Skip to main content

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, PartialEq)]
58pub struct Flatland2CreateImage2Request {
59    pub image_id: ImageId,
60    pub import_token: BufferCollectionImportToken,
61    pub vmo_index: u32,
62    pub properties: ImageProperties,
63}
64
65impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
66    for Flatland2CreateImage2Request
67{
68}
69
70#[derive(Debug, PartialEq)]
71pub struct Flatland2CreateViewport2Request {
72    pub viewport_id: ViewportId,
73    pub token: fidl_fuchsia_ui_views::ViewportCreationToken,
74    pub properties: ViewportProperties,
75    pub child_view_watcher: fidl::endpoints::ServerEnd<ChildViewWatcherMarker>,
76}
77
78impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
79    for Flatland2CreateViewport2Request
80{
81}
82
83#[derive(Debug, PartialEq)]
84pub struct Flatland2ReleaseViewport2Response {
85    pub token: fidl_fuchsia_ui_views::ViewportCreationToken,
86}
87
88impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
89    for Flatland2ReleaseViewport2Response
90{
91}
92
93#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
94pub struct Flatland2SetLayerImageRequest {
95    pub layer_id: LayerId,
96    pub image_id: ImageId,
97    pub acquire_fence: Option<Box<WaitFence>>,
98    pub release_fence: Option<Box<SignalFence>>,
99}
100
101impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
102    for Flatland2SetLayerImageRequest
103{
104}
105
106#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
107#[repr(C)]
108pub struct FlatlandCreateFilledRectRequest {
109    pub rect_id: ContentId,
110}
111
112impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
113    for FlatlandCreateFilledRectRequest
114{
115}
116
117#[derive(Debug, PartialEq)]
118pub struct FlatlandCreateImageRequest {
119    pub image_id: ContentId,
120    pub import_token: BufferCollectionImportToken,
121    pub vmo_index: u32,
122    pub properties: ImageProperties,
123}
124
125impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
126    for FlatlandCreateImageRequest
127{
128}
129
130#[derive(Debug, PartialEq)]
131pub struct FlatlandCreateView2Request {
132    /// A typed wrapper for a channel, representing the child endpoint of the connection
133    /// between two Flatland sessions.
134    pub token: fidl_fuchsia_ui_views::ViewCreationToken,
135    /// The ViewRef to strongly associate with [`token`].
136    pub view_identity: fidl_fuchsia_ui_views::ViewIdentityOnCreation,
137    /// The protocol endpoints that are strongly bound to the ViewRef in [`view_identity`].
138    /// The protocols are bound when the view is created and installed in the view tree.
139    pub protocols: ViewBoundProtocols,
140    pub parent_viewport_watcher: fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>,
141}
142
143impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
144    for FlatlandCreateView2Request
145{
146}
147
148#[derive(Debug, PartialEq)]
149pub struct FlatlandCreateViewRequest {
150    pub token: fidl_fuchsia_ui_views::ViewCreationToken,
151    pub parent_viewport_watcher: fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>,
152}
153
154impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for FlatlandCreateViewRequest {}
155
156#[derive(Debug, PartialEq)]
157pub struct FlatlandCreateViewportRequest {
158    pub viewport_id: ContentId,
159    /// A typed wrapper for a channel, representing the parent endpoint of the connection
160    /// between two Flatland sessions.
161    pub token: fidl_fuchsia_ui_views::ViewportCreationToken,
162    pub properties: ViewportProperties,
163    pub child_view_watcher: fidl::endpoints::ServerEnd<ChildViewWatcherMarker>,
164}
165
166impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
167    for FlatlandCreateViewportRequest
168{
169}
170
171#[derive(Debug, PartialEq)]
172pub struct FlatlandDisplaySetContentRequest {
173    pub token: fidl_fuchsia_ui_views::ViewportCreationToken,
174    pub child_view_watcher: fidl::endpoints::ServerEnd<ChildViewWatcherMarker>,
175}
176
177impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
178    for FlatlandDisplaySetContentRequest
179{
180}
181
182#[derive(Debug, PartialEq)]
183pub struct FlatlandFactoryCreateFlatlandRequest {
184    /// The server end of the [`fuchsia.ui.composition/Flatland`] protocol to be created.
185    pub server_end: fidl::endpoints::ServerEnd<FlatlandMarker>,
186    /// The configuration for the new Flatland session. See [FlatlandConfig] for details.
187    pub config: FlatlandConfig,
188}
189
190impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
191    for FlatlandFactoryCreateFlatlandRequest
192{
193}
194
195#[derive(Debug, PartialEq)]
196pub struct FlatlandPresentRequest {
197    pub args: PresentArgs,
198}
199
200impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for FlatlandPresentRequest {}
201
202#[derive(Debug, PartialEq)]
203pub struct FlatlandReleaseViewportResponse {
204    pub token: fidl_fuchsia_ui_views::ViewportCreationToken,
205}
206
207impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
208    for FlatlandReleaseViewportResponse
209{
210}
211
212#[derive(Debug, PartialEq)]
213pub struct FlatlandSetSolidFillRequest {
214    pub rect_id: ContentId,
215    pub color: ColorRgba,
216    pub size: fidl_fuchsia_math::SizeU,
217}
218
219impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
220    for FlatlandSetSolidFillRequest
221{
222}
223
224#[derive(Debug, PartialEq)]
225pub struct TrustedFlatlandFactoryCreateFlatlandRequest {
226    /// The server end of the [Flatland] protocol to be created.
227    pub server_end: fidl::endpoints::ServerEnd<FlatlandMarker>,
228    /// The configuration for the new Flatland session. See [TrustedFlatlandConfig] for
229    /// details on available options.
230    pub config: TrustedFlatlandConfig,
231}
232
233impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
234    for TrustedFlatlandFactoryCreateFlatlandRequest
235{
236}
237
238/// Metadata about the frame rendered by [`GetNextFrame`].
239#[derive(Debug, Default, PartialEq)]
240pub struct FrameInfo {
241    /// The index of the VMO where the requested frame has been rendered. Required.
242    pub buffer_id: Option<u32>,
243    #[doc(hidden)]
244    pub __source_breaking: fidl::marker::SourceBreaking,
245}
246
247impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for FrameInfo {}
248
249/// The arguments passed into the [`GetNextFrame`] call. All fields are necessary.
250#[derive(Debug, Default, PartialEq)]
251pub struct GetNextFrameArgs {
252    /// The event that will signal when the requested frame has been rendered. Required.
253    pub event: Option<fidl::Event>,
254    #[doc(hidden)]
255    pub __source_breaking: fidl::marker::SourceBreaking,
256}
257
258impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for GetNextFrameArgs {}
259
260/// Arguments passed into [`Present`]. All arguments are optional, and if an
261/// argument is omitted Flatland will use a reasonable default, specified below.
262#[derive(Debug, Default, PartialEq)]
263pub struct PresentArgs {
264    /// `requested_presentation_time` specifies the time on or after which the client would like the
265    /// enqueued operations to take visible effect (light up pixels on the screen), expressed in
266    /// nanoseconds in the `CLOCK_MONOTONIC` timebase.
267    ///
268    /// The default `requested_presentation_time` is 0.
269    ///
270    /// Using a `requested_presentation_time` in the present or past (such as 0) schedules enqueued
271    /// operations to take visible effect as soon as possible, during the next frame to be prepared.
272    ///
273    /// Using a `requested_presentation_time` in the future schedules the enqueued operations to
274    /// take visible effect on or as closely as possible after the stated time, but no earlier.
275    ///
276    /// Each rendered frame has a target presentation time. This is when Flatland aims to have the
277    /// frame presented to the user. Before rendering a frame, Flatland applies all
278    /// enqueued operations associated with all squashable calls to [`Present`] whose
279    /// `requested_presentation_time` is on or before the frame's target presentation time.
280    pub requested_presentation_time: Option<i64>,
281    /// Flatland will wait until all of a Flatland session's `acquire_fences` are ready before it
282    /// will execute the presented commands. Not signaling `acquire_fences` will block the current
283    /// [`Present`] as well as the following ones even if their `acquire_fences` are signaled.
284    ///
285    /// The default `acquire_fences` value is the empty vector.
286    pub acquire_fences: Option<Vec<fidl::Event>>,
287    /// Flatland will signal all `release_fences` when it is safe to reuse resources which no longer
288    /// appear in the local scene graph at the time of the current [`Present`].  At the latest, this
289    /// will happen when the local scene graph (checkpointed at this [`Present`]) has been
290    /// integrated into the global scene graph, and the global scene has been displayed on screen.
291    ///
292    /// (Under some circumstances, the fences may be signaled earlier, but clients do not need to
293    /// worry about this: the fences will only be signaled when it is safe to reuse the associated
294    /// resources).
295    ///
296    /// These fences are intended to manage the reuse of shared memory resources such as sysmem
297    /// buffers.  For example, it is undesirable for the client to render into an image which is
298    /// currently displayed on screen, because this may result in graphical artifacts such as
299    /// tearing.
300    ///
301    /// It is up to the client to maintain the mapping between each fence and the resources which
302    /// will become reusable when the fence is signaled.  A common strategy is to keep track of
303    /// resources which were used by the previous [`Present`] but are no longer used by the current
304    /// [`Present`].  For example, if an image is removed from the scene by the current [`Present`],
305    /// the client would insert a fence here.  When the fence is later signaled, the client knows
306    /// that it is safe to render into the image and insert it into the local scene graph in a
307    /// subsequent [`Present`].
308    ///
309    /// If an error occurs, Flatland may close the channel without signaling these fences.  Clients
310    /// may immediately release shared buffers, but they should not immediately modify such buffers,
311    /// because they may still be displayed on screen.  There is currently no good signal available
312    /// to the client about when it is safe to reuse shared buffers.
313    ///
314    /// The default `release_fences` value is the empty vector.
315    pub release_fences: Option<Vec<fidl::Event>>,
316    /// If `unsquashable` is true, then the update is guaranteed to be uniquely shown for at
317    /// least one vsync interval.
318    ///
319    /// If `unsquashable` is false, then the update can be combined with those that come after
320    /// it.
321    ///
322    /// If absent, `unsquashable` is false.
323    pub unsquashable: Option<bool>,
324    /// Flatland will signal all `present_fences` when the frame corresponding to this `Present`
325    /// is reported as displayed by the display hardware.  Additionally, each fence will have the
326    /// monotonic timestamp of the corresponding vsync written into it.
327    ///
328    /// The default `present_fences` value is the empty vector.
329    pub present_fences: Option<Vec<fidl::Counter>>,
330    /// Flatland will signal all `release_counters` when it is safe to reuse resources which no
331    /// longer appear in the local scene graph at the time of the current `Present` (i.e. resources
332    /// from the previous present). This is similar to `release_fences` but by using counters
333    /// instead of events, counters hold the monotonic timestamp of when resources became safe for
334    /// reuse. The event based `release_fences` can be used simultaneously with `release_counters`
335    /// for resources that don't care about this timestamp.
336    ///
337    /// The default `release_counters` value is the empty vector.
338    pub release_counters: Option<Vec<fidl::Counter>>,
339    #[doc(hidden)]
340    pub __source_breaking: fidl::marker::SourceBreaking,
341}
342
343impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for PresentArgs {}
344
345/// The table of arguments for [`RegisterBufferCollection`]. Note that some
346/// fields below are REQUIRED.
347#[derive(Debug, Default, PartialEq)]
348pub struct RegisterBufferCollectionArgs {
349    /// Clients can send [`export_token`] to register buffer collections with Allocator to be used
350    /// later in [`fuchsia.ui.composition/Flatland`] instances or other Scenic APIs, such as
351    /// Screenshot.
352    ///
353    /// For example, by passing a [`BufferCollectionImportToken`] containing the matching peer of
354    /// [`BufferCollectionExportToken`], they can create image resources via
355    /// [`fuchsia.ui.composition/Flatland.CreateImage`].
356    ///
357    /// Clients should wait for the response before using `import_token`.
358    ///
359    /// This field is REQUIRED.
360    pub export_token: Option<BufferCollectionExportToken>,
361    pub buffer_collection_token:
362        Option<fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem::BufferCollectionTokenMarker>>,
363    /// The client can register a buffer collection for various uses, each
364    /// coming with their own unique constraints.
365    ///
366    /// This field is OPTIONAL. If `usage` is omitted it will be treated as if
367    /// it has the DEFAULT option.
368    ///
369    /// # Deprecation
370    ///
371    /// This arg is deprecated at API version 9 with addition of |usages|.
372    ///
373    /// If both the `usages` and `usage` fields are set, `usages` takes precedence and `usage` is
374    /// ignored.
375    pub usage: Option<RegisterBufferCollectionUsage>,
376    /// The client can register a buffer collection for various uses and has the ability to
377    /// combine usages if multiple are needed.
378    ///
379    /// This field is OPTIONAL. If `usages` is omitted it will be treated as if
380    /// it has only the DEFAULT option.
381    pub usages: Option<RegisterBufferCollectionUsages>,
382    /// Flatland participates in the allocation of buffers by setting constraints on the
383    /// BufferCollection referenced by `buffer_collection_token2` (or `buffer_collection_token`
384    /// prior to its removal). It will not block on buffers being allocated until the client creates
385    /// content using the BufferCollection.
386    ///
387    /// The buffer collection registered with `export_token` is available and kept alive as long
388    /// as the client holds a valid [`BufferCollectionImportToken`]. They will be garbage collected
389    /// when all [`BufferCollectionImportToken`]s are closed and all the associated Image resources
390    /// are released.
391    ///
392    /// `buffer_collection_token2` must be set (or prior to `buffer_collection_token` removal,
393    /// exactly one of `buffer_collection_token2` or `buffer_collection_token` must be set).
394    pub buffer_collection_token2:
395        Option<fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem2::BufferCollectionTokenMarker>>,
396    #[doc(hidden)]
397    pub __source_breaking: fidl::marker::SourceBreaking,
398}
399
400impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
401    for RegisterBufferCollectionArgs
402{
403}
404
405/// The arguments passed into the [`Configure`] call. Note that not all fields are necessary.
406#[derive(Debug, Default, PartialEq)]
407pub struct ScreenCaptureConfig {
408    /// The import token referencing a BufferCollection registered with
409    /// Allocator. Required.
410    pub import_token: Option<BufferCollectionImportToken>,
411    /// The size of the image in pixels. Required.
412    pub size: Option<fidl_fuchsia_math::SizeU>,
413    /// The number of buffers in the BufferCollection. Required.
414    pub buffer_count: Option<u32>,
415    /// The rotation to be applied to the stream of images. Optional; if absent no rotation is
416    /// applied.
417    pub rotation: Option<Rotation>,
418    #[doc(hidden)]
419    pub __source_breaking: fidl::marker::SourceBreaking,
420}
421
422impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for ScreenCaptureConfig {}
423
424#[derive(Debug, Default, PartialEq)]
425pub struct ScreenshotTakeFileRequest {
426    /// Format of the requested screenshot.
427    pub format: Option<ScreenshotFormat>,
428    #[doc(hidden)]
429    pub __source_breaking: fidl::marker::SourceBreaking,
430}
431
432impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for ScreenshotTakeFileRequest {}
433
434#[derive(Debug, Default, PartialEq)]
435pub struct ScreenshotTakeFileResponse {
436    /// |fuchsia.io.File| channel used to read the generated screenshot file data.
437    /// The server side of the channel is stored on the device until ZX_CHANNEL_PEER_CLOSED
438    /// is detected.
439    ///
440    /// Basic usage: After the client recieves the client end of the file channel,
441    /// to avoid memory pile-ups, it should finish reading the data
442    /// before calling [`TakeFile`] again. When finished reading,
443    /// the client should call [`Close`] on the |fuchsia.io.File| channel, this will release
444    /// the memory allocated on the server side.
445    pub file: Option<fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>>,
446    /// Size of the screenshot in pixels.
447    pub size: Option<fidl_fuchsia_math::SizeU>,
448    #[doc(hidden)]
449    pub __source_breaking: fidl::marker::SourceBreaking,
450}
451
452impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
453    for ScreenshotTakeFileResponse
454{
455}
456
457#[derive(Debug, Default, PartialEq)]
458pub struct ScreenshotTakeRequest {
459    /// Format of the requested screenshot.
460    pub format: Option<ScreenshotFormat>,
461    #[doc(hidden)]
462    pub __source_breaking: fidl::marker::SourceBreaking,
463}
464
465impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for ScreenshotTakeRequest {}
466
467#[derive(Debug, Default, PartialEq)]
468pub struct ScreenshotTakeResponse {
469    /// CPU mappable read-only VMO that contains screenshot data. The server owns the VMO and
470    /// may reuse for the next [`Take`]. The VMO is guaranteed to be accessible after mapping.
471    /// In some allocations, VMO::read() might not be available, i.e. on emulator.
472    ///
473    /// Basic usage: After the client receives a VMO handle, to ensure data stability, it should
474    /// finish reading the VMO before calling [`Take`] again. When finished reading, the client
475    /// should drop the VMO handle.
476    ///
477    /// Advanced usage: To edit the data, or to persist it beyond the next [`Take`] call, the
478    /// client should copy the data to a private VMO.
479    pub vmo: Option<fidl::Vmo>,
480    /// Size of the screenshot in pixels.
481    pub size: Option<fidl_fuchsia_math::SizeU>,
482    #[doc(hidden)]
483    pub __source_breaking: fidl::marker::SourceBreaking,
484}
485
486impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for ScreenshotTakeResponse {}
487
488/// All arguments are optional; default values will be provided if they are absent.
489/// By default, the resulting Flatland will behave identically to connecting
490/// to the [Flatland] service instead of connecting via the factory.
491#[derive(Debug, Default, PartialEq)]
492pub struct TrustedFlatlandConfig {
493    /// If true and the [PresentArgs.requested_presentation_time] passed to [Flatland.Present] is
494    /// set to 0 or less than or equal to the nearest presentation time, a frame will be scheduled
495    /// to be presented as soon as all acquire fences are signaled, instead of waiting for other
496    /// clients to present within the same vsync. This allows the caller to decide when to wake up
497    /// for preparing a frame.
498    ///
499    /// If [requested_presentation_time] is set to a value greater than the nearest presentation
500    /// time, this flag will have no effect and the wakeup time decision will be made by the
501    /// scheduler.
502    ///
503    /// If absent, `schedule_asap` is false.
504    pub schedule_asap: Option<bool>,
505    /// If true, Scenic should pass acquire fences to the drivers for composition HW, instead of
506    /// waiting for them on CPU. This can improve performance by reducing CPU overhead.
507    ///
508    /// If absent, `pass_acquire_fences` is false.
509    pub pass_acquire_fences: Option<bool>,
510    /// If true, the client will not utilize Flatland's built in frame-scheduling mechanism and
511    /// will ignore present credits, instead relying on their own flow control system.
512    ///
513    /// If absent, `skips_present_credits` is false.
514    pub skips_present_credits: Option<bool>,
515    /// If true, the client will not receive [Flatland.OnFramePresented] events.
516    ///
517    /// If absent, `skips_on_frame_presented` is false.
518    pub skips_on_frame_presented: Option<bool>,
519    /// If true, clients may use the [`fuchsia.ui.composition/Flatland2`] protocol, which is
520    /// composed into the "classic" [`fuchsia.ui.composition/Flatland`] protocol.
521    ///
522    /// Note: some "classic" Flatland methods are disabled when Flatland2 is enabled; see the
523    /// [`fuchsia.ui.composition/Flatland2`] documentation for details.
524    ///
525    /// If absent, `use_flatland2_api` is false.
526    pub use_flatland2_api: Option<bool>,
527    #[doc(hidden)]
528    pub __source_breaking: fidl::marker::SourceBreaking,
529}
530
531impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for TrustedFlatlandConfig {}
532
533/// The protocol endpoints bound to a Flatland ViewCreationToken. These protocols operate on the
534/// View that ViewCreationToken created in the Flatland session.
535#[derive(Debug, Default, PartialEq)]
536pub struct ViewBoundProtocols {
537    /// Learn when a View gains focus.
538    ///
539    /// Server-bound ViewRef. The [`view_ref_focused`] client does not specify the ViewRef
540    /// explicitly; instead, the server implementation uses the ViewRef used in View creation for
541    /// reporting focus movement on/off this View.
542    pub view_ref_focused:
543        Option<fidl::endpoints::ServerEnd<fidl_fuchsia_ui_views::ViewRefFocusedMarker>>,
544    /// Enable a View to request focus transfer to a child (target) View.
545    ///
546    /// Server-bound ViewRef. The [`view_focuser`] client does not specify the "requester" ViewRef
547    /// explicitly, only the "target" ViewRef. Instead, the server implementation uses the ViewRef
548    /// used in View creation as the "requester" ViewRef.
549    pub view_focuser: Option<fidl::endpoints::ServerEnd<fidl_fuchsia_ui_views::FocuserMarker>>,
550    /// Receive touch events that are associated with a View.
551    /// Mutually exclusive with `touch_source_v2`. Providing both will result in
552    /// a `FlatlandError.BAD_OPERATION` error and channel closure.
553    pub touch_source:
554        Option<fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::TouchSourceMarker>>,
555    /// Receive mouse events that are associated with a View.
556    /// Mutually exclusive with `mouse_source_v2`. Providing both will result in
557    /// a `FlatlandError.BAD_OPERATION` error and channel closure.
558    pub mouse_source:
559        Option<fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::MouseSourceMarker>>,
560    /// Receive touch events that are associated with a View.
561    /// Mutually exclusive with `touch_source`. Providing both will result in
562    /// a `FlatlandError.BAD_OPERATION` error and channel closure.
563    pub touch_source_v2:
564        Option<fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::TouchSourceV2Marker>>,
565    /// Receive mouse events that are associated with a View.
566    /// Mutually exclusive with `mouse_source`. Providing both will result in
567    /// a `FlatlandError.BAD_OPERATION` error and channel closure.
568    pub mouse_source_v2:
569        Option<fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::MouseSourceV2Marker>>,
570    #[doc(hidden)]
571    pub __source_breaking: fidl::marker::SourceBreaking,
572}
573
574impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for ViewBoundProtocols {}
575
576/// A fence that will be signaled by Scenic when some condition becomes true.
577/// For more details, refer to the method the fence appears in.
578#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
579pub enum SignalFence {
580    /// A basic handle (e.g., EVENT or EVENTPAIR).
581    Basic(fidl::NullableHandle),
582    /// Before Scenic signals the fence, it will write the timestamp of
583    /// the corresponding event into the counter.
584    Timestamp(fidl::Counter),
585}
586
587impl SignalFence {
588    #[inline]
589    pub fn ordinal(&self) -> u64 {
590        match *self {
591            Self::Basic(_) => 1,
592            Self::Timestamp(_) => 2,
593        }
594    }
595}
596
597impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for SignalFence {}
598
599/// A fence that will be signaled when the associated resource is ready for Scenic to use.
600/// For context-specific usage info, refer to the method the fence appears in.
601#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
602pub enum WaitFence {
603    /// A basic handle (e.g., EVENT or EVENTPAIR).
604    Basic(fidl::NullableHandle),
605    /// At the time the fence is signalled, the timestamp of the
606    /// corresponding event will have been written into the counter.
607    Timestamp(fidl::Counter),
608}
609
610impl WaitFence {
611    #[inline]
612    pub fn ordinal(&self) -> u64 {
613        match *self {
614            Self::Basic(_) => 1,
615            Self::Timestamp(_) => 2,
616        }
617    }
618}
619
620impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for WaitFence {}
621
622#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
623pub struct AllocatorMarker;
624
625impl fidl::endpoints::ProtocolMarker for AllocatorMarker {
626    type Proxy = AllocatorProxy;
627    type RequestStream = AllocatorRequestStream;
628    #[cfg(target_os = "fuchsia")]
629    type SynchronousProxy = AllocatorSynchronousProxy;
630
631    const DEBUG_NAME: &'static str = "fuchsia.ui.composition.Allocator";
632}
633impl fidl::endpoints::DiscoverableProtocolMarker for AllocatorMarker {}
634pub type AllocatorRegisterBufferCollectionResult = Result<(), RegisterBufferCollectionError>;
635
636pub trait AllocatorProxyInterface: Send + Sync {
637    type RegisterBufferCollectionResponseFut: std::future::Future<Output = Result<AllocatorRegisterBufferCollectionResult, fidl::Error>>
638        + Send;
639    fn r#register_buffer_collection(
640        &self,
641        args: RegisterBufferCollectionArgs,
642    ) -> Self::RegisterBufferCollectionResponseFut;
643}
644#[derive(Debug)]
645#[cfg(target_os = "fuchsia")]
646pub struct AllocatorSynchronousProxy {
647    client: fidl::client::sync::Client,
648}
649
650#[cfg(target_os = "fuchsia")]
651impl fidl::endpoints::SynchronousProxy for AllocatorSynchronousProxy {
652    type Proxy = AllocatorProxy;
653    type Protocol = AllocatorMarker;
654
655    fn from_channel(inner: fidl::Channel) -> Self {
656        Self::new(inner)
657    }
658
659    fn into_channel(self) -> fidl::Channel {
660        self.client.into_channel()
661    }
662
663    fn as_channel(&self) -> &fidl::Channel {
664        self.client.as_channel()
665    }
666}
667
668#[cfg(target_os = "fuchsia")]
669impl AllocatorSynchronousProxy {
670    pub fn new(channel: fidl::Channel) -> Self {
671        Self { client: fidl::client::sync::Client::new(channel) }
672    }
673
674    pub fn into_channel(self) -> fidl::Channel {
675        self.client.into_channel()
676    }
677
678    /// Waits until an event arrives and returns it. It is safe for other
679    /// threads to make concurrent requests while waiting for an event.
680    pub fn wait_for_event(
681        &self,
682        deadline: zx::MonotonicInstant,
683    ) -> Result<AllocatorEvent, fidl::Error> {
684        AllocatorEvent::decode(self.client.wait_for_event::<AllocatorMarker>(deadline)?)
685    }
686
687    /// A BufferCollection is a set of VMOs created by Sysmem and shared by a number of
688    /// participants, one of which is the Flatland Renderer. Some content, such as Images, use a
689    /// BufferCollection as their backing memory.
690    ///
691    /// See [`RegisterBufferCollectionArgs`] for information on each argument.
692    pub fn r#register_buffer_collection(
693        &self,
694        mut args: RegisterBufferCollectionArgs,
695        ___deadline: zx::MonotonicInstant,
696    ) -> Result<AllocatorRegisterBufferCollectionResult, fidl::Error> {
697        let _response = self
698            .client
699            .send_query::<AllocatorRegisterBufferCollectionRequest, fidl::encoding::ResultType<
700                fidl::encoding::EmptyStruct,
701                RegisterBufferCollectionError,
702            >, AllocatorMarker>(
703                (&mut args,),
704                0x494b7ea578d1061e,
705                fidl::encoding::DynamicFlags::empty(),
706                ___deadline,
707            )?;
708        Ok(_response.map(|x| x))
709    }
710}
711
712#[cfg(target_os = "fuchsia")]
713impl From<AllocatorSynchronousProxy> for zx::NullableHandle {
714    fn from(value: AllocatorSynchronousProxy) -> Self {
715        value.into_channel().into()
716    }
717}
718
719#[cfg(target_os = "fuchsia")]
720impl From<fidl::Channel> for AllocatorSynchronousProxy {
721    fn from(value: fidl::Channel) -> Self {
722        Self::new(value)
723    }
724}
725
726#[cfg(target_os = "fuchsia")]
727impl fidl::endpoints::FromClient for AllocatorSynchronousProxy {
728    type Protocol = AllocatorMarker;
729
730    fn from_client(value: fidl::endpoints::ClientEnd<AllocatorMarker>) -> Self {
731        Self::new(value.into_channel())
732    }
733}
734
735#[derive(Debug, Clone)]
736pub struct AllocatorProxy {
737    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
738}
739
740impl fidl::endpoints::Proxy for AllocatorProxy {
741    type Protocol = AllocatorMarker;
742
743    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
744        Self::new(inner)
745    }
746
747    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
748        self.client.into_channel().map_err(|client| Self { client })
749    }
750
751    fn as_channel(&self) -> &::fidl::AsyncChannel {
752        self.client.as_channel()
753    }
754}
755
756impl AllocatorProxy {
757    /// Create a new Proxy for fuchsia.ui.composition/Allocator.
758    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
759        let protocol_name = <AllocatorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
760        Self { client: fidl::client::Client::new(channel, protocol_name) }
761    }
762
763    /// Get a Stream of events from the remote end of the protocol.
764    ///
765    /// # Panics
766    ///
767    /// Panics if the event stream was already taken.
768    pub fn take_event_stream(&self) -> AllocatorEventStream {
769        AllocatorEventStream { event_receiver: self.client.take_event_receiver() }
770    }
771
772    /// A BufferCollection is a set of VMOs created by Sysmem and shared by a number of
773    /// participants, one of which is the Flatland Renderer. Some content, such as Images, use a
774    /// BufferCollection as their backing memory.
775    ///
776    /// See [`RegisterBufferCollectionArgs`] for information on each argument.
777    pub fn r#register_buffer_collection(
778        &self,
779        mut args: RegisterBufferCollectionArgs,
780    ) -> fidl::client::QueryResponseFut<
781        AllocatorRegisterBufferCollectionResult,
782        fidl::encoding::DefaultFuchsiaResourceDialect,
783    > {
784        AllocatorProxyInterface::r#register_buffer_collection(self, args)
785    }
786}
787
788impl AllocatorProxyInterface for AllocatorProxy {
789    type RegisterBufferCollectionResponseFut = fidl::client::QueryResponseFut<
790        AllocatorRegisterBufferCollectionResult,
791        fidl::encoding::DefaultFuchsiaResourceDialect,
792    >;
793    fn r#register_buffer_collection(
794        &self,
795        mut args: RegisterBufferCollectionArgs,
796    ) -> Self::RegisterBufferCollectionResponseFut {
797        fn _decode(
798            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
799        ) -> Result<AllocatorRegisterBufferCollectionResult, fidl::Error> {
800            let _response = fidl::client::decode_transaction_body::<
801                fidl::encoding::ResultType<
802                    fidl::encoding::EmptyStruct,
803                    RegisterBufferCollectionError,
804                >,
805                fidl::encoding::DefaultFuchsiaResourceDialect,
806                0x494b7ea578d1061e,
807            >(_buf?)?;
808            Ok(_response.map(|x| x))
809        }
810        self.client.send_query_and_decode::<
811            AllocatorRegisterBufferCollectionRequest,
812            AllocatorRegisterBufferCollectionResult,
813        >(
814            (&mut args,),
815            0x494b7ea578d1061e,
816            fidl::encoding::DynamicFlags::empty(),
817            _decode,
818        )
819    }
820}
821
822pub struct AllocatorEventStream {
823    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
824}
825
826impl std::marker::Unpin for AllocatorEventStream {}
827
828impl futures::stream::FusedStream for AllocatorEventStream {
829    fn is_terminated(&self) -> bool {
830        self.event_receiver.is_terminated()
831    }
832}
833
834impl futures::Stream for AllocatorEventStream {
835    type Item = Result<AllocatorEvent, fidl::Error>;
836
837    fn poll_next(
838        mut self: std::pin::Pin<&mut Self>,
839        cx: &mut std::task::Context<'_>,
840    ) -> std::task::Poll<Option<Self::Item>> {
841        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
842            &mut self.event_receiver,
843            cx
844        )?) {
845            Some(buf) => std::task::Poll::Ready(Some(AllocatorEvent::decode(buf))),
846            None => std::task::Poll::Ready(None),
847        }
848    }
849}
850
851#[derive(Debug)]
852pub enum AllocatorEvent {}
853
854impl AllocatorEvent {
855    /// Decodes a message buffer as a [`AllocatorEvent`].
856    fn decode(
857        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
858    ) -> Result<AllocatorEvent, fidl::Error> {
859        let (bytes, _handles) = buf.split_mut();
860        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
861        debug_assert_eq!(tx_header.tx_id, 0);
862        match tx_header.ordinal {
863            _ => Err(fidl::Error::UnknownOrdinal {
864                ordinal: tx_header.ordinal,
865                protocol_name: <AllocatorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
866            }),
867        }
868    }
869}
870
871/// A Stream of incoming requests for fuchsia.ui.composition/Allocator.
872pub struct AllocatorRequestStream {
873    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
874    is_terminated: bool,
875}
876
877impl std::marker::Unpin for AllocatorRequestStream {}
878
879impl futures::stream::FusedStream for AllocatorRequestStream {
880    fn is_terminated(&self) -> bool {
881        self.is_terminated
882    }
883}
884
885impl fidl::endpoints::RequestStream for AllocatorRequestStream {
886    type Protocol = AllocatorMarker;
887    type ControlHandle = AllocatorControlHandle;
888
889    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
890        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
891    }
892
893    fn control_handle(&self) -> Self::ControlHandle {
894        AllocatorControlHandle { inner: self.inner.clone() }
895    }
896
897    fn into_inner(
898        self,
899    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
900    {
901        (self.inner, self.is_terminated)
902    }
903
904    fn from_inner(
905        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
906        is_terminated: bool,
907    ) -> Self {
908        Self { inner, is_terminated }
909    }
910}
911
912impl futures::Stream for AllocatorRequestStream {
913    type Item = Result<AllocatorRequest, fidl::Error>;
914
915    fn poll_next(
916        mut self: std::pin::Pin<&mut Self>,
917        cx: &mut std::task::Context<'_>,
918    ) -> std::task::Poll<Option<Self::Item>> {
919        let this = &mut *self;
920        if this.inner.check_shutdown(cx) {
921            this.is_terminated = true;
922            return std::task::Poll::Ready(None);
923        }
924        if this.is_terminated {
925            panic!("polled AllocatorRequestStream after completion");
926        }
927        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
928            |bytes, handles| {
929                match this.inner.channel().read_etc(cx, bytes, handles) {
930                    std::task::Poll::Ready(Ok(())) => {}
931                    std::task::Poll::Pending => return std::task::Poll::Pending,
932                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
933                        this.is_terminated = true;
934                        return std::task::Poll::Ready(None);
935                    }
936                    std::task::Poll::Ready(Err(e)) => {
937                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
938                            e.into(),
939                        ))));
940                    }
941                }
942
943                // A message has been received from the channel
944                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
945
946                std::task::Poll::Ready(Some(match header.ordinal {
947                    0x494b7ea578d1061e => {
948                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
949                        let mut req = fidl::new_empty!(
950                            AllocatorRegisterBufferCollectionRequest,
951                            fidl::encoding::DefaultFuchsiaResourceDialect
952                        );
953                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AllocatorRegisterBufferCollectionRequest>(&header, _body_bytes, handles, &mut req)?;
954                        let control_handle = AllocatorControlHandle { inner: this.inner.clone() };
955                        Ok(AllocatorRequest::RegisterBufferCollection {
956                            args: req.args,
957
958                            responder: AllocatorRegisterBufferCollectionResponder {
959                                control_handle: std::mem::ManuallyDrop::new(control_handle),
960                                tx_id: header.tx_id,
961                            },
962                        })
963                    }
964                    _ => Err(fidl::Error::UnknownOrdinal {
965                        ordinal: header.ordinal,
966                        protocol_name:
967                            <AllocatorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
968                    }),
969                }))
970            },
971        )
972    }
973}
974
975#[derive(Debug)]
976pub enum AllocatorRequest {
977    /// A BufferCollection is a set of VMOs created by Sysmem and shared by a number of
978    /// participants, one of which is the Flatland Renderer. Some content, such as Images, use a
979    /// BufferCollection as their backing memory.
980    ///
981    /// See [`RegisterBufferCollectionArgs`] for information on each argument.
982    RegisterBufferCollection {
983        args: RegisterBufferCollectionArgs,
984        responder: AllocatorRegisterBufferCollectionResponder,
985    },
986}
987
988impl AllocatorRequest {
989    #[allow(irrefutable_let_patterns)]
990    pub fn into_register_buffer_collection(
991        self,
992    ) -> Option<(RegisterBufferCollectionArgs, AllocatorRegisterBufferCollectionResponder)> {
993        if let AllocatorRequest::RegisterBufferCollection { args, responder } = self {
994            Some((args, responder))
995        } else {
996            None
997        }
998    }
999
1000    /// Name of the method defined in FIDL
1001    pub fn method_name(&self) -> &'static str {
1002        match *self {
1003            AllocatorRequest::RegisterBufferCollection { .. } => "register_buffer_collection",
1004        }
1005    }
1006}
1007
1008#[derive(Debug, Clone)]
1009pub struct AllocatorControlHandle {
1010    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1011}
1012
1013impl AllocatorControlHandle {
1014    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
1015        self.inner.shutdown_with_epitaph(status.into())
1016    }
1017}
1018
1019impl fidl::endpoints::ControlHandle for AllocatorControlHandle {
1020    fn shutdown(&self) {
1021        self.inner.shutdown()
1022    }
1023
1024    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
1025        self.inner.shutdown_with_epitaph(status)
1026    }
1027
1028    fn is_closed(&self) -> bool {
1029        self.inner.channel().is_closed()
1030    }
1031    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1032        self.inner.channel().on_closed()
1033    }
1034
1035    #[cfg(target_os = "fuchsia")]
1036    fn signal_peer(
1037        &self,
1038        clear_mask: zx::Signals,
1039        set_mask: zx::Signals,
1040    ) -> Result<(), zx_status::Status> {
1041        use fidl::Peered;
1042        self.inner.channel().signal_peer(clear_mask, set_mask)
1043    }
1044}
1045
1046impl AllocatorControlHandle {}
1047
1048#[must_use = "FIDL methods require a response to be sent"]
1049#[derive(Debug)]
1050pub struct AllocatorRegisterBufferCollectionResponder {
1051    control_handle: std::mem::ManuallyDrop<AllocatorControlHandle>,
1052    tx_id: u32,
1053}
1054
1055/// Set the the channel to be shutdown (see [`AllocatorControlHandle::shutdown`])
1056/// if the responder is dropped without sending a response, so that the client
1057/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1058impl std::ops::Drop for AllocatorRegisterBufferCollectionResponder {
1059    fn drop(&mut self) {
1060        self.control_handle.shutdown();
1061        // Safety: drops once, never accessed again
1062        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1063    }
1064}
1065
1066impl fidl::endpoints::Responder for AllocatorRegisterBufferCollectionResponder {
1067    type ControlHandle = AllocatorControlHandle;
1068
1069    fn control_handle(&self) -> &AllocatorControlHandle {
1070        &self.control_handle
1071    }
1072
1073    fn drop_without_shutdown(mut self) {
1074        // Safety: drops once, never accessed again due to mem::forget
1075        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1076        // Prevent Drop from running (which would shut down the channel)
1077        std::mem::forget(self);
1078    }
1079}
1080
1081impl AllocatorRegisterBufferCollectionResponder {
1082    /// Sends a response to the FIDL transaction.
1083    ///
1084    /// Sets the channel to shutdown if an error occurs.
1085    pub fn send(
1086        self,
1087        mut result: Result<(), RegisterBufferCollectionError>,
1088    ) -> Result<(), fidl::Error> {
1089        let _result = self.send_raw(result);
1090        if _result.is_err() {
1091            self.control_handle.shutdown();
1092        }
1093        self.drop_without_shutdown();
1094        _result
1095    }
1096
1097    /// Similar to "send" but does not shutdown the channel if an error occurs.
1098    pub fn send_no_shutdown_on_err(
1099        self,
1100        mut result: Result<(), RegisterBufferCollectionError>,
1101    ) -> Result<(), fidl::Error> {
1102        let _result = self.send_raw(result);
1103        self.drop_without_shutdown();
1104        _result
1105    }
1106
1107    fn send_raw(
1108        &self,
1109        mut result: Result<(), RegisterBufferCollectionError>,
1110    ) -> Result<(), fidl::Error> {
1111        self.control_handle.inner.send::<fidl::encoding::ResultType<
1112            fidl::encoding::EmptyStruct,
1113            RegisterBufferCollectionError,
1114        >>(
1115            result,
1116            self.tx_id,
1117            0x494b7ea578d1061e,
1118            fidl::encoding::DynamicFlags::empty(),
1119        )
1120    }
1121}
1122
1123#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1124pub struct ChildViewWatcherMarker;
1125
1126impl fidl::endpoints::ProtocolMarker for ChildViewWatcherMarker {
1127    type Proxy = ChildViewWatcherProxy;
1128    type RequestStream = ChildViewWatcherRequestStream;
1129    #[cfg(target_os = "fuchsia")]
1130    type SynchronousProxy = ChildViewWatcherSynchronousProxy;
1131
1132    const DEBUG_NAME: &'static str = "(anonymous) ChildViewWatcher";
1133}
1134
1135pub trait ChildViewWatcherProxyInterface: Send + Sync {
1136    type GetStatusResponseFut: std::future::Future<Output = Result<ChildViewStatus, fidl::Error>>
1137        + Send;
1138    fn r#get_status(&self) -> Self::GetStatusResponseFut;
1139    type GetViewRefResponseFut: std::future::Future<Output = Result<fidl_fuchsia_ui_views::ViewRef, fidl::Error>>
1140        + Send;
1141    fn r#get_view_ref(&self) -> Self::GetViewRefResponseFut;
1142}
1143#[derive(Debug)]
1144#[cfg(target_os = "fuchsia")]
1145pub struct ChildViewWatcherSynchronousProxy {
1146    client: fidl::client::sync::Client,
1147}
1148
1149#[cfg(target_os = "fuchsia")]
1150impl fidl::endpoints::SynchronousProxy for ChildViewWatcherSynchronousProxy {
1151    type Proxy = ChildViewWatcherProxy;
1152    type Protocol = ChildViewWatcherMarker;
1153
1154    fn from_channel(inner: fidl::Channel) -> Self {
1155        Self::new(inner)
1156    }
1157
1158    fn into_channel(self) -> fidl::Channel {
1159        self.client.into_channel()
1160    }
1161
1162    fn as_channel(&self) -> &fidl::Channel {
1163        self.client.as_channel()
1164    }
1165}
1166
1167#[cfg(target_os = "fuchsia")]
1168impl ChildViewWatcherSynchronousProxy {
1169    pub fn new(channel: fidl::Channel) -> Self {
1170        Self { client: fidl::client::sync::Client::new(channel) }
1171    }
1172
1173    pub fn into_channel(self) -> fidl::Channel {
1174        self.client.into_channel()
1175    }
1176
1177    /// Waits until an event arrives and returns it. It is safe for other
1178    /// threads to make concurrent requests while waiting for an event.
1179    pub fn wait_for_event(
1180        &self,
1181        deadline: zx::MonotonicInstant,
1182    ) -> Result<ChildViewWatcherEvent, fidl::Error> {
1183        ChildViewWatcherEvent::decode(
1184            self.client.wait_for_event::<ChildViewWatcherMarker>(deadline)?,
1185        )
1186    }
1187
1188    /// A hanging get for receiving the status of a View. This provides information to the parent,
1189    /// such as whether or not the child has successfully presented content through this View.
1190    ///
1191    /// This hanging get will only fire when the ChildViewStatus is different than the previously
1192    /// returned ChildViewStatus.  This can happen immediately, and even if the creator of the
1193    /// Viewport hasn't yet called Present() after calling CreateViewport().  This allows the parent
1194    /// to know that the child has content ready to display before the parent modifies their own
1195    /// local scene graph to incorporate the child content.
1196    ///
1197    /// It is invalid to call `GetStatus` while a previous call is still pending. Doing so will
1198    /// cause both this channel and the Flatland channel that handed out ChildViewWatcher to be
1199    /// closed.
1200    pub fn r#get_status(
1201        &self,
1202        ___deadline: zx::MonotonicInstant,
1203    ) -> Result<ChildViewStatus, fidl::Error> {
1204        let _response = self.client.send_query::<
1205            fidl::encoding::EmptyPayload,
1206            ChildViewWatcherGetStatusResponse,
1207            ChildViewWatcherMarker,
1208        >(
1209            (),
1210            0x1d622075f4fc8243,
1211            fidl::encoding::DynamicFlags::empty(),
1212            ___deadline,
1213        )?;
1214        Ok(_response.status)
1215    }
1216
1217    /// Hanging get to receive the ViewRef of the child View. This will only fire when the View ref
1218    /// is different from the previously-returned View ref. Note: currently the View ref will not
1219    /// change after it is first received, but this will change if/when the API changes to allow
1220    /// relinking of views.
1221    ///
1222    /// The ViewRef is not returned until the View is included in the View tree, in other words when
1223    /// there is a chain of ancestor transforms all the way back up to the root of the scene graph,
1224    /// i.e. the display.
1225    ///
1226    /// It is invalid to call `GetViewRef` while a previous call is still pending. Doing so will
1227    /// cause both this channel and the Flatland channel that handed out ChildViewWatcher to be
1228    /// closed.
1229    ///
1230    /// A `GetViewRef` call will hang if the View was created using `CreateView`, but returns the
1231    /// View if the View was created using CreateView2. This is because `CreateView` does not mint
1232    /// a ViewRef for that View.
1233    pub fn r#get_view_ref(
1234        &self,
1235        ___deadline: zx::MonotonicInstant,
1236    ) -> Result<fidl_fuchsia_ui_views::ViewRef, fidl::Error> {
1237        let _response = self.client.send_query::<
1238            fidl::encoding::EmptyPayload,
1239            ChildViewWatcherGetViewRefResponse,
1240            ChildViewWatcherMarker,
1241        >(
1242            (),
1243            0x3b2f3ca31e8908b4,
1244            fidl::encoding::DynamicFlags::empty(),
1245            ___deadline,
1246        )?;
1247        Ok(_response.view_ref)
1248    }
1249}
1250
1251#[cfg(target_os = "fuchsia")]
1252impl From<ChildViewWatcherSynchronousProxy> for zx::NullableHandle {
1253    fn from(value: ChildViewWatcherSynchronousProxy) -> Self {
1254        value.into_channel().into()
1255    }
1256}
1257
1258#[cfg(target_os = "fuchsia")]
1259impl From<fidl::Channel> for ChildViewWatcherSynchronousProxy {
1260    fn from(value: fidl::Channel) -> Self {
1261        Self::new(value)
1262    }
1263}
1264
1265#[cfg(target_os = "fuchsia")]
1266impl fidl::endpoints::FromClient for ChildViewWatcherSynchronousProxy {
1267    type Protocol = ChildViewWatcherMarker;
1268
1269    fn from_client(value: fidl::endpoints::ClientEnd<ChildViewWatcherMarker>) -> Self {
1270        Self::new(value.into_channel())
1271    }
1272}
1273
1274#[derive(Debug, Clone)]
1275pub struct ChildViewWatcherProxy {
1276    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1277}
1278
1279impl fidl::endpoints::Proxy for ChildViewWatcherProxy {
1280    type Protocol = ChildViewWatcherMarker;
1281
1282    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1283        Self::new(inner)
1284    }
1285
1286    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1287        self.client.into_channel().map_err(|client| Self { client })
1288    }
1289
1290    fn as_channel(&self) -> &::fidl::AsyncChannel {
1291        self.client.as_channel()
1292    }
1293}
1294
1295impl ChildViewWatcherProxy {
1296    /// Create a new Proxy for fuchsia.ui.composition/ChildViewWatcher.
1297    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1298        let protocol_name = <ChildViewWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1299        Self { client: fidl::client::Client::new(channel, protocol_name) }
1300    }
1301
1302    /// Get a Stream of events from the remote end of the protocol.
1303    ///
1304    /// # Panics
1305    ///
1306    /// Panics if the event stream was already taken.
1307    pub fn take_event_stream(&self) -> ChildViewWatcherEventStream {
1308        ChildViewWatcherEventStream { event_receiver: self.client.take_event_receiver() }
1309    }
1310
1311    /// A hanging get for receiving the status of a View. This provides information to the parent,
1312    /// such as whether or not the child has successfully presented content through this View.
1313    ///
1314    /// This hanging get will only fire when the ChildViewStatus is different than the previously
1315    /// returned ChildViewStatus.  This can happen immediately, and even if the creator of the
1316    /// Viewport hasn't yet called Present() after calling CreateViewport().  This allows the parent
1317    /// to know that the child has content ready to display before the parent modifies their own
1318    /// local scene graph to incorporate the child content.
1319    ///
1320    /// It is invalid to call `GetStatus` while a previous call is still pending. Doing so will
1321    /// cause both this channel and the Flatland channel that handed out ChildViewWatcher to be
1322    /// closed.
1323    pub fn r#get_status(
1324        &self,
1325    ) -> fidl::client::QueryResponseFut<
1326        ChildViewStatus,
1327        fidl::encoding::DefaultFuchsiaResourceDialect,
1328    > {
1329        ChildViewWatcherProxyInterface::r#get_status(self)
1330    }
1331
1332    /// Hanging get to receive the ViewRef of the child View. This will only fire when the View ref
1333    /// is different from the previously-returned View ref. Note: currently the View ref will not
1334    /// change after it is first received, but this will change if/when the API changes to allow
1335    /// relinking of views.
1336    ///
1337    /// The ViewRef is not returned until the View is included in the View tree, in other words when
1338    /// there is a chain of ancestor transforms all the way back up to the root of the scene graph,
1339    /// i.e. the display.
1340    ///
1341    /// It is invalid to call `GetViewRef` while a previous call is still pending. Doing so will
1342    /// cause both this channel and the Flatland channel that handed out ChildViewWatcher to be
1343    /// closed.
1344    ///
1345    /// A `GetViewRef` call will hang if the View was created using `CreateView`, but returns the
1346    /// View if the View was created using CreateView2. This is because `CreateView` does not mint
1347    /// a ViewRef for that View.
1348    pub fn r#get_view_ref(
1349        &self,
1350    ) -> fidl::client::QueryResponseFut<
1351        fidl_fuchsia_ui_views::ViewRef,
1352        fidl::encoding::DefaultFuchsiaResourceDialect,
1353    > {
1354        ChildViewWatcherProxyInterface::r#get_view_ref(self)
1355    }
1356}
1357
1358impl ChildViewWatcherProxyInterface for ChildViewWatcherProxy {
1359    type GetStatusResponseFut = fidl::client::QueryResponseFut<
1360        ChildViewStatus,
1361        fidl::encoding::DefaultFuchsiaResourceDialect,
1362    >;
1363    fn r#get_status(&self) -> Self::GetStatusResponseFut {
1364        fn _decode(
1365            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1366        ) -> Result<ChildViewStatus, fidl::Error> {
1367            let _response = fidl::client::decode_transaction_body::<
1368                ChildViewWatcherGetStatusResponse,
1369                fidl::encoding::DefaultFuchsiaResourceDialect,
1370                0x1d622075f4fc8243,
1371            >(_buf?)?;
1372            Ok(_response.status)
1373        }
1374        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ChildViewStatus>(
1375            (),
1376            0x1d622075f4fc8243,
1377            fidl::encoding::DynamicFlags::empty(),
1378            _decode,
1379        )
1380    }
1381
1382    type GetViewRefResponseFut = fidl::client::QueryResponseFut<
1383        fidl_fuchsia_ui_views::ViewRef,
1384        fidl::encoding::DefaultFuchsiaResourceDialect,
1385    >;
1386    fn r#get_view_ref(&self) -> Self::GetViewRefResponseFut {
1387        fn _decode(
1388            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1389        ) -> Result<fidl_fuchsia_ui_views::ViewRef, fidl::Error> {
1390            let _response = fidl::client::decode_transaction_body::<
1391                ChildViewWatcherGetViewRefResponse,
1392                fidl::encoding::DefaultFuchsiaResourceDialect,
1393                0x3b2f3ca31e8908b4,
1394            >(_buf?)?;
1395            Ok(_response.view_ref)
1396        }
1397        self.client
1398            .send_query_and_decode::<fidl::encoding::EmptyPayload, fidl_fuchsia_ui_views::ViewRef>(
1399                (),
1400                0x3b2f3ca31e8908b4,
1401                fidl::encoding::DynamicFlags::empty(),
1402                _decode,
1403            )
1404    }
1405}
1406
1407pub struct ChildViewWatcherEventStream {
1408    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1409}
1410
1411impl std::marker::Unpin for ChildViewWatcherEventStream {}
1412
1413impl futures::stream::FusedStream for ChildViewWatcherEventStream {
1414    fn is_terminated(&self) -> bool {
1415        self.event_receiver.is_terminated()
1416    }
1417}
1418
1419impl futures::Stream for ChildViewWatcherEventStream {
1420    type Item = Result<ChildViewWatcherEvent, fidl::Error>;
1421
1422    fn poll_next(
1423        mut self: std::pin::Pin<&mut Self>,
1424        cx: &mut std::task::Context<'_>,
1425    ) -> std::task::Poll<Option<Self::Item>> {
1426        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1427            &mut self.event_receiver,
1428            cx
1429        )?) {
1430            Some(buf) => std::task::Poll::Ready(Some(ChildViewWatcherEvent::decode(buf))),
1431            None => std::task::Poll::Ready(None),
1432        }
1433    }
1434}
1435
1436#[derive(Debug)]
1437pub enum ChildViewWatcherEvent {}
1438
1439impl ChildViewWatcherEvent {
1440    /// Decodes a message buffer as a [`ChildViewWatcherEvent`].
1441    fn decode(
1442        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1443    ) -> Result<ChildViewWatcherEvent, fidl::Error> {
1444        let (bytes, _handles) = buf.split_mut();
1445        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1446        debug_assert_eq!(tx_header.tx_id, 0);
1447        match tx_header.ordinal {
1448            _ => Err(fidl::Error::UnknownOrdinal {
1449                ordinal: tx_header.ordinal,
1450                protocol_name:
1451                    <ChildViewWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1452            }),
1453        }
1454    }
1455}
1456
1457/// A Stream of incoming requests for fuchsia.ui.composition/ChildViewWatcher.
1458pub struct ChildViewWatcherRequestStream {
1459    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1460    is_terminated: bool,
1461}
1462
1463impl std::marker::Unpin for ChildViewWatcherRequestStream {}
1464
1465impl futures::stream::FusedStream for ChildViewWatcherRequestStream {
1466    fn is_terminated(&self) -> bool {
1467        self.is_terminated
1468    }
1469}
1470
1471impl fidl::endpoints::RequestStream for ChildViewWatcherRequestStream {
1472    type Protocol = ChildViewWatcherMarker;
1473    type ControlHandle = ChildViewWatcherControlHandle;
1474
1475    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1476        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1477    }
1478
1479    fn control_handle(&self) -> Self::ControlHandle {
1480        ChildViewWatcherControlHandle { inner: self.inner.clone() }
1481    }
1482
1483    fn into_inner(
1484        self,
1485    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1486    {
1487        (self.inner, self.is_terminated)
1488    }
1489
1490    fn from_inner(
1491        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1492        is_terminated: bool,
1493    ) -> Self {
1494        Self { inner, is_terminated }
1495    }
1496}
1497
1498impl futures::Stream for ChildViewWatcherRequestStream {
1499    type Item = Result<ChildViewWatcherRequest, fidl::Error>;
1500
1501    fn poll_next(
1502        mut self: std::pin::Pin<&mut Self>,
1503        cx: &mut std::task::Context<'_>,
1504    ) -> std::task::Poll<Option<Self::Item>> {
1505        let this = &mut *self;
1506        if this.inner.check_shutdown(cx) {
1507            this.is_terminated = true;
1508            return std::task::Poll::Ready(None);
1509        }
1510        if this.is_terminated {
1511            panic!("polled ChildViewWatcherRequestStream after completion");
1512        }
1513        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1514            |bytes, handles| {
1515                match this.inner.channel().read_etc(cx, bytes, handles) {
1516                    std::task::Poll::Ready(Ok(())) => {}
1517                    std::task::Poll::Pending => return std::task::Poll::Pending,
1518                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1519                        this.is_terminated = true;
1520                        return std::task::Poll::Ready(None);
1521                    }
1522                    std::task::Poll::Ready(Err(e)) => {
1523                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1524                            e.into(),
1525                        ))));
1526                    }
1527                }
1528
1529                // A message has been received from the channel
1530                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1531
1532                std::task::Poll::Ready(Some(match header.ordinal {
1533                    0x1d622075f4fc8243 => {
1534                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1535                        let mut req = fidl::new_empty!(
1536                            fidl::encoding::EmptyPayload,
1537                            fidl::encoding::DefaultFuchsiaResourceDialect
1538                        );
1539                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1540                        let control_handle =
1541                            ChildViewWatcherControlHandle { inner: this.inner.clone() };
1542                        Ok(ChildViewWatcherRequest::GetStatus {
1543                            responder: ChildViewWatcherGetStatusResponder {
1544                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1545                                tx_id: header.tx_id,
1546                            },
1547                        })
1548                    }
1549                    0x3b2f3ca31e8908b4 => {
1550                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1551                        let mut req = fidl::new_empty!(
1552                            fidl::encoding::EmptyPayload,
1553                            fidl::encoding::DefaultFuchsiaResourceDialect
1554                        );
1555                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1556                        let control_handle =
1557                            ChildViewWatcherControlHandle { inner: this.inner.clone() };
1558                        Ok(ChildViewWatcherRequest::GetViewRef {
1559                            responder: ChildViewWatcherGetViewRefResponder {
1560                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1561                                tx_id: header.tx_id,
1562                            },
1563                        })
1564                    }
1565                    _ => Err(fidl::Error::UnknownOrdinal {
1566                        ordinal: header.ordinal,
1567                        protocol_name:
1568                            <ChildViewWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1569                    }),
1570                }))
1571            },
1572        )
1573    }
1574}
1575
1576/// A protocol that provides information about a particular child View which is attached to the
1577/// Viewport owned by the parent client; connections to this protocol are estabished in
1578/// [`CreateViewport`].  Since a Flatland session may contain any number of Viewports, each of
1579/// which may or may not be attached to a transform, the client can maintain connections to an
1580/// equal number of ChildViewWatcher instances.
1581///
1582/// Each ChildViewWatcher instance will remain connected as long as the corresponding child View
1583/// exists; the connection will also be closed if the child's ViewCreationToken is dropped without
1584/// using it to create a View.
1585#[derive(Debug)]
1586pub enum ChildViewWatcherRequest {
1587    /// A hanging get for receiving the status of a View. This provides information to the parent,
1588    /// such as whether or not the child has successfully presented content through this View.
1589    ///
1590    /// This hanging get will only fire when the ChildViewStatus is different than the previously
1591    /// returned ChildViewStatus.  This can happen immediately, and even if the creator of the
1592    /// Viewport hasn't yet called Present() after calling CreateViewport().  This allows the parent
1593    /// to know that the child has content ready to display before the parent modifies their own
1594    /// local scene graph to incorporate the child content.
1595    ///
1596    /// It is invalid to call `GetStatus` while a previous call is still pending. Doing so will
1597    /// cause both this channel and the Flatland channel that handed out ChildViewWatcher to be
1598    /// closed.
1599    GetStatus { responder: ChildViewWatcherGetStatusResponder },
1600    /// Hanging get to receive the ViewRef of the child View. This will only fire when the View ref
1601    /// is different from the previously-returned View ref. Note: currently the View ref will not
1602    /// change after it is first received, but this will change if/when the API changes to allow
1603    /// relinking of views.
1604    ///
1605    /// The ViewRef is not returned until the View is included in the View tree, in other words when
1606    /// there is a chain of ancestor transforms all the way back up to the root of the scene graph,
1607    /// i.e. the display.
1608    ///
1609    /// It is invalid to call `GetViewRef` while a previous call is still pending. Doing so will
1610    /// cause both this channel and the Flatland channel that handed out ChildViewWatcher to be
1611    /// closed.
1612    ///
1613    /// A `GetViewRef` call will hang if the View was created using `CreateView`, but returns the
1614    /// View if the View was created using CreateView2. This is because `CreateView` does not mint
1615    /// a ViewRef for that View.
1616    GetViewRef { responder: ChildViewWatcherGetViewRefResponder },
1617}
1618
1619impl ChildViewWatcherRequest {
1620    #[allow(irrefutable_let_patterns)]
1621    pub fn into_get_status(self) -> Option<(ChildViewWatcherGetStatusResponder)> {
1622        if let ChildViewWatcherRequest::GetStatus { responder } = self {
1623            Some((responder))
1624        } else {
1625            None
1626        }
1627    }
1628
1629    #[allow(irrefutable_let_patterns)]
1630    pub fn into_get_view_ref(self) -> Option<(ChildViewWatcherGetViewRefResponder)> {
1631        if let ChildViewWatcherRequest::GetViewRef { responder } = self {
1632            Some((responder))
1633        } else {
1634            None
1635        }
1636    }
1637
1638    /// Name of the method defined in FIDL
1639    pub fn method_name(&self) -> &'static str {
1640        match *self {
1641            ChildViewWatcherRequest::GetStatus { .. } => "get_status",
1642            ChildViewWatcherRequest::GetViewRef { .. } => "get_view_ref",
1643        }
1644    }
1645}
1646
1647#[derive(Debug, Clone)]
1648pub struct ChildViewWatcherControlHandle {
1649    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1650}
1651
1652impl ChildViewWatcherControlHandle {
1653    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
1654        self.inner.shutdown_with_epitaph(status.into())
1655    }
1656}
1657
1658impl fidl::endpoints::ControlHandle for ChildViewWatcherControlHandle {
1659    fn shutdown(&self) {
1660        self.inner.shutdown()
1661    }
1662
1663    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
1664        self.inner.shutdown_with_epitaph(status)
1665    }
1666
1667    fn is_closed(&self) -> bool {
1668        self.inner.channel().is_closed()
1669    }
1670    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1671        self.inner.channel().on_closed()
1672    }
1673
1674    #[cfg(target_os = "fuchsia")]
1675    fn signal_peer(
1676        &self,
1677        clear_mask: zx::Signals,
1678        set_mask: zx::Signals,
1679    ) -> Result<(), zx_status::Status> {
1680        use fidl::Peered;
1681        self.inner.channel().signal_peer(clear_mask, set_mask)
1682    }
1683}
1684
1685impl ChildViewWatcherControlHandle {}
1686
1687#[must_use = "FIDL methods require a response to be sent"]
1688#[derive(Debug)]
1689pub struct ChildViewWatcherGetStatusResponder {
1690    control_handle: std::mem::ManuallyDrop<ChildViewWatcherControlHandle>,
1691    tx_id: u32,
1692}
1693
1694/// Set the the channel to be shutdown (see [`ChildViewWatcherControlHandle::shutdown`])
1695/// if the responder is dropped without sending a response, so that the client
1696/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1697impl std::ops::Drop for ChildViewWatcherGetStatusResponder {
1698    fn drop(&mut self) {
1699        self.control_handle.shutdown();
1700        // Safety: drops once, never accessed again
1701        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1702    }
1703}
1704
1705impl fidl::endpoints::Responder for ChildViewWatcherGetStatusResponder {
1706    type ControlHandle = ChildViewWatcherControlHandle;
1707
1708    fn control_handle(&self) -> &ChildViewWatcherControlHandle {
1709        &self.control_handle
1710    }
1711
1712    fn drop_without_shutdown(mut self) {
1713        // Safety: drops once, never accessed again due to mem::forget
1714        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1715        // Prevent Drop from running (which would shut down the channel)
1716        std::mem::forget(self);
1717    }
1718}
1719
1720impl ChildViewWatcherGetStatusResponder {
1721    /// Sends a response to the FIDL transaction.
1722    ///
1723    /// Sets the channel to shutdown if an error occurs.
1724    pub fn send(self, mut status: ChildViewStatus) -> Result<(), fidl::Error> {
1725        let _result = self.send_raw(status);
1726        if _result.is_err() {
1727            self.control_handle.shutdown();
1728        }
1729        self.drop_without_shutdown();
1730        _result
1731    }
1732
1733    /// Similar to "send" but does not shutdown the channel if an error occurs.
1734    pub fn send_no_shutdown_on_err(self, mut status: ChildViewStatus) -> Result<(), fidl::Error> {
1735        let _result = self.send_raw(status);
1736        self.drop_without_shutdown();
1737        _result
1738    }
1739
1740    fn send_raw(&self, mut status: ChildViewStatus) -> Result<(), fidl::Error> {
1741        self.control_handle.inner.send::<ChildViewWatcherGetStatusResponse>(
1742            (status,),
1743            self.tx_id,
1744            0x1d622075f4fc8243,
1745            fidl::encoding::DynamicFlags::empty(),
1746        )
1747    }
1748}
1749
1750#[must_use = "FIDL methods require a response to be sent"]
1751#[derive(Debug)]
1752pub struct ChildViewWatcherGetViewRefResponder {
1753    control_handle: std::mem::ManuallyDrop<ChildViewWatcherControlHandle>,
1754    tx_id: u32,
1755}
1756
1757/// Set the the channel to be shutdown (see [`ChildViewWatcherControlHandle::shutdown`])
1758/// if the responder is dropped without sending a response, so that the client
1759/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1760impl std::ops::Drop for ChildViewWatcherGetViewRefResponder {
1761    fn drop(&mut self) {
1762        self.control_handle.shutdown();
1763        // Safety: drops once, never accessed again
1764        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1765    }
1766}
1767
1768impl fidl::endpoints::Responder for ChildViewWatcherGetViewRefResponder {
1769    type ControlHandle = ChildViewWatcherControlHandle;
1770
1771    fn control_handle(&self) -> &ChildViewWatcherControlHandle {
1772        &self.control_handle
1773    }
1774
1775    fn drop_without_shutdown(mut self) {
1776        // Safety: drops once, never accessed again due to mem::forget
1777        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1778        // Prevent Drop from running (which would shut down the channel)
1779        std::mem::forget(self);
1780    }
1781}
1782
1783impl ChildViewWatcherGetViewRefResponder {
1784    /// Sends a response to the FIDL transaction.
1785    ///
1786    /// Sets the channel to shutdown if an error occurs.
1787    pub fn send(self, mut view_ref: fidl_fuchsia_ui_views::ViewRef) -> Result<(), fidl::Error> {
1788        let _result = self.send_raw(view_ref);
1789        if _result.is_err() {
1790            self.control_handle.shutdown();
1791        }
1792        self.drop_without_shutdown();
1793        _result
1794    }
1795
1796    /// Similar to "send" but does not shutdown the channel if an error occurs.
1797    pub fn send_no_shutdown_on_err(
1798        self,
1799        mut view_ref: fidl_fuchsia_ui_views::ViewRef,
1800    ) -> Result<(), fidl::Error> {
1801        let _result = self.send_raw(view_ref);
1802        self.drop_without_shutdown();
1803        _result
1804    }
1805
1806    fn send_raw(&self, mut view_ref: fidl_fuchsia_ui_views::ViewRef) -> Result<(), fidl::Error> {
1807        self.control_handle.inner.send::<ChildViewWatcherGetViewRefResponse>(
1808            (&mut view_ref,),
1809            self.tx_id,
1810            0x3b2f3ca31e8908b4,
1811            fidl::encoding::DynamicFlags::empty(),
1812        )
1813    }
1814}
1815
1816#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1817pub struct FlatlandMarker;
1818
1819impl fidl::endpoints::ProtocolMarker for FlatlandMarker {
1820    type Proxy = FlatlandProxy;
1821    type RequestStream = FlatlandRequestStream;
1822    #[cfg(target_os = "fuchsia")]
1823    type SynchronousProxy = FlatlandSynchronousProxy;
1824
1825    const DEBUG_NAME: &'static str = "fuchsia.ui.composition.Flatland";
1826}
1827impl fidl::endpoints::DiscoverableProtocolMarker for FlatlandMarker {}
1828
1829pub trait FlatlandProxyInterface: Send + Sync {
1830    fn r#release_image_immediately(&self, image_id: &ContentId) -> Result<(), fidl::Error>;
1831    fn r#release_image_immediately2(&self, image_id: &ImageId) -> Result<(), fidl::Error>;
1832    fn r#create_layer(&self, layer_id: &LayerId) -> Result<(), fidl::Error>;
1833    fn r#release_layer(&self, layer_id: &LayerId) -> Result<(), fidl::Error>;
1834    fn r#set_layer_image(
1835        &self,
1836        layer_id: &LayerId,
1837        image_id: &ImageId,
1838        acquire_fence: Option<WaitFence>,
1839        release_fence: Option<SignalFence>,
1840    ) -> Result<(), fidl::Error>;
1841    fn r#set_layer_properties(
1842        &self,
1843        layer_id: &LayerId,
1844        properties: &LayerProperties,
1845    ) -> Result<(), fidl::Error>;
1846    fn r#reset_layer(&self, layer_id: &LayerId) -> Result<(), fidl::Error>;
1847    fn r#create_layer_stack(&self, stack_id: &LayerStackId) -> Result<(), fidl::Error>;
1848    fn r#release_layer_stack(&self, stack_id: &LayerStackId) -> Result<(), fidl::Error>;
1849    fn r#set_stack_layers(
1850        &self,
1851        stack_id: &LayerStackId,
1852        layers: &[LayerId],
1853    ) -> Result<(), fidl::Error>;
1854    fn r#create_image2(
1855        &self,
1856        image_id: &ImageId,
1857        import_token: BufferCollectionImportToken,
1858        vmo_index: u32,
1859        properties: &ImageProperties,
1860    ) -> Result<(), fidl::Error>;
1861    fn r#release_image2(&self, image_id: &ImageId) -> Result<(), fidl::Error>;
1862    fn r#create_viewport2(
1863        &self,
1864        viewport_id: &ViewportId,
1865        token: fidl_fuchsia_ui_views::ViewportCreationToken,
1866        properties: &ViewportProperties,
1867        child_view_watcher: fidl::endpoints::ServerEnd<ChildViewWatcherMarker>,
1868    ) -> Result<(), fidl::Error>;
1869    type ReleaseViewport2ResponseFut: std::future::Future<
1870            Output = Result<fidl_fuchsia_ui_views::ViewportCreationToken, fidl::Error>,
1871        > + Send;
1872    fn r#release_viewport2(&self, viewport_id: &ViewportId) -> Self::ReleaseViewport2ResponseFut;
1873    fn r#set_viewport_properties2(
1874        &self,
1875        viewport_id: &ViewportId,
1876        properties: &ViewportProperties,
1877    ) -> Result<(), fidl::Error>;
1878    fn r#set_transform_content(
1879        &self,
1880        transform_id: &TransformId,
1881        content: Option<&TransformContent>,
1882    ) -> Result<(), fidl::Error>;
1883    fn r#present(&self, args: PresentArgs) -> Result<(), fidl::Error>;
1884    fn r#create_view(
1885        &self,
1886        token: fidl_fuchsia_ui_views::ViewCreationToken,
1887        parent_viewport_watcher: fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>,
1888    ) -> Result<(), fidl::Error>;
1889    fn r#create_view2(
1890        &self,
1891        token: fidl_fuchsia_ui_views::ViewCreationToken,
1892        view_identity: fidl_fuchsia_ui_views::ViewIdentityOnCreation,
1893        protocols: ViewBoundProtocols,
1894        parent_viewport_watcher: fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>,
1895    ) -> Result<(), fidl::Error>;
1896    fn r#create_transform(&self, transform_id: &TransformId) -> Result<(), fidl::Error>;
1897    fn r#set_translation(
1898        &self,
1899        transform_id: &TransformId,
1900        translation: &fidl_fuchsia_math::Vec_,
1901    ) -> Result<(), fidl::Error>;
1902    fn r#set_orientation(
1903        &self,
1904        transform_id: &TransformId,
1905        orientation: Orientation,
1906    ) -> Result<(), fidl::Error>;
1907    fn r#set_scale(
1908        &self,
1909        transform_id: &TransformId,
1910        scale: &fidl_fuchsia_math::VecF,
1911    ) -> Result<(), fidl::Error>;
1912    fn r#set_opacity(&self, transform_id: &TransformId, value: f32) -> Result<(), fidl::Error>;
1913    fn r#set_clip_boundary(
1914        &self,
1915        transform_id: &TransformId,
1916        rect: Option<&fidl_fuchsia_math::Rect>,
1917    ) -> Result<(), fidl::Error>;
1918    fn r#add_child(
1919        &self,
1920        parent_transform_id: &TransformId,
1921        child_transform_id: &TransformId,
1922    ) -> Result<(), fidl::Error>;
1923    fn r#remove_child(
1924        &self,
1925        parent_transform_id: &TransformId,
1926        child_transform_id: &TransformId,
1927    ) -> Result<(), fidl::Error>;
1928    fn r#replace_children(
1929        &self,
1930        parent_transform_id: &TransformId,
1931        new_child_transform_ids: &[TransformId],
1932    ) -> Result<(), fidl::Error>;
1933    fn r#set_root_transform(&self, transform_id: &TransformId) -> Result<(), fidl::Error>;
1934    fn r#set_hit_regions(
1935        &self,
1936        transform_id: &TransformId,
1937        regions: &[HitRegion],
1938    ) -> Result<(), fidl::Error>;
1939    fn r#set_infinite_hit_region(
1940        &self,
1941        transform_id: &TransformId,
1942        hit_test: HitTestInteraction,
1943    ) -> Result<(), fidl::Error>;
1944    fn r#create_viewport(
1945        &self,
1946        viewport_id: &ContentId,
1947        token: fidl_fuchsia_ui_views::ViewportCreationToken,
1948        properties: &ViewportProperties,
1949        child_view_watcher: fidl::endpoints::ServerEnd<ChildViewWatcherMarker>,
1950    ) -> Result<(), fidl::Error>;
1951    fn r#create_image(
1952        &self,
1953        image_id: &ContentId,
1954        import_token: BufferCollectionImportToken,
1955        vmo_index: u32,
1956        properties: &ImageProperties,
1957    ) -> Result<(), fidl::Error>;
1958    fn r#set_image_sample_region(
1959        &self,
1960        image_id: &ContentId,
1961        rect: &fidl_fuchsia_math::RectF,
1962    ) -> Result<(), fidl::Error>;
1963    fn r#set_image_destination_size(
1964        &self,
1965        image_id: &ContentId,
1966        size: &fidl_fuchsia_math::SizeU,
1967    ) -> Result<(), fidl::Error>;
1968    fn r#set_image_blending_function(
1969        &self,
1970        image_id: &ContentId,
1971        blend_mode: BlendMode,
1972    ) -> Result<(), fidl::Error>;
1973    fn r#set_image_blend_mode(
1974        &self,
1975        image_id: &ContentId,
1976        blend_mode: BlendMode2,
1977    ) -> Result<(), fidl::Error>;
1978    fn r#set_image_opacity(&self, image_id: &ContentId, val: f32) -> Result<(), fidl::Error>;
1979    fn r#set_image_flip(&self, image_id: &ContentId, flip: ImageFlip) -> Result<(), fidl::Error>;
1980    fn r#create_filled_rect(&self, rect_id: &ContentId) -> Result<(), fidl::Error>;
1981    fn r#set_solid_fill(
1982        &self,
1983        rect_id: &ContentId,
1984        color: &ColorRgba,
1985        size: &fidl_fuchsia_math::SizeU,
1986    ) -> Result<(), fidl::Error>;
1987    fn r#release_filled_rect(&self, rect_id: &ContentId) -> Result<(), fidl::Error>;
1988    fn r#set_content(
1989        &self,
1990        transform_id: &TransformId,
1991        content_id: &ContentId,
1992    ) -> Result<(), fidl::Error>;
1993    fn r#set_viewport_properties(
1994        &self,
1995        viewport_id: &ContentId,
1996        properties: &ViewportProperties,
1997    ) -> Result<(), fidl::Error>;
1998    fn r#release_transform(&self, transform_id: &TransformId) -> Result<(), fidl::Error>;
1999    fn r#release_view(&self) -> Result<(), fidl::Error>;
2000    type ReleaseViewportResponseFut: std::future::Future<
2001            Output = Result<fidl_fuchsia_ui_views::ViewportCreationToken, fidl::Error>,
2002        > + Send;
2003    fn r#release_viewport(&self, viewport_id: &ContentId) -> Self::ReleaseViewportResponseFut;
2004    fn r#release_image(&self, image_id: &ContentId) -> Result<(), fidl::Error>;
2005    fn r#clear(&self) -> Result<(), fidl::Error>;
2006    fn r#set_debug_name(&self, name: &str) -> Result<(), fidl::Error>;
2007}
2008#[derive(Debug)]
2009#[cfg(target_os = "fuchsia")]
2010pub struct FlatlandSynchronousProxy {
2011    client: fidl::client::sync::Client,
2012}
2013
2014#[cfg(target_os = "fuchsia")]
2015impl fidl::endpoints::SynchronousProxy for FlatlandSynchronousProxy {
2016    type Proxy = FlatlandProxy;
2017    type Protocol = FlatlandMarker;
2018
2019    fn from_channel(inner: fidl::Channel) -> Self {
2020        Self::new(inner)
2021    }
2022
2023    fn into_channel(self) -> fidl::Channel {
2024        self.client.into_channel()
2025    }
2026
2027    fn as_channel(&self) -> &fidl::Channel {
2028        self.client.as_channel()
2029    }
2030}
2031
2032#[cfg(target_os = "fuchsia")]
2033impl FlatlandSynchronousProxy {
2034    pub fn new(channel: fidl::Channel) -> Self {
2035        Self { client: fidl::client::sync::Client::new(channel) }
2036    }
2037
2038    pub fn into_channel(self) -> fidl::Channel {
2039        self.client.into_channel()
2040    }
2041
2042    /// Waits until an event arrives and returns it. It is safe for other
2043    /// threads to make concurrent requests while waiting for an event.
2044    pub fn wait_for_event(
2045        &self,
2046        deadline: zx::MonotonicInstant,
2047    ) -> Result<FlatlandEvent, fidl::Error> {
2048        FlatlandEvent::decode(self.client.wait_for_event::<FlatlandMarker>(deadline)?)
2049    }
2050
2051    /// Releases an image immediately, without waiting for the next present.
2052    pub fn r#release_image_immediately(&self, mut image_id: &ContentId) -> Result<(), fidl::Error> {
2053        self.client.send::<TrustedFlatlandReleaseImageImmediatelyRequest>(
2054            (image_id,),
2055            0x245e1ac080772c8,
2056            fidl::encoding::DynamicFlags::empty(),
2057        )
2058    }
2059
2060    /// Releases an Image immediately, without waiting for the next present. This is a trusted
2061    /// memory-eviction path.
2062    ///
2063    /// The Image is forcibly unbound from any Layers that currently reference it. Those Layers
2064    /// behave as if their image was simply never set (they are invisible, but retain their image
2065    /// properties) until their next `SetLayerImage()`.
2066    ///
2067    /// Any pending release fences for the evicted Image's bindings will signal at the earliest
2068    /// safe point.
2069    ///
2070    /// This method is only available if Flatland2 is enabled and the session is trusted.
2071    pub fn r#release_image_immediately2(&self, mut image_id: &ImageId) -> Result<(), fidl::Error> {
2072        self.client.send::<TrustedFlatlandReleaseImageImmediately2Request>(
2073            (image_id,),
2074            0x6d6a73d150589146,
2075            fidl::encoding::DynamicFlags::empty(),
2076        )
2077    }
2078
2079    /// A Layer is a type of `Content` that composites either a single `Image` or a solid
2080    /// color. It separates visual properties (such as size, flip, opacity, and blending)
2081    /// from the raw pixel data.
2082    ///
2083    /// Unlike typical `Content` items which represent a static visual resource, a Layer is designed
2084    /// to be a dynamic container for an image sequence. Typical usage involves setting the layer's
2085    /// visual properties and image metadata infrequently, and then rapidly swapping the active
2086    /// `Image` (e.g. on every frame) with another image of matching metadata.
2087    ///
2088    /// This separation allows a single `Image` resource to be reused across multiple layers with
2089    /// different visual configurations simultaneously.
2090    ///
2091    /// To use a Layer:
2092    /// 1. Create a `Layer` using [`CreateLayer`].
2093    /// 2. Set properties on the `Layer` via [`SetLayerProperties`], including the
2094    ///    composition mode.
2095    /// 3. For an image layer, associate an `Image` with the `Layer` via [`SetLayerImage`].
2096    /// 4. Add the `Layer` to a `LayerStack` via [`SetStackLayers`].
2097    /// 5. Set the `LayerStack` as the content of a node via [`SetTransformContent`].
2098    ///
2099    /// `layer_id` must satisfy the identifier rules documented on [`LayerId`].
2100    pub fn r#create_layer(&self, mut layer_id: &LayerId) -> Result<(), fidl::Error> {
2101        self.client.send::<Flatland2CreateLayerRequest>(
2102            (layer_id,),
2103            0x60837bb0ce59f8a9,
2104            fidl::encoding::DynamicFlags::empty(),
2105        )
2106    }
2107
2108    /// Released Layers will be garbage collected by the system once they are no longer necessary
2109    /// for rendering. For Layers, this means:
2110    /// - the Layer is no longer referenced by any LayerStack, and
2111    /// - any pending rendering that references the Layer is complete.
2112    ///
2113    /// `layer_id` must refer to a valid, unreleased Layer.
2114    pub fn r#release_layer(&self, mut layer_id: &LayerId) -> Result<(), fidl::Error> {
2115        self.client.send::<Flatland2ReleaseLayerRequest>(
2116            (layer_id,),
2117            0x60118a842b6f0756,
2118            fidl::encoding::DynamicFlags::empty(),
2119        )
2120    }
2121
2122    /// Associates an Image with the Layer.
2123    ///
2124    /// The binding is legal in any composition mode, and is sticky: it survives composition
2125    /// mode changes, and is replaced only by a later [`SetLayerImage`] call (or cleared by
2126    /// [`ResetLayer`]). The image is displayed only while the layer's composition mode is
2127    /// `IMAGE`.
2128    ///
2129    /// The bound image must be large enough for the layer's stored `sample_rect`; this is
2130    /// checked at [`fuchsia.ui.composition/Flatland.Present`], not here. See
2131    /// [`LayerProperties.sample_rect`].
2132    ///
2133    /// `layer_id` must refer to a valid, unreleased Layer.
2134    /// `image_id` must refer to a valid, unreleased Image.
2135    /// `acquire_fence` is an optional fence that must be signaled before the image is displayed.
2136    /// `release_fence` is an optional fence, signaled by Scenic when *this binding* no
2137    /// longer references the image. It is per-binding, not per-image: an image bound to
2138    /// several layers has one such fence per binding, and the image is safe to write only
2139    /// once every one of them has signaled.
2140    ///
2141    /// A binding is ended by:
2142    ///
2143    /// - being superseded by a later [`SetLayerImage`] on the same layer
2144    /// - [`ResetLayer`]
2145    /// - the layer ref-count reaching zero, either via [`ReleaseLayer`] or by being released
2146    ///   by a layer stack
2147    /// - destruction of the session, which ends every binding it holds
2148    ///
2149    /// For a binding ended while the session is alive, Scenic signals at the first frame
2150    /// retire after that point. Bindings that never reached the screen (e.g. one superseded
2151    /// within a single batch, or one lost when several
2152    /// [`fuchsia.ui.composition/Flatland.Present`] calls are squashed into a single
2153    /// frame) signal at that same retire rather than immediately. The signal is
2154    /// therefore conservative by at most one frame; it is never early.
2155    pub fn r#set_layer_image(
2156        &self,
2157        mut layer_id: &LayerId,
2158        mut image_id: &ImageId,
2159        mut acquire_fence: Option<WaitFence>,
2160        mut release_fence: Option<SignalFence>,
2161    ) -> Result<(), fidl::Error> {
2162        self.client.send::<Flatland2SetLayerImageRequest>(
2163            (layer_id, image_id, acquire_fence.as_mut(), release_fence.as_mut()),
2164            0x262302d9782d252c,
2165            fidl::encoding::DynamicFlags::empty(),
2166        )
2167    }
2168
2169    /// Sets properties of the Layer.
2170    ///
2171    /// The provided `properties` table is merged into the layer's stored properties: fields
2172    /// which are unset in `properties` retain their previously stored values. Stored
2173    /// properties are sticky; see [`LayerProperties`] for the full persistence semantics.
2174    ///
2175    /// Values are stored as given; validation which depends on other state (notably
2176    /// `sample_rect` against the bound image) happens at
2177    /// [`fuchsia.ui.composition/Flatland.Present`]. See [`LayerProperties.sample_rect`].
2178    ///
2179    /// `layer_id` must refer to a valid, unreleased Layer.
2180    pub fn r#set_layer_properties(
2181        &self,
2182        mut layer_id: &LayerId,
2183        mut properties: &LayerProperties,
2184    ) -> Result<(), fidl::Error> {
2185        self.client.send::<Flatland2SetLayerPropertiesRequest>(
2186            (layer_id, properties),
2187            0x282d0e902aae8bb0,
2188            fidl::encoding::DynamicFlags::empty(),
2189        )
2190    }
2191
2192    /// Unbinds any Image bound to the layer and clears every stored [`LayerProperties`]
2193    /// field, returning the layer to its freshly-created state (composition mode
2194    /// `INVISIBLE`, all properties at their documented defaults). This is the only
2195    /// operation which forgets stored layer properties.
2196    ///
2197    /// `layer_id` must refer to a valid, unreleased Layer.
2198    pub fn r#reset_layer(&self, mut layer_id: &LayerId) -> Result<(), fidl::Error> {
2199        self.client.send::<Flatland2ResetLayerRequest>(
2200            (layer_id,),
2201            0x17bf541bf216ab2b,
2202            fidl::encoding::DynamicFlags::empty(),
2203        )
2204    }
2205
2206    /// Creates a new layer stack with the specified `stack_id`.
2207    ///
2208    /// `stack_id` must satisfy the identifier rules documented on [`LayerId`].
2209    pub fn r#create_layer_stack(&self, mut stack_id: &LayerStackId) -> Result<(), fidl::Error> {
2210        self.client.send::<Flatland2CreateLayerStackRequest>(
2211            (stack_id,),
2212            0x70debe3cd7371aa6,
2213            fidl::encoding::DynamicFlags::empty(),
2214        )
2215    }
2216
2217    /// Releases the layer stack with the specified `stack_id`.
2218    pub fn r#release_layer_stack(&self, mut stack_id: &LayerStackId) -> Result<(), fidl::Error> {
2219        self.client.send::<Flatland2ReleaseLayerStackRequest>(
2220            (stack_id,),
2221            0x3ad3151aece3b1bb,
2222            fidl::encoding::DynamicFlags::empty(),
2223        )
2224    }
2225
2226    /// Sets the layers in the stack. The order of layers in the vector determines their Z-order,
2227    /// with the first element being the back-most and the last element being the front-most.
2228    ///
2229    /// `stack_id` must refer to a valid, unreleased LayerStack. Each element of `layers`
2230    /// must refer to a valid, unreleased Layer. Duplicate layers within `layers` are
2231    /// disallowed.
2232    pub fn r#set_stack_layers(
2233        &self,
2234        mut stack_id: &LayerStackId,
2235        mut layers: &[LayerId],
2236    ) -> Result<(), fidl::Error> {
2237        self.client.send::<Flatland2SetStackLayersRequest>(
2238            (stack_id, layers),
2239            0x1e0bff0f5cca065a,
2240            fidl::encoding::DynamicFlags::empty(),
2241        )
2242    }
2243
2244    /// Creates an Image resource.
2245    ///
2246    /// `image_id` must satisfy the identifier rules documented on [`LayerId`].
2247    pub fn r#create_image2(
2248        &self,
2249        mut image_id: &ImageId,
2250        mut import_token: BufferCollectionImportToken,
2251        mut vmo_index: u32,
2252        mut properties: &ImageProperties,
2253    ) -> Result<(), fidl::Error> {
2254        self.client.send::<Flatland2CreateImage2Request>(
2255            (image_id, &mut import_token, vmo_index, properties),
2256            0x677fa7b23aaca46,
2257            fidl::encoding::DynamicFlags::empty(),
2258        )
2259    }
2260
2261    /// Released Images will be garbage collected by the system once they are no longer necessary
2262    /// for rendering. For Images, this means:
2263    /// - the Image is no longer bound to any Layer, and
2264    /// - any pending rendering that references the Image is complete.
2265    ///
2266    /// The `image_id` value is freed for reuse immediately by the client (identifier uniqueness
2267    /// is instantaneous).
2268    ///
2269    /// Note: Per-binding release fences (passed to `SetLayerImage`) are unaffected by this call.
2270    /// They track the lifecycle of individual layer bindings, not the client's `image_id`.
2271    ///
2272    /// `image_id` must refer to a valid, unreleased Image.
2273    pub fn r#release_image2(&self, mut image_id: &ImageId) -> Result<(), fidl::Error> {
2274        self.client.send::<Flatland2ReleaseImage2Request>(
2275            (image_id,),
2276            0x7d0a041ed51aca06,
2277            fidl::encoding::DynamicFlags::empty(),
2278        )
2279    }
2280
2281    /// Creates a Viewport resource.
2282    ///
2283    /// `viewport_id` must satisfy the identifier rules documented on [`LayerId`].
2284    pub fn r#create_viewport2(
2285        &self,
2286        mut viewport_id: &ViewportId,
2287        mut token: fidl_fuchsia_ui_views::ViewportCreationToken,
2288        mut properties: &ViewportProperties,
2289        mut child_view_watcher: fidl::endpoints::ServerEnd<ChildViewWatcherMarker>,
2290    ) -> Result<(), fidl::Error> {
2291        self.client.send::<Flatland2CreateViewport2Request>(
2292            (viewport_id, &mut token, properties, child_view_watcher),
2293            0x1b646776764f1128,
2294            fidl::encoding::DynamicFlags::empty(),
2295        )
2296    }
2297
2298    /// Releases a Viewport from the scene.
2299    pub fn r#release_viewport2(
2300        &self,
2301        mut viewport_id: &ViewportId,
2302        ___deadline: zx::MonotonicInstant,
2303    ) -> Result<fidl_fuchsia_ui_views::ViewportCreationToken, fidl::Error> {
2304        let _response = self.client.send_query::<
2305            Flatland2ReleaseViewport2Request,
2306            Flatland2ReleaseViewport2Response,
2307            FlatlandMarker,
2308        >(
2309            (viewport_id,),
2310            0x18ef77414c7a9ae3,
2311            fidl::encoding::DynamicFlags::empty(),
2312            ___deadline,
2313        )?;
2314        Ok(_response.token)
2315    }
2316
2317    /// Sets the properties of a Viewport.
2318    pub fn r#set_viewport_properties2(
2319        &self,
2320        mut viewport_id: &ViewportId,
2321        mut properties: &ViewportProperties,
2322    ) -> Result<(), fidl::Error> {
2323        self.client.send::<Flatland2SetViewportProperties2Request>(
2324            (viewport_id, properties),
2325            0x95f2ec3b9e4beea,
2326            fidl::encoding::DynamicFlags::empty(),
2327        )
2328    }
2329
2330    /// Sets (or clears) the content of a Transform.
2331    ///
2332    /// The same content may be attached to more than one Transform; each attachment composites
2333    /// that content again under its own Transform's matrix, clip, and opacity, so a single
2334    /// LayerStack or Viewport can appear repeatedly in a scene without the client duplicating the
2335    /// underlying resources.
2336    ///
2337    /// A Transform's content can be cleared by not providing the optional `content`.
2338    ///
2339    /// If `content` is set, it must refer to a valid, unreleased LayerStack or Viewport.
2340    /// Unlike classic [`Flatland.SetContent`], a zero id does not clear the content.
2341    pub fn r#set_transform_content(
2342        &self,
2343        mut transform_id: &TransformId,
2344        mut content: Option<&TransformContent>,
2345    ) -> Result<(), fidl::Error> {
2346        self.client.send::<Flatland2SetTransformContentRequest>(
2347            (transform_id, content),
2348            0x17e33f64f55e4ea9,
2349            fidl::encoding::DynamicFlags::empty(),
2350        )
2351    }
2352
2353    /// Complete execution of all feed-forward operations.
2354    ///
2355    /// If executing an operation produces an error (e.g., CreateTransform(0)), an [`OnError`] event
2356    /// is emitted. Operations that produce errors are ignored and the channel is closed.
2357    ///
2358    /// If execution completes successfully, [`OnNextFrameBegin`] is emitted with valid frame
2359    /// production information.
2360    ///
2361    /// The client may only call [`Present`] when they have a non-zero number of present credits,
2362    /// which are tracked by the server. The server may increment the number of credits when it
2363    /// fires the [`OnNextFrameBegin`] event, which informs the client when it receives additional
2364    /// present credits. Each [`Present`] call uses one present credit and decrements the server
2365    /// count by one. If the client calls [`Present`] with no present credits, the server will
2366    /// return a `NO_PRESENTS_REMAINING` error.
2367    ///
2368    /// The client should assume that prior to receiving any [`OnNextFrameBegin`] events, they have
2369    /// one present credit.
2370    ///
2371    /// Every [`Present`] call results in one [`OnNextFrameBegin`] event, and one
2372    /// [`OnFramePresented`] event, typically in that order.
2373    ///
2374    /// When the commands flushed by [`Present`] make it to display, an [`OnFramePresented`] event
2375    /// is fired. This event includes information pertaining to all [`Present`]s that had content
2376    /// that were part of that frame.
2377    ///
2378    /// See [`fuchsia.ui.composition/PresentArgs`] documentation above for more detailed information
2379    /// on what arguments are passed in and their role.
2380    pub fn r#present(&self, mut args: PresentArgs) -> Result<(), fidl::Error> {
2381        self.client.send::<FlatlandPresentRequest>(
2382            (&mut args,),
2383            0x50acc2aa1f0acec7,
2384            fidl::encoding::DynamicFlags::empty(),
2385        )
2386    }
2387
2388    /// Two Flatland sessions may be connected in a parent-child relationship. The parent endpoint
2389    /// is held in a Viewport, and the child endpoint is held in a View. The parent Flatland
2390    /// session that creates a Viewport has control over how the child's View is integrated into
2391    /// its own View.
2392    ///
2393    /// The lifecycle of a parent-child connection starts with two endpoints of a channel object:
2394    /// a ViewportCreationToken and a ViewCreationToken. Out-of-band protocols pass the
2395    /// ViewportCreationToken to the parent, which calls [`CreateViewport`], and the
2396    /// ViewCreationToken to the child, which calls [`CreateView`].
2397    ///
2398    /// Only nodes connected to the Root Transform in this Flatland session will be rendered into
2399    /// the parent's Viewport.
2400    ///
2401    /// Calling [`CreateView`] a second time will disconnect the Root Transform from the existing
2402    /// parent's Viewport, and attach it to a new parent's Viewport. In other words, each View can
2403    /// only have one parent.
2404    ///
2405    /// This function is queued, meaning that the Root Transform will not be attached to the
2406    /// parent Viewport until [`Present`] is called. However, clients will receive information
2407    /// through their ParentViewportWatcher (e.g., LayoutInfo) immediately after calling this
2408    /// function, even if they have not called [`Present`] or [`SetRootTransform`]. This allows
2409    /// clients to wait for layout information from their parent before calling [`Present`].
2410    ///
2411    /// Any illegal operations on ParentViewportWatcher will cause both ParentViewportWatcher
2412    /// channel and this Flatland channel to be torn down.
2413    ///
2414    /// Lifecycle note. The lifetime of the ParentViewportWatcher channel is bound by the peer
2415    /// ViewportCreationToken. When the ViewportCreationToken dies, this ParentViewportWatcher
2416    /// channel is destroyed.
2417    ///
2418    /// Views and subgraphs of Views created using `CreateView` will not be represented in the
2419    /// ViewTree, and hence will not be able to participate in any ViewTree-dependent interactions
2420    /// such as touch, mouse or focus.
2421    /// The Flatland protocol provides no way for Views in the subgraph of a View created with
2422    /// `CreateView` to know that they are excluded from the ViewTree.
2423    pub fn r#create_view(
2424        &self,
2425        mut token: fidl_fuchsia_ui_views::ViewCreationToken,
2426        mut parent_viewport_watcher: fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>,
2427    ) -> Result<(), fidl::Error> {
2428        self.client.send::<FlatlandCreateViewRequest>(
2429            (&mut token, parent_viewport_watcher),
2430            0x504686eb25864780,
2431            fidl::encoding::DynamicFlags::empty(),
2432        )
2433    }
2434
2435    /// Identical to [`CreateView`], except it allows association of View identity (ViewRef) and
2436    /// view-bound protocols.
2437    pub fn r#create_view2(
2438        &self,
2439        mut token: fidl_fuchsia_ui_views::ViewCreationToken,
2440        mut view_identity: fidl_fuchsia_ui_views::ViewIdentityOnCreation,
2441        mut protocols: ViewBoundProtocols,
2442        mut parent_viewport_watcher: fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>,
2443    ) -> Result<(), fidl::Error> {
2444        self.client.send::<FlatlandCreateView2Request>(
2445            (&mut token, &mut view_identity, &mut protocols, parent_viewport_watcher),
2446            0x340a3a40c2fdbd5e,
2447            fidl::encoding::DynamicFlags::empty(),
2448        )
2449    }
2450
2451    /// Creates a new Transform node. Transforms are a hierarchical piece of a Flatland graph. They
2452    /// can have children, and can reference Content. A sub-graph represented by a Transform and its
2453    /// descendants can be rendered to a display.
2454    ///
2455    /// Transforms are kept alive, even when released, as long as they are children of either an
2456    /// unreleased Transform, or the Root Transform.
2457    ///
2458    /// Each Transform can have a single piece of attached Content. Common types of Content include
2459    /// bitmaps, asynchronous streams of images, and Viewports to Views hosted in other Flatland
2460    /// sessions.
2461    ///
2462    /// Transforms have attributes. Child Transforms inherit the combined attributes of their
2463    /// parents. Content attached to a Transform is also affected by that Transform's attributes.
2464    ///
2465    /// When a sub-graph of Transforms is rendered, Content will be rendered back-to-front, starting
2466    /// with the Content on the root transform, and continuing recursively through all of its child
2467    /// Transforms in the order the children were added. See [`AddChild`] for more information.
2468    ///
2469    /// Zero is not a valid transform id. All other values are valid, assuming they are not already
2470    /// in use (see [`ReleaseTransform`] for more details).
2471    pub fn r#create_transform(&self, mut transform_id: &TransformId) -> Result<(), fidl::Error> {
2472        self.client.send::<FlatlandCreateTransformRequest>(
2473            (transform_id,),
2474            0x5e042a4d3de3efb0,
2475            fidl::encoding::DynamicFlags::empty(),
2476        )
2477    }
2478
2479    /// All Transform objects support all attributes.
2480    ///
2481    /// Geometric attributes are applied in the following order:
2482    /// 1. Scale (relative to the parent transform's coordinate space)
2483    /// 2. Orientation (relative to the parent transform's coordinate space)
2484    /// 3. Translation (relative to the parent transforms's coordinate space,
2485    ///    unaffected by scale applied to the current transform).
2486    /// 4. Clipping (relative to the current transform's coordinate space)
2487    ///
2488    /// The effects of each of these attributes are cumulative. This means the transform's position
2489    /// in the view space, and its clip boundary, will be calculated based on that chain of
2490    /// geometric attributes going up to the root transform.
2491    ///
2492    /// For instance, in a nested hierarchy such as the following:
2493    ///     [Root-Transform -> Transform1 -> Transform2 -> CurrentTransform]
2494    /// If Transform1 is translated by [2,0] and Transform2 is translated by [0,1] then the
2495    /// view-space position of CurrentTransform will be [2,1].
2496    ///
2497    /// Sets the translation on a Transform. The order of geometric attribute application is
2498    /// addressed above.
2499    pub fn r#set_translation(
2500        &self,
2501        mut transform_id: &TransformId,
2502        mut translation: &fidl_fuchsia_math::Vec_,
2503    ) -> Result<(), fidl::Error> {
2504        self.client.send::<FlatlandSetTranslationRequest>(
2505            (transform_id, translation),
2506            0x7863398291fba346,
2507            fidl::encoding::DynamicFlags::empty(),
2508        )
2509    }
2510
2511    /// Sets the orientation on a Transform. The order of geometric attribute application is
2512    /// addressed in the documentation for [`SetTranslation`]. In Flatland, the +X axis is
2513    /// to the right and the +Y axis is down. There is no notion of a Z axis. CCW is defined
2514    /// from the POV of the user, as if a skeuomorphoic clock is displayed on the screen.
2515    pub fn r#set_orientation(
2516        &self,
2517        mut transform_id: &TransformId,
2518        mut orientation: Orientation,
2519    ) -> Result<(), fidl::Error> {
2520        self.client.send::<FlatlandSetOrientationRequest>(
2521            (transform_id, orientation),
2522            0x4915310bc4928edc,
2523            fidl::encoding::DynamicFlags::empty(),
2524        )
2525    }
2526
2527    /// Sets the scale on a transform. The order of geometric attribute application is
2528    /// addressed above. The (x,y) values in the VecF |scale| refer to the scale factor in the
2529    /// x-axis (width) and y-axis (height) respectively. Scale values must be positive 32-bit
2530    /// floating point values: https://en.wikipedia.org/wiki/Normal_number_%28computing%29
2531    pub fn r#set_scale(
2532        &self,
2533        mut transform_id: &TransformId,
2534        mut scale: &fidl_fuchsia_math::VecF,
2535    ) -> Result<(), fidl::Error> {
2536        self.client.send::<FlatlandSetScaleRequest>(
2537            (transform_id, scale),
2538            0x1ea1766fd8996bb4,
2539            fidl::encoding::DynamicFlags::empty(),
2540        )
2541    }
2542
2543    /// Sets an opacity in linear space to be applied to a transform and its descendents,
2544    /// which include other transforms and content. Opacity values must be in the range
2545    /// of [0.0, 1.0], where 0.0 is completely transparent and 1.0 is completely opaque.
2546    /// Attempting to call this function with values outside that range will result in
2547    /// an error. A transform's opacity value is multiplied with that of its parent. This
2548    /// effect works differently from group opacity. Using group opacity, child nodes are
2549    /// rendered together first, and then have the parent's opacity applied as a post-effect.
2550    /// Here, opacity is applied to each child individually. This may result in a very
2551    /// different effect.
2552    pub fn r#set_opacity(
2553        &self,
2554        mut transform_id: &TransformId,
2555        mut value: f32,
2556    ) -> Result<(), fidl::Error> {
2557        self.client.send::<FlatlandSetOpacityRequest>(
2558            (transform_id, value),
2559            0x3775fc2c00b432fa,
2560            fidl::encoding::DynamicFlags::empty(),
2561        )
2562    }
2563
2564    /// Sets the bounds, expressed in the local coordinate space of the transform, that
2565    /// constrains the region that content attached to this transform can be rendered to.
2566    /// If the content's area exceeds the clip bounds, the area outside the bounds will
2567    /// not be rendered. These bounds are valid for all children of this transform node as
2568    /// well, which includes nested Flatland sessions and their node hierarchies.
2569    /// If a child transform attempts to set clip bounds larger than that of its parent,
2570    /// it will be clipped to the parent's clip bounds. The default state is for a transform
2571    /// to be unclipped, meaning it will not have any bounds placed on its render region.
2572    /// The clip width/height must be positive. Negative values will result in an error.
2573    /// Passing in an empty box to the |rect| parameter will remove the clip bounds.
2574    pub fn r#set_clip_boundary(
2575        &self,
2576        mut transform_id: &TransformId,
2577        mut rect: Option<&fidl_fuchsia_math::Rect>,
2578    ) -> Result<(), fidl::Error> {
2579        self.client.send::<FlatlandSetClipBoundaryRequest>(
2580            (transform_id, rect),
2581            0x6507843df12222d2,
2582            fidl::encoding::DynamicFlags::empty(),
2583        )
2584    }
2585
2586    /// Adds a child Transform to a parent Transform. The new child Transform,
2587    /// and any Content attached to it or its children, will be rendered on top
2588    /// of the parent's Content, as well as any previously added children.
2589    ///
2590    /// The caller must ensure that `child_transform_id` is valid and that there
2591    /// are no repetitions.  Sending a repeated `child_transform_id` over
2592    /// multiple calls will result in session closure.
2593    pub fn r#add_child(
2594        &self,
2595        mut parent_transform_id: &TransformId,
2596        mut child_transform_id: &TransformId,
2597    ) -> Result<(), fidl::Error> {
2598        self.client.send::<FlatlandAddChildRequest>(
2599            (parent_transform_id, child_transform_id),
2600            0x67a8abd2f19b1a74,
2601            fidl::encoding::DynamicFlags::empty(),
2602        )
2603    }
2604
2605    /// Removes a child Transform from a parent Transform.
2606    pub fn r#remove_child(
2607        &self,
2608        mut parent_transform_id: &TransformId,
2609        mut child_transform_id: &TransformId,
2610    ) -> Result<(), fidl::Error> {
2611        self.client.send::<FlatlandRemoveChildRequest>(
2612            (parent_transform_id, child_transform_id),
2613            0x41d6cd90b298b67a,
2614            fidl::encoding::DynamicFlags::empty(),
2615        )
2616    }
2617
2618    /// Removes all child Transforms from a parent Transform and replaces them
2619    /// with the new child transforms in `new_child_transform_ids`.  The caller
2620    /// must ensure that all `TransformId` values in `new_child_transform_ids`
2621    /// are valid and that there are no repetitions.  Sending a repeated
2622    /// `TransformId` in `new_child_transform_ids` will result in session
2623    /// closure.
2624    pub fn r#replace_children(
2625        &self,
2626        mut parent_transform_id: &TransformId,
2627        mut new_child_transform_ids: &[TransformId],
2628    ) -> Result<(), fidl::Error> {
2629        self.client.send::<FlatlandReplaceChildrenRequest>(
2630            (parent_transform_id, new_child_transform_ids),
2631            0x5b6d86cbbff81316,
2632            fidl::encoding::DynamicFlags::empty(),
2633        )
2634    }
2635
2636    /// Sets the Root Transform for the graph.
2637    ///
2638    /// The sub-graph defined by the Root Transform and its children will be rendered as View
2639    /// in the connected parent's Viewport (see [`CreateView`]). Any parents of the Root Transform
2640    /// in this Graph will be ignored.
2641    ///
2642    /// The Root Transform, and all children of the Root Transform, are kept alive if they are
2643    /// released (see [`ReleaseTransform`] for more details).
2644    ///
2645    /// There is only ever one Root. Since 0 is not a valid transform id (see [`CreateTransform`]),
2646    /// calling SetRootTransform(0) clears the current Root, destroying any previously released
2647    /// objects that are not referenced by the new root.
2648    ///
2649    /// Note that every View has a clip boundary equivalent to its logical size. Anything outside
2650    /// that clip boundary will not be rendered. Hence, the Root Transform has a useful coordinate
2651    /// space of (0, 0) to (logical_size.width, logical_size.height), where (0, 0) is the upper left
2652    /// corner.
2653    ///
2654    /// Setting the root transform installs a full screen hit region on the root transform. Clients
2655    /// may remove this hit region if they don't want users to be able to interact with the root
2656    /// transform's content. For additional details on hit regions, see the [`SetHitRegions`]
2657    /// documentation.
2658    ///
2659    /// Default hit region rules
2660    ///
2661    ///   A default hit region follows these rules:
2662    ///   - When [`SetRootTransform`](T) is called, T receives a maximal hit region, covering the
2663    ///   entire view.
2664    ///   - If [`SetHitRegions`] is called on T, either before or after [`SetRootTransform`](T),
2665    ///   then no default hit region is active and the client specified hit regions are used.
2666    ///   - If a transform is no longer the root transform, i.e., [`SetRootTransform`](U) is
2667    ///   called, then the original transform no longer has its default hit region.
2668    ///   - Clients can remove or modify the root transform's hit regions the same way they would
2669    ///   reset any other transform's hit regions, by calling [`SetHitRegions`] with the appropriate
2670    ///   vector.
2671    pub fn r#set_root_transform(&self, mut transform_id: &TransformId) -> Result<(), fidl::Error> {
2672        self.client.send::<FlatlandSetRootTransformRequest>(
2673            (transform_id,),
2674            0x6e80ca5bcc566cd8,
2675            fidl::encoding::DynamicFlags::empty(),
2676        )
2677    }
2678
2679    /// Sets the interactive areas for a Transform. By default, Content is not interactive; hit
2680    /// regions must be placed for a user to interact with the Content in a View. Because hit
2681    /// regions are described in the Flatland protocol, a Flatland session can synchronize Content
2682    /// and hit regions.
2683    ///
2684    /// Each hit region is placed in the coordinate space of the owning Transform, and may or may
2685    /// not interact with different types of hit testing, depending on its [`HitTestInteraction`]
2686    /// type. When there are multiple hit regions that intersect with a hit test, the precedence
2687    /// rules given below dictate which hit region has interacted with the hit test. Only Transforms
2688    /// that transitively connect to the root Transform have their hit regions interact with a hit
2689    /// test.
2690    ///
2691    /// Calling this function replaces any previous values set on this Transform. To reset a
2692    /// Transform to "no hit testing": send an empty vector with [`SetHitRegions`].
2693    ///
2694    /// Note that root transforms get a default hit region installed by Flatland. For more details,
2695    /// see the [`SetRootTransform`] documentation.
2696    ///
2697    /// Precedence rules
2698    ///   Within a Transform, if multiple hit regions overlap, the hit test examines each
2699    ///   intersecting hit region for a possible interaction. Thus, for a regular hit test R and an
2700    ///   accessibility hit test A, where R and A both intersect two hit regions D ([`DEFAULT`]) and
2701    ///   S ([`SEMANTICALLY_INVISIBLE`]) on the same Transform, (1) R interacts with both D and S,
2702    ///   and (2) A only interacts with D. Generally, hit regions that overlap in a single Transform
2703    ///   can cause confusing behavior.
2704    ///
2705    ///   Within a View, for a given hit test, the front-most Transform's hit regions take
2706    ///   precedence over those behind. This follows the expected reverse "render order" of
2707    ///   Transforms (described in [`CreateTransform`]), where a user expects to interact with
2708    ///   Content that is visible, or front-most.
2709    ///
2710    ///   Across Flatland sessions, for a given hit test, the front-most session's front-most
2711    ///   Transform's hit regions take precedence over those behind. This follows the expected
2712    ///   reverse "render order" of views, where a user expects to interact with the View that is
2713    ///   visible, or front-most. For example, if a child View owns Content that is rendered over
2714    ///   the parent View, the user expects to interact with the child's Content.
2715    pub fn r#set_hit_regions(
2716        &self,
2717        mut transform_id: &TransformId,
2718        mut regions: &[HitRegion],
2719    ) -> Result<(), fidl::Error> {
2720        self.client.send::<FlatlandSetHitRegionsRequest>(
2721            (transform_id, regions),
2722            0x31c9d17b07c37ce4,
2723            fidl::encoding::DynamicFlags::empty(),
2724        )
2725    }
2726
2727    /// Identical to [`SetHitRegions`], except the hit region associated with [`transform_id`]
2728    /// covers an infinite region. The hit region is invariant against translation, scaling, and
2729    /// orientation of the Transform.
2730    ///
2731    /// An infinite hit region is still limited in extent by the View's clip boundary, just like a
2732    /// finite hit region.
2733    ///
2734    /// Calling this function replaces any previous values set on this Transform. To reset a
2735    /// Transform to "no hit testing": send an empty vector with [`SetHitRegions`].
2736    pub fn r#set_infinite_hit_region(
2737        &self,
2738        mut transform_id: &TransformId,
2739        mut hit_test: HitTestInteraction,
2740    ) -> Result<(), fidl::Error> {
2741        self.client.send::<FlatlandSetInfiniteHitRegionRequest>(
2742            (transform_id, hit_test),
2743            0x26d81af852d29562,
2744            fidl::encoding::DynamicFlags::empty(),
2745        )
2746    }
2747
2748    /// The Viewport and View pair, together, represent the connection between two Flatland
2749    /// sessions. The Viewport is created in the parent, and the View is created in the child. The
2750    /// parent has control over how the child's View is integrated into its own View.
2751    ///
2752    /// Any illegal operations on ChildViewWatcher will cause both ChildViewWatcher channel and this
2753    /// Flatland channel to be torn down.
2754    ///
2755    /// `ViewportProperties` must have logical_size set. This is the initial size that will drive
2756    /// the layout of the child. The logical_size is also used as the default Content size, but
2757    /// subsequent changes to the logical_size will have no effect on the Content size.
2758    ///
2759    /// `ViewportProperties` may have inset field not set. In that case, the default value of
2760    /// (0, 0, 0, 0) is used.
2761    ///
2762    /// The logical_size must have positive X and Y components.
2763    ///
2764    /// Lifecycle note. The lifetime of the ChildViewWatcher channel is bound by the peer
2765    /// ViewCreationToken. When the ViewCreationToken dies, this ChildViewWatcher channel is
2766    /// destroyed.
2767    ///
2768    /// `viewport_id` must satisfy standard [`ContentId`] creation constraints.
2769    pub fn r#create_viewport(
2770        &self,
2771        mut viewport_id: &ContentId,
2772        mut token: fidl_fuchsia_ui_views::ViewportCreationToken,
2773        mut properties: &ViewportProperties,
2774        mut child_view_watcher: fidl::endpoints::ServerEnd<ChildViewWatcherMarker>,
2775    ) -> Result<(), fidl::Error> {
2776        self.client.send::<FlatlandCreateViewportRequest>(
2777            (viewport_id, &mut token, properties, child_view_watcher),
2778            0x2485fbcab7f943c,
2779            fidl::encoding::DynamicFlags::empty(),
2780        )
2781    }
2782
2783    /// An Image is a bitmap backed by a specific VMO in a BufferCollection.
2784    ///
2785    /// Image creation requires an allocated BufferCollection registered with Allocator. This
2786    /// function will fail unless all clients of the specified BufferCollection have set their
2787    /// constraints.
2788    ///
2789    /// The Image must reference a valid VMO index and must have ImageProperties that fall within
2790    /// the constraints specified by the backing BufferCollection (i.e. width and height within a
2791    /// valid range, etc.)
2792    ///
2793    /// `image_id` must satisfy standard [`ContentId`] creation constraints.
2794    pub fn r#create_image(
2795        &self,
2796        mut image_id: &ContentId,
2797        mut import_token: BufferCollectionImportToken,
2798        mut vmo_index: u32,
2799        mut properties: &ImageProperties,
2800    ) -> Result<(), fidl::Error> {
2801        self.client.send::<FlatlandCreateImageRequest>(
2802            (image_id, &mut import_token, vmo_index, properties),
2803            0x26fae823c4ebedad,
2804            fidl::encoding::DynamicFlags::empty(),
2805        )
2806    }
2807
2808    /// This function is used to determine the region (in texel space) of an image that will be used
2809    /// by Flatland when rendering. The image to be sampled is referenced by [`image_id`] and the
2810    /// sample region is specified by [`rect`] which itself is comprised of an origin point (x,y) as
2811    /// well as a width and height, in unnormalized coordinates. It is illegal to call this function
2812    /// on non-image content, or to sample a region outside of the texel space of the image. In
2813    /// other words, the region specifed by [`rect`] must not exceed the ranges (0, image_width) and
2814    /// (0, image_height). If (rect.x + rect.width > image_width) or (rect.y + rect.height >
2815    /// image_height) or if any of the values are negative, this will result in an error.
2816    ///
2817    /// If this method is not called, the default sample region is the rectangle with origin at
2818    /// (0, 0) and width and height set at ImageProperties from [`CreateImage`].
2819    ///
2820    /// `image_id` must refer to a valid, unreleased Image.
2821    pub fn r#set_image_sample_region(
2822        &self,
2823        mut image_id: &ContentId,
2824        mut rect: &fidl_fuchsia_math::RectF,
2825    ) -> Result<(), fidl::Error> {
2826        self.client.send::<FlatlandSetImageSampleRegionRequest>(
2827            (image_id, rect),
2828            0x8039391d715eb28,
2829            fidl::encoding::DynamicFlags::empty(),
2830        )
2831    }
2832
2833    /// The content size for an Image is the size of the rectangle in the parent's logical
2834    /// coordinate space that the image occupies. This combined with the global translation of the
2835    /// transform it is attached to determines the size and location of where the content is
2836    /// rendered on the display.
2837    ///
2838    /// If this method is not called, the default image destination size is the width and height set
2839    /// at ImageProperties from [`CreateImage`]. The destination size will be affected by scaling if
2840    /// [`SetScale`] is used on the attached Transform or its parents.
2841    pub fn r#set_image_destination_size(
2842        &self,
2843        mut image_id: &ContentId,
2844        mut size: &fidl_fuchsia_math::SizeU,
2845    ) -> Result<(), fidl::Error> {
2846        self.client.send::<FlatlandSetImageDestinationSizeRequest>(
2847            (image_id, size),
2848            0x766cf99a2ec58446,
2849            fidl::encoding::DynamicFlags::empty(),
2850        )
2851    }
2852
2853    /// Determines the blend function to use when rendering the content specified by
2854    /// |image_id|. |image_id| must be a valid ContentId associated to a transform through
2855    /// a call to |CreateImage| or |CreateFilledRect|. For details on the different blend functions
2856    /// that are available, please refer to the BlendMode enum. If this function is not called, then
2857    /// the default blendmode is BlendMode::SRC.
2858    pub fn r#set_image_blending_function(
2859        &self,
2860        mut image_id: &ContentId,
2861        mut blend_mode: BlendMode,
2862    ) -> Result<(), fidl::Error> {
2863        self.client.send::<FlatlandSetImageBlendingFunctionRequest>(
2864            (image_id, blend_mode),
2865            0x10f5da1356275b7b,
2866            fidl::encoding::DynamicFlags::empty(),
2867        )
2868    }
2869
2870    /// Determines the blend function to use when rendering the content specified by
2871    /// |image_id|. |image_id| must be a valid ContentId associated to a transform through
2872    /// a call to |CreateImage| or |CreateFilledRect|. For details on the different blend functions
2873    /// that are available, please refer to the BlendMode2 enum. If this function is not called,
2874    /// the default blendmode is BlendMode2::REPLACE.
2875    pub fn r#set_image_blend_mode(
2876        &self,
2877        mut image_id: &ContentId,
2878        mut blend_mode: BlendMode2,
2879    ) -> Result<(), fidl::Error> {
2880        self.client.send::<FlatlandSetImageBlendModeRequest>(
2881            (image_id, blend_mode),
2882            0x5b1667f130c3de67,
2883            fidl::encoding::DynamicFlags::empty(),
2884        )
2885    }
2886
2887    /// Sets an opacity in linear space to be applied to a flatland image. Opacity values must
2888    /// be in the range [0.0, 1.0].
2889    pub fn r#set_image_opacity(
2890        &self,
2891        mut image_id: &ContentId,
2892        mut val: f32,
2893    ) -> Result<(), fidl::Error> {
2894        self.client.send::<FlatlandSetImageOpacityRequest>(
2895            (image_id, val),
2896            0x2da9e4ef4c2cff6f,
2897            fidl::encoding::DynamicFlags::empty(),
2898        )
2899    }
2900
2901    /// Sets the image flip to be applied to a flatland image. This call must be performed after a
2902    /// successful |CreateImage| call. If an invalid |image_id| is supplied, the channel will be
2903    /// closed due to FlatlandError::BAD_OPERATION. This flip will be applied to the Image before
2904    /// parent Transform Orientations. If this function is not called, then the default flip value
2905    /// is ImageFlip::NONE.
2906    pub fn r#set_image_flip(
2907        &self,
2908        mut image_id: &ContentId,
2909        mut flip: ImageFlip,
2910    ) -> Result<(), fidl::Error> {
2911        self.client.send::<FlatlandSetImageFlipRequest>(
2912            (image_id, flip),
2913            0x21b20f2c14aae6bc,
2914            fidl::encoding::DynamicFlags::empty(),
2915        )
2916    }
2917
2918    /// Creates a solid-color rectangle. By default a filled-rect does not have a defined
2919    /// color or size. It is necessary to call |SetSolidFill| to specify a color and size
2920    /// before a filled rect can be used for rendering. Not doing so will result the
2921    /// rectangle having a default size of (0,0) and so it will not show up when rendering.
2922    ///
2923    /// `rect_id` must satisfy standard [`ContentId`] creation constraints.
2924    pub fn r#create_filled_rect(&self, mut rect_id: &ContentId) -> Result<(), fidl::Error> {
2925        self.client.send::<FlatlandCreateFilledRectRequest>(
2926            (rect_id,),
2927            0x5e62355abc1c4c5d,
2928            fidl::encoding::DynamicFlags::empty(),
2929        )
2930    }
2931
2932    /// Defines the color and size of a filled rect. |rect_id| must refer to content that
2933    /// was created via a call to CreateFilledRect. The color is not premultiplied. Color values
2934    /// must be within the range [0,1] inclusive, and normal 32-bit
2935    /// floating point values: https://en.wikipedia.org/wiki/Normal_number_%28computing%29. Values
2936    /// that do not conform to these specifications will cause the channel to close.
2937    /// The rectangle's top left corner will be at (0, 0) in its transform's coordinate space.
2938    /// Hence, its bottom right corner will be at (size.width, size.height).
2939    ///
2940    /// `rect_id` must refer to a valid, unreleased filled rectangle.
2941    pub fn r#set_solid_fill(
2942        &self,
2943        mut rect_id: &ContentId,
2944        mut color: &ColorRgba,
2945        mut size: &fidl_fuchsia_math::SizeU,
2946    ) -> Result<(), fidl::Error> {
2947        self.client.send::<FlatlandSetSolidFillRequest>(
2948            (rect_id, color, size),
2949            0x32d6ef41e182dfa5,
2950            fidl::encoding::DynamicFlags::empty(),
2951        )
2952    }
2953
2954    /// Automatically garbage collects the rectangle when it is no longer needed for
2955    /// rendering. |rect_id| must have been instantiated with a call to
2956    /// |CreateFilledRect|. Once released, the ID immediately goes out of scope and is free
2957    /// to be used again.
2958    ///
2959    /// `rect_id` must refer to a valid, unreleased filled rectangle.
2960    pub fn r#release_filled_rect(&self, mut rect_id: &ContentId) -> Result<(), fidl::Error> {
2961        self.client.send::<FlatlandReleaseFilledRectRequest>(
2962            (rect_id,),
2963            0x7392cabe45618f9b,
2964            fidl::encoding::DynamicFlags::empty(),
2965        )
2966    }
2967
2968    /// Setting a piece of Content on a Transform makes that Content visible in the render tree as
2969    /// long as the Transform is visible from the root Transform. The Content will be rendered
2970    /// before, and therefore "behind", any Content attached to the descendants of the Transform.
2971    ///
2972    /// Because each Transform can have, at most, a single piece of Content on it, calling this
2973    /// function on a Transform that already has Content will replace that Content.
2974    ///
2975    /// A Content may be set on more than one Transform.
2976    ///
2977    /// Calling this function with a Content id of 0 will remove any Content currently on the
2978    /// Transform.
2979    ///
2980    /// `content_id` must refer to a valid, unreleased Content object, or 0 to clear.
2981    pub fn r#set_content(
2982        &self,
2983        mut transform_id: &TransformId,
2984        mut content_id: &ContentId,
2985    ) -> Result<(), fidl::Error> {
2986        self.client.send::<FlatlandSetContentRequest>(
2987            (transform_id, content_id),
2988            0x4ed2cfc0ce130862,
2989            fidl::encoding::DynamicFlags::empty(),
2990        )
2991    }
2992
2993    /// Transforms are usually sufficient to change how Content is presented. Viewports, however,
2994    /// have special properties that are not part of the Transform hierarchy. Those properties can
2995    /// be set using this function.
2996    pub fn r#set_viewport_properties(
2997        &self,
2998        mut viewport_id: &ContentId,
2999        mut properties: &ViewportProperties,
3000    ) -> Result<(), fidl::Error> {
3001        self.client.send::<FlatlandSetViewportPropertiesRequest>(
3002            (viewport_id, properties),
3003            0x66ab67e9608ddb9f,
3004            fidl::encoding::DynamicFlags::empty(),
3005        )
3006    }
3007
3008    /// Released Transforms will be garbage collected by the system once they are no longer
3009    /// necessary for rendering. For Transforms, this means there is no path from any unreleased
3010    /// Transform to the newly-released Transform.
3011    ///
3012    /// Once released, the id immediately goes out of scope for future function calls and can be
3013    /// reused when creating new Transforms.
3014    ///
3015    /// It is an error to call functions with a released id (unless that id has been reused to
3016    /// construct a new Transform).
3017    pub fn r#release_transform(&self, mut transform_id: &TransformId) -> Result<(), fidl::Error> {
3018        self.client.send::<FlatlandReleaseTransformRequest>(
3019            (transform_id,),
3020            0xab9328419451c22,
3021            fidl::encoding::DynamicFlags::empty(),
3022        )
3023    }
3024
3025    /// Releases the View, which disconnects this Flatland session from its parent Viewport in
3026    /// another Flatland session.
3027    ///
3028    /// To clear the existing content from the screen without releasing the current View, use
3029    /// SetRootTransform(0) instead.
3030    ///
3031    /// Despite having a return type, this function is still feed-forward Like [`CreateView`] and
3032    /// requires a call to [`Present`] to be executed. The ViewCreationToken will be returned after
3033    /// the presented operations have been executed.
3034    pub fn r#release_view(&self) -> Result<(), fidl::Error> {
3035        self.client.send::<fidl::encoding::EmptyPayload>(
3036            (),
3037            0x5b35aab9baffecae,
3038            fidl::encoding::DynamicFlags::empty(),
3039        )
3040    }
3041
3042    /// Releases a Viewport from the scene, even if the Viewport is still connected to a Transform.
3043    /// Unlike other resources, Viewports are garbage collected by the system during the next
3044    /// [`Present`] because a removed Viewport is guaranteed to provide no renderable content.
3045    ///
3046    /// Use SetContent(transform_id, 0) to clean up references to released Viewports.
3047    ///
3048    /// Despite having a return type, this function is still feed-forward like [`CreateView`] and
3049    /// requires a call to [`Present`] to be executed. The ViewportCreationToken will be returned
3050    /// after the presented operations have been executed.
3051    pub fn r#release_viewport(
3052        &self,
3053        mut viewport_id: &ContentId,
3054        ___deadline: zx::MonotonicInstant,
3055    ) -> Result<fidl_fuchsia_ui_views::ViewportCreationToken, fidl::Error> {
3056        let _response = self.client.send_query::<
3057            FlatlandReleaseViewportRequest,
3058            FlatlandReleaseViewportResponse,
3059            FlatlandMarker,
3060        >(
3061            (viewport_id,),
3062            0xbad474aeb5293f9,
3063            fidl::encoding::DynamicFlags::empty(),
3064            ___deadline,
3065        )?;
3066        Ok(_response.token)
3067    }
3068
3069    /// Released Images will be garbage collected by the system once they are no longer necessary
3070    /// for rendering. For Images, this means the Image is no longer attached to any Transform and
3071    /// any pending rendering that references the Image is complete.
3072    ///
3073    /// Use SetContent(transform_id, 0) to clean up references to released Images.
3074    ///
3075    /// Once released, the id immediately goes out of scope for future function calls and can be
3076    /// reused when creating new Images.
3077    ///
3078    /// It is an error to call functions with a released id (unless that id has been reused to
3079    /// construct a new Image).
3080    pub fn r#release_image(&self, mut image_id: &ContentId) -> Result<(), fidl::Error> {
3081        self.client.send::<FlatlandReleaseImageRequest>(
3082            (image_id,),
3083            0xb884ffdbc72c111,
3084            fidl::encoding::DynamicFlags::empty(),
3085        )
3086    }
3087
3088    /// This function will reset all state on this interface. This includes destroying all existing
3089    /// View and Viewports without returning the associated Token to the caller.
3090    pub fn r#clear(&self) -> Result<(), fidl::Error> {
3091        self.client.send::<fidl::encoding::EmptyPayload>(
3092            (),
3093            0x4ec8817c02828c3e,
3094            fidl::encoding::DynamicFlags::empty(),
3095        )
3096    }
3097
3098    /// Set debug name of the current client that can be used by Flatland to print as a prefix to
3099    /// logs to help client distinguish what is theirs. [`name`] can be an arbitrary string, but the
3100    /// current process name (see fsl::GetCurrentProcessName()) is a good default.
3101    pub fn r#set_debug_name(&self, mut name: &str) -> Result<(), fidl::Error> {
3102        self.client.send::<FlatlandSetDebugNameRequest>(
3103            (name,),
3104            0x46a8b397e68a8888,
3105            fidl::encoding::DynamicFlags::empty(),
3106        )
3107    }
3108}
3109
3110#[cfg(target_os = "fuchsia")]
3111impl From<FlatlandSynchronousProxy> for zx::NullableHandle {
3112    fn from(value: FlatlandSynchronousProxy) -> Self {
3113        value.into_channel().into()
3114    }
3115}
3116
3117#[cfg(target_os = "fuchsia")]
3118impl From<fidl::Channel> for FlatlandSynchronousProxy {
3119    fn from(value: fidl::Channel) -> Self {
3120        Self::new(value)
3121    }
3122}
3123
3124#[cfg(target_os = "fuchsia")]
3125impl fidl::endpoints::FromClient for FlatlandSynchronousProxy {
3126    type Protocol = FlatlandMarker;
3127
3128    fn from_client(value: fidl::endpoints::ClientEnd<FlatlandMarker>) -> Self {
3129        Self::new(value.into_channel())
3130    }
3131}
3132
3133#[derive(Debug, Clone)]
3134pub struct FlatlandProxy {
3135    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
3136}
3137
3138impl fidl::endpoints::Proxy for FlatlandProxy {
3139    type Protocol = FlatlandMarker;
3140
3141    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
3142        Self::new(inner)
3143    }
3144
3145    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
3146        self.client.into_channel().map_err(|client| Self { client })
3147    }
3148
3149    fn as_channel(&self) -> &::fidl::AsyncChannel {
3150        self.client.as_channel()
3151    }
3152}
3153
3154impl FlatlandProxy {
3155    /// Create a new Proxy for fuchsia.ui.composition/Flatland.
3156    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
3157        let protocol_name = <FlatlandMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3158        Self { client: fidl::client::Client::new(channel, protocol_name) }
3159    }
3160
3161    /// Get a Stream of events from the remote end of the protocol.
3162    ///
3163    /// # Panics
3164    ///
3165    /// Panics if the event stream was already taken.
3166    pub fn take_event_stream(&self) -> FlatlandEventStream {
3167        FlatlandEventStream { event_receiver: self.client.take_event_receiver() }
3168    }
3169
3170    /// Releases an image immediately, without waiting for the next present.
3171    pub fn r#release_image_immediately(&self, mut image_id: &ContentId) -> Result<(), fidl::Error> {
3172        FlatlandProxyInterface::r#release_image_immediately(self, image_id)
3173    }
3174
3175    /// Releases an Image immediately, without waiting for the next present. This is a trusted
3176    /// memory-eviction path.
3177    ///
3178    /// The Image is forcibly unbound from any Layers that currently reference it. Those Layers
3179    /// behave as if their image was simply never set (they are invisible, but retain their image
3180    /// properties) until their next `SetLayerImage()`.
3181    ///
3182    /// Any pending release fences for the evicted Image's bindings will signal at the earliest
3183    /// safe point.
3184    ///
3185    /// This method is only available if Flatland2 is enabled and the session is trusted.
3186    pub fn r#release_image_immediately2(&self, mut image_id: &ImageId) -> Result<(), fidl::Error> {
3187        FlatlandProxyInterface::r#release_image_immediately2(self, image_id)
3188    }
3189
3190    /// A Layer is a type of `Content` that composites either a single `Image` or a solid
3191    /// color. It separates visual properties (such as size, flip, opacity, and blending)
3192    /// from the raw pixel data.
3193    ///
3194    /// Unlike typical `Content` items which represent a static visual resource, a Layer is designed
3195    /// to be a dynamic container for an image sequence. Typical usage involves setting the layer's
3196    /// visual properties and image metadata infrequently, and then rapidly swapping the active
3197    /// `Image` (e.g. on every frame) with another image of matching metadata.
3198    ///
3199    /// This separation allows a single `Image` resource to be reused across multiple layers with
3200    /// different visual configurations simultaneously.
3201    ///
3202    /// To use a Layer:
3203    /// 1. Create a `Layer` using [`CreateLayer`].
3204    /// 2. Set properties on the `Layer` via [`SetLayerProperties`], including the
3205    ///    composition mode.
3206    /// 3. For an image layer, associate an `Image` with the `Layer` via [`SetLayerImage`].
3207    /// 4. Add the `Layer` to a `LayerStack` via [`SetStackLayers`].
3208    /// 5. Set the `LayerStack` as the content of a node via [`SetTransformContent`].
3209    ///
3210    /// `layer_id` must satisfy the identifier rules documented on [`LayerId`].
3211    pub fn r#create_layer(&self, mut layer_id: &LayerId) -> Result<(), fidl::Error> {
3212        FlatlandProxyInterface::r#create_layer(self, layer_id)
3213    }
3214
3215    /// Released Layers will be garbage collected by the system once they are no longer necessary
3216    /// for rendering. For Layers, this means:
3217    /// - the Layer is no longer referenced by any LayerStack, and
3218    /// - any pending rendering that references the Layer is complete.
3219    ///
3220    /// `layer_id` must refer to a valid, unreleased Layer.
3221    pub fn r#release_layer(&self, mut layer_id: &LayerId) -> Result<(), fidl::Error> {
3222        FlatlandProxyInterface::r#release_layer(self, layer_id)
3223    }
3224
3225    /// Associates an Image with the Layer.
3226    ///
3227    /// The binding is legal in any composition mode, and is sticky: it survives composition
3228    /// mode changes, and is replaced only by a later [`SetLayerImage`] call (or cleared by
3229    /// [`ResetLayer`]). The image is displayed only while the layer's composition mode is
3230    /// `IMAGE`.
3231    ///
3232    /// The bound image must be large enough for the layer's stored `sample_rect`; this is
3233    /// checked at [`fuchsia.ui.composition/Flatland.Present`], not here. See
3234    /// [`LayerProperties.sample_rect`].
3235    ///
3236    /// `layer_id` must refer to a valid, unreleased Layer.
3237    /// `image_id` must refer to a valid, unreleased Image.
3238    /// `acquire_fence` is an optional fence that must be signaled before the image is displayed.
3239    /// `release_fence` is an optional fence, signaled by Scenic when *this binding* no
3240    /// longer references the image. It is per-binding, not per-image: an image bound to
3241    /// several layers has one such fence per binding, and the image is safe to write only
3242    /// once every one of them has signaled.
3243    ///
3244    /// A binding is ended by:
3245    ///
3246    /// - being superseded by a later [`SetLayerImage`] on the same layer
3247    /// - [`ResetLayer`]
3248    /// - the layer ref-count reaching zero, either via [`ReleaseLayer`] or by being released
3249    ///   by a layer stack
3250    /// - destruction of the session, which ends every binding it holds
3251    ///
3252    /// For a binding ended while the session is alive, Scenic signals at the first frame
3253    /// retire after that point. Bindings that never reached the screen (e.g. one superseded
3254    /// within a single batch, or one lost when several
3255    /// [`fuchsia.ui.composition/Flatland.Present`] calls are squashed into a single
3256    /// frame) signal at that same retire rather than immediately. The signal is
3257    /// therefore conservative by at most one frame; it is never early.
3258    pub fn r#set_layer_image(
3259        &self,
3260        mut layer_id: &LayerId,
3261        mut image_id: &ImageId,
3262        mut acquire_fence: Option<WaitFence>,
3263        mut release_fence: Option<SignalFence>,
3264    ) -> Result<(), fidl::Error> {
3265        FlatlandProxyInterface::r#set_layer_image(
3266            self,
3267            layer_id,
3268            image_id,
3269            acquire_fence,
3270            release_fence,
3271        )
3272    }
3273
3274    /// Sets properties of the Layer.
3275    ///
3276    /// The provided `properties` table is merged into the layer's stored properties: fields
3277    /// which are unset in `properties` retain their previously stored values. Stored
3278    /// properties are sticky; see [`LayerProperties`] for the full persistence semantics.
3279    ///
3280    /// Values are stored as given; validation which depends on other state (notably
3281    /// `sample_rect` against the bound image) happens at
3282    /// [`fuchsia.ui.composition/Flatland.Present`]. See [`LayerProperties.sample_rect`].
3283    ///
3284    /// `layer_id` must refer to a valid, unreleased Layer.
3285    pub fn r#set_layer_properties(
3286        &self,
3287        mut layer_id: &LayerId,
3288        mut properties: &LayerProperties,
3289    ) -> Result<(), fidl::Error> {
3290        FlatlandProxyInterface::r#set_layer_properties(self, layer_id, properties)
3291    }
3292
3293    /// Unbinds any Image bound to the layer and clears every stored [`LayerProperties`]
3294    /// field, returning the layer to its freshly-created state (composition mode
3295    /// `INVISIBLE`, all properties at their documented defaults). This is the only
3296    /// operation which forgets stored layer properties.
3297    ///
3298    /// `layer_id` must refer to a valid, unreleased Layer.
3299    pub fn r#reset_layer(&self, mut layer_id: &LayerId) -> Result<(), fidl::Error> {
3300        FlatlandProxyInterface::r#reset_layer(self, layer_id)
3301    }
3302
3303    /// Creates a new layer stack with the specified `stack_id`.
3304    ///
3305    /// `stack_id` must satisfy the identifier rules documented on [`LayerId`].
3306    pub fn r#create_layer_stack(&self, mut stack_id: &LayerStackId) -> Result<(), fidl::Error> {
3307        FlatlandProxyInterface::r#create_layer_stack(self, stack_id)
3308    }
3309
3310    /// Releases the layer stack with the specified `stack_id`.
3311    pub fn r#release_layer_stack(&self, mut stack_id: &LayerStackId) -> Result<(), fidl::Error> {
3312        FlatlandProxyInterface::r#release_layer_stack(self, stack_id)
3313    }
3314
3315    /// Sets the layers in the stack. The order of layers in the vector determines their Z-order,
3316    /// with the first element being the back-most and the last element being the front-most.
3317    ///
3318    /// `stack_id` must refer to a valid, unreleased LayerStack. Each element of `layers`
3319    /// must refer to a valid, unreleased Layer. Duplicate layers within `layers` are
3320    /// disallowed.
3321    pub fn r#set_stack_layers(
3322        &self,
3323        mut stack_id: &LayerStackId,
3324        mut layers: &[LayerId],
3325    ) -> Result<(), fidl::Error> {
3326        FlatlandProxyInterface::r#set_stack_layers(self, stack_id, layers)
3327    }
3328
3329    /// Creates an Image resource.
3330    ///
3331    /// `image_id` must satisfy the identifier rules documented on [`LayerId`].
3332    pub fn r#create_image2(
3333        &self,
3334        mut image_id: &ImageId,
3335        mut import_token: BufferCollectionImportToken,
3336        mut vmo_index: u32,
3337        mut properties: &ImageProperties,
3338    ) -> Result<(), fidl::Error> {
3339        FlatlandProxyInterface::r#create_image2(self, image_id, import_token, vmo_index, properties)
3340    }
3341
3342    /// Released Images will be garbage collected by the system once they are no longer necessary
3343    /// for rendering. For Images, this means:
3344    /// - the Image is no longer bound to any Layer, and
3345    /// - any pending rendering that references the Image is complete.
3346    ///
3347    /// The `image_id` value is freed for reuse immediately by the client (identifier uniqueness
3348    /// is instantaneous).
3349    ///
3350    /// Note: Per-binding release fences (passed to `SetLayerImage`) are unaffected by this call.
3351    /// They track the lifecycle of individual layer bindings, not the client's `image_id`.
3352    ///
3353    /// `image_id` must refer to a valid, unreleased Image.
3354    pub fn r#release_image2(&self, mut image_id: &ImageId) -> Result<(), fidl::Error> {
3355        FlatlandProxyInterface::r#release_image2(self, image_id)
3356    }
3357
3358    /// Creates a Viewport resource.
3359    ///
3360    /// `viewport_id` must satisfy the identifier rules documented on [`LayerId`].
3361    pub fn r#create_viewport2(
3362        &self,
3363        mut viewport_id: &ViewportId,
3364        mut token: fidl_fuchsia_ui_views::ViewportCreationToken,
3365        mut properties: &ViewportProperties,
3366        mut child_view_watcher: fidl::endpoints::ServerEnd<ChildViewWatcherMarker>,
3367    ) -> Result<(), fidl::Error> {
3368        FlatlandProxyInterface::r#create_viewport2(
3369            self,
3370            viewport_id,
3371            token,
3372            properties,
3373            child_view_watcher,
3374        )
3375    }
3376
3377    /// Releases a Viewport from the scene.
3378    pub fn r#release_viewport2(
3379        &self,
3380        mut viewport_id: &ViewportId,
3381    ) -> fidl::client::QueryResponseFut<
3382        fidl_fuchsia_ui_views::ViewportCreationToken,
3383        fidl::encoding::DefaultFuchsiaResourceDialect,
3384    > {
3385        FlatlandProxyInterface::r#release_viewport2(self, viewport_id)
3386    }
3387
3388    /// Sets the properties of a Viewport.
3389    pub fn r#set_viewport_properties2(
3390        &self,
3391        mut viewport_id: &ViewportId,
3392        mut properties: &ViewportProperties,
3393    ) -> Result<(), fidl::Error> {
3394        FlatlandProxyInterface::r#set_viewport_properties2(self, viewport_id, properties)
3395    }
3396
3397    /// Sets (or clears) the content of a Transform.
3398    ///
3399    /// The same content may be attached to more than one Transform; each attachment composites
3400    /// that content again under its own Transform's matrix, clip, and opacity, so a single
3401    /// LayerStack or Viewport can appear repeatedly in a scene without the client duplicating the
3402    /// underlying resources.
3403    ///
3404    /// A Transform's content can be cleared by not providing the optional `content`.
3405    ///
3406    /// If `content` is set, it must refer to a valid, unreleased LayerStack or Viewport.
3407    /// Unlike classic [`Flatland.SetContent`], a zero id does not clear the content.
3408    pub fn r#set_transform_content(
3409        &self,
3410        mut transform_id: &TransformId,
3411        mut content: Option<&TransformContent>,
3412    ) -> Result<(), fidl::Error> {
3413        FlatlandProxyInterface::r#set_transform_content(self, transform_id, content)
3414    }
3415
3416    /// Complete execution of all feed-forward operations.
3417    ///
3418    /// If executing an operation produces an error (e.g., CreateTransform(0)), an [`OnError`] event
3419    /// is emitted. Operations that produce errors are ignored and the channel is closed.
3420    ///
3421    /// If execution completes successfully, [`OnNextFrameBegin`] is emitted with valid frame
3422    /// production information.
3423    ///
3424    /// The client may only call [`Present`] when they have a non-zero number of present credits,
3425    /// which are tracked by the server. The server may increment the number of credits when it
3426    /// fires the [`OnNextFrameBegin`] event, which informs the client when it receives additional
3427    /// present credits. Each [`Present`] call uses one present credit and decrements the server
3428    /// count by one. If the client calls [`Present`] with no present credits, the server will
3429    /// return a `NO_PRESENTS_REMAINING` error.
3430    ///
3431    /// The client should assume that prior to receiving any [`OnNextFrameBegin`] events, they have
3432    /// one present credit.
3433    ///
3434    /// Every [`Present`] call results in one [`OnNextFrameBegin`] event, and one
3435    /// [`OnFramePresented`] event, typically in that order.
3436    ///
3437    /// When the commands flushed by [`Present`] make it to display, an [`OnFramePresented`] event
3438    /// is fired. This event includes information pertaining to all [`Present`]s that had content
3439    /// that were part of that frame.
3440    ///
3441    /// See [`fuchsia.ui.composition/PresentArgs`] documentation above for more detailed information
3442    /// on what arguments are passed in and their role.
3443    pub fn r#present(&self, mut args: PresentArgs) -> Result<(), fidl::Error> {
3444        FlatlandProxyInterface::r#present(self, args)
3445    }
3446
3447    /// Two Flatland sessions may be connected in a parent-child relationship. The parent endpoint
3448    /// is held in a Viewport, and the child endpoint is held in a View. The parent Flatland
3449    /// session that creates a Viewport has control over how the child's View is integrated into
3450    /// its own View.
3451    ///
3452    /// The lifecycle of a parent-child connection starts with two endpoints of a channel object:
3453    /// a ViewportCreationToken and a ViewCreationToken. Out-of-band protocols pass the
3454    /// ViewportCreationToken to the parent, which calls [`CreateViewport`], and the
3455    /// ViewCreationToken to the child, which calls [`CreateView`].
3456    ///
3457    /// Only nodes connected to the Root Transform in this Flatland session will be rendered into
3458    /// the parent's Viewport.
3459    ///
3460    /// Calling [`CreateView`] a second time will disconnect the Root Transform from the existing
3461    /// parent's Viewport, and attach it to a new parent's Viewport. In other words, each View can
3462    /// only have one parent.
3463    ///
3464    /// This function is queued, meaning that the Root Transform will not be attached to the
3465    /// parent Viewport until [`Present`] is called. However, clients will receive information
3466    /// through their ParentViewportWatcher (e.g., LayoutInfo) immediately after calling this
3467    /// function, even if they have not called [`Present`] or [`SetRootTransform`]. This allows
3468    /// clients to wait for layout information from their parent before calling [`Present`].
3469    ///
3470    /// Any illegal operations on ParentViewportWatcher will cause both ParentViewportWatcher
3471    /// channel and this Flatland channel to be torn down.
3472    ///
3473    /// Lifecycle note. The lifetime of the ParentViewportWatcher channel is bound by the peer
3474    /// ViewportCreationToken. When the ViewportCreationToken dies, this ParentViewportWatcher
3475    /// channel is destroyed.
3476    ///
3477    /// Views and subgraphs of Views created using `CreateView` will not be represented in the
3478    /// ViewTree, and hence will not be able to participate in any ViewTree-dependent interactions
3479    /// such as touch, mouse or focus.
3480    /// The Flatland protocol provides no way for Views in the subgraph of a View created with
3481    /// `CreateView` to know that they are excluded from the ViewTree.
3482    pub fn r#create_view(
3483        &self,
3484        mut token: fidl_fuchsia_ui_views::ViewCreationToken,
3485        mut parent_viewport_watcher: fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>,
3486    ) -> Result<(), fidl::Error> {
3487        FlatlandProxyInterface::r#create_view(self, token, parent_viewport_watcher)
3488    }
3489
3490    /// Identical to [`CreateView`], except it allows association of View identity (ViewRef) and
3491    /// view-bound protocols.
3492    pub fn r#create_view2(
3493        &self,
3494        mut token: fidl_fuchsia_ui_views::ViewCreationToken,
3495        mut view_identity: fidl_fuchsia_ui_views::ViewIdentityOnCreation,
3496        mut protocols: ViewBoundProtocols,
3497        mut parent_viewport_watcher: fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>,
3498    ) -> Result<(), fidl::Error> {
3499        FlatlandProxyInterface::r#create_view2(
3500            self,
3501            token,
3502            view_identity,
3503            protocols,
3504            parent_viewport_watcher,
3505        )
3506    }
3507
3508    /// Creates a new Transform node. Transforms are a hierarchical piece of a Flatland graph. They
3509    /// can have children, and can reference Content. A sub-graph represented by a Transform and its
3510    /// descendants can be rendered to a display.
3511    ///
3512    /// Transforms are kept alive, even when released, as long as they are children of either an
3513    /// unreleased Transform, or the Root Transform.
3514    ///
3515    /// Each Transform can have a single piece of attached Content. Common types of Content include
3516    /// bitmaps, asynchronous streams of images, and Viewports to Views hosted in other Flatland
3517    /// sessions.
3518    ///
3519    /// Transforms have attributes. Child Transforms inherit the combined attributes of their
3520    /// parents. Content attached to a Transform is also affected by that Transform's attributes.
3521    ///
3522    /// When a sub-graph of Transforms is rendered, Content will be rendered back-to-front, starting
3523    /// with the Content on the root transform, and continuing recursively through all of its child
3524    /// Transforms in the order the children were added. See [`AddChild`] for more information.
3525    ///
3526    /// Zero is not a valid transform id. All other values are valid, assuming they are not already
3527    /// in use (see [`ReleaseTransform`] for more details).
3528    pub fn r#create_transform(&self, mut transform_id: &TransformId) -> Result<(), fidl::Error> {
3529        FlatlandProxyInterface::r#create_transform(self, transform_id)
3530    }
3531
3532    /// All Transform objects support all attributes.
3533    ///
3534    /// Geometric attributes are applied in the following order:
3535    /// 1. Scale (relative to the parent transform's coordinate space)
3536    /// 2. Orientation (relative to the parent transform's coordinate space)
3537    /// 3. Translation (relative to the parent transforms's coordinate space,
3538    ///    unaffected by scale applied to the current transform).
3539    /// 4. Clipping (relative to the current transform's coordinate space)
3540    ///
3541    /// The effects of each of these attributes are cumulative. This means the transform's position
3542    /// in the view space, and its clip boundary, will be calculated based on that chain of
3543    /// geometric attributes going up to the root transform.
3544    ///
3545    /// For instance, in a nested hierarchy such as the following:
3546    ///     [Root-Transform -> Transform1 -> Transform2 -> CurrentTransform]
3547    /// If Transform1 is translated by [2,0] and Transform2 is translated by [0,1] then the
3548    /// view-space position of CurrentTransform will be [2,1].
3549    ///
3550    /// Sets the translation on a Transform. The order of geometric attribute application is
3551    /// addressed above.
3552    pub fn r#set_translation(
3553        &self,
3554        mut transform_id: &TransformId,
3555        mut translation: &fidl_fuchsia_math::Vec_,
3556    ) -> Result<(), fidl::Error> {
3557        FlatlandProxyInterface::r#set_translation(self, transform_id, translation)
3558    }
3559
3560    /// Sets the orientation on a Transform. The order of geometric attribute application is
3561    /// addressed in the documentation for [`SetTranslation`]. In Flatland, the +X axis is
3562    /// to the right and the +Y axis is down. There is no notion of a Z axis. CCW is defined
3563    /// from the POV of the user, as if a skeuomorphoic clock is displayed on the screen.
3564    pub fn r#set_orientation(
3565        &self,
3566        mut transform_id: &TransformId,
3567        mut orientation: Orientation,
3568    ) -> Result<(), fidl::Error> {
3569        FlatlandProxyInterface::r#set_orientation(self, transform_id, orientation)
3570    }
3571
3572    /// Sets the scale on a transform. The order of geometric attribute application is
3573    /// addressed above. The (x,y) values in the VecF |scale| refer to the scale factor in the
3574    /// x-axis (width) and y-axis (height) respectively. Scale values must be positive 32-bit
3575    /// floating point values: https://en.wikipedia.org/wiki/Normal_number_%28computing%29
3576    pub fn r#set_scale(
3577        &self,
3578        mut transform_id: &TransformId,
3579        mut scale: &fidl_fuchsia_math::VecF,
3580    ) -> Result<(), fidl::Error> {
3581        FlatlandProxyInterface::r#set_scale(self, transform_id, scale)
3582    }
3583
3584    /// Sets an opacity in linear space to be applied to a transform and its descendents,
3585    /// which include other transforms and content. Opacity values must be in the range
3586    /// of [0.0, 1.0], where 0.0 is completely transparent and 1.0 is completely opaque.
3587    /// Attempting to call this function with values outside that range will result in
3588    /// an error. A transform's opacity value is multiplied with that of its parent. This
3589    /// effect works differently from group opacity. Using group opacity, child nodes are
3590    /// rendered together first, and then have the parent's opacity applied as a post-effect.
3591    /// Here, opacity is applied to each child individually. This may result in a very
3592    /// different effect.
3593    pub fn r#set_opacity(
3594        &self,
3595        mut transform_id: &TransformId,
3596        mut value: f32,
3597    ) -> Result<(), fidl::Error> {
3598        FlatlandProxyInterface::r#set_opacity(self, transform_id, value)
3599    }
3600
3601    /// Sets the bounds, expressed in the local coordinate space of the transform, that
3602    /// constrains the region that content attached to this transform can be rendered to.
3603    /// If the content's area exceeds the clip bounds, the area outside the bounds will
3604    /// not be rendered. These bounds are valid for all children of this transform node as
3605    /// well, which includes nested Flatland sessions and their node hierarchies.
3606    /// If a child transform attempts to set clip bounds larger than that of its parent,
3607    /// it will be clipped to the parent's clip bounds. The default state is for a transform
3608    /// to be unclipped, meaning it will not have any bounds placed on its render region.
3609    /// The clip width/height must be positive. Negative values will result in an error.
3610    /// Passing in an empty box to the |rect| parameter will remove the clip bounds.
3611    pub fn r#set_clip_boundary(
3612        &self,
3613        mut transform_id: &TransformId,
3614        mut rect: Option<&fidl_fuchsia_math::Rect>,
3615    ) -> Result<(), fidl::Error> {
3616        FlatlandProxyInterface::r#set_clip_boundary(self, transform_id, rect)
3617    }
3618
3619    /// Adds a child Transform to a parent Transform. The new child Transform,
3620    /// and any Content attached to it or its children, will be rendered on top
3621    /// of the parent's Content, as well as any previously added children.
3622    ///
3623    /// The caller must ensure that `child_transform_id` is valid and that there
3624    /// are no repetitions.  Sending a repeated `child_transform_id` over
3625    /// multiple calls will result in session closure.
3626    pub fn r#add_child(
3627        &self,
3628        mut parent_transform_id: &TransformId,
3629        mut child_transform_id: &TransformId,
3630    ) -> Result<(), fidl::Error> {
3631        FlatlandProxyInterface::r#add_child(self, parent_transform_id, child_transform_id)
3632    }
3633
3634    /// Removes a child Transform from a parent Transform.
3635    pub fn r#remove_child(
3636        &self,
3637        mut parent_transform_id: &TransformId,
3638        mut child_transform_id: &TransformId,
3639    ) -> Result<(), fidl::Error> {
3640        FlatlandProxyInterface::r#remove_child(self, parent_transform_id, child_transform_id)
3641    }
3642
3643    /// Removes all child Transforms from a parent Transform and replaces them
3644    /// with the new child transforms in `new_child_transform_ids`.  The caller
3645    /// must ensure that all `TransformId` values in `new_child_transform_ids`
3646    /// are valid and that there are no repetitions.  Sending a repeated
3647    /// `TransformId` in `new_child_transform_ids` will result in session
3648    /// closure.
3649    pub fn r#replace_children(
3650        &self,
3651        mut parent_transform_id: &TransformId,
3652        mut new_child_transform_ids: &[TransformId],
3653    ) -> Result<(), fidl::Error> {
3654        FlatlandProxyInterface::r#replace_children(
3655            self,
3656            parent_transform_id,
3657            new_child_transform_ids,
3658        )
3659    }
3660
3661    /// Sets the Root Transform for the graph.
3662    ///
3663    /// The sub-graph defined by the Root Transform and its children will be rendered as View
3664    /// in the connected parent's Viewport (see [`CreateView`]). Any parents of the Root Transform
3665    /// in this Graph will be ignored.
3666    ///
3667    /// The Root Transform, and all children of the Root Transform, are kept alive if they are
3668    /// released (see [`ReleaseTransform`] for more details).
3669    ///
3670    /// There is only ever one Root. Since 0 is not a valid transform id (see [`CreateTransform`]),
3671    /// calling SetRootTransform(0) clears the current Root, destroying any previously released
3672    /// objects that are not referenced by the new root.
3673    ///
3674    /// Note that every View has a clip boundary equivalent to its logical size. Anything outside
3675    /// that clip boundary will not be rendered. Hence, the Root Transform has a useful coordinate
3676    /// space of (0, 0) to (logical_size.width, logical_size.height), where (0, 0) is the upper left
3677    /// corner.
3678    ///
3679    /// Setting the root transform installs a full screen hit region on the root transform. Clients
3680    /// may remove this hit region if they don't want users to be able to interact with the root
3681    /// transform's content. For additional details on hit regions, see the [`SetHitRegions`]
3682    /// documentation.
3683    ///
3684    /// Default hit region rules
3685    ///
3686    ///   A default hit region follows these rules:
3687    ///   - When [`SetRootTransform`](T) is called, T receives a maximal hit region, covering the
3688    ///   entire view.
3689    ///   - If [`SetHitRegions`] is called on T, either before or after [`SetRootTransform`](T),
3690    ///   then no default hit region is active and the client specified hit regions are used.
3691    ///   - If a transform is no longer the root transform, i.e., [`SetRootTransform`](U) is
3692    ///   called, then the original transform no longer has its default hit region.
3693    ///   - Clients can remove or modify the root transform's hit regions the same way they would
3694    ///   reset any other transform's hit regions, by calling [`SetHitRegions`] with the appropriate
3695    ///   vector.
3696    pub fn r#set_root_transform(&self, mut transform_id: &TransformId) -> Result<(), fidl::Error> {
3697        FlatlandProxyInterface::r#set_root_transform(self, transform_id)
3698    }
3699
3700    /// Sets the interactive areas for a Transform. By default, Content is not interactive; hit
3701    /// regions must be placed for a user to interact with the Content in a View. Because hit
3702    /// regions are described in the Flatland protocol, a Flatland session can synchronize Content
3703    /// and hit regions.
3704    ///
3705    /// Each hit region is placed in the coordinate space of the owning Transform, and may or may
3706    /// not interact with different types of hit testing, depending on its [`HitTestInteraction`]
3707    /// type. When there are multiple hit regions that intersect with a hit test, the precedence
3708    /// rules given below dictate which hit region has interacted with the hit test. Only Transforms
3709    /// that transitively connect to the root Transform have their hit regions interact with a hit
3710    /// test.
3711    ///
3712    /// Calling this function replaces any previous values set on this Transform. To reset a
3713    /// Transform to "no hit testing": send an empty vector with [`SetHitRegions`].
3714    ///
3715    /// Note that root transforms get a default hit region installed by Flatland. For more details,
3716    /// see the [`SetRootTransform`] documentation.
3717    ///
3718    /// Precedence rules
3719    ///   Within a Transform, if multiple hit regions overlap, the hit test examines each
3720    ///   intersecting hit region for a possible interaction. Thus, for a regular hit test R and an
3721    ///   accessibility hit test A, where R and A both intersect two hit regions D ([`DEFAULT`]) and
3722    ///   S ([`SEMANTICALLY_INVISIBLE`]) on the same Transform, (1) R interacts with both D and S,
3723    ///   and (2) A only interacts with D. Generally, hit regions that overlap in a single Transform
3724    ///   can cause confusing behavior.
3725    ///
3726    ///   Within a View, for a given hit test, the front-most Transform's hit regions take
3727    ///   precedence over those behind. This follows the expected reverse "render order" of
3728    ///   Transforms (described in [`CreateTransform`]), where a user expects to interact with
3729    ///   Content that is visible, or front-most.
3730    ///
3731    ///   Across Flatland sessions, for a given hit test, the front-most session's front-most
3732    ///   Transform's hit regions take precedence over those behind. This follows the expected
3733    ///   reverse "render order" of views, where a user expects to interact with the View that is
3734    ///   visible, or front-most. For example, if a child View owns Content that is rendered over
3735    ///   the parent View, the user expects to interact with the child's Content.
3736    pub fn r#set_hit_regions(
3737        &self,
3738        mut transform_id: &TransformId,
3739        mut regions: &[HitRegion],
3740    ) -> Result<(), fidl::Error> {
3741        FlatlandProxyInterface::r#set_hit_regions(self, transform_id, regions)
3742    }
3743
3744    /// Identical to [`SetHitRegions`], except the hit region associated with [`transform_id`]
3745    /// covers an infinite region. The hit region is invariant against translation, scaling, and
3746    /// orientation of the Transform.
3747    ///
3748    /// An infinite hit region is still limited in extent by the View's clip boundary, just like a
3749    /// finite hit region.
3750    ///
3751    /// Calling this function replaces any previous values set on this Transform. To reset a
3752    /// Transform to "no hit testing": send an empty vector with [`SetHitRegions`].
3753    pub fn r#set_infinite_hit_region(
3754        &self,
3755        mut transform_id: &TransformId,
3756        mut hit_test: HitTestInteraction,
3757    ) -> Result<(), fidl::Error> {
3758        FlatlandProxyInterface::r#set_infinite_hit_region(self, transform_id, hit_test)
3759    }
3760
3761    /// The Viewport and View pair, together, represent the connection between two Flatland
3762    /// sessions. The Viewport is created in the parent, and the View is created in the child. The
3763    /// parent has control over how the child's View is integrated into its own View.
3764    ///
3765    /// Any illegal operations on ChildViewWatcher will cause both ChildViewWatcher channel and this
3766    /// Flatland channel to be torn down.
3767    ///
3768    /// `ViewportProperties` must have logical_size set. This is the initial size that will drive
3769    /// the layout of the child. The logical_size is also used as the default Content size, but
3770    /// subsequent changes to the logical_size will have no effect on the Content size.
3771    ///
3772    /// `ViewportProperties` may have inset field not set. In that case, the default value of
3773    /// (0, 0, 0, 0) is used.
3774    ///
3775    /// The logical_size must have positive X and Y components.
3776    ///
3777    /// Lifecycle note. The lifetime of the ChildViewWatcher channel is bound by the peer
3778    /// ViewCreationToken. When the ViewCreationToken dies, this ChildViewWatcher channel is
3779    /// destroyed.
3780    ///
3781    /// `viewport_id` must satisfy standard [`ContentId`] creation constraints.
3782    pub fn r#create_viewport(
3783        &self,
3784        mut viewport_id: &ContentId,
3785        mut token: fidl_fuchsia_ui_views::ViewportCreationToken,
3786        mut properties: &ViewportProperties,
3787        mut child_view_watcher: fidl::endpoints::ServerEnd<ChildViewWatcherMarker>,
3788    ) -> Result<(), fidl::Error> {
3789        FlatlandProxyInterface::r#create_viewport(
3790            self,
3791            viewport_id,
3792            token,
3793            properties,
3794            child_view_watcher,
3795        )
3796    }
3797
3798    /// An Image is a bitmap backed by a specific VMO in a BufferCollection.
3799    ///
3800    /// Image creation requires an allocated BufferCollection registered with Allocator. This
3801    /// function will fail unless all clients of the specified BufferCollection have set their
3802    /// constraints.
3803    ///
3804    /// The Image must reference a valid VMO index and must have ImageProperties that fall within
3805    /// the constraints specified by the backing BufferCollection (i.e. width and height within a
3806    /// valid range, etc.)
3807    ///
3808    /// `image_id` must satisfy standard [`ContentId`] creation constraints.
3809    pub fn r#create_image(
3810        &self,
3811        mut image_id: &ContentId,
3812        mut import_token: BufferCollectionImportToken,
3813        mut vmo_index: u32,
3814        mut properties: &ImageProperties,
3815    ) -> Result<(), fidl::Error> {
3816        FlatlandProxyInterface::r#create_image(self, image_id, import_token, vmo_index, properties)
3817    }
3818
3819    /// This function is used to determine the region (in texel space) of an image that will be used
3820    /// by Flatland when rendering. The image to be sampled is referenced by [`image_id`] and the
3821    /// sample region is specified by [`rect`] which itself is comprised of an origin point (x,y) as
3822    /// well as a width and height, in unnormalized coordinates. It is illegal to call this function
3823    /// on non-image content, or to sample a region outside of the texel space of the image. In
3824    /// other words, the region specifed by [`rect`] must not exceed the ranges (0, image_width) and
3825    /// (0, image_height). If (rect.x + rect.width > image_width) or (rect.y + rect.height >
3826    /// image_height) or if any of the values are negative, this will result in an error.
3827    ///
3828    /// If this method is not called, the default sample region is the rectangle with origin at
3829    /// (0, 0) and width and height set at ImageProperties from [`CreateImage`].
3830    ///
3831    /// `image_id` must refer to a valid, unreleased Image.
3832    pub fn r#set_image_sample_region(
3833        &self,
3834        mut image_id: &ContentId,
3835        mut rect: &fidl_fuchsia_math::RectF,
3836    ) -> Result<(), fidl::Error> {
3837        FlatlandProxyInterface::r#set_image_sample_region(self, image_id, rect)
3838    }
3839
3840    /// The content size for an Image is the size of the rectangle in the parent's logical
3841    /// coordinate space that the image occupies. This combined with the global translation of the
3842    /// transform it is attached to determines the size and location of where the content is
3843    /// rendered on the display.
3844    ///
3845    /// If this method is not called, the default image destination size is the width and height set
3846    /// at ImageProperties from [`CreateImage`]. The destination size will be affected by scaling if
3847    /// [`SetScale`] is used on the attached Transform or its parents.
3848    pub fn r#set_image_destination_size(
3849        &self,
3850        mut image_id: &ContentId,
3851        mut size: &fidl_fuchsia_math::SizeU,
3852    ) -> Result<(), fidl::Error> {
3853        FlatlandProxyInterface::r#set_image_destination_size(self, image_id, size)
3854    }
3855
3856    /// Determines the blend function to use when rendering the content specified by
3857    /// |image_id|. |image_id| must be a valid ContentId associated to a transform through
3858    /// a call to |CreateImage| or |CreateFilledRect|. For details on the different blend functions
3859    /// that are available, please refer to the BlendMode enum. If this function is not called, then
3860    /// the default blendmode is BlendMode::SRC.
3861    pub fn r#set_image_blending_function(
3862        &self,
3863        mut image_id: &ContentId,
3864        mut blend_mode: BlendMode,
3865    ) -> Result<(), fidl::Error> {
3866        FlatlandProxyInterface::r#set_image_blending_function(self, image_id, blend_mode)
3867    }
3868
3869    /// Determines the blend function to use when rendering the content specified by
3870    /// |image_id|. |image_id| must be a valid ContentId associated to a transform through
3871    /// a call to |CreateImage| or |CreateFilledRect|. For details on the different blend functions
3872    /// that are available, please refer to the BlendMode2 enum. If this function is not called,
3873    /// the default blendmode is BlendMode2::REPLACE.
3874    pub fn r#set_image_blend_mode(
3875        &self,
3876        mut image_id: &ContentId,
3877        mut blend_mode: BlendMode2,
3878    ) -> Result<(), fidl::Error> {
3879        FlatlandProxyInterface::r#set_image_blend_mode(self, image_id, blend_mode)
3880    }
3881
3882    /// Sets an opacity in linear space to be applied to a flatland image. Opacity values must
3883    /// be in the range [0.0, 1.0].
3884    pub fn r#set_image_opacity(
3885        &self,
3886        mut image_id: &ContentId,
3887        mut val: f32,
3888    ) -> Result<(), fidl::Error> {
3889        FlatlandProxyInterface::r#set_image_opacity(self, image_id, val)
3890    }
3891
3892    /// Sets the image flip to be applied to a flatland image. This call must be performed after a
3893    /// successful |CreateImage| call. If an invalid |image_id| is supplied, the channel will be
3894    /// closed due to FlatlandError::BAD_OPERATION. This flip will be applied to the Image before
3895    /// parent Transform Orientations. If this function is not called, then the default flip value
3896    /// is ImageFlip::NONE.
3897    pub fn r#set_image_flip(
3898        &self,
3899        mut image_id: &ContentId,
3900        mut flip: ImageFlip,
3901    ) -> Result<(), fidl::Error> {
3902        FlatlandProxyInterface::r#set_image_flip(self, image_id, flip)
3903    }
3904
3905    /// Creates a solid-color rectangle. By default a filled-rect does not have a defined
3906    /// color or size. It is necessary to call |SetSolidFill| to specify a color and size
3907    /// before a filled rect can be used for rendering. Not doing so will result the
3908    /// rectangle having a default size of (0,0) and so it will not show up when rendering.
3909    ///
3910    /// `rect_id` must satisfy standard [`ContentId`] creation constraints.
3911    pub fn r#create_filled_rect(&self, mut rect_id: &ContentId) -> Result<(), fidl::Error> {
3912        FlatlandProxyInterface::r#create_filled_rect(self, rect_id)
3913    }
3914
3915    /// Defines the color and size of a filled rect. |rect_id| must refer to content that
3916    /// was created via a call to CreateFilledRect. The color is not premultiplied. Color values
3917    /// must be within the range [0,1] inclusive, and normal 32-bit
3918    /// floating point values: https://en.wikipedia.org/wiki/Normal_number_%28computing%29. Values
3919    /// that do not conform to these specifications will cause the channel to close.
3920    /// The rectangle's top left corner will be at (0, 0) in its transform's coordinate space.
3921    /// Hence, its bottom right corner will be at (size.width, size.height).
3922    ///
3923    /// `rect_id` must refer to a valid, unreleased filled rectangle.
3924    pub fn r#set_solid_fill(
3925        &self,
3926        mut rect_id: &ContentId,
3927        mut color: &ColorRgba,
3928        mut size: &fidl_fuchsia_math::SizeU,
3929    ) -> Result<(), fidl::Error> {
3930        FlatlandProxyInterface::r#set_solid_fill(self, rect_id, color, size)
3931    }
3932
3933    /// Automatically garbage collects the rectangle when it is no longer needed for
3934    /// rendering. |rect_id| must have been instantiated with a call to
3935    /// |CreateFilledRect|. Once released, the ID immediately goes out of scope and is free
3936    /// to be used again.
3937    ///
3938    /// `rect_id` must refer to a valid, unreleased filled rectangle.
3939    pub fn r#release_filled_rect(&self, mut rect_id: &ContentId) -> Result<(), fidl::Error> {
3940        FlatlandProxyInterface::r#release_filled_rect(self, rect_id)
3941    }
3942
3943    /// Setting a piece of Content on a Transform makes that Content visible in the render tree as
3944    /// long as the Transform is visible from the root Transform. The Content will be rendered
3945    /// before, and therefore "behind", any Content attached to the descendants of the Transform.
3946    ///
3947    /// Because each Transform can have, at most, a single piece of Content on it, calling this
3948    /// function on a Transform that already has Content will replace that Content.
3949    ///
3950    /// A Content may be set on more than one Transform.
3951    ///
3952    /// Calling this function with a Content id of 0 will remove any Content currently on the
3953    /// Transform.
3954    ///
3955    /// `content_id` must refer to a valid, unreleased Content object, or 0 to clear.
3956    pub fn r#set_content(
3957        &self,
3958        mut transform_id: &TransformId,
3959        mut content_id: &ContentId,
3960    ) -> Result<(), fidl::Error> {
3961        FlatlandProxyInterface::r#set_content(self, transform_id, content_id)
3962    }
3963
3964    /// Transforms are usually sufficient to change how Content is presented. Viewports, however,
3965    /// have special properties that are not part of the Transform hierarchy. Those properties can
3966    /// be set using this function.
3967    pub fn r#set_viewport_properties(
3968        &self,
3969        mut viewport_id: &ContentId,
3970        mut properties: &ViewportProperties,
3971    ) -> Result<(), fidl::Error> {
3972        FlatlandProxyInterface::r#set_viewport_properties(self, viewport_id, properties)
3973    }
3974
3975    /// Released Transforms will be garbage collected by the system once they are no longer
3976    /// necessary for rendering. For Transforms, this means there is no path from any unreleased
3977    /// Transform to the newly-released Transform.
3978    ///
3979    /// Once released, the id immediately goes out of scope for future function calls and can be
3980    /// reused when creating new Transforms.
3981    ///
3982    /// It is an error to call functions with a released id (unless that id has been reused to
3983    /// construct a new Transform).
3984    pub fn r#release_transform(&self, mut transform_id: &TransformId) -> Result<(), fidl::Error> {
3985        FlatlandProxyInterface::r#release_transform(self, transform_id)
3986    }
3987
3988    /// Releases the View, which disconnects this Flatland session from its parent Viewport in
3989    /// another Flatland session.
3990    ///
3991    /// To clear the existing content from the screen without releasing the current View, use
3992    /// SetRootTransform(0) instead.
3993    ///
3994    /// Despite having a return type, this function is still feed-forward Like [`CreateView`] and
3995    /// requires a call to [`Present`] to be executed. The ViewCreationToken will be returned after
3996    /// the presented operations have been executed.
3997    pub fn r#release_view(&self) -> Result<(), fidl::Error> {
3998        FlatlandProxyInterface::r#release_view(self)
3999    }
4000
4001    /// Releases a Viewport from the scene, even if the Viewport is still connected to a Transform.
4002    /// Unlike other resources, Viewports are garbage collected by the system during the next
4003    /// [`Present`] because a removed Viewport is guaranteed to provide no renderable content.
4004    ///
4005    /// Use SetContent(transform_id, 0) to clean up references to released Viewports.
4006    ///
4007    /// Despite having a return type, this function is still feed-forward like [`CreateView`] and
4008    /// requires a call to [`Present`] to be executed. The ViewportCreationToken will be returned
4009    /// after the presented operations have been executed.
4010    pub fn r#release_viewport(
4011        &self,
4012        mut viewport_id: &ContentId,
4013    ) -> fidl::client::QueryResponseFut<
4014        fidl_fuchsia_ui_views::ViewportCreationToken,
4015        fidl::encoding::DefaultFuchsiaResourceDialect,
4016    > {
4017        FlatlandProxyInterface::r#release_viewport(self, viewport_id)
4018    }
4019
4020    /// Released Images will be garbage collected by the system once they are no longer necessary
4021    /// for rendering. For Images, this means the Image is no longer attached to any Transform and
4022    /// any pending rendering that references the Image is complete.
4023    ///
4024    /// Use SetContent(transform_id, 0) to clean up references to released Images.
4025    ///
4026    /// Once released, the id immediately goes out of scope for future function calls and can be
4027    /// reused when creating new Images.
4028    ///
4029    /// It is an error to call functions with a released id (unless that id has been reused to
4030    /// construct a new Image).
4031    pub fn r#release_image(&self, mut image_id: &ContentId) -> Result<(), fidl::Error> {
4032        FlatlandProxyInterface::r#release_image(self, image_id)
4033    }
4034
4035    /// This function will reset all state on this interface. This includes destroying all existing
4036    /// View and Viewports without returning the associated Token to the caller.
4037    pub fn r#clear(&self) -> Result<(), fidl::Error> {
4038        FlatlandProxyInterface::r#clear(self)
4039    }
4040
4041    /// Set debug name of the current client that can be used by Flatland to print as a prefix to
4042    /// logs to help client distinguish what is theirs. [`name`] can be an arbitrary string, but the
4043    /// current process name (see fsl::GetCurrentProcessName()) is a good default.
4044    pub fn r#set_debug_name(&self, mut name: &str) -> Result<(), fidl::Error> {
4045        FlatlandProxyInterface::r#set_debug_name(self, name)
4046    }
4047}
4048
4049impl FlatlandProxyInterface for FlatlandProxy {
4050    fn r#release_image_immediately(&self, mut image_id: &ContentId) -> Result<(), fidl::Error> {
4051        self.client.send::<TrustedFlatlandReleaseImageImmediatelyRequest>(
4052            (image_id,),
4053            0x245e1ac080772c8,
4054            fidl::encoding::DynamicFlags::empty(),
4055        )
4056    }
4057
4058    fn r#release_image_immediately2(&self, mut image_id: &ImageId) -> Result<(), fidl::Error> {
4059        self.client.send::<TrustedFlatlandReleaseImageImmediately2Request>(
4060            (image_id,),
4061            0x6d6a73d150589146,
4062            fidl::encoding::DynamicFlags::empty(),
4063        )
4064    }
4065
4066    fn r#create_layer(&self, mut layer_id: &LayerId) -> Result<(), fidl::Error> {
4067        self.client.send::<Flatland2CreateLayerRequest>(
4068            (layer_id,),
4069            0x60837bb0ce59f8a9,
4070            fidl::encoding::DynamicFlags::empty(),
4071        )
4072    }
4073
4074    fn r#release_layer(&self, mut layer_id: &LayerId) -> Result<(), fidl::Error> {
4075        self.client.send::<Flatland2ReleaseLayerRequest>(
4076            (layer_id,),
4077            0x60118a842b6f0756,
4078            fidl::encoding::DynamicFlags::empty(),
4079        )
4080    }
4081
4082    fn r#set_layer_image(
4083        &self,
4084        mut layer_id: &LayerId,
4085        mut image_id: &ImageId,
4086        mut acquire_fence: Option<WaitFence>,
4087        mut release_fence: Option<SignalFence>,
4088    ) -> Result<(), fidl::Error> {
4089        self.client.send::<Flatland2SetLayerImageRequest>(
4090            (layer_id, image_id, acquire_fence.as_mut(), release_fence.as_mut()),
4091            0x262302d9782d252c,
4092            fidl::encoding::DynamicFlags::empty(),
4093        )
4094    }
4095
4096    fn r#set_layer_properties(
4097        &self,
4098        mut layer_id: &LayerId,
4099        mut properties: &LayerProperties,
4100    ) -> Result<(), fidl::Error> {
4101        self.client.send::<Flatland2SetLayerPropertiesRequest>(
4102            (layer_id, properties),
4103            0x282d0e902aae8bb0,
4104            fidl::encoding::DynamicFlags::empty(),
4105        )
4106    }
4107
4108    fn r#reset_layer(&self, mut layer_id: &LayerId) -> Result<(), fidl::Error> {
4109        self.client.send::<Flatland2ResetLayerRequest>(
4110            (layer_id,),
4111            0x17bf541bf216ab2b,
4112            fidl::encoding::DynamicFlags::empty(),
4113        )
4114    }
4115
4116    fn r#create_layer_stack(&self, mut stack_id: &LayerStackId) -> Result<(), fidl::Error> {
4117        self.client.send::<Flatland2CreateLayerStackRequest>(
4118            (stack_id,),
4119            0x70debe3cd7371aa6,
4120            fidl::encoding::DynamicFlags::empty(),
4121        )
4122    }
4123
4124    fn r#release_layer_stack(&self, mut stack_id: &LayerStackId) -> Result<(), fidl::Error> {
4125        self.client.send::<Flatland2ReleaseLayerStackRequest>(
4126            (stack_id,),
4127            0x3ad3151aece3b1bb,
4128            fidl::encoding::DynamicFlags::empty(),
4129        )
4130    }
4131
4132    fn r#set_stack_layers(
4133        &self,
4134        mut stack_id: &LayerStackId,
4135        mut layers: &[LayerId],
4136    ) -> Result<(), fidl::Error> {
4137        self.client.send::<Flatland2SetStackLayersRequest>(
4138            (stack_id, layers),
4139            0x1e0bff0f5cca065a,
4140            fidl::encoding::DynamicFlags::empty(),
4141        )
4142    }
4143
4144    fn r#create_image2(
4145        &self,
4146        mut image_id: &ImageId,
4147        mut import_token: BufferCollectionImportToken,
4148        mut vmo_index: u32,
4149        mut properties: &ImageProperties,
4150    ) -> Result<(), fidl::Error> {
4151        self.client.send::<Flatland2CreateImage2Request>(
4152            (image_id, &mut import_token, vmo_index, properties),
4153            0x677fa7b23aaca46,
4154            fidl::encoding::DynamicFlags::empty(),
4155        )
4156    }
4157
4158    fn r#release_image2(&self, mut image_id: &ImageId) -> Result<(), fidl::Error> {
4159        self.client.send::<Flatland2ReleaseImage2Request>(
4160            (image_id,),
4161            0x7d0a041ed51aca06,
4162            fidl::encoding::DynamicFlags::empty(),
4163        )
4164    }
4165
4166    fn r#create_viewport2(
4167        &self,
4168        mut viewport_id: &ViewportId,
4169        mut token: fidl_fuchsia_ui_views::ViewportCreationToken,
4170        mut properties: &ViewportProperties,
4171        mut child_view_watcher: fidl::endpoints::ServerEnd<ChildViewWatcherMarker>,
4172    ) -> Result<(), fidl::Error> {
4173        self.client.send::<Flatland2CreateViewport2Request>(
4174            (viewport_id, &mut token, properties, child_view_watcher),
4175            0x1b646776764f1128,
4176            fidl::encoding::DynamicFlags::empty(),
4177        )
4178    }
4179
4180    type ReleaseViewport2ResponseFut = fidl::client::QueryResponseFut<
4181        fidl_fuchsia_ui_views::ViewportCreationToken,
4182        fidl::encoding::DefaultFuchsiaResourceDialect,
4183    >;
4184    fn r#release_viewport2(
4185        &self,
4186        mut viewport_id: &ViewportId,
4187    ) -> Self::ReleaseViewport2ResponseFut {
4188        fn _decode(
4189            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4190        ) -> Result<fidl_fuchsia_ui_views::ViewportCreationToken, fidl::Error> {
4191            let _response = fidl::client::decode_transaction_body::<
4192                Flatland2ReleaseViewport2Response,
4193                fidl::encoding::DefaultFuchsiaResourceDialect,
4194                0x18ef77414c7a9ae3,
4195            >(_buf?)?;
4196            Ok(_response.token)
4197        }
4198        self.client.send_query_and_decode::<
4199            Flatland2ReleaseViewport2Request,
4200            fidl_fuchsia_ui_views::ViewportCreationToken,
4201        >(
4202            (viewport_id,),
4203            0x18ef77414c7a9ae3,
4204            fidl::encoding::DynamicFlags::empty(),
4205            _decode,
4206        )
4207    }
4208
4209    fn r#set_viewport_properties2(
4210        &self,
4211        mut viewport_id: &ViewportId,
4212        mut properties: &ViewportProperties,
4213    ) -> Result<(), fidl::Error> {
4214        self.client.send::<Flatland2SetViewportProperties2Request>(
4215            (viewport_id, properties),
4216            0x95f2ec3b9e4beea,
4217            fidl::encoding::DynamicFlags::empty(),
4218        )
4219    }
4220
4221    fn r#set_transform_content(
4222        &self,
4223        mut transform_id: &TransformId,
4224        mut content: Option<&TransformContent>,
4225    ) -> Result<(), fidl::Error> {
4226        self.client.send::<Flatland2SetTransformContentRequest>(
4227            (transform_id, content),
4228            0x17e33f64f55e4ea9,
4229            fidl::encoding::DynamicFlags::empty(),
4230        )
4231    }
4232
4233    fn r#present(&self, mut args: PresentArgs) -> Result<(), fidl::Error> {
4234        self.client.send::<FlatlandPresentRequest>(
4235            (&mut args,),
4236            0x50acc2aa1f0acec7,
4237            fidl::encoding::DynamicFlags::empty(),
4238        )
4239    }
4240
4241    fn r#create_view(
4242        &self,
4243        mut token: fidl_fuchsia_ui_views::ViewCreationToken,
4244        mut parent_viewport_watcher: fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>,
4245    ) -> Result<(), fidl::Error> {
4246        self.client.send::<FlatlandCreateViewRequest>(
4247            (&mut token, parent_viewport_watcher),
4248            0x504686eb25864780,
4249            fidl::encoding::DynamicFlags::empty(),
4250        )
4251    }
4252
4253    fn r#create_view2(
4254        &self,
4255        mut token: fidl_fuchsia_ui_views::ViewCreationToken,
4256        mut view_identity: fidl_fuchsia_ui_views::ViewIdentityOnCreation,
4257        mut protocols: ViewBoundProtocols,
4258        mut parent_viewport_watcher: fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>,
4259    ) -> Result<(), fidl::Error> {
4260        self.client.send::<FlatlandCreateView2Request>(
4261            (&mut token, &mut view_identity, &mut protocols, parent_viewport_watcher),
4262            0x340a3a40c2fdbd5e,
4263            fidl::encoding::DynamicFlags::empty(),
4264        )
4265    }
4266
4267    fn r#create_transform(&self, mut transform_id: &TransformId) -> Result<(), fidl::Error> {
4268        self.client.send::<FlatlandCreateTransformRequest>(
4269            (transform_id,),
4270            0x5e042a4d3de3efb0,
4271            fidl::encoding::DynamicFlags::empty(),
4272        )
4273    }
4274
4275    fn r#set_translation(
4276        &self,
4277        mut transform_id: &TransformId,
4278        mut translation: &fidl_fuchsia_math::Vec_,
4279    ) -> Result<(), fidl::Error> {
4280        self.client.send::<FlatlandSetTranslationRequest>(
4281            (transform_id, translation),
4282            0x7863398291fba346,
4283            fidl::encoding::DynamicFlags::empty(),
4284        )
4285    }
4286
4287    fn r#set_orientation(
4288        &self,
4289        mut transform_id: &TransformId,
4290        mut orientation: Orientation,
4291    ) -> Result<(), fidl::Error> {
4292        self.client.send::<FlatlandSetOrientationRequest>(
4293            (transform_id, orientation),
4294            0x4915310bc4928edc,
4295            fidl::encoding::DynamicFlags::empty(),
4296        )
4297    }
4298
4299    fn r#set_scale(
4300        &self,
4301        mut transform_id: &TransformId,
4302        mut scale: &fidl_fuchsia_math::VecF,
4303    ) -> Result<(), fidl::Error> {
4304        self.client.send::<FlatlandSetScaleRequest>(
4305            (transform_id, scale),
4306            0x1ea1766fd8996bb4,
4307            fidl::encoding::DynamicFlags::empty(),
4308        )
4309    }
4310
4311    fn r#set_opacity(
4312        &self,
4313        mut transform_id: &TransformId,
4314        mut value: f32,
4315    ) -> Result<(), fidl::Error> {
4316        self.client.send::<FlatlandSetOpacityRequest>(
4317            (transform_id, value),
4318            0x3775fc2c00b432fa,
4319            fidl::encoding::DynamicFlags::empty(),
4320        )
4321    }
4322
4323    fn r#set_clip_boundary(
4324        &self,
4325        mut transform_id: &TransformId,
4326        mut rect: Option<&fidl_fuchsia_math::Rect>,
4327    ) -> Result<(), fidl::Error> {
4328        self.client.send::<FlatlandSetClipBoundaryRequest>(
4329            (transform_id, rect),
4330            0x6507843df12222d2,
4331            fidl::encoding::DynamicFlags::empty(),
4332        )
4333    }
4334
4335    fn r#add_child(
4336        &self,
4337        mut parent_transform_id: &TransformId,
4338        mut child_transform_id: &TransformId,
4339    ) -> Result<(), fidl::Error> {
4340        self.client.send::<FlatlandAddChildRequest>(
4341            (parent_transform_id, child_transform_id),
4342            0x67a8abd2f19b1a74,
4343            fidl::encoding::DynamicFlags::empty(),
4344        )
4345    }
4346
4347    fn r#remove_child(
4348        &self,
4349        mut parent_transform_id: &TransformId,
4350        mut child_transform_id: &TransformId,
4351    ) -> Result<(), fidl::Error> {
4352        self.client.send::<FlatlandRemoveChildRequest>(
4353            (parent_transform_id, child_transform_id),
4354            0x41d6cd90b298b67a,
4355            fidl::encoding::DynamicFlags::empty(),
4356        )
4357    }
4358
4359    fn r#replace_children(
4360        &self,
4361        mut parent_transform_id: &TransformId,
4362        mut new_child_transform_ids: &[TransformId],
4363    ) -> Result<(), fidl::Error> {
4364        self.client.send::<FlatlandReplaceChildrenRequest>(
4365            (parent_transform_id, new_child_transform_ids),
4366            0x5b6d86cbbff81316,
4367            fidl::encoding::DynamicFlags::empty(),
4368        )
4369    }
4370
4371    fn r#set_root_transform(&self, mut transform_id: &TransformId) -> Result<(), fidl::Error> {
4372        self.client.send::<FlatlandSetRootTransformRequest>(
4373            (transform_id,),
4374            0x6e80ca5bcc566cd8,
4375            fidl::encoding::DynamicFlags::empty(),
4376        )
4377    }
4378
4379    fn r#set_hit_regions(
4380        &self,
4381        mut transform_id: &TransformId,
4382        mut regions: &[HitRegion],
4383    ) -> Result<(), fidl::Error> {
4384        self.client.send::<FlatlandSetHitRegionsRequest>(
4385            (transform_id, regions),
4386            0x31c9d17b07c37ce4,
4387            fidl::encoding::DynamicFlags::empty(),
4388        )
4389    }
4390
4391    fn r#set_infinite_hit_region(
4392        &self,
4393        mut transform_id: &TransformId,
4394        mut hit_test: HitTestInteraction,
4395    ) -> Result<(), fidl::Error> {
4396        self.client.send::<FlatlandSetInfiniteHitRegionRequest>(
4397            (transform_id, hit_test),
4398            0x26d81af852d29562,
4399            fidl::encoding::DynamicFlags::empty(),
4400        )
4401    }
4402
4403    fn r#create_viewport(
4404        &self,
4405        mut viewport_id: &ContentId,
4406        mut token: fidl_fuchsia_ui_views::ViewportCreationToken,
4407        mut properties: &ViewportProperties,
4408        mut child_view_watcher: fidl::endpoints::ServerEnd<ChildViewWatcherMarker>,
4409    ) -> Result<(), fidl::Error> {
4410        self.client.send::<FlatlandCreateViewportRequest>(
4411            (viewport_id, &mut token, properties, child_view_watcher),
4412            0x2485fbcab7f943c,
4413            fidl::encoding::DynamicFlags::empty(),
4414        )
4415    }
4416
4417    fn r#create_image(
4418        &self,
4419        mut image_id: &ContentId,
4420        mut import_token: BufferCollectionImportToken,
4421        mut vmo_index: u32,
4422        mut properties: &ImageProperties,
4423    ) -> Result<(), fidl::Error> {
4424        self.client.send::<FlatlandCreateImageRequest>(
4425            (image_id, &mut import_token, vmo_index, properties),
4426            0x26fae823c4ebedad,
4427            fidl::encoding::DynamicFlags::empty(),
4428        )
4429    }
4430
4431    fn r#set_image_sample_region(
4432        &self,
4433        mut image_id: &ContentId,
4434        mut rect: &fidl_fuchsia_math::RectF,
4435    ) -> Result<(), fidl::Error> {
4436        self.client.send::<FlatlandSetImageSampleRegionRequest>(
4437            (image_id, rect),
4438            0x8039391d715eb28,
4439            fidl::encoding::DynamicFlags::empty(),
4440        )
4441    }
4442
4443    fn r#set_image_destination_size(
4444        &self,
4445        mut image_id: &ContentId,
4446        mut size: &fidl_fuchsia_math::SizeU,
4447    ) -> Result<(), fidl::Error> {
4448        self.client.send::<FlatlandSetImageDestinationSizeRequest>(
4449            (image_id, size),
4450            0x766cf99a2ec58446,
4451            fidl::encoding::DynamicFlags::empty(),
4452        )
4453    }
4454
4455    fn r#set_image_blending_function(
4456        &self,
4457        mut image_id: &ContentId,
4458        mut blend_mode: BlendMode,
4459    ) -> Result<(), fidl::Error> {
4460        self.client.send::<FlatlandSetImageBlendingFunctionRequest>(
4461            (image_id, blend_mode),
4462            0x10f5da1356275b7b,
4463            fidl::encoding::DynamicFlags::empty(),
4464        )
4465    }
4466
4467    fn r#set_image_blend_mode(
4468        &self,
4469        mut image_id: &ContentId,
4470        mut blend_mode: BlendMode2,
4471    ) -> Result<(), fidl::Error> {
4472        self.client.send::<FlatlandSetImageBlendModeRequest>(
4473            (image_id, blend_mode),
4474            0x5b1667f130c3de67,
4475            fidl::encoding::DynamicFlags::empty(),
4476        )
4477    }
4478
4479    fn r#set_image_opacity(
4480        &self,
4481        mut image_id: &ContentId,
4482        mut val: f32,
4483    ) -> Result<(), fidl::Error> {
4484        self.client.send::<FlatlandSetImageOpacityRequest>(
4485            (image_id, val),
4486            0x2da9e4ef4c2cff6f,
4487            fidl::encoding::DynamicFlags::empty(),
4488        )
4489    }
4490
4491    fn r#set_image_flip(
4492        &self,
4493        mut image_id: &ContentId,
4494        mut flip: ImageFlip,
4495    ) -> Result<(), fidl::Error> {
4496        self.client.send::<FlatlandSetImageFlipRequest>(
4497            (image_id, flip),
4498            0x21b20f2c14aae6bc,
4499            fidl::encoding::DynamicFlags::empty(),
4500        )
4501    }
4502
4503    fn r#create_filled_rect(&self, mut rect_id: &ContentId) -> Result<(), fidl::Error> {
4504        self.client.send::<FlatlandCreateFilledRectRequest>(
4505            (rect_id,),
4506            0x5e62355abc1c4c5d,
4507            fidl::encoding::DynamicFlags::empty(),
4508        )
4509    }
4510
4511    fn r#set_solid_fill(
4512        &self,
4513        mut rect_id: &ContentId,
4514        mut color: &ColorRgba,
4515        mut size: &fidl_fuchsia_math::SizeU,
4516    ) -> Result<(), fidl::Error> {
4517        self.client.send::<FlatlandSetSolidFillRequest>(
4518            (rect_id, color, size),
4519            0x32d6ef41e182dfa5,
4520            fidl::encoding::DynamicFlags::empty(),
4521        )
4522    }
4523
4524    fn r#release_filled_rect(&self, mut rect_id: &ContentId) -> Result<(), fidl::Error> {
4525        self.client.send::<FlatlandReleaseFilledRectRequest>(
4526            (rect_id,),
4527            0x7392cabe45618f9b,
4528            fidl::encoding::DynamicFlags::empty(),
4529        )
4530    }
4531
4532    fn r#set_content(
4533        &self,
4534        mut transform_id: &TransformId,
4535        mut content_id: &ContentId,
4536    ) -> Result<(), fidl::Error> {
4537        self.client.send::<FlatlandSetContentRequest>(
4538            (transform_id, content_id),
4539            0x4ed2cfc0ce130862,
4540            fidl::encoding::DynamicFlags::empty(),
4541        )
4542    }
4543
4544    fn r#set_viewport_properties(
4545        &self,
4546        mut viewport_id: &ContentId,
4547        mut properties: &ViewportProperties,
4548    ) -> Result<(), fidl::Error> {
4549        self.client.send::<FlatlandSetViewportPropertiesRequest>(
4550            (viewport_id, properties),
4551            0x66ab67e9608ddb9f,
4552            fidl::encoding::DynamicFlags::empty(),
4553        )
4554    }
4555
4556    fn r#release_transform(&self, mut transform_id: &TransformId) -> Result<(), fidl::Error> {
4557        self.client.send::<FlatlandReleaseTransformRequest>(
4558            (transform_id,),
4559            0xab9328419451c22,
4560            fidl::encoding::DynamicFlags::empty(),
4561        )
4562    }
4563
4564    fn r#release_view(&self) -> Result<(), fidl::Error> {
4565        self.client.send::<fidl::encoding::EmptyPayload>(
4566            (),
4567            0x5b35aab9baffecae,
4568            fidl::encoding::DynamicFlags::empty(),
4569        )
4570    }
4571
4572    type ReleaseViewportResponseFut = fidl::client::QueryResponseFut<
4573        fidl_fuchsia_ui_views::ViewportCreationToken,
4574        fidl::encoding::DefaultFuchsiaResourceDialect,
4575    >;
4576    fn r#release_viewport(&self, mut viewport_id: &ContentId) -> Self::ReleaseViewportResponseFut {
4577        fn _decode(
4578            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4579        ) -> Result<fidl_fuchsia_ui_views::ViewportCreationToken, fidl::Error> {
4580            let _response = fidl::client::decode_transaction_body::<
4581                FlatlandReleaseViewportResponse,
4582                fidl::encoding::DefaultFuchsiaResourceDialect,
4583                0xbad474aeb5293f9,
4584            >(_buf?)?;
4585            Ok(_response.token)
4586        }
4587        self.client.send_query_and_decode::<
4588            FlatlandReleaseViewportRequest,
4589            fidl_fuchsia_ui_views::ViewportCreationToken,
4590        >(
4591            (viewport_id,),
4592            0xbad474aeb5293f9,
4593            fidl::encoding::DynamicFlags::empty(),
4594            _decode,
4595        )
4596    }
4597
4598    fn r#release_image(&self, mut image_id: &ContentId) -> Result<(), fidl::Error> {
4599        self.client.send::<FlatlandReleaseImageRequest>(
4600            (image_id,),
4601            0xb884ffdbc72c111,
4602            fidl::encoding::DynamicFlags::empty(),
4603        )
4604    }
4605
4606    fn r#clear(&self) -> Result<(), fidl::Error> {
4607        self.client.send::<fidl::encoding::EmptyPayload>(
4608            (),
4609            0x4ec8817c02828c3e,
4610            fidl::encoding::DynamicFlags::empty(),
4611        )
4612    }
4613
4614    fn r#set_debug_name(&self, mut name: &str) -> Result<(), fidl::Error> {
4615        self.client.send::<FlatlandSetDebugNameRequest>(
4616            (name,),
4617            0x46a8b397e68a8888,
4618            fidl::encoding::DynamicFlags::empty(),
4619        )
4620    }
4621}
4622
4623pub struct FlatlandEventStream {
4624    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
4625}
4626
4627impl std::marker::Unpin for FlatlandEventStream {}
4628
4629impl futures::stream::FusedStream for FlatlandEventStream {
4630    fn is_terminated(&self) -> bool {
4631        self.event_receiver.is_terminated()
4632    }
4633}
4634
4635impl futures::Stream for FlatlandEventStream {
4636    type Item = Result<FlatlandEvent, fidl::Error>;
4637
4638    fn poll_next(
4639        mut self: std::pin::Pin<&mut Self>,
4640        cx: &mut std::task::Context<'_>,
4641    ) -> std::task::Poll<Option<Self::Item>> {
4642        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
4643            &mut self.event_receiver,
4644            cx
4645        )?) {
4646            Some(buf) => std::task::Poll::Ready(Some(FlatlandEvent::decode(buf))),
4647            None => std::task::Poll::Ready(None),
4648        }
4649    }
4650}
4651
4652#[derive(Debug)]
4653pub enum FlatlandEvent {
4654    OnNextFrameBegin { values: OnNextFrameBeginValues },
4655    OnFramePresented { frame_presented_info: fidl_fuchsia_scenic_scheduling::FramePresentedInfo },
4656    OnError { error: FlatlandError },
4657}
4658
4659impl FlatlandEvent {
4660    #[allow(irrefutable_let_patterns)]
4661    pub fn into_on_next_frame_begin(self) -> Option<OnNextFrameBeginValues> {
4662        if let FlatlandEvent::OnNextFrameBegin { values } = self { Some((values)) } else { None }
4663    }
4664    #[allow(irrefutable_let_patterns)]
4665    pub fn into_on_frame_presented(
4666        self,
4667    ) -> Option<fidl_fuchsia_scenic_scheduling::FramePresentedInfo> {
4668        if let FlatlandEvent::OnFramePresented { frame_presented_info } = self {
4669            Some((frame_presented_info))
4670        } else {
4671            None
4672        }
4673    }
4674    #[allow(irrefutable_let_patterns)]
4675    pub fn into_on_error(self) -> Option<FlatlandError> {
4676        if let FlatlandEvent::OnError { error } = self { Some((error)) } else { None }
4677    }
4678
4679    /// Decodes a message buffer as a [`FlatlandEvent`].
4680    fn decode(
4681        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
4682    ) -> Result<FlatlandEvent, fidl::Error> {
4683        let (bytes, _handles) = buf.split_mut();
4684        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4685        debug_assert_eq!(tx_header.tx_id, 0);
4686        match tx_header.ordinal {
4687            0x10f69a5cdeece84a => {
4688                let mut out = fidl::new_empty!(
4689                    FlatlandOnNextFrameBeginRequest,
4690                    fidl::encoding::DefaultFuchsiaResourceDialect
4691                );
4692                fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandOnNextFrameBeginRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
4693                Ok((FlatlandEvent::OnNextFrameBegin { values: out.values }))
4694            }
4695            0x56e43e1a5f30216d => {
4696                let mut out = fidl::new_empty!(
4697                    FlatlandOnFramePresentedRequest,
4698                    fidl::encoding::DefaultFuchsiaResourceDialect
4699                );
4700                fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandOnFramePresentedRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
4701                Ok((FlatlandEvent::OnFramePresented {
4702                    frame_presented_info: out.frame_presented_info,
4703                }))
4704            }
4705            0x1ebf39e90cd8b8d => {
4706                let mut out = fidl::new_empty!(
4707                    FlatlandOnErrorRequest,
4708                    fidl::encoding::DefaultFuchsiaResourceDialect
4709                );
4710                fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandOnErrorRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
4711                Ok((FlatlandEvent::OnError { error: out.error }))
4712            }
4713            _ => Err(fidl::Error::UnknownOrdinal {
4714                ordinal: tx_header.ordinal,
4715                protocol_name: <FlatlandMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4716            }),
4717        }
4718    }
4719}
4720
4721/// A Stream of incoming requests for fuchsia.ui.composition/Flatland.
4722pub struct FlatlandRequestStream {
4723    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4724    is_terminated: bool,
4725}
4726
4727impl std::marker::Unpin for FlatlandRequestStream {}
4728
4729impl futures::stream::FusedStream for FlatlandRequestStream {
4730    fn is_terminated(&self) -> bool {
4731        self.is_terminated
4732    }
4733}
4734
4735impl fidl::endpoints::RequestStream for FlatlandRequestStream {
4736    type Protocol = FlatlandMarker;
4737    type ControlHandle = FlatlandControlHandle;
4738
4739    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
4740        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
4741    }
4742
4743    fn control_handle(&self) -> Self::ControlHandle {
4744        FlatlandControlHandle { inner: self.inner.clone() }
4745    }
4746
4747    fn into_inner(
4748        self,
4749    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
4750    {
4751        (self.inner, self.is_terminated)
4752    }
4753
4754    fn from_inner(
4755        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4756        is_terminated: bool,
4757    ) -> Self {
4758        Self { inner, is_terminated }
4759    }
4760}
4761
4762impl futures::Stream for FlatlandRequestStream {
4763    type Item = Result<FlatlandRequest, fidl::Error>;
4764
4765    fn poll_next(
4766        mut self: std::pin::Pin<&mut Self>,
4767        cx: &mut std::task::Context<'_>,
4768    ) -> std::task::Poll<Option<Self::Item>> {
4769        let this = &mut *self;
4770        if this.inner.check_shutdown(cx) {
4771            this.is_terminated = true;
4772            return std::task::Poll::Ready(None);
4773        }
4774        if this.is_terminated {
4775            panic!("polled FlatlandRequestStream after completion");
4776        }
4777        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
4778            |bytes, handles| {
4779                match this.inner.channel().read_etc(cx, bytes, handles) {
4780                    std::task::Poll::Ready(Ok(())) => {}
4781                    std::task::Poll::Pending => return std::task::Poll::Pending,
4782                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
4783                        this.is_terminated = true;
4784                        return std::task::Poll::Ready(None);
4785                    }
4786                    std::task::Poll::Ready(Err(e)) => {
4787                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
4788                            e.into(),
4789                        ))));
4790                    }
4791                }
4792
4793                // A message has been received from the channel
4794                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4795
4796                std::task::Poll::Ready(Some(match header.ordinal {
4797                    0x245e1ac080772c8 => {
4798                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4799                        let mut req = fidl::new_empty!(
4800                            TrustedFlatlandReleaseImageImmediatelyRequest,
4801                            fidl::encoding::DefaultFuchsiaResourceDialect
4802                        );
4803                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<TrustedFlatlandReleaseImageImmediatelyRequest>(&header, _body_bytes, handles, &mut req)?;
4804                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4805                        Ok(FlatlandRequest::ReleaseImageImmediately {
4806                            image_id: req.image_id,
4807
4808                            control_handle,
4809                        })
4810                    }
4811                    0x6d6a73d150589146 => {
4812                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4813                        let mut req = fidl::new_empty!(
4814                            TrustedFlatlandReleaseImageImmediately2Request,
4815                            fidl::encoding::DefaultFuchsiaResourceDialect
4816                        );
4817                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<TrustedFlatlandReleaseImageImmediately2Request>(&header, _body_bytes, handles, &mut req)?;
4818                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4819                        Ok(FlatlandRequest::ReleaseImageImmediately2 {
4820                            image_id: req.image_id,
4821
4822                            control_handle,
4823                        })
4824                    }
4825                    0x60837bb0ce59f8a9 => {
4826                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4827                        let mut req = fidl::new_empty!(
4828                            Flatland2CreateLayerRequest,
4829                            fidl::encoding::DefaultFuchsiaResourceDialect
4830                        );
4831                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<Flatland2CreateLayerRequest>(&header, _body_bytes, handles, &mut req)?;
4832                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4833                        Ok(FlatlandRequest::CreateLayer { layer_id: req.layer_id, control_handle })
4834                    }
4835                    0x60118a842b6f0756 => {
4836                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4837                        let mut req = fidl::new_empty!(
4838                            Flatland2ReleaseLayerRequest,
4839                            fidl::encoding::DefaultFuchsiaResourceDialect
4840                        );
4841                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<Flatland2ReleaseLayerRequest>(&header, _body_bytes, handles, &mut req)?;
4842                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4843                        Ok(FlatlandRequest::ReleaseLayer { layer_id: req.layer_id, control_handle })
4844                    }
4845                    0x262302d9782d252c => {
4846                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4847                        let mut req = fidl::new_empty!(
4848                            Flatland2SetLayerImageRequest,
4849                            fidl::encoding::DefaultFuchsiaResourceDialect
4850                        );
4851                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<Flatland2SetLayerImageRequest>(&header, _body_bytes, handles, &mut req)?;
4852                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4853                        Ok(FlatlandRequest::SetLayerImage {
4854                            layer_id: req.layer_id,
4855                            image_id: req.image_id,
4856                            acquire_fence: req.acquire_fence,
4857                            release_fence: req.release_fence,
4858
4859                            control_handle,
4860                        })
4861                    }
4862                    0x282d0e902aae8bb0 => {
4863                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4864                        let mut req = fidl::new_empty!(
4865                            Flatland2SetLayerPropertiesRequest,
4866                            fidl::encoding::DefaultFuchsiaResourceDialect
4867                        );
4868                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<Flatland2SetLayerPropertiesRequest>(&header, _body_bytes, handles, &mut req)?;
4869                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4870                        Ok(FlatlandRequest::SetLayerProperties {
4871                            layer_id: req.layer_id,
4872                            properties: req.properties,
4873
4874                            control_handle,
4875                        })
4876                    }
4877                    0x17bf541bf216ab2b => {
4878                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4879                        let mut req = fidl::new_empty!(
4880                            Flatland2ResetLayerRequest,
4881                            fidl::encoding::DefaultFuchsiaResourceDialect
4882                        );
4883                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<Flatland2ResetLayerRequest>(&header, _body_bytes, handles, &mut req)?;
4884                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4885                        Ok(FlatlandRequest::ResetLayer { layer_id: req.layer_id, control_handle })
4886                    }
4887                    0x70debe3cd7371aa6 => {
4888                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4889                        let mut req = fidl::new_empty!(
4890                            Flatland2CreateLayerStackRequest,
4891                            fidl::encoding::DefaultFuchsiaResourceDialect
4892                        );
4893                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<Flatland2CreateLayerStackRequest>(&header, _body_bytes, handles, &mut req)?;
4894                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4895                        Ok(FlatlandRequest::CreateLayerStack {
4896                            stack_id: req.stack_id,
4897
4898                            control_handle,
4899                        })
4900                    }
4901                    0x3ad3151aece3b1bb => {
4902                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4903                        let mut req = fidl::new_empty!(
4904                            Flatland2ReleaseLayerStackRequest,
4905                            fidl::encoding::DefaultFuchsiaResourceDialect
4906                        );
4907                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<Flatland2ReleaseLayerStackRequest>(&header, _body_bytes, handles, &mut req)?;
4908                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4909                        Ok(FlatlandRequest::ReleaseLayerStack {
4910                            stack_id: req.stack_id,
4911
4912                            control_handle,
4913                        })
4914                    }
4915                    0x1e0bff0f5cca065a => {
4916                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4917                        let mut req = fidl::new_empty!(
4918                            Flatland2SetStackLayersRequest,
4919                            fidl::encoding::DefaultFuchsiaResourceDialect
4920                        );
4921                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<Flatland2SetStackLayersRequest>(&header, _body_bytes, handles, &mut req)?;
4922                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4923                        Ok(FlatlandRequest::SetStackLayers {
4924                            stack_id: req.stack_id,
4925                            layers: req.layers,
4926
4927                            control_handle,
4928                        })
4929                    }
4930                    0x677fa7b23aaca46 => {
4931                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4932                        let mut req = fidl::new_empty!(
4933                            Flatland2CreateImage2Request,
4934                            fidl::encoding::DefaultFuchsiaResourceDialect
4935                        );
4936                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<Flatland2CreateImage2Request>(&header, _body_bytes, handles, &mut req)?;
4937                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4938                        Ok(FlatlandRequest::CreateImage2 {
4939                            image_id: req.image_id,
4940                            import_token: req.import_token,
4941                            vmo_index: req.vmo_index,
4942                            properties: req.properties,
4943
4944                            control_handle,
4945                        })
4946                    }
4947                    0x7d0a041ed51aca06 => {
4948                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4949                        let mut req = fidl::new_empty!(
4950                            Flatland2ReleaseImage2Request,
4951                            fidl::encoding::DefaultFuchsiaResourceDialect
4952                        );
4953                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<Flatland2ReleaseImage2Request>(&header, _body_bytes, handles, &mut req)?;
4954                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4955                        Ok(FlatlandRequest::ReleaseImage2 {
4956                            image_id: req.image_id,
4957
4958                            control_handle,
4959                        })
4960                    }
4961                    0x1b646776764f1128 => {
4962                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4963                        let mut req = fidl::new_empty!(
4964                            Flatland2CreateViewport2Request,
4965                            fidl::encoding::DefaultFuchsiaResourceDialect
4966                        );
4967                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<Flatland2CreateViewport2Request>(&header, _body_bytes, handles, &mut req)?;
4968                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4969                        Ok(FlatlandRequest::CreateViewport2 {
4970                            viewport_id: req.viewport_id,
4971                            token: req.token,
4972                            properties: req.properties,
4973                            child_view_watcher: req.child_view_watcher,
4974
4975                            control_handle,
4976                        })
4977                    }
4978                    0x18ef77414c7a9ae3 => {
4979                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4980                        let mut req = fidl::new_empty!(
4981                            Flatland2ReleaseViewport2Request,
4982                            fidl::encoding::DefaultFuchsiaResourceDialect
4983                        );
4984                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<Flatland2ReleaseViewport2Request>(&header, _body_bytes, handles, &mut req)?;
4985                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4986                        Ok(FlatlandRequest::ReleaseViewport2 {
4987                            viewport_id: req.viewport_id,
4988
4989                            responder: FlatlandReleaseViewport2Responder {
4990                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4991                                tx_id: header.tx_id,
4992                            },
4993                        })
4994                    }
4995                    0x95f2ec3b9e4beea => {
4996                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4997                        let mut req = fidl::new_empty!(
4998                            Flatland2SetViewportProperties2Request,
4999                            fidl::encoding::DefaultFuchsiaResourceDialect
5000                        );
5001                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<Flatland2SetViewportProperties2Request>(&header, _body_bytes, handles, &mut req)?;
5002                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
5003                        Ok(FlatlandRequest::SetViewportProperties2 {
5004                            viewport_id: req.viewport_id,
5005                            properties: req.properties,
5006
5007                            control_handle,
5008                        })
5009                    }
5010                    0x17e33f64f55e4ea9 => {
5011                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5012                        let mut req = fidl::new_empty!(
5013                            Flatland2SetTransformContentRequest,
5014                            fidl::encoding::DefaultFuchsiaResourceDialect
5015                        );
5016                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<Flatland2SetTransformContentRequest>(&header, _body_bytes, handles, &mut req)?;
5017                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
5018                        Ok(FlatlandRequest::SetTransformContent {
5019                            transform_id: req.transform_id,
5020                            content: req.content,
5021
5022                            control_handle,
5023                        })
5024                    }
5025                    0x50acc2aa1f0acec7 => {
5026                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5027                        let mut req = fidl::new_empty!(
5028                            FlatlandPresentRequest,
5029                            fidl::encoding::DefaultFuchsiaResourceDialect
5030                        );
5031                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandPresentRequest>(&header, _body_bytes, handles, &mut req)?;
5032                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
5033                        Ok(FlatlandRequest::Present { args: req.args, control_handle })
5034                    }
5035                    0x504686eb25864780 => {
5036                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5037                        let mut req = fidl::new_empty!(
5038                            FlatlandCreateViewRequest,
5039                            fidl::encoding::DefaultFuchsiaResourceDialect
5040                        );
5041                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandCreateViewRequest>(&header, _body_bytes, handles, &mut req)?;
5042                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
5043                        Ok(FlatlandRequest::CreateView {
5044                            token: req.token,
5045                            parent_viewport_watcher: req.parent_viewport_watcher,
5046
5047                            control_handle,
5048                        })
5049                    }
5050                    0x340a3a40c2fdbd5e => {
5051                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5052                        let mut req = fidl::new_empty!(
5053                            FlatlandCreateView2Request,
5054                            fidl::encoding::DefaultFuchsiaResourceDialect
5055                        );
5056                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandCreateView2Request>(&header, _body_bytes, handles, &mut req)?;
5057                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
5058                        Ok(FlatlandRequest::CreateView2 {
5059                            token: req.token,
5060                            view_identity: req.view_identity,
5061                            protocols: req.protocols,
5062                            parent_viewport_watcher: req.parent_viewport_watcher,
5063
5064                            control_handle,
5065                        })
5066                    }
5067                    0x5e042a4d3de3efb0 => {
5068                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5069                        let mut req = fidl::new_empty!(
5070                            FlatlandCreateTransformRequest,
5071                            fidl::encoding::DefaultFuchsiaResourceDialect
5072                        );
5073                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandCreateTransformRequest>(&header, _body_bytes, handles, &mut req)?;
5074                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
5075                        Ok(FlatlandRequest::CreateTransform {
5076                            transform_id: req.transform_id,
5077
5078                            control_handle,
5079                        })
5080                    }
5081                    0x7863398291fba346 => {
5082                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5083                        let mut req = fidl::new_empty!(
5084                            FlatlandSetTranslationRequest,
5085                            fidl::encoding::DefaultFuchsiaResourceDialect
5086                        );
5087                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetTranslationRequest>(&header, _body_bytes, handles, &mut req)?;
5088                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
5089                        Ok(FlatlandRequest::SetTranslation {
5090                            transform_id: req.transform_id,
5091                            translation: req.translation,
5092
5093                            control_handle,
5094                        })
5095                    }
5096                    0x4915310bc4928edc => {
5097                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5098                        let mut req = fidl::new_empty!(
5099                            FlatlandSetOrientationRequest,
5100                            fidl::encoding::DefaultFuchsiaResourceDialect
5101                        );
5102                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetOrientationRequest>(&header, _body_bytes, handles, &mut req)?;
5103                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
5104                        Ok(FlatlandRequest::SetOrientation {
5105                            transform_id: req.transform_id,
5106                            orientation: req.orientation,
5107
5108                            control_handle,
5109                        })
5110                    }
5111                    0x1ea1766fd8996bb4 => {
5112                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5113                        let mut req = fidl::new_empty!(
5114                            FlatlandSetScaleRequest,
5115                            fidl::encoding::DefaultFuchsiaResourceDialect
5116                        );
5117                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetScaleRequest>(&header, _body_bytes, handles, &mut req)?;
5118                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
5119                        Ok(FlatlandRequest::SetScale {
5120                            transform_id: req.transform_id,
5121                            scale: req.scale,
5122
5123                            control_handle,
5124                        })
5125                    }
5126                    0x3775fc2c00b432fa => {
5127                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5128                        let mut req = fidl::new_empty!(
5129                            FlatlandSetOpacityRequest,
5130                            fidl::encoding::DefaultFuchsiaResourceDialect
5131                        );
5132                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetOpacityRequest>(&header, _body_bytes, handles, &mut req)?;
5133                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
5134                        Ok(FlatlandRequest::SetOpacity {
5135                            transform_id: req.transform_id,
5136                            value: req.value,
5137
5138                            control_handle,
5139                        })
5140                    }
5141                    0x6507843df12222d2 => {
5142                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5143                        let mut req = fidl::new_empty!(
5144                            FlatlandSetClipBoundaryRequest,
5145                            fidl::encoding::DefaultFuchsiaResourceDialect
5146                        );
5147                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetClipBoundaryRequest>(&header, _body_bytes, handles, &mut req)?;
5148                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
5149                        Ok(FlatlandRequest::SetClipBoundary {
5150                            transform_id: req.transform_id,
5151                            rect: req.rect,
5152
5153                            control_handle,
5154                        })
5155                    }
5156                    0x67a8abd2f19b1a74 => {
5157                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5158                        let mut req = fidl::new_empty!(
5159                            FlatlandAddChildRequest,
5160                            fidl::encoding::DefaultFuchsiaResourceDialect
5161                        );
5162                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandAddChildRequest>(&header, _body_bytes, handles, &mut req)?;
5163                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
5164                        Ok(FlatlandRequest::AddChild {
5165                            parent_transform_id: req.parent_transform_id,
5166                            child_transform_id: req.child_transform_id,
5167
5168                            control_handle,
5169                        })
5170                    }
5171                    0x41d6cd90b298b67a => {
5172                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5173                        let mut req = fidl::new_empty!(
5174                            FlatlandRemoveChildRequest,
5175                            fidl::encoding::DefaultFuchsiaResourceDialect
5176                        );
5177                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandRemoveChildRequest>(&header, _body_bytes, handles, &mut req)?;
5178                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
5179                        Ok(FlatlandRequest::RemoveChild {
5180                            parent_transform_id: req.parent_transform_id,
5181                            child_transform_id: req.child_transform_id,
5182
5183                            control_handle,
5184                        })
5185                    }
5186                    0x5b6d86cbbff81316 => {
5187                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5188                        let mut req = fidl::new_empty!(
5189                            FlatlandReplaceChildrenRequest,
5190                            fidl::encoding::DefaultFuchsiaResourceDialect
5191                        );
5192                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandReplaceChildrenRequest>(&header, _body_bytes, handles, &mut req)?;
5193                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
5194                        Ok(FlatlandRequest::ReplaceChildren {
5195                            parent_transform_id: req.parent_transform_id,
5196                            new_child_transform_ids: req.new_child_transform_ids,
5197
5198                            control_handle,
5199                        })
5200                    }
5201                    0x6e80ca5bcc566cd8 => {
5202                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5203                        let mut req = fidl::new_empty!(
5204                            FlatlandSetRootTransformRequest,
5205                            fidl::encoding::DefaultFuchsiaResourceDialect
5206                        );
5207                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetRootTransformRequest>(&header, _body_bytes, handles, &mut req)?;
5208                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
5209                        Ok(FlatlandRequest::SetRootTransform {
5210                            transform_id: req.transform_id,
5211
5212                            control_handle,
5213                        })
5214                    }
5215                    0x31c9d17b07c37ce4 => {
5216                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5217                        let mut req = fidl::new_empty!(
5218                            FlatlandSetHitRegionsRequest,
5219                            fidl::encoding::DefaultFuchsiaResourceDialect
5220                        );
5221                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetHitRegionsRequest>(&header, _body_bytes, handles, &mut req)?;
5222                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
5223                        Ok(FlatlandRequest::SetHitRegions {
5224                            transform_id: req.transform_id,
5225                            regions: req.regions,
5226
5227                            control_handle,
5228                        })
5229                    }
5230                    0x26d81af852d29562 => {
5231                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5232                        let mut req = fidl::new_empty!(
5233                            FlatlandSetInfiniteHitRegionRequest,
5234                            fidl::encoding::DefaultFuchsiaResourceDialect
5235                        );
5236                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetInfiniteHitRegionRequest>(&header, _body_bytes, handles, &mut req)?;
5237                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
5238                        Ok(FlatlandRequest::SetInfiniteHitRegion {
5239                            transform_id: req.transform_id,
5240                            hit_test: req.hit_test,
5241
5242                            control_handle,
5243                        })
5244                    }
5245                    0x2485fbcab7f943c => {
5246                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5247                        let mut req = fidl::new_empty!(
5248                            FlatlandCreateViewportRequest,
5249                            fidl::encoding::DefaultFuchsiaResourceDialect
5250                        );
5251                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandCreateViewportRequest>(&header, _body_bytes, handles, &mut req)?;
5252                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
5253                        Ok(FlatlandRequest::CreateViewport {
5254                            viewport_id: req.viewport_id,
5255                            token: req.token,
5256                            properties: req.properties,
5257                            child_view_watcher: req.child_view_watcher,
5258
5259                            control_handle,
5260                        })
5261                    }
5262                    0x26fae823c4ebedad => {
5263                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5264                        let mut req = fidl::new_empty!(
5265                            FlatlandCreateImageRequest,
5266                            fidl::encoding::DefaultFuchsiaResourceDialect
5267                        );
5268                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandCreateImageRequest>(&header, _body_bytes, handles, &mut req)?;
5269                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
5270                        Ok(FlatlandRequest::CreateImage {
5271                            image_id: req.image_id,
5272                            import_token: req.import_token,
5273                            vmo_index: req.vmo_index,
5274                            properties: req.properties,
5275
5276                            control_handle,
5277                        })
5278                    }
5279                    0x8039391d715eb28 => {
5280                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5281                        let mut req = fidl::new_empty!(
5282                            FlatlandSetImageSampleRegionRequest,
5283                            fidl::encoding::DefaultFuchsiaResourceDialect
5284                        );
5285                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetImageSampleRegionRequest>(&header, _body_bytes, handles, &mut req)?;
5286                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
5287                        Ok(FlatlandRequest::SetImageSampleRegion {
5288                            image_id: req.image_id,
5289                            rect: req.rect,
5290
5291                            control_handle,
5292                        })
5293                    }
5294                    0x766cf99a2ec58446 => {
5295                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5296                        let mut req = fidl::new_empty!(
5297                            FlatlandSetImageDestinationSizeRequest,
5298                            fidl::encoding::DefaultFuchsiaResourceDialect
5299                        );
5300                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetImageDestinationSizeRequest>(&header, _body_bytes, handles, &mut req)?;
5301                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
5302                        Ok(FlatlandRequest::SetImageDestinationSize {
5303                            image_id: req.image_id,
5304                            size: req.size,
5305
5306                            control_handle,
5307                        })
5308                    }
5309                    0x10f5da1356275b7b => {
5310                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5311                        let mut req = fidl::new_empty!(
5312                            FlatlandSetImageBlendingFunctionRequest,
5313                            fidl::encoding::DefaultFuchsiaResourceDialect
5314                        );
5315                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetImageBlendingFunctionRequest>(&header, _body_bytes, handles, &mut req)?;
5316                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
5317                        Ok(FlatlandRequest::SetImageBlendingFunction {
5318                            image_id: req.image_id,
5319                            blend_mode: req.blend_mode,
5320
5321                            control_handle,
5322                        })
5323                    }
5324                    0x5b1667f130c3de67 => {
5325                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5326                        let mut req = fidl::new_empty!(
5327                            FlatlandSetImageBlendModeRequest,
5328                            fidl::encoding::DefaultFuchsiaResourceDialect
5329                        );
5330                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetImageBlendModeRequest>(&header, _body_bytes, handles, &mut req)?;
5331                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
5332                        Ok(FlatlandRequest::SetImageBlendMode {
5333                            image_id: req.image_id,
5334                            blend_mode: req.blend_mode,
5335
5336                            control_handle,
5337                        })
5338                    }
5339                    0x2da9e4ef4c2cff6f => {
5340                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5341                        let mut req = fidl::new_empty!(
5342                            FlatlandSetImageOpacityRequest,
5343                            fidl::encoding::DefaultFuchsiaResourceDialect
5344                        );
5345                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetImageOpacityRequest>(&header, _body_bytes, handles, &mut req)?;
5346                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
5347                        Ok(FlatlandRequest::SetImageOpacity {
5348                            image_id: req.image_id,
5349                            val: req.val,
5350
5351                            control_handle,
5352                        })
5353                    }
5354                    0x21b20f2c14aae6bc => {
5355                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5356                        let mut req = fidl::new_empty!(
5357                            FlatlandSetImageFlipRequest,
5358                            fidl::encoding::DefaultFuchsiaResourceDialect
5359                        );
5360                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetImageFlipRequest>(&header, _body_bytes, handles, &mut req)?;
5361                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
5362                        Ok(FlatlandRequest::SetImageFlip {
5363                            image_id: req.image_id,
5364                            flip: req.flip,
5365
5366                            control_handle,
5367                        })
5368                    }
5369                    0x5e62355abc1c4c5d => {
5370                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5371                        let mut req = fidl::new_empty!(
5372                            FlatlandCreateFilledRectRequest,
5373                            fidl::encoding::DefaultFuchsiaResourceDialect
5374                        );
5375                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandCreateFilledRectRequest>(&header, _body_bytes, handles, &mut req)?;
5376                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
5377                        Ok(FlatlandRequest::CreateFilledRect {
5378                            rect_id: req.rect_id,
5379
5380                            control_handle,
5381                        })
5382                    }
5383                    0x32d6ef41e182dfa5 => {
5384                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5385                        let mut req = fidl::new_empty!(
5386                            FlatlandSetSolidFillRequest,
5387                            fidl::encoding::DefaultFuchsiaResourceDialect
5388                        );
5389                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetSolidFillRequest>(&header, _body_bytes, handles, &mut req)?;
5390                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
5391                        Ok(FlatlandRequest::SetSolidFill {
5392                            rect_id: req.rect_id,
5393                            color: req.color,
5394                            size: req.size,
5395
5396                            control_handle,
5397                        })
5398                    }
5399                    0x7392cabe45618f9b => {
5400                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5401                        let mut req = fidl::new_empty!(
5402                            FlatlandReleaseFilledRectRequest,
5403                            fidl::encoding::DefaultFuchsiaResourceDialect
5404                        );
5405                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandReleaseFilledRectRequest>(&header, _body_bytes, handles, &mut req)?;
5406                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
5407                        Ok(FlatlandRequest::ReleaseFilledRect {
5408                            rect_id: req.rect_id,
5409
5410                            control_handle,
5411                        })
5412                    }
5413                    0x4ed2cfc0ce130862 => {
5414                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5415                        let mut req = fidl::new_empty!(
5416                            FlatlandSetContentRequest,
5417                            fidl::encoding::DefaultFuchsiaResourceDialect
5418                        );
5419                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetContentRequest>(&header, _body_bytes, handles, &mut req)?;
5420                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
5421                        Ok(FlatlandRequest::SetContent {
5422                            transform_id: req.transform_id,
5423                            content_id: req.content_id,
5424
5425                            control_handle,
5426                        })
5427                    }
5428                    0x66ab67e9608ddb9f => {
5429                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5430                        let mut req = fidl::new_empty!(
5431                            FlatlandSetViewportPropertiesRequest,
5432                            fidl::encoding::DefaultFuchsiaResourceDialect
5433                        );
5434                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetViewportPropertiesRequest>(&header, _body_bytes, handles, &mut req)?;
5435                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
5436                        Ok(FlatlandRequest::SetViewportProperties {
5437                            viewport_id: req.viewport_id,
5438                            properties: req.properties,
5439
5440                            control_handle,
5441                        })
5442                    }
5443                    0xab9328419451c22 => {
5444                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5445                        let mut req = fidl::new_empty!(
5446                            FlatlandReleaseTransformRequest,
5447                            fidl::encoding::DefaultFuchsiaResourceDialect
5448                        );
5449                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandReleaseTransformRequest>(&header, _body_bytes, handles, &mut req)?;
5450                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
5451                        Ok(FlatlandRequest::ReleaseTransform {
5452                            transform_id: req.transform_id,
5453
5454                            control_handle,
5455                        })
5456                    }
5457                    0x5b35aab9baffecae => {
5458                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5459                        let mut req = fidl::new_empty!(
5460                            fidl::encoding::EmptyPayload,
5461                            fidl::encoding::DefaultFuchsiaResourceDialect
5462                        );
5463                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
5464                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
5465                        Ok(FlatlandRequest::ReleaseView { control_handle })
5466                    }
5467                    0xbad474aeb5293f9 => {
5468                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5469                        let mut req = fidl::new_empty!(
5470                            FlatlandReleaseViewportRequest,
5471                            fidl::encoding::DefaultFuchsiaResourceDialect
5472                        );
5473                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandReleaseViewportRequest>(&header, _body_bytes, handles, &mut req)?;
5474                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
5475                        Ok(FlatlandRequest::ReleaseViewport {
5476                            viewport_id: req.viewport_id,
5477
5478                            responder: FlatlandReleaseViewportResponder {
5479                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5480                                tx_id: header.tx_id,
5481                            },
5482                        })
5483                    }
5484                    0xb884ffdbc72c111 => {
5485                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5486                        let mut req = fidl::new_empty!(
5487                            FlatlandReleaseImageRequest,
5488                            fidl::encoding::DefaultFuchsiaResourceDialect
5489                        );
5490                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandReleaseImageRequest>(&header, _body_bytes, handles, &mut req)?;
5491                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
5492                        Ok(FlatlandRequest::ReleaseImage { image_id: req.image_id, control_handle })
5493                    }
5494                    0x4ec8817c02828c3e => {
5495                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5496                        let mut req = fidl::new_empty!(
5497                            fidl::encoding::EmptyPayload,
5498                            fidl::encoding::DefaultFuchsiaResourceDialect
5499                        );
5500                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
5501                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
5502                        Ok(FlatlandRequest::Clear { control_handle })
5503                    }
5504                    0x46a8b397e68a8888 => {
5505                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5506                        let mut req = fidl::new_empty!(
5507                            FlatlandSetDebugNameRequest,
5508                            fidl::encoding::DefaultFuchsiaResourceDialect
5509                        );
5510                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetDebugNameRequest>(&header, _body_bytes, handles, &mut req)?;
5511                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
5512                        Ok(FlatlandRequest::SetDebugName { name: req.name, control_handle })
5513                    }
5514                    _ => Err(fidl::Error::UnknownOrdinal {
5515                        ordinal: header.ordinal,
5516                        protocol_name:
5517                            <FlatlandMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5518                    }),
5519                }))
5520            },
5521        )
5522    }
5523}
5524
5525/// Each Flatland session contains a Graph, which consists of a set of objects, and the
5526/// relationships between those objects. The client can specify a subset of those objects
5527/// (specifically, the directed acyclic graph starting at the root transform) to be presented as
5528/// content to some kind of output -- usually, a display.
5529///
5530/// Flatland Graphs are both hierarchical, and distributed. Graphs from different Flatland sessions
5531/// may be connected together, allowing multiple processes to be involved in authoring content for a
5532/// particular output.
5533///
5534/// All functions in this protocol are feed-forward. The operations they represent are not fully
5535/// executed until [`Present`] is called.
5536#[derive(Debug)]
5537pub enum FlatlandRequest {
5538    /// Releases an image immediately, without waiting for the next present.
5539    ReleaseImageImmediately { image_id: ContentId, control_handle: FlatlandControlHandle },
5540    /// Releases an Image immediately, without waiting for the next present. This is a trusted
5541    /// memory-eviction path.
5542    ///
5543    /// The Image is forcibly unbound from any Layers that currently reference it. Those Layers
5544    /// behave as if their image was simply never set (they are invisible, but retain their image
5545    /// properties) until their next `SetLayerImage()`.
5546    ///
5547    /// Any pending release fences for the evicted Image's bindings will signal at the earliest
5548    /// safe point.
5549    ///
5550    /// This method is only available if Flatland2 is enabled and the session is trusted.
5551    ReleaseImageImmediately2 { image_id: ImageId, control_handle: FlatlandControlHandle },
5552    /// A Layer is a type of `Content` that composites either a single `Image` or a solid
5553    /// color. It separates visual properties (such as size, flip, opacity, and blending)
5554    /// from the raw pixel data.
5555    ///
5556    /// Unlike typical `Content` items which represent a static visual resource, a Layer is designed
5557    /// to be a dynamic container for an image sequence. Typical usage involves setting the layer's
5558    /// visual properties and image metadata infrequently, and then rapidly swapping the active
5559    /// `Image` (e.g. on every frame) with another image of matching metadata.
5560    ///
5561    /// This separation allows a single `Image` resource to be reused across multiple layers with
5562    /// different visual configurations simultaneously.
5563    ///
5564    /// To use a Layer:
5565    /// 1. Create a `Layer` using [`CreateLayer`].
5566    /// 2. Set properties on the `Layer` via [`SetLayerProperties`], including the
5567    ///    composition mode.
5568    /// 3. For an image layer, associate an `Image` with the `Layer` via [`SetLayerImage`].
5569    /// 4. Add the `Layer` to a `LayerStack` via [`SetStackLayers`].
5570    /// 5. Set the `LayerStack` as the content of a node via [`SetTransformContent`].
5571    ///
5572    /// `layer_id` must satisfy the identifier rules documented on [`LayerId`].
5573    CreateLayer { layer_id: LayerId, control_handle: FlatlandControlHandle },
5574    /// Released Layers will be garbage collected by the system once they are no longer necessary
5575    /// for rendering. For Layers, this means:
5576    /// - the Layer is no longer referenced by any LayerStack, and
5577    /// - any pending rendering that references the Layer is complete.
5578    ///
5579    /// `layer_id` must refer to a valid, unreleased Layer.
5580    ReleaseLayer { layer_id: LayerId, control_handle: FlatlandControlHandle },
5581    /// Associates an Image with the Layer.
5582    ///
5583    /// The binding is legal in any composition mode, and is sticky: it survives composition
5584    /// mode changes, and is replaced only by a later [`SetLayerImage`] call (or cleared by
5585    /// [`ResetLayer`]). The image is displayed only while the layer's composition mode is
5586    /// `IMAGE`.
5587    ///
5588    /// The bound image must be large enough for the layer's stored `sample_rect`; this is
5589    /// checked at [`fuchsia.ui.composition/Flatland.Present`], not here. See
5590    /// [`LayerProperties.sample_rect`].
5591    ///
5592    /// `layer_id` must refer to a valid, unreleased Layer.
5593    /// `image_id` must refer to a valid, unreleased Image.
5594    /// `acquire_fence` is an optional fence that must be signaled before the image is displayed.
5595    /// `release_fence` is an optional fence, signaled by Scenic when *this binding* no
5596    /// longer references the image. It is per-binding, not per-image: an image bound to
5597    /// several layers has one such fence per binding, and the image is safe to write only
5598    /// once every one of them has signaled.
5599    ///
5600    /// A binding is ended by:
5601    ///
5602    /// - being superseded by a later [`SetLayerImage`] on the same layer
5603    /// - [`ResetLayer`]
5604    /// - the layer ref-count reaching zero, either via [`ReleaseLayer`] or by being released
5605    ///   by a layer stack
5606    /// - destruction of the session, which ends every binding it holds
5607    ///
5608    /// For a binding ended while the session is alive, Scenic signals at the first frame
5609    /// retire after that point. Bindings that never reached the screen (e.g. one superseded
5610    /// within a single batch, or one lost when several
5611    /// [`fuchsia.ui.composition/Flatland.Present`] calls are squashed into a single
5612    /// frame) signal at that same retire rather than immediately. The signal is
5613    /// therefore conservative by at most one frame; it is never early.
5614    SetLayerImage {
5615        layer_id: LayerId,
5616        image_id: ImageId,
5617        acquire_fence: Option<Box<WaitFence>>,
5618        release_fence: Option<Box<SignalFence>>,
5619        control_handle: FlatlandControlHandle,
5620    },
5621    /// Sets properties of the Layer.
5622    ///
5623    /// The provided `properties` table is merged into the layer's stored properties: fields
5624    /// which are unset in `properties` retain their previously stored values. Stored
5625    /// properties are sticky; see [`LayerProperties`] for the full persistence semantics.
5626    ///
5627    /// Values are stored as given; validation which depends on other state (notably
5628    /// `sample_rect` against the bound image) happens at
5629    /// [`fuchsia.ui.composition/Flatland.Present`]. See [`LayerProperties.sample_rect`].
5630    ///
5631    /// `layer_id` must refer to a valid, unreleased Layer.
5632    SetLayerProperties {
5633        layer_id: LayerId,
5634        properties: LayerProperties,
5635        control_handle: FlatlandControlHandle,
5636    },
5637    /// Unbinds any Image bound to the layer and clears every stored [`LayerProperties`]
5638    /// field, returning the layer to its freshly-created state (composition mode
5639    /// `INVISIBLE`, all properties at their documented defaults). This is the only
5640    /// operation which forgets stored layer properties.
5641    ///
5642    /// `layer_id` must refer to a valid, unreleased Layer.
5643    ResetLayer { layer_id: LayerId, control_handle: FlatlandControlHandle },
5644    /// Creates a new layer stack with the specified `stack_id`.
5645    ///
5646    /// `stack_id` must satisfy the identifier rules documented on [`LayerId`].
5647    CreateLayerStack { stack_id: LayerStackId, control_handle: FlatlandControlHandle },
5648    /// Releases the layer stack with the specified `stack_id`.
5649    ReleaseLayerStack { stack_id: LayerStackId, control_handle: FlatlandControlHandle },
5650    /// Sets the layers in the stack. The order of layers in the vector determines their Z-order,
5651    /// with the first element being the back-most and the last element being the front-most.
5652    ///
5653    /// `stack_id` must refer to a valid, unreleased LayerStack. Each element of `layers`
5654    /// must refer to a valid, unreleased Layer. Duplicate layers within `layers` are
5655    /// disallowed.
5656    SetStackLayers {
5657        stack_id: LayerStackId,
5658        layers: Vec<LayerId>,
5659        control_handle: FlatlandControlHandle,
5660    },
5661    /// Creates an Image resource.
5662    ///
5663    /// `image_id` must satisfy the identifier rules documented on [`LayerId`].
5664    CreateImage2 {
5665        image_id: ImageId,
5666        import_token: BufferCollectionImportToken,
5667        vmo_index: u32,
5668        properties: ImageProperties,
5669        control_handle: FlatlandControlHandle,
5670    },
5671    /// Released Images will be garbage collected by the system once they are no longer necessary
5672    /// for rendering. For Images, this means:
5673    /// - the Image is no longer bound to any Layer, and
5674    /// - any pending rendering that references the Image is complete.
5675    ///
5676    /// The `image_id` value is freed for reuse immediately by the client (identifier uniqueness
5677    /// is instantaneous).
5678    ///
5679    /// Note: Per-binding release fences (passed to `SetLayerImage`) are unaffected by this call.
5680    /// They track the lifecycle of individual layer bindings, not the client's `image_id`.
5681    ///
5682    /// `image_id` must refer to a valid, unreleased Image.
5683    ReleaseImage2 { image_id: ImageId, control_handle: FlatlandControlHandle },
5684    /// Creates a Viewport resource.
5685    ///
5686    /// `viewport_id` must satisfy the identifier rules documented on [`LayerId`].
5687    CreateViewport2 {
5688        viewport_id: ViewportId,
5689        token: fidl_fuchsia_ui_views::ViewportCreationToken,
5690        properties: ViewportProperties,
5691        child_view_watcher: fidl::endpoints::ServerEnd<ChildViewWatcherMarker>,
5692        control_handle: FlatlandControlHandle,
5693    },
5694    /// Releases a Viewport from the scene.
5695    ReleaseViewport2 { viewport_id: ViewportId, responder: FlatlandReleaseViewport2Responder },
5696    /// Sets the properties of a Viewport.
5697    SetViewportProperties2 {
5698        viewport_id: ViewportId,
5699        properties: ViewportProperties,
5700        control_handle: FlatlandControlHandle,
5701    },
5702    /// Sets (or clears) the content of a Transform.
5703    ///
5704    /// The same content may be attached to more than one Transform; each attachment composites
5705    /// that content again under its own Transform's matrix, clip, and opacity, so a single
5706    /// LayerStack or Viewport can appear repeatedly in a scene without the client duplicating the
5707    /// underlying resources.
5708    ///
5709    /// A Transform's content can be cleared by not providing the optional `content`.
5710    ///
5711    /// If `content` is set, it must refer to a valid, unreleased LayerStack or Viewport.
5712    /// Unlike classic [`Flatland.SetContent`], a zero id does not clear the content.
5713    SetTransformContent {
5714        transform_id: TransformId,
5715        content: Option<Box<TransformContent>>,
5716        control_handle: FlatlandControlHandle,
5717    },
5718    /// Complete execution of all feed-forward operations.
5719    ///
5720    /// If executing an operation produces an error (e.g., CreateTransform(0)), an [`OnError`] event
5721    /// is emitted. Operations that produce errors are ignored and the channel is closed.
5722    ///
5723    /// If execution completes successfully, [`OnNextFrameBegin`] is emitted with valid frame
5724    /// production information.
5725    ///
5726    /// The client may only call [`Present`] when they have a non-zero number of present credits,
5727    /// which are tracked by the server. The server may increment the number of credits when it
5728    /// fires the [`OnNextFrameBegin`] event, which informs the client when it receives additional
5729    /// present credits. Each [`Present`] call uses one present credit and decrements the server
5730    /// count by one. If the client calls [`Present`] with no present credits, the server will
5731    /// return a `NO_PRESENTS_REMAINING` error.
5732    ///
5733    /// The client should assume that prior to receiving any [`OnNextFrameBegin`] events, they have
5734    /// one present credit.
5735    ///
5736    /// Every [`Present`] call results in one [`OnNextFrameBegin`] event, and one
5737    /// [`OnFramePresented`] event, typically in that order.
5738    ///
5739    /// When the commands flushed by [`Present`] make it to display, an [`OnFramePresented`] event
5740    /// is fired. This event includes information pertaining to all [`Present`]s that had content
5741    /// that were part of that frame.
5742    ///
5743    /// See [`fuchsia.ui.composition/PresentArgs`] documentation above for more detailed information
5744    /// on what arguments are passed in and their role.
5745    Present { args: PresentArgs, control_handle: FlatlandControlHandle },
5746    /// Two Flatland sessions may be connected in a parent-child relationship. The parent endpoint
5747    /// is held in a Viewport, and the child endpoint is held in a View. The parent Flatland
5748    /// session that creates a Viewport has control over how the child's View is integrated into
5749    /// its own View.
5750    ///
5751    /// The lifecycle of a parent-child connection starts with two endpoints of a channel object:
5752    /// a ViewportCreationToken and a ViewCreationToken. Out-of-band protocols pass the
5753    /// ViewportCreationToken to the parent, which calls [`CreateViewport`], and the
5754    /// ViewCreationToken to the child, which calls [`CreateView`].
5755    ///
5756    /// Only nodes connected to the Root Transform in this Flatland session will be rendered into
5757    /// the parent's Viewport.
5758    ///
5759    /// Calling [`CreateView`] a second time will disconnect the Root Transform from the existing
5760    /// parent's Viewport, and attach it to a new parent's Viewport. In other words, each View can
5761    /// only have one parent.
5762    ///
5763    /// This function is queued, meaning that the Root Transform will not be attached to the
5764    /// parent Viewport until [`Present`] is called. However, clients will receive information
5765    /// through their ParentViewportWatcher (e.g., LayoutInfo) immediately after calling this
5766    /// function, even if they have not called [`Present`] or [`SetRootTransform`]. This allows
5767    /// clients to wait for layout information from their parent before calling [`Present`].
5768    ///
5769    /// Any illegal operations on ParentViewportWatcher will cause both ParentViewportWatcher
5770    /// channel and this Flatland channel to be torn down.
5771    ///
5772    /// Lifecycle note. The lifetime of the ParentViewportWatcher channel is bound by the peer
5773    /// ViewportCreationToken. When the ViewportCreationToken dies, this ParentViewportWatcher
5774    /// channel is destroyed.
5775    ///
5776    /// Views and subgraphs of Views created using `CreateView` will not be represented in the
5777    /// ViewTree, and hence will not be able to participate in any ViewTree-dependent interactions
5778    /// such as touch, mouse or focus.
5779    /// The Flatland protocol provides no way for Views in the subgraph of a View created with
5780    /// `CreateView` to know that they are excluded from the ViewTree.
5781    CreateView {
5782        token: fidl_fuchsia_ui_views::ViewCreationToken,
5783        parent_viewport_watcher: fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>,
5784        control_handle: FlatlandControlHandle,
5785    },
5786    /// Identical to [`CreateView`], except it allows association of View identity (ViewRef) and
5787    /// view-bound protocols.
5788    CreateView2 {
5789        token: fidl_fuchsia_ui_views::ViewCreationToken,
5790        view_identity: fidl_fuchsia_ui_views::ViewIdentityOnCreation,
5791        protocols: ViewBoundProtocols,
5792        parent_viewport_watcher: fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>,
5793        control_handle: FlatlandControlHandle,
5794    },
5795    /// Creates a new Transform node. Transforms are a hierarchical piece of a Flatland graph. They
5796    /// can have children, and can reference Content. A sub-graph represented by a Transform and its
5797    /// descendants can be rendered to a display.
5798    ///
5799    /// Transforms are kept alive, even when released, as long as they are children of either an
5800    /// unreleased Transform, or the Root Transform.
5801    ///
5802    /// Each Transform can have a single piece of attached Content. Common types of Content include
5803    /// bitmaps, asynchronous streams of images, and Viewports to Views hosted in other Flatland
5804    /// sessions.
5805    ///
5806    /// Transforms have attributes. Child Transforms inherit the combined attributes of their
5807    /// parents. Content attached to a Transform is also affected by that Transform's attributes.
5808    ///
5809    /// When a sub-graph of Transforms is rendered, Content will be rendered back-to-front, starting
5810    /// with the Content on the root transform, and continuing recursively through all of its child
5811    /// Transforms in the order the children were added. See [`AddChild`] for more information.
5812    ///
5813    /// Zero is not a valid transform id. All other values are valid, assuming they are not already
5814    /// in use (see [`ReleaseTransform`] for more details).
5815    CreateTransform { transform_id: TransformId, control_handle: FlatlandControlHandle },
5816    /// All Transform objects support all attributes.
5817    ///
5818    /// Geometric attributes are applied in the following order:
5819    /// 1. Scale (relative to the parent transform's coordinate space)
5820    /// 2. Orientation (relative to the parent transform's coordinate space)
5821    /// 3. Translation (relative to the parent transforms's coordinate space,
5822    ///    unaffected by scale applied to the current transform).
5823    /// 4. Clipping (relative to the current transform's coordinate space)
5824    ///
5825    /// The effects of each of these attributes are cumulative. This means the transform's position
5826    /// in the view space, and its clip boundary, will be calculated based on that chain of
5827    /// geometric attributes going up to the root transform.
5828    ///
5829    /// For instance, in a nested hierarchy such as the following:
5830    ///     [Root-Transform -> Transform1 -> Transform2 -> CurrentTransform]
5831    /// If Transform1 is translated by [2,0] and Transform2 is translated by [0,1] then the
5832    /// view-space position of CurrentTransform will be [2,1].
5833    ///
5834    /// Sets the translation on a Transform. The order of geometric attribute application is
5835    /// addressed above.
5836    SetTranslation {
5837        transform_id: TransformId,
5838        translation: fidl_fuchsia_math::Vec_,
5839        control_handle: FlatlandControlHandle,
5840    },
5841    /// Sets the orientation on a Transform. The order of geometric attribute application is
5842    /// addressed in the documentation for [`SetTranslation`]. In Flatland, the +X axis is
5843    /// to the right and the +Y axis is down. There is no notion of a Z axis. CCW is defined
5844    /// from the POV of the user, as if a skeuomorphoic clock is displayed on the screen.
5845    SetOrientation {
5846        transform_id: TransformId,
5847        orientation: Orientation,
5848        control_handle: FlatlandControlHandle,
5849    },
5850    /// Sets the scale on a transform. The order of geometric attribute application is
5851    /// addressed above. The (x,y) values in the VecF |scale| refer to the scale factor in the
5852    /// x-axis (width) and y-axis (height) respectively. Scale values must be positive 32-bit
5853    /// floating point values: https://en.wikipedia.org/wiki/Normal_number_%28computing%29
5854    SetScale {
5855        transform_id: TransformId,
5856        scale: fidl_fuchsia_math::VecF,
5857        control_handle: FlatlandControlHandle,
5858    },
5859    /// Sets an opacity in linear space to be applied to a transform and its descendents,
5860    /// which include other transforms and content. Opacity values must be in the range
5861    /// of [0.0, 1.0], where 0.0 is completely transparent and 1.0 is completely opaque.
5862    /// Attempting to call this function with values outside that range will result in
5863    /// an error. A transform's opacity value is multiplied with that of its parent. This
5864    /// effect works differently from group opacity. Using group opacity, child nodes are
5865    /// rendered together first, and then have the parent's opacity applied as a post-effect.
5866    /// Here, opacity is applied to each child individually. This may result in a very
5867    /// different effect.
5868    SetOpacity { transform_id: TransformId, value: f32, control_handle: FlatlandControlHandle },
5869    /// Sets the bounds, expressed in the local coordinate space of the transform, that
5870    /// constrains the region that content attached to this transform can be rendered to.
5871    /// If the content's area exceeds the clip bounds, the area outside the bounds will
5872    /// not be rendered. These bounds are valid for all children of this transform node as
5873    /// well, which includes nested Flatland sessions and their node hierarchies.
5874    /// If a child transform attempts to set clip bounds larger than that of its parent,
5875    /// it will be clipped to the parent's clip bounds. The default state is for a transform
5876    /// to be unclipped, meaning it will not have any bounds placed on its render region.
5877    /// The clip width/height must be positive. Negative values will result in an error.
5878    /// Passing in an empty box to the |rect| parameter will remove the clip bounds.
5879    SetClipBoundary {
5880        transform_id: TransformId,
5881        rect: Option<Box<fidl_fuchsia_math::Rect>>,
5882        control_handle: FlatlandControlHandle,
5883    },
5884    /// Adds a child Transform to a parent Transform. The new child Transform,
5885    /// and any Content attached to it or its children, will be rendered on top
5886    /// of the parent's Content, as well as any previously added children.
5887    ///
5888    /// The caller must ensure that `child_transform_id` is valid and that there
5889    /// are no repetitions.  Sending a repeated `child_transform_id` over
5890    /// multiple calls will result in session closure.
5891    AddChild {
5892        parent_transform_id: TransformId,
5893        child_transform_id: TransformId,
5894        control_handle: FlatlandControlHandle,
5895    },
5896    /// Removes a child Transform from a parent Transform.
5897    RemoveChild {
5898        parent_transform_id: TransformId,
5899        child_transform_id: TransformId,
5900        control_handle: FlatlandControlHandle,
5901    },
5902    /// Removes all child Transforms from a parent Transform and replaces them
5903    /// with the new child transforms in `new_child_transform_ids`.  The caller
5904    /// must ensure that all `TransformId` values in `new_child_transform_ids`
5905    /// are valid and that there are no repetitions.  Sending a repeated
5906    /// `TransformId` in `new_child_transform_ids` will result in session
5907    /// closure.
5908    ReplaceChildren {
5909        parent_transform_id: TransformId,
5910        new_child_transform_ids: Vec<TransformId>,
5911        control_handle: FlatlandControlHandle,
5912    },
5913    /// Sets the Root Transform for the graph.
5914    ///
5915    /// The sub-graph defined by the Root Transform and its children will be rendered as View
5916    /// in the connected parent's Viewport (see [`CreateView`]). Any parents of the Root Transform
5917    /// in this Graph will be ignored.
5918    ///
5919    /// The Root Transform, and all children of the Root Transform, are kept alive if they are
5920    /// released (see [`ReleaseTransform`] for more details).
5921    ///
5922    /// There is only ever one Root. Since 0 is not a valid transform id (see [`CreateTransform`]),
5923    /// calling SetRootTransform(0) clears the current Root, destroying any previously released
5924    /// objects that are not referenced by the new root.
5925    ///
5926    /// Note that every View has a clip boundary equivalent to its logical size. Anything outside
5927    /// that clip boundary will not be rendered. Hence, the Root Transform has a useful coordinate
5928    /// space of (0, 0) to (logical_size.width, logical_size.height), where (0, 0) is the upper left
5929    /// corner.
5930    ///
5931    /// Setting the root transform installs a full screen hit region on the root transform. Clients
5932    /// may remove this hit region if they don't want users to be able to interact with the root
5933    /// transform's content. For additional details on hit regions, see the [`SetHitRegions`]
5934    /// documentation.
5935    ///
5936    /// Default hit region rules
5937    ///
5938    ///   A default hit region follows these rules:
5939    ///   - When [`SetRootTransform`](T) is called, T receives a maximal hit region, covering the
5940    ///   entire view.
5941    ///   - If [`SetHitRegions`] is called on T, either before or after [`SetRootTransform`](T),
5942    ///   then no default hit region is active and the client specified hit regions are used.
5943    ///   - If a transform is no longer the root transform, i.e., [`SetRootTransform`](U) is
5944    ///   called, then the original transform no longer has its default hit region.
5945    ///   - Clients can remove or modify the root transform's hit regions the same way they would
5946    ///   reset any other transform's hit regions, by calling [`SetHitRegions`] with the appropriate
5947    ///   vector.
5948    SetRootTransform { transform_id: TransformId, control_handle: FlatlandControlHandle },
5949    /// Sets the interactive areas for a Transform. By default, Content is not interactive; hit
5950    /// regions must be placed for a user to interact with the Content in a View. Because hit
5951    /// regions are described in the Flatland protocol, a Flatland session can synchronize Content
5952    /// and hit regions.
5953    ///
5954    /// Each hit region is placed in the coordinate space of the owning Transform, and may or may
5955    /// not interact with different types of hit testing, depending on its [`HitTestInteraction`]
5956    /// type. When there are multiple hit regions that intersect with a hit test, the precedence
5957    /// rules given below dictate which hit region has interacted with the hit test. Only Transforms
5958    /// that transitively connect to the root Transform have their hit regions interact with a hit
5959    /// test.
5960    ///
5961    /// Calling this function replaces any previous values set on this Transform. To reset a
5962    /// Transform to "no hit testing": send an empty vector with [`SetHitRegions`].
5963    ///
5964    /// Note that root transforms get a default hit region installed by Flatland. For more details,
5965    /// see the [`SetRootTransform`] documentation.
5966    ///
5967    /// Precedence rules
5968    ///   Within a Transform, if multiple hit regions overlap, the hit test examines each
5969    ///   intersecting hit region for a possible interaction. Thus, for a regular hit test R and an
5970    ///   accessibility hit test A, where R and A both intersect two hit regions D ([`DEFAULT`]) and
5971    ///   S ([`SEMANTICALLY_INVISIBLE`]) on the same Transform, (1) R interacts with both D and S,
5972    ///   and (2) A only interacts with D. Generally, hit regions that overlap in a single Transform
5973    ///   can cause confusing behavior.
5974    ///
5975    ///   Within a View, for a given hit test, the front-most Transform's hit regions take
5976    ///   precedence over those behind. This follows the expected reverse "render order" of
5977    ///   Transforms (described in [`CreateTransform`]), where a user expects to interact with
5978    ///   Content that is visible, or front-most.
5979    ///
5980    ///   Across Flatland sessions, for a given hit test, the front-most session's front-most
5981    ///   Transform's hit regions take precedence over those behind. This follows the expected
5982    ///   reverse "render order" of views, where a user expects to interact with the View that is
5983    ///   visible, or front-most. For example, if a child View owns Content that is rendered over
5984    ///   the parent View, the user expects to interact with the child's Content.
5985    SetHitRegions {
5986        transform_id: TransformId,
5987        regions: Vec<HitRegion>,
5988        control_handle: FlatlandControlHandle,
5989    },
5990    /// Identical to [`SetHitRegions`], except the hit region associated with [`transform_id`]
5991    /// covers an infinite region. The hit region is invariant against translation, scaling, and
5992    /// orientation of the Transform.
5993    ///
5994    /// An infinite hit region is still limited in extent by the View's clip boundary, just like a
5995    /// finite hit region.
5996    ///
5997    /// Calling this function replaces any previous values set on this Transform. To reset a
5998    /// Transform to "no hit testing": send an empty vector with [`SetHitRegions`].
5999    SetInfiniteHitRegion {
6000        transform_id: TransformId,
6001        hit_test: HitTestInteraction,
6002        control_handle: FlatlandControlHandle,
6003    },
6004    /// The Viewport and View pair, together, represent the connection between two Flatland
6005    /// sessions. The Viewport is created in the parent, and the View is created in the child. The
6006    /// parent has control over how the child's View is integrated into its own View.
6007    ///
6008    /// Any illegal operations on ChildViewWatcher will cause both ChildViewWatcher channel and this
6009    /// Flatland channel to be torn down.
6010    ///
6011    /// `ViewportProperties` must have logical_size set. This is the initial size that will drive
6012    /// the layout of the child. The logical_size is also used as the default Content size, but
6013    /// subsequent changes to the logical_size will have no effect on the Content size.
6014    ///
6015    /// `ViewportProperties` may have inset field not set. In that case, the default value of
6016    /// (0, 0, 0, 0) is used.
6017    ///
6018    /// The logical_size must have positive X and Y components.
6019    ///
6020    /// Lifecycle note. The lifetime of the ChildViewWatcher channel is bound by the peer
6021    /// ViewCreationToken. When the ViewCreationToken dies, this ChildViewWatcher channel is
6022    /// destroyed.
6023    ///
6024    /// `viewport_id` must satisfy standard [`ContentId`] creation constraints.
6025    CreateViewport {
6026        viewport_id: ContentId,
6027        token: fidl_fuchsia_ui_views::ViewportCreationToken,
6028        properties: ViewportProperties,
6029        child_view_watcher: fidl::endpoints::ServerEnd<ChildViewWatcherMarker>,
6030        control_handle: FlatlandControlHandle,
6031    },
6032    /// An Image is a bitmap backed by a specific VMO in a BufferCollection.
6033    ///
6034    /// Image creation requires an allocated BufferCollection registered with Allocator. This
6035    /// function will fail unless all clients of the specified BufferCollection have set their
6036    /// constraints.
6037    ///
6038    /// The Image must reference a valid VMO index and must have ImageProperties that fall within
6039    /// the constraints specified by the backing BufferCollection (i.e. width and height within a
6040    /// valid range, etc.)
6041    ///
6042    /// `image_id` must satisfy standard [`ContentId`] creation constraints.
6043    CreateImage {
6044        image_id: ContentId,
6045        import_token: BufferCollectionImportToken,
6046        vmo_index: u32,
6047        properties: ImageProperties,
6048        control_handle: FlatlandControlHandle,
6049    },
6050    /// This function is used to determine the region (in texel space) of an image that will be used
6051    /// by Flatland when rendering. The image to be sampled is referenced by [`image_id`] and the
6052    /// sample region is specified by [`rect`] which itself is comprised of an origin point (x,y) as
6053    /// well as a width and height, in unnormalized coordinates. It is illegal to call this function
6054    /// on non-image content, or to sample a region outside of the texel space of the image. In
6055    /// other words, the region specifed by [`rect`] must not exceed the ranges (0, image_width) and
6056    /// (0, image_height). If (rect.x + rect.width > image_width) or (rect.y + rect.height >
6057    /// image_height) or if any of the values are negative, this will result in an error.
6058    ///
6059    /// If this method is not called, the default sample region is the rectangle with origin at
6060    /// (0, 0) and width and height set at ImageProperties from [`CreateImage`].
6061    ///
6062    /// `image_id` must refer to a valid, unreleased Image.
6063    SetImageSampleRegion {
6064        image_id: ContentId,
6065        rect: fidl_fuchsia_math::RectF,
6066        control_handle: FlatlandControlHandle,
6067    },
6068    /// The content size for an Image is the size of the rectangle in the parent's logical
6069    /// coordinate space that the image occupies. This combined with the global translation of the
6070    /// transform it is attached to determines the size and location of where the content is
6071    /// rendered on the display.
6072    ///
6073    /// If this method is not called, the default image destination size is the width and height set
6074    /// at ImageProperties from [`CreateImage`]. The destination size will be affected by scaling if
6075    /// [`SetScale`] is used on the attached Transform or its parents.
6076    SetImageDestinationSize {
6077        image_id: ContentId,
6078        size: fidl_fuchsia_math::SizeU,
6079        control_handle: FlatlandControlHandle,
6080    },
6081    /// Determines the blend function to use when rendering the content specified by
6082    /// |image_id|. |image_id| must be a valid ContentId associated to a transform through
6083    /// a call to |CreateImage| or |CreateFilledRect|. For details on the different blend functions
6084    /// that are available, please refer to the BlendMode enum. If this function is not called, then
6085    /// the default blendmode is BlendMode::SRC.
6086    SetImageBlendingFunction {
6087        image_id: ContentId,
6088        blend_mode: BlendMode,
6089        control_handle: FlatlandControlHandle,
6090    },
6091    /// Determines the blend function to use when rendering the content specified by
6092    /// |image_id|. |image_id| must be a valid ContentId associated to a transform through
6093    /// a call to |CreateImage| or |CreateFilledRect|. For details on the different blend functions
6094    /// that are available, please refer to the BlendMode2 enum. If this function is not called,
6095    /// the default blendmode is BlendMode2::REPLACE.
6096    SetImageBlendMode {
6097        image_id: ContentId,
6098        blend_mode: BlendMode2,
6099        control_handle: FlatlandControlHandle,
6100    },
6101    /// Sets an opacity in linear space to be applied to a flatland image. Opacity values must
6102    /// be in the range [0.0, 1.0].
6103    SetImageOpacity { image_id: ContentId, val: f32, control_handle: FlatlandControlHandle },
6104    /// Sets the image flip to be applied to a flatland image. This call must be performed after a
6105    /// successful |CreateImage| call. If an invalid |image_id| is supplied, the channel will be
6106    /// closed due to FlatlandError::BAD_OPERATION. This flip will be applied to the Image before
6107    /// parent Transform Orientations. If this function is not called, then the default flip value
6108    /// is ImageFlip::NONE.
6109    SetImageFlip { image_id: ContentId, flip: ImageFlip, control_handle: FlatlandControlHandle },
6110    /// Creates a solid-color rectangle. By default a filled-rect does not have a defined
6111    /// color or size. It is necessary to call |SetSolidFill| to specify a color and size
6112    /// before a filled rect can be used for rendering. Not doing so will result the
6113    /// rectangle having a default size of (0,0) and so it will not show up when rendering.
6114    ///
6115    /// `rect_id` must satisfy standard [`ContentId`] creation constraints.
6116    CreateFilledRect { rect_id: ContentId, control_handle: FlatlandControlHandle },
6117    /// Defines the color and size of a filled rect. |rect_id| must refer to content that
6118    /// was created via a call to CreateFilledRect. The color is not premultiplied. Color values
6119    /// must be within the range [0,1] inclusive, and normal 32-bit
6120    /// floating point values: https://en.wikipedia.org/wiki/Normal_number_%28computing%29. Values
6121    /// that do not conform to these specifications will cause the channel to close.
6122    /// The rectangle's top left corner will be at (0, 0) in its transform's coordinate space.
6123    /// Hence, its bottom right corner will be at (size.width, size.height).
6124    ///
6125    /// `rect_id` must refer to a valid, unreleased filled rectangle.
6126    SetSolidFill {
6127        rect_id: ContentId,
6128        color: ColorRgba,
6129        size: fidl_fuchsia_math::SizeU,
6130        control_handle: FlatlandControlHandle,
6131    },
6132    /// Automatically garbage collects the rectangle when it is no longer needed for
6133    /// rendering. |rect_id| must have been instantiated with a call to
6134    /// |CreateFilledRect|. Once released, the ID immediately goes out of scope and is free
6135    /// to be used again.
6136    ///
6137    /// `rect_id` must refer to a valid, unreleased filled rectangle.
6138    ReleaseFilledRect { rect_id: ContentId, control_handle: FlatlandControlHandle },
6139    /// Setting a piece of Content on a Transform makes that Content visible in the render tree as
6140    /// long as the Transform is visible from the root Transform. The Content will be rendered
6141    /// before, and therefore "behind", any Content attached to the descendants of the Transform.
6142    ///
6143    /// Because each Transform can have, at most, a single piece of Content on it, calling this
6144    /// function on a Transform that already has Content will replace that Content.
6145    ///
6146    /// A Content may be set on more than one Transform.
6147    ///
6148    /// Calling this function with a Content id of 0 will remove any Content currently on the
6149    /// Transform.
6150    ///
6151    /// `content_id` must refer to a valid, unreleased Content object, or 0 to clear.
6152    SetContent {
6153        transform_id: TransformId,
6154        content_id: ContentId,
6155        control_handle: FlatlandControlHandle,
6156    },
6157    /// Transforms are usually sufficient to change how Content is presented. Viewports, however,
6158    /// have special properties that are not part of the Transform hierarchy. Those properties can
6159    /// be set using this function.
6160    SetViewportProperties {
6161        viewport_id: ContentId,
6162        properties: ViewportProperties,
6163        control_handle: FlatlandControlHandle,
6164    },
6165    /// Released Transforms will be garbage collected by the system once they are no longer
6166    /// necessary for rendering. For Transforms, this means there is no path from any unreleased
6167    /// Transform to the newly-released Transform.
6168    ///
6169    /// Once released, the id immediately goes out of scope for future function calls and can be
6170    /// reused when creating new Transforms.
6171    ///
6172    /// It is an error to call functions with a released id (unless that id has been reused to
6173    /// construct a new Transform).
6174    ReleaseTransform { transform_id: TransformId, control_handle: FlatlandControlHandle },
6175    /// Releases the View, which disconnects this Flatland session from its parent Viewport in
6176    /// another Flatland session.
6177    ///
6178    /// To clear the existing content from the screen without releasing the current View, use
6179    /// SetRootTransform(0) instead.
6180    ///
6181    /// Despite having a return type, this function is still feed-forward Like [`CreateView`] and
6182    /// requires a call to [`Present`] to be executed. The ViewCreationToken will be returned after
6183    /// the presented operations have been executed.
6184    ReleaseView { control_handle: FlatlandControlHandle },
6185    /// Releases a Viewport from the scene, even if the Viewport is still connected to a Transform.
6186    /// Unlike other resources, Viewports are garbage collected by the system during the next
6187    /// [`Present`] because a removed Viewport is guaranteed to provide no renderable content.
6188    ///
6189    /// Use SetContent(transform_id, 0) to clean up references to released Viewports.
6190    ///
6191    /// Despite having a return type, this function is still feed-forward like [`CreateView`] and
6192    /// requires a call to [`Present`] to be executed. The ViewportCreationToken will be returned
6193    /// after the presented operations have been executed.
6194    ReleaseViewport { viewport_id: ContentId, responder: FlatlandReleaseViewportResponder },
6195    /// Released Images will be garbage collected by the system once they are no longer necessary
6196    /// for rendering. For Images, this means the Image is no longer attached to any Transform and
6197    /// any pending rendering that references the Image is complete.
6198    ///
6199    /// Use SetContent(transform_id, 0) to clean up references to released Images.
6200    ///
6201    /// Once released, the id immediately goes out of scope for future function calls and can be
6202    /// reused when creating new Images.
6203    ///
6204    /// It is an error to call functions with a released id (unless that id has been reused to
6205    /// construct a new Image).
6206    ReleaseImage { image_id: ContentId, control_handle: FlatlandControlHandle },
6207    /// This function will reset all state on this interface. This includes destroying all existing
6208    /// View and Viewports without returning the associated Token to the caller.
6209    Clear { control_handle: FlatlandControlHandle },
6210    /// Set debug name of the current client that can be used by Flatland to print as a prefix to
6211    /// logs to help client distinguish what is theirs. [`name`] can be an arbitrary string, but the
6212    /// current process name (see fsl::GetCurrentProcessName()) is a good default.
6213    SetDebugName { name: String, control_handle: FlatlandControlHandle },
6214}
6215
6216impl FlatlandRequest {
6217    #[allow(irrefutable_let_patterns)]
6218    pub fn into_release_image_immediately(self) -> Option<(ContentId, FlatlandControlHandle)> {
6219        if let FlatlandRequest::ReleaseImageImmediately { image_id, control_handle } = self {
6220            Some((image_id, control_handle))
6221        } else {
6222            None
6223        }
6224    }
6225
6226    #[allow(irrefutable_let_patterns)]
6227    pub fn into_release_image_immediately2(self) -> Option<(ImageId, FlatlandControlHandle)> {
6228        if let FlatlandRequest::ReleaseImageImmediately2 { image_id, control_handle } = self {
6229            Some((image_id, control_handle))
6230        } else {
6231            None
6232        }
6233    }
6234
6235    #[allow(irrefutable_let_patterns)]
6236    pub fn into_create_layer(self) -> Option<(LayerId, FlatlandControlHandle)> {
6237        if let FlatlandRequest::CreateLayer { layer_id, control_handle } = self {
6238            Some((layer_id, control_handle))
6239        } else {
6240            None
6241        }
6242    }
6243
6244    #[allow(irrefutable_let_patterns)]
6245    pub fn into_release_layer(self) -> Option<(LayerId, FlatlandControlHandle)> {
6246        if let FlatlandRequest::ReleaseLayer { layer_id, control_handle } = self {
6247            Some((layer_id, control_handle))
6248        } else {
6249            None
6250        }
6251    }
6252
6253    #[allow(irrefutable_let_patterns)]
6254    pub fn into_set_layer_image(
6255        self,
6256    ) -> Option<(
6257        LayerId,
6258        ImageId,
6259        Option<Box<WaitFence>>,
6260        Option<Box<SignalFence>>,
6261        FlatlandControlHandle,
6262    )> {
6263        if let FlatlandRequest::SetLayerImage {
6264            layer_id,
6265            image_id,
6266            acquire_fence,
6267            release_fence,
6268            control_handle,
6269        } = self
6270        {
6271            Some((layer_id, image_id, acquire_fence, release_fence, control_handle))
6272        } else {
6273            None
6274        }
6275    }
6276
6277    #[allow(irrefutable_let_patterns)]
6278    pub fn into_set_layer_properties(
6279        self,
6280    ) -> Option<(LayerId, LayerProperties, FlatlandControlHandle)> {
6281        if let FlatlandRequest::SetLayerProperties { layer_id, properties, control_handle } = self {
6282            Some((layer_id, properties, control_handle))
6283        } else {
6284            None
6285        }
6286    }
6287
6288    #[allow(irrefutable_let_patterns)]
6289    pub fn into_reset_layer(self) -> Option<(LayerId, FlatlandControlHandle)> {
6290        if let FlatlandRequest::ResetLayer { layer_id, control_handle } = self {
6291            Some((layer_id, control_handle))
6292        } else {
6293            None
6294        }
6295    }
6296
6297    #[allow(irrefutable_let_patterns)]
6298    pub fn into_create_layer_stack(self) -> Option<(LayerStackId, FlatlandControlHandle)> {
6299        if let FlatlandRequest::CreateLayerStack { stack_id, control_handle } = self {
6300            Some((stack_id, control_handle))
6301        } else {
6302            None
6303        }
6304    }
6305
6306    #[allow(irrefutable_let_patterns)]
6307    pub fn into_release_layer_stack(self) -> Option<(LayerStackId, FlatlandControlHandle)> {
6308        if let FlatlandRequest::ReleaseLayerStack { stack_id, control_handle } = self {
6309            Some((stack_id, control_handle))
6310        } else {
6311            None
6312        }
6313    }
6314
6315    #[allow(irrefutable_let_patterns)]
6316    pub fn into_set_stack_layers(
6317        self,
6318    ) -> Option<(LayerStackId, Vec<LayerId>, FlatlandControlHandle)> {
6319        if let FlatlandRequest::SetStackLayers { stack_id, layers, control_handle } = self {
6320            Some((stack_id, layers, control_handle))
6321        } else {
6322            None
6323        }
6324    }
6325
6326    #[allow(irrefutable_let_patterns)]
6327    pub fn into_create_image2(
6328        self,
6329    ) -> Option<(ImageId, BufferCollectionImportToken, u32, ImageProperties, FlatlandControlHandle)>
6330    {
6331        if let FlatlandRequest::CreateImage2 {
6332            image_id,
6333            import_token,
6334            vmo_index,
6335            properties,
6336            control_handle,
6337        } = self
6338        {
6339            Some((image_id, import_token, vmo_index, properties, control_handle))
6340        } else {
6341            None
6342        }
6343    }
6344
6345    #[allow(irrefutable_let_patterns)]
6346    pub fn into_release_image2(self) -> Option<(ImageId, FlatlandControlHandle)> {
6347        if let FlatlandRequest::ReleaseImage2 { image_id, control_handle } = self {
6348            Some((image_id, control_handle))
6349        } else {
6350            None
6351        }
6352    }
6353
6354    #[allow(irrefutable_let_patterns)]
6355    pub fn into_create_viewport2(
6356        self,
6357    ) -> Option<(
6358        ViewportId,
6359        fidl_fuchsia_ui_views::ViewportCreationToken,
6360        ViewportProperties,
6361        fidl::endpoints::ServerEnd<ChildViewWatcherMarker>,
6362        FlatlandControlHandle,
6363    )> {
6364        if let FlatlandRequest::CreateViewport2 {
6365            viewport_id,
6366            token,
6367            properties,
6368            child_view_watcher,
6369            control_handle,
6370        } = self
6371        {
6372            Some((viewport_id, token, properties, child_view_watcher, control_handle))
6373        } else {
6374            None
6375        }
6376    }
6377
6378    #[allow(irrefutable_let_patterns)]
6379    pub fn into_release_viewport2(self) -> Option<(ViewportId, FlatlandReleaseViewport2Responder)> {
6380        if let FlatlandRequest::ReleaseViewport2 { viewport_id, responder } = self {
6381            Some((viewport_id, responder))
6382        } else {
6383            None
6384        }
6385    }
6386
6387    #[allow(irrefutable_let_patterns)]
6388    pub fn into_set_viewport_properties2(
6389        self,
6390    ) -> Option<(ViewportId, ViewportProperties, FlatlandControlHandle)> {
6391        if let FlatlandRequest::SetViewportProperties2 { viewport_id, properties, control_handle } =
6392            self
6393        {
6394            Some((viewport_id, properties, control_handle))
6395        } else {
6396            None
6397        }
6398    }
6399
6400    #[allow(irrefutable_let_patterns)]
6401    pub fn into_set_transform_content(
6402        self,
6403    ) -> Option<(TransformId, Option<Box<TransformContent>>, FlatlandControlHandle)> {
6404        if let FlatlandRequest::SetTransformContent { transform_id, content, control_handle } = self
6405        {
6406            Some((transform_id, content, control_handle))
6407        } else {
6408            None
6409        }
6410    }
6411
6412    #[allow(irrefutable_let_patterns)]
6413    pub fn into_present(self) -> Option<(PresentArgs, FlatlandControlHandle)> {
6414        if let FlatlandRequest::Present { args, control_handle } = self {
6415            Some((args, control_handle))
6416        } else {
6417            None
6418        }
6419    }
6420
6421    #[allow(irrefutable_let_patterns)]
6422    pub fn into_create_view(
6423        self,
6424    ) -> Option<(
6425        fidl_fuchsia_ui_views::ViewCreationToken,
6426        fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>,
6427        FlatlandControlHandle,
6428    )> {
6429        if let FlatlandRequest::CreateView { token, parent_viewport_watcher, control_handle } = self
6430        {
6431            Some((token, parent_viewport_watcher, control_handle))
6432        } else {
6433            None
6434        }
6435    }
6436
6437    #[allow(irrefutable_let_patterns)]
6438    pub fn into_create_view2(
6439        self,
6440    ) -> Option<(
6441        fidl_fuchsia_ui_views::ViewCreationToken,
6442        fidl_fuchsia_ui_views::ViewIdentityOnCreation,
6443        ViewBoundProtocols,
6444        fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>,
6445        FlatlandControlHandle,
6446    )> {
6447        if let FlatlandRequest::CreateView2 {
6448            token,
6449            view_identity,
6450            protocols,
6451            parent_viewport_watcher,
6452            control_handle,
6453        } = self
6454        {
6455            Some((token, view_identity, protocols, parent_viewport_watcher, control_handle))
6456        } else {
6457            None
6458        }
6459    }
6460
6461    #[allow(irrefutable_let_patterns)]
6462    pub fn into_create_transform(self) -> Option<(TransformId, FlatlandControlHandle)> {
6463        if let FlatlandRequest::CreateTransform { transform_id, control_handle } = self {
6464            Some((transform_id, control_handle))
6465        } else {
6466            None
6467        }
6468    }
6469
6470    #[allow(irrefutable_let_patterns)]
6471    pub fn into_set_translation(
6472        self,
6473    ) -> Option<(TransformId, fidl_fuchsia_math::Vec_, FlatlandControlHandle)> {
6474        if let FlatlandRequest::SetTranslation { transform_id, translation, control_handle } = self
6475        {
6476            Some((transform_id, translation, control_handle))
6477        } else {
6478            None
6479        }
6480    }
6481
6482    #[allow(irrefutable_let_patterns)]
6483    pub fn into_set_orientation(self) -> Option<(TransformId, Orientation, FlatlandControlHandle)> {
6484        if let FlatlandRequest::SetOrientation { transform_id, orientation, control_handle } = self
6485        {
6486            Some((transform_id, orientation, control_handle))
6487        } else {
6488            None
6489        }
6490    }
6491
6492    #[allow(irrefutable_let_patterns)]
6493    pub fn into_set_scale(
6494        self,
6495    ) -> Option<(TransformId, fidl_fuchsia_math::VecF, FlatlandControlHandle)> {
6496        if let FlatlandRequest::SetScale { transform_id, scale, control_handle } = self {
6497            Some((transform_id, scale, control_handle))
6498        } else {
6499            None
6500        }
6501    }
6502
6503    #[allow(irrefutable_let_patterns)]
6504    pub fn into_set_opacity(self) -> Option<(TransformId, f32, FlatlandControlHandle)> {
6505        if let FlatlandRequest::SetOpacity { transform_id, value, control_handle } = self {
6506            Some((transform_id, value, control_handle))
6507        } else {
6508            None
6509        }
6510    }
6511
6512    #[allow(irrefutable_let_patterns)]
6513    pub fn into_set_clip_boundary(
6514        self,
6515    ) -> Option<(TransformId, Option<Box<fidl_fuchsia_math::Rect>>, FlatlandControlHandle)> {
6516        if let FlatlandRequest::SetClipBoundary { transform_id, rect, control_handle } = self {
6517            Some((transform_id, rect, control_handle))
6518        } else {
6519            None
6520        }
6521    }
6522
6523    #[allow(irrefutable_let_patterns)]
6524    pub fn into_add_child(self) -> Option<(TransformId, TransformId, FlatlandControlHandle)> {
6525        if let FlatlandRequest::AddChild {
6526            parent_transform_id,
6527            child_transform_id,
6528            control_handle,
6529        } = self
6530        {
6531            Some((parent_transform_id, child_transform_id, control_handle))
6532        } else {
6533            None
6534        }
6535    }
6536
6537    #[allow(irrefutable_let_patterns)]
6538    pub fn into_remove_child(self) -> Option<(TransformId, TransformId, FlatlandControlHandle)> {
6539        if let FlatlandRequest::RemoveChild {
6540            parent_transform_id,
6541            child_transform_id,
6542            control_handle,
6543        } = self
6544        {
6545            Some((parent_transform_id, child_transform_id, control_handle))
6546        } else {
6547            None
6548        }
6549    }
6550
6551    #[allow(irrefutable_let_patterns)]
6552    pub fn into_replace_children(
6553        self,
6554    ) -> Option<(TransformId, Vec<TransformId>, FlatlandControlHandle)> {
6555        if let FlatlandRequest::ReplaceChildren {
6556            parent_transform_id,
6557            new_child_transform_ids,
6558            control_handle,
6559        } = self
6560        {
6561            Some((parent_transform_id, new_child_transform_ids, control_handle))
6562        } else {
6563            None
6564        }
6565    }
6566
6567    #[allow(irrefutable_let_patterns)]
6568    pub fn into_set_root_transform(self) -> Option<(TransformId, FlatlandControlHandle)> {
6569        if let FlatlandRequest::SetRootTransform { transform_id, control_handle } = self {
6570            Some((transform_id, control_handle))
6571        } else {
6572            None
6573        }
6574    }
6575
6576    #[allow(irrefutable_let_patterns)]
6577    pub fn into_set_hit_regions(
6578        self,
6579    ) -> Option<(TransformId, Vec<HitRegion>, FlatlandControlHandle)> {
6580        if let FlatlandRequest::SetHitRegions { transform_id, regions, control_handle } = self {
6581            Some((transform_id, regions, control_handle))
6582        } else {
6583            None
6584        }
6585    }
6586
6587    #[allow(irrefutable_let_patterns)]
6588    pub fn into_set_infinite_hit_region(
6589        self,
6590    ) -> Option<(TransformId, HitTestInteraction, FlatlandControlHandle)> {
6591        if let FlatlandRequest::SetInfiniteHitRegion { transform_id, hit_test, control_handle } =
6592            self
6593        {
6594            Some((transform_id, hit_test, control_handle))
6595        } else {
6596            None
6597        }
6598    }
6599
6600    #[allow(irrefutable_let_patterns)]
6601    pub fn into_create_viewport(
6602        self,
6603    ) -> Option<(
6604        ContentId,
6605        fidl_fuchsia_ui_views::ViewportCreationToken,
6606        ViewportProperties,
6607        fidl::endpoints::ServerEnd<ChildViewWatcherMarker>,
6608        FlatlandControlHandle,
6609    )> {
6610        if let FlatlandRequest::CreateViewport {
6611            viewport_id,
6612            token,
6613            properties,
6614            child_view_watcher,
6615            control_handle,
6616        } = self
6617        {
6618            Some((viewport_id, token, properties, child_view_watcher, control_handle))
6619        } else {
6620            None
6621        }
6622    }
6623
6624    #[allow(irrefutable_let_patterns)]
6625    pub fn into_create_image(
6626        self,
6627    ) -> Option<(ContentId, BufferCollectionImportToken, u32, ImageProperties, FlatlandControlHandle)>
6628    {
6629        if let FlatlandRequest::CreateImage {
6630            image_id,
6631            import_token,
6632            vmo_index,
6633            properties,
6634            control_handle,
6635        } = self
6636        {
6637            Some((image_id, import_token, vmo_index, properties, control_handle))
6638        } else {
6639            None
6640        }
6641    }
6642
6643    #[allow(irrefutable_let_patterns)]
6644    pub fn into_set_image_sample_region(
6645        self,
6646    ) -> Option<(ContentId, fidl_fuchsia_math::RectF, FlatlandControlHandle)> {
6647        if let FlatlandRequest::SetImageSampleRegion { image_id, rect, control_handle } = self {
6648            Some((image_id, rect, control_handle))
6649        } else {
6650            None
6651        }
6652    }
6653
6654    #[allow(irrefutable_let_patterns)]
6655    pub fn into_set_image_destination_size(
6656        self,
6657    ) -> Option<(ContentId, fidl_fuchsia_math::SizeU, FlatlandControlHandle)> {
6658        if let FlatlandRequest::SetImageDestinationSize { image_id, size, control_handle } = self {
6659            Some((image_id, size, control_handle))
6660        } else {
6661            None
6662        }
6663    }
6664
6665    #[allow(irrefutable_let_patterns)]
6666    pub fn into_set_image_blending_function(
6667        self,
6668    ) -> Option<(ContentId, BlendMode, FlatlandControlHandle)> {
6669        if let FlatlandRequest::SetImageBlendingFunction { image_id, blend_mode, control_handle } =
6670            self
6671        {
6672            Some((image_id, blend_mode, control_handle))
6673        } else {
6674            None
6675        }
6676    }
6677
6678    #[allow(irrefutable_let_patterns)]
6679    pub fn into_set_image_blend_mode(
6680        self,
6681    ) -> Option<(ContentId, BlendMode2, FlatlandControlHandle)> {
6682        if let FlatlandRequest::SetImageBlendMode { image_id, blend_mode, control_handle } = self {
6683            Some((image_id, blend_mode, control_handle))
6684        } else {
6685            None
6686        }
6687    }
6688
6689    #[allow(irrefutable_let_patterns)]
6690    pub fn into_set_image_opacity(self) -> Option<(ContentId, f32, FlatlandControlHandle)> {
6691        if let FlatlandRequest::SetImageOpacity { image_id, val, control_handle } = self {
6692            Some((image_id, val, control_handle))
6693        } else {
6694            None
6695        }
6696    }
6697
6698    #[allow(irrefutable_let_patterns)]
6699    pub fn into_set_image_flip(self) -> Option<(ContentId, ImageFlip, FlatlandControlHandle)> {
6700        if let FlatlandRequest::SetImageFlip { image_id, flip, control_handle } = self {
6701            Some((image_id, flip, control_handle))
6702        } else {
6703            None
6704        }
6705    }
6706
6707    #[allow(irrefutable_let_patterns)]
6708    pub fn into_create_filled_rect(self) -> Option<(ContentId, FlatlandControlHandle)> {
6709        if let FlatlandRequest::CreateFilledRect { rect_id, control_handle } = self {
6710            Some((rect_id, control_handle))
6711        } else {
6712            None
6713        }
6714    }
6715
6716    #[allow(irrefutable_let_patterns)]
6717    pub fn into_set_solid_fill(
6718        self,
6719    ) -> Option<(ContentId, ColorRgba, fidl_fuchsia_math::SizeU, FlatlandControlHandle)> {
6720        if let FlatlandRequest::SetSolidFill { rect_id, color, size, control_handle } = self {
6721            Some((rect_id, color, size, control_handle))
6722        } else {
6723            None
6724        }
6725    }
6726
6727    #[allow(irrefutable_let_patterns)]
6728    pub fn into_release_filled_rect(self) -> Option<(ContentId, FlatlandControlHandle)> {
6729        if let FlatlandRequest::ReleaseFilledRect { rect_id, control_handle } = self {
6730            Some((rect_id, control_handle))
6731        } else {
6732            None
6733        }
6734    }
6735
6736    #[allow(irrefutable_let_patterns)]
6737    pub fn into_set_content(self) -> Option<(TransformId, ContentId, FlatlandControlHandle)> {
6738        if let FlatlandRequest::SetContent { transform_id, content_id, control_handle } = self {
6739            Some((transform_id, content_id, control_handle))
6740        } else {
6741            None
6742        }
6743    }
6744
6745    #[allow(irrefutable_let_patterns)]
6746    pub fn into_set_viewport_properties(
6747        self,
6748    ) -> Option<(ContentId, ViewportProperties, FlatlandControlHandle)> {
6749        if let FlatlandRequest::SetViewportProperties { viewport_id, properties, control_handle } =
6750            self
6751        {
6752            Some((viewport_id, properties, control_handle))
6753        } else {
6754            None
6755        }
6756    }
6757
6758    #[allow(irrefutable_let_patterns)]
6759    pub fn into_release_transform(self) -> Option<(TransformId, FlatlandControlHandle)> {
6760        if let FlatlandRequest::ReleaseTransform { transform_id, control_handle } = self {
6761            Some((transform_id, control_handle))
6762        } else {
6763            None
6764        }
6765    }
6766
6767    #[allow(irrefutable_let_patterns)]
6768    pub fn into_release_view(self) -> Option<(FlatlandControlHandle)> {
6769        if let FlatlandRequest::ReleaseView { control_handle } = self {
6770            Some((control_handle))
6771        } else {
6772            None
6773        }
6774    }
6775
6776    #[allow(irrefutable_let_patterns)]
6777    pub fn into_release_viewport(self) -> Option<(ContentId, FlatlandReleaseViewportResponder)> {
6778        if let FlatlandRequest::ReleaseViewport { viewport_id, responder } = self {
6779            Some((viewport_id, responder))
6780        } else {
6781            None
6782        }
6783    }
6784
6785    #[allow(irrefutable_let_patterns)]
6786    pub fn into_release_image(self) -> Option<(ContentId, FlatlandControlHandle)> {
6787        if let FlatlandRequest::ReleaseImage { image_id, control_handle } = self {
6788            Some((image_id, control_handle))
6789        } else {
6790            None
6791        }
6792    }
6793
6794    #[allow(irrefutable_let_patterns)]
6795    pub fn into_clear(self) -> Option<(FlatlandControlHandle)> {
6796        if let FlatlandRequest::Clear { control_handle } = self {
6797            Some((control_handle))
6798        } else {
6799            None
6800        }
6801    }
6802
6803    #[allow(irrefutable_let_patterns)]
6804    pub fn into_set_debug_name(self) -> Option<(String, FlatlandControlHandle)> {
6805        if let FlatlandRequest::SetDebugName { name, control_handle } = self {
6806            Some((name, control_handle))
6807        } else {
6808            None
6809        }
6810    }
6811
6812    /// Name of the method defined in FIDL
6813    pub fn method_name(&self) -> &'static str {
6814        match *self {
6815            FlatlandRequest::ReleaseImageImmediately { .. } => "release_image_immediately",
6816            FlatlandRequest::ReleaseImageImmediately2 { .. } => "release_image_immediately2",
6817            FlatlandRequest::CreateLayer { .. } => "create_layer",
6818            FlatlandRequest::ReleaseLayer { .. } => "release_layer",
6819            FlatlandRequest::SetLayerImage { .. } => "set_layer_image",
6820            FlatlandRequest::SetLayerProperties { .. } => "set_layer_properties",
6821            FlatlandRequest::ResetLayer { .. } => "reset_layer",
6822            FlatlandRequest::CreateLayerStack { .. } => "create_layer_stack",
6823            FlatlandRequest::ReleaseLayerStack { .. } => "release_layer_stack",
6824            FlatlandRequest::SetStackLayers { .. } => "set_stack_layers",
6825            FlatlandRequest::CreateImage2 { .. } => "create_image2",
6826            FlatlandRequest::ReleaseImage2 { .. } => "release_image2",
6827            FlatlandRequest::CreateViewport2 { .. } => "create_viewport2",
6828            FlatlandRequest::ReleaseViewport2 { .. } => "release_viewport2",
6829            FlatlandRequest::SetViewportProperties2 { .. } => "set_viewport_properties2",
6830            FlatlandRequest::SetTransformContent { .. } => "set_transform_content",
6831            FlatlandRequest::Present { .. } => "present",
6832            FlatlandRequest::CreateView { .. } => "create_view",
6833            FlatlandRequest::CreateView2 { .. } => "create_view2",
6834            FlatlandRequest::CreateTransform { .. } => "create_transform",
6835            FlatlandRequest::SetTranslation { .. } => "set_translation",
6836            FlatlandRequest::SetOrientation { .. } => "set_orientation",
6837            FlatlandRequest::SetScale { .. } => "set_scale",
6838            FlatlandRequest::SetOpacity { .. } => "set_opacity",
6839            FlatlandRequest::SetClipBoundary { .. } => "set_clip_boundary",
6840            FlatlandRequest::AddChild { .. } => "add_child",
6841            FlatlandRequest::RemoveChild { .. } => "remove_child",
6842            FlatlandRequest::ReplaceChildren { .. } => "replace_children",
6843            FlatlandRequest::SetRootTransform { .. } => "set_root_transform",
6844            FlatlandRequest::SetHitRegions { .. } => "set_hit_regions",
6845            FlatlandRequest::SetInfiniteHitRegion { .. } => "set_infinite_hit_region",
6846            FlatlandRequest::CreateViewport { .. } => "create_viewport",
6847            FlatlandRequest::CreateImage { .. } => "create_image",
6848            FlatlandRequest::SetImageSampleRegion { .. } => "set_image_sample_region",
6849            FlatlandRequest::SetImageDestinationSize { .. } => "set_image_destination_size",
6850            FlatlandRequest::SetImageBlendingFunction { .. } => "set_image_blending_function",
6851            FlatlandRequest::SetImageBlendMode { .. } => "set_image_blend_mode",
6852            FlatlandRequest::SetImageOpacity { .. } => "set_image_opacity",
6853            FlatlandRequest::SetImageFlip { .. } => "set_image_flip",
6854            FlatlandRequest::CreateFilledRect { .. } => "create_filled_rect",
6855            FlatlandRequest::SetSolidFill { .. } => "set_solid_fill",
6856            FlatlandRequest::ReleaseFilledRect { .. } => "release_filled_rect",
6857            FlatlandRequest::SetContent { .. } => "set_content",
6858            FlatlandRequest::SetViewportProperties { .. } => "set_viewport_properties",
6859            FlatlandRequest::ReleaseTransform { .. } => "release_transform",
6860            FlatlandRequest::ReleaseView { .. } => "release_view",
6861            FlatlandRequest::ReleaseViewport { .. } => "release_viewport",
6862            FlatlandRequest::ReleaseImage { .. } => "release_image",
6863            FlatlandRequest::Clear { .. } => "clear",
6864            FlatlandRequest::SetDebugName { .. } => "set_debug_name",
6865        }
6866    }
6867}
6868
6869#[derive(Debug, Clone)]
6870pub struct FlatlandControlHandle {
6871    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6872}
6873
6874impl FlatlandControlHandle {
6875    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
6876        self.inner.shutdown_with_epitaph(status.into())
6877    }
6878}
6879
6880impl fidl::endpoints::ControlHandle for FlatlandControlHandle {
6881    fn shutdown(&self) {
6882        self.inner.shutdown()
6883    }
6884
6885    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
6886        self.inner.shutdown_with_epitaph(status)
6887    }
6888
6889    fn is_closed(&self) -> bool {
6890        self.inner.channel().is_closed()
6891    }
6892    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
6893        self.inner.channel().on_closed()
6894    }
6895
6896    #[cfg(target_os = "fuchsia")]
6897    fn signal_peer(
6898        &self,
6899        clear_mask: zx::Signals,
6900        set_mask: zx::Signals,
6901    ) -> Result<(), zx_status::Status> {
6902        use fidl::Peered;
6903        self.inner.channel().signal_peer(clear_mask, set_mask)
6904    }
6905}
6906
6907impl FlatlandControlHandle {
6908    pub fn send_on_next_frame_begin(
6909        &self,
6910        mut values: &OnNextFrameBeginValues,
6911    ) -> Result<(), fidl::Error> {
6912        self.inner.send::<FlatlandOnNextFrameBeginRequest>(
6913            (values,),
6914            0,
6915            0x10f69a5cdeece84a,
6916            fidl::encoding::DynamicFlags::empty(),
6917        )
6918    }
6919
6920    pub fn send_on_frame_presented(
6921        &self,
6922        mut frame_presented_info: &fidl_fuchsia_scenic_scheduling::FramePresentedInfo,
6923    ) -> Result<(), fidl::Error> {
6924        self.inner.send::<FlatlandOnFramePresentedRequest>(
6925            (frame_presented_info,),
6926            0,
6927            0x56e43e1a5f30216d,
6928            fidl::encoding::DynamicFlags::empty(),
6929        )
6930    }
6931
6932    pub fn send_on_error(&self, mut error: FlatlandError) -> Result<(), fidl::Error> {
6933        self.inner.send::<FlatlandOnErrorRequest>(
6934            (error,),
6935            0,
6936            0x1ebf39e90cd8b8d,
6937            fidl::encoding::DynamicFlags::empty(),
6938        )
6939    }
6940}
6941
6942#[must_use = "FIDL methods require a response to be sent"]
6943#[derive(Debug)]
6944pub struct FlatlandReleaseViewport2Responder {
6945    control_handle: std::mem::ManuallyDrop<FlatlandControlHandle>,
6946    tx_id: u32,
6947}
6948
6949/// Set the the channel to be shutdown (see [`FlatlandControlHandle::shutdown`])
6950/// if the responder is dropped without sending a response, so that the client
6951/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6952impl std::ops::Drop for FlatlandReleaseViewport2Responder {
6953    fn drop(&mut self) {
6954        self.control_handle.shutdown();
6955        // Safety: drops once, never accessed again
6956        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6957    }
6958}
6959
6960impl fidl::endpoints::Responder for FlatlandReleaseViewport2Responder {
6961    type ControlHandle = FlatlandControlHandle;
6962
6963    fn control_handle(&self) -> &FlatlandControlHandle {
6964        &self.control_handle
6965    }
6966
6967    fn drop_without_shutdown(mut self) {
6968        // Safety: drops once, never accessed again due to mem::forget
6969        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6970        // Prevent Drop from running (which would shut down the channel)
6971        std::mem::forget(self);
6972    }
6973}
6974
6975impl FlatlandReleaseViewport2Responder {
6976    /// Sends a response to the FIDL transaction.
6977    ///
6978    /// Sets the channel to shutdown if an error occurs.
6979    pub fn send(
6980        self,
6981        mut token: fidl_fuchsia_ui_views::ViewportCreationToken,
6982    ) -> Result<(), fidl::Error> {
6983        let _result = self.send_raw(token);
6984        if _result.is_err() {
6985            self.control_handle.shutdown();
6986        }
6987        self.drop_without_shutdown();
6988        _result
6989    }
6990
6991    /// Similar to "send" but does not shutdown the channel if an error occurs.
6992    pub fn send_no_shutdown_on_err(
6993        self,
6994        mut token: fidl_fuchsia_ui_views::ViewportCreationToken,
6995    ) -> Result<(), fidl::Error> {
6996        let _result = self.send_raw(token);
6997        self.drop_without_shutdown();
6998        _result
6999    }
7000
7001    fn send_raw(
7002        &self,
7003        mut token: fidl_fuchsia_ui_views::ViewportCreationToken,
7004    ) -> Result<(), fidl::Error> {
7005        self.control_handle.inner.send::<Flatland2ReleaseViewport2Response>(
7006            (&mut token,),
7007            self.tx_id,
7008            0x18ef77414c7a9ae3,
7009            fidl::encoding::DynamicFlags::empty(),
7010        )
7011    }
7012}
7013
7014#[must_use = "FIDL methods require a response to be sent"]
7015#[derive(Debug)]
7016pub struct FlatlandReleaseViewportResponder {
7017    control_handle: std::mem::ManuallyDrop<FlatlandControlHandle>,
7018    tx_id: u32,
7019}
7020
7021/// Set the the channel to be shutdown (see [`FlatlandControlHandle::shutdown`])
7022/// if the responder is dropped without sending a response, so that the client
7023/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7024impl std::ops::Drop for FlatlandReleaseViewportResponder {
7025    fn drop(&mut self) {
7026        self.control_handle.shutdown();
7027        // Safety: drops once, never accessed again
7028        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7029    }
7030}
7031
7032impl fidl::endpoints::Responder for FlatlandReleaseViewportResponder {
7033    type ControlHandle = FlatlandControlHandle;
7034
7035    fn control_handle(&self) -> &FlatlandControlHandle {
7036        &self.control_handle
7037    }
7038
7039    fn drop_without_shutdown(mut self) {
7040        // Safety: drops once, never accessed again due to mem::forget
7041        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7042        // Prevent Drop from running (which would shut down the channel)
7043        std::mem::forget(self);
7044    }
7045}
7046
7047impl FlatlandReleaseViewportResponder {
7048    /// Sends a response to the FIDL transaction.
7049    ///
7050    /// Sets the channel to shutdown if an error occurs.
7051    pub fn send(
7052        self,
7053        mut token: fidl_fuchsia_ui_views::ViewportCreationToken,
7054    ) -> Result<(), fidl::Error> {
7055        let _result = self.send_raw(token);
7056        if _result.is_err() {
7057            self.control_handle.shutdown();
7058        }
7059        self.drop_without_shutdown();
7060        _result
7061    }
7062
7063    /// Similar to "send" but does not shutdown the channel if an error occurs.
7064    pub fn send_no_shutdown_on_err(
7065        self,
7066        mut token: fidl_fuchsia_ui_views::ViewportCreationToken,
7067    ) -> Result<(), fidl::Error> {
7068        let _result = self.send_raw(token);
7069        self.drop_without_shutdown();
7070        _result
7071    }
7072
7073    fn send_raw(
7074        &self,
7075        mut token: fidl_fuchsia_ui_views::ViewportCreationToken,
7076    ) -> Result<(), fidl::Error> {
7077        self.control_handle.inner.send::<FlatlandReleaseViewportResponse>(
7078            (&mut token,),
7079            self.tx_id,
7080            0xbad474aeb5293f9,
7081            fidl::encoding::DynamicFlags::empty(),
7082        )
7083    }
7084}
7085
7086#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
7087pub struct Flatland2Marker;
7088
7089impl fidl::endpoints::ProtocolMarker for Flatland2Marker {
7090    type Proxy = Flatland2Proxy;
7091    type RequestStream = Flatland2RequestStream;
7092    #[cfg(target_os = "fuchsia")]
7093    type SynchronousProxy = Flatland2SynchronousProxy;
7094
7095    const DEBUG_NAME: &'static str = "(anonymous) Flatland2";
7096}
7097
7098pub trait Flatland2ProxyInterface: Send + Sync {
7099    fn r#create_layer(&self, layer_id: &LayerId) -> Result<(), fidl::Error>;
7100    fn r#release_layer(&self, layer_id: &LayerId) -> Result<(), fidl::Error>;
7101    fn r#set_layer_image(
7102        &self,
7103        layer_id: &LayerId,
7104        image_id: &ImageId,
7105        acquire_fence: Option<WaitFence>,
7106        release_fence: Option<SignalFence>,
7107    ) -> Result<(), fidl::Error>;
7108    fn r#set_layer_properties(
7109        &self,
7110        layer_id: &LayerId,
7111        properties: &LayerProperties,
7112    ) -> Result<(), fidl::Error>;
7113    fn r#reset_layer(&self, layer_id: &LayerId) -> Result<(), fidl::Error>;
7114    fn r#create_layer_stack(&self, stack_id: &LayerStackId) -> Result<(), fidl::Error>;
7115    fn r#release_layer_stack(&self, stack_id: &LayerStackId) -> Result<(), fidl::Error>;
7116    fn r#set_stack_layers(
7117        &self,
7118        stack_id: &LayerStackId,
7119        layers: &[LayerId],
7120    ) -> Result<(), fidl::Error>;
7121    fn r#create_image2(
7122        &self,
7123        image_id: &ImageId,
7124        import_token: BufferCollectionImportToken,
7125        vmo_index: u32,
7126        properties: &ImageProperties,
7127    ) -> Result<(), fidl::Error>;
7128    fn r#release_image2(&self, image_id: &ImageId) -> Result<(), fidl::Error>;
7129    fn r#create_viewport2(
7130        &self,
7131        viewport_id: &ViewportId,
7132        token: fidl_fuchsia_ui_views::ViewportCreationToken,
7133        properties: &ViewportProperties,
7134        child_view_watcher: fidl::endpoints::ServerEnd<ChildViewWatcherMarker>,
7135    ) -> Result<(), fidl::Error>;
7136    type ReleaseViewport2ResponseFut: std::future::Future<
7137            Output = Result<fidl_fuchsia_ui_views::ViewportCreationToken, fidl::Error>,
7138        > + Send;
7139    fn r#release_viewport2(&self, viewport_id: &ViewportId) -> Self::ReleaseViewport2ResponseFut;
7140    fn r#set_viewport_properties2(
7141        &self,
7142        viewport_id: &ViewportId,
7143        properties: &ViewportProperties,
7144    ) -> Result<(), fidl::Error>;
7145    fn r#set_transform_content(
7146        &self,
7147        transform_id: &TransformId,
7148        content: Option<&TransformContent>,
7149    ) -> Result<(), fidl::Error>;
7150}
7151#[derive(Debug)]
7152#[cfg(target_os = "fuchsia")]
7153pub struct Flatland2SynchronousProxy {
7154    client: fidl::client::sync::Client,
7155}
7156
7157#[cfg(target_os = "fuchsia")]
7158impl fidl::endpoints::SynchronousProxy for Flatland2SynchronousProxy {
7159    type Proxy = Flatland2Proxy;
7160    type Protocol = Flatland2Marker;
7161
7162    fn from_channel(inner: fidl::Channel) -> Self {
7163        Self::new(inner)
7164    }
7165
7166    fn into_channel(self) -> fidl::Channel {
7167        self.client.into_channel()
7168    }
7169
7170    fn as_channel(&self) -> &fidl::Channel {
7171        self.client.as_channel()
7172    }
7173}
7174
7175#[cfg(target_os = "fuchsia")]
7176impl Flatland2SynchronousProxy {
7177    pub fn new(channel: fidl::Channel) -> Self {
7178        Self { client: fidl::client::sync::Client::new(channel) }
7179    }
7180
7181    pub fn into_channel(self) -> fidl::Channel {
7182        self.client.into_channel()
7183    }
7184
7185    /// Waits until an event arrives and returns it. It is safe for other
7186    /// threads to make concurrent requests while waiting for an event.
7187    pub fn wait_for_event(
7188        &self,
7189        deadline: zx::MonotonicInstant,
7190    ) -> Result<Flatland2Event, fidl::Error> {
7191        Flatland2Event::decode(self.client.wait_for_event::<Flatland2Marker>(deadline)?)
7192    }
7193
7194    /// A Layer is a type of `Content` that composites either a single `Image` or a solid
7195    /// color. It separates visual properties (such as size, flip, opacity, and blending)
7196    /// from the raw pixel data.
7197    ///
7198    /// Unlike typical `Content` items which represent a static visual resource, a Layer is designed
7199    /// to be a dynamic container for an image sequence. Typical usage involves setting the layer's
7200    /// visual properties and image metadata infrequently, and then rapidly swapping the active
7201    /// `Image` (e.g. on every frame) with another image of matching metadata.
7202    ///
7203    /// This separation allows a single `Image` resource to be reused across multiple layers with
7204    /// different visual configurations simultaneously.
7205    ///
7206    /// To use a Layer:
7207    /// 1. Create a `Layer` using [`CreateLayer`].
7208    /// 2. Set properties on the `Layer` via [`SetLayerProperties`], including the
7209    ///    composition mode.
7210    /// 3. For an image layer, associate an `Image` with the `Layer` via [`SetLayerImage`].
7211    /// 4. Add the `Layer` to a `LayerStack` via [`SetStackLayers`].
7212    /// 5. Set the `LayerStack` as the content of a node via [`SetTransformContent`].
7213    ///
7214    /// `layer_id` must satisfy the identifier rules documented on [`LayerId`].
7215    pub fn r#create_layer(&self, mut layer_id: &LayerId) -> Result<(), fidl::Error> {
7216        self.client.send::<Flatland2CreateLayerRequest>(
7217            (layer_id,),
7218            0x60837bb0ce59f8a9,
7219            fidl::encoding::DynamicFlags::empty(),
7220        )
7221    }
7222
7223    /// Released Layers will be garbage collected by the system once they are no longer necessary
7224    /// for rendering. For Layers, this means:
7225    /// - the Layer is no longer referenced by any LayerStack, and
7226    /// - any pending rendering that references the Layer is complete.
7227    ///
7228    /// `layer_id` must refer to a valid, unreleased Layer.
7229    pub fn r#release_layer(&self, mut layer_id: &LayerId) -> Result<(), fidl::Error> {
7230        self.client.send::<Flatland2ReleaseLayerRequest>(
7231            (layer_id,),
7232            0x60118a842b6f0756,
7233            fidl::encoding::DynamicFlags::empty(),
7234        )
7235    }
7236
7237    /// Associates an Image with the Layer.
7238    ///
7239    /// The binding is legal in any composition mode, and is sticky: it survives composition
7240    /// mode changes, and is replaced only by a later [`SetLayerImage`] call (or cleared by
7241    /// [`ResetLayer`]). The image is displayed only while the layer's composition mode is
7242    /// `IMAGE`.
7243    ///
7244    /// The bound image must be large enough for the layer's stored `sample_rect`; this is
7245    /// checked at [`fuchsia.ui.composition/Flatland.Present`], not here. See
7246    /// [`LayerProperties.sample_rect`].
7247    ///
7248    /// `layer_id` must refer to a valid, unreleased Layer.
7249    /// `image_id` must refer to a valid, unreleased Image.
7250    /// `acquire_fence` is an optional fence that must be signaled before the image is displayed.
7251    /// `release_fence` is an optional fence, signaled by Scenic when *this binding* no
7252    /// longer references the image. It is per-binding, not per-image: an image bound to
7253    /// several layers has one such fence per binding, and the image is safe to write only
7254    /// once every one of them has signaled.
7255    ///
7256    /// A binding is ended by:
7257    ///
7258    /// - being superseded by a later [`SetLayerImage`] on the same layer
7259    /// - [`ResetLayer`]
7260    /// - the layer ref-count reaching zero, either via [`ReleaseLayer`] or by being released
7261    ///   by a layer stack
7262    /// - destruction of the session, which ends every binding it holds
7263    ///
7264    /// For a binding ended while the session is alive, Scenic signals at the first frame
7265    /// retire after that point. Bindings that never reached the screen (e.g. one superseded
7266    /// within a single batch, or one lost when several
7267    /// [`fuchsia.ui.composition/Flatland.Present`] calls are squashed into a single
7268    /// frame) signal at that same retire rather than immediately. The signal is
7269    /// therefore conservative by at most one frame; it is never early.
7270    pub fn r#set_layer_image(
7271        &self,
7272        mut layer_id: &LayerId,
7273        mut image_id: &ImageId,
7274        mut acquire_fence: Option<WaitFence>,
7275        mut release_fence: Option<SignalFence>,
7276    ) -> Result<(), fidl::Error> {
7277        self.client.send::<Flatland2SetLayerImageRequest>(
7278            (layer_id, image_id, acquire_fence.as_mut(), release_fence.as_mut()),
7279            0x262302d9782d252c,
7280            fidl::encoding::DynamicFlags::empty(),
7281        )
7282    }
7283
7284    /// Sets properties of the Layer.
7285    ///
7286    /// The provided `properties` table is merged into the layer's stored properties: fields
7287    /// which are unset in `properties` retain their previously stored values. Stored
7288    /// properties are sticky; see [`LayerProperties`] for the full persistence semantics.
7289    ///
7290    /// Values are stored as given; validation which depends on other state (notably
7291    /// `sample_rect` against the bound image) happens at
7292    /// [`fuchsia.ui.composition/Flatland.Present`]. See [`LayerProperties.sample_rect`].
7293    ///
7294    /// `layer_id` must refer to a valid, unreleased Layer.
7295    pub fn r#set_layer_properties(
7296        &self,
7297        mut layer_id: &LayerId,
7298        mut properties: &LayerProperties,
7299    ) -> Result<(), fidl::Error> {
7300        self.client.send::<Flatland2SetLayerPropertiesRequest>(
7301            (layer_id, properties),
7302            0x282d0e902aae8bb0,
7303            fidl::encoding::DynamicFlags::empty(),
7304        )
7305    }
7306
7307    /// Unbinds any Image bound to the layer and clears every stored [`LayerProperties`]
7308    /// field, returning the layer to its freshly-created state (composition mode
7309    /// `INVISIBLE`, all properties at their documented defaults). This is the only
7310    /// operation which forgets stored layer properties.
7311    ///
7312    /// `layer_id` must refer to a valid, unreleased Layer.
7313    pub fn r#reset_layer(&self, mut layer_id: &LayerId) -> Result<(), fidl::Error> {
7314        self.client.send::<Flatland2ResetLayerRequest>(
7315            (layer_id,),
7316            0x17bf541bf216ab2b,
7317            fidl::encoding::DynamicFlags::empty(),
7318        )
7319    }
7320
7321    /// Creates a new layer stack with the specified `stack_id`.
7322    ///
7323    /// `stack_id` must satisfy the identifier rules documented on [`LayerId`].
7324    pub fn r#create_layer_stack(&self, mut stack_id: &LayerStackId) -> Result<(), fidl::Error> {
7325        self.client.send::<Flatland2CreateLayerStackRequest>(
7326            (stack_id,),
7327            0x70debe3cd7371aa6,
7328            fidl::encoding::DynamicFlags::empty(),
7329        )
7330    }
7331
7332    /// Releases the layer stack with the specified `stack_id`.
7333    pub fn r#release_layer_stack(&self, mut stack_id: &LayerStackId) -> Result<(), fidl::Error> {
7334        self.client.send::<Flatland2ReleaseLayerStackRequest>(
7335            (stack_id,),
7336            0x3ad3151aece3b1bb,
7337            fidl::encoding::DynamicFlags::empty(),
7338        )
7339    }
7340
7341    /// Sets the layers in the stack. The order of layers in the vector determines their Z-order,
7342    /// with the first element being the back-most and the last element being the front-most.
7343    ///
7344    /// `stack_id` must refer to a valid, unreleased LayerStack. Each element of `layers`
7345    /// must refer to a valid, unreleased Layer. Duplicate layers within `layers` are
7346    /// disallowed.
7347    pub fn r#set_stack_layers(
7348        &self,
7349        mut stack_id: &LayerStackId,
7350        mut layers: &[LayerId],
7351    ) -> Result<(), fidl::Error> {
7352        self.client.send::<Flatland2SetStackLayersRequest>(
7353            (stack_id, layers),
7354            0x1e0bff0f5cca065a,
7355            fidl::encoding::DynamicFlags::empty(),
7356        )
7357    }
7358
7359    /// Creates an Image resource.
7360    ///
7361    /// `image_id` must satisfy the identifier rules documented on [`LayerId`].
7362    pub fn r#create_image2(
7363        &self,
7364        mut image_id: &ImageId,
7365        mut import_token: BufferCollectionImportToken,
7366        mut vmo_index: u32,
7367        mut properties: &ImageProperties,
7368    ) -> Result<(), fidl::Error> {
7369        self.client.send::<Flatland2CreateImage2Request>(
7370            (image_id, &mut import_token, vmo_index, properties),
7371            0x677fa7b23aaca46,
7372            fidl::encoding::DynamicFlags::empty(),
7373        )
7374    }
7375
7376    /// Released Images will be garbage collected by the system once they are no longer necessary
7377    /// for rendering. For Images, this means:
7378    /// - the Image is no longer bound to any Layer, and
7379    /// - any pending rendering that references the Image is complete.
7380    ///
7381    /// The `image_id` value is freed for reuse immediately by the client (identifier uniqueness
7382    /// is instantaneous).
7383    ///
7384    /// Note: Per-binding release fences (passed to `SetLayerImage`) are unaffected by this call.
7385    /// They track the lifecycle of individual layer bindings, not the client's `image_id`.
7386    ///
7387    /// `image_id` must refer to a valid, unreleased Image.
7388    pub fn r#release_image2(&self, mut image_id: &ImageId) -> Result<(), fidl::Error> {
7389        self.client.send::<Flatland2ReleaseImage2Request>(
7390            (image_id,),
7391            0x7d0a041ed51aca06,
7392            fidl::encoding::DynamicFlags::empty(),
7393        )
7394    }
7395
7396    /// Creates a Viewport resource.
7397    ///
7398    /// `viewport_id` must satisfy the identifier rules documented on [`LayerId`].
7399    pub fn r#create_viewport2(
7400        &self,
7401        mut viewport_id: &ViewportId,
7402        mut token: fidl_fuchsia_ui_views::ViewportCreationToken,
7403        mut properties: &ViewportProperties,
7404        mut child_view_watcher: fidl::endpoints::ServerEnd<ChildViewWatcherMarker>,
7405    ) -> Result<(), fidl::Error> {
7406        self.client.send::<Flatland2CreateViewport2Request>(
7407            (viewport_id, &mut token, properties, child_view_watcher),
7408            0x1b646776764f1128,
7409            fidl::encoding::DynamicFlags::empty(),
7410        )
7411    }
7412
7413    /// Releases a Viewport from the scene.
7414    pub fn r#release_viewport2(
7415        &self,
7416        mut viewport_id: &ViewportId,
7417        ___deadline: zx::MonotonicInstant,
7418    ) -> Result<fidl_fuchsia_ui_views::ViewportCreationToken, fidl::Error> {
7419        let _response = self.client.send_query::<
7420            Flatland2ReleaseViewport2Request,
7421            Flatland2ReleaseViewport2Response,
7422            Flatland2Marker,
7423        >(
7424            (viewport_id,),
7425            0x18ef77414c7a9ae3,
7426            fidl::encoding::DynamicFlags::empty(),
7427            ___deadline,
7428        )?;
7429        Ok(_response.token)
7430    }
7431
7432    /// Sets the properties of a Viewport.
7433    pub fn r#set_viewport_properties2(
7434        &self,
7435        mut viewport_id: &ViewportId,
7436        mut properties: &ViewportProperties,
7437    ) -> Result<(), fidl::Error> {
7438        self.client.send::<Flatland2SetViewportProperties2Request>(
7439            (viewport_id, properties),
7440            0x95f2ec3b9e4beea,
7441            fidl::encoding::DynamicFlags::empty(),
7442        )
7443    }
7444
7445    /// Sets (or clears) the content of a Transform.
7446    ///
7447    /// The same content may be attached to more than one Transform; each attachment composites
7448    /// that content again under its own Transform's matrix, clip, and opacity, so a single
7449    /// LayerStack or Viewport can appear repeatedly in a scene without the client duplicating the
7450    /// underlying resources.
7451    ///
7452    /// A Transform's content can be cleared by not providing the optional `content`.
7453    ///
7454    /// If `content` is set, it must refer to a valid, unreleased LayerStack or Viewport.
7455    /// Unlike classic [`Flatland.SetContent`], a zero id does not clear the content.
7456    pub fn r#set_transform_content(
7457        &self,
7458        mut transform_id: &TransformId,
7459        mut content: Option<&TransformContent>,
7460    ) -> Result<(), fidl::Error> {
7461        self.client.send::<Flatland2SetTransformContentRequest>(
7462            (transform_id, content),
7463            0x17e33f64f55e4ea9,
7464            fidl::encoding::DynamicFlags::empty(),
7465        )
7466    }
7467}
7468
7469#[cfg(target_os = "fuchsia")]
7470impl From<Flatland2SynchronousProxy> for zx::NullableHandle {
7471    fn from(value: Flatland2SynchronousProxy) -> Self {
7472        value.into_channel().into()
7473    }
7474}
7475
7476#[cfg(target_os = "fuchsia")]
7477impl From<fidl::Channel> for Flatland2SynchronousProxy {
7478    fn from(value: fidl::Channel) -> Self {
7479        Self::new(value)
7480    }
7481}
7482
7483#[cfg(target_os = "fuchsia")]
7484impl fidl::endpoints::FromClient for Flatland2SynchronousProxy {
7485    type Protocol = Flatland2Marker;
7486
7487    fn from_client(value: fidl::endpoints::ClientEnd<Flatland2Marker>) -> Self {
7488        Self::new(value.into_channel())
7489    }
7490}
7491
7492#[derive(Debug, Clone)]
7493pub struct Flatland2Proxy {
7494    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
7495}
7496
7497impl fidl::endpoints::Proxy for Flatland2Proxy {
7498    type Protocol = Flatland2Marker;
7499
7500    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
7501        Self::new(inner)
7502    }
7503
7504    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
7505        self.client.into_channel().map_err(|client| Self { client })
7506    }
7507
7508    fn as_channel(&self) -> &::fidl::AsyncChannel {
7509        self.client.as_channel()
7510    }
7511}
7512
7513impl Flatland2Proxy {
7514    /// Create a new Proxy for fuchsia.ui.composition/Flatland2.
7515    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
7516        let protocol_name = <Flatland2Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
7517        Self { client: fidl::client::Client::new(channel, protocol_name) }
7518    }
7519
7520    /// Get a Stream of events from the remote end of the protocol.
7521    ///
7522    /// # Panics
7523    ///
7524    /// Panics if the event stream was already taken.
7525    pub fn take_event_stream(&self) -> Flatland2EventStream {
7526        Flatland2EventStream { event_receiver: self.client.take_event_receiver() }
7527    }
7528
7529    /// A Layer is a type of `Content` that composites either a single `Image` or a solid
7530    /// color. It separates visual properties (such as size, flip, opacity, and blending)
7531    /// from the raw pixel data.
7532    ///
7533    /// Unlike typical `Content` items which represent a static visual resource, a Layer is designed
7534    /// to be a dynamic container for an image sequence. Typical usage involves setting the layer's
7535    /// visual properties and image metadata infrequently, and then rapidly swapping the active
7536    /// `Image` (e.g. on every frame) with another image of matching metadata.
7537    ///
7538    /// This separation allows a single `Image` resource to be reused across multiple layers with
7539    /// different visual configurations simultaneously.
7540    ///
7541    /// To use a Layer:
7542    /// 1. Create a `Layer` using [`CreateLayer`].
7543    /// 2. Set properties on the `Layer` via [`SetLayerProperties`], including the
7544    ///    composition mode.
7545    /// 3. For an image layer, associate an `Image` with the `Layer` via [`SetLayerImage`].
7546    /// 4. Add the `Layer` to a `LayerStack` via [`SetStackLayers`].
7547    /// 5. Set the `LayerStack` as the content of a node via [`SetTransformContent`].
7548    ///
7549    /// `layer_id` must satisfy the identifier rules documented on [`LayerId`].
7550    pub fn r#create_layer(&self, mut layer_id: &LayerId) -> Result<(), fidl::Error> {
7551        Flatland2ProxyInterface::r#create_layer(self, layer_id)
7552    }
7553
7554    /// Released Layers will be garbage collected by the system once they are no longer necessary
7555    /// for rendering. For Layers, this means:
7556    /// - the Layer is no longer referenced by any LayerStack, and
7557    /// - any pending rendering that references the Layer is complete.
7558    ///
7559    /// `layer_id` must refer to a valid, unreleased Layer.
7560    pub fn r#release_layer(&self, mut layer_id: &LayerId) -> Result<(), fidl::Error> {
7561        Flatland2ProxyInterface::r#release_layer(self, layer_id)
7562    }
7563
7564    /// Associates an Image with the Layer.
7565    ///
7566    /// The binding is legal in any composition mode, and is sticky: it survives composition
7567    /// mode changes, and is replaced only by a later [`SetLayerImage`] call (or cleared by
7568    /// [`ResetLayer`]). The image is displayed only while the layer's composition mode is
7569    /// `IMAGE`.
7570    ///
7571    /// The bound image must be large enough for the layer's stored `sample_rect`; this is
7572    /// checked at [`fuchsia.ui.composition/Flatland.Present`], not here. See
7573    /// [`LayerProperties.sample_rect`].
7574    ///
7575    /// `layer_id` must refer to a valid, unreleased Layer.
7576    /// `image_id` must refer to a valid, unreleased Image.
7577    /// `acquire_fence` is an optional fence that must be signaled before the image is displayed.
7578    /// `release_fence` is an optional fence, signaled by Scenic when *this binding* no
7579    /// longer references the image. It is per-binding, not per-image: an image bound to
7580    /// several layers has one such fence per binding, and the image is safe to write only
7581    /// once every one of them has signaled.
7582    ///
7583    /// A binding is ended by:
7584    ///
7585    /// - being superseded by a later [`SetLayerImage`] on the same layer
7586    /// - [`ResetLayer`]
7587    /// - the layer ref-count reaching zero, either via [`ReleaseLayer`] or by being released
7588    ///   by a layer stack
7589    /// - destruction of the session, which ends every binding it holds
7590    ///
7591    /// For a binding ended while the session is alive, Scenic signals at the first frame
7592    /// retire after that point. Bindings that never reached the screen (e.g. one superseded
7593    /// within a single batch, or one lost when several
7594    /// [`fuchsia.ui.composition/Flatland.Present`] calls are squashed into a single
7595    /// frame) signal at that same retire rather than immediately. The signal is
7596    /// therefore conservative by at most one frame; it is never early.
7597    pub fn r#set_layer_image(
7598        &self,
7599        mut layer_id: &LayerId,
7600        mut image_id: &ImageId,
7601        mut acquire_fence: Option<WaitFence>,
7602        mut release_fence: Option<SignalFence>,
7603    ) -> Result<(), fidl::Error> {
7604        Flatland2ProxyInterface::r#set_layer_image(
7605            self,
7606            layer_id,
7607            image_id,
7608            acquire_fence,
7609            release_fence,
7610        )
7611    }
7612
7613    /// Sets properties of the Layer.
7614    ///
7615    /// The provided `properties` table is merged into the layer's stored properties: fields
7616    /// which are unset in `properties` retain their previously stored values. Stored
7617    /// properties are sticky; see [`LayerProperties`] for the full persistence semantics.
7618    ///
7619    /// Values are stored as given; validation which depends on other state (notably
7620    /// `sample_rect` against the bound image) happens at
7621    /// [`fuchsia.ui.composition/Flatland.Present`]. See [`LayerProperties.sample_rect`].
7622    ///
7623    /// `layer_id` must refer to a valid, unreleased Layer.
7624    pub fn r#set_layer_properties(
7625        &self,
7626        mut layer_id: &LayerId,
7627        mut properties: &LayerProperties,
7628    ) -> Result<(), fidl::Error> {
7629        Flatland2ProxyInterface::r#set_layer_properties(self, layer_id, properties)
7630    }
7631
7632    /// Unbinds any Image bound to the layer and clears every stored [`LayerProperties`]
7633    /// field, returning the layer to its freshly-created state (composition mode
7634    /// `INVISIBLE`, all properties at their documented defaults). This is the only
7635    /// operation which forgets stored layer properties.
7636    ///
7637    /// `layer_id` must refer to a valid, unreleased Layer.
7638    pub fn r#reset_layer(&self, mut layer_id: &LayerId) -> Result<(), fidl::Error> {
7639        Flatland2ProxyInterface::r#reset_layer(self, layer_id)
7640    }
7641
7642    /// Creates a new layer stack with the specified `stack_id`.
7643    ///
7644    /// `stack_id` must satisfy the identifier rules documented on [`LayerId`].
7645    pub fn r#create_layer_stack(&self, mut stack_id: &LayerStackId) -> Result<(), fidl::Error> {
7646        Flatland2ProxyInterface::r#create_layer_stack(self, stack_id)
7647    }
7648
7649    /// Releases the layer stack with the specified `stack_id`.
7650    pub fn r#release_layer_stack(&self, mut stack_id: &LayerStackId) -> Result<(), fidl::Error> {
7651        Flatland2ProxyInterface::r#release_layer_stack(self, stack_id)
7652    }
7653
7654    /// Sets the layers in the stack. The order of layers in the vector determines their Z-order,
7655    /// with the first element being the back-most and the last element being the front-most.
7656    ///
7657    /// `stack_id` must refer to a valid, unreleased LayerStack. Each element of `layers`
7658    /// must refer to a valid, unreleased Layer. Duplicate layers within `layers` are
7659    /// disallowed.
7660    pub fn r#set_stack_layers(
7661        &self,
7662        mut stack_id: &LayerStackId,
7663        mut layers: &[LayerId],
7664    ) -> Result<(), fidl::Error> {
7665        Flatland2ProxyInterface::r#set_stack_layers(self, stack_id, layers)
7666    }
7667
7668    /// Creates an Image resource.
7669    ///
7670    /// `image_id` must satisfy the identifier rules documented on [`LayerId`].
7671    pub fn r#create_image2(
7672        &self,
7673        mut image_id: &ImageId,
7674        mut import_token: BufferCollectionImportToken,
7675        mut vmo_index: u32,
7676        mut properties: &ImageProperties,
7677    ) -> Result<(), fidl::Error> {
7678        Flatland2ProxyInterface::r#create_image2(
7679            self,
7680            image_id,
7681            import_token,
7682            vmo_index,
7683            properties,
7684        )
7685    }
7686
7687    /// Released Images will be garbage collected by the system once they are no longer necessary
7688    /// for rendering. For Images, this means:
7689    /// - the Image is no longer bound to any Layer, and
7690    /// - any pending rendering that references the Image is complete.
7691    ///
7692    /// The `image_id` value is freed for reuse immediately by the client (identifier uniqueness
7693    /// is instantaneous).
7694    ///
7695    /// Note: Per-binding release fences (passed to `SetLayerImage`) are unaffected by this call.
7696    /// They track the lifecycle of individual layer bindings, not the client's `image_id`.
7697    ///
7698    /// `image_id` must refer to a valid, unreleased Image.
7699    pub fn r#release_image2(&self, mut image_id: &ImageId) -> Result<(), fidl::Error> {
7700        Flatland2ProxyInterface::r#release_image2(self, image_id)
7701    }
7702
7703    /// Creates a Viewport resource.
7704    ///
7705    /// `viewport_id` must satisfy the identifier rules documented on [`LayerId`].
7706    pub fn r#create_viewport2(
7707        &self,
7708        mut viewport_id: &ViewportId,
7709        mut token: fidl_fuchsia_ui_views::ViewportCreationToken,
7710        mut properties: &ViewportProperties,
7711        mut child_view_watcher: fidl::endpoints::ServerEnd<ChildViewWatcherMarker>,
7712    ) -> Result<(), fidl::Error> {
7713        Flatland2ProxyInterface::r#create_viewport2(
7714            self,
7715            viewport_id,
7716            token,
7717            properties,
7718            child_view_watcher,
7719        )
7720    }
7721
7722    /// Releases a Viewport from the scene.
7723    pub fn r#release_viewport2(
7724        &self,
7725        mut viewport_id: &ViewportId,
7726    ) -> fidl::client::QueryResponseFut<
7727        fidl_fuchsia_ui_views::ViewportCreationToken,
7728        fidl::encoding::DefaultFuchsiaResourceDialect,
7729    > {
7730        Flatland2ProxyInterface::r#release_viewport2(self, viewport_id)
7731    }
7732
7733    /// Sets the properties of a Viewport.
7734    pub fn r#set_viewport_properties2(
7735        &self,
7736        mut viewport_id: &ViewportId,
7737        mut properties: &ViewportProperties,
7738    ) -> Result<(), fidl::Error> {
7739        Flatland2ProxyInterface::r#set_viewport_properties2(self, viewport_id, properties)
7740    }
7741
7742    /// Sets (or clears) the content of a Transform.
7743    ///
7744    /// The same content may be attached to more than one Transform; each attachment composites
7745    /// that content again under its own Transform's matrix, clip, and opacity, so a single
7746    /// LayerStack or Viewport can appear repeatedly in a scene without the client duplicating the
7747    /// underlying resources.
7748    ///
7749    /// A Transform's content can be cleared by not providing the optional `content`.
7750    ///
7751    /// If `content` is set, it must refer to a valid, unreleased LayerStack or Viewport.
7752    /// Unlike classic [`Flatland.SetContent`], a zero id does not clear the content.
7753    pub fn r#set_transform_content(
7754        &self,
7755        mut transform_id: &TransformId,
7756        mut content: Option<&TransformContent>,
7757    ) -> Result<(), fidl::Error> {
7758        Flatland2ProxyInterface::r#set_transform_content(self, transform_id, content)
7759    }
7760}
7761
7762impl Flatland2ProxyInterface for Flatland2Proxy {
7763    fn r#create_layer(&self, mut layer_id: &LayerId) -> Result<(), fidl::Error> {
7764        self.client.send::<Flatland2CreateLayerRequest>(
7765            (layer_id,),
7766            0x60837bb0ce59f8a9,
7767            fidl::encoding::DynamicFlags::empty(),
7768        )
7769    }
7770
7771    fn r#release_layer(&self, mut layer_id: &LayerId) -> Result<(), fidl::Error> {
7772        self.client.send::<Flatland2ReleaseLayerRequest>(
7773            (layer_id,),
7774            0x60118a842b6f0756,
7775            fidl::encoding::DynamicFlags::empty(),
7776        )
7777    }
7778
7779    fn r#set_layer_image(
7780        &self,
7781        mut layer_id: &LayerId,
7782        mut image_id: &ImageId,
7783        mut acquire_fence: Option<WaitFence>,
7784        mut release_fence: Option<SignalFence>,
7785    ) -> Result<(), fidl::Error> {
7786        self.client.send::<Flatland2SetLayerImageRequest>(
7787            (layer_id, image_id, acquire_fence.as_mut(), release_fence.as_mut()),
7788            0x262302d9782d252c,
7789            fidl::encoding::DynamicFlags::empty(),
7790        )
7791    }
7792
7793    fn r#set_layer_properties(
7794        &self,
7795        mut layer_id: &LayerId,
7796        mut properties: &LayerProperties,
7797    ) -> Result<(), fidl::Error> {
7798        self.client.send::<Flatland2SetLayerPropertiesRequest>(
7799            (layer_id, properties),
7800            0x282d0e902aae8bb0,
7801            fidl::encoding::DynamicFlags::empty(),
7802        )
7803    }
7804
7805    fn r#reset_layer(&self, mut layer_id: &LayerId) -> Result<(), fidl::Error> {
7806        self.client.send::<Flatland2ResetLayerRequest>(
7807            (layer_id,),
7808            0x17bf541bf216ab2b,
7809            fidl::encoding::DynamicFlags::empty(),
7810        )
7811    }
7812
7813    fn r#create_layer_stack(&self, mut stack_id: &LayerStackId) -> Result<(), fidl::Error> {
7814        self.client.send::<Flatland2CreateLayerStackRequest>(
7815            (stack_id,),
7816            0x70debe3cd7371aa6,
7817            fidl::encoding::DynamicFlags::empty(),
7818        )
7819    }
7820
7821    fn r#release_layer_stack(&self, mut stack_id: &LayerStackId) -> Result<(), fidl::Error> {
7822        self.client.send::<Flatland2ReleaseLayerStackRequest>(
7823            (stack_id,),
7824            0x3ad3151aece3b1bb,
7825            fidl::encoding::DynamicFlags::empty(),
7826        )
7827    }
7828
7829    fn r#set_stack_layers(
7830        &self,
7831        mut stack_id: &LayerStackId,
7832        mut layers: &[LayerId],
7833    ) -> Result<(), fidl::Error> {
7834        self.client.send::<Flatland2SetStackLayersRequest>(
7835            (stack_id, layers),
7836            0x1e0bff0f5cca065a,
7837            fidl::encoding::DynamicFlags::empty(),
7838        )
7839    }
7840
7841    fn r#create_image2(
7842        &self,
7843        mut image_id: &ImageId,
7844        mut import_token: BufferCollectionImportToken,
7845        mut vmo_index: u32,
7846        mut properties: &ImageProperties,
7847    ) -> Result<(), fidl::Error> {
7848        self.client.send::<Flatland2CreateImage2Request>(
7849            (image_id, &mut import_token, vmo_index, properties),
7850            0x677fa7b23aaca46,
7851            fidl::encoding::DynamicFlags::empty(),
7852        )
7853    }
7854
7855    fn r#release_image2(&self, mut image_id: &ImageId) -> Result<(), fidl::Error> {
7856        self.client.send::<Flatland2ReleaseImage2Request>(
7857            (image_id,),
7858            0x7d0a041ed51aca06,
7859            fidl::encoding::DynamicFlags::empty(),
7860        )
7861    }
7862
7863    fn r#create_viewport2(
7864        &self,
7865        mut viewport_id: &ViewportId,
7866        mut token: fidl_fuchsia_ui_views::ViewportCreationToken,
7867        mut properties: &ViewportProperties,
7868        mut child_view_watcher: fidl::endpoints::ServerEnd<ChildViewWatcherMarker>,
7869    ) -> Result<(), fidl::Error> {
7870        self.client.send::<Flatland2CreateViewport2Request>(
7871            (viewport_id, &mut token, properties, child_view_watcher),
7872            0x1b646776764f1128,
7873            fidl::encoding::DynamicFlags::empty(),
7874        )
7875    }
7876
7877    type ReleaseViewport2ResponseFut = fidl::client::QueryResponseFut<
7878        fidl_fuchsia_ui_views::ViewportCreationToken,
7879        fidl::encoding::DefaultFuchsiaResourceDialect,
7880    >;
7881    fn r#release_viewport2(
7882        &self,
7883        mut viewport_id: &ViewportId,
7884    ) -> Self::ReleaseViewport2ResponseFut {
7885        fn _decode(
7886            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7887        ) -> Result<fidl_fuchsia_ui_views::ViewportCreationToken, fidl::Error> {
7888            let _response = fidl::client::decode_transaction_body::<
7889                Flatland2ReleaseViewport2Response,
7890                fidl::encoding::DefaultFuchsiaResourceDialect,
7891                0x18ef77414c7a9ae3,
7892            >(_buf?)?;
7893            Ok(_response.token)
7894        }
7895        self.client.send_query_and_decode::<
7896            Flatland2ReleaseViewport2Request,
7897            fidl_fuchsia_ui_views::ViewportCreationToken,
7898        >(
7899            (viewport_id,),
7900            0x18ef77414c7a9ae3,
7901            fidl::encoding::DynamicFlags::empty(),
7902            _decode,
7903        )
7904    }
7905
7906    fn r#set_viewport_properties2(
7907        &self,
7908        mut viewport_id: &ViewportId,
7909        mut properties: &ViewportProperties,
7910    ) -> Result<(), fidl::Error> {
7911        self.client.send::<Flatland2SetViewportProperties2Request>(
7912            (viewport_id, properties),
7913            0x95f2ec3b9e4beea,
7914            fidl::encoding::DynamicFlags::empty(),
7915        )
7916    }
7917
7918    fn r#set_transform_content(
7919        &self,
7920        mut transform_id: &TransformId,
7921        mut content: Option<&TransformContent>,
7922    ) -> Result<(), fidl::Error> {
7923        self.client.send::<Flatland2SetTransformContentRequest>(
7924            (transform_id, content),
7925            0x17e33f64f55e4ea9,
7926            fidl::encoding::DynamicFlags::empty(),
7927        )
7928    }
7929}
7930
7931pub struct Flatland2EventStream {
7932    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
7933}
7934
7935impl std::marker::Unpin for Flatland2EventStream {}
7936
7937impl futures::stream::FusedStream for Flatland2EventStream {
7938    fn is_terminated(&self) -> bool {
7939        self.event_receiver.is_terminated()
7940    }
7941}
7942
7943impl futures::Stream for Flatland2EventStream {
7944    type Item = Result<Flatland2Event, fidl::Error>;
7945
7946    fn poll_next(
7947        mut self: std::pin::Pin<&mut Self>,
7948        cx: &mut std::task::Context<'_>,
7949    ) -> std::task::Poll<Option<Self::Item>> {
7950        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
7951            &mut self.event_receiver,
7952            cx
7953        )?) {
7954            Some(buf) => std::task::Poll::Ready(Some(Flatland2Event::decode(buf))),
7955            None => std::task::Poll::Ready(None),
7956        }
7957    }
7958}
7959
7960#[derive(Debug)]
7961pub enum Flatland2Event {}
7962
7963impl Flatland2Event {
7964    /// Decodes a message buffer as a [`Flatland2Event`].
7965    fn decode(
7966        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
7967    ) -> Result<Flatland2Event, fidl::Error> {
7968        let (bytes, _handles) = buf.split_mut();
7969        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7970        debug_assert_eq!(tx_header.tx_id, 0);
7971        match tx_header.ordinal {
7972            _ => Err(fidl::Error::UnknownOrdinal {
7973                ordinal: tx_header.ordinal,
7974                protocol_name: <Flatland2Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
7975            }),
7976        }
7977    }
7978}
7979
7980/// A Stream of incoming requests for fuchsia.ui.composition/Flatland2.
7981pub struct Flatland2RequestStream {
7982    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7983    is_terminated: bool,
7984}
7985
7986impl std::marker::Unpin for Flatland2RequestStream {}
7987
7988impl futures::stream::FusedStream for Flatland2RequestStream {
7989    fn is_terminated(&self) -> bool {
7990        self.is_terminated
7991    }
7992}
7993
7994impl fidl::endpoints::RequestStream for Flatland2RequestStream {
7995    type Protocol = Flatland2Marker;
7996    type ControlHandle = Flatland2ControlHandle;
7997
7998    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
7999        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
8000    }
8001
8002    fn control_handle(&self) -> Self::ControlHandle {
8003        Flatland2ControlHandle { inner: self.inner.clone() }
8004    }
8005
8006    fn into_inner(
8007        self,
8008    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
8009    {
8010        (self.inner, self.is_terminated)
8011    }
8012
8013    fn from_inner(
8014        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8015        is_terminated: bool,
8016    ) -> Self {
8017        Self { inner, is_terminated }
8018    }
8019}
8020
8021impl futures::Stream for Flatland2RequestStream {
8022    type Item = Result<Flatland2Request, fidl::Error>;
8023
8024    fn poll_next(
8025        mut self: std::pin::Pin<&mut Self>,
8026        cx: &mut std::task::Context<'_>,
8027    ) -> std::task::Poll<Option<Self::Item>> {
8028        let this = &mut *self;
8029        if this.inner.check_shutdown(cx) {
8030            this.is_terminated = true;
8031            return std::task::Poll::Ready(None);
8032        }
8033        if this.is_terminated {
8034            panic!("polled Flatland2RequestStream after completion");
8035        }
8036        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
8037            |bytes, handles| {
8038                match this.inner.channel().read_etc(cx, bytes, handles) {
8039                    std::task::Poll::Ready(Ok(())) => {}
8040                    std::task::Poll::Pending => return std::task::Poll::Pending,
8041                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
8042                        this.is_terminated = true;
8043                        return std::task::Poll::Ready(None);
8044                    }
8045                    std::task::Poll::Ready(Err(e)) => {
8046                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
8047                            e.into(),
8048                        ))));
8049                    }
8050                }
8051
8052                // A message has been received from the channel
8053                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
8054
8055                std::task::Poll::Ready(Some(match header.ordinal {
8056                    0x60837bb0ce59f8a9 => {
8057                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
8058                        let mut req = fidl::new_empty!(
8059                            Flatland2CreateLayerRequest,
8060                            fidl::encoding::DefaultFuchsiaResourceDialect
8061                        );
8062                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<Flatland2CreateLayerRequest>(&header, _body_bytes, handles, &mut req)?;
8063                        let control_handle = Flatland2ControlHandle { inner: this.inner.clone() };
8064                        Ok(Flatland2Request::CreateLayer { layer_id: req.layer_id, control_handle })
8065                    }
8066                    0x60118a842b6f0756 => {
8067                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
8068                        let mut req = fidl::new_empty!(
8069                            Flatland2ReleaseLayerRequest,
8070                            fidl::encoding::DefaultFuchsiaResourceDialect
8071                        );
8072                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<Flatland2ReleaseLayerRequest>(&header, _body_bytes, handles, &mut req)?;
8073                        let control_handle = Flatland2ControlHandle { inner: this.inner.clone() };
8074                        Ok(Flatland2Request::ReleaseLayer {
8075                            layer_id: req.layer_id,
8076
8077                            control_handle,
8078                        })
8079                    }
8080                    0x262302d9782d252c => {
8081                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
8082                        let mut req = fidl::new_empty!(
8083                            Flatland2SetLayerImageRequest,
8084                            fidl::encoding::DefaultFuchsiaResourceDialect
8085                        );
8086                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<Flatland2SetLayerImageRequest>(&header, _body_bytes, handles, &mut req)?;
8087                        let control_handle = Flatland2ControlHandle { inner: this.inner.clone() };
8088                        Ok(Flatland2Request::SetLayerImage {
8089                            layer_id: req.layer_id,
8090                            image_id: req.image_id,
8091                            acquire_fence: req.acquire_fence,
8092                            release_fence: req.release_fence,
8093
8094                            control_handle,
8095                        })
8096                    }
8097                    0x282d0e902aae8bb0 => {
8098                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
8099                        let mut req = fidl::new_empty!(
8100                            Flatland2SetLayerPropertiesRequest,
8101                            fidl::encoding::DefaultFuchsiaResourceDialect
8102                        );
8103                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<Flatland2SetLayerPropertiesRequest>(&header, _body_bytes, handles, &mut req)?;
8104                        let control_handle = Flatland2ControlHandle { inner: this.inner.clone() };
8105                        Ok(Flatland2Request::SetLayerProperties {
8106                            layer_id: req.layer_id,
8107                            properties: req.properties,
8108
8109                            control_handle,
8110                        })
8111                    }
8112                    0x17bf541bf216ab2b => {
8113                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
8114                        let mut req = fidl::new_empty!(
8115                            Flatland2ResetLayerRequest,
8116                            fidl::encoding::DefaultFuchsiaResourceDialect
8117                        );
8118                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<Flatland2ResetLayerRequest>(&header, _body_bytes, handles, &mut req)?;
8119                        let control_handle = Flatland2ControlHandle { inner: this.inner.clone() };
8120                        Ok(Flatland2Request::ResetLayer { layer_id: req.layer_id, control_handle })
8121                    }
8122                    0x70debe3cd7371aa6 => {
8123                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
8124                        let mut req = fidl::new_empty!(
8125                            Flatland2CreateLayerStackRequest,
8126                            fidl::encoding::DefaultFuchsiaResourceDialect
8127                        );
8128                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<Flatland2CreateLayerStackRequest>(&header, _body_bytes, handles, &mut req)?;
8129                        let control_handle = Flatland2ControlHandle { inner: this.inner.clone() };
8130                        Ok(Flatland2Request::CreateLayerStack {
8131                            stack_id: req.stack_id,
8132
8133                            control_handle,
8134                        })
8135                    }
8136                    0x3ad3151aece3b1bb => {
8137                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
8138                        let mut req = fidl::new_empty!(
8139                            Flatland2ReleaseLayerStackRequest,
8140                            fidl::encoding::DefaultFuchsiaResourceDialect
8141                        );
8142                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<Flatland2ReleaseLayerStackRequest>(&header, _body_bytes, handles, &mut req)?;
8143                        let control_handle = Flatland2ControlHandle { inner: this.inner.clone() };
8144                        Ok(Flatland2Request::ReleaseLayerStack {
8145                            stack_id: req.stack_id,
8146
8147                            control_handle,
8148                        })
8149                    }
8150                    0x1e0bff0f5cca065a => {
8151                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
8152                        let mut req = fidl::new_empty!(
8153                            Flatland2SetStackLayersRequest,
8154                            fidl::encoding::DefaultFuchsiaResourceDialect
8155                        );
8156                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<Flatland2SetStackLayersRequest>(&header, _body_bytes, handles, &mut req)?;
8157                        let control_handle = Flatland2ControlHandle { inner: this.inner.clone() };
8158                        Ok(Flatland2Request::SetStackLayers {
8159                            stack_id: req.stack_id,
8160                            layers: req.layers,
8161
8162                            control_handle,
8163                        })
8164                    }
8165                    0x677fa7b23aaca46 => {
8166                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
8167                        let mut req = fidl::new_empty!(
8168                            Flatland2CreateImage2Request,
8169                            fidl::encoding::DefaultFuchsiaResourceDialect
8170                        );
8171                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<Flatland2CreateImage2Request>(&header, _body_bytes, handles, &mut req)?;
8172                        let control_handle = Flatland2ControlHandle { inner: this.inner.clone() };
8173                        Ok(Flatland2Request::CreateImage2 {
8174                            image_id: req.image_id,
8175                            import_token: req.import_token,
8176                            vmo_index: req.vmo_index,
8177                            properties: req.properties,
8178
8179                            control_handle,
8180                        })
8181                    }
8182                    0x7d0a041ed51aca06 => {
8183                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
8184                        let mut req = fidl::new_empty!(
8185                            Flatland2ReleaseImage2Request,
8186                            fidl::encoding::DefaultFuchsiaResourceDialect
8187                        );
8188                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<Flatland2ReleaseImage2Request>(&header, _body_bytes, handles, &mut req)?;
8189                        let control_handle = Flatland2ControlHandle { inner: this.inner.clone() };
8190                        Ok(Flatland2Request::ReleaseImage2 {
8191                            image_id: req.image_id,
8192
8193                            control_handle,
8194                        })
8195                    }
8196                    0x1b646776764f1128 => {
8197                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
8198                        let mut req = fidl::new_empty!(
8199                            Flatland2CreateViewport2Request,
8200                            fidl::encoding::DefaultFuchsiaResourceDialect
8201                        );
8202                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<Flatland2CreateViewport2Request>(&header, _body_bytes, handles, &mut req)?;
8203                        let control_handle = Flatland2ControlHandle { inner: this.inner.clone() };
8204                        Ok(Flatland2Request::CreateViewport2 {
8205                            viewport_id: req.viewport_id,
8206                            token: req.token,
8207                            properties: req.properties,
8208                            child_view_watcher: req.child_view_watcher,
8209
8210                            control_handle,
8211                        })
8212                    }
8213                    0x18ef77414c7a9ae3 => {
8214                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
8215                        let mut req = fidl::new_empty!(
8216                            Flatland2ReleaseViewport2Request,
8217                            fidl::encoding::DefaultFuchsiaResourceDialect
8218                        );
8219                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<Flatland2ReleaseViewport2Request>(&header, _body_bytes, handles, &mut req)?;
8220                        let control_handle = Flatland2ControlHandle { inner: this.inner.clone() };
8221                        Ok(Flatland2Request::ReleaseViewport2 {
8222                            viewport_id: req.viewport_id,
8223
8224                            responder: Flatland2ReleaseViewport2Responder {
8225                                control_handle: std::mem::ManuallyDrop::new(control_handle),
8226                                tx_id: header.tx_id,
8227                            },
8228                        })
8229                    }
8230                    0x95f2ec3b9e4beea => {
8231                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
8232                        let mut req = fidl::new_empty!(
8233                            Flatland2SetViewportProperties2Request,
8234                            fidl::encoding::DefaultFuchsiaResourceDialect
8235                        );
8236                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<Flatland2SetViewportProperties2Request>(&header, _body_bytes, handles, &mut req)?;
8237                        let control_handle = Flatland2ControlHandle { inner: this.inner.clone() };
8238                        Ok(Flatland2Request::SetViewportProperties2 {
8239                            viewport_id: req.viewport_id,
8240                            properties: req.properties,
8241
8242                            control_handle,
8243                        })
8244                    }
8245                    0x17e33f64f55e4ea9 => {
8246                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
8247                        let mut req = fidl::new_empty!(
8248                            Flatland2SetTransformContentRequest,
8249                            fidl::encoding::DefaultFuchsiaResourceDialect
8250                        );
8251                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<Flatland2SetTransformContentRequest>(&header, _body_bytes, handles, &mut req)?;
8252                        let control_handle = Flatland2ControlHandle { inner: this.inner.clone() };
8253                        Ok(Flatland2Request::SetTransformContent {
8254                            transform_id: req.transform_id,
8255                            content: req.content,
8256
8257                            control_handle,
8258                        })
8259                    }
8260                    _ => Err(fidl::Error::UnknownOrdinal {
8261                        ordinal: header.ordinal,
8262                        protocol_name:
8263                            <Flatland2Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
8264                    }),
8265                }))
8266            },
8267        )
8268    }
8269}
8270
8271/// This protocol is composed into the "classic" [`Flatland`] protocol, and
8272/// cleans up some "warts" in the original design.
8273///
8274/// All methods defined in this protocol are ONLY available when Flatland2 is enabled
8275/// (e.g. via [`TrustedFlatlandConfig.use_flatland2_api`]). Calling these methods
8276/// when Flatland2 is not enabled will result in a channel closure.
8277///
8278/// Broadly speaking, the "warts" involve properties that are set on images when they shouldn't be.
8279/// For example, it should be possible to display two copies of the same image side by side, with
8280/// one image flipped `LEFT_RIGHT` to reflect the other.  This is impossible in the classic Flatland
8281/// API, because the flip is a property of the image.  In Flatland2, the flip is a property of
8282/// the layer, and the client's goal is easily achieved with two layers with the same image and
8283/// different flips.
8284///
8285/// Certain "classic" Flatland methods are disabled/illegal when Flatland2 is enabled.
8286/// Eventually these methods will be removed; Flatland2 will be the standard way to display
8287/// images in Flatland.  Until then, this "opt in" approach provides clients with a convenient way
8288/// to migrate to this modernized API.  The disabled methods are:
8289/// - [`fuchsia.ui.composition/Flatland.CreateFilledRect`]
8290/// - [`fuchsia.ui.composition/Flatland.CreateImage`]
8291/// - [`fuchsia.ui.composition/Flatland.CreateViewport`]
8292/// - [`fuchsia.ui.composition/Flatland.ReleaseFilledRect`]
8293/// - [`fuchsia.ui.composition/Flatland.ReleaseImage`]
8294/// - [`fuchsia.ui.composition/Flatland.ReleaseViewport`]
8295/// - [`fuchsia.ui.composition/Flatland.SetContent`]
8296/// - [`fuchsia.ui.composition/Flatland.SetImageBlendingFunction`]
8297/// - [`fuchsia.ui.composition/Flatland.SetImageBlendMode`]
8298/// - [`fuchsia.ui.composition/Flatland.SetImageDestinationSize`]
8299/// - [`fuchsia.ui.composition/Flatland.SetImageFlip`]
8300/// - [`fuchsia.ui.composition/Flatland.SetImageOpacity`]
8301/// - [`fuchsia.ui.composition/Flatland.SetSolidFill`]
8302/// - [`fuchsia.ui.composition/Flatland.SetImageSampleRegion`]
8303/// - [`fuchsia.ui.composition/Flatland.SetViewportProperties`]
8304/// - [`fuchsia.ui.composition/TrustedFlatland.ReleaseImageImmediately`]
8305#[derive(Debug)]
8306pub enum Flatland2Request {
8307    /// A Layer is a type of `Content` that composites either a single `Image` or a solid
8308    /// color. It separates visual properties (such as size, flip, opacity, and blending)
8309    /// from the raw pixel data.
8310    ///
8311    /// Unlike typical `Content` items which represent a static visual resource, a Layer is designed
8312    /// to be a dynamic container for an image sequence. Typical usage involves setting the layer's
8313    /// visual properties and image metadata infrequently, and then rapidly swapping the active
8314    /// `Image` (e.g. on every frame) with another image of matching metadata.
8315    ///
8316    /// This separation allows a single `Image` resource to be reused across multiple layers with
8317    /// different visual configurations simultaneously.
8318    ///
8319    /// To use a Layer:
8320    /// 1. Create a `Layer` using [`CreateLayer`].
8321    /// 2. Set properties on the `Layer` via [`SetLayerProperties`], including the
8322    ///    composition mode.
8323    /// 3. For an image layer, associate an `Image` with the `Layer` via [`SetLayerImage`].
8324    /// 4. Add the `Layer` to a `LayerStack` via [`SetStackLayers`].
8325    /// 5. Set the `LayerStack` as the content of a node via [`SetTransformContent`].
8326    ///
8327    /// `layer_id` must satisfy the identifier rules documented on [`LayerId`].
8328    CreateLayer { layer_id: LayerId, control_handle: Flatland2ControlHandle },
8329    /// Released Layers will be garbage collected by the system once they are no longer necessary
8330    /// for rendering. For Layers, this means:
8331    /// - the Layer is no longer referenced by any LayerStack, and
8332    /// - any pending rendering that references the Layer is complete.
8333    ///
8334    /// `layer_id` must refer to a valid, unreleased Layer.
8335    ReleaseLayer { layer_id: LayerId, control_handle: Flatland2ControlHandle },
8336    /// Associates an Image with the Layer.
8337    ///
8338    /// The binding is legal in any composition mode, and is sticky: it survives composition
8339    /// mode changes, and is replaced only by a later [`SetLayerImage`] call (or cleared by
8340    /// [`ResetLayer`]). The image is displayed only while the layer's composition mode is
8341    /// `IMAGE`.
8342    ///
8343    /// The bound image must be large enough for the layer's stored `sample_rect`; this is
8344    /// checked at [`fuchsia.ui.composition/Flatland.Present`], not here. See
8345    /// [`LayerProperties.sample_rect`].
8346    ///
8347    /// `layer_id` must refer to a valid, unreleased Layer.
8348    /// `image_id` must refer to a valid, unreleased Image.
8349    /// `acquire_fence` is an optional fence that must be signaled before the image is displayed.
8350    /// `release_fence` is an optional fence, signaled by Scenic when *this binding* no
8351    /// longer references the image. It is per-binding, not per-image: an image bound to
8352    /// several layers has one such fence per binding, and the image is safe to write only
8353    /// once every one of them has signaled.
8354    ///
8355    /// A binding is ended by:
8356    ///
8357    /// - being superseded by a later [`SetLayerImage`] on the same layer
8358    /// - [`ResetLayer`]
8359    /// - the layer ref-count reaching zero, either via [`ReleaseLayer`] or by being released
8360    ///   by a layer stack
8361    /// - destruction of the session, which ends every binding it holds
8362    ///
8363    /// For a binding ended while the session is alive, Scenic signals at the first frame
8364    /// retire after that point. Bindings that never reached the screen (e.g. one superseded
8365    /// within a single batch, or one lost when several
8366    /// [`fuchsia.ui.composition/Flatland.Present`] calls are squashed into a single
8367    /// frame) signal at that same retire rather than immediately. The signal is
8368    /// therefore conservative by at most one frame; it is never early.
8369    SetLayerImage {
8370        layer_id: LayerId,
8371        image_id: ImageId,
8372        acquire_fence: Option<Box<WaitFence>>,
8373        release_fence: Option<Box<SignalFence>>,
8374        control_handle: Flatland2ControlHandle,
8375    },
8376    /// Sets properties of the Layer.
8377    ///
8378    /// The provided `properties` table is merged into the layer's stored properties: fields
8379    /// which are unset in `properties` retain their previously stored values. Stored
8380    /// properties are sticky; see [`LayerProperties`] for the full persistence semantics.
8381    ///
8382    /// Values are stored as given; validation which depends on other state (notably
8383    /// `sample_rect` against the bound image) happens at
8384    /// [`fuchsia.ui.composition/Flatland.Present`]. See [`LayerProperties.sample_rect`].
8385    ///
8386    /// `layer_id` must refer to a valid, unreleased Layer.
8387    SetLayerProperties {
8388        layer_id: LayerId,
8389        properties: LayerProperties,
8390        control_handle: Flatland2ControlHandle,
8391    },
8392    /// Unbinds any Image bound to the layer and clears every stored [`LayerProperties`]
8393    /// field, returning the layer to its freshly-created state (composition mode
8394    /// `INVISIBLE`, all properties at their documented defaults). This is the only
8395    /// operation which forgets stored layer properties.
8396    ///
8397    /// `layer_id` must refer to a valid, unreleased Layer.
8398    ResetLayer { layer_id: LayerId, control_handle: Flatland2ControlHandle },
8399    /// Creates a new layer stack with the specified `stack_id`.
8400    ///
8401    /// `stack_id` must satisfy the identifier rules documented on [`LayerId`].
8402    CreateLayerStack { stack_id: LayerStackId, control_handle: Flatland2ControlHandle },
8403    /// Releases the layer stack with the specified `stack_id`.
8404    ReleaseLayerStack { stack_id: LayerStackId, control_handle: Flatland2ControlHandle },
8405    /// Sets the layers in the stack. The order of layers in the vector determines their Z-order,
8406    /// with the first element being the back-most and the last element being the front-most.
8407    ///
8408    /// `stack_id` must refer to a valid, unreleased LayerStack. Each element of `layers`
8409    /// must refer to a valid, unreleased Layer. Duplicate layers within `layers` are
8410    /// disallowed.
8411    SetStackLayers {
8412        stack_id: LayerStackId,
8413        layers: Vec<LayerId>,
8414        control_handle: Flatland2ControlHandle,
8415    },
8416    /// Creates an Image resource.
8417    ///
8418    /// `image_id` must satisfy the identifier rules documented on [`LayerId`].
8419    CreateImage2 {
8420        image_id: ImageId,
8421        import_token: BufferCollectionImportToken,
8422        vmo_index: u32,
8423        properties: ImageProperties,
8424        control_handle: Flatland2ControlHandle,
8425    },
8426    /// Released Images will be garbage collected by the system once they are no longer necessary
8427    /// for rendering. For Images, this means:
8428    /// - the Image is no longer bound to any Layer, and
8429    /// - any pending rendering that references the Image is complete.
8430    ///
8431    /// The `image_id` value is freed for reuse immediately by the client (identifier uniqueness
8432    /// is instantaneous).
8433    ///
8434    /// Note: Per-binding release fences (passed to `SetLayerImage`) are unaffected by this call.
8435    /// They track the lifecycle of individual layer bindings, not the client's `image_id`.
8436    ///
8437    /// `image_id` must refer to a valid, unreleased Image.
8438    ReleaseImage2 { image_id: ImageId, control_handle: Flatland2ControlHandle },
8439    /// Creates a Viewport resource.
8440    ///
8441    /// `viewport_id` must satisfy the identifier rules documented on [`LayerId`].
8442    CreateViewport2 {
8443        viewport_id: ViewportId,
8444        token: fidl_fuchsia_ui_views::ViewportCreationToken,
8445        properties: ViewportProperties,
8446        child_view_watcher: fidl::endpoints::ServerEnd<ChildViewWatcherMarker>,
8447        control_handle: Flatland2ControlHandle,
8448    },
8449    /// Releases a Viewport from the scene.
8450    ReleaseViewport2 { viewport_id: ViewportId, responder: Flatland2ReleaseViewport2Responder },
8451    /// Sets the properties of a Viewport.
8452    SetViewportProperties2 {
8453        viewport_id: ViewportId,
8454        properties: ViewportProperties,
8455        control_handle: Flatland2ControlHandle,
8456    },
8457    /// Sets (or clears) the content of a Transform.
8458    ///
8459    /// The same content may be attached to more than one Transform; each attachment composites
8460    /// that content again under its own Transform's matrix, clip, and opacity, so a single
8461    /// LayerStack or Viewport can appear repeatedly in a scene without the client duplicating the
8462    /// underlying resources.
8463    ///
8464    /// A Transform's content can be cleared by not providing the optional `content`.
8465    ///
8466    /// If `content` is set, it must refer to a valid, unreleased LayerStack or Viewport.
8467    /// Unlike classic [`Flatland.SetContent`], a zero id does not clear the content.
8468    SetTransformContent {
8469        transform_id: TransformId,
8470        content: Option<Box<TransformContent>>,
8471        control_handle: Flatland2ControlHandle,
8472    },
8473}
8474
8475impl Flatland2Request {
8476    #[allow(irrefutable_let_patterns)]
8477    pub fn into_create_layer(self) -> Option<(LayerId, Flatland2ControlHandle)> {
8478        if let Flatland2Request::CreateLayer { layer_id, control_handle } = self {
8479            Some((layer_id, control_handle))
8480        } else {
8481            None
8482        }
8483    }
8484
8485    #[allow(irrefutable_let_patterns)]
8486    pub fn into_release_layer(self) -> Option<(LayerId, Flatland2ControlHandle)> {
8487        if let Flatland2Request::ReleaseLayer { layer_id, control_handle } = self {
8488            Some((layer_id, control_handle))
8489        } else {
8490            None
8491        }
8492    }
8493
8494    #[allow(irrefutable_let_patterns)]
8495    pub fn into_set_layer_image(
8496        self,
8497    ) -> Option<(
8498        LayerId,
8499        ImageId,
8500        Option<Box<WaitFence>>,
8501        Option<Box<SignalFence>>,
8502        Flatland2ControlHandle,
8503    )> {
8504        if let Flatland2Request::SetLayerImage {
8505            layer_id,
8506            image_id,
8507            acquire_fence,
8508            release_fence,
8509            control_handle,
8510        } = self
8511        {
8512            Some((layer_id, image_id, acquire_fence, release_fence, control_handle))
8513        } else {
8514            None
8515        }
8516    }
8517
8518    #[allow(irrefutable_let_patterns)]
8519    pub fn into_set_layer_properties(
8520        self,
8521    ) -> Option<(LayerId, LayerProperties, Flatland2ControlHandle)> {
8522        if let Flatland2Request::SetLayerProperties { layer_id, properties, control_handle } = self
8523        {
8524            Some((layer_id, properties, control_handle))
8525        } else {
8526            None
8527        }
8528    }
8529
8530    #[allow(irrefutable_let_patterns)]
8531    pub fn into_reset_layer(self) -> Option<(LayerId, Flatland2ControlHandle)> {
8532        if let Flatland2Request::ResetLayer { layer_id, control_handle } = self {
8533            Some((layer_id, control_handle))
8534        } else {
8535            None
8536        }
8537    }
8538
8539    #[allow(irrefutable_let_patterns)]
8540    pub fn into_create_layer_stack(self) -> Option<(LayerStackId, Flatland2ControlHandle)> {
8541        if let Flatland2Request::CreateLayerStack { stack_id, control_handle } = self {
8542            Some((stack_id, control_handle))
8543        } else {
8544            None
8545        }
8546    }
8547
8548    #[allow(irrefutable_let_patterns)]
8549    pub fn into_release_layer_stack(self) -> Option<(LayerStackId, Flatland2ControlHandle)> {
8550        if let Flatland2Request::ReleaseLayerStack { stack_id, control_handle } = self {
8551            Some((stack_id, control_handle))
8552        } else {
8553            None
8554        }
8555    }
8556
8557    #[allow(irrefutable_let_patterns)]
8558    pub fn into_set_stack_layers(
8559        self,
8560    ) -> Option<(LayerStackId, Vec<LayerId>, Flatland2ControlHandle)> {
8561        if let Flatland2Request::SetStackLayers { stack_id, layers, control_handle } = self {
8562            Some((stack_id, layers, control_handle))
8563        } else {
8564            None
8565        }
8566    }
8567
8568    #[allow(irrefutable_let_patterns)]
8569    pub fn into_create_image2(
8570        self,
8571    ) -> Option<(ImageId, BufferCollectionImportToken, u32, ImageProperties, Flatland2ControlHandle)>
8572    {
8573        if let Flatland2Request::CreateImage2 {
8574            image_id,
8575            import_token,
8576            vmo_index,
8577            properties,
8578            control_handle,
8579        } = self
8580        {
8581            Some((image_id, import_token, vmo_index, properties, control_handle))
8582        } else {
8583            None
8584        }
8585    }
8586
8587    #[allow(irrefutable_let_patterns)]
8588    pub fn into_release_image2(self) -> Option<(ImageId, Flatland2ControlHandle)> {
8589        if let Flatland2Request::ReleaseImage2 { image_id, control_handle } = self {
8590            Some((image_id, control_handle))
8591        } else {
8592            None
8593        }
8594    }
8595
8596    #[allow(irrefutable_let_patterns)]
8597    pub fn into_create_viewport2(
8598        self,
8599    ) -> Option<(
8600        ViewportId,
8601        fidl_fuchsia_ui_views::ViewportCreationToken,
8602        ViewportProperties,
8603        fidl::endpoints::ServerEnd<ChildViewWatcherMarker>,
8604        Flatland2ControlHandle,
8605    )> {
8606        if let Flatland2Request::CreateViewport2 {
8607            viewport_id,
8608            token,
8609            properties,
8610            child_view_watcher,
8611            control_handle,
8612        } = self
8613        {
8614            Some((viewport_id, token, properties, child_view_watcher, control_handle))
8615        } else {
8616            None
8617        }
8618    }
8619
8620    #[allow(irrefutable_let_patterns)]
8621    pub fn into_release_viewport2(
8622        self,
8623    ) -> Option<(ViewportId, Flatland2ReleaseViewport2Responder)> {
8624        if let Flatland2Request::ReleaseViewport2 { viewport_id, responder } = self {
8625            Some((viewport_id, responder))
8626        } else {
8627            None
8628        }
8629    }
8630
8631    #[allow(irrefutable_let_patterns)]
8632    pub fn into_set_viewport_properties2(
8633        self,
8634    ) -> Option<(ViewportId, ViewportProperties, Flatland2ControlHandle)> {
8635        if let Flatland2Request::SetViewportProperties2 {
8636            viewport_id,
8637            properties,
8638            control_handle,
8639        } = self
8640        {
8641            Some((viewport_id, properties, control_handle))
8642        } else {
8643            None
8644        }
8645    }
8646
8647    #[allow(irrefutable_let_patterns)]
8648    pub fn into_set_transform_content(
8649        self,
8650    ) -> Option<(TransformId, Option<Box<TransformContent>>, Flatland2ControlHandle)> {
8651        if let Flatland2Request::SetTransformContent { transform_id, content, control_handle } =
8652            self
8653        {
8654            Some((transform_id, content, control_handle))
8655        } else {
8656            None
8657        }
8658    }
8659
8660    /// Name of the method defined in FIDL
8661    pub fn method_name(&self) -> &'static str {
8662        match *self {
8663            Flatland2Request::CreateLayer { .. } => "create_layer",
8664            Flatland2Request::ReleaseLayer { .. } => "release_layer",
8665            Flatland2Request::SetLayerImage { .. } => "set_layer_image",
8666            Flatland2Request::SetLayerProperties { .. } => "set_layer_properties",
8667            Flatland2Request::ResetLayer { .. } => "reset_layer",
8668            Flatland2Request::CreateLayerStack { .. } => "create_layer_stack",
8669            Flatland2Request::ReleaseLayerStack { .. } => "release_layer_stack",
8670            Flatland2Request::SetStackLayers { .. } => "set_stack_layers",
8671            Flatland2Request::CreateImage2 { .. } => "create_image2",
8672            Flatland2Request::ReleaseImage2 { .. } => "release_image2",
8673            Flatland2Request::CreateViewport2 { .. } => "create_viewport2",
8674            Flatland2Request::ReleaseViewport2 { .. } => "release_viewport2",
8675            Flatland2Request::SetViewportProperties2 { .. } => "set_viewport_properties2",
8676            Flatland2Request::SetTransformContent { .. } => "set_transform_content",
8677        }
8678    }
8679}
8680
8681#[derive(Debug, Clone)]
8682pub struct Flatland2ControlHandle {
8683    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8684}
8685
8686impl Flatland2ControlHandle {
8687    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
8688        self.inner.shutdown_with_epitaph(status.into())
8689    }
8690}
8691
8692impl fidl::endpoints::ControlHandle for Flatland2ControlHandle {
8693    fn shutdown(&self) {
8694        self.inner.shutdown()
8695    }
8696
8697    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
8698        self.inner.shutdown_with_epitaph(status)
8699    }
8700
8701    fn is_closed(&self) -> bool {
8702        self.inner.channel().is_closed()
8703    }
8704    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
8705        self.inner.channel().on_closed()
8706    }
8707
8708    #[cfg(target_os = "fuchsia")]
8709    fn signal_peer(
8710        &self,
8711        clear_mask: zx::Signals,
8712        set_mask: zx::Signals,
8713    ) -> Result<(), zx_status::Status> {
8714        use fidl::Peered;
8715        self.inner.channel().signal_peer(clear_mask, set_mask)
8716    }
8717}
8718
8719impl Flatland2ControlHandle {}
8720
8721#[must_use = "FIDL methods require a response to be sent"]
8722#[derive(Debug)]
8723pub struct Flatland2ReleaseViewport2Responder {
8724    control_handle: std::mem::ManuallyDrop<Flatland2ControlHandle>,
8725    tx_id: u32,
8726}
8727
8728/// Set the the channel to be shutdown (see [`Flatland2ControlHandle::shutdown`])
8729/// if the responder is dropped without sending a response, so that the client
8730/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
8731impl std::ops::Drop for Flatland2ReleaseViewport2Responder {
8732    fn drop(&mut self) {
8733        self.control_handle.shutdown();
8734        // Safety: drops once, never accessed again
8735        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8736    }
8737}
8738
8739impl fidl::endpoints::Responder for Flatland2ReleaseViewport2Responder {
8740    type ControlHandle = Flatland2ControlHandle;
8741
8742    fn control_handle(&self) -> &Flatland2ControlHandle {
8743        &self.control_handle
8744    }
8745
8746    fn drop_without_shutdown(mut self) {
8747        // Safety: drops once, never accessed again due to mem::forget
8748        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8749        // Prevent Drop from running (which would shut down the channel)
8750        std::mem::forget(self);
8751    }
8752}
8753
8754impl Flatland2ReleaseViewport2Responder {
8755    /// Sends a response to the FIDL transaction.
8756    ///
8757    /// Sets the channel to shutdown if an error occurs.
8758    pub fn send(
8759        self,
8760        mut token: fidl_fuchsia_ui_views::ViewportCreationToken,
8761    ) -> Result<(), fidl::Error> {
8762        let _result = self.send_raw(token);
8763        if _result.is_err() {
8764            self.control_handle.shutdown();
8765        }
8766        self.drop_without_shutdown();
8767        _result
8768    }
8769
8770    /// Similar to "send" but does not shutdown the channel if an error occurs.
8771    pub fn send_no_shutdown_on_err(
8772        self,
8773        mut token: fidl_fuchsia_ui_views::ViewportCreationToken,
8774    ) -> Result<(), fidl::Error> {
8775        let _result = self.send_raw(token);
8776        self.drop_without_shutdown();
8777        _result
8778    }
8779
8780    fn send_raw(
8781        &self,
8782        mut token: fidl_fuchsia_ui_views::ViewportCreationToken,
8783    ) -> Result<(), fidl::Error> {
8784        self.control_handle.inner.send::<Flatland2ReleaseViewport2Response>(
8785            (&mut token,),
8786            self.tx_id,
8787            0x18ef77414c7a9ae3,
8788            fidl::encoding::DynamicFlags::empty(),
8789        )
8790    }
8791}
8792
8793#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
8794pub struct FlatlandDisplayMarker;
8795
8796impl fidl::endpoints::ProtocolMarker for FlatlandDisplayMarker {
8797    type Proxy = FlatlandDisplayProxy;
8798    type RequestStream = FlatlandDisplayRequestStream;
8799    #[cfg(target_os = "fuchsia")]
8800    type SynchronousProxy = FlatlandDisplaySynchronousProxy;
8801
8802    const DEBUG_NAME: &'static str = "fuchsia.ui.composition.FlatlandDisplay";
8803}
8804impl fidl::endpoints::DiscoverableProtocolMarker for FlatlandDisplayMarker {}
8805
8806pub trait FlatlandDisplayProxyInterface: Send + Sync {
8807    fn r#set_content(
8808        &self,
8809        token: fidl_fuchsia_ui_views::ViewportCreationToken,
8810        child_view_watcher: fidl::endpoints::ServerEnd<ChildViewWatcherMarker>,
8811    ) -> Result<(), fidl::Error>;
8812    fn r#set_device_pixel_ratio(
8813        &self,
8814        device_pixel_ratio: &fidl_fuchsia_math::VecF,
8815    ) -> Result<(), fidl::Error>;
8816}
8817#[derive(Debug)]
8818#[cfg(target_os = "fuchsia")]
8819pub struct FlatlandDisplaySynchronousProxy {
8820    client: fidl::client::sync::Client,
8821}
8822
8823#[cfg(target_os = "fuchsia")]
8824impl fidl::endpoints::SynchronousProxy for FlatlandDisplaySynchronousProxy {
8825    type Proxy = FlatlandDisplayProxy;
8826    type Protocol = FlatlandDisplayMarker;
8827
8828    fn from_channel(inner: fidl::Channel) -> Self {
8829        Self::new(inner)
8830    }
8831
8832    fn into_channel(self) -> fidl::Channel {
8833        self.client.into_channel()
8834    }
8835
8836    fn as_channel(&self) -> &fidl::Channel {
8837        self.client.as_channel()
8838    }
8839}
8840
8841#[cfg(target_os = "fuchsia")]
8842impl FlatlandDisplaySynchronousProxy {
8843    pub fn new(channel: fidl::Channel) -> Self {
8844        Self { client: fidl::client::sync::Client::new(channel) }
8845    }
8846
8847    pub fn into_channel(self) -> fidl::Channel {
8848        self.client.into_channel()
8849    }
8850
8851    /// Waits until an event arrives and returns it. It is safe for other
8852    /// threads to make concurrent requests while waiting for an event.
8853    pub fn wait_for_event(
8854        &self,
8855        deadline: zx::MonotonicInstant,
8856    ) -> Result<FlatlandDisplayEvent, fidl::Error> {
8857        FlatlandDisplayEvent::decode(self.client.wait_for_event::<FlatlandDisplayMarker>(deadline)?)
8858    }
8859
8860    pub fn r#set_content(
8861        &self,
8862        mut token: fidl_fuchsia_ui_views::ViewportCreationToken,
8863        mut child_view_watcher: fidl::endpoints::ServerEnd<ChildViewWatcherMarker>,
8864    ) -> Result<(), fidl::Error> {
8865        self.client.send::<FlatlandDisplaySetContentRequest>(
8866            (&mut token, child_view_watcher),
8867            0x6748193a39918298,
8868            fidl::encoding::DynamicFlags::empty(),
8869        )
8870    }
8871
8872    /// Sets the ratio of display's physical pixels to device independent pixels that should be used
8873    /// for the tree of Flatland content that are attached to this display. See
8874    /// [`LayoutInfo.device_pixel_ratio`] for details.
8875    ///
8876    /// The default value is (1.0, 1.0). The valid values are 1.0 and above.
8877    pub fn r#set_device_pixel_ratio(
8878        &self,
8879        mut device_pixel_ratio: &fidl_fuchsia_math::VecF,
8880    ) -> Result<(), fidl::Error> {
8881        self.client.send::<FlatlandDisplaySetDevicePixelRatioRequest>(
8882            (device_pixel_ratio,),
8883            0x392c3e70cc0a81a4,
8884            fidl::encoding::DynamicFlags::empty(),
8885        )
8886    }
8887}
8888
8889#[cfg(target_os = "fuchsia")]
8890impl From<FlatlandDisplaySynchronousProxy> for zx::NullableHandle {
8891    fn from(value: FlatlandDisplaySynchronousProxy) -> Self {
8892        value.into_channel().into()
8893    }
8894}
8895
8896#[cfg(target_os = "fuchsia")]
8897impl From<fidl::Channel> for FlatlandDisplaySynchronousProxy {
8898    fn from(value: fidl::Channel) -> Self {
8899        Self::new(value)
8900    }
8901}
8902
8903#[cfg(target_os = "fuchsia")]
8904impl fidl::endpoints::FromClient for FlatlandDisplaySynchronousProxy {
8905    type Protocol = FlatlandDisplayMarker;
8906
8907    fn from_client(value: fidl::endpoints::ClientEnd<FlatlandDisplayMarker>) -> Self {
8908        Self::new(value.into_channel())
8909    }
8910}
8911
8912#[derive(Debug, Clone)]
8913pub struct FlatlandDisplayProxy {
8914    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
8915}
8916
8917impl fidl::endpoints::Proxy for FlatlandDisplayProxy {
8918    type Protocol = FlatlandDisplayMarker;
8919
8920    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
8921        Self::new(inner)
8922    }
8923
8924    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
8925        self.client.into_channel().map_err(|client| Self { client })
8926    }
8927
8928    fn as_channel(&self) -> &::fidl::AsyncChannel {
8929        self.client.as_channel()
8930    }
8931}
8932
8933impl FlatlandDisplayProxy {
8934    /// Create a new Proxy for fuchsia.ui.composition/FlatlandDisplay.
8935    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
8936        let protocol_name = <FlatlandDisplayMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
8937        Self { client: fidl::client::Client::new(channel, protocol_name) }
8938    }
8939
8940    /// Get a Stream of events from the remote end of the protocol.
8941    ///
8942    /// # Panics
8943    ///
8944    /// Panics if the event stream was already taken.
8945    pub fn take_event_stream(&self) -> FlatlandDisplayEventStream {
8946        FlatlandDisplayEventStream { event_receiver: self.client.take_event_receiver() }
8947    }
8948
8949    pub fn r#set_content(
8950        &self,
8951        mut token: fidl_fuchsia_ui_views::ViewportCreationToken,
8952        mut child_view_watcher: fidl::endpoints::ServerEnd<ChildViewWatcherMarker>,
8953    ) -> Result<(), fidl::Error> {
8954        FlatlandDisplayProxyInterface::r#set_content(self, token, child_view_watcher)
8955    }
8956
8957    /// Sets the ratio of display's physical pixels to device independent pixels that should be used
8958    /// for the tree of Flatland content that are attached to this display. See
8959    /// [`LayoutInfo.device_pixel_ratio`] for details.
8960    ///
8961    /// The default value is (1.0, 1.0). The valid values are 1.0 and above.
8962    pub fn r#set_device_pixel_ratio(
8963        &self,
8964        mut device_pixel_ratio: &fidl_fuchsia_math::VecF,
8965    ) -> Result<(), fidl::Error> {
8966        FlatlandDisplayProxyInterface::r#set_device_pixel_ratio(self, device_pixel_ratio)
8967    }
8968}
8969
8970impl FlatlandDisplayProxyInterface for FlatlandDisplayProxy {
8971    fn r#set_content(
8972        &self,
8973        mut token: fidl_fuchsia_ui_views::ViewportCreationToken,
8974        mut child_view_watcher: fidl::endpoints::ServerEnd<ChildViewWatcherMarker>,
8975    ) -> Result<(), fidl::Error> {
8976        self.client.send::<FlatlandDisplaySetContentRequest>(
8977            (&mut token, child_view_watcher),
8978            0x6748193a39918298,
8979            fidl::encoding::DynamicFlags::empty(),
8980        )
8981    }
8982
8983    fn r#set_device_pixel_ratio(
8984        &self,
8985        mut device_pixel_ratio: &fidl_fuchsia_math::VecF,
8986    ) -> Result<(), fidl::Error> {
8987        self.client.send::<FlatlandDisplaySetDevicePixelRatioRequest>(
8988            (device_pixel_ratio,),
8989            0x392c3e70cc0a81a4,
8990            fidl::encoding::DynamicFlags::empty(),
8991        )
8992    }
8993}
8994
8995pub struct FlatlandDisplayEventStream {
8996    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
8997}
8998
8999impl std::marker::Unpin for FlatlandDisplayEventStream {}
9000
9001impl futures::stream::FusedStream for FlatlandDisplayEventStream {
9002    fn is_terminated(&self) -> bool {
9003        self.event_receiver.is_terminated()
9004    }
9005}
9006
9007impl futures::Stream for FlatlandDisplayEventStream {
9008    type Item = Result<FlatlandDisplayEvent, fidl::Error>;
9009
9010    fn poll_next(
9011        mut self: std::pin::Pin<&mut Self>,
9012        cx: &mut std::task::Context<'_>,
9013    ) -> std::task::Poll<Option<Self::Item>> {
9014        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
9015            &mut self.event_receiver,
9016            cx
9017        )?) {
9018            Some(buf) => std::task::Poll::Ready(Some(FlatlandDisplayEvent::decode(buf))),
9019            None => std::task::Poll::Ready(None),
9020        }
9021    }
9022}
9023
9024#[derive(Debug)]
9025pub enum FlatlandDisplayEvent {}
9026
9027impl FlatlandDisplayEvent {
9028    /// Decodes a message buffer as a [`FlatlandDisplayEvent`].
9029    fn decode(
9030        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
9031    ) -> Result<FlatlandDisplayEvent, fidl::Error> {
9032        let (bytes, _handles) = buf.split_mut();
9033        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
9034        debug_assert_eq!(tx_header.tx_id, 0);
9035        match tx_header.ordinal {
9036            _ => Err(fidl::Error::UnknownOrdinal {
9037                ordinal: tx_header.ordinal,
9038                protocol_name:
9039                    <FlatlandDisplayMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
9040            }),
9041        }
9042    }
9043}
9044
9045/// A Stream of incoming requests for fuchsia.ui.composition/FlatlandDisplay.
9046pub struct FlatlandDisplayRequestStream {
9047    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
9048    is_terminated: bool,
9049}
9050
9051impl std::marker::Unpin for FlatlandDisplayRequestStream {}
9052
9053impl futures::stream::FusedStream for FlatlandDisplayRequestStream {
9054    fn is_terminated(&self) -> bool {
9055        self.is_terminated
9056    }
9057}
9058
9059impl fidl::endpoints::RequestStream for FlatlandDisplayRequestStream {
9060    type Protocol = FlatlandDisplayMarker;
9061    type ControlHandle = FlatlandDisplayControlHandle;
9062
9063    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
9064        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
9065    }
9066
9067    fn control_handle(&self) -> Self::ControlHandle {
9068        FlatlandDisplayControlHandle { inner: self.inner.clone() }
9069    }
9070
9071    fn into_inner(
9072        self,
9073    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
9074    {
9075        (self.inner, self.is_terminated)
9076    }
9077
9078    fn from_inner(
9079        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
9080        is_terminated: bool,
9081    ) -> Self {
9082        Self { inner, is_terminated }
9083    }
9084}
9085
9086impl futures::Stream for FlatlandDisplayRequestStream {
9087    type Item = Result<FlatlandDisplayRequest, fidl::Error>;
9088
9089    fn poll_next(
9090        mut self: std::pin::Pin<&mut Self>,
9091        cx: &mut std::task::Context<'_>,
9092    ) -> std::task::Poll<Option<Self::Item>> {
9093        let this = &mut *self;
9094        if this.inner.check_shutdown(cx) {
9095            this.is_terminated = true;
9096            return std::task::Poll::Ready(None);
9097        }
9098        if this.is_terminated {
9099            panic!("polled FlatlandDisplayRequestStream after completion");
9100        }
9101        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
9102            |bytes, handles| {
9103                match this.inner.channel().read_etc(cx, bytes, handles) {
9104                    std::task::Poll::Ready(Ok(())) => {}
9105                    std::task::Poll::Pending => return std::task::Poll::Pending,
9106                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
9107                        this.is_terminated = true;
9108                        return std::task::Poll::Ready(None);
9109                    }
9110                    std::task::Poll::Ready(Err(e)) => {
9111                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
9112                            e.into(),
9113                        ))));
9114                    }
9115                }
9116
9117                // A message has been received from the channel
9118                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
9119
9120                std::task::Poll::Ready(Some(match header.ordinal {
9121                    0x6748193a39918298 => {
9122                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
9123                        let mut req = fidl::new_empty!(
9124                            FlatlandDisplaySetContentRequest,
9125                            fidl::encoding::DefaultFuchsiaResourceDialect
9126                        );
9127                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandDisplaySetContentRequest>(&header, _body_bytes, handles, &mut req)?;
9128                        let control_handle =
9129                            FlatlandDisplayControlHandle { inner: this.inner.clone() };
9130                        Ok(FlatlandDisplayRequest::SetContent {
9131                            token: req.token,
9132                            child_view_watcher: req.child_view_watcher,
9133
9134                            control_handle,
9135                        })
9136                    }
9137                    0x392c3e70cc0a81a4 => {
9138                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
9139                        let mut req = fidl::new_empty!(
9140                            FlatlandDisplaySetDevicePixelRatioRequest,
9141                            fidl::encoding::DefaultFuchsiaResourceDialect
9142                        );
9143                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandDisplaySetDevicePixelRatioRequest>(&header, _body_bytes, handles, &mut req)?;
9144                        let control_handle =
9145                            FlatlandDisplayControlHandle { inner: this.inner.clone() };
9146                        Ok(FlatlandDisplayRequest::SetDevicePixelRatio {
9147                            device_pixel_ratio: req.device_pixel_ratio,
9148
9149                            control_handle,
9150                        })
9151                    }
9152                    _ => Err(fidl::Error::UnknownOrdinal {
9153                        ordinal: header.ordinal,
9154                        protocol_name:
9155                            <FlatlandDisplayMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
9156                    }),
9157                }))
9158            },
9159        )
9160    }
9161}
9162
9163/// This API connects to the singleton "primary display", and allows a tree of Flatland content to
9164/// be attached underneath.  Only one FlatlandDisplay client connection is allowed at one time.
9165#[derive(Debug)]
9166pub enum FlatlandDisplayRequest {
9167    SetContent {
9168        token: fidl_fuchsia_ui_views::ViewportCreationToken,
9169        child_view_watcher: fidl::endpoints::ServerEnd<ChildViewWatcherMarker>,
9170        control_handle: FlatlandDisplayControlHandle,
9171    },
9172    /// Sets the ratio of display's physical pixels to device independent pixels that should be used
9173    /// for the tree of Flatland content that are attached to this display. See
9174    /// [`LayoutInfo.device_pixel_ratio`] for details.
9175    ///
9176    /// The default value is (1.0, 1.0). The valid values are 1.0 and above.
9177    SetDevicePixelRatio {
9178        device_pixel_ratio: fidl_fuchsia_math::VecF,
9179        control_handle: FlatlandDisplayControlHandle,
9180    },
9181}
9182
9183impl FlatlandDisplayRequest {
9184    #[allow(irrefutable_let_patterns)]
9185    pub fn into_set_content(
9186        self,
9187    ) -> Option<(
9188        fidl_fuchsia_ui_views::ViewportCreationToken,
9189        fidl::endpoints::ServerEnd<ChildViewWatcherMarker>,
9190        FlatlandDisplayControlHandle,
9191    )> {
9192        if let FlatlandDisplayRequest::SetContent { token, child_view_watcher, control_handle } =
9193            self
9194        {
9195            Some((token, child_view_watcher, control_handle))
9196        } else {
9197            None
9198        }
9199    }
9200
9201    #[allow(irrefutable_let_patterns)]
9202    pub fn into_set_device_pixel_ratio(
9203        self,
9204    ) -> Option<(fidl_fuchsia_math::VecF, FlatlandDisplayControlHandle)> {
9205        if let FlatlandDisplayRequest::SetDevicePixelRatio { device_pixel_ratio, control_handle } =
9206            self
9207        {
9208            Some((device_pixel_ratio, control_handle))
9209        } else {
9210            None
9211        }
9212    }
9213
9214    /// Name of the method defined in FIDL
9215    pub fn method_name(&self) -> &'static str {
9216        match *self {
9217            FlatlandDisplayRequest::SetContent { .. } => "set_content",
9218            FlatlandDisplayRequest::SetDevicePixelRatio { .. } => "set_device_pixel_ratio",
9219        }
9220    }
9221}
9222
9223#[derive(Debug, Clone)]
9224pub struct FlatlandDisplayControlHandle {
9225    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
9226}
9227
9228impl FlatlandDisplayControlHandle {
9229    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
9230        self.inner.shutdown_with_epitaph(status.into())
9231    }
9232}
9233
9234impl fidl::endpoints::ControlHandle for FlatlandDisplayControlHandle {
9235    fn shutdown(&self) {
9236        self.inner.shutdown()
9237    }
9238
9239    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
9240        self.inner.shutdown_with_epitaph(status)
9241    }
9242
9243    fn is_closed(&self) -> bool {
9244        self.inner.channel().is_closed()
9245    }
9246    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
9247        self.inner.channel().on_closed()
9248    }
9249
9250    #[cfg(target_os = "fuchsia")]
9251    fn signal_peer(
9252        &self,
9253        clear_mask: zx::Signals,
9254        set_mask: zx::Signals,
9255    ) -> Result<(), zx_status::Status> {
9256        use fidl::Peered;
9257        self.inner.channel().signal_peer(clear_mask, set_mask)
9258    }
9259}
9260
9261impl FlatlandDisplayControlHandle {}
9262
9263#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
9264pub struct FlatlandFactoryMarker;
9265
9266impl fidl::endpoints::ProtocolMarker for FlatlandFactoryMarker {
9267    type Proxy = FlatlandFactoryProxy;
9268    type RequestStream = FlatlandFactoryRequestStream;
9269    #[cfg(target_os = "fuchsia")]
9270    type SynchronousProxy = FlatlandFactorySynchronousProxy;
9271
9272    const DEBUG_NAME: &'static str = "fuchsia.ui.composition.FlatlandFactory";
9273}
9274impl fidl::endpoints::DiscoverableProtocolMarker for FlatlandFactoryMarker {}
9275pub type FlatlandFactoryCreateFlatlandResult = Result<(), FlatlandFactoryError>;
9276
9277pub trait FlatlandFactoryProxyInterface: Send + Sync {
9278    type CreateFlatlandResponseFut: std::future::Future<Output = Result<FlatlandFactoryCreateFlatlandResult, fidl::Error>>
9279        + Send;
9280    fn r#create_flatland(
9281        &self,
9282        server_end: fidl::endpoints::ServerEnd<FlatlandMarker>,
9283        config: &FlatlandConfig,
9284    ) -> Self::CreateFlatlandResponseFut;
9285}
9286#[derive(Debug)]
9287#[cfg(target_os = "fuchsia")]
9288pub struct FlatlandFactorySynchronousProxy {
9289    client: fidl::client::sync::Client,
9290}
9291
9292#[cfg(target_os = "fuchsia")]
9293impl fidl::endpoints::SynchronousProxy for FlatlandFactorySynchronousProxy {
9294    type Proxy = FlatlandFactoryProxy;
9295    type Protocol = FlatlandFactoryMarker;
9296
9297    fn from_channel(inner: fidl::Channel) -> Self {
9298        Self::new(inner)
9299    }
9300
9301    fn into_channel(self) -> fidl::Channel {
9302        self.client.into_channel()
9303    }
9304
9305    fn as_channel(&self) -> &fidl::Channel {
9306        self.client.as_channel()
9307    }
9308}
9309
9310#[cfg(target_os = "fuchsia")]
9311impl FlatlandFactorySynchronousProxy {
9312    pub fn new(channel: fidl::Channel) -> Self {
9313        Self { client: fidl::client::sync::Client::new(channel) }
9314    }
9315
9316    pub fn into_channel(self) -> fidl::Channel {
9317        self.client.into_channel()
9318    }
9319
9320    /// Waits until an event arrives and returns it. It is safe for other
9321    /// threads to make concurrent requests while waiting for an event.
9322    pub fn wait_for_event(
9323        &self,
9324        deadline: zx::MonotonicInstant,
9325    ) -> Result<FlatlandFactoryEvent, fidl::Error> {
9326        FlatlandFactoryEvent::decode(self.client.wait_for_event::<FlatlandFactoryMarker>(deadline)?)
9327    }
9328
9329    /// Creates a new Flatland session with the specified configuration.
9330    ///
9331    /// Clients should optimistically assume connection success and immediately begin pipelining
9332    /// [`fuchsia.ui.composition/Flatland`] requests without waiting for this method to return.
9333    /// If session creation fails, the [`fuchsia.ui.composition/FlatlandFactory`] server closes the
9334    /// `Flatland` session channel and returns a [`fuchsia.ui.composition/FlatlandFactoryError`].
9335    /// Clients should asynchronously handle this failure and discard their `Flatland` client
9336    /// endpoint.
9337    ///
9338    /// ## Error
9339    ///
9340    /// Returns a `FlatlandFactoryError` if the operation fails.
9341    pub fn r#create_flatland(
9342        &self,
9343        mut server_end: fidl::endpoints::ServerEnd<FlatlandMarker>,
9344        mut config: &FlatlandConfig,
9345        ___deadline: zx::MonotonicInstant,
9346    ) -> Result<FlatlandFactoryCreateFlatlandResult, fidl::Error> {
9347        let _response = self.client.send_query::<
9348            FlatlandFactoryCreateFlatlandRequest,
9349            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, FlatlandFactoryError>,
9350            FlatlandFactoryMarker,
9351        >(
9352            (server_end, config,),
9353            0x5de80d9d7239b37e,
9354            fidl::encoding::DynamicFlags::empty(),
9355            ___deadline,
9356        )?;
9357        Ok(_response.map(|x| x))
9358    }
9359}
9360
9361#[cfg(target_os = "fuchsia")]
9362impl From<FlatlandFactorySynchronousProxy> for zx::NullableHandle {
9363    fn from(value: FlatlandFactorySynchronousProxy) -> Self {
9364        value.into_channel().into()
9365    }
9366}
9367
9368#[cfg(target_os = "fuchsia")]
9369impl From<fidl::Channel> for FlatlandFactorySynchronousProxy {
9370    fn from(value: fidl::Channel) -> Self {
9371        Self::new(value)
9372    }
9373}
9374
9375#[cfg(target_os = "fuchsia")]
9376impl fidl::endpoints::FromClient for FlatlandFactorySynchronousProxy {
9377    type Protocol = FlatlandFactoryMarker;
9378
9379    fn from_client(value: fidl::endpoints::ClientEnd<FlatlandFactoryMarker>) -> Self {
9380        Self::new(value.into_channel())
9381    }
9382}
9383
9384#[derive(Debug, Clone)]
9385pub struct FlatlandFactoryProxy {
9386    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
9387}
9388
9389impl fidl::endpoints::Proxy for FlatlandFactoryProxy {
9390    type Protocol = FlatlandFactoryMarker;
9391
9392    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
9393        Self::new(inner)
9394    }
9395
9396    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
9397        self.client.into_channel().map_err(|client| Self { client })
9398    }
9399
9400    fn as_channel(&self) -> &::fidl::AsyncChannel {
9401        self.client.as_channel()
9402    }
9403}
9404
9405impl FlatlandFactoryProxy {
9406    /// Create a new Proxy for fuchsia.ui.composition/FlatlandFactory.
9407    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
9408        let protocol_name = <FlatlandFactoryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
9409        Self { client: fidl::client::Client::new(channel, protocol_name) }
9410    }
9411
9412    /// Get a Stream of events from the remote end of the protocol.
9413    ///
9414    /// # Panics
9415    ///
9416    /// Panics if the event stream was already taken.
9417    pub fn take_event_stream(&self) -> FlatlandFactoryEventStream {
9418        FlatlandFactoryEventStream { event_receiver: self.client.take_event_receiver() }
9419    }
9420
9421    /// Creates a new Flatland session with the specified configuration.
9422    ///
9423    /// Clients should optimistically assume connection success and immediately begin pipelining
9424    /// [`fuchsia.ui.composition/Flatland`] requests without waiting for this method to return.
9425    /// If session creation fails, the [`fuchsia.ui.composition/FlatlandFactory`] server closes the
9426    /// `Flatland` session channel and returns a [`fuchsia.ui.composition/FlatlandFactoryError`].
9427    /// Clients should asynchronously handle this failure and discard their `Flatland` client
9428    /// endpoint.
9429    ///
9430    /// ## Error
9431    ///
9432    /// Returns a `FlatlandFactoryError` if the operation fails.
9433    pub fn r#create_flatland(
9434        &self,
9435        mut server_end: fidl::endpoints::ServerEnd<FlatlandMarker>,
9436        mut config: &FlatlandConfig,
9437    ) -> fidl::client::QueryResponseFut<
9438        FlatlandFactoryCreateFlatlandResult,
9439        fidl::encoding::DefaultFuchsiaResourceDialect,
9440    > {
9441        FlatlandFactoryProxyInterface::r#create_flatland(self, server_end, config)
9442    }
9443}
9444
9445impl FlatlandFactoryProxyInterface for FlatlandFactoryProxy {
9446    type CreateFlatlandResponseFut = fidl::client::QueryResponseFut<
9447        FlatlandFactoryCreateFlatlandResult,
9448        fidl::encoding::DefaultFuchsiaResourceDialect,
9449    >;
9450    fn r#create_flatland(
9451        &self,
9452        mut server_end: fidl::endpoints::ServerEnd<FlatlandMarker>,
9453        mut config: &FlatlandConfig,
9454    ) -> Self::CreateFlatlandResponseFut {
9455        fn _decode(
9456            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
9457        ) -> Result<FlatlandFactoryCreateFlatlandResult, fidl::Error> {
9458            let _response = fidl::client::decode_transaction_body::<
9459                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, FlatlandFactoryError>,
9460                fidl::encoding::DefaultFuchsiaResourceDialect,
9461                0x5de80d9d7239b37e,
9462            >(_buf?)?;
9463            Ok(_response.map(|x| x))
9464        }
9465        self.client.send_query_and_decode::<
9466            FlatlandFactoryCreateFlatlandRequest,
9467            FlatlandFactoryCreateFlatlandResult,
9468        >(
9469            (server_end, config,),
9470            0x5de80d9d7239b37e,
9471            fidl::encoding::DynamicFlags::empty(),
9472            _decode,
9473        )
9474    }
9475}
9476
9477pub struct FlatlandFactoryEventStream {
9478    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
9479}
9480
9481impl std::marker::Unpin for FlatlandFactoryEventStream {}
9482
9483impl futures::stream::FusedStream for FlatlandFactoryEventStream {
9484    fn is_terminated(&self) -> bool {
9485        self.event_receiver.is_terminated()
9486    }
9487}
9488
9489impl futures::Stream for FlatlandFactoryEventStream {
9490    type Item = Result<FlatlandFactoryEvent, fidl::Error>;
9491
9492    fn poll_next(
9493        mut self: std::pin::Pin<&mut Self>,
9494        cx: &mut std::task::Context<'_>,
9495    ) -> std::task::Poll<Option<Self::Item>> {
9496        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
9497            &mut self.event_receiver,
9498            cx
9499        )?) {
9500            Some(buf) => std::task::Poll::Ready(Some(FlatlandFactoryEvent::decode(buf))),
9501            None => std::task::Poll::Ready(None),
9502        }
9503    }
9504}
9505
9506#[derive(Debug)]
9507pub enum FlatlandFactoryEvent {}
9508
9509impl FlatlandFactoryEvent {
9510    /// Decodes a message buffer as a [`FlatlandFactoryEvent`].
9511    fn decode(
9512        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
9513    ) -> Result<FlatlandFactoryEvent, fidl::Error> {
9514        let (bytes, _handles) = buf.split_mut();
9515        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
9516        debug_assert_eq!(tx_header.tx_id, 0);
9517        match tx_header.ordinal {
9518            _ => Err(fidl::Error::UnknownOrdinal {
9519                ordinal: tx_header.ordinal,
9520                protocol_name:
9521                    <FlatlandFactoryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
9522            }),
9523        }
9524    }
9525}
9526
9527/// A Stream of incoming requests for fuchsia.ui.composition/FlatlandFactory.
9528pub struct FlatlandFactoryRequestStream {
9529    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
9530    is_terminated: bool,
9531}
9532
9533impl std::marker::Unpin for FlatlandFactoryRequestStream {}
9534
9535impl futures::stream::FusedStream for FlatlandFactoryRequestStream {
9536    fn is_terminated(&self) -> bool {
9537        self.is_terminated
9538    }
9539}
9540
9541impl fidl::endpoints::RequestStream for FlatlandFactoryRequestStream {
9542    type Protocol = FlatlandFactoryMarker;
9543    type ControlHandle = FlatlandFactoryControlHandle;
9544
9545    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
9546        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
9547    }
9548
9549    fn control_handle(&self) -> Self::ControlHandle {
9550        FlatlandFactoryControlHandle { inner: self.inner.clone() }
9551    }
9552
9553    fn into_inner(
9554        self,
9555    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
9556    {
9557        (self.inner, self.is_terminated)
9558    }
9559
9560    fn from_inner(
9561        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
9562        is_terminated: bool,
9563    ) -> Self {
9564        Self { inner, is_terminated }
9565    }
9566}
9567
9568impl futures::Stream for FlatlandFactoryRequestStream {
9569    type Item = Result<FlatlandFactoryRequest, fidl::Error>;
9570
9571    fn poll_next(
9572        mut self: std::pin::Pin<&mut Self>,
9573        cx: &mut std::task::Context<'_>,
9574    ) -> std::task::Poll<Option<Self::Item>> {
9575        let this = &mut *self;
9576        if this.inner.check_shutdown(cx) {
9577            this.is_terminated = true;
9578            return std::task::Poll::Ready(None);
9579        }
9580        if this.is_terminated {
9581            panic!("polled FlatlandFactoryRequestStream after completion");
9582        }
9583        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
9584            |bytes, handles| {
9585                match this.inner.channel().read_etc(cx, bytes, handles) {
9586                    std::task::Poll::Ready(Ok(())) => {}
9587                    std::task::Poll::Pending => return std::task::Poll::Pending,
9588                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
9589                        this.is_terminated = true;
9590                        return std::task::Poll::Ready(None);
9591                    }
9592                    std::task::Poll::Ready(Err(e)) => {
9593                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
9594                            e.into(),
9595                        ))));
9596                    }
9597                }
9598
9599                // A message has been received from the channel
9600                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
9601
9602                std::task::Poll::Ready(Some(match header.ordinal {
9603                    0x5de80d9d7239b37e => {
9604                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
9605                        let mut req = fidl::new_empty!(
9606                            FlatlandFactoryCreateFlatlandRequest,
9607                            fidl::encoding::DefaultFuchsiaResourceDialect
9608                        );
9609                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandFactoryCreateFlatlandRequest>(&header, _body_bytes, handles, &mut req)?;
9610                        let control_handle =
9611                            FlatlandFactoryControlHandle { inner: this.inner.clone() };
9612                        Ok(FlatlandFactoryRequest::CreateFlatland {
9613                            server_end: req.server_end,
9614                            config: req.config,
9615
9616                            responder: FlatlandFactoryCreateFlatlandResponder {
9617                                control_handle: std::mem::ManuallyDrop::new(control_handle),
9618                                tx_id: header.tx_id,
9619                            },
9620                        })
9621                    }
9622                    _ => Err(fidl::Error::UnknownOrdinal {
9623                        ordinal: header.ordinal,
9624                        protocol_name:
9625                            <FlatlandFactoryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
9626                    }),
9627                }))
9628            },
9629        )
9630    }
9631}
9632
9633/// Factory protocol for spawning regular (untrusted) Flatland sessions.
9634#[derive(Debug)]
9635pub enum FlatlandFactoryRequest {
9636    /// Creates a new Flatland session with the specified configuration.
9637    ///
9638    /// Clients should optimistically assume connection success and immediately begin pipelining
9639    /// [`fuchsia.ui.composition/Flatland`] requests without waiting for this method to return.
9640    /// If session creation fails, the [`fuchsia.ui.composition/FlatlandFactory`] server closes the
9641    /// `Flatland` session channel and returns a [`fuchsia.ui.composition/FlatlandFactoryError`].
9642    /// Clients should asynchronously handle this failure and discard their `Flatland` client
9643    /// endpoint.
9644    ///
9645    /// ## Error
9646    ///
9647    /// Returns a `FlatlandFactoryError` if the operation fails.
9648    CreateFlatland {
9649        server_end: fidl::endpoints::ServerEnd<FlatlandMarker>,
9650        config: FlatlandConfig,
9651        responder: FlatlandFactoryCreateFlatlandResponder,
9652    },
9653}
9654
9655impl FlatlandFactoryRequest {
9656    #[allow(irrefutable_let_patterns)]
9657    pub fn into_create_flatland(
9658        self,
9659    ) -> Option<(
9660        fidl::endpoints::ServerEnd<FlatlandMarker>,
9661        FlatlandConfig,
9662        FlatlandFactoryCreateFlatlandResponder,
9663    )> {
9664        if let FlatlandFactoryRequest::CreateFlatland { server_end, config, responder } = self {
9665            Some((server_end, config, responder))
9666        } else {
9667            None
9668        }
9669    }
9670
9671    /// Name of the method defined in FIDL
9672    pub fn method_name(&self) -> &'static str {
9673        match *self {
9674            FlatlandFactoryRequest::CreateFlatland { .. } => "create_flatland",
9675        }
9676    }
9677}
9678
9679#[derive(Debug, Clone)]
9680pub struct FlatlandFactoryControlHandle {
9681    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
9682}
9683
9684impl FlatlandFactoryControlHandle {
9685    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
9686        self.inner.shutdown_with_epitaph(status.into())
9687    }
9688}
9689
9690impl fidl::endpoints::ControlHandle for FlatlandFactoryControlHandle {
9691    fn shutdown(&self) {
9692        self.inner.shutdown()
9693    }
9694
9695    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
9696        self.inner.shutdown_with_epitaph(status)
9697    }
9698
9699    fn is_closed(&self) -> bool {
9700        self.inner.channel().is_closed()
9701    }
9702    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
9703        self.inner.channel().on_closed()
9704    }
9705
9706    #[cfg(target_os = "fuchsia")]
9707    fn signal_peer(
9708        &self,
9709        clear_mask: zx::Signals,
9710        set_mask: zx::Signals,
9711    ) -> Result<(), zx_status::Status> {
9712        use fidl::Peered;
9713        self.inner.channel().signal_peer(clear_mask, set_mask)
9714    }
9715}
9716
9717impl FlatlandFactoryControlHandle {}
9718
9719#[must_use = "FIDL methods require a response to be sent"]
9720#[derive(Debug)]
9721pub struct FlatlandFactoryCreateFlatlandResponder {
9722    control_handle: std::mem::ManuallyDrop<FlatlandFactoryControlHandle>,
9723    tx_id: u32,
9724}
9725
9726/// Set the the channel to be shutdown (see [`FlatlandFactoryControlHandle::shutdown`])
9727/// if the responder is dropped without sending a response, so that the client
9728/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
9729impl std::ops::Drop for FlatlandFactoryCreateFlatlandResponder {
9730    fn drop(&mut self) {
9731        self.control_handle.shutdown();
9732        // Safety: drops once, never accessed again
9733        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9734    }
9735}
9736
9737impl fidl::endpoints::Responder for FlatlandFactoryCreateFlatlandResponder {
9738    type ControlHandle = FlatlandFactoryControlHandle;
9739
9740    fn control_handle(&self) -> &FlatlandFactoryControlHandle {
9741        &self.control_handle
9742    }
9743
9744    fn drop_without_shutdown(mut self) {
9745        // Safety: drops once, never accessed again due to mem::forget
9746        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9747        // Prevent Drop from running (which would shut down the channel)
9748        std::mem::forget(self);
9749    }
9750}
9751
9752impl FlatlandFactoryCreateFlatlandResponder {
9753    /// Sends a response to the FIDL transaction.
9754    ///
9755    /// Sets the channel to shutdown if an error occurs.
9756    pub fn send(self, mut result: Result<(), FlatlandFactoryError>) -> Result<(), fidl::Error> {
9757        let _result = self.send_raw(result);
9758        if _result.is_err() {
9759            self.control_handle.shutdown();
9760        }
9761        self.drop_without_shutdown();
9762        _result
9763    }
9764
9765    /// Similar to "send" but does not shutdown the channel if an error occurs.
9766    pub fn send_no_shutdown_on_err(
9767        self,
9768        mut result: Result<(), FlatlandFactoryError>,
9769    ) -> Result<(), fidl::Error> {
9770        let _result = self.send_raw(result);
9771        self.drop_without_shutdown();
9772        _result
9773    }
9774
9775    fn send_raw(&self, mut result: Result<(), FlatlandFactoryError>) -> Result<(), fidl::Error> {
9776        self.control_handle.inner.send::<fidl::encoding::ResultType<
9777            fidl::encoding::EmptyStruct,
9778            FlatlandFactoryError,
9779        >>(
9780            result,
9781            self.tx_id,
9782            0x5de80d9d7239b37e,
9783            fidl::encoding::DynamicFlags::empty(),
9784        )
9785    }
9786}
9787
9788#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
9789pub struct ParentViewportWatcherMarker;
9790
9791impl fidl::endpoints::ProtocolMarker for ParentViewportWatcherMarker {
9792    type Proxy = ParentViewportWatcherProxy;
9793    type RequestStream = ParentViewportWatcherRequestStream;
9794    #[cfg(target_os = "fuchsia")]
9795    type SynchronousProxy = ParentViewportWatcherSynchronousProxy;
9796
9797    const DEBUG_NAME: &'static str = "(anonymous) ParentViewportWatcher";
9798}
9799
9800pub trait ParentViewportWatcherProxyInterface: Send + Sync {
9801    type GetLayoutResponseFut: std::future::Future<Output = Result<LayoutInfo, fidl::Error>> + Send;
9802    fn r#get_layout(&self) -> Self::GetLayoutResponseFut;
9803    type GetStatusResponseFut: std::future::Future<Output = Result<ParentViewportStatus, fidl::Error>>
9804        + Send;
9805    fn r#get_status(&self) -> Self::GetStatusResponseFut;
9806}
9807#[derive(Debug)]
9808#[cfg(target_os = "fuchsia")]
9809pub struct ParentViewportWatcherSynchronousProxy {
9810    client: fidl::client::sync::Client,
9811}
9812
9813#[cfg(target_os = "fuchsia")]
9814impl fidl::endpoints::SynchronousProxy for ParentViewportWatcherSynchronousProxy {
9815    type Proxy = ParentViewportWatcherProxy;
9816    type Protocol = ParentViewportWatcherMarker;
9817
9818    fn from_channel(inner: fidl::Channel) -> Self {
9819        Self::new(inner)
9820    }
9821
9822    fn into_channel(self) -> fidl::Channel {
9823        self.client.into_channel()
9824    }
9825
9826    fn as_channel(&self) -> &fidl::Channel {
9827        self.client.as_channel()
9828    }
9829}
9830
9831#[cfg(target_os = "fuchsia")]
9832impl ParentViewportWatcherSynchronousProxy {
9833    pub fn new(channel: fidl::Channel) -> Self {
9834        Self { client: fidl::client::sync::Client::new(channel) }
9835    }
9836
9837    pub fn into_channel(self) -> fidl::Channel {
9838        self.client.into_channel()
9839    }
9840
9841    /// Waits until an event arrives and returns it. It is safe for other
9842    /// threads to make concurrent requests while waiting for an event.
9843    pub fn wait_for_event(
9844        &self,
9845        deadline: zx::MonotonicInstant,
9846    ) -> Result<ParentViewportWatcherEvent, fidl::Error> {
9847        ParentViewportWatcherEvent::decode(
9848            self.client.wait_for_event::<ParentViewportWatcherMarker>(deadline)?,
9849        )
9850    }
9851
9852    /// A hanging get for receiving layout information. Clients may receive layout information
9853    /// before the ParentViewportWatcher operation has been presented. This allows children to
9854    /// layout their content before their first call to [`Present`]. In transition cases where two
9855    /// ParentViewportWatcher channels exist at the same time, both protocol sessions will be
9856    /// receiving different layout information.
9857    ///
9858    /// This hanging get will only fire when the LayoutInfo is different than the previously
9859    /// returned LayoutInfo. Note that, since LayoutInfo is a table, only some fields may have
9860    /// changed.
9861    ///
9862    /// It is invalid to call `GetLayout` while a previous call is still pending. Doing so will
9863    /// cause both this channel and the Flatland channel that handed out ParentViewportWatcher to be
9864    /// closed.
9865    pub fn r#get_layout(
9866        &self,
9867        ___deadline: zx::MonotonicInstant,
9868    ) -> Result<LayoutInfo, fidl::Error> {
9869        let _response = self.client.send_query::<
9870            fidl::encoding::EmptyPayload,
9871            ParentViewportWatcherGetLayoutResponse,
9872            ParentViewportWatcherMarker,
9873        >(
9874            (),
9875            0x3cbe5d9638e032,
9876            fidl::encoding::DynamicFlags::empty(),
9877            ___deadline,
9878        )?;
9879        Ok(_response.info)
9880    }
9881
9882    /// A hanging get for receiving the status of the parent Viewport. This provides global
9883    /// connectivity information to the child.
9884    ///
9885    /// This hanging get will only fire when the ParentViewportStatus is different than the
9886    /// previously returned ParentViewportStatus.
9887    ///
9888    /// It is invalid to call `GetStatus` while a previous call is still pending. Doing so will
9889    /// cause both this channel and the Flatland channel that handed out ParentViewportWatcher to be
9890    /// closed.
9891    pub fn r#get_status(
9892        &self,
9893        ___deadline: zx::MonotonicInstant,
9894    ) -> Result<ParentViewportStatus, fidl::Error> {
9895        let _response = self.client.send_query::<
9896            fidl::encoding::EmptyPayload,
9897            ParentViewportWatcherGetStatusResponse,
9898            ParentViewportWatcherMarker,
9899        >(
9900            (),
9901            0x7caa022f050d9ea6,
9902            fidl::encoding::DynamicFlags::empty(),
9903            ___deadline,
9904        )?;
9905        Ok(_response.status)
9906    }
9907}
9908
9909#[cfg(target_os = "fuchsia")]
9910impl From<ParentViewportWatcherSynchronousProxy> for zx::NullableHandle {
9911    fn from(value: ParentViewportWatcherSynchronousProxy) -> Self {
9912        value.into_channel().into()
9913    }
9914}
9915
9916#[cfg(target_os = "fuchsia")]
9917impl From<fidl::Channel> for ParentViewportWatcherSynchronousProxy {
9918    fn from(value: fidl::Channel) -> Self {
9919        Self::new(value)
9920    }
9921}
9922
9923#[cfg(target_os = "fuchsia")]
9924impl fidl::endpoints::FromClient for ParentViewportWatcherSynchronousProxy {
9925    type Protocol = ParentViewportWatcherMarker;
9926
9927    fn from_client(value: fidl::endpoints::ClientEnd<ParentViewportWatcherMarker>) -> Self {
9928        Self::new(value.into_channel())
9929    }
9930}
9931
9932#[derive(Debug, Clone)]
9933pub struct ParentViewportWatcherProxy {
9934    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
9935}
9936
9937impl fidl::endpoints::Proxy for ParentViewportWatcherProxy {
9938    type Protocol = ParentViewportWatcherMarker;
9939
9940    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
9941        Self::new(inner)
9942    }
9943
9944    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
9945        self.client.into_channel().map_err(|client| Self { client })
9946    }
9947
9948    fn as_channel(&self) -> &::fidl::AsyncChannel {
9949        self.client.as_channel()
9950    }
9951}
9952
9953impl ParentViewportWatcherProxy {
9954    /// Create a new Proxy for fuchsia.ui.composition/ParentViewportWatcher.
9955    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
9956        let protocol_name =
9957            <ParentViewportWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
9958        Self { client: fidl::client::Client::new(channel, protocol_name) }
9959    }
9960
9961    /// Get a Stream of events from the remote end of the protocol.
9962    ///
9963    /// # Panics
9964    ///
9965    /// Panics if the event stream was already taken.
9966    pub fn take_event_stream(&self) -> ParentViewportWatcherEventStream {
9967        ParentViewportWatcherEventStream { event_receiver: self.client.take_event_receiver() }
9968    }
9969
9970    /// A hanging get for receiving layout information. Clients may receive layout information
9971    /// before the ParentViewportWatcher operation has been presented. This allows children to
9972    /// layout their content before their first call to [`Present`]. In transition cases where two
9973    /// ParentViewportWatcher channels exist at the same time, both protocol sessions will be
9974    /// receiving different layout information.
9975    ///
9976    /// This hanging get will only fire when the LayoutInfo is different than the previously
9977    /// returned LayoutInfo. Note that, since LayoutInfo is a table, only some fields may have
9978    /// changed.
9979    ///
9980    /// It is invalid to call `GetLayout` while a previous call is still pending. Doing so will
9981    /// cause both this channel and the Flatland channel that handed out ParentViewportWatcher to be
9982    /// closed.
9983    pub fn r#get_layout(
9984        &self,
9985    ) -> fidl::client::QueryResponseFut<LayoutInfo, fidl::encoding::DefaultFuchsiaResourceDialect>
9986    {
9987        ParentViewportWatcherProxyInterface::r#get_layout(self)
9988    }
9989
9990    /// A hanging get for receiving the status of the parent Viewport. This provides global
9991    /// connectivity information to the child.
9992    ///
9993    /// This hanging get will only fire when the ParentViewportStatus is different than the
9994    /// previously returned ParentViewportStatus.
9995    ///
9996    /// It is invalid to call `GetStatus` while a previous call is still pending. Doing so will
9997    /// cause both this channel and the Flatland channel that handed out ParentViewportWatcher to be
9998    /// closed.
9999    pub fn r#get_status(
10000        &self,
10001    ) -> fidl::client::QueryResponseFut<
10002        ParentViewportStatus,
10003        fidl::encoding::DefaultFuchsiaResourceDialect,
10004    > {
10005        ParentViewportWatcherProxyInterface::r#get_status(self)
10006    }
10007}
10008
10009impl ParentViewportWatcherProxyInterface for ParentViewportWatcherProxy {
10010    type GetLayoutResponseFut =
10011        fidl::client::QueryResponseFut<LayoutInfo, fidl::encoding::DefaultFuchsiaResourceDialect>;
10012    fn r#get_layout(&self) -> Self::GetLayoutResponseFut {
10013        fn _decode(
10014            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
10015        ) -> Result<LayoutInfo, fidl::Error> {
10016            let _response = fidl::client::decode_transaction_body::<
10017                ParentViewportWatcherGetLayoutResponse,
10018                fidl::encoding::DefaultFuchsiaResourceDialect,
10019                0x3cbe5d9638e032,
10020            >(_buf?)?;
10021            Ok(_response.info)
10022        }
10023        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, LayoutInfo>(
10024            (),
10025            0x3cbe5d9638e032,
10026            fidl::encoding::DynamicFlags::empty(),
10027            _decode,
10028        )
10029    }
10030
10031    type GetStatusResponseFut = fidl::client::QueryResponseFut<
10032        ParentViewportStatus,
10033        fidl::encoding::DefaultFuchsiaResourceDialect,
10034    >;
10035    fn r#get_status(&self) -> Self::GetStatusResponseFut {
10036        fn _decode(
10037            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
10038        ) -> Result<ParentViewportStatus, fidl::Error> {
10039            let _response = fidl::client::decode_transaction_body::<
10040                ParentViewportWatcherGetStatusResponse,
10041                fidl::encoding::DefaultFuchsiaResourceDialect,
10042                0x7caa022f050d9ea6,
10043            >(_buf?)?;
10044            Ok(_response.status)
10045        }
10046        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ParentViewportStatus>(
10047            (),
10048            0x7caa022f050d9ea6,
10049            fidl::encoding::DynamicFlags::empty(),
10050            _decode,
10051        )
10052    }
10053}
10054
10055pub struct ParentViewportWatcherEventStream {
10056    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
10057}
10058
10059impl std::marker::Unpin for ParentViewportWatcherEventStream {}
10060
10061impl futures::stream::FusedStream for ParentViewportWatcherEventStream {
10062    fn is_terminated(&self) -> bool {
10063        self.event_receiver.is_terminated()
10064    }
10065}
10066
10067impl futures::Stream for ParentViewportWatcherEventStream {
10068    type Item = Result<ParentViewportWatcherEvent, fidl::Error>;
10069
10070    fn poll_next(
10071        mut self: std::pin::Pin<&mut Self>,
10072        cx: &mut std::task::Context<'_>,
10073    ) -> std::task::Poll<Option<Self::Item>> {
10074        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
10075            &mut self.event_receiver,
10076            cx
10077        )?) {
10078            Some(buf) => std::task::Poll::Ready(Some(ParentViewportWatcherEvent::decode(buf))),
10079            None => std::task::Poll::Ready(None),
10080        }
10081    }
10082}
10083
10084#[derive(Debug)]
10085pub enum ParentViewportWatcherEvent {}
10086
10087impl ParentViewportWatcherEvent {
10088    /// Decodes a message buffer as a [`ParentViewportWatcherEvent`].
10089    fn decode(
10090        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
10091    ) -> Result<ParentViewportWatcherEvent, fidl::Error> {
10092        let (bytes, _handles) = buf.split_mut();
10093        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
10094        debug_assert_eq!(tx_header.tx_id, 0);
10095        match tx_header.ordinal {
10096            _ => Err(fidl::Error::UnknownOrdinal {
10097                ordinal: tx_header.ordinal,
10098                protocol_name:
10099                    <ParentViewportWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
10100            }),
10101        }
10102    }
10103}
10104
10105/// A Stream of incoming requests for fuchsia.ui.composition/ParentViewportWatcher.
10106pub struct ParentViewportWatcherRequestStream {
10107    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
10108    is_terminated: bool,
10109}
10110
10111impl std::marker::Unpin for ParentViewportWatcherRequestStream {}
10112
10113impl futures::stream::FusedStream for ParentViewportWatcherRequestStream {
10114    fn is_terminated(&self) -> bool {
10115        self.is_terminated
10116    }
10117}
10118
10119impl fidl::endpoints::RequestStream for ParentViewportWatcherRequestStream {
10120    type Protocol = ParentViewportWatcherMarker;
10121    type ControlHandle = ParentViewportWatcherControlHandle;
10122
10123    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
10124        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
10125    }
10126
10127    fn control_handle(&self) -> Self::ControlHandle {
10128        ParentViewportWatcherControlHandle { inner: self.inner.clone() }
10129    }
10130
10131    fn into_inner(
10132        self,
10133    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
10134    {
10135        (self.inner, self.is_terminated)
10136    }
10137
10138    fn from_inner(
10139        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
10140        is_terminated: bool,
10141    ) -> Self {
10142        Self { inner, is_terminated }
10143    }
10144}
10145
10146impl futures::Stream for ParentViewportWatcherRequestStream {
10147    type Item = Result<ParentViewportWatcherRequest, fidl::Error>;
10148
10149    fn poll_next(
10150        mut self: std::pin::Pin<&mut Self>,
10151        cx: &mut std::task::Context<'_>,
10152    ) -> std::task::Poll<Option<Self::Item>> {
10153        let this = &mut *self;
10154        if this.inner.check_shutdown(cx) {
10155            this.is_terminated = true;
10156            return std::task::Poll::Ready(None);
10157        }
10158        if this.is_terminated {
10159            panic!("polled ParentViewportWatcherRequestStream after completion");
10160        }
10161        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
10162            |bytes, handles| {
10163                match this.inner.channel().read_etc(cx, bytes, handles) {
10164                    std::task::Poll::Ready(Ok(())) => {}
10165                    std::task::Poll::Pending => return std::task::Poll::Pending,
10166                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
10167                        this.is_terminated = true;
10168                        return std::task::Poll::Ready(None);
10169                    }
10170                    std::task::Poll::Ready(Err(e)) => {
10171                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
10172                            e.into(),
10173                        ))));
10174                    }
10175                }
10176
10177                // A message has been received from the channel
10178                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
10179
10180                std::task::Poll::Ready(Some(match header.ordinal {
10181                0x3cbe5d9638e032 => {
10182                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
10183                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
10184                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
10185                    let control_handle = ParentViewportWatcherControlHandle {
10186                        inner: this.inner.clone(),
10187                    };
10188                    Ok(ParentViewportWatcherRequest::GetLayout {
10189                        responder: ParentViewportWatcherGetLayoutResponder {
10190                            control_handle: std::mem::ManuallyDrop::new(control_handle),
10191                            tx_id: header.tx_id,
10192                        },
10193                    })
10194                }
10195                0x7caa022f050d9ea6 => {
10196                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
10197                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
10198                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
10199                    let control_handle = ParentViewportWatcherControlHandle {
10200                        inner: this.inner.clone(),
10201                    };
10202                    Ok(ParentViewportWatcherRequest::GetStatus {
10203                        responder: ParentViewportWatcherGetStatusResponder {
10204                            control_handle: std::mem::ManuallyDrop::new(control_handle),
10205                            tx_id: header.tx_id,
10206                        },
10207                    })
10208                }
10209                _ => Err(fidl::Error::UnknownOrdinal {
10210                    ordinal: header.ordinal,
10211                    protocol_name: <ParentViewportWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
10212                }),
10213            }))
10214            },
10215        )
10216    }
10217}
10218
10219/// A protocol that provides information about the parent Viewport attached to a Flatland session's
10220/// sole View.  Although Flatland sessions can have at most one view, it is possible to have
10221/// multiple ParentViewportWatchers during the brief transition period when replacing the session's
10222/// View with another, e.g. via [`CreateView`].  During this period, certain updates may be
10223/// duplicated and sent to each ParentViewportWatcher connection.
10224///
10225/// A ParentViewportWatcher will remain connected as long as the corresponding parent Viewport
10226/// exists; the connection will also be closed if the parents's ViewportCreationToken is dropped
10227/// without using it to create a Viewport.
10228#[derive(Debug)]
10229pub enum ParentViewportWatcherRequest {
10230    /// A hanging get for receiving layout information. Clients may receive layout information
10231    /// before the ParentViewportWatcher operation has been presented. This allows children to
10232    /// layout their content before their first call to [`Present`]. In transition cases where two
10233    /// ParentViewportWatcher channels exist at the same time, both protocol sessions will be
10234    /// receiving different layout information.
10235    ///
10236    /// This hanging get will only fire when the LayoutInfo is different than the previously
10237    /// returned LayoutInfo. Note that, since LayoutInfo is a table, only some fields may have
10238    /// changed.
10239    ///
10240    /// It is invalid to call `GetLayout` while a previous call is still pending. Doing so will
10241    /// cause both this channel and the Flatland channel that handed out ParentViewportWatcher to be
10242    /// closed.
10243    GetLayout { responder: ParentViewportWatcherGetLayoutResponder },
10244    /// A hanging get for receiving the status of the parent Viewport. This provides global
10245    /// connectivity information to the child.
10246    ///
10247    /// This hanging get will only fire when the ParentViewportStatus is different than the
10248    /// previously returned ParentViewportStatus.
10249    ///
10250    /// It is invalid to call `GetStatus` while a previous call is still pending. Doing so will
10251    /// cause both this channel and the Flatland channel that handed out ParentViewportWatcher to be
10252    /// closed.
10253    GetStatus { responder: ParentViewportWatcherGetStatusResponder },
10254}
10255
10256impl ParentViewportWatcherRequest {
10257    #[allow(irrefutable_let_patterns)]
10258    pub fn into_get_layout(self) -> Option<(ParentViewportWatcherGetLayoutResponder)> {
10259        if let ParentViewportWatcherRequest::GetLayout { responder } = self {
10260            Some((responder))
10261        } else {
10262            None
10263        }
10264    }
10265
10266    #[allow(irrefutable_let_patterns)]
10267    pub fn into_get_status(self) -> Option<(ParentViewportWatcherGetStatusResponder)> {
10268        if let ParentViewportWatcherRequest::GetStatus { responder } = self {
10269            Some((responder))
10270        } else {
10271            None
10272        }
10273    }
10274
10275    /// Name of the method defined in FIDL
10276    pub fn method_name(&self) -> &'static str {
10277        match *self {
10278            ParentViewportWatcherRequest::GetLayout { .. } => "get_layout",
10279            ParentViewportWatcherRequest::GetStatus { .. } => "get_status",
10280        }
10281    }
10282}
10283
10284#[derive(Debug, Clone)]
10285pub struct ParentViewportWatcherControlHandle {
10286    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
10287}
10288
10289impl ParentViewportWatcherControlHandle {
10290    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
10291        self.inner.shutdown_with_epitaph(status.into())
10292    }
10293}
10294
10295impl fidl::endpoints::ControlHandle for ParentViewportWatcherControlHandle {
10296    fn shutdown(&self) {
10297        self.inner.shutdown()
10298    }
10299
10300    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
10301        self.inner.shutdown_with_epitaph(status)
10302    }
10303
10304    fn is_closed(&self) -> bool {
10305        self.inner.channel().is_closed()
10306    }
10307    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
10308        self.inner.channel().on_closed()
10309    }
10310
10311    #[cfg(target_os = "fuchsia")]
10312    fn signal_peer(
10313        &self,
10314        clear_mask: zx::Signals,
10315        set_mask: zx::Signals,
10316    ) -> Result<(), zx_status::Status> {
10317        use fidl::Peered;
10318        self.inner.channel().signal_peer(clear_mask, set_mask)
10319    }
10320}
10321
10322impl ParentViewportWatcherControlHandle {}
10323
10324#[must_use = "FIDL methods require a response to be sent"]
10325#[derive(Debug)]
10326pub struct ParentViewportWatcherGetLayoutResponder {
10327    control_handle: std::mem::ManuallyDrop<ParentViewportWatcherControlHandle>,
10328    tx_id: u32,
10329}
10330
10331/// Set the the channel to be shutdown (see [`ParentViewportWatcherControlHandle::shutdown`])
10332/// if the responder is dropped without sending a response, so that the client
10333/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
10334impl std::ops::Drop for ParentViewportWatcherGetLayoutResponder {
10335    fn drop(&mut self) {
10336        self.control_handle.shutdown();
10337        // Safety: drops once, never accessed again
10338        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
10339    }
10340}
10341
10342impl fidl::endpoints::Responder for ParentViewportWatcherGetLayoutResponder {
10343    type ControlHandle = ParentViewportWatcherControlHandle;
10344
10345    fn control_handle(&self) -> &ParentViewportWatcherControlHandle {
10346        &self.control_handle
10347    }
10348
10349    fn drop_without_shutdown(mut self) {
10350        // Safety: drops once, never accessed again due to mem::forget
10351        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
10352        // Prevent Drop from running (which would shut down the channel)
10353        std::mem::forget(self);
10354    }
10355}
10356
10357impl ParentViewportWatcherGetLayoutResponder {
10358    /// Sends a response to the FIDL transaction.
10359    ///
10360    /// Sets the channel to shutdown if an error occurs.
10361    pub fn send(self, mut info: &LayoutInfo) -> Result<(), fidl::Error> {
10362        let _result = self.send_raw(info);
10363        if _result.is_err() {
10364            self.control_handle.shutdown();
10365        }
10366        self.drop_without_shutdown();
10367        _result
10368    }
10369
10370    /// Similar to "send" but does not shutdown the channel if an error occurs.
10371    pub fn send_no_shutdown_on_err(self, mut info: &LayoutInfo) -> Result<(), fidl::Error> {
10372        let _result = self.send_raw(info);
10373        self.drop_without_shutdown();
10374        _result
10375    }
10376
10377    fn send_raw(&self, mut info: &LayoutInfo) -> Result<(), fidl::Error> {
10378        self.control_handle.inner.send::<ParentViewportWatcherGetLayoutResponse>(
10379            (info,),
10380            self.tx_id,
10381            0x3cbe5d9638e032,
10382            fidl::encoding::DynamicFlags::empty(),
10383        )
10384    }
10385}
10386
10387#[must_use = "FIDL methods require a response to be sent"]
10388#[derive(Debug)]
10389pub struct ParentViewportWatcherGetStatusResponder {
10390    control_handle: std::mem::ManuallyDrop<ParentViewportWatcherControlHandle>,
10391    tx_id: u32,
10392}
10393
10394/// Set the the channel to be shutdown (see [`ParentViewportWatcherControlHandle::shutdown`])
10395/// if the responder is dropped without sending a response, so that the client
10396/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
10397impl std::ops::Drop for ParentViewportWatcherGetStatusResponder {
10398    fn drop(&mut self) {
10399        self.control_handle.shutdown();
10400        // Safety: drops once, never accessed again
10401        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
10402    }
10403}
10404
10405impl fidl::endpoints::Responder for ParentViewportWatcherGetStatusResponder {
10406    type ControlHandle = ParentViewportWatcherControlHandle;
10407
10408    fn control_handle(&self) -> &ParentViewportWatcherControlHandle {
10409        &self.control_handle
10410    }
10411
10412    fn drop_without_shutdown(mut self) {
10413        // Safety: drops once, never accessed again due to mem::forget
10414        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
10415        // Prevent Drop from running (which would shut down the channel)
10416        std::mem::forget(self);
10417    }
10418}
10419
10420impl ParentViewportWatcherGetStatusResponder {
10421    /// Sends a response to the FIDL transaction.
10422    ///
10423    /// Sets the channel to shutdown if an error occurs.
10424    pub fn send(self, mut status: ParentViewportStatus) -> Result<(), fidl::Error> {
10425        let _result = self.send_raw(status);
10426        if _result.is_err() {
10427            self.control_handle.shutdown();
10428        }
10429        self.drop_without_shutdown();
10430        _result
10431    }
10432
10433    /// Similar to "send" but does not shutdown the channel if an error occurs.
10434    pub fn send_no_shutdown_on_err(
10435        self,
10436        mut status: ParentViewportStatus,
10437    ) -> Result<(), fidl::Error> {
10438        let _result = self.send_raw(status);
10439        self.drop_without_shutdown();
10440        _result
10441    }
10442
10443    fn send_raw(&self, mut status: ParentViewportStatus) -> Result<(), fidl::Error> {
10444        self.control_handle.inner.send::<ParentViewportWatcherGetStatusResponse>(
10445            (status,),
10446            self.tx_id,
10447            0x7caa022f050d9ea6,
10448            fidl::encoding::DynamicFlags::empty(),
10449        )
10450    }
10451}
10452
10453#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
10454pub struct ScreenCaptureMarker;
10455
10456impl fidl::endpoints::ProtocolMarker for ScreenCaptureMarker {
10457    type Proxy = ScreenCaptureProxy;
10458    type RequestStream = ScreenCaptureRequestStream;
10459    #[cfg(target_os = "fuchsia")]
10460    type SynchronousProxy = ScreenCaptureSynchronousProxy;
10461
10462    const DEBUG_NAME: &'static str = "fuchsia.ui.composition.ScreenCapture";
10463}
10464impl fidl::endpoints::DiscoverableProtocolMarker for ScreenCaptureMarker {}
10465pub type ScreenCaptureConfigureResult = Result<(), ScreenCaptureError>;
10466pub type ScreenCaptureGetNextFrameResult = Result<FrameInfo, ScreenCaptureError>;
10467pub type ScreenCaptureReleaseFrameResult = Result<(), ScreenCaptureError>;
10468
10469pub trait ScreenCaptureProxyInterface: Send + Sync {
10470    type ConfigureResponseFut: std::future::Future<Output = Result<ScreenCaptureConfigureResult, fidl::Error>>
10471        + Send;
10472    fn r#configure(&self, payload: ScreenCaptureConfig) -> Self::ConfigureResponseFut;
10473    type GetNextFrameResponseFut: std::future::Future<Output = Result<ScreenCaptureGetNextFrameResult, fidl::Error>>
10474        + Send;
10475    fn r#get_next_frame(&self, payload: GetNextFrameArgs) -> Self::GetNextFrameResponseFut;
10476    type ReleaseFrameResponseFut: std::future::Future<Output = Result<ScreenCaptureReleaseFrameResult, fidl::Error>>
10477        + Send;
10478    fn r#release_frame(&self, buffer_id: u32) -> Self::ReleaseFrameResponseFut;
10479}
10480#[derive(Debug)]
10481#[cfg(target_os = "fuchsia")]
10482pub struct ScreenCaptureSynchronousProxy {
10483    client: fidl::client::sync::Client,
10484}
10485
10486#[cfg(target_os = "fuchsia")]
10487impl fidl::endpoints::SynchronousProxy for ScreenCaptureSynchronousProxy {
10488    type Proxy = ScreenCaptureProxy;
10489    type Protocol = ScreenCaptureMarker;
10490
10491    fn from_channel(inner: fidl::Channel) -> Self {
10492        Self::new(inner)
10493    }
10494
10495    fn into_channel(self) -> fidl::Channel {
10496        self.client.into_channel()
10497    }
10498
10499    fn as_channel(&self) -> &fidl::Channel {
10500        self.client.as_channel()
10501    }
10502}
10503
10504#[cfg(target_os = "fuchsia")]
10505impl ScreenCaptureSynchronousProxy {
10506    pub fn new(channel: fidl::Channel) -> Self {
10507        Self { client: fidl::client::sync::Client::new(channel) }
10508    }
10509
10510    pub fn into_channel(self) -> fidl::Channel {
10511        self.client.into_channel()
10512    }
10513
10514    /// Waits until an event arrives and returns it. It is safe for other
10515    /// threads to make concurrent requests while waiting for an event.
10516    pub fn wait_for_event(
10517        &self,
10518        deadline: zx::MonotonicInstant,
10519    ) -> Result<ScreenCaptureEvent, fidl::Error> {
10520        ScreenCaptureEvent::decode(self.client.wait_for_event::<ScreenCaptureMarker>(deadline)?)
10521    }
10522
10523    /// Clients should first use the Allocator protocol to register a
10524    /// BufferCollection. This function will fail with BAD_OPERATION unless all clients of the
10525    /// BufferCollection have set their constraints.
10526    ///
10527    /// Afterwards, clients should create and configure the images that will
10528    /// eventually be rendered to using this method. All the buffers in the
10529    /// collection from 0 to (buffer_count-1) may be used for screen capture.
10530    ///
10531    /// Clients are responsible for determining the rotation of the display,
10532    /// and applying the corrective rotation. For instance, if the display is
10533    /// mounted 90 degrees clockwise (the "top" is on the right, when looking
10534    /// at the display), then the client should specify a 270 degree rotation
10535    /// to account for it.
10536    ///
10537    /// Similarly, the clients are responsible for specifying a buffer big
10538    /// enough for the rotated image. If the buffer is too small, a best effort
10539    /// attempt will be made to render the image.
10540    ///
10541    /// Finally, clients request the server to render the current screen to the
10542    /// shared buffers using [`GetNextFrame`].
10543    ///
10544    /// [`Configure`] can be called again with a new BufferCollectionImportToken
10545    /// if the client wishes to change any of the configuration settings. In
10546    /// this case all the buffers from the previous call to [`Configure`] will
10547    /// be released.
10548    pub fn r#configure(
10549        &self,
10550        mut payload: ScreenCaptureConfig,
10551        ___deadline: zx::MonotonicInstant,
10552    ) -> Result<ScreenCaptureConfigureResult, fidl::Error> {
10553        let _response = self.client.send_query::<ScreenCaptureConfig, fidl::encoding::ResultType<
10554            fidl::encoding::EmptyStruct,
10555            ScreenCaptureError,
10556        >, ScreenCaptureMarker>(
10557            &mut payload,
10558            0x3b6e5af1d294afd9,
10559            fidl::encoding::DynamicFlags::empty(),
10560            ___deadline,
10561        )?;
10562        Ok(_response.map(|x| x))
10563    }
10564
10565    /// Following a successful call to [`Configure`], clients can call
10566    /// GetNextFrame. This will populate a buffer with the most recent frame.
10567    ///
10568    /// Clients should wait on the zx::event they pass for successful
10569    /// completion of the screenshot. It is not guaranteed that the screenshot
10570    /// will be completed by the time this function returns.
10571    ///
10572    /// The requested image will be in the BufferCollection that the client set
10573    /// up in the VMO at the index specified by buffer_id.
10574    ///
10575    /// When ScreenCapture is used to provide a stream, the rate that the
10576    /// client calls GetNextFrame will drive the frame rate.
10577    ///
10578    /// Errors:
10579    /// BAD_OPERATION if Configure was not called, or not called successfully
10580    /// MISSING_ARGS if a required argument is not present
10581    /// BUFFER_FULL if all buffers in the BufferCollection are in use. In this case, ReleaseFrame
10582    /// must be called to make a buffer available before this function can be called successfully.
10583    pub fn r#get_next_frame(
10584        &self,
10585        mut payload: GetNextFrameArgs,
10586        ___deadline: zx::MonotonicInstant,
10587    ) -> Result<ScreenCaptureGetNextFrameResult, fidl::Error> {
10588        let _response = self.client.send_query::<
10589            GetNextFrameArgs,
10590            fidl::encoding::ResultType<FrameInfo, ScreenCaptureError>,
10591            ScreenCaptureMarker,
10592        >(
10593            &mut payload,
10594            0x552c1580aab8c4a7,
10595            fidl::encoding::DynamicFlags::empty(),
10596            ___deadline,
10597        )?;
10598        Ok(_response.map(|x| x))
10599    }
10600
10601    /// Once the client no longer needs an image, they can call ReleaseFrame on
10602    /// the VMO index of the buffer so that the server can reuse it in the future.
10603    pub fn r#release_frame(
10604        &self,
10605        mut buffer_id: u32,
10606        ___deadline: zx::MonotonicInstant,
10607    ) -> Result<ScreenCaptureReleaseFrameResult, fidl::Error> {
10608        let _response =
10609            self.client.send_query::<ScreenCaptureReleaseFrameRequest, fidl::encoding::ResultType<
10610                fidl::encoding::EmptyStruct,
10611                ScreenCaptureError,
10612            >, ScreenCaptureMarker>(
10613                (buffer_id,),
10614                0x46704dce24e35950,
10615                fidl::encoding::DynamicFlags::empty(),
10616                ___deadline,
10617            )?;
10618        Ok(_response.map(|x| x))
10619    }
10620}
10621
10622#[cfg(target_os = "fuchsia")]
10623impl From<ScreenCaptureSynchronousProxy> for zx::NullableHandle {
10624    fn from(value: ScreenCaptureSynchronousProxy) -> Self {
10625        value.into_channel().into()
10626    }
10627}
10628
10629#[cfg(target_os = "fuchsia")]
10630impl From<fidl::Channel> for ScreenCaptureSynchronousProxy {
10631    fn from(value: fidl::Channel) -> Self {
10632        Self::new(value)
10633    }
10634}
10635
10636#[cfg(target_os = "fuchsia")]
10637impl fidl::endpoints::FromClient for ScreenCaptureSynchronousProxy {
10638    type Protocol = ScreenCaptureMarker;
10639
10640    fn from_client(value: fidl::endpoints::ClientEnd<ScreenCaptureMarker>) -> Self {
10641        Self::new(value.into_channel())
10642    }
10643}
10644
10645#[derive(Debug, Clone)]
10646pub struct ScreenCaptureProxy {
10647    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
10648}
10649
10650impl fidl::endpoints::Proxy for ScreenCaptureProxy {
10651    type Protocol = ScreenCaptureMarker;
10652
10653    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
10654        Self::new(inner)
10655    }
10656
10657    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
10658        self.client.into_channel().map_err(|client| Self { client })
10659    }
10660
10661    fn as_channel(&self) -> &::fidl::AsyncChannel {
10662        self.client.as_channel()
10663    }
10664}
10665
10666impl ScreenCaptureProxy {
10667    /// Create a new Proxy for fuchsia.ui.composition/ScreenCapture.
10668    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
10669        let protocol_name = <ScreenCaptureMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
10670        Self { client: fidl::client::Client::new(channel, protocol_name) }
10671    }
10672
10673    /// Get a Stream of events from the remote end of the protocol.
10674    ///
10675    /// # Panics
10676    ///
10677    /// Panics if the event stream was already taken.
10678    pub fn take_event_stream(&self) -> ScreenCaptureEventStream {
10679        ScreenCaptureEventStream { event_receiver: self.client.take_event_receiver() }
10680    }
10681
10682    /// Clients should first use the Allocator protocol to register a
10683    /// BufferCollection. This function will fail with BAD_OPERATION unless all clients of the
10684    /// BufferCollection have set their constraints.
10685    ///
10686    /// Afterwards, clients should create and configure the images that will
10687    /// eventually be rendered to using this method. All the buffers in the
10688    /// collection from 0 to (buffer_count-1) may be used for screen capture.
10689    ///
10690    /// Clients are responsible for determining the rotation of the display,
10691    /// and applying the corrective rotation. For instance, if the display is
10692    /// mounted 90 degrees clockwise (the "top" is on the right, when looking
10693    /// at the display), then the client should specify a 270 degree rotation
10694    /// to account for it.
10695    ///
10696    /// Similarly, the clients are responsible for specifying a buffer big
10697    /// enough for the rotated image. If the buffer is too small, a best effort
10698    /// attempt will be made to render the image.
10699    ///
10700    /// Finally, clients request the server to render the current screen to the
10701    /// shared buffers using [`GetNextFrame`].
10702    ///
10703    /// [`Configure`] can be called again with a new BufferCollectionImportToken
10704    /// if the client wishes to change any of the configuration settings. In
10705    /// this case all the buffers from the previous call to [`Configure`] will
10706    /// be released.
10707    pub fn r#configure(
10708        &self,
10709        mut payload: ScreenCaptureConfig,
10710    ) -> fidl::client::QueryResponseFut<
10711        ScreenCaptureConfigureResult,
10712        fidl::encoding::DefaultFuchsiaResourceDialect,
10713    > {
10714        ScreenCaptureProxyInterface::r#configure(self, payload)
10715    }
10716
10717    /// Following a successful call to [`Configure`], clients can call
10718    /// GetNextFrame. This will populate a buffer with the most recent frame.
10719    ///
10720    /// Clients should wait on the zx::event they pass for successful
10721    /// completion of the screenshot. It is not guaranteed that the screenshot
10722    /// will be completed by the time this function returns.
10723    ///
10724    /// The requested image will be in the BufferCollection that the client set
10725    /// up in the VMO at the index specified by buffer_id.
10726    ///
10727    /// When ScreenCapture is used to provide a stream, the rate that the
10728    /// client calls GetNextFrame will drive the frame rate.
10729    ///
10730    /// Errors:
10731    /// BAD_OPERATION if Configure was not called, or not called successfully
10732    /// MISSING_ARGS if a required argument is not present
10733    /// BUFFER_FULL if all buffers in the BufferCollection are in use. In this case, ReleaseFrame
10734    /// must be called to make a buffer available before this function can be called successfully.
10735    pub fn r#get_next_frame(
10736        &self,
10737        mut payload: GetNextFrameArgs,
10738    ) -> fidl::client::QueryResponseFut<
10739        ScreenCaptureGetNextFrameResult,
10740        fidl::encoding::DefaultFuchsiaResourceDialect,
10741    > {
10742        ScreenCaptureProxyInterface::r#get_next_frame(self, payload)
10743    }
10744
10745    /// Once the client no longer needs an image, they can call ReleaseFrame on
10746    /// the VMO index of the buffer so that the server can reuse it in the future.
10747    pub fn r#release_frame(
10748        &self,
10749        mut buffer_id: u32,
10750    ) -> fidl::client::QueryResponseFut<
10751        ScreenCaptureReleaseFrameResult,
10752        fidl::encoding::DefaultFuchsiaResourceDialect,
10753    > {
10754        ScreenCaptureProxyInterface::r#release_frame(self, buffer_id)
10755    }
10756}
10757
10758impl ScreenCaptureProxyInterface for ScreenCaptureProxy {
10759    type ConfigureResponseFut = fidl::client::QueryResponseFut<
10760        ScreenCaptureConfigureResult,
10761        fidl::encoding::DefaultFuchsiaResourceDialect,
10762    >;
10763    fn r#configure(&self, mut payload: ScreenCaptureConfig) -> Self::ConfigureResponseFut {
10764        fn _decode(
10765            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
10766        ) -> Result<ScreenCaptureConfigureResult, fidl::Error> {
10767            let _response = fidl::client::decode_transaction_body::<
10768                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, ScreenCaptureError>,
10769                fidl::encoding::DefaultFuchsiaResourceDialect,
10770                0x3b6e5af1d294afd9,
10771            >(_buf?)?;
10772            Ok(_response.map(|x| x))
10773        }
10774        self.client.send_query_and_decode::<ScreenCaptureConfig, ScreenCaptureConfigureResult>(
10775            &mut payload,
10776            0x3b6e5af1d294afd9,
10777            fidl::encoding::DynamicFlags::empty(),
10778            _decode,
10779        )
10780    }
10781
10782    type GetNextFrameResponseFut = fidl::client::QueryResponseFut<
10783        ScreenCaptureGetNextFrameResult,
10784        fidl::encoding::DefaultFuchsiaResourceDialect,
10785    >;
10786    fn r#get_next_frame(&self, mut payload: GetNextFrameArgs) -> Self::GetNextFrameResponseFut {
10787        fn _decode(
10788            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
10789        ) -> Result<ScreenCaptureGetNextFrameResult, fidl::Error> {
10790            let _response = fidl::client::decode_transaction_body::<
10791                fidl::encoding::ResultType<FrameInfo, ScreenCaptureError>,
10792                fidl::encoding::DefaultFuchsiaResourceDialect,
10793                0x552c1580aab8c4a7,
10794            >(_buf?)?;
10795            Ok(_response.map(|x| x))
10796        }
10797        self.client.send_query_and_decode::<GetNextFrameArgs, ScreenCaptureGetNextFrameResult>(
10798            &mut payload,
10799            0x552c1580aab8c4a7,
10800            fidl::encoding::DynamicFlags::empty(),
10801            _decode,
10802        )
10803    }
10804
10805    type ReleaseFrameResponseFut = fidl::client::QueryResponseFut<
10806        ScreenCaptureReleaseFrameResult,
10807        fidl::encoding::DefaultFuchsiaResourceDialect,
10808    >;
10809    fn r#release_frame(&self, mut buffer_id: u32) -> Self::ReleaseFrameResponseFut {
10810        fn _decode(
10811            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
10812        ) -> Result<ScreenCaptureReleaseFrameResult, fidl::Error> {
10813            let _response = fidl::client::decode_transaction_body::<
10814                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, ScreenCaptureError>,
10815                fidl::encoding::DefaultFuchsiaResourceDialect,
10816                0x46704dce24e35950,
10817            >(_buf?)?;
10818            Ok(_response.map(|x| x))
10819        }
10820        self.client.send_query_and_decode::<
10821            ScreenCaptureReleaseFrameRequest,
10822            ScreenCaptureReleaseFrameResult,
10823        >(
10824            (buffer_id,),
10825            0x46704dce24e35950,
10826            fidl::encoding::DynamicFlags::empty(),
10827            _decode,
10828        )
10829    }
10830}
10831
10832pub struct ScreenCaptureEventStream {
10833    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
10834}
10835
10836impl std::marker::Unpin for ScreenCaptureEventStream {}
10837
10838impl futures::stream::FusedStream for ScreenCaptureEventStream {
10839    fn is_terminated(&self) -> bool {
10840        self.event_receiver.is_terminated()
10841    }
10842}
10843
10844impl futures::Stream for ScreenCaptureEventStream {
10845    type Item = Result<ScreenCaptureEvent, fidl::Error>;
10846
10847    fn poll_next(
10848        mut self: std::pin::Pin<&mut Self>,
10849        cx: &mut std::task::Context<'_>,
10850    ) -> std::task::Poll<Option<Self::Item>> {
10851        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
10852            &mut self.event_receiver,
10853            cx
10854        )?) {
10855            Some(buf) => std::task::Poll::Ready(Some(ScreenCaptureEvent::decode(buf))),
10856            None => std::task::Poll::Ready(None),
10857        }
10858    }
10859}
10860
10861#[derive(Debug)]
10862pub enum ScreenCaptureEvent {}
10863
10864impl ScreenCaptureEvent {
10865    /// Decodes a message buffer as a [`ScreenCaptureEvent`].
10866    fn decode(
10867        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
10868    ) -> Result<ScreenCaptureEvent, fidl::Error> {
10869        let (bytes, _handles) = buf.split_mut();
10870        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
10871        debug_assert_eq!(tx_header.tx_id, 0);
10872        match tx_header.ordinal {
10873            _ => Err(fidl::Error::UnknownOrdinal {
10874                ordinal: tx_header.ordinal,
10875                protocol_name: <ScreenCaptureMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
10876            }),
10877        }
10878    }
10879}
10880
10881/// A Stream of incoming requests for fuchsia.ui.composition/ScreenCapture.
10882pub struct ScreenCaptureRequestStream {
10883    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
10884    is_terminated: bool,
10885}
10886
10887impl std::marker::Unpin for ScreenCaptureRequestStream {}
10888
10889impl futures::stream::FusedStream for ScreenCaptureRequestStream {
10890    fn is_terminated(&self) -> bool {
10891        self.is_terminated
10892    }
10893}
10894
10895impl fidl::endpoints::RequestStream for ScreenCaptureRequestStream {
10896    type Protocol = ScreenCaptureMarker;
10897    type ControlHandle = ScreenCaptureControlHandle;
10898
10899    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
10900        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
10901    }
10902
10903    fn control_handle(&self) -> Self::ControlHandle {
10904        ScreenCaptureControlHandle { inner: self.inner.clone() }
10905    }
10906
10907    fn into_inner(
10908        self,
10909    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
10910    {
10911        (self.inner, self.is_terminated)
10912    }
10913
10914    fn from_inner(
10915        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
10916        is_terminated: bool,
10917    ) -> Self {
10918        Self { inner, is_terminated }
10919    }
10920}
10921
10922impl futures::Stream for ScreenCaptureRequestStream {
10923    type Item = Result<ScreenCaptureRequest, fidl::Error>;
10924
10925    fn poll_next(
10926        mut self: std::pin::Pin<&mut Self>,
10927        cx: &mut std::task::Context<'_>,
10928    ) -> std::task::Poll<Option<Self::Item>> {
10929        let this = &mut *self;
10930        if this.inner.check_shutdown(cx) {
10931            this.is_terminated = true;
10932            return std::task::Poll::Ready(None);
10933        }
10934        if this.is_terminated {
10935            panic!("polled ScreenCaptureRequestStream after completion");
10936        }
10937        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
10938            |bytes, handles| {
10939                match this.inner.channel().read_etc(cx, bytes, handles) {
10940                    std::task::Poll::Ready(Ok(())) => {}
10941                    std::task::Poll::Pending => return std::task::Poll::Pending,
10942                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
10943                        this.is_terminated = true;
10944                        return std::task::Poll::Ready(None);
10945                    }
10946                    std::task::Poll::Ready(Err(e)) => {
10947                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
10948                            e.into(),
10949                        ))));
10950                    }
10951                }
10952
10953                // A message has been received from the channel
10954                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
10955
10956                std::task::Poll::Ready(Some(match header.ordinal {
10957                    0x3b6e5af1d294afd9 => {
10958                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
10959                        let mut req = fidl::new_empty!(
10960                            ScreenCaptureConfig,
10961                            fidl::encoding::DefaultFuchsiaResourceDialect
10962                        );
10963                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ScreenCaptureConfig>(&header, _body_bytes, handles, &mut req)?;
10964                        let control_handle =
10965                            ScreenCaptureControlHandle { inner: this.inner.clone() };
10966                        Ok(ScreenCaptureRequest::Configure {
10967                            payload: req,
10968                            responder: ScreenCaptureConfigureResponder {
10969                                control_handle: std::mem::ManuallyDrop::new(control_handle),
10970                                tx_id: header.tx_id,
10971                            },
10972                        })
10973                    }
10974                    0x552c1580aab8c4a7 => {
10975                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
10976                        let mut req = fidl::new_empty!(
10977                            GetNextFrameArgs,
10978                            fidl::encoding::DefaultFuchsiaResourceDialect
10979                        );
10980                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<GetNextFrameArgs>(&header, _body_bytes, handles, &mut req)?;
10981                        let control_handle =
10982                            ScreenCaptureControlHandle { inner: this.inner.clone() };
10983                        Ok(ScreenCaptureRequest::GetNextFrame {
10984                            payload: req,
10985                            responder: ScreenCaptureGetNextFrameResponder {
10986                                control_handle: std::mem::ManuallyDrop::new(control_handle),
10987                                tx_id: header.tx_id,
10988                            },
10989                        })
10990                    }
10991                    0x46704dce24e35950 => {
10992                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
10993                        let mut req = fidl::new_empty!(
10994                            ScreenCaptureReleaseFrameRequest,
10995                            fidl::encoding::DefaultFuchsiaResourceDialect
10996                        );
10997                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ScreenCaptureReleaseFrameRequest>(&header, _body_bytes, handles, &mut req)?;
10998                        let control_handle =
10999                            ScreenCaptureControlHandle { inner: this.inner.clone() };
11000                        Ok(ScreenCaptureRequest::ReleaseFrame {
11001                            buffer_id: req.buffer_id,
11002
11003                            responder: ScreenCaptureReleaseFrameResponder {
11004                                control_handle: std::mem::ManuallyDrop::new(control_handle),
11005                                tx_id: header.tx_id,
11006                            },
11007                        })
11008                    }
11009                    _ => Err(fidl::Error::UnknownOrdinal {
11010                        ordinal: header.ordinal,
11011                        protocol_name:
11012                            <ScreenCaptureMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
11013                    }),
11014                }))
11015            },
11016        )
11017    }
11018}
11019
11020/// This protocol provides a low-level ScreenCapture API for clients to use.
11021/// ScreenCapture clients should familiarize themselves with the
11022/// [`fuchsia.sysmem/BufferCollection`] and [`fuchsia.ui.composition/Allocator`] protocols
11023/// as those are necessary to create the BufferCollections and images ScreenCapture uses.
11024#[derive(Debug)]
11025pub enum ScreenCaptureRequest {
11026    /// Clients should first use the Allocator protocol to register a
11027    /// BufferCollection. This function will fail with BAD_OPERATION unless all clients of the
11028    /// BufferCollection have set their constraints.
11029    ///
11030    /// Afterwards, clients should create and configure the images that will
11031    /// eventually be rendered to using this method. All the buffers in the
11032    /// collection from 0 to (buffer_count-1) may be used for screen capture.
11033    ///
11034    /// Clients are responsible for determining the rotation of the display,
11035    /// and applying the corrective rotation. For instance, if the display is
11036    /// mounted 90 degrees clockwise (the "top" is on the right, when looking
11037    /// at the display), then the client should specify a 270 degree rotation
11038    /// to account for it.
11039    ///
11040    /// Similarly, the clients are responsible for specifying a buffer big
11041    /// enough for the rotated image. If the buffer is too small, a best effort
11042    /// attempt will be made to render the image.
11043    ///
11044    /// Finally, clients request the server to render the current screen to the
11045    /// shared buffers using [`GetNextFrame`].
11046    ///
11047    /// [`Configure`] can be called again with a new BufferCollectionImportToken
11048    /// if the client wishes to change any of the configuration settings. In
11049    /// this case all the buffers from the previous call to [`Configure`] will
11050    /// be released.
11051    Configure { payload: ScreenCaptureConfig, responder: ScreenCaptureConfigureResponder },
11052    /// Following a successful call to [`Configure`], clients can call
11053    /// GetNextFrame. This will populate a buffer with the most recent frame.
11054    ///
11055    /// Clients should wait on the zx::event they pass for successful
11056    /// completion of the screenshot. It is not guaranteed that the screenshot
11057    /// will be completed by the time this function returns.
11058    ///
11059    /// The requested image will be in the BufferCollection that the client set
11060    /// up in the VMO at the index specified by buffer_id.
11061    ///
11062    /// When ScreenCapture is used to provide a stream, the rate that the
11063    /// client calls GetNextFrame will drive the frame rate.
11064    ///
11065    /// Errors:
11066    /// BAD_OPERATION if Configure was not called, or not called successfully
11067    /// MISSING_ARGS if a required argument is not present
11068    /// BUFFER_FULL if all buffers in the BufferCollection are in use. In this case, ReleaseFrame
11069    /// must be called to make a buffer available before this function can be called successfully.
11070    GetNextFrame { payload: GetNextFrameArgs, responder: ScreenCaptureGetNextFrameResponder },
11071    /// Once the client no longer needs an image, they can call ReleaseFrame on
11072    /// the VMO index of the buffer so that the server can reuse it in the future.
11073    ReleaseFrame { buffer_id: u32, responder: ScreenCaptureReleaseFrameResponder },
11074}
11075
11076impl ScreenCaptureRequest {
11077    #[allow(irrefutable_let_patterns)]
11078    pub fn into_configure(self) -> Option<(ScreenCaptureConfig, ScreenCaptureConfigureResponder)> {
11079        if let ScreenCaptureRequest::Configure { payload, responder } = self {
11080            Some((payload, responder))
11081        } else {
11082            None
11083        }
11084    }
11085
11086    #[allow(irrefutable_let_patterns)]
11087    pub fn into_get_next_frame(
11088        self,
11089    ) -> Option<(GetNextFrameArgs, ScreenCaptureGetNextFrameResponder)> {
11090        if let ScreenCaptureRequest::GetNextFrame { payload, responder } = self {
11091            Some((payload, responder))
11092        } else {
11093            None
11094        }
11095    }
11096
11097    #[allow(irrefutable_let_patterns)]
11098    pub fn into_release_frame(self) -> Option<(u32, ScreenCaptureReleaseFrameResponder)> {
11099        if let ScreenCaptureRequest::ReleaseFrame { buffer_id, responder } = self {
11100            Some((buffer_id, responder))
11101        } else {
11102            None
11103        }
11104    }
11105
11106    /// Name of the method defined in FIDL
11107    pub fn method_name(&self) -> &'static str {
11108        match *self {
11109            ScreenCaptureRequest::Configure { .. } => "configure",
11110            ScreenCaptureRequest::GetNextFrame { .. } => "get_next_frame",
11111            ScreenCaptureRequest::ReleaseFrame { .. } => "release_frame",
11112        }
11113    }
11114}
11115
11116#[derive(Debug, Clone)]
11117pub struct ScreenCaptureControlHandle {
11118    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
11119}
11120
11121impl ScreenCaptureControlHandle {
11122    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
11123        self.inner.shutdown_with_epitaph(status.into())
11124    }
11125}
11126
11127impl fidl::endpoints::ControlHandle for ScreenCaptureControlHandle {
11128    fn shutdown(&self) {
11129        self.inner.shutdown()
11130    }
11131
11132    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
11133        self.inner.shutdown_with_epitaph(status)
11134    }
11135
11136    fn is_closed(&self) -> bool {
11137        self.inner.channel().is_closed()
11138    }
11139    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
11140        self.inner.channel().on_closed()
11141    }
11142
11143    #[cfg(target_os = "fuchsia")]
11144    fn signal_peer(
11145        &self,
11146        clear_mask: zx::Signals,
11147        set_mask: zx::Signals,
11148    ) -> Result<(), zx_status::Status> {
11149        use fidl::Peered;
11150        self.inner.channel().signal_peer(clear_mask, set_mask)
11151    }
11152}
11153
11154impl ScreenCaptureControlHandle {}
11155
11156#[must_use = "FIDL methods require a response to be sent"]
11157#[derive(Debug)]
11158pub struct ScreenCaptureConfigureResponder {
11159    control_handle: std::mem::ManuallyDrop<ScreenCaptureControlHandle>,
11160    tx_id: u32,
11161}
11162
11163/// Set the the channel to be shutdown (see [`ScreenCaptureControlHandle::shutdown`])
11164/// if the responder is dropped without sending a response, so that the client
11165/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
11166impl std::ops::Drop for ScreenCaptureConfigureResponder {
11167    fn drop(&mut self) {
11168        self.control_handle.shutdown();
11169        // Safety: drops once, never accessed again
11170        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
11171    }
11172}
11173
11174impl fidl::endpoints::Responder for ScreenCaptureConfigureResponder {
11175    type ControlHandle = ScreenCaptureControlHandle;
11176
11177    fn control_handle(&self) -> &ScreenCaptureControlHandle {
11178        &self.control_handle
11179    }
11180
11181    fn drop_without_shutdown(mut self) {
11182        // Safety: drops once, never accessed again due to mem::forget
11183        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
11184        // Prevent Drop from running (which would shut down the channel)
11185        std::mem::forget(self);
11186    }
11187}
11188
11189impl ScreenCaptureConfigureResponder {
11190    /// Sends a response to the FIDL transaction.
11191    ///
11192    /// Sets the channel to shutdown if an error occurs.
11193    pub fn send(self, mut result: Result<(), ScreenCaptureError>) -> Result<(), fidl::Error> {
11194        let _result = self.send_raw(result);
11195        if _result.is_err() {
11196            self.control_handle.shutdown();
11197        }
11198        self.drop_without_shutdown();
11199        _result
11200    }
11201
11202    /// Similar to "send" but does not shutdown the channel if an error occurs.
11203    pub fn send_no_shutdown_on_err(
11204        self,
11205        mut result: Result<(), ScreenCaptureError>,
11206    ) -> Result<(), fidl::Error> {
11207        let _result = self.send_raw(result);
11208        self.drop_without_shutdown();
11209        _result
11210    }
11211
11212    fn send_raw(&self, mut result: Result<(), ScreenCaptureError>) -> Result<(), fidl::Error> {
11213        self.control_handle.inner.send::<fidl::encoding::ResultType<
11214            fidl::encoding::EmptyStruct,
11215            ScreenCaptureError,
11216        >>(
11217            result,
11218            self.tx_id,
11219            0x3b6e5af1d294afd9,
11220            fidl::encoding::DynamicFlags::empty(),
11221        )
11222    }
11223}
11224
11225#[must_use = "FIDL methods require a response to be sent"]
11226#[derive(Debug)]
11227pub struct ScreenCaptureGetNextFrameResponder {
11228    control_handle: std::mem::ManuallyDrop<ScreenCaptureControlHandle>,
11229    tx_id: u32,
11230}
11231
11232/// Set the the channel to be shutdown (see [`ScreenCaptureControlHandle::shutdown`])
11233/// if the responder is dropped without sending a response, so that the client
11234/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
11235impl std::ops::Drop for ScreenCaptureGetNextFrameResponder {
11236    fn drop(&mut self) {
11237        self.control_handle.shutdown();
11238        // Safety: drops once, never accessed again
11239        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
11240    }
11241}
11242
11243impl fidl::endpoints::Responder for ScreenCaptureGetNextFrameResponder {
11244    type ControlHandle = ScreenCaptureControlHandle;
11245
11246    fn control_handle(&self) -> &ScreenCaptureControlHandle {
11247        &self.control_handle
11248    }
11249
11250    fn drop_without_shutdown(mut self) {
11251        // Safety: drops once, never accessed again due to mem::forget
11252        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
11253        // Prevent Drop from running (which would shut down the channel)
11254        std::mem::forget(self);
11255    }
11256}
11257
11258impl ScreenCaptureGetNextFrameResponder {
11259    /// Sends a response to the FIDL transaction.
11260    ///
11261    /// Sets the channel to shutdown if an error occurs.
11262    pub fn send(
11263        self,
11264        mut result: Result<FrameInfo, ScreenCaptureError>,
11265    ) -> Result<(), fidl::Error> {
11266        let _result = self.send_raw(result);
11267        if _result.is_err() {
11268            self.control_handle.shutdown();
11269        }
11270        self.drop_without_shutdown();
11271        _result
11272    }
11273
11274    /// Similar to "send" but does not shutdown the channel if an error occurs.
11275    pub fn send_no_shutdown_on_err(
11276        self,
11277        mut result: Result<FrameInfo, ScreenCaptureError>,
11278    ) -> Result<(), fidl::Error> {
11279        let _result = self.send_raw(result);
11280        self.drop_without_shutdown();
11281        _result
11282    }
11283
11284    fn send_raw(
11285        &self,
11286        mut result: Result<FrameInfo, ScreenCaptureError>,
11287    ) -> Result<(), fidl::Error> {
11288        self.control_handle.inner.send::<fidl::encoding::ResultType<FrameInfo, ScreenCaptureError>>(
11289            result.as_mut().map_err(|e| *e),
11290            self.tx_id,
11291            0x552c1580aab8c4a7,
11292            fidl::encoding::DynamicFlags::empty(),
11293        )
11294    }
11295}
11296
11297#[must_use = "FIDL methods require a response to be sent"]
11298#[derive(Debug)]
11299pub struct ScreenCaptureReleaseFrameResponder {
11300    control_handle: std::mem::ManuallyDrop<ScreenCaptureControlHandle>,
11301    tx_id: u32,
11302}
11303
11304/// Set the the channel to be shutdown (see [`ScreenCaptureControlHandle::shutdown`])
11305/// if the responder is dropped without sending a response, so that the client
11306/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
11307impl std::ops::Drop for ScreenCaptureReleaseFrameResponder {
11308    fn drop(&mut self) {
11309        self.control_handle.shutdown();
11310        // Safety: drops once, never accessed again
11311        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
11312    }
11313}
11314
11315impl fidl::endpoints::Responder for ScreenCaptureReleaseFrameResponder {
11316    type ControlHandle = ScreenCaptureControlHandle;
11317
11318    fn control_handle(&self) -> &ScreenCaptureControlHandle {
11319        &self.control_handle
11320    }
11321
11322    fn drop_without_shutdown(mut self) {
11323        // Safety: drops once, never accessed again due to mem::forget
11324        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
11325        // Prevent Drop from running (which would shut down the channel)
11326        std::mem::forget(self);
11327    }
11328}
11329
11330impl ScreenCaptureReleaseFrameResponder {
11331    /// Sends a response to the FIDL transaction.
11332    ///
11333    /// Sets the channel to shutdown if an error occurs.
11334    pub fn send(self, mut result: Result<(), ScreenCaptureError>) -> Result<(), fidl::Error> {
11335        let _result = self.send_raw(result);
11336        if _result.is_err() {
11337            self.control_handle.shutdown();
11338        }
11339        self.drop_without_shutdown();
11340        _result
11341    }
11342
11343    /// Similar to "send" but does not shutdown the channel if an error occurs.
11344    pub fn send_no_shutdown_on_err(
11345        self,
11346        mut result: Result<(), ScreenCaptureError>,
11347    ) -> Result<(), fidl::Error> {
11348        let _result = self.send_raw(result);
11349        self.drop_without_shutdown();
11350        _result
11351    }
11352
11353    fn send_raw(&self, mut result: Result<(), ScreenCaptureError>) -> Result<(), fidl::Error> {
11354        self.control_handle.inner.send::<fidl::encoding::ResultType<
11355            fidl::encoding::EmptyStruct,
11356            ScreenCaptureError,
11357        >>(
11358            result,
11359            self.tx_id,
11360            0x46704dce24e35950,
11361            fidl::encoding::DynamicFlags::empty(),
11362        )
11363    }
11364}
11365
11366#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
11367pub struct ScreenshotMarker;
11368
11369impl fidl::endpoints::ProtocolMarker for ScreenshotMarker {
11370    type Proxy = ScreenshotProxy;
11371    type RequestStream = ScreenshotRequestStream;
11372    #[cfg(target_os = "fuchsia")]
11373    type SynchronousProxy = ScreenshotSynchronousProxy;
11374
11375    const DEBUG_NAME: &'static str = "fuchsia.ui.composition.Screenshot";
11376}
11377impl fidl::endpoints::DiscoverableProtocolMarker for ScreenshotMarker {}
11378
11379pub trait ScreenshotProxyInterface: Send + Sync {
11380    type TakeResponseFut: std::future::Future<Output = Result<ScreenshotTakeResponse, fidl::Error>>
11381        + Send;
11382    fn r#take(&self, payload: ScreenshotTakeRequest) -> Self::TakeResponseFut;
11383    type TakeFileResponseFut: std::future::Future<Output = Result<ScreenshotTakeFileResponse, fidl::Error>>
11384        + Send;
11385    fn r#take_file(&self, payload: ScreenshotTakeFileRequest) -> Self::TakeFileResponseFut;
11386}
11387#[derive(Debug)]
11388#[cfg(target_os = "fuchsia")]
11389pub struct ScreenshotSynchronousProxy {
11390    client: fidl::client::sync::Client,
11391}
11392
11393#[cfg(target_os = "fuchsia")]
11394impl fidl::endpoints::SynchronousProxy for ScreenshotSynchronousProxy {
11395    type Proxy = ScreenshotProxy;
11396    type Protocol = ScreenshotMarker;
11397
11398    fn from_channel(inner: fidl::Channel) -> Self {
11399        Self::new(inner)
11400    }
11401
11402    fn into_channel(self) -> fidl::Channel {
11403        self.client.into_channel()
11404    }
11405
11406    fn as_channel(&self) -> &fidl::Channel {
11407        self.client.as_channel()
11408    }
11409}
11410
11411#[cfg(target_os = "fuchsia")]
11412impl ScreenshotSynchronousProxy {
11413    pub fn new(channel: fidl::Channel) -> Self {
11414        Self { client: fidl::client::sync::Client::new(channel) }
11415    }
11416
11417    pub fn into_channel(self) -> fidl::Channel {
11418        self.client.into_channel()
11419    }
11420
11421    /// Waits until an event arrives and returns it. It is safe for other
11422    /// threads to make concurrent requests while waiting for an event.
11423    pub fn wait_for_event(
11424        &self,
11425        deadline: zx::MonotonicInstant,
11426    ) -> Result<ScreenshotEvent, fidl::Error> {
11427        ScreenshotEvent::decode(self.client.wait_for_event::<ScreenshotMarker>(deadline)?)
11428    }
11429
11430    /// Collects the current graphical content of a display in a specified buffer `format` in the
11431    /// sRGB color space. Note that the sRGB color space is non-linear, meaning that unit tests
11432    /// doing pixel equality checks making use of non-fully saturated colors should convert to a
11433    /// linear color space.
11434    ///
11435    /// See https://fuchsia.dev/fuchsia-src/concepts/ui/scenic/color_spaces for more information.
11436    ///
11437    /// Screenshot is taken immediately, populated with the display's content from the most recent
11438    /// VSYNC.
11439    ///
11440    /// If the client calls [`Take`] a second time before a first [`Take`] call returns, the server
11441    /// will close the Screenshot connection with a ZX_ERR_SHOULD_WAIT epitaph.
11442    ///
11443    /// If capture fails due to an internal error, the server will close the Screenshot connection
11444    /// with a ZX_ERR_INTERNAL epitaph.
11445    pub fn r#take(
11446        &self,
11447        mut payload: ScreenshotTakeRequest,
11448        ___deadline: zx::MonotonicInstant,
11449    ) -> Result<ScreenshotTakeResponse, fidl::Error> {
11450        let _response = self
11451            .client
11452            .send_query::<ScreenshotTakeRequest, ScreenshotTakeResponse, ScreenshotMarker>(
11453                &mut payload,
11454                0x51341396e9fd2fd0,
11455                fidl::encoding::DynamicFlags::empty(),
11456                ___deadline,
11457            )?;
11458        Ok(_response)
11459    }
11460
11461    /// Collects the current graphical content of a display in a specified buffer `format` in the
11462    /// sRGB color space. Note that the sRGB color space is non-linear, meaning that unit tests
11463    /// doing pixel equality checks making use of non-fully saturated colors should convert to a
11464    /// linear color space.
11465    ///
11466    /// TODO(https://fxbug.dev/42065844): Link to fuchsia.dev documentation when it's up.
11467    ///
11468    /// Screenshot is taken immediately, populated with the display's content from the most recent
11469    /// VSYNC.
11470    ///
11471    /// If the client calls [`TakeFile`] a second time before a first [`TakeFile`] call returns,
11472    /// the server will close the Screenshot connection with a ZX_ERR_SHOULD_WAIT epitaph.
11473    ///
11474    /// If capture fails due to an internal error, the server will close the Screenshot connection
11475    /// with a ZX_ERR_INTERNAL epitaph.
11476    ///
11477    /// This call should be used if the client is on the host and does not support VMOs,
11478    /// as is the case for ffx tools.
11479    pub fn r#take_file(
11480        &self,
11481        mut payload: ScreenshotTakeFileRequest,
11482        ___deadline: zx::MonotonicInstant,
11483    ) -> Result<ScreenshotTakeFileResponse, fidl::Error> {
11484        let _response = self
11485            .client
11486            .send_query::<ScreenshotTakeFileRequest, ScreenshotTakeFileResponse, ScreenshotMarker>(
11487                &mut payload,
11488                0x470aeea0a4d32903,
11489                fidl::encoding::DynamicFlags::empty(),
11490                ___deadline,
11491            )?;
11492        Ok(_response)
11493    }
11494}
11495
11496#[cfg(target_os = "fuchsia")]
11497impl From<ScreenshotSynchronousProxy> for zx::NullableHandle {
11498    fn from(value: ScreenshotSynchronousProxy) -> Self {
11499        value.into_channel().into()
11500    }
11501}
11502
11503#[cfg(target_os = "fuchsia")]
11504impl From<fidl::Channel> for ScreenshotSynchronousProxy {
11505    fn from(value: fidl::Channel) -> Self {
11506        Self::new(value)
11507    }
11508}
11509
11510#[cfg(target_os = "fuchsia")]
11511impl fidl::endpoints::FromClient for ScreenshotSynchronousProxy {
11512    type Protocol = ScreenshotMarker;
11513
11514    fn from_client(value: fidl::endpoints::ClientEnd<ScreenshotMarker>) -> Self {
11515        Self::new(value.into_channel())
11516    }
11517}
11518
11519#[derive(Debug, Clone)]
11520pub struct ScreenshotProxy {
11521    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
11522}
11523
11524impl fidl::endpoints::Proxy for ScreenshotProxy {
11525    type Protocol = ScreenshotMarker;
11526
11527    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
11528        Self::new(inner)
11529    }
11530
11531    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
11532        self.client.into_channel().map_err(|client| Self { client })
11533    }
11534
11535    fn as_channel(&self) -> &::fidl::AsyncChannel {
11536        self.client.as_channel()
11537    }
11538}
11539
11540impl ScreenshotProxy {
11541    /// Create a new Proxy for fuchsia.ui.composition/Screenshot.
11542    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
11543        let protocol_name = <ScreenshotMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
11544        Self { client: fidl::client::Client::new(channel, protocol_name) }
11545    }
11546
11547    /// Get a Stream of events from the remote end of the protocol.
11548    ///
11549    /// # Panics
11550    ///
11551    /// Panics if the event stream was already taken.
11552    pub fn take_event_stream(&self) -> ScreenshotEventStream {
11553        ScreenshotEventStream { event_receiver: self.client.take_event_receiver() }
11554    }
11555
11556    /// Collects the current graphical content of a display in a specified buffer `format` in the
11557    /// sRGB color space. Note that the sRGB color space is non-linear, meaning that unit tests
11558    /// doing pixel equality checks making use of non-fully saturated colors should convert to a
11559    /// linear color space.
11560    ///
11561    /// See https://fuchsia.dev/fuchsia-src/concepts/ui/scenic/color_spaces for more information.
11562    ///
11563    /// Screenshot is taken immediately, populated with the display's content from the most recent
11564    /// VSYNC.
11565    ///
11566    /// If the client calls [`Take`] a second time before a first [`Take`] call returns, the server
11567    /// will close the Screenshot connection with a ZX_ERR_SHOULD_WAIT epitaph.
11568    ///
11569    /// If capture fails due to an internal error, the server will close the Screenshot connection
11570    /// with a ZX_ERR_INTERNAL epitaph.
11571    pub fn r#take(
11572        &self,
11573        mut payload: ScreenshotTakeRequest,
11574    ) -> fidl::client::QueryResponseFut<
11575        ScreenshotTakeResponse,
11576        fidl::encoding::DefaultFuchsiaResourceDialect,
11577    > {
11578        ScreenshotProxyInterface::r#take(self, payload)
11579    }
11580
11581    /// Collects the current graphical content of a display in a specified buffer `format` in the
11582    /// sRGB color space. Note that the sRGB color space is non-linear, meaning that unit tests
11583    /// doing pixel equality checks making use of non-fully saturated colors should convert to a
11584    /// linear color space.
11585    ///
11586    /// TODO(https://fxbug.dev/42065844): Link to fuchsia.dev documentation when it's up.
11587    ///
11588    /// Screenshot is taken immediately, populated with the display's content from the most recent
11589    /// VSYNC.
11590    ///
11591    /// If the client calls [`TakeFile`] a second time before a first [`TakeFile`] call returns,
11592    /// the server will close the Screenshot connection with a ZX_ERR_SHOULD_WAIT epitaph.
11593    ///
11594    /// If capture fails due to an internal error, the server will close the Screenshot connection
11595    /// with a ZX_ERR_INTERNAL epitaph.
11596    ///
11597    /// This call should be used if the client is on the host and does not support VMOs,
11598    /// as is the case for ffx tools.
11599    pub fn r#take_file(
11600        &self,
11601        mut payload: ScreenshotTakeFileRequest,
11602    ) -> fidl::client::QueryResponseFut<
11603        ScreenshotTakeFileResponse,
11604        fidl::encoding::DefaultFuchsiaResourceDialect,
11605    > {
11606        ScreenshotProxyInterface::r#take_file(self, payload)
11607    }
11608}
11609
11610impl ScreenshotProxyInterface for ScreenshotProxy {
11611    type TakeResponseFut = fidl::client::QueryResponseFut<
11612        ScreenshotTakeResponse,
11613        fidl::encoding::DefaultFuchsiaResourceDialect,
11614    >;
11615    fn r#take(&self, mut payload: ScreenshotTakeRequest) -> Self::TakeResponseFut {
11616        fn _decode(
11617            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
11618        ) -> Result<ScreenshotTakeResponse, fidl::Error> {
11619            let _response = fidl::client::decode_transaction_body::<
11620                ScreenshotTakeResponse,
11621                fidl::encoding::DefaultFuchsiaResourceDialect,
11622                0x51341396e9fd2fd0,
11623            >(_buf?)?;
11624            Ok(_response)
11625        }
11626        self.client.send_query_and_decode::<ScreenshotTakeRequest, ScreenshotTakeResponse>(
11627            &mut payload,
11628            0x51341396e9fd2fd0,
11629            fidl::encoding::DynamicFlags::empty(),
11630            _decode,
11631        )
11632    }
11633
11634    type TakeFileResponseFut = fidl::client::QueryResponseFut<
11635        ScreenshotTakeFileResponse,
11636        fidl::encoding::DefaultFuchsiaResourceDialect,
11637    >;
11638    fn r#take_file(&self, mut payload: ScreenshotTakeFileRequest) -> Self::TakeFileResponseFut {
11639        fn _decode(
11640            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
11641        ) -> Result<ScreenshotTakeFileResponse, fidl::Error> {
11642            let _response = fidl::client::decode_transaction_body::<
11643                ScreenshotTakeFileResponse,
11644                fidl::encoding::DefaultFuchsiaResourceDialect,
11645                0x470aeea0a4d32903,
11646            >(_buf?)?;
11647            Ok(_response)
11648        }
11649        self.client.send_query_and_decode::<ScreenshotTakeFileRequest, ScreenshotTakeFileResponse>(
11650            &mut payload,
11651            0x470aeea0a4d32903,
11652            fidl::encoding::DynamicFlags::empty(),
11653            _decode,
11654        )
11655    }
11656}
11657
11658pub struct ScreenshotEventStream {
11659    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
11660}
11661
11662impl std::marker::Unpin for ScreenshotEventStream {}
11663
11664impl futures::stream::FusedStream for ScreenshotEventStream {
11665    fn is_terminated(&self) -> bool {
11666        self.event_receiver.is_terminated()
11667    }
11668}
11669
11670impl futures::Stream for ScreenshotEventStream {
11671    type Item = Result<ScreenshotEvent, fidl::Error>;
11672
11673    fn poll_next(
11674        mut self: std::pin::Pin<&mut Self>,
11675        cx: &mut std::task::Context<'_>,
11676    ) -> std::task::Poll<Option<Self::Item>> {
11677        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
11678            &mut self.event_receiver,
11679            cx
11680        )?) {
11681            Some(buf) => std::task::Poll::Ready(Some(ScreenshotEvent::decode(buf))),
11682            None => std::task::Poll::Ready(None),
11683        }
11684    }
11685}
11686
11687#[derive(Debug)]
11688pub enum ScreenshotEvent {}
11689
11690impl ScreenshotEvent {
11691    /// Decodes a message buffer as a [`ScreenshotEvent`].
11692    fn decode(
11693        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
11694    ) -> Result<ScreenshotEvent, fidl::Error> {
11695        let (bytes, _handles) = buf.split_mut();
11696        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
11697        debug_assert_eq!(tx_header.tx_id, 0);
11698        match tx_header.ordinal {
11699            _ => Err(fidl::Error::UnknownOrdinal {
11700                ordinal: tx_header.ordinal,
11701                protocol_name: <ScreenshotMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
11702            }),
11703        }
11704    }
11705}
11706
11707/// A Stream of incoming requests for fuchsia.ui.composition/Screenshot.
11708pub struct ScreenshotRequestStream {
11709    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
11710    is_terminated: bool,
11711}
11712
11713impl std::marker::Unpin for ScreenshotRequestStream {}
11714
11715impl futures::stream::FusedStream for ScreenshotRequestStream {
11716    fn is_terminated(&self) -> bool {
11717        self.is_terminated
11718    }
11719}
11720
11721impl fidl::endpoints::RequestStream for ScreenshotRequestStream {
11722    type Protocol = ScreenshotMarker;
11723    type ControlHandle = ScreenshotControlHandle;
11724
11725    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
11726        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
11727    }
11728
11729    fn control_handle(&self) -> Self::ControlHandle {
11730        ScreenshotControlHandle { inner: self.inner.clone() }
11731    }
11732
11733    fn into_inner(
11734        self,
11735    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
11736    {
11737        (self.inner, self.is_terminated)
11738    }
11739
11740    fn from_inner(
11741        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
11742        is_terminated: bool,
11743    ) -> Self {
11744        Self { inner, is_terminated }
11745    }
11746}
11747
11748impl futures::Stream for ScreenshotRequestStream {
11749    type Item = Result<ScreenshotRequest, fidl::Error>;
11750
11751    fn poll_next(
11752        mut self: std::pin::Pin<&mut Self>,
11753        cx: &mut std::task::Context<'_>,
11754    ) -> std::task::Poll<Option<Self::Item>> {
11755        let this = &mut *self;
11756        if this.inner.check_shutdown(cx) {
11757            this.is_terminated = true;
11758            return std::task::Poll::Ready(None);
11759        }
11760        if this.is_terminated {
11761            panic!("polled ScreenshotRequestStream after completion");
11762        }
11763        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
11764            |bytes, handles| {
11765                match this.inner.channel().read_etc(cx, bytes, handles) {
11766                    std::task::Poll::Ready(Ok(())) => {}
11767                    std::task::Poll::Pending => return std::task::Poll::Pending,
11768                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
11769                        this.is_terminated = true;
11770                        return std::task::Poll::Ready(None);
11771                    }
11772                    std::task::Poll::Ready(Err(e)) => {
11773                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
11774                            e.into(),
11775                        ))));
11776                    }
11777                }
11778
11779                // A message has been received from the channel
11780                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
11781
11782                std::task::Poll::Ready(Some(match header.ordinal {
11783                    0x51341396e9fd2fd0 => {
11784                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
11785                        let mut req = fidl::new_empty!(
11786                            ScreenshotTakeRequest,
11787                            fidl::encoding::DefaultFuchsiaResourceDialect
11788                        );
11789                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ScreenshotTakeRequest>(&header, _body_bytes, handles, &mut req)?;
11790                        let control_handle = ScreenshotControlHandle { inner: this.inner.clone() };
11791                        Ok(ScreenshotRequest::Take {
11792                            payload: req,
11793                            responder: ScreenshotTakeResponder {
11794                                control_handle: std::mem::ManuallyDrop::new(control_handle),
11795                                tx_id: header.tx_id,
11796                            },
11797                        })
11798                    }
11799                    0x470aeea0a4d32903 => {
11800                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
11801                        let mut req = fidl::new_empty!(
11802                            ScreenshotTakeFileRequest,
11803                            fidl::encoding::DefaultFuchsiaResourceDialect
11804                        );
11805                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ScreenshotTakeFileRequest>(&header, _body_bytes, handles, &mut req)?;
11806                        let control_handle = ScreenshotControlHandle { inner: this.inner.clone() };
11807                        Ok(ScreenshotRequest::TakeFile {
11808                            payload: req,
11809                            responder: ScreenshotTakeFileResponder {
11810                                control_handle: std::mem::ManuallyDrop::new(control_handle),
11811                                tx_id: header.tx_id,
11812                            },
11813                        })
11814                    }
11815                    _ => Err(fidl::Error::UnknownOrdinal {
11816                        ordinal: header.ordinal,
11817                        protocol_name:
11818                            <ScreenshotMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
11819                    }),
11820                }))
11821            },
11822        )
11823    }
11824}
11825
11826/// Collects the current graphical content of a display.
11827#[derive(Debug)]
11828pub enum ScreenshotRequest {
11829    /// Collects the current graphical content of a display in a specified buffer `format` in the
11830    /// sRGB color space. Note that the sRGB color space is non-linear, meaning that unit tests
11831    /// doing pixel equality checks making use of non-fully saturated colors should convert to a
11832    /// linear color space.
11833    ///
11834    /// See https://fuchsia.dev/fuchsia-src/concepts/ui/scenic/color_spaces for more information.
11835    ///
11836    /// Screenshot is taken immediately, populated with the display's content from the most recent
11837    /// VSYNC.
11838    ///
11839    /// If the client calls [`Take`] a second time before a first [`Take`] call returns, the server
11840    /// will close the Screenshot connection with a ZX_ERR_SHOULD_WAIT epitaph.
11841    ///
11842    /// If capture fails due to an internal error, the server will close the Screenshot connection
11843    /// with a ZX_ERR_INTERNAL epitaph.
11844    Take { payload: ScreenshotTakeRequest, responder: ScreenshotTakeResponder },
11845    /// Collects the current graphical content of a display in a specified buffer `format` in the
11846    /// sRGB color space. Note that the sRGB color space is non-linear, meaning that unit tests
11847    /// doing pixel equality checks making use of non-fully saturated colors should convert to a
11848    /// linear color space.
11849    ///
11850    /// TODO(https://fxbug.dev/42065844): Link to fuchsia.dev documentation when it's up.
11851    ///
11852    /// Screenshot is taken immediately, populated with the display's content from the most recent
11853    /// VSYNC.
11854    ///
11855    /// If the client calls [`TakeFile`] a second time before a first [`TakeFile`] call returns,
11856    /// the server will close the Screenshot connection with a ZX_ERR_SHOULD_WAIT epitaph.
11857    ///
11858    /// If capture fails due to an internal error, the server will close the Screenshot connection
11859    /// with a ZX_ERR_INTERNAL epitaph.
11860    ///
11861    /// This call should be used if the client is on the host and does not support VMOs,
11862    /// as is the case for ffx tools.
11863    TakeFile { payload: ScreenshotTakeFileRequest, responder: ScreenshotTakeFileResponder },
11864}
11865
11866impl ScreenshotRequest {
11867    #[allow(irrefutable_let_patterns)]
11868    pub fn into_take(self) -> Option<(ScreenshotTakeRequest, ScreenshotTakeResponder)> {
11869        if let ScreenshotRequest::Take { payload, responder } = self {
11870            Some((payload, responder))
11871        } else {
11872            None
11873        }
11874    }
11875
11876    #[allow(irrefutable_let_patterns)]
11877    pub fn into_take_file(
11878        self,
11879    ) -> Option<(ScreenshotTakeFileRequest, ScreenshotTakeFileResponder)> {
11880        if let ScreenshotRequest::TakeFile { payload, responder } = self {
11881            Some((payload, responder))
11882        } else {
11883            None
11884        }
11885    }
11886
11887    /// Name of the method defined in FIDL
11888    pub fn method_name(&self) -> &'static str {
11889        match *self {
11890            ScreenshotRequest::Take { .. } => "take",
11891            ScreenshotRequest::TakeFile { .. } => "take_file",
11892        }
11893    }
11894}
11895
11896#[derive(Debug, Clone)]
11897pub struct ScreenshotControlHandle {
11898    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
11899}
11900
11901impl ScreenshotControlHandle {
11902    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
11903        self.inner.shutdown_with_epitaph(status.into())
11904    }
11905}
11906
11907impl fidl::endpoints::ControlHandle for ScreenshotControlHandle {
11908    fn shutdown(&self) {
11909        self.inner.shutdown()
11910    }
11911
11912    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
11913        self.inner.shutdown_with_epitaph(status)
11914    }
11915
11916    fn is_closed(&self) -> bool {
11917        self.inner.channel().is_closed()
11918    }
11919    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
11920        self.inner.channel().on_closed()
11921    }
11922
11923    #[cfg(target_os = "fuchsia")]
11924    fn signal_peer(
11925        &self,
11926        clear_mask: zx::Signals,
11927        set_mask: zx::Signals,
11928    ) -> Result<(), zx_status::Status> {
11929        use fidl::Peered;
11930        self.inner.channel().signal_peer(clear_mask, set_mask)
11931    }
11932}
11933
11934impl ScreenshotControlHandle {}
11935
11936#[must_use = "FIDL methods require a response to be sent"]
11937#[derive(Debug)]
11938pub struct ScreenshotTakeResponder {
11939    control_handle: std::mem::ManuallyDrop<ScreenshotControlHandle>,
11940    tx_id: u32,
11941}
11942
11943/// Set the the channel to be shutdown (see [`ScreenshotControlHandle::shutdown`])
11944/// if the responder is dropped without sending a response, so that the client
11945/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
11946impl std::ops::Drop for ScreenshotTakeResponder {
11947    fn drop(&mut self) {
11948        self.control_handle.shutdown();
11949        // Safety: drops once, never accessed again
11950        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
11951    }
11952}
11953
11954impl fidl::endpoints::Responder for ScreenshotTakeResponder {
11955    type ControlHandle = ScreenshotControlHandle;
11956
11957    fn control_handle(&self) -> &ScreenshotControlHandle {
11958        &self.control_handle
11959    }
11960
11961    fn drop_without_shutdown(mut self) {
11962        // Safety: drops once, never accessed again due to mem::forget
11963        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
11964        // Prevent Drop from running (which would shut down the channel)
11965        std::mem::forget(self);
11966    }
11967}
11968
11969impl ScreenshotTakeResponder {
11970    /// Sends a response to the FIDL transaction.
11971    ///
11972    /// Sets the channel to shutdown if an error occurs.
11973    pub fn send(self, mut payload: ScreenshotTakeResponse) -> Result<(), fidl::Error> {
11974        let _result = self.send_raw(payload);
11975        if _result.is_err() {
11976            self.control_handle.shutdown();
11977        }
11978        self.drop_without_shutdown();
11979        _result
11980    }
11981
11982    /// Similar to "send" but does not shutdown the channel if an error occurs.
11983    pub fn send_no_shutdown_on_err(
11984        self,
11985        mut payload: ScreenshotTakeResponse,
11986    ) -> Result<(), fidl::Error> {
11987        let _result = self.send_raw(payload);
11988        self.drop_without_shutdown();
11989        _result
11990    }
11991
11992    fn send_raw(&self, mut payload: ScreenshotTakeResponse) -> Result<(), fidl::Error> {
11993        self.control_handle.inner.send::<ScreenshotTakeResponse>(
11994            &mut payload,
11995            self.tx_id,
11996            0x51341396e9fd2fd0,
11997            fidl::encoding::DynamicFlags::empty(),
11998        )
11999    }
12000}
12001
12002#[must_use = "FIDL methods require a response to be sent"]
12003#[derive(Debug)]
12004pub struct ScreenshotTakeFileResponder {
12005    control_handle: std::mem::ManuallyDrop<ScreenshotControlHandle>,
12006    tx_id: u32,
12007}
12008
12009/// Set the the channel to be shutdown (see [`ScreenshotControlHandle::shutdown`])
12010/// if the responder is dropped without sending a response, so that the client
12011/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
12012impl std::ops::Drop for ScreenshotTakeFileResponder {
12013    fn drop(&mut self) {
12014        self.control_handle.shutdown();
12015        // Safety: drops once, never accessed again
12016        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
12017    }
12018}
12019
12020impl fidl::endpoints::Responder for ScreenshotTakeFileResponder {
12021    type ControlHandle = ScreenshotControlHandle;
12022
12023    fn control_handle(&self) -> &ScreenshotControlHandle {
12024        &self.control_handle
12025    }
12026
12027    fn drop_without_shutdown(mut self) {
12028        // Safety: drops once, never accessed again due to mem::forget
12029        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
12030        // Prevent Drop from running (which would shut down the channel)
12031        std::mem::forget(self);
12032    }
12033}
12034
12035impl ScreenshotTakeFileResponder {
12036    /// Sends a response to the FIDL transaction.
12037    ///
12038    /// Sets the channel to shutdown if an error occurs.
12039    pub fn send(self, mut payload: ScreenshotTakeFileResponse) -> Result<(), fidl::Error> {
12040        let _result = self.send_raw(payload);
12041        if _result.is_err() {
12042            self.control_handle.shutdown();
12043        }
12044        self.drop_without_shutdown();
12045        _result
12046    }
12047
12048    /// Similar to "send" but does not shutdown the channel if an error occurs.
12049    pub fn send_no_shutdown_on_err(
12050        self,
12051        mut payload: ScreenshotTakeFileResponse,
12052    ) -> Result<(), fidl::Error> {
12053        let _result = self.send_raw(payload);
12054        self.drop_without_shutdown();
12055        _result
12056    }
12057
12058    fn send_raw(&self, mut payload: ScreenshotTakeFileResponse) -> Result<(), fidl::Error> {
12059        self.control_handle.inner.send::<ScreenshotTakeFileResponse>(
12060            &mut payload,
12061            self.tx_id,
12062            0x470aeea0a4d32903,
12063            fidl::encoding::DynamicFlags::empty(),
12064        )
12065    }
12066}
12067
12068#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
12069pub struct TrustedFlatlandMarker;
12070
12071impl fidl::endpoints::ProtocolMarker for TrustedFlatlandMarker {
12072    type Proxy = TrustedFlatlandProxy;
12073    type RequestStream = TrustedFlatlandRequestStream;
12074    #[cfg(target_os = "fuchsia")]
12075    type SynchronousProxy = TrustedFlatlandSynchronousProxy;
12076
12077    const DEBUG_NAME: &'static str = "(anonymous) TrustedFlatland";
12078}
12079
12080pub trait TrustedFlatlandProxyInterface: Send + Sync {
12081    fn r#release_image_immediately(&self, image_id: &ContentId) -> Result<(), fidl::Error>;
12082    fn r#release_image_immediately2(&self, image_id: &ImageId) -> Result<(), fidl::Error>;
12083}
12084#[derive(Debug)]
12085#[cfg(target_os = "fuchsia")]
12086pub struct TrustedFlatlandSynchronousProxy {
12087    client: fidl::client::sync::Client,
12088}
12089
12090#[cfg(target_os = "fuchsia")]
12091impl fidl::endpoints::SynchronousProxy for TrustedFlatlandSynchronousProxy {
12092    type Proxy = TrustedFlatlandProxy;
12093    type Protocol = TrustedFlatlandMarker;
12094
12095    fn from_channel(inner: fidl::Channel) -> Self {
12096        Self::new(inner)
12097    }
12098
12099    fn into_channel(self) -> fidl::Channel {
12100        self.client.into_channel()
12101    }
12102
12103    fn as_channel(&self) -> &fidl::Channel {
12104        self.client.as_channel()
12105    }
12106}
12107
12108#[cfg(target_os = "fuchsia")]
12109impl TrustedFlatlandSynchronousProxy {
12110    pub fn new(channel: fidl::Channel) -> Self {
12111        Self { client: fidl::client::sync::Client::new(channel) }
12112    }
12113
12114    pub fn into_channel(self) -> fidl::Channel {
12115        self.client.into_channel()
12116    }
12117
12118    /// Waits until an event arrives and returns it. It is safe for other
12119    /// threads to make concurrent requests while waiting for an event.
12120    pub fn wait_for_event(
12121        &self,
12122        deadline: zx::MonotonicInstant,
12123    ) -> Result<TrustedFlatlandEvent, fidl::Error> {
12124        TrustedFlatlandEvent::decode(self.client.wait_for_event::<TrustedFlatlandMarker>(deadline)?)
12125    }
12126
12127    /// Releases an image immediately, without waiting for the next present.
12128    pub fn r#release_image_immediately(&self, mut image_id: &ContentId) -> Result<(), fidl::Error> {
12129        self.client.send::<TrustedFlatlandReleaseImageImmediatelyRequest>(
12130            (image_id,),
12131            0x245e1ac080772c8,
12132            fidl::encoding::DynamicFlags::empty(),
12133        )
12134    }
12135
12136    /// Releases an Image immediately, without waiting for the next present. This is a trusted
12137    /// memory-eviction path.
12138    ///
12139    /// The Image is forcibly unbound from any Layers that currently reference it. Those Layers
12140    /// behave as if their image was simply never set (they are invisible, but retain their image
12141    /// properties) until their next `SetLayerImage()`.
12142    ///
12143    /// Any pending release fences for the evicted Image's bindings will signal at the earliest
12144    /// safe point.
12145    ///
12146    /// This method is only available if Flatland2 is enabled and the session is trusted.
12147    pub fn r#release_image_immediately2(&self, mut image_id: &ImageId) -> Result<(), fidl::Error> {
12148        self.client.send::<TrustedFlatlandReleaseImageImmediately2Request>(
12149            (image_id,),
12150            0x6d6a73d150589146,
12151            fidl::encoding::DynamicFlags::empty(),
12152        )
12153    }
12154}
12155
12156#[cfg(target_os = "fuchsia")]
12157impl From<TrustedFlatlandSynchronousProxy> for zx::NullableHandle {
12158    fn from(value: TrustedFlatlandSynchronousProxy) -> Self {
12159        value.into_channel().into()
12160    }
12161}
12162
12163#[cfg(target_os = "fuchsia")]
12164impl From<fidl::Channel> for TrustedFlatlandSynchronousProxy {
12165    fn from(value: fidl::Channel) -> Self {
12166        Self::new(value)
12167    }
12168}
12169
12170#[cfg(target_os = "fuchsia")]
12171impl fidl::endpoints::FromClient for TrustedFlatlandSynchronousProxy {
12172    type Protocol = TrustedFlatlandMarker;
12173
12174    fn from_client(value: fidl::endpoints::ClientEnd<TrustedFlatlandMarker>) -> Self {
12175        Self::new(value.into_channel())
12176    }
12177}
12178
12179#[derive(Debug, Clone)]
12180pub struct TrustedFlatlandProxy {
12181    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
12182}
12183
12184impl fidl::endpoints::Proxy for TrustedFlatlandProxy {
12185    type Protocol = TrustedFlatlandMarker;
12186
12187    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
12188        Self::new(inner)
12189    }
12190
12191    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
12192        self.client.into_channel().map_err(|client| Self { client })
12193    }
12194
12195    fn as_channel(&self) -> &::fidl::AsyncChannel {
12196        self.client.as_channel()
12197    }
12198}
12199
12200impl TrustedFlatlandProxy {
12201    /// Create a new Proxy for fuchsia.ui.composition/TrustedFlatland.
12202    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
12203        let protocol_name = <TrustedFlatlandMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
12204        Self { client: fidl::client::Client::new(channel, protocol_name) }
12205    }
12206
12207    /// Get a Stream of events from the remote end of the protocol.
12208    ///
12209    /// # Panics
12210    ///
12211    /// Panics if the event stream was already taken.
12212    pub fn take_event_stream(&self) -> TrustedFlatlandEventStream {
12213        TrustedFlatlandEventStream { event_receiver: self.client.take_event_receiver() }
12214    }
12215
12216    /// Releases an image immediately, without waiting for the next present.
12217    pub fn r#release_image_immediately(&self, mut image_id: &ContentId) -> Result<(), fidl::Error> {
12218        TrustedFlatlandProxyInterface::r#release_image_immediately(self, image_id)
12219    }
12220
12221    /// Releases an Image immediately, without waiting for the next present. This is a trusted
12222    /// memory-eviction path.
12223    ///
12224    /// The Image is forcibly unbound from any Layers that currently reference it. Those Layers
12225    /// behave as if their image was simply never set (they are invisible, but retain their image
12226    /// properties) until their next `SetLayerImage()`.
12227    ///
12228    /// Any pending release fences for the evicted Image's bindings will signal at the earliest
12229    /// safe point.
12230    ///
12231    /// This method is only available if Flatland2 is enabled and the session is trusted.
12232    pub fn r#release_image_immediately2(&self, mut image_id: &ImageId) -> Result<(), fidl::Error> {
12233        TrustedFlatlandProxyInterface::r#release_image_immediately2(self, image_id)
12234    }
12235}
12236
12237impl TrustedFlatlandProxyInterface for TrustedFlatlandProxy {
12238    fn r#release_image_immediately(&self, mut image_id: &ContentId) -> Result<(), fidl::Error> {
12239        self.client.send::<TrustedFlatlandReleaseImageImmediatelyRequest>(
12240            (image_id,),
12241            0x245e1ac080772c8,
12242            fidl::encoding::DynamicFlags::empty(),
12243        )
12244    }
12245
12246    fn r#release_image_immediately2(&self, mut image_id: &ImageId) -> Result<(), fidl::Error> {
12247        self.client.send::<TrustedFlatlandReleaseImageImmediately2Request>(
12248            (image_id,),
12249            0x6d6a73d150589146,
12250            fidl::encoding::DynamicFlags::empty(),
12251        )
12252    }
12253}
12254
12255pub struct TrustedFlatlandEventStream {
12256    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
12257}
12258
12259impl std::marker::Unpin for TrustedFlatlandEventStream {}
12260
12261impl futures::stream::FusedStream for TrustedFlatlandEventStream {
12262    fn is_terminated(&self) -> bool {
12263        self.event_receiver.is_terminated()
12264    }
12265}
12266
12267impl futures::Stream for TrustedFlatlandEventStream {
12268    type Item = Result<TrustedFlatlandEvent, fidl::Error>;
12269
12270    fn poll_next(
12271        mut self: std::pin::Pin<&mut Self>,
12272        cx: &mut std::task::Context<'_>,
12273    ) -> std::task::Poll<Option<Self::Item>> {
12274        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
12275            &mut self.event_receiver,
12276            cx
12277        )?) {
12278            Some(buf) => std::task::Poll::Ready(Some(TrustedFlatlandEvent::decode(buf))),
12279            None => std::task::Poll::Ready(None),
12280        }
12281    }
12282}
12283
12284#[derive(Debug)]
12285pub enum TrustedFlatlandEvent {}
12286
12287impl TrustedFlatlandEvent {
12288    /// Decodes a message buffer as a [`TrustedFlatlandEvent`].
12289    fn decode(
12290        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
12291    ) -> Result<TrustedFlatlandEvent, fidl::Error> {
12292        let (bytes, _handles) = buf.split_mut();
12293        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
12294        debug_assert_eq!(tx_header.tx_id, 0);
12295        match tx_header.ordinal {
12296            _ => Err(fidl::Error::UnknownOrdinal {
12297                ordinal: tx_header.ordinal,
12298                protocol_name:
12299                    <TrustedFlatlandMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
12300            }),
12301        }
12302    }
12303}
12304
12305/// A Stream of incoming requests for fuchsia.ui.composition/TrustedFlatland.
12306pub struct TrustedFlatlandRequestStream {
12307    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
12308    is_terminated: bool,
12309}
12310
12311impl std::marker::Unpin for TrustedFlatlandRequestStream {}
12312
12313impl futures::stream::FusedStream for TrustedFlatlandRequestStream {
12314    fn is_terminated(&self) -> bool {
12315        self.is_terminated
12316    }
12317}
12318
12319impl fidl::endpoints::RequestStream for TrustedFlatlandRequestStream {
12320    type Protocol = TrustedFlatlandMarker;
12321    type ControlHandle = TrustedFlatlandControlHandle;
12322
12323    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
12324        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
12325    }
12326
12327    fn control_handle(&self) -> Self::ControlHandle {
12328        TrustedFlatlandControlHandle { inner: self.inner.clone() }
12329    }
12330
12331    fn into_inner(
12332        self,
12333    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
12334    {
12335        (self.inner, self.is_terminated)
12336    }
12337
12338    fn from_inner(
12339        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
12340        is_terminated: bool,
12341    ) -> Self {
12342        Self { inner, is_terminated }
12343    }
12344}
12345
12346impl futures::Stream for TrustedFlatlandRequestStream {
12347    type Item = Result<TrustedFlatlandRequest, fidl::Error>;
12348
12349    fn poll_next(
12350        mut self: std::pin::Pin<&mut Self>,
12351        cx: &mut std::task::Context<'_>,
12352    ) -> std::task::Poll<Option<Self::Item>> {
12353        let this = &mut *self;
12354        if this.inner.check_shutdown(cx) {
12355            this.is_terminated = true;
12356            return std::task::Poll::Ready(None);
12357        }
12358        if this.is_terminated {
12359            panic!("polled TrustedFlatlandRequestStream after completion");
12360        }
12361        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
12362            |bytes, handles| {
12363                match this.inner.channel().read_etc(cx, bytes, handles) {
12364                    std::task::Poll::Ready(Ok(())) => {}
12365                    std::task::Poll::Pending => return std::task::Poll::Pending,
12366                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
12367                        this.is_terminated = true;
12368                        return std::task::Poll::Ready(None);
12369                    }
12370                    std::task::Poll::Ready(Err(e)) => {
12371                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
12372                            e.into(),
12373                        ))));
12374                    }
12375                }
12376
12377                // A message has been received from the channel
12378                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
12379
12380                std::task::Poll::Ready(Some(match header.ordinal {
12381                    0x245e1ac080772c8 => {
12382                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
12383                        let mut req = fidl::new_empty!(
12384                            TrustedFlatlandReleaseImageImmediatelyRequest,
12385                            fidl::encoding::DefaultFuchsiaResourceDialect
12386                        );
12387                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<TrustedFlatlandReleaseImageImmediatelyRequest>(&header, _body_bytes, handles, &mut req)?;
12388                        let control_handle =
12389                            TrustedFlatlandControlHandle { inner: this.inner.clone() };
12390                        Ok(TrustedFlatlandRequest::ReleaseImageImmediately {
12391                            image_id: req.image_id,
12392
12393                            control_handle,
12394                        })
12395                    }
12396                    0x6d6a73d150589146 => {
12397                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
12398                        let mut req = fidl::new_empty!(
12399                            TrustedFlatlandReleaseImageImmediately2Request,
12400                            fidl::encoding::DefaultFuchsiaResourceDialect
12401                        );
12402                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<TrustedFlatlandReleaseImageImmediately2Request>(&header, _body_bytes, handles, &mut req)?;
12403                        let control_handle =
12404                            TrustedFlatlandControlHandle { inner: this.inner.clone() };
12405                        Ok(TrustedFlatlandRequest::ReleaseImageImmediately2 {
12406                            image_id: req.image_id,
12407
12408                            control_handle,
12409                        })
12410                    }
12411                    _ => Err(fidl::Error::UnknownOrdinal {
12412                        ordinal: header.ordinal,
12413                        protocol_name:
12414                            <TrustedFlatlandMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
12415                    }),
12416                }))
12417            },
12418        )
12419    }
12420}
12421
12422/// A privileged protocol for trusted Flatland sessions that require special capabilities.
12423///
12424/// This protocol is composed into the [Flatland] protocol. Methods in this protocol
12425/// are only available if the Flatland session was created via [TrustedFlatlandFactory].
12426#[derive(Debug)]
12427pub enum TrustedFlatlandRequest {
12428    /// Releases an image immediately, without waiting for the next present.
12429    ReleaseImageImmediately { image_id: ContentId, control_handle: TrustedFlatlandControlHandle },
12430    /// Releases an Image immediately, without waiting for the next present. This is a trusted
12431    /// memory-eviction path.
12432    ///
12433    /// The Image is forcibly unbound from any Layers that currently reference it. Those Layers
12434    /// behave as if their image was simply never set (they are invisible, but retain their image
12435    /// properties) until their next `SetLayerImage()`.
12436    ///
12437    /// Any pending release fences for the evicted Image's bindings will signal at the earliest
12438    /// safe point.
12439    ///
12440    /// This method is only available if Flatland2 is enabled and the session is trusted.
12441    ReleaseImageImmediately2 { image_id: ImageId, control_handle: TrustedFlatlandControlHandle },
12442}
12443
12444impl TrustedFlatlandRequest {
12445    #[allow(irrefutable_let_patterns)]
12446    pub fn into_release_image_immediately(
12447        self,
12448    ) -> Option<(ContentId, TrustedFlatlandControlHandle)> {
12449        if let TrustedFlatlandRequest::ReleaseImageImmediately { image_id, control_handle } = self {
12450            Some((image_id, control_handle))
12451        } else {
12452            None
12453        }
12454    }
12455
12456    #[allow(irrefutable_let_patterns)]
12457    pub fn into_release_image_immediately2(
12458        self,
12459    ) -> Option<(ImageId, TrustedFlatlandControlHandle)> {
12460        if let TrustedFlatlandRequest::ReleaseImageImmediately2 { image_id, control_handle } = self
12461        {
12462            Some((image_id, control_handle))
12463        } else {
12464            None
12465        }
12466    }
12467
12468    /// Name of the method defined in FIDL
12469    pub fn method_name(&self) -> &'static str {
12470        match *self {
12471            TrustedFlatlandRequest::ReleaseImageImmediately { .. } => "release_image_immediately",
12472            TrustedFlatlandRequest::ReleaseImageImmediately2 { .. } => "release_image_immediately2",
12473        }
12474    }
12475}
12476
12477#[derive(Debug, Clone)]
12478pub struct TrustedFlatlandControlHandle {
12479    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
12480}
12481
12482impl TrustedFlatlandControlHandle {
12483    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
12484        self.inner.shutdown_with_epitaph(status.into())
12485    }
12486}
12487
12488impl fidl::endpoints::ControlHandle for TrustedFlatlandControlHandle {
12489    fn shutdown(&self) {
12490        self.inner.shutdown()
12491    }
12492
12493    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
12494        self.inner.shutdown_with_epitaph(status)
12495    }
12496
12497    fn is_closed(&self) -> bool {
12498        self.inner.channel().is_closed()
12499    }
12500    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
12501        self.inner.channel().on_closed()
12502    }
12503
12504    #[cfg(target_os = "fuchsia")]
12505    fn signal_peer(
12506        &self,
12507        clear_mask: zx::Signals,
12508        set_mask: zx::Signals,
12509    ) -> Result<(), zx_status::Status> {
12510        use fidl::Peered;
12511        self.inner.channel().signal_peer(clear_mask, set_mask)
12512    }
12513}
12514
12515impl TrustedFlatlandControlHandle {}
12516
12517#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
12518pub struct TrustedFlatlandFactoryMarker;
12519
12520impl fidl::endpoints::ProtocolMarker for TrustedFlatlandFactoryMarker {
12521    type Proxy = TrustedFlatlandFactoryProxy;
12522    type RequestStream = TrustedFlatlandFactoryRequestStream;
12523    #[cfg(target_os = "fuchsia")]
12524    type SynchronousProxy = TrustedFlatlandFactorySynchronousProxy;
12525
12526    const DEBUG_NAME: &'static str = "fuchsia.ui.composition.TrustedFlatlandFactory";
12527}
12528impl fidl::endpoints::DiscoverableProtocolMarker for TrustedFlatlandFactoryMarker {}
12529pub type TrustedFlatlandFactoryCreateFlatlandResult = Result<(), TrustedFlatlandFactoryError>;
12530
12531pub trait TrustedFlatlandFactoryProxyInterface: Send + Sync {
12532    type CreateFlatlandResponseFut: std::future::Future<
12533            Output = Result<TrustedFlatlandFactoryCreateFlatlandResult, fidl::Error>,
12534        > + Send;
12535    fn r#create_flatland(
12536        &self,
12537        server_end: fidl::endpoints::ServerEnd<FlatlandMarker>,
12538        config: TrustedFlatlandConfig,
12539    ) -> Self::CreateFlatlandResponseFut;
12540}
12541#[derive(Debug)]
12542#[cfg(target_os = "fuchsia")]
12543pub struct TrustedFlatlandFactorySynchronousProxy {
12544    client: fidl::client::sync::Client,
12545}
12546
12547#[cfg(target_os = "fuchsia")]
12548impl fidl::endpoints::SynchronousProxy for TrustedFlatlandFactorySynchronousProxy {
12549    type Proxy = TrustedFlatlandFactoryProxy;
12550    type Protocol = TrustedFlatlandFactoryMarker;
12551
12552    fn from_channel(inner: fidl::Channel) -> Self {
12553        Self::new(inner)
12554    }
12555
12556    fn into_channel(self) -> fidl::Channel {
12557        self.client.into_channel()
12558    }
12559
12560    fn as_channel(&self) -> &fidl::Channel {
12561        self.client.as_channel()
12562    }
12563}
12564
12565#[cfg(target_os = "fuchsia")]
12566impl TrustedFlatlandFactorySynchronousProxy {
12567    pub fn new(channel: fidl::Channel) -> Self {
12568        Self { client: fidl::client::sync::Client::new(channel) }
12569    }
12570
12571    pub fn into_channel(self) -> fidl::Channel {
12572        self.client.into_channel()
12573    }
12574
12575    /// Waits until an event arrives and returns it. It is safe for other
12576    /// threads to make concurrent requests while waiting for an event.
12577    pub fn wait_for_event(
12578        &self,
12579        deadline: zx::MonotonicInstant,
12580    ) -> Result<TrustedFlatlandFactoryEvent, fidl::Error> {
12581        TrustedFlatlandFactoryEvent::decode(
12582            self.client.wait_for_event::<TrustedFlatlandFactoryMarker>(deadline)?,
12583        )
12584    }
12585
12586    /// Creates a new Flatland session with the specified configuration.
12587    ///
12588    /// ## Error
12589    ///
12590    /// Returns a [TrustedFlatlandFactoryError] error if the operation fails.
12591    pub fn r#create_flatland(
12592        &self,
12593        mut server_end: fidl::endpoints::ServerEnd<FlatlandMarker>,
12594        mut config: TrustedFlatlandConfig,
12595        ___deadline: zx::MonotonicInstant,
12596    ) -> Result<TrustedFlatlandFactoryCreateFlatlandResult, fidl::Error> {
12597        let _response = self.client.send_query::<
12598            TrustedFlatlandFactoryCreateFlatlandRequest,
12599            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, TrustedFlatlandFactoryError>,
12600            TrustedFlatlandFactoryMarker,
12601        >(
12602            (server_end, &mut config,),
12603            0x48e89c53f00561dc,
12604            fidl::encoding::DynamicFlags::empty(),
12605            ___deadline,
12606        )?;
12607        Ok(_response.map(|x| x))
12608    }
12609}
12610
12611#[cfg(target_os = "fuchsia")]
12612impl From<TrustedFlatlandFactorySynchronousProxy> for zx::NullableHandle {
12613    fn from(value: TrustedFlatlandFactorySynchronousProxy) -> Self {
12614        value.into_channel().into()
12615    }
12616}
12617
12618#[cfg(target_os = "fuchsia")]
12619impl From<fidl::Channel> for TrustedFlatlandFactorySynchronousProxy {
12620    fn from(value: fidl::Channel) -> Self {
12621        Self::new(value)
12622    }
12623}
12624
12625#[cfg(target_os = "fuchsia")]
12626impl fidl::endpoints::FromClient for TrustedFlatlandFactorySynchronousProxy {
12627    type Protocol = TrustedFlatlandFactoryMarker;
12628
12629    fn from_client(value: fidl::endpoints::ClientEnd<TrustedFlatlandFactoryMarker>) -> Self {
12630        Self::new(value.into_channel())
12631    }
12632}
12633
12634#[derive(Debug, Clone)]
12635pub struct TrustedFlatlandFactoryProxy {
12636    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
12637}
12638
12639impl fidl::endpoints::Proxy for TrustedFlatlandFactoryProxy {
12640    type Protocol = TrustedFlatlandFactoryMarker;
12641
12642    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
12643        Self::new(inner)
12644    }
12645
12646    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
12647        self.client.into_channel().map_err(|client| Self { client })
12648    }
12649
12650    fn as_channel(&self) -> &::fidl::AsyncChannel {
12651        self.client.as_channel()
12652    }
12653}
12654
12655impl TrustedFlatlandFactoryProxy {
12656    /// Create a new Proxy for fuchsia.ui.composition/TrustedFlatlandFactory.
12657    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
12658        let protocol_name =
12659            <TrustedFlatlandFactoryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
12660        Self { client: fidl::client::Client::new(channel, protocol_name) }
12661    }
12662
12663    /// Get a Stream of events from the remote end of the protocol.
12664    ///
12665    /// # Panics
12666    ///
12667    /// Panics if the event stream was already taken.
12668    pub fn take_event_stream(&self) -> TrustedFlatlandFactoryEventStream {
12669        TrustedFlatlandFactoryEventStream { event_receiver: self.client.take_event_receiver() }
12670    }
12671
12672    /// Creates a new Flatland session with the specified configuration.
12673    ///
12674    /// ## Error
12675    ///
12676    /// Returns a [TrustedFlatlandFactoryError] error if the operation fails.
12677    pub fn r#create_flatland(
12678        &self,
12679        mut server_end: fidl::endpoints::ServerEnd<FlatlandMarker>,
12680        mut config: TrustedFlatlandConfig,
12681    ) -> fidl::client::QueryResponseFut<
12682        TrustedFlatlandFactoryCreateFlatlandResult,
12683        fidl::encoding::DefaultFuchsiaResourceDialect,
12684    > {
12685        TrustedFlatlandFactoryProxyInterface::r#create_flatland(self, server_end, config)
12686    }
12687}
12688
12689impl TrustedFlatlandFactoryProxyInterface for TrustedFlatlandFactoryProxy {
12690    type CreateFlatlandResponseFut = fidl::client::QueryResponseFut<
12691        TrustedFlatlandFactoryCreateFlatlandResult,
12692        fidl::encoding::DefaultFuchsiaResourceDialect,
12693    >;
12694    fn r#create_flatland(
12695        &self,
12696        mut server_end: fidl::endpoints::ServerEnd<FlatlandMarker>,
12697        mut config: TrustedFlatlandConfig,
12698    ) -> Self::CreateFlatlandResponseFut {
12699        fn _decode(
12700            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
12701        ) -> Result<TrustedFlatlandFactoryCreateFlatlandResult, fidl::Error> {
12702            let _response = fidl::client::decode_transaction_body::<
12703                fidl::encoding::ResultType<
12704                    fidl::encoding::EmptyStruct,
12705                    TrustedFlatlandFactoryError,
12706                >,
12707                fidl::encoding::DefaultFuchsiaResourceDialect,
12708                0x48e89c53f00561dc,
12709            >(_buf?)?;
12710            Ok(_response.map(|x| x))
12711        }
12712        self.client.send_query_and_decode::<
12713            TrustedFlatlandFactoryCreateFlatlandRequest,
12714            TrustedFlatlandFactoryCreateFlatlandResult,
12715        >(
12716            (server_end, &mut config,),
12717            0x48e89c53f00561dc,
12718            fidl::encoding::DynamicFlags::empty(),
12719            _decode,
12720        )
12721    }
12722}
12723
12724pub struct TrustedFlatlandFactoryEventStream {
12725    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
12726}
12727
12728impl std::marker::Unpin for TrustedFlatlandFactoryEventStream {}
12729
12730impl futures::stream::FusedStream for TrustedFlatlandFactoryEventStream {
12731    fn is_terminated(&self) -> bool {
12732        self.event_receiver.is_terminated()
12733    }
12734}
12735
12736impl futures::Stream for TrustedFlatlandFactoryEventStream {
12737    type Item = Result<TrustedFlatlandFactoryEvent, fidl::Error>;
12738
12739    fn poll_next(
12740        mut self: std::pin::Pin<&mut Self>,
12741        cx: &mut std::task::Context<'_>,
12742    ) -> std::task::Poll<Option<Self::Item>> {
12743        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
12744            &mut self.event_receiver,
12745            cx
12746        )?) {
12747            Some(buf) => std::task::Poll::Ready(Some(TrustedFlatlandFactoryEvent::decode(buf))),
12748            None => std::task::Poll::Ready(None),
12749        }
12750    }
12751}
12752
12753#[derive(Debug)]
12754pub enum TrustedFlatlandFactoryEvent {}
12755
12756impl TrustedFlatlandFactoryEvent {
12757    /// Decodes a message buffer as a [`TrustedFlatlandFactoryEvent`].
12758    fn decode(
12759        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
12760    ) -> Result<TrustedFlatlandFactoryEvent, fidl::Error> {
12761        let (bytes, _handles) = buf.split_mut();
12762        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
12763        debug_assert_eq!(tx_header.tx_id, 0);
12764        match tx_header.ordinal {
12765            _ => Err(fidl::Error::UnknownOrdinal {
12766                ordinal: tx_header.ordinal,
12767                protocol_name:
12768                    <TrustedFlatlandFactoryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
12769            }),
12770        }
12771    }
12772}
12773
12774/// A Stream of incoming requests for fuchsia.ui.composition/TrustedFlatlandFactory.
12775pub struct TrustedFlatlandFactoryRequestStream {
12776    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
12777    is_terminated: bool,
12778}
12779
12780impl std::marker::Unpin for TrustedFlatlandFactoryRequestStream {}
12781
12782impl futures::stream::FusedStream for TrustedFlatlandFactoryRequestStream {
12783    fn is_terminated(&self) -> bool {
12784        self.is_terminated
12785    }
12786}
12787
12788impl fidl::endpoints::RequestStream for TrustedFlatlandFactoryRequestStream {
12789    type Protocol = TrustedFlatlandFactoryMarker;
12790    type ControlHandle = TrustedFlatlandFactoryControlHandle;
12791
12792    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
12793        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
12794    }
12795
12796    fn control_handle(&self) -> Self::ControlHandle {
12797        TrustedFlatlandFactoryControlHandle { inner: self.inner.clone() }
12798    }
12799
12800    fn into_inner(
12801        self,
12802    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
12803    {
12804        (self.inner, self.is_terminated)
12805    }
12806
12807    fn from_inner(
12808        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
12809        is_terminated: bool,
12810    ) -> Self {
12811        Self { inner, is_terminated }
12812    }
12813}
12814
12815impl futures::Stream for TrustedFlatlandFactoryRequestStream {
12816    type Item = Result<TrustedFlatlandFactoryRequest, fidl::Error>;
12817
12818    fn poll_next(
12819        mut self: std::pin::Pin<&mut Self>,
12820        cx: &mut std::task::Context<'_>,
12821    ) -> std::task::Poll<Option<Self::Item>> {
12822        let this = &mut *self;
12823        if this.inner.check_shutdown(cx) {
12824            this.is_terminated = true;
12825            return std::task::Poll::Ready(None);
12826        }
12827        if this.is_terminated {
12828            panic!("polled TrustedFlatlandFactoryRequestStream after completion");
12829        }
12830        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
12831            |bytes, handles| {
12832                match this.inner.channel().read_etc(cx, bytes, handles) {
12833                    std::task::Poll::Ready(Ok(())) => {}
12834                    std::task::Poll::Pending => return std::task::Poll::Pending,
12835                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
12836                        this.is_terminated = true;
12837                        return std::task::Poll::Ready(None);
12838                    }
12839                    std::task::Poll::Ready(Err(e)) => {
12840                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
12841                            e.into(),
12842                        ))));
12843                    }
12844                }
12845
12846                // A message has been received from the channel
12847                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
12848
12849                std::task::Poll::Ready(Some(match header.ordinal {
12850                0x48e89c53f00561dc => {
12851                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
12852                    let mut req = fidl::new_empty!(TrustedFlatlandFactoryCreateFlatlandRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
12853                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<TrustedFlatlandFactoryCreateFlatlandRequest>(&header, _body_bytes, handles, &mut req)?;
12854                    let control_handle = TrustedFlatlandFactoryControlHandle {
12855                        inner: this.inner.clone(),
12856                    };
12857                    Ok(TrustedFlatlandFactoryRequest::CreateFlatland {server_end: req.server_end,
12858config: req.config,
12859
12860                        responder: TrustedFlatlandFactoryCreateFlatlandResponder {
12861                            control_handle: std::mem::ManuallyDrop::new(control_handle),
12862                            tx_id: header.tx_id,
12863                        },
12864                    })
12865                }
12866                _ => Err(fidl::Error::UnknownOrdinal {
12867                    ordinal: header.ordinal,
12868                    protocol_name: <TrustedFlatlandFactoryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
12869                }),
12870            }))
12871            },
12872        )
12873    }
12874}
12875
12876/// A privileged factory for creating Flatland sessions with special configurations.
12877///
12878/// This protocol is intended for trusted clients that require fine-grained control over
12879/// Flatland's behavior for performance-critical applications. It is not intended for
12880/// general use. Misuse of this API can negatively impact system performance and stability.
12881#[derive(Debug)]
12882pub enum TrustedFlatlandFactoryRequest {
12883    /// Creates a new Flatland session with the specified configuration.
12884    ///
12885    /// ## Error
12886    ///
12887    /// Returns a [TrustedFlatlandFactoryError] error if the operation fails.
12888    CreateFlatland {
12889        server_end: fidl::endpoints::ServerEnd<FlatlandMarker>,
12890        config: TrustedFlatlandConfig,
12891        responder: TrustedFlatlandFactoryCreateFlatlandResponder,
12892    },
12893}
12894
12895impl TrustedFlatlandFactoryRequest {
12896    #[allow(irrefutable_let_patterns)]
12897    pub fn into_create_flatland(
12898        self,
12899    ) -> Option<(
12900        fidl::endpoints::ServerEnd<FlatlandMarker>,
12901        TrustedFlatlandConfig,
12902        TrustedFlatlandFactoryCreateFlatlandResponder,
12903    )> {
12904        if let TrustedFlatlandFactoryRequest::CreateFlatland { server_end, config, responder } =
12905            self
12906        {
12907            Some((server_end, config, responder))
12908        } else {
12909            None
12910        }
12911    }
12912
12913    /// Name of the method defined in FIDL
12914    pub fn method_name(&self) -> &'static str {
12915        match *self {
12916            TrustedFlatlandFactoryRequest::CreateFlatland { .. } => "create_flatland",
12917        }
12918    }
12919}
12920
12921#[derive(Debug, Clone)]
12922pub struct TrustedFlatlandFactoryControlHandle {
12923    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
12924}
12925
12926impl TrustedFlatlandFactoryControlHandle {
12927    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
12928        self.inner.shutdown_with_epitaph(status.into())
12929    }
12930}
12931
12932impl fidl::endpoints::ControlHandle for TrustedFlatlandFactoryControlHandle {
12933    fn shutdown(&self) {
12934        self.inner.shutdown()
12935    }
12936
12937    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
12938        self.inner.shutdown_with_epitaph(status)
12939    }
12940
12941    fn is_closed(&self) -> bool {
12942        self.inner.channel().is_closed()
12943    }
12944    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
12945        self.inner.channel().on_closed()
12946    }
12947
12948    #[cfg(target_os = "fuchsia")]
12949    fn signal_peer(
12950        &self,
12951        clear_mask: zx::Signals,
12952        set_mask: zx::Signals,
12953    ) -> Result<(), zx_status::Status> {
12954        use fidl::Peered;
12955        self.inner.channel().signal_peer(clear_mask, set_mask)
12956    }
12957}
12958
12959impl TrustedFlatlandFactoryControlHandle {}
12960
12961#[must_use = "FIDL methods require a response to be sent"]
12962#[derive(Debug)]
12963pub struct TrustedFlatlandFactoryCreateFlatlandResponder {
12964    control_handle: std::mem::ManuallyDrop<TrustedFlatlandFactoryControlHandle>,
12965    tx_id: u32,
12966}
12967
12968/// Set the the channel to be shutdown (see [`TrustedFlatlandFactoryControlHandle::shutdown`])
12969/// if the responder is dropped without sending a response, so that the client
12970/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
12971impl std::ops::Drop for TrustedFlatlandFactoryCreateFlatlandResponder {
12972    fn drop(&mut self) {
12973        self.control_handle.shutdown();
12974        // Safety: drops once, never accessed again
12975        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
12976    }
12977}
12978
12979impl fidl::endpoints::Responder for TrustedFlatlandFactoryCreateFlatlandResponder {
12980    type ControlHandle = TrustedFlatlandFactoryControlHandle;
12981
12982    fn control_handle(&self) -> &TrustedFlatlandFactoryControlHandle {
12983        &self.control_handle
12984    }
12985
12986    fn drop_without_shutdown(mut self) {
12987        // Safety: drops once, never accessed again due to mem::forget
12988        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
12989        // Prevent Drop from running (which would shut down the channel)
12990        std::mem::forget(self);
12991    }
12992}
12993
12994impl TrustedFlatlandFactoryCreateFlatlandResponder {
12995    /// Sends a response to the FIDL transaction.
12996    ///
12997    /// Sets the channel to shutdown if an error occurs.
12998    pub fn send(
12999        self,
13000        mut result: Result<(), TrustedFlatlandFactoryError>,
13001    ) -> Result<(), fidl::Error> {
13002        let _result = self.send_raw(result);
13003        if _result.is_err() {
13004            self.control_handle.shutdown();
13005        }
13006        self.drop_without_shutdown();
13007        _result
13008    }
13009
13010    /// Similar to "send" but does not shutdown the channel if an error occurs.
13011    pub fn send_no_shutdown_on_err(
13012        self,
13013        mut result: Result<(), TrustedFlatlandFactoryError>,
13014    ) -> Result<(), fidl::Error> {
13015        let _result = self.send_raw(result);
13016        self.drop_without_shutdown();
13017        _result
13018    }
13019
13020    fn send_raw(
13021        &self,
13022        mut result: Result<(), TrustedFlatlandFactoryError>,
13023    ) -> Result<(), fidl::Error> {
13024        self.control_handle.inner.send::<fidl::encoding::ResultType<
13025            fidl::encoding::EmptyStruct,
13026            TrustedFlatlandFactoryError,
13027        >>(
13028            result,
13029            self.tx_id,
13030            0x48e89c53f00561dc,
13031            fidl::encoding::DynamicFlags::empty(),
13032        )
13033    }
13034}
13035
13036mod internal {
13037    use super::*;
13038
13039    impl fidl::encoding::ResourceTypeMarker for AllocatorRegisterBufferCollectionRequest {
13040        type Borrowed<'a> = &'a mut Self;
13041        fn take_or_borrow<'a>(
13042            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
13043        ) -> Self::Borrowed<'a> {
13044            value
13045        }
13046    }
13047
13048    unsafe impl fidl::encoding::TypeMarker for AllocatorRegisterBufferCollectionRequest {
13049        type Owned = Self;
13050
13051        #[inline(always)]
13052        fn inline_align(_context: fidl::encoding::Context) -> usize {
13053            8
13054        }
13055
13056        #[inline(always)]
13057        fn inline_size(_context: fidl::encoding::Context) -> usize {
13058            16
13059        }
13060    }
13061
13062    unsafe impl
13063        fidl::encoding::Encode<
13064            AllocatorRegisterBufferCollectionRequest,
13065            fidl::encoding::DefaultFuchsiaResourceDialect,
13066        > for &mut AllocatorRegisterBufferCollectionRequest
13067    {
13068        #[inline]
13069        unsafe fn encode(
13070            self,
13071            encoder: &mut fidl::encoding::Encoder<
13072                '_,
13073                fidl::encoding::DefaultFuchsiaResourceDialect,
13074            >,
13075            offset: usize,
13076            _depth: fidl::encoding::Depth,
13077        ) -> fidl::Result<()> {
13078            encoder.debug_check_bounds::<AllocatorRegisterBufferCollectionRequest>(offset);
13079            // Delegate to tuple encoding.
13080            fidl::encoding::Encode::<AllocatorRegisterBufferCollectionRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
13081                (
13082                    <RegisterBufferCollectionArgs as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.args),
13083                ),
13084                encoder, offset, _depth
13085            )
13086        }
13087    }
13088    unsafe impl<
13089        T0: fidl::encoding::Encode<
13090                RegisterBufferCollectionArgs,
13091                fidl::encoding::DefaultFuchsiaResourceDialect,
13092            >,
13093    >
13094        fidl::encoding::Encode<
13095            AllocatorRegisterBufferCollectionRequest,
13096            fidl::encoding::DefaultFuchsiaResourceDialect,
13097        > for (T0,)
13098    {
13099        #[inline]
13100        unsafe fn encode(
13101            self,
13102            encoder: &mut fidl::encoding::Encoder<
13103                '_,
13104                fidl::encoding::DefaultFuchsiaResourceDialect,
13105            >,
13106            offset: usize,
13107            depth: fidl::encoding::Depth,
13108        ) -> fidl::Result<()> {
13109            encoder.debug_check_bounds::<AllocatorRegisterBufferCollectionRequest>(offset);
13110            // Zero out padding regions. There's no need to apply masks
13111            // because the unmasked parts will be overwritten by fields.
13112            // Write the fields.
13113            self.0.encode(encoder, offset + 0, depth)?;
13114            Ok(())
13115        }
13116    }
13117
13118    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
13119        for AllocatorRegisterBufferCollectionRequest
13120    {
13121        #[inline(always)]
13122        fn new_empty() -> Self {
13123            Self {
13124                args: fidl::new_empty!(
13125                    RegisterBufferCollectionArgs,
13126                    fidl::encoding::DefaultFuchsiaResourceDialect
13127                ),
13128            }
13129        }
13130
13131        #[inline]
13132        unsafe fn decode(
13133            &mut self,
13134            decoder: &mut fidl::encoding::Decoder<
13135                '_,
13136                fidl::encoding::DefaultFuchsiaResourceDialect,
13137            >,
13138            offset: usize,
13139            _depth: fidl::encoding::Depth,
13140        ) -> fidl::Result<()> {
13141            decoder.debug_check_bounds::<Self>(offset);
13142            // Verify that padding bytes are zero.
13143            fidl::decode!(
13144                RegisterBufferCollectionArgs,
13145                fidl::encoding::DefaultFuchsiaResourceDialect,
13146                &mut self.args,
13147                decoder,
13148                offset + 0,
13149                _depth
13150            )?;
13151            Ok(())
13152        }
13153    }
13154
13155    impl fidl::encoding::ResourceTypeMarker for BufferCollectionExportToken {
13156        type Borrowed<'a> = &'a mut Self;
13157        fn take_or_borrow<'a>(
13158            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
13159        ) -> Self::Borrowed<'a> {
13160            value
13161        }
13162    }
13163
13164    unsafe impl fidl::encoding::TypeMarker for BufferCollectionExportToken {
13165        type Owned = Self;
13166
13167        #[inline(always)]
13168        fn inline_align(_context: fidl::encoding::Context) -> usize {
13169            4
13170        }
13171
13172        #[inline(always)]
13173        fn inline_size(_context: fidl::encoding::Context) -> usize {
13174            4
13175        }
13176    }
13177
13178    unsafe impl
13179        fidl::encoding::Encode<
13180            BufferCollectionExportToken,
13181            fidl::encoding::DefaultFuchsiaResourceDialect,
13182        > for &mut BufferCollectionExportToken
13183    {
13184        #[inline]
13185        unsafe fn encode(
13186            self,
13187            encoder: &mut fidl::encoding::Encoder<
13188                '_,
13189                fidl::encoding::DefaultFuchsiaResourceDialect,
13190            >,
13191            offset: usize,
13192            _depth: fidl::encoding::Depth,
13193        ) -> fidl::Result<()> {
13194            encoder.debug_check_bounds::<BufferCollectionExportToken>(offset);
13195            // Delegate to tuple encoding.
13196            fidl::encoding::Encode::<
13197                BufferCollectionExportToken,
13198                fidl::encoding::DefaultFuchsiaResourceDialect,
13199            >::encode(
13200                (<fidl::encoding::HandleType<
13201                    fidl::EventPair,
13202                    { fidl::ObjectType::EVENTPAIR.into_raw() },
13203                    2147483648,
13204                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
13205                    &mut self.value
13206                ),),
13207                encoder,
13208                offset,
13209                _depth,
13210            )
13211        }
13212    }
13213    unsafe impl<
13214        T0: fidl::encoding::Encode<
13215                fidl::encoding::HandleType<
13216                    fidl::EventPair,
13217                    { fidl::ObjectType::EVENTPAIR.into_raw() },
13218                    2147483648,
13219                >,
13220                fidl::encoding::DefaultFuchsiaResourceDialect,
13221            >,
13222    >
13223        fidl::encoding::Encode<
13224            BufferCollectionExportToken,
13225            fidl::encoding::DefaultFuchsiaResourceDialect,
13226        > for (T0,)
13227    {
13228        #[inline]
13229        unsafe fn encode(
13230            self,
13231            encoder: &mut fidl::encoding::Encoder<
13232                '_,
13233                fidl::encoding::DefaultFuchsiaResourceDialect,
13234            >,
13235            offset: usize,
13236            depth: fidl::encoding::Depth,
13237        ) -> fidl::Result<()> {
13238            encoder.debug_check_bounds::<BufferCollectionExportToken>(offset);
13239            // Zero out padding regions. There's no need to apply masks
13240            // because the unmasked parts will be overwritten by fields.
13241            // Write the fields.
13242            self.0.encode(encoder, offset + 0, depth)?;
13243            Ok(())
13244        }
13245    }
13246
13247    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
13248        for BufferCollectionExportToken
13249    {
13250        #[inline(always)]
13251        fn new_empty() -> Self {
13252            Self {
13253                value: fidl::new_empty!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
13254            }
13255        }
13256
13257        #[inline]
13258        unsafe fn decode(
13259            &mut self,
13260            decoder: &mut fidl::encoding::Decoder<
13261                '_,
13262                fidl::encoding::DefaultFuchsiaResourceDialect,
13263            >,
13264            offset: usize,
13265            _depth: fidl::encoding::Depth,
13266        ) -> fidl::Result<()> {
13267            decoder.debug_check_bounds::<Self>(offset);
13268            // Verify that padding bytes are zero.
13269            fidl::decode!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.value, decoder, offset + 0, _depth)?;
13270            Ok(())
13271        }
13272    }
13273
13274    impl fidl::encoding::ResourceTypeMarker for BufferCollectionImportToken {
13275        type Borrowed<'a> = &'a mut Self;
13276        fn take_or_borrow<'a>(
13277            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
13278        ) -> Self::Borrowed<'a> {
13279            value
13280        }
13281    }
13282
13283    unsafe impl fidl::encoding::TypeMarker for BufferCollectionImportToken {
13284        type Owned = Self;
13285
13286        #[inline(always)]
13287        fn inline_align(_context: fidl::encoding::Context) -> usize {
13288            4
13289        }
13290
13291        #[inline(always)]
13292        fn inline_size(_context: fidl::encoding::Context) -> usize {
13293            4
13294        }
13295    }
13296
13297    unsafe impl
13298        fidl::encoding::Encode<
13299            BufferCollectionImportToken,
13300            fidl::encoding::DefaultFuchsiaResourceDialect,
13301        > for &mut BufferCollectionImportToken
13302    {
13303        #[inline]
13304        unsafe fn encode(
13305            self,
13306            encoder: &mut fidl::encoding::Encoder<
13307                '_,
13308                fidl::encoding::DefaultFuchsiaResourceDialect,
13309            >,
13310            offset: usize,
13311            _depth: fidl::encoding::Depth,
13312        ) -> fidl::Result<()> {
13313            encoder.debug_check_bounds::<BufferCollectionImportToken>(offset);
13314            // Delegate to tuple encoding.
13315            fidl::encoding::Encode::<
13316                BufferCollectionImportToken,
13317                fidl::encoding::DefaultFuchsiaResourceDialect,
13318            >::encode(
13319                (<fidl::encoding::HandleType<
13320                    fidl::EventPair,
13321                    { fidl::ObjectType::EVENTPAIR.into_raw() },
13322                    2147483648,
13323                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
13324                    &mut self.value
13325                ),),
13326                encoder,
13327                offset,
13328                _depth,
13329            )
13330        }
13331    }
13332    unsafe impl<
13333        T0: fidl::encoding::Encode<
13334                fidl::encoding::HandleType<
13335                    fidl::EventPair,
13336                    { fidl::ObjectType::EVENTPAIR.into_raw() },
13337                    2147483648,
13338                >,
13339                fidl::encoding::DefaultFuchsiaResourceDialect,
13340            >,
13341    >
13342        fidl::encoding::Encode<
13343            BufferCollectionImportToken,
13344            fidl::encoding::DefaultFuchsiaResourceDialect,
13345        > for (T0,)
13346    {
13347        #[inline]
13348        unsafe fn encode(
13349            self,
13350            encoder: &mut fidl::encoding::Encoder<
13351                '_,
13352                fidl::encoding::DefaultFuchsiaResourceDialect,
13353            >,
13354            offset: usize,
13355            depth: fidl::encoding::Depth,
13356        ) -> fidl::Result<()> {
13357            encoder.debug_check_bounds::<BufferCollectionImportToken>(offset);
13358            // Zero out padding regions. There's no need to apply masks
13359            // because the unmasked parts will be overwritten by fields.
13360            // Write the fields.
13361            self.0.encode(encoder, offset + 0, depth)?;
13362            Ok(())
13363        }
13364    }
13365
13366    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
13367        for BufferCollectionImportToken
13368    {
13369        #[inline(always)]
13370        fn new_empty() -> Self {
13371            Self {
13372                value: fidl::new_empty!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
13373            }
13374        }
13375
13376        #[inline]
13377        unsafe fn decode(
13378            &mut self,
13379            decoder: &mut fidl::encoding::Decoder<
13380                '_,
13381                fidl::encoding::DefaultFuchsiaResourceDialect,
13382            >,
13383            offset: usize,
13384            _depth: fidl::encoding::Depth,
13385        ) -> fidl::Result<()> {
13386            decoder.debug_check_bounds::<Self>(offset);
13387            // Verify that padding bytes are zero.
13388            fidl::decode!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.value, decoder, offset + 0, _depth)?;
13389            Ok(())
13390        }
13391    }
13392
13393    impl fidl::encoding::ResourceTypeMarker for ChildViewWatcherGetViewRefResponse {
13394        type Borrowed<'a> = &'a mut Self;
13395        fn take_or_borrow<'a>(
13396            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
13397        ) -> Self::Borrowed<'a> {
13398            value
13399        }
13400    }
13401
13402    unsafe impl fidl::encoding::TypeMarker for ChildViewWatcherGetViewRefResponse {
13403        type Owned = Self;
13404
13405        #[inline(always)]
13406        fn inline_align(_context: fidl::encoding::Context) -> usize {
13407            4
13408        }
13409
13410        #[inline(always)]
13411        fn inline_size(_context: fidl::encoding::Context) -> usize {
13412            4
13413        }
13414    }
13415
13416    unsafe impl
13417        fidl::encoding::Encode<
13418            ChildViewWatcherGetViewRefResponse,
13419            fidl::encoding::DefaultFuchsiaResourceDialect,
13420        > for &mut ChildViewWatcherGetViewRefResponse
13421    {
13422        #[inline]
13423        unsafe fn encode(
13424            self,
13425            encoder: &mut fidl::encoding::Encoder<
13426                '_,
13427                fidl::encoding::DefaultFuchsiaResourceDialect,
13428            >,
13429            offset: usize,
13430            _depth: fidl::encoding::Depth,
13431        ) -> fidl::Result<()> {
13432            encoder.debug_check_bounds::<ChildViewWatcherGetViewRefResponse>(offset);
13433            // Delegate to tuple encoding.
13434            fidl::encoding::Encode::<ChildViewWatcherGetViewRefResponse, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
13435                (
13436                    <fidl_fuchsia_ui_views::ViewRef as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.view_ref),
13437                ),
13438                encoder, offset, _depth
13439            )
13440        }
13441    }
13442    unsafe impl<
13443        T0: fidl::encoding::Encode<
13444                fidl_fuchsia_ui_views::ViewRef,
13445                fidl::encoding::DefaultFuchsiaResourceDialect,
13446            >,
13447    >
13448        fidl::encoding::Encode<
13449            ChildViewWatcherGetViewRefResponse,
13450            fidl::encoding::DefaultFuchsiaResourceDialect,
13451        > for (T0,)
13452    {
13453        #[inline]
13454        unsafe fn encode(
13455            self,
13456            encoder: &mut fidl::encoding::Encoder<
13457                '_,
13458                fidl::encoding::DefaultFuchsiaResourceDialect,
13459            >,
13460            offset: usize,
13461            depth: fidl::encoding::Depth,
13462        ) -> fidl::Result<()> {
13463            encoder.debug_check_bounds::<ChildViewWatcherGetViewRefResponse>(offset);
13464            // Zero out padding regions. There's no need to apply masks
13465            // because the unmasked parts will be overwritten by fields.
13466            // Write the fields.
13467            self.0.encode(encoder, offset + 0, depth)?;
13468            Ok(())
13469        }
13470    }
13471
13472    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
13473        for ChildViewWatcherGetViewRefResponse
13474    {
13475        #[inline(always)]
13476        fn new_empty() -> Self {
13477            Self {
13478                view_ref: fidl::new_empty!(
13479                    fidl_fuchsia_ui_views::ViewRef,
13480                    fidl::encoding::DefaultFuchsiaResourceDialect
13481                ),
13482            }
13483        }
13484
13485        #[inline]
13486        unsafe fn decode(
13487            &mut self,
13488            decoder: &mut fidl::encoding::Decoder<
13489                '_,
13490                fidl::encoding::DefaultFuchsiaResourceDialect,
13491            >,
13492            offset: usize,
13493            _depth: fidl::encoding::Depth,
13494        ) -> fidl::Result<()> {
13495            decoder.debug_check_bounds::<Self>(offset);
13496            // Verify that padding bytes are zero.
13497            fidl::decode!(
13498                fidl_fuchsia_ui_views::ViewRef,
13499                fidl::encoding::DefaultFuchsiaResourceDialect,
13500                &mut self.view_ref,
13501                decoder,
13502                offset + 0,
13503                _depth
13504            )?;
13505            Ok(())
13506        }
13507    }
13508
13509    impl fidl::encoding::ResourceTypeMarker for Flatland2CreateImage2Request {
13510        type Borrowed<'a> = &'a mut Self;
13511        fn take_or_borrow<'a>(
13512            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
13513        ) -> Self::Borrowed<'a> {
13514            value
13515        }
13516    }
13517
13518    unsafe impl fidl::encoding::TypeMarker for Flatland2CreateImage2Request {
13519        type Owned = Self;
13520
13521        #[inline(always)]
13522        fn inline_align(_context: fidl::encoding::Context) -> usize {
13523            8
13524        }
13525
13526        #[inline(always)]
13527        fn inline_size(_context: fidl::encoding::Context) -> usize {
13528            32
13529        }
13530    }
13531
13532    unsafe impl
13533        fidl::encoding::Encode<
13534            Flatland2CreateImage2Request,
13535            fidl::encoding::DefaultFuchsiaResourceDialect,
13536        > for &mut Flatland2CreateImage2Request
13537    {
13538        #[inline]
13539        unsafe fn encode(
13540            self,
13541            encoder: &mut fidl::encoding::Encoder<
13542                '_,
13543                fidl::encoding::DefaultFuchsiaResourceDialect,
13544            >,
13545            offset: usize,
13546            _depth: fidl::encoding::Depth,
13547        ) -> fidl::Result<()> {
13548            encoder.debug_check_bounds::<Flatland2CreateImage2Request>(offset);
13549            // Delegate to tuple encoding.
13550            fidl::encoding::Encode::<Flatland2CreateImage2Request, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
13551                (
13552                    <ImageId as fidl::encoding::ValueTypeMarker>::borrow(&self.image_id),
13553                    <BufferCollectionImportToken as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.import_token),
13554                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.vmo_index),
13555                    <ImageProperties as fidl::encoding::ValueTypeMarker>::borrow(&self.properties),
13556                ),
13557                encoder, offset, _depth
13558            )
13559        }
13560    }
13561    unsafe impl<
13562        T0: fidl::encoding::Encode<ImageId, fidl::encoding::DefaultFuchsiaResourceDialect>,
13563        T1: fidl::encoding::Encode<
13564                BufferCollectionImportToken,
13565                fidl::encoding::DefaultFuchsiaResourceDialect,
13566            >,
13567        T2: fidl::encoding::Encode<u32, fidl::encoding::DefaultFuchsiaResourceDialect>,
13568        T3: fidl::encoding::Encode<ImageProperties, fidl::encoding::DefaultFuchsiaResourceDialect>,
13569    >
13570        fidl::encoding::Encode<
13571            Flatland2CreateImage2Request,
13572            fidl::encoding::DefaultFuchsiaResourceDialect,
13573        > for (T0, T1, T2, T3)
13574    {
13575        #[inline]
13576        unsafe fn encode(
13577            self,
13578            encoder: &mut fidl::encoding::Encoder<
13579                '_,
13580                fidl::encoding::DefaultFuchsiaResourceDialect,
13581            >,
13582            offset: usize,
13583            depth: fidl::encoding::Depth,
13584        ) -> fidl::Result<()> {
13585            encoder.debug_check_bounds::<Flatland2CreateImage2Request>(offset);
13586            // Zero out padding regions. There's no need to apply masks
13587            // because the unmasked parts will be overwritten by fields.
13588            // Write the fields.
13589            self.0.encode(encoder, offset + 0, depth)?;
13590            self.1.encode(encoder, offset + 8, depth)?;
13591            self.2.encode(encoder, offset + 12, depth)?;
13592            self.3.encode(encoder, offset + 16, depth)?;
13593            Ok(())
13594        }
13595    }
13596
13597    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
13598        for Flatland2CreateImage2Request
13599    {
13600        #[inline(always)]
13601        fn new_empty() -> Self {
13602            Self {
13603                image_id: fidl::new_empty!(ImageId, fidl::encoding::DefaultFuchsiaResourceDialect),
13604                import_token: fidl::new_empty!(
13605                    BufferCollectionImportToken,
13606                    fidl::encoding::DefaultFuchsiaResourceDialect
13607                ),
13608                vmo_index: fidl::new_empty!(u32, fidl::encoding::DefaultFuchsiaResourceDialect),
13609                properties: fidl::new_empty!(
13610                    ImageProperties,
13611                    fidl::encoding::DefaultFuchsiaResourceDialect
13612                ),
13613            }
13614        }
13615
13616        #[inline]
13617        unsafe fn decode(
13618            &mut self,
13619            decoder: &mut fidl::encoding::Decoder<
13620                '_,
13621                fidl::encoding::DefaultFuchsiaResourceDialect,
13622            >,
13623            offset: usize,
13624            _depth: fidl::encoding::Depth,
13625        ) -> fidl::Result<()> {
13626            decoder.debug_check_bounds::<Self>(offset);
13627            // Verify that padding bytes are zero.
13628            fidl::decode!(
13629                ImageId,
13630                fidl::encoding::DefaultFuchsiaResourceDialect,
13631                &mut self.image_id,
13632                decoder,
13633                offset + 0,
13634                _depth
13635            )?;
13636            fidl::decode!(
13637                BufferCollectionImportToken,
13638                fidl::encoding::DefaultFuchsiaResourceDialect,
13639                &mut self.import_token,
13640                decoder,
13641                offset + 8,
13642                _depth
13643            )?;
13644            fidl::decode!(
13645                u32,
13646                fidl::encoding::DefaultFuchsiaResourceDialect,
13647                &mut self.vmo_index,
13648                decoder,
13649                offset + 12,
13650                _depth
13651            )?;
13652            fidl::decode!(
13653                ImageProperties,
13654                fidl::encoding::DefaultFuchsiaResourceDialect,
13655                &mut self.properties,
13656                decoder,
13657                offset + 16,
13658                _depth
13659            )?;
13660            Ok(())
13661        }
13662    }
13663
13664    impl fidl::encoding::ResourceTypeMarker for Flatland2CreateViewport2Request {
13665        type Borrowed<'a> = &'a mut Self;
13666        fn take_or_borrow<'a>(
13667            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
13668        ) -> Self::Borrowed<'a> {
13669            value
13670        }
13671    }
13672
13673    unsafe impl fidl::encoding::TypeMarker for Flatland2CreateViewport2Request {
13674        type Owned = Self;
13675
13676        #[inline(always)]
13677        fn inline_align(_context: fidl::encoding::Context) -> usize {
13678            8
13679        }
13680
13681        #[inline(always)]
13682        fn inline_size(_context: fidl::encoding::Context) -> usize {
13683            40
13684        }
13685    }
13686
13687    unsafe impl
13688        fidl::encoding::Encode<
13689            Flatland2CreateViewport2Request,
13690            fidl::encoding::DefaultFuchsiaResourceDialect,
13691        > for &mut Flatland2CreateViewport2Request
13692    {
13693        #[inline]
13694        unsafe fn encode(
13695            self,
13696            encoder: &mut fidl::encoding::Encoder<
13697                '_,
13698                fidl::encoding::DefaultFuchsiaResourceDialect,
13699            >,
13700            offset: usize,
13701            _depth: fidl::encoding::Depth,
13702        ) -> fidl::Result<()> {
13703            encoder.debug_check_bounds::<Flatland2CreateViewport2Request>(offset);
13704            // Delegate to tuple encoding.
13705            fidl::encoding::Encode::<Flatland2CreateViewport2Request, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
13706                (
13707                    <ViewportId as fidl::encoding::ValueTypeMarker>::borrow(&self.viewport_id),
13708                    <fidl_fuchsia_ui_views::ViewportCreationToken as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.token),
13709                    <ViewportProperties as fidl::encoding::ValueTypeMarker>::borrow(&self.properties),
13710                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ChildViewWatcherMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.child_view_watcher),
13711                ),
13712                encoder, offset, _depth
13713            )
13714        }
13715    }
13716    unsafe impl<
13717        T0: fidl::encoding::Encode<ViewportId, fidl::encoding::DefaultFuchsiaResourceDialect>,
13718        T1: fidl::encoding::Encode<
13719                fidl_fuchsia_ui_views::ViewportCreationToken,
13720                fidl::encoding::DefaultFuchsiaResourceDialect,
13721            >,
13722        T2: fidl::encoding::Encode<ViewportProperties, fidl::encoding::DefaultFuchsiaResourceDialect>,
13723        T3: fidl::encoding::Encode<
13724                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ChildViewWatcherMarker>>,
13725                fidl::encoding::DefaultFuchsiaResourceDialect,
13726            >,
13727    >
13728        fidl::encoding::Encode<
13729            Flatland2CreateViewport2Request,
13730            fidl::encoding::DefaultFuchsiaResourceDialect,
13731        > for (T0, T1, T2, T3)
13732    {
13733        #[inline]
13734        unsafe fn encode(
13735            self,
13736            encoder: &mut fidl::encoding::Encoder<
13737                '_,
13738                fidl::encoding::DefaultFuchsiaResourceDialect,
13739            >,
13740            offset: usize,
13741            depth: fidl::encoding::Depth,
13742        ) -> fidl::Result<()> {
13743            encoder.debug_check_bounds::<Flatland2CreateViewport2Request>(offset);
13744            // Zero out padding regions. There's no need to apply masks
13745            // because the unmasked parts will be overwritten by fields.
13746            unsafe {
13747                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
13748                (ptr as *mut u64).write_unaligned(0);
13749            }
13750            unsafe {
13751                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(32);
13752                (ptr as *mut u64).write_unaligned(0);
13753            }
13754            // Write the fields.
13755            self.0.encode(encoder, offset + 0, depth)?;
13756            self.1.encode(encoder, offset + 8, depth)?;
13757            self.2.encode(encoder, offset + 16, depth)?;
13758            self.3.encode(encoder, offset + 32, depth)?;
13759            Ok(())
13760        }
13761    }
13762
13763    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
13764        for Flatland2CreateViewport2Request
13765    {
13766        #[inline(always)]
13767        fn new_empty() -> Self {
13768            Self {
13769                viewport_id: fidl::new_empty!(
13770                    ViewportId,
13771                    fidl::encoding::DefaultFuchsiaResourceDialect
13772                ),
13773                token: fidl::new_empty!(
13774                    fidl_fuchsia_ui_views::ViewportCreationToken,
13775                    fidl::encoding::DefaultFuchsiaResourceDialect
13776                ),
13777                properties: fidl::new_empty!(
13778                    ViewportProperties,
13779                    fidl::encoding::DefaultFuchsiaResourceDialect
13780                ),
13781                child_view_watcher: fidl::new_empty!(
13782                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ChildViewWatcherMarker>>,
13783                    fidl::encoding::DefaultFuchsiaResourceDialect
13784                ),
13785            }
13786        }
13787
13788        #[inline]
13789        unsafe fn decode(
13790            &mut self,
13791            decoder: &mut fidl::encoding::Decoder<
13792                '_,
13793                fidl::encoding::DefaultFuchsiaResourceDialect,
13794            >,
13795            offset: usize,
13796            _depth: fidl::encoding::Depth,
13797        ) -> fidl::Result<()> {
13798            decoder.debug_check_bounds::<Self>(offset);
13799            // Verify that padding bytes are zero.
13800            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(8) };
13801            let padval = unsafe { (ptr as *const u64).read_unaligned() };
13802            let mask = 0xffffffff00000000u64;
13803            let maskedval = padval & mask;
13804            if maskedval != 0 {
13805                return Err(fidl::Error::NonZeroPadding {
13806                    padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
13807                });
13808            }
13809            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(32) };
13810            let padval = unsafe { (ptr as *const u64).read_unaligned() };
13811            let mask = 0xffffffff00000000u64;
13812            let maskedval = padval & mask;
13813            if maskedval != 0 {
13814                return Err(fidl::Error::NonZeroPadding {
13815                    padding_start: offset + 32 + ((mask as u64).trailing_zeros() / 8) as usize,
13816                });
13817            }
13818            fidl::decode!(
13819                ViewportId,
13820                fidl::encoding::DefaultFuchsiaResourceDialect,
13821                &mut self.viewport_id,
13822                decoder,
13823                offset + 0,
13824                _depth
13825            )?;
13826            fidl::decode!(
13827                fidl_fuchsia_ui_views::ViewportCreationToken,
13828                fidl::encoding::DefaultFuchsiaResourceDialect,
13829                &mut self.token,
13830                decoder,
13831                offset + 8,
13832                _depth
13833            )?;
13834            fidl::decode!(
13835                ViewportProperties,
13836                fidl::encoding::DefaultFuchsiaResourceDialect,
13837                &mut self.properties,
13838                decoder,
13839                offset + 16,
13840                _depth
13841            )?;
13842            fidl::decode!(
13843                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ChildViewWatcherMarker>>,
13844                fidl::encoding::DefaultFuchsiaResourceDialect,
13845                &mut self.child_view_watcher,
13846                decoder,
13847                offset + 32,
13848                _depth
13849            )?;
13850            Ok(())
13851        }
13852    }
13853
13854    impl fidl::encoding::ResourceTypeMarker for Flatland2ReleaseViewport2Response {
13855        type Borrowed<'a> = &'a mut Self;
13856        fn take_or_borrow<'a>(
13857            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
13858        ) -> Self::Borrowed<'a> {
13859            value
13860        }
13861    }
13862
13863    unsafe impl fidl::encoding::TypeMarker for Flatland2ReleaseViewport2Response {
13864        type Owned = Self;
13865
13866        #[inline(always)]
13867        fn inline_align(_context: fidl::encoding::Context) -> usize {
13868            4
13869        }
13870
13871        #[inline(always)]
13872        fn inline_size(_context: fidl::encoding::Context) -> usize {
13873            4
13874        }
13875    }
13876
13877    unsafe impl
13878        fidl::encoding::Encode<
13879            Flatland2ReleaseViewport2Response,
13880            fidl::encoding::DefaultFuchsiaResourceDialect,
13881        > for &mut Flatland2ReleaseViewport2Response
13882    {
13883        #[inline]
13884        unsafe fn encode(
13885            self,
13886            encoder: &mut fidl::encoding::Encoder<
13887                '_,
13888                fidl::encoding::DefaultFuchsiaResourceDialect,
13889            >,
13890            offset: usize,
13891            _depth: fidl::encoding::Depth,
13892        ) -> fidl::Result<()> {
13893            encoder.debug_check_bounds::<Flatland2ReleaseViewport2Response>(offset);
13894            // Delegate to tuple encoding.
13895            fidl::encoding::Encode::<Flatland2ReleaseViewport2Response, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
13896                (
13897                    <fidl_fuchsia_ui_views::ViewportCreationToken as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.token),
13898                ),
13899                encoder, offset, _depth
13900            )
13901        }
13902    }
13903    unsafe impl<
13904        T0: fidl::encoding::Encode<
13905                fidl_fuchsia_ui_views::ViewportCreationToken,
13906                fidl::encoding::DefaultFuchsiaResourceDialect,
13907            >,
13908    >
13909        fidl::encoding::Encode<
13910            Flatland2ReleaseViewport2Response,
13911            fidl::encoding::DefaultFuchsiaResourceDialect,
13912        > for (T0,)
13913    {
13914        #[inline]
13915        unsafe fn encode(
13916            self,
13917            encoder: &mut fidl::encoding::Encoder<
13918                '_,
13919                fidl::encoding::DefaultFuchsiaResourceDialect,
13920            >,
13921            offset: usize,
13922            depth: fidl::encoding::Depth,
13923        ) -> fidl::Result<()> {
13924            encoder.debug_check_bounds::<Flatland2ReleaseViewport2Response>(offset);
13925            // Zero out padding regions. There's no need to apply masks
13926            // because the unmasked parts will be overwritten by fields.
13927            // Write the fields.
13928            self.0.encode(encoder, offset + 0, depth)?;
13929            Ok(())
13930        }
13931    }
13932
13933    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
13934        for Flatland2ReleaseViewport2Response
13935    {
13936        #[inline(always)]
13937        fn new_empty() -> Self {
13938            Self {
13939                token: fidl::new_empty!(
13940                    fidl_fuchsia_ui_views::ViewportCreationToken,
13941                    fidl::encoding::DefaultFuchsiaResourceDialect
13942                ),
13943            }
13944        }
13945
13946        #[inline]
13947        unsafe fn decode(
13948            &mut self,
13949            decoder: &mut fidl::encoding::Decoder<
13950                '_,
13951                fidl::encoding::DefaultFuchsiaResourceDialect,
13952            >,
13953            offset: usize,
13954            _depth: fidl::encoding::Depth,
13955        ) -> fidl::Result<()> {
13956            decoder.debug_check_bounds::<Self>(offset);
13957            // Verify that padding bytes are zero.
13958            fidl::decode!(
13959                fidl_fuchsia_ui_views::ViewportCreationToken,
13960                fidl::encoding::DefaultFuchsiaResourceDialect,
13961                &mut self.token,
13962                decoder,
13963                offset + 0,
13964                _depth
13965            )?;
13966            Ok(())
13967        }
13968    }
13969
13970    impl fidl::encoding::ResourceTypeMarker for Flatland2SetLayerImageRequest {
13971        type Borrowed<'a> = &'a mut Self;
13972        fn take_or_borrow<'a>(
13973            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
13974        ) -> Self::Borrowed<'a> {
13975            value
13976        }
13977    }
13978
13979    unsafe impl fidl::encoding::TypeMarker for Flatland2SetLayerImageRequest {
13980        type Owned = Self;
13981
13982        #[inline(always)]
13983        fn inline_align(_context: fidl::encoding::Context) -> usize {
13984            8
13985        }
13986
13987        #[inline(always)]
13988        fn inline_size(_context: fidl::encoding::Context) -> usize {
13989            48
13990        }
13991    }
13992
13993    unsafe impl
13994        fidl::encoding::Encode<
13995            Flatland2SetLayerImageRequest,
13996            fidl::encoding::DefaultFuchsiaResourceDialect,
13997        > for &mut Flatland2SetLayerImageRequest
13998    {
13999        #[inline]
14000        unsafe fn encode(
14001            self,
14002            encoder: &mut fidl::encoding::Encoder<
14003                '_,
14004                fidl::encoding::DefaultFuchsiaResourceDialect,
14005            >,
14006            offset: usize,
14007            _depth: fidl::encoding::Depth,
14008        ) -> fidl::Result<()> {
14009            encoder.debug_check_bounds::<Flatland2SetLayerImageRequest>(offset);
14010            // Delegate to tuple encoding.
14011            fidl::encoding::Encode::<Flatland2SetLayerImageRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
14012                (
14013                    <LayerId as fidl::encoding::ValueTypeMarker>::borrow(&self.layer_id),
14014                    <ImageId as fidl::encoding::ValueTypeMarker>::borrow(&self.image_id),
14015                    <fidl::encoding::OptionalUnion<WaitFence> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.acquire_fence),
14016                    <fidl::encoding::OptionalUnion<SignalFence> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.release_fence),
14017                ),
14018                encoder, offset, _depth
14019            )
14020        }
14021    }
14022    unsafe impl<
14023        T0: fidl::encoding::Encode<LayerId, fidl::encoding::DefaultFuchsiaResourceDialect>,
14024        T1: fidl::encoding::Encode<ImageId, fidl::encoding::DefaultFuchsiaResourceDialect>,
14025        T2: fidl::encoding::Encode<
14026                fidl::encoding::OptionalUnion<WaitFence>,
14027                fidl::encoding::DefaultFuchsiaResourceDialect,
14028            >,
14029        T3: fidl::encoding::Encode<
14030                fidl::encoding::OptionalUnion<SignalFence>,
14031                fidl::encoding::DefaultFuchsiaResourceDialect,
14032            >,
14033    >
14034        fidl::encoding::Encode<
14035            Flatland2SetLayerImageRequest,
14036            fidl::encoding::DefaultFuchsiaResourceDialect,
14037        > for (T0, T1, T2, T3)
14038    {
14039        #[inline]
14040        unsafe fn encode(
14041            self,
14042            encoder: &mut fidl::encoding::Encoder<
14043                '_,
14044                fidl::encoding::DefaultFuchsiaResourceDialect,
14045            >,
14046            offset: usize,
14047            depth: fidl::encoding::Depth,
14048        ) -> fidl::Result<()> {
14049            encoder.debug_check_bounds::<Flatland2SetLayerImageRequest>(offset);
14050            // Zero out padding regions. There's no need to apply masks
14051            // because the unmasked parts will be overwritten by fields.
14052            // Write the fields.
14053            self.0.encode(encoder, offset + 0, depth)?;
14054            self.1.encode(encoder, offset + 8, depth)?;
14055            self.2.encode(encoder, offset + 16, depth)?;
14056            self.3.encode(encoder, offset + 32, depth)?;
14057            Ok(())
14058        }
14059    }
14060
14061    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
14062        for Flatland2SetLayerImageRequest
14063    {
14064        #[inline(always)]
14065        fn new_empty() -> Self {
14066            Self {
14067                layer_id: fidl::new_empty!(LayerId, fidl::encoding::DefaultFuchsiaResourceDialect),
14068                image_id: fidl::new_empty!(ImageId, fidl::encoding::DefaultFuchsiaResourceDialect),
14069                acquire_fence: fidl::new_empty!(
14070                    fidl::encoding::OptionalUnion<WaitFence>,
14071                    fidl::encoding::DefaultFuchsiaResourceDialect
14072                ),
14073                release_fence: fidl::new_empty!(
14074                    fidl::encoding::OptionalUnion<SignalFence>,
14075                    fidl::encoding::DefaultFuchsiaResourceDialect
14076                ),
14077            }
14078        }
14079
14080        #[inline]
14081        unsafe fn decode(
14082            &mut self,
14083            decoder: &mut fidl::encoding::Decoder<
14084                '_,
14085                fidl::encoding::DefaultFuchsiaResourceDialect,
14086            >,
14087            offset: usize,
14088            _depth: fidl::encoding::Depth,
14089        ) -> fidl::Result<()> {
14090            decoder.debug_check_bounds::<Self>(offset);
14091            // Verify that padding bytes are zero.
14092            fidl::decode!(
14093                LayerId,
14094                fidl::encoding::DefaultFuchsiaResourceDialect,
14095                &mut self.layer_id,
14096                decoder,
14097                offset + 0,
14098                _depth
14099            )?;
14100            fidl::decode!(
14101                ImageId,
14102                fidl::encoding::DefaultFuchsiaResourceDialect,
14103                &mut self.image_id,
14104                decoder,
14105                offset + 8,
14106                _depth
14107            )?;
14108            fidl::decode!(
14109                fidl::encoding::OptionalUnion<WaitFence>,
14110                fidl::encoding::DefaultFuchsiaResourceDialect,
14111                &mut self.acquire_fence,
14112                decoder,
14113                offset + 16,
14114                _depth
14115            )?;
14116            fidl::decode!(
14117                fidl::encoding::OptionalUnion<SignalFence>,
14118                fidl::encoding::DefaultFuchsiaResourceDialect,
14119                &mut self.release_fence,
14120                decoder,
14121                offset + 32,
14122                _depth
14123            )?;
14124            Ok(())
14125        }
14126    }
14127
14128    impl fidl::encoding::ResourceTypeMarker for FlatlandCreateFilledRectRequest {
14129        type Borrowed<'a> = &'a mut Self;
14130        fn take_or_borrow<'a>(
14131            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
14132        ) -> Self::Borrowed<'a> {
14133            value
14134        }
14135    }
14136
14137    unsafe impl fidl::encoding::TypeMarker for FlatlandCreateFilledRectRequest {
14138        type Owned = Self;
14139
14140        #[inline(always)]
14141        fn inline_align(_context: fidl::encoding::Context) -> usize {
14142            8
14143        }
14144
14145        #[inline(always)]
14146        fn inline_size(_context: fidl::encoding::Context) -> usize {
14147            8
14148        }
14149        #[inline(always)]
14150        fn encode_is_copy() -> bool {
14151            true
14152        }
14153
14154        #[inline(always)]
14155        fn decode_is_copy() -> bool {
14156            true
14157        }
14158    }
14159
14160    unsafe impl
14161        fidl::encoding::Encode<
14162            FlatlandCreateFilledRectRequest,
14163            fidl::encoding::DefaultFuchsiaResourceDialect,
14164        > for &mut FlatlandCreateFilledRectRequest
14165    {
14166        #[inline]
14167        unsafe fn encode(
14168            self,
14169            encoder: &mut fidl::encoding::Encoder<
14170                '_,
14171                fidl::encoding::DefaultFuchsiaResourceDialect,
14172            >,
14173            offset: usize,
14174            _depth: fidl::encoding::Depth,
14175        ) -> fidl::Result<()> {
14176            encoder.debug_check_bounds::<FlatlandCreateFilledRectRequest>(offset);
14177            unsafe {
14178                // Copy the object into the buffer.
14179                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
14180                (buf_ptr as *mut FlatlandCreateFilledRectRequest)
14181                    .write_unaligned((self as *const FlatlandCreateFilledRectRequest).read());
14182                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
14183                // done second because the memcpy will write garbage to these bytes.
14184            }
14185            Ok(())
14186        }
14187    }
14188    unsafe impl<
14189        T0: fidl::encoding::Encode<ContentId, fidl::encoding::DefaultFuchsiaResourceDialect>,
14190    >
14191        fidl::encoding::Encode<
14192            FlatlandCreateFilledRectRequest,
14193            fidl::encoding::DefaultFuchsiaResourceDialect,
14194        > for (T0,)
14195    {
14196        #[inline]
14197        unsafe fn encode(
14198            self,
14199            encoder: &mut fidl::encoding::Encoder<
14200                '_,
14201                fidl::encoding::DefaultFuchsiaResourceDialect,
14202            >,
14203            offset: usize,
14204            depth: fidl::encoding::Depth,
14205        ) -> fidl::Result<()> {
14206            encoder.debug_check_bounds::<FlatlandCreateFilledRectRequest>(offset);
14207            // Zero out padding regions. There's no need to apply masks
14208            // because the unmasked parts will be overwritten by fields.
14209            // Write the fields.
14210            self.0.encode(encoder, offset + 0, depth)?;
14211            Ok(())
14212        }
14213    }
14214
14215    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
14216        for FlatlandCreateFilledRectRequest
14217    {
14218        #[inline(always)]
14219        fn new_empty() -> Self {
14220            Self {
14221                rect_id: fidl::new_empty!(ContentId, fidl::encoding::DefaultFuchsiaResourceDialect),
14222            }
14223        }
14224
14225        #[inline]
14226        unsafe fn decode(
14227            &mut self,
14228            decoder: &mut fidl::encoding::Decoder<
14229                '_,
14230                fidl::encoding::DefaultFuchsiaResourceDialect,
14231            >,
14232            offset: usize,
14233            _depth: fidl::encoding::Depth,
14234        ) -> fidl::Result<()> {
14235            decoder.debug_check_bounds::<Self>(offset);
14236            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
14237            // Verify that padding bytes are zero.
14238            // Copy from the buffer into the object.
14239            unsafe {
14240                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
14241            }
14242            Ok(())
14243        }
14244    }
14245
14246    impl fidl::encoding::ResourceTypeMarker for FlatlandCreateImageRequest {
14247        type Borrowed<'a> = &'a mut Self;
14248        fn take_or_borrow<'a>(
14249            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
14250        ) -> Self::Borrowed<'a> {
14251            value
14252        }
14253    }
14254
14255    unsafe impl fidl::encoding::TypeMarker for FlatlandCreateImageRequest {
14256        type Owned = Self;
14257
14258        #[inline(always)]
14259        fn inline_align(_context: fidl::encoding::Context) -> usize {
14260            8
14261        }
14262
14263        #[inline(always)]
14264        fn inline_size(_context: fidl::encoding::Context) -> usize {
14265            32
14266        }
14267    }
14268
14269    unsafe impl
14270        fidl::encoding::Encode<
14271            FlatlandCreateImageRequest,
14272            fidl::encoding::DefaultFuchsiaResourceDialect,
14273        > for &mut FlatlandCreateImageRequest
14274    {
14275        #[inline]
14276        unsafe fn encode(
14277            self,
14278            encoder: &mut fidl::encoding::Encoder<
14279                '_,
14280                fidl::encoding::DefaultFuchsiaResourceDialect,
14281            >,
14282            offset: usize,
14283            _depth: fidl::encoding::Depth,
14284        ) -> fidl::Result<()> {
14285            encoder.debug_check_bounds::<FlatlandCreateImageRequest>(offset);
14286            // Delegate to tuple encoding.
14287            fidl::encoding::Encode::<FlatlandCreateImageRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
14288                (
14289                    <ContentId as fidl::encoding::ValueTypeMarker>::borrow(&self.image_id),
14290                    <BufferCollectionImportToken as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.import_token),
14291                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.vmo_index),
14292                    <ImageProperties as fidl::encoding::ValueTypeMarker>::borrow(&self.properties),
14293                ),
14294                encoder, offset, _depth
14295            )
14296        }
14297    }
14298    unsafe impl<
14299        T0: fidl::encoding::Encode<ContentId, fidl::encoding::DefaultFuchsiaResourceDialect>,
14300        T1: fidl::encoding::Encode<
14301                BufferCollectionImportToken,
14302                fidl::encoding::DefaultFuchsiaResourceDialect,
14303            >,
14304        T2: fidl::encoding::Encode<u32, fidl::encoding::DefaultFuchsiaResourceDialect>,
14305        T3: fidl::encoding::Encode<ImageProperties, fidl::encoding::DefaultFuchsiaResourceDialect>,
14306    >
14307        fidl::encoding::Encode<
14308            FlatlandCreateImageRequest,
14309            fidl::encoding::DefaultFuchsiaResourceDialect,
14310        > for (T0, T1, T2, T3)
14311    {
14312        #[inline]
14313        unsafe fn encode(
14314            self,
14315            encoder: &mut fidl::encoding::Encoder<
14316                '_,
14317                fidl::encoding::DefaultFuchsiaResourceDialect,
14318            >,
14319            offset: usize,
14320            depth: fidl::encoding::Depth,
14321        ) -> fidl::Result<()> {
14322            encoder.debug_check_bounds::<FlatlandCreateImageRequest>(offset);
14323            // Zero out padding regions. There's no need to apply masks
14324            // because the unmasked parts will be overwritten by fields.
14325            // Write the fields.
14326            self.0.encode(encoder, offset + 0, depth)?;
14327            self.1.encode(encoder, offset + 8, depth)?;
14328            self.2.encode(encoder, offset + 12, depth)?;
14329            self.3.encode(encoder, offset + 16, depth)?;
14330            Ok(())
14331        }
14332    }
14333
14334    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
14335        for FlatlandCreateImageRequest
14336    {
14337        #[inline(always)]
14338        fn new_empty() -> Self {
14339            Self {
14340                image_id: fidl::new_empty!(
14341                    ContentId,
14342                    fidl::encoding::DefaultFuchsiaResourceDialect
14343                ),
14344                import_token: fidl::new_empty!(
14345                    BufferCollectionImportToken,
14346                    fidl::encoding::DefaultFuchsiaResourceDialect
14347                ),
14348                vmo_index: fidl::new_empty!(u32, fidl::encoding::DefaultFuchsiaResourceDialect),
14349                properties: fidl::new_empty!(
14350                    ImageProperties,
14351                    fidl::encoding::DefaultFuchsiaResourceDialect
14352                ),
14353            }
14354        }
14355
14356        #[inline]
14357        unsafe fn decode(
14358            &mut self,
14359            decoder: &mut fidl::encoding::Decoder<
14360                '_,
14361                fidl::encoding::DefaultFuchsiaResourceDialect,
14362            >,
14363            offset: usize,
14364            _depth: fidl::encoding::Depth,
14365        ) -> fidl::Result<()> {
14366            decoder.debug_check_bounds::<Self>(offset);
14367            // Verify that padding bytes are zero.
14368            fidl::decode!(
14369                ContentId,
14370                fidl::encoding::DefaultFuchsiaResourceDialect,
14371                &mut self.image_id,
14372                decoder,
14373                offset + 0,
14374                _depth
14375            )?;
14376            fidl::decode!(
14377                BufferCollectionImportToken,
14378                fidl::encoding::DefaultFuchsiaResourceDialect,
14379                &mut self.import_token,
14380                decoder,
14381                offset + 8,
14382                _depth
14383            )?;
14384            fidl::decode!(
14385                u32,
14386                fidl::encoding::DefaultFuchsiaResourceDialect,
14387                &mut self.vmo_index,
14388                decoder,
14389                offset + 12,
14390                _depth
14391            )?;
14392            fidl::decode!(
14393                ImageProperties,
14394                fidl::encoding::DefaultFuchsiaResourceDialect,
14395                &mut self.properties,
14396                decoder,
14397                offset + 16,
14398                _depth
14399            )?;
14400            Ok(())
14401        }
14402    }
14403
14404    impl fidl::encoding::ResourceTypeMarker for FlatlandCreateView2Request {
14405        type Borrowed<'a> = &'a mut Self;
14406        fn take_or_borrow<'a>(
14407            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
14408        ) -> Self::Borrowed<'a> {
14409            value
14410        }
14411    }
14412
14413    unsafe impl fidl::encoding::TypeMarker for FlatlandCreateView2Request {
14414        type Owned = Self;
14415
14416        #[inline(always)]
14417        fn inline_align(_context: fidl::encoding::Context) -> usize {
14418            8
14419        }
14420
14421        #[inline(always)]
14422        fn inline_size(_context: fidl::encoding::Context) -> usize {
14423            40
14424        }
14425    }
14426
14427    unsafe impl
14428        fidl::encoding::Encode<
14429            FlatlandCreateView2Request,
14430            fidl::encoding::DefaultFuchsiaResourceDialect,
14431        > for &mut FlatlandCreateView2Request
14432    {
14433        #[inline]
14434        unsafe fn encode(
14435            self,
14436            encoder: &mut fidl::encoding::Encoder<
14437                '_,
14438                fidl::encoding::DefaultFuchsiaResourceDialect,
14439            >,
14440            offset: usize,
14441            _depth: fidl::encoding::Depth,
14442        ) -> fidl::Result<()> {
14443            encoder.debug_check_bounds::<FlatlandCreateView2Request>(offset);
14444            // Delegate to tuple encoding.
14445            fidl::encoding::Encode::<FlatlandCreateView2Request, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
14446                (
14447                    <fidl_fuchsia_ui_views::ViewCreationToken as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.token),
14448                    <fidl_fuchsia_ui_views::ViewIdentityOnCreation as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.view_identity),
14449                    <ViewBoundProtocols as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.protocols),
14450                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.parent_viewport_watcher),
14451                ),
14452                encoder, offset, _depth
14453            )
14454        }
14455    }
14456    unsafe impl<
14457        T0: fidl::encoding::Encode<
14458                fidl_fuchsia_ui_views::ViewCreationToken,
14459                fidl::encoding::DefaultFuchsiaResourceDialect,
14460            >,
14461        T1: fidl::encoding::Encode<
14462                fidl_fuchsia_ui_views::ViewIdentityOnCreation,
14463                fidl::encoding::DefaultFuchsiaResourceDialect,
14464            >,
14465        T2: fidl::encoding::Encode<ViewBoundProtocols, fidl::encoding::DefaultFuchsiaResourceDialect>,
14466        T3: fidl::encoding::Encode<
14467                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>>,
14468                fidl::encoding::DefaultFuchsiaResourceDialect,
14469            >,
14470    >
14471        fidl::encoding::Encode<
14472            FlatlandCreateView2Request,
14473            fidl::encoding::DefaultFuchsiaResourceDialect,
14474        > for (T0, T1, T2, T3)
14475    {
14476        #[inline]
14477        unsafe fn encode(
14478            self,
14479            encoder: &mut fidl::encoding::Encoder<
14480                '_,
14481                fidl::encoding::DefaultFuchsiaResourceDialect,
14482            >,
14483            offset: usize,
14484            depth: fidl::encoding::Depth,
14485        ) -> fidl::Result<()> {
14486            encoder.debug_check_bounds::<FlatlandCreateView2Request>(offset);
14487            // Zero out padding regions. There's no need to apply masks
14488            // because the unmasked parts will be overwritten by fields.
14489            unsafe {
14490                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
14491                (ptr as *mut u64).write_unaligned(0);
14492            }
14493            unsafe {
14494                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(32);
14495                (ptr as *mut u64).write_unaligned(0);
14496            }
14497            // Write the fields.
14498            self.0.encode(encoder, offset + 0, depth)?;
14499            self.1.encode(encoder, offset + 4, depth)?;
14500            self.2.encode(encoder, offset + 16, depth)?;
14501            self.3.encode(encoder, offset + 32, depth)?;
14502            Ok(())
14503        }
14504    }
14505
14506    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
14507        for FlatlandCreateView2Request
14508    {
14509        #[inline(always)]
14510        fn new_empty() -> Self {
14511            Self {
14512                token: fidl::new_empty!(
14513                    fidl_fuchsia_ui_views::ViewCreationToken,
14514                    fidl::encoding::DefaultFuchsiaResourceDialect
14515                ),
14516                view_identity: fidl::new_empty!(
14517                    fidl_fuchsia_ui_views::ViewIdentityOnCreation,
14518                    fidl::encoding::DefaultFuchsiaResourceDialect
14519                ),
14520                protocols: fidl::new_empty!(
14521                    ViewBoundProtocols,
14522                    fidl::encoding::DefaultFuchsiaResourceDialect
14523                ),
14524                parent_viewport_watcher: fidl::new_empty!(
14525                    fidl::encoding::Endpoint<
14526                        fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>,
14527                    >,
14528                    fidl::encoding::DefaultFuchsiaResourceDialect
14529                ),
14530            }
14531        }
14532
14533        #[inline]
14534        unsafe fn decode(
14535            &mut self,
14536            decoder: &mut fidl::encoding::Decoder<
14537                '_,
14538                fidl::encoding::DefaultFuchsiaResourceDialect,
14539            >,
14540            offset: usize,
14541            _depth: fidl::encoding::Depth,
14542        ) -> fidl::Result<()> {
14543            decoder.debug_check_bounds::<Self>(offset);
14544            // Verify that padding bytes are zero.
14545            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(8) };
14546            let padval = unsafe { (ptr as *const u64).read_unaligned() };
14547            let mask = 0xffffffff00000000u64;
14548            let maskedval = padval & mask;
14549            if maskedval != 0 {
14550                return Err(fidl::Error::NonZeroPadding {
14551                    padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
14552                });
14553            }
14554            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(32) };
14555            let padval = unsafe { (ptr as *const u64).read_unaligned() };
14556            let mask = 0xffffffff00000000u64;
14557            let maskedval = padval & mask;
14558            if maskedval != 0 {
14559                return Err(fidl::Error::NonZeroPadding {
14560                    padding_start: offset + 32 + ((mask as u64).trailing_zeros() / 8) as usize,
14561                });
14562            }
14563            fidl::decode!(
14564                fidl_fuchsia_ui_views::ViewCreationToken,
14565                fidl::encoding::DefaultFuchsiaResourceDialect,
14566                &mut self.token,
14567                decoder,
14568                offset + 0,
14569                _depth
14570            )?;
14571            fidl::decode!(
14572                fidl_fuchsia_ui_views::ViewIdentityOnCreation,
14573                fidl::encoding::DefaultFuchsiaResourceDialect,
14574                &mut self.view_identity,
14575                decoder,
14576                offset + 4,
14577                _depth
14578            )?;
14579            fidl::decode!(
14580                ViewBoundProtocols,
14581                fidl::encoding::DefaultFuchsiaResourceDialect,
14582                &mut self.protocols,
14583                decoder,
14584                offset + 16,
14585                _depth
14586            )?;
14587            fidl::decode!(
14588                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>>,
14589                fidl::encoding::DefaultFuchsiaResourceDialect,
14590                &mut self.parent_viewport_watcher,
14591                decoder,
14592                offset + 32,
14593                _depth
14594            )?;
14595            Ok(())
14596        }
14597    }
14598
14599    impl fidl::encoding::ResourceTypeMarker for FlatlandCreateViewRequest {
14600        type Borrowed<'a> = &'a mut Self;
14601        fn take_or_borrow<'a>(
14602            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
14603        ) -> Self::Borrowed<'a> {
14604            value
14605        }
14606    }
14607
14608    unsafe impl fidl::encoding::TypeMarker for FlatlandCreateViewRequest {
14609        type Owned = Self;
14610
14611        #[inline(always)]
14612        fn inline_align(_context: fidl::encoding::Context) -> usize {
14613            4
14614        }
14615
14616        #[inline(always)]
14617        fn inline_size(_context: fidl::encoding::Context) -> usize {
14618            8
14619        }
14620    }
14621
14622    unsafe impl
14623        fidl::encoding::Encode<
14624            FlatlandCreateViewRequest,
14625            fidl::encoding::DefaultFuchsiaResourceDialect,
14626        > for &mut FlatlandCreateViewRequest
14627    {
14628        #[inline]
14629        unsafe fn encode(
14630            self,
14631            encoder: &mut fidl::encoding::Encoder<
14632                '_,
14633                fidl::encoding::DefaultFuchsiaResourceDialect,
14634            >,
14635            offset: usize,
14636            _depth: fidl::encoding::Depth,
14637        ) -> fidl::Result<()> {
14638            encoder.debug_check_bounds::<FlatlandCreateViewRequest>(offset);
14639            // Delegate to tuple encoding.
14640            fidl::encoding::Encode::<FlatlandCreateViewRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
14641                (
14642                    <fidl_fuchsia_ui_views::ViewCreationToken as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.token),
14643                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.parent_viewport_watcher),
14644                ),
14645                encoder, offset, _depth
14646            )
14647        }
14648    }
14649    unsafe impl<
14650        T0: fidl::encoding::Encode<
14651                fidl_fuchsia_ui_views::ViewCreationToken,
14652                fidl::encoding::DefaultFuchsiaResourceDialect,
14653            >,
14654        T1: fidl::encoding::Encode<
14655                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>>,
14656                fidl::encoding::DefaultFuchsiaResourceDialect,
14657            >,
14658    >
14659        fidl::encoding::Encode<
14660            FlatlandCreateViewRequest,
14661            fidl::encoding::DefaultFuchsiaResourceDialect,
14662        > for (T0, T1)
14663    {
14664        #[inline]
14665        unsafe fn encode(
14666            self,
14667            encoder: &mut fidl::encoding::Encoder<
14668                '_,
14669                fidl::encoding::DefaultFuchsiaResourceDialect,
14670            >,
14671            offset: usize,
14672            depth: fidl::encoding::Depth,
14673        ) -> fidl::Result<()> {
14674            encoder.debug_check_bounds::<FlatlandCreateViewRequest>(offset);
14675            // Zero out padding regions. There's no need to apply masks
14676            // because the unmasked parts will be overwritten by fields.
14677            // Write the fields.
14678            self.0.encode(encoder, offset + 0, depth)?;
14679            self.1.encode(encoder, offset + 4, depth)?;
14680            Ok(())
14681        }
14682    }
14683
14684    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
14685        for FlatlandCreateViewRequest
14686    {
14687        #[inline(always)]
14688        fn new_empty() -> Self {
14689            Self {
14690                token: fidl::new_empty!(
14691                    fidl_fuchsia_ui_views::ViewCreationToken,
14692                    fidl::encoding::DefaultFuchsiaResourceDialect
14693                ),
14694                parent_viewport_watcher: fidl::new_empty!(
14695                    fidl::encoding::Endpoint<
14696                        fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>,
14697                    >,
14698                    fidl::encoding::DefaultFuchsiaResourceDialect
14699                ),
14700            }
14701        }
14702
14703        #[inline]
14704        unsafe fn decode(
14705            &mut self,
14706            decoder: &mut fidl::encoding::Decoder<
14707                '_,
14708                fidl::encoding::DefaultFuchsiaResourceDialect,
14709            >,
14710            offset: usize,
14711            _depth: fidl::encoding::Depth,
14712        ) -> fidl::Result<()> {
14713            decoder.debug_check_bounds::<Self>(offset);
14714            // Verify that padding bytes are zero.
14715            fidl::decode!(
14716                fidl_fuchsia_ui_views::ViewCreationToken,
14717                fidl::encoding::DefaultFuchsiaResourceDialect,
14718                &mut self.token,
14719                decoder,
14720                offset + 0,
14721                _depth
14722            )?;
14723            fidl::decode!(
14724                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>>,
14725                fidl::encoding::DefaultFuchsiaResourceDialect,
14726                &mut self.parent_viewport_watcher,
14727                decoder,
14728                offset + 4,
14729                _depth
14730            )?;
14731            Ok(())
14732        }
14733    }
14734
14735    impl fidl::encoding::ResourceTypeMarker for FlatlandCreateViewportRequest {
14736        type Borrowed<'a> = &'a mut Self;
14737        fn take_or_borrow<'a>(
14738            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
14739        ) -> Self::Borrowed<'a> {
14740            value
14741        }
14742    }
14743
14744    unsafe impl fidl::encoding::TypeMarker for FlatlandCreateViewportRequest {
14745        type Owned = Self;
14746
14747        #[inline(always)]
14748        fn inline_align(_context: fidl::encoding::Context) -> usize {
14749            8
14750        }
14751
14752        #[inline(always)]
14753        fn inline_size(_context: fidl::encoding::Context) -> usize {
14754            40
14755        }
14756    }
14757
14758    unsafe impl
14759        fidl::encoding::Encode<
14760            FlatlandCreateViewportRequest,
14761            fidl::encoding::DefaultFuchsiaResourceDialect,
14762        > for &mut FlatlandCreateViewportRequest
14763    {
14764        #[inline]
14765        unsafe fn encode(
14766            self,
14767            encoder: &mut fidl::encoding::Encoder<
14768                '_,
14769                fidl::encoding::DefaultFuchsiaResourceDialect,
14770            >,
14771            offset: usize,
14772            _depth: fidl::encoding::Depth,
14773        ) -> fidl::Result<()> {
14774            encoder.debug_check_bounds::<FlatlandCreateViewportRequest>(offset);
14775            // Delegate to tuple encoding.
14776            fidl::encoding::Encode::<FlatlandCreateViewportRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
14777                (
14778                    <ContentId as fidl::encoding::ValueTypeMarker>::borrow(&self.viewport_id),
14779                    <fidl_fuchsia_ui_views::ViewportCreationToken as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.token),
14780                    <ViewportProperties as fidl::encoding::ValueTypeMarker>::borrow(&self.properties),
14781                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ChildViewWatcherMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.child_view_watcher),
14782                ),
14783                encoder, offset, _depth
14784            )
14785        }
14786    }
14787    unsafe impl<
14788        T0: fidl::encoding::Encode<ContentId, fidl::encoding::DefaultFuchsiaResourceDialect>,
14789        T1: fidl::encoding::Encode<
14790                fidl_fuchsia_ui_views::ViewportCreationToken,
14791                fidl::encoding::DefaultFuchsiaResourceDialect,
14792            >,
14793        T2: fidl::encoding::Encode<ViewportProperties, fidl::encoding::DefaultFuchsiaResourceDialect>,
14794        T3: fidl::encoding::Encode<
14795                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ChildViewWatcherMarker>>,
14796                fidl::encoding::DefaultFuchsiaResourceDialect,
14797            >,
14798    >
14799        fidl::encoding::Encode<
14800            FlatlandCreateViewportRequest,
14801            fidl::encoding::DefaultFuchsiaResourceDialect,
14802        > for (T0, T1, T2, T3)
14803    {
14804        #[inline]
14805        unsafe fn encode(
14806            self,
14807            encoder: &mut fidl::encoding::Encoder<
14808                '_,
14809                fidl::encoding::DefaultFuchsiaResourceDialect,
14810            >,
14811            offset: usize,
14812            depth: fidl::encoding::Depth,
14813        ) -> fidl::Result<()> {
14814            encoder.debug_check_bounds::<FlatlandCreateViewportRequest>(offset);
14815            // Zero out padding regions. There's no need to apply masks
14816            // because the unmasked parts will be overwritten by fields.
14817            unsafe {
14818                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
14819                (ptr as *mut u64).write_unaligned(0);
14820            }
14821            unsafe {
14822                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(32);
14823                (ptr as *mut u64).write_unaligned(0);
14824            }
14825            // Write the fields.
14826            self.0.encode(encoder, offset + 0, depth)?;
14827            self.1.encode(encoder, offset + 8, depth)?;
14828            self.2.encode(encoder, offset + 16, depth)?;
14829            self.3.encode(encoder, offset + 32, depth)?;
14830            Ok(())
14831        }
14832    }
14833
14834    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
14835        for FlatlandCreateViewportRequest
14836    {
14837        #[inline(always)]
14838        fn new_empty() -> Self {
14839            Self {
14840                viewport_id: fidl::new_empty!(
14841                    ContentId,
14842                    fidl::encoding::DefaultFuchsiaResourceDialect
14843                ),
14844                token: fidl::new_empty!(
14845                    fidl_fuchsia_ui_views::ViewportCreationToken,
14846                    fidl::encoding::DefaultFuchsiaResourceDialect
14847                ),
14848                properties: fidl::new_empty!(
14849                    ViewportProperties,
14850                    fidl::encoding::DefaultFuchsiaResourceDialect
14851                ),
14852                child_view_watcher: fidl::new_empty!(
14853                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ChildViewWatcherMarker>>,
14854                    fidl::encoding::DefaultFuchsiaResourceDialect
14855                ),
14856            }
14857        }
14858
14859        #[inline]
14860        unsafe fn decode(
14861            &mut self,
14862            decoder: &mut fidl::encoding::Decoder<
14863                '_,
14864                fidl::encoding::DefaultFuchsiaResourceDialect,
14865            >,
14866            offset: usize,
14867            _depth: fidl::encoding::Depth,
14868        ) -> fidl::Result<()> {
14869            decoder.debug_check_bounds::<Self>(offset);
14870            // Verify that padding bytes are zero.
14871            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(8) };
14872            let padval = unsafe { (ptr as *const u64).read_unaligned() };
14873            let mask = 0xffffffff00000000u64;
14874            let maskedval = padval & mask;
14875            if maskedval != 0 {
14876                return Err(fidl::Error::NonZeroPadding {
14877                    padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
14878                });
14879            }
14880            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(32) };
14881            let padval = unsafe { (ptr as *const u64).read_unaligned() };
14882            let mask = 0xffffffff00000000u64;
14883            let maskedval = padval & mask;
14884            if maskedval != 0 {
14885                return Err(fidl::Error::NonZeroPadding {
14886                    padding_start: offset + 32 + ((mask as u64).trailing_zeros() / 8) as usize,
14887                });
14888            }
14889            fidl::decode!(
14890                ContentId,
14891                fidl::encoding::DefaultFuchsiaResourceDialect,
14892                &mut self.viewport_id,
14893                decoder,
14894                offset + 0,
14895                _depth
14896            )?;
14897            fidl::decode!(
14898                fidl_fuchsia_ui_views::ViewportCreationToken,
14899                fidl::encoding::DefaultFuchsiaResourceDialect,
14900                &mut self.token,
14901                decoder,
14902                offset + 8,
14903                _depth
14904            )?;
14905            fidl::decode!(
14906                ViewportProperties,
14907                fidl::encoding::DefaultFuchsiaResourceDialect,
14908                &mut self.properties,
14909                decoder,
14910                offset + 16,
14911                _depth
14912            )?;
14913            fidl::decode!(
14914                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ChildViewWatcherMarker>>,
14915                fidl::encoding::DefaultFuchsiaResourceDialect,
14916                &mut self.child_view_watcher,
14917                decoder,
14918                offset + 32,
14919                _depth
14920            )?;
14921            Ok(())
14922        }
14923    }
14924
14925    impl fidl::encoding::ResourceTypeMarker for FlatlandDisplaySetContentRequest {
14926        type Borrowed<'a> = &'a mut Self;
14927        fn take_or_borrow<'a>(
14928            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
14929        ) -> Self::Borrowed<'a> {
14930            value
14931        }
14932    }
14933
14934    unsafe impl fidl::encoding::TypeMarker for FlatlandDisplaySetContentRequest {
14935        type Owned = Self;
14936
14937        #[inline(always)]
14938        fn inline_align(_context: fidl::encoding::Context) -> usize {
14939            4
14940        }
14941
14942        #[inline(always)]
14943        fn inline_size(_context: fidl::encoding::Context) -> usize {
14944            8
14945        }
14946    }
14947
14948    unsafe impl
14949        fidl::encoding::Encode<
14950            FlatlandDisplaySetContentRequest,
14951            fidl::encoding::DefaultFuchsiaResourceDialect,
14952        > for &mut FlatlandDisplaySetContentRequest
14953    {
14954        #[inline]
14955        unsafe fn encode(
14956            self,
14957            encoder: &mut fidl::encoding::Encoder<
14958                '_,
14959                fidl::encoding::DefaultFuchsiaResourceDialect,
14960            >,
14961            offset: usize,
14962            _depth: fidl::encoding::Depth,
14963        ) -> fidl::Result<()> {
14964            encoder.debug_check_bounds::<FlatlandDisplaySetContentRequest>(offset);
14965            // Delegate to tuple encoding.
14966            fidl::encoding::Encode::<FlatlandDisplaySetContentRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
14967                (
14968                    <fidl_fuchsia_ui_views::ViewportCreationToken as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.token),
14969                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ChildViewWatcherMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.child_view_watcher),
14970                ),
14971                encoder, offset, _depth
14972            )
14973        }
14974    }
14975    unsafe impl<
14976        T0: fidl::encoding::Encode<
14977                fidl_fuchsia_ui_views::ViewportCreationToken,
14978                fidl::encoding::DefaultFuchsiaResourceDialect,
14979            >,
14980        T1: fidl::encoding::Encode<
14981                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ChildViewWatcherMarker>>,
14982                fidl::encoding::DefaultFuchsiaResourceDialect,
14983            >,
14984    >
14985        fidl::encoding::Encode<
14986            FlatlandDisplaySetContentRequest,
14987            fidl::encoding::DefaultFuchsiaResourceDialect,
14988        > for (T0, T1)
14989    {
14990        #[inline]
14991        unsafe fn encode(
14992            self,
14993            encoder: &mut fidl::encoding::Encoder<
14994                '_,
14995                fidl::encoding::DefaultFuchsiaResourceDialect,
14996            >,
14997            offset: usize,
14998            depth: fidl::encoding::Depth,
14999        ) -> fidl::Result<()> {
15000            encoder.debug_check_bounds::<FlatlandDisplaySetContentRequest>(offset);
15001            // Zero out padding regions. There's no need to apply masks
15002            // because the unmasked parts will be overwritten by fields.
15003            // Write the fields.
15004            self.0.encode(encoder, offset + 0, depth)?;
15005            self.1.encode(encoder, offset + 4, depth)?;
15006            Ok(())
15007        }
15008    }
15009
15010    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
15011        for FlatlandDisplaySetContentRequest
15012    {
15013        #[inline(always)]
15014        fn new_empty() -> Self {
15015            Self {
15016                token: fidl::new_empty!(
15017                    fidl_fuchsia_ui_views::ViewportCreationToken,
15018                    fidl::encoding::DefaultFuchsiaResourceDialect
15019                ),
15020                child_view_watcher: fidl::new_empty!(
15021                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ChildViewWatcherMarker>>,
15022                    fidl::encoding::DefaultFuchsiaResourceDialect
15023                ),
15024            }
15025        }
15026
15027        #[inline]
15028        unsafe fn decode(
15029            &mut self,
15030            decoder: &mut fidl::encoding::Decoder<
15031                '_,
15032                fidl::encoding::DefaultFuchsiaResourceDialect,
15033            >,
15034            offset: usize,
15035            _depth: fidl::encoding::Depth,
15036        ) -> fidl::Result<()> {
15037            decoder.debug_check_bounds::<Self>(offset);
15038            // Verify that padding bytes are zero.
15039            fidl::decode!(
15040                fidl_fuchsia_ui_views::ViewportCreationToken,
15041                fidl::encoding::DefaultFuchsiaResourceDialect,
15042                &mut self.token,
15043                decoder,
15044                offset + 0,
15045                _depth
15046            )?;
15047            fidl::decode!(
15048                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ChildViewWatcherMarker>>,
15049                fidl::encoding::DefaultFuchsiaResourceDialect,
15050                &mut self.child_view_watcher,
15051                decoder,
15052                offset + 4,
15053                _depth
15054            )?;
15055            Ok(())
15056        }
15057    }
15058
15059    impl fidl::encoding::ResourceTypeMarker for FlatlandFactoryCreateFlatlandRequest {
15060        type Borrowed<'a> = &'a mut Self;
15061        fn take_or_borrow<'a>(
15062            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
15063        ) -> Self::Borrowed<'a> {
15064            value
15065        }
15066    }
15067
15068    unsafe impl fidl::encoding::TypeMarker for FlatlandFactoryCreateFlatlandRequest {
15069        type Owned = Self;
15070
15071        #[inline(always)]
15072        fn inline_align(_context: fidl::encoding::Context) -> usize {
15073            8
15074        }
15075
15076        #[inline(always)]
15077        fn inline_size(_context: fidl::encoding::Context) -> usize {
15078            24
15079        }
15080    }
15081
15082    unsafe impl
15083        fidl::encoding::Encode<
15084            FlatlandFactoryCreateFlatlandRequest,
15085            fidl::encoding::DefaultFuchsiaResourceDialect,
15086        > for &mut FlatlandFactoryCreateFlatlandRequest
15087    {
15088        #[inline]
15089        unsafe fn encode(
15090            self,
15091            encoder: &mut fidl::encoding::Encoder<
15092                '_,
15093                fidl::encoding::DefaultFuchsiaResourceDialect,
15094            >,
15095            offset: usize,
15096            _depth: fidl::encoding::Depth,
15097        ) -> fidl::Result<()> {
15098            encoder.debug_check_bounds::<FlatlandFactoryCreateFlatlandRequest>(offset);
15099            // Delegate to tuple encoding.
15100            fidl::encoding::Encode::<FlatlandFactoryCreateFlatlandRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
15101                (
15102                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<FlatlandMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.server_end),
15103                    <FlatlandConfig as fidl::encoding::ValueTypeMarker>::borrow(&self.config),
15104                ),
15105                encoder, offset, _depth
15106            )
15107        }
15108    }
15109    unsafe impl<
15110        T0: fidl::encoding::Encode<
15111                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<FlatlandMarker>>,
15112                fidl::encoding::DefaultFuchsiaResourceDialect,
15113            >,
15114        T1: fidl::encoding::Encode<FlatlandConfig, fidl::encoding::DefaultFuchsiaResourceDialect>,
15115    >
15116        fidl::encoding::Encode<
15117            FlatlandFactoryCreateFlatlandRequest,
15118            fidl::encoding::DefaultFuchsiaResourceDialect,
15119        > for (T0, T1)
15120    {
15121        #[inline]
15122        unsafe fn encode(
15123            self,
15124            encoder: &mut fidl::encoding::Encoder<
15125                '_,
15126                fidl::encoding::DefaultFuchsiaResourceDialect,
15127            >,
15128            offset: usize,
15129            depth: fidl::encoding::Depth,
15130        ) -> fidl::Result<()> {
15131            encoder.debug_check_bounds::<FlatlandFactoryCreateFlatlandRequest>(offset);
15132            // Zero out padding regions. There's no need to apply masks
15133            // because the unmasked parts will be overwritten by fields.
15134            unsafe {
15135                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
15136                (ptr as *mut u64).write_unaligned(0);
15137            }
15138            // Write the fields.
15139            self.0.encode(encoder, offset + 0, depth)?;
15140            self.1.encode(encoder, offset + 8, depth)?;
15141            Ok(())
15142        }
15143    }
15144
15145    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
15146        for FlatlandFactoryCreateFlatlandRequest
15147    {
15148        #[inline(always)]
15149        fn new_empty() -> Self {
15150            Self {
15151                server_end: fidl::new_empty!(
15152                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<FlatlandMarker>>,
15153                    fidl::encoding::DefaultFuchsiaResourceDialect
15154                ),
15155                config: fidl::new_empty!(
15156                    FlatlandConfig,
15157                    fidl::encoding::DefaultFuchsiaResourceDialect
15158                ),
15159            }
15160        }
15161
15162        #[inline]
15163        unsafe fn decode(
15164            &mut self,
15165            decoder: &mut fidl::encoding::Decoder<
15166                '_,
15167                fidl::encoding::DefaultFuchsiaResourceDialect,
15168            >,
15169            offset: usize,
15170            _depth: fidl::encoding::Depth,
15171        ) -> fidl::Result<()> {
15172            decoder.debug_check_bounds::<Self>(offset);
15173            // Verify that padding bytes are zero.
15174            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
15175            let padval = unsafe { (ptr as *const u64).read_unaligned() };
15176            let mask = 0xffffffff00000000u64;
15177            let maskedval = padval & mask;
15178            if maskedval != 0 {
15179                return Err(fidl::Error::NonZeroPadding {
15180                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
15181                });
15182            }
15183            fidl::decode!(
15184                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<FlatlandMarker>>,
15185                fidl::encoding::DefaultFuchsiaResourceDialect,
15186                &mut self.server_end,
15187                decoder,
15188                offset + 0,
15189                _depth
15190            )?;
15191            fidl::decode!(
15192                FlatlandConfig,
15193                fidl::encoding::DefaultFuchsiaResourceDialect,
15194                &mut self.config,
15195                decoder,
15196                offset + 8,
15197                _depth
15198            )?;
15199            Ok(())
15200        }
15201    }
15202
15203    impl fidl::encoding::ResourceTypeMarker for FlatlandPresentRequest {
15204        type Borrowed<'a> = &'a mut Self;
15205        fn take_or_borrow<'a>(
15206            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
15207        ) -> Self::Borrowed<'a> {
15208            value
15209        }
15210    }
15211
15212    unsafe impl fidl::encoding::TypeMarker for FlatlandPresentRequest {
15213        type Owned = Self;
15214
15215        #[inline(always)]
15216        fn inline_align(_context: fidl::encoding::Context) -> usize {
15217            8
15218        }
15219
15220        #[inline(always)]
15221        fn inline_size(_context: fidl::encoding::Context) -> usize {
15222            16
15223        }
15224    }
15225
15226    unsafe impl
15227        fidl::encoding::Encode<
15228            FlatlandPresentRequest,
15229            fidl::encoding::DefaultFuchsiaResourceDialect,
15230        > for &mut FlatlandPresentRequest
15231    {
15232        #[inline]
15233        unsafe fn encode(
15234            self,
15235            encoder: &mut fidl::encoding::Encoder<
15236                '_,
15237                fidl::encoding::DefaultFuchsiaResourceDialect,
15238            >,
15239            offset: usize,
15240            _depth: fidl::encoding::Depth,
15241        ) -> fidl::Result<()> {
15242            encoder.debug_check_bounds::<FlatlandPresentRequest>(offset);
15243            // Delegate to tuple encoding.
15244            fidl::encoding::Encode::<
15245                FlatlandPresentRequest,
15246                fidl::encoding::DefaultFuchsiaResourceDialect,
15247            >::encode(
15248                (<PresentArgs as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
15249                    &mut self.args,
15250                ),),
15251                encoder,
15252                offset,
15253                _depth,
15254            )
15255        }
15256    }
15257    unsafe impl<
15258        T0: fidl::encoding::Encode<PresentArgs, fidl::encoding::DefaultFuchsiaResourceDialect>,
15259    >
15260        fidl::encoding::Encode<
15261            FlatlandPresentRequest,
15262            fidl::encoding::DefaultFuchsiaResourceDialect,
15263        > for (T0,)
15264    {
15265        #[inline]
15266        unsafe fn encode(
15267            self,
15268            encoder: &mut fidl::encoding::Encoder<
15269                '_,
15270                fidl::encoding::DefaultFuchsiaResourceDialect,
15271            >,
15272            offset: usize,
15273            depth: fidl::encoding::Depth,
15274        ) -> fidl::Result<()> {
15275            encoder.debug_check_bounds::<FlatlandPresentRequest>(offset);
15276            // Zero out padding regions. There's no need to apply masks
15277            // because the unmasked parts will be overwritten by fields.
15278            // Write the fields.
15279            self.0.encode(encoder, offset + 0, depth)?;
15280            Ok(())
15281        }
15282    }
15283
15284    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
15285        for FlatlandPresentRequest
15286    {
15287        #[inline(always)]
15288        fn new_empty() -> Self {
15289            Self {
15290                args: fidl::new_empty!(PresentArgs, fidl::encoding::DefaultFuchsiaResourceDialect),
15291            }
15292        }
15293
15294        #[inline]
15295        unsafe fn decode(
15296            &mut self,
15297            decoder: &mut fidl::encoding::Decoder<
15298                '_,
15299                fidl::encoding::DefaultFuchsiaResourceDialect,
15300            >,
15301            offset: usize,
15302            _depth: fidl::encoding::Depth,
15303        ) -> fidl::Result<()> {
15304            decoder.debug_check_bounds::<Self>(offset);
15305            // Verify that padding bytes are zero.
15306            fidl::decode!(
15307                PresentArgs,
15308                fidl::encoding::DefaultFuchsiaResourceDialect,
15309                &mut self.args,
15310                decoder,
15311                offset + 0,
15312                _depth
15313            )?;
15314            Ok(())
15315        }
15316    }
15317
15318    impl fidl::encoding::ResourceTypeMarker for FlatlandReleaseViewportResponse {
15319        type Borrowed<'a> = &'a mut Self;
15320        fn take_or_borrow<'a>(
15321            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
15322        ) -> Self::Borrowed<'a> {
15323            value
15324        }
15325    }
15326
15327    unsafe impl fidl::encoding::TypeMarker for FlatlandReleaseViewportResponse {
15328        type Owned = Self;
15329
15330        #[inline(always)]
15331        fn inline_align(_context: fidl::encoding::Context) -> usize {
15332            4
15333        }
15334
15335        #[inline(always)]
15336        fn inline_size(_context: fidl::encoding::Context) -> usize {
15337            4
15338        }
15339    }
15340
15341    unsafe impl
15342        fidl::encoding::Encode<
15343            FlatlandReleaseViewportResponse,
15344            fidl::encoding::DefaultFuchsiaResourceDialect,
15345        > for &mut FlatlandReleaseViewportResponse
15346    {
15347        #[inline]
15348        unsafe fn encode(
15349            self,
15350            encoder: &mut fidl::encoding::Encoder<
15351                '_,
15352                fidl::encoding::DefaultFuchsiaResourceDialect,
15353            >,
15354            offset: usize,
15355            _depth: fidl::encoding::Depth,
15356        ) -> fidl::Result<()> {
15357            encoder.debug_check_bounds::<FlatlandReleaseViewportResponse>(offset);
15358            // Delegate to tuple encoding.
15359            fidl::encoding::Encode::<FlatlandReleaseViewportResponse, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
15360                (
15361                    <fidl_fuchsia_ui_views::ViewportCreationToken as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.token),
15362                ),
15363                encoder, offset, _depth
15364            )
15365        }
15366    }
15367    unsafe impl<
15368        T0: fidl::encoding::Encode<
15369                fidl_fuchsia_ui_views::ViewportCreationToken,
15370                fidl::encoding::DefaultFuchsiaResourceDialect,
15371            >,
15372    >
15373        fidl::encoding::Encode<
15374            FlatlandReleaseViewportResponse,
15375            fidl::encoding::DefaultFuchsiaResourceDialect,
15376        > for (T0,)
15377    {
15378        #[inline]
15379        unsafe fn encode(
15380            self,
15381            encoder: &mut fidl::encoding::Encoder<
15382                '_,
15383                fidl::encoding::DefaultFuchsiaResourceDialect,
15384            >,
15385            offset: usize,
15386            depth: fidl::encoding::Depth,
15387        ) -> fidl::Result<()> {
15388            encoder.debug_check_bounds::<FlatlandReleaseViewportResponse>(offset);
15389            // Zero out padding regions. There's no need to apply masks
15390            // because the unmasked parts will be overwritten by fields.
15391            // Write the fields.
15392            self.0.encode(encoder, offset + 0, depth)?;
15393            Ok(())
15394        }
15395    }
15396
15397    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
15398        for FlatlandReleaseViewportResponse
15399    {
15400        #[inline(always)]
15401        fn new_empty() -> Self {
15402            Self {
15403                token: fidl::new_empty!(
15404                    fidl_fuchsia_ui_views::ViewportCreationToken,
15405                    fidl::encoding::DefaultFuchsiaResourceDialect
15406                ),
15407            }
15408        }
15409
15410        #[inline]
15411        unsafe fn decode(
15412            &mut self,
15413            decoder: &mut fidl::encoding::Decoder<
15414                '_,
15415                fidl::encoding::DefaultFuchsiaResourceDialect,
15416            >,
15417            offset: usize,
15418            _depth: fidl::encoding::Depth,
15419        ) -> fidl::Result<()> {
15420            decoder.debug_check_bounds::<Self>(offset);
15421            // Verify that padding bytes are zero.
15422            fidl::decode!(
15423                fidl_fuchsia_ui_views::ViewportCreationToken,
15424                fidl::encoding::DefaultFuchsiaResourceDialect,
15425                &mut self.token,
15426                decoder,
15427                offset + 0,
15428                _depth
15429            )?;
15430            Ok(())
15431        }
15432    }
15433
15434    impl fidl::encoding::ResourceTypeMarker for FlatlandSetSolidFillRequest {
15435        type Borrowed<'a> = &'a mut Self;
15436        fn take_or_borrow<'a>(
15437            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
15438        ) -> Self::Borrowed<'a> {
15439            value
15440        }
15441    }
15442
15443    unsafe impl fidl::encoding::TypeMarker for FlatlandSetSolidFillRequest {
15444        type Owned = Self;
15445
15446        #[inline(always)]
15447        fn inline_align(_context: fidl::encoding::Context) -> usize {
15448            8
15449        }
15450
15451        #[inline(always)]
15452        fn inline_size(_context: fidl::encoding::Context) -> usize {
15453            32
15454        }
15455    }
15456
15457    unsafe impl
15458        fidl::encoding::Encode<
15459            FlatlandSetSolidFillRequest,
15460            fidl::encoding::DefaultFuchsiaResourceDialect,
15461        > for &mut FlatlandSetSolidFillRequest
15462    {
15463        #[inline]
15464        unsafe fn encode(
15465            self,
15466            encoder: &mut fidl::encoding::Encoder<
15467                '_,
15468                fidl::encoding::DefaultFuchsiaResourceDialect,
15469            >,
15470            offset: usize,
15471            _depth: fidl::encoding::Depth,
15472        ) -> fidl::Result<()> {
15473            encoder.debug_check_bounds::<FlatlandSetSolidFillRequest>(offset);
15474            // Delegate to tuple encoding.
15475            fidl::encoding::Encode::<
15476                FlatlandSetSolidFillRequest,
15477                fidl::encoding::DefaultFuchsiaResourceDialect,
15478            >::encode(
15479                (
15480                    <ContentId as fidl::encoding::ValueTypeMarker>::borrow(&self.rect_id),
15481                    <ColorRgba as fidl::encoding::ValueTypeMarker>::borrow(&self.color),
15482                    <fidl_fuchsia_math::SizeU as fidl::encoding::ValueTypeMarker>::borrow(
15483                        &self.size,
15484                    ),
15485                ),
15486                encoder,
15487                offset,
15488                _depth,
15489            )
15490        }
15491    }
15492    unsafe impl<
15493        T0: fidl::encoding::Encode<ContentId, fidl::encoding::DefaultFuchsiaResourceDialect>,
15494        T1: fidl::encoding::Encode<ColorRgba, fidl::encoding::DefaultFuchsiaResourceDialect>,
15495        T2: fidl::encoding::Encode<
15496                fidl_fuchsia_math::SizeU,
15497                fidl::encoding::DefaultFuchsiaResourceDialect,
15498            >,
15499    >
15500        fidl::encoding::Encode<
15501            FlatlandSetSolidFillRequest,
15502            fidl::encoding::DefaultFuchsiaResourceDialect,
15503        > for (T0, T1, T2)
15504    {
15505        #[inline]
15506        unsafe fn encode(
15507            self,
15508            encoder: &mut fidl::encoding::Encoder<
15509                '_,
15510                fidl::encoding::DefaultFuchsiaResourceDialect,
15511            >,
15512            offset: usize,
15513            depth: fidl::encoding::Depth,
15514        ) -> fidl::Result<()> {
15515            encoder.debug_check_bounds::<FlatlandSetSolidFillRequest>(offset);
15516            // Zero out padding regions. There's no need to apply masks
15517            // because the unmasked parts will be overwritten by fields.
15518            // Write the fields.
15519            self.0.encode(encoder, offset + 0, depth)?;
15520            self.1.encode(encoder, offset + 8, depth)?;
15521            self.2.encode(encoder, offset + 24, depth)?;
15522            Ok(())
15523        }
15524    }
15525
15526    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
15527        for FlatlandSetSolidFillRequest
15528    {
15529        #[inline(always)]
15530        fn new_empty() -> Self {
15531            Self {
15532                rect_id: fidl::new_empty!(ContentId, fidl::encoding::DefaultFuchsiaResourceDialect),
15533                color: fidl::new_empty!(ColorRgba, fidl::encoding::DefaultFuchsiaResourceDialect),
15534                size: fidl::new_empty!(
15535                    fidl_fuchsia_math::SizeU,
15536                    fidl::encoding::DefaultFuchsiaResourceDialect
15537                ),
15538            }
15539        }
15540
15541        #[inline]
15542        unsafe fn decode(
15543            &mut self,
15544            decoder: &mut fidl::encoding::Decoder<
15545                '_,
15546                fidl::encoding::DefaultFuchsiaResourceDialect,
15547            >,
15548            offset: usize,
15549            _depth: fidl::encoding::Depth,
15550        ) -> fidl::Result<()> {
15551            decoder.debug_check_bounds::<Self>(offset);
15552            // Verify that padding bytes are zero.
15553            fidl::decode!(
15554                ContentId,
15555                fidl::encoding::DefaultFuchsiaResourceDialect,
15556                &mut self.rect_id,
15557                decoder,
15558                offset + 0,
15559                _depth
15560            )?;
15561            fidl::decode!(
15562                ColorRgba,
15563                fidl::encoding::DefaultFuchsiaResourceDialect,
15564                &mut self.color,
15565                decoder,
15566                offset + 8,
15567                _depth
15568            )?;
15569            fidl::decode!(
15570                fidl_fuchsia_math::SizeU,
15571                fidl::encoding::DefaultFuchsiaResourceDialect,
15572                &mut self.size,
15573                decoder,
15574                offset + 24,
15575                _depth
15576            )?;
15577            Ok(())
15578        }
15579    }
15580
15581    impl fidl::encoding::ResourceTypeMarker for TrustedFlatlandFactoryCreateFlatlandRequest {
15582        type Borrowed<'a> = &'a mut Self;
15583        fn take_or_borrow<'a>(
15584            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
15585        ) -> Self::Borrowed<'a> {
15586            value
15587        }
15588    }
15589
15590    unsafe impl fidl::encoding::TypeMarker for TrustedFlatlandFactoryCreateFlatlandRequest {
15591        type Owned = Self;
15592
15593        #[inline(always)]
15594        fn inline_align(_context: fidl::encoding::Context) -> usize {
15595            8
15596        }
15597
15598        #[inline(always)]
15599        fn inline_size(_context: fidl::encoding::Context) -> usize {
15600            24
15601        }
15602    }
15603
15604    unsafe impl
15605        fidl::encoding::Encode<
15606            TrustedFlatlandFactoryCreateFlatlandRequest,
15607            fidl::encoding::DefaultFuchsiaResourceDialect,
15608        > for &mut TrustedFlatlandFactoryCreateFlatlandRequest
15609    {
15610        #[inline]
15611        unsafe fn encode(
15612            self,
15613            encoder: &mut fidl::encoding::Encoder<
15614                '_,
15615                fidl::encoding::DefaultFuchsiaResourceDialect,
15616            >,
15617            offset: usize,
15618            _depth: fidl::encoding::Depth,
15619        ) -> fidl::Result<()> {
15620            encoder.debug_check_bounds::<TrustedFlatlandFactoryCreateFlatlandRequest>(offset);
15621            // Delegate to tuple encoding.
15622            fidl::encoding::Encode::<TrustedFlatlandFactoryCreateFlatlandRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
15623                (
15624                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<FlatlandMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.server_end),
15625                    <TrustedFlatlandConfig as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.config),
15626                ),
15627                encoder, offset, _depth
15628            )
15629        }
15630    }
15631    unsafe impl<
15632        T0: fidl::encoding::Encode<
15633                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<FlatlandMarker>>,
15634                fidl::encoding::DefaultFuchsiaResourceDialect,
15635            >,
15636        T1: fidl::encoding::Encode<
15637                TrustedFlatlandConfig,
15638                fidl::encoding::DefaultFuchsiaResourceDialect,
15639            >,
15640    >
15641        fidl::encoding::Encode<
15642            TrustedFlatlandFactoryCreateFlatlandRequest,
15643            fidl::encoding::DefaultFuchsiaResourceDialect,
15644        > for (T0, T1)
15645    {
15646        #[inline]
15647        unsafe fn encode(
15648            self,
15649            encoder: &mut fidl::encoding::Encoder<
15650                '_,
15651                fidl::encoding::DefaultFuchsiaResourceDialect,
15652            >,
15653            offset: usize,
15654            depth: fidl::encoding::Depth,
15655        ) -> fidl::Result<()> {
15656            encoder.debug_check_bounds::<TrustedFlatlandFactoryCreateFlatlandRequest>(offset);
15657            // Zero out padding regions. There's no need to apply masks
15658            // because the unmasked parts will be overwritten by fields.
15659            unsafe {
15660                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
15661                (ptr as *mut u64).write_unaligned(0);
15662            }
15663            // Write the fields.
15664            self.0.encode(encoder, offset + 0, depth)?;
15665            self.1.encode(encoder, offset + 8, depth)?;
15666            Ok(())
15667        }
15668    }
15669
15670    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
15671        for TrustedFlatlandFactoryCreateFlatlandRequest
15672    {
15673        #[inline(always)]
15674        fn new_empty() -> Self {
15675            Self {
15676                server_end: fidl::new_empty!(
15677                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<FlatlandMarker>>,
15678                    fidl::encoding::DefaultFuchsiaResourceDialect
15679                ),
15680                config: fidl::new_empty!(
15681                    TrustedFlatlandConfig,
15682                    fidl::encoding::DefaultFuchsiaResourceDialect
15683                ),
15684            }
15685        }
15686
15687        #[inline]
15688        unsafe fn decode(
15689            &mut self,
15690            decoder: &mut fidl::encoding::Decoder<
15691                '_,
15692                fidl::encoding::DefaultFuchsiaResourceDialect,
15693            >,
15694            offset: usize,
15695            _depth: fidl::encoding::Depth,
15696        ) -> fidl::Result<()> {
15697            decoder.debug_check_bounds::<Self>(offset);
15698            // Verify that padding bytes are zero.
15699            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
15700            let padval = unsafe { (ptr as *const u64).read_unaligned() };
15701            let mask = 0xffffffff00000000u64;
15702            let maskedval = padval & mask;
15703            if maskedval != 0 {
15704                return Err(fidl::Error::NonZeroPadding {
15705                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
15706                });
15707            }
15708            fidl::decode!(
15709                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<FlatlandMarker>>,
15710                fidl::encoding::DefaultFuchsiaResourceDialect,
15711                &mut self.server_end,
15712                decoder,
15713                offset + 0,
15714                _depth
15715            )?;
15716            fidl::decode!(
15717                TrustedFlatlandConfig,
15718                fidl::encoding::DefaultFuchsiaResourceDialect,
15719                &mut self.config,
15720                decoder,
15721                offset + 8,
15722                _depth
15723            )?;
15724            Ok(())
15725        }
15726    }
15727
15728    impl FrameInfo {
15729        #[inline(always)]
15730        fn max_ordinal_present(&self) -> u64 {
15731            if let Some(_) = self.buffer_id {
15732                return 1;
15733            }
15734            0
15735        }
15736    }
15737
15738    impl fidl::encoding::ResourceTypeMarker for FrameInfo {
15739        type Borrowed<'a> = &'a mut Self;
15740        fn take_or_borrow<'a>(
15741            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
15742        ) -> Self::Borrowed<'a> {
15743            value
15744        }
15745    }
15746
15747    unsafe impl fidl::encoding::TypeMarker for FrameInfo {
15748        type Owned = Self;
15749
15750        #[inline(always)]
15751        fn inline_align(_context: fidl::encoding::Context) -> usize {
15752            8
15753        }
15754
15755        #[inline(always)]
15756        fn inline_size(_context: fidl::encoding::Context) -> usize {
15757            16
15758        }
15759    }
15760
15761    unsafe impl fidl::encoding::Encode<FrameInfo, fidl::encoding::DefaultFuchsiaResourceDialect>
15762        for &mut FrameInfo
15763    {
15764        unsafe fn encode(
15765            self,
15766            encoder: &mut fidl::encoding::Encoder<
15767                '_,
15768                fidl::encoding::DefaultFuchsiaResourceDialect,
15769            >,
15770            offset: usize,
15771            mut depth: fidl::encoding::Depth,
15772        ) -> fidl::Result<()> {
15773            encoder.debug_check_bounds::<FrameInfo>(offset);
15774            // Vector header
15775            let max_ordinal: u64 = self.max_ordinal_present();
15776            encoder.write_num(max_ordinal, offset);
15777            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
15778            // Calling encoder.out_of_line_offset(0) is not allowed.
15779            if max_ordinal == 0 {
15780                return Ok(());
15781            }
15782            depth.increment()?;
15783            let envelope_size = 8;
15784            let bytes_len = max_ordinal as usize * envelope_size;
15785            #[allow(unused_variables)]
15786            let offset = encoder.out_of_line_offset(bytes_len);
15787            let mut _prev_end_offset: usize = 0;
15788            if 1 > max_ordinal {
15789                return Ok(());
15790            }
15791
15792            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
15793            // are envelope_size bytes.
15794            let cur_offset: usize = (1 - 1) * envelope_size;
15795
15796            // Zero reserved fields.
15797            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
15798
15799            // Safety:
15800            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
15801            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
15802            //   envelope_size bytes, there is always sufficient room.
15803            fidl::encoding::encode_in_envelope_optional::<
15804                u32,
15805                fidl::encoding::DefaultFuchsiaResourceDialect,
15806            >(
15807                self.buffer_id.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
15808                encoder,
15809                offset + cur_offset,
15810                depth,
15811            )?;
15812
15813            _prev_end_offset = cur_offset + envelope_size;
15814
15815            Ok(())
15816        }
15817    }
15818
15819    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for FrameInfo {
15820        #[inline(always)]
15821        fn new_empty() -> Self {
15822            Self::default()
15823        }
15824
15825        unsafe fn decode(
15826            &mut self,
15827            decoder: &mut fidl::encoding::Decoder<
15828                '_,
15829                fidl::encoding::DefaultFuchsiaResourceDialect,
15830            >,
15831            offset: usize,
15832            mut depth: fidl::encoding::Depth,
15833        ) -> fidl::Result<()> {
15834            decoder.debug_check_bounds::<Self>(offset);
15835            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
15836                None => return Err(fidl::Error::NotNullable),
15837                Some(len) => len,
15838            };
15839            // Calling decoder.out_of_line_offset(0) is not allowed.
15840            if len == 0 {
15841                return Ok(());
15842            };
15843            depth.increment()?;
15844            let envelope_size = 8;
15845            let bytes_len = len * envelope_size;
15846            let offset = decoder.out_of_line_offset(bytes_len)?;
15847            // Decode the envelope for each type.
15848            let mut _next_ordinal_to_read = 0;
15849            let mut next_offset = offset;
15850            let end_offset = offset + bytes_len;
15851            _next_ordinal_to_read += 1;
15852            if next_offset >= end_offset {
15853                return Ok(());
15854            }
15855
15856            // Decode unknown envelopes for gaps in ordinals.
15857            while _next_ordinal_to_read < 1 {
15858                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
15859                _next_ordinal_to_read += 1;
15860                next_offset += envelope_size;
15861            }
15862
15863            let next_out_of_line = decoder.next_out_of_line();
15864            let handles_before = decoder.remaining_handles();
15865            if let Some((inlined, num_bytes, num_handles)) =
15866                fidl::encoding::decode_envelope_header(decoder, next_offset)?
15867            {
15868                let member_inline_size =
15869                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
15870                if inlined != (member_inline_size <= 4) {
15871                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
15872                }
15873                let inner_offset;
15874                let mut inner_depth = depth.clone();
15875                if inlined {
15876                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
15877                    inner_offset = next_offset;
15878                } else {
15879                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
15880                    inner_depth.increment()?;
15881                }
15882                let val_ref = self.buffer_id.get_or_insert_with(|| {
15883                    fidl::new_empty!(u32, fidl::encoding::DefaultFuchsiaResourceDialect)
15884                });
15885                fidl::decode!(
15886                    u32,
15887                    fidl::encoding::DefaultFuchsiaResourceDialect,
15888                    val_ref,
15889                    decoder,
15890                    inner_offset,
15891                    inner_depth
15892                )?;
15893                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
15894                {
15895                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
15896                }
15897                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
15898                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
15899                }
15900            }
15901
15902            next_offset += envelope_size;
15903
15904            // Decode the remaining unknown envelopes.
15905            while next_offset < end_offset {
15906                _next_ordinal_to_read += 1;
15907                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
15908                next_offset += envelope_size;
15909            }
15910
15911            Ok(())
15912        }
15913    }
15914
15915    impl GetNextFrameArgs {
15916        #[inline(always)]
15917        fn max_ordinal_present(&self) -> u64 {
15918            if let Some(_) = self.event {
15919                return 1;
15920            }
15921            0
15922        }
15923    }
15924
15925    impl fidl::encoding::ResourceTypeMarker for GetNextFrameArgs {
15926        type Borrowed<'a> = &'a mut Self;
15927        fn take_or_borrow<'a>(
15928            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
15929        ) -> Self::Borrowed<'a> {
15930            value
15931        }
15932    }
15933
15934    unsafe impl fidl::encoding::TypeMarker for GetNextFrameArgs {
15935        type Owned = Self;
15936
15937        #[inline(always)]
15938        fn inline_align(_context: fidl::encoding::Context) -> usize {
15939            8
15940        }
15941
15942        #[inline(always)]
15943        fn inline_size(_context: fidl::encoding::Context) -> usize {
15944            16
15945        }
15946    }
15947
15948    unsafe impl
15949        fidl::encoding::Encode<GetNextFrameArgs, fidl::encoding::DefaultFuchsiaResourceDialect>
15950        for &mut GetNextFrameArgs
15951    {
15952        unsafe fn encode(
15953            self,
15954            encoder: &mut fidl::encoding::Encoder<
15955                '_,
15956                fidl::encoding::DefaultFuchsiaResourceDialect,
15957            >,
15958            offset: usize,
15959            mut depth: fidl::encoding::Depth,
15960        ) -> fidl::Result<()> {
15961            encoder.debug_check_bounds::<GetNextFrameArgs>(offset);
15962            // Vector header
15963            let max_ordinal: u64 = self.max_ordinal_present();
15964            encoder.write_num(max_ordinal, offset);
15965            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
15966            // Calling encoder.out_of_line_offset(0) is not allowed.
15967            if max_ordinal == 0 {
15968                return Ok(());
15969            }
15970            depth.increment()?;
15971            let envelope_size = 8;
15972            let bytes_len = max_ordinal as usize * envelope_size;
15973            #[allow(unused_variables)]
15974            let offset = encoder.out_of_line_offset(bytes_len);
15975            let mut _prev_end_offset: usize = 0;
15976            if 1 > max_ordinal {
15977                return Ok(());
15978            }
15979
15980            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
15981            // are envelope_size bytes.
15982            let cur_offset: usize = (1 - 1) * envelope_size;
15983
15984            // Zero reserved fields.
15985            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
15986
15987            // Safety:
15988            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
15989            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
15990            //   envelope_size bytes, there is always sufficient room.
15991            fidl::encoding::encode_in_envelope_optional::<
15992                fidl::encoding::HandleType<
15993                    fidl::Event,
15994                    { fidl::ObjectType::EVENT.into_raw() },
15995                    2147483648,
15996                >,
15997                fidl::encoding::DefaultFuchsiaResourceDialect,
15998            >(
15999                self.event.as_mut().map(
16000                    <fidl::encoding::HandleType<
16001                        fidl::Event,
16002                        { fidl::ObjectType::EVENT.into_raw() },
16003                        2147483648,
16004                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
16005                ),
16006                encoder,
16007                offset + cur_offset,
16008                depth,
16009            )?;
16010
16011            _prev_end_offset = cur_offset + envelope_size;
16012
16013            Ok(())
16014        }
16015    }
16016
16017    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
16018        for GetNextFrameArgs
16019    {
16020        #[inline(always)]
16021        fn new_empty() -> Self {
16022            Self::default()
16023        }
16024
16025        unsafe fn decode(
16026            &mut self,
16027            decoder: &mut fidl::encoding::Decoder<
16028                '_,
16029                fidl::encoding::DefaultFuchsiaResourceDialect,
16030            >,
16031            offset: usize,
16032            mut depth: fidl::encoding::Depth,
16033        ) -> fidl::Result<()> {
16034            decoder.debug_check_bounds::<Self>(offset);
16035            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
16036                None => return Err(fidl::Error::NotNullable),
16037                Some(len) => len,
16038            };
16039            // Calling decoder.out_of_line_offset(0) is not allowed.
16040            if len == 0 {
16041                return Ok(());
16042            };
16043            depth.increment()?;
16044            let envelope_size = 8;
16045            let bytes_len = len * envelope_size;
16046            let offset = decoder.out_of_line_offset(bytes_len)?;
16047            // Decode the envelope for each type.
16048            let mut _next_ordinal_to_read = 0;
16049            let mut next_offset = offset;
16050            let end_offset = offset + bytes_len;
16051            _next_ordinal_to_read += 1;
16052            if next_offset >= end_offset {
16053                return Ok(());
16054            }
16055
16056            // Decode unknown envelopes for gaps in ordinals.
16057            while _next_ordinal_to_read < 1 {
16058                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
16059                _next_ordinal_to_read += 1;
16060                next_offset += envelope_size;
16061            }
16062
16063            let next_out_of_line = decoder.next_out_of_line();
16064            let handles_before = decoder.remaining_handles();
16065            if let Some((inlined, num_bytes, num_handles)) =
16066                fidl::encoding::decode_envelope_header(decoder, next_offset)?
16067            {
16068                let member_inline_size = <fidl::encoding::HandleType<
16069                    fidl::Event,
16070                    { fidl::ObjectType::EVENT.into_raw() },
16071                    2147483648,
16072                > as fidl::encoding::TypeMarker>::inline_size(
16073                    decoder.context
16074                );
16075                if inlined != (member_inline_size <= 4) {
16076                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
16077                }
16078                let inner_offset;
16079                let mut inner_depth = depth.clone();
16080                if inlined {
16081                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
16082                    inner_offset = next_offset;
16083                } else {
16084                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
16085                    inner_depth.increment()?;
16086                }
16087                let val_ref =
16088                self.event.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
16089                fidl::decode!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
16090                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
16091                {
16092                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
16093                }
16094                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
16095                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
16096                }
16097            }
16098
16099            next_offset += envelope_size;
16100
16101            // Decode the remaining unknown envelopes.
16102            while next_offset < end_offset {
16103                _next_ordinal_to_read += 1;
16104                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
16105                next_offset += envelope_size;
16106            }
16107
16108            Ok(())
16109        }
16110    }
16111
16112    impl PresentArgs {
16113        #[inline(always)]
16114        fn max_ordinal_present(&self) -> u64 {
16115            if let Some(_) = self.release_counters {
16116                return 8;
16117            }
16118            if let Some(_) = self.present_fences {
16119                return 7;
16120            }
16121            if let Some(_) = self.unsquashable {
16122                return 4;
16123            }
16124            if let Some(_) = self.release_fences {
16125                return 3;
16126            }
16127            if let Some(_) = self.acquire_fences {
16128                return 2;
16129            }
16130            if let Some(_) = self.requested_presentation_time {
16131                return 1;
16132            }
16133            0
16134        }
16135    }
16136
16137    impl fidl::encoding::ResourceTypeMarker for PresentArgs {
16138        type Borrowed<'a> = &'a mut Self;
16139        fn take_or_borrow<'a>(
16140            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
16141        ) -> Self::Borrowed<'a> {
16142            value
16143        }
16144    }
16145
16146    unsafe impl fidl::encoding::TypeMarker for PresentArgs {
16147        type Owned = Self;
16148
16149        #[inline(always)]
16150        fn inline_align(_context: fidl::encoding::Context) -> usize {
16151            8
16152        }
16153
16154        #[inline(always)]
16155        fn inline_size(_context: fidl::encoding::Context) -> usize {
16156            16
16157        }
16158    }
16159
16160    unsafe impl fidl::encoding::Encode<PresentArgs, fidl::encoding::DefaultFuchsiaResourceDialect>
16161        for &mut PresentArgs
16162    {
16163        unsafe fn encode(
16164            self,
16165            encoder: &mut fidl::encoding::Encoder<
16166                '_,
16167                fidl::encoding::DefaultFuchsiaResourceDialect,
16168            >,
16169            offset: usize,
16170            mut depth: fidl::encoding::Depth,
16171        ) -> fidl::Result<()> {
16172            encoder.debug_check_bounds::<PresentArgs>(offset);
16173            // Vector header
16174            let max_ordinal: u64 = self.max_ordinal_present();
16175            encoder.write_num(max_ordinal, offset);
16176            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
16177            // Calling encoder.out_of_line_offset(0) is not allowed.
16178            if max_ordinal == 0 {
16179                return Ok(());
16180            }
16181            depth.increment()?;
16182            let envelope_size = 8;
16183            let bytes_len = max_ordinal as usize * envelope_size;
16184            #[allow(unused_variables)]
16185            let offset = encoder.out_of_line_offset(bytes_len);
16186            let mut _prev_end_offset: usize = 0;
16187            if 1 > max_ordinal {
16188                return Ok(());
16189            }
16190
16191            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
16192            // are envelope_size bytes.
16193            let cur_offset: usize = (1 - 1) * envelope_size;
16194
16195            // Zero reserved fields.
16196            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
16197
16198            // Safety:
16199            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
16200            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
16201            //   envelope_size bytes, there is always sufficient room.
16202            fidl::encoding::encode_in_envelope_optional::<
16203                i64,
16204                fidl::encoding::DefaultFuchsiaResourceDialect,
16205            >(
16206                self.requested_presentation_time
16207                    .as_ref()
16208                    .map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
16209                encoder,
16210                offset + cur_offset,
16211                depth,
16212            )?;
16213
16214            _prev_end_offset = cur_offset + envelope_size;
16215            if 2 > max_ordinal {
16216                return Ok(());
16217            }
16218
16219            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
16220            // are envelope_size bytes.
16221            let cur_offset: usize = (2 - 1) * envelope_size;
16222
16223            // Zero reserved fields.
16224            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
16225
16226            // Safety:
16227            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
16228            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
16229            //   envelope_size bytes, there is always sufficient room.
16230            fidl::encoding::encode_in_envelope_optional::<
16231                fidl::encoding::Vector<
16232                    fidl::encoding::HandleType<
16233                        fidl::Event,
16234                        { fidl::ObjectType::EVENT.into_raw() },
16235                        2147483648,
16236                    >,
16237                    16,
16238                >,
16239                fidl::encoding::DefaultFuchsiaResourceDialect,
16240            >(
16241                self.acquire_fences.as_mut().map(
16242                    <fidl::encoding::Vector<
16243                        fidl::encoding::HandleType<
16244                            fidl::Event,
16245                            { fidl::ObjectType::EVENT.into_raw() },
16246                            2147483648,
16247                        >,
16248                        16,
16249                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
16250                ),
16251                encoder,
16252                offset + cur_offset,
16253                depth,
16254            )?;
16255
16256            _prev_end_offset = cur_offset + envelope_size;
16257            if 3 > max_ordinal {
16258                return Ok(());
16259            }
16260
16261            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
16262            // are envelope_size bytes.
16263            let cur_offset: usize = (3 - 1) * envelope_size;
16264
16265            // Zero reserved fields.
16266            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
16267
16268            // Safety:
16269            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
16270            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
16271            //   envelope_size bytes, there is always sufficient room.
16272            fidl::encoding::encode_in_envelope_optional::<
16273                fidl::encoding::Vector<
16274                    fidl::encoding::HandleType<
16275                        fidl::Event,
16276                        { fidl::ObjectType::EVENT.into_raw() },
16277                        2147483648,
16278                    >,
16279                    16,
16280                >,
16281                fidl::encoding::DefaultFuchsiaResourceDialect,
16282            >(
16283                self.release_fences.as_mut().map(
16284                    <fidl::encoding::Vector<
16285                        fidl::encoding::HandleType<
16286                            fidl::Event,
16287                            { fidl::ObjectType::EVENT.into_raw() },
16288                            2147483648,
16289                        >,
16290                        16,
16291                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
16292                ),
16293                encoder,
16294                offset + cur_offset,
16295                depth,
16296            )?;
16297
16298            _prev_end_offset = cur_offset + envelope_size;
16299            if 4 > max_ordinal {
16300                return Ok(());
16301            }
16302
16303            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
16304            // are envelope_size bytes.
16305            let cur_offset: usize = (4 - 1) * envelope_size;
16306
16307            // Zero reserved fields.
16308            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
16309
16310            // Safety:
16311            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
16312            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
16313            //   envelope_size bytes, there is always sufficient room.
16314            fidl::encoding::encode_in_envelope_optional::<
16315                bool,
16316                fidl::encoding::DefaultFuchsiaResourceDialect,
16317            >(
16318                self.unsquashable.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
16319                encoder,
16320                offset + cur_offset,
16321                depth,
16322            )?;
16323
16324            _prev_end_offset = cur_offset + envelope_size;
16325            if 7 > max_ordinal {
16326                return Ok(());
16327            }
16328
16329            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
16330            // are envelope_size bytes.
16331            let cur_offset: usize = (7 - 1) * envelope_size;
16332
16333            // Zero reserved fields.
16334            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
16335
16336            // Safety:
16337            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
16338            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
16339            //   envelope_size bytes, there is always sufficient room.
16340            fidl::encoding::encode_in_envelope_optional::<
16341                fidl::encoding::Vector<
16342                    fidl::encoding::HandleType<
16343                        fidl::Counter,
16344                        { fidl::ObjectType::COUNTER.into_raw() },
16345                        2147483648,
16346                    >,
16347                    16,
16348                >,
16349                fidl::encoding::DefaultFuchsiaResourceDialect,
16350            >(
16351                self.present_fences.as_mut().map(
16352                    <fidl::encoding::Vector<
16353                        fidl::encoding::HandleType<
16354                            fidl::Counter,
16355                            { fidl::ObjectType::COUNTER.into_raw() },
16356                            2147483648,
16357                        >,
16358                        16,
16359                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
16360                ),
16361                encoder,
16362                offset + cur_offset,
16363                depth,
16364            )?;
16365
16366            _prev_end_offset = cur_offset + envelope_size;
16367            if 8 > max_ordinal {
16368                return Ok(());
16369            }
16370
16371            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
16372            // are envelope_size bytes.
16373            let cur_offset: usize = (8 - 1) * envelope_size;
16374
16375            // Zero reserved fields.
16376            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
16377
16378            // Safety:
16379            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
16380            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
16381            //   envelope_size bytes, there is always sufficient room.
16382            fidl::encoding::encode_in_envelope_optional::<
16383                fidl::encoding::Vector<
16384                    fidl::encoding::HandleType<
16385                        fidl::Counter,
16386                        { fidl::ObjectType::COUNTER.into_raw() },
16387                        2147483648,
16388                    >,
16389                    16,
16390                >,
16391                fidl::encoding::DefaultFuchsiaResourceDialect,
16392            >(
16393                self.release_counters.as_mut().map(
16394                    <fidl::encoding::Vector<
16395                        fidl::encoding::HandleType<
16396                            fidl::Counter,
16397                            { fidl::ObjectType::COUNTER.into_raw() },
16398                            2147483648,
16399                        >,
16400                        16,
16401                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
16402                ),
16403                encoder,
16404                offset + cur_offset,
16405                depth,
16406            )?;
16407
16408            _prev_end_offset = cur_offset + envelope_size;
16409
16410            Ok(())
16411        }
16412    }
16413
16414    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for PresentArgs {
16415        #[inline(always)]
16416        fn new_empty() -> Self {
16417            Self::default()
16418        }
16419
16420        unsafe fn decode(
16421            &mut self,
16422            decoder: &mut fidl::encoding::Decoder<
16423                '_,
16424                fidl::encoding::DefaultFuchsiaResourceDialect,
16425            >,
16426            offset: usize,
16427            mut depth: fidl::encoding::Depth,
16428        ) -> fidl::Result<()> {
16429            decoder.debug_check_bounds::<Self>(offset);
16430            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
16431                None => return Err(fidl::Error::NotNullable),
16432                Some(len) => len,
16433            };
16434            // Calling decoder.out_of_line_offset(0) is not allowed.
16435            if len == 0 {
16436                return Ok(());
16437            };
16438            depth.increment()?;
16439            let envelope_size = 8;
16440            let bytes_len = len * envelope_size;
16441            let offset = decoder.out_of_line_offset(bytes_len)?;
16442            // Decode the envelope for each type.
16443            let mut _next_ordinal_to_read = 0;
16444            let mut next_offset = offset;
16445            let end_offset = offset + bytes_len;
16446            _next_ordinal_to_read += 1;
16447            if next_offset >= end_offset {
16448                return Ok(());
16449            }
16450
16451            // Decode unknown envelopes for gaps in ordinals.
16452            while _next_ordinal_to_read < 1 {
16453                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
16454                _next_ordinal_to_read += 1;
16455                next_offset += envelope_size;
16456            }
16457
16458            let next_out_of_line = decoder.next_out_of_line();
16459            let handles_before = decoder.remaining_handles();
16460            if let Some((inlined, num_bytes, num_handles)) =
16461                fidl::encoding::decode_envelope_header(decoder, next_offset)?
16462            {
16463                let member_inline_size =
16464                    <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
16465                if inlined != (member_inline_size <= 4) {
16466                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
16467                }
16468                let inner_offset;
16469                let mut inner_depth = depth.clone();
16470                if inlined {
16471                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
16472                    inner_offset = next_offset;
16473                } else {
16474                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
16475                    inner_depth.increment()?;
16476                }
16477                let val_ref = self.requested_presentation_time.get_or_insert_with(|| {
16478                    fidl::new_empty!(i64, fidl::encoding::DefaultFuchsiaResourceDialect)
16479                });
16480                fidl::decode!(
16481                    i64,
16482                    fidl::encoding::DefaultFuchsiaResourceDialect,
16483                    val_ref,
16484                    decoder,
16485                    inner_offset,
16486                    inner_depth
16487                )?;
16488                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
16489                {
16490                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
16491                }
16492                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
16493                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
16494                }
16495            }
16496
16497            next_offset += envelope_size;
16498            _next_ordinal_to_read += 1;
16499            if next_offset >= end_offset {
16500                return Ok(());
16501            }
16502
16503            // Decode unknown envelopes for gaps in ordinals.
16504            while _next_ordinal_to_read < 2 {
16505                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
16506                _next_ordinal_to_read += 1;
16507                next_offset += envelope_size;
16508            }
16509
16510            let next_out_of_line = decoder.next_out_of_line();
16511            let handles_before = decoder.remaining_handles();
16512            if let Some((inlined, num_bytes, num_handles)) =
16513                fidl::encoding::decode_envelope_header(decoder, next_offset)?
16514            {
16515                let member_inline_size = <fidl::encoding::Vector<
16516                    fidl::encoding::HandleType<
16517                        fidl::Event,
16518                        { fidl::ObjectType::EVENT.into_raw() },
16519                        2147483648,
16520                    >,
16521                    16,
16522                > as fidl::encoding::TypeMarker>::inline_size(
16523                    decoder.context
16524                );
16525                if inlined != (member_inline_size <= 4) {
16526                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
16527                }
16528                let inner_offset;
16529                let mut inner_depth = depth.clone();
16530                if inlined {
16531                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
16532                    inner_offset = next_offset;
16533                } else {
16534                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
16535                    inner_depth.increment()?;
16536                }
16537                let val_ref = self.acquire_fences.get_or_insert_with(|| {
16538                    fidl::new_empty!(
16539                        fidl::encoding::Vector<
16540                            fidl::encoding::HandleType<
16541                                fidl::Event,
16542                                { fidl::ObjectType::EVENT.into_raw() },
16543                                2147483648,
16544                            >,
16545                            16,
16546                        >,
16547                        fidl::encoding::DefaultFuchsiaResourceDialect
16548                    )
16549                });
16550                fidl::decode!(
16551                    fidl::encoding::Vector<
16552                        fidl::encoding::HandleType<
16553                            fidl::Event,
16554                            { fidl::ObjectType::EVENT.into_raw() },
16555                            2147483648,
16556                        >,
16557                        16,
16558                    >,
16559                    fidl::encoding::DefaultFuchsiaResourceDialect,
16560                    val_ref,
16561                    decoder,
16562                    inner_offset,
16563                    inner_depth
16564                )?;
16565                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
16566                {
16567                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
16568                }
16569                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
16570                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
16571                }
16572            }
16573
16574            next_offset += envelope_size;
16575            _next_ordinal_to_read += 1;
16576            if next_offset >= end_offset {
16577                return Ok(());
16578            }
16579
16580            // Decode unknown envelopes for gaps in ordinals.
16581            while _next_ordinal_to_read < 3 {
16582                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
16583                _next_ordinal_to_read += 1;
16584                next_offset += envelope_size;
16585            }
16586
16587            let next_out_of_line = decoder.next_out_of_line();
16588            let handles_before = decoder.remaining_handles();
16589            if let Some((inlined, num_bytes, num_handles)) =
16590                fidl::encoding::decode_envelope_header(decoder, next_offset)?
16591            {
16592                let member_inline_size = <fidl::encoding::Vector<
16593                    fidl::encoding::HandleType<
16594                        fidl::Event,
16595                        { fidl::ObjectType::EVENT.into_raw() },
16596                        2147483648,
16597                    >,
16598                    16,
16599                > as fidl::encoding::TypeMarker>::inline_size(
16600                    decoder.context
16601                );
16602                if inlined != (member_inline_size <= 4) {
16603                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
16604                }
16605                let inner_offset;
16606                let mut inner_depth = depth.clone();
16607                if inlined {
16608                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
16609                    inner_offset = next_offset;
16610                } else {
16611                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
16612                    inner_depth.increment()?;
16613                }
16614                let val_ref = self.release_fences.get_or_insert_with(|| {
16615                    fidl::new_empty!(
16616                        fidl::encoding::Vector<
16617                            fidl::encoding::HandleType<
16618                                fidl::Event,
16619                                { fidl::ObjectType::EVENT.into_raw() },
16620                                2147483648,
16621                            >,
16622                            16,
16623                        >,
16624                        fidl::encoding::DefaultFuchsiaResourceDialect
16625                    )
16626                });
16627                fidl::decode!(
16628                    fidl::encoding::Vector<
16629                        fidl::encoding::HandleType<
16630                            fidl::Event,
16631                            { fidl::ObjectType::EVENT.into_raw() },
16632                            2147483648,
16633                        >,
16634                        16,
16635                    >,
16636                    fidl::encoding::DefaultFuchsiaResourceDialect,
16637                    val_ref,
16638                    decoder,
16639                    inner_offset,
16640                    inner_depth
16641                )?;
16642                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
16643                {
16644                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
16645                }
16646                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
16647                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
16648                }
16649            }
16650
16651            next_offset += envelope_size;
16652            _next_ordinal_to_read += 1;
16653            if next_offset >= end_offset {
16654                return Ok(());
16655            }
16656
16657            // Decode unknown envelopes for gaps in ordinals.
16658            while _next_ordinal_to_read < 4 {
16659                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
16660                _next_ordinal_to_read += 1;
16661                next_offset += envelope_size;
16662            }
16663
16664            let next_out_of_line = decoder.next_out_of_line();
16665            let handles_before = decoder.remaining_handles();
16666            if let Some((inlined, num_bytes, num_handles)) =
16667                fidl::encoding::decode_envelope_header(decoder, next_offset)?
16668            {
16669                let member_inline_size =
16670                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
16671                if inlined != (member_inline_size <= 4) {
16672                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
16673                }
16674                let inner_offset;
16675                let mut inner_depth = depth.clone();
16676                if inlined {
16677                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
16678                    inner_offset = next_offset;
16679                } else {
16680                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
16681                    inner_depth.increment()?;
16682                }
16683                let val_ref = self.unsquashable.get_or_insert_with(|| {
16684                    fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
16685                });
16686                fidl::decode!(
16687                    bool,
16688                    fidl::encoding::DefaultFuchsiaResourceDialect,
16689                    val_ref,
16690                    decoder,
16691                    inner_offset,
16692                    inner_depth
16693                )?;
16694                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
16695                {
16696                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
16697                }
16698                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
16699                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
16700                }
16701            }
16702
16703            next_offset += envelope_size;
16704            _next_ordinal_to_read += 1;
16705            if next_offset >= end_offset {
16706                return Ok(());
16707            }
16708
16709            // Decode unknown envelopes for gaps in ordinals.
16710            while _next_ordinal_to_read < 7 {
16711                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
16712                _next_ordinal_to_read += 1;
16713                next_offset += envelope_size;
16714            }
16715
16716            let next_out_of_line = decoder.next_out_of_line();
16717            let handles_before = decoder.remaining_handles();
16718            if let Some((inlined, num_bytes, num_handles)) =
16719                fidl::encoding::decode_envelope_header(decoder, next_offset)?
16720            {
16721                let member_inline_size = <fidl::encoding::Vector<
16722                    fidl::encoding::HandleType<
16723                        fidl::Counter,
16724                        { fidl::ObjectType::COUNTER.into_raw() },
16725                        2147483648,
16726                    >,
16727                    16,
16728                > as fidl::encoding::TypeMarker>::inline_size(
16729                    decoder.context
16730                );
16731                if inlined != (member_inline_size <= 4) {
16732                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
16733                }
16734                let inner_offset;
16735                let mut inner_depth = depth.clone();
16736                if inlined {
16737                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
16738                    inner_offset = next_offset;
16739                } else {
16740                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
16741                    inner_depth.increment()?;
16742                }
16743                let val_ref = self.present_fences.get_or_insert_with(|| {
16744                    fidl::new_empty!(
16745                        fidl::encoding::Vector<
16746                            fidl::encoding::HandleType<
16747                                fidl::Counter,
16748                                { fidl::ObjectType::COUNTER.into_raw() },
16749                                2147483648,
16750                            >,
16751                            16,
16752                        >,
16753                        fidl::encoding::DefaultFuchsiaResourceDialect
16754                    )
16755                });
16756                fidl::decode!(
16757                    fidl::encoding::Vector<
16758                        fidl::encoding::HandleType<
16759                            fidl::Counter,
16760                            { fidl::ObjectType::COUNTER.into_raw() },
16761                            2147483648,
16762                        >,
16763                        16,
16764                    >,
16765                    fidl::encoding::DefaultFuchsiaResourceDialect,
16766                    val_ref,
16767                    decoder,
16768                    inner_offset,
16769                    inner_depth
16770                )?;
16771                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
16772                {
16773                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
16774                }
16775                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
16776                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
16777                }
16778            }
16779
16780            next_offset += envelope_size;
16781            _next_ordinal_to_read += 1;
16782            if next_offset >= end_offset {
16783                return Ok(());
16784            }
16785
16786            // Decode unknown envelopes for gaps in ordinals.
16787            while _next_ordinal_to_read < 8 {
16788                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
16789                _next_ordinal_to_read += 1;
16790                next_offset += envelope_size;
16791            }
16792
16793            let next_out_of_line = decoder.next_out_of_line();
16794            let handles_before = decoder.remaining_handles();
16795            if let Some((inlined, num_bytes, num_handles)) =
16796                fidl::encoding::decode_envelope_header(decoder, next_offset)?
16797            {
16798                let member_inline_size = <fidl::encoding::Vector<
16799                    fidl::encoding::HandleType<
16800                        fidl::Counter,
16801                        { fidl::ObjectType::COUNTER.into_raw() },
16802                        2147483648,
16803                    >,
16804                    16,
16805                > as fidl::encoding::TypeMarker>::inline_size(
16806                    decoder.context
16807                );
16808                if inlined != (member_inline_size <= 4) {
16809                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
16810                }
16811                let inner_offset;
16812                let mut inner_depth = depth.clone();
16813                if inlined {
16814                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
16815                    inner_offset = next_offset;
16816                } else {
16817                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
16818                    inner_depth.increment()?;
16819                }
16820                let val_ref = self.release_counters.get_or_insert_with(|| {
16821                    fidl::new_empty!(
16822                        fidl::encoding::Vector<
16823                            fidl::encoding::HandleType<
16824                                fidl::Counter,
16825                                { fidl::ObjectType::COUNTER.into_raw() },
16826                                2147483648,
16827                            >,
16828                            16,
16829                        >,
16830                        fidl::encoding::DefaultFuchsiaResourceDialect
16831                    )
16832                });
16833                fidl::decode!(
16834                    fidl::encoding::Vector<
16835                        fidl::encoding::HandleType<
16836                            fidl::Counter,
16837                            { fidl::ObjectType::COUNTER.into_raw() },
16838                            2147483648,
16839                        >,
16840                        16,
16841                    >,
16842                    fidl::encoding::DefaultFuchsiaResourceDialect,
16843                    val_ref,
16844                    decoder,
16845                    inner_offset,
16846                    inner_depth
16847                )?;
16848                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
16849                {
16850                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
16851                }
16852                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
16853                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
16854                }
16855            }
16856
16857            next_offset += envelope_size;
16858
16859            // Decode the remaining unknown envelopes.
16860            while next_offset < end_offset {
16861                _next_ordinal_to_read += 1;
16862                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
16863                next_offset += envelope_size;
16864            }
16865
16866            Ok(())
16867        }
16868    }
16869
16870    impl RegisterBufferCollectionArgs {
16871        #[inline(always)]
16872        fn max_ordinal_present(&self) -> u64 {
16873            if let Some(_) = self.buffer_collection_token2 {
16874                return 5;
16875            }
16876            if let Some(_) = self.usages {
16877                return 4;
16878            }
16879            if let Some(_) = self.usage {
16880                return 3;
16881            }
16882            if let Some(_) = self.buffer_collection_token {
16883                return 2;
16884            }
16885            if let Some(_) = self.export_token {
16886                return 1;
16887            }
16888            0
16889        }
16890    }
16891
16892    impl fidl::encoding::ResourceTypeMarker for RegisterBufferCollectionArgs {
16893        type Borrowed<'a> = &'a mut Self;
16894        fn take_or_borrow<'a>(
16895            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
16896        ) -> Self::Borrowed<'a> {
16897            value
16898        }
16899    }
16900
16901    unsafe impl fidl::encoding::TypeMarker for RegisterBufferCollectionArgs {
16902        type Owned = Self;
16903
16904        #[inline(always)]
16905        fn inline_align(_context: fidl::encoding::Context) -> usize {
16906            8
16907        }
16908
16909        #[inline(always)]
16910        fn inline_size(_context: fidl::encoding::Context) -> usize {
16911            16
16912        }
16913    }
16914
16915    unsafe impl
16916        fidl::encoding::Encode<
16917            RegisterBufferCollectionArgs,
16918            fidl::encoding::DefaultFuchsiaResourceDialect,
16919        > for &mut RegisterBufferCollectionArgs
16920    {
16921        unsafe fn encode(
16922            self,
16923            encoder: &mut fidl::encoding::Encoder<
16924                '_,
16925                fidl::encoding::DefaultFuchsiaResourceDialect,
16926            >,
16927            offset: usize,
16928            mut depth: fidl::encoding::Depth,
16929        ) -> fidl::Result<()> {
16930            encoder.debug_check_bounds::<RegisterBufferCollectionArgs>(offset);
16931            // Vector header
16932            let max_ordinal: u64 = self.max_ordinal_present();
16933            encoder.write_num(max_ordinal, offset);
16934            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
16935            // Calling encoder.out_of_line_offset(0) is not allowed.
16936            if max_ordinal == 0 {
16937                return Ok(());
16938            }
16939            depth.increment()?;
16940            let envelope_size = 8;
16941            let bytes_len = max_ordinal as usize * envelope_size;
16942            #[allow(unused_variables)]
16943            let offset = encoder.out_of_line_offset(bytes_len);
16944            let mut _prev_end_offset: usize = 0;
16945            if 1 > max_ordinal {
16946                return Ok(());
16947            }
16948
16949            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
16950            // are envelope_size bytes.
16951            let cur_offset: usize = (1 - 1) * envelope_size;
16952
16953            // Zero reserved fields.
16954            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
16955
16956            // Safety:
16957            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
16958            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
16959            //   envelope_size bytes, there is always sufficient room.
16960            fidl::encoding::encode_in_envelope_optional::<BufferCollectionExportToken, fidl::encoding::DefaultFuchsiaResourceDialect>(
16961            self.export_token.as_mut().map(<BufferCollectionExportToken as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
16962            encoder, offset + cur_offset, depth
16963        )?;
16964
16965            _prev_end_offset = cur_offset + envelope_size;
16966            if 2 > max_ordinal {
16967                return Ok(());
16968            }
16969
16970            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
16971            // are envelope_size bytes.
16972            let cur_offset: usize = (2 - 1) * envelope_size;
16973
16974            // Zero reserved fields.
16975            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
16976
16977            // Safety:
16978            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
16979            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
16980            //   envelope_size bytes, there is always sufficient room.
16981            fidl::encoding::encode_in_envelope_optional::<
16982                fidl::encoding::Endpoint<
16983                    fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem::BufferCollectionTokenMarker>,
16984                >,
16985                fidl::encoding::DefaultFuchsiaResourceDialect,
16986            >(
16987                self.buffer_collection_token.as_mut().map(
16988                    <fidl::encoding::Endpoint<
16989                        fidl::endpoints::ClientEnd<
16990                            fidl_fuchsia_sysmem::BufferCollectionTokenMarker,
16991                        >,
16992                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
16993                ),
16994                encoder,
16995                offset + cur_offset,
16996                depth,
16997            )?;
16998
16999            _prev_end_offset = cur_offset + envelope_size;
17000            if 3 > max_ordinal {
17001                return Ok(());
17002            }
17003
17004            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
17005            // are envelope_size bytes.
17006            let cur_offset: usize = (3 - 1) * envelope_size;
17007
17008            // Zero reserved fields.
17009            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
17010
17011            // Safety:
17012            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
17013            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
17014            //   envelope_size bytes, there is always sufficient room.
17015            fidl::encoding::encode_in_envelope_optional::<
17016                RegisterBufferCollectionUsage,
17017                fidl::encoding::DefaultFuchsiaResourceDialect,
17018            >(
17019                self.usage.as_ref().map(
17020                    <RegisterBufferCollectionUsage as fidl::encoding::ValueTypeMarker>::borrow,
17021                ),
17022                encoder,
17023                offset + cur_offset,
17024                depth,
17025            )?;
17026
17027            _prev_end_offset = cur_offset + envelope_size;
17028            if 4 > max_ordinal {
17029                return Ok(());
17030            }
17031
17032            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
17033            // are envelope_size bytes.
17034            let cur_offset: usize = (4 - 1) * envelope_size;
17035
17036            // Zero reserved fields.
17037            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
17038
17039            // Safety:
17040            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
17041            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
17042            //   envelope_size bytes, there is always sufficient room.
17043            fidl::encoding::encode_in_envelope_optional::<
17044                RegisterBufferCollectionUsages,
17045                fidl::encoding::DefaultFuchsiaResourceDialect,
17046            >(
17047                self.usages.as_ref().map(
17048                    <RegisterBufferCollectionUsages as fidl::encoding::ValueTypeMarker>::borrow,
17049                ),
17050                encoder,
17051                offset + cur_offset,
17052                depth,
17053            )?;
17054
17055            _prev_end_offset = cur_offset + envelope_size;
17056            if 5 > max_ordinal {
17057                return Ok(());
17058            }
17059
17060            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
17061            // are envelope_size bytes.
17062            let cur_offset: usize = (5 - 1) * envelope_size;
17063
17064            // Zero reserved fields.
17065            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
17066
17067            // Safety:
17068            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
17069            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
17070            //   envelope_size bytes, there is always sufficient room.
17071            fidl::encoding::encode_in_envelope_optional::<
17072                fidl::encoding::Endpoint<
17073                    fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem2::BufferCollectionTokenMarker>,
17074                >,
17075                fidl::encoding::DefaultFuchsiaResourceDialect,
17076            >(
17077                self.buffer_collection_token2.as_mut().map(
17078                    <fidl::encoding::Endpoint<
17079                        fidl::endpoints::ClientEnd<
17080                            fidl_fuchsia_sysmem2::BufferCollectionTokenMarker,
17081                        >,
17082                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
17083                ),
17084                encoder,
17085                offset + cur_offset,
17086                depth,
17087            )?;
17088
17089            _prev_end_offset = cur_offset + envelope_size;
17090
17091            Ok(())
17092        }
17093    }
17094
17095    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
17096        for RegisterBufferCollectionArgs
17097    {
17098        #[inline(always)]
17099        fn new_empty() -> Self {
17100            Self::default()
17101        }
17102
17103        unsafe fn decode(
17104            &mut self,
17105            decoder: &mut fidl::encoding::Decoder<
17106                '_,
17107                fidl::encoding::DefaultFuchsiaResourceDialect,
17108            >,
17109            offset: usize,
17110            mut depth: fidl::encoding::Depth,
17111        ) -> fidl::Result<()> {
17112            decoder.debug_check_bounds::<Self>(offset);
17113            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
17114                None => return Err(fidl::Error::NotNullable),
17115                Some(len) => len,
17116            };
17117            // Calling decoder.out_of_line_offset(0) is not allowed.
17118            if len == 0 {
17119                return Ok(());
17120            };
17121            depth.increment()?;
17122            let envelope_size = 8;
17123            let bytes_len = len * envelope_size;
17124            let offset = decoder.out_of_line_offset(bytes_len)?;
17125            // Decode the envelope for each type.
17126            let mut _next_ordinal_to_read = 0;
17127            let mut next_offset = offset;
17128            let end_offset = offset + bytes_len;
17129            _next_ordinal_to_read += 1;
17130            if next_offset >= end_offset {
17131                return Ok(());
17132            }
17133
17134            // Decode unknown envelopes for gaps in ordinals.
17135            while _next_ordinal_to_read < 1 {
17136                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
17137                _next_ordinal_to_read += 1;
17138                next_offset += envelope_size;
17139            }
17140
17141            let next_out_of_line = decoder.next_out_of_line();
17142            let handles_before = decoder.remaining_handles();
17143            if let Some((inlined, num_bytes, num_handles)) =
17144                fidl::encoding::decode_envelope_header(decoder, next_offset)?
17145            {
17146                let member_inline_size =
17147                    <BufferCollectionExportToken as fidl::encoding::TypeMarker>::inline_size(
17148                        decoder.context,
17149                    );
17150                if inlined != (member_inline_size <= 4) {
17151                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
17152                }
17153                let inner_offset;
17154                let mut inner_depth = depth.clone();
17155                if inlined {
17156                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
17157                    inner_offset = next_offset;
17158                } else {
17159                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
17160                    inner_depth.increment()?;
17161                }
17162                let val_ref = self.export_token.get_or_insert_with(|| {
17163                    fidl::new_empty!(
17164                        BufferCollectionExportToken,
17165                        fidl::encoding::DefaultFuchsiaResourceDialect
17166                    )
17167                });
17168                fidl::decode!(
17169                    BufferCollectionExportToken,
17170                    fidl::encoding::DefaultFuchsiaResourceDialect,
17171                    val_ref,
17172                    decoder,
17173                    inner_offset,
17174                    inner_depth
17175                )?;
17176                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
17177                {
17178                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
17179                }
17180                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
17181                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
17182                }
17183            }
17184
17185            next_offset += envelope_size;
17186            _next_ordinal_to_read += 1;
17187            if next_offset >= end_offset {
17188                return Ok(());
17189            }
17190
17191            // Decode unknown envelopes for gaps in ordinals.
17192            while _next_ordinal_to_read < 2 {
17193                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
17194                _next_ordinal_to_read += 1;
17195                next_offset += envelope_size;
17196            }
17197
17198            let next_out_of_line = decoder.next_out_of_line();
17199            let handles_before = decoder.remaining_handles();
17200            if let Some((inlined, num_bytes, num_handles)) =
17201                fidl::encoding::decode_envelope_header(decoder, next_offset)?
17202            {
17203                let member_inline_size = <fidl::encoding::Endpoint<
17204                    fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem::BufferCollectionTokenMarker>,
17205                > as fidl::encoding::TypeMarker>::inline_size(
17206                    decoder.context
17207                );
17208                if inlined != (member_inline_size <= 4) {
17209                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
17210                }
17211                let inner_offset;
17212                let mut inner_depth = depth.clone();
17213                if inlined {
17214                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
17215                    inner_offset = next_offset;
17216                } else {
17217                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
17218                    inner_depth.increment()?;
17219                }
17220                let val_ref = self.buffer_collection_token.get_or_insert_with(|| {
17221                    fidl::new_empty!(
17222                        fidl::encoding::Endpoint<
17223                            fidl::endpoints::ClientEnd<
17224                                fidl_fuchsia_sysmem::BufferCollectionTokenMarker,
17225                            >,
17226                        >,
17227                        fidl::encoding::DefaultFuchsiaResourceDialect
17228                    )
17229                });
17230                fidl::decode!(
17231                    fidl::encoding::Endpoint<
17232                        fidl::endpoints::ClientEnd<
17233                            fidl_fuchsia_sysmem::BufferCollectionTokenMarker,
17234                        >,
17235                    >,
17236                    fidl::encoding::DefaultFuchsiaResourceDialect,
17237                    val_ref,
17238                    decoder,
17239                    inner_offset,
17240                    inner_depth
17241                )?;
17242                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
17243                {
17244                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
17245                }
17246                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
17247                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
17248                }
17249            }
17250
17251            next_offset += envelope_size;
17252            _next_ordinal_to_read += 1;
17253            if next_offset >= end_offset {
17254                return Ok(());
17255            }
17256
17257            // Decode unknown envelopes for gaps in ordinals.
17258            while _next_ordinal_to_read < 3 {
17259                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
17260                _next_ordinal_to_read += 1;
17261                next_offset += envelope_size;
17262            }
17263
17264            let next_out_of_line = decoder.next_out_of_line();
17265            let handles_before = decoder.remaining_handles();
17266            if let Some((inlined, num_bytes, num_handles)) =
17267                fidl::encoding::decode_envelope_header(decoder, next_offset)?
17268            {
17269                let member_inline_size =
17270                    <RegisterBufferCollectionUsage as fidl::encoding::TypeMarker>::inline_size(
17271                        decoder.context,
17272                    );
17273                if inlined != (member_inline_size <= 4) {
17274                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
17275                }
17276                let inner_offset;
17277                let mut inner_depth = depth.clone();
17278                if inlined {
17279                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
17280                    inner_offset = next_offset;
17281                } else {
17282                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
17283                    inner_depth.increment()?;
17284                }
17285                let val_ref = self.usage.get_or_insert_with(|| {
17286                    fidl::new_empty!(
17287                        RegisterBufferCollectionUsage,
17288                        fidl::encoding::DefaultFuchsiaResourceDialect
17289                    )
17290                });
17291                fidl::decode!(
17292                    RegisterBufferCollectionUsage,
17293                    fidl::encoding::DefaultFuchsiaResourceDialect,
17294                    val_ref,
17295                    decoder,
17296                    inner_offset,
17297                    inner_depth
17298                )?;
17299                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
17300                {
17301                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
17302                }
17303                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
17304                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
17305                }
17306            }
17307
17308            next_offset += envelope_size;
17309            _next_ordinal_to_read += 1;
17310            if next_offset >= end_offset {
17311                return Ok(());
17312            }
17313
17314            // Decode unknown envelopes for gaps in ordinals.
17315            while _next_ordinal_to_read < 4 {
17316                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
17317                _next_ordinal_to_read += 1;
17318                next_offset += envelope_size;
17319            }
17320
17321            let next_out_of_line = decoder.next_out_of_line();
17322            let handles_before = decoder.remaining_handles();
17323            if let Some((inlined, num_bytes, num_handles)) =
17324                fidl::encoding::decode_envelope_header(decoder, next_offset)?
17325            {
17326                let member_inline_size =
17327                    <RegisterBufferCollectionUsages as fidl::encoding::TypeMarker>::inline_size(
17328                        decoder.context,
17329                    );
17330                if inlined != (member_inline_size <= 4) {
17331                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
17332                }
17333                let inner_offset;
17334                let mut inner_depth = depth.clone();
17335                if inlined {
17336                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
17337                    inner_offset = next_offset;
17338                } else {
17339                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
17340                    inner_depth.increment()?;
17341                }
17342                let val_ref = self.usages.get_or_insert_with(|| {
17343                    fidl::new_empty!(
17344                        RegisterBufferCollectionUsages,
17345                        fidl::encoding::DefaultFuchsiaResourceDialect
17346                    )
17347                });
17348                fidl::decode!(
17349                    RegisterBufferCollectionUsages,
17350                    fidl::encoding::DefaultFuchsiaResourceDialect,
17351                    val_ref,
17352                    decoder,
17353                    inner_offset,
17354                    inner_depth
17355                )?;
17356                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
17357                {
17358                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
17359                }
17360                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
17361                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
17362                }
17363            }
17364
17365            next_offset += envelope_size;
17366            _next_ordinal_to_read += 1;
17367            if next_offset >= end_offset {
17368                return Ok(());
17369            }
17370
17371            // Decode unknown envelopes for gaps in ordinals.
17372            while _next_ordinal_to_read < 5 {
17373                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
17374                _next_ordinal_to_read += 1;
17375                next_offset += envelope_size;
17376            }
17377
17378            let next_out_of_line = decoder.next_out_of_line();
17379            let handles_before = decoder.remaining_handles();
17380            if let Some((inlined, num_bytes, num_handles)) =
17381                fidl::encoding::decode_envelope_header(decoder, next_offset)?
17382            {
17383                let member_inline_size = <fidl::encoding::Endpoint<
17384                    fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem2::BufferCollectionTokenMarker>,
17385                > as fidl::encoding::TypeMarker>::inline_size(
17386                    decoder.context
17387                );
17388                if inlined != (member_inline_size <= 4) {
17389                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
17390                }
17391                let inner_offset;
17392                let mut inner_depth = depth.clone();
17393                if inlined {
17394                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
17395                    inner_offset = next_offset;
17396                } else {
17397                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
17398                    inner_depth.increment()?;
17399                }
17400                let val_ref = self.buffer_collection_token2.get_or_insert_with(|| {
17401                    fidl::new_empty!(
17402                        fidl::encoding::Endpoint<
17403                            fidl::endpoints::ClientEnd<
17404                                fidl_fuchsia_sysmem2::BufferCollectionTokenMarker,
17405                            >,
17406                        >,
17407                        fidl::encoding::DefaultFuchsiaResourceDialect
17408                    )
17409                });
17410                fidl::decode!(
17411                    fidl::encoding::Endpoint<
17412                        fidl::endpoints::ClientEnd<
17413                            fidl_fuchsia_sysmem2::BufferCollectionTokenMarker,
17414                        >,
17415                    >,
17416                    fidl::encoding::DefaultFuchsiaResourceDialect,
17417                    val_ref,
17418                    decoder,
17419                    inner_offset,
17420                    inner_depth
17421                )?;
17422                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
17423                {
17424                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
17425                }
17426                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
17427                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
17428                }
17429            }
17430
17431            next_offset += envelope_size;
17432
17433            // Decode the remaining unknown envelopes.
17434            while next_offset < end_offset {
17435                _next_ordinal_to_read += 1;
17436                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
17437                next_offset += envelope_size;
17438            }
17439
17440            Ok(())
17441        }
17442    }
17443
17444    impl ScreenCaptureConfig {
17445        #[inline(always)]
17446        fn max_ordinal_present(&self) -> u64 {
17447            if let Some(_) = self.rotation {
17448                return 4;
17449            }
17450            if let Some(_) = self.buffer_count {
17451                return 3;
17452            }
17453            if let Some(_) = self.size {
17454                return 2;
17455            }
17456            if let Some(_) = self.import_token {
17457                return 1;
17458            }
17459            0
17460        }
17461    }
17462
17463    impl fidl::encoding::ResourceTypeMarker for ScreenCaptureConfig {
17464        type Borrowed<'a> = &'a mut Self;
17465        fn take_or_borrow<'a>(
17466            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
17467        ) -> Self::Borrowed<'a> {
17468            value
17469        }
17470    }
17471
17472    unsafe impl fidl::encoding::TypeMarker for ScreenCaptureConfig {
17473        type Owned = Self;
17474
17475        #[inline(always)]
17476        fn inline_align(_context: fidl::encoding::Context) -> usize {
17477            8
17478        }
17479
17480        #[inline(always)]
17481        fn inline_size(_context: fidl::encoding::Context) -> usize {
17482            16
17483        }
17484    }
17485
17486    unsafe impl
17487        fidl::encoding::Encode<ScreenCaptureConfig, fidl::encoding::DefaultFuchsiaResourceDialect>
17488        for &mut ScreenCaptureConfig
17489    {
17490        unsafe fn encode(
17491            self,
17492            encoder: &mut fidl::encoding::Encoder<
17493                '_,
17494                fidl::encoding::DefaultFuchsiaResourceDialect,
17495            >,
17496            offset: usize,
17497            mut depth: fidl::encoding::Depth,
17498        ) -> fidl::Result<()> {
17499            encoder.debug_check_bounds::<ScreenCaptureConfig>(offset);
17500            // Vector header
17501            let max_ordinal: u64 = self.max_ordinal_present();
17502            encoder.write_num(max_ordinal, offset);
17503            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
17504            // Calling encoder.out_of_line_offset(0) is not allowed.
17505            if max_ordinal == 0 {
17506                return Ok(());
17507            }
17508            depth.increment()?;
17509            let envelope_size = 8;
17510            let bytes_len = max_ordinal as usize * envelope_size;
17511            #[allow(unused_variables)]
17512            let offset = encoder.out_of_line_offset(bytes_len);
17513            let mut _prev_end_offset: usize = 0;
17514            if 1 > max_ordinal {
17515                return Ok(());
17516            }
17517
17518            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
17519            // are envelope_size bytes.
17520            let cur_offset: usize = (1 - 1) * envelope_size;
17521
17522            // Zero reserved fields.
17523            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
17524
17525            // Safety:
17526            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
17527            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
17528            //   envelope_size bytes, there is always sufficient room.
17529            fidl::encoding::encode_in_envelope_optional::<BufferCollectionImportToken, fidl::encoding::DefaultFuchsiaResourceDialect>(
17530            self.import_token.as_mut().map(<BufferCollectionImportToken as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
17531            encoder, offset + cur_offset, depth
17532        )?;
17533
17534            _prev_end_offset = cur_offset + envelope_size;
17535            if 2 > max_ordinal {
17536                return Ok(());
17537            }
17538
17539            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
17540            // are envelope_size bytes.
17541            let cur_offset: usize = (2 - 1) * envelope_size;
17542
17543            // Zero reserved fields.
17544            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
17545
17546            // Safety:
17547            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
17548            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
17549            //   envelope_size bytes, there is always sufficient room.
17550            fidl::encoding::encode_in_envelope_optional::<
17551                fidl_fuchsia_math::SizeU,
17552                fidl::encoding::DefaultFuchsiaResourceDialect,
17553            >(
17554                self.size
17555                    .as_ref()
17556                    .map(<fidl_fuchsia_math::SizeU as fidl::encoding::ValueTypeMarker>::borrow),
17557                encoder,
17558                offset + cur_offset,
17559                depth,
17560            )?;
17561
17562            _prev_end_offset = cur_offset + envelope_size;
17563            if 3 > max_ordinal {
17564                return Ok(());
17565            }
17566
17567            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
17568            // are envelope_size bytes.
17569            let cur_offset: usize = (3 - 1) * envelope_size;
17570
17571            // Zero reserved fields.
17572            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
17573
17574            // Safety:
17575            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
17576            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
17577            //   envelope_size bytes, there is always sufficient room.
17578            fidl::encoding::encode_in_envelope_optional::<
17579                u32,
17580                fidl::encoding::DefaultFuchsiaResourceDialect,
17581            >(
17582                self.buffer_count.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
17583                encoder,
17584                offset + cur_offset,
17585                depth,
17586            )?;
17587
17588            _prev_end_offset = cur_offset + envelope_size;
17589            if 4 > max_ordinal {
17590                return Ok(());
17591            }
17592
17593            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
17594            // are envelope_size bytes.
17595            let cur_offset: usize = (4 - 1) * envelope_size;
17596
17597            // Zero reserved fields.
17598            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
17599
17600            // Safety:
17601            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
17602            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
17603            //   envelope_size bytes, there is always sufficient room.
17604            fidl::encoding::encode_in_envelope_optional::<
17605                Rotation,
17606                fidl::encoding::DefaultFuchsiaResourceDialect,
17607            >(
17608                self.rotation.as_ref().map(<Rotation as fidl::encoding::ValueTypeMarker>::borrow),
17609                encoder,
17610                offset + cur_offset,
17611                depth,
17612            )?;
17613
17614            _prev_end_offset = cur_offset + envelope_size;
17615
17616            Ok(())
17617        }
17618    }
17619
17620    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
17621        for ScreenCaptureConfig
17622    {
17623        #[inline(always)]
17624        fn new_empty() -> Self {
17625            Self::default()
17626        }
17627
17628        unsafe fn decode(
17629            &mut self,
17630            decoder: &mut fidl::encoding::Decoder<
17631                '_,
17632                fidl::encoding::DefaultFuchsiaResourceDialect,
17633            >,
17634            offset: usize,
17635            mut depth: fidl::encoding::Depth,
17636        ) -> fidl::Result<()> {
17637            decoder.debug_check_bounds::<Self>(offset);
17638            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
17639                None => return Err(fidl::Error::NotNullable),
17640                Some(len) => len,
17641            };
17642            // Calling decoder.out_of_line_offset(0) is not allowed.
17643            if len == 0 {
17644                return Ok(());
17645            };
17646            depth.increment()?;
17647            let envelope_size = 8;
17648            let bytes_len = len * envelope_size;
17649            let offset = decoder.out_of_line_offset(bytes_len)?;
17650            // Decode the envelope for each type.
17651            let mut _next_ordinal_to_read = 0;
17652            let mut next_offset = offset;
17653            let end_offset = offset + bytes_len;
17654            _next_ordinal_to_read += 1;
17655            if next_offset >= end_offset {
17656                return Ok(());
17657            }
17658
17659            // Decode unknown envelopes for gaps in ordinals.
17660            while _next_ordinal_to_read < 1 {
17661                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
17662                _next_ordinal_to_read += 1;
17663                next_offset += envelope_size;
17664            }
17665
17666            let next_out_of_line = decoder.next_out_of_line();
17667            let handles_before = decoder.remaining_handles();
17668            if let Some((inlined, num_bytes, num_handles)) =
17669                fidl::encoding::decode_envelope_header(decoder, next_offset)?
17670            {
17671                let member_inline_size =
17672                    <BufferCollectionImportToken as fidl::encoding::TypeMarker>::inline_size(
17673                        decoder.context,
17674                    );
17675                if inlined != (member_inline_size <= 4) {
17676                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
17677                }
17678                let inner_offset;
17679                let mut inner_depth = depth.clone();
17680                if inlined {
17681                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
17682                    inner_offset = next_offset;
17683                } else {
17684                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
17685                    inner_depth.increment()?;
17686                }
17687                let val_ref = self.import_token.get_or_insert_with(|| {
17688                    fidl::new_empty!(
17689                        BufferCollectionImportToken,
17690                        fidl::encoding::DefaultFuchsiaResourceDialect
17691                    )
17692                });
17693                fidl::decode!(
17694                    BufferCollectionImportToken,
17695                    fidl::encoding::DefaultFuchsiaResourceDialect,
17696                    val_ref,
17697                    decoder,
17698                    inner_offset,
17699                    inner_depth
17700                )?;
17701                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
17702                {
17703                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
17704                }
17705                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
17706                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
17707                }
17708            }
17709
17710            next_offset += envelope_size;
17711            _next_ordinal_to_read += 1;
17712            if next_offset >= end_offset {
17713                return Ok(());
17714            }
17715
17716            // Decode unknown envelopes for gaps in ordinals.
17717            while _next_ordinal_to_read < 2 {
17718                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
17719                _next_ordinal_to_read += 1;
17720                next_offset += envelope_size;
17721            }
17722
17723            let next_out_of_line = decoder.next_out_of_line();
17724            let handles_before = decoder.remaining_handles();
17725            if let Some((inlined, num_bytes, num_handles)) =
17726                fidl::encoding::decode_envelope_header(decoder, next_offset)?
17727            {
17728                let member_inline_size =
17729                    <fidl_fuchsia_math::SizeU as fidl::encoding::TypeMarker>::inline_size(
17730                        decoder.context,
17731                    );
17732                if inlined != (member_inline_size <= 4) {
17733                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
17734                }
17735                let inner_offset;
17736                let mut inner_depth = depth.clone();
17737                if inlined {
17738                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
17739                    inner_offset = next_offset;
17740                } else {
17741                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
17742                    inner_depth.increment()?;
17743                }
17744                let val_ref = self.size.get_or_insert_with(|| {
17745                    fidl::new_empty!(
17746                        fidl_fuchsia_math::SizeU,
17747                        fidl::encoding::DefaultFuchsiaResourceDialect
17748                    )
17749                });
17750                fidl::decode!(
17751                    fidl_fuchsia_math::SizeU,
17752                    fidl::encoding::DefaultFuchsiaResourceDialect,
17753                    val_ref,
17754                    decoder,
17755                    inner_offset,
17756                    inner_depth
17757                )?;
17758                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
17759                {
17760                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
17761                }
17762                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
17763                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
17764                }
17765            }
17766
17767            next_offset += envelope_size;
17768            _next_ordinal_to_read += 1;
17769            if next_offset >= end_offset {
17770                return Ok(());
17771            }
17772
17773            // Decode unknown envelopes for gaps in ordinals.
17774            while _next_ordinal_to_read < 3 {
17775                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
17776                _next_ordinal_to_read += 1;
17777                next_offset += envelope_size;
17778            }
17779
17780            let next_out_of_line = decoder.next_out_of_line();
17781            let handles_before = decoder.remaining_handles();
17782            if let Some((inlined, num_bytes, num_handles)) =
17783                fidl::encoding::decode_envelope_header(decoder, next_offset)?
17784            {
17785                let member_inline_size =
17786                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
17787                if inlined != (member_inline_size <= 4) {
17788                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
17789                }
17790                let inner_offset;
17791                let mut inner_depth = depth.clone();
17792                if inlined {
17793                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
17794                    inner_offset = next_offset;
17795                } else {
17796                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
17797                    inner_depth.increment()?;
17798                }
17799                let val_ref = self.buffer_count.get_or_insert_with(|| {
17800                    fidl::new_empty!(u32, fidl::encoding::DefaultFuchsiaResourceDialect)
17801                });
17802                fidl::decode!(
17803                    u32,
17804                    fidl::encoding::DefaultFuchsiaResourceDialect,
17805                    val_ref,
17806                    decoder,
17807                    inner_offset,
17808                    inner_depth
17809                )?;
17810                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
17811                {
17812                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
17813                }
17814                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
17815                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
17816                }
17817            }
17818
17819            next_offset += envelope_size;
17820            _next_ordinal_to_read += 1;
17821            if next_offset >= end_offset {
17822                return Ok(());
17823            }
17824
17825            // Decode unknown envelopes for gaps in ordinals.
17826            while _next_ordinal_to_read < 4 {
17827                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
17828                _next_ordinal_to_read += 1;
17829                next_offset += envelope_size;
17830            }
17831
17832            let next_out_of_line = decoder.next_out_of_line();
17833            let handles_before = decoder.remaining_handles();
17834            if let Some((inlined, num_bytes, num_handles)) =
17835                fidl::encoding::decode_envelope_header(decoder, next_offset)?
17836            {
17837                let member_inline_size =
17838                    <Rotation as fidl::encoding::TypeMarker>::inline_size(decoder.context);
17839                if inlined != (member_inline_size <= 4) {
17840                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
17841                }
17842                let inner_offset;
17843                let mut inner_depth = depth.clone();
17844                if inlined {
17845                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
17846                    inner_offset = next_offset;
17847                } else {
17848                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
17849                    inner_depth.increment()?;
17850                }
17851                let val_ref = self.rotation.get_or_insert_with(|| {
17852                    fidl::new_empty!(Rotation, fidl::encoding::DefaultFuchsiaResourceDialect)
17853                });
17854                fidl::decode!(
17855                    Rotation,
17856                    fidl::encoding::DefaultFuchsiaResourceDialect,
17857                    val_ref,
17858                    decoder,
17859                    inner_offset,
17860                    inner_depth
17861                )?;
17862                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
17863                {
17864                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
17865                }
17866                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
17867                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
17868                }
17869            }
17870
17871            next_offset += envelope_size;
17872
17873            // Decode the remaining unknown envelopes.
17874            while next_offset < end_offset {
17875                _next_ordinal_to_read += 1;
17876                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
17877                next_offset += envelope_size;
17878            }
17879
17880            Ok(())
17881        }
17882    }
17883
17884    impl ScreenshotTakeFileRequest {
17885        #[inline(always)]
17886        fn max_ordinal_present(&self) -> u64 {
17887            if let Some(_) = self.format {
17888                return 1;
17889            }
17890            0
17891        }
17892    }
17893
17894    impl fidl::encoding::ResourceTypeMarker for ScreenshotTakeFileRequest {
17895        type Borrowed<'a> = &'a mut Self;
17896        fn take_or_borrow<'a>(
17897            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
17898        ) -> Self::Borrowed<'a> {
17899            value
17900        }
17901    }
17902
17903    unsafe impl fidl::encoding::TypeMarker for ScreenshotTakeFileRequest {
17904        type Owned = Self;
17905
17906        #[inline(always)]
17907        fn inline_align(_context: fidl::encoding::Context) -> usize {
17908            8
17909        }
17910
17911        #[inline(always)]
17912        fn inline_size(_context: fidl::encoding::Context) -> usize {
17913            16
17914        }
17915    }
17916
17917    unsafe impl
17918        fidl::encoding::Encode<
17919            ScreenshotTakeFileRequest,
17920            fidl::encoding::DefaultFuchsiaResourceDialect,
17921        > for &mut ScreenshotTakeFileRequest
17922    {
17923        unsafe fn encode(
17924            self,
17925            encoder: &mut fidl::encoding::Encoder<
17926                '_,
17927                fidl::encoding::DefaultFuchsiaResourceDialect,
17928            >,
17929            offset: usize,
17930            mut depth: fidl::encoding::Depth,
17931        ) -> fidl::Result<()> {
17932            encoder.debug_check_bounds::<ScreenshotTakeFileRequest>(offset);
17933            // Vector header
17934            let max_ordinal: u64 = self.max_ordinal_present();
17935            encoder.write_num(max_ordinal, offset);
17936            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
17937            // Calling encoder.out_of_line_offset(0) is not allowed.
17938            if max_ordinal == 0 {
17939                return Ok(());
17940            }
17941            depth.increment()?;
17942            let envelope_size = 8;
17943            let bytes_len = max_ordinal as usize * envelope_size;
17944            #[allow(unused_variables)]
17945            let offset = encoder.out_of_line_offset(bytes_len);
17946            let mut _prev_end_offset: usize = 0;
17947            if 1 > max_ordinal {
17948                return Ok(());
17949            }
17950
17951            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
17952            // are envelope_size bytes.
17953            let cur_offset: usize = (1 - 1) * envelope_size;
17954
17955            // Zero reserved fields.
17956            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
17957
17958            // Safety:
17959            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
17960            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
17961            //   envelope_size bytes, there is always sufficient room.
17962            fidl::encoding::encode_in_envelope_optional::<
17963                ScreenshotFormat,
17964                fidl::encoding::DefaultFuchsiaResourceDialect,
17965            >(
17966                self.format
17967                    .as_ref()
17968                    .map(<ScreenshotFormat as fidl::encoding::ValueTypeMarker>::borrow),
17969                encoder,
17970                offset + cur_offset,
17971                depth,
17972            )?;
17973
17974            _prev_end_offset = cur_offset + envelope_size;
17975
17976            Ok(())
17977        }
17978    }
17979
17980    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
17981        for ScreenshotTakeFileRequest
17982    {
17983        #[inline(always)]
17984        fn new_empty() -> Self {
17985            Self::default()
17986        }
17987
17988        unsafe fn decode(
17989            &mut self,
17990            decoder: &mut fidl::encoding::Decoder<
17991                '_,
17992                fidl::encoding::DefaultFuchsiaResourceDialect,
17993            >,
17994            offset: usize,
17995            mut depth: fidl::encoding::Depth,
17996        ) -> fidl::Result<()> {
17997            decoder.debug_check_bounds::<Self>(offset);
17998            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
17999                None => return Err(fidl::Error::NotNullable),
18000                Some(len) => len,
18001            };
18002            // Calling decoder.out_of_line_offset(0) is not allowed.
18003            if len == 0 {
18004                return Ok(());
18005            };
18006            depth.increment()?;
18007            let envelope_size = 8;
18008            let bytes_len = len * envelope_size;
18009            let offset = decoder.out_of_line_offset(bytes_len)?;
18010            // Decode the envelope for each type.
18011            let mut _next_ordinal_to_read = 0;
18012            let mut next_offset = offset;
18013            let end_offset = offset + bytes_len;
18014            _next_ordinal_to_read += 1;
18015            if next_offset >= end_offset {
18016                return Ok(());
18017            }
18018
18019            // Decode unknown envelopes for gaps in ordinals.
18020            while _next_ordinal_to_read < 1 {
18021                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
18022                _next_ordinal_to_read += 1;
18023                next_offset += envelope_size;
18024            }
18025
18026            let next_out_of_line = decoder.next_out_of_line();
18027            let handles_before = decoder.remaining_handles();
18028            if let Some((inlined, num_bytes, num_handles)) =
18029                fidl::encoding::decode_envelope_header(decoder, next_offset)?
18030            {
18031                let member_inline_size =
18032                    <ScreenshotFormat as fidl::encoding::TypeMarker>::inline_size(decoder.context);
18033                if inlined != (member_inline_size <= 4) {
18034                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
18035                }
18036                let inner_offset;
18037                let mut inner_depth = depth.clone();
18038                if inlined {
18039                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
18040                    inner_offset = next_offset;
18041                } else {
18042                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
18043                    inner_depth.increment()?;
18044                }
18045                let val_ref = self.format.get_or_insert_with(|| {
18046                    fidl::new_empty!(
18047                        ScreenshotFormat,
18048                        fidl::encoding::DefaultFuchsiaResourceDialect
18049                    )
18050                });
18051                fidl::decode!(
18052                    ScreenshotFormat,
18053                    fidl::encoding::DefaultFuchsiaResourceDialect,
18054                    val_ref,
18055                    decoder,
18056                    inner_offset,
18057                    inner_depth
18058                )?;
18059                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
18060                {
18061                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
18062                }
18063                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
18064                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
18065                }
18066            }
18067
18068            next_offset += envelope_size;
18069
18070            // Decode the remaining unknown envelopes.
18071            while next_offset < end_offset {
18072                _next_ordinal_to_read += 1;
18073                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
18074                next_offset += envelope_size;
18075            }
18076
18077            Ok(())
18078        }
18079    }
18080
18081    impl ScreenshotTakeFileResponse {
18082        #[inline(always)]
18083        fn max_ordinal_present(&self) -> u64 {
18084            if let Some(_) = self.size {
18085                return 2;
18086            }
18087            if let Some(_) = self.file {
18088                return 1;
18089            }
18090            0
18091        }
18092    }
18093
18094    impl fidl::encoding::ResourceTypeMarker for ScreenshotTakeFileResponse {
18095        type Borrowed<'a> = &'a mut Self;
18096        fn take_or_borrow<'a>(
18097            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
18098        ) -> Self::Borrowed<'a> {
18099            value
18100        }
18101    }
18102
18103    unsafe impl fidl::encoding::TypeMarker for ScreenshotTakeFileResponse {
18104        type Owned = Self;
18105
18106        #[inline(always)]
18107        fn inline_align(_context: fidl::encoding::Context) -> usize {
18108            8
18109        }
18110
18111        #[inline(always)]
18112        fn inline_size(_context: fidl::encoding::Context) -> usize {
18113            16
18114        }
18115    }
18116
18117    unsafe impl
18118        fidl::encoding::Encode<
18119            ScreenshotTakeFileResponse,
18120            fidl::encoding::DefaultFuchsiaResourceDialect,
18121        > for &mut ScreenshotTakeFileResponse
18122    {
18123        unsafe fn encode(
18124            self,
18125            encoder: &mut fidl::encoding::Encoder<
18126                '_,
18127                fidl::encoding::DefaultFuchsiaResourceDialect,
18128            >,
18129            offset: usize,
18130            mut depth: fidl::encoding::Depth,
18131        ) -> fidl::Result<()> {
18132            encoder.debug_check_bounds::<ScreenshotTakeFileResponse>(offset);
18133            // Vector header
18134            let max_ordinal: u64 = self.max_ordinal_present();
18135            encoder.write_num(max_ordinal, offset);
18136            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
18137            // Calling encoder.out_of_line_offset(0) is not allowed.
18138            if max_ordinal == 0 {
18139                return Ok(());
18140            }
18141            depth.increment()?;
18142            let envelope_size = 8;
18143            let bytes_len = max_ordinal as usize * envelope_size;
18144            #[allow(unused_variables)]
18145            let offset = encoder.out_of_line_offset(bytes_len);
18146            let mut _prev_end_offset: usize = 0;
18147            if 1 > max_ordinal {
18148                return Ok(());
18149            }
18150
18151            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
18152            // are envelope_size bytes.
18153            let cur_offset: usize = (1 - 1) * envelope_size;
18154
18155            // Zero reserved fields.
18156            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
18157
18158            // Safety:
18159            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
18160            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
18161            //   envelope_size bytes, there is always sufficient room.
18162            fidl::encoding::encode_in_envelope_optional::<
18163                fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>>,
18164                fidl::encoding::DefaultFuchsiaResourceDialect,
18165            >(
18166                self.file.as_mut().map(
18167                    <fidl::encoding::Endpoint<
18168                        fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
18169                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
18170                ),
18171                encoder,
18172                offset + cur_offset,
18173                depth,
18174            )?;
18175
18176            _prev_end_offset = cur_offset + envelope_size;
18177            if 2 > max_ordinal {
18178                return Ok(());
18179            }
18180
18181            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
18182            // are envelope_size bytes.
18183            let cur_offset: usize = (2 - 1) * envelope_size;
18184
18185            // Zero reserved fields.
18186            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
18187
18188            // Safety:
18189            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
18190            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
18191            //   envelope_size bytes, there is always sufficient room.
18192            fidl::encoding::encode_in_envelope_optional::<
18193                fidl_fuchsia_math::SizeU,
18194                fidl::encoding::DefaultFuchsiaResourceDialect,
18195            >(
18196                self.size
18197                    .as_ref()
18198                    .map(<fidl_fuchsia_math::SizeU as fidl::encoding::ValueTypeMarker>::borrow),
18199                encoder,
18200                offset + cur_offset,
18201                depth,
18202            )?;
18203
18204            _prev_end_offset = cur_offset + envelope_size;
18205
18206            Ok(())
18207        }
18208    }
18209
18210    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
18211        for ScreenshotTakeFileResponse
18212    {
18213        #[inline(always)]
18214        fn new_empty() -> Self {
18215            Self::default()
18216        }
18217
18218        unsafe fn decode(
18219            &mut self,
18220            decoder: &mut fidl::encoding::Decoder<
18221                '_,
18222                fidl::encoding::DefaultFuchsiaResourceDialect,
18223            >,
18224            offset: usize,
18225            mut depth: fidl::encoding::Depth,
18226        ) -> fidl::Result<()> {
18227            decoder.debug_check_bounds::<Self>(offset);
18228            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
18229                None => return Err(fidl::Error::NotNullable),
18230                Some(len) => len,
18231            };
18232            // Calling decoder.out_of_line_offset(0) is not allowed.
18233            if len == 0 {
18234                return Ok(());
18235            };
18236            depth.increment()?;
18237            let envelope_size = 8;
18238            let bytes_len = len * envelope_size;
18239            let offset = decoder.out_of_line_offset(bytes_len)?;
18240            // Decode the envelope for each type.
18241            let mut _next_ordinal_to_read = 0;
18242            let mut next_offset = offset;
18243            let end_offset = offset + bytes_len;
18244            _next_ordinal_to_read += 1;
18245            if next_offset >= end_offset {
18246                return Ok(());
18247            }
18248
18249            // Decode unknown envelopes for gaps in ordinals.
18250            while _next_ordinal_to_read < 1 {
18251                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
18252                _next_ordinal_to_read += 1;
18253                next_offset += envelope_size;
18254            }
18255
18256            let next_out_of_line = decoder.next_out_of_line();
18257            let handles_before = decoder.remaining_handles();
18258            if let Some((inlined, num_bytes, num_handles)) =
18259                fidl::encoding::decode_envelope_header(decoder, next_offset)?
18260            {
18261                let member_inline_size = <fidl::encoding::Endpoint<
18262                    fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
18263                > as fidl::encoding::TypeMarker>::inline_size(
18264                    decoder.context
18265                );
18266                if inlined != (member_inline_size <= 4) {
18267                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
18268                }
18269                let inner_offset;
18270                let mut inner_depth = depth.clone();
18271                if inlined {
18272                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
18273                    inner_offset = next_offset;
18274                } else {
18275                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
18276                    inner_depth.increment()?;
18277                }
18278                let val_ref = self.file.get_or_insert_with(|| {
18279                    fidl::new_empty!(
18280                        fidl::encoding::Endpoint<
18281                            fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
18282                        >,
18283                        fidl::encoding::DefaultFuchsiaResourceDialect
18284                    )
18285                });
18286                fidl::decode!(
18287                    fidl::encoding::Endpoint<
18288                        fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
18289                    >,
18290                    fidl::encoding::DefaultFuchsiaResourceDialect,
18291                    val_ref,
18292                    decoder,
18293                    inner_offset,
18294                    inner_depth
18295                )?;
18296                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
18297                {
18298                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
18299                }
18300                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
18301                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
18302                }
18303            }
18304
18305            next_offset += envelope_size;
18306            _next_ordinal_to_read += 1;
18307            if next_offset >= end_offset {
18308                return Ok(());
18309            }
18310
18311            // Decode unknown envelopes for gaps in ordinals.
18312            while _next_ordinal_to_read < 2 {
18313                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
18314                _next_ordinal_to_read += 1;
18315                next_offset += envelope_size;
18316            }
18317
18318            let next_out_of_line = decoder.next_out_of_line();
18319            let handles_before = decoder.remaining_handles();
18320            if let Some((inlined, num_bytes, num_handles)) =
18321                fidl::encoding::decode_envelope_header(decoder, next_offset)?
18322            {
18323                let member_inline_size =
18324                    <fidl_fuchsia_math::SizeU as fidl::encoding::TypeMarker>::inline_size(
18325                        decoder.context,
18326                    );
18327                if inlined != (member_inline_size <= 4) {
18328                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
18329                }
18330                let inner_offset;
18331                let mut inner_depth = depth.clone();
18332                if inlined {
18333                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
18334                    inner_offset = next_offset;
18335                } else {
18336                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
18337                    inner_depth.increment()?;
18338                }
18339                let val_ref = self.size.get_or_insert_with(|| {
18340                    fidl::new_empty!(
18341                        fidl_fuchsia_math::SizeU,
18342                        fidl::encoding::DefaultFuchsiaResourceDialect
18343                    )
18344                });
18345                fidl::decode!(
18346                    fidl_fuchsia_math::SizeU,
18347                    fidl::encoding::DefaultFuchsiaResourceDialect,
18348                    val_ref,
18349                    decoder,
18350                    inner_offset,
18351                    inner_depth
18352                )?;
18353                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
18354                {
18355                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
18356                }
18357                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
18358                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
18359                }
18360            }
18361
18362            next_offset += envelope_size;
18363
18364            // Decode the remaining unknown envelopes.
18365            while next_offset < end_offset {
18366                _next_ordinal_to_read += 1;
18367                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
18368                next_offset += envelope_size;
18369            }
18370
18371            Ok(())
18372        }
18373    }
18374
18375    impl ScreenshotTakeRequest {
18376        #[inline(always)]
18377        fn max_ordinal_present(&self) -> u64 {
18378            if let Some(_) = self.format {
18379                return 1;
18380            }
18381            0
18382        }
18383    }
18384
18385    impl fidl::encoding::ResourceTypeMarker for ScreenshotTakeRequest {
18386        type Borrowed<'a> = &'a mut Self;
18387        fn take_or_borrow<'a>(
18388            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
18389        ) -> Self::Borrowed<'a> {
18390            value
18391        }
18392    }
18393
18394    unsafe impl fidl::encoding::TypeMarker for ScreenshotTakeRequest {
18395        type Owned = Self;
18396
18397        #[inline(always)]
18398        fn inline_align(_context: fidl::encoding::Context) -> usize {
18399            8
18400        }
18401
18402        #[inline(always)]
18403        fn inline_size(_context: fidl::encoding::Context) -> usize {
18404            16
18405        }
18406    }
18407
18408    unsafe impl
18409        fidl::encoding::Encode<ScreenshotTakeRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
18410        for &mut ScreenshotTakeRequest
18411    {
18412        unsafe fn encode(
18413            self,
18414            encoder: &mut fidl::encoding::Encoder<
18415                '_,
18416                fidl::encoding::DefaultFuchsiaResourceDialect,
18417            >,
18418            offset: usize,
18419            mut depth: fidl::encoding::Depth,
18420        ) -> fidl::Result<()> {
18421            encoder.debug_check_bounds::<ScreenshotTakeRequest>(offset);
18422            // Vector header
18423            let max_ordinal: u64 = self.max_ordinal_present();
18424            encoder.write_num(max_ordinal, offset);
18425            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
18426            // Calling encoder.out_of_line_offset(0) is not allowed.
18427            if max_ordinal == 0 {
18428                return Ok(());
18429            }
18430            depth.increment()?;
18431            let envelope_size = 8;
18432            let bytes_len = max_ordinal as usize * envelope_size;
18433            #[allow(unused_variables)]
18434            let offset = encoder.out_of_line_offset(bytes_len);
18435            let mut _prev_end_offset: usize = 0;
18436            if 1 > max_ordinal {
18437                return Ok(());
18438            }
18439
18440            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
18441            // are envelope_size bytes.
18442            let cur_offset: usize = (1 - 1) * envelope_size;
18443
18444            // Zero reserved fields.
18445            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
18446
18447            // Safety:
18448            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
18449            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
18450            //   envelope_size bytes, there is always sufficient room.
18451            fidl::encoding::encode_in_envelope_optional::<
18452                ScreenshotFormat,
18453                fidl::encoding::DefaultFuchsiaResourceDialect,
18454            >(
18455                self.format
18456                    .as_ref()
18457                    .map(<ScreenshotFormat as fidl::encoding::ValueTypeMarker>::borrow),
18458                encoder,
18459                offset + cur_offset,
18460                depth,
18461            )?;
18462
18463            _prev_end_offset = cur_offset + envelope_size;
18464
18465            Ok(())
18466        }
18467    }
18468
18469    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
18470        for ScreenshotTakeRequest
18471    {
18472        #[inline(always)]
18473        fn new_empty() -> Self {
18474            Self::default()
18475        }
18476
18477        unsafe fn decode(
18478            &mut self,
18479            decoder: &mut fidl::encoding::Decoder<
18480                '_,
18481                fidl::encoding::DefaultFuchsiaResourceDialect,
18482            >,
18483            offset: usize,
18484            mut depth: fidl::encoding::Depth,
18485        ) -> fidl::Result<()> {
18486            decoder.debug_check_bounds::<Self>(offset);
18487            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
18488                None => return Err(fidl::Error::NotNullable),
18489                Some(len) => len,
18490            };
18491            // Calling decoder.out_of_line_offset(0) is not allowed.
18492            if len == 0 {
18493                return Ok(());
18494            };
18495            depth.increment()?;
18496            let envelope_size = 8;
18497            let bytes_len = len * envelope_size;
18498            let offset = decoder.out_of_line_offset(bytes_len)?;
18499            // Decode the envelope for each type.
18500            let mut _next_ordinal_to_read = 0;
18501            let mut next_offset = offset;
18502            let end_offset = offset + bytes_len;
18503            _next_ordinal_to_read += 1;
18504            if next_offset >= end_offset {
18505                return Ok(());
18506            }
18507
18508            // Decode unknown envelopes for gaps in ordinals.
18509            while _next_ordinal_to_read < 1 {
18510                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
18511                _next_ordinal_to_read += 1;
18512                next_offset += envelope_size;
18513            }
18514
18515            let next_out_of_line = decoder.next_out_of_line();
18516            let handles_before = decoder.remaining_handles();
18517            if let Some((inlined, num_bytes, num_handles)) =
18518                fidl::encoding::decode_envelope_header(decoder, next_offset)?
18519            {
18520                let member_inline_size =
18521                    <ScreenshotFormat as fidl::encoding::TypeMarker>::inline_size(decoder.context);
18522                if inlined != (member_inline_size <= 4) {
18523                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
18524                }
18525                let inner_offset;
18526                let mut inner_depth = depth.clone();
18527                if inlined {
18528                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
18529                    inner_offset = next_offset;
18530                } else {
18531                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
18532                    inner_depth.increment()?;
18533                }
18534                let val_ref = self.format.get_or_insert_with(|| {
18535                    fidl::new_empty!(
18536                        ScreenshotFormat,
18537                        fidl::encoding::DefaultFuchsiaResourceDialect
18538                    )
18539                });
18540                fidl::decode!(
18541                    ScreenshotFormat,
18542                    fidl::encoding::DefaultFuchsiaResourceDialect,
18543                    val_ref,
18544                    decoder,
18545                    inner_offset,
18546                    inner_depth
18547                )?;
18548                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
18549                {
18550                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
18551                }
18552                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
18553                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
18554                }
18555            }
18556
18557            next_offset += envelope_size;
18558
18559            // Decode the remaining unknown envelopes.
18560            while next_offset < end_offset {
18561                _next_ordinal_to_read += 1;
18562                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
18563                next_offset += envelope_size;
18564            }
18565
18566            Ok(())
18567        }
18568    }
18569
18570    impl ScreenshotTakeResponse {
18571        #[inline(always)]
18572        fn max_ordinal_present(&self) -> u64 {
18573            if let Some(_) = self.size {
18574                return 2;
18575            }
18576            if let Some(_) = self.vmo {
18577                return 1;
18578            }
18579            0
18580        }
18581    }
18582
18583    impl fidl::encoding::ResourceTypeMarker for ScreenshotTakeResponse {
18584        type Borrowed<'a> = &'a mut Self;
18585        fn take_or_borrow<'a>(
18586            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
18587        ) -> Self::Borrowed<'a> {
18588            value
18589        }
18590    }
18591
18592    unsafe impl fidl::encoding::TypeMarker for ScreenshotTakeResponse {
18593        type Owned = Self;
18594
18595        #[inline(always)]
18596        fn inline_align(_context: fidl::encoding::Context) -> usize {
18597            8
18598        }
18599
18600        #[inline(always)]
18601        fn inline_size(_context: fidl::encoding::Context) -> usize {
18602            16
18603        }
18604    }
18605
18606    unsafe impl
18607        fidl::encoding::Encode<
18608            ScreenshotTakeResponse,
18609            fidl::encoding::DefaultFuchsiaResourceDialect,
18610        > for &mut ScreenshotTakeResponse
18611    {
18612        unsafe fn encode(
18613            self,
18614            encoder: &mut fidl::encoding::Encoder<
18615                '_,
18616                fidl::encoding::DefaultFuchsiaResourceDialect,
18617            >,
18618            offset: usize,
18619            mut depth: fidl::encoding::Depth,
18620        ) -> fidl::Result<()> {
18621            encoder.debug_check_bounds::<ScreenshotTakeResponse>(offset);
18622            // Vector header
18623            let max_ordinal: u64 = self.max_ordinal_present();
18624            encoder.write_num(max_ordinal, offset);
18625            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
18626            // Calling encoder.out_of_line_offset(0) is not allowed.
18627            if max_ordinal == 0 {
18628                return Ok(());
18629            }
18630            depth.increment()?;
18631            let envelope_size = 8;
18632            let bytes_len = max_ordinal as usize * envelope_size;
18633            #[allow(unused_variables)]
18634            let offset = encoder.out_of_line_offset(bytes_len);
18635            let mut _prev_end_offset: usize = 0;
18636            if 1 > max_ordinal {
18637                return Ok(());
18638            }
18639
18640            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
18641            // are envelope_size bytes.
18642            let cur_offset: usize = (1 - 1) * envelope_size;
18643
18644            // Zero reserved fields.
18645            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
18646
18647            // Safety:
18648            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
18649            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
18650            //   envelope_size bytes, there is always sufficient room.
18651            fidl::encoding::encode_in_envelope_optional::<
18652                fidl::encoding::HandleType<
18653                    fidl::Vmo,
18654                    { fidl::ObjectType::VMO.into_raw() },
18655                    2147483648,
18656                >,
18657                fidl::encoding::DefaultFuchsiaResourceDialect,
18658            >(
18659                self.vmo.as_mut().map(
18660                    <fidl::encoding::HandleType<
18661                        fidl::Vmo,
18662                        { fidl::ObjectType::VMO.into_raw() },
18663                        2147483648,
18664                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
18665                ),
18666                encoder,
18667                offset + cur_offset,
18668                depth,
18669            )?;
18670
18671            _prev_end_offset = cur_offset + envelope_size;
18672            if 2 > max_ordinal {
18673                return Ok(());
18674            }
18675
18676            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
18677            // are envelope_size bytes.
18678            let cur_offset: usize = (2 - 1) * envelope_size;
18679
18680            // Zero reserved fields.
18681            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
18682
18683            // Safety:
18684            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
18685            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
18686            //   envelope_size bytes, there is always sufficient room.
18687            fidl::encoding::encode_in_envelope_optional::<
18688                fidl_fuchsia_math::SizeU,
18689                fidl::encoding::DefaultFuchsiaResourceDialect,
18690            >(
18691                self.size
18692                    .as_ref()
18693                    .map(<fidl_fuchsia_math::SizeU as fidl::encoding::ValueTypeMarker>::borrow),
18694                encoder,
18695                offset + cur_offset,
18696                depth,
18697            )?;
18698
18699            _prev_end_offset = cur_offset + envelope_size;
18700
18701            Ok(())
18702        }
18703    }
18704
18705    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
18706        for ScreenshotTakeResponse
18707    {
18708        #[inline(always)]
18709        fn new_empty() -> Self {
18710            Self::default()
18711        }
18712
18713        unsafe fn decode(
18714            &mut self,
18715            decoder: &mut fidl::encoding::Decoder<
18716                '_,
18717                fidl::encoding::DefaultFuchsiaResourceDialect,
18718            >,
18719            offset: usize,
18720            mut depth: fidl::encoding::Depth,
18721        ) -> fidl::Result<()> {
18722            decoder.debug_check_bounds::<Self>(offset);
18723            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
18724                None => return Err(fidl::Error::NotNullable),
18725                Some(len) => len,
18726            };
18727            // Calling decoder.out_of_line_offset(0) is not allowed.
18728            if len == 0 {
18729                return Ok(());
18730            };
18731            depth.increment()?;
18732            let envelope_size = 8;
18733            let bytes_len = len * envelope_size;
18734            let offset = decoder.out_of_line_offset(bytes_len)?;
18735            // Decode the envelope for each type.
18736            let mut _next_ordinal_to_read = 0;
18737            let mut next_offset = offset;
18738            let end_offset = offset + bytes_len;
18739            _next_ordinal_to_read += 1;
18740            if next_offset >= end_offset {
18741                return Ok(());
18742            }
18743
18744            // Decode unknown envelopes for gaps in ordinals.
18745            while _next_ordinal_to_read < 1 {
18746                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
18747                _next_ordinal_to_read += 1;
18748                next_offset += envelope_size;
18749            }
18750
18751            let next_out_of_line = decoder.next_out_of_line();
18752            let handles_before = decoder.remaining_handles();
18753            if let Some((inlined, num_bytes, num_handles)) =
18754                fidl::encoding::decode_envelope_header(decoder, next_offset)?
18755            {
18756                let member_inline_size = <fidl::encoding::HandleType<
18757                    fidl::Vmo,
18758                    { fidl::ObjectType::VMO.into_raw() },
18759                    2147483648,
18760                > as fidl::encoding::TypeMarker>::inline_size(
18761                    decoder.context
18762                );
18763                if inlined != (member_inline_size <= 4) {
18764                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
18765                }
18766                let inner_offset;
18767                let mut inner_depth = depth.clone();
18768                if inlined {
18769                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
18770                    inner_offset = next_offset;
18771                } else {
18772                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
18773                    inner_depth.increment()?;
18774                }
18775                let val_ref =
18776                self.vmo.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
18777                fidl::decode!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
18778                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
18779                {
18780                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
18781                }
18782                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
18783                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
18784                }
18785            }
18786
18787            next_offset += envelope_size;
18788            _next_ordinal_to_read += 1;
18789            if next_offset >= end_offset {
18790                return Ok(());
18791            }
18792
18793            // Decode unknown envelopes for gaps in ordinals.
18794            while _next_ordinal_to_read < 2 {
18795                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
18796                _next_ordinal_to_read += 1;
18797                next_offset += envelope_size;
18798            }
18799
18800            let next_out_of_line = decoder.next_out_of_line();
18801            let handles_before = decoder.remaining_handles();
18802            if let Some((inlined, num_bytes, num_handles)) =
18803                fidl::encoding::decode_envelope_header(decoder, next_offset)?
18804            {
18805                let member_inline_size =
18806                    <fidl_fuchsia_math::SizeU as fidl::encoding::TypeMarker>::inline_size(
18807                        decoder.context,
18808                    );
18809                if inlined != (member_inline_size <= 4) {
18810                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
18811                }
18812                let inner_offset;
18813                let mut inner_depth = depth.clone();
18814                if inlined {
18815                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
18816                    inner_offset = next_offset;
18817                } else {
18818                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
18819                    inner_depth.increment()?;
18820                }
18821                let val_ref = self.size.get_or_insert_with(|| {
18822                    fidl::new_empty!(
18823                        fidl_fuchsia_math::SizeU,
18824                        fidl::encoding::DefaultFuchsiaResourceDialect
18825                    )
18826                });
18827                fidl::decode!(
18828                    fidl_fuchsia_math::SizeU,
18829                    fidl::encoding::DefaultFuchsiaResourceDialect,
18830                    val_ref,
18831                    decoder,
18832                    inner_offset,
18833                    inner_depth
18834                )?;
18835                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
18836                {
18837                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
18838                }
18839                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
18840                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
18841                }
18842            }
18843
18844            next_offset += envelope_size;
18845
18846            // Decode the remaining unknown envelopes.
18847            while next_offset < end_offset {
18848                _next_ordinal_to_read += 1;
18849                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
18850                next_offset += envelope_size;
18851            }
18852
18853            Ok(())
18854        }
18855    }
18856
18857    impl TrustedFlatlandConfig {
18858        #[inline(always)]
18859        fn max_ordinal_present(&self) -> u64 {
18860            if let Some(_) = self.use_flatland2_api {
18861                return 5;
18862            }
18863            if let Some(_) = self.skips_on_frame_presented {
18864                return 4;
18865            }
18866            if let Some(_) = self.skips_present_credits {
18867                return 3;
18868            }
18869            if let Some(_) = self.pass_acquire_fences {
18870                return 2;
18871            }
18872            if let Some(_) = self.schedule_asap {
18873                return 1;
18874            }
18875            0
18876        }
18877    }
18878
18879    impl fidl::encoding::ResourceTypeMarker for TrustedFlatlandConfig {
18880        type Borrowed<'a> = &'a mut Self;
18881        fn take_or_borrow<'a>(
18882            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
18883        ) -> Self::Borrowed<'a> {
18884            value
18885        }
18886    }
18887
18888    unsafe impl fidl::encoding::TypeMarker for TrustedFlatlandConfig {
18889        type Owned = Self;
18890
18891        #[inline(always)]
18892        fn inline_align(_context: fidl::encoding::Context) -> usize {
18893            8
18894        }
18895
18896        #[inline(always)]
18897        fn inline_size(_context: fidl::encoding::Context) -> usize {
18898            16
18899        }
18900    }
18901
18902    unsafe impl
18903        fidl::encoding::Encode<TrustedFlatlandConfig, fidl::encoding::DefaultFuchsiaResourceDialect>
18904        for &mut TrustedFlatlandConfig
18905    {
18906        unsafe fn encode(
18907            self,
18908            encoder: &mut fidl::encoding::Encoder<
18909                '_,
18910                fidl::encoding::DefaultFuchsiaResourceDialect,
18911            >,
18912            offset: usize,
18913            mut depth: fidl::encoding::Depth,
18914        ) -> fidl::Result<()> {
18915            encoder.debug_check_bounds::<TrustedFlatlandConfig>(offset);
18916            // Vector header
18917            let max_ordinal: u64 = self.max_ordinal_present();
18918            encoder.write_num(max_ordinal, offset);
18919            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
18920            // Calling encoder.out_of_line_offset(0) is not allowed.
18921            if max_ordinal == 0 {
18922                return Ok(());
18923            }
18924            depth.increment()?;
18925            let envelope_size = 8;
18926            let bytes_len = max_ordinal as usize * envelope_size;
18927            #[allow(unused_variables)]
18928            let offset = encoder.out_of_line_offset(bytes_len);
18929            let mut _prev_end_offset: usize = 0;
18930            if 1 > max_ordinal {
18931                return Ok(());
18932            }
18933
18934            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
18935            // are envelope_size bytes.
18936            let cur_offset: usize = (1 - 1) * envelope_size;
18937
18938            // Zero reserved fields.
18939            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
18940
18941            // Safety:
18942            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
18943            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
18944            //   envelope_size bytes, there is always sufficient room.
18945            fidl::encoding::encode_in_envelope_optional::<
18946                bool,
18947                fidl::encoding::DefaultFuchsiaResourceDialect,
18948            >(
18949                self.schedule_asap.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
18950                encoder,
18951                offset + cur_offset,
18952                depth,
18953            )?;
18954
18955            _prev_end_offset = cur_offset + envelope_size;
18956            if 2 > max_ordinal {
18957                return Ok(());
18958            }
18959
18960            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
18961            // are envelope_size bytes.
18962            let cur_offset: usize = (2 - 1) * envelope_size;
18963
18964            // Zero reserved fields.
18965            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
18966
18967            // Safety:
18968            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
18969            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
18970            //   envelope_size bytes, there is always sufficient room.
18971            fidl::encoding::encode_in_envelope_optional::<
18972                bool,
18973                fidl::encoding::DefaultFuchsiaResourceDialect,
18974            >(
18975                self.pass_acquire_fences
18976                    .as_ref()
18977                    .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
18978                encoder,
18979                offset + cur_offset,
18980                depth,
18981            )?;
18982
18983            _prev_end_offset = cur_offset + envelope_size;
18984            if 3 > max_ordinal {
18985                return Ok(());
18986            }
18987
18988            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
18989            // are envelope_size bytes.
18990            let cur_offset: usize = (3 - 1) * envelope_size;
18991
18992            // Zero reserved fields.
18993            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
18994
18995            // Safety:
18996            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
18997            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
18998            //   envelope_size bytes, there is always sufficient room.
18999            fidl::encoding::encode_in_envelope_optional::<
19000                bool,
19001                fidl::encoding::DefaultFuchsiaResourceDialect,
19002            >(
19003                self.skips_present_credits
19004                    .as_ref()
19005                    .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
19006                encoder,
19007                offset + cur_offset,
19008                depth,
19009            )?;
19010
19011            _prev_end_offset = cur_offset + envelope_size;
19012            if 4 > max_ordinal {
19013                return Ok(());
19014            }
19015
19016            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
19017            // are envelope_size bytes.
19018            let cur_offset: usize = (4 - 1) * envelope_size;
19019
19020            // Zero reserved fields.
19021            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
19022
19023            // Safety:
19024            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
19025            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
19026            //   envelope_size bytes, there is always sufficient room.
19027            fidl::encoding::encode_in_envelope_optional::<
19028                bool,
19029                fidl::encoding::DefaultFuchsiaResourceDialect,
19030            >(
19031                self.skips_on_frame_presented
19032                    .as_ref()
19033                    .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
19034                encoder,
19035                offset + cur_offset,
19036                depth,
19037            )?;
19038
19039            _prev_end_offset = cur_offset + envelope_size;
19040            if 5 > max_ordinal {
19041                return Ok(());
19042            }
19043
19044            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
19045            // are envelope_size bytes.
19046            let cur_offset: usize = (5 - 1) * envelope_size;
19047
19048            // Zero reserved fields.
19049            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
19050
19051            // Safety:
19052            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
19053            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
19054            //   envelope_size bytes, there is always sufficient room.
19055            fidl::encoding::encode_in_envelope_optional::<
19056                bool,
19057                fidl::encoding::DefaultFuchsiaResourceDialect,
19058            >(
19059                self.use_flatland2_api
19060                    .as_ref()
19061                    .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
19062                encoder,
19063                offset + cur_offset,
19064                depth,
19065            )?;
19066
19067            _prev_end_offset = cur_offset + envelope_size;
19068
19069            Ok(())
19070        }
19071    }
19072
19073    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
19074        for TrustedFlatlandConfig
19075    {
19076        #[inline(always)]
19077        fn new_empty() -> Self {
19078            Self::default()
19079        }
19080
19081        unsafe fn decode(
19082            &mut self,
19083            decoder: &mut fidl::encoding::Decoder<
19084                '_,
19085                fidl::encoding::DefaultFuchsiaResourceDialect,
19086            >,
19087            offset: usize,
19088            mut depth: fidl::encoding::Depth,
19089        ) -> fidl::Result<()> {
19090            decoder.debug_check_bounds::<Self>(offset);
19091            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
19092                None => return Err(fidl::Error::NotNullable),
19093                Some(len) => len,
19094            };
19095            // Calling decoder.out_of_line_offset(0) is not allowed.
19096            if len == 0 {
19097                return Ok(());
19098            };
19099            depth.increment()?;
19100            let envelope_size = 8;
19101            let bytes_len = len * envelope_size;
19102            let offset = decoder.out_of_line_offset(bytes_len)?;
19103            // Decode the envelope for each type.
19104            let mut _next_ordinal_to_read = 0;
19105            let mut next_offset = offset;
19106            let end_offset = offset + bytes_len;
19107            _next_ordinal_to_read += 1;
19108            if next_offset >= end_offset {
19109                return Ok(());
19110            }
19111
19112            // Decode unknown envelopes for gaps in ordinals.
19113            while _next_ordinal_to_read < 1 {
19114                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
19115                _next_ordinal_to_read += 1;
19116                next_offset += envelope_size;
19117            }
19118
19119            let next_out_of_line = decoder.next_out_of_line();
19120            let handles_before = decoder.remaining_handles();
19121            if let Some((inlined, num_bytes, num_handles)) =
19122                fidl::encoding::decode_envelope_header(decoder, next_offset)?
19123            {
19124                let member_inline_size =
19125                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
19126                if inlined != (member_inline_size <= 4) {
19127                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
19128                }
19129                let inner_offset;
19130                let mut inner_depth = depth.clone();
19131                if inlined {
19132                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
19133                    inner_offset = next_offset;
19134                } else {
19135                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
19136                    inner_depth.increment()?;
19137                }
19138                let val_ref = self.schedule_asap.get_or_insert_with(|| {
19139                    fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
19140                });
19141                fidl::decode!(
19142                    bool,
19143                    fidl::encoding::DefaultFuchsiaResourceDialect,
19144                    val_ref,
19145                    decoder,
19146                    inner_offset,
19147                    inner_depth
19148                )?;
19149                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
19150                {
19151                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
19152                }
19153                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
19154                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
19155                }
19156            }
19157
19158            next_offset += envelope_size;
19159            _next_ordinal_to_read += 1;
19160            if next_offset >= end_offset {
19161                return Ok(());
19162            }
19163
19164            // Decode unknown envelopes for gaps in ordinals.
19165            while _next_ordinal_to_read < 2 {
19166                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
19167                _next_ordinal_to_read += 1;
19168                next_offset += envelope_size;
19169            }
19170
19171            let next_out_of_line = decoder.next_out_of_line();
19172            let handles_before = decoder.remaining_handles();
19173            if let Some((inlined, num_bytes, num_handles)) =
19174                fidl::encoding::decode_envelope_header(decoder, next_offset)?
19175            {
19176                let member_inline_size =
19177                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
19178                if inlined != (member_inline_size <= 4) {
19179                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
19180                }
19181                let inner_offset;
19182                let mut inner_depth = depth.clone();
19183                if inlined {
19184                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
19185                    inner_offset = next_offset;
19186                } else {
19187                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
19188                    inner_depth.increment()?;
19189                }
19190                let val_ref = self.pass_acquire_fences.get_or_insert_with(|| {
19191                    fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
19192                });
19193                fidl::decode!(
19194                    bool,
19195                    fidl::encoding::DefaultFuchsiaResourceDialect,
19196                    val_ref,
19197                    decoder,
19198                    inner_offset,
19199                    inner_depth
19200                )?;
19201                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
19202                {
19203                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
19204                }
19205                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
19206                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
19207                }
19208            }
19209
19210            next_offset += envelope_size;
19211            _next_ordinal_to_read += 1;
19212            if next_offset >= end_offset {
19213                return Ok(());
19214            }
19215
19216            // Decode unknown envelopes for gaps in ordinals.
19217            while _next_ordinal_to_read < 3 {
19218                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
19219                _next_ordinal_to_read += 1;
19220                next_offset += envelope_size;
19221            }
19222
19223            let next_out_of_line = decoder.next_out_of_line();
19224            let handles_before = decoder.remaining_handles();
19225            if let Some((inlined, num_bytes, num_handles)) =
19226                fidl::encoding::decode_envelope_header(decoder, next_offset)?
19227            {
19228                let member_inline_size =
19229                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
19230                if inlined != (member_inline_size <= 4) {
19231                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
19232                }
19233                let inner_offset;
19234                let mut inner_depth = depth.clone();
19235                if inlined {
19236                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
19237                    inner_offset = next_offset;
19238                } else {
19239                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
19240                    inner_depth.increment()?;
19241                }
19242                let val_ref = self.skips_present_credits.get_or_insert_with(|| {
19243                    fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
19244                });
19245                fidl::decode!(
19246                    bool,
19247                    fidl::encoding::DefaultFuchsiaResourceDialect,
19248                    val_ref,
19249                    decoder,
19250                    inner_offset,
19251                    inner_depth
19252                )?;
19253                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
19254                {
19255                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
19256                }
19257                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
19258                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
19259                }
19260            }
19261
19262            next_offset += envelope_size;
19263            _next_ordinal_to_read += 1;
19264            if next_offset >= end_offset {
19265                return Ok(());
19266            }
19267
19268            // Decode unknown envelopes for gaps in ordinals.
19269            while _next_ordinal_to_read < 4 {
19270                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
19271                _next_ordinal_to_read += 1;
19272                next_offset += envelope_size;
19273            }
19274
19275            let next_out_of_line = decoder.next_out_of_line();
19276            let handles_before = decoder.remaining_handles();
19277            if let Some((inlined, num_bytes, num_handles)) =
19278                fidl::encoding::decode_envelope_header(decoder, next_offset)?
19279            {
19280                let member_inline_size =
19281                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
19282                if inlined != (member_inline_size <= 4) {
19283                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
19284                }
19285                let inner_offset;
19286                let mut inner_depth = depth.clone();
19287                if inlined {
19288                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
19289                    inner_offset = next_offset;
19290                } else {
19291                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
19292                    inner_depth.increment()?;
19293                }
19294                let val_ref = self.skips_on_frame_presented.get_or_insert_with(|| {
19295                    fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
19296                });
19297                fidl::decode!(
19298                    bool,
19299                    fidl::encoding::DefaultFuchsiaResourceDialect,
19300                    val_ref,
19301                    decoder,
19302                    inner_offset,
19303                    inner_depth
19304                )?;
19305                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
19306                {
19307                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
19308                }
19309                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
19310                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
19311                }
19312            }
19313
19314            next_offset += envelope_size;
19315            _next_ordinal_to_read += 1;
19316            if next_offset >= end_offset {
19317                return Ok(());
19318            }
19319
19320            // Decode unknown envelopes for gaps in ordinals.
19321            while _next_ordinal_to_read < 5 {
19322                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
19323                _next_ordinal_to_read += 1;
19324                next_offset += envelope_size;
19325            }
19326
19327            let next_out_of_line = decoder.next_out_of_line();
19328            let handles_before = decoder.remaining_handles();
19329            if let Some((inlined, num_bytes, num_handles)) =
19330                fidl::encoding::decode_envelope_header(decoder, next_offset)?
19331            {
19332                let member_inline_size =
19333                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
19334                if inlined != (member_inline_size <= 4) {
19335                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
19336                }
19337                let inner_offset;
19338                let mut inner_depth = depth.clone();
19339                if inlined {
19340                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
19341                    inner_offset = next_offset;
19342                } else {
19343                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
19344                    inner_depth.increment()?;
19345                }
19346                let val_ref = self.use_flatland2_api.get_or_insert_with(|| {
19347                    fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
19348                });
19349                fidl::decode!(
19350                    bool,
19351                    fidl::encoding::DefaultFuchsiaResourceDialect,
19352                    val_ref,
19353                    decoder,
19354                    inner_offset,
19355                    inner_depth
19356                )?;
19357                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
19358                {
19359                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
19360                }
19361                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
19362                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
19363                }
19364            }
19365
19366            next_offset += envelope_size;
19367
19368            // Decode the remaining unknown envelopes.
19369            while next_offset < end_offset {
19370                _next_ordinal_to_read += 1;
19371                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
19372                next_offset += envelope_size;
19373            }
19374
19375            Ok(())
19376        }
19377    }
19378
19379    impl ViewBoundProtocols {
19380        #[inline(always)]
19381        fn max_ordinal_present(&self) -> u64 {
19382            if let Some(_) = self.mouse_source_v2 {
19383                return 6;
19384            }
19385            if let Some(_) = self.touch_source_v2 {
19386                return 5;
19387            }
19388            if let Some(_) = self.mouse_source {
19389                return 4;
19390            }
19391            if let Some(_) = self.touch_source {
19392                return 3;
19393            }
19394            if let Some(_) = self.view_focuser {
19395                return 2;
19396            }
19397            if let Some(_) = self.view_ref_focused {
19398                return 1;
19399            }
19400            0
19401        }
19402    }
19403
19404    impl fidl::encoding::ResourceTypeMarker for ViewBoundProtocols {
19405        type Borrowed<'a> = &'a mut Self;
19406        fn take_or_borrow<'a>(
19407            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
19408        ) -> Self::Borrowed<'a> {
19409            value
19410        }
19411    }
19412
19413    unsafe impl fidl::encoding::TypeMarker for ViewBoundProtocols {
19414        type Owned = Self;
19415
19416        #[inline(always)]
19417        fn inline_align(_context: fidl::encoding::Context) -> usize {
19418            8
19419        }
19420
19421        #[inline(always)]
19422        fn inline_size(_context: fidl::encoding::Context) -> usize {
19423            16
19424        }
19425    }
19426
19427    unsafe impl
19428        fidl::encoding::Encode<ViewBoundProtocols, fidl::encoding::DefaultFuchsiaResourceDialect>
19429        for &mut ViewBoundProtocols
19430    {
19431        unsafe fn encode(
19432            self,
19433            encoder: &mut fidl::encoding::Encoder<
19434                '_,
19435                fidl::encoding::DefaultFuchsiaResourceDialect,
19436            >,
19437            offset: usize,
19438            mut depth: fidl::encoding::Depth,
19439        ) -> fidl::Result<()> {
19440            encoder.debug_check_bounds::<ViewBoundProtocols>(offset);
19441            // Vector header
19442            let max_ordinal: u64 = self.max_ordinal_present();
19443            encoder.write_num(max_ordinal, offset);
19444            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
19445            // Calling encoder.out_of_line_offset(0) is not allowed.
19446            if max_ordinal == 0 {
19447                return Ok(());
19448            }
19449            depth.increment()?;
19450            let envelope_size = 8;
19451            let bytes_len = max_ordinal as usize * envelope_size;
19452            #[allow(unused_variables)]
19453            let offset = encoder.out_of_line_offset(bytes_len);
19454            let mut _prev_end_offset: usize = 0;
19455            if 1 > max_ordinal {
19456                return Ok(());
19457            }
19458
19459            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
19460            // are envelope_size bytes.
19461            let cur_offset: usize = (1 - 1) * envelope_size;
19462
19463            // Zero reserved fields.
19464            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
19465
19466            // Safety:
19467            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
19468            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
19469            //   envelope_size bytes, there is always sufficient room.
19470            fidl::encoding::encode_in_envelope_optional::<
19471                fidl::encoding::Endpoint<
19472                    fidl::endpoints::ServerEnd<fidl_fuchsia_ui_views::ViewRefFocusedMarker>,
19473                >,
19474                fidl::encoding::DefaultFuchsiaResourceDialect,
19475            >(
19476                self.view_ref_focused.as_mut().map(
19477                    <fidl::encoding::Endpoint<
19478                        fidl::endpoints::ServerEnd<fidl_fuchsia_ui_views::ViewRefFocusedMarker>,
19479                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
19480                ),
19481                encoder,
19482                offset + cur_offset,
19483                depth,
19484            )?;
19485
19486            _prev_end_offset = cur_offset + envelope_size;
19487            if 2 > max_ordinal {
19488                return Ok(());
19489            }
19490
19491            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
19492            // are envelope_size bytes.
19493            let cur_offset: usize = (2 - 1) * envelope_size;
19494
19495            // Zero reserved fields.
19496            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
19497
19498            // Safety:
19499            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
19500            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
19501            //   envelope_size bytes, there is always sufficient room.
19502            fidl::encoding::encode_in_envelope_optional::<
19503                fidl::encoding::Endpoint<
19504                    fidl::endpoints::ServerEnd<fidl_fuchsia_ui_views::FocuserMarker>,
19505                >,
19506                fidl::encoding::DefaultFuchsiaResourceDialect,
19507            >(
19508                self.view_focuser.as_mut().map(
19509                    <fidl::encoding::Endpoint<
19510                        fidl::endpoints::ServerEnd<fidl_fuchsia_ui_views::FocuserMarker>,
19511                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
19512                ),
19513                encoder,
19514                offset + cur_offset,
19515                depth,
19516            )?;
19517
19518            _prev_end_offset = cur_offset + envelope_size;
19519            if 3 > max_ordinal {
19520                return Ok(());
19521            }
19522
19523            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
19524            // are envelope_size bytes.
19525            let cur_offset: usize = (3 - 1) * envelope_size;
19526
19527            // Zero reserved fields.
19528            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
19529
19530            // Safety:
19531            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
19532            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
19533            //   envelope_size bytes, there is always sufficient room.
19534            fidl::encoding::encode_in_envelope_optional::<
19535                fidl::encoding::Endpoint<
19536                    fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::TouchSourceMarker>,
19537                >,
19538                fidl::encoding::DefaultFuchsiaResourceDialect,
19539            >(
19540                self.touch_source.as_mut().map(
19541                    <fidl::encoding::Endpoint<
19542                        fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::TouchSourceMarker>,
19543                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
19544                ),
19545                encoder,
19546                offset + cur_offset,
19547                depth,
19548            )?;
19549
19550            _prev_end_offset = cur_offset + envelope_size;
19551            if 4 > max_ordinal {
19552                return Ok(());
19553            }
19554
19555            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
19556            // are envelope_size bytes.
19557            let cur_offset: usize = (4 - 1) * envelope_size;
19558
19559            // Zero reserved fields.
19560            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
19561
19562            // Safety:
19563            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
19564            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
19565            //   envelope_size bytes, there is always sufficient room.
19566            fidl::encoding::encode_in_envelope_optional::<
19567                fidl::encoding::Endpoint<
19568                    fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::MouseSourceMarker>,
19569                >,
19570                fidl::encoding::DefaultFuchsiaResourceDialect,
19571            >(
19572                self.mouse_source.as_mut().map(
19573                    <fidl::encoding::Endpoint<
19574                        fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::MouseSourceMarker>,
19575                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
19576                ),
19577                encoder,
19578                offset + cur_offset,
19579                depth,
19580            )?;
19581
19582            _prev_end_offset = cur_offset + envelope_size;
19583            if 5 > max_ordinal {
19584                return Ok(());
19585            }
19586
19587            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
19588            // are envelope_size bytes.
19589            let cur_offset: usize = (5 - 1) * envelope_size;
19590
19591            // Zero reserved fields.
19592            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
19593
19594            // Safety:
19595            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
19596            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
19597            //   envelope_size bytes, there is always sufficient room.
19598            fidl::encoding::encode_in_envelope_optional::<
19599                fidl::encoding::Endpoint<
19600                    fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::TouchSourceV2Marker>,
19601                >,
19602                fidl::encoding::DefaultFuchsiaResourceDialect,
19603            >(
19604                self.touch_source_v2.as_mut().map(
19605                    <fidl::encoding::Endpoint<
19606                        fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::TouchSourceV2Marker>,
19607                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
19608                ),
19609                encoder,
19610                offset + cur_offset,
19611                depth,
19612            )?;
19613
19614            _prev_end_offset = cur_offset + envelope_size;
19615            if 6 > max_ordinal {
19616                return Ok(());
19617            }
19618
19619            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
19620            // are envelope_size bytes.
19621            let cur_offset: usize = (6 - 1) * envelope_size;
19622
19623            // Zero reserved fields.
19624            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
19625
19626            // Safety:
19627            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
19628            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
19629            //   envelope_size bytes, there is always sufficient room.
19630            fidl::encoding::encode_in_envelope_optional::<
19631                fidl::encoding::Endpoint<
19632                    fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::MouseSourceV2Marker>,
19633                >,
19634                fidl::encoding::DefaultFuchsiaResourceDialect,
19635            >(
19636                self.mouse_source_v2.as_mut().map(
19637                    <fidl::encoding::Endpoint<
19638                        fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::MouseSourceV2Marker>,
19639                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
19640                ),
19641                encoder,
19642                offset + cur_offset,
19643                depth,
19644            )?;
19645
19646            _prev_end_offset = cur_offset + envelope_size;
19647
19648            Ok(())
19649        }
19650    }
19651
19652    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
19653        for ViewBoundProtocols
19654    {
19655        #[inline(always)]
19656        fn new_empty() -> Self {
19657            Self::default()
19658        }
19659
19660        unsafe fn decode(
19661            &mut self,
19662            decoder: &mut fidl::encoding::Decoder<
19663                '_,
19664                fidl::encoding::DefaultFuchsiaResourceDialect,
19665            >,
19666            offset: usize,
19667            mut depth: fidl::encoding::Depth,
19668        ) -> fidl::Result<()> {
19669            decoder.debug_check_bounds::<Self>(offset);
19670            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
19671                None => return Err(fidl::Error::NotNullable),
19672                Some(len) => len,
19673            };
19674            // Calling decoder.out_of_line_offset(0) is not allowed.
19675            if len == 0 {
19676                return Ok(());
19677            };
19678            depth.increment()?;
19679            let envelope_size = 8;
19680            let bytes_len = len * envelope_size;
19681            let offset = decoder.out_of_line_offset(bytes_len)?;
19682            // Decode the envelope for each type.
19683            let mut _next_ordinal_to_read = 0;
19684            let mut next_offset = offset;
19685            let end_offset = offset + bytes_len;
19686            _next_ordinal_to_read += 1;
19687            if next_offset >= end_offset {
19688                return Ok(());
19689            }
19690
19691            // Decode unknown envelopes for gaps in ordinals.
19692            while _next_ordinal_to_read < 1 {
19693                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
19694                _next_ordinal_to_read += 1;
19695                next_offset += envelope_size;
19696            }
19697
19698            let next_out_of_line = decoder.next_out_of_line();
19699            let handles_before = decoder.remaining_handles();
19700            if let Some((inlined, num_bytes, num_handles)) =
19701                fidl::encoding::decode_envelope_header(decoder, next_offset)?
19702            {
19703                let member_inline_size = <fidl::encoding::Endpoint<
19704                    fidl::endpoints::ServerEnd<fidl_fuchsia_ui_views::ViewRefFocusedMarker>,
19705                > as fidl::encoding::TypeMarker>::inline_size(
19706                    decoder.context
19707                );
19708                if inlined != (member_inline_size <= 4) {
19709                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
19710                }
19711                let inner_offset;
19712                let mut inner_depth = depth.clone();
19713                if inlined {
19714                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
19715                    inner_offset = next_offset;
19716                } else {
19717                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
19718                    inner_depth.increment()?;
19719                }
19720                let val_ref = self.view_ref_focused.get_or_insert_with(|| {
19721                    fidl::new_empty!(
19722                        fidl::encoding::Endpoint<
19723                            fidl::endpoints::ServerEnd<fidl_fuchsia_ui_views::ViewRefFocusedMarker>,
19724                        >,
19725                        fidl::encoding::DefaultFuchsiaResourceDialect
19726                    )
19727                });
19728                fidl::decode!(
19729                    fidl::encoding::Endpoint<
19730                        fidl::endpoints::ServerEnd<fidl_fuchsia_ui_views::ViewRefFocusedMarker>,
19731                    >,
19732                    fidl::encoding::DefaultFuchsiaResourceDialect,
19733                    val_ref,
19734                    decoder,
19735                    inner_offset,
19736                    inner_depth
19737                )?;
19738                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
19739                {
19740                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
19741                }
19742                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
19743                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
19744                }
19745            }
19746
19747            next_offset += envelope_size;
19748            _next_ordinal_to_read += 1;
19749            if next_offset >= end_offset {
19750                return Ok(());
19751            }
19752
19753            // Decode unknown envelopes for gaps in ordinals.
19754            while _next_ordinal_to_read < 2 {
19755                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
19756                _next_ordinal_to_read += 1;
19757                next_offset += envelope_size;
19758            }
19759
19760            let next_out_of_line = decoder.next_out_of_line();
19761            let handles_before = decoder.remaining_handles();
19762            if let Some((inlined, num_bytes, num_handles)) =
19763                fidl::encoding::decode_envelope_header(decoder, next_offset)?
19764            {
19765                let member_inline_size = <fidl::encoding::Endpoint<
19766                    fidl::endpoints::ServerEnd<fidl_fuchsia_ui_views::FocuserMarker>,
19767                > as fidl::encoding::TypeMarker>::inline_size(
19768                    decoder.context
19769                );
19770                if inlined != (member_inline_size <= 4) {
19771                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
19772                }
19773                let inner_offset;
19774                let mut inner_depth = depth.clone();
19775                if inlined {
19776                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
19777                    inner_offset = next_offset;
19778                } else {
19779                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
19780                    inner_depth.increment()?;
19781                }
19782                let val_ref = self.view_focuser.get_or_insert_with(|| {
19783                    fidl::new_empty!(
19784                        fidl::encoding::Endpoint<
19785                            fidl::endpoints::ServerEnd<fidl_fuchsia_ui_views::FocuserMarker>,
19786                        >,
19787                        fidl::encoding::DefaultFuchsiaResourceDialect
19788                    )
19789                });
19790                fidl::decode!(
19791                    fidl::encoding::Endpoint<
19792                        fidl::endpoints::ServerEnd<fidl_fuchsia_ui_views::FocuserMarker>,
19793                    >,
19794                    fidl::encoding::DefaultFuchsiaResourceDialect,
19795                    val_ref,
19796                    decoder,
19797                    inner_offset,
19798                    inner_depth
19799                )?;
19800                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
19801                {
19802                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
19803                }
19804                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
19805                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
19806                }
19807            }
19808
19809            next_offset += envelope_size;
19810            _next_ordinal_to_read += 1;
19811            if next_offset >= end_offset {
19812                return Ok(());
19813            }
19814
19815            // Decode unknown envelopes for gaps in ordinals.
19816            while _next_ordinal_to_read < 3 {
19817                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
19818                _next_ordinal_to_read += 1;
19819                next_offset += envelope_size;
19820            }
19821
19822            let next_out_of_line = decoder.next_out_of_line();
19823            let handles_before = decoder.remaining_handles();
19824            if let Some((inlined, num_bytes, num_handles)) =
19825                fidl::encoding::decode_envelope_header(decoder, next_offset)?
19826            {
19827                let member_inline_size = <fidl::encoding::Endpoint<
19828                    fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::TouchSourceMarker>,
19829                > as fidl::encoding::TypeMarker>::inline_size(
19830                    decoder.context
19831                );
19832                if inlined != (member_inline_size <= 4) {
19833                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
19834                }
19835                let inner_offset;
19836                let mut inner_depth = depth.clone();
19837                if inlined {
19838                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
19839                    inner_offset = next_offset;
19840                } else {
19841                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
19842                    inner_depth.increment()?;
19843                }
19844                let val_ref = self.touch_source.get_or_insert_with(|| {
19845                    fidl::new_empty!(
19846                        fidl::encoding::Endpoint<
19847                            fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::TouchSourceMarker>,
19848                        >,
19849                        fidl::encoding::DefaultFuchsiaResourceDialect
19850                    )
19851                });
19852                fidl::decode!(
19853                    fidl::encoding::Endpoint<
19854                        fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::TouchSourceMarker>,
19855                    >,
19856                    fidl::encoding::DefaultFuchsiaResourceDialect,
19857                    val_ref,
19858                    decoder,
19859                    inner_offset,
19860                    inner_depth
19861                )?;
19862                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
19863                {
19864                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
19865                }
19866                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
19867                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
19868                }
19869            }
19870
19871            next_offset += envelope_size;
19872            _next_ordinal_to_read += 1;
19873            if next_offset >= end_offset {
19874                return Ok(());
19875            }
19876
19877            // Decode unknown envelopes for gaps in ordinals.
19878            while _next_ordinal_to_read < 4 {
19879                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
19880                _next_ordinal_to_read += 1;
19881                next_offset += envelope_size;
19882            }
19883
19884            let next_out_of_line = decoder.next_out_of_line();
19885            let handles_before = decoder.remaining_handles();
19886            if let Some((inlined, num_bytes, num_handles)) =
19887                fidl::encoding::decode_envelope_header(decoder, next_offset)?
19888            {
19889                let member_inline_size = <fidl::encoding::Endpoint<
19890                    fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::MouseSourceMarker>,
19891                > as fidl::encoding::TypeMarker>::inline_size(
19892                    decoder.context
19893                );
19894                if inlined != (member_inline_size <= 4) {
19895                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
19896                }
19897                let inner_offset;
19898                let mut inner_depth = depth.clone();
19899                if inlined {
19900                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
19901                    inner_offset = next_offset;
19902                } else {
19903                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
19904                    inner_depth.increment()?;
19905                }
19906                let val_ref = self.mouse_source.get_or_insert_with(|| {
19907                    fidl::new_empty!(
19908                        fidl::encoding::Endpoint<
19909                            fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::MouseSourceMarker>,
19910                        >,
19911                        fidl::encoding::DefaultFuchsiaResourceDialect
19912                    )
19913                });
19914                fidl::decode!(
19915                    fidl::encoding::Endpoint<
19916                        fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::MouseSourceMarker>,
19917                    >,
19918                    fidl::encoding::DefaultFuchsiaResourceDialect,
19919                    val_ref,
19920                    decoder,
19921                    inner_offset,
19922                    inner_depth
19923                )?;
19924                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
19925                {
19926                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
19927                }
19928                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
19929                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
19930                }
19931            }
19932
19933            next_offset += envelope_size;
19934            _next_ordinal_to_read += 1;
19935            if next_offset >= end_offset {
19936                return Ok(());
19937            }
19938
19939            // Decode unknown envelopes for gaps in ordinals.
19940            while _next_ordinal_to_read < 5 {
19941                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
19942                _next_ordinal_to_read += 1;
19943                next_offset += envelope_size;
19944            }
19945
19946            let next_out_of_line = decoder.next_out_of_line();
19947            let handles_before = decoder.remaining_handles();
19948            if let Some((inlined, num_bytes, num_handles)) =
19949                fidl::encoding::decode_envelope_header(decoder, next_offset)?
19950            {
19951                let member_inline_size = <fidl::encoding::Endpoint<
19952                    fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::TouchSourceV2Marker>,
19953                > as fidl::encoding::TypeMarker>::inline_size(
19954                    decoder.context
19955                );
19956                if inlined != (member_inline_size <= 4) {
19957                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
19958                }
19959                let inner_offset;
19960                let mut inner_depth = depth.clone();
19961                if inlined {
19962                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
19963                    inner_offset = next_offset;
19964                } else {
19965                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
19966                    inner_depth.increment()?;
19967                }
19968                let val_ref = self.touch_source_v2.get_or_insert_with(|| {
19969                    fidl::new_empty!(
19970                        fidl::encoding::Endpoint<
19971                            fidl::endpoints::ServerEnd<
19972                                fidl_fuchsia_ui_pointer::TouchSourceV2Marker,
19973                            >,
19974                        >,
19975                        fidl::encoding::DefaultFuchsiaResourceDialect
19976                    )
19977                });
19978                fidl::decode!(
19979                    fidl::encoding::Endpoint<
19980                        fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::TouchSourceV2Marker>,
19981                    >,
19982                    fidl::encoding::DefaultFuchsiaResourceDialect,
19983                    val_ref,
19984                    decoder,
19985                    inner_offset,
19986                    inner_depth
19987                )?;
19988                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
19989                {
19990                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
19991                }
19992                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
19993                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
19994                }
19995            }
19996
19997            next_offset += envelope_size;
19998            _next_ordinal_to_read += 1;
19999            if next_offset >= end_offset {
20000                return Ok(());
20001            }
20002
20003            // Decode unknown envelopes for gaps in ordinals.
20004            while _next_ordinal_to_read < 6 {
20005                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
20006                _next_ordinal_to_read += 1;
20007                next_offset += envelope_size;
20008            }
20009
20010            let next_out_of_line = decoder.next_out_of_line();
20011            let handles_before = decoder.remaining_handles();
20012            if let Some((inlined, num_bytes, num_handles)) =
20013                fidl::encoding::decode_envelope_header(decoder, next_offset)?
20014            {
20015                let member_inline_size = <fidl::encoding::Endpoint<
20016                    fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::MouseSourceV2Marker>,
20017                > as fidl::encoding::TypeMarker>::inline_size(
20018                    decoder.context
20019                );
20020                if inlined != (member_inline_size <= 4) {
20021                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
20022                }
20023                let inner_offset;
20024                let mut inner_depth = depth.clone();
20025                if inlined {
20026                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
20027                    inner_offset = next_offset;
20028                } else {
20029                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
20030                    inner_depth.increment()?;
20031                }
20032                let val_ref = self.mouse_source_v2.get_or_insert_with(|| {
20033                    fidl::new_empty!(
20034                        fidl::encoding::Endpoint<
20035                            fidl::endpoints::ServerEnd<
20036                                fidl_fuchsia_ui_pointer::MouseSourceV2Marker,
20037                            >,
20038                        >,
20039                        fidl::encoding::DefaultFuchsiaResourceDialect
20040                    )
20041                });
20042                fidl::decode!(
20043                    fidl::encoding::Endpoint<
20044                        fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::MouseSourceV2Marker>,
20045                    >,
20046                    fidl::encoding::DefaultFuchsiaResourceDialect,
20047                    val_ref,
20048                    decoder,
20049                    inner_offset,
20050                    inner_depth
20051                )?;
20052                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
20053                {
20054                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
20055                }
20056                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
20057                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
20058                }
20059            }
20060
20061            next_offset += envelope_size;
20062
20063            // Decode the remaining unknown envelopes.
20064            while next_offset < end_offset {
20065                _next_ordinal_to_read += 1;
20066                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
20067                next_offset += envelope_size;
20068            }
20069
20070            Ok(())
20071        }
20072    }
20073
20074    impl fidl::encoding::ResourceTypeMarker for SignalFence {
20075        type Borrowed<'a> = &'a mut Self;
20076        fn take_or_borrow<'a>(
20077            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
20078        ) -> Self::Borrowed<'a> {
20079            value
20080        }
20081    }
20082
20083    unsafe impl fidl::encoding::TypeMarker for SignalFence {
20084        type Owned = Self;
20085
20086        #[inline(always)]
20087        fn inline_align(_context: fidl::encoding::Context) -> usize {
20088            8
20089        }
20090
20091        #[inline(always)]
20092        fn inline_size(_context: fidl::encoding::Context) -> usize {
20093            16
20094        }
20095    }
20096
20097    unsafe impl fidl::encoding::Encode<SignalFence, fidl::encoding::DefaultFuchsiaResourceDialect>
20098        for &mut SignalFence
20099    {
20100        #[inline]
20101        unsafe fn encode(
20102            self,
20103            encoder: &mut fidl::encoding::Encoder<
20104                '_,
20105                fidl::encoding::DefaultFuchsiaResourceDialect,
20106            >,
20107            offset: usize,
20108            _depth: fidl::encoding::Depth,
20109        ) -> fidl::Result<()> {
20110            encoder.debug_check_bounds::<SignalFence>(offset);
20111            encoder.write_num::<u64>(self.ordinal(), offset);
20112            match self {
20113                SignalFence::Basic(ref mut val) => fidl::encoding::encode_in_envelope::<
20114                    fidl::encoding::HandleType<
20115                        fidl::NullableHandle,
20116                        { fidl::ObjectType::NONE.into_raw() },
20117                        2147483648,
20118                    >,
20119                    fidl::encoding::DefaultFuchsiaResourceDialect,
20120                >(
20121                    <fidl::encoding::HandleType<
20122                        fidl::NullableHandle,
20123                        { fidl::ObjectType::NONE.into_raw() },
20124                        2147483648,
20125                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
20126                        val
20127                    ),
20128                    encoder,
20129                    offset + 8,
20130                    _depth,
20131                ),
20132                SignalFence::Timestamp(ref mut val) => fidl::encoding::encode_in_envelope::<
20133                    fidl::encoding::HandleType<
20134                        fidl::Counter,
20135                        { fidl::ObjectType::COUNTER.into_raw() },
20136                        2147483648,
20137                    >,
20138                    fidl::encoding::DefaultFuchsiaResourceDialect,
20139                >(
20140                    <fidl::encoding::HandleType<
20141                        fidl::Counter,
20142                        { fidl::ObjectType::COUNTER.into_raw() },
20143                        2147483648,
20144                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
20145                        val
20146                    ),
20147                    encoder,
20148                    offset + 8,
20149                    _depth,
20150                ),
20151            }
20152        }
20153    }
20154
20155    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for SignalFence {
20156        #[inline(always)]
20157        fn new_empty() -> Self {
20158            Self::Basic(
20159                fidl::new_empty!(fidl::encoding::HandleType<fidl::NullableHandle, { fidl::ObjectType::NONE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
20160            )
20161        }
20162
20163        #[inline]
20164        unsafe fn decode(
20165            &mut self,
20166            decoder: &mut fidl::encoding::Decoder<
20167                '_,
20168                fidl::encoding::DefaultFuchsiaResourceDialect,
20169            >,
20170            offset: usize,
20171            mut depth: fidl::encoding::Depth,
20172        ) -> fidl::Result<()> {
20173            decoder.debug_check_bounds::<Self>(offset);
20174            #[allow(unused_variables)]
20175            let next_out_of_line = decoder.next_out_of_line();
20176            let handles_before = decoder.remaining_handles();
20177            let (ordinal, inlined, num_bytes, num_handles) =
20178                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
20179
20180            let member_inline_size = match ordinal {
20181                1 => <fidl::encoding::HandleType<
20182                    fidl::NullableHandle,
20183                    { fidl::ObjectType::NONE.into_raw() },
20184                    2147483648,
20185                > as fidl::encoding::TypeMarker>::inline_size(decoder.context),
20186                2 => <fidl::encoding::HandleType<
20187                    fidl::Counter,
20188                    { fidl::ObjectType::COUNTER.into_raw() },
20189                    2147483648,
20190                > as fidl::encoding::TypeMarker>::inline_size(decoder.context),
20191                _ => return Err(fidl::Error::UnknownUnionTag),
20192            };
20193
20194            if inlined != (member_inline_size <= 4) {
20195                return Err(fidl::Error::InvalidInlineBitInEnvelope);
20196            }
20197            let _inner_offset;
20198            if inlined {
20199                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
20200                _inner_offset = offset + 8;
20201            } else {
20202                depth.increment()?;
20203                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
20204            }
20205            match ordinal {
20206                1 => {
20207                    #[allow(irrefutable_let_patterns)]
20208                    if let SignalFence::Basic(_) = self {
20209                        // Do nothing, read the value into the object
20210                    } else {
20211                        // Initialize `self` to the right variant
20212                        *self = SignalFence::Basic(
20213                            fidl::new_empty!(fidl::encoding::HandleType<fidl::NullableHandle, { fidl::ObjectType::NONE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
20214                        );
20215                    }
20216                    #[allow(irrefutable_let_patterns)]
20217                    if let SignalFence::Basic(ref mut val) = self {
20218                        fidl::decode!(fidl::encoding::HandleType<fidl::NullableHandle, { fidl::ObjectType::NONE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val, decoder, _inner_offset, depth)?;
20219                    } else {
20220                        unreachable!()
20221                    }
20222                }
20223                2 => {
20224                    #[allow(irrefutable_let_patterns)]
20225                    if let SignalFence::Timestamp(_) = self {
20226                        // Do nothing, read the value into the object
20227                    } else {
20228                        // Initialize `self` to the right variant
20229                        *self = SignalFence::Timestamp(
20230                            fidl::new_empty!(fidl::encoding::HandleType<fidl::Counter, { fidl::ObjectType::COUNTER.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
20231                        );
20232                    }
20233                    #[allow(irrefutable_let_patterns)]
20234                    if let SignalFence::Timestamp(ref mut val) = self {
20235                        fidl::decode!(fidl::encoding::HandleType<fidl::Counter, { fidl::ObjectType::COUNTER.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val, decoder, _inner_offset, depth)?;
20236                    } else {
20237                        unreachable!()
20238                    }
20239                }
20240                ordinal => panic!("unexpected ordinal {:?}", ordinal),
20241            }
20242            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
20243                return Err(fidl::Error::InvalidNumBytesInEnvelope);
20244            }
20245            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
20246                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
20247            }
20248            Ok(())
20249        }
20250    }
20251
20252    impl fidl::encoding::ResourceTypeMarker for WaitFence {
20253        type Borrowed<'a> = &'a mut Self;
20254        fn take_or_borrow<'a>(
20255            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
20256        ) -> Self::Borrowed<'a> {
20257            value
20258        }
20259    }
20260
20261    unsafe impl fidl::encoding::TypeMarker for WaitFence {
20262        type Owned = Self;
20263
20264        #[inline(always)]
20265        fn inline_align(_context: fidl::encoding::Context) -> usize {
20266            8
20267        }
20268
20269        #[inline(always)]
20270        fn inline_size(_context: fidl::encoding::Context) -> usize {
20271            16
20272        }
20273    }
20274
20275    unsafe impl fidl::encoding::Encode<WaitFence, fidl::encoding::DefaultFuchsiaResourceDialect>
20276        for &mut WaitFence
20277    {
20278        #[inline]
20279        unsafe fn encode(
20280            self,
20281            encoder: &mut fidl::encoding::Encoder<
20282                '_,
20283                fidl::encoding::DefaultFuchsiaResourceDialect,
20284            >,
20285            offset: usize,
20286            _depth: fidl::encoding::Depth,
20287        ) -> fidl::Result<()> {
20288            encoder.debug_check_bounds::<WaitFence>(offset);
20289            encoder.write_num::<u64>(self.ordinal(), offset);
20290            match self {
20291                WaitFence::Basic(ref mut val) => fidl::encoding::encode_in_envelope::<
20292                    fidl::encoding::HandleType<
20293                        fidl::NullableHandle,
20294                        { fidl::ObjectType::NONE.into_raw() },
20295                        2147483648,
20296                    >,
20297                    fidl::encoding::DefaultFuchsiaResourceDialect,
20298                >(
20299                    <fidl::encoding::HandleType<
20300                        fidl::NullableHandle,
20301                        { fidl::ObjectType::NONE.into_raw() },
20302                        2147483648,
20303                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
20304                        val
20305                    ),
20306                    encoder,
20307                    offset + 8,
20308                    _depth,
20309                ),
20310                WaitFence::Timestamp(ref mut val) => fidl::encoding::encode_in_envelope::<
20311                    fidl::encoding::HandleType<
20312                        fidl::Counter,
20313                        { fidl::ObjectType::COUNTER.into_raw() },
20314                        2147483648,
20315                    >,
20316                    fidl::encoding::DefaultFuchsiaResourceDialect,
20317                >(
20318                    <fidl::encoding::HandleType<
20319                        fidl::Counter,
20320                        { fidl::ObjectType::COUNTER.into_raw() },
20321                        2147483648,
20322                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
20323                        val
20324                    ),
20325                    encoder,
20326                    offset + 8,
20327                    _depth,
20328                ),
20329            }
20330        }
20331    }
20332
20333    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for WaitFence {
20334        #[inline(always)]
20335        fn new_empty() -> Self {
20336            Self::Basic(
20337                fidl::new_empty!(fidl::encoding::HandleType<fidl::NullableHandle, { fidl::ObjectType::NONE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
20338            )
20339        }
20340
20341        #[inline]
20342        unsafe fn decode(
20343            &mut self,
20344            decoder: &mut fidl::encoding::Decoder<
20345                '_,
20346                fidl::encoding::DefaultFuchsiaResourceDialect,
20347            >,
20348            offset: usize,
20349            mut depth: fidl::encoding::Depth,
20350        ) -> fidl::Result<()> {
20351            decoder.debug_check_bounds::<Self>(offset);
20352            #[allow(unused_variables)]
20353            let next_out_of_line = decoder.next_out_of_line();
20354            let handles_before = decoder.remaining_handles();
20355            let (ordinal, inlined, num_bytes, num_handles) =
20356                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
20357
20358            let member_inline_size = match ordinal {
20359                1 => <fidl::encoding::HandleType<
20360                    fidl::NullableHandle,
20361                    { fidl::ObjectType::NONE.into_raw() },
20362                    2147483648,
20363                > as fidl::encoding::TypeMarker>::inline_size(decoder.context),
20364                2 => <fidl::encoding::HandleType<
20365                    fidl::Counter,
20366                    { fidl::ObjectType::COUNTER.into_raw() },
20367                    2147483648,
20368                > as fidl::encoding::TypeMarker>::inline_size(decoder.context),
20369                _ => return Err(fidl::Error::UnknownUnionTag),
20370            };
20371
20372            if inlined != (member_inline_size <= 4) {
20373                return Err(fidl::Error::InvalidInlineBitInEnvelope);
20374            }
20375            let _inner_offset;
20376            if inlined {
20377                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
20378                _inner_offset = offset + 8;
20379            } else {
20380                depth.increment()?;
20381                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
20382            }
20383            match ordinal {
20384                1 => {
20385                    #[allow(irrefutable_let_patterns)]
20386                    if let WaitFence::Basic(_) = self {
20387                        // Do nothing, read the value into the object
20388                    } else {
20389                        // Initialize `self` to the right variant
20390                        *self = WaitFence::Basic(
20391                            fidl::new_empty!(fidl::encoding::HandleType<fidl::NullableHandle, { fidl::ObjectType::NONE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
20392                        );
20393                    }
20394                    #[allow(irrefutable_let_patterns)]
20395                    if let WaitFence::Basic(ref mut val) = self {
20396                        fidl::decode!(fidl::encoding::HandleType<fidl::NullableHandle, { fidl::ObjectType::NONE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val, decoder, _inner_offset, depth)?;
20397                    } else {
20398                        unreachable!()
20399                    }
20400                }
20401                2 => {
20402                    #[allow(irrefutable_let_patterns)]
20403                    if let WaitFence::Timestamp(_) = self {
20404                        // Do nothing, read the value into the object
20405                    } else {
20406                        // Initialize `self` to the right variant
20407                        *self = WaitFence::Timestamp(
20408                            fidl::new_empty!(fidl::encoding::HandleType<fidl::Counter, { fidl::ObjectType::COUNTER.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
20409                        );
20410                    }
20411                    #[allow(irrefutable_let_patterns)]
20412                    if let WaitFence::Timestamp(ref mut val) = self {
20413                        fidl::decode!(fidl::encoding::HandleType<fidl::Counter, { fidl::ObjectType::COUNTER.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val, decoder, _inner_offset, depth)?;
20414                    } else {
20415                        unreachable!()
20416                    }
20417                }
20418                ordinal => panic!("unexpected ordinal {:?}", ordinal),
20419            }
20420            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
20421                return Err(fidl::Error::InvalidNumBytesInEnvelope);
20422            }
20423            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
20424                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
20425            }
20426            Ok(())
20427        }
20428    }
20429}