fidl_fuchsia_ui_composition/
fidl_fuchsia_ui_composition.rs

1// WARNING: This file is machine generated by fidlgen.
2
3#![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_common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, PartialEq)]
15pub struct AllocatorRegisterBufferCollectionRequest {
16    pub args: RegisterBufferCollectionArgs,
17}
18
19impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
20    for AllocatorRegisterBufferCollectionRequest
21{
22}
23
24/// A typed wrapper for an eventpair, representing the registry endpoint of a buffer collection.
25#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
26pub struct BufferCollectionExportToken {
27    pub value: fidl::EventPair,
28}
29
30impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
31    for BufferCollectionExportToken
32{
33}
34
35/// A typed wrapper for an eventpair, representing the Image import endpoint of a buffer
36/// collection.
37#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
38pub struct BufferCollectionImportToken {
39    pub value: fidl::EventPair,
40}
41
42impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
43    for BufferCollectionImportToken
44{
45}
46
47#[derive(Debug, PartialEq)]
48pub struct ChildViewWatcherGetViewRefResponse {
49    pub view_ref: fidl_fuchsia_ui_views::ViewRef,
50}
51
52impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
53    for ChildViewWatcherGetViewRefResponse
54{
55}
56
57#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
58#[repr(C)]
59pub struct FlatlandCreateFilledRectRequest {
60    pub rect_id: ContentId,
61}
62
63impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
64    for FlatlandCreateFilledRectRequest
65{
66}
67
68#[derive(Debug, PartialEq)]
69pub struct FlatlandCreateImageRequest {
70    pub image_id: ContentId,
71    pub import_token: BufferCollectionImportToken,
72    pub vmo_index: u32,
73    pub properties: ImageProperties,
74}
75
76impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
77    for FlatlandCreateImageRequest
78{
79}
80
81#[derive(Debug, PartialEq)]
82pub struct FlatlandCreateView2Request {
83    /// A typed wrapper for a channel, representing the child endpoint of the connection
84    /// between two Flatland instances.
85    pub token: fidl_fuchsia_ui_views::ViewCreationToken,
86    /// The ViewRef to strongly associate with [`token`].
87    pub view_identity: fidl_fuchsia_ui_views::ViewIdentityOnCreation,
88    /// The protocol endpoints that are strongly bound to the ViewRef in [`view_identity`].
89    /// The protocols are bound when the view is created and installed in the view tree.
90    pub protocols: ViewBoundProtocols,
91    pub parent_viewport_watcher: fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>,
92}
93
94impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
95    for FlatlandCreateView2Request
96{
97}
98
99#[derive(Debug, PartialEq)]
100pub struct FlatlandCreateViewRequest {
101    pub token: fidl_fuchsia_ui_views::ViewCreationToken,
102    pub parent_viewport_watcher: fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>,
103}
104
105impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for FlatlandCreateViewRequest {}
106
107#[derive(Debug, PartialEq)]
108pub struct FlatlandCreateViewportRequest {
109    pub viewport_id: ContentId,
110    /// A typed wrapper for a channel, representing the parent endpoint of the connection
111    /// between two Flatland instances.
112    pub token: fidl_fuchsia_ui_views::ViewportCreationToken,
113    pub properties: ViewportProperties,
114    pub child_view_watcher: fidl::endpoints::ServerEnd<ChildViewWatcherMarker>,
115}
116
117impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
118    for FlatlandCreateViewportRequest
119{
120}
121
122#[derive(Debug, PartialEq)]
123pub struct FlatlandDisplaySetContentRequest {
124    pub token: fidl_fuchsia_ui_views::ViewportCreationToken,
125    pub child_view_watcher: fidl::endpoints::ServerEnd<ChildViewWatcherMarker>,
126}
127
128impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
129    for FlatlandDisplaySetContentRequest
130{
131}
132
133#[derive(Debug, PartialEq)]
134pub struct FlatlandPresentRequest {
135    pub args: PresentArgs,
136}
137
138impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for FlatlandPresentRequest {}
139
140#[derive(Debug, PartialEq)]
141pub struct FlatlandReleaseViewportResponse {
142    pub token: fidl_fuchsia_ui_views::ViewportCreationToken,
143}
144
145impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
146    for FlatlandReleaseViewportResponse
147{
148}
149
150#[derive(Debug, PartialEq)]
151pub struct FlatlandSetSolidFillRequest {
152    pub rect_id: ContentId,
153    pub color: ColorRgba,
154    pub size: fidl_fuchsia_math::SizeU,
155}
156
157impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
158    for FlatlandSetSolidFillRequest
159{
160}
161
162/// Metadata about the frame rendered by [`GetNextFrame`].
163#[derive(Debug, Default, PartialEq)]
164pub struct FrameInfo {
165    /// The index of the VMO where the requested frame has been rendered. Required.
166    pub buffer_id: Option<u32>,
167    #[doc(hidden)]
168    pub __source_breaking: fidl::marker::SourceBreaking,
169}
170
171impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for FrameInfo {}
172
173/// The arguments passed into the [`GetNextFrame`] call. All fields are necessary.
174#[derive(Debug, Default, PartialEq)]
175pub struct GetNextFrameArgs {
176    /// The event that will signal when the requested frame has been rendered. Required.
177    pub event: Option<fidl::Event>,
178    #[doc(hidden)]
179    pub __source_breaking: fidl::marker::SourceBreaking,
180}
181
182impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for GetNextFrameArgs {}
183
184/// Arguments passed into [`Present`]. All arguments are optional, and if an
185/// argument is omitted Flatland will use a reasonable default, specified below.
186#[derive(Debug, Default, PartialEq)]
187pub struct PresentArgs {
188    /// `requested_presentation_time` specifies the time on or after which the client would like the
189    /// enqueued operations to take visible effect (light up pixels on the screen), expressed in
190    /// nanoseconds in the `CLOCK_MONOTONIC` timebase.
191    ///
192    /// The default `requested_presentation_time` is 0.
193    ///
194    /// Using a `requested_presentation_time` in the present or past (such as 0) schedules enqueued
195    /// operations to take visible effect as soon as possible, during the next frame to be prepared.
196    ///
197    /// Using a `requested_presentation_time` in the future schedules the enqueued operations to
198    /// take visible effect on or as closely as possible after the stated time, but no earlier.
199    ///
200    /// Each rendered frame has a target presentation time. This is when Flatland aims to have the
201    /// frame presented to the user. Before rendering a frame, Flatland applies all
202    /// enqueued operations associated with all squashable calls to [`Present`] whose
203    /// `requested_presentation_time` is on or before the frame's target presentation time.
204    pub requested_presentation_time: Option<i64>,
205    /// Flatland will wait until all of a Flatland instance's `acquire_fences` are ready before it
206    /// will execute the presented commands. Not signaling `acquire_fences` will block the current
207    /// [`Present`] as well as the following ones even if their `acquire_fences` are signaled.
208    ///
209    /// The default `acquire_fences` value is the empty vector.
210    pub acquire_fences: Option<Vec<fidl::Event>>,
211    /// Flatland will signal all `release_fences` when it is safe to reuse resources which no longer
212    /// appear in the local scene graph at the time of the current [`Present`].  At the latest, this
213    /// will happen when the local scene graph (checkpointed at this [`Present`]) has been
214    /// integrated into the global scene graph, and the global scene has been displayed on screen.
215    ///
216    /// (Under some circumstances, the fences may be signaled earlier, but clients do not need to
217    /// worry about this: the fences will only be signaled when it is safe to reuse the associated
218    /// resources).
219    ///
220    /// These fences are intended to manage the reuse of shared memory resources such as sysmem
221    /// buffers.  For example, it is undesirable for the client to render into an image which is
222    /// currently displayed on screen, because this may result in graphical artifacts such as
223    /// tearing.
224    ///
225    /// It is up to the client to maintain the mapping between each fence and the resources which
226    /// will become reusable when the fence is signaled.  A common strategy is to keep track of
227    /// resources which were used by the previous [`Present`] but are no longer used by the current
228    /// [`Present`].  For example, if an image is removed from the scene by the current [`Present`],
229    /// the client would insert a fence here.  When the fence is later signaled, the client knows
230    /// that it is safe to render into the image and insert it into the local scene graph in a
231    /// subsequent [`Present`].
232    ///
233    /// If an error occurs, Flatland may close the channel without signaling these fences.  Clients
234    /// may immediately release shared buffers, but they should not immediately modify such buffers,
235    /// because they may still be displayed on screen.  There is currently no good signal available
236    /// to the client about when it is safe to reuse shared buffers.
237    ///
238    /// The default `release_fences` value is the empty vector.
239    pub release_fences: Option<Vec<fidl::Event>>,
240    /// If `unsquashable` is true, then the update is guaranteed to be uniquely shown for at
241    /// least one vsync interval.
242    ///
243    /// If `unsquashable` is false, then the update can be combined with those that come after
244    /// it.
245    ///
246    /// If absent, `unsquashable` is false.
247    pub unsquashable: Option<bool>,
248    /// Unused.  Originally intended to be a renaming of `acquire_fences`, but was never hooked up.
249    pub server_wait_fences: Option<Vec<fidl::Event>>,
250    /// Unused.  Originally intended to be a renaming of `release_fences`, but was never hooked up.
251    pub server_signal_fences: Option<Vec<fidl::Event>>,
252    #[doc(hidden)]
253    pub __source_breaking: fidl::marker::SourceBreaking,
254}
255
256impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for PresentArgs {}
257
258/// The table of arguments for [`RegisterBufferCollection`]. Note that some
259/// fields below are REQUIRED.
260#[derive(Debug, Default, PartialEq)]
261pub struct RegisterBufferCollectionArgs {
262    /// Clients can send [`export_token`] to register buffer collections with Allocator to be used
263    /// later in [`fuchsia.ui.composition/Flatland`] instances or other Scenic APIs, such as
264    /// Screenshot.
265    ///
266    /// For example, by passing a [`BufferCollectionImportToken`] containing the matching peer of
267    /// [`BufferCollectionExportToken`], they can create image resources via
268    /// [`fuchsia.ui.composition/Flatland.CreateImage`].
269    ///
270    /// Clients should wait for the response before using `import_token`.
271    ///
272    /// This field is REQUIRED.
273    pub export_token: Option<BufferCollectionExportToken>,
274    pub buffer_collection_token:
275        Option<fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem::BufferCollectionTokenMarker>>,
276    /// The client can register a buffer collection for various uses, each
277    /// coming with their own unique constraints.
278    ///
279    /// This field is OPTIONAL. If `usage` is omitted it will be treated as if
280    /// it has the DEFAULT option.
281    ///
282    /// # Deprecation
283    ///
284    /// This arg is deprecated at API version 9 with addition of |usages|.
285    ///
286    /// If both the `usages` and `usage` fields are set, `usages` takes precedence and `usage` is
287    /// ignored.
288    pub usage: Option<RegisterBufferCollectionUsage>,
289    /// The client can register a buffer collection for various uses and has the ability to
290    /// combine usages if multiple are needed.
291    ///
292    /// This field is OPTIONAL. If `usages` is omitted it will be treated as if
293    /// it has only the DEFAULT option.
294    pub usages: Option<RegisterBufferCollectionUsages>,
295    /// Flatland participates in the allocation of buffers by setting constraints on the
296    /// BufferCollection referenced by `buffer_collection_token`. It will not block on buffers
297    /// being allocated until the client creates content using the BufferCollection.
298    ///
299    /// The buffer collection registered with `export_token` is available and kept alive as long
300    /// as the client holds a valid [`BufferCollectionImportToken`]. They will be garbage collected
301    /// when all [`BufferCollectionImportToken`]s are closed and all the associated Image resources
302    /// are released.
303    ///
304    /// Exactly one of `buffer_collection_token2` / `buffer_collection_token` must be set.
305    pub buffer_collection_token2:
306        Option<fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem2::BufferCollectionTokenMarker>>,
307    #[doc(hidden)]
308    pub __source_breaking: fidl::marker::SourceBreaking,
309}
310
311impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
312    for RegisterBufferCollectionArgs
313{
314}
315
316/// The arguments passed into the [`Configure`] call. Note that not all fields are necessary.
317#[derive(Debug, Default, PartialEq)]
318pub struct ScreenCaptureConfig {
319    /// The import token referencing a BufferCollection registered with
320    /// Allocator. Required.
321    pub import_token: Option<BufferCollectionImportToken>,
322    /// The size of the image in pixels. Required.
323    pub size: Option<fidl_fuchsia_math::SizeU>,
324    /// The number of buffers in the BufferCollection. Required.
325    pub buffer_count: Option<u32>,
326    /// The rotation to be applied to the stream of images. Optional; if absent no rotation is
327    /// applied.
328    pub rotation: Option<Rotation>,
329    #[doc(hidden)]
330    pub __source_breaking: fidl::marker::SourceBreaking,
331}
332
333impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for ScreenCaptureConfig {}
334
335#[derive(Debug, Default, PartialEq)]
336pub struct ScreenshotTakeFileRequest {
337    /// Format of the requested screenshot.
338    pub format: Option<ScreenshotFormat>,
339    #[doc(hidden)]
340    pub __source_breaking: fidl::marker::SourceBreaking,
341}
342
343impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for ScreenshotTakeFileRequest {}
344
345#[derive(Debug, Default, PartialEq)]
346pub struct ScreenshotTakeFileResponse {
347    /// |fuchsia.io.File| channel used to read the generated screenshot file data.
348    /// The server side of the channel is stored on the device until ZX_CHANNEL_PEER_CLOSED
349    /// is detected.
350    ///
351    /// Basic usage: After the client recieves the client end of the file channel,
352    /// to avoid memory pile-ups, it should finish reading the data
353    /// before calling [`TakeFile`] again. When finished reading,
354    /// the client should call [`Close`] on the |fuchsia.io.File| channel, this will release
355    /// the memory allocated on the server side.
356    pub file: Option<fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>>,
357    /// Size of the screenshot in pixels.
358    pub size: Option<fidl_fuchsia_math::SizeU>,
359    #[doc(hidden)]
360    pub __source_breaking: fidl::marker::SourceBreaking,
361}
362
363impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
364    for ScreenshotTakeFileResponse
365{
366}
367
368#[derive(Debug, Default, PartialEq)]
369pub struct ScreenshotTakeRequest {
370    /// Format of the requested screenshot.
371    pub format: Option<ScreenshotFormat>,
372    #[doc(hidden)]
373    pub __source_breaking: fidl::marker::SourceBreaking,
374}
375
376impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for ScreenshotTakeRequest {}
377
378#[derive(Debug, Default, PartialEq)]
379pub struct ScreenshotTakeResponse {
380    /// CPU mappable read-only VMO that contains screenshot data. The server owns the VMO and
381    /// may reuse for the next [`Take`]. The VMO is guaranteed to be accessible after mapping.
382    /// In some allocations, VMO::read() might not be available, i.e. on emulator.
383    ///
384    /// Basic usage: After the client receives a VMO handle, to ensure data stability, it should
385    /// finish reading the VMO before calling [`Take`] again. When finished reading, the client
386    /// should drop the VMO handle.
387    ///
388    /// Advanced usage: To edit the data, or to persist it beyond the next [`Take`] call, the
389    /// client should copy the data to a private VMO.
390    pub vmo: Option<fidl::Vmo>,
391    /// Size of the screenshot in pixels.
392    pub size: Option<fidl_fuchsia_math::SizeU>,
393    #[doc(hidden)]
394    pub __source_breaking: fidl::marker::SourceBreaking,
395}
396
397impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for ScreenshotTakeResponse {}
398
399/// The protocol endpoints bound to a Flatland ViewCreationToken. These protocols operate on the
400/// View that ViewCreationToken created in the Flatland session.
401#[derive(Debug, Default, PartialEq)]
402pub struct ViewBoundProtocols {
403    /// Learn when a View gains focus.
404    ///
405    /// Server-bound ViewRef. The [`view_ref_focused`] client does not specify the ViewRef
406    /// explicitly; instead, the server implementation uses the ViewRef used in View creation for
407    /// reporting focus movement on/off this View.
408    pub view_ref_focused:
409        Option<fidl::endpoints::ServerEnd<fidl_fuchsia_ui_views::ViewRefFocusedMarker>>,
410    /// Enable a View to request focus transfer to a child (target) View.
411    ///
412    /// Server-bound ViewRef. The [`view_focuser`] client does not specify the "requestor" ViewRef
413    /// explicitly, only the "target" ViewRef. Instead, the server implementation uses the ViewRef
414    /// used in View creation as the "requestor" ViewRef.
415    pub view_focuser: Option<fidl::endpoints::ServerEnd<fidl_fuchsia_ui_views::FocuserMarker>>,
416    /// Receive touch events that are associated with a View.
417    pub touch_source:
418        Option<fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::TouchSourceMarker>>,
419    /// Receive mouse events that are associated with a View.
420    pub mouse_source:
421        Option<fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::MouseSourceMarker>>,
422    #[doc(hidden)]
423    pub __source_breaking: fidl::marker::SourceBreaking,
424}
425
426impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for ViewBoundProtocols {}
427
428#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
429pub struct AllocatorMarker;
430
431impl fidl::endpoints::ProtocolMarker for AllocatorMarker {
432    type Proxy = AllocatorProxy;
433    type RequestStream = AllocatorRequestStream;
434    #[cfg(target_os = "fuchsia")]
435    type SynchronousProxy = AllocatorSynchronousProxy;
436
437    const DEBUG_NAME: &'static str = "fuchsia.ui.composition.Allocator";
438}
439impl fidl::endpoints::DiscoverableProtocolMarker for AllocatorMarker {}
440pub type AllocatorRegisterBufferCollectionResult = Result<(), RegisterBufferCollectionError>;
441
442pub trait AllocatorProxyInterface: Send + Sync {
443    type RegisterBufferCollectionResponseFut: std::future::Future<Output = Result<AllocatorRegisterBufferCollectionResult, fidl::Error>>
444        + Send;
445    fn r#register_buffer_collection(
446        &self,
447        args: RegisterBufferCollectionArgs,
448    ) -> Self::RegisterBufferCollectionResponseFut;
449}
450#[derive(Debug)]
451#[cfg(target_os = "fuchsia")]
452pub struct AllocatorSynchronousProxy {
453    client: fidl::client::sync::Client,
454}
455
456#[cfg(target_os = "fuchsia")]
457impl fidl::endpoints::SynchronousProxy for AllocatorSynchronousProxy {
458    type Proxy = AllocatorProxy;
459    type Protocol = AllocatorMarker;
460
461    fn from_channel(inner: fidl::Channel) -> Self {
462        Self::new(inner)
463    }
464
465    fn into_channel(self) -> fidl::Channel {
466        self.client.into_channel()
467    }
468
469    fn as_channel(&self) -> &fidl::Channel {
470        self.client.as_channel()
471    }
472}
473
474#[cfg(target_os = "fuchsia")]
475impl AllocatorSynchronousProxy {
476    pub fn new(channel: fidl::Channel) -> Self {
477        let protocol_name = <AllocatorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
478        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
479    }
480
481    pub fn into_channel(self) -> fidl::Channel {
482        self.client.into_channel()
483    }
484
485    /// Waits until an event arrives and returns it. It is safe for other
486    /// threads to make concurrent requests while waiting for an event.
487    pub fn wait_for_event(
488        &self,
489        deadline: zx::MonotonicInstant,
490    ) -> Result<AllocatorEvent, fidl::Error> {
491        AllocatorEvent::decode(self.client.wait_for_event(deadline)?)
492    }
493
494    /// A BufferCollection is a set of VMOs created by Sysmem and shared by a number of
495    /// participants, one of which is the Flatland Renderer. Some content, such as Images, use a
496    /// BufferCollection as their backing memory.
497    ///
498    /// See [`RegisterBufferCollectionArgs`] for information on each argument.
499    pub fn r#register_buffer_collection(
500        &self,
501        mut args: RegisterBufferCollectionArgs,
502        ___deadline: zx::MonotonicInstant,
503    ) -> Result<AllocatorRegisterBufferCollectionResult, fidl::Error> {
504        let _response = self
505            .client
506            .send_query::<AllocatorRegisterBufferCollectionRequest, fidl::encoding::ResultType<
507                fidl::encoding::EmptyStruct,
508                RegisterBufferCollectionError,
509            >>(
510                (&mut args,),
511                0x494b7ea578d1061e,
512                fidl::encoding::DynamicFlags::empty(),
513                ___deadline,
514            )?;
515        Ok(_response.map(|x| x))
516    }
517}
518
519#[cfg(target_os = "fuchsia")]
520impl From<AllocatorSynchronousProxy> for zx::Handle {
521    fn from(value: AllocatorSynchronousProxy) -> Self {
522        value.into_channel().into()
523    }
524}
525
526#[cfg(target_os = "fuchsia")]
527impl From<fidl::Channel> for AllocatorSynchronousProxy {
528    fn from(value: fidl::Channel) -> Self {
529        Self::new(value)
530    }
531}
532
533#[derive(Debug, Clone)]
534pub struct AllocatorProxy {
535    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
536}
537
538impl fidl::endpoints::Proxy for AllocatorProxy {
539    type Protocol = AllocatorMarker;
540
541    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
542        Self::new(inner)
543    }
544
545    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
546        self.client.into_channel().map_err(|client| Self { client })
547    }
548
549    fn as_channel(&self) -> &::fidl::AsyncChannel {
550        self.client.as_channel()
551    }
552}
553
554impl AllocatorProxy {
555    /// Create a new Proxy for fuchsia.ui.composition/Allocator.
556    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
557        let protocol_name = <AllocatorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
558        Self { client: fidl::client::Client::new(channel, protocol_name) }
559    }
560
561    /// Get a Stream of events from the remote end of the protocol.
562    ///
563    /// # Panics
564    ///
565    /// Panics if the event stream was already taken.
566    pub fn take_event_stream(&self) -> AllocatorEventStream {
567        AllocatorEventStream { event_receiver: self.client.take_event_receiver() }
568    }
569
570    /// A BufferCollection is a set of VMOs created by Sysmem and shared by a number of
571    /// participants, one of which is the Flatland Renderer. Some content, such as Images, use a
572    /// BufferCollection as their backing memory.
573    ///
574    /// See [`RegisterBufferCollectionArgs`] for information on each argument.
575    pub fn r#register_buffer_collection(
576        &self,
577        mut args: RegisterBufferCollectionArgs,
578    ) -> fidl::client::QueryResponseFut<
579        AllocatorRegisterBufferCollectionResult,
580        fidl::encoding::DefaultFuchsiaResourceDialect,
581    > {
582        AllocatorProxyInterface::r#register_buffer_collection(self, args)
583    }
584}
585
586impl AllocatorProxyInterface for AllocatorProxy {
587    type RegisterBufferCollectionResponseFut = fidl::client::QueryResponseFut<
588        AllocatorRegisterBufferCollectionResult,
589        fidl::encoding::DefaultFuchsiaResourceDialect,
590    >;
591    fn r#register_buffer_collection(
592        &self,
593        mut args: RegisterBufferCollectionArgs,
594    ) -> Self::RegisterBufferCollectionResponseFut {
595        fn _decode(
596            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
597        ) -> Result<AllocatorRegisterBufferCollectionResult, fidl::Error> {
598            let _response = fidl::client::decode_transaction_body::<
599                fidl::encoding::ResultType<
600                    fidl::encoding::EmptyStruct,
601                    RegisterBufferCollectionError,
602                >,
603                fidl::encoding::DefaultFuchsiaResourceDialect,
604                0x494b7ea578d1061e,
605            >(_buf?)?;
606            Ok(_response.map(|x| x))
607        }
608        self.client.send_query_and_decode::<
609            AllocatorRegisterBufferCollectionRequest,
610            AllocatorRegisterBufferCollectionResult,
611        >(
612            (&mut args,),
613            0x494b7ea578d1061e,
614            fidl::encoding::DynamicFlags::empty(),
615            _decode,
616        )
617    }
618}
619
620pub struct AllocatorEventStream {
621    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
622}
623
624impl std::marker::Unpin for AllocatorEventStream {}
625
626impl futures::stream::FusedStream for AllocatorEventStream {
627    fn is_terminated(&self) -> bool {
628        self.event_receiver.is_terminated()
629    }
630}
631
632impl futures::Stream for AllocatorEventStream {
633    type Item = Result<AllocatorEvent, fidl::Error>;
634
635    fn poll_next(
636        mut self: std::pin::Pin<&mut Self>,
637        cx: &mut std::task::Context<'_>,
638    ) -> std::task::Poll<Option<Self::Item>> {
639        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
640            &mut self.event_receiver,
641            cx
642        )?) {
643            Some(buf) => std::task::Poll::Ready(Some(AllocatorEvent::decode(buf))),
644            None => std::task::Poll::Ready(None),
645        }
646    }
647}
648
649#[derive(Debug)]
650pub enum AllocatorEvent {}
651
652impl AllocatorEvent {
653    /// Decodes a message buffer as a [`AllocatorEvent`].
654    fn decode(
655        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
656    ) -> Result<AllocatorEvent, fidl::Error> {
657        let (bytes, _handles) = buf.split_mut();
658        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
659        debug_assert_eq!(tx_header.tx_id, 0);
660        match tx_header.ordinal {
661            _ => Err(fidl::Error::UnknownOrdinal {
662                ordinal: tx_header.ordinal,
663                protocol_name: <AllocatorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
664            }),
665        }
666    }
667}
668
669/// A Stream of incoming requests for fuchsia.ui.composition/Allocator.
670pub struct AllocatorRequestStream {
671    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
672    is_terminated: bool,
673}
674
675impl std::marker::Unpin for AllocatorRequestStream {}
676
677impl futures::stream::FusedStream for AllocatorRequestStream {
678    fn is_terminated(&self) -> bool {
679        self.is_terminated
680    }
681}
682
683impl fidl::endpoints::RequestStream for AllocatorRequestStream {
684    type Protocol = AllocatorMarker;
685    type ControlHandle = AllocatorControlHandle;
686
687    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
688        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
689    }
690
691    fn control_handle(&self) -> Self::ControlHandle {
692        AllocatorControlHandle { inner: self.inner.clone() }
693    }
694
695    fn into_inner(
696        self,
697    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
698    {
699        (self.inner, self.is_terminated)
700    }
701
702    fn from_inner(
703        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
704        is_terminated: bool,
705    ) -> Self {
706        Self { inner, is_terminated }
707    }
708}
709
710impl futures::Stream for AllocatorRequestStream {
711    type Item = Result<AllocatorRequest, fidl::Error>;
712
713    fn poll_next(
714        mut self: std::pin::Pin<&mut Self>,
715        cx: &mut std::task::Context<'_>,
716    ) -> std::task::Poll<Option<Self::Item>> {
717        let this = &mut *self;
718        if this.inner.check_shutdown(cx) {
719            this.is_terminated = true;
720            return std::task::Poll::Ready(None);
721        }
722        if this.is_terminated {
723            panic!("polled AllocatorRequestStream after completion");
724        }
725        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
726            |bytes, handles| {
727                match this.inner.channel().read_etc(cx, bytes, handles) {
728                    std::task::Poll::Ready(Ok(())) => {}
729                    std::task::Poll::Pending => return std::task::Poll::Pending,
730                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
731                        this.is_terminated = true;
732                        return std::task::Poll::Ready(None);
733                    }
734                    std::task::Poll::Ready(Err(e)) => {
735                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
736                            e.into(),
737                        ))))
738                    }
739                }
740
741                // A message has been received from the channel
742                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
743
744                std::task::Poll::Ready(Some(match header.ordinal {
745                    0x494b7ea578d1061e => {
746                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
747                        let mut req = fidl::new_empty!(
748                            AllocatorRegisterBufferCollectionRequest,
749                            fidl::encoding::DefaultFuchsiaResourceDialect
750                        );
751                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AllocatorRegisterBufferCollectionRequest>(&header, _body_bytes, handles, &mut req)?;
752                        let control_handle = AllocatorControlHandle { inner: this.inner.clone() };
753                        Ok(AllocatorRequest::RegisterBufferCollection {
754                            args: req.args,
755
756                            responder: AllocatorRegisterBufferCollectionResponder {
757                                control_handle: std::mem::ManuallyDrop::new(control_handle),
758                                tx_id: header.tx_id,
759                            },
760                        })
761                    }
762                    _ => Err(fidl::Error::UnknownOrdinal {
763                        ordinal: header.ordinal,
764                        protocol_name:
765                            <AllocatorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
766                    }),
767                }))
768            },
769        )
770    }
771}
772
773#[derive(Debug)]
774pub enum AllocatorRequest {
775    /// A BufferCollection is a set of VMOs created by Sysmem and shared by a number of
776    /// participants, one of which is the Flatland Renderer. Some content, such as Images, use a
777    /// BufferCollection as their backing memory.
778    ///
779    /// See [`RegisterBufferCollectionArgs`] for information on each argument.
780    RegisterBufferCollection {
781        args: RegisterBufferCollectionArgs,
782        responder: AllocatorRegisterBufferCollectionResponder,
783    },
784}
785
786impl AllocatorRequest {
787    #[allow(irrefutable_let_patterns)]
788    pub fn into_register_buffer_collection(
789        self,
790    ) -> Option<(RegisterBufferCollectionArgs, AllocatorRegisterBufferCollectionResponder)> {
791        if let AllocatorRequest::RegisterBufferCollection { args, responder } = self {
792            Some((args, responder))
793        } else {
794            None
795        }
796    }
797
798    /// Name of the method defined in FIDL
799    pub fn method_name(&self) -> &'static str {
800        match *self {
801            AllocatorRequest::RegisterBufferCollection { .. } => "register_buffer_collection",
802        }
803    }
804}
805
806#[derive(Debug, Clone)]
807pub struct AllocatorControlHandle {
808    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
809}
810
811impl fidl::endpoints::ControlHandle for AllocatorControlHandle {
812    fn shutdown(&self) {
813        self.inner.shutdown()
814    }
815    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
816        self.inner.shutdown_with_epitaph(status)
817    }
818
819    fn is_closed(&self) -> bool {
820        self.inner.channel().is_closed()
821    }
822    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
823        self.inner.channel().on_closed()
824    }
825
826    #[cfg(target_os = "fuchsia")]
827    fn signal_peer(
828        &self,
829        clear_mask: zx::Signals,
830        set_mask: zx::Signals,
831    ) -> Result<(), zx_status::Status> {
832        use fidl::Peered;
833        self.inner.channel().signal_peer(clear_mask, set_mask)
834    }
835}
836
837impl AllocatorControlHandle {}
838
839#[must_use = "FIDL methods require a response to be sent"]
840#[derive(Debug)]
841pub struct AllocatorRegisterBufferCollectionResponder {
842    control_handle: std::mem::ManuallyDrop<AllocatorControlHandle>,
843    tx_id: u32,
844}
845
846/// Set the the channel to be shutdown (see [`AllocatorControlHandle::shutdown`])
847/// if the responder is dropped without sending a response, so that the client
848/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
849impl std::ops::Drop for AllocatorRegisterBufferCollectionResponder {
850    fn drop(&mut self) {
851        self.control_handle.shutdown();
852        // Safety: drops once, never accessed again
853        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
854    }
855}
856
857impl fidl::endpoints::Responder for AllocatorRegisterBufferCollectionResponder {
858    type ControlHandle = AllocatorControlHandle;
859
860    fn control_handle(&self) -> &AllocatorControlHandle {
861        &self.control_handle
862    }
863
864    fn drop_without_shutdown(mut self) {
865        // Safety: drops once, never accessed again due to mem::forget
866        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
867        // Prevent Drop from running (which would shut down the channel)
868        std::mem::forget(self);
869    }
870}
871
872impl AllocatorRegisterBufferCollectionResponder {
873    /// Sends a response to the FIDL transaction.
874    ///
875    /// Sets the channel to shutdown if an error occurs.
876    pub fn send(
877        self,
878        mut result: Result<(), RegisterBufferCollectionError>,
879    ) -> Result<(), fidl::Error> {
880        let _result = self.send_raw(result);
881        if _result.is_err() {
882            self.control_handle.shutdown();
883        }
884        self.drop_without_shutdown();
885        _result
886    }
887
888    /// Similar to "send" but does not shutdown the channel if an error occurs.
889    pub fn send_no_shutdown_on_err(
890        self,
891        mut result: Result<(), RegisterBufferCollectionError>,
892    ) -> Result<(), fidl::Error> {
893        let _result = self.send_raw(result);
894        self.drop_without_shutdown();
895        _result
896    }
897
898    fn send_raw(
899        &self,
900        mut result: Result<(), RegisterBufferCollectionError>,
901    ) -> Result<(), fidl::Error> {
902        self.control_handle.inner.send::<fidl::encoding::ResultType<
903            fidl::encoding::EmptyStruct,
904            RegisterBufferCollectionError,
905        >>(
906            result,
907            self.tx_id,
908            0x494b7ea578d1061e,
909            fidl::encoding::DynamicFlags::empty(),
910        )
911    }
912}
913
914#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
915pub struct ChildViewWatcherMarker;
916
917impl fidl::endpoints::ProtocolMarker for ChildViewWatcherMarker {
918    type Proxy = ChildViewWatcherProxy;
919    type RequestStream = ChildViewWatcherRequestStream;
920    #[cfg(target_os = "fuchsia")]
921    type SynchronousProxy = ChildViewWatcherSynchronousProxy;
922
923    const DEBUG_NAME: &'static str = "(anonymous) ChildViewWatcher";
924}
925
926pub trait ChildViewWatcherProxyInterface: Send + Sync {
927    type GetStatusResponseFut: std::future::Future<Output = Result<ChildViewStatus, fidl::Error>>
928        + Send;
929    fn r#get_status(&self) -> Self::GetStatusResponseFut;
930    type GetViewRefResponseFut: std::future::Future<Output = Result<fidl_fuchsia_ui_views::ViewRef, fidl::Error>>
931        + Send;
932    fn r#get_view_ref(&self) -> Self::GetViewRefResponseFut;
933}
934#[derive(Debug)]
935#[cfg(target_os = "fuchsia")]
936pub struct ChildViewWatcherSynchronousProxy {
937    client: fidl::client::sync::Client,
938}
939
940#[cfg(target_os = "fuchsia")]
941impl fidl::endpoints::SynchronousProxy for ChildViewWatcherSynchronousProxy {
942    type Proxy = ChildViewWatcherProxy;
943    type Protocol = ChildViewWatcherMarker;
944
945    fn from_channel(inner: fidl::Channel) -> Self {
946        Self::new(inner)
947    }
948
949    fn into_channel(self) -> fidl::Channel {
950        self.client.into_channel()
951    }
952
953    fn as_channel(&self) -> &fidl::Channel {
954        self.client.as_channel()
955    }
956}
957
958#[cfg(target_os = "fuchsia")]
959impl ChildViewWatcherSynchronousProxy {
960    pub fn new(channel: fidl::Channel) -> Self {
961        let protocol_name = <ChildViewWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
962        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
963    }
964
965    pub fn into_channel(self) -> fidl::Channel {
966        self.client.into_channel()
967    }
968
969    /// Waits until an event arrives and returns it. It is safe for other
970    /// threads to make concurrent requests while waiting for an event.
971    pub fn wait_for_event(
972        &self,
973        deadline: zx::MonotonicInstant,
974    ) -> Result<ChildViewWatcherEvent, fidl::Error> {
975        ChildViewWatcherEvent::decode(self.client.wait_for_event(deadline)?)
976    }
977
978    /// A hanging get for receiving the status of a View. This provides information to the parent,
979    /// such as whether or not the child has successfully presented content through this View.
980    ///
981    /// This hanging get will only fire when the ChildViewStatus is different than the previously
982    /// returned ChildViewStatus.  This can happen immediately, and even if the creator of the
983    /// Viewport hasn't yet called Present() after calling CreateViewport().  This allows the parent
984    /// to know that the child has content ready to display before the parent modifies their own
985    /// local scene graph to incorporate the child content.
986    ///
987    /// It is invalid to call `GetStatus` while a previous call is still pending. Doing so will
988    /// cause both this channel and the Flatland channel that handed out ChildViewWatcher to be
989    /// closed.
990    pub fn r#get_status(
991        &self,
992        ___deadline: zx::MonotonicInstant,
993    ) -> Result<ChildViewStatus, fidl::Error> {
994        let _response = self
995            .client
996            .send_query::<fidl::encoding::EmptyPayload, ChildViewWatcherGetStatusResponse>(
997                (),
998                0x1d622075f4fc8243,
999                fidl::encoding::DynamicFlags::empty(),
1000                ___deadline,
1001            )?;
1002        Ok(_response.status)
1003    }
1004
1005    /// Hanging get to receive the ViewRef of the child View. This will only fire when the View ref
1006    /// is different from the previously-returned View ref. Note: currently the View ref will not
1007    /// change after it is first received, but this will change if/when the API changes to allow
1008    /// relinking of views.
1009    ///
1010    /// The ViewRef is not returned until the View is included in the View tree, in other words when
1011    /// there is a chain of ancestor transforms all the way back up to the root of the scene graph,
1012    /// i.e. the display.
1013    ///
1014    /// It is invalid to call `GetViewRef` while a previous call is still pending. Doing so will
1015    /// cause both this channel and the Flatland channel that handed out ChildViewWatcher to be
1016    /// closed.
1017    ///
1018    /// A `GetViewRef` call will hang if the View was created using `CreateView`, but returns the
1019    /// View if the View was created using CreateView2. This is because `CreateView` does not mint
1020    /// a ViewRef for that View.
1021    pub fn r#get_view_ref(
1022        &self,
1023        ___deadline: zx::MonotonicInstant,
1024    ) -> Result<fidl_fuchsia_ui_views::ViewRef, fidl::Error> {
1025        let _response = self
1026            .client
1027            .send_query::<fidl::encoding::EmptyPayload, ChildViewWatcherGetViewRefResponse>(
1028                (),
1029                0x3b2f3ca31e8908b4,
1030                fidl::encoding::DynamicFlags::empty(),
1031                ___deadline,
1032            )?;
1033        Ok(_response.view_ref)
1034    }
1035}
1036
1037#[cfg(target_os = "fuchsia")]
1038impl From<ChildViewWatcherSynchronousProxy> for zx::Handle {
1039    fn from(value: ChildViewWatcherSynchronousProxy) -> Self {
1040        value.into_channel().into()
1041    }
1042}
1043
1044#[cfg(target_os = "fuchsia")]
1045impl From<fidl::Channel> for ChildViewWatcherSynchronousProxy {
1046    fn from(value: fidl::Channel) -> Self {
1047        Self::new(value)
1048    }
1049}
1050
1051#[derive(Debug, Clone)]
1052pub struct ChildViewWatcherProxy {
1053    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1054}
1055
1056impl fidl::endpoints::Proxy for ChildViewWatcherProxy {
1057    type Protocol = ChildViewWatcherMarker;
1058
1059    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1060        Self::new(inner)
1061    }
1062
1063    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1064        self.client.into_channel().map_err(|client| Self { client })
1065    }
1066
1067    fn as_channel(&self) -> &::fidl::AsyncChannel {
1068        self.client.as_channel()
1069    }
1070}
1071
1072impl ChildViewWatcherProxy {
1073    /// Create a new Proxy for fuchsia.ui.composition/ChildViewWatcher.
1074    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1075        let protocol_name = <ChildViewWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1076        Self { client: fidl::client::Client::new(channel, protocol_name) }
1077    }
1078
1079    /// Get a Stream of events from the remote end of the protocol.
1080    ///
1081    /// # Panics
1082    ///
1083    /// Panics if the event stream was already taken.
1084    pub fn take_event_stream(&self) -> ChildViewWatcherEventStream {
1085        ChildViewWatcherEventStream { event_receiver: self.client.take_event_receiver() }
1086    }
1087
1088    /// A hanging get for receiving the status of a View. This provides information to the parent,
1089    /// such as whether or not the child has successfully presented content through this View.
1090    ///
1091    /// This hanging get will only fire when the ChildViewStatus is different than the previously
1092    /// returned ChildViewStatus.  This can happen immediately, and even if the creator of the
1093    /// Viewport hasn't yet called Present() after calling CreateViewport().  This allows the parent
1094    /// to know that the child has content ready to display before the parent modifies their own
1095    /// local scene graph to incorporate the child content.
1096    ///
1097    /// It is invalid to call `GetStatus` while a previous call is still pending. Doing so will
1098    /// cause both this channel and the Flatland channel that handed out ChildViewWatcher to be
1099    /// closed.
1100    pub fn r#get_status(
1101        &self,
1102    ) -> fidl::client::QueryResponseFut<
1103        ChildViewStatus,
1104        fidl::encoding::DefaultFuchsiaResourceDialect,
1105    > {
1106        ChildViewWatcherProxyInterface::r#get_status(self)
1107    }
1108
1109    /// Hanging get to receive the ViewRef of the child View. This will only fire when the View ref
1110    /// is different from the previously-returned View ref. Note: currently the View ref will not
1111    /// change after it is first received, but this will change if/when the API changes to allow
1112    /// relinking of views.
1113    ///
1114    /// The ViewRef is not returned until the View is included in the View tree, in other words when
1115    /// there is a chain of ancestor transforms all the way back up to the root of the scene graph,
1116    /// i.e. the display.
1117    ///
1118    /// It is invalid to call `GetViewRef` while a previous call is still pending. Doing so will
1119    /// cause both this channel and the Flatland channel that handed out ChildViewWatcher to be
1120    /// closed.
1121    ///
1122    /// A `GetViewRef` call will hang if the View was created using `CreateView`, but returns the
1123    /// View if the View was created using CreateView2. This is because `CreateView` does not mint
1124    /// a ViewRef for that View.
1125    pub fn r#get_view_ref(
1126        &self,
1127    ) -> fidl::client::QueryResponseFut<
1128        fidl_fuchsia_ui_views::ViewRef,
1129        fidl::encoding::DefaultFuchsiaResourceDialect,
1130    > {
1131        ChildViewWatcherProxyInterface::r#get_view_ref(self)
1132    }
1133}
1134
1135impl ChildViewWatcherProxyInterface for ChildViewWatcherProxy {
1136    type GetStatusResponseFut = fidl::client::QueryResponseFut<
1137        ChildViewStatus,
1138        fidl::encoding::DefaultFuchsiaResourceDialect,
1139    >;
1140    fn r#get_status(&self) -> Self::GetStatusResponseFut {
1141        fn _decode(
1142            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1143        ) -> Result<ChildViewStatus, fidl::Error> {
1144            let _response = fidl::client::decode_transaction_body::<
1145                ChildViewWatcherGetStatusResponse,
1146                fidl::encoding::DefaultFuchsiaResourceDialect,
1147                0x1d622075f4fc8243,
1148            >(_buf?)?;
1149            Ok(_response.status)
1150        }
1151        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ChildViewStatus>(
1152            (),
1153            0x1d622075f4fc8243,
1154            fidl::encoding::DynamicFlags::empty(),
1155            _decode,
1156        )
1157    }
1158
1159    type GetViewRefResponseFut = fidl::client::QueryResponseFut<
1160        fidl_fuchsia_ui_views::ViewRef,
1161        fidl::encoding::DefaultFuchsiaResourceDialect,
1162    >;
1163    fn r#get_view_ref(&self) -> Self::GetViewRefResponseFut {
1164        fn _decode(
1165            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1166        ) -> Result<fidl_fuchsia_ui_views::ViewRef, fidl::Error> {
1167            let _response = fidl::client::decode_transaction_body::<
1168                ChildViewWatcherGetViewRefResponse,
1169                fidl::encoding::DefaultFuchsiaResourceDialect,
1170                0x3b2f3ca31e8908b4,
1171            >(_buf?)?;
1172            Ok(_response.view_ref)
1173        }
1174        self.client
1175            .send_query_and_decode::<fidl::encoding::EmptyPayload, fidl_fuchsia_ui_views::ViewRef>(
1176                (),
1177                0x3b2f3ca31e8908b4,
1178                fidl::encoding::DynamicFlags::empty(),
1179                _decode,
1180            )
1181    }
1182}
1183
1184pub struct ChildViewWatcherEventStream {
1185    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1186}
1187
1188impl std::marker::Unpin for ChildViewWatcherEventStream {}
1189
1190impl futures::stream::FusedStream for ChildViewWatcherEventStream {
1191    fn is_terminated(&self) -> bool {
1192        self.event_receiver.is_terminated()
1193    }
1194}
1195
1196impl futures::Stream for ChildViewWatcherEventStream {
1197    type Item = Result<ChildViewWatcherEvent, fidl::Error>;
1198
1199    fn poll_next(
1200        mut self: std::pin::Pin<&mut Self>,
1201        cx: &mut std::task::Context<'_>,
1202    ) -> std::task::Poll<Option<Self::Item>> {
1203        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1204            &mut self.event_receiver,
1205            cx
1206        )?) {
1207            Some(buf) => std::task::Poll::Ready(Some(ChildViewWatcherEvent::decode(buf))),
1208            None => std::task::Poll::Ready(None),
1209        }
1210    }
1211}
1212
1213#[derive(Debug)]
1214pub enum ChildViewWatcherEvent {}
1215
1216impl ChildViewWatcherEvent {
1217    /// Decodes a message buffer as a [`ChildViewWatcherEvent`].
1218    fn decode(
1219        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1220    ) -> Result<ChildViewWatcherEvent, fidl::Error> {
1221        let (bytes, _handles) = buf.split_mut();
1222        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1223        debug_assert_eq!(tx_header.tx_id, 0);
1224        match tx_header.ordinal {
1225            _ => Err(fidl::Error::UnknownOrdinal {
1226                ordinal: tx_header.ordinal,
1227                protocol_name:
1228                    <ChildViewWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1229            }),
1230        }
1231    }
1232}
1233
1234/// A Stream of incoming requests for fuchsia.ui.composition/ChildViewWatcher.
1235pub struct ChildViewWatcherRequestStream {
1236    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1237    is_terminated: bool,
1238}
1239
1240impl std::marker::Unpin for ChildViewWatcherRequestStream {}
1241
1242impl futures::stream::FusedStream for ChildViewWatcherRequestStream {
1243    fn is_terminated(&self) -> bool {
1244        self.is_terminated
1245    }
1246}
1247
1248impl fidl::endpoints::RequestStream for ChildViewWatcherRequestStream {
1249    type Protocol = ChildViewWatcherMarker;
1250    type ControlHandle = ChildViewWatcherControlHandle;
1251
1252    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1253        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1254    }
1255
1256    fn control_handle(&self) -> Self::ControlHandle {
1257        ChildViewWatcherControlHandle { inner: self.inner.clone() }
1258    }
1259
1260    fn into_inner(
1261        self,
1262    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1263    {
1264        (self.inner, self.is_terminated)
1265    }
1266
1267    fn from_inner(
1268        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1269        is_terminated: bool,
1270    ) -> Self {
1271        Self { inner, is_terminated }
1272    }
1273}
1274
1275impl futures::Stream for ChildViewWatcherRequestStream {
1276    type Item = Result<ChildViewWatcherRequest, fidl::Error>;
1277
1278    fn poll_next(
1279        mut self: std::pin::Pin<&mut Self>,
1280        cx: &mut std::task::Context<'_>,
1281    ) -> std::task::Poll<Option<Self::Item>> {
1282        let this = &mut *self;
1283        if this.inner.check_shutdown(cx) {
1284            this.is_terminated = true;
1285            return std::task::Poll::Ready(None);
1286        }
1287        if this.is_terminated {
1288            panic!("polled ChildViewWatcherRequestStream after completion");
1289        }
1290        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1291            |bytes, handles| {
1292                match this.inner.channel().read_etc(cx, bytes, handles) {
1293                    std::task::Poll::Ready(Ok(())) => {}
1294                    std::task::Poll::Pending => return std::task::Poll::Pending,
1295                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1296                        this.is_terminated = true;
1297                        return std::task::Poll::Ready(None);
1298                    }
1299                    std::task::Poll::Ready(Err(e)) => {
1300                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1301                            e.into(),
1302                        ))))
1303                    }
1304                }
1305
1306                // A message has been received from the channel
1307                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1308
1309                std::task::Poll::Ready(Some(match header.ordinal {
1310                    0x1d622075f4fc8243 => {
1311                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1312                        let mut req = fidl::new_empty!(
1313                            fidl::encoding::EmptyPayload,
1314                            fidl::encoding::DefaultFuchsiaResourceDialect
1315                        );
1316                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1317                        let control_handle =
1318                            ChildViewWatcherControlHandle { inner: this.inner.clone() };
1319                        Ok(ChildViewWatcherRequest::GetStatus {
1320                            responder: ChildViewWatcherGetStatusResponder {
1321                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1322                                tx_id: header.tx_id,
1323                            },
1324                        })
1325                    }
1326                    0x3b2f3ca31e8908b4 => {
1327                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1328                        let mut req = fidl::new_empty!(
1329                            fidl::encoding::EmptyPayload,
1330                            fidl::encoding::DefaultFuchsiaResourceDialect
1331                        );
1332                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1333                        let control_handle =
1334                            ChildViewWatcherControlHandle { inner: this.inner.clone() };
1335                        Ok(ChildViewWatcherRequest::GetViewRef {
1336                            responder: ChildViewWatcherGetViewRefResponder {
1337                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1338                                tx_id: header.tx_id,
1339                            },
1340                        })
1341                    }
1342                    _ => Err(fidl::Error::UnknownOrdinal {
1343                        ordinal: header.ordinal,
1344                        protocol_name:
1345                            <ChildViewWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1346                    }),
1347                }))
1348            },
1349        )
1350    }
1351}
1352
1353/// A protocol that provides information about a particular child View which is attached to the
1354/// Viewport owned by the parent client; connections to this protocol are estabished in
1355/// [`CreateViewport`].  Since a Flatland instance may contain any number of Viewports, each of
1356/// which may or may not be attached to a transform, the client can maintain connections to an
1357/// equal number of ChildViewWatcher instances.
1358///
1359/// Each ChildViewWatcher instance will remain connected as long as the corresponding child View
1360/// exists; the connection will also be closed if the child's ViewCreationToken is dropped without
1361/// using it to create a View.
1362#[derive(Debug)]
1363pub enum ChildViewWatcherRequest {
1364    /// A hanging get for receiving the status of a View. This provides information to the parent,
1365    /// such as whether or not the child has successfully presented content through this View.
1366    ///
1367    /// This hanging get will only fire when the ChildViewStatus is different than the previously
1368    /// returned ChildViewStatus.  This can happen immediately, and even if the creator of the
1369    /// Viewport hasn't yet called Present() after calling CreateViewport().  This allows the parent
1370    /// to know that the child has content ready to display before the parent modifies their own
1371    /// local scene graph to incorporate the child content.
1372    ///
1373    /// It is invalid to call `GetStatus` while a previous call is still pending. Doing so will
1374    /// cause both this channel and the Flatland channel that handed out ChildViewWatcher to be
1375    /// closed.
1376    GetStatus { responder: ChildViewWatcherGetStatusResponder },
1377    /// Hanging get to receive the ViewRef of the child View. This will only fire when the View ref
1378    /// is different from the previously-returned View ref. Note: currently the View ref will not
1379    /// change after it is first received, but this will change if/when the API changes to allow
1380    /// relinking of views.
1381    ///
1382    /// The ViewRef is not returned until the View is included in the View tree, in other words when
1383    /// there is a chain of ancestor transforms all the way back up to the root of the scene graph,
1384    /// i.e. the display.
1385    ///
1386    /// It is invalid to call `GetViewRef` while a previous call is still pending. Doing so will
1387    /// cause both this channel and the Flatland channel that handed out ChildViewWatcher to be
1388    /// closed.
1389    ///
1390    /// A `GetViewRef` call will hang if the View was created using `CreateView`, but returns the
1391    /// View if the View was created using CreateView2. This is because `CreateView` does not mint
1392    /// a ViewRef for that View.
1393    GetViewRef { responder: ChildViewWatcherGetViewRefResponder },
1394}
1395
1396impl ChildViewWatcherRequest {
1397    #[allow(irrefutable_let_patterns)]
1398    pub fn into_get_status(self) -> Option<(ChildViewWatcherGetStatusResponder)> {
1399        if let ChildViewWatcherRequest::GetStatus { responder } = self {
1400            Some((responder))
1401        } else {
1402            None
1403        }
1404    }
1405
1406    #[allow(irrefutable_let_patterns)]
1407    pub fn into_get_view_ref(self) -> Option<(ChildViewWatcherGetViewRefResponder)> {
1408        if let ChildViewWatcherRequest::GetViewRef { responder } = self {
1409            Some((responder))
1410        } else {
1411            None
1412        }
1413    }
1414
1415    /// Name of the method defined in FIDL
1416    pub fn method_name(&self) -> &'static str {
1417        match *self {
1418            ChildViewWatcherRequest::GetStatus { .. } => "get_status",
1419            ChildViewWatcherRequest::GetViewRef { .. } => "get_view_ref",
1420        }
1421    }
1422}
1423
1424#[derive(Debug, Clone)]
1425pub struct ChildViewWatcherControlHandle {
1426    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1427}
1428
1429impl fidl::endpoints::ControlHandle for ChildViewWatcherControlHandle {
1430    fn shutdown(&self) {
1431        self.inner.shutdown()
1432    }
1433    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1434        self.inner.shutdown_with_epitaph(status)
1435    }
1436
1437    fn is_closed(&self) -> bool {
1438        self.inner.channel().is_closed()
1439    }
1440    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1441        self.inner.channel().on_closed()
1442    }
1443
1444    #[cfg(target_os = "fuchsia")]
1445    fn signal_peer(
1446        &self,
1447        clear_mask: zx::Signals,
1448        set_mask: zx::Signals,
1449    ) -> Result<(), zx_status::Status> {
1450        use fidl::Peered;
1451        self.inner.channel().signal_peer(clear_mask, set_mask)
1452    }
1453}
1454
1455impl ChildViewWatcherControlHandle {}
1456
1457#[must_use = "FIDL methods require a response to be sent"]
1458#[derive(Debug)]
1459pub struct ChildViewWatcherGetStatusResponder {
1460    control_handle: std::mem::ManuallyDrop<ChildViewWatcherControlHandle>,
1461    tx_id: u32,
1462}
1463
1464/// Set the the channel to be shutdown (see [`ChildViewWatcherControlHandle::shutdown`])
1465/// if the responder is dropped without sending a response, so that the client
1466/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1467impl std::ops::Drop for ChildViewWatcherGetStatusResponder {
1468    fn drop(&mut self) {
1469        self.control_handle.shutdown();
1470        // Safety: drops once, never accessed again
1471        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1472    }
1473}
1474
1475impl fidl::endpoints::Responder for ChildViewWatcherGetStatusResponder {
1476    type ControlHandle = ChildViewWatcherControlHandle;
1477
1478    fn control_handle(&self) -> &ChildViewWatcherControlHandle {
1479        &self.control_handle
1480    }
1481
1482    fn drop_without_shutdown(mut self) {
1483        // Safety: drops once, never accessed again due to mem::forget
1484        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1485        // Prevent Drop from running (which would shut down the channel)
1486        std::mem::forget(self);
1487    }
1488}
1489
1490impl ChildViewWatcherGetStatusResponder {
1491    /// Sends a response to the FIDL transaction.
1492    ///
1493    /// Sets the channel to shutdown if an error occurs.
1494    pub fn send(self, mut status: ChildViewStatus) -> Result<(), fidl::Error> {
1495        let _result = self.send_raw(status);
1496        if _result.is_err() {
1497            self.control_handle.shutdown();
1498        }
1499        self.drop_without_shutdown();
1500        _result
1501    }
1502
1503    /// Similar to "send" but does not shutdown the channel if an error occurs.
1504    pub fn send_no_shutdown_on_err(self, mut status: ChildViewStatus) -> Result<(), fidl::Error> {
1505        let _result = self.send_raw(status);
1506        self.drop_without_shutdown();
1507        _result
1508    }
1509
1510    fn send_raw(&self, mut status: ChildViewStatus) -> Result<(), fidl::Error> {
1511        self.control_handle.inner.send::<ChildViewWatcherGetStatusResponse>(
1512            (status,),
1513            self.tx_id,
1514            0x1d622075f4fc8243,
1515            fidl::encoding::DynamicFlags::empty(),
1516        )
1517    }
1518}
1519
1520#[must_use = "FIDL methods require a response to be sent"]
1521#[derive(Debug)]
1522pub struct ChildViewWatcherGetViewRefResponder {
1523    control_handle: std::mem::ManuallyDrop<ChildViewWatcherControlHandle>,
1524    tx_id: u32,
1525}
1526
1527/// Set the the channel to be shutdown (see [`ChildViewWatcherControlHandle::shutdown`])
1528/// if the responder is dropped without sending a response, so that the client
1529/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1530impl std::ops::Drop for ChildViewWatcherGetViewRefResponder {
1531    fn drop(&mut self) {
1532        self.control_handle.shutdown();
1533        // Safety: drops once, never accessed again
1534        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1535    }
1536}
1537
1538impl fidl::endpoints::Responder for ChildViewWatcherGetViewRefResponder {
1539    type ControlHandle = ChildViewWatcherControlHandle;
1540
1541    fn control_handle(&self) -> &ChildViewWatcherControlHandle {
1542        &self.control_handle
1543    }
1544
1545    fn drop_without_shutdown(mut self) {
1546        // Safety: drops once, never accessed again due to mem::forget
1547        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1548        // Prevent Drop from running (which would shut down the channel)
1549        std::mem::forget(self);
1550    }
1551}
1552
1553impl ChildViewWatcherGetViewRefResponder {
1554    /// Sends a response to the FIDL transaction.
1555    ///
1556    /// Sets the channel to shutdown if an error occurs.
1557    pub fn send(self, mut view_ref: fidl_fuchsia_ui_views::ViewRef) -> Result<(), fidl::Error> {
1558        let _result = self.send_raw(view_ref);
1559        if _result.is_err() {
1560            self.control_handle.shutdown();
1561        }
1562        self.drop_without_shutdown();
1563        _result
1564    }
1565
1566    /// Similar to "send" but does not shutdown the channel if an error occurs.
1567    pub fn send_no_shutdown_on_err(
1568        self,
1569        mut view_ref: fidl_fuchsia_ui_views::ViewRef,
1570    ) -> Result<(), fidl::Error> {
1571        let _result = self.send_raw(view_ref);
1572        self.drop_without_shutdown();
1573        _result
1574    }
1575
1576    fn send_raw(&self, mut view_ref: fidl_fuchsia_ui_views::ViewRef) -> Result<(), fidl::Error> {
1577        self.control_handle.inner.send::<ChildViewWatcherGetViewRefResponse>(
1578            (&mut view_ref,),
1579            self.tx_id,
1580            0x3b2f3ca31e8908b4,
1581            fidl::encoding::DynamicFlags::empty(),
1582        )
1583    }
1584}
1585
1586#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1587pub struct FlatlandMarker;
1588
1589impl fidl::endpoints::ProtocolMarker for FlatlandMarker {
1590    type Proxy = FlatlandProxy;
1591    type RequestStream = FlatlandRequestStream;
1592    #[cfg(target_os = "fuchsia")]
1593    type SynchronousProxy = FlatlandSynchronousProxy;
1594
1595    const DEBUG_NAME: &'static str = "fuchsia.ui.composition.Flatland";
1596}
1597impl fidl::endpoints::DiscoverableProtocolMarker for FlatlandMarker {}
1598
1599pub trait FlatlandProxyInterface: Send + Sync {
1600    fn r#present(&self, args: PresentArgs) -> Result<(), fidl::Error>;
1601    fn r#create_view(
1602        &self,
1603        token: fidl_fuchsia_ui_views::ViewCreationToken,
1604        parent_viewport_watcher: fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>,
1605    ) -> Result<(), fidl::Error>;
1606    fn r#create_view2(
1607        &self,
1608        token: fidl_fuchsia_ui_views::ViewCreationToken,
1609        view_identity: fidl_fuchsia_ui_views::ViewIdentityOnCreation,
1610        protocols: ViewBoundProtocols,
1611        parent_viewport_watcher: fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>,
1612    ) -> Result<(), fidl::Error>;
1613    fn r#create_transform(&self, transform_id: &TransformId) -> Result<(), fidl::Error>;
1614    fn r#set_translation(
1615        &self,
1616        transform_id: &TransformId,
1617        translation: &fidl_fuchsia_math::Vec_,
1618    ) -> Result<(), fidl::Error>;
1619    fn r#set_orientation(
1620        &self,
1621        transform_id: &TransformId,
1622        orientation: Orientation,
1623    ) -> Result<(), fidl::Error>;
1624    fn r#set_scale(
1625        &self,
1626        transform_id: &TransformId,
1627        scale: &fidl_fuchsia_math::VecF,
1628    ) -> Result<(), fidl::Error>;
1629    fn r#set_opacity(&self, transform_id: &TransformId, value: f32) -> Result<(), fidl::Error>;
1630    fn r#set_clip_boundary(
1631        &self,
1632        transform_id: &TransformId,
1633        rect: Option<&fidl_fuchsia_math::Rect>,
1634    ) -> Result<(), fidl::Error>;
1635    fn r#add_child(
1636        &self,
1637        parent_transform_id: &TransformId,
1638        child_transform_id: &TransformId,
1639    ) -> Result<(), fidl::Error>;
1640    fn r#remove_child(
1641        &self,
1642        parent_transform_id: &TransformId,
1643        child_transform_id: &TransformId,
1644    ) -> Result<(), fidl::Error>;
1645    fn r#replace_children(
1646        &self,
1647        parent_transform_id: &TransformId,
1648        new_child_transform_ids: &[TransformId],
1649    ) -> Result<(), fidl::Error>;
1650    fn r#set_root_transform(&self, transform_id: &TransformId) -> Result<(), fidl::Error>;
1651    fn r#set_hit_regions(
1652        &self,
1653        transform_id: &TransformId,
1654        regions: &[HitRegion],
1655    ) -> Result<(), fidl::Error>;
1656    fn r#set_infinite_hit_region(
1657        &self,
1658        transform_id: &TransformId,
1659        hit_test: HitTestInteraction,
1660    ) -> Result<(), fidl::Error>;
1661    fn r#create_viewport(
1662        &self,
1663        viewport_id: &ContentId,
1664        token: fidl_fuchsia_ui_views::ViewportCreationToken,
1665        properties: &ViewportProperties,
1666        child_view_watcher: fidl::endpoints::ServerEnd<ChildViewWatcherMarker>,
1667    ) -> Result<(), fidl::Error>;
1668    fn r#create_image(
1669        &self,
1670        image_id: &ContentId,
1671        import_token: BufferCollectionImportToken,
1672        vmo_index: u32,
1673        properties: &ImageProperties,
1674    ) -> Result<(), fidl::Error>;
1675    fn r#set_image_sample_region(
1676        &self,
1677        image_id: &ContentId,
1678        rect: &fidl_fuchsia_math::RectF,
1679    ) -> Result<(), fidl::Error>;
1680    fn r#set_image_destination_size(
1681        &self,
1682        image_id: &ContentId,
1683        size: &fidl_fuchsia_math::SizeU,
1684    ) -> Result<(), fidl::Error>;
1685    fn r#set_image_blending_function(
1686        &self,
1687        image_id: &ContentId,
1688        blend_mode: BlendMode,
1689    ) -> Result<(), fidl::Error>;
1690    fn r#set_image_opacity(&self, image_id: &ContentId, val: f32) -> Result<(), fidl::Error>;
1691    fn r#set_image_flip(&self, image_id: &ContentId, flip: ImageFlip) -> Result<(), fidl::Error>;
1692    fn r#create_filled_rect(&self, rect_id: &ContentId) -> Result<(), fidl::Error>;
1693    fn r#set_solid_fill(
1694        &self,
1695        rect_id: &ContentId,
1696        color: &ColorRgba,
1697        size: &fidl_fuchsia_math::SizeU,
1698    ) -> Result<(), fidl::Error>;
1699    fn r#release_filled_rect(&self, rect_id: &ContentId) -> Result<(), fidl::Error>;
1700    fn r#set_content(
1701        &self,
1702        transform_id: &TransformId,
1703        content_id: &ContentId,
1704    ) -> Result<(), fidl::Error>;
1705    fn r#set_viewport_properties(
1706        &self,
1707        viewport_id: &ContentId,
1708        properties: &ViewportProperties,
1709    ) -> Result<(), fidl::Error>;
1710    fn r#release_transform(&self, transform_id: &TransformId) -> Result<(), fidl::Error>;
1711    fn r#release_view(&self) -> Result<(), fidl::Error>;
1712    type ReleaseViewportResponseFut: std::future::Future<
1713            Output = Result<fidl_fuchsia_ui_views::ViewportCreationToken, fidl::Error>,
1714        > + Send;
1715    fn r#release_viewport(&self, viewport_id: &ContentId) -> Self::ReleaseViewportResponseFut;
1716    fn r#release_image(&self, image_id: &ContentId) -> Result<(), fidl::Error>;
1717    fn r#clear(&self) -> Result<(), fidl::Error>;
1718    fn r#set_debug_name(&self, name: &str) -> Result<(), fidl::Error>;
1719}
1720#[derive(Debug)]
1721#[cfg(target_os = "fuchsia")]
1722pub struct FlatlandSynchronousProxy {
1723    client: fidl::client::sync::Client,
1724}
1725
1726#[cfg(target_os = "fuchsia")]
1727impl fidl::endpoints::SynchronousProxy for FlatlandSynchronousProxy {
1728    type Proxy = FlatlandProxy;
1729    type Protocol = FlatlandMarker;
1730
1731    fn from_channel(inner: fidl::Channel) -> Self {
1732        Self::new(inner)
1733    }
1734
1735    fn into_channel(self) -> fidl::Channel {
1736        self.client.into_channel()
1737    }
1738
1739    fn as_channel(&self) -> &fidl::Channel {
1740        self.client.as_channel()
1741    }
1742}
1743
1744#[cfg(target_os = "fuchsia")]
1745impl FlatlandSynchronousProxy {
1746    pub fn new(channel: fidl::Channel) -> Self {
1747        let protocol_name = <FlatlandMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1748        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1749    }
1750
1751    pub fn into_channel(self) -> fidl::Channel {
1752        self.client.into_channel()
1753    }
1754
1755    /// Waits until an event arrives and returns it. It is safe for other
1756    /// threads to make concurrent requests while waiting for an event.
1757    pub fn wait_for_event(
1758        &self,
1759        deadline: zx::MonotonicInstant,
1760    ) -> Result<FlatlandEvent, fidl::Error> {
1761        FlatlandEvent::decode(self.client.wait_for_event(deadline)?)
1762    }
1763
1764    /// Complete execution of all feed-forward operations.
1765    ///
1766    /// If executing an operation produces an error (e.g., CreateTransform(0)), an [`OnError`] event
1767    /// is emitted. Operations that produce errors are ignored and the channel is closed.
1768    ///
1769    /// If the execution is completed successfully, [`OnNextFrameBegin`] emits NO_ERROR along
1770    /// with other valid fields.
1771    ///
1772    /// The client may only call [`Present`] when they have a non-zero number of present credits,
1773    /// which are tracked by the server. The server may increment the number of credits when it
1774    /// fires the [`OnNextFrameBegin`] event, which informs the client when it receives additional
1775    /// present credits. Each [`Present`] call uses one present credit and decrements the server
1776    /// count by one. If the client calls [`Present`] with no present credits, the server will
1777    /// return a `NO_PRESENTS_REMAINING` error.
1778    ///
1779    /// The client should assume that prior to receiving any [`OnNextFrameBegin`] events, they have
1780    /// one present credit.
1781    ///
1782    /// Every [`Present`] call results in one [`OnNextFrameBegin`] event, and one
1783    /// [`OnFramePresented`] event, typically in that order.
1784    ///
1785    /// When the commands flushed by [`Present`] make it to display, an [`OnFramePresented`] event
1786    /// is fired. This event includes information pertaining to all [`Present`]s that had content
1787    /// that were part of that frame.
1788    ///
1789    /// See [`fuchsia.ui.composition/PresentArgs`] documentation above for more detailed information
1790    /// on what arguments are passed in and their role.
1791    pub fn r#present(&self, mut args: PresentArgs) -> Result<(), fidl::Error> {
1792        self.client.send::<FlatlandPresentRequest>(
1793            (&mut args,),
1794            0x50acc2aa1f0acec7,
1795            fidl::encoding::DynamicFlags::empty(),
1796        )
1797    }
1798
1799    /// Two Flatland instances may be connected in a parent-child relationship. The parent endpoint
1800    /// is held in a Viewport, and the child endpoint is held in a View. The parent Flatland
1801    /// instance that creates a Viewport has control over how the child's View is integrated into
1802    /// its own View.
1803    ///
1804    /// The lifecycle of a parent-child connection starts with two endpoints of a channel object:
1805    /// a ViewportCreationToken and a ViewCreationToken. Out-of-band protocols pass the
1806    /// ViewportCreationToken to the parent, which calls [`CreateViewport`], and the
1807    /// ViewCreationToken to the child, which calls [`CreateView`].
1808    ///
1809    /// Only nodes connected to the Root Transform in this Flatland instance will be rendered into
1810    /// the parent's Viewport.
1811    ///
1812    /// Calling [`CreateView`] a second time will disconnect the Root Transform from the existing
1813    /// parent's Viewport, and attach it to a new parent's Viewport. In other words, each View can
1814    /// only have one parent.
1815    ///
1816    /// This function is queued, meaning that the Root Transform will not be attached to the
1817    /// parent Viewport until [`Present`] is called. However, clients will receive information
1818    /// through their ParentViewportWatcher (e.g., LayoutInfo) immediately after calling this
1819    /// function, even if they have not called [`Present`] or [`SetRootTransform`]. This allows
1820    /// clients to wait for layout information from their parent before calling [`Present`].
1821    ///
1822    /// Any illegal operations on ParentViewportWatcher will cause both ParentViewportWatcher
1823    /// channel and this Flatland channel to be torn down.
1824    ///
1825    /// Lifecycle note. The lifetime of the ParentViewportWatcher channel is bound by the peer
1826    /// ViewportCreationToken. When the ViewportCreationToken dies, this ParentViewportWatcher
1827    /// channel is destroyed.
1828    ///
1829    /// Views and subgraphs of Views created using `CreateView` will not be represented in the
1830    /// ViewTree, and hence will not be able to participate in any ViewTree-dependent interactions
1831    /// such as touch, mouse or focus.
1832    /// The Flatland protocol provides no way for Views in the subgraph of a View created with
1833    /// `CreateView` to know that they are excluded from the ViewTree.
1834    pub fn r#create_view(
1835        &self,
1836        mut token: fidl_fuchsia_ui_views::ViewCreationToken,
1837        mut parent_viewport_watcher: fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>,
1838    ) -> Result<(), fidl::Error> {
1839        self.client.send::<FlatlandCreateViewRequest>(
1840            (&mut token, parent_viewport_watcher),
1841            0x504686eb25864780,
1842            fidl::encoding::DynamicFlags::empty(),
1843        )
1844    }
1845
1846    /// Identical to [`CreateView`], except it allows association of View identity (ViewRef) and
1847    /// view-bound protocols.
1848    pub fn r#create_view2(
1849        &self,
1850        mut token: fidl_fuchsia_ui_views::ViewCreationToken,
1851        mut view_identity: fidl_fuchsia_ui_views::ViewIdentityOnCreation,
1852        mut protocols: ViewBoundProtocols,
1853        mut parent_viewport_watcher: fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>,
1854    ) -> Result<(), fidl::Error> {
1855        self.client.send::<FlatlandCreateView2Request>(
1856            (&mut token, &mut view_identity, &mut protocols, parent_viewport_watcher),
1857            0x340a3a40c2fdbd5e,
1858            fidl::encoding::DynamicFlags::empty(),
1859        )
1860    }
1861
1862    /// Creates a new Transform node. Transforms are a hierarchical piece of a Flatland graph. They
1863    /// can have children, and can reference Content. A sub-graph represented by a Transform and its
1864    /// descendants can be rendered to a display.
1865    ///
1866    /// Transforms are kept alive, even when released, as long as they are children of either an
1867    /// unreleased Transform, or the Root Transform.
1868    ///
1869    /// Each Transform can have a single piece of attached Content. Common types of Content include
1870    /// bitmaps, asynchronous streams of images, and Viewports to Views hosted in other Flatland
1871    /// instances.
1872    ///
1873    /// Transforms have attributes. Child Transforms inherit the combined attributes of their
1874    /// parents. Content attached to a Transform is also affected by that Transform's attributes.
1875    ///
1876    /// When a sub-graph of Transforms is rendered, Content will be rendered back-to-front, starting
1877    /// with the Content on the root transform, and continuing recursively through all of its child
1878    /// Transforms in the order the children were added. See [`AddChild`] for more information.
1879    ///
1880    /// Zero is not a valid transform id. All other values are valid, assuming they are not already
1881    /// in use (see [`ReleaseTransform`] for more details).
1882    pub fn r#create_transform(&self, mut transform_id: &TransformId) -> Result<(), fidl::Error> {
1883        self.client.send::<FlatlandCreateTransformRequest>(
1884            (transform_id,),
1885            0x5e042a4d3de3efb0,
1886            fidl::encoding::DynamicFlags::empty(),
1887        )
1888    }
1889
1890    /// All Transform objects support all attributes.
1891    ///
1892    /// Geometric attributes are applied in the following order:
1893    /// 1. Scale (relative to the parent transform's coordinate space)
1894    /// 2. Orientation (relative to the parent transform's coordinate space)
1895    /// 3. Translation (relative to the parent transforms's coordinate space,
1896    ///    unaffected by scale applied to the current transform).
1897    /// 4. Clipping (relative to the current transform's coordinate space)
1898    ///
1899    /// The effects of each of these attributes are cumulative. This means the transform's position
1900    /// in the view space, and its clip boundary, will be calculated based on that chain of
1901    /// geometric attributes going up to the root transform.
1902    ///
1903    /// For instance, in a nested hierarchy such as the following:
1904    ///     [Root-Transform -> Transform1 -> Transform2 -> CurrentTransform]
1905    /// If Transform1 is translated by [2,0] and Transform2 is translated by [0,1] then the
1906    /// view-space position of CurrentTransform will be [2,1].
1907    ///
1908    /// Sets the translation on a Transform. The order of geometric attribute application is
1909    /// addressed above.
1910    pub fn r#set_translation(
1911        &self,
1912        mut transform_id: &TransformId,
1913        mut translation: &fidl_fuchsia_math::Vec_,
1914    ) -> Result<(), fidl::Error> {
1915        self.client.send::<FlatlandSetTranslationRequest>(
1916            (transform_id, translation),
1917            0x7863398291fba346,
1918            fidl::encoding::DynamicFlags::empty(),
1919        )
1920    }
1921
1922    /// Sets the orientation on a Transform. The order of geometric attribute application is
1923    /// addressed in the documentation for [`SetTranslation`]. In Flatland, the +X axis is
1924    /// to the right and the +Y axis is down. There is no notion of a Z axis. CCW is defined
1925    /// from the POV of the user, as if a skeuomorphoic clock is displayed on the screen.
1926    pub fn r#set_orientation(
1927        &self,
1928        mut transform_id: &TransformId,
1929        mut orientation: Orientation,
1930    ) -> Result<(), fidl::Error> {
1931        self.client.send::<FlatlandSetOrientationRequest>(
1932            (transform_id, orientation),
1933            0x4915310bc4928edc,
1934            fidl::encoding::DynamicFlags::empty(),
1935        )
1936    }
1937
1938    /// Sets the scale on a transform. The order of geometric attribute application is
1939    /// addressed above. The (x,y) values in the VecF |scale| refer to the scale factor in the
1940    /// x-axis (width) and y-axis (height) respectively. Scale values must be normal 32-bit
1941    /// floating point values: https://en.wikipedia.org/wiki/Normal_number_%28computing%29
1942    pub fn r#set_scale(
1943        &self,
1944        mut transform_id: &TransformId,
1945        mut scale: &fidl_fuchsia_math::VecF,
1946    ) -> Result<(), fidl::Error> {
1947        self.client.send::<FlatlandSetScaleRequest>(
1948            (transform_id, scale),
1949            0x1ea1766fd8996bb4,
1950            fidl::encoding::DynamicFlags::empty(),
1951        )
1952    }
1953
1954    /// Sets an opacity in linear space to be applied to a transform and its descendents,
1955    /// which include other transforms and content. Opacity values must be in the range
1956    /// of [0.0, 1.0], where 0.0 is completely transparent and 1.0 is completely opaque.
1957    /// Attempting to call this function with values outside that range will result in
1958    /// an error. A transform's opacity value is multiplied with that of its parent. This
1959    /// effect works differently from group opacity. Using group opacity, child nodes are
1960    /// rendered together first, and then have the parent's opacity applied as a post-effect.
1961    /// Here, opacity is applied to each child individually. This may result in a very
1962    /// different effect.
1963    pub fn r#set_opacity(
1964        &self,
1965        mut transform_id: &TransformId,
1966        mut value: f32,
1967    ) -> Result<(), fidl::Error> {
1968        self.client.send::<FlatlandSetOpacityRequest>(
1969            (transform_id, value),
1970            0x3775fc2c00b432fa,
1971            fidl::encoding::DynamicFlags::empty(),
1972        )
1973    }
1974
1975    /// Sets the bounds, expressed in the local coordinate space of the transform, that
1976    /// constrains the region that content attached to this transform can be rendered to.
1977    /// If the content's area exceeds the clip bounds, the area outside the bounds will
1978    /// not be rendered. These bounds are valid for all children of this transform node as
1979    /// well, which includes nested Flatland instances and their node hierarchies.
1980    /// If a child transform attempts to set clip bounds larger than that of its parent,
1981    /// it will be clipped to the parent's clip bounds. The default state is for a transform
1982    /// to be unclipped, meaning it will not have any bounds placed on its render region.
1983    /// The clip width/height must be positive. Negative values will result in an error.
1984    /// Passing in an empty box to the |rect| parameter will remove the clip bounds.
1985    pub fn r#set_clip_boundary(
1986        &self,
1987        mut transform_id: &TransformId,
1988        mut rect: Option<&fidl_fuchsia_math::Rect>,
1989    ) -> Result<(), fidl::Error> {
1990        self.client.send::<FlatlandSetClipBoundaryRequest>(
1991            (transform_id, rect),
1992            0x6507843df12222d2,
1993            fidl::encoding::DynamicFlags::empty(),
1994        )
1995    }
1996
1997    /// Adds a child Transform to a parent Transform. The new child Transform, and any Content
1998    /// attached to it or its children, will be rendered on top of the parent's Content, as well as
1999    /// any previously added children.
2000    pub fn r#add_child(
2001        &self,
2002        mut parent_transform_id: &TransformId,
2003        mut child_transform_id: &TransformId,
2004    ) -> Result<(), fidl::Error> {
2005        self.client.send::<FlatlandAddChildRequest>(
2006            (parent_transform_id, child_transform_id),
2007            0x67a8abd2f19b1a74,
2008            fidl::encoding::DynamicFlags::empty(),
2009        )
2010    }
2011
2012    /// Removes a child Transform from a parent Transform.
2013    pub fn r#remove_child(
2014        &self,
2015        mut parent_transform_id: &TransformId,
2016        mut child_transform_id: &TransformId,
2017    ) -> Result<(), fidl::Error> {
2018        self.client.send::<FlatlandRemoveChildRequest>(
2019            (parent_transform_id, child_transform_id),
2020            0x41d6cd90b298b67a,
2021            fidl::encoding::DynamicFlags::empty(),
2022        )
2023    }
2024
2025    /// Removes all child Transforms from a parent Transform and replaces them with the new child
2026    /// transforms in `new_child_transform_ids`.
2027    pub fn r#replace_children(
2028        &self,
2029        mut parent_transform_id: &TransformId,
2030        mut new_child_transform_ids: &[TransformId],
2031    ) -> Result<(), fidl::Error> {
2032        self.client.send::<FlatlandReplaceChildrenRequest>(
2033            (parent_transform_id, new_child_transform_ids),
2034            0x5b6d86cbbff81316,
2035            fidl::encoding::DynamicFlags::empty(),
2036        )
2037    }
2038
2039    /// Sets the Root Transform for the graph.
2040    ///
2041    /// The sub-graph defined by the Root Transform and its children will be rendered as View
2042    /// in the connected parent's Viewport (see [`CreateView`]). Any parents of the Root Transform
2043    /// in this Graph will be ignored.
2044    ///
2045    /// The Root Transform, and all children of the Root Transform, are kept alive if they are
2046    /// released (see [`ReleaseTransform`] for more details).
2047    ///
2048    /// There is only ever one Root. Since 0 is not a valid transform id (see [`CreateTransform`]),
2049    /// calling SetRootTransform(0) clears the current Root, destroying any previously released
2050    /// objects that are not referenced by the new root.
2051    ///
2052    /// Note that every View has a clip boundary equivalent to its logical size. Anything outside
2053    /// that clip boundary will not be rendered. Hence, the Root Transform has a useful coordinate
2054    /// space of (0, 0) to (logical_size.width, logical_size.height), where (0, 0) is the upper left
2055    /// corner.
2056    ///
2057    /// Setting the root transform installs a full screen hit region on the root transform. Clients
2058    /// may remove this hit region if they don't want users to be able to interact with the root
2059    /// transform's content. For additional details on hit regions, see the [`SetHitRegions`]
2060    /// documentation.
2061    ///
2062    /// Default hit region rules
2063    ///
2064    ///   A default hit region follows these rules:
2065    ///   - When [`SetRootTransform`](T) is called, T receives a maximal hit region, covering the
2066    ///   entire view.
2067    ///   - If [`SetHitRegions`] is called on T, either before or after [`SetRootTransform`](T),
2068    ///   then no default hit region is active and the client specified hit regions are used.
2069    ///   - If a transform is no longer the root transform, i.e., [`SetRootTransform`](U) is
2070    ///   called, then the original transform no longer has its default hit region.
2071    ///   - Clients can remove or modify the root transform's hit regions the same way they would
2072    ///   reset any other transform's hit regions, by calling [`SetHitRegions`] with the appropriate
2073    ///   vector.
2074    pub fn r#set_root_transform(&self, mut transform_id: &TransformId) -> Result<(), fidl::Error> {
2075        self.client.send::<FlatlandSetRootTransformRequest>(
2076            (transform_id,),
2077            0x6e80ca5bcc566cd8,
2078            fidl::encoding::DynamicFlags::empty(),
2079        )
2080    }
2081
2082    /// Sets the interactive areas for a Transform. By default, Content is not interactive; hit
2083    /// regions must be placed for a user to interact with the Content in a View. Because hit
2084    /// regions are described in the Flatland protocol, a Flatland instance can synchronize Content
2085    /// and hit regions.
2086    ///
2087    /// Each hit region is placed in the coordinate space of the owning Transform, and may or may
2088    /// not interact with different types of hit testing, depending on its [`HitTestInteraction`]
2089    /// type. When there are multiple hit regions that intersect with a hit test, the precedence
2090    /// rules given below dictate which hit region has interacted with the hit test. Only Transforms
2091    /// that transitively connect to the root Transform have their hit regions interact with a hit
2092    /// test.
2093    ///
2094    /// Calling this function replaces any previous values set on this Transform. To reset a
2095    /// Transform to "no hit testing": send an empty vector with [`SetHitRegions`].
2096    ///
2097    /// Note that root transforms get a default hit region installed by Flatland. For more details,
2098    /// see the [`SetRootTransform`] documentation.
2099    ///
2100    /// Precedence rules
2101    ///   Within a Transform, if multiple hit regions overlap, the hit test examines each
2102    ///   intersecting hit region for a possible interaction. Thus, for a regular hit test R and an
2103    ///   accessibility hit test A, where R and A both intersect two hit regions D ([`DEFAULT`]) and
2104    ///   S ([`SEMANTICALLY_INVISIBLE`]) on the same Transform, (1) R interacts with both D and S,
2105    ///   and (2) A only interacts with D. Generally, hit regions that overlap in a single Transform
2106    ///   can cause confusing behavior.
2107    ///
2108    ///   Within a View, for a given hit test, the front-most Transform's hit regions take
2109    ///   precedence over those behind. This follows the expected reverse "render order" of
2110    ///   Transforms (described in [`CreateTransform`]), where a user expects to interact with
2111    ///   Content that is visible, or front-most.
2112    ///
2113    ///   Across Flatland instances, for a given hit test, the front-most instance's front-most
2114    ///   Transform's hit regions take precedence over those behind. This follows the expected
2115    ///   reverse "render order" of views, where a user expects to interact with the View that is
2116    ///   visible, or front-most. For example, if a child View owns Content that is rendered over
2117    ///   the parent View, the user expects to interact with the child's Content.
2118    pub fn r#set_hit_regions(
2119        &self,
2120        mut transform_id: &TransformId,
2121        mut regions: &[HitRegion],
2122    ) -> Result<(), fidl::Error> {
2123        self.client.send::<FlatlandSetHitRegionsRequest>(
2124            (transform_id, regions),
2125            0x31c9d17b07c37ce4,
2126            fidl::encoding::DynamicFlags::empty(),
2127        )
2128    }
2129
2130    /// Identical to [`SetHitRegions`], except the hit region associated with [`transform_id`]
2131    /// covers an infinite region. The hit region is invariant against translation, scaling, and
2132    /// orientation of the Transform.
2133    ///
2134    /// An infinite hit region is still limited in extent by the View's clip boundary, just like a
2135    /// finite hit region.
2136    ///
2137    /// Calling this function replaces any previous values set on this Transform. To reset a
2138    /// Transform to "no hit testing": send an empty vector with [`SetHitRegions`].
2139    pub fn r#set_infinite_hit_region(
2140        &self,
2141        mut transform_id: &TransformId,
2142        mut hit_test: HitTestInteraction,
2143    ) -> Result<(), fidl::Error> {
2144        self.client.send::<FlatlandSetInfiniteHitRegionRequest>(
2145            (transform_id, hit_test),
2146            0x26d81af852d29562,
2147            fidl::encoding::DynamicFlags::empty(),
2148        )
2149    }
2150
2151    /// The Viewport and View pair, together, represent the connection between two Flatland
2152    /// instances. The Viewport is created in the parent, and the View is created in the child. The
2153    /// parent has control over how the child's View is integrated into its own View.
2154    ///
2155    /// Any illegal operations on ChildViewWatcher will cause both ChildViewWatcher channel and this
2156    /// Flatland channel to be torn down.
2157    ///
2158    /// `ViewportProperties` must have logical_size set. This is the initial size that will drive
2159    /// the layout of the child. The logical_size is also used as the default Content size, but
2160    /// subsequent changes to the logical_size will have no effect on the Content size.
2161    ///
2162    /// `ViewportProperties` may have inset field not set. In that case, the default value of
2163    /// (0, 0, 0, 0) is used.
2164    ///
2165    /// The logical_size must have positive X and Y components.
2166    ///
2167    /// Zero is not a valid ContentId. All other values are valid, assuming they are not already
2168    /// in use for another piece of Content (see [`ReleaseViewport`] for more details).
2169    ///
2170    /// Lifecycle note. The lifetime of the ChildViewWatcher channel is bound by the peer
2171    /// ViewCreationToken. When the ViewCreationToken dies, this ChildViewWatcher channel is
2172    /// destroyed.
2173    pub fn r#create_viewport(
2174        &self,
2175        mut viewport_id: &ContentId,
2176        mut token: fidl_fuchsia_ui_views::ViewportCreationToken,
2177        mut properties: &ViewportProperties,
2178        mut child_view_watcher: fidl::endpoints::ServerEnd<ChildViewWatcherMarker>,
2179    ) -> Result<(), fidl::Error> {
2180        self.client.send::<FlatlandCreateViewportRequest>(
2181            (viewport_id, &mut token, properties, child_view_watcher),
2182            0x2485fbcab7f943c,
2183            fidl::encoding::DynamicFlags::empty(),
2184        )
2185    }
2186
2187    /// An Image is a bitmap backed by a specific VMO in a BufferCollection.
2188    ///
2189    /// Image creation requires an allocated BufferCollection registered with Allocator. This
2190    /// function will fail unless all clients of the specified BufferCollection have set their
2191    /// constraints.
2192    ///
2193    /// The Image must reference a valid VMO index and must have ImageProperties that fall within
2194    /// the constraints specified by the backing BufferCollection (i.e. width and height within a
2195    /// valid range, etc.)
2196    ///
2197    /// Zero is not a valid Image id. All other values are valid, assuming they are not already in
2198    /// use for another piece of Content (see [`ReleaseImage`] for more details).
2199    pub fn r#create_image(
2200        &self,
2201        mut image_id: &ContentId,
2202        mut import_token: BufferCollectionImportToken,
2203        mut vmo_index: u32,
2204        mut properties: &ImageProperties,
2205    ) -> Result<(), fidl::Error> {
2206        self.client.send::<FlatlandCreateImageRequest>(
2207            (image_id, &mut import_token, vmo_index, properties),
2208            0x26fae823c4ebedad,
2209            fidl::encoding::DynamicFlags::empty(),
2210        )
2211    }
2212
2213    /// This function is used to determine the region (in texel space) of an image that will be used
2214    /// by Flatland when rendering. The image to be sampled is referenced by [`image_id`] and the
2215    /// sample region is specified by [`rect`] which itself is comprised of an origin point (x,y) as
2216    /// well as a width and height, in unnormalized coordinates. It is illegal to call this function
2217    /// on non-image content, or to sample a region outside of the texel space of the image. In
2218    /// other words, the region specifed by [`rect`] must not exceed the ranges (0, image_width) and
2219    /// (0, image_height). If (rect.x + rect.width > image_width) or (rect.y + rect.height >
2220    /// image_height) or if any of the values are negative, this will result in an error.
2221    ///
2222    /// If this method is not called, the default sample region is the rectangle with origin at
2223    /// (0, 0) and width and height set at ImageProperties from [`CreateImage`].
2224    pub fn r#set_image_sample_region(
2225        &self,
2226        mut image_id: &ContentId,
2227        mut rect: &fidl_fuchsia_math::RectF,
2228    ) -> Result<(), fidl::Error> {
2229        self.client.send::<FlatlandSetImageSampleRegionRequest>(
2230            (image_id, rect),
2231            0x8039391d715eb28,
2232            fidl::encoding::DynamicFlags::empty(),
2233        )
2234    }
2235
2236    /// The content size for an Image is the size of the rectangle in the parent's logical
2237    /// coordinate space that the image occupies. This combined with the global translation of the
2238    /// transform it is attached to determines the size and location of where the content is
2239    /// rendered on the display.
2240    ///
2241    /// If this method is not called, the default image destination size is the width and height set
2242    /// at ImageProperties from [`CreateImage`]. The destination size will be affected by scaling if
2243    /// [`SetScale`] is used on the attached Transform or its parents.
2244    pub fn r#set_image_destination_size(
2245        &self,
2246        mut image_id: &ContentId,
2247        mut size: &fidl_fuchsia_math::SizeU,
2248    ) -> Result<(), fidl::Error> {
2249        self.client.send::<FlatlandSetImageDestinationSizeRequest>(
2250            (image_id, size),
2251            0x766cf99a2ec58446,
2252            fidl::encoding::DynamicFlags::empty(),
2253        )
2254    }
2255
2256    /// Determines the blend function to use when rendering the content specified by
2257    /// |image_id|. |image_id| must be a valid ContentId associated to a transform through
2258    /// a call to |CreateImage| or |CreateFilledRect|. For details on the different blend functions
2259    /// that are available, please refer to the BlendMode enum. If this function is not called, then
2260    /// the default blendmode is BlendMode::SRC.
2261    pub fn r#set_image_blending_function(
2262        &self,
2263        mut image_id: &ContentId,
2264        mut blend_mode: BlendMode,
2265    ) -> Result<(), fidl::Error> {
2266        self.client.send::<FlatlandSetImageBlendingFunctionRequest>(
2267            (image_id, blend_mode),
2268            0x10f5da1356275b7b,
2269            fidl::encoding::DynamicFlags::empty(),
2270        )
2271    }
2272
2273    /// Sets an opacity in linear space to be applied to a flatland image. Opacity values must
2274    /// be in the range [0.0, 1.0].
2275    pub fn r#set_image_opacity(
2276        &self,
2277        mut image_id: &ContentId,
2278        mut val: f32,
2279    ) -> Result<(), fidl::Error> {
2280        self.client.send::<FlatlandSetImageOpacityRequest>(
2281            (image_id, val),
2282            0x2da9e4ef4c2cff6f,
2283            fidl::encoding::DynamicFlags::empty(),
2284        )
2285    }
2286
2287    /// Sets the image flip to be applied to a flatland image. This call must be performed after a
2288    /// successful |CreateImage| call. If an invalid |image_id| is supplied, the channel will be
2289    /// closed due to FlatlandError::BAD_OPERATION. This flip will be applied to the Image before
2290    /// parent Transform Orientations. If this function is not called, then the default flip value
2291    /// is ImageFlip::NONE.
2292    pub fn r#set_image_flip(
2293        &self,
2294        mut image_id: &ContentId,
2295        mut flip: ImageFlip,
2296    ) -> Result<(), fidl::Error> {
2297        self.client.send::<FlatlandSetImageFlipRequest>(
2298            (image_id, flip),
2299            0x21b20f2c14aae6bc,
2300            fidl::encoding::DynamicFlags::empty(),
2301        )
2302    }
2303
2304    /// Creates a solid-color rectangle. By default a filled-rect does not have a defined
2305    /// color or size. It is necessary to call |SetSolidFill| to specify a color and size
2306    /// before a filled rect can be used for rendering. Not doing so will result the
2307    pub fn r#create_filled_rect(&self, mut rect_id: &ContentId) -> Result<(), fidl::Error> {
2308        self.client.send::<FlatlandCreateFilledRectRequest>(
2309            (rect_id,),
2310            0x5e62355abc1c4c5d,
2311            fidl::encoding::DynamicFlags::empty(),
2312        )
2313    }
2314
2315    /// Defines the color and size of a filled rect. |rect_id| must refer to content that
2316    /// was created via a call to CreateFilledRect. The color is not premultiplied. Color values
2317    /// must be within the range [0,1] inclusive, and normal 32-bit
2318    /// floating point values: https://en.wikipedia.org/wiki/Normal_number_%28computing%29. Values
2319    /// that do not conform to these specifications will cause the channel to close.
2320    /// The rectangle's top left corner will be at (0, 0) in its transform's coordinate space.
2321    /// Hence, its bottom right corner will be at (size.width, size.height).
2322    pub fn r#set_solid_fill(
2323        &self,
2324        mut rect_id: &ContentId,
2325        mut color: &ColorRgba,
2326        mut size: &fidl_fuchsia_math::SizeU,
2327    ) -> Result<(), fidl::Error> {
2328        self.client.send::<FlatlandSetSolidFillRequest>(
2329            (rect_id, color, size),
2330            0x32d6ef41e182dfa5,
2331            fidl::encoding::DynamicFlags::empty(),
2332        )
2333    }
2334
2335    /// Automatically garbage collects the rectangle when it is no longer needed for
2336    /// rendering. |rect_id| must have been instantiated with a call to
2337    /// |CreateFilledRect|. Once released, the ID immediately goes out of scope and is free
2338    /// to be used again.
2339    pub fn r#release_filled_rect(&self, mut rect_id: &ContentId) -> Result<(), fidl::Error> {
2340        self.client.send::<FlatlandReleaseFilledRectRequest>(
2341            (rect_id,),
2342            0x7392cabe45618f9b,
2343            fidl::encoding::DynamicFlags::empty(),
2344        )
2345    }
2346
2347    /// Setting a piece of Content on a Transform makes that Content visible in the render tree as
2348    /// long as the Transform is visible from the root Transform. The Content will be rendered
2349    /// before, and therefore "behind", any Content attached to the descendants of the Transform.
2350    ///
2351    /// Because each Transform can have, at most, a single piece of Content on it, calling this
2352    /// function on a Transform that already has Content will replace that Content.
2353    ///
2354    /// A Content may be set on more than one Transform.
2355    ///
2356    /// Calling this function with a Content id of 0 will remove any Content currently on the
2357    /// Transform.
2358    pub fn r#set_content(
2359        &self,
2360        mut transform_id: &TransformId,
2361        mut content_id: &ContentId,
2362    ) -> Result<(), fidl::Error> {
2363        self.client.send::<FlatlandSetContentRequest>(
2364            (transform_id, content_id),
2365            0x4ed2cfc0ce130862,
2366            fidl::encoding::DynamicFlags::empty(),
2367        )
2368    }
2369
2370    /// Transforms are usually sufficient to change how Content is presented. Viewports, however,
2371    /// have special properties that are not part of the Transform hierarchy. Those properties can
2372    /// be set using this function.
2373    pub fn r#set_viewport_properties(
2374        &self,
2375        mut viewport_id: &ContentId,
2376        mut properties: &ViewportProperties,
2377    ) -> Result<(), fidl::Error> {
2378        self.client.send::<FlatlandSetViewportPropertiesRequest>(
2379            (viewport_id, properties),
2380            0x66ab67e9608ddb9f,
2381            fidl::encoding::DynamicFlags::empty(),
2382        )
2383    }
2384
2385    /// Released Transforms will be garbage collected by the system once they are no longer
2386    /// necessary for rendering. For Transforms, this means there is no path from any unreleased
2387    /// Transform to the newly-released Transform.
2388    ///
2389    /// Once released, the id immediately goes out of scope for future function calls and can be
2390    /// reused when creating new Transforms.
2391    ///
2392    /// It is an error to call functions with a released id (unless that id has been reused to
2393    /// construct a new Transform).
2394    pub fn r#release_transform(&self, mut transform_id: &TransformId) -> Result<(), fidl::Error> {
2395        self.client.send::<FlatlandReleaseTransformRequest>(
2396            (transform_id,),
2397            0xab9328419451c22,
2398            fidl::encoding::DynamicFlags::empty(),
2399        )
2400    }
2401
2402    pub fn r#release_view(&self) -> Result<(), fidl::Error> {
2403        self.client.send::<fidl::encoding::EmptyPayload>(
2404            (),
2405            0x5b35aab9baffecae,
2406            fidl::encoding::DynamicFlags::empty(),
2407        )
2408    }
2409
2410    /// Releases a Viewport from the scene, even if the Viewport is still connected to a Transform.
2411    /// Unlike other resources, Viewports are garbage collected by the system during the next
2412    /// [`Present`] because a removed Viewport is guaranteed to provide no renderable content.
2413    ///
2414    /// Use SetContent(transform_id, 0) to clean up references to released Viewports.
2415    ///
2416    /// Despite having a return type, this function is still feed-forward like [`CreateView`] and
2417    /// requires a call to [`Present`] to be executed. The ViewportCreationToken will be returned
2418    /// after the presented operations have been executed.
2419    pub fn r#release_viewport(
2420        &self,
2421        mut viewport_id: &ContentId,
2422        ___deadline: zx::MonotonicInstant,
2423    ) -> Result<fidl_fuchsia_ui_views::ViewportCreationToken, fidl::Error> {
2424        let _response = self
2425            .client
2426            .send_query::<FlatlandReleaseViewportRequest, FlatlandReleaseViewportResponse>(
2427                (viewport_id,),
2428                0xbad474aeb5293f9,
2429                fidl::encoding::DynamicFlags::empty(),
2430                ___deadline,
2431            )?;
2432        Ok(_response.token)
2433    }
2434
2435    /// Released Images will be garbage collected by the system once they are no longer necessary
2436    /// for rendering. For Images, this means the Image is no longer attached to any Transform and
2437    /// any pending rendering that references the Image is complete.
2438    ///
2439    /// Use SetContent(transform_id, 0) to clean up references to released Images.
2440    ///
2441    /// Once released, the id immediately goes out of scope for future function calls and can be
2442    /// reused when creating new Images.
2443    ///
2444    /// It is an error to call functions with a released id (unless that id has been reused to
2445    /// construct a new Image).
2446    pub fn r#release_image(&self, mut image_id: &ContentId) -> Result<(), fidl::Error> {
2447        self.client.send::<FlatlandReleaseImageRequest>(
2448            (image_id,),
2449            0xb884ffdbc72c111,
2450            fidl::encoding::DynamicFlags::empty(),
2451        )
2452    }
2453
2454    /// This function will reset all state on this interface. This includes destroying all existing
2455    /// View and Viewports without returning the associated Token to the caller.
2456    pub fn r#clear(&self) -> Result<(), fidl::Error> {
2457        self.client.send::<fidl::encoding::EmptyPayload>(
2458            (),
2459            0x4ec8817c02828c3e,
2460            fidl::encoding::DynamicFlags::empty(),
2461        )
2462    }
2463
2464    /// Set debug name of the current client that can be used by Flatland to print as a prefix to
2465    /// logs to help client distinguish what is theirs. [`name`] can be an arbitrary string, but the
2466    /// current process name (see fsl::GetCurrentProcessName()) is a good default.
2467    pub fn r#set_debug_name(&self, mut name: &str) -> Result<(), fidl::Error> {
2468        self.client.send::<FlatlandSetDebugNameRequest>(
2469            (name,),
2470            0x46a8b397e68a8888,
2471            fidl::encoding::DynamicFlags::empty(),
2472        )
2473    }
2474}
2475
2476#[cfg(target_os = "fuchsia")]
2477impl From<FlatlandSynchronousProxy> for zx::Handle {
2478    fn from(value: FlatlandSynchronousProxy) -> Self {
2479        value.into_channel().into()
2480    }
2481}
2482
2483#[cfg(target_os = "fuchsia")]
2484impl From<fidl::Channel> for FlatlandSynchronousProxy {
2485    fn from(value: fidl::Channel) -> Self {
2486        Self::new(value)
2487    }
2488}
2489
2490#[derive(Debug, Clone)]
2491pub struct FlatlandProxy {
2492    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2493}
2494
2495impl fidl::endpoints::Proxy for FlatlandProxy {
2496    type Protocol = FlatlandMarker;
2497
2498    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2499        Self::new(inner)
2500    }
2501
2502    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2503        self.client.into_channel().map_err(|client| Self { client })
2504    }
2505
2506    fn as_channel(&self) -> &::fidl::AsyncChannel {
2507        self.client.as_channel()
2508    }
2509}
2510
2511impl FlatlandProxy {
2512    /// Create a new Proxy for fuchsia.ui.composition/Flatland.
2513    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2514        let protocol_name = <FlatlandMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2515        Self { client: fidl::client::Client::new(channel, protocol_name) }
2516    }
2517
2518    /// Get a Stream of events from the remote end of the protocol.
2519    ///
2520    /// # Panics
2521    ///
2522    /// Panics if the event stream was already taken.
2523    pub fn take_event_stream(&self) -> FlatlandEventStream {
2524        FlatlandEventStream { event_receiver: self.client.take_event_receiver() }
2525    }
2526
2527    /// Complete execution of all feed-forward operations.
2528    ///
2529    /// If executing an operation produces an error (e.g., CreateTransform(0)), an [`OnError`] event
2530    /// is emitted. Operations that produce errors are ignored and the channel is closed.
2531    ///
2532    /// If the execution is completed successfully, [`OnNextFrameBegin`] emits NO_ERROR along
2533    /// with other valid fields.
2534    ///
2535    /// The client may only call [`Present`] when they have a non-zero number of present credits,
2536    /// which are tracked by the server. The server may increment the number of credits when it
2537    /// fires the [`OnNextFrameBegin`] event, which informs the client when it receives additional
2538    /// present credits. Each [`Present`] call uses one present credit and decrements the server
2539    /// count by one. If the client calls [`Present`] with no present credits, the server will
2540    /// return a `NO_PRESENTS_REMAINING` error.
2541    ///
2542    /// The client should assume that prior to receiving any [`OnNextFrameBegin`] events, they have
2543    /// one present credit.
2544    ///
2545    /// Every [`Present`] call results in one [`OnNextFrameBegin`] event, and one
2546    /// [`OnFramePresented`] event, typically in that order.
2547    ///
2548    /// When the commands flushed by [`Present`] make it to display, an [`OnFramePresented`] event
2549    /// is fired. This event includes information pertaining to all [`Present`]s that had content
2550    /// that were part of that frame.
2551    ///
2552    /// See [`fuchsia.ui.composition/PresentArgs`] documentation above for more detailed information
2553    /// on what arguments are passed in and their role.
2554    pub fn r#present(&self, mut args: PresentArgs) -> Result<(), fidl::Error> {
2555        FlatlandProxyInterface::r#present(self, args)
2556    }
2557
2558    /// Two Flatland instances may be connected in a parent-child relationship. The parent endpoint
2559    /// is held in a Viewport, and the child endpoint is held in a View. The parent Flatland
2560    /// instance that creates a Viewport has control over how the child's View is integrated into
2561    /// its own View.
2562    ///
2563    /// The lifecycle of a parent-child connection starts with two endpoints of a channel object:
2564    /// a ViewportCreationToken and a ViewCreationToken. Out-of-band protocols pass the
2565    /// ViewportCreationToken to the parent, which calls [`CreateViewport`], and the
2566    /// ViewCreationToken to the child, which calls [`CreateView`].
2567    ///
2568    /// Only nodes connected to the Root Transform in this Flatland instance will be rendered into
2569    /// the parent's Viewport.
2570    ///
2571    /// Calling [`CreateView`] a second time will disconnect the Root Transform from the existing
2572    /// parent's Viewport, and attach it to a new parent's Viewport. In other words, each View can
2573    /// only have one parent.
2574    ///
2575    /// This function is queued, meaning that the Root Transform will not be attached to the
2576    /// parent Viewport until [`Present`] is called. However, clients will receive information
2577    /// through their ParentViewportWatcher (e.g., LayoutInfo) immediately after calling this
2578    /// function, even if they have not called [`Present`] or [`SetRootTransform`]. This allows
2579    /// clients to wait for layout information from their parent before calling [`Present`].
2580    ///
2581    /// Any illegal operations on ParentViewportWatcher will cause both ParentViewportWatcher
2582    /// channel and this Flatland channel to be torn down.
2583    ///
2584    /// Lifecycle note. The lifetime of the ParentViewportWatcher channel is bound by the peer
2585    /// ViewportCreationToken. When the ViewportCreationToken dies, this ParentViewportWatcher
2586    /// channel is destroyed.
2587    ///
2588    /// Views and subgraphs of Views created using `CreateView` will not be represented in the
2589    /// ViewTree, and hence will not be able to participate in any ViewTree-dependent interactions
2590    /// such as touch, mouse or focus.
2591    /// The Flatland protocol provides no way for Views in the subgraph of a View created with
2592    /// `CreateView` to know that they are excluded from the ViewTree.
2593    pub fn r#create_view(
2594        &self,
2595        mut token: fidl_fuchsia_ui_views::ViewCreationToken,
2596        mut parent_viewport_watcher: fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>,
2597    ) -> Result<(), fidl::Error> {
2598        FlatlandProxyInterface::r#create_view(self, token, parent_viewport_watcher)
2599    }
2600
2601    /// Identical to [`CreateView`], except it allows association of View identity (ViewRef) and
2602    /// view-bound protocols.
2603    pub fn r#create_view2(
2604        &self,
2605        mut token: fidl_fuchsia_ui_views::ViewCreationToken,
2606        mut view_identity: fidl_fuchsia_ui_views::ViewIdentityOnCreation,
2607        mut protocols: ViewBoundProtocols,
2608        mut parent_viewport_watcher: fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>,
2609    ) -> Result<(), fidl::Error> {
2610        FlatlandProxyInterface::r#create_view2(
2611            self,
2612            token,
2613            view_identity,
2614            protocols,
2615            parent_viewport_watcher,
2616        )
2617    }
2618
2619    /// Creates a new Transform node. Transforms are a hierarchical piece of a Flatland graph. They
2620    /// can have children, and can reference Content. A sub-graph represented by a Transform and its
2621    /// descendants can be rendered to a display.
2622    ///
2623    /// Transforms are kept alive, even when released, as long as they are children of either an
2624    /// unreleased Transform, or the Root Transform.
2625    ///
2626    /// Each Transform can have a single piece of attached Content. Common types of Content include
2627    /// bitmaps, asynchronous streams of images, and Viewports to Views hosted in other Flatland
2628    /// instances.
2629    ///
2630    /// Transforms have attributes. Child Transforms inherit the combined attributes of their
2631    /// parents. Content attached to a Transform is also affected by that Transform's attributes.
2632    ///
2633    /// When a sub-graph of Transforms is rendered, Content will be rendered back-to-front, starting
2634    /// with the Content on the root transform, and continuing recursively through all of its child
2635    /// Transforms in the order the children were added. See [`AddChild`] for more information.
2636    ///
2637    /// Zero is not a valid transform id. All other values are valid, assuming they are not already
2638    /// in use (see [`ReleaseTransform`] for more details).
2639    pub fn r#create_transform(&self, mut transform_id: &TransformId) -> Result<(), fidl::Error> {
2640        FlatlandProxyInterface::r#create_transform(self, transform_id)
2641    }
2642
2643    /// All Transform objects support all attributes.
2644    ///
2645    /// Geometric attributes are applied in the following order:
2646    /// 1. Scale (relative to the parent transform's coordinate space)
2647    /// 2. Orientation (relative to the parent transform's coordinate space)
2648    /// 3. Translation (relative to the parent transforms's coordinate space,
2649    ///    unaffected by scale applied to the current transform).
2650    /// 4. Clipping (relative to the current transform's coordinate space)
2651    ///
2652    /// The effects of each of these attributes are cumulative. This means the transform's position
2653    /// in the view space, and its clip boundary, will be calculated based on that chain of
2654    /// geometric attributes going up to the root transform.
2655    ///
2656    /// For instance, in a nested hierarchy such as the following:
2657    ///     [Root-Transform -> Transform1 -> Transform2 -> CurrentTransform]
2658    /// If Transform1 is translated by [2,0] and Transform2 is translated by [0,1] then the
2659    /// view-space position of CurrentTransform will be [2,1].
2660    ///
2661    /// Sets the translation on a Transform. The order of geometric attribute application is
2662    /// addressed above.
2663    pub fn r#set_translation(
2664        &self,
2665        mut transform_id: &TransformId,
2666        mut translation: &fidl_fuchsia_math::Vec_,
2667    ) -> Result<(), fidl::Error> {
2668        FlatlandProxyInterface::r#set_translation(self, transform_id, translation)
2669    }
2670
2671    /// Sets the orientation on a Transform. The order of geometric attribute application is
2672    /// addressed in the documentation for [`SetTranslation`]. In Flatland, the +X axis is
2673    /// to the right and the +Y axis is down. There is no notion of a Z axis. CCW is defined
2674    /// from the POV of the user, as if a skeuomorphoic clock is displayed on the screen.
2675    pub fn r#set_orientation(
2676        &self,
2677        mut transform_id: &TransformId,
2678        mut orientation: Orientation,
2679    ) -> Result<(), fidl::Error> {
2680        FlatlandProxyInterface::r#set_orientation(self, transform_id, orientation)
2681    }
2682
2683    /// Sets the scale on a transform. The order of geometric attribute application is
2684    /// addressed above. The (x,y) values in the VecF |scale| refer to the scale factor in the
2685    /// x-axis (width) and y-axis (height) respectively. Scale values must be normal 32-bit
2686    /// floating point values: https://en.wikipedia.org/wiki/Normal_number_%28computing%29
2687    pub fn r#set_scale(
2688        &self,
2689        mut transform_id: &TransformId,
2690        mut scale: &fidl_fuchsia_math::VecF,
2691    ) -> Result<(), fidl::Error> {
2692        FlatlandProxyInterface::r#set_scale(self, transform_id, scale)
2693    }
2694
2695    /// Sets an opacity in linear space to be applied to a transform and its descendents,
2696    /// which include other transforms and content. Opacity values must be in the range
2697    /// of [0.0, 1.0], where 0.0 is completely transparent and 1.0 is completely opaque.
2698    /// Attempting to call this function with values outside that range will result in
2699    /// an error. A transform's opacity value is multiplied with that of its parent. This
2700    /// effect works differently from group opacity. Using group opacity, child nodes are
2701    /// rendered together first, and then have the parent's opacity applied as a post-effect.
2702    /// Here, opacity is applied to each child individually. This may result in a very
2703    /// different effect.
2704    pub fn r#set_opacity(
2705        &self,
2706        mut transform_id: &TransformId,
2707        mut value: f32,
2708    ) -> Result<(), fidl::Error> {
2709        FlatlandProxyInterface::r#set_opacity(self, transform_id, value)
2710    }
2711
2712    /// Sets the bounds, expressed in the local coordinate space of the transform, that
2713    /// constrains the region that content attached to this transform can be rendered to.
2714    /// If the content's area exceeds the clip bounds, the area outside the bounds will
2715    /// not be rendered. These bounds are valid for all children of this transform node as
2716    /// well, which includes nested Flatland instances and their node hierarchies.
2717    /// If a child transform attempts to set clip bounds larger than that of its parent,
2718    /// it will be clipped to the parent's clip bounds. The default state is for a transform
2719    /// to be unclipped, meaning it will not have any bounds placed on its render region.
2720    /// The clip width/height must be positive. Negative values will result in an error.
2721    /// Passing in an empty box to the |rect| parameter will remove the clip bounds.
2722    pub fn r#set_clip_boundary(
2723        &self,
2724        mut transform_id: &TransformId,
2725        mut rect: Option<&fidl_fuchsia_math::Rect>,
2726    ) -> Result<(), fidl::Error> {
2727        FlatlandProxyInterface::r#set_clip_boundary(self, transform_id, rect)
2728    }
2729
2730    /// Adds a child Transform to a parent Transform. The new child Transform, and any Content
2731    /// attached to it or its children, will be rendered on top of the parent's Content, as well as
2732    /// any previously added children.
2733    pub fn r#add_child(
2734        &self,
2735        mut parent_transform_id: &TransformId,
2736        mut child_transform_id: &TransformId,
2737    ) -> Result<(), fidl::Error> {
2738        FlatlandProxyInterface::r#add_child(self, parent_transform_id, child_transform_id)
2739    }
2740
2741    /// Removes a child Transform from a parent Transform.
2742    pub fn r#remove_child(
2743        &self,
2744        mut parent_transform_id: &TransformId,
2745        mut child_transform_id: &TransformId,
2746    ) -> Result<(), fidl::Error> {
2747        FlatlandProxyInterface::r#remove_child(self, parent_transform_id, child_transform_id)
2748    }
2749
2750    /// Removes all child Transforms from a parent Transform and replaces them with the new child
2751    /// transforms in `new_child_transform_ids`.
2752    pub fn r#replace_children(
2753        &self,
2754        mut parent_transform_id: &TransformId,
2755        mut new_child_transform_ids: &[TransformId],
2756    ) -> Result<(), fidl::Error> {
2757        FlatlandProxyInterface::r#replace_children(
2758            self,
2759            parent_transform_id,
2760            new_child_transform_ids,
2761        )
2762    }
2763
2764    /// Sets the Root Transform for the graph.
2765    ///
2766    /// The sub-graph defined by the Root Transform and its children will be rendered as View
2767    /// in the connected parent's Viewport (see [`CreateView`]). Any parents of the Root Transform
2768    /// in this Graph will be ignored.
2769    ///
2770    /// The Root Transform, and all children of the Root Transform, are kept alive if they are
2771    /// released (see [`ReleaseTransform`] for more details).
2772    ///
2773    /// There is only ever one Root. Since 0 is not a valid transform id (see [`CreateTransform`]),
2774    /// calling SetRootTransform(0) clears the current Root, destroying any previously released
2775    /// objects that are not referenced by the new root.
2776    ///
2777    /// Note that every View has a clip boundary equivalent to its logical size. Anything outside
2778    /// that clip boundary will not be rendered. Hence, the Root Transform has a useful coordinate
2779    /// space of (0, 0) to (logical_size.width, logical_size.height), where (0, 0) is the upper left
2780    /// corner.
2781    ///
2782    /// Setting the root transform installs a full screen hit region on the root transform. Clients
2783    /// may remove this hit region if they don't want users to be able to interact with the root
2784    /// transform's content. For additional details on hit regions, see the [`SetHitRegions`]
2785    /// documentation.
2786    ///
2787    /// Default hit region rules
2788    ///
2789    ///   A default hit region follows these rules:
2790    ///   - When [`SetRootTransform`](T) is called, T receives a maximal hit region, covering the
2791    ///   entire view.
2792    ///   - If [`SetHitRegions`] is called on T, either before or after [`SetRootTransform`](T),
2793    ///   then no default hit region is active and the client specified hit regions are used.
2794    ///   - If a transform is no longer the root transform, i.e., [`SetRootTransform`](U) is
2795    ///   called, then the original transform no longer has its default hit region.
2796    ///   - Clients can remove or modify the root transform's hit regions the same way they would
2797    ///   reset any other transform's hit regions, by calling [`SetHitRegions`] with the appropriate
2798    ///   vector.
2799    pub fn r#set_root_transform(&self, mut transform_id: &TransformId) -> Result<(), fidl::Error> {
2800        FlatlandProxyInterface::r#set_root_transform(self, transform_id)
2801    }
2802
2803    /// Sets the interactive areas for a Transform. By default, Content is not interactive; hit
2804    /// regions must be placed for a user to interact with the Content in a View. Because hit
2805    /// regions are described in the Flatland protocol, a Flatland instance can synchronize Content
2806    /// and hit regions.
2807    ///
2808    /// Each hit region is placed in the coordinate space of the owning Transform, and may or may
2809    /// not interact with different types of hit testing, depending on its [`HitTestInteraction`]
2810    /// type. When there are multiple hit regions that intersect with a hit test, the precedence
2811    /// rules given below dictate which hit region has interacted with the hit test. Only Transforms
2812    /// that transitively connect to the root Transform have their hit regions interact with a hit
2813    /// test.
2814    ///
2815    /// Calling this function replaces any previous values set on this Transform. To reset a
2816    /// Transform to "no hit testing": send an empty vector with [`SetHitRegions`].
2817    ///
2818    /// Note that root transforms get a default hit region installed by Flatland. For more details,
2819    /// see the [`SetRootTransform`] documentation.
2820    ///
2821    /// Precedence rules
2822    ///   Within a Transform, if multiple hit regions overlap, the hit test examines each
2823    ///   intersecting hit region for a possible interaction. Thus, for a regular hit test R and an
2824    ///   accessibility hit test A, where R and A both intersect two hit regions D ([`DEFAULT`]) and
2825    ///   S ([`SEMANTICALLY_INVISIBLE`]) on the same Transform, (1) R interacts with both D and S,
2826    ///   and (2) A only interacts with D. Generally, hit regions that overlap in a single Transform
2827    ///   can cause confusing behavior.
2828    ///
2829    ///   Within a View, for a given hit test, the front-most Transform's hit regions take
2830    ///   precedence over those behind. This follows the expected reverse "render order" of
2831    ///   Transforms (described in [`CreateTransform`]), where a user expects to interact with
2832    ///   Content that is visible, or front-most.
2833    ///
2834    ///   Across Flatland instances, for a given hit test, the front-most instance's front-most
2835    ///   Transform's hit regions take precedence over those behind. This follows the expected
2836    ///   reverse "render order" of views, where a user expects to interact with the View that is
2837    ///   visible, or front-most. For example, if a child View owns Content that is rendered over
2838    ///   the parent View, the user expects to interact with the child's Content.
2839    pub fn r#set_hit_regions(
2840        &self,
2841        mut transform_id: &TransformId,
2842        mut regions: &[HitRegion],
2843    ) -> Result<(), fidl::Error> {
2844        FlatlandProxyInterface::r#set_hit_regions(self, transform_id, regions)
2845    }
2846
2847    /// Identical to [`SetHitRegions`], except the hit region associated with [`transform_id`]
2848    /// covers an infinite region. The hit region is invariant against translation, scaling, and
2849    /// orientation of the Transform.
2850    ///
2851    /// An infinite hit region is still limited in extent by the View's clip boundary, just like a
2852    /// finite hit region.
2853    ///
2854    /// Calling this function replaces any previous values set on this Transform. To reset a
2855    /// Transform to "no hit testing": send an empty vector with [`SetHitRegions`].
2856    pub fn r#set_infinite_hit_region(
2857        &self,
2858        mut transform_id: &TransformId,
2859        mut hit_test: HitTestInteraction,
2860    ) -> Result<(), fidl::Error> {
2861        FlatlandProxyInterface::r#set_infinite_hit_region(self, transform_id, hit_test)
2862    }
2863
2864    /// The Viewport and View pair, together, represent the connection between two Flatland
2865    /// instances. The Viewport is created in the parent, and the View is created in the child. The
2866    /// parent has control over how the child's View is integrated into its own View.
2867    ///
2868    /// Any illegal operations on ChildViewWatcher will cause both ChildViewWatcher channel and this
2869    /// Flatland channel to be torn down.
2870    ///
2871    /// `ViewportProperties` must have logical_size set. This is the initial size that will drive
2872    /// the layout of the child. The logical_size is also used as the default Content size, but
2873    /// subsequent changes to the logical_size will have no effect on the Content size.
2874    ///
2875    /// `ViewportProperties` may have inset field not set. In that case, the default value of
2876    /// (0, 0, 0, 0) is used.
2877    ///
2878    /// The logical_size must have positive X and Y components.
2879    ///
2880    /// Zero is not a valid ContentId. All other values are valid, assuming they are not already
2881    /// in use for another piece of Content (see [`ReleaseViewport`] for more details).
2882    ///
2883    /// Lifecycle note. The lifetime of the ChildViewWatcher channel is bound by the peer
2884    /// ViewCreationToken. When the ViewCreationToken dies, this ChildViewWatcher channel is
2885    /// destroyed.
2886    pub fn r#create_viewport(
2887        &self,
2888        mut viewport_id: &ContentId,
2889        mut token: fidl_fuchsia_ui_views::ViewportCreationToken,
2890        mut properties: &ViewportProperties,
2891        mut child_view_watcher: fidl::endpoints::ServerEnd<ChildViewWatcherMarker>,
2892    ) -> Result<(), fidl::Error> {
2893        FlatlandProxyInterface::r#create_viewport(
2894            self,
2895            viewport_id,
2896            token,
2897            properties,
2898            child_view_watcher,
2899        )
2900    }
2901
2902    /// An Image is a bitmap backed by a specific VMO in a BufferCollection.
2903    ///
2904    /// Image creation requires an allocated BufferCollection registered with Allocator. This
2905    /// function will fail unless all clients of the specified BufferCollection have set their
2906    /// constraints.
2907    ///
2908    /// The Image must reference a valid VMO index and must have ImageProperties that fall within
2909    /// the constraints specified by the backing BufferCollection (i.e. width and height within a
2910    /// valid range, etc.)
2911    ///
2912    /// Zero is not a valid Image id. All other values are valid, assuming they are not already in
2913    /// use for another piece of Content (see [`ReleaseImage`] for more details).
2914    pub fn r#create_image(
2915        &self,
2916        mut image_id: &ContentId,
2917        mut import_token: BufferCollectionImportToken,
2918        mut vmo_index: u32,
2919        mut properties: &ImageProperties,
2920    ) -> Result<(), fidl::Error> {
2921        FlatlandProxyInterface::r#create_image(self, image_id, import_token, vmo_index, properties)
2922    }
2923
2924    /// This function is used to determine the region (in texel space) of an image that will be used
2925    /// by Flatland when rendering. The image to be sampled is referenced by [`image_id`] and the
2926    /// sample region is specified by [`rect`] which itself is comprised of an origin point (x,y) as
2927    /// well as a width and height, in unnormalized coordinates. It is illegal to call this function
2928    /// on non-image content, or to sample a region outside of the texel space of the image. In
2929    /// other words, the region specifed by [`rect`] must not exceed the ranges (0, image_width) and
2930    /// (0, image_height). If (rect.x + rect.width > image_width) or (rect.y + rect.height >
2931    /// image_height) or if any of the values are negative, this will result in an error.
2932    ///
2933    /// If this method is not called, the default sample region is the rectangle with origin at
2934    /// (0, 0) and width and height set at ImageProperties from [`CreateImage`].
2935    pub fn r#set_image_sample_region(
2936        &self,
2937        mut image_id: &ContentId,
2938        mut rect: &fidl_fuchsia_math::RectF,
2939    ) -> Result<(), fidl::Error> {
2940        FlatlandProxyInterface::r#set_image_sample_region(self, image_id, rect)
2941    }
2942
2943    /// The content size for an Image is the size of the rectangle in the parent's logical
2944    /// coordinate space that the image occupies. This combined with the global translation of the
2945    /// transform it is attached to determines the size and location of where the content is
2946    /// rendered on the display.
2947    ///
2948    /// If this method is not called, the default image destination size is the width and height set
2949    /// at ImageProperties from [`CreateImage`]. The destination size will be affected by scaling if
2950    /// [`SetScale`] is used on the attached Transform or its parents.
2951    pub fn r#set_image_destination_size(
2952        &self,
2953        mut image_id: &ContentId,
2954        mut size: &fidl_fuchsia_math::SizeU,
2955    ) -> Result<(), fidl::Error> {
2956        FlatlandProxyInterface::r#set_image_destination_size(self, image_id, size)
2957    }
2958
2959    /// Determines the blend function to use when rendering the content specified by
2960    /// |image_id|. |image_id| must be a valid ContentId associated to a transform through
2961    /// a call to |CreateImage| or |CreateFilledRect|. For details on the different blend functions
2962    /// that are available, please refer to the BlendMode enum. If this function is not called, then
2963    /// the default blendmode is BlendMode::SRC.
2964    pub fn r#set_image_blending_function(
2965        &self,
2966        mut image_id: &ContentId,
2967        mut blend_mode: BlendMode,
2968    ) -> Result<(), fidl::Error> {
2969        FlatlandProxyInterface::r#set_image_blending_function(self, image_id, blend_mode)
2970    }
2971
2972    /// Sets an opacity in linear space to be applied to a flatland image. Opacity values must
2973    /// be in the range [0.0, 1.0].
2974    pub fn r#set_image_opacity(
2975        &self,
2976        mut image_id: &ContentId,
2977        mut val: f32,
2978    ) -> Result<(), fidl::Error> {
2979        FlatlandProxyInterface::r#set_image_opacity(self, image_id, val)
2980    }
2981
2982    /// Sets the image flip to be applied to a flatland image. This call must be performed after a
2983    /// successful |CreateImage| call. If an invalid |image_id| is supplied, the channel will be
2984    /// closed due to FlatlandError::BAD_OPERATION. This flip will be applied to the Image before
2985    /// parent Transform Orientations. If this function is not called, then the default flip value
2986    /// is ImageFlip::NONE.
2987    pub fn r#set_image_flip(
2988        &self,
2989        mut image_id: &ContentId,
2990        mut flip: ImageFlip,
2991    ) -> Result<(), fidl::Error> {
2992        FlatlandProxyInterface::r#set_image_flip(self, image_id, flip)
2993    }
2994
2995    /// Creates a solid-color rectangle. By default a filled-rect does not have a defined
2996    /// color or size. It is necessary to call |SetSolidFill| to specify a color and size
2997    /// before a filled rect can be used for rendering. Not doing so will result the
2998    pub fn r#create_filled_rect(&self, mut rect_id: &ContentId) -> Result<(), fidl::Error> {
2999        FlatlandProxyInterface::r#create_filled_rect(self, rect_id)
3000    }
3001
3002    /// Defines the color and size of a filled rect. |rect_id| must refer to content that
3003    /// was created via a call to CreateFilledRect. The color is not premultiplied. Color values
3004    /// must be within the range [0,1] inclusive, and normal 32-bit
3005    /// floating point values: https://en.wikipedia.org/wiki/Normal_number_%28computing%29. Values
3006    /// that do not conform to these specifications will cause the channel to close.
3007    /// The rectangle's top left corner will be at (0, 0) in its transform's coordinate space.
3008    /// Hence, its bottom right corner will be at (size.width, size.height).
3009    pub fn r#set_solid_fill(
3010        &self,
3011        mut rect_id: &ContentId,
3012        mut color: &ColorRgba,
3013        mut size: &fidl_fuchsia_math::SizeU,
3014    ) -> Result<(), fidl::Error> {
3015        FlatlandProxyInterface::r#set_solid_fill(self, rect_id, color, size)
3016    }
3017
3018    /// Automatically garbage collects the rectangle when it is no longer needed for
3019    /// rendering. |rect_id| must have been instantiated with a call to
3020    /// |CreateFilledRect|. Once released, the ID immediately goes out of scope and is free
3021    /// to be used again.
3022    pub fn r#release_filled_rect(&self, mut rect_id: &ContentId) -> Result<(), fidl::Error> {
3023        FlatlandProxyInterface::r#release_filled_rect(self, rect_id)
3024    }
3025
3026    /// Setting a piece of Content on a Transform makes that Content visible in the render tree as
3027    /// long as the Transform is visible from the root Transform. The Content will be rendered
3028    /// before, and therefore "behind", any Content attached to the descendants of the Transform.
3029    ///
3030    /// Because each Transform can have, at most, a single piece of Content on it, calling this
3031    /// function on a Transform that already has Content will replace that Content.
3032    ///
3033    /// A Content may be set on more than one Transform.
3034    ///
3035    /// Calling this function with a Content id of 0 will remove any Content currently on the
3036    /// Transform.
3037    pub fn r#set_content(
3038        &self,
3039        mut transform_id: &TransformId,
3040        mut content_id: &ContentId,
3041    ) -> Result<(), fidl::Error> {
3042        FlatlandProxyInterface::r#set_content(self, transform_id, content_id)
3043    }
3044
3045    /// Transforms are usually sufficient to change how Content is presented. Viewports, however,
3046    /// have special properties that are not part of the Transform hierarchy. Those properties can
3047    /// be set using this function.
3048    pub fn r#set_viewport_properties(
3049        &self,
3050        mut viewport_id: &ContentId,
3051        mut properties: &ViewportProperties,
3052    ) -> Result<(), fidl::Error> {
3053        FlatlandProxyInterface::r#set_viewport_properties(self, viewport_id, properties)
3054    }
3055
3056    /// Released Transforms will be garbage collected by the system once they are no longer
3057    /// necessary for rendering. For Transforms, this means there is no path from any unreleased
3058    /// Transform to the newly-released Transform.
3059    ///
3060    /// Once released, the id immediately goes out of scope for future function calls and can be
3061    /// reused when creating new Transforms.
3062    ///
3063    /// It is an error to call functions with a released id (unless that id has been reused to
3064    /// construct a new Transform).
3065    pub fn r#release_transform(&self, mut transform_id: &TransformId) -> Result<(), fidl::Error> {
3066        FlatlandProxyInterface::r#release_transform(self, transform_id)
3067    }
3068
3069    pub fn r#release_view(&self) -> Result<(), fidl::Error> {
3070        FlatlandProxyInterface::r#release_view(self)
3071    }
3072
3073    /// Releases a Viewport from the scene, even if the Viewport is still connected to a Transform.
3074    /// Unlike other resources, Viewports are garbage collected by the system during the next
3075    /// [`Present`] because a removed Viewport is guaranteed to provide no renderable content.
3076    ///
3077    /// Use SetContent(transform_id, 0) to clean up references to released Viewports.
3078    ///
3079    /// Despite having a return type, this function is still feed-forward like [`CreateView`] and
3080    /// requires a call to [`Present`] to be executed. The ViewportCreationToken will be returned
3081    /// after the presented operations have been executed.
3082    pub fn r#release_viewport(
3083        &self,
3084        mut viewport_id: &ContentId,
3085    ) -> fidl::client::QueryResponseFut<
3086        fidl_fuchsia_ui_views::ViewportCreationToken,
3087        fidl::encoding::DefaultFuchsiaResourceDialect,
3088    > {
3089        FlatlandProxyInterface::r#release_viewport(self, viewport_id)
3090    }
3091
3092    /// Released Images will be garbage collected by the system once they are no longer necessary
3093    /// for rendering. For Images, this means the Image is no longer attached to any Transform and
3094    /// any pending rendering that references the Image is complete.
3095    ///
3096    /// Use SetContent(transform_id, 0) to clean up references to released Images.
3097    ///
3098    /// Once released, the id immediately goes out of scope for future function calls and can be
3099    /// reused when creating new Images.
3100    ///
3101    /// It is an error to call functions with a released id (unless that id has been reused to
3102    /// construct a new Image).
3103    pub fn r#release_image(&self, mut image_id: &ContentId) -> Result<(), fidl::Error> {
3104        FlatlandProxyInterface::r#release_image(self, image_id)
3105    }
3106
3107    /// This function will reset all state on this interface. This includes destroying all existing
3108    /// View and Viewports without returning the associated Token to the caller.
3109    pub fn r#clear(&self) -> Result<(), fidl::Error> {
3110        FlatlandProxyInterface::r#clear(self)
3111    }
3112
3113    /// Set debug name of the current client that can be used by Flatland to print as a prefix to
3114    /// logs to help client distinguish what is theirs. [`name`] can be an arbitrary string, but the
3115    /// current process name (see fsl::GetCurrentProcessName()) is a good default.
3116    pub fn r#set_debug_name(&self, mut name: &str) -> Result<(), fidl::Error> {
3117        FlatlandProxyInterface::r#set_debug_name(self, name)
3118    }
3119}
3120
3121impl FlatlandProxyInterface for FlatlandProxy {
3122    fn r#present(&self, mut args: PresentArgs) -> Result<(), fidl::Error> {
3123        self.client.send::<FlatlandPresentRequest>(
3124            (&mut args,),
3125            0x50acc2aa1f0acec7,
3126            fidl::encoding::DynamicFlags::empty(),
3127        )
3128    }
3129
3130    fn r#create_view(
3131        &self,
3132        mut token: fidl_fuchsia_ui_views::ViewCreationToken,
3133        mut parent_viewport_watcher: fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>,
3134    ) -> Result<(), fidl::Error> {
3135        self.client.send::<FlatlandCreateViewRequest>(
3136            (&mut token, parent_viewport_watcher),
3137            0x504686eb25864780,
3138            fidl::encoding::DynamicFlags::empty(),
3139        )
3140    }
3141
3142    fn r#create_view2(
3143        &self,
3144        mut token: fidl_fuchsia_ui_views::ViewCreationToken,
3145        mut view_identity: fidl_fuchsia_ui_views::ViewIdentityOnCreation,
3146        mut protocols: ViewBoundProtocols,
3147        mut parent_viewport_watcher: fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>,
3148    ) -> Result<(), fidl::Error> {
3149        self.client.send::<FlatlandCreateView2Request>(
3150            (&mut token, &mut view_identity, &mut protocols, parent_viewport_watcher),
3151            0x340a3a40c2fdbd5e,
3152            fidl::encoding::DynamicFlags::empty(),
3153        )
3154    }
3155
3156    fn r#create_transform(&self, mut transform_id: &TransformId) -> Result<(), fidl::Error> {
3157        self.client.send::<FlatlandCreateTransformRequest>(
3158            (transform_id,),
3159            0x5e042a4d3de3efb0,
3160            fidl::encoding::DynamicFlags::empty(),
3161        )
3162    }
3163
3164    fn r#set_translation(
3165        &self,
3166        mut transform_id: &TransformId,
3167        mut translation: &fidl_fuchsia_math::Vec_,
3168    ) -> Result<(), fidl::Error> {
3169        self.client.send::<FlatlandSetTranslationRequest>(
3170            (transform_id, translation),
3171            0x7863398291fba346,
3172            fidl::encoding::DynamicFlags::empty(),
3173        )
3174    }
3175
3176    fn r#set_orientation(
3177        &self,
3178        mut transform_id: &TransformId,
3179        mut orientation: Orientation,
3180    ) -> Result<(), fidl::Error> {
3181        self.client.send::<FlatlandSetOrientationRequest>(
3182            (transform_id, orientation),
3183            0x4915310bc4928edc,
3184            fidl::encoding::DynamicFlags::empty(),
3185        )
3186    }
3187
3188    fn r#set_scale(
3189        &self,
3190        mut transform_id: &TransformId,
3191        mut scale: &fidl_fuchsia_math::VecF,
3192    ) -> Result<(), fidl::Error> {
3193        self.client.send::<FlatlandSetScaleRequest>(
3194            (transform_id, scale),
3195            0x1ea1766fd8996bb4,
3196            fidl::encoding::DynamicFlags::empty(),
3197        )
3198    }
3199
3200    fn r#set_opacity(
3201        &self,
3202        mut transform_id: &TransformId,
3203        mut value: f32,
3204    ) -> Result<(), fidl::Error> {
3205        self.client.send::<FlatlandSetOpacityRequest>(
3206            (transform_id, value),
3207            0x3775fc2c00b432fa,
3208            fidl::encoding::DynamicFlags::empty(),
3209        )
3210    }
3211
3212    fn r#set_clip_boundary(
3213        &self,
3214        mut transform_id: &TransformId,
3215        mut rect: Option<&fidl_fuchsia_math::Rect>,
3216    ) -> Result<(), fidl::Error> {
3217        self.client.send::<FlatlandSetClipBoundaryRequest>(
3218            (transform_id, rect),
3219            0x6507843df12222d2,
3220            fidl::encoding::DynamicFlags::empty(),
3221        )
3222    }
3223
3224    fn r#add_child(
3225        &self,
3226        mut parent_transform_id: &TransformId,
3227        mut child_transform_id: &TransformId,
3228    ) -> Result<(), fidl::Error> {
3229        self.client.send::<FlatlandAddChildRequest>(
3230            (parent_transform_id, child_transform_id),
3231            0x67a8abd2f19b1a74,
3232            fidl::encoding::DynamicFlags::empty(),
3233        )
3234    }
3235
3236    fn r#remove_child(
3237        &self,
3238        mut parent_transform_id: &TransformId,
3239        mut child_transform_id: &TransformId,
3240    ) -> Result<(), fidl::Error> {
3241        self.client.send::<FlatlandRemoveChildRequest>(
3242            (parent_transform_id, child_transform_id),
3243            0x41d6cd90b298b67a,
3244            fidl::encoding::DynamicFlags::empty(),
3245        )
3246    }
3247
3248    fn r#replace_children(
3249        &self,
3250        mut parent_transform_id: &TransformId,
3251        mut new_child_transform_ids: &[TransformId],
3252    ) -> Result<(), fidl::Error> {
3253        self.client.send::<FlatlandReplaceChildrenRequest>(
3254            (parent_transform_id, new_child_transform_ids),
3255            0x5b6d86cbbff81316,
3256            fidl::encoding::DynamicFlags::empty(),
3257        )
3258    }
3259
3260    fn r#set_root_transform(&self, mut transform_id: &TransformId) -> Result<(), fidl::Error> {
3261        self.client.send::<FlatlandSetRootTransformRequest>(
3262            (transform_id,),
3263            0x6e80ca5bcc566cd8,
3264            fidl::encoding::DynamicFlags::empty(),
3265        )
3266    }
3267
3268    fn r#set_hit_regions(
3269        &self,
3270        mut transform_id: &TransformId,
3271        mut regions: &[HitRegion],
3272    ) -> Result<(), fidl::Error> {
3273        self.client.send::<FlatlandSetHitRegionsRequest>(
3274            (transform_id, regions),
3275            0x31c9d17b07c37ce4,
3276            fidl::encoding::DynamicFlags::empty(),
3277        )
3278    }
3279
3280    fn r#set_infinite_hit_region(
3281        &self,
3282        mut transform_id: &TransformId,
3283        mut hit_test: HitTestInteraction,
3284    ) -> Result<(), fidl::Error> {
3285        self.client.send::<FlatlandSetInfiniteHitRegionRequest>(
3286            (transform_id, hit_test),
3287            0x26d81af852d29562,
3288            fidl::encoding::DynamicFlags::empty(),
3289        )
3290    }
3291
3292    fn r#create_viewport(
3293        &self,
3294        mut viewport_id: &ContentId,
3295        mut token: fidl_fuchsia_ui_views::ViewportCreationToken,
3296        mut properties: &ViewportProperties,
3297        mut child_view_watcher: fidl::endpoints::ServerEnd<ChildViewWatcherMarker>,
3298    ) -> Result<(), fidl::Error> {
3299        self.client.send::<FlatlandCreateViewportRequest>(
3300            (viewport_id, &mut token, properties, child_view_watcher),
3301            0x2485fbcab7f943c,
3302            fidl::encoding::DynamicFlags::empty(),
3303        )
3304    }
3305
3306    fn r#create_image(
3307        &self,
3308        mut image_id: &ContentId,
3309        mut import_token: BufferCollectionImportToken,
3310        mut vmo_index: u32,
3311        mut properties: &ImageProperties,
3312    ) -> Result<(), fidl::Error> {
3313        self.client.send::<FlatlandCreateImageRequest>(
3314            (image_id, &mut import_token, vmo_index, properties),
3315            0x26fae823c4ebedad,
3316            fidl::encoding::DynamicFlags::empty(),
3317        )
3318    }
3319
3320    fn r#set_image_sample_region(
3321        &self,
3322        mut image_id: &ContentId,
3323        mut rect: &fidl_fuchsia_math::RectF,
3324    ) -> Result<(), fidl::Error> {
3325        self.client.send::<FlatlandSetImageSampleRegionRequest>(
3326            (image_id, rect),
3327            0x8039391d715eb28,
3328            fidl::encoding::DynamicFlags::empty(),
3329        )
3330    }
3331
3332    fn r#set_image_destination_size(
3333        &self,
3334        mut image_id: &ContentId,
3335        mut size: &fidl_fuchsia_math::SizeU,
3336    ) -> Result<(), fidl::Error> {
3337        self.client.send::<FlatlandSetImageDestinationSizeRequest>(
3338            (image_id, size),
3339            0x766cf99a2ec58446,
3340            fidl::encoding::DynamicFlags::empty(),
3341        )
3342    }
3343
3344    fn r#set_image_blending_function(
3345        &self,
3346        mut image_id: &ContentId,
3347        mut blend_mode: BlendMode,
3348    ) -> Result<(), fidl::Error> {
3349        self.client.send::<FlatlandSetImageBlendingFunctionRequest>(
3350            (image_id, blend_mode),
3351            0x10f5da1356275b7b,
3352            fidl::encoding::DynamicFlags::empty(),
3353        )
3354    }
3355
3356    fn r#set_image_opacity(
3357        &self,
3358        mut image_id: &ContentId,
3359        mut val: f32,
3360    ) -> Result<(), fidl::Error> {
3361        self.client.send::<FlatlandSetImageOpacityRequest>(
3362            (image_id, val),
3363            0x2da9e4ef4c2cff6f,
3364            fidl::encoding::DynamicFlags::empty(),
3365        )
3366    }
3367
3368    fn r#set_image_flip(
3369        &self,
3370        mut image_id: &ContentId,
3371        mut flip: ImageFlip,
3372    ) -> Result<(), fidl::Error> {
3373        self.client.send::<FlatlandSetImageFlipRequest>(
3374            (image_id, flip),
3375            0x21b20f2c14aae6bc,
3376            fidl::encoding::DynamicFlags::empty(),
3377        )
3378    }
3379
3380    fn r#create_filled_rect(&self, mut rect_id: &ContentId) -> Result<(), fidl::Error> {
3381        self.client.send::<FlatlandCreateFilledRectRequest>(
3382            (rect_id,),
3383            0x5e62355abc1c4c5d,
3384            fidl::encoding::DynamicFlags::empty(),
3385        )
3386    }
3387
3388    fn r#set_solid_fill(
3389        &self,
3390        mut rect_id: &ContentId,
3391        mut color: &ColorRgba,
3392        mut size: &fidl_fuchsia_math::SizeU,
3393    ) -> Result<(), fidl::Error> {
3394        self.client.send::<FlatlandSetSolidFillRequest>(
3395            (rect_id, color, size),
3396            0x32d6ef41e182dfa5,
3397            fidl::encoding::DynamicFlags::empty(),
3398        )
3399    }
3400
3401    fn r#release_filled_rect(&self, mut rect_id: &ContentId) -> Result<(), fidl::Error> {
3402        self.client.send::<FlatlandReleaseFilledRectRequest>(
3403            (rect_id,),
3404            0x7392cabe45618f9b,
3405            fidl::encoding::DynamicFlags::empty(),
3406        )
3407    }
3408
3409    fn r#set_content(
3410        &self,
3411        mut transform_id: &TransformId,
3412        mut content_id: &ContentId,
3413    ) -> Result<(), fidl::Error> {
3414        self.client.send::<FlatlandSetContentRequest>(
3415            (transform_id, content_id),
3416            0x4ed2cfc0ce130862,
3417            fidl::encoding::DynamicFlags::empty(),
3418        )
3419    }
3420
3421    fn r#set_viewport_properties(
3422        &self,
3423        mut viewport_id: &ContentId,
3424        mut properties: &ViewportProperties,
3425    ) -> Result<(), fidl::Error> {
3426        self.client.send::<FlatlandSetViewportPropertiesRequest>(
3427            (viewport_id, properties),
3428            0x66ab67e9608ddb9f,
3429            fidl::encoding::DynamicFlags::empty(),
3430        )
3431    }
3432
3433    fn r#release_transform(&self, mut transform_id: &TransformId) -> Result<(), fidl::Error> {
3434        self.client.send::<FlatlandReleaseTransformRequest>(
3435            (transform_id,),
3436            0xab9328419451c22,
3437            fidl::encoding::DynamicFlags::empty(),
3438        )
3439    }
3440
3441    fn r#release_view(&self) -> Result<(), fidl::Error> {
3442        self.client.send::<fidl::encoding::EmptyPayload>(
3443            (),
3444            0x5b35aab9baffecae,
3445            fidl::encoding::DynamicFlags::empty(),
3446        )
3447    }
3448
3449    type ReleaseViewportResponseFut = fidl::client::QueryResponseFut<
3450        fidl_fuchsia_ui_views::ViewportCreationToken,
3451        fidl::encoding::DefaultFuchsiaResourceDialect,
3452    >;
3453    fn r#release_viewport(&self, mut viewport_id: &ContentId) -> Self::ReleaseViewportResponseFut {
3454        fn _decode(
3455            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3456        ) -> Result<fidl_fuchsia_ui_views::ViewportCreationToken, fidl::Error> {
3457            let _response = fidl::client::decode_transaction_body::<
3458                FlatlandReleaseViewportResponse,
3459                fidl::encoding::DefaultFuchsiaResourceDialect,
3460                0xbad474aeb5293f9,
3461            >(_buf?)?;
3462            Ok(_response.token)
3463        }
3464        self.client.send_query_and_decode::<
3465            FlatlandReleaseViewportRequest,
3466            fidl_fuchsia_ui_views::ViewportCreationToken,
3467        >(
3468            (viewport_id,),
3469            0xbad474aeb5293f9,
3470            fidl::encoding::DynamicFlags::empty(),
3471            _decode,
3472        )
3473    }
3474
3475    fn r#release_image(&self, mut image_id: &ContentId) -> Result<(), fidl::Error> {
3476        self.client.send::<FlatlandReleaseImageRequest>(
3477            (image_id,),
3478            0xb884ffdbc72c111,
3479            fidl::encoding::DynamicFlags::empty(),
3480        )
3481    }
3482
3483    fn r#clear(&self) -> Result<(), fidl::Error> {
3484        self.client.send::<fidl::encoding::EmptyPayload>(
3485            (),
3486            0x4ec8817c02828c3e,
3487            fidl::encoding::DynamicFlags::empty(),
3488        )
3489    }
3490
3491    fn r#set_debug_name(&self, mut name: &str) -> Result<(), fidl::Error> {
3492        self.client.send::<FlatlandSetDebugNameRequest>(
3493            (name,),
3494            0x46a8b397e68a8888,
3495            fidl::encoding::DynamicFlags::empty(),
3496        )
3497    }
3498}
3499
3500pub struct FlatlandEventStream {
3501    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
3502}
3503
3504impl std::marker::Unpin for FlatlandEventStream {}
3505
3506impl futures::stream::FusedStream for FlatlandEventStream {
3507    fn is_terminated(&self) -> bool {
3508        self.event_receiver.is_terminated()
3509    }
3510}
3511
3512impl futures::Stream for FlatlandEventStream {
3513    type Item = Result<FlatlandEvent, fidl::Error>;
3514
3515    fn poll_next(
3516        mut self: std::pin::Pin<&mut Self>,
3517        cx: &mut std::task::Context<'_>,
3518    ) -> std::task::Poll<Option<Self::Item>> {
3519        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
3520            &mut self.event_receiver,
3521            cx
3522        )?) {
3523            Some(buf) => std::task::Poll::Ready(Some(FlatlandEvent::decode(buf))),
3524            None => std::task::Poll::Ready(None),
3525        }
3526    }
3527}
3528
3529#[derive(Debug)]
3530pub enum FlatlandEvent {
3531    OnNextFrameBegin { values: OnNextFrameBeginValues },
3532    OnFramePresented { frame_presented_info: fidl_fuchsia_scenic_scheduling::FramePresentedInfo },
3533    OnError { error: FlatlandError },
3534}
3535
3536impl FlatlandEvent {
3537    #[allow(irrefutable_let_patterns)]
3538    pub fn into_on_next_frame_begin(self) -> Option<OnNextFrameBeginValues> {
3539        if let FlatlandEvent::OnNextFrameBegin { values } = self {
3540            Some((values))
3541        } else {
3542            None
3543        }
3544    }
3545    #[allow(irrefutable_let_patterns)]
3546    pub fn into_on_frame_presented(
3547        self,
3548    ) -> Option<fidl_fuchsia_scenic_scheduling::FramePresentedInfo> {
3549        if let FlatlandEvent::OnFramePresented { frame_presented_info } = self {
3550            Some((frame_presented_info))
3551        } else {
3552            None
3553        }
3554    }
3555    #[allow(irrefutable_let_patterns)]
3556    pub fn into_on_error(self) -> Option<FlatlandError> {
3557        if let FlatlandEvent::OnError { error } = self {
3558            Some((error))
3559        } else {
3560            None
3561        }
3562    }
3563
3564    /// Decodes a message buffer as a [`FlatlandEvent`].
3565    fn decode(
3566        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3567    ) -> Result<FlatlandEvent, fidl::Error> {
3568        let (bytes, _handles) = buf.split_mut();
3569        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3570        debug_assert_eq!(tx_header.tx_id, 0);
3571        match tx_header.ordinal {
3572            0x10f69a5cdeece84a => {
3573                let mut out = fidl::new_empty!(
3574                    FlatlandOnNextFrameBeginRequest,
3575                    fidl::encoding::DefaultFuchsiaResourceDialect
3576                );
3577                fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandOnNextFrameBeginRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
3578                Ok((FlatlandEvent::OnNextFrameBegin { values: out.values }))
3579            }
3580            0x56e43e1a5f30216d => {
3581                let mut out = fidl::new_empty!(
3582                    FlatlandOnFramePresentedRequest,
3583                    fidl::encoding::DefaultFuchsiaResourceDialect
3584                );
3585                fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandOnFramePresentedRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
3586                Ok((FlatlandEvent::OnFramePresented {
3587                    frame_presented_info: out.frame_presented_info,
3588                }))
3589            }
3590            0x1ebf39e90cd8b8d => {
3591                let mut out = fidl::new_empty!(
3592                    FlatlandOnErrorRequest,
3593                    fidl::encoding::DefaultFuchsiaResourceDialect
3594                );
3595                fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandOnErrorRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
3596                Ok((FlatlandEvent::OnError { error: out.error }))
3597            }
3598            _ => Err(fidl::Error::UnknownOrdinal {
3599                ordinal: tx_header.ordinal,
3600                protocol_name: <FlatlandMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3601            }),
3602        }
3603    }
3604}
3605
3606/// A Stream of incoming requests for fuchsia.ui.composition/Flatland.
3607pub struct FlatlandRequestStream {
3608    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3609    is_terminated: bool,
3610}
3611
3612impl std::marker::Unpin for FlatlandRequestStream {}
3613
3614impl futures::stream::FusedStream for FlatlandRequestStream {
3615    fn is_terminated(&self) -> bool {
3616        self.is_terminated
3617    }
3618}
3619
3620impl fidl::endpoints::RequestStream for FlatlandRequestStream {
3621    type Protocol = FlatlandMarker;
3622    type ControlHandle = FlatlandControlHandle;
3623
3624    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
3625        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3626    }
3627
3628    fn control_handle(&self) -> Self::ControlHandle {
3629        FlatlandControlHandle { inner: self.inner.clone() }
3630    }
3631
3632    fn into_inner(
3633        self,
3634    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3635    {
3636        (self.inner, self.is_terminated)
3637    }
3638
3639    fn from_inner(
3640        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3641        is_terminated: bool,
3642    ) -> Self {
3643        Self { inner, is_terminated }
3644    }
3645}
3646
3647impl futures::Stream for FlatlandRequestStream {
3648    type Item = Result<FlatlandRequest, fidl::Error>;
3649
3650    fn poll_next(
3651        mut self: std::pin::Pin<&mut Self>,
3652        cx: &mut std::task::Context<'_>,
3653    ) -> std::task::Poll<Option<Self::Item>> {
3654        let this = &mut *self;
3655        if this.inner.check_shutdown(cx) {
3656            this.is_terminated = true;
3657            return std::task::Poll::Ready(None);
3658        }
3659        if this.is_terminated {
3660            panic!("polled FlatlandRequestStream after completion");
3661        }
3662        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3663            |bytes, handles| {
3664                match this.inner.channel().read_etc(cx, bytes, handles) {
3665                    std::task::Poll::Ready(Ok(())) => {}
3666                    std::task::Poll::Pending => return std::task::Poll::Pending,
3667                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3668                        this.is_terminated = true;
3669                        return std::task::Poll::Ready(None);
3670                    }
3671                    std::task::Poll::Ready(Err(e)) => {
3672                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3673                            e.into(),
3674                        ))))
3675                    }
3676                }
3677
3678                // A message has been received from the channel
3679                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3680
3681                std::task::Poll::Ready(Some(match header.ordinal {
3682                    0x50acc2aa1f0acec7 => {
3683                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3684                        let mut req = fidl::new_empty!(
3685                            FlatlandPresentRequest,
3686                            fidl::encoding::DefaultFuchsiaResourceDialect
3687                        );
3688                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandPresentRequest>(&header, _body_bytes, handles, &mut req)?;
3689                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
3690                        Ok(FlatlandRequest::Present { args: req.args, control_handle })
3691                    }
3692                    0x504686eb25864780 => {
3693                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3694                        let mut req = fidl::new_empty!(
3695                            FlatlandCreateViewRequest,
3696                            fidl::encoding::DefaultFuchsiaResourceDialect
3697                        );
3698                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandCreateViewRequest>(&header, _body_bytes, handles, &mut req)?;
3699                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
3700                        Ok(FlatlandRequest::CreateView {
3701                            token: req.token,
3702                            parent_viewport_watcher: req.parent_viewport_watcher,
3703
3704                            control_handle,
3705                        })
3706                    }
3707                    0x340a3a40c2fdbd5e => {
3708                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3709                        let mut req = fidl::new_empty!(
3710                            FlatlandCreateView2Request,
3711                            fidl::encoding::DefaultFuchsiaResourceDialect
3712                        );
3713                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandCreateView2Request>(&header, _body_bytes, handles, &mut req)?;
3714                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
3715                        Ok(FlatlandRequest::CreateView2 {
3716                            token: req.token,
3717                            view_identity: req.view_identity,
3718                            protocols: req.protocols,
3719                            parent_viewport_watcher: req.parent_viewport_watcher,
3720
3721                            control_handle,
3722                        })
3723                    }
3724                    0x5e042a4d3de3efb0 => {
3725                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3726                        let mut req = fidl::new_empty!(
3727                            FlatlandCreateTransformRequest,
3728                            fidl::encoding::DefaultFuchsiaResourceDialect
3729                        );
3730                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandCreateTransformRequest>(&header, _body_bytes, handles, &mut req)?;
3731                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
3732                        Ok(FlatlandRequest::CreateTransform {
3733                            transform_id: req.transform_id,
3734
3735                            control_handle,
3736                        })
3737                    }
3738                    0x7863398291fba346 => {
3739                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3740                        let mut req = fidl::new_empty!(
3741                            FlatlandSetTranslationRequest,
3742                            fidl::encoding::DefaultFuchsiaResourceDialect
3743                        );
3744                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetTranslationRequest>(&header, _body_bytes, handles, &mut req)?;
3745                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
3746                        Ok(FlatlandRequest::SetTranslation {
3747                            transform_id: req.transform_id,
3748                            translation: req.translation,
3749
3750                            control_handle,
3751                        })
3752                    }
3753                    0x4915310bc4928edc => {
3754                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3755                        let mut req = fidl::new_empty!(
3756                            FlatlandSetOrientationRequest,
3757                            fidl::encoding::DefaultFuchsiaResourceDialect
3758                        );
3759                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetOrientationRequest>(&header, _body_bytes, handles, &mut req)?;
3760                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
3761                        Ok(FlatlandRequest::SetOrientation {
3762                            transform_id: req.transform_id,
3763                            orientation: req.orientation,
3764
3765                            control_handle,
3766                        })
3767                    }
3768                    0x1ea1766fd8996bb4 => {
3769                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3770                        let mut req = fidl::new_empty!(
3771                            FlatlandSetScaleRequest,
3772                            fidl::encoding::DefaultFuchsiaResourceDialect
3773                        );
3774                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetScaleRequest>(&header, _body_bytes, handles, &mut req)?;
3775                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
3776                        Ok(FlatlandRequest::SetScale {
3777                            transform_id: req.transform_id,
3778                            scale: req.scale,
3779
3780                            control_handle,
3781                        })
3782                    }
3783                    0x3775fc2c00b432fa => {
3784                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3785                        let mut req = fidl::new_empty!(
3786                            FlatlandSetOpacityRequest,
3787                            fidl::encoding::DefaultFuchsiaResourceDialect
3788                        );
3789                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetOpacityRequest>(&header, _body_bytes, handles, &mut req)?;
3790                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
3791                        Ok(FlatlandRequest::SetOpacity {
3792                            transform_id: req.transform_id,
3793                            value: req.value,
3794
3795                            control_handle,
3796                        })
3797                    }
3798                    0x6507843df12222d2 => {
3799                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3800                        let mut req = fidl::new_empty!(
3801                            FlatlandSetClipBoundaryRequest,
3802                            fidl::encoding::DefaultFuchsiaResourceDialect
3803                        );
3804                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetClipBoundaryRequest>(&header, _body_bytes, handles, &mut req)?;
3805                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
3806                        Ok(FlatlandRequest::SetClipBoundary {
3807                            transform_id: req.transform_id,
3808                            rect: req.rect,
3809
3810                            control_handle,
3811                        })
3812                    }
3813                    0x67a8abd2f19b1a74 => {
3814                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3815                        let mut req = fidl::new_empty!(
3816                            FlatlandAddChildRequest,
3817                            fidl::encoding::DefaultFuchsiaResourceDialect
3818                        );
3819                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandAddChildRequest>(&header, _body_bytes, handles, &mut req)?;
3820                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
3821                        Ok(FlatlandRequest::AddChild {
3822                            parent_transform_id: req.parent_transform_id,
3823                            child_transform_id: req.child_transform_id,
3824
3825                            control_handle,
3826                        })
3827                    }
3828                    0x41d6cd90b298b67a => {
3829                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3830                        let mut req = fidl::new_empty!(
3831                            FlatlandRemoveChildRequest,
3832                            fidl::encoding::DefaultFuchsiaResourceDialect
3833                        );
3834                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandRemoveChildRequest>(&header, _body_bytes, handles, &mut req)?;
3835                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
3836                        Ok(FlatlandRequest::RemoveChild {
3837                            parent_transform_id: req.parent_transform_id,
3838                            child_transform_id: req.child_transform_id,
3839
3840                            control_handle,
3841                        })
3842                    }
3843                    0x5b6d86cbbff81316 => {
3844                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3845                        let mut req = fidl::new_empty!(
3846                            FlatlandReplaceChildrenRequest,
3847                            fidl::encoding::DefaultFuchsiaResourceDialect
3848                        );
3849                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandReplaceChildrenRequest>(&header, _body_bytes, handles, &mut req)?;
3850                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
3851                        Ok(FlatlandRequest::ReplaceChildren {
3852                            parent_transform_id: req.parent_transform_id,
3853                            new_child_transform_ids: req.new_child_transform_ids,
3854
3855                            control_handle,
3856                        })
3857                    }
3858                    0x6e80ca5bcc566cd8 => {
3859                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3860                        let mut req = fidl::new_empty!(
3861                            FlatlandSetRootTransformRequest,
3862                            fidl::encoding::DefaultFuchsiaResourceDialect
3863                        );
3864                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetRootTransformRequest>(&header, _body_bytes, handles, &mut req)?;
3865                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
3866                        Ok(FlatlandRequest::SetRootTransform {
3867                            transform_id: req.transform_id,
3868
3869                            control_handle,
3870                        })
3871                    }
3872                    0x31c9d17b07c37ce4 => {
3873                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3874                        let mut req = fidl::new_empty!(
3875                            FlatlandSetHitRegionsRequest,
3876                            fidl::encoding::DefaultFuchsiaResourceDialect
3877                        );
3878                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetHitRegionsRequest>(&header, _body_bytes, handles, &mut req)?;
3879                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
3880                        Ok(FlatlandRequest::SetHitRegions {
3881                            transform_id: req.transform_id,
3882                            regions: req.regions,
3883
3884                            control_handle,
3885                        })
3886                    }
3887                    0x26d81af852d29562 => {
3888                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3889                        let mut req = fidl::new_empty!(
3890                            FlatlandSetInfiniteHitRegionRequest,
3891                            fidl::encoding::DefaultFuchsiaResourceDialect
3892                        );
3893                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetInfiniteHitRegionRequest>(&header, _body_bytes, handles, &mut req)?;
3894                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
3895                        Ok(FlatlandRequest::SetInfiniteHitRegion {
3896                            transform_id: req.transform_id,
3897                            hit_test: req.hit_test,
3898
3899                            control_handle,
3900                        })
3901                    }
3902                    0x2485fbcab7f943c => {
3903                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3904                        let mut req = fidl::new_empty!(
3905                            FlatlandCreateViewportRequest,
3906                            fidl::encoding::DefaultFuchsiaResourceDialect
3907                        );
3908                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandCreateViewportRequest>(&header, _body_bytes, handles, &mut req)?;
3909                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
3910                        Ok(FlatlandRequest::CreateViewport {
3911                            viewport_id: req.viewport_id,
3912                            token: req.token,
3913                            properties: req.properties,
3914                            child_view_watcher: req.child_view_watcher,
3915
3916                            control_handle,
3917                        })
3918                    }
3919                    0x26fae823c4ebedad => {
3920                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3921                        let mut req = fidl::new_empty!(
3922                            FlatlandCreateImageRequest,
3923                            fidl::encoding::DefaultFuchsiaResourceDialect
3924                        );
3925                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandCreateImageRequest>(&header, _body_bytes, handles, &mut req)?;
3926                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
3927                        Ok(FlatlandRequest::CreateImage {
3928                            image_id: req.image_id,
3929                            import_token: req.import_token,
3930                            vmo_index: req.vmo_index,
3931                            properties: req.properties,
3932
3933                            control_handle,
3934                        })
3935                    }
3936                    0x8039391d715eb28 => {
3937                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3938                        let mut req = fidl::new_empty!(
3939                            FlatlandSetImageSampleRegionRequest,
3940                            fidl::encoding::DefaultFuchsiaResourceDialect
3941                        );
3942                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetImageSampleRegionRequest>(&header, _body_bytes, handles, &mut req)?;
3943                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
3944                        Ok(FlatlandRequest::SetImageSampleRegion {
3945                            image_id: req.image_id,
3946                            rect: req.rect,
3947
3948                            control_handle,
3949                        })
3950                    }
3951                    0x766cf99a2ec58446 => {
3952                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3953                        let mut req = fidl::new_empty!(
3954                            FlatlandSetImageDestinationSizeRequest,
3955                            fidl::encoding::DefaultFuchsiaResourceDialect
3956                        );
3957                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetImageDestinationSizeRequest>(&header, _body_bytes, handles, &mut req)?;
3958                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
3959                        Ok(FlatlandRequest::SetImageDestinationSize {
3960                            image_id: req.image_id,
3961                            size: req.size,
3962
3963                            control_handle,
3964                        })
3965                    }
3966                    0x10f5da1356275b7b => {
3967                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3968                        let mut req = fidl::new_empty!(
3969                            FlatlandSetImageBlendingFunctionRequest,
3970                            fidl::encoding::DefaultFuchsiaResourceDialect
3971                        );
3972                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetImageBlendingFunctionRequest>(&header, _body_bytes, handles, &mut req)?;
3973                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
3974                        Ok(FlatlandRequest::SetImageBlendingFunction {
3975                            image_id: req.image_id,
3976                            blend_mode: req.blend_mode,
3977
3978                            control_handle,
3979                        })
3980                    }
3981                    0x2da9e4ef4c2cff6f => {
3982                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3983                        let mut req = fidl::new_empty!(
3984                            FlatlandSetImageOpacityRequest,
3985                            fidl::encoding::DefaultFuchsiaResourceDialect
3986                        );
3987                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetImageOpacityRequest>(&header, _body_bytes, handles, &mut req)?;
3988                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
3989                        Ok(FlatlandRequest::SetImageOpacity {
3990                            image_id: req.image_id,
3991                            val: req.val,
3992
3993                            control_handle,
3994                        })
3995                    }
3996                    0x21b20f2c14aae6bc => {
3997                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3998                        let mut req = fidl::new_empty!(
3999                            FlatlandSetImageFlipRequest,
4000                            fidl::encoding::DefaultFuchsiaResourceDialect
4001                        );
4002                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetImageFlipRequest>(&header, _body_bytes, handles, &mut req)?;
4003                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4004                        Ok(FlatlandRequest::SetImageFlip {
4005                            image_id: req.image_id,
4006                            flip: req.flip,
4007
4008                            control_handle,
4009                        })
4010                    }
4011                    0x5e62355abc1c4c5d => {
4012                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4013                        let mut req = fidl::new_empty!(
4014                            FlatlandCreateFilledRectRequest,
4015                            fidl::encoding::DefaultFuchsiaResourceDialect
4016                        );
4017                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandCreateFilledRectRequest>(&header, _body_bytes, handles, &mut req)?;
4018                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4019                        Ok(FlatlandRequest::CreateFilledRect {
4020                            rect_id: req.rect_id,
4021
4022                            control_handle,
4023                        })
4024                    }
4025                    0x32d6ef41e182dfa5 => {
4026                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4027                        let mut req = fidl::new_empty!(
4028                            FlatlandSetSolidFillRequest,
4029                            fidl::encoding::DefaultFuchsiaResourceDialect
4030                        );
4031                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetSolidFillRequest>(&header, _body_bytes, handles, &mut req)?;
4032                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4033                        Ok(FlatlandRequest::SetSolidFill {
4034                            rect_id: req.rect_id,
4035                            color: req.color,
4036                            size: req.size,
4037
4038                            control_handle,
4039                        })
4040                    }
4041                    0x7392cabe45618f9b => {
4042                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4043                        let mut req = fidl::new_empty!(
4044                            FlatlandReleaseFilledRectRequest,
4045                            fidl::encoding::DefaultFuchsiaResourceDialect
4046                        );
4047                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandReleaseFilledRectRequest>(&header, _body_bytes, handles, &mut req)?;
4048                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4049                        Ok(FlatlandRequest::ReleaseFilledRect {
4050                            rect_id: req.rect_id,
4051
4052                            control_handle,
4053                        })
4054                    }
4055                    0x4ed2cfc0ce130862 => {
4056                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4057                        let mut req = fidl::new_empty!(
4058                            FlatlandSetContentRequest,
4059                            fidl::encoding::DefaultFuchsiaResourceDialect
4060                        );
4061                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetContentRequest>(&header, _body_bytes, handles, &mut req)?;
4062                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4063                        Ok(FlatlandRequest::SetContent {
4064                            transform_id: req.transform_id,
4065                            content_id: req.content_id,
4066
4067                            control_handle,
4068                        })
4069                    }
4070                    0x66ab67e9608ddb9f => {
4071                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4072                        let mut req = fidl::new_empty!(
4073                            FlatlandSetViewportPropertiesRequest,
4074                            fidl::encoding::DefaultFuchsiaResourceDialect
4075                        );
4076                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetViewportPropertiesRequest>(&header, _body_bytes, handles, &mut req)?;
4077                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4078                        Ok(FlatlandRequest::SetViewportProperties {
4079                            viewport_id: req.viewport_id,
4080                            properties: req.properties,
4081
4082                            control_handle,
4083                        })
4084                    }
4085                    0xab9328419451c22 => {
4086                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4087                        let mut req = fidl::new_empty!(
4088                            FlatlandReleaseTransformRequest,
4089                            fidl::encoding::DefaultFuchsiaResourceDialect
4090                        );
4091                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandReleaseTransformRequest>(&header, _body_bytes, handles, &mut req)?;
4092                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4093                        Ok(FlatlandRequest::ReleaseTransform {
4094                            transform_id: req.transform_id,
4095
4096                            control_handle,
4097                        })
4098                    }
4099                    0x5b35aab9baffecae => {
4100                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4101                        let mut req = fidl::new_empty!(
4102                            fidl::encoding::EmptyPayload,
4103                            fidl::encoding::DefaultFuchsiaResourceDialect
4104                        );
4105                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
4106                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4107                        Ok(FlatlandRequest::ReleaseView { control_handle })
4108                    }
4109                    0xbad474aeb5293f9 => {
4110                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4111                        let mut req = fidl::new_empty!(
4112                            FlatlandReleaseViewportRequest,
4113                            fidl::encoding::DefaultFuchsiaResourceDialect
4114                        );
4115                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandReleaseViewportRequest>(&header, _body_bytes, handles, &mut req)?;
4116                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4117                        Ok(FlatlandRequest::ReleaseViewport {
4118                            viewport_id: req.viewport_id,
4119
4120                            responder: FlatlandReleaseViewportResponder {
4121                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4122                                tx_id: header.tx_id,
4123                            },
4124                        })
4125                    }
4126                    0xb884ffdbc72c111 => {
4127                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4128                        let mut req = fidl::new_empty!(
4129                            FlatlandReleaseImageRequest,
4130                            fidl::encoding::DefaultFuchsiaResourceDialect
4131                        );
4132                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandReleaseImageRequest>(&header, _body_bytes, handles, &mut req)?;
4133                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4134                        Ok(FlatlandRequest::ReleaseImage { image_id: req.image_id, control_handle })
4135                    }
4136                    0x4ec8817c02828c3e => {
4137                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4138                        let mut req = fidl::new_empty!(
4139                            fidl::encoding::EmptyPayload,
4140                            fidl::encoding::DefaultFuchsiaResourceDialect
4141                        );
4142                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
4143                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4144                        Ok(FlatlandRequest::Clear { control_handle })
4145                    }
4146                    0x46a8b397e68a8888 => {
4147                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4148                        let mut req = fidl::new_empty!(
4149                            FlatlandSetDebugNameRequest,
4150                            fidl::encoding::DefaultFuchsiaResourceDialect
4151                        );
4152                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetDebugNameRequest>(&header, _body_bytes, handles, &mut req)?;
4153                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4154                        Ok(FlatlandRequest::SetDebugName { name: req.name, control_handle })
4155                    }
4156                    _ => Err(fidl::Error::UnknownOrdinal {
4157                        ordinal: header.ordinal,
4158                        protocol_name:
4159                            <FlatlandMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4160                    }),
4161                }))
4162            },
4163        )
4164    }
4165}
4166
4167/// Each Flatland instance contains a Graph, which consists of a set of objects, and the
4168/// relationships between those objects. The client can specify a subset of those objects
4169/// (specifically, the directed acyclic graph starting at the root transform) to be presented as
4170/// content to some kind of output -- usually, a display.
4171///
4172/// Flatland Graphs are both hierarchical, and distributed. Graphs from different Flatland instances
4173/// may be connected together, allowing multiple processes to be involved in authoring content for a
4174/// particular output.
4175///
4176/// All functions in this protocol are feed-forward. The operations they represent are not fully
4177/// executed until [`Present`] is called.
4178#[derive(Debug)]
4179pub enum FlatlandRequest {
4180    /// Complete execution of all feed-forward operations.
4181    ///
4182    /// If executing an operation produces an error (e.g., CreateTransform(0)), an [`OnError`] event
4183    /// is emitted. Operations that produce errors are ignored and the channel is closed.
4184    ///
4185    /// If the execution is completed successfully, [`OnNextFrameBegin`] emits NO_ERROR along
4186    /// with other valid fields.
4187    ///
4188    /// The client may only call [`Present`] when they have a non-zero number of present credits,
4189    /// which are tracked by the server. The server may increment the number of credits when it
4190    /// fires the [`OnNextFrameBegin`] event, which informs the client when it receives additional
4191    /// present credits. Each [`Present`] call uses one present credit and decrements the server
4192    /// count by one. If the client calls [`Present`] with no present credits, the server will
4193    /// return a `NO_PRESENTS_REMAINING` error.
4194    ///
4195    /// The client should assume that prior to receiving any [`OnNextFrameBegin`] events, they have
4196    /// one present credit.
4197    ///
4198    /// Every [`Present`] call results in one [`OnNextFrameBegin`] event, and one
4199    /// [`OnFramePresented`] event, typically in that order.
4200    ///
4201    /// When the commands flushed by [`Present`] make it to display, an [`OnFramePresented`] event
4202    /// is fired. This event includes information pertaining to all [`Present`]s that had content
4203    /// that were part of that frame.
4204    ///
4205    /// See [`fuchsia.ui.composition/PresentArgs`] documentation above for more detailed information
4206    /// on what arguments are passed in and their role.
4207    Present {
4208        args: PresentArgs,
4209        control_handle: FlatlandControlHandle,
4210    },
4211    /// Two Flatland instances may be connected in a parent-child relationship. The parent endpoint
4212    /// is held in a Viewport, and the child endpoint is held in a View. The parent Flatland
4213    /// instance that creates a Viewport has control over how the child's View is integrated into
4214    /// its own View.
4215    ///
4216    /// The lifecycle of a parent-child connection starts with two endpoints of a channel object:
4217    /// a ViewportCreationToken and a ViewCreationToken. Out-of-band protocols pass the
4218    /// ViewportCreationToken to the parent, which calls [`CreateViewport`], and the
4219    /// ViewCreationToken to the child, which calls [`CreateView`].
4220    ///
4221    /// Only nodes connected to the Root Transform in this Flatland instance will be rendered into
4222    /// the parent's Viewport.
4223    ///
4224    /// Calling [`CreateView`] a second time will disconnect the Root Transform from the existing
4225    /// parent's Viewport, and attach it to a new parent's Viewport. In other words, each View can
4226    /// only have one parent.
4227    ///
4228    /// This function is queued, meaning that the Root Transform will not be attached to the
4229    /// parent Viewport until [`Present`] is called. However, clients will receive information
4230    /// through their ParentViewportWatcher (e.g., LayoutInfo) immediately after calling this
4231    /// function, even if they have not called [`Present`] or [`SetRootTransform`]. This allows
4232    /// clients to wait for layout information from their parent before calling [`Present`].
4233    ///
4234    /// Any illegal operations on ParentViewportWatcher will cause both ParentViewportWatcher
4235    /// channel and this Flatland channel to be torn down.
4236    ///
4237    /// Lifecycle note. The lifetime of the ParentViewportWatcher channel is bound by the peer
4238    /// ViewportCreationToken. When the ViewportCreationToken dies, this ParentViewportWatcher
4239    /// channel is destroyed.
4240    ///
4241    /// Views and subgraphs of Views created using `CreateView` will not be represented in the
4242    /// ViewTree, and hence will not be able to participate in any ViewTree-dependent interactions
4243    /// such as touch, mouse or focus.
4244    /// The Flatland protocol provides no way for Views in the subgraph of a View created with
4245    /// `CreateView` to know that they are excluded from the ViewTree.
4246    CreateView {
4247        token: fidl_fuchsia_ui_views::ViewCreationToken,
4248        parent_viewport_watcher: fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>,
4249        control_handle: FlatlandControlHandle,
4250    },
4251    /// Identical to [`CreateView`], except it allows association of View identity (ViewRef) and
4252    /// view-bound protocols.
4253    CreateView2 {
4254        token: fidl_fuchsia_ui_views::ViewCreationToken,
4255        view_identity: fidl_fuchsia_ui_views::ViewIdentityOnCreation,
4256        protocols: ViewBoundProtocols,
4257        parent_viewport_watcher: fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>,
4258        control_handle: FlatlandControlHandle,
4259    },
4260    /// Creates a new Transform node. Transforms are a hierarchical piece of a Flatland graph. They
4261    /// can have children, and can reference Content. A sub-graph represented by a Transform and its
4262    /// descendants can be rendered to a display.
4263    ///
4264    /// Transforms are kept alive, even when released, as long as they are children of either an
4265    /// unreleased Transform, or the Root Transform.
4266    ///
4267    /// Each Transform can have a single piece of attached Content. Common types of Content include
4268    /// bitmaps, asynchronous streams of images, and Viewports to Views hosted in other Flatland
4269    /// instances.
4270    ///
4271    /// Transforms have attributes. Child Transforms inherit the combined attributes of their
4272    /// parents. Content attached to a Transform is also affected by that Transform's attributes.
4273    ///
4274    /// When a sub-graph of Transforms is rendered, Content will be rendered back-to-front, starting
4275    /// with the Content on the root transform, and continuing recursively through all of its child
4276    /// Transforms in the order the children were added. See [`AddChild`] for more information.
4277    ///
4278    /// Zero is not a valid transform id. All other values are valid, assuming they are not already
4279    /// in use (see [`ReleaseTransform`] for more details).
4280    CreateTransform {
4281        transform_id: TransformId,
4282        control_handle: FlatlandControlHandle,
4283    },
4284    /// All Transform objects support all attributes.
4285    ///
4286    /// Geometric attributes are applied in the following order:
4287    /// 1. Scale (relative to the parent transform's coordinate space)
4288    /// 2. Orientation (relative to the parent transform's coordinate space)
4289    /// 3. Translation (relative to the parent transforms's coordinate space,
4290    ///    unaffected by scale applied to the current transform).
4291    /// 4. Clipping (relative to the current transform's coordinate space)
4292    ///
4293    /// The effects of each of these attributes are cumulative. This means the transform's position
4294    /// in the view space, and its clip boundary, will be calculated based on that chain of
4295    /// geometric attributes going up to the root transform.
4296    ///
4297    /// For instance, in a nested hierarchy such as the following:
4298    ///     [Root-Transform -> Transform1 -> Transform2 -> CurrentTransform]
4299    /// If Transform1 is translated by [2,0] and Transform2 is translated by [0,1] then the
4300    /// view-space position of CurrentTransform will be [2,1].
4301    ///
4302    /// Sets the translation on a Transform. The order of geometric attribute application is
4303    /// addressed above.
4304    SetTranslation {
4305        transform_id: TransformId,
4306        translation: fidl_fuchsia_math::Vec_,
4307        control_handle: FlatlandControlHandle,
4308    },
4309    /// Sets the orientation on a Transform. The order of geometric attribute application is
4310    /// addressed in the documentation for [`SetTranslation`]. In Flatland, the +X axis is
4311    /// to the right and the +Y axis is down. There is no notion of a Z axis. CCW is defined
4312    /// from the POV of the user, as if a skeuomorphoic clock is displayed on the screen.
4313    SetOrientation {
4314        transform_id: TransformId,
4315        orientation: Orientation,
4316        control_handle: FlatlandControlHandle,
4317    },
4318    /// Sets the scale on a transform. The order of geometric attribute application is
4319    /// addressed above. The (x,y) values in the VecF |scale| refer to the scale factor in the
4320    /// x-axis (width) and y-axis (height) respectively. Scale values must be normal 32-bit
4321    /// floating point values: https://en.wikipedia.org/wiki/Normal_number_%28computing%29
4322    SetScale {
4323        transform_id: TransformId,
4324        scale: fidl_fuchsia_math::VecF,
4325        control_handle: FlatlandControlHandle,
4326    },
4327    /// Sets an opacity in linear space to be applied to a transform and its descendents,
4328    /// which include other transforms and content. Opacity values must be in the range
4329    /// of [0.0, 1.0], where 0.0 is completely transparent and 1.0 is completely opaque.
4330    /// Attempting to call this function with values outside that range will result in
4331    /// an error. A transform's opacity value is multiplied with that of its parent. This
4332    /// effect works differently from group opacity. Using group opacity, child nodes are
4333    /// rendered together first, and then have the parent's opacity applied as a post-effect.
4334    /// Here, opacity is applied to each child individually. This may result in a very
4335    /// different effect.
4336    SetOpacity {
4337        transform_id: TransformId,
4338        value: f32,
4339        control_handle: FlatlandControlHandle,
4340    },
4341    /// Sets the bounds, expressed in the local coordinate space of the transform, that
4342    /// constrains the region that content attached to this transform can be rendered to.
4343    /// If the content's area exceeds the clip bounds, the area outside the bounds will
4344    /// not be rendered. These bounds are valid for all children of this transform node as
4345    /// well, which includes nested Flatland instances and their node hierarchies.
4346    /// If a child transform attempts to set clip bounds larger than that of its parent,
4347    /// it will be clipped to the parent's clip bounds. The default state is for a transform
4348    /// to be unclipped, meaning it will not have any bounds placed on its render region.
4349    /// The clip width/height must be positive. Negative values will result in an error.
4350    /// Passing in an empty box to the |rect| parameter will remove the clip bounds.
4351    SetClipBoundary {
4352        transform_id: TransformId,
4353        rect: Option<Box<fidl_fuchsia_math::Rect>>,
4354        control_handle: FlatlandControlHandle,
4355    },
4356    /// Adds a child Transform to a parent Transform. The new child Transform, and any Content
4357    /// attached to it or its children, will be rendered on top of the parent's Content, as well as
4358    /// any previously added children.
4359    AddChild {
4360        parent_transform_id: TransformId,
4361        child_transform_id: TransformId,
4362        control_handle: FlatlandControlHandle,
4363    },
4364    /// Removes a child Transform from a parent Transform.
4365    RemoveChild {
4366        parent_transform_id: TransformId,
4367        child_transform_id: TransformId,
4368        control_handle: FlatlandControlHandle,
4369    },
4370    /// Removes all child Transforms from a parent Transform and replaces them with the new child
4371    /// transforms in `new_child_transform_ids`.
4372    ReplaceChildren {
4373        parent_transform_id: TransformId,
4374        new_child_transform_ids: Vec<TransformId>,
4375        control_handle: FlatlandControlHandle,
4376    },
4377    /// Sets the Root Transform for the graph.
4378    ///
4379    /// The sub-graph defined by the Root Transform and its children will be rendered as View
4380    /// in the connected parent's Viewport (see [`CreateView`]). Any parents of the Root Transform
4381    /// in this Graph will be ignored.
4382    ///
4383    /// The Root Transform, and all children of the Root Transform, are kept alive if they are
4384    /// released (see [`ReleaseTransform`] for more details).
4385    ///
4386    /// There is only ever one Root. Since 0 is not a valid transform id (see [`CreateTransform`]),
4387    /// calling SetRootTransform(0) clears the current Root, destroying any previously released
4388    /// objects that are not referenced by the new root.
4389    ///
4390    /// Note that every View has a clip boundary equivalent to its logical size. Anything outside
4391    /// that clip boundary will not be rendered. Hence, the Root Transform has a useful coordinate
4392    /// space of (0, 0) to (logical_size.width, logical_size.height), where (0, 0) is the upper left
4393    /// corner.
4394    ///
4395    /// Setting the root transform installs a full screen hit region on the root transform. Clients
4396    /// may remove this hit region if they don't want users to be able to interact with the root
4397    /// transform's content. For additional details on hit regions, see the [`SetHitRegions`]
4398    /// documentation.
4399    ///
4400    /// Default hit region rules
4401    ///
4402    ///   A default hit region follows these rules:
4403    ///   - When [`SetRootTransform`](T) is called, T receives a maximal hit region, covering the
4404    ///   entire view.
4405    ///   - If [`SetHitRegions`] is called on T, either before or after [`SetRootTransform`](T),
4406    ///   then no default hit region is active and the client specified hit regions are used.
4407    ///   - If a transform is no longer the root transform, i.e., [`SetRootTransform`](U) is
4408    ///   called, then the original transform no longer has its default hit region.
4409    ///   - Clients can remove or modify the root transform's hit regions the same way they would
4410    ///   reset any other transform's hit regions, by calling [`SetHitRegions`] with the appropriate
4411    ///   vector.
4412    SetRootTransform {
4413        transform_id: TransformId,
4414        control_handle: FlatlandControlHandle,
4415    },
4416    /// Sets the interactive areas for a Transform. By default, Content is not interactive; hit
4417    /// regions must be placed for a user to interact with the Content in a View. Because hit
4418    /// regions are described in the Flatland protocol, a Flatland instance can synchronize Content
4419    /// and hit regions.
4420    ///
4421    /// Each hit region is placed in the coordinate space of the owning Transform, and may or may
4422    /// not interact with different types of hit testing, depending on its [`HitTestInteraction`]
4423    /// type. When there are multiple hit regions that intersect with a hit test, the precedence
4424    /// rules given below dictate which hit region has interacted with the hit test. Only Transforms
4425    /// that transitively connect to the root Transform have their hit regions interact with a hit
4426    /// test.
4427    ///
4428    /// Calling this function replaces any previous values set on this Transform. To reset a
4429    /// Transform to "no hit testing": send an empty vector with [`SetHitRegions`].
4430    ///
4431    /// Note that root transforms get a default hit region installed by Flatland. For more details,
4432    /// see the [`SetRootTransform`] documentation.
4433    ///
4434    /// Precedence rules
4435    ///   Within a Transform, if multiple hit regions overlap, the hit test examines each
4436    ///   intersecting hit region for a possible interaction. Thus, for a regular hit test R and an
4437    ///   accessibility hit test A, where R and A both intersect two hit regions D ([`DEFAULT`]) and
4438    ///   S ([`SEMANTICALLY_INVISIBLE`]) on the same Transform, (1) R interacts with both D and S,
4439    ///   and (2) A only interacts with D. Generally, hit regions that overlap in a single Transform
4440    ///   can cause confusing behavior.
4441    ///
4442    ///   Within a View, for a given hit test, the front-most Transform's hit regions take
4443    ///   precedence over those behind. This follows the expected reverse "render order" of
4444    ///   Transforms (described in [`CreateTransform`]), where a user expects to interact with
4445    ///   Content that is visible, or front-most.
4446    ///
4447    ///   Across Flatland instances, for a given hit test, the front-most instance's front-most
4448    ///   Transform's hit regions take precedence over those behind. This follows the expected
4449    ///   reverse "render order" of views, where a user expects to interact with the View that is
4450    ///   visible, or front-most. For example, if a child View owns Content that is rendered over
4451    ///   the parent View, the user expects to interact with the child's Content.
4452    SetHitRegions {
4453        transform_id: TransformId,
4454        regions: Vec<HitRegion>,
4455        control_handle: FlatlandControlHandle,
4456    },
4457    /// Identical to [`SetHitRegions`], except the hit region associated with [`transform_id`]
4458    /// covers an infinite region. The hit region is invariant against translation, scaling, and
4459    /// orientation of the Transform.
4460    ///
4461    /// An infinite hit region is still limited in extent by the View's clip boundary, just like a
4462    /// finite hit region.
4463    ///
4464    /// Calling this function replaces any previous values set on this Transform. To reset a
4465    /// Transform to "no hit testing": send an empty vector with [`SetHitRegions`].
4466    SetInfiniteHitRegion {
4467        transform_id: TransformId,
4468        hit_test: HitTestInteraction,
4469        control_handle: FlatlandControlHandle,
4470    },
4471    /// The Viewport and View pair, together, represent the connection between two Flatland
4472    /// instances. The Viewport is created in the parent, and the View is created in the child. The
4473    /// parent has control over how the child's View is integrated into its own View.
4474    ///
4475    /// Any illegal operations on ChildViewWatcher will cause both ChildViewWatcher channel and this
4476    /// Flatland channel to be torn down.
4477    ///
4478    /// `ViewportProperties` must have logical_size set. This is the initial size that will drive
4479    /// the layout of the child. The logical_size is also used as the default Content size, but
4480    /// subsequent changes to the logical_size will have no effect on the Content size.
4481    ///
4482    /// `ViewportProperties` may have inset field not set. In that case, the default value of
4483    /// (0, 0, 0, 0) is used.
4484    ///
4485    /// The logical_size must have positive X and Y components.
4486    ///
4487    /// Zero is not a valid ContentId. All other values are valid, assuming they are not already
4488    /// in use for another piece of Content (see [`ReleaseViewport`] for more details).
4489    ///
4490    /// Lifecycle note. The lifetime of the ChildViewWatcher channel is bound by the peer
4491    /// ViewCreationToken. When the ViewCreationToken dies, this ChildViewWatcher channel is
4492    /// destroyed.
4493    CreateViewport {
4494        viewport_id: ContentId,
4495        token: fidl_fuchsia_ui_views::ViewportCreationToken,
4496        properties: ViewportProperties,
4497        child_view_watcher: fidl::endpoints::ServerEnd<ChildViewWatcherMarker>,
4498        control_handle: FlatlandControlHandle,
4499    },
4500    /// An Image is a bitmap backed by a specific VMO in a BufferCollection.
4501    ///
4502    /// Image creation requires an allocated BufferCollection registered with Allocator. This
4503    /// function will fail unless all clients of the specified BufferCollection have set their
4504    /// constraints.
4505    ///
4506    /// The Image must reference a valid VMO index and must have ImageProperties that fall within
4507    /// the constraints specified by the backing BufferCollection (i.e. width and height within a
4508    /// valid range, etc.)
4509    ///
4510    /// Zero is not a valid Image id. All other values are valid, assuming they are not already in
4511    /// use for another piece of Content (see [`ReleaseImage`] for more details).
4512    CreateImage {
4513        image_id: ContentId,
4514        import_token: BufferCollectionImportToken,
4515        vmo_index: u32,
4516        properties: ImageProperties,
4517        control_handle: FlatlandControlHandle,
4518    },
4519    /// This function is used to determine the region (in texel space) of an image that will be used
4520    /// by Flatland when rendering. The image to be sampled is referenced by [`image_id`] and the
4521    /// sample region is specified by [`rect`] which itself is comprised of an origin point (x,y) as
4522    /// well as a width and height, in unnormalized coordinates. It is illegal to call this function
4523    /// on non-image content, or to sample a region outside of the texel space of the image. In
4524    /// other words, the region specifed by [`rect`] must not exceed the ranges (0, image_width) and
4525    /// (0, image_height). If (rect.x + rect.width > image_width) or (rect.y + rect.height >
4526    /// image_height) or if any of the values are negative, this will result in an error.
4527    ///
4528    /// If this method is not called, the default sample region is the rectangle with origin at
4529    /// (0, 0) and width and height set at ImageProperties from [`CreateImage`].
4530    SetImageSampleRegion {
4531        image_id: ContentId,
4532        rect: fidl_fuchsia_math::RectF,
4533        control_handle: FlatlandControlHandle,
4534    },
4535    /// The content size for an Image is the size of the rectangle in the parent's logical
4536    /// coordinate space that the image occupies. This combined with the global translation of the
4537    /// transform it is attached to determines the size and location of where the content is
4538    /// rendered on the display.
4539    ///
4540    /// If this method is not called, the default image destination size is the width and height set
4541    /// at ImageProperties from [`CreateImage`]. The destination size will be affected by scaling if
4542    /// [`SetScale`] is used on the attached Transform or its parents.
4543    SetImageDestinationSize {
4544        image_id: ContentId,
4545        size: fidl_fuchsia_math::SizeU,
4546        control_handle: FlatlandControlHandle,
4547    },
4548    /// Determines the blend function to use when rendering the content specified by
4549    /// |image_id|. |image_id| must be a valid ContentId associated to a transform through
4550    /// a call to |CreateImage| or |CreateFilledRect|. For details on the different blend functions
4551    /// that are available, please refer to the BlendMode enum. If this function is not called, then
4552    /// the default blendmode is BlendMode::SRC.
4553    SetImageBlendingFunction {
4554        image_id: ContentId,
4555        blend_mode: BlendMode,
4556        control_handle: FlatlandControlHandle,
4557    },
4558    /// Sets an opacity in linear space to be applied to a flatland image. Opacity values must
4559    /// be in the range [0.0, 1.0].
4560    SetImageOpacity {
4561        image_id: ContentId,
4562        val: f32,
4563        control_handle: FlatlandControlHandle,
4564    },
4565    /// Sets the image flip to be applied to a flatland image. This call must be performed after a
4566    /// successful |CreateImage| call. If an invalid |image_id| is supplied, the channel will be
4567    /// closed due to FlatlandError::BAD_OPERATION. This flip will be applied to the Image before
4568    /// parent Transform Orientations. If this function is not called, then the default flip value
4569    /// is ImageFlip::NONE.
4570    SetImageFlip {
4571        image_id: ContentId,
4572        flip: ImageFlip,
4573        control_handle: FlatlandControlHandle,
4574    },
4575    /// Creates a solid-color rectangle. By default a filled-rect does not have a defined
4576    /// color or size. It is necessary to call |SetSolidFill| to specify a color and size
4577    /// before a filled rect can be used for rendering. Not doing so will result the
4578    CreateFilledRect {
4579        rect_id: ContentId,
4580        control_handle: FlatlandControlHandle,
4581    },
4582    /// Defines the color and size of a filled rect. |rect_id| must refer to content that
4583    /// was created via a call to CreateFilledRect. The color is not premultiplied. Color values
4584    /// must be within the range [0,1] inclusive, and normal 32-bit
4585    /// floating point values: https://en.wikipedia.org/wiki/Normal_number_%28computing%29. Values
4586    /// that do not conform to these specifications will cause the channel to close.
4587    /// The rectangle's top left corner will be at (0, 0) in its transform's coordinate space.
4588    /// Hence, its bottom right corner will be at (size.width, size.height).
4589    SetSolidFill {
4590        rect_id: ContentId,
4591        color: ColorRgba,
4592        size: fidl_fuchsia_math::SizeU,
4593        control_handle: FlatlandControlHandle,
4594    },
4595    /// Automatically garbage collects the rectangle when it is no longer needed for
4596    /// rendering. |rect_id| must have been instantiated with a call to
4597    /// |CreateFilledRect|. Once released, the ID immediately goes out of scope and is free
4598    /// to be used again.
4599    ReleaseFilledRect {
4600        rect_id: ContentId,
4601        control_handle: FlatlandControlHandle,
4602    },
4603    /// Setting a piece of Content on a Transform makes that Content visible in the render tree as
4604    /// long as the Transform is visible from the root Transform. The Content will be rendered
4605    /// before, and therefore "behind", any Content attached to the descendants of the Transform.
4606    ///
4607    /// Because each Transform can have, at most, a single piece of Content on it, calling this
4608    /// function on a Transform that already has Content will replace that Content.
4609    ///
4610    /// A Content may be set on more than one Transform.
4611    ///
4612    /// Calling this function with a Content id of 0 will remove any Content currently on the
4613    /// Transform.
4614    SetContent {
4615        transform_id: TransformId,
4616        content_id: ContentId,
4617        control_handle: FlatlandControlHandle,
4618    },
4619    /// Transforms are usually sufficient to change how Content is presented. Viewports, however,
4620    /// have special properties that are not part of the Transform hierarchy. Those properties can
4621    /// be set using this function.
4622    SetViewportProperties {
4623        viewport_id: ContentId,
4624        properties: ViewportProperties,
4625        control_handle: FlatlandControlHandle,
4626    },
4627    /// Released Transforms will be garbage collected by the system once they are no longer
4628    /// necessary for rendering. For Transforms, this means there is no path from any unreleased
4629    /// Transform to the newly-released Transform.
4630    ///
4631    /// Once released, the id immediately goes out of scope for future function calls and can be
4632    /// reused when creating new Transforms.
4633    ///
4634    /// It is an error to call functions with a released id (unless that id has been reused to
4635    /// construct a new Transform).
4636    ReleaseTransform {
4637        transform_id: TransformId,
4638        control_handle: FlatlandControlHandle,
4639    },
4640    ReleaseView {
4641        control_handle: FlatlandControlHandle,
4642    },
4643    /// Releases a Viewport from the scene, even if the Viewport is still connected to a Transform.
4644    /// Unlike other resources, Viewports are garbage collected by the system during the next
4645    /// [`Present`] because a removed Viewport is guaranteed to provide no renderable content.
4646    ///
4647    /// Use SetContent(transform_id, 0) to clean up references to released Viewports.
4648    ///
4649    /// Despite having a return type, this function is still feed-forward like [`CreateView`] and
4650    /// requires a call to [`Present`] to be executed. The ViewportCreationToken will be returned
4651    /// after the presented operations have been executed.
4652    ReleaseViewport {
4653        viewport_id: ContentId,
4654        responder: FlatlandReleaseViewportResponder,
4655    },
4656    /// Released Images will be garbage collected by the system once they are no longer necessary
4657    /// for rendering. For Images, this means the Image is no longer attached to any Transform and
4658    /// any pending rendering that references the Image is complete.
4659    ///
4660    /// Use SetContent(transform_id, 0) to clean up references to released Images.
4661    ///
4662    /// Once released, the id immediately goes out of scope for future function calls and can be
4663    /// reused when creating new Images.
4664    ///
4665    /// It is an error to call functions with a released id (unless that id has been reused to
4666    /// construct a new Image).
4667    ReleaseImage {
4668        image_id: ContentId,
4669        control_handle: FlatlandControlHandle,
4670    },
4671    /// This function will reset all state on this interface. This includes destroying all existing
4672    /// View and Viewports without returning the associated Token to the caller.
4673    Clear {
4674        control_handle: FlatlandControlHandle,
4675    },
4676    /// Set debug name of the current client that can be used by Flatland to print as a prefix to
4677    /// logs to help client distinguish what is theirs. [`name`] can be an arbitrary string, but the
4678    /// current process name (see fsl::GetCurrentProcessName()) is a good default.
4679    SetDebugName {
4680        name: String,
4681        control_handle: FlatlandControlHandle,
4682    },
4683}
4684
4685impl FlatlandRequest {
4686    #[allow(irrefutable_let_patterns)]
4687    pub fn into_present(self) -> Option<(PresentArgs, FlatlandControlHandle)> {
4688        if let FlatlandRequest::Present { args, control_handle } = self {
4689            Some((args, control_handle))
4690        } else {
4691            None
4692        }
4693    }
4694
4695    #[allow(irrefutable_let_patterns)]
4696    pub fn into_create_view(
4697        self,
4698    ) -> Option<(
4699        fidl_fuchsia_ui_views::ViewCreationToken,
4700        fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>,
4701        FlatlandControlHandle,
4702    )> {
4703        if let FlatlandRequest::CreateView { token, parent_viewport_watcher, control_handle } = self
4704        {
4705            Some((token, parent_viewport_watcher, control_handle))
4706        } else {
4707            None
4708        }
4709    }
4710
4711    #[allow(irrefutable_let_patterns)]
4712    pub fn into_create_view2(
4713        self,
4714    ) -> Option<(
4715        fidl_fuchsia_ui_views::ViewCreationToken,
4716        fidl_fuchsia_ui_views::ViewIdentityOnCreation,
4717        ViewBoundProtocols,
4718        fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>,
4719        FlatlandControlHandle,
4720    )> {
4721        if let FlatlandRequest::CreateView2 {
4722            token,
4723            view_identity,
4724            protocols,
4725            parent_viewport_watcher,
4726            control_handle,
4727        } = self
4728        {
4729            Some((token, view_identity, protocols, parent_viewport_watcher, control_handle))
4730        } else {
4731            None
4732        }
4733    }
4734
4735    #[allow(irrefutable_let_patterns)]
4736    pub fn into_create_transform(self) -> Option<(TransformId, FlatlandControlHandle)> {
4737        if let FlatlandRequest::CreateTransform { transform_id, control_handle } = self {
4738            Some((transform_id, control_handle))
4739        } else {
4740            None
4741        }
4742    }
4743
4744    #[allow(irrefutable_let_patterns)]
4745    pub fn into_set_translation(
4746        self,
4747    ) -> Option<(TransformId, fidl_fuchsia_math::Vec_, FlatlandControlHandle)> {
4748        if let FlatlandRequest::SetTranslation { transform_id, translation, control_handle } = self
4749        {
4750            Some((transform_id, translation, control_handle))
4751        } else {
4752            None
4753        }
4754    }
4755
4756    #[allow(irrefutable_let_patterns)]
4757    pub fn into_set_orientation(self) -> Option<(TransformId, Orientation, FlatlandControlHandle)> {
4758        if let FlatlandRequest::SetOrientation { transform_id, orientation, control_handle } = self
4759        {
4760            Some((transform_id, orientation, control_handle))
4761        } else {
4762            None
4763        }
4764    }
4765
4766    #[allow(irrefutable_let_patterns)]
4767    pub fn into_set_scale(
4768        self,
4769    ) -> Option<(TransformId, fidl_fuchsia_math::VecF, FlatlandControlHandle)> {
4770        if let FlatlandRequest::SetScale { transform_id, scale, control_handle } = self {
4771            Some((transform_id, scale, control_handle))
4772        } else {
4773            None
4774        }
4775    }
4776
4777    #[allow(irrefutable_let_patterns)]
4778    pub fn into_set_opacity(self) -> Option<(TransformId, f32, FlatlandControlHandle)> {
4779        if let FlatlandRequest::SetOpacity { transform_id, value, control_handle } = self {
4780            Some((transform_id, value, control_handle))
4781        } else {
4782            None
4783        }
4784    }
4785
4786    #[allow(irrefutable_let_patterns)]
4787    pub fn into_set_clip_boundary(
4788        self,
4789    ) -> Option<(TransformId, Option<Box<fidl_fuchsia_math::Rect>>, FlatlandControlHandle)> {
4790        if let FlatlandRequest::SetClipBoundary { transform_id, rect, control_handle } = self {
4791            Some((transform_id, rect, control_handle))
4792        } else {
4793            None
4794        }
4795    }
4796
4797    #[allow(irrefutable_let_patterns)]
4798    pub fn into_add_child(self) -> Option<(TransformId, TransformId, FlatlandControlHandle)> {
4799        if let FlatlandRequest::AddChild {
4800            parent_transform_id,
4801            child_transform_id,
4802            control_handle,
4803        } = self
4804        {
4805            Some((parent_transform_id, child_transform_id, control_handle))
4806        } else {
4807            None
4808        }
4809    }
4810
4811    #[allow(irrefutable_let_patterns)]
4812    pub fn into_remove_child(self) -> Option<(TransformId, TransformId, FlatlandControlHandle)> {
4813        if let FlatlandRequest::RemoveChild {
4814            parent_transform_id,
4815            child_transform_id,
4816            control_handle,
4817        } = self
4818        {
4819            Some((parent_transform_id, child_transform_id, control_handle))
4820        } else {
4821            None
4822        }
4823    }
4824
4825    #[allow(irrefutable_let_patterns)]
4826    pub fn into_replace_children(
4827        self,
4828    ) -> Option<(TransformId, Vec<TransformId>, FlatlandControlHandle)> {
4829        if let FlatlandRequest::ReplaceChildren {
4830            parent_transform_id,
4831            new_child_transform_ids,
4832            control_handle,
4833        } = self
4834        {
4835            Some((parent_transform_id, new_child_transform_ids, control_handle))
4836        } else {
4837            None
4838        }
4839    }
4840
4841    #[allow(irrefutable_let_patterns)]
4842    pub fn into_set_root_transform(self) -> Option<(TransformId, FlatlandControlHandle)> {
4843        if let FlatlandRequest::SetRootTransform { transform_id, control_handle } = self {
4844            Some((transform_id, control_handle))
4845        } else {
4846            None
4847        }
4848    }
4849
4850    #[allow(irrefutable_let_patterns)]
4851    pub fn into_set_hit_regions(
4852        self,
4853    ) -> Option<(TransformId, Vec<HitRegion>, FlatlandControlHandle)> {
4854        if let FlatlandRequest::SetHitRegions { transform_id, regions, control_handle } = self {
4855            Some((transform_id, regions, control_handle))
4856        } else {
4857            None
4858        }
4859    }
4860
4861    #[allow(irrefutable_let_patterns)]
4862    pub fn into_set_infinite_hit_region(
4863        self,
4864    ) -> Option<(TransformId, HitTestInteraction, FlatlandControlHandle)> {
4865        if let FlatlandRequest::SetInfiniteHitRegion { transform_id, hit_test, control_handle } =
4866            self
4867        {
4868            Some((transform_id, hit_test, control_handle))
4869        } else {
4870            None
4871        }
4872    }
4873
4874    #[allow(irrefutable_let_patterns)]
4875    pub fn into_create_viewport(
4876        self,
4877    ) -> Option<(
4878        ContentId,
4879        fidl_fuchsia_ui_views::ViewportCreationToken,
4880        ViewportProperties,
4881        fidl::endpoints::ServerEnd<ChildViewWatcherMarker>,
4882        FlatlandControlHandle,
4883    )> {
4884        if let FlatlandRequest::CreateViewport {
4885            viewport_id,
4886            token,
4887            properties,
4888            child_view_watcher,
4889            control_handle,
4890        } = self
4891        {
4892            Some((viewport_id, token, properties, child_view_watcher, control_handle))
4893        } else {
4894            None
4895        }
4896    }
4897
4898    #[allow(irrefutable_let_patterns)]
4899    pub fn into_create_image(
4900        self,
4901    ) -> Option<(ContentId, BufferCollectionImportToken, u32, ImageProperties, FlatlandControlHandle)>
4902    {
4903        if let FlatlandRequest::CreateImage {
4904            image_id,
4905            import_token,
4906            vmo_index,
4907            properties,
4908            control_handle,
4909        } = self
4910        {
4911            Some((image_id, import_token, vmo_index, properties, control_handle))
4912        } else {
4913            None
4914        }
4915    }
4916
4917    #[allow(irrefutable_let_patterns)]
4918    pub fn into_set_image_sample_region(
4919        self,
4920    ) -> Option<(ContentId, fidl_fuchsia_math::RectF, FlatlandControlHandle)> {
4921        if let FlatlandRequest::SetImageSampleRegion { image_id, rect, control_handle } = self {
4922            Some((image_id, rect, control_handle))
4923        } else {
4924            None
4925        }
4926    }
4927
4928    #[allow(irrefutable_let_patterns)]
4929    pub fn into_set_image_destination_size(
4930        self,
4931    ) -> Option<(ContentId, fidl_fuchsia_math::SizeU, FlatlandControlHandle)> {
4932        if let FlatlandRequest::SetImageDestinationSize { image_id, size, control_handle } = self {
4933            Some((image_id, size, control_handle))
4934        } else {
4935            None
4936        }
4937    }
4938
4939    #[allow(irrefutable_let_patterns)]
4940    pub fn into_set_image_blending_function(
4941        self,
4942    ) -> Option<(ContentId, BlendMode, FlatlandControlHandle)> {
4943        if let FlatlandRequest::SetImageBlendingFunction { image_id, blend_mode, control_handle } =
4944            self
4945        {
4946            Some((image_id, blend_mode, control_handle))
4947        } else {
4948            None
4949        }
4950    }
4951
4952    #[allow(irrefutable_let_patterns)]
4953    pub fn into_set_image_opacity(self) -> Option<(ContentId, f32, FlatlandControlHandle)> {
4954        if let FlatlandRequest::SetImageOpacity { image_id, val, control_handle } = self {
4955            Some((image_id, val, control_handle))
4956        } else {
4957            None
4958        }
4959    }
4960
4961    #[allow(irrefutable_let_patterns)]
4962    pub fn into_set_image_flip(self) -> Option<(ContentId, ImageFlip, FlatlandControlHandle)> {
4963        if let FlatlandRequest::SetImageFlip { image_id, flip, control_handle } = self {
4964            Some((image_id, flip, control_handle))
4965        } else {
4966            None
4967        }
4968    }
4969
4970    #[allow(irrefutable_let_patterns)]
4971    pub fn into_create_filled_rect(self) -> Option<(ContentId, FlatlandControlHandle)> {
4972        if let FlatlandRequest::CreateFilledRect { rect_id, control_handle } = self {
4973            Some((rect_id, control_handle))
4974        } else {
4975            None
4976        }
4977    }
4978
4979    #[allow(irrefutable_let_patterns)]
4980    pub fn into_set_solid_fill(
4981        self,
4982    ) -> Option<(ContentId, ColorRgba, fidl_fuchsia_math::SizeU, FlatlandControlHandle)> {
4983        if let FlatlandRequest::SetSolidFill { rect_id, color, size, control_handle } = self {
4984            Some((rect_id, color, size, control_handle))
4985        } else {
4986            None
4987        }
4988    }
4989
4990    #[allow(irrefutable_let_patterns)]
4991    pub fn into_release_filled_rect(self) -> Option<(ContentId, FlatlandControlHandle)> {
4992        if let FlatlandRequest::ReleaseFilledRect { rect_id, control_handle } = self {
4993            Some((rect_id, control_handle))
4994        } else {
4995            None
4996        }
4997    }
4998
4999    #[allow(irrefutable_let_patterns)]
5000    pub fn into_set_content(self) -> Option<(TransformId, ContentId, FlatlandControlHandle)> {
5001        if let FlatlandRequest::SetContent { transform_id, content_id, control_handle } = self {
5002            Some((transform_id, content_id, control_handle))
5003        } else {
5004            None
5005        }
5006    }
5007
5008    #[allow(irrefutable_let_patterns)]
5009    pub fn into_set_viewport_properties(
5010        self,
5011    ) -> Option<(ContentId, ViewportProperties, FlatlandControlHandle)> {
5012        if let FlatlandRequest::SetViewportProperties { viewport_id, properties, control_handle } =
5013            self
5014        {
5015            Some((viewport_id, properties, control_handle))
5016        } else {
5017            None
5018        }
5019    }
5020
5021    #[allow(irrefutable_let_patterns)]
5022    pub fn into_release_transform(self) -> Option<(TransformId, FlatlandControlHandle)> {
5023        if let FlatlandRequest::ReleaseTransform { transform_id, control_handle } = self {
5024            Some((transform_id, control_handle))
5025        } else {
5026            None
5027        }
5028    }
5029
5030    #[allow(irrefutable_let_patterns)]
5031    pub fn into_release_view(self) -> Option<(FlatlandControlHandle)> {
5032        if let FlatlandRequest::ReleaseView { control_handle } = self {
5033            Some((control_handle))
5034        } else {
5035            None
5036        }
5037    }
5038
5039    #[allow(irrefutable_let_patterns)]
5040    pub fn into_release_viewport(self) -> Option<(ContentId, FlatlandReleaseViewportResponder)> {
5041        if let FlatlandRequest::ReleaseViewport { viewport_id, responder } = self {
5042            Some((viewport_id, responder))
5043        } else {
5044            None
5045        }
5046    }
5047
5048    #[allow(irrefutable_let_patterns)]
5049    pub fn into_release_image(self) -> Option<(ContentId, FlatlandControlHandle)> {
5050        if let FlatlandRequest::ReleaseImage { image_id, control_handle } = self {
5051            Some((image_id, control_handle))
5052        } else {
5053            None
5054        }
5055    }
5056
5057    #[allow(irrefutable_let_patterns)]
5058    pub fn into_clear(self) -> Option<(FlatlandControlHandle)> {
5059        if let FlatlandRequest::Clear { control_handle } = self {
5060            Some((control_handle))
5061        } else {
5062            None
5063        }
5064    }
5065
5066    #[allow(irrefutable_let_patterns)]
5067    pub fn into_set_debug_name(self) -> Option<(String, FlatlandControlHandle)> {
5068        if let FlatlandRequest::SetDebugName { name, control_handle } = self {
5069            Some((name, control_handle))
5070        } else {
5071            None
5072        }
5073    }
5074
5075    /// Name of the method defined in FIDL
5076    pub fn method_name(&self) -> &'static str {
5077        match *self {
5078            FlatlandRequest::Present { .. } => "present",
5079            FlatlandRequest::CreateView { .. } => "create_view",
5080            FlatlandRequest::CreateView2 { .. } => "create_view2",
5081            FlatlandRequest::CreateTransform { .. } => "create_transform",
5082            FlatlandRequest::SetTranslation { .. } => "set_translation",
5083            FlatlandRequest::SetOrientation { .. } => "set_orientation",
5084            FlatlandRequest::SetScale { .. } => "set_scale",
5085            FlatlandRequest::SetOpacity { .. } => "set_opacity",
5086            FlatlandRequest::SetClipBoundary { .. } => "set_clip_boundary",
5087            FlatlandRequest::AddChild { .. } => "add_child",
5088            FlatlandRequest::RemoveChild { .. } => "remove_child",
5089            FlatlandRequest::ReplaceChildren { .. } => "replace_children",
5090            FlatlandRequest::SetRootTransform { .. } => "set_root_transform",
5091            FlatlandRequest::SetHitRegions { .. } => "set_hit_regions",
5092            FlatlandRequest::SetInfiniteHitRegion { .. } => "set_infinite_hit_region",
5093            FlatlandRequest::CreateViewport { .. } => "create_viewport",
5094            FlatlandRequest::CreateImage { .. } => "create_image",
5095            FlatlandRequest::SetImageSampleRegion { .. } => "set_image_sample_region",
5096            FlatlandRequest::SetImageDestinationSize { .. } => "set_image_destination_size",
5097            FlatlandRequest::SetImageBlendingFunction { .. } => "set_image_blending_function",
5098            FlatlandRequest::SetImageOpacity { .. } => "set_image_opacity",
5099            FlatlandRequest::SetImageFlip { .. } => "set_image_flip",
5100            FlatlandRequest::CreateFilledRect { .. } => "create_filled_rect",
5101            FlatlandRequest::SetSolidFill { .. } => "set_solid_fill",
5102            FlatlandRequest::ReleaseFilledRect { .. } => "release_filled_rect",
5103            FlatlandRequest::SetContent { .. } => "set_content",
5104            FlatlandRequest::SetViewportProperties { .. } => "set_viewport_properties",
5105            FlatlandRequest::ReleaseTransform { .. } => "release_transform",
5106            FlatlandRequest::ReleaseView { .. } => "release_view",
5107            FlatlandRequest::ReleaseViewport { .. } => "release_viewport",
5108            FlatlandRequest::ReleaseImage { .. } => "release_image",
5109            FlatlandRequest::Clear { .. } => "clear",
5110            FlatlandRequest::SetDebugName { .. } => "set_debug_name",
5111        }
5112    }
5113}
5114
5115#[derive(Debug, Clone)]
5116pub struct FlatlandControlHandle {
5117    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5118}
5119
5120impl fidl::endpoints::ControlHandle for FlatlandControlHandle {
5121    fn shutdown(&self) {
5122        self.inner.shutdown()
5123    }
5124    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
5125        self.inner.shutdown_with_epitaph(status)
5126    }
5127
5128    fn is_closed(&self) -> bool {
5129        self.inner.channel().is_closed()
5130    }
5131    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
5132        self.inner.channel().on_closed()
5133    }
5134
5135    #[cfg(target_os = "fuchsia")]
5136    fn signal_peer(
5137        &self,
5138        clear_mask: zx::Signals,
5139        set_mask: zx::Signals,
5140    ) -> Result<(), zx_status::Status> {
5141        use fidl::Peered;
5142        self.inner.channel().signal_peer(clear_mask, set_mask)
5143    }
5144}
5145
5146impl FlatlandControlHandle {
5147    pub fn send_on_next_frame_begin(
5148        &self,
5149        mut values: &OnNextFrameBeginValues,
5150    ) -> Result<(), fidl::Error> {
5151        self.inner.send::<FlatlandOnNextFrameBeginRequest>(
5152            (values,),
5153            0,
5154            0x10f69a5cdeece84a,
5155            fidl::encoding::DynamicFlags::empty(),
5156        )
5157    }
5158
5159    pub fn send_on_frame_presented(
5160        &self,
5161        mut frame_presented_info: &fidl_fuchsia_scenic_scheduling::FramePresentedInfo,
5162    ) -> Result<(), fidl::Error> {
5163        self.inner.send::<FlatlandOnFramePresentedRequest>(
5164            (frame_presented_info,),
5165            0,
5166            0x56e43e1a5f30216d,
5167            fidl::encoding::DynamicFlags::empty(),
5168        )
5169    }
5170
5171    pub fn send_on_error(&self, mut error: FlatlandError) -> Result<(), fidl::Error> {
5172        self.inner.send::<FlatlandOnErrorRequest>(
5173            (error,),
5174            0,
5175            0x1ebf39e90cd8b8d,
5176            fidl::encoding::DynamicFlags::empty(),
5177        )
5178    }
5179}
5180
5181#[must_use = "FIDL methods require a response to be sent"]
5182#[derive(Debug)]
5183pub struct FlatlandReleaseViewportResponder {
5184    control_handle: std::mem::ManuallyDrop<FlatlandControlHandle>,
5185    tx_id: u32,
5186}
5187
5188/// Set the the channel to be shutdown (see [`FlatlandControlHandle::shutdown`])
5189/// if the responder is dropped without sending a response, so that the client
5190/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5191impl std::ops::Drop for FlatlandReleaseViewportResponder {
5192    fn drop(&mut self) {
5193        self.control_handle.shutdown();
5194        // Safety: drops once, never accessed again
5195        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5196    }
5197}
5198
5199impl fidl::endpoints::Responder for FlatlandReleaseViewportResponder {
5200    type ControlHandle = FlatlandControlHandle;
5201
5202    fn control_handle(&self) -> &FlatlandControlHandle {
5203        &self.control_handle
5204    }
5205
5206    fn drop_without_shutdown(mut self) {
5207        // Safety: drops once, never accessed again due to mem::forget
5208        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5209        // Prevent Drop from running (which would shut down the channel)
5210        std::mem::forget(self);
5211    }
5212}
5213
5214impl FlatlandReleaseViewportResponder {
5215    /// Sends a response to the FIDL transaction.
5216    ///
5217    /// Sets the channel to shutdown if an error occurs.
5218    pub fn send(
5219        self,
5220        mut token: fidl_fuchsia_ui_views::ViewportCreationToken,
5221    ) -> Result<(), fidl::Error> {
5222        let _result = self.send_raw(token);
5223        if _result.is_err() {
5224            self.control_handle.shutdown();
5225        }
5226        self.drop_without_shutdown();
5227        _result
5228    }
5229
5230    /// Similar to "send" but does not shutdown the channel if an error occurs.
5231    pub fn send_no_shutdown_on_err(
5232        self,
5233        mut token: fidl_fuchsia_ui_views::ViewportCreationToken,
5234    ) -> Result<(), fidl::Error> {
5235        let _result = self.send_raw(token);
5236        self.drop_without_shutdown();
5237        _result
5238    }
5239
5240    fn send_raw(
5241        &self,
5242        mut token: fidl_fuchsia_ui_views::ViewportCreationToken,
5243    ) -> Result<(), fidl::Error> {
5244        self.control_handle.inner.send::<FlatlandReleaseViewportResponse>(
5245            (&mut token,),
5246            self.tx_id,
5247            0xbad474aeb5293f9,
5248            fidl::encoding::DynamicFlags::empty(),
5249        )
5250    }
5251}
5252
5253#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
5254pub struct FlatlandDisplayMarker;
5255
5256impl fidl::endpoints::ProtocolMarker for FlatlandDisplayMarker {
5257    type Proxy = FlatlandDisplayProxy;
5258    type RequestStream = FlatlandDisplayRequestStream;
5259    #[cfg(target_os = "fuchsia")]
5260    type SynchronousProxy = FlatlandDisplaySynchronousProxy;
5261
5262    const DEBUG_NAME: &'static str = "fuchsia.ui.composition.FlatlandDisplay";
5263}
5264impl fidl::endpoints::DiscoverableProtocolMarker for FlatlandDisplayMarker {}
5265
5266pub trait FlatlandDisplayProxyInterface: Send + Sync {
5267    fn r#set_content(
5268        &self,
5269        token: fidl_fuchsia_ui_views::ViewportCreationToken,
5270        child_view_watcher: fidl::endpoints::ServerEnd<ChildViewWatcherMarker>,
5271    ) -> Result<(), fidl::Error>;
5272    fn r#set_device_pixel_ratio(
5273        &self,
5274        device_pixel_ratio: &fidl_fuchsia_math::VecF,
5275    ) -> Result<(), fidl::Error>;
5276}
5277#[derive(Debug)]
5278#[cfg(target_os = "fuchsia")]
5279pub struct FlatlandDisplaySynchronousProxy {
5280    client: fidl::client::sync::Client,
5281}
5282
5283#[cfg(target_os = "fuchsia")]
5284impl fidl::endpoints::SynchronousProxy for FlatlandDisplaySynchronousProxy {
5285    type Proxy = FlatlandDisplayProxy;
5286    type Protocol = FlatlandDisplayMarker;
5287
5288    fn from_channel(inner: fidl::Channel) -> Self {
5289        Self::new(inner)
5290    }
5291
5292    fn into_channel(self) -> fidl::Channel {
5293        self.client.into_channel()
5294    }
5295
5296    fn as_channel(&self) -> &fidl::Channel {
5297        self.client.as_channel()
5298    }
5299}
5300
5301#[cfg(target_os = "fuchsia")]
5302impl FlatlandDisplaySynchronousProxy {
5303    pub fn new(channel: fidl::Channel) -> Self {
5304        let protocol_name = <FlatlandDisplayMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
5305        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
5306    }
5307
5308    pub fn into_channel(self) -> fidl::Channel {
5309        self.client.into_channel()
5310    }
5311
5312    /// Waits until an event arrives and returns it. It is safe for other
5313    /// threads to make concurrent requests while waiting for an event.
5314    pub fn wait_for_event(
5315        &self,
5316        deadline: zx::MonotonicInstant,
5317    ) -> Result<FlatlandDisplayEvent, fidl::Error> {
5318        FlatlandDisplayEvent::decode(self.client.wait_for_event(deadline)?)
5319    }
5320
5321    pub fn r#set_content(
5322        &self,
5323        mut token: fidl_fuchsia_ui_views::ViewportCreationToken,
5324        mut child_view_watcher: fidl::endpoints::ServerEnd<ChildViewWatcherMarker>,
5325    ) -> Result<(), fidl::Error> {
5326        self.client.send::<FlatlandDisplaySetContentRequest>(
5327            (&mut token, child_view_watcher),
5328            0x6748193a39918298,
5329            fidl::encoding::DynamicFlags::empty(),
5330        )
5331    }
5332
5333    /// Sets the ratio of display's physical pixels to device independent pixels that should be used
5334    /// for the tree of Flatland content that are attached to this display. See
5335    /// [`LayoutInfo.device_pixel_ratio`] for details.
5336    ///
5337    /// The default value is (1.0, 1.0). The valid values are 1.0 and above.
5338    pub fn r#set_device_pixel_ratio(
5339        &self,
5340        mut device_pixel_ratio: &fidl_fuchsia_math::VecF,
5341    ) -> Result<(), fidl::Error> {
5342        self.client.send::<FlatlandDisplaySetDevicePixelRatioRequest>(
5343            (device_pixel_ratio,),
5344            0x392c3e70cc0a81a4,
5345            fidl::encoding::DynamicFlags::empty(),
5346        )
5347    }
5348}
5349
5350#[cfg(target_os = "fuchsia")]
5351impl From<FlatlandDisplaySynchronousProxy> for zx::Handle {
5352    fn from(value: FlatlandDisplaySynchronousProxy) -> Self {
5353        value.into_channel().into()
5354    }
5355}
5356
5357#[cfg(target_os = "fuchsia")]
5358impl From<fidl::Channel> for FlatlandDisplaySynchronousProxy {
5359    fn from(value: fidl::Channel) -> Self {
5360        Self::new(value)
5361    }
5362}
5363
5364#[derive(Debug, Clone)]
5365pub struct FlatlandDisplayProxy {
5366    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
5367}
5368
5369impl fidl::endpoints::Proxy for FlatlandDisplayProxy {
5370    type Protocol = FlatlandDisplayMarker;
5371
5372    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
5373        Self::new(inner)
5374    }
5375
5376    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
5377        self.client.into_channel().map_err(|client| Self { client })
5378    }
5379
5380    fn as_channel(&self) -> &::fidl::AsyncChannel {
5381        self.client.as_channel()
5382    }
5383}
5384
5385impl FlatlandDisplayProxy {
5386    /// Create a new Proxy for fuchsia.ui.composition/FlatlandDisplay.
5387    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
5388        let protocol_name = <FlatlandDisplayMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
5389        Self { client: fidl::client::Client::new(channel, protocol_name) }
5390    }
5391
5392    /// Get a Stream of events from the remote end of the protocol.
5393    ///
5394    /// # Panics
5395    ///
5396    /// Panics if the event stream was already taken.
5397    pub fn take_event_stream(&self) -> FlatlandDisplayEventStream {
5398        FlatlandDisplayEventStream { event_receiver: self.client.take_event_receiver() }
5399    }
5400
5401    pub fn r#set_content(
5402        &self,
5403        mut token: fidl_fuchsia_ui_views::ViewportCreationToken,
5404        mut child_view_watcher: fidl::endpoints::ServerEnd<ChildViewWatcherMarker>,
5405    ) -> Result<(), fidl::Error> {
5406        FlatlandDisplayProxyInterface::r#set_content(self, token, child_view_watcher)
5407    }
5408
5409    /// Sets the ratio of display's physical pixels to device independent pixels that should be used
5410    /// for the tree of Flatland content that are attached to this display. See
5411    /// [`LayoutInfo.device_pixel_ratio`] for details.
5412    ///
5413    /// The default value is (1.0, 1.0). The valid values are 1.0 and above.
5414    pub fn r#set_device_pixel_ratio(
5415        &self,
5416        mut device_pixel_ratio: &fidl_fuchsia_math::VecF,
5417    ) -> Result<(), fidl::Error> {
5418        FlatlandDisplayProxyInterface::r#set_device_pixel_ratio(self, device_pixel_ratio)
5419    }
5420}
5421
5422impl FlatlandDisplayProxyInterface for FlatlandDisplayProxy {
5423    fn r#set_content(
5424        &self,
5425        mut token: fidl_fuchsia_ui_views::ViewportCreationToken,
5426        mut child_view_watcher: fidl::endpoints::ServerEnd<ChildViewWatcherMarker>,
5427    ) -> Result<(), fidl::Error> {
5428        self.client.send::<FlatlandDisplaySetContentRequest>(
5429            (&mut token, child_view_watcher),
5430            0x6748193a39918298,
5431            fidl::encoding::DynamicFlags::empty(),
5432        )
5433    }
5434
5435    fn r#set_device_pixel_ratio(
5436        &self,
5437        mut device_pixel_ratio: &fidl_fuchsia_math::VecF,
5438    ) -> Result<(), fidl::Error> {
5439        self.client.send::<FlatlandDisplaySetDevicePixelRatioRequest>(
5440            (device_pixel_ratio,),
5441            0x392c3e70cc0a81a4,
5442            fidl::encoding::DynamicFlags::empty(),
5443        )
5444    }
5445}
5446
5447pub struct FlatlandDisplayEventStream {
5448    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
5449}
5450
5451impl std::marker::Unpin for FlatlandDisplayEventStream {}
5452
5453impl futures::stream::FusedStream for FlatlandDisplayEventStream {
5454    fn is_terminated(&self) -> bool {
5455        self.event_receiver.is_terminated()
5456    }
5457}
5458
5459impl futures::Stream for FlatlandDisplayEventStream {
5460    type Item = Result<FlatlandDisplayEvent, fidl::Error>;
5461
5462    fn poll_next(
5463        mut self: std::pin::Pin<&mut Self>,
5464        cx: &mut std::task::Context<'_>,
5465    ) -> std::task::Poll<Option<Self::Item>> {
5466        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
5467            &mut self.event_receiver,
5468            cx
5469        )?) {
5470            Some(buf) => std::task::Poll::Ready(Some(FlatlandDisplayEvent::decode(buf))),
5471            None => std::task::Poll::Ready(None),
5472        }
5473    }
5474}
5475
5476#[derive(Debug)]
5477pub enum FlatlandDisplayEvent {}
5478
5479impl FlatlandDisplayEvent {
5480    /// Decodes a message buffer as a [`FlatlandDisplayEvent`].
5481    fn decode(
5482        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
5483    ) -> Result<FlatlandDisplayEvent, fidl::Error> {
5484        let (bytes, _handles) = buf.split_mut();
5485        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5486        debug_assert_eq!(tx_header.tx_id, 0);
5487        match tx_header.ordinal {
5488            _ => Err(fidl::Error::UnknownOrdinal {
5489                ordinal: tx_header.ordinal,
5490                protocol_name:
5491                    <FlatlandDisplayMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5492            }),
5493        }
5494    }
5495}
5496
5497/// A Stream of incoming requests for fuchsia.ui.composition/FlatlandDisplay.
5498pub struct FlatlandDisplayRequestStream {
5499    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5500    is_terminated: bool,
5501}
5502
5503impl std::marker::Unpin for FlatlandDisplayRequestStream {}
5504
5505impl futures::stream::FusedStream for FlatlandDisplayRequestStream {
5506    fn is_terminated(&self) -> bool {
5507        self.is_terminated
5508    }
5509}
5510
5511impl fidl::endpoints::RequestStream for FlatlandDisplayRequestStream {
5512    type Protocol = FlatlandDisplayMarker;
5513    type ControlHandle = FlatlandDisplayControlHandle;
5514
5515    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
5516        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
5517    }
5518
5519    fn control_handle(&self) -> Self::ControlHandle {
5520        FlatlandDisplayControlHandle { inner: self.inner.clone() }
5521    }
5522
5523    fn into_inner(
5524        self,
5525    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
5526    {
5527        (self.inner, self.is_terminated)
5528    }
5529
5530    fn from_inner(
5531        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5532        is_terminated: bool,
5533    ) -> Self {
5534        Self { inner, is_terminated }
5535    }
5536}
5537
5538impl futures::Stream for FlatlandDisplayRequestStream {
5539    type Item = Result<FlatlandDisplayRequest, fidl::Error>;
5540
5541    fn poll_next(
5542        mut self: std::pin::Pin<&mut Self>,
5543        cx: &mut std::task::Context<'_>,
5544    ) -> std::task::Poll<Option<Self::Item>> {
5545        let this = &mut *self;
5546        if this.inner.check_shutdown(cx) {
5547            this.is_terminated = true;
5548            return std::task::Poll::Ready(None);
5549        }
5550        if this.is_terminated {
5551            panic!("polled FlatlandDisplayRequestStream after completion");
5552        }
5553        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
5554            |bytes, handles| {
5555                match this.inner.channel().read_etc(cx, bytes, handles) {
5556                    std::task::Poll::Ready(Ok(())) => {}
5557                    std::task::Poll::Pending => return std::task::Poll::Pending,
5558                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
5559                        this.is_terminated = true;
5560                        return std::task::Poll::Ready(None);
5561                    }
5562                    std::task::Poll::Ready(Err(e)) => {
5563                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
5564                            e.into(),
5565                        ))))
5566                    }
5567                }
5568
5569                // A message has been received from the channel
5570                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5571
5572                std::task::Poll::Ready(Some(match header.ordinal {
5573                    0x6748193a39918298 => {
5574                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5575                        let mut req = fidl::new_empty!(
5576                            FlatlandDisplaySetContentRequest,
5577                            fidl::encoding::DefaultFuchsiaResourceDialect
5578                        );
5579                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandDisplaySetContentRequest>(&header, _body_bytes, handles, &mut req)?;
5580                        let control_handle =
5581                            FlatlandDisplayControlHandle { inner: this.inner.clone() };
5582                        Ok(FlatlandDisplayRequest::SetContent {
5583                            token: req.token,
5584                            child_view_watcher: req.child_view_watcher,
5585
5586                            control_handle,
5587                        })
5588                    }
5589                    0x392c3e70cc0a81a4 => {
5590                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5591                        let mut req = fidl::new_empty!(
5592                            FlatlandDisplaySetDevicePixelRatioRequest,
5593                            fidl::encoding::DefaultFuchsiaResourceDialect
5594                        );
5595                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandDisplaySetDevicePixelRatioRequest>(&header, _body_bytes, handles, &mut req)?;
5596                        let control_handle =
5597                            FlatlandDisplayControlHandle { inner: this.inner.clone() };
5598                        Ok(FlatlandDisplayRequest::SetDevicePixelRatio {
5599                            device_pixel_ratio: req.device_pixel_ratio,
5600
5601                            control_handle,
5602                        })
5603                    }
5604                    _ => Err(fidl::Error::UnknownOrdinal {
5605                        ordinal: header.ordinal,
5606                        protocol_name:
5607                            <FlatlandDisplayMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5608                    }),
5609                }))
5610            },
5611        )
5612    }
5613}
5614
5615/// This API connects to the singleton "primary display", and allows a tree of Flatland content to
5616/// be attached underneath.  Only one FlatlandDisplay client connection is allowed at one time.
5617#[derive(Debug)]
5618pub enum FlatlandDisplayRequest {
5619    SetContent {
5620        token: fidl_fuchsia_ui_views::ViewportCreationToken,
5621        child_view_watcher: fidl::endpoints::ServerEnd<ChildViewWatcherMarker>,
5622        control_handle: FlatlandDisplayControlHandle,
5623    },
5624    /// Sets the ratio of display's physical pixels to device independent pixels that should be used
5625    /// for the tree of Flatland content that are attached to this display. See
5626    /// [`LayoutInfo.device_pixel_ratio`] for details.
5627    ///
5628    /// The default value is (1.0, 1.0). The valid values are 1.0 and above.
5629    SetDevicePixelRatio {
5630        device_pixel_ratio: fidl_fuchsia_math::VecF,
5631        control_handle: FlatlandDisplayControlHandle,
5632    },
5633}
5634
5635impl FlatlandDisplayRequest {
5636    #[allow(irrefutable_let_patterns)]
5637    pub fn into_set_content(
5638        self,
5639    ) -> Option<(
5640        fidl_fuchsia_ui_views::ViewportCreationToken,
5641        fidl::endpoints::ServerEnd<ChildViewWatcherMarker>,
5642        FlatlandDisplayControlHandle,
5643    )> {
5644        if let FlatlandDisplayRequest::SetContent { token, child_view_watcher, control_handle } =
5645            self
5646        {
5647            Some((token, child_view_watcher, control_handle))
5648        } else {
5649            None
5650        }
5651    }
5652
5653    #[allow(irrefutable_let_patterns)]
5654    pub fn into_set_device_pixel_ratio(
5655        self,
5656    ) -> Option<(fidl_fuchsia_math::VecF, FlatlandDisplayControlHandle)> {
5657        if let FlatlandDisplayRequest::SetDevicePixelRatio { device_pixel_ratio, control_handle } =
5658            self
5659        {
5660            Some((device_pixel_ratio, control_handle))
5661        } else {
5662            None
5663        }
5664    }
5665
5666    /// Name of the method defined in FIDL
5667    pub fn method_name(&self) -> &'static str {
5668        match *self {
5669            FlatlandDisplayRequest::SetContent { .. } => "set_content",
5670            FlatlandDisplayRequest::SetDevicePixelRatio { .. } => "set_device_pixel_ratio",
5671        }
5672    }
5673}
5674
5675#[derive(Debug, Clone)]
5676pub struct FlatlandDisplayControlHandle {
5677    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5678}
5679
5680impl fidl::endpoints::ControlHandle for FlatlandDisplayControlHandle {
5681    fn shutdown(&self) {
5682        self.inner.shutdown()
5683    }
5684    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
5685        self.inner.shutdown_with_epitaph(status)
5686    }
5687
5688    fn is_closed(&self) -> bool {
5689        self.inner.channel().is_closed()
5690    }
5691    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
5692        self.inner.channel().on_closed()
5693    }
5694
5695    #[cfg(target_os = "fuchsia")]
5696    fn signal_peer(
5697        &self,
5698        clear_mask: zx::Signals,
5699        set_mask: zx::Signals,
5700    ) -> Result<(), zx_status::Status> {
5701        use fidl::Peered;
5702        self.inner.channel().signal_peer(clear_mask, set_mask)
5703    }
5704}
5705
5706impl FlatlandDisplayControlHandle {}
5707
5708#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
5709pub struct ParentViewportWatcherMarker;
5710
5711impl fidl::endpoints::ProtocolMarker for ParentViewportWatcherMarker {
5712    type Proxy = ParentViewportWatcherProxy;
5713    type RequestStream = ParentViewportWatcherRequestStream;
5714    #[cfg(target_os = "fuchsia")]
5715    type SynchronousProxy = ParentViewportWatcherSynchronousProxy;
5716
5717    const DEBUG_NAME: &'static str = "(anonymous) ParentViewportWatcher";
5718}
5719
5720pub trait ParentViewportWatcherProxyInterface: Send + Sync {
5721    type GetLayoutResponseFut: std::future::Future<Output = Result<LayoutInfo, fidl::Error>> + Send;
5722    fn r#get_layout(&self) -> Self::GetLayoutResponseFut;
5723    type GetStatusResponseFut: std::future::Future<Output = Result<ParentViewportStatus, fidl::Error>>
5724        + Send;
5725    fn r#get_status(&self) -> Self::GetStatusResponseFut;
5726}
5727#[derive(Debug)]
5728#[cfg(target_os = "fuchsia")]
5729pub struct ParentViewportWatcherSynchronousProxy {
5730    client: fidl::client::sync::Client,
5731}
5732
5733#[cfg(target_os = "fuchsia")]
5734impl fidl::endpoints::SynchronousProxy for ParentViewportWatcherSynchronousProxy {
5735    type Proxy = ParentViewportWatcherProxy;
5736    type Protocol = ParentViewportWatcherMarker;
5737
5738    fn from_channel(inner: fidl::Channel) -> Self {
5739        Self::new(inner)
5740    }
5741
5742    fn into_channel(self) -> fidl::Channel {
5743        self.client.into_channel()
5744    }
5745
5746    fn as_channel(&self) -> &fidl::Channel {
5747        self.client.as_channel()
5748    }
5749}
5750
5751#[cfg(target_os = "fuchsia")]
5752impl ParentViewportWatcherSynchronousProxy {
5753    pub fn new(channel: fidl::Channel) -> Self {
5754        let protocol_name =
5755            <ParentViewportWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
5756        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
5757    }
5758
5759    pub fn into_channel(self) -> fidl::Channel {
5760        self.client.into_channel()
5761    }
5762
5763    /// Waits until an event arrives and returns it. It is safe for other
5764    /// threads to make concurrent requests while waiting for an event.
5765    pub fn wait_for_event(
5766        &self,
5767        deadline: zx::MonotonicInstant,
5768    ) -> Result<ParentViewportWatcherEvent, fidl::Error> {
5769        ParentViewportWatcherEvent::decode(self.client.wait_for_event(deadline)?)
5770    }
5771
5772    /// A hanging get for receiving layout information. Clients may receive layout information
5773    /// before the ParentViewportWatcher operation has been presented. This allows children to
5774    /// layout their content before their first call to [`Present`]. In transition cases where two
5775    /// ParentViewportWatcher channels exist at the same time, both protocol instances will be
5776    /// receiving different layout information.
5777    ///
5778    /// This hanging get will only fire when the LayoutInfo is different than the previously
5779    /// returned LayoutInfo. Note that, since LayoutInfo is a table, only some fields may have
5780    /// changed.
5781    ///
5782    /// It is invalid to call `GetLayout` while a previous call is still pending. Doing so will
5783    /// cause both this channel and the Flatland channel that handed out ParentViewportWatcher to be
5784    /// closed.
5785    pub fn r#get_layout(
5786        &self,
5787        ___deadline: zx::MonotonicInstant,
5788    ) -> Result<LayoutInfo, fidl::Error> {
5789        let _response = self
5790            .client
5791            .send_query::<fidl::encoding::EmptyPayload, ParentViewportWatcherGetLayoutResponse>(
5792                (),
5793                0x3cbe5d9638e032,
5794                fidl::encoding::DynamicFlags::empty(),
5795                ___deadline,
5796            )?;
5797        Ok(_response.info)
5798    }
5799
5800    /// A hanging get for receiving the status of the parent Viewport. This provides global
5801    /// connectivity information to the child.
5802    ///
5803    /// This hanging get will only fire when the ParentViewportStatus is different than the
5804    /// previously returned ParentViewportStatus.
5805    ///
5806    /// It is invalid to call `GetStatus` while a previous call is still pending. Doing so will
5807    /// cause both this channel and the Flatland channel that handed out ParentViewportWatcher to be
5808    /// closed.
5809    pub fn r#get_status(
5810        &self,
5811        ___deadline: zx::MonotonicInstant,
5812    ) -> Result<ParentViewportStatus, fidl::Error> {
5813        let _response = self
5814            .client
5815            .send_query::<fidl::encoding::EmptyPayload, ParentViewportWatcherGetStatusResponse>(
5816                (),
5817                0x7caa022f050d9ea6,
5818                fidl::encoding::DynamicFlags::empty(),
5819                ___deadline,
5820            )?;
5821        Ok(_response.status)
5822    }
5823}
5824
5825#[cfg(target_os = "fuchsia")]
5826impl From<ParentViewportWatcherSynchronousProxy> for zx::Handle {
5827    fn from(value: ParentViewportWatcherSynchronousProxy) -> Self {
5828        value.into_channel().into()
5829    }
5830}
5831
5832#[cfg(target_os = "fuchsia")]
5833impl From<fidl::Channel> for ParentViewportWatcherSynchronousProxy {
5834    fn from(value: fidl::Channel) -> Self {
5835        Self::new(value)
5836    }
5837}
5838
5839#[derive(Debug, Clone)]
5840pub struct ParentViewportWatcherProxy {
5841    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
5842}
5843
5844impl fidl::endpoints::Proxy for ParentViewportWatcherProxy {
5845    type Protocol = ParentViewportWatcherMarker;
5846
5847    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
5848        Self::new(inner)
5849    }
5850
5851    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
5852        self.client.into_channel().map_err(|client| Self { client })
5853    }
5854
5855    fn as_channel(&self) -> &::fidl::AsyncChannel {
5856        self.client.as_channel()
5857    }
5858}
5859
5860impl ParentViewportWatcherProxy {
5861    /// Create a new Proxy for fuchsia.ui.composition/ParentViewportWatcher.
5862    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
5863        let protocol_name =
5864            <ParentViewportWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
5865        Self { client: fidl::client::Client::new(channel, protocol_name) }
5866    }
5867
5868    /// Get a Stream of events from the remote end of the protocol.
5869    ///
5870    /// # Panics
5871    ///
5872    /// Panics if the event stream was already taken.
5873    pub fn take_event_stream(&self) -> ParentViewportWatcherEventStream {
5874        ParentViewportWatcherEventStream { event_receiver: self.client.take_event_receiver() }
5875    }
5876
5877    /// A hanging get for receiving layout information. Clients may receive layout information
5878    /// before the ParentViewportWatcher operation has been presented. This allows children to
5879    /// layout their content before their first call to [`Present`]. In transition cases where two
5880    /// ParentViewportWatcher channels exist at the same time, both protocol instances will be
5881    /// receiving different layout information.
5882    ///
5883    /// This hanging get will only fire when the LayoutInfo is different than the previously
5884    /// returned LayoutInfo. Note that, since LayoutInfo is a table, only some fields may have
5885    /// changed.
5886    ///
5887    /// It is invalid to call `GetLayout` while a previous call is still pending. Doing so will
5888    /// cause both this channel and the Flatland channel that handed out ParentViewportWatcher to be
5889    /// closed.
5890    pub fn r#get_layout(
5891        &self,
5892    ) -> fidl::client::QueryResponseFut<LayoutInfo, fidl::encoding::DefaultFuchsiaResourceDialect>
5893    {
5894        ParentViewportWatcherProxyInterface::r#get_layout(self)
5895    }
5896
5897    /// A hanging get for receiving the status of the parent Viewport. This provides global
5898    /// connectivity information to the child.
5899    ///
5900    /// This hanging get will only fire when the ParentViewportStatus is different than the
5901    /// previously returned ParentViewportStatus.
5902    ///
5903    /// It is invalid to call `GetStatus` while a previous call is still pending. Doing so will
5904    /// cause both this channel and the Flatland channel that handed out ParentViewportWatcher to be
5905    /// closed.
5906    pub fn r#get_status(
5907        &self,
5908    ) -> fidl::client::QueryResponseFut<
5909        ParentViewportStatus,
5910        fidl::encoding::DefaultFuchsiaResourceDialect,
5911    > {
5912        ParentViewportWatcherProxyInterface::r#get_status(self)
5913    }
5914}
5915
5916impl ParentViewportWatcherProxyInterface for ParentViewportWatcherProxy {
5917    type GetLayoutResponseFut =
5918        fidl::client::QueryResponseFut<LayoutInfo, fidl::encoding::DefaultFuchsiaResourceDialect>;
5919    fn r#get_layout(&self) -> Self::GetLayoutResponseFut {
5920        fn _decode(
5921            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5922        ) -> Result<LayoutInfo, fidl::Error> {
5923            let _response = fidl::client::decode_transaction_body::<
5924                ParentViewportWatcherGetLayoutResponse,
5925                fidl::encoding::DefaultFuchsiaResourceDialect,
5926                0x3cbe5d9638e032,
5927            >(_buf?)?;
5928            Ok(_response.info)
5929        }
5930        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, LayoutInfo>(
5931            (),
5932            0x3cbe5d9638e032,
5933            fidl::encoding::DynamicFlags::empty(),
5934            _decode,
5935        )
5936    }
5937
5938    type GetStatusResponseFut = fidl::client::QueryResponseFut<
5939        ParentViewportStatus,
5940        fidl::encoding::DefaultFuchsiaResourceDialect,
5941    >;
5942    fn r#get_status(&self) -> Self::GetStatusResponseFut {
5943        fn _decode(
5944            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5945        ) -> Result<ParentViewportStatus, fidl::Error> {
5946            let _response = fidl::client::decode_transaction_body::<
5947                ParentViewportWatcherGetStatusResponse,
5948                fidl::encoding::DefaultFuchsiaResourceDialect,
5949                0x7caa022f050d9ea6,
5950            >(_buf?)?;
5951            Ok(_response.status)
5952        }
5953        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ParentViewportStatus>(
5954            (),
5955            0x7caa022f050d9ea6,
5956            fidl::encoding::DynamicFlags::empty(),
5957            _decode,
5958        )
5959    }
5960}
5961
5962pub struct ParentViewportWatcherEventStream {
5963    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
5964}
5965
5966impl std::marker::Unpin for ParentViewportWatcherEventStream {}
5967
5968impl futures::stream::FusedStream for ParentViewportWatcherEventStream {
5969    fn is_terminated(&self) -> bool {
5970        self.event_receiver.is_terminated()
5971    }
5972}
5973
5974impl futures::Stream for ParentViewportWatcherEventStream {
5975    type Item = Result<ParentViewportWatcherEvent, fidl::Error>;
5976
5977    fn poll_next(
5978        mut self: std::pin::Pin<&mut Self>,
5979        cx: &mut std::task::Context<'_>,
5980    ) -> std::task::Poll<Option<Self::Item>> {
5981        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
5982            &mut self.event_receiver,
5983            cx
5984        )?) {
5985            Some(buf) => std::task::Poll::Ready(Some(ParentViewportWatcherEvent::decode(buf))),
5986            None => std::task::Poll::Ready(None),
5987        }
5988    }
5989}
5990
5991#[derive(Debug)]
5992pub enum ParentViewportWatcherEvent {}
5993
5994impl ParentViewportWatcherEvent {
5995    /// Decodes a message buffer as a [`ParentViewportWatcherEvent`].
5996    fn decode(
5997        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
5998    ) -> Result<ParentViewportWatcherEvent, fidl::Error> {
5999        let (bytes, _handles) = buf.split_mut();
6000        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6001        debug_assert_eq!(tx_header.tx_id, 0);
6002        match tx_header.ordinal {
6003            _ => Err(fidl::Error::UnknownOrdinal {
6004                ordinal: tx_header.ordinal,
6005                protocol_name:
6006                    <ParentViewportWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6007            }),
6008        }
6009    }
6010}
6011
6012/// A Stream of incoming requests for fuchsia.ui.composition/ParentViewportWatcher.
6013pub struct ParentViewportWatcherRequestStream {
6014    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6015    is_terminated: bool,
6016}
6017
6018impl std::marker::Unpin for ParentViewportWatcherRequestStream {}
6019
6020impl futures::stream::FusedStream for ParentViewportWatcherRequestStream {
6021    fn is_terminated(&self) -> bool {
6022        self.is_terminated
6023    }
6024}
6025
6026impl fidl::endpoints::RequestStream for ParentViewportWatcherRequestStream {
6027    type Protocol = ParentViewportWatcherMarker;
6028    type ControlHandle = ParentViewportWatcherControlHandle;
6029
6030    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
6031        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
6032    }
6033
6034    fn control_handle(&self) -> Self::ControlHandle {
6035        ParentViewportWatcherControlHandle { inner: self.inner.clone() }
6036    }
6037
6038    fn into_inner(
6039        self,
6040    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
6041    {
6042        (self.inner, self.is_terminated)
6043    }
6044
6045    fn from_inner(
6046        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6047        is_terminated: bool,
6048    ) -> Self {
6049        Self { inner, is_terminated }
6050    }
6051}
6052
6053impl futures::Stream for ParentViewportWatcherRequestStream {
6054    type Item = Result<ParentViewportWatcherRequest, fidl::Error>;
6055
6056    fn poll_next(
6057        mut self: std::pin::Pin<&mut Self>,
6058        cx: &mut std::task::Context<'_>,
6059    ) -> std::task::Poll<Option<Self::Item>> {
6060        let this = &mut *self;
6061        if this.inner.check_shutdown(cx) {
6062            this.is_terminated = true;
6063            return std::task::Poll::Ready(None);
6064        }
6065        if this.is_terminated {
6066            panic!("polled ParentViewportWatcherRequestStream after completion");
6067        }
6068        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
6069            |bytes, handles| {
6070                match this.inner.channel().read_etc(cx, bytes, handles) {
6071                    std::task::Poll::Ready(Ok(())) => {}
6072                    std::task::Poll::Pending => return std::task::Poll::Pending,
6073                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
6074                        this.is_terminated = true;
6075                        return std::task::Poll::Ready(None);
6076                    }
6077                    std::task::Poll::Ready(Err(e)) => {
6078                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
6079                            e.into(),
6080                        ))))
6081                    }
6082                }
6083
6084                // A message has been received from the channel
6085                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6086
6087                std::task::Poll::Ready(Some(match header.ordinal {
6088                0x3cbe5d9638e032 => {
6089                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6090                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
6091                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
6092                    let control_handle = ParentViewportWatcherControlHandle {
6093                        inner: this.inner.clone(),
6094                    };
6095                    Ok(ParentViewportWatcherRequest::GetLayout {
6096                        responder: ParentViewportWatcherGetLayoutResponder {
6097                            control_handle: std::mem::ManuallyDrop::new(control_handle),
6098                            tx_id: header.tx_id,
6099                        },
6100                    })
6101                }
6102                0x7caa022f050d9ea6 => {
6103                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6104                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
6105                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
6106                    let control_handle = ParentViewportWatcherControlHandle {
6107                        inner: this.inner.clone(),
6108                    };
6109                    Ok(ParentViewportWatcherRequest::GetStatus {
6110                        responder: ParentViewportWatcherGetStatusResponder {
6111                            control_handle: std::mem::ManuallyDrop::new(control_handle),
6112                            tx_id: header.tx_id,
6113                        },
6114                    })
6115                }
6116                _ => Err(fidl::Error::UnknownOrdinal {
6117                    ordinal: header.ordinal,
6118                    protocol_name: <ParentViewportWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6119                }),
6120            }))
6121            },
6122        )
6123    }
6124}
6125
6126/// A protocol that provides information about the parent Viewport attached to a Flatland instance's
6127/// sole View.  Although Flatland instances can have at most one view, it is possible to have
6128/// multiple ParentViewportWatchers during the brief transition period when replacing the instance's
6129/// View with another, e.g. via [`CreateView`].  During this period, certain updates may be
6130/// duplicated and sent to each ParentViewportWatcher connection.
6131///
6132/// A ParentViewportWatcher will remain connected as long as the corresponding parent Viewport
6133/// exists; the connection will also be closed if the parents's ViewportCreationToken is dropped
6134/// without using it to create a Viewport.
6135#[derive(Debug)]
6136pub enum ParentViewportWatcherRequest {
6137    /// A hanging get for receiving layout information. Clients may receive layout information
6138    /// before the ParentViewportWatcher operation has been presented. This allows children to
6139    /// layout their content before their first call to [`Present`]. In transition cases where two
6140    /// ParentViewportWatcher channels exist at the same time, both protocol instances will be
6141    /// receiving different layout information.
6142    ///
6143    /// This hanging get will only fire when the LayoutInfo is different than the previously
6144    /// returned LayoutInfo. Note that, since LayoutInfo is a table, only some fields may have
6145    /// changed.
6146    ///
6147    /// It is invalid to call `GetLayout` while a previous call is still pending. Doing so will
6148    /// cause both this channel and the Flatland channel that handed out ParentViewportWatcher to be
6149    /// closed.
6150    GetLayout { responder: ParentViewportWatcherGetLayoutResponder },
6151    /// A hanging get for receiving the status of the parent Viewport. This provides global
6152    /// connectivity information to the child.
6153    ///
6154    /// This hanging get will only fire when the ParentViewportStatus is different than the
6155    /// previously returned ParentViewportStatus.
6156    ///
6157    /// It is invalid to call `GetStatus` while a previous call is still pending. Doing so will
6158    /// cause both this channel and the Flatland channel that handed out ParentViewportWatcher to be
6159    /// closed.
6160    GetStatus { responder: ParentViewportWatcherGetStatusResponder },
6161}
6162
6163impl ParentViewportWatcherRequest {
6164    #[allow(irrefutable_let_patterns)]
6165    pub fn into_get_layout(self) -> Option<(ParentViewportWatcherGetLayoutResponder)> {
6166        if let ParentViewportWatcherRequest::GetLayout { responder } = self {
6167            Some((responder))
6168        } else {
6169            None
6170        }
6171    }
6172
6173    #[allow(irrefutable_let_patterns)]
6174    pub fn into_get_status(self) -> Option<(ParentViewportWatcherGetStatusResponder)> {
6175        if let ParentViewportWatcherRequest::GetStatus { responder } = self {
6176            Some((responder))
6177        } else {
6178            None
6179        }
6180    }
6181
6182    /// Name of the method defined in FIDL
6183    pub fn method_name(&self) -> &'static str {
6184        match *self {
6185            ParentViewportWatcherRequest::GetLayout { .. } => "get_layout",
6186            ParentViewportWatcherRequest::GetStatus { .. } => "get_status",
6187        }
6188    }
6189}
6190
6191#[derive(Debug, Clone)]
6192pub struct ParentViewportWatcherControlHandle {
6193    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6194}
6195
6196impl fidl::endpoints::ControlHandle for ParentViewportWatcherControlHandle {
6197    fn shutdown(&self) {
6198        self.inner.shutdown()
6199    }
6200    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
6201        self.inner.shutdown_with_epitaph(status)
6202    }
6203
6204    fn is_closed(&self) -> bool {
6205        self.inner.channel().is_closed()
6206    }
6207    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
6208        self.inner.channel().on_closed()
6209    }
6210
6211    #[cfg(target_os = "fuchsia")]
6212    fn signal_peer(
6213        &self,
6214        clear_mask: zx::Signals,
6215        set_mask: zx::Signals,
6216    ) -> Result<(), zx_status::Status> {
6217        use fidl::Peered;
6218        self.inner.channel().signal_peer(clear_mask, set_mask)
6219    }
6220}
6221
6222impl ParentViewportWatcherControlHandle {}
6223
6224#[must_use = "FIDL methods require a response to be sent"]
6225#[derive(Debug)]
6226pub struct ParentViewportWatcherGetLayoutResponder {
6227    control_handle: std::mem::ManuallyDrop<ParentViewportWatcherControlHandle>,
6228    tx_id: u32,
6229}
6230
6231/// Set the the channel to be shutdown (see [`ParentViewportWatcherControlHandle::shutdown`])
6232/// if the responder is dropped without sending a response, so that the client
6233/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6234impl std::ops::Drop for ParentViewportWatcherGetLayoutResponder {
6235    fn drop(&mut self) {
6236        self.control_handle.shutdown();
6237        // Safety: drops once, never accessed again
6238        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6239    }
6240}
6241
6242impl fidl::endpoints::Responder for ParentViewportWatcherGetLayoutResponder {
6243    type ControlHandle = ParentViewportWatcherControlHandle;
6244
6245    fn control_handle(&self) -> &ParentViewportWatcherControlHandle {
6246        &self.control_handle
6247    }
6248
6249    fn drop_without_shutdown(mut self) {
6250        // Safety: drops once, never accessed again due to mem::forget
6251        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6252        // Prevent Drop from running (which would shut down the channel)
6253        std::mem::forget(self);
6254    }
6255}
6256
6257impl ParentViewportWatcherGetLayoutResponder {
6258    /// Sends a response to the FIDL transaction.
6259    ///
6260    /// Sets the channel to shutdown if an error occurs.
6261    pub fn send(self, mut info: &LayoutInfo) -> Result<(), fidl::Error> {
6262        let _result = self.send_raw(info);
6263        if _result.is_err() {
6264            self.control_handle.shutdown();
6265        }
6266        self.drop_without_shutdown();
6267        _result
6268    }
6269
6270    /// Similar to "send" but does not shutdown the channel if an error occurs.
6271    pub fn send_no_shutdown_on_err(self, mut info: &LayoutInfo) -> Result<(), fidl::Error> {
6272        let _result = self.send_raw(info);
6273        self.drop_without_shutdown();
6274        _result
6275    }
6276
6277    fn send_raw(&self, mut info: &LayoutInfo) -> Result<(), fidl::Error> {
6278        self.control_handle.inner.send::<ParentViewportWatcherGetLayoutResponse>(
6279            (info,),
6280            self.tx_id,
6281            0x3cbe5d9638e032,
6282            fidl::encoding::DynamicFlags::empty(),
6283        )
6284    }
6285}
6286
6287#[must_use = "FIDL methods require a response to be sent"]
6288#[derive(Debug)]
6289pub struct ParentViewportWatcherGetStatusResponder {
6290    control_handle: std::mem::ManuallyDrop<ParentViewportWatcherControlHandle>,
6291    tx_id: u32,
6292}
6293
6294/// Set the the channel to be shutdown (see [`ParentViewportWatcherControlHandle::shutdown`])
6295/// if the responder is dropped without sending a response, so that the client
6296/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6297impl std::ops::Drop for ParentViewportWatcherGetStatusResponder {
6298    fn drop(&mut self) {
6299        self.control_handle.shutdown();
6300        // Safety: drops once, never accessed again
6301        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6302    }
6303}
6304
6305impl fidl::endpoints::Responder for ParentViewportWatcherGetStatusResponder {
6306    type ControlHandle = ParentViewportWatcherControlHandle;
6307
6308    fn control_handle(&self) -> &ParentViewportWatcherControlHandle {
6309        &self.control_handle
6310    }
6311
6312    fn drop_without_shutdown(mut self) {
6313        // Safety: drops once, never accessed again due to mem::forget
6314        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6315        // Prevent Drop from running (which would shut down the channel)
6316        std::mem::forget(self);
6317    }
6318}
6319
6320impl ParentViewportWatcherGetStatusResponder {
6321    /// Sends a response to the FIDL transaction.
6322    ///
6323    /// Sets the channel to shutdown if an error occurs.
6324    pub fn send(self, mut status: ParentViewportStatus) -> Result<(), fidl::Error> {
6325        let _result = self.send_raw(status);
6326        if _result.is_err() {
6327            self.control_handle.shutdown();
6328        }
6329        self.drop_without_shutdown();
6330        _result
6331    }
6332
6333    /// Similar to "send" but does not shutdown the channel if an error occurs.
6334    pub fn send_no_shutdown_on_err(
6335        self,
6336        mut status: ParentViewportStatus,
6337    ) -> Result<(), fidl::Error> {
6338        let _result = self.send_raw(status);
6339        self.drop_without_shutdown();
6340        _result
6341    }
6342
6343    fn send_raw(&self, mut status: ParentViewportStatus) -> Result<(), fidl::Error> {
6344        self.control_handle.inner.send::<ParentViewportWatcherGetStatusResponse>(
6345            (status,),
6346            self.tx_id,
6347            0x7caa022f050d9ea6,
6348            fidl::encoding::DynamicFlags::empty(),
6349        )
6350    }
6351}
6352
6353#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
6354pub struct ScreenCaptureMarker;
6355
6356impl fidl::endpoints::ProtocolMarker for ScreenCaptureMarker {
6357    type Proxy = ScreenCaptureProxy;
6358    type RequestStream = ScreenCaptureRequestStream;
6359    #[cfg(target_os = "fuchsia")]
6360    type SynchronousProxy = ScreenCaptureSynchronousProxy;
6361
6362    const DEBUG_NAME: &'static str = "fuchsia.ui.composition.ScreenCapture";
6363}
6364impl fidl::endpoints::DiscoverableProtocolMarker for ScreenCaptureMarker {}
6365pub type ScreenCaptureConfigureResult = Result<(), ScreenCaptureError>;
6366pub type ScreenCaptureGetNextFrameResult = Result<FrameInfo, ScreenCaptureError>;
6367pub type ScreenCaptureReleaseFrameResult = Result<(), ScreenCaptureError>;
6368
6369pub trait ScreenCaptureProxyInterface: Send + Sync {
6370    type ConfigureResponseFut: std::future::Future<Output = Result<ScreenCaptureConfigureResult, fidl::Error>>
6371        + Send;
6372    fn r#configure(&self, payload: ScreenCaptureConfig) -> Self::ConfigureResponseFut;
6373    type GetNextFrameResponseFut: std::future::Future<Output = Result<ScreenCaptureGetNextFrameResult, fidl::Error>>
6374        + Send;
6375    fn r#get_next_frame(&self, payload: GetNextFrameArgs) -> Self::GetNextFrameResponseFut;
6376    type ReleaseFrameResponseFut: std::future::Future<Output = Result<ScreenCaptureReleaseFrameResult, fidl::Error>>
6377        + Send;
6378    fn r#release_frame(&self, buffer_id: u32) -> Self::ReleaseFrameResponseFut;
6379}
6380#[derive(Debug)]
6381#[cfg(target_os = "fuchsia")]
6382pub struct ScreenCaptureSynchronousProxy {
6383    client: fidl::client::sync::Client,
6384}
6385
6386#[cfg(target_os = "fuchsia")]
6387impl fidl::endpoints::SynchronousProxy for ScreenCaptureSynchronousProxy {
6388    type Proxy = ScreenCaptureProxy;
6389    type Protocol = ScreenCaptureMarker;
6390
6391    fn from_channel(inner: fidl::Channel) -> Self {
6392        Self::new(inner)
6393    }
6394
6395    fn into_channel(self) -> fidl::Channel {
6396        self.client.into_channel()
6397    }
6398
6399    fn as_channel(&self) -> &fidl::Channel {
6400        self.client.as_channel()
6401    }
6402}
6403
6404#[cfg(target_os = "fuchsia")]
6405impl ScreenCaptureSynchronousProxy {
6406    pub fn new(channel: fidl::Channel) -> Self {
6407        let protocol_name = <ScreenCaptureMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
6408        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
6409    }
6410
6411    pub fn into_channel(self) -> fidl::Channel {
6412        self.client.into_channel()
6413    }
6414
6415    /// Waits until an event arrives and returns it. It is safe for other
6416    /// threads to make concurrent requests while waiting for an event.
6417    pub fn wait_for_event(
6418        &self,
6419        deadline: zx::MonotonicInstant,
6420    ) -> Result<ScreenCaptureEvent, fidl::Error> {
6421        ScreenCaptureEvent::decode(self.client.wait_for_event(deadline)?)
6422    }
6423
6424    /// Clients should first use the Allocator protocol to register a
6425    /// BufferCollection. This function will fail with BAD_OPERATION unless all clients of the
6426    /// BufferCollection have set their constraints.
6427    ///
6428    /// Afterwards, clients should create and configure the images that will
6429    /// eventually be rendered to using this method. All the buffers in the
6430    /// collection from 0 to (buffer_count-1) may be used for screen capture.
6431    ///
6432    /// Clients are responsible for determining the rotation of the display,
6433    /// and applying the corrective rotation. For instance, if the display is
6434    /// mounted 90 degrees clockwise (the "top" is on the right, when looking
6435    /// at the display), then the client should specify a 270 degree rotation
6436    /// to account for it.
6437    ///
6438    /// Similarly, the clients are responsible for specifying a buffer big
6439    /// enough for the rotated image. If the buffer is too small, a best effort
6440    /// attempt will be made to render the image.
6441    ///
6442    /// Finally, clients request the server to render the current screen to the
6443    /// shared buffers using [`GetNextFrame`].
6444    ///
6445    /// [`Configure`] can be called again with a new BufferCollectionImportToken
6446    /// if the client wishes to change any of the configuration settings. In
6447    /// this case all the buffers from the previous call to [`Configure`] will
6448    /// be released.
6449    pub fn r#configure(
6450        &self,
6451        mut payload: ScreenCaptureConfig,
6452        ___deadline: zx::MonotonicInstant,
6453    ) -> Result<ScreenCaptureConfigureResult, fidl::Error> {
6454        let _response = self.client.send_query::<ScreenCaptureConfig, fidl::encoding::ResultType<
6455            fidl::encoding::EmptyStruct,
6456            ScreenCaptureError,
6457        >>(
6458            &mut payload,
6459            0x3b6e5af1d294afd9,
6460            fidl::encoding::DynamicFlags::empty(),
6461            ___deadline,
6462        )?;
6463        Ok(_response.map(|x| x))
6464    }
6465
6466    /// Following a successful call to [`Configure`], clients can call
6467    /// GetNextFrame. This will populate a buffer with the most recent frame.
6468    ///
6469    /// Clients should wait on the zx::event they pass for successful
6470    /// completion of the screenshot. It is not guaranteed that the screenshot
6471    /// will be completed by the time this function returns.
6472    ///
6473    /// The requested image will be in the BufferCollection that the client set
6474    /// up in the VMO at the index specified by buffer_id.
6475    ///
6476    /// When ScreenCapture is used to provide a stream, the rate that the
6477    /// client calls GetNextFrame will drive the frame rate.
6478    ///
6479    /// Errors:
6480    /// BAD_OPERATION if Configure was not called, or not called successfully
6481    /// MISSING_ARGS if a required argument is not present
6482    /// BUFFER_FULL if all buffers in the BufferCollection are in use. In this case, ReleaseFrame
6483    /// must be called to make a buffer available before this function can be called successfully.
6484    pub fn r#get_next_frame(
6485        &self,
6486        mut payload: GetNextFrameArgs,
6487        ___deadline: zx::MonotonicInstant,
6488    ) -> Result<ScreenCaptureGetNextFrameResult, fidl::Error> {
6489        let _response = self.client.send_query::<
6490            GetNextFrameArgs,
6491            fidl::encoding::ResultType<FrameInfo, ScreenCaptureError>,
6492        >(
6493            &mut payload,
6494            0x552c1580aab8c4a7,
6495            fidl::encoding::DynamicFlags::empty(),
6496            ___deadline,
6497        )?;
6498        Ok(_response.map(|x| x))
6499    }
6500
6501    /// Once the client no longer needs an image, they can call ReleaseFrame on
6502    /// the VMO index of the buffer so that the server can reuse it in the future.
6503    pub fn r#release_frame(
6504        &self,
6505        mut buffer_id: u32,
6506        ___deadline: zx::MonotonicInstant,
6507    ) -> Result<ScreenCaptureReleaseFrameResult, fidl::Error> {
6508        let _response =
6509            self.client.send_query::<ScreenCaptureReleaseFrameRequest, fidl::encoding::ResultType<
6510                fidl::encoding::EmptyStruct,
6511                ScreenCaptureError,
6512            >>(
6513                (buffer_id,),
6514                0x46704dce24e35950,
6515                fidl::encoding::DynamicFlags::empty(),
6516                ___deadline,
6517            )?;
6518        Ok(_response.map(|x| x))
6519    }
6520}
6521
6522#[cfg(target_os = "fuchsia")]
6523impl From<ScreenCaptureSynchronousProxy> for zx::Handle {
6524    fn from(value: ScreenCaptureSynchronousProxy) -> Self {
6525        value.into_channel().into()
6526    }
6527}
6528
6529#[cfg(target_os = "fuchsia")]
6530impl From<fidl::Channel> for ScreenCaptureSynchronousProxy {
6531    fn from(value: fidl::Channel) -> Self {
6532        Self::new(value)
6533    }
6534}
6535
6536#[derive(Debug, Clone)]
6537pub struct ScreenCaptureProxy {
6538    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
6539}
6540
6541impl fidl::endpoints::Proxy for ScreenCaptureProxy {
6542    type Protocol = ScreenCaptureMarker;
6543
6544    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
6545        Self::new(inner)
6546    }
6547
6548    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
6549        self.client.into_channel().map_err(|client| Self { client })
6550    }
6551
6552    fn as_channel(&self) -> &::fidl::AsyncChannel {
6553        self.client.as_channel()
6554    }
6555}
6556
6557impl ScreenCaptureProxy {
6558    /// Create a new Proxy for fuchsia.ui.composition/ScreenCapture.
6559    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
6560        let protocol_name = <ScreenCaptureMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
6561        Self { client: fidl::client::Client::new(channel, protocol_name) }
6562    }
6563
6564    /// Get a Stream of events from the remote end of the protocol.
6565    ///
6566    /// # Panics
6567    ///
6568    /// Panics if the event stream was already taken.
6569    pub fn take_event_stream(&self) -> ScreenCaptureEventStream {
6570        ScreenCaptureEventStream { event_receiver: self.client.take_event_receiver() }
6571    }
6572
6573    /// Clients should first use the Allocator protocol to register a
6574    /// BufferCollection. This function will fail with BAD_OPERATION unless all clients of the
6575    /// BufferCollection have set their constraints.
6576    ///
6577    /// Afterwards, clients should create and configure the images that will
6578    /// eventually be rendered to using this method. All the buffers in the
6579    /// collection from 0 to (buffer_count-1) may be used for screen capture.
6580    ///
6581    /// Clients are responsible for determining the rotation of the display,
6582    /// and applying the corrective rotation. For instance, if the display is
6583    /// mounted 90 degrees clockwise (the "top" is on the right, when looking
6584    /// at the display), then the client should specify a 270 degree rotation
6585    /// to account for it.
6586    ///
6587    /// Similarly, the clients are responsible for specifying a buffer big
6588    /// enough for the rotated image. If the buffer is too small, a best effort
6589    /// attempt will be made to render the image.
6590    ///
6591    /// Finally, clients request the server to render the current screen to the
6592    /// shared buffers using [`GetNextFrame`].
6593    ///
6594    /// [`Configure`] can be called again with a new BufferCollectionImportToken
6595    /// if the client wishes to change any of the configuration settings. In
6596    /// this case all the buffers from the previous call to [`Configure`] will
6597    /// be released.
6598    pub fn r#configure(
6599        &self,
6600        mut payload: ScreenCaptureConfig,
6601    ) -> fidl::client::QueryResponseFut<
6602        ScreenCaptureConfigureResult,
6603        fidl::encoding::DefaultFuchsiaResourceDialect,
6604    > {
6605        ScreenCaptureProxyInterface::r#configure(self, payload)
6606    }
6607
6608    /// Following a successful call to [`Configure`], clients can call
6609    /// GetNextFrame. This will populate a buffer with the most recent frame.
6610    ///
6611    /// Clients should wait on the zx::event they pass for successful
6612    /// completion of the screenshot. It is not guaranteed that the screenshot
6613    /// will be completed by the time this function returns.
6614    ///
6615    /// The requested image will be in the BufferCollection that the client set
6616    /// up in the VMO at the index specified by buffer_id.
6617    ///
6618    /// When ScreenCapture is used to provide a stream, the rate that the
6619    /// client calls GetNextFrame will drive the frame rate.
6620    ///
6621    /// Errors:
6622    /// BAD_OPERATION if Configure was not called, or not called successfully
6623    /// MISSING_ARGS if a required argument is not present
6624    /// BUFFER_FULL if all buffers in the BufferCollection are in use. In this case, ReleaseFrame
6625    /// must be called to make a buffer available before this function can be called successfully.
6626    pub fn r#get_next_frame(
6627        &self,
6628        mut payload: GetNextFrameArgs,
6629    ) -> fidl::client::QueryResponseFut<
6630        ScreenCaptureGetNextFrameResult,
6631        fidl::encoding::DefaultFuchsiaResourceDialect,
6632    > {
6633        ScreenCaptureProxyInterface::r#get_next_frame(self, payload)
6634    }
6635
6636    /// Once the client no longer needs an image, they can call ReleaseFrame on
6637    /// the VMO index of the buffer so that the server can reuse it in the future.
6638    pub fn r#release_frame(
6639        &self,
6640        mut buffer_id: u32,
6641    ) -> fidl::client::QueryResponseFut<
6642        ScreenCaptureReleaseFrameResult,
6643        fidl::encoding::DefaultFuchsiaResourceDialect,
6644    > {
6645        ScreenCaptureProxyInterface::r#release_frame(self, buffer_id)
6646    }
6647}
6648
6649impl ScreenCaptureProxyInterface for ScreenCaptureProxy {
6650    type ConfigureResponseFut = fidl::client::QueryResponseFut<
6651        ScreenCaptureConfigureResult,
6652        fidl::encoding::DefaultFuchsiaResourceDialect,
6653    >;
6654    fn r#configure(&self, mut payload: ScreenCaptureConfig) -> Self::ConfigureResponseFut {
6655        fn _decode(
6656            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6657        ) -> Result<ScreenCaptureConfigureResult, fidl::Error> {
6658            let _response = fidl::client::decode_transaction_body::<
6659                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, ScreenCaptureError>,
6660                fidl::encoding::DefaultFuchsiaResourceDialect,
6661                0x3b6e5af1d294afd9,
6662            >(_buf?)?;
6663            Ok(_response.map(|x| x))
6664        }
6665        self.client.send_query_and_decode::<ScreenCaptureConfig, ScreenCaptureConfigureResult>(
6666            &mut payload,
6667            0x3b6e5af1d294afd9,
6668            fidl::encoding::DynamicFlags::empty(),
6669            _decode,
6670        )
6671    }
6672
6673    type GetNextFrameResponseFut = fidl::client::QueryResponseFut<
6674        ScreenCaptureGetNextFrameResult,
6675        fidl::encoding::DefaultFuchsiaResourceDialect,
6676    >;
6677    fn r#get_next_frame(&self, mut payload: GetNextFrameArgs) -> Self::GetNextFrameResponseFut {
6678        fn _decode(
6679            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6680        ) -> Result<ScreenCaptureGetNextFrameResult, fidl::Error> {
6681            let _response = fidl::client::decode_transaction_body::<
6682                fidl::encoding::ResultType<FrameInfo, ScreenCaptureError>,
6683                fidl::encoding::DefaultFuchsiaResourceDialect,
6684                0x552c1580aab8c4a7,
6685            >(_buf?)?;
6686            Ok(_response.map(|x| x))
6687        }
6688        self.client.send_query_and_decode::<GetNextFrameArgs, ScreenCaptureGetNextFrameResult>(
6689            &mut payload,
6690            0x552c1580aab8c4a7,
6691            fidl::encoding::DynamicFlags::empty(),
6692            _decode,
6693        )
6694    }
6695
6696    type ReleaseFrameResponseFut = fidl::client::QueryResponseFut<
6697        ScreenCaptureReleaseFrameResult,
6698        fidl::encoding::DefaultFuchsiaResourceDialect,
6699    >;
6700    fn r#release_frame(&self, mut buffer_id: u32) -> Self::ReleaseFrameResponseFut {
6701        fn _decode(
6702            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6703        ) -> Result<ScreenCaptureReleaseFrameResult, fidl::Error> {
6704            let _response = fidl::client::decode_transaction_body::<
6705                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, ScreenCaptureError>,
6706                fidl::encoding::DefaultFuchsiaResourceDialect,
6707                0x46704dce24e35950,
6708            >(_buf?)?;
6709            Ok(_response.map(|x| x))
6710        }
6711        self.client.send_query_and_decode::<
6712            ScreenCaptureReleaseFrameRequest,
6713            ScreenCaptureReleaseFrameResult,
6714        >(
6715            (buffer_id,),
6716            0x46704dce24e35950,
6717            fidl::encoding::DynamicFlags::empty(),
6718            _decode,
6719        )
6720    }
6721}
6722
6723pub struct ScreenCaptureEventStream {
6724    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
6725}
6726
6727impl std::marker::Unpin for ScreenCaptureEventStream {}
6728
6729impl futures::stream::FusedStream for ScreenCaptureEventStream {
6730    fn is_terminated(&self) -> bool {
6731        self.event_receiver.is_terminated()
6732    }
6733}
6734
6735impl futures::Stream for ScreenCaptureEventStream {
6736    type Item = Result<ScreenCaptureEvent, fidl::Error>;
6737
6738    fn poll_next(
6739        mut self: std::pin::Pin<&mut Self>,
6740        cx: &mut std::task::Context<'_>,
6741    ) -> std::task::Poll<Option<Self::Item>> {
6742        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
6743            &mut self.event_receiver,
6744            cx
6745        )?) {
6746            Some(buf) => std::task::Poll::Ready(Some(ScreenCaptureEvent::decode(buf))),
6747            None => std::task::Poll::Ready(None),
6748        }
6749    }
6750}
6751
6752#[derive(Debug)]
6753pub enum ScreenCaptureEvent {}
6754
6755impl ScreenCaptureEvent {
6756    /// Decodes a message buffer as a [`ScreenCaptureEvent`].
6757    fn decode(
6758        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
6759    ) -> Result<ScreenCaptureEvent, fidl::Error> {
6760        let (bytes, _handles) = buf.split_mut();
6761        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6762        debug_assert_eq!(tx_header.tx_id, 0);
6763        match tx_header.ordinal {
6764            _ => Err(fidl::Error::UnknownOrdinal {
6765                ordinal: tx_header.ordinal,
6766                protocol_name: <ScreenCaptureMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6767            }),
6768        }
6769    }
6770}
6771
6772/// A Stream of incoming requests for fuchsia.ui.composition/ScreenCapture.
6773pub struct ScreenCaptureRequestStream {
6774    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6775    is_terminated: bool,
6776}
6777
6778impl std::marker::Unpin for ScreenCaptureRequestStream {}
6779
6780impl futures::stream::FusedStream for ScreenCaptureRequestStream {
6781    fn is_terminated(&self) -> bool {
6782        self.is_terminated
6783    }
6784}
6785
6786impl fidl::endpoints::RequestStream for ScreenCaptureRequestStream {
6787    type Protocol = ScreenCaptureMarker;
6788    type ControlHandle = ScreenCaptureControlHandle;
6789
6790    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
6791        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
6792    }
6793
6794    fn control_handle(&self) -> Self::ControlHandle {
6795        ScreenCaptureControlHandle { inner: self.inner.clone() }
6796    }
6797
6798    fn into_inner(
6799        self,
6800    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
6801    {
6802        (self.inner, self.is_terminated)
6803    }
6804
6805    fn from_inner(
6806        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6807        is_terminated: bool,
6808    ) -> Self {
6809        Self { inner, is_terminated }
6810    }
6811}
6812
6813impl futures::Stream for ScreenCaptureRequestStream {
6814    type Item = Result<ScreenCaptureRequest, fidl::Error>;
6815
6816    fn poll_next(
6817        mut self: std::pin::Pin<&mut Self>,
6818        cx: &mut std::task::Context<'_>,
6819    ) -> std::task::Poll<Option<Self::Item>> {
6820        let this = &mut *self;
6821        if this.inner.check_shutdown(cx) {
6822            this.is_terminated = true;
6823            return std::task::Poll::Ready(None);
6824        }
6825        if this.is_terminated {
6826            panic!("polled ScreenCaptureRequestStream after completion");
6827        }
6828        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
6829            |bytes, handles| {
6830                match this.inner.channel().read_etc(cx, bytes, handles) {
6831                    std::task::Poll::Ready(Ok(())) => {}
6832                    std::task::Poll::Pending => return std::task::Poll::Pending,
6833                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
6834                        this.is_terminated = true;
6835                        return std::task::Poll::Ready(None);
6836                    }
6837                    std::task::Poll::Ready(Err(e)) => {
6838                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
6839                            e.into(),
6840                        ))))
6841                    }
6842                }
6843
6844                // A message has been received from the channel
6845                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6846
6847                std::task::Poll::Ready(Some(match header.ordinal {
6848                    0x3b6e5af1d294afd9 => {
6849                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6850                        let mut req = fidl::new_empty!(
6851                            ScreenCaptureConfig,
6852                            fidl::encoding::DefaultFuchsiaResourceDialect
6853                        );
6854                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ScreenCaptureConfig>(&header, _body_bytes, handles, &mut req)?;
6855                        let control_handle =
6856                            ScreenCaptureControlHandle { inner: this.inner.clone() };
6857                        Ok(ScreenCaptureRequest::Configure {
6858                            payload: req,
6859                            responder: ScreenCaptureConfigureResponder {
6860                                control_handle: std::mem::ManuallyDrop::new(control_handle),
6861                                tx_id: header.tx_id,
6862                            },
6863                        })
6864                    }
6865                    0x552c1580aab8c4a7 => {
6866                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6867                        let mut req = fidl::new_empty!(
6868                            GetNextFrameArgs,
6869                            fidl::encoding::DefaultFuchsiaResourceDialect
6870                        );
6871                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<GetNextFrameArgs>(&header, _body_bytes, handles, &mut req)?;
6872                        let control_handle =
6873                            ScreenCaptureControlHandle { inner: this.inner.clone() };
6874                        Ok(ScreenCaptureRequest::GetNextFrame {
6875                            payload: req,
6876                            responder: ScreenCaptureGetNextFrameResponder {
6877                                control_handle: std::mem::ManuallyDrop::new(control_handle),
6878                                tx_id: header.tx_id,
6879                            },
6880                        })
6881                    }
6882                    0x46704dce24e35950 => {
6883                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6884                        let mut req = fidl::new_empty!(
6885                            ScreenCaptureReleaseFrameRequest,
6886                            fidl::encoding::DefaultFuchsiaResourceDialect
6887                        );
6888                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ScreenCaptureReleaseFrameRequest>(&header, _body_bytes, handles, &mut req)?;
6889                        let control_handle =
6890                            ScreenCaptureControlHandle { inner: this.inner.clone() };
6891                        Ok(ScreenCaptureRequest::ReleaseFrame {
6892                            buffer_id: req.buffer_id,
6893
6894                            responder: ScreenCaptureReleaseFrameResponder {
6895                                control_handle: std::mem::ManuallyDrop::new(control_handle),
6896                                tx_id: header.tx_id,
6897                            },
6898                        })
6899                    }
6900                    _ => Err(fidl::Error::UnknownOrdinal {
6901                        ordinal: header.ordinal,
6902                        protocol_name:
6903                            <ScreenCaptureMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6904                    }),
6905                }))
6906            },
6907        )
6908    }
6909}
6910
6911/// This protocol provides a low-level ScreenCapture API for clients to use.
6912/// ScreenCapture clients should familiarize themselves with the
6913/// [`fuchsia.sysmem/BufferCollection`] and [`fuchsia.ui.composition/Allocator`] protocols
6914/// as those are necessary to create the BufferCollections and images ScreenCapture uses.
6915#[derive(Debug)]
6916pub enum ScreenCaptureRequest {
6917    /// Clients should first use the Allocator protocol to register a
6918    /// BufferCollection. This function will fail with BAD_OPERATION unless all clients of the
6919    /// BufferCollection have set their constraints.
6920    ///
6921    /// Afterwards, clients should create and configure the images that will
6922    /// eventually be rendered to using this method. All the buffers in the
6923    /// collection from 0 to (buffer_count-1) may be used for screen capture.
6924    ///
6925    /// Clients are responsible for determining the rotation of the display,
6926    /// and applying the corrective rotation. For instance, if the display is
6927    /// mounted 90 degrees clockwise (the "top" is on the right, when looking
6928    /// at the display), then the client should specify a 270 degree rotation
6929    /// to account for it.
6930    ///
6931    /// Similarly, the clients are responsible for specifying a buffer big
6932    /// enough for the rotated image. If the buffer is too small, a best effort
6933    /// attempt will be made to render the image.
6934    ///
6935    /// Finally, clients request the server to render the current screen to the
6936    /// shared buffers using [`GetNextFrame`].
6937    ///
6938    /// [`Configure`] can be called again with a new BufferCollectionImportToken
6939    /// if the client wishes to change any of the configuration settings. In
6940    /// this case all the buffers from the previous call to [`Configure`] will
6941    /// be released.
6942    Configure { payload: ScreenCaptureConfig, responder: ScreenCaptureConfigureResponder },
6943    /// Following a successful call to [`Configure`], clients can call
6944    /// GetNextFrame. This will populate a buffer with the most recent frame.
6945    ///
6946    /// Clients should wait on the zx::event they pass for successful
6947    /// completion of the screenshot. It is not guaranteed that the screenshot
6948    /// will be completed by the time this function returns.
6949    ///
6950    /// The requested image will be in the BufferCollection that the client set
6951    /// up in the VMO at the index specified by buffer_id.
6952    ///
6953    /// When ScreenCapture is used to provide a stream, the rate that the
6954    /// client calls GetNextFrame will drive the frame rate.
6955    ///
6956    /// Errors:
6957    /// BAD_OPERATION if Configure was not called, or not called successfully
6958    /// MISSING_ARGS if a required argument is not present
6959    /// BUFFER_FULL if all buffers in the BufferCollection are in use. In this case, ReleaseFrame
6960    /// must be called to make a buffer available before this function can be called successfully.
6961    GetNextFrame { payload: GetNextFrameArgs, responder: ScreenCaptureGetNextFrameResponder },
6962    /// Once the client no longer needs an image, they can call ReleaseFrame on
6963    /// the VMO index of the buffer so that the server can reuse it in the future.
6964    ReleaseFrame { buffer_id: u32, responder: ScreenCaptureReleaseFrameResponder },
6965}
6966
6967impl ScreenCaptureRequest {
6968    #[allow(irrefutable_let_patterns)]
6969    pub fn into_configure(self) -> Option<(ScreenCaptureConfig, ScreenCaptureConfigureResponder)> {
6970        if let ScreenCaptureRequest::Configure { payload, responder } = self {
6971            Some((payload, responder))
6972        } else {
6973            None
6974        }
6975    }
6976
6977    #[allow(irrefutable_let_patterns)]
6978    pub fn into_get_next_frame(
6979        self,
6980    ) -> Option<(GetNextFrameArgs, ScreenCaptureGetNextFrameResponder)> {
6981        if let ScreenCaptureRequest::GetNextFrame { payload, responder } = self {
6982            Some((payload, responder))
6983        } else {
6984            None
6985        }
6986    }
6987
6988    #[allow(irrefutable_let_patterns)]
6989    pub fn into_release_frame(self) -> Option<(u32, ScreenCaptureReleaseFrameResponder)> {
6990        if let ScreenCaptureRequest::ReleaseFrame { buffer_id, responder } = self {
6991            Some((buffer_id, responder))
6992        } else {
6993            None
6994        }
6995    }
6996
6997    /// Name of the method defined in FIDL
6998    pub fn method_name(&self) -> &'static str {
6999        match *self {
7000            ScreenCaptureRequest::Configure { .. } => "configure",
7001            ScreenCaptureRequest::GetNextFrame { .. } => "get_next_frame",
7002            ScreenCaptureRequest::ReleaseFrame { .. } => "release_frame",
7003        }
7004    }
7005}
7006
7007#[derive(Debug, Clone)]
7008pub struct ScreenCaptureControlHandle {
7009    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7010}
7011
7012impl fidl::endpoints::ControlHandle for ScreenCaptureControlHandle {
7013    fn shutdown(&self) {
7014        self.inner.shutdown()
7015    }
7016    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
7017        self.inner.shutdown_with_epitaph(status)
7018    }
7019
7020    fn is_closed(&self) -> bool {
7021        self.inner.channel().is_closed()
7022    }
7023    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
7024        self.inner.channel().on_closed()
7025    }
7026
7027    #[cfg(target_os = "fuchsia")]
7028    fn signal_peer(
7029        &self,
7030        clear_mask: zx::Signals,
7031        set_mask: zx::Signals,
7032    ) -> Result<(), zx_status::Status> {
7033        use fidl::Peered;
7034        self.inner.channel().signal_peer(clear_mask, set_mask)
7035    }
7036}
7037
7038impl ScreenCaptureControlHandle {}
7039
7040#[must_use = "FIDL methods require a response to be sent"]
7041#[derive(Debug)]
7042pub struct ScreenCaptureConfigureResponder {
7043    control_handle: std::mem::ManuallyDrop<ScreenCaptureControlHandle>,
7044    tx_id: u32,
7045}
7046
7047/// Set the the channel to be shutdown (see [`ScreenCaptureControlHandle::shutdown`])
7048/// if the responder is dropped without sending a response, so that the client
7049/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7050impl std::ops::Drop for ScreenCaptureConfigureResponder {
7051    fn drop(&mut self) {
7052        self.control_handle.shutdown();
7053        // Safety: drops once, never accessed again
7054        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7055    }
7056}
7057
7058impl fidl::endpoints::Responder for ScreenCaptureConfigureResponder {
7059    type ControlHandle = ScreenCaptureControlHandle;
7060
7061    fn control_handle(&self) -> &ScreenCaptureControlHandle {
7062        &self.control_handle
7063    }
7064
7065    fn drop_without_shutdown(mut self) {
7066        // Safety: drops once, never accessed again due to mem::forget
7067        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7068        // Prevent Drop from running (which would shut down the channel)
7069        std::mem::forget(self);
7070    }
7071}
7072
7073impl ScreenCaptureConfigureResponder {
7074    /// Sends a response to the FIDL transaction.
7075    ///
7076    /// Sets the channel to shutdown if an error occurs.
7077    pub fn send(self, mut result: Result<(), ScreenCaptureError>) -> Result<(), fidl::Error> {
7078        let _result = self.send_raw(result);
7079        if _result.is_err() {
7080            self.control_handle.shutdown();
7081        }
7082        self.drop_without_shutdown();
7083        _result
7084    }
7085
7086    /// Similar to "send" but does not shutdown the channel if an error occurs.
7087    pub fn send_no_shutdown_on_err(
7088        self,
7089        mut result: Result<(), ScreenCaptureError>,
7090    ) -> Result<(), fidl::Error> {
7091        let _result = self.send_raw(result);
7092        self.drop_without_shutdown();
7093        _result
7094    }
7095
7096    fn send_raw(&self, mut result: Result<(), ScreenCaptureError>) -> Result<(), fidl::Error> {
7097        self.control_handle.inner.send::<fidl::encoding::ResultType<
7098            fidl::encoding::EmptyStruct,
7099            ScreenCaptureError,
7100        >>(
7101            result,
7102            self.tx_id,
7103            0x3b6e5af1d294afd9,
7104            fidl::encoding::DynamicFlags::empty(),
7105        )
7106    }
7107}
7108
7109#[must_use = "FIDL methods require a response to be sent"]
7110#[derive(Debug)]
7111pub struct ScreenCaptureGetNextFrameResponder {
7112    control_handle: std::mem::ManuallyDrop<ScreenCaptureControlHandle>,
7113    tx_id: u32,
7114}
7115
7116/// Set the the channel to be shutdown (see [`ScreenCaptureControlHandle::shutdown`])
7117/// if the responder is dropped without sending a response, so that the client
7118/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7119impl std::ops::Drop for ScreenCaptureGetNextFrameResponder {
7120    fn drop(&mut self) {
7121        self.control_handle.shutdown();
7122        // Safety: drops once, never accessed again
7123        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7124    }
7125}
7126
7127impl fidl::endpoints::Responder for ScreenCaptureGetNextFrameResponder {
7128    type ControlHandle = ScreenCaptureControlHandle;
7129
7130    fn control_handle(&self) -> &ScreenCaptureControlHandle {
7131        &self.control_handle
7132    }
7133
7134    fn drop_without_shutdown(mut self) {
7135        // Safety: drops once, never accessed again due to mem::forget
7136        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7137        // Prevent Drop from running (which would shut down the channel)
7138        std::mem::forget(self);
7139    }
7140}
7141
7142impl ScreenCaptureGetNextFrameResponder {
7143    /// Sends a response to the FIDL transaction.
7144    ///
7145    /// Sets the channel to shutdown if an error occurs.
7146    pub fn send(
7147        self,
7148        mut result: Result<FrameInfo, ScreenCaptureError>,
7149    ) -> Result<(), fidl::Error> {
7150        let _result = self.send_raw(result);
7151        if _result.is_err() {
7152            self.control_handle.shutdown();
7153        }
7154        self.drop_without_shutdown();
7155        _result
7156    }
7157
7158    /// Similar to "send" but does not shutdown the channel if an error occurs.
7159    pub fn send_no_shutdown_on_err(
7160        self,
7161        mut result: Result<FrameInfo, ScreenCaptureError>,
7162    ) -> Result<(), fidl::Error> {
7163        let _result = self.send_raw(result);
7164        self.drop_without_shutdown();
7165        _result
7166    }
7167
7168    fn send_raw(
7169        &self,
7170        mut result: Result<FrameInfo, ScreenCaptureError>,
7171    ) -> Result<(), fidl::Error> {
7172        self.control_handle.inner.send::<fidl::encoding::ResultType<FrameInfo, ScreenCaptureError>>(
7173            result.as_mut().map_err(|e| *e),
7174            self.tx_id,
7175            0x552c1580aab8c4a7,
7176            fidl::encoding::DynamicFlags::empty(),
7177        )
7178    }
7179}
7180
7181#[must_use = "FIDL methods require a response to be sent"]
7182#[derive(Debug)]
7183pub struct ScreenCaptureReleaseFrameResponder {
7184    control_handle: std::mem::ManuallyDrop<ScreenCaptureControlHandle>,
7185    tx_id: u32,
7186}
7187
7188/// Set the the channel to be shutdown (see [`ScreenCaptureControlHandle::shutdown`])
7189/// if the responder is dropped without sending a response, so that the client
7190/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7191impl std::ops::Drop for ScreenCaptureReleaseFrameResponder {
7192    fn drop(&mut self) {
7193        self.control_handle.shutdown();
7194        // Safety: drops once, never accessed again
7195        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7196    }
7197}
7198
7199impl fidl::endpoints::Responder for ScreenCaptureReleaseFrameResponder {
7200    type ControlHandle = ScreenCaptureControlHandle;
7201
7202    fn control_handle(&self) -> &ScreenCaptureControlHandle {
7203        &self.control_handle
7204    }
7205
7206    fn drop_without_shutdown(mut self) {
7207        // Safety: drops once, never accessed again due to mem::forget
7208        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7209        // Prevent Drop from running (which would shut down the channel)
7210        std::mem::forget(self);
7211    }
7212}
7213
7214impl ScreenCaptureReleaseFrameResponder {
7215    /// Sends a response to the FIDL transaction.
7216    ///
7217    /// Sets the channel to shutdown if an error occurs.
7218    pub fn send(self, mut result: Result<(), ScreenCaptureError>) -> Result<(), fidl::Error> {
7219        let _result = self.send_raw(result);
7220        if _result.is_err() {
7221            self.control_handle.shutdown();
7222        }
7223        self.drop_without_shutdown();
7224        _result
7225    }
7226
7227    /// Similar to "send" but does not shutdown the channel if an error occurs.
7228    pub fn send_no_shutdown_on_err(
7229        self,
7230        mut result: Result<(), ScreenCaptureError>,
7231    ) -> Result<(), fidl::Error> {
7232        let _result = self.send_raw(result);
7233        self.drop_without_shutdown();
7234        _result
7235    }
7236
7237    fn send_raw(&self, mut result: Result<(), ScreenCaptureError>) -> Result<(), fidl::Error> {
7238        self.control_handle.inner.send::<fidl::encoding::ResultType<
7239            fidl::encoding::EmptyStruct,
7240            ScreenCaptureError,
7241        >>(
7242            result,
7243            self.tx_id,
7244            0x46704dce24e35950,
7245            fidl::encoding::DynamicFlags::empty(),
7246        )
7247    }
7248}
7249
7250#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
7251pub struct ScreenshotMarker;
7252
7253impl fidl::endpoints::ProtocolMarker for ScreenshotMarker {
7254    type Proxy = ScreenshotProxy;
7255    type RequestStream = ScreenshotRequestStream;
7256    #[cfg(target_os = "fuchsia")]
7257    type SynchronousProxy = ScreenshotSynchronousProxy;
7258
7259    const DEBUG_NAME: &'static str = "fuchsia.ui.composition.Screenshot";
7260}
7261impl fidl::endpoints::DiscoverableProtocolMarker for ScreenshotMarker {}
7262
7263pub trait ScreenshotProxyInterface: Send + Sync {
7264    type TakeResponseFut: std::future::Future<Output = Result<ScreenshotTakeResponse, fidl::Error>>
7265        + Send;
7266    fn r#take(&self, payload: ScreenshotTakeRequest) -> Self::TakeResponseFut;
7267    type TakeFileResponseFut: std::future::Future<Output = Result<ScreenshotTakeFileResponse, fidl::Error>>
7268        + Send;
7269    fn r#take_file(&self, payload: ScreenshotTakeFileRequest) -> Self::TakeFileResponseFut;
7270}
7271#[derive(Debug)]
7272#[cfg(target_os = "fuchsia")]
7273pub struct ScreenshotSynchronousProxy {
7274    client: fidl::client::sync::Client,
7275}
7276
7277#[cfg(target_os = "fuchsia")]
7278impl fidl::endpoints::SynchronousProxy for ScreenshotSynchronousProxy {
7279    type Proxy = ScreenshotProxy;
7280    type Protocol = ScreenshotMarker;
7281
7282    fn from_channel(inner: fidl::Channel) -> Self {
7283        Self::new(inner)
7284    }
7285
7286    fn into_channel(self) -> fidl::Channel {
7287        self.client.into_channel()
7288    }
7289
7290    fn as_channel(&self) -> &fidl::Channel {
7291        self.client.as_channel()
7292    }
7293}
7294
7295#[cfg(target_os = "fuchsia")]
7296impl ScreenshotSynchronousProxy {
7297    pub fn new(channel: fidl::Channel) -> Self {
7298        let protocol_name = <ScreenshotMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
7299        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
7300    }
7301
7302    pub fn into_channel(self) -> fidl::Channel {
7303        self.client.into_channel()
7304    }
7305
7306    /// Waits until an event arrives and returns it. It is safe for other
7307    /// threads to make concurrent requests while waiting for an event.
7308    pub fn wait_for_event(
7309        &self,
7310        deadline: zx::MonotonicInstant,
7311    ) -> Result<ScreenshotEvent, fidl::Error> {
7312        ScreenshotEvent::decode(self.client.wait_for_event(deadline)?)
7313    }
7314
7315    /// Collects the current graphical content of a display in a specified buffer `format` in the
7316    /// sRGB color space. Note that the sRGB color space is non-linear, meaning that unit tests
7317    /// doing pixel equality checks making use of non-fully saturated colors should convert to a
7318    /// linear color space.
7319    ///
7320    /// See https://fuchsia.dev/fuchsia-src/concepts/ui/scenic/color_spaces for more information.
7321    ///
7322    /// Screenshot is taken immediately, populated with the display's content from the most recent
7323    /// VSYNC.
7324    ///
7325    /// If the client calls [`Take`] a second time before a first [`Take`] call returns, the server
7326    /// will close the Screenshot connection with a ZX_ERR_SHOULD_WAIT epitaph.
7327    ///
7328    /// If capture fails due to an internal error, the server will close the Screenshot connection
7329    /// with a ZX_ERR_INTERNAL epitaph.
7330    pub fn r#take(
7331        &self,
7332        mut payload: ScreenshotTakeRequest,
7333        ___deadline: zx::MonotonicInstant,
7334    ) -> Result<ScreenshotTakeResponse, fidl::Error> {
7335        let _response = self.client.send_query::<ScreenshotTakeRequest, ScreenshotTakeResponse>(
7336            &mut payload,
7337            0x51341396e9fd2fd0,
7338            fidl::encoding::DynamicFlags::empty(),
7339            ___deadline,
7340        )?;
7341        Ok(_response)
7342    }
7343
7344    /// Collects the current graphical content of a display in a specified buffer `format` in the
7345    /// sRGB color space. Note that the sRGB color space is non-linear, meaning that unit tests
7346    /// doing pixel equality checks making use of non-fully saturated colors should convert to a
7347    /// linear color space.
7348    ///
7349    /// TODO(https://fxbug.dev/42065844): Link to fuchsia.dev documentation when it's up.
7350    ///
7351    /// Screenshot is taken immediately, populated with the display's content from the most recent
7352    /// VSYNC.
7353    ///
7354    /// If the client calls [`TakeFile`] a second time before a first [`TakeFile`] call returns,
7355    /// the server will close the Screenshot connection with a ZX_ERR_SHOULD_WAIT epitaph.
7356    ///
7357    /// If capture fails due to an internal error, the server will close the Screenshot connection
7358    /// with a ZX_ERR_INTERNAL epitaph.
7359    ///
7360    /// This call should be used if the client is on the host and does not support VMOs,
7361    /// as is the case for ffx tools.
7362    pub fn r#take_file(
7363        &self,
7364        mut payload: ScreenshotTakeFileRequest,
7365        ___deadline: zx::MonotonicInstant,
7366    ) -> Result<ScreenshotTakeFileResponse, fidl::Error> {
7367        let _response =
7368            self.client.send_query::<ScreenshotTakeFileRequest, ScreenshotTakeFileResponse>(
7369                &mut payload,
7370                0x470aeea0a4d32903,
7371                fidl::encoding::DynamicFlags::empty(),
7372                ___deadline,
7373            )?;
7374        Ok(_response)
7375    }
7376}
7377
7378#[cfg(target_os = "fuchsia")]
7379impl From<ScreenshotSynchronousProxy> for zx::Handle {
7380    fn from(value: ScreenshotSynchronousProxy) -> Self {
7381        value.into_channel().into()
7382    }
7383}
7384
7385#[cfg(target_os = "fuchsia")]
7386impl From<fidl::Channel> for ScreenshotSynchronousProxy {
7387    fn from(value: fidl::Channel) -> Self {
7388        Self::new(value)
7389    }
7390}
7391
7392#[derive(Debug, Clone)]
7393pub struct ScreenshotProxy {
7394    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
7395}
7396
7397impl fidl::endpoints::Proxy for ScreenshotProxy {
7398    type Protocol = ScreenshotMarker;
7399
7400    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
7401        Self::new(inner)
7402    }
7403
7404    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
7405        self.client.into_channel().map_err(|client| Self { client })
7406    }
7407
7408    fn as_channel(&self) -> &::fidl::AsyncChannel {
7409        self.client.as_channel()
7410    }
7411}
7412
7413impl ScreenshotProxy {
7414    /// Create a new Proxy for fuchsia.ui.composition/Screenshot.
7415    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
7416        let protocol_name = <ScreenshotMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
7417        Self { client: fidl::client::Client::new(channel, protocol_name) }
7418    }
7419
7420    /// Get a Stream of events from the remote end of the protocol.
7421    ///
7422    /// # Panics
7423    ///
7424    /// Panics if the event stream was already taken.
7425    pub fn take_event_stream(&self) -> ScreenshotEventStream {
7426        ScreenshotEventStream { event_receiver: self.client.take_event_receiver() }
7427    }
7428
7429    /// Collects the current graphical content of a display in a specified buffer `format` in the
7430    /// sRGB color space. Note that the sRGB color space is non-linear, meaning that unit tests
7431    /// doing pixel equality checks making use of non-fully saturated colors should convert to a
7432    /// linear color space.
7433    ///
7434    /// See https://fuchsia.dev/fuchsia-src/concepts/ui/scenic/color_spaces for more information.
7435    ///
7436    /// Screenshot is taken immediately, populated with the display's content from the most recent
7437    /// VSYNC.
7438    ///
7439    /// If the client calls [`Take`] a second time before a first [`Take`] call returns, the server
7440    /// will close the Screenshot connection with a ZX_ERR_SHOULD_WAIT epitaph.
7441    ///
7442    /// If capture fails due to an internal error, the server will close the Screenshot connection
7443    /// with a ZX_ERR_INTERNAL epitaph.
7444    pub fn r#take(
7445        &self,
7446        mut payload: ScreenshotTakeRequest,
7447    ) -> fidl::client::QueryResponseFut<
7448        ScreenshotTakeResponse,
7449        fidl::encoding::DefaultFuchsiaResourceDialect,
7450    > {
7451        ScreenshotProxyInterface::r#take(self, payload)
7452    }
7453
7454    /// Collects the current graphical content of a display in a specified buffer `format` in the
7455    /// sRGB color space. Note that the sRGB color space is non-linear, meaning that unit tests
7456    /// doing pixel equality checks making use of non-fully saturated colors should convert to a
7457    /// linear color space.
7458    ///
7459    /// TODO(https://fxbug.dev/42065844): Link to fuchsia.dev documentation when it's up.
7460    ///
7461    /// Screenshot is taken immediately, populated with the display's content from the most recent
7462    /// VSYNC.
7463    ///
7464    /// If the client calls [`TakeFile`] a second time before a first [`TakeFile`] call returns,
7465    /// the server will close the Screenshot connection with a ZX_ERR_SHOULD_WAIT epitaph.
7466    ///
7467    /// If capture fails due to an internal error, the server will close the Screenshot connection
7468    /// with a ZX_ERR_INTERNAL epitaph.
7469    ///
7470    /// This call should be used if the client is on the host and does not support VMOs,
7471    /// as is the case for ffx tools.
7472    pub fn r#take_file(
7473        &self,
7474        mut payload: ScreenshotTakeFileRequest,
7475    ) -> fidl::client::QueryResponseFut<
7476        ScreenshotTakeFileResponse,
7477        fidl::encoding::DefaultFuchsiaResourceDialect,
7478    > {
7479        ScreenshotProxyInterface::r#take_file(self, payload)
7480    }
7481}
7482
7483impl ScreenshotProxyInterface for ScreenshotProxy {
7484    type TakeResponseFut = fidl::client::QueryResponseFut<
7485        ScreenshotTakeResponse,
7486        fidl::encoding::DefaultFuchsiaResourceDialect,
7487    >;
7488    fn r#take(&self, mut payload: ScreenshotTakeRequest) -> Self::TakeResponseFut {
7489        fn _decode(
7490            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7491        ) -> Result<ScreenshotTakeResponse, fidl::Error> {
7492            let _response = fidl::client::decode_transaction_body::<
7493                ScreenshotTakeResponse,
7494                fidl::encoding::DefaultFuchsiaResourceDialect,
7495                0x51341396e9fd2fd0,
7496            >(_buf?)?;
7497            Ok(_response)
7498        }
7499        self.client.send_query_and_decode::<ScreenshotTakeRequest, ScreenshotTakeResponse>(
7500            &mut payload,
7501            0x51341396e9fd2fd0,
7502            fidl::encoding::DynamicFlags::empty(),
7503            _decode,
7504        )
7505    }
7506
7507    type TakeFileResponseFut = fidl::client::QueryResponseFut<
7508        ScreenshotTakeFileResponse,
7509        fidl::encoding::DefaultFuchsiaResourceDialect,
7510    >;
7511    fn r#take_file(&self, mut payload: ScreenshotTakeFileRequest) -> Self::TakeFileResponseFut {
7512        fn _decode(
7513            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7514        ) -> Result<ScreenshotTakeFileResponse, fidl::Error> {
7515            let _response = fidl::client::decode_transaction_body::<
7516                ScreenshotTakeFileResponse,
7517                fidl::encoding::DefaultFuchsiaResourceDialect,
7518                0x470aeea0a4d32903,
7519            >(_buf?)?;
7520            Ok(_response)
7521        }
7522        self.client.send_query_and_decode::<ScreenshotTakeFileRequest, ScreenshotTakeFileResponse>(
7523            &mut payload,
7524            0x470aeea0a4d32903,
7525            fidl::encoding::DynamicFlags::empty(),
7526            _decode,
7527        )
7528    }
7529}
7530
7531pub struct ScreenshotEventStream {
7532    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
7533}
7534
7535impl std::marker::Unpin for ScreenshotEventStream {}
7536
7537impl futures::stream::FusedStream for ScreenshotEventStream {
7538    fn is_terminated(&self) -> bool {
7539        self.event_receiver.is_terminated()
7540    }
7541}
7542
7543impl futures::Stream for ScreenshotEventStream {
7544    type Item = Result<ScreenshotEvent, fidl::Error>;
7545
7546    fn poll_next(
7547        mut self: std::pin::Pin<&mut Self>,
7548        cx: &mut std::task::Context<'_>,
7549    ) -> std::task::Poll<Option<Self::Item>> {
7550        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
7551            &mut self.event_receiver,
7552            cx
7553        )?) {
7554            Some(buf) => std::task::Poll::Ready(Some(ScreenshotEvent::decode(buf))),
7555            None => std::task::Poll::Ready(None),
7556        }
7557    }
7558}
7559
7560#[derive(Debug)]
7561pub enum ScreenshotEvent {}
7562
7563impl ScreenshotEvent {
7564    /// Decodes a message buffer as a [`ScreenshotEvent`].
7565    fn decode(
7566        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
7567    ) -> Result<ScreenshotEvent, fidl::Error> {
7568        let (bytes, _handles) = buf.split_mut();
7569        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7570        debug_assert_eq!(tx_header.tx_id, 0);
7571        match tx_header.ordinal {
7572            _ => Err(fidl::Error::UnknownOrdinal {
7573                ordinal: tx_header.ordinal,
7574                protocol_name: <ScreenshotMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
7575            }),
7576        }
7577    }
7578}
7579
7580/// A Stream of incoming requests for fuchsia.ui.composition/Screenshot.
7581pub struct ScreenshotRequestStream {
7582    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7583    is_terminated: bool,
7584}
7585
7586impl std::marker::Unpin for ScreenshotRequestStream {}
7587
7588impl futures::stream::FusedStream for ScreenshotRequestStream {
7589    fn is_terminated(&self) -> bool {
7590        self.is_terminated
7591    }
7592}
7593
7594impl fidl::endpoints::RequestStream for ScreenshotRequestStream {
7595    type Protocol = ScreenshotMarker;
7596    type ControlHandle = ScreenshotControlHandle;
7597
7598    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
7599        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
7600    }
7601
7602    fn control_handle(&self) -> Self::ControlHandle {
7603        ScreenshotControlHandle { inner: self.inner.clone() }
7604    }
7605
7606    fn into_inner(
7607        self,
7608    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
7609    {
7610        (self.inner, self.is_terminated)
7611    }
7612
7613    fn from_inner(
7614        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7615        is_terminated: bool,
7616    ) -> Self {
7617        Self { inner, is_terminated }
7618    }
7619}
7620
7621impl futures::Stream for ScreenshotRequestStream {
7622    type Item = Result<ScreenshotRequest, fidl::Error>;
7623
7624    fn poll_next(
7625        mut self: std::pin::Pin<&mut Self>,
7626        cx: &mut std::task::Context<'_>,
7627    ) -> std::task::Poll<Option<Self::Item>> {
7628        let this = &mut *self;
7629        if this.inner.check_shutdown(cx) {
7630            this.is_terminated = true;
7631            return std::task::Poll::Ready(None);
7632        }
7633        if this.is_terminated {
7634            panic!("polled ScreenshotRequestStream after completion");
7635        }
7636        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
7637            |bytes, handles| {
7638                match this.inner.channel().read_etc(cx, bytes, handles) {
7639                    std::task::Poll::Ready(Ok(())) => {}
7640                    std::task::Poll::Pending => return std::task::Poll::Pending,
7641                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
7642                        this.is_terminated = true;
7643                        return std::task::Poll::Ready(None);
7644                    }
7645                    std::task::Poll::Ready(Err(e)) => {
7646                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
7647                            e.into(),
7648                        ))))
7649                    }
7650                }
7651
7652                // A message has been received from the channel
7653                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7654
7655                std::task::Poll::Ready(Some(match header.ordinal {
7656                    0x51341396e9fd2fd0 => {
7657                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7658                        let mut req = fidl::new_empty!(
7659                            ScreenshotTakeRequest,
7660                            fidl::encoding::DefaultFuchsiaResourceDialect
7661                        );
7662                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ScreenshotTakeRequest>(&header, _body_bytes, handles, &mut req)?;
7663                        let control_handle = ScreenshotControlHandle { inner: this.inner.clone() };
7664                        Ok(ScreenshotRequest::Take {
7665                            payload: req,
7666                            responder: ScreenshotTakeResponder {
7667                                control_handle: std::mem::ManuallyDrop::new(control_handle),
7668                                tx_id: header.tx_id,
7669                            },
7670                        })
7671                    }
7672                    0x470aeea0a4d32903 => {
7673                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7674                        let mut req = fidl::new_empty!(
7675                            ScreenshotTakeFileRequest,
7676                            fidl::encoding::DefaultFuchsiaResourceDialect
7677                        );
7678                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ScreenshotTakeFileRequest>(&header, _body_bytes, handles, &mut req)?;
7679                        let control_handle = ScreenshotControlHandle { inner: this.inner.clone() };
7680                        Ok(ScreenshotRequest::TakeFile {
7681                            payload: req,
7682                            responder: ScreenshotTakeFileResponder {
7683                                control_handle: std::mem::ManuallyDrop::new(control_handle),
7684                                tx_id: header.tx_id,
7685                            },
7686                        })
7687                    }
7688                    _ => Err(fidl::Error::UnknownOrdinal {
7689                        ordinal: header.ordinal,
7690                        protocol_name:
7691                            <ScreenshotMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
7692                    }),
7693                }))
7694            },
7695        )
7696    }
7697}
7698
7699/// Collects the current graphical content of a display.
7700#[derive(Debug)]
7701pub enum ScreenshotRequest {
7702    /// Collects the current graphical content of a display in a specified buffer `format` in the
7703    /// sRGB color space. Note that the sRGB color space is non-linear, meaning that unit tests
7704    /// doing pixel equality checks making use of non-fully saturated colors should convert to a
7705    /// linear color space.
7706    ///
7707    /// See https://fuchsia.dev/fuchsia-src/concepts/ui/scenic/color_spaces for more information.
7708    ///
7709    /// Screenshot is taken immediately, populated with the display's content from the most recent
7710    /// VSYNC.
7711    ///
7712    /// If the client calls [`Take`] a second time before a first [`Take`] call returns, the server
7713    /// will close the Screenshot connection with a ZX_ERR_SHOULD_WAIT epitaph.
7714    ///
7715    /// If capture fails due to an internal error, the server will close the Screenshot connection
7716    /// with a ZX_ERR_INTERNAL epitaph.
7717    Take { payload: ScreenshotTakeRequest, responder: ScreenshotTakeResponder },
7718    /// Collects the current graphical content of a display in a specified buffer `format` in the
7719    /// sRGB color space. Note that the sRGB color space is non-linear, meaning that unit tests
7720    /// doing pixel equality checks making use of non-fully saturated colors should convert to a
7721    /// linear color space.
7722    ///
7723    /// TODO(https://fxbug.dev/42065844): Link to fuchsia.dev documentation when it's up.
7724    ///
7725    /// Screenshot is taken immediately, populated with the display's content from the most recent
7726    /// VSYNC.
7727    ///
7728    /// If the client calls [`TakeFile`] a second time before a first [`TakeFile`] call returns,
7729    /// the server will close the Screenshot connection with a ZX_ERR_SHOULD_WAIT epitaph.
7730    ///
7731    /// If capture fails due to an internal error, the server will close the Screenshot connection
7732    /// with a ZX_ERR_INTERNAL epitaph.
7733    ///
7734    /// This call should be used if the client is on the host and does not support VMOs,
7735    /// as is the case for ffx tools.
7736    TakeFile { payload: ScreenshotTakeFileRequest, responder: ScreenshotTakeFileResponder },
7737}
7738
7739impl ScreenshotRequest {
7740    #[allow(irrefutable_let_patterns)]
7741    pub fn into_take(self) -> Option<(ScreenshotTakeRequest, ScreenshotTakeResponder)> {
7742        if let ScreenshotRequest::Take { payload, responder } = self {
7743            Some((payload, responder))
7744        } else {
7745            None
7746        }
7747    }
7748
7749    #[allow(irrefutable_let_patterns)]
7750    pub fn into_take_file(
7751        self,
7752    ) -> Option<(ScreenshotTakeFileRequest, ScreenshotTakeFileResponder)> {
7753        if let ScreenshotRequest::TakeFile { payload, responder } = self {
7754            Some((payload, responder))
7755        } else {
7756            None
7757        }
7758    }
7759
7760    /// Name of the method defined in FIDL
7761    pub fn method_name(&self) -> &'static str {
7762        match *self {
7763            ScreenshotRequest::Take { .. } => "take",
7764            ScreenshotRequest::TakeFile { .. } => "take_file",
7765        }
7766    }
7767}
7768
7769#[derive(Debug, Clone)]
7770pub struct ScreenshotControlHandle {
7771    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7772}
7773
7774impl fidl::endpoints::ControlHandle for ScreenshotControlHandle {
7775    fn shutdown(&self) {
7776        self.inner.shutdown()
7777    }
7778    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
7779        self.inner.shutdown_with_epitaph(status)
7780    }
7781
7782    fn is_closed(&self) -> bool {
7783        self.inner.channel().is_closed()
7784    }
7785    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
7786        self.inner.channel().on_closed()
7787    }
7788
7789    #[cfg(target_os = "fuchsia")]
7790    fn signal_peer(
7791        &self,
7792        clear_mask: zx::Signals,
7793        set_mask: zx::Signals,
7794    ) -> Result<(), zx_status::Status> {
7795        use fidl::Peered;
7796        self.inner.channel().signal_peer(clear_mask, set_mask)
7797    }
7798}
7799
7800impl ScreenshotControlHandle {}
7801
7802#[must_use = "FIDL methods require a response to be sent"]
7803#[derive(Debug)]
7804pub struct ScreenshotTakeResponder {
7805    control_handle: std::mem::ManuallyDrop<ScreenshotControlHandle>,
7806    tx_id: u32,
7807}
7808
7809/// Set the the channel to be shutdown (see [`ScreenshotControlHandle::shutdown`])
7810/// if the responder is dropped without sending a response, so that the client
7811/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7812impl std::ops::Drop for ScreenshotTakeResponder {
7813    fn drop(&mut self) {
7814        self.control_handle.shutdown();
7815        // Safety: drops once, never accessed again
7816        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7817    }
7818}
7819
7820impl fidl::endpoints::Responder for ScreenshotTakeResponder {
7821    type ControlHandle = ScreenshotControlHandle;
7822
7823    fn control_handle(&self) -> &ScreenshotControlHandle {
7824        &self.control_handle
7825    }
7826
7827    fn drop_without_shutdown(mut self) {
7828        // Safety: drops once, never accessed again due to mem::forget
7829        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7830        // Prevent Drop from running (which would shut down the channel)
7831        std::mem::forget(self);
7832    }
7833}
7834
7835impl ScreenshotTakeResponder {
7836    /// Sends a response to the FIDL transaction.
7837    ///
7838    /// Sets the channel to shutdown if an error occurs.
7839    pub fn send(self, mut payload: ScreenshotTakeResponse) -> Result<(), fidl::Error> {
7840        let _result = self.send_raw(payload);
7841        if _result.is_err() {
7842            self.control_handle.shutdown();
7843        }
7844        self.drop_without_shutdown();
7845        _result
7846    }
7847
7848    /// Similar to "send" but does not shutdown the channel if an error occurs.
7849    pub fn send_no_shutdown_on_err(
7850        self,
7851        mut payload: ScreenshotTakeResponse,
7852    ) -> Result<(), fidl::Error> {
7853        let _result = self.send_raw(payload);
7854        self.drop_without_shutdown();
7855        _result
7856    }
7857
7858    fn send_raw(&self, mut payload: ScreenshotTakeResponse) -> Result<(), fidl::Error> {
7859        self.control_handle.inner.send::<ScreenshotTakeResponse>(
7860            &mut payload,
7861            self.tx_id,
7862            0x51341396e9fd2fd0,
7863            fidl::encoding::DynamicFlags::empty(),
7864        )
7865    }
7866}
7867
7868#[must_use = "FIDL methods require a response to be sent"]
7869#[derive(Debug)]
7870pub struct ScreenshotTakeFileResponder {
7871    control_handle: std::mem::ManuallyDrop<ScreenshotControlHandle>,
7872    tx_id: u32,
7873}
7874
7875/// Set the the channel to be shutdown (see [`ScreenshotControlHandle::shutdown`])
7876/// if the responder is dropped without sending a response, so that the client
7877/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7878impl std::ops::Drop for ScreenshotTakeFileResponder {
7879    fn drop(&mut self) {
7880        self.control_handle.shutdown();
7881        // Safety: drops once, never accessed again
7882        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7883    }
7884}
7885
7886impl fidl::endpoints::Responder for ScreenshotTakeFileResponder {
7887    type ControlHandle = ScreenshotControlHandle;
7888
7889    fn control_handle(&self) -> &ScreenshotControlHandle {
7890        &self.control_handle
7891    }
7892
7893    fn drop_without_shutdown(mut self) {
7894        // Safety: drops once, never accessed again due to mem::forget
7895        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7896        // Prevent Drop from running (which would shut down the channel)
7897        std::mem::forget(self);
7898    }
7899}
7900
7901impl ScreenshotTakeFileResponder {
7902    /// Sends a response to the FIDL transaction.
7903    ///
7904    /// Sets the channel to shutdown if an error occurs.
7905    pub fn send(self, mut payload: ScreenshotTakeFileResponse) -> Result<(), fidl::Error> {
7906        let _result = self.send_raw(payload);
7907        if _result.is_err() {
7908            self.control_handle.shutdown();
7909        }
7910        self.drop_without_shutdown();
7911        _result
7912    }
7913
7914    /// Similar to "send" but does not shutdown the channel if an error occurs.
7915    pub fn send_no_shutdown_on_err(
7916        self,
7917        mut payload: ScreenshotTakeFileResponse,
7918    ) -> Result<(), fidl::Error> {
7919        let _result = self.send_raw(payload);
7920        self.drop_without_shutdown();
7921        _result
7922    }
7923
7924    fn send_raw(&self, mut payload: ScreenshotTakeFileResponse) -> Result<(), fidl::Error> {
7925        self.control_handle.inner.send::<ScreenshotTakeFileResponse>(
7926            &mut payload,
7927            self.tx_id,
7928            0x470aeea0a4d32903,
7929            fidl::encoding::DynamicFlags::empty(),
7930        )
7931    }
7932}
7933
7934mod internal {
7935    use super::*;
7936
7937    impl fidl::encoding::ResourceTypeMarker for AllocatorRegisterBufferCollectionRequest {
7938        type Borrowed<'a> = &'a mut Self;
7939        fn take_or_borrow<'a>(
7940            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
7941        ) -> Self::Borrowed<'a> {
7942            value
7943        }
7944    }
7945
7946    unsafe impl fidl::encoding::TypeMarker for AllocatorRegisterBufferCollectionRequest {
7947        type Owned = Self;
7948
7949        #[inline(always)]
7950        fn inline_align(_context: fidl::encoding::Context) -> usize {
7951            8
7952        }
7953
7954        #[inline(always)]
7955        fn inline_size(_context: fidl::encoding::Context) -> usize {
7956            16
7957        }
7958    }
7959
7960    unsafe impl
7961        fidl::encoding::Encode<
7962            AllocatorRegisterBufferCollectionRequest,
7963            fidl::encoding::DefaultFuchsiaResourceDialect,
7964        > for &mut AllocatorRegisterBufferCollectionRequest
7965    {
7966        #[inline]
7967        unsafe fn encode(
7968            self,
7969            encoder: &mut fidl::encoding::Encoder<
7970                '_,
7971                fidl::encoding::DefaultFuchsiaResourceDialect,
7972            >,
7973            offset: usize,
7974            _depth: fidl::encoding::Depth,
7975        ) -> fidl::Result<()> {
7976            encoder.debug_check_bounds::<AllocatorRegisterBufferCollectionRequest>(offset);
7977            // Delegate to tuple encoding.
7978            fidl::encoding::Encode::<AllocatorRegisterBufferCollectionRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
7979                (
7980                    <RegisterBufferCollectionArgs as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.args),
7981                ),
7982                encoder, offset, _depth
7983            )
7984        }
7985    }
7986    unsafe impl<
7987            T0: fidl::encoding::Encode<
7988                RegisterBufferCollectionArgs,
7989                fidl::encoding::DefaultFuchsiaResourceDialect,
7990            >,
7991        >
7992        fidl::encoding::Encode<
7993            AllocatorRegisterBufferCollectionRequest,
7994            fidl::encoding::DefaultFuchsiaResourceDialect,
7995        > for (T0,)
7996    {
7997        #[inline]
7998        unsafe fn encode(
7999            self,
8000            encoder: &mut fidl::encoding::Encoder<
8001                '_,
8002                fidl::encoding::DefaultFuchsiaResourceDialect,
8003            >,
8004            offset: usize,
8005            depth: fidl::encoding::Depth,
8006        ) -> fidl::Result<()> {
8007            encoder.debug_check_bounds::<AllocatorRegisterBufferCollectionRequest>(offset);
8008            // Zero out padding regions. There's no need to apply masks
8009            // because the unmasked parts will be overwritten by fields.
8010            // Write the fields.
8011            self.0.encode(encoder, offset + 0, depth)?;
8012            Ok(())
8013        }
8014    }
8015
8016    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
8017        for AllocatorRegisterBufferCollectionRequest
8018    {
8019        #[inline(always)]
8020        fn new_empty() -> Self {
8021            Self {
8022                args: fidl::new_empty!(
8023                    RegisterBufferCollectionArgs,
8024                    fidl::encoding::DefaultFuchsiaResourceDialect
8025                ),
8026            }
8027        }
8028
8029        #[inline]
8030        unsafe fn decode(
8031            &mut self,
8032            decoder: &mut fidl::encoding::Decoder<
8033                '_,
8034                fidl::encoding::DefaultFuchsiaResourceDialect,
8035            >,
8036            offset: usize,
8037            _depth: fidl::encoding::Depth,
8038        ) -> fidl::Result<()> {
8039            decoder.debug_check_bounds::<Self>(offset);
8040            // Verify that padding bytes are zero.
8041            fidl::decode!(
8042                RegisterBufferCollectionArgs,
8043                fidl::encoding::DefaultFuchsiaResourceDialect,
8044                &mut self.args,
8045                decoder,
8046                offset + 0,
8047                _depth
8048            )?;
8049            Ok(())
8050        }
8051    }
8052
8053    impl fidl::encoding::ResourceTypeMarker for BufferCollectionExportToken {
8054        type Borrowed<'a> = &'a mut Self;
8055        fn take_or_borrow<'a>(
8056            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
8057        ) -> Self::Borrowed<'a> {
8058            value
8059        }
8060    }
8061
8062    unsafe impl fidl::encoding::TypeMarker for BufferCollectionExportToken {
8063        type Owned = Self;
8064
8065        #[inline(always)]
8066        fn inline_align(_context: fidl::encoding::Context) -> usize {
8067            4
8068        }
8069
8070        #[inline(always)]
8071        fn inline_size(_context: fidl::encoding::Context) -> usize {
8072            4
8073        }
8074    }
8075
8076    unsafe impl
8077        fidl::encoding::Encode<
8078            BufferCollectionExportToken,
8079            fidl::encoding::DefaultFuchsiaResourceDialect,
8080        > for &mut BufferCollectionExportToken
8081    {
8082        #[inline]
8083        unsafe fn encode(
8084            self,
8085            encoder: &mut fidl::encoding::Encoder<
8086                '_,
8087                fidl::encoding::DefaultFuchsiaResourceDialect,
8088            >,
8089            offset: usize,
8090            _depth: fidl::encoding::Depth,
8091        ) -> fidl::Result<()> {
8092            encoder.debug_check_bounds::<BufferCollectionExportToken>(offset);
8093            // Delegate to tuple encoding.
8094            fidl::encoding::Encode::<
8095                BufferCollectionExportToken,
8096                fidl::encoding::DefaultFuchsiaResourceDialect,
8097            >::encode(
8098                (<fidl::encoding::HandleType<
8099                    fidl::EventPair,
8100                    { fidl::ObjectType::EVENTPAIR.into_raw() },
8101                    2147483648,
8102                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
8103                    &mut self.value
8104                ),),
8105                encoder,
8106                offset,
8107                _depth,
8108            )
8109        }
8110    }
8111    unsafe impl<
8112            T0: fidl::encoding::Encode<
8113                fidl::encoding::HandleType<
8114                    fidl::EventPair,
8115                    { fidl::ObjectType::EVENTPAIR.into_raw() },
8116                    2147483648,
8117                >,
8118                fidl::encoding::DefaultFuchsiaResourceDialect,
8119            >,
8120        >
8121        fidl::encoding::Encode<
8122            BufferCollectionExportToken,
8123            fidl::encoding::DefaultFuchsiaResourceDialect,
8124        > for (T0,)
8125    {
8126        #[inline]
8127        unsafe fn encode(
8128            self,
8129            encoder: &mut fidl::encoding::Encoder<
8130                '_,
8131                fidl::encoding::DefaultFuchsiaResourceDialect,
8132            >,
8133            offset: usize,
8134            depth: fidl::encoding::Depth,
8135        ) -> fidl::Result<()> {
8136            encoder.debug_check_bounds::<BufferCollectionExportToken>(offset);
8137            // Zero out padding regions. There's no need to apply masks
8138            // because the unmasked parts will be overwritten by fields.
8139            // Write the fields.
8140            self.0.encode(encoder, offset + 0, depth)?;
8141            Ok(())
8142        }
8143    }
8144
8145    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
8146        for BufferCollectionExportToken
8147    {
8148        #[inline(always)]
8149        fn new_empty() -> Self {
8150            Self {
8151                value: fidl::new_empty!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
8152            }
8153        }
8154
8155        #[inline]
8156        unsafe fn decode(
8157            &mut self,
8158            decoder: &mut fidl::encoding::Decoder<
8159                '_,
8160                fidl::encoding::DefaultFuchsiaResourceDialect,
8161            >,
8162            offset: usize,
8163            _depth: fidl::encoding::Depth,
8164        ) -> fidl::Result<()> {
8165            decoder.debug_check_bounds::<Self>(offset);
8166            // Verify that padding bytes are zero.
8167            fidl::decode!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.value, decoder, offset + 0, _depth)?;
8168            Ok(())
8169        }
8170    }
8171
8172    impl fidl::encoding::ResourceTypeMarker for BufferCollectionImportToken {
8173        type Borrowed<'a> = &'a mut Self;
8174        fn take_or_borrow<'a>(
8175            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
8176        ) -> Self::Borrowed<'a> {
8177            value
8178        }
8179    }
8180
8181    unsafe impl fidl::encoding::TypeMarker for BufferCollectionImportToken {
8182        type Owned = Self;
8183
8184        #[inline(always)]
8185        fn inline_align(_context: fidl::encoding::Context) -> usize {
8186            4
8187        }
8188
8189        #[inline(always)]
8190        fn inline_size(_context: fidl::encoding::Context) -> usize {
8191            4
8192        }
8193    }
8194
8195    unsafe impl
8196        fidl::encoding::Encode<
8197            BufferCollectionImportToken,
8198            fidl::encoding::DefaultFuchsiaResourceDialect,
8199        > for &mut BufferCollectionImportToken
8200    {
8201        #[inline]
8202        unsafe fn encode(
8203            self,
8204            encoder: &mut fidl::encoding::Encoder<
8205                '_,
8206                fidl::encoding::DefaultFuchsiaResourceDialect,
8207            >,
8208            offset: usize,
8209            _depth: fidl::encoding::Depth,
8210        ) -> fidl::Result<()> {
8211            encoder.debug_check_bounds::<BufferCollectionImportToken>(offset);
8212            // Delegate to tuple encoding.
8213            fidl::encoding::Encode::<
8214                BufferCollectionImportToken,
8215                fidl::encoding::DefaultFuchsiaResourceDialect,
8216            >::encode(
8217                (<fidl::encoding::HandleType<
8218                    fidl::EventPair,
8219                    { fidl::ObjectType::EVENTPAIR.into_raw() },
8220                    2147483648,
8221                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
8222                    &mut self.value
8223                ),),
8224                encoder,
8225                offset,
8226                _depth,
8227            )
8228        }
8229    }
8230    unsafe impl<
8231            T0: fidl::encoding::Encode<
8232                fidl::encoding::HandleType<
8233                    fidl::EventPair,
8234                    { fidl::ObjectType::EVENTPAIR.into_raw() },
8235                    2147483648,
8236                >,
8237                fidl::encoding::DefaultFuchsiaResourceDialect,
8238            >,
8239        >
8240        fidl::encoding::Encode<
8241            BufferCollectionImportToken,
8242            fidl::encoding::DefaultFuchsiaResourceDialect,
8243        > for (T0,)
8244    {
8245        #[inline]
8246        unsafe fn encode(
8247            self,
8248            encoder: &mut fidl::encoding::Encoder<
8249                '_,
8250                fidl::encoding::DefaultFuchsiaResourceDialect,
8251            >,
8252            offset: usize,
8253            depth: fidl::encoding::Depth,
8254        ) -> fidl::Result<()> {
8255            encoder.debug_check_bounds::<BufferCollectionImportToken>(offset);
8256            // Zero out padding regions. There's no need to apply masks
8257            // because the unmasked parts will be overwritten by fields.
8258            // Write the fields.
8259            self.0.encode(encoder, offset + 0, depth)?;
8260            Ok(())
8261        }
8262    }
8263
8264    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
8265        for BufferCollectionImportToken
8266    {
8267        #[inline(always)]
8268        fn new_empty() -> Self {
8269            Self {
8270                value: fidl::new_empty!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
8271            }
8272        }
8273
8274        #[inline]
8275        unsafe fn decode(
8276            &mut self,
8277            decoder: &mut fidl::encoding::Decoder<
8278                '_,
8279                fidl::encoding::DefaultFuchsiaResourceDialect,
8280            >,
8281            offset: usize,
8282            _depth: fidl::encoding::Depth,
8283        ) -> fidl::Result<()> {
8284            decoder.debug_check_bounds::<Self>(offset);
8285            // Verify that padding bytes are zero.
8286            fidl::decode!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.value, decoder, offset + 0, _depth)?;
8287            Ok(())
8288        }
8289    }
8290
8291    impl fidl::encoding::ResourceTypeMarker for ChildViewWatcherGetViewRefResponse {
8292        type Borrowed<'a> = &'a mut Self;
8293        fn take_or_borrow<'a>(
8294            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
8295        ) -> Self::Borrowed<'a> {
8296            value
8297        }
8298    }
8299
8300    unsafe impl fidl::encoding::TypeMarker for ChildViewWatcherGetViewRefResponse {
8301        type Owned = Self;
8302
8303        #[inline(always)]
8304        fn inline_align(_context: fidl::encoding::Context) -> usize {
8305            4
8306        }
8307
8308        #[inline(always)]
8309        fn inline_size(_context: fidl::encoding::Context) -> usize {
8310            4
8311        }
8312    }
8313
8314    unsafe impl
8315        fidl::encoding::Encode<
8316            ChildViewWatcherGetViewRefResponse,
8317            fidl::encoding::DefaultFuchsiaResourceDialect,
8318        > for &mut ChildViewWatcherGetViewRefResponse
8319    {
8320        #[inline]
8321        unsafe fn encode(
8322            self,
8323            encoder: &mut fidl::encoding::Encoder<
8324                '_,
8325                fidl::encoding::DefaultFuchsiaResourceDialect,
8326            >,
8327            offset: usize,
8328            _depth: fidl::encoding::Depth,
8329        ) -> fidl::Result<()> {
8330            encoder.debug_check_bounds::<ChildViewWatcherGetViewRefResponse>(offset);
8331            // Delegate to tuple encoding.
8332            fidl::encoding::Encode::<ChildViewWatcherGetViewRefResponse, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
8333                (
8334                    <fidl_fuchsia_ui_views::ViewRef as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.view_ref),
8335                ),
8336                encoder, offset, _depth
8337            )
8338        }
8339    }
8340    unsafe impl<
8341            T0: fidl::encoding::Encode<
8342                fidl_fuchsia_ui_views::ViewRef,
8343                fidl::encoding::DefaultFuchsiaResourceDialect,
8344            >,
8345        >
8346        fidl::encoding::Encode<
8347            ChildViewWatcherGetViewRefResponse,
8348            fidl::encoding::DefaultFuchsiaResourceDialect,
8349        > for (T0,)
8350    {
8351        #[inline]
8352        unsafe fn encode(
8353            self,
8354            encoder: &mut fidl::encoding::Encoder<
8355                '_,
8356                fidl::encoding::DefaultFuchsiaResourceDialect,
8357            >,
8358            offset: usize,
8359            depth: fidl::encoding::Depth,
8360        ) -> fidl::Result<()> {
8361            encoder.debug_check_bounds::<ChildViewWatcherGetViewRefResponse>(offset);
8362            // Zero out padding regions. There's no need to apply masks
8363            // because the unmasked parts will be overwritten by fields.
8364            // Write the fields.
8365            self.0.encode(encoder, offset + 0, depth)?;
8366            Ok(())
8367        }
8368    }
8369
8370    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
8371        for ChildViewWatcherGetViewRefResponse
8372    {
8373        #[inline(always)]
8374        fn new_empty() -> Self {
8375            Self {
8376                view_ref: fidl::new_empty!(
8377                    fidl_fuchsia_ui_views::ViewRef,
8378                    fidl::encoding::DefaultFuchsiaResourceDialect
8379                ),
8380            }
8381        }
8382
8383        #[inline]
8384        unsafe fn decode(
8385            &mut self,
8386            decoder: &mut fidl::encoding::Decoder<
8387                '_,
8388                fidl::encoding::DefaultFuchsiaResourceDialect,
8389            >,
8390            offset: usize,
8391            _depth: fidl::encoding::Depth,
8392        ) -> fidl::Result<()> {
8393            decoder.debug_check_bounds::<Self>(offset);
8394            // Verify that padding bytes are zero.
8395            fidl::decode!(
8396                fidl_fuchsia_ui_views::ViewRef,
8397                fidl::encoding::DefaultFuchsiaResourceDialect,
8398                &mut self.view_ref,
8399                decoder,
8400                offset + 0,
8401                _depth
8402            )?;
8403            Ok(())
8404        }
8405    }
8406
8407    impl fidl::encoding::ResourceTypeMarker for FlatlandCreateFilledRectRequest {
8408        type Borrowed<'a> = &'a mut Self;
8409        fn take_or_borrow<'a>(
8410            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
8411        ) -> Self::Borrowed<'a> {
8412            value
8413        }
8414    }
8415
8416    unsafe impl fidl::encoding::TypeMarker for FlatlandCreateFilledRectRequest {
8417        type Owned = Self;
8418
8419        #[inline(always)]
8420        fn inline_align(_context: fidl::encoding::Context) -> usize {
8421            8
8422        }
8423
8424        #[inline(always)]
8425        fn inline_size(_context: fidl::encoding::Context) -> usize {
8426            8
8427        }
8428        #[inline(always)]
8429        fn encode_is_copy() -> bool {
8430            true
8431        }
8432
8433        #[inline(always)]
8434        fn decode_is_copy() -> bool {
8435            true
8436        }
8437    }
8438
8439    unsafe impl
8440        fidl::encoding::Encode<
8441            FlatlandCreateFilledRectRequest,
8442            fidl::encoding::DefaultFuchsiaResourceDialect,
8443        > for &mut FlatlandCreateFilledRectRequest
8444    {
8445        #[inline]
8446        unsafe fn encode(
8447            self,
8448            encoder: &mut fidl::encoding::Encoder<
8449                '_,
8450                fidl::encoding::DefaultFuchsiaResourceDialect,
8451            >,
8452            offset: usize,
8453            _depth: fidl::encoding::Depth,
8454        ) -> fidl::Result<()> {
8455            encoder.debug_check_bounds::<FlatlandCreateFilledRectRequest>(offset);
8456            unsafe {
8457                // Copy the object into the buffer.
8458                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
8459                (buf_ptr as *mut FlatlandCreateFilledRectRequest)
8460                    .write_unaligned((self as *const FlatlandCreateFilledRectRequest).read());
8461                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
8462                // done second because the memcpy will write garbage to these bytes.
8463            }
8464            Ok(())
8465        }
8466    }
8467    unsafe impl<T0: fidl::encoding::Encode<ContentId, fidl::encoding::DefaultFuchsiaResourceDialect>>
8468        fidl::encoding::Encode<
8469            FlatlandCreateFilledRectRequest,
8470            fidl::encoding::DefaultFuchsiaResourceDialect,
8471        > for (T0,)
8472    {
8473        #[inline]
8474        unsafe fn encode(
8475            self,
8476            encoder: &mut fidl::encoding::Encoder<
8477                '_,
8478                fidl::encoding::DefaultFuchsiaResourceDialect,
8479            >,
8480            offset: usize,
8481            depth: fidl::encoding::Depth,
8482        ) -> fidl::Result<()> {
8483            encoder.debug_check_bounds::<FlatlandCreateFilledRectRequest>(offset);
8484            // Zero out padding regions. There's no need to apply masks
8485            // because the unmasked parts will be overwritten by fields.
8486            // Write the fields.
8487            self.0.encode(encoder, offset + 0, depth)?;
8488            Ok(())
8489        }
8490    }
8491
8492    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
8493        for FlatlandCreateFilledRectRequest
8494    {
8495        #[inline(always)]
8496        fn new_empty() -> Self {
8497            Self {
8498                rect_id: fidl::new_empty!(ContentId, fidl::encoding::DefaultFuchsiaResourceDialect),
8499            }
8500        }
8501
8502        #[inline]
8503        unsafe fn decode(
8504            &mut self,
8505            decoder: &mut fidl::encoding::Decoder<
8506                '_,
8507                fidl::encoding::DefaultFuchsiaResourceDialect,
8508            >,
8509            offset: usize,
8510            _depth: fidl::encoding::Depth,
8511        ) -> fidl::Result<()> {
8512            decoder.debug_check_bounds::<Self>(offset);
8513            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
8514            // Verify that padding bytes are zero.
8515            // Copy from the buffer into the object.
8516            unsafe {
8517                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
8518            }
8519            Ok(())
8520        }
8521    }
8522
8523    impl fidl::encoding::ResourceTypeMarker for FlatlandCreateImageRequest {
8524        type Borrowed<'a> = &'a mut Self;
8525        fn take_or_borrow<'a>(
8526            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
8527        ) -> Self::Borrowed<'a> {
8528            value
8529        }
8530    }
8531
8532    unsafe impl fidl::encoding::TypeMarker for FlatlandCreateImageRequest {
8533        type Owned = Self;
8534
8535        #[inline(always)]
8536        fn inline_align(_context: fidl::encoding::Context) -> usize {
8537            8
8538        }
8539
8540        #[inline(always)]
8541        fn inline_size(_context: fidl::encoding::Context) -> usize {
8542            32
8543        }
8544    }
8545
8546    unsafe impl
8547        fidl::encoding::Encode<
8548            FlatlandCreateImageRequest,
8549            fidl::encoding::DefaultFuchsiaResourceDialect,
8550        > for &mut FlatlandCreateImageRequest
8551    {
8552        #[inline]
8553        unsafe fn encode(
8554            self,
8555            encoder: &mut fidl::encoding::Encoder<
8556                '_,
8557                fidl::encoding::DefaultFuchsiaResourceDialect,
8558            >,
8559            offset: usize,
8560            _depth: fidl::encoding::Depth,
8561        ) -> fidl::Result<()> {
8562            encoder.debug_check_bounds::<FlatlandCreateImageRequest>(offset);
8563            // Delegate to tuple encoding.
8564            fidl::encoding::Encode::<FlatlandCreateImageRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
8565                (
8566                    <ContentId as fidl::encoding::ValueTypeMarker>::borrow(&self.image_id),
8567                    <BufferCollectionImportToken as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.import_token),
8568                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.vmo_index),
8569                    <ImageProperties as fidl::encoding::ValueTypeMarker>::borrow(&self.properties),
8570                ),
8571                encoder, offset, _depth
8572            )
8573        }
8574    }
8575    unsafe impl<
8576            T0: fidl::encoding::Encode<ContentId, fidl::encoding::DefaultFuchsiaResourceDialect>,
8577            T1: fidl::encoding::Encode<
8578                BufferCollectionImportToken,
8579                fidl::encoding::DefaultFuchsiaResourceDialect,
8580            >,
8581            T2: fidl::encoding::Encode<u32, fidl::encoding::DefaultFuchsiaResourceDialect>,
8582            T3: fidl::encoding::Encode<ImageProperties, fidl::encoding::DefaultFuchsiaResourceDialect>,
8583        >
8584        fidl::encoding::Encode<
8585            FlatlandCreateImageRequest,
8586            fidl::encoding::DefaultFuchsiaResourceDialect,
8587        > for (T0, T1, T2, T3)
8588    {
8589        #[inline]
8590        unsafe fn encode(
8591            self,
8592            encoder: &mut fidl::encoding::Encoder<
8593                '_,
8594                fidl::encoding::DefaultFuchsiaResourceDialect,
8595            >,
8596            offset: usize,
8597            depth: fidl::encoding::Depth,
8598        ) -> fidl::Result<()> {
8599            encoder.debug_check_bounds::<FlatlandCreateImageRequest>(offset);
8600            // Zero out padding regions. There's no need to apply masks
8601            // because the unmasked parts will be overwritten by fields.
8602            // Write the fields.
8603            self.0.encode(encoder, offset + 0, depth)?;
8604            self.1.encode(encoder, offset + 8, depth)?;
8605            self.2.encode(encoder, offset + 12, depth)?;
8606            self.3.encode(encoder, offset + 16, depth)?;
8607            Ok(())
8608        }
8609    }
8610
8611    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
8612        for FlatlandCreateImageRequest
8613    {
8614        #[inline(always)]
8615        fn new_empty() -> Self {
8616            Self {
8617                image_id: fidl::new_empty!(
8618                    ContentId,
8619                    fidl::encoding::DefaultFuchsiaResourceDialect
8620                ),
8621                import_token: fidl::new_empty!(
8622                    BufferCollectionImportToken,
8623                    fidl::encoding::DefaultFuchsiaResourceDialect
8624                ),
8625                vmo_index: fidl::new_empty!(u32, fidl::encoding::DefaultFuchsiaResourceDialect),
8626                properties: fidl::new_empty!(
8627                    ImageProperties,
8628                    fidl::encoding::DefaultFuchsiaResourceDialect
8629                ),
8630            }
8631        }
8632
8633        #[inline]
8634        unsafe fn decode(
8635            &mut self,
8636            decoder: &mut fidl::encoding::Decoder<
8637                '_,
8638                fidl::encoding::DefaultFuchsiaResourceDialect,
8639            >,
8640            offset: usize,
8641            _depth: fidl::encoding::Depth,
8642        ) -> fidl::Result<()> {
8643            decoder.debug_check_bounds::<Self>(offset);
8644            // Verify that padding bytes are zero.
8645            fidl::decode!(
8646                ContentId,
8647                fidl::encoding::DefaultFuchsiaResourceDialect,
8648                &mut self.image_id,
8649                decoder,
8650                offset + 0,
8651                _depth
8652            )?;
8653            fidl::decode!(
8654                BufferCollectionImportToken,
8655                fidl::encoding::DefaultFuchsiaResourceDialect,
8656                &mut self.import_token,
8657                decoder,
8658                offset + 8,
8659                _depth
8660            )?;
8661            fidl::decode!(
8662                u32,
8663                fidl::encoding::DefaultFuchsiaResourceDialect,
8664                &mut self.vmo_index,
8665                decoder,
8666                offset + 12,
8667                _depth
8668            )?;
8669            fidl::decode!(
8670                ImageProperties,
8671                fidl::encoding::DefaultFuchsiaResourceDialect,
8672                &mut self.properties,
8673                decoder,
8674                offset + 16,
8675                _depth
8676            )?;
8677            Ok(())
8678        }
8679    }
8680
8681    impl fidl::encoding::ResourceTypeMarker for FlatlandCreateView2Request {
8682        type Borrowed<'a> = &'a mut Self;
8683        fn take_or_borrow<'a>(
8684            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
8685        ) -> Self::Borrowed<'a> {
8686            value
8687        }
8688    }
8689
8690    unsafe impl fidl::encoding::TypeMarker for FlatlandCreateView2Request {
8691        type Owned = Self;
8692
8693        #[inline(always)]
8694        fn inline_align(_context: fidl::encoding::Context) -> usize {
8695            8
8696        }
8697
8698        #[inline(always)]
8699        fn inline_size(_context: fidl::encoding::Context) -> usize {
8700            40
8701        }
8702    }
8703
8704    unsafe impl
8705        fidl::encoding::Encode<
8706            FlatlandCreateView2Request,
8707            fidl::encoding::DefaultFuchsiaResourceDialect,
8708        > for &mut FlatlandCreateView2Request
8709    {
8710        #[inline]
8711        unsafe fn encode(
8712            self,
8713            encoder: &mut fidl::encoding::Encoder<
8714                '_,
8715                fidl::encoding::DefaultFuchsiaResourceDialect,
8716            >,
8717            offset: usize,
8718            _depth: fidl::encoding::Depth,
8719        ) -> fidl::Result<()> {
8720            encoder.debug_check_bounds::<FlatlandCreateView2Request>(offset);
8721            // Delegate to tuple encoding.
8722            fidl::encoding::Encode::<FlatlandCreateView2Request, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
8723                (
8724                    <fidl_fuchsia_ui_views::ViewCreationToken as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.token),
8725                    <fidl_fuchsia_ui_views::ViewIdentityOnCreation as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.view_identity),
8726                    <ViewBoundProtocols as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.protocols),
8727                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.parent_viewport_watcher),
8728                ),
8729                encoder, offset, _depth
8730            )
8731        }
8732    }
8733    unsafe impl<
8734            T0: fidl::encoding::Encode<
8735                fidl_fuchsia_ui_views::ViewCreationToken,
8736                fidl::encoding::DefaultFuchsiaResourceDialect,
8737            >,
8738            T1: fidl::encoding::Encode<
8739                fidl_fuchsia_ui_views::ViewIdentityOnCreation,
8740                fidl::encoding::DefaultFuchsiaResourceDialect,
8741            >,
8742            T2: fidl::encoding::Encode<
8743                ViewBoundProtocols,
8744                fidl::encoding::DefaultFuchsiaResourceDialect,
8745            >,
8746            T3: fidl::encoding::Encode<
8747                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>>,
8748                fidl::encoding::DefaultFuchsiaResourceDialect,
8749            >,
8750        >
8751        fidl::encoding::Encode<
8752            FlatlandCreateView2Request,
8753            fidl::encoding::DefaultFuchsiaResourceDialect,
8754        > for (T0, T1, T2, T3)
8755    {
8756        #[inline]
8757        unsafe fn encode(
8758            self,
8759            encoder: &mut fidl::encoding::Encoder<
8760                '_,
8761                fidl::encoding::DefaultFuchsiaResourceDialect,
8762            >,
8763            offset: usize,
8764            depth: fidl::encoding::Depth,
8765        ) -> fidl::Result<()> {
8766            encoder.debug_check_bounds::<FlatlandCreateView2Request>(offset);
8767            // Zero out padding regions. There's no need to apply masks
8768            // because the unmasked parts will be overwritten by fields.
8769            unsafe {
8770                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
8771                (ptr as *mut u64).write_unaligned(0);
8772            }
8773            unsafe {
8774                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(32);
8775                (ptr as *mut u64).write_unaligned(0);
8776            }
8777            // Write the fields.
8778            self.0.encode(encoder, offset + 0, depth)?;
8779            self.1.encode(encoder, offset + 4, depth)?;
8780            self.2.encode(encoder, offset + 16, depth)?;
8781            self.3.encode(encoder, offset + 32, depth)?;
8782            Ok(())
8783        }
8784    }
8785
8786    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
8787        for FlatlandCreateView2Request
8788    {
8789        #[inline(always)]
8790        fn new_empty() -> Self {
8791            Self {
8792                token: fidl::new_empty!(
8793                    fidl_fuchsia_ui_views::ViewCreationToken,
8794                    fidl::encoding::DefaultFuchsiaResourceDialect
8795                ),
8796                view_identity: fidl::new_empty!(
8797                    fidl_fuchsia_ui_views::ViewIdentityOnCreation,
8798                    fidl::encoding::DefaultFuchsiaResourceDialect
8799                ),
8800                protocols: fidl::new_empty!(
8801                    ViewBoundProtocols,
8802                    fidl::encoding::DefaultFuchsiaResourceDialect
8803                ),
8804                parent_viewport_watcher: fidl::new_empty!(
8805                    fidl::encoding::Endpoint<
8806                        fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>,
8807                    >,
8808                    fidl::encoding::DefaultFuchsiaResourceDialect
8809                ),
8810            }
8811        }
8812
8813        #[inline]
8814        unsafe fn decode(
8815            &mut self,
8816            decoder: &mut fidl::encoding::Decoder<
8817                '_,
8818                fidl::encoding::DefaultFuchsiaResourceDialect,
8819            >,
8820            offset: usize,
8821            _depth: fidl::encoding::Depth,
8822        ) -> fidl::Result<()> {
8823            decoder.debug_check_bounds::<Self>(offset);
8824            // Verify that padding bytes are zero.
8825            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(8) };
8826            let padval = unsafe { (ptr as *const u64).read_unaligned() };
8827            let mask = 0xffffffff00000000u64;
8828            let maskedval = padval & mask;
8829            if maskedval != 0 {
8830                return Err(fidl::Error::NonZeroPadding {
8831                    padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
8832                });
8833            }
8834            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(32) };
8835            let padval = unsafe { (ptr as *const u64).read_unaligned() };
8836            let mask = 0xffffffff00000000u64;
8837            let maskedval = padval & mask;
8838            if maskedval != 0 {
8839                return Err(fidl::Error::NonZeroPadding {
8840                    padding_start: offset + 32 + ((mask as u64).trailing_zeros() / 8) as usize,
8841                });
8842            }
8843            fidl::decode!(
8844                fidl_fuchsia_ui_views::ViewCreationToken,
8845                fidl::encoding::DefaultFuchsiaResourceDialect,
8846                &mut self.token,
8847                decoder,
8848                offset + 0,
8849                _depth
8850            )?;
8851            fidl::decode!(
8852                fidl_fuchsia_ui_views::ViewIdentityOnCreation,
8853                fidl::encoding::DefaultFuchsiaResourceDialect,
8854                &mut self.view_identity,
8855                decoder,
8856                offset + 4,
8857                _depth
8858            )?;
8859            fidl::decode!(
8860                ViewBoundProtocols,
8861                fidl::encoding::DefaultFuchsiaResourceDialect,
8862                &mut self.protocols,
8863                decoder,
8864                offset + 16,
8865                _depth
8866            )?;
8867            fidl::decode!(
8868                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>>,
8869                fidl::encoding::DefaultFuchsiaResourceDialect,
8870                &mut self.parent_viewport_watcher,
8871                decoder,
8872                offset + 32,
8873                _depth
8874            )?;
8875            Ok(())
8876        }
8877    }
8878
8879    impl fidl::encoding::ResourceTypeMarker for FlatlandCreateViewRequest {
8880        type Borrowed<'a> = &'a mut Self;
8881        fn take_or_borrow<'a>(
8882            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
8883        ) -> Self::Borrowed<'a> {
8884            value
8885        }
8886    }
8887
8888    unsafe impl fidl::encoding::TypeMarker for FlatlandCreateViewRequest {
8889        type Owned = Self;
8890
8891        #[inline(always)]
8892        fn inline_align(_context: fidl::encoding::Context) -> usize {
8893            4
8894        }
8895
8896        #[inline(always)]
8897        fn inline_size(_context: fidl::encoding::Context) -> usize {
8898            8
8899        }
8900    }
8901
8902    unsafe impl
8903        fidl::encoding::Encode<
8904            FlatlandCreateViewRequest,
8905            fidl::encoding::DefaultFuchsiaResourceDialect,
8906        > for &mut FlatlandCreateViewRequest
8907    {
8908        #[inline]
8909        unsafe fn encode(
8910            self,
8911            encoder: &mut fidl::encoding::Encoder<
8912                '_,
8913                fidl::encoding::DefaultFuchsiaResourceDialect,
8914            >,
8915            offset: usize,
8916            _depth: fidl::encoding::Depth,
8917        ) -> fidl::Result<()> {
8918            encoder.debug_check_bounds::<FlatlandCreateViewRequest>(offset);
8919            // Delegate to tuple encoding.
8920            fidl::encoding::Encode::<FlatlandCreateViewRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
8921                (
8922                    <fidl_fuchsia_ui_views::ViewCreationToken as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.token),
8923                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.parent_viewport_watcher),
8924                ),
8925                encoder, offset, _depth
8926            )
8927        }
8928    }
8929    unsafe impl<
8930            T0: fidl::encoding::Encode<
8931                fidl_fuchsia_ui_views::ViewCreationToken,
8932                fidl::encoding::DefaultFuchsiaResourceDialect,
8933            >,
8934            T1: fidl::encoding::Encode<
8935                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>>,
8936                fidl::encoding::DefaultFuchsiaResourceDialect,
8937            >,
8938        >
8939        fidl::encoding::Encode<
8940            FlatlandCreateViewRequest,
8941            fidl::encoding::DefaultFuchsiaResourceDialect,
8942        > for (T0, T1)
8943    {
8944        #[inline]
8945        unsafe fn encode(
8946            self,
8947            encoder: &mut fidl::encoding::Encoder<
8948                '_,
8949                fidl::encoding::DefaultFuchsiaResourceDialect,
8950            >,
8951            offset: usize,
8952            depth: fidl::encoding::Depth,
8953        ) -> fidl::Result<()> {
8954            encoder.debug_check_bounds::<FlatlandCreateViewRequest>(offset);
8955            // Zero out padding regions. There's no need to apply masks
8956            // because the unmasked parts will be overwritten by fields.
8957            // Write the fields.
8958            self.0.encode(encoder, offset + 0, depth)?;
8959            self.1.encode(encoder, offset + 4, depth)?;
8960            Ok(())
8961        }
8962    }
8963
8964    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
8965        for FlatlandCreateViewRequest
8966    {
8967        #[inline(always)]
8968        fn new_empty() -> Self {
8969            Self {
8970                token: fidl::new_empty!(
8971                    fidl_fuchsia_ui_views::ViewCreationToken,
8972                    fidl::encoding::DefaultFuchsiaResourceDialect
8973                ),
8974                parent_viewport_watcher: fidl::new_empty!(
8975                    fidl::encoding::Endpoint<
8976                        fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>,
8977                    >,
8978                    fidl::encoding::DefaultFuchsiaResourceDialect
8979                ),
8980            }
8981        }
8982
8983        #[inline]
8984        unsafe fn decode(
8985            &mut self,
8986            decoder: &mut fidl::encoding::Decoder<
8987                '_,
8988                fidl::encoding::DefaultFuchsiaResourceDialect,
8989            >,
8990            offset: usize,
8991            _depth: fidl::encoding::Depth,
8992        ) -> fidl::Result<()> {
8993            decoder.debug_check_bounds::<Self>(offset);
8994            // Verify that padding bytes are zero.
8995            fidl::decode!(
8996                fidl_fuchsia_ui_views::ViewCreationToken,
8997                fidl::encoding::DefaultFuchsiaResourceDialect,
8998                &mut self.token,
8999                decoder,
9000                offset + 0,
9001                _depth
9002            )?;
9003            fidl::decode!(
9004                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>>,
9005                fidl::encoding::DefaultFuchsiaResourceDialect,
9006                &mut self.parent_viewport_watcher,
9007                decoder,
9008                offset + 4,
9009                _depth
9010            )?;
9011            Ok(())
9012        }
9013    }
9014
9015    impl fidl::encoding::ResourceTypeMarker for FlatlandCreateViewportRequest {
9016        type Borrowed<'a> = &'a mut Self;
9017        fn take_or_borrow<'a>(
9018            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9019        ) -> Self::Borrowed<'a> {
9020            value
9021        }
9022    }
9023
9024    unsafe impl fidl::encoding::TypeMarker for FlatlandCreateViewportRequest {
9025        type Owned = Self;
9026
9027        #[inline(always)]
9028        fn inline_align(_context: fidl::encoding::Context) -> usize {
9029            8
9030        }
9031
9032        #[inline(always)]
9033        fn inline_size(_context: fidl::encoding::Context) -> usize {
9034            40
9035        }
9036    }
9037
9038    unsafe impl
9039        fidl::encoding::Encode<
9040            FlatlandCreateViewportRequest,
9041            fidl::encoding::DefaultFuchsiaResourceDialect,
9042        > for &mut FlatlandCreateViewportRequest
9043    {
9044        #[inline]
9045        unsafe fn encode(
9046            self,
9047            encoder: &mut fidl::encoding::Encoder<
9048                '_,
9049                fidl::encoding::DefaultFuchsiaResourceDialect,
9050            >,
9051            offset: usize,
9052            _depth: fidl::encoding::Depth,
9053        ) -> fidl::Result<()> {
9054            encoder.debug_check_bounds::<FlatlandCreateViewportRequest>(offset);
9055            // Delegate to tuple encoding.
9056            fidl::encoding::Encode::<FlatlandCreateViewportRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
9057                (
9058                    <ContentId as fidl::encoding::ValueTypeMarker>::borrow(&self.viewport_id),
9059                    <fidl_fuchsia_ui_views::ViewportCreationToken as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.token),
9060                    <ViewportProperties as fidl::encoding::ValueTypeMarker>::borrow(&self.properties),
9061                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ChildViewWatcherMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.child_view_watcher),
9062                ),
9063                encoder, offset, _depth
9064            )
9065        }
9066    }
9067    unsafe impl<
9068            T0: fidl::encoding::Encode<ContentId, fidl::encoding::DefaultFuchsiaResourceDialect>,
9069            T1: fidl::encoding::Encode<
9070                fidl_fuchsia_ui_views::ViewportCreationToken,
9071                fidl::encoding::DefaultFuchsiaResourceDialect,
9072            >,
9073            T2: fidl::encoding::Encode<
9074                ViewportProperties,
9075                fidl::encoding::DefaultFuchsiaResourceDialect,
9076            >,
9077            T3: fidl::encoding::Encode<
9078                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ChildViewWatcherMarker>>,
9079                fidl::encoding::DefaultFuchsiaResourceDialect,
9080            >,
9081        >
9082        fidl::encoding::Encode<
9083            FlatlandCreateViewportRequest,
9084            fidl::encoding::DefaultFuchsiaResourceDialect,
9085        > for (T0, T1, T2, T3)
9086    {
9087        #[inline]
9088        unsafe fn encode(
9089            self,
9090            encoder: &mut fidl::encoding::Encoder<
9091                '_,
9092                fidl::encoding::DefaultFuchsiaResourceDialect,
9093            >,
9094            offset: usize,
9095            depth: fidl::encoding::Depth,
9096        ) -> fidl::Result<()> {
9097            encoder.debug_check_bounds::<FlatlandCreateViewportRequest>(offset);
9098            // Zero out padding regions. There's no need to apply masks
9099            // because the unmasked parts will be overwritten by fields.
9100            unsafe {
9101                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
9102                (ptr as *mut u64).write_unaligned(0);
9103            }
9104            unsafe {
9105                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(32);
9106                (ptr as *mut u64).write_unaligned(0);
9107            }
9108            // Write the fields.
9109            self.0.encode(encoder, offset + 0, depth)?;
9110            self.1.encode(encoder, offset + 8, depth)?;
9111            self.2.encode(encoder, offset + 16, depth)?;
9112            self.3.encode(encoder, offset + 32, depth)?;
9113            Ok(())
9114        }
9115    }
9116
9117    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
9118        for FlatlandCreateViewportRequest
9119    {
9120        #[inline(always)]
9121        fn new_empty() -> Self {
9122            Self {
9123                viewport_id: fidl::new_empty!(
9124                    ContentId,
9125                    fidl::encoding::DefaultFuchsiaResourceDialect
9126                ),
9127                token: fidl::new_empty!(
9128                    fidl_fuchsia_ui_views::ViewportCreationToken,
9129                    fidl::encoding::DefaultFuchsiaResourceDialect
9130                ),
9131                properties: fidl::new_empty!(
9132                    ViewportProperties,
9133                    fidl::encoding::DefaultFuchsiaResourceDialect
9134                ),
9135                child_view_watcher: fidl::new_empty!(
9136                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ChildViewWatcherMarker>>,
9137                    fidl::encoding::DefaultFuchsiaResourceDialect
9138                ),
9139            }
9140        }
9141
9142        #[inline]
9143        unsafe fn decode(
9144            &mut self,
9145            decoder: &mut fidl::encoding::Decoder<
9146                '_,
9147                fidl::encoding::DefaultFuchsiaResourceDialect,
9148            >,
9149            offset: usize,
9150            _depth: fidl::encoding::Depth,
9151        ) -> fidl::Result<()> {
9152            decoder.debug_check_bounds::<Self>(offset);
9153            // Verify that padding bytes are zero.
9154            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(8) };
9155            let padval = unsafe { (ptr as *const u64).read_unaligned() };
9156            let mask = 0xffffffff00000000u64;
9157            let maskedval = padval & mask;
9158            if maskedval != 0 {
9159                return Err(fidl::Error::NonZeroPadding {
9160                    padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
9161                });
9162            }
9163            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(32) };
9164            let padval = unsafe { (ptr as *const u64).read_unaligned() };
9165            let mask = 0xffffffff00000000u64;
9166            let maskedval = padval & mask;
9167            if maskedval != 0 {
9168                return Err(fidl::Error::NonZeroPadding {
9169                    padding_start: offset + 32 + ((mask as u64).trailing_zeros() / 8) as usize,
9170                });
9171            }
9172            fidl::decode!(
9173                ContentId,
9174                fidl::encoding::DefaultFuchsiaResourceDialect,
9175                &mut self.viewport_id,
9176                decoder,
9177                offset + 0,
9178                _depth
9179            )?;
9180            fidl::decode!(
9181                fidl_fuchsia_ui_views::ViewportCreationToken,
9182                fidl::encoding::DefaultFuchsiaResourceDialect,
9183                &mut self.token,
9184                decoder,
9185                offset + 8,
9186                _depth
9187            )?;
9188            fidl::decode!(
9189                ViewportProperties,
9190                fidl::encoding::DefaultFuchsiaResourceDialect,
9191                &mut self.properties,
9192                decoder,
9193                offset + 16,
9194                _depth
9195            )?;
9196            fidl::decode!(
9197                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ChildViewWatcherMarker>>,
9198                fidl::encoding::DefaultFuchsiaResourceDialect,
9199                &mut self.child_view_watcher,
9200                decoder,
9201                offset + 32,
9202                _depth
9203            )?;
9204            Ok(())
9205        }
9206    }
9207
9208    impl fidl::encoding::ResourceTypeMarker for FlatlandDisplaySetContentRequest {
9209        type Borrowed<'a> = &'a mut Self;
9210        fn take_or_borrow<'a>(
9211            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9212        ) -> Self::Borrowed<'a> {
9213            value
9214        }
9215    }
9216
9217    unsafe impl fidl::encoding::TypeMarker for FlatlandDisplaySetContentRequest {
9218        type Owned = Self;
9219
9220        #[inline(always)]
9221        fn inline_align(_context: fidl::encoding::Context) -> usize {
9222            4
9223        }
9224
9225        #[inline(always)]
9226        fn inline_size(_context: fidl::encoding::Context) -> usize {
9227            8
9228        }
9229    }
9230
9231    unsafe impl
9232        fidl::encoding::Encode<
9233            FlatlandDisplaySetContentRequest,
9234            fidl::encoding::DefaultFuchsiaResourceDialect,
9235        > for &mut FlatlandDisplaySetContentRequest
9236    {
9237        #[inline]
9238        unsafe fn encode(
9239            self,
9240            encoder: &mut fidl::encoding::Encoder<
9241                '_,
9242                fidl::encoding::DefaultFuchsiaResourceDialect,
9243            >,
9244            offset: usize,
9245            _depth: fidl::encoding::Depth,
9246        ) -> fidl::Result<()> {
9247            encoder.debug_check_bounds::<FlatlandDisplaySetContentRequest>(offset);
9248            // Delegate to tuple encoding.
9249            fidl::encoding::Encode::<FlatlandDisplaySetContentRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
9250                (
9251                    <fidl_fuchsia_ui_views::ViewportCreationToken as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.token),
9252                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ChildViewWatcherMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.child_view_watcher),
9253                ),
9254                encoder, offset, _depth
9255            )
9256        }
9257    }
9258    unsafe impl<
9259            T0: fidl::encoding::Encode<
9260                fidl_fuchsia_ui_views::ViewportCreationToken,
9261                fidl::encoding::DefaultFuchsiaResourceDialect,
9262            >,
9263            T1: fidl::encoding::Encode<
9264                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ChildViewWatcherMarker>>,
9265                fidl::encoding::DefaultFuchsiaResourceDialect,
9266            >,
9267        >
9268        fidl::encoding::Encode<
9269            FlatlandDisplaySetContentRequest,
9270            fidl::encoding::DefaultFuchsiaResourceDialect,
9271        > for (T0, T1)
9272    {
9273        #[inline]
9274        unsafe fn encode(
9275            self,
9276            encoder: &mut fidl::encoding::Encoder<
9277                '_,
9278                fidl::encoding::DefaultFuchsiaResourceDialect,
9279            >,
9280            offset: usize,
9281            depth: fidl::encoding::Depth,
9282        ) -> fidl::Result<()> {
9283            encoder.debug_check_bounds::<FlatlandDisplaySetContentRequest>(offset);
9284            // Zero out padding regions. There's no need to apply masks
9285            // because the unmasked parts will be overwritten by fields.
9286            // Write the fields.
9287            self.0.encode(encoder, offset + 0, depth)?;
9288            self.1.encode(encoder, offset + 4, depth)?;
9289            Ok(())
9290        }
9291    }
9292
9293    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
9294        for FlatlandDisplaySetContentRequest
9295    {
9296        #[inline(always)]
9297        fn new_empty() -> Self {
9298            Self {
9299                token: fidl::new_empty!(
9300                    fidl_fuchsia_ui_views::ViewportCreationToken,
9301                    fidl::encoding::DefaultFuchsiaResourceDialect
9302                ),
9303                child_view_watcher: fidl::new_empty!(
9304                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ChildViewWatcherMarker>>,
9305                    fidl::encoding::DefaultFuchsiaResourceDialect
9306                ),
9307            }
9308        }
9309
9310        #[inline]
9311        unsafe fn decode(
9312            &mut self,
9313            decoder: &mut fidl::encoding::Decoder<
9314                '_,
9315                fidl::encoding::DefaultFuchsiaResourceDialect,
9316            >,
9317            offset: usize,
9318            _depth: fidl::encoding::Depth,
9319        ) -> fidl::Result<()> {
9320            decoder.debug_check_bounds::<Self>(offset);
9321            // Verify that padding bytes are zero.
9322            fidl::decode!(
9323                fidl_fuchsia_ui_views::ViewportCreationToken,
9324                fidl::encoding::DefaultFuchsiaResourceDialect,
9325                &mut self.token,
9326                decoder,
9327                offset + 0,
9328                _depth
9329            )?;
9330            fidl::decode!(
9331                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ChildViewWatcherMarker>>,
9332                fidl::encoding::DefaultFuchsiaResourceDialect,
9333                &mut self.child_view_watcher,
9334                decoder,
9335                offset + 4,
9336                _depth
9337            )?;
9338            Ok(())
9339        }
9340    }
9341
9342    impl fidl::encoding::ResourceTypeMarker for FlatlandPresentRequest {
9343        type Borrowed<'a> = &'a mut Self;
9344        fn take_or_borrow<'a>(
9345            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9346        ) -> Self::Borrowed<'a> {
9347            value
9348        }
9349    }
9350
9351    unsafe impl fidl::encoding::TypeMarker for FlatlandPresentRequest {
9352        type Owned = Self;
9353
9354        #[inline(always)]
9355        fn inline_align(_context: fidl::encoding::Context) -> usize {
9356            8
9357        }
9358
9359        #[inline(always)]
9360        fn inline_size(_context: fidl::encoding::Context) -> usize {
9361            16
9362        }
9363    }
9364
9365    unsafe impl
9366        fidl::encoding::Encode<
9367            FlatlandPresentRequest,
9368            fidl::encoding::DefaultFuchsiaResourceDialect,
9369        > for &mut FlatlandPresentRequest
9370    {
9371        #[inline]
9372        unsafe fn encode(
9373            self,
9374            encoder: &mut fidl::encoding::Encoder<
9375                '_,
9376                fidl::encoding::DefaultFuchsiaResourceDialect,
9377            >,
9378            offset: usize,
9379            _depth: fidl::encoding::Depth,
9380        ) -> fidl::Result<()> {
9381            encoder.debug_check_bounds::<FlatlandPresentRequest>(offset);
9382            // Delegate to tuple encoding.
9383            fidl::encoding::Encode::<
9384                FlatlandPresentRequest,
9385                fidl::encoding::DefaultFuchsiaResourceDialect,
9386            >::encode(
9387                (<PresentArgs as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
9388                    &mut self.args,
9389                ),),
9390                encoder,
9391                offset,
9392                _depth,
9393            )
9394        }
9395    }
9396    unsafe impl<
9397            T0: fidl::encoding::Encode<PresentArgs, fidl::encoding::DefaultFuchsiaResourceDialect>,
9398        >
9399        fidl::encoding::Encode<
9400            FlatlandPresentRequest,
9401            fidl::encoding::DefaultFuchsiaResourceDialect,
9402        > for (T0,)
9403    {
9404        #[inline]
9405        unsafe fn encode(
9406            self,
9407            encoder: &mut fidl::encoding::Encoder<
9408                '_,
9409                fidl::encoding::DefaultFuchsiaResourceDialect,
9410            >,
9411            offset: usize,
9412            depth: fidl::encoding::Depth,
9413        ) -> fidl::Result<()> {
9414            encoder.debug_check_bounds::<FlatlandPresentRequest>(offset);
9415            // Zero out padding regions. There's no need to apply masks
9416            // because the unmasked parts will be overwritten by fields.
9417            // Write the fields.
9418            self.0.encode(encoder, offset + 0, depth)?;
9419            Ok(())
9420        }
9421    }
9422
9423    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
9424        for FlatlandPresentRequest
9425    {
9426        #[inline(always)]
9427        fn new_empty() -> Self {
9428            Self {
9429                args: fidl::new_empty!(PresentArgs, fidl::encoding::DefaultFuchsiaResourceDialect),
9430            }
9431        }
9432
9433        #[inline]
9434        unsafe fn decode(
9435            &mut self,
9436            decoder: &mut fidl::encoding::Decoder<
9437                '_,
9438                fidl::encoding::DefaultFuchsiaResourceDialect,
9439            >,
9440            offset: usize,
9441            _depth: fidl::encoding::Depth,
9442        ) -> fidl::Result<()> {
9443            decoder.debug_check_bounds::<Self>(offset);
9444            // Verify that padding bytes are zero.
9445            fidl::decode!(
9446                PresentArgs,
9447                fidl::encoding::DefaultFuchsiaResourceDialect,
9448                &mut self.args,
9449                decoder,
9450                offset + 0,
9451                _depth
9452            )?;
9453            Ok(())
9454        }
9455    }
9456
9457    impl fidl::encoding::ResourceTypeMarker for FlatlandReleaseViewportResponse {
9458        type Borrowed<'a> = &'a mut Self;
9459        fn take_or_borrow<'a>(
9460            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9461        ) -> Self::Borrowed<'a> {
9462            value
9463        }
9464    }
9465
9466    unsafe impl fidl::encoding::TypeMarker for FlatlandReleaseViewportResponse {
9467        type Owned = Self;
9468
9469        #[inline(always)]
9470        fn inline_align(_context: fidl::encoding::Context) -> usize {
9471            4
9472        }
9473
9474        #[inline(always)]
9475        fn inline_size(_context: fidl::encoding::Context) -> usize {
9476            4
9477        }
9478    }
9479
9480    unsafe impl
9481        fidl::encoding::Encode<
9482            FlatlandReleaseViewportResponse,
9483            fidl::encoding::DefaultFuchsiaResourceDialect,
9484        > for &mut FlatlandReleaseViewportResponse
9485    {
9486        #[inline]
9487        unsafe fn encode(
9488            self,
9489            encoder: &mut fidl::encoding::Encoder<
9490                '_,
9491                fidl::encoding::DefaultFuchsiaResourceDialect,
9492            >,
9493            offset: usize,
9494            _depth: fidl::encoding::Depth,
9495        ) -> fidl::Result<()> {
9496            encoder.debug_check_bounds::<FlatlandReleaseViewportResponse>(offset);
9497            // Delegate to tuple encoding.
9498            fidl::encoding::Encode::<FlatlandReleaseViewportResponse, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
9499                (
9500                    <fidl_fuchsia_ui_views::ViewportCreationToken as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.token),
9501                ),
9502                encoder, offset, _depth
9503            )
9504        }
9505    }
9506    unsafe impl<
9507            T0: fidl::encoding::Encode<
9508                fidl_fuchsia_ui_views::ViewportCreationToken,
9509                fidl::encoding::DefaultFuchsiaResourceDialect,
9510            >,
9511        >
9512        fidl::encoding::Encode<
9513            FlatlandReleaseViewportResponse,
9514            fidl::encoding::DefaultFuchsiaResourceDialect,
9515        > for (T0,)
9516    {
9517        #[inline]
9518        unsafe fn encode(
9519            self,
9520            encoder: &mut fidl::encoding::Encoder<
9521                '_,
9522                fidl::encoding::DefaultFuchsiaResourceDialect,
9523            >,
9524            offset: usize,
9525            depth: fidl::encoding::Depth,
9526        ) -> fidl::Result<()> {
9527            encoder.debug_check_bounds::<FlatlandReleaseViewportResponse>(offset);
9528            // Zero out padding regions. There's no need to apply masks
9529            // because the unmasked parts will be overwritten by fields.
9530            // Write the fields.
9531            self.0.encode(encoder, offset + 0, depth)?;
9532            Ok(())
9533        }
9534    }
9535
9536    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
9537        for FlatlandReleaseViewportResponse
9538    {
9539        #[inline(always)]
9540        fn new_empty() -> Self {
9541            Self {
9542                token: fidl::new_empty!(
9543                    fidl_fuchsia_ui_views::ViewportCreationToken,
9544                    fidl::encoding::DefaultFuchsiaResourceDialect
9545                ),
9546            }
9547        }
9548
9549        #[inline]
9550        unsafe fn decode(
9551            &mut self,
9552            decoder: &mut fidl::encoding::Decoder<
9553                '_,
9554                fidl::encoding::DefaultFuchsiaResourceDialect,
9555            >,
9556            offset: usize,
9557            _depth: fidl::encoding::Depth,
9558        ) -> fidl::Result<()> {
9559            decoder.debug_check_bounds::<Self>(offset);
9560            // Verify that padding bytes are zero.
9561            fidl::decode!(
9562                fidl_fuchsia_ui_views::ViewportCreationToken,
9563                fidl::encoding::DefaultFuchsiaResourceDialect,
9564                &mut self.token,
9565                decoder,
9566                offset + 0,
9567                _depth
9568            )?;
9569            Ok(())
9570        }
9571    }
9572
9573    impl fidl::encoding::ResourceTypeMarker for FlatlandSetSolidFillRequest {
9574        type Borrowed<'a> = &'a mut Self;
9575        fn take_or_borrow<'a>(
9576            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9577        ) -> Self::Borrowed<'a> {
9578            value
9579        }
9580    }
9581
9582    unsafe impl fidl::encoding::TypeMarker for FlatlandSetSolidFillRequest {
9583        type Owned = Self;
9584
9585        #[inline(always)]
9586        fn inline_align(_context: fidl::encoding::Context) -> usize {
9587            8
9588        }
9589
9590        #[inline(always)]
9591        fn inline_size(_context: fidl::encoding::Context) -> usize {
9592            32
9593        }
9594    }
9595
9596    unsafe impl
9597        fidl::encoding::Encode<
9598            FlatlandSetSolidFillRequest,
9599            fidl::encoding::DefaultFuchsiaResourceDialect,
9600        > for &mut FlatlandSetSolidFillRequest
9601    {
9602        #[inline]
9603        unsafe fn encode(
9604            self,
9605            encoder: &mut fidl::encoding::Encoder<
9606                '_,
9607                fidl::encoding::DefaultFuchsiaResourceDialect,
9608            >,
9609            offset: usize,
9610            _depth: fidl::encoding::Depth,
9611        ) -> fidl::Result<()> {
9612            encoder.debug_check_bounds::<FlatlandSetSolidFillRequest>(offset);
9613            // Delegate to tuple encoding.
9614            fidl::encoding::Encode::<
9615                FlatlandSetSolidFillRequest,
9616                fidl::encoding::DefaultFuchsiaResourceDialect,
9617            >::encode(
9618                (
9619                    <ContentId as fidl::encoding::ValueTypeMarker>::borrow(&self.rect_id),
9620                    <ColorRgba as fidl::encoding::ValueTypeMarker>::borrow(&self.color),
9621                    <fidl_fuchsia_math::SizeU as fidl::encoding::ValueTypeMarker>::borrow(
9622                        &self.size,
9623                    ),
9624                ),
9625                encoder,
9626                offset,
9627                _depth,
9628            )
9629        }
9630    }
9631    unsafe impl<
9632            T0: fidl::encoding::Encode<ContentId, fidl::encoding::DefaultFuchsiaResourceDialect>,
9633            T1: fidl::encoding::Encode<ColorRgba, fidl::encoding::DefaultFuchsiaResourceDialect>,
9634            T2: fidl::encoding::Encode<
9635                fidl_fuchsia_math::SizeU,
9636                fidl::encoding::DefaultFuchsiaResourceDialect,
9637            >,
9638        >
9639        fidl::encoding::Encode<
9640            FlatlandSetSolidFillRequest,
9641            fidl::encoding::DefaultFuchsiaResourceDialect,
9642        > for (T0, T1, T2)
9643    {
9644        #[inline]
9645        unsafe fn encode(
9646            self,
9647            encoder: &mut fidl::encoding::Encoder<
9648                '_,
9649                fidl::encoding::DefaultFuchsiaResourceDialect,
9650            >,
9651            offset: usize,
9652            depth: fidl::encoding::Depth,
9653        ) -> fidl::Result<()> {
9654            encoder.debug_check_bounds::<FlatlandSetSolidFillRequest>(offset);
9655            // Zero out padding regions. There's no need to apply masks
9656            // because the unmasked parts will be overwritten by fields.
9657            // Write the fields.
9658            self.0.encode(encoder, offset + 0, depth)?;
9659            self.1.encode(encoder, offset + 8, depth)?;
9660            self.2.encode(encoder, offset + 24, depth)?;
9661            Ok(())
9662        }
9663    }
9664
9665    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
9666        for FlatlandSetSolidFillRequest
9667    {
9668        #[inline(always)]
9669        fn new_empty() -> Self {
9670            Self {
9671                rect_id: fidl::new_empty!(ContentId, fidl::encoding::DefaultFuchsiaResourceDialect),
9672                color: fidl::new_empty!(ColorRgba, fidl::encoding::DefaultFuchsiaResourceDialect),
9673                size: fidl::new_empty!(
9674                    fidl_fuchsia_math::SizeU,
9675                    fidl::encoding::DefaultFuchsiaResourceDialect
9676                ),
9677            }
9678        }
9679
9680        #[inline]
9681        unsafe fn decode(
9682            &mut self,
9683            decoder: &mut fidl::encoding::Decoder<
9684                '_,
9685                fidl::encoding::DefaultFuchsiaResourceDialect,
9686            >,
9687            offset: usize,
9688            _depth: fidl::encoding::Depth,
9689        ) -> fidl::Result<()> {
9690            decoder.debug_check_bounds::<Self>(offset);
9691            // Verify that padding bytes are zero.
9692            fidl::decode!(
9693                ContentId,
9694                fidl::encoding::DefaultFuchsiaResourceDialect,
9695                &mut self.rect_id,
9696                decoder,
9697                offset + 0,
9698                _depth
9699            )?;
9700            fidl::decode!(
9701                ColorRgba,
9702                fidl::encoding::DefaultFuchsiaResourceDialect,
9703                &mut self.color,
9704                decoder,
9705                offset + 8,
9706                _depth
9707            )?;
9708            fidl::decode!(
9709                fidl_fuchsia_math::SizeU,
9710                fidl::encoding::DefaultFuchsiaResourceDialect,
9711                &mut self.size,
9712                decoder,
9713                offset + 24,
9714                _depth
9715            )?;
9716            Ok(())
9717        }
9718    }
9719
9720    impl FrameInfo {
9721        #[inline(always)]
9722        fn max_ordinal_present(&self) -> u64 {
9723            if let Some(_) = self.buffer_id {
9724                return 1;
9725            }
9726            0
9727        }
9728    }
9729
9730    impl fidl::encoding::ResourceTypeMarker for FrameInfo {
9731        type Borrowed<'a> = &'a mut Self;
9732        fn take_or_borrow<'a>(
9733            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9734        ) -> Self::Borrowed<'a> {
9735            value
9736        }
9737    }
9738
9739    unsafe impl fidl::encoding::TypeMarker for FrameInfo {
9740        type Owned = Self;
9741
9742        #[inline(always)]
9743        fn inline_align(_context: fidl::encoding::Context) -> usize {
9744            8
9745        }
9746
9747        #[inline(always)]
9748        fn inline_size(_context: fidl::encoding::Context) -> usize {
9749            16
9750        }
9751    }
9752
9753    unsafe impl fidl::encoding::Encode<FrameInfo, fidl::encoding::DefaultFuchsiaResourceDialect>
9754        for &mut FrameInfo
9755    {
9756        unsafe fn encode(
9757            self,
9758            encoder: &mut fidl::encoding::Encoder<
9759                '_,
9760                fidl::encoding::DefaultFuchsiaResourceDialect,
9761            >,
9762            offset: usize,
9763            mut depth: fidl::encoding::Depth,
9764        ) -> fidl::Result<()> {
9765            encoder.debug_check_bounds::<FrameInfo>(offset);
9766            // Vector header
9767            let max_ordinal: u64 = self.max_ordinal_present();
9768            encoder.write_num(max_ordinal, offset);
9769            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
9770            // Calling encoder.out_of_line_offset(0) is not allowed.
9771            if max_ordinal == 0 {
9772                return Ok(());
9773            }
9774            depth.increment()?;
9775            let envelope_size = 8;
9776            let bytes_len = max_ordinal as usize * envelope_size;
9777            #[allow(unused_variables)]
9778            let offset = encoder.out_of_line_offset(bytes_len);
9779            let mut _prev_end_offset: usize = 0;
9780            if 1 > max_ordinal {
9781                return Ok(());
9782            }
9783
9784            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
9785            // are envelope_size bytes.
9786            let cur_offset: usize = (1 - 1) * envelope_size;
9787
9788            // Zero reserved fields.
9789            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
9790
9791            // Safety:
9792            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
9793            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
9794            //   envelope_size bytes, there is always sufficient room.
9795            fidl::encoding::encode_in_envelope_optional::<
9796                u32,
9797                fidl::encoding::DefaultFuchsiaResourceDialect,
9798            >(
9799                self.buffer_id.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
9800                encoder,
9801                offset + cur_offset,
9802                depth,
9803            )?;
9804
9805            _prev_end_offset = cur_offset + envelope_size;
9806
9807            Ok(())
9808        }
9809    }
9810
9811    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for FrameInfo {
9812        #[inline(always)]
9813        fn new_empty() -> Self {
9814            Self::default()
9815        }
9816
9817        unsafe fn decode(
9818            &mut self,
9819            decoder: &mut fidl::encoding::Decoder<
9820                '_,
9821                fidl::encoding::DefaultFuchsiaResourceDialect,
9822            >,
9823            offset: usize,
9824            mut depth: fidl::encoding::Depth,
9825        ) -> fidl::Result<()> {
9826            decoder.debug_check_bounds::<Self>(offset);
9827            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
9828                None => return Err(fidl::Error::NotNullable),
9829                Some(len) => len,
9830            };
9831            // Calling decoder.out_of_line_offset(0) is not allowed.
9832            if len == 0 {
9833                return Ok(());
9834            };
9835            depth.increment()?;
9836            let envelope_size = 8;
9837            let bytes_len = len * envelope_size;
9838            let offset = decoder.out_of_line_offset(bytes_len)?;
9839            // Decode the envelope for each type.
9840            let mut _next_ordinal_to_read = 0;
9841            let mut next_offset = offset;
9842            let end_offset = offset + bytes_len;
9843            _next_ordinal_to_read += 1;
9844            if next_offset >= end_offset {
9845                return Ok(());
9846            }
9847
9848            // Decode unknown envelopes for gaps in ordinals.
9849            while _next_ordinal_to_read < 1 {
9850                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9851                _next_ordinal_to_read += 1;
9852                next_offset += envelope_size;
9853            }
9854
9855            let next_out_of_line = decoder.next_out_of_line();
9856            let handles_before = decoder.remaining_handles();
9857            if let Some((inlined, num_bytes, num_handles)) =
9858                fidl::encoding::decode_envelope_header(decoder, next_offset)?
9859            {
9860                let member_inline_size =
9861                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
9862                if inlined != (member_inline_size <= 4) {
9863                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
9864                }
9865                let inner_offset;
9866                let mut inner_depth = depth.clone();
9867                if inlined {
9868                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
9869                    inner_offset = next_offset;
9870                } else {
9871                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
9872                    inner_depth.increment()?;
9873                }
9874                let val_ref = self.buffer_id.get_or_insert_with(|| {
9875                    fidl::new_empty!(u32, fidl::encoding::DefaultFuchsiaResourceDialect)
9876                });
9877                fidl::decode!(
9878                    u32,
9879                    fidl::encoding::DefaultFuchsiaResourceDialect,
9880                    val_ref,
9881                    decoder,
9882                    inner_offset,
9883                    inner_depth
9884                )?;
9885                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
9886                {
9887                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
9888                }
9889                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
9890                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
9891                }
9892            }
9893
9894            next_offset += envelope_size;
9895
9896            // Decode the remaining unknown envelopes.
9897            while next_offset < end_offset {
9898                _next_ordinal_to_read += 1;
9899                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9900                next_offset += envelope_size;
9901            }
9902
9903            Ok(())
9904        }
9905    }
9906
9907    impl GetNextFrameArgs {
9908        #[inline(always)]
9909        fn max_ordinal_present(&self) -> u64 {
9910            if let Some(_) = self.event {
9911                return 1;
9912            }
9913            0
9914        }
9915    }
9916
9917    impl fidl::encoding::ResourceTypeMarker for GetNextFrameArgs {
9918        type Borrowed<'a> = &'a mut Self;
9919        fn take_or_borrow<'a>(
9920            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9921        ) -> Self::Borrowed<'a> {
9922            value
9923        }
9924    }
9925
9926    unsafe impl fidl::encoding::TypeMarker for GetNextFrameArgs {
9927        type Owned = Self;
9928
9929        #[inline(always)]
9930        fn inline_align(_context: fidl::encoding::Context) -> usize {
9931            8
9932        }
9933
9934        #[inline(always)]
9935        fn inline_size(_context: fidl::encoding::Context) -> usize {
9936            16
9937        }
9938    }
9939
9940    unsafe impl
9941        fidl::encoding::Encode<GetNextFrameArgs, fidl::encoding::DefaultFuchsiaResourceDialect>
9942        for &mut GetNextFrameArgs
9943    {
9944        unsafe fn encode(
9945            self,
9946            encoder: &mut fidl::encoding::Encoder<
9947                '_,
9948                fidl::encoding::DefaultFuchsiaResourceDialect,
9949            >,
9950            offset: usize,
9951            mut depth: fidl::encoding::Depth,
9952        ) -> fidl::Result<()> {
9953            encoder.debug_check_bounds::<GetNextFrameArgs>(offset);
9954            // Vector header
9955            let max_ordinal: u64 = self.max_ordinal_present();
9956            encoder.write_num(max_ordinal, offset);
9957            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
9958            // Calling encoder.out_of_line_offset(0) is not allowed.
9959            if max_ordinal == 0 {
9960                return Ok(());
9961            }
9962            depth.increment()?;
9963            let envelope_size = 8;
9964            let bytes_len = max_ordinal as usize * envelope_size;
9965            #[allow(unused_variables)]
9966            let offset = encoder.out_of_line_offset(bytes_len);
9967            let mut _prev_end_offset: usize = 0;
9968            if 1 > max_ordinal {
9969                return Ok(());
9970            }
9971
9972            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
9973            // are envelope_size bytes.
9974            let cur_offset: usize = (1 - 1) * envelope_size;
9975
9976            // Zero reserved fields.
9977            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
9978
9979            // Safety:
9980            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
9981            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
9982            //   envelope_size bytes, there is always sufficient room.
9983            fidl::encoding::encode_in_envelope_optional::<
9984                fidl::encoding::HandleType<
9985                    fidl::Event,
9986                    { fidl::ObjectType::EVENT.into_raw() },
9987                    2147483648,
9988                >,
9989                fidl::encoding::DefaultFuchsiaResourceDialect,
9990            >(
9991                self.event.as_mut().map(
9992                    <fidl::encoding::HandleType<
9993                        fidl::Event,
9994                        { fidl::ObjectType::EVENT.into_raw() },
9995                        2147483648,
9996                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
9997                ),
9998                encoder,
9999                offset + cur_offset,
10000                depth,
10001            )?;
10002
10003            _prev_end_offset = cur_offset + envelope_size;
10004
10005            Ok(())
10006        }
10007    }
10008
10009    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10010        for GetNextFrameArgs
10011    {
10012        #[inline(always)]
10013        fn new_empty() -> Self {
10014            Self::default()
10015        }
10016
10017        unsafe fn decode(
10018            &mut self,
10019            decoder: &mut fidl::encoding::Decoder<
10020                '_,
10021                fidl::encoding::DefaultFuchsiaResourceDialect,
10022            >,
10023            offset: usize,
10024            mut depth: fidl::encoding::Depth,
10025        ) -> fidl::Result<()> {
10026            decoder.debug_check_bounds::<Self>(offset);
10027            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
10028                None => return Err(fidl::Error::NotNullable),
10029                Some(len) => len,
10030            };
10031            // Calling decoder.out_of_line_offset(0) is not allowed.
10032            if len == 0 {
10033                return Ok(());
10034            };
10035            depth.increment()?;
10036            let envelope_size = 8;
10037            let bytes_len = len * envelope_size;
10038            let offset = decoder.out_of_line_offset(bytes_len)?;
10039            // Decode the envelope for each type.
10040            let mut _next_ordinal_to_read = 0;
10041            let mut next_offset = offset;
10042            let end_offset = offset + bytes_len;
10043            _next_ordinal_to_read += 1;
10044            if next_offset >= end_offset {
10045                return Ok(());
10046            }
10047
10048            // Decode unknown envelopes for gaps in ordinals.
10049            while _next_ordinal_to_read < 1 {
10050                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10051                _next_ordinal_to_read += 1;
10052                next_offset += envelope_size;
10053            }
10054
10055            let next_out_of_line = decoder.next_out_of_line();
10056            let handles_before = decoder.remaining_handles();
10057            if let Some((inlined, num_bytes, num_handles)) =
10058                fidl::encoding::decode_envelope_header(decoder, next_offset)?
10059            {
10060                let member_inline_size = <fidl::encoding::HandleType<
10061                    fidl::Event,
10062                    { fidl::ObjectType::EVENT.into_raw() },
10063                    2147483648,
10064                > as fidl::encoding::TypeMarker>::inline_size(
10065                    decoder.context
10066                );
10067                if inlined != (member_inline_size <= 4) {
10068                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
10069                }
10070                let inner_offset;
10071                let mut inner_depth = depth.clone();
10072                if inlined {
10073                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
10074                    inner_offset = next_offset;
10075                } else {
10076                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
10077                    inner_depth.increment()?;
10078                }
10079                let val_ref =
10080                self.event.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
10081                fidl::decode!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
10082                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
10083                {
10084                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
10085                }
10086                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
10087                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
10088                }
10089            }
10090
10091            next_offset += envelope_size;
10092
10093            // Decode the remaining unknown envelopes.
10094            while next_offset < end_offset {
10095                _next_ordinal_to_read += 1;
10096                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10097                next_offset += envelope_size;
10098            }
10099
10100            Ok(())
10101        }
10102    }
10103
10104    impl PresentArgs {
10105        #[inline(always)]
10106        fn max_ordinal_present(&self) -> u64 {
10107            if let Some(_) = self.server_signal_fences {
10108                return 6;
10109            }
10110            if let Some(_) = self.server_wait_fences {
10111                return 5;
10112            }
10113            if let Some(_) = self.unsquashable {
10114                return 4;
10115            }
10116            if let Some(_) = self.release_fences {
10117                return 3;
10118            }
10119            if let Some(_) = self.acquire_fences {
10120                return 2;
10121            }
10122            if let Some(_) = self.requested_presentation_time {
10123                return 1;
10124            }
10125            0
10126        }
10127    }
10128
10129    impl fidl::encoding::ResourceTypeMarker for PresentArgs {
10130        type Borrowed<'a> = &'a mut Self;
10131        fn take_or_borrow<'a>(
10132            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10133        ) -> Self::Borrowed<'a> {
10134            value
10135        }
10136    }
10137
10138    unsafe impl fidl::encoding::TypeMarker for PresentArgs {
10139        type Owned = Self;
10140
10141        #[inline(always)]
10142        fn inline_align(_context: fidl::encoding::Context) -> usize {
10143            8
10144        }
10145
10146        #[inline(always)]
10147        fn inline_size(_context: fidl::encoding::Context) -> usize {
10148            16
10149        }
10150    }
10151
10152    unsafe impl fidl::encoding::Encode<PresentArgs, fidl::encoding::DefaultFuchsiaResourceDialect>
10153        for &mut PresentArgs
10154    {
10155        unsafe fn encode(
10156            self,
10157            encoder: &mut fidl::encoding::Encoder<
10158                '_,
10159                fidl::encoding::DefaultFuchsiaResourceDialect,
10160            >,
10161            offset: usize,
10162            mut depth: fidl::encoding::Depth,
10163        ) -> fidl::Result<()> {
10164            encoder.debug_check_bounds::<PresentArgs>(offset);
10165            // Vector header
10166            let max_ordinal: u64 = self.max_ordinal_present();
10167            encoder.write_num(max_ordinal, offset);
10168            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
10169            // Calling encoder.out_of_line_offset(0) is not allowed.
10170            if max_ordinal == 0 {
10171                return Ok(());
10172            }
10173            depth.increment()?;
10174            let envelope_size = 8;
10175            let bytes_len = max_ordinal as usize * envelope_size;
10176            #[allow(unused_variables)]
10177            let offset = encoder.out_of_line_offset(bytes_len);
10178            let mut _prev_end_offset: usize = 0;
10179            if 1 > max_ordinal {
10180                return Ok(());
10181            }
10182
10183            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
10184            // are envelope_size bytes.
10185            let cur_offset: usize = (1 - 1) * envelope_size;
10186
10187            // Zero reserved fields.
10188            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
10189
10190            // Safety:
10191            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
10192            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
10193            //   envelope_size bytes, there is always sufficient room.
10194            fidl::encoding::encode_in_envelope_optional::<
10195                i64,
10196                fidl::encoding::DefaultFuchsiaResourceDialect,
10197            >(
10198                self.requested_presentation_time
10199                    .as_ref()
10200                    .map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
10201                encoder,
10202                offset + cur_offset,
10203                depth,
10204            )?;
10205
10206            _prev_end_offset = cur_offset + envelope_size;
10207            if 2 > max_ordinal {
10208                return Ok(());
10209            }
10210
10211            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
10212            // are envelope_size bytes.
10213            let cur_offset: usize = (2 - 1) * envelope_size;
10214
10215            // Zero reserved fields.
10216            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
10217
10218            // Safety:
10219            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
10220            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
10221            //   envelope_size bytes, there is always sufficient room.
10222            fidl::encoding::encode_in_envelope_optional::<
10223                fidl::encoding::Vector<
10224                    fidl::encoding::HandleType<
10225                        fidl::Event,
10226                        { fidl::ObjectType::EVENT.into_raw() },
10227                        2147483648,
10228                    >,
10229                    16,
10230                >,
10231                fidl::encoding::DefaultFuchsiaResourceDialect,
10232            >(
10233                self.acquire_fences.as_mut().map(
10234                    <fidl::encoding::Vector<
10235                        fidl::encoding::HandleType<
10236                            fidl::Event,
10237                            { fidl::ObjectType::EVENT.into_raw() },
10238                            2147483648,
10239                        >,
10240                        16,
10241                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
10242                ),
10243                encoder,
10244                offset + cur_offset,
10245                depth,
10246            )?;
10247
10248            _prev_end_offset = cur_offset + envelope_size;
10249            if 3 > max_ordinal {
10250                return Ok(());
10251            }
10252
10253            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
10254            // are envelope_size bytes.
10255            let cur_offset: usize = (3 - 1) * envelope_size;
10256
10257            // Zero reserved fields.
10258            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
10259
10260            // Safety:
10261            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
10262            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
10263            //   envelope_size bytes, there is always sufficient room.
10264            fidl::encoding::encode_in_envelope_optional::<
10265                fidl::encoding::Vector<
10266                    fidl::encoding::HandleType<
10267                        fidl::Event,
10268                        { fidl::ObjectType::EVENT.into_raw() },
10269                        2147483648,
10270                    >,
10271                    16,
10272                >,
10273                fidl::encoding::DefaultFuchsiaResourceDialect,
10274            >(
10275                self.release_fences.as_mut().map(
10276                    <fidl::encoding::Vector<
10277                        fidl::encoding::HandleType<
10278                            fidl::Event,
10279                            { fidl::ObjectType::EVENT.into_raw() },
10280                            2147483648,
10281                        >,
10282                        16,
10283                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
10284                ),
10285                encoder,
10286                offset + cur_offset,
10287                depth,
10288            )?;
10289
10290            _prev_end_offset = cur_offset + envelope_size;
10291            if 4 > max_ordinal {
10292                return Ok(());
10293            }
10294
10295            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
10296            // are envelope_size bytes.
10297            let cur_offset: usize = (4 - 1) * envelope_size;
10298
10299            // Zero reserved fields.
10300            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
10301
10302            // Safety:
10303            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
10304            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
10305            //   envelope_size bytes, there is always sufficient room.
10306            fidl::encoding::encode_in_envelope_optional::<
10307                bool,
10308                fidl::encoding::DefaultFuchsiaResourceDialect,
10309            >(
10310                self.unsquashable.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
10311                encoder,
10312                offset + cur_offset,
10313                depth,
10314            )?;
10315
10316            _prev_end_offset = cur_offset + envelope_size;
10317            if 5 > max_ordinal {
10318                return Ok(());
10319            }
10320
10321            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
10322            // are envelope_size bytes.
10323            let cur_offset: usize = (5 - 1) * envelope_size;
10324
10325            // Zero reserved fields.
10326            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
10327
10328            // Safety:
10329            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
10330            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
10331            //   envelope_size bytes, there is always sufficient room.
10332            fidl::encoding::encode_in_envelope_optional::<
10333                fidl::encoding::Vector<
10334                    fidl::encoding::HandleType<
10335                        fidl::Event,
10336                        { fidl::ObjectType::EVENT.into_raw() },
10337                        2147483648,
10338                    >,
10339                    16,
10340                >,
10341                fidl::encoding::DefaultFuchsiaResourceDialect,
10342            >(
10343                self.server_wait_fences.as_mut().map(
10344                    <fidl::encoding::Vector<
10345                        fidl::encoding::HandleType<
10346                            fidl::Event,
10347                            { fidl::ObjectType::EVENT.into_raw() },
10348                            2147483648,
10349                        >,
10350                        16,
10351                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
10352                ),
10353                encoder,
10354                offset + cur_offset,
10355                depth,
10356            )?;
10357
10358            _prev_end_offset = cur_offset + envelope_size;
10359            if 6 > max_ordinal {
10360                return Ok(());
10361            }
10362
10363            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
10364            // are envelope_size bytes.
10365            let cur_offset: usize = (6 - 1) * envelope_size;
10366
10367            // Zero reserved fields.
10368            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
10369
10370            // Safety:
10371            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
10372            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
10373            //   envelope_size bytes, there is always sufficient room.
10374            fidl::encoding::encode_in_envelope_optional::<
10375                fidl::encoding::Vector<
10376                    fidl::encoding::HandleType<
10377                        fidl::Event,
10378                        { fidl::ObjectType::EVENT.into_raw() },
10379                        2147483648,
10380                    >,
10381                    16,
10382                >,
10383                fidl::encoding::DefaultFuchsiaResourceDialect,
10384            >(
10385                self.server_signal_fences.as_mut().map(
10386                    <fidl::encoding::Vector<
10387                        fidl::encoding::HandleType<
10388                            fidl::Event,
10389                            { fidl::ObjectType::EVENT.into_raw() },
10390                            2147483648,
10391                        >,
10392                        16,
10393                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
10394                ),
10395                encoder,
10396                offset + cur_offset,
10397                depth,
10398            )?;
10399
10400            _prev_end_offset = cur_offset + envelope_size;
10401
10402            Ok(())
10403        }
10404    }
10405
10406    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for PresentArgs {
10407        #[inline(always)]
10408        fn new_empty() -> Self {
10409            Self::default()
10410        }
10411
10412        unsafe fn decode(
10413            &mut self,
10414            decoder: &mut fidl::encoding::Decoder<
10415                '_,
10416                fidl::encoding::DefaultFuchsiaResourceDialect,
10417            >,
10418            offset: usize,
10419            mut depth: fidl::encoding::Depth,
10420        ) -> fidl::Result<()> {
10421            decoder.debug_check_bounds::<Self>(offset);
10422            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
10423                None => return Err(fidl::Error::NotNullable),
10424                Some(len) => len,
10425            };
10426            // Calling decoder.out_of_line_offset(0) is not allowed.
10427            if len == 0 {
10428                return Ok(());
10429            };
10430            depth.increment()?;
10431            let envelope_size = 8;
10432            let bytes_len = len * envelope_size;
10433            let offset = decoder.out_of_line_offset(bytes_len)?;
10434            // Decode the envelope for each type.
10435            let mut _next_ordinal_to_read = 0;
10436            let mut next_offset = offset;
10437            let end_offset = offset + bytes_len;
10438            _next_ordinal_to_read += 1;
10439            if next_offset >= end_offset {
10440                return Ok(());
10441            }
10442
10443            // Decode unknown envelopes for gaps in ordinals.
10444            while _next_ordinal_to_read < 1 {
10445                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10446                _next_ordinal_to_read += 1;
10447                next_offset += envelope_size;
10448            }
10449
10450            let next_out_of_line = decoder.next_out_of_line();
10451            let handles_before = decoder.remaining_handles();
10452            if let Some((inlined, num_bytes, num_handles)) =
10453                fidl::encoding::decode_envelope_header(decoder, next_offset)?
10454            {
10455                let member_inline_size =
10456                    <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
10457                if inlined != (member_inline_size <= 4) {
10458                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
10459                }
10460                let inner_offset;
10461                let mut inner_depth = depth.clone();
10462                if inlined {
10463                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
10464                    inner_offset = next_offset;
10465                } else {
10466                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
10467                    inner_depth.increment()?;
10468                }
10469                let val_ref = self.requested_presentation_time.get_or_insert_with(|| {
10470                    fidl::new_empty!(i64, fidl::encoding::DefaultFuchsiaResourceDialect)
10471                });
10472                fidl::decode!(
10473                    i64,
10474                    fidl::encoding::DefaultFuchsiaResourceDialect,
10475                    val_ref,
10476                    decoder,
10477                    inner_offset,
10478                    inner_depth
10479                )?;
10480                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
10481                {
10482                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
10483                }
10484                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
10485                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
10486                }
10487            }
10488
10489            next_offset += envelope_size;
10490            _next_ordinal_to_read += 1;
10491            if next_offset >= end_offset {
10492                return Ok(());
10493            }
10494
10495            // Decode unknown envelopes for gaps in ordinals.
10496            while _next_ordinal_to_read < 2 {
10497                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10498                _next_ordinal_to_read += 1;
10499                next_offset += envelope_size;
10500            }
10501
10502            let next_out_of_line = decoder.next_out_of_line();
10503            let handles_before = decoder.remaining_handles();
10504            if let Some((inlined, num_bytes, num_handles)) =
10505                fidl::encoding::decode_envelope_header(decoder, next_offset)?
10506            {
10507                let member_inline_size = <fidl::encoding::Vector<
10508                    fidl::encoding::HandleType<
10509                        fidl::Event,
10510                        { fidl::ObjectType::EVENT.into_raw() },
10511                        2147483648,
10512                    >,
10513                    16,
10514                > as fidl::encoding::TypeMarker>::inline_size(
10515                    decoder.context
10516                );
10517                if inlined != (member_inline_size <= 4) {
10518                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
10519                }
10520                let inner_offset;
10521                let mut inner_depth = depth.clone();
10522                if inlined {
10523                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
10524                    inner_offset = next_offset;
10525                } else {
10526                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
10527                    inner_depth.increment()?;
10528                }
10529                let val_ref = self.acquire_fences.get_or_insert_with(|| {
10530                    fidl::new_empty!(
10531                        fidl::encoding::Vector<
10532                            fidl::encoding::HandleType<
10533                                fidl::Event,
10534                                { fidl::ObjectType::EVENT.into_raw() },
10535                                2147483648,
10536                            >,
10537                            16,
10538                        >,
10539                        fidl::encoding::DefaultFuchsiaResourceDialect
10540                    )
10541                });
10542                fidl::decode!(
10543                    fidl::encoding::Vector<
10544                        fidl::encoding::HandleType<
10545                            fidl::Event,
10546                            { fidl::ObjectType::EVENT.into_raw() },
10547                            2147483648,
10548                        >,
10549                        16,
10550                    >,
10551                    fidl::encoding::DefaultFuchsiaResourceDialect,
10552                    val_ref,
10553                    decoder,
10554                    inner_offset,
10555                    inner_depth
10556                )?;
10557                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
10558                {
10559                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
10560                }
10561                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
10562                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
10563                }
10564            }
10565
10566            next_offset += envelope_size;
10567            _next_ordinal_to_read += 1;
10568            if next_offset >= end_offset {
10569                return Ok(());
10570            }
10571
10572            // Decode unknown envelopes for gaps in ordinals.
10573            while _next_ordinal_to_read < 3 {
10574                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10575                _next_ordinal_to_read += 1;
10576                next_offset += envelope_size;
10577            }
10578
10579            let next_out_of_line = decoder.next_out_of_line();
10580            let handles_before = decoder.remaining_handles();
10581            if let Some((inlined, num_bytes, num_handles)) =
10582                fidl::encoding::decode_envelope_header(decoder, next_offset)?
10583            {
10584                let member_inline_size = <fidl::encoding::Vector<
10585                    fidl::encoding::HandleType<
10586                        fidl::Event,
10587                        { fidl::ObjectType::EVENT.into_raw() },
10588                        2147483648,
10589                    >,
10590                    16,
10591                > as fidl::encoding::TypeMarker>::inline_size(
10592                    decoder.context
10593                );
10594                if inlined != (member_inline_size <= 4) {
10595                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
10596                }
10597                let inner_offset;
10598                let mut inner_depth = depth.clone();
10599                if inlined {
10600                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
10601                    inner_offset = next_offset;
10602                } else {
10603                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
10604                    inner_depth.increment()?;
10605                }
10606                let val_ref = self.release_fences.get_or_insert_with(|| {
10607                    fidl::new_empty!(
10608                        fidl::encoding::Vector<
10609                            fidl::encoding::HandleType<
10610                                fidl::Event,
10611                                { fidl::ObjectType::EVENT.into_raw() },
10612                                2147483648,
10613                            >,
10614                            16,
10615                        >,
10616                        fidl::encoding::DefaultFuchsiaResourceDialect
10617                    )
10618                });
10619                fidl::decode!(
10620                    fidl::encoding::Vector<
10621                        fidl::encoding::HandleType<
10622                            fidl::Event,
10623                            { fidl::ObjectType::EVENT.into_raw() },
10624                            2147483648,
10625                        >,
10626                        16,
10627                    >,
10628                    fidl::encoding::DefaultFuchsiaResourceDialect,
10629                    val_ref,
10630                    decoder,
10631                    inner_offset,
10632                    inner_depth
10633                )?;
10634                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
10635                {
10636                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
10637                }
10638                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
10639                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
10640                }
10641            }
10642
10643            next_offset += envelope_size;
10644            _next_ordinal_to_read += 1;
10645            if next_offset >= end_offset {
10646                return Ok(());
10647            }
10648
10649            // Decode unknown envelopes for gaps in ordinals.
10650            while _next_ordinal_to_read < 4 {
10651                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10652                _next_ordinal_to_read += 1;
10653                next_offset += envelope_size;
10654            }
10655
10656            let next_out_of_line = decoder.next_out_of_line();
10657            let handles_before = decoder.remaining_handles();
10658            if let Some((inlined, num_bytes, num_handles)) =
10659                fidl::encoding::decode_envelope_header(decoder, next_offset)?
10660            {
10661                let member_inline_size =
10662                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
10663                if inlined != (member_inline_size <= 4) {
10664                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
10665                }
10666                let inner_offset;
10667                let mut inner_depth = depth.clone();
10668                if inlined {
10669                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
10670                    inner_offset = next_offset;
10671                } else {
10672                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
10673                    inner_depth.increment()?;
10674                }
10675                let val_ref = self.unsquashable.get_or_insert_with(|| {
10676                    fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
10677                });
10678                fidl::decode!(
10679                    bool,
10680                    fidl::encoding::DefaultFuchsiaResourceDialect,
10681                    val_ref,
10682                    decoder,
10683                    inner_offset,
10684                    inner_depth
10685                )?;
10686                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
10687                {
10688                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
10689                }
10690                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
10691                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
10692                }
10693            }
10694
10695            next_offset += envelope_size;
10696            _next_ordinal_to_read += 1;
10697            if next_offset >= end_offset {
10698                return Ok(());
10699            }
10700
10701            // Decode unknown envelopes for gaps in ordinals.
10702            while _next_ordinal_to_read < 5 {
10703                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10704                _next_ordinal_to_read += 1;
10705                next_offset += envelope_size;
10706            }
10707
10708            let next_out_of_line = decoder.next_out_of_line();
10709            let handles_before = decoder.remaining_handles();
10710            if let Some((inlined, num_bytes, num_handles)) =
10711                fidl::encoding::decode_envelope_header(decoder, next_offset)?
10712            {
10713                let member_inline_size = <fidl::encoding::Vector<
10714                    fidl::encoding::HandleType<
10715                        fidl::Event,
10716                        { fidl::ObjectType::EVENT.into_raw() },
10717                        2147483648,
10718                    >,
10719                    16,
10720                > as fidl::encoding::TypeMarker>::inline_size(
10721                    decoder.context
10722                );
10723                if inlined != (member_inline_size <= 4) {
10724                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
10725                }
10726                let inner_offset;
10727                let mut inner_depth = depth.clone();
10728                if inlined {
10729                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
10730                    inner_offset = next_offset;
10731                } else {
10732                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
10733                    inner_depth.increment()?;
10734                }
10735                let val_ref = self.server_wait_fences.get_or_insert_with(|| {
10736                    fidl::new_empty!(
10737                        fidl::encoding::Vector<
10738                            fidl::encoding::HandleType<
10739                                fidl::Event,
10740                                { fidl::ObjectType::EVENT.into_raw() },
10741                                2147483648,
10742                            >,
10743                            16,
10744                        >,
10745                        fidl::encoding::DefaultFuchsiaResourceDialect
10746                    )
10747                });
10748                fidl::decode!(
10749                    fidl::encoding::Vector<
10750                        fidl::encoding::HandleType<
10751                            fidl::Event,
10752                            { fidl::ObjectType::EVENT.into_raw() },
10753                            2147483648,
10754                        >,
10755                        16,
10756                    >,
10757                    fidl::encoding::DefaultFuchsiaResourceDialect,
10758                    val_ref,
10759                    decoder,
10760                    inner_offset,
10761                    inner_depth
10762                )?;
10763                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
10764                {
10765                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
10766                }
10767                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
10768                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
10769                }
10770            }
10771
10772            next_offset += envelope_size;
10773            _next_ordinal_to_read += 1;
10774            if next_offset >= end_offset {
10775                return Ok(());
10776            }
10777
10778            // Decode unknown envelopes for gaps in ordinals.
10779            while _next_ordinal_to_read < 6 {
10780                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10781                _next_ordinal_to_read += 1;
10782                next_offset += envelope_size;
10783            }
10784
10785            let next_out_of_line = decoder.next_out_of_line();
10786            let handles_before = decoder.remaining_handles();
10787            if let Some((inlined, num_bytes, num_handles)) =
10788                fidl::encoding::decode_envelope_header(decoder, next_offset)?
10789            {
10790                let member_inline_size = <fidl::encoding::Vector<
10791                    fidl::encoding::HandleType<
10792                        fidl::Event,
10793                        { fidl::ObjectType::EVENT.into_raw() },
10794                        2147483648,
10795                    >,
10796                    16,
10797                > as fidl::encoding::TypeMarker>::inline_size(
10798                    decoder.context
10799                );
10800                if inlined != (member_inline_size <= 4) {
10801                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
10802                }
10803                let inner_offset;
10804                let mut inner_depth = depth.clone();
10805                if inlined {
10806                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
10807                    inner_offset = next_offset;
10808                } else {
10809                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
10810                    inner_depth.increment()?;
10811                }
10812                let val_ref = self.server_signal_fences.get_or_insert_with(|| {
10813                    fidl::new_empty!(
10814                        fidl::encoding::Vector<
10815                            fidl::encoding::HandleType<
10816                                fidl::Event,
10817                                { fidl::ObjectType::EVENT.into_raw() },
10818                                2147483648,
10819                            >,
10820                            16,
10821                        >,
10822                        fidl::encoding::DefaultFuchsiaResourceDialect
10823                    )
10824                });
10825                fidl::decode!(
10826                    fidl::encoding::Vector<
10827                        fidl::encoding::HandleType<
10828                            fidl::Event,
10829                            { fidl::ObjectType::EVENT.into_raw() },
10830                            2147483648,
10831                        >,
10832                        16,
10833                    >,
10834                    fidl::encoding::DefaultFuchsiaResourceDialect,
10835                    val_ref,
10836                    decoder,
10837                    inner_offset,
10838                    inner_depth
10839                )?;
10840                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
10841                {
10842                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
10843                }
10844                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
10845                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
10846                }
10847            }
10848
10849            next_offset += envelope_size;
10850
10851            // Decode the remaining unknown envelopes.
10852            while next_offset < end_offset {
10853                _next_ordinal_to_read += 1;
10854                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10855                next_offset += envelope_size;
10856            }
10857
10858            Ok(())
10859        }
10860    }
10861
10862    impl RegisterBufferCollectionArgs {
10863        #[inline(always)]
10864        fn max_ordinal_present(&self) -> u64 {
10865            if let Some(_) = self.buffer_collection_token2 {
10866                return 5;
10867            }
10868            if let Some(_) = self.usages {
10869                return 4;
10870            }
10871            if let Some(_) = self.usage {
10872                return 3;
10873            }
10874            if let Some(_) = self.buffer_collection_token {
10875                return 2;
10876            }
10877            if let Some(_) = self.export_token {
10878                return 1;
10879            }
10880            0
10881        }
10882    }
10883
10884    impl fidl::encoding::ResourceTypeMarker for RegisterBufferCollectionArgs {
10885        type Borrowed<'a> = &'a mut Self;
10886        fn take_or_borrow<'a>(
10887            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10888        ) -> Self::Borrowed<'a> {
10889            value
10890        }
10891    }
10892
10893    unsafe impl fidl::encoding::TypeMarker for RegisterBufferCollectionArgs {
10894        type Owned = Self;
10895
10896        #[inline(always)]
10897        fn inline_align(_context: fidl::encoding::Context) -> usize {
10898            8
10899        }
10900
10901        #[inline(always)]
10902        fn inline_size(_context: fidl::encoding::Context) -> usize {
10903            16
10904        }
10905    }
10906
10907    unsafe impl
10908        fidl::encoding::Encode<
10909            RegisterBufferCollectionArgs,
10910            fidl::encoding::DefaultFuchsiaResourceDialect,
10911        > for &mut RegisterBufferCollectionArgs
10912    {
10913        unsafe fn encode(
10914            self,
10915            encoder: &mut fidl::encoding::Encoder<
10916                '_,
10917                fidl::encoding::DefaultFuchsiaResourceDialect,
10918            >,
10919            offset: usize,
10920            mut depth: fidl::encoding::Depth,
10921        ) -> fidl::Result<()> {
10922            encoder.debug_check_bounds::<RegisterBufferCollectionArgs>(offset);
10923            // Vector header
10924            let max_ordinal: u64 = self.max_ordinal_present();
10925            encoder.write_num(max_ordinal, offset);
10926            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
10927            // Calling encoder.out_of_line_offset(0) is not allowed.
10928            if max_ordinal == 0 {
10929                return Ok(());
10930            }
10931            depth.increment()?;
10932            let envelope_size = 8;
10933            let bytes_len = max_ordinal as usize * envelope_size;
10934            #[allow(unused_variables)]
10935            let offset = encoder.out_of_line_offset(bytes_len);
10936            let mut _prev_end_offset: usize = 0;
10937            if 1 > max_ordinal {
10938                return Ok(());
10939            }
10940
10941            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
10942            // are envelope_size bytes.
10943            let cur_offset: usize = (1 - 1) * envelope_size;
10944
10945            // Zero reserved fields.
10946            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
10947
10948            // Safety:
10949            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
10950            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
10951            //   envelope_size bytes, there is always sufficient room.
10952            fidl::encoding::encode_in_envelope_optional::<BufferCollectionExportToken, fidl::encoding::DefaultFuchsiaResourceDialect>(
10953            self.export_token.as_mut().map(<BufferCollectionExportToken as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
10954            encoder, offset + cur_offset, depth
10955        )?;
10956
10957            _prev_end_offset = cur_offset + envelope_size;
10958            if 2 > max_ordinal {
10959                return Ok(());
10960            }
10961
10962            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
10963            // are envelope_size bytes.
10964            let cur_offset: usize = (2 - 1) * envelope_size;
10965
10966            // Zero reserved fields.
10967            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
10968
10969            // Safety:
10970            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
10971            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
10972            //   envelope_size bytes, there is always sufficient room.
10973            fidl::encoding::encode_in_envelope_optional::<
10974                fidl::encoding::Endpoint<
10975                    fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem::BufferCollectionTokenMarker>,
10976                >,
10977                fidl::encoding::DefaultFuchsiaResourceDialect,
10978            >(
10979                self.buffer_collection_token.as_mut().map(
10980                    <fidl::encoding::Endpoint<
10981                        fidl::endpoints::ClientEnd<
10982                            fidl_fuchsia_sysmem::BufferCollectionTokenMarker,
10983                        >,
10984                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
10985                ),
10986                encoder,
10987                offset + cur_offset,
10988                depth,
10989            )?;
10990
10991            _prev_end_offset = cur_offset + envelope_size;
10992            if 3 > max_ordinal {
10993                return Ok(());
10994            }
10995
10996            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
10997            // are envelope_size bytes.
10998            let cur_offset: usize = (3 - 1) * envelope_size;
10999
11000            // Zero reserved fields.
11001            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11002
11003            // Safety:
11004            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11005            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11006            //   envelope_size bytes, there is always sufficient room.
11007            fidl::encoding::encode_in_envelope_optional::<
11008                RegisterBufferCollectionUsage,
11009                fidl::encoding::DefaultFuchsiaResourceDialect,
11010            >(
11011                self.usage.as_ref().map(
11012                    <RegisterBufferCollectionUsage as fidl::encoding::ValueTypeMarker>::borrow,
11013                ),
11014                encoder,
11015                offset + cur_offset,
11016                depth,
11017            )?;
11018
11019            _prev_end_offset = cur_offset + envelope_size;
11020            if 4 > max_ordinal {
11021                return Ok(());
11022            }
11023
11024            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11025            // are envelope_size bytes.
11026            let cur_offset: usize = (4 - 1) * envelope_size;
11027
11028            // Zero reserved fields.
11029            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11030
11031            // Safety:
11032            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11033            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11034            //   envelope_size bytes, there is always sufficient room.
11035            fidl::encoding::encode_in_envelope_optional::<
11036                RegisterBufferCollectionUsages,
11037                fidl::encoding::DefaultFuchsiaResourceDialect,
11038            >(
11039                self.usages.as_ref().map(
11040                    <RegisterBufferCollectionUsages as fidl::encoding::ValueTypeMarker>::borrow,
11041                ),
11042                encoder,
11043                offset + cur_offset,
11044                depth,
11045            )?;
11046
11047            _prev_end_offset = cur_offset + envelope_size;
11048            if 5 > max_ordinal {
11049                return Ok(());
11050            }
11051
11052            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11053            // are envelope_size bytes.
11054            let cur_offset: usize = (5 - 1) * envelope_size;
11055
11056            // Zero reserved fields.
11057            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11058
11059            // Safety:
11060            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11061            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11062            //   envelope_size bytes, there is always sufficient room.
11063            fidl::encoding::encode_in_envelope_optional::<
11064                fidl::encoding::Endpoint<
11065                    fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem2::BufferCollectionTokenMarker>,
11066                >,
11067                fidl::encoding::DefaultFuchsiaResourceDialect,
11068            >(
11069                self.buffer_collection_token2.as_mut().map(
11070                    <fidl::encoding::Endpoint<
11071                        fidl::endpoints::ClientEnd<
11072                            fidl_fuchsia_sysmem2::BufferCollectionTokenMarker,
11073                        >,
11074                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
11075                ),
11076                encoder,
11077                offset + cur_offset,
11078                depth,
11079            )?;
11080
11081            _prev_end_offset = cur_offset + envelope_size;
11082
11083            Ok(())
11084        }
11085    }
11086
11087    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11088        for RegisterBufferCollectionArgs
11089    {
11090        #[inline(always)]
11091        fn new_empty() -> Self {
11092            Self::default()
11093        }
11094
11095        unsafe fn decode(
11096            &mut self,
11097            decoder: &mut fidl::encoding::Decoder<
11098                '_,
11099                fidl::encoding::DefaultFuchsiaResourceDialect,
11100            >,
11101            offset: usize,
11102            mut depth: fidl::encoding::Depth,
11103        ) -> fidl::Result<()> {
11104            decoder.debug_check_bounds::<Self>(offset);
11105            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
11106                None => return Err(fidl::Error::NotNullable),
11107                Some(len) => len,
11108            };
11109            // Calling decoder.out_of_line_offset(0) is not allowed.
11110            if len == 0 {
11111                return Ok(());
11112            };
11113            depth.increment()?;
11114            let envelope_size = 8;
11115            let bytes_len = len * envelope_size;
11116            let offset = decoder.out_of_line_offset(bytes_len)?;
11117            // Decode the envelope for each type.
11118            let mut _next_ordinal_to_read = 0;
11119            let mut next_offset = offset;
11120            let end_offset = offset + bytes_len;
11121            _next_ordinal_to_read += 1;
11122            if next_offset >= end_offset {
11123                return Ok(());
11124            }
11125
11126            // Decode unknown envelopes for gaps in ordinals.
11127            while _next_ordinal_to_read < 1 {
11128                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11129                _next_ordinal_to_read += 1;
11130                next_offset += envelope_size;
11131            }
11132
11133            let next_out_of_line = decoder.next_out_of_line();
11134            let handles_before = decoder.remaining_handles();
11135            if let Some((inlined, num_bytes, num_handles)) =
11136                fidl::encoding::decode_envelope_header(decoder, next_offset)?
11137            {
11138                let member_inline_size =
11139                    <BufferCollectionExportToken as fidl::encoding::TypeMarker>::inline_size(
11140                        decoder.context,
11141                    );
11142                if inlined != (member_inline_size <= 4) {
11143                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
11144                }
11145                let inner_offset;
11146                let mut inner_depth = depth.clone();
11147                if inlined {
11148                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11149                    inner_offset = next_offset;
11150                } else {
11151                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11152                    inner_depth.increment()?;
11153                }
11154                let val_ref = self.export_token.get_or_insert_with(|| {
11155                    fidl::new_empty!(
11156                        BufferCollectionExportToken,
11157                        fidl::encoding::DefaultFuchsiaResourceDialect
11158                    )
11159                });
11160                fidl::decode!(
11161                    BufferCollectionExportToken,
11162                    fidl::encoding::DefaultFuchsiaResourceDialect,
11163                    val_ref,
11164                    decoder,
11165                    inner_offset,
11166                    inner_depth
11167                )?;
11168                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11169                {
11170                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
11171                }
11172                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11173                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11174                }
11175            }
11176
11177            next_offset += envelope_size;
11178            _next_ordinal_to_read += 1;
11179            if next_offset >= end_offset {
11180                return Ok(());
11181            }
11182
11183            // Decode unknown envelopes for gaps in ordinals.
11184            while _next_ordinal_to_read < 2 {
11185                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11186                _next_ordinal_to_read += 1;
11187                next_offset += envelope_size;
11188            }
11189
11190            let next_out_of_line = decoder.next_out_of_line();
11191            let handles_before = decoder.remaining_handles();
11192            if let Some((inlined, num_bytes, num_handles)) =
11193                fidl::encoding::decode_envelope_header(decoder, next_offset)?
11194            {
11195                let member_inline_size = <fidl::encoding::Endpoint<
11196                    fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem::BufferCollectionTokenMarker>,
11197                > as fidl::encoding::TypeMarker>::inline_size(
11198                    decoder.context
11199                );
11200                if inlined != (member_inline_size <= 4) {
11201                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
11202                }
11203                let inner_offset;
11204                let mut inner_depth = depth.clone();
11205                if inlined {
11206                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11207                    inner_offset = next_offset;
11208                } else {
11209                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11210                    inner_depth.increment()?;
11211                }
11212                let val_ref = self.buffer_collection_token.get_or_insert_with(|| {
11213                    fidl::new_empty!(
11214                        fidl::encoding::Endpoint<
11215                            fidl::endpoints::ClientEnd<
11216                                fidl_fuchsia_sysmem::BufferCollectionTokenMarker,
11217                            >,
11218                        >,
11219                        fidl::encoding::DefaultFuchsiaResourceDialect
11220                    )
11221                });
11222                fidl::decode!(
11223                    fidl::encoding::Endpoint<
11224                        fidl::endpoints::ClientEnd<
11225                            fidl_fuchsia_sysmem::BufferCollectionTokenMarker,
11226                        >,
11227                    >,
11228                    fidl::encoding::DefaultFuchsiaResourceDialect,
11229                    val_ref,
11230                    decoder,
11231                    inner_offset,
11232                    inner_depth
11233                )?;
11234                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11235                {
11236                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
11237                }
11238                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11239                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11240                }
11241            }
11242
11243            next_offset += envelope_size;
11244            _next_ordinal_to_read += 1;
11245            if next_offset >= end_offset {
11246                return Ok(());
11247            }
11248
11249            // Decode unknown envelopes for gaps in ordinals.
11250            while _next_ordinal_to_read < 3 {
11251                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11252                _next_ordinal_to_read += 1;
11253                next_offset += envelope_size;
11254            }
11255
11256            let next_out_of_line = decoder.next_out_of_line();
11257            let handles_before = decoder.remaining_handles();
11258            if let Some((inlined, num_bytes, num_handles)) =
11259                fidl::encoding::decode_envelope_header(decoder, next_offset)?
11260            {
11261                let member_inline_size =
11262                    <RegisterBufferCollectionUsage as fidl::encoding::TypeMarker>::inline_size(
11263                        decoder.context,
11264                    );
11265                if inlined != (member_inline_size <= 4) {
11266                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
11267                }
11268                let inner_offset;
11269                let mut inner_depth = depth.clone();
11270                if inlined {
11271                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11272                    inner_offset = next_offset;
11273                } else {
11274                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11275                    inner_depth.increment()?;
11276                }
11277                let val_ref = self.usage.get_or_insert_with(|| {
11278                    fidl::new_empty!(
11279                        RegisterBufferCollectionUsage,
11280                        fidl::encoding::DefaultFuchsiaResourceDialect
11281                    )
11282                });
11283                fidl::decode!(
11284                    RegisterBufferCollectionUsage,
11285                    fidl::encoding::DefaultFuchsiaResourceDialect,
11286                    val_ref,
11287                    decoder,
11288                    inner_offset,
11289                    inner_depth
11290                )?;
11291                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11292                {
11293                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
11294                }
11295                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11296                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11297                }
11298            }
11299
11300            next_offset += envelope_size;
11301            _next_ordinal_to_read += 1;
11302            if next_offset >= end_offset {
11303                return Ok(());
11304            }
11305
11306            // Decode unknown envelopes for gaps in ordinals.
11307            while _next_ordinal_to_read < 4 {
11308                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11309                _next_ordinal_to_read += 1;
11310                next_offset += envelope_size;
11311            }
11312
11313            let next_out_of_line = decoder.next_out_of_line();
11314            let handles_before = decoder.remaining_handles();
11315            if let Some((inlined, num_bytes, num_handles)) =
11316                fidl::encoding::decode_envelope_header(decoder, next_offset)?
11317            {
11318                let member_inline_size =
11319                    <RegisterBufferCollectionUsages as fidl::encoding::TypeMarker>::inline_size(
11320                        decoder.context,
11321                    );
11322                if inlined != (member_inline_size <= 4) {
11323                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
11324                }
11325                let inner_offset;
11326                let mut inner_depth = depth.clone();
11327                if inlined {
11328                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11329                    inner_offset = next_offset;
11330                } else {
11331                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11332                    inner_depth.increment()?;
11333                }
11334                let val_ref = self.usages.get_or_insert_with(|| {
11335                    fidl::new_empty!(
11336                        RegisterBufferCollectionUsages,
11337                        fidl::encoding::DefaultFuchsiaResourceDialect
11338                    )
11339                });
11340                fidl::decode!(
11341                    RegisterBufferCollectionUsages,
11342                    fidl::encoding::DefaultFuchsiaResourceDialect,
11343                    val_ref,
11344                    decoder,
11345                    inner_offset,
11346                    inner_depth
11347                )?;
11348                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11349                {
11350                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
11351                }
11352                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11353                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11354                }
11355            }
11356
11357            next_offset += envelope_size;
11358            _next_ordinal_to_read += 1;
11359            if next_offset >= end_offset {
11360                return Ok(());
11361            }
11362
11363            // Decode unknown envelopes for gaps in ordinals.
11364            while _next_ordinal_to_read < 5 {
11365                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11366                _next_ordinal_to_read += 1;
11367                next_offset += envelope_size;
11368            }
11369
11370            let next_out_of_line = decoder.next_out_of_line();
11371            let handles_before = decoder.remaining_handles();
11372            if let Some((inlined, num_bytes, num_handles)) =
11373                fidl::encoding::decode_envelope_header(decoder, next_offset)?
11374            {
11375                let member_inline_size = <fidl::encoding::Endpoint<
11376                    fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem2::BufferCollectionTokenMarker>,
11377                > as fidl::encoding::TypeMarker>::inline_size(
11378                    decoder.context
11379                );
11380                if inlined != (member_inline_size <= 4) {
11381                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
11382                }
11383                let inner_offset;
11384                let mut inner_depth = depth.clone();
11385                if inlined {
11386                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11387                    inner_offset = next_offset;
11388                } else {
11389                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11390                    inner_depth.increment()?;
11391                }
11392                let val_ref = self.buffer_collection_token2.get_or_insert_with(|| {
11393                    fidl::new_empty!(
11394                        fidl::encoding::Endpoint<
11395                            fidl::endpoints::ClientEnd<
11396                                fidl_fuchsia_sysmem2::BufferCollectionTokenMarker,
11397                            >,
11398                        >,
11399                        fidl::encoding::DefaultFuchsiaResourceDialect
11400                    )
11401                });
11402                fidl::decode!(
11403                    fidl::encoding::Endpoint<
11404                        fidl::endpoints::ClientEnd<
11405                            fidl_fuchsia_sysmem2::BufferCollectionTokenMarker,
11406                        >,
11407                    >,
11408                    fidl::encoding::DefaultFuchsiaResourceDialect,
11409                    val_ref,
11410                    decoder,
11411                    inner_offset,
11412                    inner_depth
11413                )?;
11414                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11415                {
11416                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
11417                }
11418                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11419                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11420                }
11421            }
11422
11423            next_offset += envelope_size;
11424
11425            // Decode the remaining unknown envelopes.
11426            while next_offset < end_offset {
11427                _next_ordinal_to_read += 1;
11428                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11429                next_offset += envelope_size;
11430            }
11431
11432            Ok(())
11433        }
11434    }
11435
11436    impl ScreenCaptureConfig {
11437        #[inline(always)]
11438        fn max_ordinal_present(&self) -> u64 {
11439            if let Some(_) = self.rotation {
11440                return 4;
11441            }
11442            if let Some(_) = self.buffer_count {
11443                return 3;
11444            }
11445            if let Some(_) = self.size {
11446                return 2;
11447            }
11448            if let Some(_) = self.import_token {
11449                return 1;
11450            }
11451            0
11452        }
11453    }
11454
11455    impl fidl::encoding::ResourceTypeMarker for ScreenCaptureConfig {
11456        type Borrowed<'a> = &'a mut Self;
11457        fn take_or_borrow<'a>(
11458            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11459        ) -> Self::Borrowed<'a> {
11460            value
11461        }
11462    }
11463
11464    unsafe impl fidl::encoding::TypeMarker for ScreenCaptureConfig {
11465        type Owned = Self;
11466
11467        #[inline(always)]
11468        fn inline_align(_context: fidl::encoding::Context) -> usize {
11469            8
11470        }
11471
11472        #[inline(always)]
11473        fn inline_size(_context: fidl::encoding::Context) -> usize {
11474            16
11475        }
11476    }
11477
11478    unsafe impl
11479        fidl::encoding::Encode<ScreenCaptureConfig, fidl::encoding::DefaultFuchsiaResourceDialect>
11480        for &mut ScreenCaptureConfig
11481    {
11482        unsafe fn encode(
11483            self,
11484            encoder: &mut fidl::encoding::Encoder<
11485                '_,
11486                fidl::encoding::DefaultFuchsiaResourceDialect,
11487            >,
11488            offset: usize,
11489            mut depth: fidl::encoding::Depth,
11490        ) -> fidl::Result<()> {
11491            encoder.debug_check_bounds::<ScreenCaptureConfig>(offset);
11492            // Vector header
11493            let max_ordinal: u64 = self.max_ordinal_present();
11494            encoder.write_num(max_ordinal, offset);
11495            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
11496            // Calling encoder.out_of_line_offset(0) is not allowed.
11497            if max_ordinal == 0 {
11498                return Ok(());
11499            }
11500            depth.increment()?;
11501            let envelope_size = 8;
11502            let bytes_len = max_ordinal as usize * envelope_size;
11503            #[allow(unused_variables)]
11504            let offset = encoder.out_of_line_offset(bytes_len);
11505            let mut _prev_end_offset: usize = 0;
11506            if 1 > max_ordinal {
11507                return Ok(());
11508            }
11509
11510            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11511            // are envelope_size bytes.
11512            let cur_offset: usize = (1 - 1) * envelope_size;
11513
11514            // Zero reserved fields.
11515            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11516
11517            // Safety:
11518            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11519            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11520            //   envelope_size bytes, there is always sufficient room.
11521            fidl::encoding::encode_in_envelope_optional::<BufferCollectionImportToken, fidl::encoding::DefaultFuchsiaResourceDialect>(
11522            self.import_token.as_mut().map(<BufferCollectionImportToken as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
11523            encoder, offset + cur_offset, depth
11524        )?;
11525
11526            _prev_end_offset = cur_offset + envelope_size;
11527            if 2 > max_ordinal {
11528                return Ok(());
11529            }
11530
11531            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11532            // are envelope_size bytes.
11533            let cur_offset: usize = (2 - 1) * envelope_size;
11534
11535            // Zero reserved fields.
11536            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11537
11538            // Safety:
11539            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11540            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11541            //   envelope_size bytes, there is always sufficient room.
11542            fidl::encoding::encode_in_envelope_optional::<
11543                fidl_fuchsia_math::SizeU,
11544                fidl::encoding::DefaultFuchsiaResourceDialect,
11545            >(
11546                self.size
11547                    .as_ref()
11548                    .map(<fidl_fuchsia_math::SizeU as fidl::encoding::ValueTypeMarker>::borrow),
11549                encoder,
11550                offset + cur_offset,
11551                depth,
11552            )?;
11553
11554            _prev_end_offset = cur_offset + envelope_size;
11555            if 3 > max_ordinal {
11556                return Ok(());
11557            }
11558
11559            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11560            // are envelope_size bytes.
11561            let cur_offset: usize = (3 - 1) * envelope_size;
11562
11563            // Zero reserved fields.
11564            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11565
11566            // Safety:
11567            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11568            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11569            //   envelope_size bytes, there is always sufficient room.
11570            fidl::encoding::encode_in_envelope_optional::<
11571                u32,
11572                fidl::encoding::DefaultFuchsiaResourceDialect,
11573            >(
11574                self.buffer_count.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
11575                encoder,
11576                offset + cur_offset,
11577                depth,
11578            )?;
11579
11580            _prev_end_offset = cur_offset + envelope_size;
11581            if 4 > max_ordinal {
11582                return Ok(());
11583            }
11584
11585            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11586            // are envelope_size bytes.
11587            let cur_offset: usize = (4 - 1) * envelope_size;
11588
11589            // Zero reserved fields.
11590            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11591
11592            // Safety:
11593            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11594            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11595            //   envelope_size bytes, there is always sufficient room.
11596            fidl::encoding::encode_in_envelope_optional::<
11597                Rotation,
11598                fidl::encoding::DefaultFuchsiaResourceDialect,
11599            >(
11600                self.rotation.as_ref().map(<Rotation as fidl::encoding::ValueTypeMarker>::borrow),
11601                encoder,
11602                offset + cur_offset,
11603                depth,
11604            )?;
11605
11606            _prev_end_offset = cur_offset + envelope_size;
11607
11608            Ok(())
11609        }
11610    }
11611
11612    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11613        for ScreenCaptureConfig
11614    {
11615        #[inline(always)]
11616        fn new_empty() -> Self {
11617            Self::default()
11618        }
11619
11620        unsafe fn decode(
11621            &mut self,
11622            decoder: &mut fidl::encoding::Decoder<
11623                '_,
11624                fidl::encoding::DefaultFuchsiaResourceDialect,
11625            >,
11626            offset: usize,
11627            mut depth: fidl::encoding::Depth,
11628        ) -> fidl::Result<()> {
11629            decoder.debug_check_bounds::<Self>(offset);
11630            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
11631                None => return Err(fidl::Error::NotNullable),
11632                Some(len) => len,
11633            };
11634            // Calling decoder.out_of_line_offset(0) is not allowed.
11635            if len == 0 {
11636                return Ok(());
11637            };
11638            depth.increment()?;
11639            let envelope_size = 8;
11640            let bytes_len = len * envelope_size;
11641            let offset = decoder.out_of_line_offset(bytes_len)?;
11642            // Decode the envelope for each type.
11643            let mut _next_ordinal_to_read = 0;
11644            let mut next_offset = offset;
11645            let end_offset = offset + bytes_len;
11646            _next_ordinal_to_read += 1;
11647            if next_offset >= end_offset {
11648                return Ok(());
11649            }
11650
11651            // Decode unknown envelopes for gaps in ordinals.
11652            while _next_ordinal_to_read < 1 {
11653                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11654                _next_ordinal_to_read += 1;
11655                next_offset += envelope_size;
11656            }
11657
11658            let next_out_of_line = decoder.next_out_of_line();
11659            let handles_before = decoder.remaining_handles();
11660            if let Some((inlined, num_bytes, num_handles)) =
11661                fidl::encoding::decode_envelope_header(decoder, next_offset)?
11662            {
11663                let member_inline_size =
11664                    <BufferCollectionImportToken as fidl::encoding::TypeMarker>::inline_size(
11665                        decoder.context,
11666                    );
11667                if inlined != (member_inline_size <= 4) {
11668                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
11669                }
11670                let inner_offset;
11671                let mut inner_depth = depth.clone();
11672                if inlined {
11673                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11674                    inner_offset = next_offset;
11675                } else {
11676                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11677                    inner_depth.increment()?;
11678                }
11679                let val_ref = self.import_token.get_or_insert_with(|| {
11680                    fidl::new_empty!(
11681                        BufferCollectionImportToken,
11682                        fidl::encoding::DefaultFuchsiaResourceDialect
11683                    )
11684                });
11685                fidl::decode!(
11686                    BufferCollectionImportToken,
11687                    fidl::encoding::DefaultFuchsiaResourceDialect,
11688                    val_ref,
11689                    decoder,
11690                    inner_offset,
11691                    inner_depth
11692                )?;
11693                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11694                {
11695                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
11696                }
11697                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11698                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11699                }
11700            }
11701
11702            next_offset += envelope_size;
11703            _next_ordinal_to_read += 1;
11704            if next_offset >= end_offset {
11705                return Ok(());
11706            }
11707
11708            // Decode unknown envelopes for gaps in ordinals.
11709            while _next_ordinal_to_read < 2 {
11710                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11711                _next_ordinal_to_read += 1;
11712                next_offset += envelope_size;
11713            }
11714
11715            let next_out_of_line = decoder.next_out_of_line();
11716            let handles_before = decoder.remaining_handles();
11717            if let Some((inlined, num_bytes, num_handles)) =
11718                fidl::encoding::decode_envelope_header(decoder, next_offset)?
11719            {
11720                let member_inline_size =
11721                    <fidl_fuchsia_math::SizeU as fidl::encoding::TypeMarker>::inline_size(
11722                        decoder.context,
11723                    );
11724                if inlined != (member_inline_size <= 4) {
11725                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
11726                }
11727                let inner_offset;
11728                let mut inner_depth = depth.clone();
11729                if inlined {
11730                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11731                    inner_offset = next_offset;
11732                } else {
11733                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11734                    inner_depth.increment()?;
11735                }
11736                let val_ref = self.size.get_or_insert_with(|| {
11737                    fidl::new_empty!(
11738                        fidl_fuchsia_math::SizeU,
11739                        fidl::encoding::DefaultFuchsiaResourceDialect
11740                    )
11741                });
11742                fidl::decode!(
11743                    fidl_fuchsia_math::SizeU,
11744                    fidl::encoding::DefaultFuchsiaResourceDialect,
11745                    val_ref,
11746                    decoder,
11747                    inner_offset,
11748                    inner_depth
11749                )?;
11750                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11751                {
11752                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
11753                }
11754                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11755                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11756                }
11757            }
11758
11759            next_offset += envelope_size;
11760            _next_ordinal_to_read += 1;
11761            if next_offset >= end_offset {
11762                return Ok(());
11763            }
11764
11765            // Decode unknown envelopes for gaps in ordinals.
11766            while _next_ordinal_to_read < 3 {
11767                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11768                _next_ordinal_to_read += 1;
11769                next_offset += envelope_size;
11770            }
11771
11772            let next_out_of_line = decoder.next_out_of_line();
11773            let handles_before = decoder.remaining_handles();
11774            if let Some((inlined, num_bytes, num_handles)) =
11775                fidl::encoding::decode_envelope_header(decoder, next_offset)?
11776            {
11777                let member_inline_size =
11778                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
11779                if inlined != (member_inline_size <= 4) {
11780                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
11781                }
11782                let inner_offset;
11783                let mut inner_depth = depth.clone();
11784                if inlined {
11785                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11786                    inner_offset = next_offset;
11787                } else {
11788                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11789                    inner_depth.increment()?;
11790                }
11791                let val_ref = self.buffer_count.get_or_insert_with(|| {
11792                    fidl::new_empty!(u32, fidl::encoding::DefaultFuchsiaResourceDialect)
11793                });
11794                fidl::decode!(
11795                    u32,
11796                    fidl::encoding::DefaultFuchsiaResourceDialect,
11797                    val_ref,
11798                    decoder,
11799                    inner_offset,
11800                    inner_depth
11801                )?;
11802                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11803                {
11804                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
11805                }
11806                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11807                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11808                }
11809            }
11810
11811            next_offset += envelope_size;
11812            _next_ordinal_to_read += 1;
11813            if next_offset >= end_offset {
11814                return Ok(());
11815            }
11816
11817            // Decode unknown envelopes for gaps in ordinals.
11818            while _next_ordinal_to_read < 4 {
11819                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11820                _next_ordinal_to_read += 1;
11821                next_offset += envelope_size;
11822            }
11823
11824            let next_out_of_line = decoder.next_out_of_line();
11825            let handles_before = decoder.remaining_handles();
11826            if let Some((inlined, num_bytes, num_handles)) =
11827                fidl::encoding::decode_envelope_header(decoder, next_offset)?
11828            {
11829                let member_inline_size =
11830                    <Rotation as fidl::encoding::TypeMarker>::inline_size(decoder.context);
11831                if inlined != (member_inline_size <= 4) {
11832                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
11833                }
11834                let inner_offset;
11835                let mut inner_depth = depth.clone();
11836                if inlined {
11837                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11838                    inner_offset = next_offset;
11839                } else {
11840                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11841                    inner_depth.increment()?;
11842                }
11843                let val_ref = self.rotation.get_or_insert_with(|| {
11844                    fidl::new_empty!(Rotation, fidl::encoding::DefaultFuchsiaResourceDialect)
11845                });
11846                fidl::decode!(
11847                    Rotation,
11848                    fidl::encoding::DefaultFuchsiaResourceDialect,
11849                    val_ref,
11850                    decoder,
11851                    inner_offset,
11852                    inner_depth
11853                )?;
11854                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11855                {
11856                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
11857                }
11858                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11859                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11860                }
11861            }
11862
11863            next_offset += envelope_size;
11864
11865            // Decode the remaining unknown envelopes.
11866            while next_offset < end_offset {
11867                _next_ordinal_to_read += 1;
11868                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11869                next_offset += envelope_size;
11870            }
11871
11872            Ok(())
11873        }
11874    }
11875
11876    impl ScreenshotTakeFileRequest {
11877        #[inline(always)]
11878        fn max_ordinal_present(&self) -> u64 {
11879            if let Some(_) = self.format {
11880                return 1;
11881            }
11882            0
11883        }
11884    }
11885
11886    impl fidl::encoding::ResourceTypeMarker for ScreenshotTakeFileRequest {
11887        type Borrowed<'a> = &'a mut Self;
11888        fn take_or_borrow<'a>(
11889            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11890        ) -> Self::Borrowed<'a> {
11891            value
11892        }
11893    }
11894
11895    unsafe impl fidl::encoding::TypeMarker for ScreenshotTakeFileRequest {
11896        type Owned = Self;
11897
11898        #[inline(always)]
11899        fn inline_align(_context: fidl::encoding::Context) -> usize {
11900            8
11901        }
11902
11903        #[inline(always)]
11904        fn inline_size(_context: fidl::encoding::Context) -> usize {
11905            16
11906        }
11907    }
11908
11909    unsafe impl
11910        fidl::encoding::Encode<
11911            ScreenshotTakeFileRequest,
11912            fidl::encoding::DefaultFuchsiaResourceDialect,
11913        > for &mut ScreenshotTakeFileRequest
11914    {
11915        unsafe fn encode(
11916            self,
11917            encoder: &mut fidl::encoding::Encoder<
11918                '_,
11919                fidl::encoding::DefaultFuchsiaResourceDialect,
11920            >,
11921            offset: usize,
11922            mut depth: fidl::encoding::Depth,
11923        ) -> fidl::Result<()> {
11924            encoder.debug_check_bounds::<ScreenshotTakeFileRequest>(offset);
11925            // Vector header
11926            let max_ordinal: u64 = self.max_ordinal_present();
11927            encoder.write_num(max_ordinal, offset);
11928            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
11929            // Calling encoder.out_of_line_offset(0) is not allowed.
11930            if max_ordinal == 0 {
11931                return Ok(());
11932            }
11933            depth.increment()?;
11934            let envelope_size = 8;
11935            let bytes_len = max_ordinal as usize * envelope_size;
11936            #[allow(unused_variables)]
11937            let offset = encoder.out_of_line_offset(bytes_len);
11938            let mut _prev_end_offset: usize = 0;
11939            if 1 > max_ordinal {
11940                return Ok(());
11941            }
11942
11943            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11944            // are envelope_size bytes.
11945            let cur_offset: usize = (1 - 1) * envelope_size;
11946
11947            // Zero reserved fields.
11948            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11949
11950            // Safety:
11951            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11952            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11953            //   envelope_size bytes, there is always sufficient room.
11954            fidl::encoding::encode_in_envelope_optional::<
11955                ScreenshotFormat,
11956                fidl::encoding::DefaultFuchsiaResourceDialect,
11957            >(
11958                self.format
11959                    .as_ref()
11960                    .map(<ScreenshotFormat as fidl::encoding::ValueTypeMarker>::borrow),
11961                encoder,
11962                offset + cur_offset,
11963                depth,
11964            )?;
11965
11966            _prev_end_offset = cur_offset + envelope_size;
11967
11968            Ok(())
11969        }
11970    }
11971
11972    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11973        for ScreenshotTakeFileRequest
11974    {
11975        #[inline(always)]
11976        fn new_empty() -> Self {
11977            Self::default()
11978        }
11979
11980        unsafe fn decode(
11981            &mut self,
11982            decoder: &mut fidl::encoding::Decoder<
11983                '_,
11984                fidl::encoding::DefaultFuchsiaResourceDialect,
11985            >,
11986            offset: usize,
11987            mut depth: fidl::encoding::Depth,
11988        ) -> fidl::Result<()> {
11989            decoder.debug_check_bounds::<Self>(offset);
11990            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
11991                None => return Err(fidl::Error::NotNullable),
11992                Some(len) => len,
11993            };
11994            // Calling decoder.out_of_line_offset(0) is not allowed.
11995            if len == 0 {
11996                return Ok(());
11997            };
11998            depth.increment()?;
11999            let envelope_size = 8;
12000            let bytes_len = len * envelope_size;
12001            let offset = decoder.out_of_line_offset(bytes_len)?;
12002            // Decode the envelope for each type.
12003            let mut _next_ordinal_to_read = 0;
12004            let mut next_offset = offset;
12005            let end_offset = offset + bytes_len;
12006            _next_ordinal_to_read += 1;
12007            if next_offset >= end_offset {
12008                return Ok(());
12009            }
12010
12011            // Decode unknown envelopes for gaps in ordinals.
12012            while _next_ordinal_to_read < 1 {
12013                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12014                _next_ordinal_to_read += 1;
12015                next_offset += envelope_size;
12016            }
12017
12018            let next_out_of_line = decoder.next_out_of_line();
12019            let handles_before = decoder.remaining_handles();
12020            if let Some((inlined, num_bytes, num_handles)) =
12021                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12022            {
12023                let member_inline_size =
12024                    <ScreenshotFormat as fidl::encoding::TypeMarker>::inline_size(decoder.context);
12025                if inlined != (member_inline_size <= 4) {
12026                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12027                }
12028                let inner_offset;
12029                let mut inner_depth = depth.clone();
12030                if inlined {
12031                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12032                    inner_offset = next_offset;
12033                } else {
12034                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12035                    inner_depth.increment()?;
12036                }
12037                let val_ref = self.format.get_or_insert_with(|| {
12038                    fidl::new_empty!(
12039                        ScreenshotFormat,
12040                        fidl::encoding::DefaultFuchsiaResourceDialect
12041                    )
12042                });
12043                fidl::decode!(
12044                    ScreenshotFormat,
12045                    fidl::encoding::DefaultFuchsiaResourceDialect,
12046                    val_ref,
12047                    decoder,
12048                    inner_offset,
12049                    inner_depth
12050                )?;
12051                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12052                {
12053                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12054                }
12055                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12056                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12057                }
12058            }
12059
12060            next_offset += envelope_size;
12061
12062            // Decode the remaining unknown envelopes.
12063            while next_offset < end_offset {
12064                _next_ordinal_to_read += 1;
12065                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12066                next_offset += envelope_size;
12067            }
12068
12069            Ok(())
12070        }
12071    }
12072
12073    impl ScreenshotTakeFileResponse {
12074        #[inline(always)]
12075        fn max_ordinal_present(&self) -> u64 {
12076            if let Some(_) = self.size {
12077                return 2;
12078            }
12079            if let Some(_) = self.file {
12080                return 1;
12081            }
12082            0
12083        }
12084    }
12085
12086    impl fidl::encoding::ResourceTypeMarker for ScreenshotTakeFileResponse {
12087        type Borrowed<'a> = &'a mut Self;
12088        fn take_or_borrow<'a>(
12089            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12090        ) -> Self::Borrowed<'a> {
12091            value
12092        }
12093    }
12094
12095    unsafe impl fidl::encoding::TypeMarker for ScreenshotTakeFileResponse {
12096        type Owned = Self;
12097
12098        #[inline(always)]
12099        fn inline_align(_context: fidl::encoding::Context) -> usize {
12100            8
12101        }
12102
12103        #[inline(always)]
12104        fn inline_size(_context: fidl::encoding::Context) -> usize {
12105            16
12106        }
12107    }
12108
12109    unsafe impl
12110        fidl::encoding::Encode<
12111            ScreenshotTakeFileResponse,
12112            fidl::encoding::DefaultFuchsiaResourceDialect,
12113        > for &mut ScreenshotTakeFileResponse
12114    {
12115        unsafe fn encode(
12116            self,
12117            encoder: &mut fidl::encoding::Encoder<
12118                '_,
12119                fidl::encoding::DefaultFuchsiaResourceDialect,
12120            >,
12121            offset: usize,
12122            mut depth: fidl::encoding::Depth,
12123        ) -> fidl::Result<()> {
12124            encoder.debug_check_bounds::<ScreenshotTakeFileResponse>(offset);
12125            // Vector header
12126            let max_ordinal: u64 = self.max_ordinal_present();
12127            encoder.write_num(max_ordinal, offset);
12128            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
12129            // Calling encoder.out_of_line_offset(0) is not allowed.
12130            if max_ordinal == 0 {
12131                return Ok(());
12132            }
12133            depth.increment()?;
12134            let envelope_size = 8;
12135            let bytes_len = max_ordinal as usize * envelope_size;
12136            #[allow(unused_variables)]
12137            let offset = encoder.out_of_line_offset(bytes_len);
12138            let mut _prev_end_offset: usize = 0;
12139            if 1 > max_ordinal {
12140                return Ok(());
12141            }
12142
12143            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12144            // are envelope_size bytes.
12145            let cur_offset: usize = (1 - 1) * envelope_size;
12146
12147            // Zero reserved fields.
12148            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12149
12150            // Safety:
12151            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12152            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12153            //   envelope_size bytes, there is always sufficient room.
12154            fidl::encoding::encode_in_envelope_optional::<
12155                fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>>,
12156                fidl::encoding::DefaultFuchsiaResourceDialect,
12157            >(
12158                self.file.as_mut().map(
12159                    <fidl::encoding::Endpoint<
12160                        fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
12161                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
12162                ),
12163                encoder,
12164                offset + cur_offset,
12165                depth,
12166            )?;
12167
12168            _prev_end_offset = cur_offset + envelope_size;
12169            if 2 > max_ordinal {
12170                return Ok(());
12171            }
12172
12173            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12174            // are envelope_size bytes.
12175            let cur_offset: usize = (2 - 1) * envelope_size;
12176
12177            // Zero reserved fields.
12178            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12179
12180            // Safety:
12181            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12182            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12183            //   envelope_size bytes, there is always sufficient room.
12184            fidl::encoding::encode_in_envelope_optional::<
12185                fidl_fuchsia_math::SizeU,
12186                fidl::encoding::DefaultFuchsiaResourceDialect,
12187            >(
12188                self.size
12189                    .as_ref()
12190                    .map(<fidl_fuchsia_math::SizeU as fidl::encoding::ValueTypeMarker>::borrow),
12191                encoder,
12192                offset + cur_offset,
12193                depth,
12194            )?;
12195
12196            _prev_end_offset = cur_offset + envelope_size;
12197
12198            Ok(())
12199        }
12200    }
12201
12202    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
12203        for ScreenshotTakeFileResponse
12204    {
12205        #[inline(always)]
12206        fn new_empty() -> Self {
12207            Self::default()
12208        }
12209
12210        unsafe fn decode(
12211            &mut self,
12212            decoder: &mut fidl::encoding::Decoder<
12213                '_,
12214                fidl::encoding::DefaultFuchsiaResourceDialect,
12215            >,
12216            offset: usize,
12217            mut depth: fidl::encoding::Depth,
12218        ) -> fidl::Result<()> {
12219            decoder.debug_check_bounds::<Self>(offset);
12220            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
12221                None => return Err(fidl::Error::NotNullable),
12222                Some(len) => len,
12223            };
12224            // Calling decoder.out_of_line_offset(0) is not allowed.
12225            if len == 0 {
12226                return Ok(());
12227            };
12228            depth.increment()?;
12229            let envelope_size = 8;
12230            let bytes_len = len * envelope_size;
12231            let offset = decoder.out_of_line_offset(bytes_len)?;
12232            // Decode the envelope for each type.
12233            let mut _next_ordinal_to_read = 0;
12234            let mut next_offset = offset;
12235            let end_offset = offset + bytes_len;
12236            _next_ordinal_to_read += 1;
12237            if next_offset >= end_offset {
12238                return Ok(());
12239            }
12240
12241            // Decode unknown envelopes for gaps in ordinals.
12242            while _next_ordinal_to_read < 1 {
12243                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12244                _next_ordinal_to_read += 1;
12245                next_offset += envelope_size;
12246            }
12247
12248            let next_out_of_line = decoder.next_out_of_line();
12249            let handles_before = decoder.remaining_handles();
12250            if let Some((inlined, num_bytes, num_handles)) =
12251                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12252            {
12253                let member_inline_size = <fidl::encoding::Endpoint<
12254                    fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
12255                > as fidl::encoding::TypeMarker>::inline_size(
12256                    decoder.context
12257                );
12258                if inlined != (member_inline_size <= 4) {
12259                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12260                }
12261                let inner_offset;
12262                let mut inner_depth = depth.clone();
12263                if inlined {
12264                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12265                    inner_offset = next_offset;
12266                } else {
12267                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12268                    inner_depth.increment()?;
12269                }
12270                let val_ref = self.file.get_or_insert_with(|| {
12271                    fidl::new_empty!(
12272                        fidl::encoding::Endpoint<
12273                            fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
12274                        >,
12275                        fidl::encoding::DefaultFuchsiaResourceDialect
12276                    )
12277                });
12278                fidl::decode!(
12279                    fidl::encoding::Endpoint<
12280                        fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
12281                    >,
12282                    fidl::encoding::DefaultFuchsiaResourceDialect,
12283                    val_ref,
12284                    decoder,
12285                    inner_offset,
12286                    inner_depth
12287                )?;
12288                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12289                {
12290                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12291                }
12292                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12293                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12294                }
12295            }
12296
12297            next_offset += envelope_size;
12298            _next_ordinal_to_read += 1;
12299            if next_offset >= end_offset {
12300                return Ok(());
12301            }
12302
12303            // Decode unknown envelopes for gaps in ordinals.
12304            while _next_ordinal_to_read < 2 {
12305                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12306                _next_ordinal_to_read += 1;
12307                next_offset += envelope_size;
12308            }
12309
12310            let next_out_of_line = decoder.next_out_of_line();
12311            let handles_before = decoder.remaining_handles();
12312            if let Some((inlined, num_bytes, num_handles)) =
12313                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12314            {
12315                let member_inline_size =
12316                    <fidl_fuchsia_math::SizeU as fidl::encoding::TypeMarker>::inline_size(
12317                        decoder.context,
12318                    );
12319                if inlined != (member_inline_size <= 4) {
12320                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12321                }
12322                let inner_offset;
12323                let mut inner_depth = depth.clone();
12324                if inlined {
12325                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12326                    inner_offset = next_offset;
12327                } else {
12328                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12329                    inner_depth.increment()?;
12330                }
12331                let val_ref = self.size.get_or_insert_with(|| {
12332                    fidl::new_empty!(
12333                        fidl_fuchsia_math::SizeU,
12334                        fidl::encoding::DefaultFuchsiaResourceDialect
12335                    )
12336                });
12337                fidl::decode!(
12338                    fidl_fuchsia_math::SizeU,
12339                    fidl::encoding::DefaultFuchsiaResourceDialect,
12340                    val_ref,
12341                    decoder,
12342                    inner_offset,
12343                    inner_depth
12344                )?;
12345                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12346                {
12347                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12348                }
12349                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12350                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12351                }
12352            }
12353
12354            next_offset += envelope_size;
12355
12356            // Decode the remaining unknown envelopes.
12357            while next_offset < end_offset {
12358                _next_ordinal_to_read += 1;
12359                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12360                next_offset += envelope_size;
12361            }
12362
12363            Ok(())
12364        }
12365    }
12366
12367    impl ScreenshotTakeRequest {
12368        #[inline(always)]
12369        fn max_ordinal_present(&self) -> u64 {
12370            if let Some(_) = self.format {
12371                return 1;
12372            }
12373            0
12374        }
12375    }
12376
12377    impl fidl::encoding::ResourceTypeMarker for ScreenshotTakeRequest {
12378        type Borrowed<'a> = &'a mut Self;
12379        fn take_or_borrow<'a>(
12380            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12381        ) -> Self::Borrowed<'a> {
12382            value
12383        }
12384    }
12385
12386    unsafe impl fidl::encoding::TypeMarker for ScreenshotTakeRequest {
12387        type Owned = Self;
12388
12389        #[inline(always)]
12390        fn inline_align(_context: fidl::encoding::Context) -> usize {
12391            8
12392        }
12393
12394        #[inline(always)]
12395        fn inline_size(_context: fidl::encoding::Context) -> usize {
12396            16
12397        }
12398    }
12399
12400    unsafe impl
12401        fidl::encoding::Encode<ScreenshotTakeRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
12402        for &mut ScreenshotTakeRequest
12403    {
12404        unsafe fn encode(
12405            self,
12406            encoder: &mut fidl::encoding::Encoder<
12407                '_,
12408                fidl::encoding::DefaultFuchsiaResourceDialect,
12409            >,
12410            offset: usize,
12411            mut depth: fidl::encoding::Depth,
12412        ) -> fidl::Result<()> {
12413            encoder.debug_check_bounds::<ScreenshotTakeRequest>(offset);
12414            // Vector header
12415            let max_ordinal: u64 = self.max_ordinal_present();
12416            encoder.write_num(max_ordinal, offset);
12417            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
12418            // Calling encoder.out_of_line_offset(0) is not allowed.
12419            if max_ordinal == 0 {
12420                return Ok(());
12421            }
12422            depth.increment()?;
12423            let envelope_size = 8;
12424            let bytes_len = max_ordinal as usize * envelope_size;
12425            #[allow(unused_variables)]
12426            let offset = encoder.out_of_line_offset(bytes_len);
12427            let mut _prev_end_offset: usize = 0;
12428            if 1 > max_ordinal {
12429                return Ok(());
12430            }
12431
12432            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12433            // are envelope_size bytes.
12434            let cur_offset: usize = (1 - 1) * envelope_size;
12435
12436            // Zero reserved fields.
12437            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12438
12439            // Safety:
12440            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12441            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12442            //   envelope_size bytes, there is always sufficient room.
12443            fidl::encoding::encode_in_envelope_optional::<
12444                ScreenshotFormat,
12445                fidl::encoding::DefaultFuchsiaResourceDialect,
12446            >(
12447                self.format
12448                    .as_ref()
12449                    .map(<ScreenshotFormat as fidl::encoding::ValueTypeMarker>::borrow),
12450                encoder,
12451                offset + cur_offset,
12452                depth,
12453            )?;
12454
12455            _prev_end_offset = cur_offset + envelope_size;
12456
12457            Ok(())
12458        }
12459    }
12460
12461    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
12462        for ScreenshotTakeRequest
12463    {
12464        #[inline(always)]
12465        fn new_empty() -> Self {
12466            Self::default()
12467        }
12468
12469        unsafe fn decode(
12470            &mut self,
12471            decoder: &mut fidl::encoding::Decoder<
12472                '_,
12473                fidl::encoding::DefaultFuchsiaResourceDialect,
12474            >,
12475            offset: usize,
12476            mut depth: fidl::encoding::Depth,
12477        ) -> fidl::Result<()> {
12478            decoder.debug_check_bounds::<Self>(offset);
12479            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
12480                None => return Err(fidl::Error::NotNullable),
12481                Some(len) => len,
12482            };
12483            // Calling decoder.out_of_line_offset(0) is not allowed.
12484            if len == 0 {
12485                return Ok(());
12486            };
12487            depth.increment()?;
12488            let envelope_size = 8;
12489            let bytes_len = len * envelope_size;
12490            let offset = decoder.out_of_line_offset(bytes_len)?;
12491            // Decode the envelope for each type.
12492            let mut _next_ordinal_to_read = 0;
12493            let mut next_offset = offset;
12494            let end_offset = offset + bytes_len;
12495            _next_ordinal_to_read += 1;
12496            if next_offset >= end_offset {
12497                return Ok(());
12498            }
12499
12500            // Decode unknown envelopes for gaps in ordinals.
12501            while _next_ordinal_to_read < 1 {
12502                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12503                _next_ordinal_to_read += 1;
12504                next_offset += envelope_size;
12505            }
12506
12507            let next_out_of_line = decoder.next_out_of_line();
12508            let handles_before = decoder.remaining_handles();
12509            if let Some((inlined, num_bytes, num_handles)) =
12510                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12511            {
12512                let member_inline_size =
12513                    <ScreenshotFormat as fidl::encoding::TypeMarker>::inline_size(decoder.context);
12514                if inlined != (member_inline_size <= 4) {
12515                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12516                }
12517                let inner_offset;
12518                let mut inner_depth = depth.clone();
12519                if inlined {
12520                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12521                    inner_offset = next_offset;
12522                } else {
12523                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12524                    inner_depth.increment()?;
12525                }
12526                let val_ref = self.format.get_or_insert_with(|| {
12527                    fidl::new_empty!(
12528                        ScreenshotFormat,
12529                        fidl::encoding::DefaultFuchsiaResourceDialect
12530                    )
12531                });
12532                fidl::decode!(
12533                    ScreenshotFormat,
12534                    fidl::encoding::DefaultFuchsiaResourceDialect,
12535                    val_ref,
12536                    decoder,
12537                    inner_offset,
12538                    inner_depth
12539                )?;
12540                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12541                {
12542                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12543                }
12544                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12545                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12546                }
12547            }
12548
12549            next_offset += envelope_size;
12550
12551            // Decode the remaining unknown envelopes.
12552            while next_offset < end_offset {
12553                _next_ordinal_to_read += 1;
12554                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12555                next_offset += envelope_size;
12556            }
12557
12558            Ok(())
12559        }
12560    }
12561
12562    impl ScreenshotTakeResponse {
12563        #[inline(always)]
12564        fn max_ordinal_present(&self) -> u64 {
12565            if let Some(_) = self.size {
12566                return 2;
12567            }
12568            if let Some(_) = self.vmo {
12569                return 1;
12570            }
12571            0
12572        }
12573    }
12574
12575    impl fidl::encoding::ResourceTypeMarker for ScreenshotTakeResponse {
12576        type Borrowed<'a> = &'a mut Self;
12577        fn take_or_borrow<'a>(
12578            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12579        ) -> Self::Borrowed<'a> {
12580            value
12581        }
12582    }
12583
12584    unsafe impl fidl::encoding::TypeMarker for ScreenshotTakeResponse {
12585        type Owned = Self;
12586
12587        #[inline(always)]
12588        fn inline_align(_context: fidl::encoding::Context) -> usize {
12589            8
12590        }
12591
12592        #[inline(always)]
12593        fn inline_size(_context: fidl::encoding::Context) -> usize {
12594            16
12595        }
12596    }
12597
12598    unsafe impl
12599        fidl::encoding::Encode<
12600            ScreenshotTakeResponse,
12601            fidl::encoding::DefaultFuchsiaResourceDialect,
12602        > for &mut ScreenshotTakeResponse
12603    {
12604        unsafe fn encode(
12605            self,
12606            encoder: &mut fidl::encoding::Encoder<
12607                '_,
12608                fidl::encoding::DefaultFuchsiaResourceDialect,
12609            >,
12610            offset: usize,
12611            mut depth: fidl::encoding::Depth,
12612        ) -> fidl::Result<()> {
12613            encoder.debug_check_bounds::<ScreenshotTakeResponse>(offset);
12614            // Vector header
12615            let max_ordinal: u64 = self.max_ordinal_present();
12616            encoder.write_num(max_ordinal, offset);
12617            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
12618            // Calling encoder.out_of_line_offset(0) is not allowed.
12619            if max_ordinal == 0 {
12620                return Ok(());
12621            }
12622            depth.increment()?;
12623            let envelope_size = 8;
12624            let bytes_len = max_ordinal as usize * envelope_size;
12625            #[allow(unused_variables)]
12626            let offset = encoder.out_of_line_offset(bytes_len);
12627            let mut _prev_end_offset: usize = 0;
12628            if 1 > max_ordinal {
12629                return Ok(());
12630            }
12631
12632            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12633            // are envelope_size bytes.
12634            let cur_offset: usize = (1 - 1) * envelope_size;
12635
12636            // Zero reserved fields.
12637            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12638
12639            // Safety:
12640            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12641            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12642            //   envelope_size bytes, there is always sufficient room.
12643            fidl::encoding::encode_in_envelope_optional::<
12644                fidl::encoding::HandleType<
12645                    fidl::Vmo,
12646                    { fidl::ObjectType::VMO.into_raw() },
12647                    2147483648,
12648                >,
12649                fidl::encoding::DefaultFuchsiaResourceDialect,
12650            >(
12651                self.vmo.as_mut().map(
12652                    <fidl::encoding::HandleType<
12653                        fidl::Vmo,
12654                        { fidl::ObjectType::VMO.into_raw() },
12655                        2147483648,
12656                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
12657                ),
12658                encoder,
12659                offset + cur_offset,
12660                depth,
12661            )?;
12662
12663            _prev_end_offset = cur_offset + envelope_size;
12664            if 2 > max_ordinal {
12665                return Ok(());
12666            }
12667
12668            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12669            // are envelope_size bytes.
12670            let cur_offset: usize = (2 - 1) * envelope_size;
12671
12672            // Zero reserved fields.
12673            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12674
12675            // Safety:
12676            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12677            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12678            //   envelope_size bytes, there is always sufficient room.
12679            fidl::encoding::encode_in_envelope_optional::<
12680                fidl_fuchsia_math::SizeU,
12681                fidl::encoding::DefaultFuchsiaResourceDialect,
12682            >(
12683                self.size
12684                    .as_ref()
12685                    .map(<fidl_fuchsia_math::SizeU as fidl::encoding::ValueTypeMarker>::borrow),
12686                encoder,
12687                offset + cur_offset,
12688                depth,
12689            )?;
12690
12691            _prev_end_offset = cur_offset + envelope_size;
12692
12693            Ok(())
12694        }
12695    }
12696
12697    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
12698        for ScreenshotTakeResponse
12699    {
12700        #[inline(always)]
12701        fn new_empty() -> Self {
12702            Self::default()
12703        }
12704
12705        unsafe fn decode(
12706            &mut self,
12707            decoder: &mut fidl::encoding::Decoder<
12708                '_,
12709                fidl::encoding::DefaultFuchsiaResourceDialect,
12710            >,
12711            offset: usize,
12712            mut depth: fidl::encoding::Depth,
12713        ) -> fidl::Result<()> {
12714            decoder.debug_check_bounds::<Self>(offset);
12715            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
12716                None => return Err(fidl::Error::NotNullable),
12717                Some(len) => len,
12718            };
12719            // Calling decoder.out_of_line_offset(0) is not allowed.
12720            if len == 0 {
12721                return Ok(());
12722            };
12723            depth.increment()?;
12724            let envelope_size = 8;
12725            let bytes_len = len * envelope_size;
12726            let offset = decoder.out_of_line_offset(bytes_len)?;
12727            // Decode the envelope for each type.
12728            let mut _next_ordinal_to_read = 0;
12729            let mut next_offset = offset;
12730            let end_offset = offset + bytes_len;
12731            _next_ordinal_to_read += 1;
12732            if next_offset >= end_offset {
12733                return Ok(());
12734            }
12735
12736            // Decode unknown envelopes for gaps in ordinals.
12737            while _next_ordinal_to_read < 1 {
12738                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12739                _next_ordinal_to_read += 1;
12740                next_offset += envelope_size;
12741            }
12742
12743            let next_out_of_line = decoder.next_out_of_line();
12744            let handles_before = decoder.remaining_handles();
12745            if let Some((inlined, num_bytes, num_handles)) =
12746                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12747            {
12748                let member_inline_size = <fidl::encoding::HandleType<
12749                    fidl::Vmo,
12750                    { fidl::ObjectType::VMO.into_raw() },
12751                    2147483648,
12752                > as fidl::encoding::TypeMarker>::inline_size(
12753                    decoder.context
12754                );
12755                if inlined != (member_inline_size <= 4) {
12756                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12757                }
12758                let inner_offset;
12759                let mut inner_depth = depth.clone();
12760                if inlined {
12761                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12762                    inner_offset = next_offset;
12763                } else {
12764                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12765                    inner_depth.increment()?;
12766                }
12767                let val_ref =
12768                self.vmo.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
12769                fidl::decode!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
12770                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12771                {
12772                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12773                }
12774                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12775                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12776                }
12777            }
12778
12779            next_offset += envelope_size;
12780            _next_ordinal_to_read += 1;
12781            if next_offset >= end_offset {
12782                return Ok(());
12783            }
12784
12785            // Decode unknown envelopes for gaps in ordinals.
12786            while _next_ordinal_to_read < 2 {
12787                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12788                _next_ordinal_to_read += 1;
12789                next_offset += envelope_size;
12790            }
12791
12792            let next_out_of_line = decoder.next_out_of_line();
12793            let handles_before = decoder.remaining_handles();
12794            if let Some((inlined, num_bytes, num_handles)) =
12795                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12796            {
12797                let member_inline_size =
12798                    <fidl_fuchsia_math::SizeU as fidl::encoding::TypeMarker>::inline_size(
12799                        decoder.context,
12800                    );
12801                if inlined != (member_inline_size <= 4) {
12802                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12803                }
12804                let inner_offset;
12805                let mut inner_depth = depth.clone();
12806                if inlined {
12807                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12808                    inner_offset = next_offset;
12809                } else {
12810                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12811                    inner_depth.increment()?;
12812                }
12813                let val_ref = self.size.get_or_insert_with(|| {
12814                    fidl::new_empty!(
12815                        fidl_fuchsia_math::SizeU,
12816                        fidl::encoding::DefaultFuchsiaResourceDialect
12817                    )
12818                });
12819                fidl::decode!(
12820                    fidl_fuchsia_math::SizeU,
12821                    fidl::encoding::DefaultFuchsiaResourceDialect,
12822                    val_ref,
12823                    decoder,
12824                    inner_offset,
12825                    inner_depth
12826                )?;
12827                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12828                {
12829                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12830                }
12831                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12832                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12833                }
12834            }
12835
12836            next_offset += envelope_size;
12837
12838            // Decode the remaining unknown envelopes.
12839            while next_offset < end_offset {
12840                _next_ordinal_to_read += 1;
12841                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12842                next_offset += envelope_size;
12843            }
12844
12845            Ok(())
12846        }
12847    }
12848
12849    impl ViewBoundProtocols {
12850        #[inline(always)]
12851        fn max_ordinal_present(&self) -> u64 {
12852            if let Some(_) = self.mouse_source {
12853                return 4;
12854            }
12855            if let Some(_) = self.touch_source {
12856                return 3;
12857            }
12858            if let Some(_) = self.view_focuser {
12859                return 2;
12860            }
12861            if let Some(_) = self.view_ref_focused {
12862                return 1;
12863            }
12864            0
12865        }
12866    }
12867
12868    impl fidl::encoding::ResourceTypeMarker for ViewBoundProtocols {
12869        type Borrowed<'a> = &'a mut Self;
12870        fn take_or_borrow<'a>(
12871            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12872        ) -> Self::Borrowed<'a> {
12873            value
12874        }
12875    }
12876
12877    unsafe impl fidl::encoding::TypeMarker for ViewBoundProtocols {
12878        type Owned = Self;
12879
12880        #[inline(always)]
12881        fn inline_align(_context: fidl::encoding::Context) -> usize {
12882            8
12883        }
12884
12885        #[inline(always)]
12886        fn inline_size(_context: fidl::encoding::Context) -> usize {
12887            16
12888        }
12889    }
12890
12891    unsafe impl
12892        fidl::encoding::Encode<ViewBoundProtocols, fidl::encoding::DefaultFuchsiaResourceDialect>
12893        for &mut ViewBoundProtocols
12894    {
12895        unsafe fn encode(
12896            self,
12897            encoder: &mut fidl::encoding::Encoder<
12898                '_,
12899                fidl::encoding::DefaultFuchsiaResourceDialect,
12900            >,
12901            offset: usize,
12902            mut depth: fidl::encoding::Depth,
12903        ) -> fidl::Result<()> {
12904            encoder.debug_check_bounds::<ViewBoundProtocols>(offset);
12905            // Vector header
12906            let max_ordinal: u64 = self.max_ordinal_present();
12907            encoder.write_num(max_ordinal, offset);
12908            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
12909            // Calling encoder.out_of_line_offset(0) is not allowed.
12910            if max_ordinal == 0 {
12911                return Ok(());
12912            }
12913            depth.increment()?;
12914            let envelope_size = 8;
12915            let bytes_len = max_ordinal as usize * envelope_size;
12916            #[allow(unused_variables)]
12917            let offset = encoder.out_of_line_offset(bytes_len);
12918            let mut _prev_end_offset: usize = 0;
12919            if 1 > max_ordinal {
12920                return Ok(());
12921            }
12922
12923            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12924            // are envelope_size bytes.
12925            let cur_offset: usize = (1 - 1) * envelope_size;
12926
12927            // Zero reserved fields.
12928            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12929
12930            // Safety:
12931            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12932            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12933            //   envelope_size bytes, there is always sufficient room.
12934            fidl::encoding::encode_in_envelope_optional::<
12935                fidl::encoding::Endpoint<
12936                    fidl::endpoints::ServerEnd<fidl_fuchsia_ui_views::ViewRefFocusedMarker>,
12937                >,
12938                fidl::encoding::DefaultFuchsiaResourceDialect,
12939            >(
12940                self.view_ref_focused.as_mut().map(
12941                    <fidl::encoding::Endpoint<
12942                        fidl::endpoints::ServerEnd<fidl_fuchsia_ui_views::ViewRefFocusedMarker>,
12943                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
12944                ),
12945                encoder,
12946                offset + cur_offset,
12947                depth,
12948            )?;
12949
12950            _prev_end_offset = cur_offset + envelope_size;
12951            if 2 > max_ordinal {
12952                return Ok(());
12953            }
12954
12955            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12956            // are envelope_size bytes.
12957            let cur_offset: usize = (2 - 1) * envelope_size;
12958
12959            // Zero reserved fields.
12960            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12961
12962            // Safety:
12963            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12964            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12965            //   envelope_size bytes, there is always sufficient room.
12966            fidl::encoding::encode_in_envelope_optional::<
12967                fidl::encoding::Endpoint<
12968                    fidl::endpoints::ServerEnd<fidl_fuchsia_ui_views::FocuserMarker>,
12969                >,
12970                fidl::encoding::DefaultFuchsiaResourceDialect,
12971            >(
12972                self.view_focuser.as_mut().map(
12973                    <fidl::encoding::Endpoint<
12974                        fidl::endpoints::ServerEnd<fidl_fuchsia_ui_views::FocuserMarker>,
12975                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
12976                ),
12977                encoder,
12978                offset + cur_offset,
12979                depth,
12980            )?;
12981
12982            _prev_end_offset = cur_offset + envelope_size;
12983            if 3 > max_ordinal {
12984                return Ok(());
12985            }
12986
12987            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12988            // are envelope_size bytes.
12989            let cur_offset: usize = (3 - 1) * envelope_size;
12990
12991            // Zero reserved fields.
12992            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12993
12994            // Safety:
12995            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12996            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12997            //   envelope_size bytes, there is always sufficient room.
12998            fidl::encoding::encode_in_envelope_optional::<
12999                fidl::encoding::Endpoint<
13000                    fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::TouchSourceMarker>,
13001                >,
13002                fidl::encoding::DefaultFuchsiaResourceDialect,
13003            >(
13004                self.touch_source.as_mut().map(
13005                    <fidl::encoding::Endpoint<
13006                        fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::TouchSourceMarker>,
13007                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
13008                ),
13009                encoder,
13010                offset + cur_offset,
13011                depth,
13012            )?;
13013
13014            _prev_end_offset = cur_offset + envelope_size;
13015            if 4 > max_ordinal {
13016                return Ok(());
13017            }
13018
13019            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
13020            // are envelope_size bytes.
13021            let cur_offset: usize = (4 - 1) * envelope_size;
13022
13023            // Zero reserved fields.
13024            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
13025
13026            // Safety:
13027            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
13028            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
13029            //   envelope_size bytes, there is always sufficient room.
13030            fidl::encoding::encode_in_envelope_optional::<
13031                fidl::encoding::Endpoint<
13032                    fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::MouseSourceMarker>,
13033                >,
13034                fidl::encoding::DefaultFuchsiaResourceDialect,
13035            >(
13036                self.mouse_source.as_mut().map(
13037                    <fidl::encoding::Endpoint<
13038                        fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::MouseSourceMarker>,
13039                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
13040                ),
13041                encoder,
13042                offset + cur_offset,
13043                depth,
13044            )?;
13045
13046            _prev_end_offset = cur_offset + envelope_size;
13047
13048            Ok(())
13049        }
13050    }
13051
13052    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
13053        for ViewBoundProtocols
13054    {
13055        #[inline(always)]
13056        fn new_empty() -> Self {
13057            Self::default()
13058        }
13059
13060        unsafe fn decode(
13061            &mut self,
13062            decoder: &mut fidl::encoding::Decoder<
13063                '_,
13064                fidl::encoding::DefaultFuchsiaResourceDialect,
13065            >,
13066            offset: usize,
13067            mut depth: fidl::encoding::Depth,
13068        ) -> fidl::Result<()> {
13069            decoder.debug_check_bounds::<Self>(offset);
13070            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
13071                None => return Err(fidl::Error::NotNullable),
13072                Some(len) => len,
13073            };
13074            // Calling decoder.out_of_line_offset(0) is not allowed.
13075            if len == 0 {
13076                return Ok(());
13077            };
13078            depth.increment()?;
13079            let envelope_size = 8;
13080            let bytes_len = len * envelope_size;
13081            let offset = decoder.out_of_line_offset(bytes_len)?;
13082            // Decode the envelope for each type.
13083            let mut _next_ordinal_to_read = 0;
13084            let mut next_offset = offset;
13085            let end_offset = offset + bytes_len;
13086            _next_ordinal_to_read += 1;
13087            if next_offset >= end_offset {
13088                return Ok(());
13089            }
13090
13091            // Decode unknown envelopes for gaps in ordinals.
13092            while _next_ordinal_to_read < 1 {
13093                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13094                _next_ordinal_to_read += 1;
13095                next_offset += envelope_size;
13096            }
13097
13098            let next_out_of_line = decoder.next_out_of_line();
13099            let handles_before = decoder.remaining_handles();
13100            if let Some((inlined, num_bytes, num_handles)) =
13101                fidl::encoding::decode_envelope_header(decoder, next_offset)?
13102            {
13103                let member_inline_size = <fidl::encoding::Endpoint<
13104                    fidl::endpoints::ServerEnd<fidl_fuchsia_ui_views::ViewRefFocusedMarker>,
13105                > as fidl::encoding::TypeMarker>::inline_size(
13106                    decoder.context
13107                );
13108                if inlined != (member_inline_size <= 4) {
13109                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
13110                }
13111                let inner_offset;
13112                let mut inner_depth = depth.clone();
13113                if inlined {
13114                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
13115                    inner_offset = next_offset;
13116                } else {
13117                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
13118                    inner_depth.increment()?;
13119                }
13120                let val_ref = self.view_ref_focused.get_or_insert_with(|| {
13121                    fidl::new_empty!(
13122                        fidl::encoding::Endpoint<
13123                            fidl::endpoints::ServerEnd<fidl_fuchsia_ui_views::ViewRefFocusedMarker>,
13124                        >,
13125                        fidl::encoding::DefaultFuchsiaResourceDialect
13126                    )
13127                });
13128                fidl::decode!(
13129                    fidl::encoding::Endpoint<
13130                        fidl::endpoints::ServerEnd<fidl_fuchsia_ui_views::ViewRefFocusedMarker>,
13131                    >,
13132                    fidl::encoding::DefaultFuchsiaResourceDialect,
13133                    val_ref,
13134                    decoder,
13135                    inner_offset,
13136                    inner_depth
13137                )?;
13138                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
13139                {
13140                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
13141                }
13142                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
13143                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
13144                }
13145            }
13146
13147            next_offset += envelope_size;
13148            _next_ordinal_to_read += 1;
13149            if next_offset >= end_offset {
13150                return Ok(());
13151            }
13152
13153            // Decode unknown envelopes for gaps in ordinals.
13154            while _next_ordinal_to_read < 2 {
13155                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13156                _next_ordinal_to_read += 1;
13157                next_offset += envelope_size;
13158            }
13159
13160            let next_out_of_line = decoder.next_out_of_line();
13161            let handles_before = decoder.remaining_handles();
13162            if let Some((inlined, num_bytes, num_handles)) =
13163                fidl::encoding::decode_envelope_header(decoder, next_offset)?
13164            {
13165                let member_inline_size = <fidl::encoding::Endpoint<
13166                    fidl::endpoints::ServerEnd<fidl_fuchsia_ui_views::FocuserMarker>,
13167                > as fidl::encoding::TypeMarker>::inline_size(
13168                    decoder.context
13169                );
13170                if inlined != (member_inline_size <= 4) {
13171                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
13172                }
13173                let inner_offset;
13174                let mut inner_depth = depth.clone();
13175                if inlined {
13176                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
13177                    inner_offset = next_offset;
13178                } else {
13179                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
13180                    inner_depth.increment()?;
13181                }
13182                let val_ref = self.view_focuser.get_or_insert_with(|| {
13183                    fidl::new_empty!(
13184                        fidl::encoding::Endpoint<
13185                            fidl::endpoints::ServerEnd<fidl_fuchsia_ui_views::FocuserMarker>,
13186                        >,
13187                        fidl::encoding::DefaultFuchsiaResourceDialect
13188                    )
13189                });
13190                fidl::decode!(
13191                    fidl::encoding::Endpoint<
13192                        fidl::endpoints::ServerEnd<fidl_fuchsia_ui_views::FocuserMarker>,
13193                    >,
13194                    fidl::encoding::DefaultFuchsiaResourceDialect,
13195                    val_ref,
13196                    decoder,
13197                    inner_offset,
13198                    inner_depth
13199                )?;
13200                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
13201                {
13202                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
13203                }
13204                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
13205                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
13206                }
13207            }
13208
13209            next_offset += envelope_size;
13210            _next_ordinal_to_read += 1;
13211            if next_offset >= end_offset {
13212                return Ok(());
13213            }
13214
13215            // Decode unknown envelopes for gaps in ordinals.
13216            while _next_ordinal_to_read < 3 {
13217                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13218                _next_ordinal_to_read += 1;
13219                next_offset += envelope_size;
13220            }
13221
13222            let next_out_of_line = decoder.next_out_of_line();
13223            let handles_before = decoder.remaining_handles();
13224            if let Some((inlined, num_bytes, num_handles)) =
13225                fidl::encoding::decode_envelope_header(decoder, next_offset)?
13226            {
13227                let member_inline_size = <fidl::encoding::Endpoint<
13228                    fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::TouchSourceMarker>,
13229                > as fidl::encoding::TypeMarker>::inline_size(
13230                    decoder.context
13231                );
13232                if inlined != (member_inline_size <= 4) {
13233                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
13234                }
13235                let inner_offset;
13236                let mut inner_depth = depth.clone();
13237                if inlined {
13238                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
13239                    inner_offset = next_offset;
13240                } else {
13241                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
13242                    inner_depth.increment()?;
13243                }
13244                let val_ref = self.touch_source.get_or_insert_with(|| {
13245                    fidl::new_empty!(
13246                        fidl::encoding::Endpoint<
13247                            fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::TouchSourceMarker>,
13248                        >,
13249                        fidl::encoding::DefaultFuchsiaResourceDialect
13250                    )
13251                });
13252                fidl::decode!(
13253                    fidl::encoding::Endpoint<
13254                        fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::TouchSourceMarker>,
13255                    >,
13256                    fidl::encoding::DefaultFuchsiaResourceDialect,
13257                    val_ref,
13258                    decoder,
13259                    inner_offset,
13260                    inner_depth
13261                )?;
13262                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
13263                {
13264                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
13265                }
13266                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
13267                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
13268                }
13269            }
13270
13271            next_offset += envelope_size;
13272            _next_ordinal_to_read += 1;
13273            if next_offset >= end_offset {
13274                return Ok(());
13275            }
13276
13277            // Decode unknown envelopes for gaps in ordinals.
13278            while _next_ordinal_to_read < 4 {
13279                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13280                _next_ordinal_to_read += 1;
13281                next_offset += envelope_size;
13282            }
13283
13284            let next_out_of_line = decoder.next_out_of_line();
13285            let handles_before = decoder.remaining_handles();
13286            if let Some((inlined, num_bytes, num_handles)) =
13287                fidl::encoding::decode_envelope_header(decoder, next_offset)?
13288            {
13289                let member_inline_size = <fidl::encoding::Endpoint<
13290                    fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::MouseSourceMarker>,
13291                > as fidl::encoding::TypeMarker>::inline_size(
13292                    decoder.context
13293                );
13294                if inlined != (member_inline_size <= 4) {
13295                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
13296                }
13297                let inner_offset;
13298                let mut inner_depth = depth.clone();
13299                if inlined {
13300                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
13301                    inner_offset = next_offset;
13302                } else {
13303                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
13304                    inner_depth.increment()?;
13305                }
13306                let val_ref = self.mouse_source.get_or_insert_with(|| {
13307                    fidl::new_empty!(
13308                        fidl::encoding::Endpoint<
13309                            fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::MouseSourceMarker>,
13310                        >,
13311                        fidl::encoding::DefaultFuchsiaResourceDialect
13312                    )
13313                });
13314                fidl::decode!(
13315                    fidl::encoding::Endpoint<
13316                        fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::MouseSourceMarker>,
13317                    >,
13318                    fidl::encoding::DefaultFuchsiaResourceDialect,
13319                    val_ref,
13320                    decoder,
13321                    inner_offset,
13322                    inner_depth
13323                )?;
13324                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
13325                {
13326                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
13327                }
13328                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
13329                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
13330                }
13331            }
13332
13333            next_offset += envelope_size;
13334
13335            // Decode the remaining unknown envelopes.
13336            while next_offset < end_offset {
13337                _next_ordinal_to_read += 1;
13338                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13339                next_offset += envelope_size;
13340            }
13341
13342            Ok(())
13343        }
13344    }
13345}