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_token`. It will not block on buffers
384    /// being allocated until the client creates content using the BufferCollection.
385    ///
386    /// The buffer collection registered with `export_token` is available and kept alive as long
387    /// as the client holds a valid [`BufferCollectionImportToken`]. They will be garbage collected
388    /// when all [`BufferCollectionImportToken`]s are closed and all the associated Image resources
389    /// are released.
390    ///
391    /// Exactly one of `buffer_collection_token2` / `buffer_collection_token` must be set.
392    pub buffer_collection_token2:
393        Option<fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem2::BufferCollectionTokenMarker>>,
394    #[doc(hidden)]
395    pub __source_breaking: fidl::marker::SourceBreaking,
396}
397
398impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
399    for RegisterBufferCollectionArgs
400{
401}
402
403/// The arguments passed into the [`Configure`] call. Note that not all fields are necessary.
404#[derive(Debug, Default, PartialEq)]
405pub struct ScreenCaptureConfig {
406    /// The import token referencing a BufferCollection registered with
407    /// Allocator. Required.
408    pub import_token: Option<BufferCollectionImportToken>,
409    /// The size of the image in pixels. Required.
410    pub size: Option<fidl_fuchsia_math::SizeU>,
411    /// The number of buffers in the BufferCollection. Required.
412    pub buffer_count: Option<u32>,
413    /// The rotation to be applied to the stream of images. Optional; if absent no rotation is
414    /// applied.
415    pub rotation: Option<Rotation>,
416    #[doc(hidden)]
417    pub __source_breaking: fidl::marker::SourceBreaking,
418}
419
420impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for ScreenCaptureConfig {}
421
422#[derive(Debug, Default, PartialEq)]
423pub struct ScreenshotTakeFileRequest {
424    /// Format of the requested screenshot.
425    pub format: Option<ScreenshotFormat>,
426    #[doc(hidden)]
427    pub __source_breaking: fidl::marker::SourceBreaking,
428}
429
430impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for ScreenshotTakeFileRequest {}
431
432#[derive(Debug, Default, PartialEq)]
433pub struct ScreenshotTakeFileResponse {
434    /// |fuchsia.io.File| channel used to read the generated screenshot file data.
435    /// The server side of the channel is stored on the device until ZX_CHANNEL_PEER_CLOSED
436    /// is detected.
437    ///
438    /// Basic usage: After the client recieves the client end of the file channel,
439    /// to avoid memory pile-ups, it should finish reading the data
440    /// before calling [`TakeFile`] again. When finished reading,
441    /// the client should call [`Close`] on the |fuchsia.io.File| channel, this will release
442    /// the memory allocated on the server side.
443    pub file: Option<fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>>,
444    /// Size of the screenshot in pixels.
445    pub size: Option<fidl_fuchsia_math::SizeU>,
446    #[doc(hidden)]
447    pub __source_breaking: fidl::marker::SourceBreaking,
448}
449
450impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
451    for ScreenshotTakeFileResponse
452{
453}
454
455#[derive(Debug, Default, PartialEq)]
456pub struct ScreenshotTakeRequest {
457    /// Format of the requested screenshot.
458    pub format: Option<ScreenshotFormat>,
459    #[doc(hidden)]
460    pub __source_breaking: fidl::marker::SourceBreaking,
461}
462
463impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for ScreenshotTakeRequest {}
464
465#[derive(Debug, Default, PartialEq)]
466pub struct ScreenshotTakeResponse {
467    /// CPU mappable read-only VMO that contains screenshot data. The server owns the VMO and
468    /// may reuse for the next [`Take`]. The VMO is guaranteed to be accessible after mapping.
469    /// In some allocations, VMO::read() might not be available, i.e. on emulator.
470    ///
471    /// Basic usage: After the client receives a VMO handle, to ensure data stability, it should
472    /// finish reading the VMO before calling [`Take`] again. When finished reading, the client
473    /// should drop the VMO handle.
474    ///
475    /// Advanced usage: To edit the data, or to persist it beyond the next [`Take`] call, the
476    /// client should copy the data to a private VMO.
477    pub vmo: Option<fidl::Vmo>,
478    /// Size of the screenshot in pixels.
479    pub size: Option<fidl_fuchsia_math::SizeU>,
480    #[doc(hidden)]
481    pub __source_breaking: fidl::marker::SourceBreaking,
482}
483
484impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for ScreenshotTakeResponse {}
485
486/// All arguments are optional; default values will be provided if they are absent.
487/// By default, the resulting Flatland will behave identically to connecting
488/// to the [Flatland] service instead of connecting via the factory.
489#[derive(Debug, Default, PartialEq)]
490pub struct TrustedFlatlandConfig {
491    /// If true and the [PresentArgs.requested_presentation_time] passed to [Flatland.Present] is
492    /// set to 0 or less than or equal to the nearest presentation time, a frame will be scheduled
493    /// to be presented as soon as all acquire fences are signaled, instead of waiting for other
494    /// clients to present within the same vsync. This allows the caller to decide when to wake up
495    /// for preparing a frame.
496    ///
497    /// If [requested_presentation_time] is set to a value greater than the nearest presentation
498    /// time, this flag will have no effect and the wakeup time decision will be made by the
499    /// scheduler.
500    ///
501    /// If absent, `schedule_asap` is false.
502    pub schedule_asap: Option<bool>,
503    /// If true, Scenic should pass acquire fences to the drivers for composition HW, instead of
504    /// waiting for them on CPU. This can improve performance by reducing CPU overhead.
505    ///
506    /// If absent, `pass_acquire_fences` is false.
507    pub pass_acquire_fences: Option<bool>,
508    /// If true, the client will not utilize Flatland's built in frame-scheduling mechanism and
509    /// will ignore present credits, instead relying on their own flow control system.
510    ///
511    /// If absent, `skips_present_credits` is false.
512    pub skips_present_credits: Option<bool>,
513    /// If true, the client will not receive [Flatland.OnFramePresented] events.
514    ///
515    /// If absent, `skips_on_frame_presented` is false.
516    pub skips_on_frame_presented: Option<bool>,
517    /// If true, clients may use the [`fuchsia.ui.composition/Flatland2`] protocol, which is
518    /// composed into the "classic" [`fuchsia.ui.composition/Flatland`] protocol.
519    ///
520    /// Note: some "classic" Flatland methods are disabled when Flatland2 is enabled; see the
521    /// [`fuchsia.ui.composition/Flatland2`] documentation for details.
522    ///
523    /// If absent, `use_flatland2_api` is false.
524    pub use_flatland2_api: Option<bool>,
525    #[doc(hidden)]
526    pub __source_breaking: fidl::marker::SourceBreaking,
527}
528
529impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for TrustedFlatlandConfig {}
530
531/// The protocol endpoints bound to a Flatland ViewCreationToken. These protocols operate on the
532/// View that ViewCreationToken created in the Flatland session.
533#[derive(Debug, Default, PartialEq)]
534pub struct ViewBoundProtocols {
535    /// Learn when a View gains focus.
536    ///
537    /// Server-bound ViewRef. The [`view_ref_focused`] client does not specify the ViewRef
538    /// explicitly; instead, the server implementation uses the ViewRef used in View creation for
539    /// reporting focus movement on/off this View.
540    pub view_ref_focused:
541        Option<fidl::endpoints::ServerEnd<fidl_fuchsia_ui_views::ViewRefFocusedMarker>>,
542    /// Enable a View to request focus transfer to a child (target) View.
543    ///
544    /// Server-bound ViewRef. The [`view_focuser`] client does not specify the "requester" ViewRef
545    /// explicitly, only the "target" ViewRef. Instead, the server implementation uses the ViewRef
546    /// used in View creation as the "requester" ViewRef.
547    pub view_focuser: Option<fidl::endpoints::ServerEnd<fidl_fuchsia_ui_views::FocuserMarker>>,
548    /// Receive touch events that are associated with a View.
549    /// Mutually exclusive with `touch_source_v2`. Providing both will result in
550    /// a `FlatlandError.BAD_OPERATION` error and channel closure.
551    pub touch_source:
552        Option<fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::TouchSourceMarker>>,
553    /// Receive mouse events that are associated with a View.
554    /// Mutually exclusive with `mouse_source_v2`. Providing both will result in
555    /// a `FlatlandError.BAD_OPERATION` error and channel closure.
556    pub mouse_source:
557        Option<fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::MouseSourceMarker>>,
558    /// Receive touch events that are associated with a View.
559    /// Mutually exclusive with `touch_source`. Providing both will result in
560    /// a `FlatlandError.BAD_OPERATION` error and channel closure.
561    pub touch_source_v2:
562        Option<fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::TouchSourceV2Marker>>,
563    /// Receive mouse events that are associated with a View.
564    /// Mutually exclusive with `mouse_source`. Providing both will result in
565    /// a `FlatlandError.BAD_OPERATION` error and channel closure.
566    pub mouse_source_v2:
567        Option<fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::MouseSourceV2Marker>>,
568    #[doc(hidden)]
569    pub __source_breaking: fidl::marker::SourceBreaking,
570}
571
572impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for ViewBoundProtocols {}
573
574/// A fence that will be signaled by Scenic when some condition becomes true.
575/// For more details, refer to the method the fence appears in.
576#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
577pub enum SignalFence {
578    /// A basic handle (e.g., EVENT or EVENTPAIR).
579    Basic(fidl::NullableHandle),
580    /// Before Scenic signals the fence, it will write the timestamp of
581    /// the corresponding event into the counter.
582    Timestamp(fidl::Counter),
583}
584
585impl SignalFence {
586    #[inline]
587    pub fn ordinal(&self) -> u64 {
588        match *self {
589            Self::Basic(_) => 1,
590            Self::Timestamp(_) => 2,
591        }
592    }
593}
594
595impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for SignalFence {}
596
597/// A fence that will be signaled when the associated resource is ready for Scenic to use.
598/// For context-specific usage info, refer to the method the fence appears in.
599#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
600pub enum WaitFence {
601    /// A basic handle (e.g., EVENT or EVENTPAIR).
602    Basic(fidl::NullableHandle),
603    /// At the time the fence is signalled, the timestamp of the
604    /// corresponding event will have been written into the counter.
605    Timestamp(fidl::Counter),
606}
607
608impl WaitFence {
609    #[inline]
610    pub fn ordinal(&self) -> u64 {
611        match *self {
612            Self::Basic(_) => 1,
613            Self::Timestamp(_) => 2,
614        }
615    }
616}
617
618impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for WaitFence {}
619
620#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
621pub struct AllocatorMarker;
622
623impl fidl::endpoints::ProtocolMarker for AllocatorMarker {
624    type Proxy = AllocatorProxy;
625    type RequestStream = AllocatorRequestStream;
626    #[cfg(target_os = "fuchsia")]
627    type SynchronousProxy = AllocatorSynchronousProxy;
628
629    const DEBUG_NAME: &'static str = "fuchsia.ui.composition.Allocator";
630}
631impl fidl::endpoints::DiscoverableProtocolMarker for AllocatorMarker {}
632pub type AllocatorRegisterBufferCollectionResult = Result<(), RegisterBufferCollectionError>;
633
634pub trait AllocatorProxyInterface: Send + Sync {
635    type RegisterBufferCollectionResponseFut: std::future::Future<Output = Result<AllocatorRegisterBufferCollectionResult, fidl::Error>>
636        + Send;
637    fn r#register_buffer_collection(
638        &self,
639        args: RegisterBufferCollectionArgs,
640    ) -> Self::RegisterBufferCollectionResponseFut;
641}
642#[derive(Debug)]
643#[cfg(target_os = "fuchsia")]
644pub struct AllocatorSynchronousProxy {
645    client: fidl::client::sync::Client,
646}
647
648#[cfg(target_os = "fuchsia")]
649impl fidl::endpoints::SynchronousProxy for AllocatorSynchronousProxy {
650    type Proxy = AllocatorProxy;
651    type Protocol = AllocatorMarker;
652
653    fn from_channel(inner: fidl::Channel) -> Self {
654        Self::new(inner)
655    }
656
657    fn into_channel(self) -> fidl::Channel {
658        self.client.into_channel()
659    }
660
661    fn as_channel(&self) -> &fidl::Channel {
662        self.client.as_channel()
663    }
664}
665
666#[cfg(target_os = "fuchsia")]
667impl AllocatorSynchronousProxy {
668    pub fn new(channel: fidl::Channel) -> Self {
669        Self { client: fidl::client::sync::Client::new(channel) }
670    }
671
672    pub fn into_channel(self) -> fidl::Channel {
673        self.client.into_channel()
674    }
675
676    /// Waits until an event arrives and returns it. It is safe for other
677    /// threads to make concurrent requests while waiting for an event.
678    pub fn wait_for_event(
679        &self,
680        deadline: zx::MonotonicInstant,
681    ) -> Result<AllocatorEvent, fidl::Error> {
682        AllocatorEvent::decode(self.client.wait_for_event::<AllocatorMarker>(deadline)?)
683    }
684
685    /// A BufferCollection is a set of VMOs created by Sysmem and shared by a number of
686    /// participants, one of which is the Flatland Renderer. Some content, such as Images, use a
687    /// BufferCollection as their backing memory.
688    ///
689    /// See [`RegisterBufferCollectionArgs`] for information on each argument.
690    pub fn r#register_buffer_collection(
691        &self,
692        mut args: RegisterBufferCollectionArgs,
693        ___deadline: zx::MonotonicInstant,
694    ) -> Result<AllocatorRegisterBufferCollectionResult, fidl::Error> {
695        let _response = self
696            .client
697            .send_query::<AllocatorRegisterBufferCollectionRequest, fidl::encoding::ResultType<
698                fidl::encoding::EmptyStruct,
699                RegisterBufferCollectionError,
700            >, AllocatorMarker>(
701                (&mut args,),
702                0x494b7ea578d1061e,
703                fidl::encoding::DynamicFlags::empty(),
704                ___deadline,
705            )?;
706        Ok(_response.map(|x| x))
707    }
708}
709
710#[cfg(target_os = "fuchsia")]
711impl From<AllocatorSynchronousProxy> for zx::NullableHandle {
712    fn from(value: AllocatorSynchronousProxy) -> Self {
713        value.into_channel().into()
714    }
715}
716
717#[cfg(target_os = "fuchsia")]
718impl From<fidl::Channel> for AllocatorSynchronousProxy {
719    fn from(value: fidl::Channel) -> Self {
720        Self::new(value)
721    }
722}
723
724#[cfg(target_os = "fuchsia")]
725impl fidl::endpoints::FromClient for AllocatorSynchronousProxy {
726    type Protocol = AllocatorMarker;
727
728    fn from_client(value: fidl::endpoints::ClientEnd<AllocatorMarker>) -> Self {
729        Self::new(value.into_channel())
730    }
731}
732
733#[derive(Debug, Clone)]
734pub struct AllocatorProxy {
735    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
736}
737
738impl fidl::endpoints::Proxy for AllocatorProxy {
739    type Protocol = AllocatorMarker;
740
741    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
742        Self::new(inner)
743    }
744
745    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
746        self.client.into_channel().map_err(|client| Self { client })
747    }
748
749    fn as_channel(&self) -> &::fidl::AsyncChannel {
750        self.client.as_channel()
751    }
752}
753
754impl AllocatorProxy {
755    /// Create a new Proxy for fuchsia.ui.composition/Allocator.
756    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
757        let protocol_name = <AllocatorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
758        Self { client: fidl::client::Client::new(channel, protocol_name) }
759    }
760
761    /// Get a Stream of events from the remote end of the protocol.
762    ///
763    /// # Panics
764    ///
765    /// Panics if the event stream was already taken.
766    pub fn take_event_stream(&self) -> AllocatorEventStream {
767        AllocatorEventStream { event_receiver: self.client.take_event_receiver() }
768    }
769
770    /// A BufferCollection is a set of VMOs created by Sysmem and shared by a number of
771    /// participants, one of which is the Flatland Renderer. Some content, such as Images, use a
772    /// BufferCollection as their backing memory.
773    ///
774    /// See [`RegisterBufferCollectionArgs`] for information on each argument.
775    pub fn r#register_buffer_collection(
776        &self,
777        mut args: RegisterBufferCollectionArgs,
778    ) -> fidl::client::QueryResponseFut<
779        AllocatorRegisterBufferCollectionResult,
780        fidl::encoding::DefaultFuchsiaResourceDialect,
781    > {
782        AllocatorProxyInterface::r#register_buffer_collection(self, args)
783    }
784}
785
786impl AllocatorProxyInterface for AllocatorProxy {
787    type RegisterBufferCollectionResponseFut = fidl::client::QueryResponseFut<
788        AllocatorRegisterBufferCollectionResult,
789        fidl::encoding::DefaultFuchsiaResourceDialect,
790    >;
791    fn r#register_buffer_collection(
792        &self,
793        mut args: RegisterBufferCollectionArgs,
794    ) -> Self::RegisterBufferCollectionResponseFut {
795        fn _decode(
796            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
797        ) -> Result<AllocatorRegisterBufferCollectionResult, fidl::Error> {
798            let _response = fidl::client::decode_transaction_body::<
799                fidl::encoding::ResultType<
800                    fidl::encoding::EmptyStruct,
801                    RegisterBufferCollectionError,
802                >,
803                fidl::encoding::DefaultFuchsiaResourceDialect,
804                0x494b7ea578d1061e,
805            >(_buf?)?;
806            Ok(_response.map(|x| x))
807        }
808        self.client.send_query_and_decode::<
809            AllocatorRegisterBufferCollectionRequest,
810            AllocatorRegisterBufferCollectionResult,
811        >(
812            (&mut args,),
813            0x494b7ea578d1061e,
814            fidl::encoding::DynamicFlags::empty(),
815            _decode,
816        )
817    }
818}
819
820pub struct AllocatorEventStream {
821    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
822}
823
824impl std::marker::Unpin for AllocatorEventStream {}
825
826impl futures::stream::FusedStream for AllocatorEventStream {
827    fn is_terminated(&self) -> bool {
828        self.event_receiver.is_terminated()
829    }
830}
831
832impl futures::Stream for AllocatorEventStream {
833    type Item = Result<AllocatorEvent, fidl::Error>;
834
835    fn poll_next(
836        mut self: std::pin::Pin<&mut Self>,
837        cx: &mut std::task::Context<'_>,
838    ) -> std::task::Poll<Option<Self::Item>> {
839        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
840            &mut self.event_receiver,
841            cx
842        )?) {
843            Some(buf) => std::task::Poll::Ready(Some(AllocatorEvent::decode(buf))),
844            None => std::task::Poll::Ready(None),
845        }
846    }
847}
848
849#[derive(Debug)]
850pub enum AllocatorEvent {}
851
852impl AllocatorEvent {
853    /// Decodes a message buffer as a [`AllocatorEvent`].
854    fn decode(
855        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
856    ) -> Result<AllocatorEvent, fidl::Error> {
857        let (bytes, _handles) = buf.split_mut();
858        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
859        debug_assert_eq!(tx_header.tx_id, 0);
860        match tx_header.ordinal {
861            _ => Err(fidl::Error::UnknownOrdinal {
862                ordinal: tx_header.ordinal,
863                protocol_name: <AllocatorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
864            }),
865        }
866    }
867}
868
869/// A Stream of incoming requests for fuchsia.ui.composition/Allocator.
870pub struct AllocatorRequestStream {
871    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
872    is_terminated: bool,
873}
874
875impl std::marker::Unpin for AllocatorRequestStream {}
876
877impl futures::stream::FusedStream for AllocatorRequestStream {
878    fn is_terminated(&self) -> bool {
879        self.is_terminated
880    }
881}
882
883impl fidl::endpoints::RequestStream for AllocatorRequestStream {
884    type Protocol = AllocatorMarker;
885    type ControlHandle = AllocatorControlHandle;
886
887    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
888        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
889    }
890
891    fn control_handle(&self) -> Self::ControlHandle {
892        AllocatorControlHandle { inner: self.inner.clone() }
893    }
894
895    fn into_inner(
896        self,
897    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
898    {
899        (self.inner, self.is_terminated)
900    }
901
902    fn from_inner(
903        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
904        is_terminated: bool,
905    ) -> Self {
906        Self { inner, is_terminated }
907    }
908}
909
910impl futures::Stream for AllocatorRequestStream {
911    type Item = Result<AllocatorRequest, fidl::Error>;
912
913    fn poll_next(
914        mut self: std::pin::Pin<&mut Self>,
915        cx: &mut std::task::Context<'_>,
916    ) -> std::task::Poll<Option<Self::Item>> {
917        let this = &mut *self;
918        if this.inner.check_shutdown(cx) {
919            this.is_terminated = true;
920            return std::task::Poll::Ready(None);
921        }
922        if this.is_terminated {
923            panic!("polled AllocatorRequestStream after completion");
924        }
925        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
926            |bytes, handles| {
927                match this.inner.channel().read_etc(cx, bytes, handles) {
928                    std::task::Poll::Ready(Ok(())) => {}
929                    std::task::Poll::Pending => return std::task::Poll::Pending,
930                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
931                        this.is_terminated = true;
932                        return std::task::Poll::Ready(None);
933                    }
934                    std::task::Poll::Ready(Err(e)) => {
935                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
936                            e.into(),
937                        ))));
938                    }
939                }
940
941                // A message has been received from the channel
942                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
943
944                std::task::Poll::Ready(Some(match header.ordinal {
945                    0x494b7ea578d1061e => {
946                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
947                        let mut req = fidl::new_empty!(
948                            AllocatorRegisterBufferCollectionRequest,
949                            fidl::encoding::DefaultFuchsiaResourceDialect
950                        );
951                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AllocatorRegisterBufferCollectionRequest>(&header, _body_bytes, handles, &mut req)?;
952                        let control_handle = AllocatorControlHandle { inner: this.inner.clone() };
953                        Ok(AllocatorRequest::RegisterBufferCollection {
954                            args: req.args,
955
956                            responder: AllocatorRegisterBufferCollectionResponder {
957                                control_handle: std::mem::ManuallyDrop::new(control_handle),
958                                tx_id: header.tx_id,
959                            },
960                        })
961                    }
962                    _ => Err(fidl::Error::UnknownOrdinal {
963                        ordinal: header.ordinal,
964                        protocol_name:
965                            <AllocatorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
966                    }),
967                }))
968            },
969        )
970    }
971}
972
973#[derive(Debug)]
974pub enum AllocatorRequest {
975    /// A BufferCollection is a set of VMOs created by Sysmem and shared by a number of
976    /// participants, one of which is the Flatland Renderer. Some content, such as Images, use a
977    /// BufferCollection as their backing memory.
978    ///
979    /// See [`RegisterBufferCollectionArgs`] for information on each argument.
980    RegisterBufferCollection {
981        args: RegisterBufferCollectionArgs,
982        responder: AllocatorRegisterBufferCollectionResponder,
983    },
984}
985
986impl AllocatorRequest {
987    #[allow(irrefutable_let_patterns)]
988    pub fn into_register_buffer_collection(
989        self,
990    ) -> Option<(RegisterBufferCollectionArgs, AllocatorRegisterBufferCollectionResponder)> {
991        if let AllocatorRequest::RegisterBufferCollection { args, responder } = self {
992            Some((args, responder))
993        } else {
994            None
995        }
996    }
997
998    /// Name of the method defined in FIDL
999    pub fn method_name(&self) -> &'static str {
1000        match *self {
1001            AllocatorRequest::RegisterBufferCollection { .. } => "register_buffer_collection",
1002        }
1003    }
1004}
1005
1006#[derive(Debug, Clone)]
1007pub struct AllocatorControlHandle {
1008    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1009}
1010
1011impl AllocatorControlHandle {
1012    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
1013        self.inner.shutdown_with_epitaph(status.into())
1014    }
1015}
1016
1017impl fidl::endpoints::ControlHandle for AllocatorControlHandle {
1018    fn shutdown(&self) {
1019        self.inner.shutdown()
1020    }
1021
1022    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
1023        self.inner.shutdown_with_epitaph(status)
1024    }
1025
1026    fn is_closed(&self) -> bool {
1027        self.inner.channel().is_closed()
1028    }
1029    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1030        self.inner.channel().on_closed()
1031    }
1032
1033    #[cfg(target_os = "fuchsia")]
1034    fn signal_peer(
1035        &self,
1036        clear_mask: zx::Signals,
1037        set_mask: zx::Signals,
1038    ) -> Result<(), zx_status::Status> {
1039        use fidl::Peered;
1040        self.inner.channel().signal_peer(clear_mask, set_mask)
1041    }
1042}
1043
1044impl AllocatorControlHandle {}
1045
1046#[must_use = "FIDL methods require a response to be sent"]
1047#[derive(Debug)]
1048pub struct AllocatorRegisterBufferCollectionResponder {
1049    control_handle: std::mem::ManuallyDrop<AllocatorControlHandle>,
1050    tx_id: u32,
1051}
1052
1053/// Set the the channel to be shutdown (see [`AllocatorControlHandle::shutdown`])
1054/// if the responder is dropped without sending a response, so that the client
1055/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1056impl std::ops::Drop for AllocatorRegisterBufferCollectionResponder {
1057    fn drop(&mut self) {
1058        self.control_handle.shutdown();
1059        // Safety: drops once, never accessed again
1060        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1061    }
1062}
1063
1064impl fidl::endpoints::Responder for AllocatorRegisterBufferCollectionResponder {
1065    type ControlHandle = AllocatorControlHandle;
1066
1067    fn control_handle(&self) -> &AllocatorControlHandle {
1068        &self.control_handle
1069    }
1070
1071    fn drop_without_shutdown(mut self) {
1072        // Safety: drops once, never accessed again due to mem::forget
1073        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1074        // Prevent Drop from running (which would shut down the channel)
1075        std::mem::forget(self);
1076    }
1077}
1078
1079impl AllocatorRegisterBufferCollectionResponder {
1080    /// Sends a response to the FIDL transaction.
1081    ///
1082    /// Sets the channel to shutdown if an error occurs.
1083    pub fn send(
1084        self,
1085        mut result: Result<(), RegisterBufferCollectionError>,
1086    ) -> Result<(), fidl::Error> {
1087        let _result = self.send_raw(result);
1088        if _result.is_err() {
1089            self.control_handle.shutdown();
1090        }
1091        self.drop_without_shutdown();
1092        _result
1093    }
1094
1095    /// Similar to "send" but does not shutdown the channel if an error occurs.
1096    pub fn send_no_shutdown_on_err(
1097        self,
1098        mut result: Result<(), RegisterBufferCollectionError>,
1099    ) -> Result<(), fidl::Error> {
1100        let _result = self.send_raw(result);
1101        self.drop_without_shutdown();
1102        _result
1103    }
1104
1105    fn send_raw(
1106        &self,
1107        mut result: Result<(), RegisterBufferCollectionError>,
1108    ) -> Result<(), fidl::Error> {
1109        self.control_handle.inner.send::<fidl::encoding::ResultType<
1110            fidl::encoding::EmptyStruct,
1111            RegisterBufferCollectionError,
1112        >>(
1113            result,
1114            self.tx_id,
1115            0x494b7ea578d1061e,
1116            fidl::encoding::DynamicFlags::empty(),
1117        )
1118    }
1119}
1120
1121#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1122pub struct ChildViewWatcherMarker;
1123
1124impl fidl::endpoints::ProtocolMarker for ChildViewWatcherMarker {
1125    type Proxy = ChildViewWatcherProxy;
1126    type RequestStream = ChildViewWatcherRequestStream;
1127    #[cfg(target_os = "fuchsia")]
1128    type SynchronousProxy = ChildViewWatcherSynchronousProxy;
1129
1130    const DEBUG_NAME: &'static str = "(anonymous) ChildViewWatcher";
1131}
1132
1133pub trait ChildViewWatcherProxyInterface: Send + Sync {
1134    type GetStatusResponseFut: std::future::Future<Output = Result<ChildViewStatus, fidl::Error>>
1135        + Send;
1136    fn r#get_status(&self) -> Self::GetStatusResponseFut;
1137    type GetViewRefResponseFut: std::future::Future<Output = Result<fidl_fuchsia_ui_views::ViewRef, fidl::Error>>
1138        + Send;
1139    fn r#get_view_ref(&self) -> Self::GetViewRefResponseFut;
1140}
1141#[derive(Debug)]
1142#[cfg(target_os = "fuchsia")]
1143pub struct ChildViewWatcherSynchronousProxy {
1144    client: fidl::client::sync::Client,
1145}
1146
1147#[cfg(target_os = "fuchsia")]
1148impl fidl::endpoints::SynchronousProxy for ChildViewWatcherSynchronousProxy {
1149    type Proxy = ChildViewWatcherProxy;
1150    type Protocol = ChildViewWatcherMarker;
1151
1152    fn from_channel(inner: fidl::Channel) -> Self {
1153        Self::new(inner)
1154    }
1155
1156    fn into_channel(self) -> fidl::Channel {
1157        self.client.into_channel()
1158    }
1159
1160    fn as_channel(&self) -> &fidl::Channel {
1161        self.client.as_channel()
1162    }
1163}
1164
1165#[cfg(target_os = "fuchsia")]
1166impl ChildViewWatcherSynchronousProxy {
1167    pub fn new(channel: fidl::Channel) -> Self {
1168        Self { client: fidl::client::sync::Client::new(channel) }
1169    }
1170
1171    pub fn into_channel(self) -> fidl::Channel {
1172        self.client.into_channel()
1173    }
1174
1175    /// Waits until an event arrives and returns it. It is safe for other
1176    /// threads to make concurrent requests while waiting for an event.
1177    pub fn wait_for_event(
1178        &self,
1179        deadline: zx::MonotonicInstant,
1180    ) -> Result<ChildViewWatcherEvent, fidl::Error> {
1181        ChildViewWatcherEvent::decode(
1182            self.client.wait_for_event::<ChildViewWatcherMarker>(deadline)?,
1183        )
1184    }
1185
1186    /// A hanging get for receiving the status of a View. This provides information to the parent,
1187    /// such as whether or not the child has successfully presented content through this View.
1188    ///
1189    /// This hanging get will only fire when the ChildViewStatus is different than the previously
1190    /// returned ChildViewStatus.  This can happen immediately, and even if the creator of the
1191    /// Viewport hasn't yet called Present() after calling CreateViewport().  This allows the parent
1192    /// to know that the child has content ready to display before the parent modifies their own
1193    /// local scene graph to incorporate the child content.
1194    ///
1195    /// It is invalid to call `GetStatus` while a previous call is still pending. Doing so will
1196    /// cause both this channel and the Flatland channel that handed out ChildViewWatcher to be
1197    /// closed.
1198    pub fn r#get_status(
1199        &self,
1200        ___deadline: zx::MonotonicInstant,
1201    ) -> Result<ChildViewStatus, fidl::Error> {
1202        let _response = self.client.send_query::<
1203            fidl::encoding::EmptyPayload,
1204            ChildViewWatcherGetStatusResponse,
1205            ChildViewWatcherMarker,
1206        >(
1207            (),
1208            0x1d622075f4fc8243,
1209            fidl::encoding::DynamicFlags::empty(),
1210            ___deadline,
1211        )?;
1212        Ok(_response.status)
1213    }
1214
1215    /// Hanging get to receive the ViewRef of the child View. This will only fire when the View ref
1216    /// is different from the previously-returned View ref. Note: currently the View ref will not
1217    /// change after it is first received, but this will change if/when the API changes to allow
1218    /// relinking of views.
1219    ///
1220    /// The ViewRef is not returned until the View is included in the View tree, in other words when
1221    /// there is a chain of ancestor transforms all the way back up to the root of the scene graph,
1222    /// i.e. the display.
1223    ///
1224    /// It is invalid to call `GetViewRef` while a previous call is still pending. Doing so will
1225    /// cause both this channel and the Flatland channel that handed out ChildViewWatcher to be
1226    /// closed.
1227    ///
1228    /// A `GetViewRef` call will hang if the View was created using `CreateView`, but returns the
1229    /// View if the View was created using CreateView2. This is because `CreateView` does not mint
1230    /// a ViewRef for that View.
1231    pub fn r#get_view_ref(
1232        &self,
1233        ___deadline: zx::MonotonicInstant,
1234    ) -> Result<fidl_fuchsia_ui_views::ViewRef, fidl::Error> {
1235        let _response = self.client.send_query::<
1236            fidl::encoding::EmptyPayload,
1237            ChildViewWatcherGetViewRefResponse,
1238            ChildViewWatcherMarker,
1239        >(
1240            (),
1241            0x3b2f3ca31e8908b4,
1242            fidl::encoding::DynamicFlags::empty(),
1243            ___deadline,
1244        )?;
1245        Ok(_response.view_ref)
1246    }
1247}
1248
1249#[cfg(target_os = "fuchsia")]
1250impl From<ChildViewWatcherSynchronousProxy> for zx::NullableHandle {
1251    fn from(value: ChildViewWatcherSynchronousProxy) -> Self {
1252        value.into_channel().into()
1253    }
1254}
1255
1256#[cfg(target_os = "fuchsia")]
1257impl From<fidl::Channel> for ChildViewWatcherSynchronousProxy {
1258    fn from(value: fidl::Channel) -> Self {
1259        Self::new(value)
1260    }
1261}
1262
1263#[cfg(target_os = "fuchsia")]
1264impl fidl::endpoints::FromClient for ChildViewWatcherSynchronousProxy {
1265    type Protocol = ChildViewWatcherMarker;
1266
1267    fn from_client(value: fidl::endpoints::ClientEnd<ChildViewWatcherMarker>) -> Self {
1268        Self::new(value.into_channel())
1269    }
1270}
1271
1272#[derive(Debug, Clone)]
1273pub struct ChildViewWatcherProxy {
1274    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1275}
1276
1277impl fidl::endpoints::Proxy for ChildViewWatcherProxy {
1278    type Protocol = ChildViewWatcherMarker;
1279
1280    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1281        Self::new(inner)
1282    }
1283
1284    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1285        self.client.into_channel().map_err(|client| Self { client })
1286    }
1287
1288    fn as_channel(&self) -> &::fidl::AsyncChannel {
1289        self.client.as_channel()
1290    }
1291}
1292
1293impl ChildViewWatcherProxy {
1294    /// Create a new Proxy for fuchsia.ui.composition/ChildViewWatcher.
1295    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1296        let protocol_name = <ChildViewWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1297        Self { client: fidl::client::Client::new(channel, protocol_name) }
1298    }
1299
1300    /// Get a Stream of events from the remote end of the protocol.
1301    ///
1302    /// # Panics
1303    ///
1304    /// Panics if the event stream was already taken.
1305    pub fn take_event_stream(&self) -> ChildViewWatcherEventStream {
1306        ChildViewWatcherEventStream { event_receiver: self.client.take_event_receiver() }
1307    }
1308
1309    /// A hanging get for receiving the status of a View. This provides information to the parent,
1310    /// such as whether or not the child has successfully presented content through this View.
1311    ///
1312    /// This hanging get will only fire when the ChildViewStatus is different than the previously
1313    /// returned ChildViewStatus.  This can happen immediately, and even if the creator of the
1314    /// Viewport hasn't yet called Present() after calling CreateViewport().  This allows the parent
1315    /// to know that the child has content ready to display before the parent modifies their own
1316    /// local scene graph to incorporate the child content.
1317    ///
1318    /// It is invalid to call `GetStatus` while a previous call is still pending. Doing so will
1319    /// cause both this channel and the Flatland channel that handed out ChildViewWatcher to be
1320    /// closed.
1321    pub fn r#get_status(
1322        &self,
1323    ) -> fidl::client::QueryResponseFut<
1324        ChildViewStatus,
1325        fidl::encoding::DefaultFuchsiaResourceDialect,
1326    > {
1327        ChildViewWatcherProxyInterface::r#get_status(self)
1328    }
1329
1330    /// Hanging get to receive the ViewRef of the child View. This will only fire when the View ref
1331    /// is different from the previously-returned View ref. Note: currently the View ref will not
1332    /// change after it is first received, but this will change if/when the API changes to allow
1333    /// relinking of views.
1334    ///
1335    /// The ViewRef is not returned until the View is included in the View tree, in other words when
1336    /// there is a chain of ancestor transforms all the way back up to the root of the scene graph,
1337    /// i.e. the display.
1338    ///
1339    /// It is invalid to call `GetViewRef` while a previous call is still pending. Doing so will
1340    /// cause both this channel and the Flatland channel that handed out ChildViewWatcher to be
1341    /// closed.
1342    ///
1343    /// A `GetViewRef` call will hang if the View was created using `CreateView`, but returns the
1344    /// View if the View was created using CreateView2. This is because `CreateView` does not mint
1345    /// a ViewRef for that View.
1346    pub fn r#get_view_ref(
1347        &self,
1348    ) -> fidl::client::QueryResponseFut<
1349        fidl_fuchsia_ui_views::ViewRef,
1350        fidl::encoding::DefaultFuchsiaResourceDialect,
1351    > {
1352        ChildViewWatcherProxyInterface::r#get_view_ref(self)
1353    }
1354}
1355
1356impl ChildViewWatcherProxyInterface for ChildViewWatcherProxy {
1357    type GetStatusResponseFut = fidl::client::QueryResponseFut<
1358        ChildViewStatus,
1359        fidl::encoding::DefaultFuchsiaResourceDialect,
1360    >;
1361    fn r#get_status(&self) -> Self::GetStatusResponseFut {
1362        fn _decode(
1363            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1364        ) -> Result<ChildViewStatus, fidl::Error> {
1365            let _response = fidl::client::decode_transaction_body::<
1366                ChildViewWatcherGetStatusResponse,
1367                fidl::encoding::DefaultFuchsiaResourceDialect,
1368                0x1d622075f4fc8243,
1369            >(_buf?)?;
1370            Ok(_response.status)
1371        }
1372        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ChildViewStatus>(
1373            (),
1374            0x1d622075f4fc8243,
1375            fidl::encoding::DynamicFlags::empty(),
1376            _decode,
1377        )
1378    }
1379
1380    type GetViewRefResponseFut = fidl::client::QueryResponseFut<
1381        fidl_fuchsia_ui_views::ViewRef,
1382        fidl::encoding::DefaultFuchsiaResourceDialect,
1383    >;
1384    fn r#get_view_ref(&self) -> Self::GetViewRefResponseFut {
1385        fn _decode(
1386            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1387        ) -> Result<fidl_fuchsia_ui_views::ViewRef, fidl::Error> {
1388            let _response = fidl::client::decode_transaction_body::<
1389                ChildViewWatcherGetViewRefResponse,
1390                fidl::encoding::DefaultFuchsiaResourceDialect,
1391                0x3b2f3ca31e8908b4,
1392            >(_buf?)?;
1393            Ok(_response.view_ref)
1394        }
1395        self.client
1396            .send_query_and_decode::<fidl::encoding::EmptyPayload, fidl_fuchsia_ui_views::ViewRef>(
1397                (),
1398                0x3b2f3ca31e8908b4,
1399                fidl::encoding::DynamicFlags::empty(),
1400                _decode,
1401            )
1402    }
1403}
1404
1405pub struct ChildViewWatcherEventStream {
1406    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1407}
1408
1409impl std::marker::Unpin for ChildViewWatcherEventStream {}
1410
1411impl futures::stream::FusedStream for ChildViewWatcherEventStream {
1412    fn is_terminated(&self) -> bool {
1413        self.event_receiver.is_terminated()
1414    }
1415}
1416
1417impl futures::Stream for ChildViewWatcherEventStream {
1418    type Item = Result<ChildViewWatcherEvent, fidl::Error>;
1419
1420    fn poll_next(
1421        mut self: std::pin::Pin<&mut Self>,
1422        cx: &mut std::task::Context<'_>,
1423    ) -> std::task::Poll<Option<Self::Item>> {
1424        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1425            &mut self.event_receiver,
1426            cx
1427        )?) {
1428            Some(buf) => std::task::Poll::Ready(Some(ChildViewWatcherEvent::decode(buf))),
1429            None => std::task::Poll::Ready(None),
1430        }
1431    }
1432}
1433
1434#[derive(Debug)]
1435pub enum ChildViewWatcherEvent {}
1436
1437impl ChildViewWatcherEvent {
1438    /// Decodes a message buffer as a [`ChildViewWatcherEvent`].
1439    fn decode(
1440        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1441    ) -> Result<ChildViewWatcherEvent, fidl::Error> {
1442        let (bytes, _handles) = buf.split_mut();
1443        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1444        debug_assert_eq!(tx_header.tx_id, 0);
1445        match tx_header.ordinal {
1446            _ => Err(fidl::Error::UnknownOrdinal {
1447                ordinal: tx_header.ordinal,
1448                protocol_name:
1449                    <ChildViewWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1450            }),
1451        }
1452    }
1453}
1454
1455/// A Stream of incoming requests for fuchsia.ui.composition/ChildViewWatcher.
1456pub struct ChildViewWatcherRequestStream {
1457    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1458    is_terminated: bool,
1459}
1460
1461impl std::marker::Unpin for ChildViewWatcherRequestStream {}
1462
1463impl futures::stream::FusedStream for ChildViewWatcherRequestStream {
1464    fn is_terminated(&self) -> bool {
1465        self.is_terminated
1466    }
1467}
1468
1469impl fidl::endpoints::RequestStream for ChildViewWatcherRequestStream {
1470    type Protocol = ChildViewWatcherMarker;
1471    type ControlHandle = ChildViewWatcherControlHandle;
1472
1473    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1474        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1475    }
1476
1477    fn control_handle(&self) -> Self::ControlHandle {
1478        ChildViewWatcherControlHandle { inner: self.inner.clone() }
1479    }
1480
1481    fn into_inner(
1482        self,
1483    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1484    {
1485        (self.inner, self.is_terminated)
1486    }
1487
1488    fn from_inner(
1489        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1490        is_terminated: bool,
1491    ) -> Self {
1492        Self { inner, is_terminated }
1493    }
1494}
1495
1496impl futures::Stream for ChildViewWatcherRequestStream {
1497    type Item = Result<ChildViewWatcherRequest, fidl::Error>;
1498
1499    fn poll_next(
1500        mut self: std::pin::Pin<&mut Self>,
1501        cx: &mut std::task::Context<'_>,
1502    ) -> std::task::Poll<Option<Self::Item>> {
1503        let this = &mut *self;
1504        if this.inner.check_shutdown(cx) {
1505            this.is_terminated = true;
1506            return std::task::Poll::Ready(None);
1507        }
1508        if this.is_terminated {
1509            panic!("polled ChildViewWatcherRequestStream after completion");
1510        }
1511        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1512            |bytes, handles| {
1513                match this.inner.channel().read_etc(cx, bytes, handles) {
1514                    std::task::Poll::Ready(Ok(())) => {}
1515                    std::task::Poll::Pending => return std::task::Poll::Pending,
1516                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1517                        this.is_terminated = true;
1518                        return std::task::Poll::Ready(None);
1519                    }
1520                    std::task::Poll::Ready(Err(e)) => {
1521                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1522                            e.into(),
1523                        ))));
1524                    }
1525                }
1526
1527                // A message has been received from the channel
1528                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1529
1530                std::task::Poll::Ready(Some(match header.ordinal {
1531                    0x1d622075f4fc8243 => {
1532                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1533                        let mut req = fidl::new_empty!(
1534                            fidl::encoding::EmptyPayload,
1535                            fidl::encoding::DefaultFuchsiaResourceDialect
1536                        );
1537                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1538                        let control_handle =
1539                            ChildViewWatcherControlHandle { inner: this.inner.clone() };
1540                        Ok(ChildViewWatcherRequest::GetStatus {
1541                            responder: ChildViewWatcherGetStatusResponder {
1542                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1543                                tx_id: header.tx_id,
1544                            },
1545                        })
1546                    }
1547                    0x3b2f3ca31e8908b4 => {
1548                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1549                        let mut req = fidl::new_empty!(
1550                            fidl::encoding::EmptyPayload,
1551                            fidl::encoding::DefaultFuchsiaResourceDialect
1552                        );
1553                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1554                        let control_handle =
1555                            ChildViewWatcherControlHandle { inner: this.inner.clone() };
1556                        Ok(ChildViewWatcherRequest::GetViewRef {
1557                            responder: ChildViewWatcherGetViewRefResponder {
1558                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1559                                tx_id: header.tx_id,
1560                            },
1561                        })
1562                    }
1563                    _ => Err(fidl::Error::UnknownOrdinal {
1564                        ordinal: header.ordinal,
1565                        protocol_name:
1566                            <ChildViewWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1567                    }),
1568                }))
1569            },
1570        )
1571    }
1572}
1573
1574/// A protocol that provides information about a particular child View which is attached to the
1575/// Viewport owned by the parent client; connections to this protocol are estabished in
1576/// [`CreateViewport`].  Since a Flatland session may contain any number of Viewports, each of
1577/// which may or may not be attached to a transform, the client can maintain connections to an
1578/// equal number of ChildViewWatcher instances.
1579///
1580/// Each ChildViewWatcher instance will remain connected as long as the corresponding child View
1581/// exists; the connection will also be closed if the child's ViewCreationToken is dropped without
1582/// using it to create a View.
1583#[derive(Debug)]
1584pub enum ChildViewWatcherRequest {
1585    /// A hanging get for receiving the status of a View. This provides information to the parent,
1586    /// such as whether or not the child has successfully presented content through this View.
1587    ///
1588    /// This hanging get will only fire when the ChildViewStatus is different than the previously
1589    /// returned ChildViewStatus.  This can happen immediately, and even if the creator of the
1590    /// Viewport hasn't yet called Present() after calling CreateViewport().  This allows the parent
1591    /// to know that the child has content ready to display before the parent modifies their own
1592    /// local scene graph to incorporate the child content.
1593    ///
1594    /// It is invalid to call `GetStatus` while a previous call is still pending. Doing so will
1595    /// cause both this channel and the Flatland channel that handed out ChildViewWatcher to be
1596    /// closed.
1597    GetStatus { responder: ChildViewWatcherGetStatusResponder },
1598    /// Hanging get to receive the ViewRef of the child View. This will only fire when the View ref
1599    /// is different from the previously-returned View ref. Note: currently the View ref will not
1600    /// change after it is first received, but this will change if/when the API changes to allow
1601    /// relinking of views.
1602    ///
1603    /// The ViewRef is not returned until the View is included in the View tree, in other words when
1604    /// there is a chain of ancestor transforms all the way back up to the root of the scene graph,
1605    /// i.e. the display.
1606    ///
1607    /// It is invalid to call `GetViewRef` while a previous call is still pending. Doing so will
1608    /// cause both this channel and the Flatland channel that handed out ChildViewWatcher to be
1609    /// closed.
1610    ///
1611    /// A `GetViewRef` call will hang if the View was created using `CreateView`, but returns the
1612    /// View if the View was created using CreateView2. This is because `CreateView` does not mint
1613    /// a ViewRef for that View.
1614    GetViewRef { responder: ChildViewWatcherGetViewRefResponder },
1615}
1616
1617impl ChildViewWatcherRequest {
1618    #[allow(irrefutable_let_patterns)]
1619    pub fn into_get_status(self) -> Option<(ChildViewWatcherGetStatusResponder)> {
1620        if let ChildViewWatcherRequest::GetStatus { responder } = self {
1621            Some((responder))
1622        } else {
1623            None
1624        }
1625    }
1626
1627    #[allow(irrefutable_let_patterns)]
1628    pub fn into_get_view_ref(self) -> Option<(ChildViewWatcherGetViewRefResponder)> {
1629        if let ChildViewWatcherRequest::GetViewRef { responder } = self {
1630            Some((responder))
1631        } else {
1632            None
1633        }
1634    }
1635
1636    /// Name of the method defined in FIDL
1637    pub fn method_name(&self) -> &'static str {
1638        match *self {
1639            ChildViewWatcherRequest::GetStatus { .. } => "get_status",
1640            ChildViewWatcherRequest::GetViewRef { .. } => "get_view_ref",
1641        }
1642    }
1643}
1644
1645#[derive(Debug, Clone)]
1646pub struct ChildViewWatcherControlHandle {
1647    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1648}
1649
1650impl ChildViewWatcherControlHandle {
1651    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
1652        self.inner.shutdown_with_epitaph(status.into())
1653    }
1654}
1655
1656impl fidl::endpoints::ControlHandle for ChildViewWatcherControlHandle {
1657    fn shutdown(&self) {
1658        self.inner.shutdown()
1659    }
1660
1661    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
1662        self.inner.shutdown_with_epitaph(status)
1663    }
1664
1665    fn is_closed(&self) -> bool {
1666        self.inner.channel().is_closed()
1667    }
1668    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1669        self.inner.channel().on_closed()
1670    }
1671
1672    #[cfg(target_os = "fuchsia")]
1673    fn signal_peer(
1674        &self,
1675        clear_mask: zx::Signals,
1676        set_mask: zx::Signals,
1677    ) -> Result<(), zx_status::Status> {
1678        use fidl::Peered;
1679        self.inner.channel().signal_peer(clear_mask, set_mask)
1680    }
1681}
1682
1683impl ChildViewWatcherControlHandle {}
1684
1685#[must_use = "FIDL methods require a response to be sent"]
1686#[derive(Debug)]
1687pub struct ChildViewWatcherGetStatusResponder {
1688    control_handle: std::mem::ManuallyDrop<ChildViewWatcherControlHandle>,
1689    tx_id: u32,
1690}
1691
1692/// Set the the channel to be shutdown (see [`ChildViewWatcherControlHandle::shutdown`])
1693/// if the responder is dropped without sending a response, so that the client
1694/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1695impl std::ops::Drop for ChildViewWatcherGetStatusResponder {
1696    fn drop(&mut self) {
1697        self.control_handle.shutdown();
1698        // Safety: drops once, never accessed again
1699        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1700    }
1701}
1702
1703impl fidl::endpoints::Responder for ChildViewWatcherGetStatusResponder {
1704    type ControlHandle = ChildViewWatcherControlHandle;
1705
1706    fn control_handle(&self) -> &ChildViewWatcherControlHandle {
1707        &self.control_handle
1708    }
1709
1710    fn drop_without_shutdown(mut self) {
1711        // Safety: drops once, never accessed again due to mem::forget
1712        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1713        // Prevent Drop from running (which would shut down the channel)
1714        std::mem::forget(self);
1715    }
1716}
1717
1718impl ChildViewWatcherGetStatusResponder {
1719    /// Sends a response to the FIDL transaction.
1720    ///
1721    /// Sets the channel to shutdown if an error occurs.
1722    pub fn send(self, mut status: ChildViewStatus) -> Result<(), fidl::Error> {
1723        let _result = self.send_raw(status);
1724        if _result.is_err() {
1725            self.control_handle.shutdown();
1726        }
1727        self.drop_without_shutdown();
1728        _result
1729    }
1730
1731    /// Similar to "send" but does not shutdown the channel if an error occurs.
1732    pub fn send_no_shutdown_on_err(self, mut status: ChildViewStatus) -> Result<(), fidl::Error> {
1733        let _result = self.send_raw(status);
1734        self.drop_without_shutdown();
1735        _result
1736    }
1737
1738    fn send_raw(&self, mut status: ChildViewStatus) -> Result<(), fidl::Error> {
1739        self.control_handle.inner.send::<ChildViewWatcherGetStatusResponse>(
1740            (status,),
1741            self.tx_id,
1742            0x1d622075f4fc8243,
1743            fidl::encoding::DynamicFlags::empty(),
1744        )
1745    }
1746}
1747
1748#[must_use = "FIDL methods require a response to be sent"]
1749#[derive(Debug)]
1750pub struct ChildViewWatcherGetViewRefResponder {
1751    control_handle: std::mem::ManuallyDrop<ChildViewWatcherControlHandle>,
1752    tx_id: u32,
1753}
1754
1755/// Set the the channel to be shutdown (see [`ChildViewWatcherControlHandle::shutdown`])
1756/// if the responder is dropped without sending a response, so that the client
1757/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1758impl std::ops::Drop for ChildViewWatcherGetViewRefResponder {
1759    fn drop(&mut self) {
1760        self.control_handle.shutdown();
1761        // Safety: drops once, never accessed again
1762        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1763    }
1764}
1765
1766impl fidl::endpoints::Responder for ChildViewWatcherGetViewRefResponder {
1767    type ControlHandle = ChildViewWatcherControlHandle;
1768
1769    fn control_handle(&self) -> &ChildViewWatcherControlHandle {
1770        &self.control_handle
1771    }
1772
1773    fn drop_without_shutdown(mut self) {
1774        // Safety: drops once, never accessed again due to mem::forget
1775        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1776        // Prevent Drop from running (which would shut down the channel)
1777        std::mem::forget(self);
1778    }
1779}
1780
1781impl ChildViewWatcherGetViewRefResponder {
1782    /// Sends a response to the FIDL transaction.
1783    ///
1784    /// Sets the channel to shutdown if an error occurs.
1785    pub fn send(self, mut view_ref: fidl_fuchsia_ui_views::ViewRef) -> Result<(), fidl::Error> {
1786        let _result = self.send_raw(view_ref);
1787        if _result.is_err() {
1788            self.control_handle.shutdown();
1789        }
1790        self.drop_without_shutdown();
1791        _result
1792    }
1793
1794    /// Similar to "send" but does not shutdown the channel if an error occurs.
1795    pub fn send_no_shutdown_on_err(
1796        self,
1797        mut view_ref: fidl_fuchsia_ui_views::ViewRef,
1798    ) -> Result<(), fidl::Error> {
1799        let _result = self.send_raw(view_ref);
1800        self.drop_without_shutdown();
1801        _result
1802    }
1803
1804    fn send_raw(&self, mut view_ref: fidl_fuchsia_ui_views::ViewRef) -> Result<(), fidl::Error> {
1805        self.control_handle.inner.send::<ChildViewWatcherGetViewRefResponse>(
1806            (&mut view_ref,),
1807            self.tx_id,
1808            0x3b2f3ca31e8908b4,
1809            fidl::encoding::DynamicFlags::empty(),
1810        )
1811    }
1812}
1813
1814#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1815pub struct FlatlandMarker;
1816
1817impl fidl::endpoints::ProtocolMarker for FlatlandMarker {
1818    type Proxy = FlatlandProxy;
1819    type RequestStream = FlatlandRequestStream;
1820    #[cfg(target_os = "fuchsia")]
1821    type SynchronousProxy = FlatlandSynchronousProxy;
1822
1823    const DEBUG_NAME: &'static str = "fuchsia.ui.composition.Flatland";
1824}
1825impl fidl::endpoints::DiscoverableProtocolMarker for FlatlandMarker {}
1826
1827pub trait FlatlandProxyInterface: Send + Sync {
1828    fn r#release_image_immediately(&self, image_id: &ContentId) -> Result<(), fidl::Error>;
1829    fn r#release_image_immediately2(&self, image_id: &ImageId) -> Result<(), fidl::Error>;
1830    fn r#create_layer(&self, layer_id: &LayerId) -> Result<(), fidl::Error>;
1831    fn r#release_layer(&self, layer_id: &LayerId) -> Result<(), fidl::Error>;
1832    fn r#set_layer_image(
1833        &self,
1834        layer_id: &LayerId,
1835        image_id: &ImageId,
1836        acquire_fence: Option<WaitFence>,
1837        release_fence: Option<SignalFence>,
1838    ) -> Result<(), fidl::Error>;
1839    fn r#set_layer_properties(
1840        &self,
1841        layer_id: &LayerId,
1842        properties: &LayerProperties,
1843    ) -> Result<(), fidl::Error>;
1844    fn r#reset_layer(&self, layer_id: &LayerId) -> Result<(), fidl::Error>;
1845    fn r#create_layer_stack(&self, stack_id: &LayerStackId) -> Result<(), fidl::Error>;
1846    fn r#release_layer_stack(&self, stack_id: &LayerStackId) -> Result<(), fidl::Error>;
1847    fn r#set_stack_layers(
1848        &self,
1849        stack_id: &LayerStackId,
1850        layers: &[LayerId],
1851    ) -> Result<(), fidl::Error>;
1852    fn r#create_image2(
1853        &self,
1854        image_id: &ImageId,
1855        import_token: BufferCollectionImportToken,
1856        vmo_index: u32,
1857        properties: &ImageProperties,
1858    ) -> Result<(), fidl::Error>;
1859    fn r#release_image2(&self, image_id: &ImageId) -> Result<(), fidl::Error>;
1860    fn r#create_viewport2(
1861        &self,
1862        viewport_id: &ViewportId,
1863        token: fidl_fuchsia_ui_views::ViewportCreationToken,
1864        properties: &ViewportProperties,
1865        child_view_watcher: fidl::endpoints::ServerEnd<ChildViewWatcherMarker>,
1866    ) -> Result<(), fidl::Error>;
1867    type ReleaseViewport2ResponseFut: std::future::Future<
1868            Output = Result<fidl_fuchsia_ui_views::ViewportCreationToken, fidl::Error>,
1869        > + Send;
1870    fn r#release_viewport2(&self, viewport_id: &ViewportId) -> Self::ReleaseViewport2ResponseFut;
1871    fn r#set_viewport_properties2(
1872        &self,
1873        viewport_id: &ViewportId,
1874        properties: &ViewportProperties,
1875    ) -> Result<(), fidl::Error>;
1876    fn r#set_transform_content(
1877        &self,
1878        transform_id: &TransformId,
1879        content: Option<&TransformContent>,
1880    ) -> Result<(), fidl::Error>;
1881    fn r#present(&self, args: PresentArgs) -> Result<(), fidl::Error>;
1882    fn r#create_view(
1883        &self,
1884        token: fidl_fuchsia_ui_views::ViewCreationToken,
1885        parent_viewport_watcher: fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>,
1886    ) -> Result<(), fidl::Error>;
1887    fn r#create_view2(
1888        &self,
1889        token: fidl_fuchsia_ui_views::ViewCreationToken,
1890        view_identity: fidl_fuchsia_ui_views::ViewIdentityOnCreation,
1891        protocols: ViewBoundProtocols,
1892        parent_viewport_watcher: fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>,
1893    ) -> Result<(), fidl::Error>;
1894    fn r#create_transform(&self, transform_id: &TransformId) -> Result<(), fidl::Error>;
1895    fn r#set_translation(
1896        &self,
1897        transform_id: &TransformId,
1898        translation: &fidl_fuchsia_math::Vec_,
1899    ) -> Result<(), fidl::Error>;
1900    fn r#set_orientation(
1901        &self,
1902        transform_id: &TransformId,
1903        orientation: Orientation,
1904    ) -> Result<(), fidl::Error>;
1905    fn r#set_scale(
1906        &self,
1907        transform_id: &TransformId,
1908        scale: &fidl_fuchsia_math::VecF,
1909    ) -> Result<(), fidl::Error>;
1910    fn r#set_opacity(&self, transform_id: &TransformId, value: f32) -> Result<(), fidl::Error>;
1911    fn r#set_clip_boundary(
1912        &self,
1913        transform_id: &TransformId,
1914        rect: Option<&fidl_fuchsia_math::Rect>,
1915    ) -> Result<(), fidl::Error>;
1916    fn r#add_child(
1917        &self,
1918        parent_transform_id: &TransformId,
1919        child_transform_id: &TransformId,
1920    ) -> Result<(), fidl::Error>;
1921    fn r#remove_child(
1922        &self,
1923        parent_transform_id: &TransformId,
1924        child_transform_id: &TransformId,
1925    ) -> Result<(), fidl::Error>;
1926    fn r#replace_children(
1927        &self,
1928        parent_transform_id: &TransformId,
1929        new_child_transform_ids: &[TransformId],
1930    ) -> Result<(), fidl::Error>;
1931    fn r#set_root_transform(&self, transform_id: &TransformId) -> Result<(), fidl::Error>;
1932    fn r#set_hit_regions(
1933        &self,
1934        transform_id: &TransformId,
1935        regions: &[HitRegion],
1936    ) -> Result<(), fidl::Error>;
1937    fn r#set_infinite_hit_region(
1938        &self,
1939        transform_id: &TransformId,
1940        hit_test: HitTestInteraction,
1941    ) -> Result<(), fidl::Error>;
1942    fn r#create_viewport(
1943        &self,
1944        viewport_id: &ContentId,
1945        token: fidl_fuchsia_ui_views::ViewportCreationToken,
1946        properties: &ViewportProperties,
1947        child_view_watcher: fidl::endpoints::ServerEnd<ChildViewWatcherMarker>,
1948    ) -> Result<(), fidl::Error>;
1949    fn r#create_image(
1950        &self,
1951        image_id: &ContentId,
1952        import_token: BufferCollectionImportToken,
1953        vmo_index: u32,
1954        properties: &ImageProperties,
1955    ) -> Result<(), fidl::Error>;
1956    fn r#set_image_sample_region(
1957        &self,
1958        image_id: &ContentId,
1959        rect: &fidl_fuchsia_math::RectF,
1960    ) -> Result<(), fidl::Error>;
1961    fn r#set_image_destination_size(
1962        &self,
1963        image_id: &ContentId,
1964        size: &fidl_fuchsia_math::SizeU,
1965    ) -> Result<(), fidl::Error>;
1966    fn r#set_image_blending_function(
1967        &self,
1968        image_id: &ContentId,
1969        blend_mode: BlendMode,
1970    ) -> Result<(), fidl::Error>;
1971    fn r#set_image_blend_mode(
1972        &self,
1973        image_id: &ContentId,
1974        blend_mode: BlendMode2,
1975    ) -> Result<(), fidl::Error>;
1976    fn r#set_image_opacity(&self, image_id: &ContentId, val: f32) -> Result<(), fidl::Error>;
1977    fn r#set_image_flip(&self, image_id: &ContentId, flip: ImageFlip) -> Result<(), fidl::Error>;
1978    fn r#create_filled_rect(&self, rect_id: &ContentId) -> Result<(), fidl::Error>;
1979    fn r#set_solid_fill(
1980        &self,
1981        rect_id: &ContentId,
1982        color: &ColorRgba,
1983        size: &fidl_fuchsia_math::SizeU,
1984    ) -> Result<(), fidl::Error>;
1985    fn r#release_filled_rect(&self, rect_id: &ContentId) -> Result<(), fidl::Error>;
1986    fn r#set_content(
1987        &self,
1988        transform_id: &TransformId,
1989        content_id: &ContentId,
1990    ) -> Result<(), fidl::Error>;
1991    fn r#set_viewport_properties(
1992        &self,
1993        viewport_id: &ContentId,
1994        properties: &ViewportProperties,
1995    ) -> Result<(), fidl::Error>;
1996    fn r#release_transform(&self, transform_id: &TransformId) -> Result<(), fidl::Error>;
1997    fn r#release_view(&self) -> Result<(), fidl::Error>;
1998    type ReleaseViewportResponseFut: std::future::Future<
1999            Output = Result<fidl_fuchsia_ui_views::ViewportCreationToken, fidl::Error>,
2000        > + Send;
2001    fn r#release_viewport(&self, viewport_id: &ContentId) -> Self::ReleaseViewportResponseFut;
2002    fn r#release_image(&self, image_id: &ContentId) -> Result<(), fidl::Error>;
2003    fn r#clear(&self) -> Result<(), fidl::Error>;
2004    fn r#set_debug_name(&self, name: &str) -> Result<(), fidl::Error>;
2005}
2006#[derive(Debug)]
2007#[cfg(target_os = "fuchsia")]
2008pub struct FlatlandSynchronousProxy {
2009    client: fidl::client::sync::Client,
2010}
2011
2012#[cfg(target_os = "fuchsia")]
2013impl fidl::endpoints::SynchronousProxy for FlatlandSynchronousProxy {
2014    type Proxy = FlatlandProxy;
2015    type Protocol = FlatlandMarker;
2016
2017    fn from_channel(inner: fidl::Channel) -> Self {
2018        Self::new(inner)
2019    }
2020
2021    fn into_channel(self) -> fidl::Channel {
2022        self.client.into_channel()
2023    }
2024
2025    fn as_channel(&self) -> &fidl::Channel {
2026        self.client.as_channel()
2027    }
2028}
2029
2030#[cfg(target_os = "fuchsia")]
2031impl FlatlandSynchronousProxy {
2032    pub fn new(channel: fidl::Channel) -> Self {
2033        Self { client: fidl::client::sync::Client::new(channel) }
2034    }
2035
2036    pub fn into_channel(self) -> fidl::Channel {
2037        self.client.into_channel()
2038    }
2039
2040    /// Waits until an event arrives and returns it. It is safe for other
2041    /// threads to make concurrent requests while waiting for an event.
2042    pub fn wait_for_event(
2043        &self,
2044        deadline: zx::MonotonicInstant,
2045    ) -> Result<FlatlandEvent, fidl::Error> {
2046        FlatlandEvent::decode(self.client.wait_for_event::<FlatlandMarker>(deadline)?)
2047    }
2048
2049    /// Releases an image immediately, without waiting for the next present.
2050    pub fn r#release_image_immediately(&self, mut image_id: &ContentId) -> Result<(), fidl::Error> {
2051        self.client.send::<TrustedFlatlandReleaseImageImmediatelyRequest>(
2052            (image_id,),
2053            0x245e1ac080772c8,
2054            fidl::encoding::DynamicFlags::empty(),
2055        )
2056    }
2057
2058    /// Releases an Image immediately, without waiting for the next present. This is a trusted
2059    /// memory-eviction path.
2060    ///
2061    /// The Image is forcibly unbound from any Layers that currently reference it. Those Layers
2062    /// behave as if their image was simply never set (they are invisible, but retain their image
2063    /// properties) until their next `SetLayerImage()`.
2064    ///
2065    /// Any pending release fences for the evicted Image's bindings will signal at the earliest
2066    /// safe point.
2067    ///
2068    /// This method is only available if Flatland2 is enabled and the session is trusted.
2069    pub fn r#release_image_immediately2(&self, mut image_id: &ImageId) -> Result<(), fidl::Error> {
2070        self.client.send::<TrustedFlatlandReleaseImageImmediately2Request>(
2071            (image_id,),
2072            0x6d6a73d150589146,
2073            fidl::encoding::DynamicFlags::empty(),
2074        )
2075    }
2076
2077    /// A Layer is a type of `Content` that composites either a single `Image` or a solid
2078    /// color. It separates visual properties (such as size, flip, opacity, and blending)
2079    /// from the raw pixel data.
2080    ///
2081    /// Unlike typical `Content` items which represent a static visual resource, a Layer is designed
2082    /// to be a dynamic container for an image sequence. Typical usage involves setting the layer's
2083    /// visual properties and image metadata infrequently, and then rapidly swapping the active
2084    /// `Image` (e.g. on every frame) with another image of matching metadata.
2085    ///
2086    /// This separation allows a single `Image` resource to be reused across multiple layers with
2087    /// different visual configurations simultaneously.
2088    ///
2089    /// To use a Layer:
2090    /// 1. Create a `Layer` using [`CreateLayer`].
2091    /// 2. Set properties on the `Layer` via [`SetLayerProperties`], including the
2092    ///    composition mode.
2093    /// 3. For an image layer, associate an `Image` with the `Layer` via [`SetLayerImage`].
2094    /// 4. Add the `Layer` to a `LayerStack` via [`SetStackLayers`].
2095    /// 5. Set the `LayerStack` as the content of a node via [`SetTransformContent`].
2096    ///
2097    /// `layer_id` must satisfy the identifier rules documented on [`LayerId`].
2098    pub fn r#create_layer(&self, mut layer_id: &LayerId) -> Result<(), fidl::Error> {
2099        self.client.send::<Flatland2CreateLayerRequest>(
2100            (layer_id,),
2101            0x60837bb0ce59f8a9,
2102            fidl::encoding::DynamicFlags::empty(),
2103        )
2104    }
2105
2106    /// Released Layers will be garbage collected by the system once they are no longer necessary
2107    /// for rendering. For Layers, this means:
2108    /// - the Layer is no longer referenced by any LayerStack, and
2109    /// - any pending rendering that references the Layer is complete.
2110    ///
2111    /// `layer_id` must refer to a valid, unreleased Layer.
2112    pub fn r#release_layer(&self, mut layer_id: &LayerId) -> Result<(), fidl::Error> {
2113        self.client.send::<Flatland2ReleaseLayerRequest>(
2114            (layer_id,),
2115            0x60118a842b6f0756,
2116            fidl::encoding::DynamicFlags::empty(),
2117        )
2118    }
2119
2120    /// Associates an Image with the Layer.
2121    ///
2122    /// The binding is legal in any composition mode, and is sticky: it survives composition
2123    /// mode changes, and is replaced only by a later [`SetLayerImage`] call (or cleared by
2124    /// [`ResetLayer`]). The image is displayed only while the layer's composition mode is
2125    /// `IMAGE`.
2126    ///
2127    /// The bound image must be large enough for the layer's stored `sample_rect`; this is
2128    /// checked at [`fuchsia.ui.composition/Flatland.Present`], not here. See
2129    /// [`LayerProperties.sample_rect`].
2130    ///
2131    /// `layer_id` must refer to a valid, unreleased Layer.
2132    /// `image_id` must refer to a valid, unreleased Image.
2133    /// `acquire_fence` is an optional fence that must be signaled before the image is displayed.
2134    /// `release_fence` is an optional fence, signaled by Scenic when *this binding* no
2135    /// longer references the image. It is per-binding, not per-image: an image bound to
2136    /// several layers has one such fence per binding, and the image is safe to write only
2137    /// once every one of them has signaled.
2138    ///
2139    /// A binding is ended by:
2140    ///
2141    /// - being superseded by a later [`SetLayerImage`] on the same layer
2142    /// - [`ResetLayer`]
2143    /// - the layer ref-count reaching zero, either via [`ReleaseLayer`] or by being released
2144    ///   by a layer stack
2145    /// - destruction of the session, which ends every binding it holds
2146    ///
2147    /// For a binding ended while the session is alive, Scenic signals at the first frame
2148    /// retire after that point. Bindings that never reached the screen (e.g. one superseded
2149    /// within a single batch, or one lost when several
2150    /// [`fuchsia.ui.composition/Flatland.Present`] calls are squashed into a single
2151    /// frame) signal at that same retire rather than immediately. The signal is
2152    /// therefore conservative by at most one frame; it is never early.
2153    pub fn r#set_layer_image(
2154        &self,
2155        mut layer_id: &LayerId,
2156        mut image_id: &ImageId,
2157        mut acquire_fence: Option<WaitFence>,
2158        mut release_fence: Option<SignalFence>,
2159    ) -> Result<(), fidl::Error> {
2160        self.client.send::<Flatland2SetLayerImageRequest>(
2161            (layer_id, image_id, acquire_fence.as_mut(), release_fence.as_mut()),
2162            0x262302d9782d252c,
2163            fidl::encoding::DynamicFlags::empty(),
2164        )
2165    }
2166
2167    /// Sets properties of the Layer.
2168    ///
2169    /// The provided `properties` table is merged into the layer's stored properties: fields
2170    /// which are unset in `properties` retain their previously stored values. Stored
2171    /// properties are sticky; see [`LayerProperties`] for the full persistence semantics.
2172    ///
2173    /// Values are stored as given; validation which depends on other state (notably
2174    /// `sample_rect` against the bound image) happens at
2175    /// [`fuchsia.ui.composition/Flatland.Present`]. See [`LayerProperties.sample_rect`].
2176    ///
2177    /// `layer_id` must refer to a valid, unreleased Layer.
2178    pub fn r#set_layer_properties(
2179        &self,
2180        mut layer_id: &LayerId,
2181        mut properties: &LayerProperties,
2182    ) -> Result<(), fidl::Error> {
2183        self.client.send::<Flatland2SetLayerPropertiesRequest>(
2184            (layer_id, properties),
2185            0x282d0e902aae8bb0,
2186            fidl::encoding::DynamicFlags::empty(),
2187        )
2188    }
2189
2190    /// Unbinds any Image bound to the layer and clears every stored [`LayerProperties`]
2191    /// field, returning the layer to its freshly-created state (composition mode
2192    /// `INVISIBLE`, all properties at their documented defaults). This is the only
2193    /// operation which forgets stored layer properties.
2194    ///
2195    /// `layer_id` must refer to a valid, unreleased Layer.
2196    pub fn r#reset_layer(&self, mut layer_id: &LayerId) -> Result<(), fidl::Error> {
2197        self.client.send::<Flatland2ResetLayerRequest>(
2198            (layer_id,),
2199            0x17bf541bf216ab2b,
2200            fidl::encoding::DynamicFlags::empty(),
2201        )
2202    }
2203
2204    /// Creates a new layer stack with the specified `stack_id`.
2205    ///
2206    /// `stack_id` must satisfy the identifier rules documented on [`LayerId`].
2207    pub fn r#create_layer_stack(&self, mut stack_id: &LayerStackId) -> Result<(), fidl::Error> {
2208        self.client.send::<Flatland2CreateLayerStackRequest>(
2209            (stack_id,),
2210            0x70debe3cd7371aa6,
2211            fidl::encoding::DynamicFlags::empty(),
2212        )
2213    }
2214
2215    /// Releases the layer stack with the specified `stack_id`.
2216    pub fn r#release_layer_stack(&self, mut stack_id: &LayerStackId) -> Result<(), fidl::Error> {
2217        self.client.send::<Flatland2ReleaseLayerStackRequest>(
2218            (stack_id,),
2219            0x3ad3151aece3b1bb,
2220            fidl::encoding::DynamicFlags::empty(),
2221        )
2222    }
2223
2224    /// Sets the layers in the stack. The order of layers in the vector determines their Z-order,
2225    /// with the first element being the back-most and the last element being the front-most.
2226    ///
2227    /// `stack_id` must refer to a valid, unreleased LayerStack. Each element of `layers`
2228    /// must refer to a valid, unreleased Layer. Duplicate layers within `layers` are
2229    /// disallowed.
2230    pub fn r#set_stack_layers(
2231        &self,
2232        mut stack_id: &LayerStackId,
2233        mut layers: &[LayerId],
2234    ) -> Result<(), fidl::Error> {
2235        self.client.send::<Flatland2SetStackLayersRequest>(
2236            (stack_id, layers),
2237            0x1e0bff0f5cca065a,
2238            fidl::encoding::DynamicFlags::empty(),
2239        )
2240    }
2241
2242    /// Creates an Image resource.
2243    ///
2244    /// `image_id` must satisfy the identifier rules documented on [`LayerId`].
2245    pub fn r#create_image2(
2246        &self,
2247        mut image_id: &ImageId,
2248        mut import_token: BufferCollectionImportToken,
2249        mut vmo_index: u32,
2250        mut properties: &ImageProperties,
2251    ) -> Result<(), fidl::Error> {
2252        self.client.send::<Flatland2CreateImage2Request>(
2253            (image_id, &mut import_token, vmo_index, properties),
2254            0x677fa7b23aaca46,
2255            fidl::encoding::DynamicFlags::empty(),
2256        )
2257    }
2258
2259    /// Released Images will be garbage collected by the system once they are no longer necessary
2260    /// for rendering. For Images, this means:
2261    /// - the Image is no longer bound to any Layer, and
2262    /// - any pending rendering that references the Image is complete.
2263    ///
2264    /// The `image_id` value is freed for reuse immediately by the client (identifier uniqueness
2265    /// is instantaneous).
2266    ///
2267    /// Note: Per-binding release fences (passed to `SetLayerImage`) are unaffected by this call.
2268    /// They track the lifecycle of individual layer bindings, not the client's `image_id`.
2269    ///
2270    /// `image_id` must refer to a valid, unreleased Image.
2271    pub fn r#release_image2(&self, mut image_id: &ImageId) -> Result<(), fidl::Error> {
2272        self.client.send::<Flatland2ReleaseImage2Request>(
2273            (image_id,),
2274            0x7d0a041ed51aca06,
2275            fidl::encoding::DynamicFlags::empty(),
2276        )
2277    }
2278
2279    /// Creates a Viewport resource.
2280    ///
2281    /// `viewport_id` must satisfy the identifier rules documented on [`LayerId`].
2282    pub fn r#create_viewport2(
2283        &self,
2284        mut viewport_id: &ViewportId,
2285        mut token: fidl_fuchsia_ui_views::ViewportCreationToken,
2286        mut properties: &ViewportProperties,
2287        mut child_view_watcher: fidl::endpoints::ServerEnd<ChildViewWatcherMarker>,
2288    ) -> Result<(), fidl::Error> {
2289        self.client.send::<Flatland2CreateViewport2Request>(
2290            (viewport_id, &mut token, properties, child_view_watcher),
2291            0x1b646776764f1128,
2292            fidl::encoding::DynamicFlags::empty(),
2293        )
2294    }
2295
2296    /// Releases a Viewport from the scene.
2297    pub fn r#release_viewport2(
2298        &self,
2299        mut viewport_id: &ViewportId,
2300        ___deadline: zx::MonotonicInstant,
2301    ) -> Result<fidl_fuchsia_ui_views::ViewportCreationToken, fidl::Error> {
2302        let _response = self.client.send_query::<
2303            Flatland2ReleaseViewport2Request,
2304            Flatland2ReleaseViewport2Response,
2305            FlatlandMarker,
2306        >(
2307            (viewport_id,),
2308            0x18ef77414c7a9ae3,
2309            fidl::encoding::DynamicFlags::empty(),
2310            ___deadline,
2311        )?;
2312        Ok(_response.token)
2313    }
2314
2315    /// Sets the properties of a Viewport.
2316    pub fn r#set_viewport_properties2(
2317        &self,
2318        mut viewport_id: &ViewportId,
2319        mut properties: &ViewportProperties,
2320    ) -> Result<(), fidl::Error> {
2321        self.client.send::<Flatland2SetViewportProperties2Request>(
2322            (viewport_id, properties),
2323            0x95f2ec3b9e4beea,
2324            fidl::encoding::DynamicFlags::empty(),
2325        )
2326    }
2327
2328    /// Sets (or clears) the content of a Transform.
2329    ///
2330    /// The same content may be attached to more than one Transform; each attachment composites
2331    /// that content again under its own Transform's matrix, clip, and opacity, so a single
2332    /// LayerStack or Viewport can appear repeatedly in a scene without the client duplicating the
2333    /// underlying resources.
2334    ///
2335    /// A Transform's content can be cleared by not providing the optional `content`.
2336    ///
2337    /// If `content` is set, it must refer to a valid, unreleased LayerStack or Viewport.
2338    /// Unlike classic [`Flatland.SetContent`], a zero id does not clear the content.
2339    pub fn r#set_transform_content(
2340        &self,
2341        mut transform_id: &TransformId,
2342        mut content: Option<&TransformContent>,
2343    ) -> Result<(), fidl::Error> {
2344        self.client.send::<Flatland2SetTransformContentRequest>(
2345            (transform_id, content),
2346            0x17e33f64f55e4ea9,
2347            fidl::encoding::DynamicFlags::empty(),
2348        )
2349    }
2350
2351    /// Complete execution of all feed-forward operations.
2352    ///
2353    /// If executing an operation produces an error (e.g., CreateTransform(0)), an [`OnError`] event
2354    /// is emitted. Operations that produce errors are ignored and the channel is closed.
2355    ///
2356    /// If execution completes successfully, [`OnNextFrameBegin`] is emitted with valid frame
2357    /// production information.
2358    ///
2359    /// The client may only call [`Present`] when they have a non-zero number of present credits,
2360    /// which are tracked by the server. The server may increment the number of credits when it
2361    /// fires the [`OnNextFrameBegin`] event, which informs the client when it receives additional
2362    /// present credits. Each [`Present`] call uses one present credit and decrements the server
2363    /// count by one. If the client calls [`Present`] with no present credits, the server will
2364    /// return a `NO_PRESENTS_REMAINING` error.
2365    ///
2366    /// The client should assume that prior to receiving any [`OnNextFrameBegin`] events, they have
2367    /// one present credit.
2368    ///
2369    /// Every [`Present`] call results in one [`OnNextFrameBegin`] event, and one
2370    /// [`OnFramePresented`] event, typically in that order.
2371    ///
2372    /// When the commands flushed by [`Present`] make it to display, an [`OnFramePresented`] event
2373    /// is fired. This event includes information pertaining to all [`Present`]s that had content
2374    /// that were part of that frame.
2375    ///
2376    /// See [`fuchsia.ui.composition/PresentArgs`] documentation above for more detailed information
2377    /// on what arguments are passed in and their role.
2378    pub fn r#present(&self, mut args: PresentArgs) -> Result<(), fidl::Error> {
2379        self.client.send::<FlatlandPresentRequest>(
2380            (&mut args,),
2381            0x50acc2aa1f0acec7,
2382            fidl::encoding::DynamicFlags::empty(),
2383        )
2384    }
2385
2386    /// Two Flatland sessions may be connected in a parent-child relationship. The parent endpoint
2387    /// is held in a Viewport, and the child endpoint is held in a View. The parent Flatland
2388    /// session that creates a Viewport has control over how the child's View is integrated into
2389    /// its own View.
2390    ///
2391    /// The lifecycle of a parent-child connection starts with two endpoints of a channel object:
2392    /// a ViewportCreationToken and a ViewCreationToken. Out-of-band protocols pass the
2393    /// ViewportCreationToken to the parent, which calls [`CreateViewport`], and the
2394    /// ViewCreationToken to the child, which calls [`CreateView`].
2395    ///
2396    /// Only nodes connected to the Root Transform in this Flatland session will be rendered into
2397    /// the parent's Viewport.
2398    ///
2399    /// Calling [`CreateView`] a second time will disconnect the Root Transform from the existing
2400    /// parent's Viewport, and attach it to a new parent's Viewport. In other words, each View can
2401    /// only have one parent.
2402    ///
2403    /// This function is queued, meaning that the Root Transform will not be attached to the
2404    /// parent Viewport until [`Present`] is called. However, clients will receive information
2405    /// through their ParentViewportWatcher (e.g., LayoutInfo) immediately after calling this
2406    /// function, even if they have not called [`Present`] or [`SetRootTransform`]. This allows
2407    /// clients to wait for layout information from their parent before calling [`Present`].
2408    ///
2409    /// Any illegal operations on ParentViewportWatcher will cause both ParentViewportWatcher
2410    /// channel and this Flatland channel to be torn down.
2411    ///
2412    /// Lifecycle note. The lifetime of the ParentViewportWatcher channel is bound by the peer
2413    /// ViewportCreationToken. When the ViewportCreationToken dies, this ParentViewportWatcher
2414    /// channel is destroyed.
2415    ///
2416    /// Views and subgraphs of Views created using `CreateView` will not be represented in the
2417    /// ViewTree, and hence will not be able to participate in any ViewTree-dependent interactions
2418    /// such as touch, mouse or focus.
2419    /// The Flatland protocol provides no way for Views in the subgraph of a View created with
2420    /// `CreateView` to know that they are excluded from the ViewTree.
2421    pub fn r#create_view(
2422        &self,
2423        mut token: fidl_fuchsia_ui_views::ViewCreationToken,
2424        mut parent_viewport_watcher: fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>,
2425    ) -> Result<(), fidl::Error> {
2426        self.client.send::<FlatlandCreateViewRequest>(
2427            (&mut token, parent_viewport_watcher),
2428            0x504686eb25864780,
2429            fidl::encoding::DynamicFlags::empty(),
2430        )
2431    }
2432
2433    /// Identical to [`CreateView`], except it allows association of View identity (ViewRef) and
2434    /// view-bound protocols.
2435    pub fn r#create_view2(
2436        &self,
2437        mut token: fidl_fuchsia_ui_views::ViewCreationToken,
2438        mut view_identity: fidl_fuchsia_ui_views::ViewIdentityOnCreation,
2439        mut protocols: ViewBoundProtocols,
2440        mut parent_viewport_watcher: fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>,
2441    ) -> Result<(), fidl::Error> {
2442        self.client.send::<FlatlandCreateView2Request>(
2443            (&mut token, &mut view_identity, &mut protocols, parent_viewport_watcher),
2444            0x340a3a40c2fdbd5e,
2445            fidl::encoding::DynamicFlags::empty(),
2446        )
2447    }
2448
2449    /// Creates a new Transform node. Transforms are a hierarchical piece of a Flatland graph. They
2450    /// can have children, and can reference Content. A sub-graph represented by a Transform and its
2451    /// descendants can be rendered to a display.
2452    ///
2453    /// Transforms are kept alive, even when released, as long as they are children of either an
2454    /// unreleased Transform, or the Root Transform.
2455    ///
2456    /// Each Transform can have a single piece of attached Content. Common types of Content include
2457    /// bitmaps, asynchronous streams of images, and Viewports to Views hosted in other Flatland
2458    /// sessions.
2459    ///
2460    /// Transforms have attributes. Child Transforms inherit the combined attributes of their
2461    /// parents. Content attached to a Transform is also affected by that Transform's attributes.
2462    ///
2463    /// When a sub-graph of Transforms is rendered, Content will be rendered back-to-front, starting
2464    /// with the Content on the root transform, and continuing recursively through all of its child
2465    /// Transforms in the order the children were added. See [`AddChild`] for more information.
2466    ///
2467    /// Zero is not a valid transform id. All other values are valid, assuming they are not already
2468    /// in use (see [`ReleaseTransform`] for more details).
2469    pub fn r#create_transform(&self, mut transform_id: &TransformId) -> Result<(), fidl::Error> {
2470        self.client.send::<FlatlandCreateTransformRequest>(
2471            (transform_id,),
2472            0x5e042a4d3de3efb0,
2473            fidl::encoding::DynamicFlags::empty(),
2474        )
2475    }
2476
2477    /// All Transform objects support all attributes.
2478    ///
2479    /// Geometric attributes are applied in the following order:
2480    /// 1. Scale (relative to the parent transform's coordinate space)
2481    /// 2. Orientation (relative to the parent transform's coordinate space)
2482    /// 3. Translation (relative to the parent transforms's coordinate space,
2483    ///    unaffected by scale applied to the current transform).
2484    /// 4. Clipping (relative to the current transform's coordinate space)
2485    ///
2486    /// The effects of each of these attributes are cumulative. This means the transform's position
2487    /// in the view space, and its clip boundary, will be calculated based on that chain of
2488    /// geometric attributes going up to the root transform.
2489    ///
2490    /// For instance, in a nested hierarchy such as the following:
2491    ///     [Root-Transform -> Transform1 -> Transform2 -> CurrentTransform]
2492    /// If Transform1 is translated by [2,0] and Transform2 is translated by [0,1] then the
2493    /// view-space position of CurrentTransform will be [2,1].
2494    ///
2495    /// Sets the translation on a Transform. The order of geometric attribute application is
2496    /// addressed above.
2497    pub fn r#set_translation(
2498        &self,
2499        mut transform_id: &TransformId,
2500        mut translation: &fidl_fuchsia_math::Vec_,
2501    ) -> Result<(), fidl::Error> {
2502        self.client.send::<FlatlandSetTranslationRequest>(
2503            (transform_id, translation),
2504            0x7863398291fba346,
2505            fidl::encoding::DynamicFlags::empty(),
2506        )
2507    }
2508
2509    /// Sets the orientation on a Transform. The order of geometric attribute application is
2510    /// addressed in the documentation for [`SetTranslation`]. In Flatland, the +X axis is
2511    /// to the right and the +Y axis is down. There is no notion of a Z axis. CCW is defined
2512    /// from the POV of the user, as if a skeuomorphoic clock is displayed on the screen.
2513    pub fn r#set_orientation(
2514        &self,
2515        mut transform_id: &TransformId,
2516        mut orientation: Orientation,
2517    ) -> Result<(), fidl::Error> {
2518        self.client.send::<FlatlandSetOrientationRequest>(
2519            (transform_id, orientation),
2520            0x4915310bc4928edc,
2521            fidl::encoding::DynamicFlags::empty(),
2522        )
2523    }
2524
2525    /// Sets the scale on a transform. The order of geometric attribute application is
2526    /// addressed above. The (x,y) values in the VecF |scale| refer to the scale factor in the
2527    /// x-axis (width) and y-axis (height) respectively. Scale values must be positive 32-bit
2528    /// floating point values: https://en.wikipedia.org/wiki/Normal_number_%28computing%29
2529    pub fn r#set_scale(
2530        &self,
2531        mut transform_id: &TransformId,
2532        mut scale: &fidl_fuchsia_math::VecF,
2533    ) -> Result<(), fidl::Error> {
2534        self.client.send::<FlatlandSetScaleRequest>(
2535            (transform_id, scale),
2536            0x1ea1766fd8996bb4,
2537            fidl::encoding::DynamicFlags::empty(),
2538        )
2539    }
2540
2541    /// Sets an opacity in linear space to be applied to a transform and its descendents,
2542    /// which include other transforms and content. Opacity values must be in the range
2543    /// of [0.0, 1.0], where 0.0 is completely transparent and 1.0 is completely opaque.
2544    /// Attempting to call this function with values outside that range will result in
2545    /// an error. A transform's opacity value is multiplied with that of its parent. This
2546    /// effect works differently from group opacity. Using group opacity, child nodes are
2547    /// rendered together first, and then have the parent's opacity applied as a post-effect.
2548    /// Here, opacity is applied to each child individually. This may result in a very
2549    /// different effect.
2550    pub fn r#set_opacity(
2551        &self,
2552        mut transform_id: &TransformId,
2553        mut value: f32,
2554    ) -> Result<(), fidl::Error> {
2555        self.client.send::<FlatlandSetOpacityRequest>(
2556            (transform_id, value),
2557            0x3775fc2c00b432fa,
2558            fidl::encoding::DynamicFlags::empty(),
2559        )
2560    }
2561
2562    /// Sets the bounds, expressed in the local coordinate space of the transform, that
2563    /// constrains the region that content attached to this transform can be rendered to.
2564    /// If the content's area exceeds the clip bounds, the area outside the bounds will
2565    /// not be rendered. These bounds are valid for all children of this transform node as
2566    /// well, which includes nested Flatland sessions and their node hierarchies.
2567    /// If a child transform attempts to set clip bounds larger than that of its parent,
2568    /// it will be clipped to the parent's clip bounds. The default state is for a transform
2569    /// to be unclipped, meaning it will not have any bounds placed on its render region.
2570    /// The clip width/height must be positive. Negative values will result in an error.
2571    /// Passing in an empty box to the |rect| parameter will remove the clip bounds.
2572    pub fn r#set_clip_boundary(
2573        &self,
2574        mut transform_id: &TransformId,
2575        mut rect: Option<&fidl_fuchsia_math::Rect>,
2576    ) -> Result<(), fidl::Error> {
2577        self.client.send::<FlatlandSetClipBoundaryRequest>(
2578            (transform_id, rect),
2579            0x6507843df12222d2,
2580            fidl::encoding::DynamicFlags::empty(),
2581        )
2582    }
2583
2584    /// Adds a child Transform to a parent Transform. The new child Transform,
2585    /// and any Content attached to it or its children, will be rendered on top
2586    /// of the parent's Content, as well as any previously added children.
2587    ///
2588    /// The caller must ensure that `child_transform_id` is valid and that there
2589    /// are no repetitions.  Sending a repeated `child_transform_id` over
2590    /// multiple calls will result in session closure.
2591    pub fn r#add_child(
2592        &self,
2593        mut parent_transform_id: &TransformId,
2594        mut child_transform_id: &TransformId,
2595    ) -> Result<(), fidl::Error> {
2596        self.client.send::<FlatlandAddChildRequest>(
2597            (parent_transform_id, child_transform_id),
2598            0x67a8abd2f19b1a74,
2599            fidl::encoding::DynamicFlags::empty(),
2600        )
2601    }
2602
2603    /// Removes a child Transform from a parent Transform.
2604    pub fn r#remove_child(
2605        &self,
2606        mut parent_transform_id: &TransformId,
2607        mut child_transform_id: &TransformId,
2608    ) -> Result<(), fidl::Error> {
2609        self.client.send::<FlatlandRemoveChildRequest>(
2610            (parent_transform_id, child_transform_id),
2611            0x41d6cd90b298b67a,
2612            fidl::encoding::DynamicFlags::empty(),
2613        )
2614    }
2615
2616    /// Removes all child Transforms from a parent Transform and replaces them
2617    /// with the new child transforms in `new_child_transform_ids`.  The caller
2618    /// must ensure that all `TransformId` values in `new_child_transform_ids`
2619    /// are valid and that there are no repetitions.  Sending a repeated
2620    /// `TransformId` in `new_child_transform_ids` will result in session
2621    /// closure.
2622    pub fn r#replace_children(
2623        &self,
2624        mut parent_transform_id: &TransformId,
2625        mut new_child_transform_ids: &[TransformId],
2626    ) -> Result<(), fidl::Error> {
2627        self.client.send::<FlatlandReplaceChildrenRequest>(
2628            (parent_transform_id, new_child_transform_ids),
2629            0x5b6d86cbbff81316,
2630            fidl::encoding::DynamicFlags::empty(),
2631        )
2632    }
2633
2634    /// Sets the Root Transform for the graph.
2635    ///
2636    /// The sub-graph defined by the Root Transform and its children will be rendered as View
2637    /// in the connected parent's Viewport (see [`CreateView`]). Any parents of the Root Transform
2638    /// in this Graph will be ignored.
2639    ///
2640    /// The Root Transform, and all children of the Root Transform, are kept alive if they are
2641    /// released (see [`ReleaseTransform`] for more details).
2642    ///
2643    /// There is only ever one Root. Since 0 is not a valid transform id (see [`CreateTransform`]),
2644    /// calling SetRootTransform(0) clears the current Root, destroying any previously released
2645    /// objects that are not referenced by the new root.
2646    ///
2647    /// Note that every View has a clip boundary equivalent to its logical size. Anything outside
2648    /// that clip boundary will not be rendered. Hence, the Root Transform has a useful coordinate
2649    /// space of (0, 0) to (logical_size.width, logical_size.height), where (0, 0) is the upper left
2650    /// corner.
2651    ///
2652    /// Setting the root transform installs a full screen hit region on the root transform. Clients
2653    /// may remove this hit region if they don't want users to be able to interact with the root
2654    /// transform's content. For additional details on hit regions, see the [`SetHitRegions`]
2655    /// documentation.
2656    ///
2657    /// Default hit region rules
2658    ///
2659    ///   A default hit region follows these rules:
2660    ///   - When [`SetRootTransform`](T) is called, T receives a maximal hit region, covering the
2661    ///   entire view.
2662    ///   - If [`SetHitRegions`] is called on T, either before or after [`SetRootTransform`](T),
2663    ///   then no default hit region is active and the client specified hit regions are used.
2664    ///   - If a transform is no longer the root transform, i.e., [`SetRootTransform`](U) is
2665    ///   called, then the original transform no longer has its default hit region.
2666    ///   - Clients can remove or modify the root transform's hit regions the same way they would
2667    ///   reset any other transform's hit regions, by calling [`SetHitRegions`] with the appropriate
2668    ///   vector.
2669    pub fn r#set_root_transform(&self, mut transform_id: &TransformId) -> Result<(), fidl::Error> {
2670        self.client.send::<FlatlandSetRootTransformRequest>(
2671            (transform_id,),
2672            0x6e80ca5bcc566cd8,
2673            fidl::encoding::DynamicFlags::empty(),
2674        )
2675    }
2676
2677    /// Sets the interactive areas for a Transform. By default, Content is not interactive; hit
2678    /// regions must be placed for a user to interact with the Content in a View. Because hit
2679    /// regions are described in the Flatland protocol, a Flatland session can synchronize Content
2680    /// and hit regions.
2681    ///
2682    /// Each hit region is placed in the coordinate space of the owning Transform, and may or may
2683    /// not interact with different types of hit testing, depending on its [`HitTestInteraction`]
2684    /// type. When there are multiple hit regions that intersect with a hit test, the precedence
2685    /// rules given below dictate which hit region has interacted with the hit test. Only Transforms
2686    /// that transitively connect to the root Transform have their hit regions interact with a hit
2687    /// test.
2688    ///
2689    /// Calling this function replaces any previous values set on this Transform. To reset a
2690    /// Transform to "no hit testing": send an empty vector with [`SetHitRegions`].
2691    ///
2692    /// Note that root transforms get a default hit region installed by Flatland. For more details,
2693    /// see the [`SetRootTransform`] documentation.
2694    ///
2695    /// Precedence rules
2696    ///   Within a Transform, if multiple hit regions overlap, the hit test examines each
2697    ///   intersecting hit region for a possible interaction. Thus, for a regular hit test R and an
2698    ///   accessibility hit test A, where R and A both intersect two hit regions D ([`DEFAULT`]) and
2699    ///   S ([`SEMANTICALLY_INVISIBLE`]) on the same Transform, (1) R interacts with both D and S,
2700    ///   and (2) A only interacts with D. Generally, hit regions that overlap in a single Transform
2701    ///   can cause confusing behavior.
2702    ///
2703    ///   Within a View, for a given hit test, the front-most Transform's hit regions take
2704    ///   precedence over those behind. This follows the expected reverse "render order" of
2705    ///   Transforms (described in [`CreateTransform`]), where a user expects to interact with
2706    ///   Content that is visible, or front-most.
2707    ///
2708    ///   Across Flatland sessions, for a given hit test, the front-most session's front-most
2709    ///   Transform's hit regions take precedence over those behind. This follows the expected
2710    ///   reverse "render order" of views, where a user expects to interact with the View that is
2711    ///   visible, or front-most. For example, if a child View owns Content that is rendered over
2712    ///   the parent View, the user expects to interact with the child's Content.
2713    pub fn r#set_hit_regions(
2714        &self,
2715        mut transform_id: &TransformId,
2716        mut regions: &[HitRegion],
2717    ) -> Result<(), fidl::Error> {
2718        self.client.send::<FlatlandSetHitRegionsRequest>(
2719            (transform_id, regions),
2720            0x31c9d17b07c37ce4,
2721            fidl::encoding::DynamicFlags::empty(),
2722        )
2723    }
2724
2725    /// Identical to [`SetHitRegions`], except the hit region associated with [`transform_id`]
2726    /// covers an infinite region. The hit region is invariant against translation, scaling, and
2727    /// orientation of the Transform.
2728    ///
2729    /// An infinite hit region is still limited in extent by the View's clip boundary, just like a
2730    /// finite hit region.
2731    ///
2732    /// Calling this function replaces any previous values set on this Transform. To reset a
2733    /// Transform to "no hit testing": send an empty vector with [`SetHitRegions`].
2734    pub fn r#set_infinite_hit_region(
2735        &self,
2736        mut transform_id: &TransformId,
2737        mut hit_test: HitTestInteraction,
2738    ) -> Result<(), fidl::Error> {
2739        self.client.send::<FlatlandSetInfiniteHitRegionRequest>(
2740            (transform_id, hit_test),
2741            0x26d81af852d29562,
2742            fidl::encoding::DynamicFlags::empty(),
2743        )
2744    }
2745
2746    /// The Viewport and View pair, together, represent the connection between two Flatland
2747    /// sessions. The Viewport is created in the parent, and the View is created in the child. The
2748    /// parent has control over how the child's View is integrated into its own View.
2749    ///
2750    /// Any illegal operations on ChildViewWatcher will cause both ChildViewWatcher channel and this
2751    /// Flatland channel to be torn down.
2752    ///
2753    /// `ViewportProperties` must have logical_size set. This is the initial size that will drive
2754    /// the layout of the child. The logical_size is also used as the default Content size, but
2755    /// subsequent changes to the logical_size will have no effect on the Content size.
2756    ///
2757    /// `ViewportProperties` may have inset field not set. In that case, the default value of
2758    /// (0, 0, 0, 0) is used.
2759    ///
2760    /// The logical_size must have positive X and Y components.
2761    ///
2762    /// Lifecycle note. The lifetime of the ChildViewWatcher channel is bound by the peer
2763    /// ViewCreationToken. When the ViewCreationToken dies, this ChildViewWatcher channel is
2764    /// destroyed.
2765    ///
2766    /// `viewport_id` must satisfy standard [`ContentId`] creation constraints.
2767    pub fn r#create_viewport(
2768        &self,
2769        mut viewport_id: &ContentId,
2770        mut token: fidl_fuchsia_ui_views::ViewportCreationToken,
2771        mut properties: &ViewportProperties,
2772        mut child_view_watcher: fidl::endpoints::ServerEnd<ChildViewWatcherMarker>,
2773    ) -> Result<(), fidl::Error> {
2774        self.client.send::<FlatlandCreateViewportRequest>(
2775            (viewport_id, &mut token, properties, child_view_watcher),
2776            0x2485fbcab7f943c,
2777            fidl::encoding::DynamicFlags::empty(),
2778        )
2779    }
2780
2781    /// An Image is a bitmap backed by a specific VMO in a BufferCollection.
2782    ///
2783    /// Image creation requires an allocated BufferCollection registered with Allocator. This
2784    /// function will fail unless all clients of the specified BufferCollection have set their
2785    /// constraints.
2786    ///
2787    /// The Image must reference a valid VMO index and must have ImageProperties that fall within
2788    /// the constraints specified by the backing BufferCollection (i.e. width and height within a
2789    /// valid range, etc.)
2790    ///
2791    /// `image_id` must satisfy standard [`ContentId`] creation constraints.
2792    pub fn r#create_image(
2793        &self,
2794        mut image_id: &ContentId,
2795        mut import_token: BufferCollectionImportToken,
2796        mut vmo_index: u32,
2797        mut properties: &ImageProperties,
2798    ) -> Result<(), fidl::Error> {
2799        self.client.send::<FlatlandCreateImageRequest>(
2800            (image_id, &mut import_token, vmo_index, properties),
2801            0x26fae823c4ebedad,
2802            fidl::encoding::DynamicFlags::empty(),
2803        )
2804    }
2805
2806    /// This function is used to determine the region (in texel space) of an image that will be used
2807    /// by Flatland when rendering. The image to be sampled is referenced by [`image_id`] and the
2808    /// sample region is specified by [`rect`] which itself is comprised of an origin point (x,y) as
2809    /// well as a width and height, in unnormalized coordinates. It is illegal to call this function
2810    /// on non-image content, or to sample a region outside of the texel space of the image. In
2811    /// other words, the region specifed by [`rect`] must not exceed the ranges (0, image_width) and
2812    /// (0, image_height). If (rect.x + rect.width > image_width) or (rect.y + rect.height >
2813    /// image_height) or if any of the values are negative, this will result in an error.
2814    ///
2815    /// If this method is not called, the default sample region is the rectangle with origin at
2816    /// (0, 0) and width and height set at ImageProperties from [`CreateImage`].
2817    ///
2818    /// `image_id` must refer to a valid, unreleased Image.
2819    pub fn r#set_image_sample_region(
2820        &self,
2821        mut image_id: &ContentId,
2822        mut rect: &fidl_fuchsia_math::RectF,
2823    ) -> Result<(), fidl::Error> {
2824        self.client.send::<FlatlandSetImageSampleRegionRequest>(
2825            (image_id, rect),
2826            0x8039391d715eb28,
2827            fidl::encoding::DynamicFlags::empty(),
2828        )
2829    }
2830
2831    /// The content size for an Image is the size of the rectangle in the parent's logical
2832    /// coordinate space that the image occupies. This combined with the global translation of the
2833    /// transform it is attached to determines the size and location of where the content is
2834    /// rendered on the display.
2835    ///
2836    /// If this method is not called, the default image destination size is the width and height set
2837    /// at ImageProperties from [`CreateImage`]. The destination size will be affected by scaling if
2838    /// [`SetScale`] is used on the attached Transform or its parents.
2839    pub fn r#set_image_destination_size(
2840        &self,
2841        mut image_id: &ContentId,
2842        mut size: &fidl_fuchsia_math::SizeU,
2843    ) -> Result<(), fidl::Error> {
2844        self.client.send::<FlatlandSetImageDestinationSizeRequest>(
2845            (image_id, size),
2846            0x766cf99a2ec58446,
2847            fidl::encoding::DynamicFlags::empty(),
2848        )
2849    }
2850
2851    /// Determines the blend function to use when rendering the content specified by
2852    /// |image_id|. |image_id| must be a valid ContentId associated to a transform through
2853    /// a call to |CreateImage| or |CreateFilledRect|. For details on the different blend functions
2854    /// that are available, please refer to the BlendMode enum. If this function is not called, then
2855    /// the default blendmode is BlendMode::SRC.
2856    pub fn r#set_image_blending_function(
2857        &self,
2858        mut image_id: &ContentId,
2859        mut blend_mode: BlendMode,
2860    ) -> Result<(), fidl::Error> {
2861        self.client.send::<FlatlandSetImageBlendingFunctionRequest>(
2862            (image_id, blend_mode),
2863            0x10f5da1356275b7b,
2864            fidl::encoding::DynamicFlags::empty(),
2865        )
2866    }
2867
2868    /// Determines the blend function to use when rendering the content specified by
2869    /// |image_id|. |image_id| must be a valid ContentId associated to a transform through
2870    /// a call to |CreateImage| or |CreateFilledRect|. For details on the different blend functions
2871    /// that are available, please refer to the BlendMode2 enum. If this function is not called,
2872    /// the default blendmode is BlendMode2::REPLACE.
2873    pub fn r#set_image_blend_mode(
2874        &self,
2875        mut image_id: &ContentId,
2876        mut blend_mode: BlendMode2,
2877    ) -> Result<(), fidl::Error> {
2878        self.client.send::<FlatlandSetImageBlendModeRequest>(
2879            (image_id, blend_mode),
2880            0x5b1667f130c3de67,
2881            fidl::encoding::DynamicFlags::empty(),
2882        )
2883    }
2884
2885    /// Sets an opacity in linear space to be applied to a flatland image. Opacity values must
2886    /// be in the range [0.0, 1.0].
2887    pub fn r#set_image_opacity(
2888        &self,
2889        mut image_id: &ContentId,
2890        mut val: f32,
2891    ) -> Result<(), fidl::Error> {
2892        self.client.send::<FlatlandSetImageOpacityRequest>(
2893            (image_id, val),
2894            0x2da9e4ef4c2cff6f,
2895            fidl::encoding::DynamicFlags::empty(),
2896        )
2897    }
2898
2899    /// Sets the image flip to be applied to a flatland image. This call must be performed after a
2900    /// successful |CreateImage| call. If an invalid |image_id| is supplied, the channel will be
2901    /// closed due to FlatlandError::BAD_OPERATION. This flip will be applied to the Image before
2902    /// parent Transform Orientations. If this function is not called, then the default flip value
2903    /// is ImageFlip::NONE.
2904    pub fn r#set_image_flip(
2905        &self,
2906        mut image_id: &ContentId,
2907        mut flip: ImageFlip,
2908    ) -> Result<(), fidl::Error> {
2909        self.client.send::<FlatlandSetImageFlipRequest>(
2910            (image_id, flip),
2911            0x21b20f2c14aae6bc,
2912            fidl::encoding::DynamicFlags::empty(),
2913        )
2914    }
2915
2916    /// Creates a solid-color rectangle. By default a filled-rect does not have a defined
2917    /// color or size. It is necessary to call |SetSolidFill| to specify a color and size
2918    /// before a filled rect can be used for rendering. Not doing so will result the
2919    /// rectangle having a default size of (0,0) and so it will not show up when rendering.
2920    ///
2921    /// `rect_id` must satisfy standard [`ContentId`] creation constraints.
2922    pub fn r#create_filled_rect(&self, mut rect_id: &ContentId) -> Result<(), fidl::Error> {
2923        self.client.send::<FlatlandCreateFilledRectRequest>(
2924            (rect_id,),
2925            0x5e62355abc1c4c5d,
2926            fidl::encoding::DynamicFlags::empty(),
2927        )
2928    }
2929
2930    /// Defines the color and size of a filled rect. |rect_id| must refer to content that
2931    /// was created via a call to CreateFilledRect. The color is not premultiplied. Color values
2932    /// must be within the range [0,1] inclusive, and normal 32-bit
2933    /// floating point values: https://en.wikipedia.org/wiki/Normal_number_%28computing%29. Values
2934    /// that do not conform to these specifications will cause the channel to close.
2935    /// The rectangle's top left corner will be at (0, 0) in its transform's coordinate space.
2936    /// Hence, its bottom right corner will be at (size.width, size.height).
2937    ///
2938    /// `rect_id` must refer to a valid, unreleased filled rectangle.
2939    pub fn r#set_solid_fill(
2940        &self,
2941        mut rect_id: &ContentId,
2942        mut color: &ColorRgba,
2943        mut size: &fidl_fuchsia_math::SizeU,
2944    ) -> Result<(), fidl::Error> {
2945        self.client.send::<FlatlandSetSolidFillRequest>(
2946            (rect_id, color, size),
2947            0x32d6ef41e182dfa5,
2948            fidl::encoding::DynamicFlags::empty(),
2949        )
2950    }
2951
2952    /// Automatically garbage collects the rectangle when it is no longer needed for
2953    /// rendering. |rect_id| must have been instantiated with a call to
2954    /// |CreateFilledRect|. Once released, the ID immediately goes out of scope and is free
2955    /// to be used again.
2956    ///
2957    /// `rect_id` must refer to a valid, unreleased filled rectangle.
2958    pub fn r#release_filled_rect(&self, mut rect_id: &ContentId) -> Result<(), fidl::Error> {
2959        self.client.send::<FlatlandReleaseFilledRectRequest>(
2960            (rect_id,),
2961            0x7392cabe45618f9b,
2962            fidl::encoding::DynamicFlags::empty(),
2963        )
2964    }
2965
2966    /// Setting a piece of Content on a Transform makes that Content visible in the render tree as
2967    /// long as the Transform is visible from the root Transform. The Content will be rendered
2968    /// before, and therefore "behind", any Content attached to the descendants of the Transform.
2969    ///
2970    /// Because each Transform can have, at most, a single piece of Content on it, calling this
2971    /// function on a Transform that already has Content will replace that Content.
2972    ///
2973    /// A Content may be set on more than one Transform.
2974    ///
2975    /// Calling this function with a Content id of 0 will remove any Content currently on the
2976    /// Transform.
2977    ///
2978    /// `content_id` must refer to a valid, unreleased Content object, or 0 to clear.
2979    pub fn r#set_content(
2980        &self,
2981        mut transform_id: &TransformId,
2982        mut content_id: &ContentId,
2983    ) -> Result<(), fidl::Error> {
2984        self.client.send::<FlatlandSetContentRequest>(
2985            (transform_id, content_id),
2986            0x4ed2cfc0ce130862,
2987            fidl::encoding::DynamicFlags::empty(),
2988        )
2989    }
2990
2991    /// Transforms are usually sufficient to change how Content is presented. Viewports, however,
2992    /// have special properties that are not part of the Transform hierarchy. Those properties can
2993    /// be set using this function.
2994    pub fn r#set_viewport_properties(
2995        &self,
2996        mut viewport_id: &ContentId,
2997        mut properties: &ViewportProperties,
2998    ) -> Result<(), fidl::Error> {
2999        self.client.send::<FlatlandSetViewportPropertiesRequest>(
3000            (viewport_id, properties),
3001            0x66ab67e9608ddb9f,
3002            fidl::encoding::DynamicFlags::empty(),
3003        )
3004    }
3005
3006    /// Released Transforms will be garbage collected by the system once they are no longer
3007    /// necessary for rendering. For Transforms, this means there is no path from any unreleased
3008    /// Transform to the newly-released Transform.
3009    ///
3010    /// Once released, the id immediately goes out of scope for future function calls and can be
3011    /// reused when creating new Transforms.
3012    ///
3013    /// It is an error to call functions with a released id (unless that id has been reused to
3014    /// construct a new Transform).
3015    pub fn r#release_transform(&self, mut transform_id: &TransformId) -> Result<(), fidl::Error> {
3016        self.client.send::<FlatlandReleaseTransformRequest>(
3017            (transform_id,),
3018            0xab9328419451c22,
3019            fidl::encoding::DynamicFlags::empty(),
3020        )
3021    }
3022
3023    /// Releases the View, which disconnects this Flatland session from its parent Viewport in
3024    /// another Flatland session.
3025    ///
3026    /// To clear the existing content from the screen without releasing the current View, use
3027    /// SetRootTransform(0) instead.
3028    ///
3029    /// Despite having a return type, this function is still feed-forward Like [`CreateView`] and
3030    /// requires a call to [`Present`] to be executed. The ViewCreationToken will be returned after
3031    /// the presented operations have been executed.
3032    pub fn r#release_view(&self) -> Result<(), fidl::Error> {
3033        self.client.send::<fidl::encoding::EmptyPayload>(
3034            (),
3035            0x5b35aab9baffecae,
3036            fidl::encoding::DynamicFlags::empty(),
3037        )
3038    }
3039
3040    /// Releases a Viewport from the scene, even if the Viewport is still connected to a Transform.
3041    /// Unlike other resources, Viewports are garbage collected by the system during the next
3042    /// [`Present`] because a removed Viewport is guaranteed to provide no renderable content.
3043    ///
3044    /// Use SetContent(transform_id, 0) to clean up references to released Viewports.
3045    ///
3046    /// Despite having a return type, this function is still feed-forward like [`CreateView`] and
3047    /// requires a call to [`Present`] to be executed. The ViewportCreationToken will be returned
3048    /// after the presented operations have been executed.
3049    pub fn r#release_viewport(
3050        &self,
3051        mut viewport_id: &ContentId,
3052        ___deadline: zx::MonotonicInstant,
3053    ) -> Result<fidl_fuchsia_ui_views::ViewportCreationToken, fidl::Error> {
3054        let _response = self.client.send_query::<
3055            FlatlandReleaseViewportRequest,
3056            FlatlandReleaseViewportResponse,
3057            FlatlandMarker,
3058        >(
3059            (viewport_id,),
3060            0xbad474aeb5293f9,
3061            fidl::encoding::DynamicFlags::empty(),
3062            ___deadline,
3063        )?;
3064        Ok(_response.token)
3065    }
3066
3067    /// Released Images will be garbage collected by the system once they are no longer necessary
3068    /// for rendering. For Images, this means the Image is no longer attached to any Transform and
3069    /// any pending rendering that references the Image is complete.
3070    ///
3071    /// Use SetContent(transform_id, 0) to clean up references to released Images.
3072    ///
3073    /// Once released, the id immediately goes out of scope for future function calls and can be
3074    /// reused when creating new Images.
3075    ///
3076    /// It is an error to call functions with a released id (unless that id has been reused to
3077    /// construct a new Image).
3078    pub fn r#release_image(&self, mut image_id: &ContentId) -> Result<(), fidl::Error> {
3079        self.client.send::<FlatlandReleaseImageRequest>(
3080            (image_id,),
3081            0xb884ffdbc72c111,
3082            fidl::encoding::DynamicFlags::empty(),
3083        )
3084    }
3085
3086    /// This function will reset all state on this interface. This includes destroying all existing
3087    /// View and Viewports without returning the associated Token to the caller.
3088    pub fn r#clear(&self) -> Result<(), fidl::Error> {
3089        self.client.send::<fidl::encoding::EmptyPayload>(
3090            (),
3091            0x4ec8817c02828c3e,
3092            fidl::encoding::DynamicFlags::empty(),
3093        )
3094    }
3095
3096    /// Set debug name of the current client that can be used by Flatland to print as a prefix to
3097    /// logs to help client distinguish what is theirs. [`name`] can be an arbitrary string, but the
3098    /// current process name (see fsl::GetCurrentProcessName()) is a good default.
3099    pub fn r#set_debug_name(&self, mut name: &str) -> Result<(), fidl::Error> {
3100        self.client.send::<FlatlandSetDebugNameRequest>(
3101            (name,),
3102            0x46a8b397e68a8888,
3103            fidl::encoding::DynamicFlags::empty(),
3104        )
3105    }
3106}
3107
3108#[cfg(target_os = "fuchsia")]
3109impl From<FlatlandSynchronousProxy> for zx::NullableHandle {
3110    fn from(value: FlatlandSynchronousProxy) -> Self {
3111        value.into_channel().into()
3112    }
3113}
3114
3115#[cfg(target_os = "fuchsia")]
3116impl From<fidl::Channel> for FlatlandSynchronousProxy {
3117    fn from(value: fidl::Channel) -> Self {
3118        Self::new(value)
3119    }
3120}
3121
3122#[cfg(target_os = "fuchsia")]
3123impl fidl::endpoints::FromClient for FlatlandSynchronousProxy {
3124    type Protocol = FlatlandMarker;
3125
3126    fn from_client(value: fidl::endpoints::ClientEnd<FlatlandMarker>) -> Self {
3127        Self::new(value.into_channel())
3128    }
3129}
3130
3131#[derive(Debug, Clone)]
3132pub struct FlatlandProxy {
3133    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
3134}
3135
3136impl fidl::endpoints::Proxy for FlatlandProxy {
3137    type Protocol = FlatlandMarker;
3138
3139    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
3140        Self::new(inner)
3141    }
3142
3143    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
3144        self.client.into_channel().map_err(|client| Self { client })
3145    }
3146
3147    fn as_channel(&self) -> &::fidl::AsyncChannel {
3148        self.client.as_channel()
3149    }
3150}
3151
3152impl FlatlandProxy {
3153    /// Create a new Proxy for fuchsia.ui.composition/Flatland.
3154    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
3155        let protocol_name = <FlatlandMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3156        Self { client: fidl::client::Client::new(channel, protocol_name) }
3157    }
3158
3159    /// Get a Stream of events from the remote end of the protocol.
3160    ///
3161    /// # Panics
3162    ///
3163    /// Panics if the event stream was already taken.
3164    pub fn take_event_stream(&self) -> FlatlandEventStream {
3165        FlatlandEventStream { event_receiver: self.client.take_event_receiver() }
3166    }
3167
3168    /// Releases an image immediately, without waiting for the next present.
3169    pub fn r#release_image_immediately(&self, mut image_id: &ContentId) -> Result<(), fidl::Error> {
3170        FlatlandProxyInterface::r#release_image_immediately(self, image_id)
3171    }
3172
3173    /// Releases an Image immediately, without waiting for the next present. This is a trusted
3174    /// memory-eviction path.
3175    ///
3176    /// The Image is forcibly unbound from any Layers that currently reference it. Those Layers
3177    /// behave as if their image was simply never set (they are invisible, but retain their image
3178    /// properties) until their next `SetLayerImage()`.
3179    ///
3180    /// Any pending release fences for the evicted Image's bindings will signal at the earliest
3181    /// safe point.
3182    ///
3183    /// This method is only available if Flatland2 is enabled and the session is trusted.
3184    pub fn r#release_image_immediately2(&self, mut image_id: &ImageId) -> Result<(), fidl::Error> {
3185        FlatlandProxyInterface::r#release_image_immediately2(self, image_id)
3186    }
3187
3188    /// A Layer is a type of `Content` that composites either a single `Image` or a solid
3189    /// color. It separates visual properties (such as size, flip, opacity, and blending)
3190    /// from the raw pixel data.
3191    ///
3192    /// Unlike typical `Content` items which represent a static visual resource, a Layer is designed
3193    /// to be a dynamic container for an image sequence. Typical usage involves setting the layer's
3194    /// visual properties and image metadata infrequently, and then rapidly swapping the active
3195    /// `Image` (e.g. on every frame) with another image of matching metadata.
3196    ///
3197    /// This separation allows a single `Image` resource to be reused across multiple layers with
3198    /// different visual configurations simultaneously.
3199    ///
3200    /// To use a Layer:
3201    /// 1. Create a `Layer` using [`CreateLayer`].
3202    /// 2. Set properties on the `Layer` via [`SetLayerProperties`], including the
3203    ///    composition mode.
3204    /// 3. For an image layer, associate an `Image` with the `Layer` via [`SetLayerImage`].
3205    /// 4. Add the `Layer` to a `LayerStack` via [`SetStackLayers`].
3206    /// 5. Set the `LayerStack` as the content of a node via [`SetTransformContent`].
3207    ///
3208    /// `layer_id` must satisfy the identifier rules documented on [`LayerId`].
3209    pub fn r#create_layer(&self, mut layer_id: &LayerId) -> Result<(), fidl::Error> {
3210        FlatlandProxyInterface::r#create_layer(self, layer_id)
3211    }
3212
3213    /// Released Layers will be garbage collected by the system once they are no longer necessary
3214    /// for rendering. For Layers, this means:
3215    /// - the Layer is no longer referenced by any LayerStack, and
3216    /// - any pending rendering that references the Layer is complete.
3217    ///
3218    /// `layer_id` must refer to a valid, unreleased Layer.
3219    pub fn r#release_layer(&self, mut layer_id: &LayerId) -> Result<(), fidl::Error> {
3220        FlatlandProxyInterface::r#release_layer(self, layer_id)
3221    }
3222
3223    /// Associates an Image with the Layer.
3224    ///
3225    /// The binding is legal in any composition mode, and is sticky: it survives composition
3226    /// mode changes, and is replaced only by a later [`SetLayerImage`] call (or cleared by
3227    /// [`ResetLayer`]). The image is displayed only while the layer's composition mode is
3228    /// `IMAGE`.
3229    ///
3230    /// The bound image must be large enough for the layer's stored `sample_rect`; this is
3231    /// checked at [`fuchsia.ui.composition/Flatland.Present`], not here. See
3232    /// [`LayerProperties.sample_rect`].
3233    ///
3234    /// `layer_id` must refer to a valid, unreleased Layer.
3235    /// `image_id` must refer to a valid, unreleased Image.
3236    /// `acquire_fence` is an optional fence that must be signaled before the image is displayed.
3237    /// `release_fence` is an optional fence, signaled by Scenic when *this binding* no
3238    /// longer references the image. It is per-binding, not per-image: an image bound to
3239    /// several layers has one such fence per binding, and the image is safe to write only
3240    /// once every one of them has signaled.
3241    ///
3242    /// A binding is ended by:
3243    ///
3244    /// - being superseded by a later [`SetLayerImage`] on the same layer
3245    /// - [`ResetLayer`]
3246    /// - the layer ref-count reaching zero, either via [`ReleaseLayer`] or by being released
3247    ///   by a layer stack
3248    /// - destruction of the session, which ends every binding it holds
3249    ///
3250    /// For a binding ended while the session is alive, Scenic signals at the first frame
3251    /// retire after that point. Bindings that never reached the screen (e.g. one superseded
3252    /// within a single batch, or one lost when several
3253    /// [`fuchsia.ui.composition/Flatland.Present`] calls are squashed into a single
3254    /// frame) signal at that same retire rather than immediately. The signal is
3255    /// therefore conservative by at most one frame; it is never early.
3256    pub fn r#set_layer_image(
3257        &self,
3258        mut layer_id: &LayerId,
3259        mut image_id: &ImageId,
3260        mut acquire_fence: Option<WaitFence>,
3261        mut release_fence: Option<SignalFence>,
3262    ) -> Result<(), fidl::Error> {
3263        FlatlandProxyInterface::r#set_layer_image(
3264            self,
3265            layer_id,
3266            image_id,
3267            acquire_fence,
3268            release_fence,
3269        )
3270    }
3271
3272    /// Sets properties of the Layer.
3273    ///
3274    /// The provided `properties` table is merged into the layer's stored properties: fields
3275    /// which are unset in `properties` retain their previously stored values. Stored
3276    /// properties are sticky; see [`LayerProperties`] for the full persistence semantics.
3277    ///
3278    /// Values are stored as given; validation which depends on other state (notably
3279    /// `sample_rect` against the bound image) happens at
3280    /// [`fuchsia.ui.composition/Flatland.Present`]. See [`LayerProperties.sample_rect`].
3281    ///
3282    /// `layer_id` must refer to a valid, unreleased Layer.
3283    pub fn r#set_layer_properties(
3284        &self,
3285        mut layer_id: &LayerId,
3286        mut properties: &LayerProperties,
3287    ) -> Result<(), fidl::Error> {
3288        FlatlandProxyInterface::r#set_layer_properties(self, layer_id, properties)
3289    }
3290
3291    /// Unbinds any Image bound to the layer and clears every stored [`LayerProperties`]
3292    /// field, returning the layer to its freshly-created state (composition mode
3293    /// `INVISIBLE`, all properties at their documented defaults). This is the only
3294    /// operation which forgets stored layer properties.
3295    ///
3296    /// `layer_id` must refer to a valid, unreleased Layer.
3297    pub fn r#reset_layer(&self, mut layer_id: &LayerId) -> Result<(), fidl::Error> {
3298        FlatlandProxyInterface::r#reset_layer(self, layer_id)
3299    }
3300
3301    /// Creates a new layer stack with the specified `stack_id`.
3302    ///
3303    /// `stack_id` must satisfy the identifier rules documented on [`LayerId`].
3304    pub fn r#create_layer_stack(&self, mut stack_id: &LayerStackId) -> Result<(), fidl::Error> {
3305        FlatlandProxyInterface::r#create_layer_stack(self, stack_id)
3306    }
3307
3308    /// Releases the layer stack with the specified `stack_id`.
3309    pub fn r#release_layer_stack(&self, mut stack_id: &LayerStackId) -> Result<(), fidl::Error> {
3310        FlatlandProxyInterface::r#release_layer_stack(self, stack_id)
3311    }
3312
3313    /// Sets the layers in the stack. The order of layers in the vector determines their Z-order,
3314    /// with the first element being the back-most and the last element being the front-most.
3315    ///
3316    /// `stack_id` must refer to a valid, unreleased LayerStack. Each element of `layers`
3317    /// must refer to a valid, unreleased Layer. Duplicate layers within `layers` are
3318    /// disallowed.
3319    pub fn r#set_stack_layers(
3320        &self,
3321        mut stack_id: &LayerStackId,
3322        mut layers: &[LayerId],
3323    ) -> Result<(), fidl::Error> {
3324        FlatlandProxyInterface::r#set_stack_layers(self, stack_id, layers)
3325    }
3326
3327    /// Creates an Image resource.
3328    ///
3329    /// `image_id` must satisfy the identifier rules documented on [`LayerId`].
3330    pub fn r#create_image2(
3331        &self,
3332        mut image_id: &ImageId,
3333        mut import_token: BufferCollectionImportToken,
3334        mut vmo_index: u32,
3335        mut properties: &ImageProperties,
3336    ) -> Result<(), fidl::Error> {
3337        FlatlandProxyInterface::r#create_image2(self, image_id, import_token, vmo_index, properties)
3338    }
3339
3340    /// Released Images will be garbage collected by the system once they are no longer necessary
3341    /// for rendering. For Images, this means:
3342    /// - the Image is no longer bound to any Layer, and
3343    /// - any pending rendering that references the Image is complete.
3344    ///
3345    /// The `image_id` value is freed for reuse immediately by the client (identifier uniqueness
3346    /// is instantaneous).
3347    ///
3348    /// Note: Per-binding release fences (passed to `SetLayerImage`) are unaffected by this call.
3349    /// They track the lifecycle of individual layer bindings, not the client's `image_id`.
3350    ///
3351    /// `image_id` must refer to a valid, unreleased Image.
3352    pub fn r#release_image2(&self, mut image_id: &ImageId) -> Result<(), fidl::Error> {
3353        FlatlandProxyInterface::r#release_image2(self, image_id)
3354    }
3355
3356    /// Creates a Viewport resource.
3357    ///
3358    /// `viewport_id` must satisfy the identifier rules documented on [`LayerId`].
3359    pub fn r#create_viewport2(
3360        &self,
3361        mut viewport_id: &ViewportId,
3362        mut token: fidl_fuchsia_ui_views::ViewportCreationToken,
3363        mut properties: &ViewportProperties,
3364        mut child_view_watcher: fidl::endpoints::ServerEnd<ChildViewWatcherMarker>,
3365    ) -> Result<(), fidl::Error> {
3366        FlatlandProxyInterface::r#create_viewport2(
3367            self,
3368            viewport_id,
3369            token,
3370            properties,
3371            child_view_watcher,
3372        )
3373    }
3374
3375    /// Releases a Viewport from the scene.
3376    pub fn r#release_viewport2(
3377        &self,
3378        mut viewport_id: &ViewportId,
3379    ) -> fidl::client::QueryResponseFut<
3380        fidl_fuchsia_ui_views::ViewportCreationToken,
3381        fidl::encoding::DefaultFuchsiaResourceDialect,
3382    > {
3383        FlatlandProxyInterface::r#release_viewport2(self, viewport_id)
3384    }
3385
3386    /// Sets the properties of a Viewport.
3387    pub fn r#set_viewport_properties2(
3388        &self,
3389        mut viewport_id: &ViewportId,
3390        mut properties: &ViewportProperties,
3391    ) -> Result<(), fidl::Error> {
3392        FlatlandProxyInterface::r#set_viewport_properties2(self, viewport_id, properties)
3393    }
3394
3395    /// Sets (or clears) the content of a Transform.
3396    ///
3397    /// The same content may be attached to more than one Transform; each attachment composites
3398    /// that content again under its own Transform's matrix, clip, and opacity, so a single
3399    /// LayerStack or Viewport can appear repeatedly in a scene without the client duplicating the
3400    /// underlying resources.
3401    ///
3402    /// A Transform's content can be cleared by not providing the optional `content`.
3403    ///
3404    /// If `content` is set, it must refer to a valid, unreleased LayerStack or Viewport.
3405    /// Unlike classic [`Flatland.SetContent`], a zero id does not clear the content.
3406    pub fn r#set_transform_content(
3407        &self,
3408        mut transform_id: &TransformId,
3409        mut content: Option<&TransformContent>,
3410    ) -> Result<(), fidl::Error> {
3411        FlatlandProxyInterface::r#set_transform_content(self, transform_id, content)
3412    }
3413
3414    /// Complete execution of all feed-forward operations.
3415    ///
3416    /// If executing an operation produces an error (e.g., CreateTransform(0)), an [`OnError`] event
3417    /// is emitted. Operations that produce errors are ignored and the channel is closed.
3418    ///
3419    /// If execution completes successfully, [`OnNextFrameBegin`] is emitted with valid frame
3420    /// production information.
3421    ///
3422    /// The client may only call [`Present`] when they have a non-zero number of present credits,
3423    /// which are tracked by the server. The server may increment the number of credits when it
3424    /// fires the [`OnNextFrameBegin`] event, which informs the client when it receives additional
3425    /// present credits. Each [`Present`] call uses one present credit and decrements the server
3426    /// count by one. If the client calls [`Present`] with no present credits, the server will
3427    /// return a `NO_PRESENTS_REMAINING` error.
3428    ///
3429    /// The client should assume that prior to receiving any [`OnNextFrameBegin`] events, they have
3430    /// one present credit.
3431    ///
3432    /// Every [`Present`] call results in one [`OnNextFrameBegin`] event, and one
3433    /// [`OnFramePresented`] event, typically in that order.
3434    ///
3435    /// When the commands flushed by [`Present`] make it to display, an [`OnFramePresented`] event
3436    /// is fired. This event includes information pertaining to all [`Present`]s that had content
3437    /// that were part of that frame.
3438    ///
3439    /// See [`fuchsia.ui.composition/PresentArgs`] documentation above for more detailed information
3440    /// on what arguments are passed in and their role.
3441    pub fn r#present(&self, mut args: PresentArgs) -> Result<(), fidl::Error> {
3442        FlatlandProxyInterface::r#present(self, args)
3443    }
3444
3445    /// Two Flatland sessions may be connected in a parent-child relationship. The parent endpoint
3446    /// is held in a Viewport, and the child endpoint is held in a View. The parent Flatland
3447    /// session that creates a Viewport has control over how the child's View is integrated into
3448    /// its own View.
3449    ///
3450    /// The lifecycle of a parent-child connection starts with two endpoints of a channel object:
3451    /// a ViewportCreationToken and a ViewCreationToken. Out-of-band protocols pass the
3452    /// ViewportCreationToken to the parent, which calls [`CreateViewport`], and the
3453    /// ViewCreationToken to the child, which calls [`CreateView`].
3454    ///
3455    /// Only nodes connected to the Root Transform in this Flatland session will be rendered into
3456    /// the parent's Viewport.
3457    ///
3458    /// Calling [`CreateView`] a second time will disconnect the Root Transform from the existing
3459    /// parent's Viewport, and attach it to a new parent's Viewport. In other words, each View can
3460    /// only have one parent.
3461    ///
3462    /// This function is queued, meaning that the Root Transform will not be attached to the
3463    /// parent Viewport until [`Present`] is called. However, clients will receive information
3464    /// through their ParentViewportWatcher (e.g., LayoutInfo) immediately after calling this
3465    /// function, even if they have not called [`Present`] or [`SetRootTransform`]. This allows
3466    /// clients to wait for layout information from their parent before calling [`Present`].
3467    ///
3468    /// Any illegal operations on ParentViewportWatcher will cause both ParentViewportWatcher
3469    /// channel and this Flatland channel to be torn down.
3470    ///
3471    /// Lifecycle note. The lifetime of the ParentViewportWatcher channel is bound by the peer
3472    /// ViewportCreationToken. When the ViewportCreationToken dies, this ParentViewportWatcher
3473    /// channel is destroyed.
3474    ///
3475    /// Views and subgraphs of Views created using `CreateView` will not be represented in the
3476    /// ViewTree, and hence will not be able to participate in any ViewTree-dependent interactions
3477    /// such as touch, mouse or focus.
3478    /// The Flatland protocol provides no way for Views in the subgraph of a View created with
3479    /// `CreateView` to know that they are excluded from the ViewTree.
3480    pub fn r#create_view(
3481        &self,
3482        mut token: fidl_fuchsia_ui_views::ViewCreationToken,
3483        mut parent_viewport_watcher: fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>,
3484    ) -> Result<(), fidl::Error> {
3485        FlatlandProxyInterface::r#create_view(self, token, parent_viewport_watcher)
3486    }
3487
3488    /// Identical to [`CreateView`], except it allows association of View identity (ViewRef) and
3489    /// view-bound protocols.
3490    pub fn r#create_view2(
3491        &self,
3492        mut token: fidl_fuchsia_ui_views::ViewCreationToken,
3493        mut view_identity: fidl_fuchsia_ui_views::ViewIdentityOnCreation,
3494        mut protocols: ViewBoundProtocols,
3495        mut parent_viewport_watcher: fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>,
3496    ) -> Result<(), fidl::Error> {
3497        FlatlandProxyInterface::r#create_view2(
3498            self,
3499            token,
3500            view_identity,
3501            protocols,
3502            parent_viewport_watcher,
3503        )
3504    }
3505
3506    /// Creates a new Transform node. Transforms are a hierarchical piece of a Flatland graph. They
3507    /// can have children, and can reference Content. A sub-graph represented by a Transform and its
3508    /// descendants can be rendered to a display.
3509    ///
3510    /// Transforms are kept alive, even when released, as long as they are children of either an
3511    /// unreleased Transform, or the Root Transform.
3512    ///
3513    /// Each Transform can have a single piece of attached Content. Common types of Content include
3514    /// bitmaps, asynchronous streams of images, and Viewports to Views hosted in other Flatland
3515    /// sessions.
3516    ///
3517    /// Transforms have attributes. Child Transforms inherit the combined attributes of their
3518    /// parents. Content attached to a Transform is also affected by that Transform's attributes.
3519    ///
3520    /// When a sub-graph of Transforms is rendered, Content will be rendered back-to-front, starting
3521    /// with the Content on the root transform, and continuing recursively through all of its child
3522    /// Transforms in the order the children were added. See [`AddChild`] for more information.
3523    ///
3524    /// Zero is not a valid transform id. All other values are valid, assuming they are not already
3525    /// in use (see [`ReleaseTransform`] for more details).
3526    pub fn r#create_transform(&self, mut transform_id: &TransformId) -> Result<(), fidl::Error> {
3527        FlatlandProxyInterface::r#create_transform(self, transform_id)
3528    }
3529
3530    /// All Transform objects support all attributes.
3531    ///
3532    /// Geometric attributes are applied in the following order:
3533    /// 1. Scale (relative to the parent transform's coordinate space)
3534    /// 2. Orientation (relative to the parent transform's coordinate space)
3535    /// 3. Translation (relative to the parent transforms's coordinate space,
3536    ///    unaffected by scale applied to the current transform).
3537    /// 4. Clipping (relative to the current transform's coordinate space)
3538    ///
3539    /// The effects of each of these attributes are cumulative. This means the transform's position
3540    /// in the view space, and its clip boundary, will be calculated based on that chain of
3541    /// geometric attributes going up to the root transform.
3542    ///
3543    /// For instance, in a nested hierarchy such as the following:
3544    ///     [Root-Transform -> Transform1 -> Transform2 -> CurrentTransform]
3545    /// If Transform1 is translated by [2,0] and Transform2 is translated by [0,1] then the
3546    /// view-space position of CurrentTransform will be [2,1].
3547    ///
3548    /// Sets the translation on a Transform. The order of geometric attribute application is
3549    /// addressed above.
3550    pub fn r#set_translation(
3551        &self,
3552        mut transform_id: &TransformId,
3553        mut translation: &fidl_fuchsia_math::Vec_,
3554    ) -> Result<(), fidl::Error> {
3555        FlatlandProxyInterface::r#set_translation(self, transform_id, translation)
3556    }
3557
3558    /// Sets the orientation on a Transform. The order of geometric attribute application is
3559    /// addressed in the documentation for [`SetTranslation`]. In Flatland, the +X axis is
3560    /// to the right and the +Y axis is down. There is no notion of a Z axis. CCW is defined
3561    /// from the POV of the user, as if a skeuomorphoic clock is displayed on the screen.
3562    pub fn r#set_orientation(
3563        &self,
3564        mut transform_id: &TransformId,
3565        mut orientation: Orientation,
3566    ) -> Result<(), fidl::Error> {
3567        FlatlandProxyInterface::r#set_orientation(self, transform_id, orientation)
3568    }
3569
3570    /// Sets the scale on a transform. The order of geometric attribute application is
3571    /// addressed above. The (x,y) values in the VecF |scale| refer to the scale factor in the
3572    /// x-axis (width) and y-axis (height) respectively. Scale values must be positive 32-bit
3573    /// floating point values: https://en.wikipedia.org/wiki/Normal_number_%28computing%29
3574    pub fn r#set_scale(
3575        &self,
3576        mut transform_id: &TransformId,
3577        mut scale: &fidl_fuchsia_math::VecF,
3578    ) -> Result<(), fidl::Error> {
3579        FlatlandProxyInterface::r#set_scale(self, transform_id, scale)
3580    }
3581
3582    /// Sets an opacity in linear space to be applied to a transform and its descendents,
3583    /// which include other transforms and content. Opacity values must be in the range
3584    /// of [0.0, 1.0], where 0.0 is completely transparent and 1.0 is completely opaque.
3585    /// Attempting to call this function with values outside that range will result in
3586    /// an error. A transform's opacity value is multiplied with that of its parent. This
3587    /// effect works differently from group opacity. Using group opacity, child nodes are
3588    /// rendered together first, and then have the parent's opacity applied as a post-effect.
3589    /// Here, opacity is applied to each child individually. This may result in a very
3590    /// different effect.
3591    pub fn r#set_opacity(
3592        &self,
3593        mut transform_id: &TransformId,
3594        mut value: f32,
3595    ) -> Result<(), fidl::Error> {
3596        FlatlandProxyInterface::r#set_opacity(self, transform_id, value)
3597    }
3598
3599    /// Sets the bounds, expressed in the local coordinate space of the transform, that
3600    /// constrains the region that content attached to this transform can be rendered to.
3601    /// If the content's area exceeds the clip bounds, the area outside the bounds will
3602    /// not be rendered. These bounds are valid for all children of this transform node as
3603    /// well, which includes nested Flatland sessions and their node hierarchies.
3604    /// If a child transform attempts to set clip bounds larger than that of its parent,
3605    /// it will be clipped to the parent's clip bounds. The default state is for a transform
3606    /// to be unclipped, meaning it will not have any bounds placed on its render region.
3607    /// The clip width/height must be positive. Negative values will result in an error.
3608    /// Passing in an empty box to the |rect| parameter will remove the clip bounds.
3609    pub fn r#set_clip_boundary(
3610        &self,
3611        mut transform_id: &TransformId,
3612        mut rect: Option<&fidl_fuchsia_math::Rect>,
3613    ) -> Result<(), fidl::Error> {
3614        FlatlandProxyInterface::r#set_clip_boundary(self, transform_id, rect)
3615    }
3616
3617    /// Adds a child Transform to a parent Transform. The new child Transform,
3618    /// and any Content attached to it or its children, will be rendered on top
3619    /// of the parent's Content, as well as any previously added children.
3620    ///
3621    /// The caller must ensure that `child_transform_id` is valid and that there
3622    /// are no repetitions.  Sending a repeated `child_transform_id` over
3623    /// multiple calls will result in session closure.
3624    pub fn r#add_child(
3625        &self,
3626        mut parent_transform_id: &TransformId,
3627        mut child_transform_id: &TransformId,
3628    ) -> Result<(), fidl::Error> {
3629        FlatlandProxyInterface::r#add_child(self, parent_transform_id, child_transform_id)
3630    }
3631
3632    /// Removes a child Transform from a parent Transform.
3633    pub fn r#remove_child(
3634        &self,
3635        mut parent_transform_id: &TransformId,
3636        mut child_transform_id: &TransformId,
3637    ) -> Result<(), fidl::Error> {
3638        FlatlandProxyInterface::r#remove_child(self, parent_transform_id, child_transform_id)
3639    }
3640
3641    /// Removes all child Transforms from a parent Transform and replaces them
3642    /// with the new child transforms in `new_child_transform_ids`.  The caller
3643    /// must ensure that all `TransformId` values in `new_child_transform_ids`
3644    /// are valid and that there are no repetitions.  Sending a repeated
3645    /// `TransformId` in `new_child_transform_ids` will result in session
3646    /// closure.
3647    pub fn r#replace_children(
3648        &self,
3649        mut parent_transform_id: &TransformId,
3650        mut new_child_transform_ids: &[TransformId],
3651    ) -> Result<(), fidl::Error> {
3652        FlatlandProxyInterface::r#replace_children(
3653            self,
3654            parent_transform_id,
3655            new_child_transform_ids,
3656        )
3657    }
3658
3659    /// Sets the Root Transform for the graph.
3660    ///
3661    /// The sub-graph defined by the Root Transform and its children will be rendered as View
3662    /// in the connected parent's Viewport (see [`CreateView`]). Any parents of the Root Transform
3663    /// in this Graph will be ignored.
3664    ///
3665    /// The Root Transform, and all children of the Root Transform, are kept alive if they are
3666    /// released (see [`ReleaseTransform`] for more details).
3667    ///
3668    /// There is only ever one Root. Since 0 is not a valid transform id (see [`CreateTransform`]),
3669    /// calling SetRootTransform(0) clears the current Root, destroying any previously released
3670    /// objects that are not referenced by the new root.
3671    ///
3672    /// Note that every View has a clip boundary equivalent to its logical size. Anything outside
3673    /// that clip boundary will not be rendered. Hence, the Root Transform has a useful coordinate
3674    /// space of (0, 0) to (logical_size.width, logical_size.height), where (0, 0) is the upper left
3675    /// corner.
3676    ///
3677    /// Setting the root transform installs a full screen hit region on the root transform. Clients
3678    /// may remove this hit region if they don't want users to be able to interact with the root
3679    /// transform's content. For additional details on hit regions, see the [`SetHitRegions`]
3680    /// documentation.
3681    ///
3682    /// Default hit region rules
3683    ///
3684    ///   A default hit region follows these rules:
3685    ///   - When [`SetRootTransform`](T) is called, T receives a maximal hit region, covering the
3686    ///   entire view.
3687    ///   - If [`SetHitRegions`] is called on T, either before or after [`SetRootTransform`](T),
3688    ///   then no default hit region is active and the client specified hit regions are used.
3689    ///   - If a transform is no longer the root transform, i.e., [`SetRootTransform`](U) is
3690    ///   called, then the original transform no longer has its default hit region.
3691    ///   - Clients can remove or modify the root transform's hit regions the same way they would
3692    ///   reset any other transform's hit regions, by calling [`SetHitRegions`] with the appropriate
3693    ///   vector.
3694    pub fn r#set_root_transform(&self, mut transform_id: &TransformId) -> Result<(), fidl::Error> {
3695        FlatlandProxyInterface::r#set_root_transform(self, transform_id)
3696    }
3697
3698    /// Sets the interactive areas for a Transform. By default, Content is not interactive; hit
3699    /// regions must be placed for a user to interact with the Content in a View. Because hit
3700    /// regions are described in the Flatland protocol, a Flatland session can synchronize Content
3701    /// and hit regions.
3702    ///
3703    /// Each hit region is placed in the coordinate space of the owning Transform, and may or may
3704    /// not interact with different types of hit testing, depending on its [`HitTestInteraction`]
3705    /// type. When there are multiple hit regions that intersect with a hit test, the precedence
3706    /// rules given below dictate which hit region has interacted with the hit test. Only Transforms
3707    /// that transitively connect to the root Transform have their hit regions interact with a hit
3708    /// test.
3709    ///
3710    /// Calling this function replaces any previous values set on this Transform. To reset a
3711    /// Transform to "no hit testing": send an empty vector with [`SetHitRegions`].
3712    ///
3713    /// Note that root transforms get a default hit region installed by Flatland. For more details,
3714    /// see the [`SetRootTransform`] documentation.
3715    ///
3716    /// Precedence rules
3717    ///   Within a Transform, if multiple hit regions overlap, the hit test examines each
3718    ///   intersecting hit region for a possible interaction. Thus, for a regular hit test R and an
3719    ///   accessibility hit test A, where R and A both intersect two hit regions D ([`DEFAULT`]) and
3720    ///   S ([`SEMANTICALLY_INVISIBLE`]) on the same Transform, (1) R interacts with both D and S,
3721    ///   and (2) A only interacts with D. Generally, hit regions that overlap in a single Transform
3722    ///   can cause confusing behavior.
3723    ///
3724    ///   Within a View, for a given hit test, the front-most Transform's hit regions take
3725    ///   precedence over those behind. This follows the expected reverse "render order" of
3726    ///   Transforms (described in [`CreateTransform`]), where a user expects to interact with
3727    ///   Content that is visible, or front-most.
3728    ///
3729    ///   Across Flatland sessions, for a given hit test, the front-most session's front-most
3730    ///   Transform's hit regions take precedence over those behind. This follows the expected
3731    ///   reverse "render order" of views, where a user expects to interact with the View that is
3732    ///   visible, or front-most. For example, if a child View owns Content that is rendered over
3733    ///   the parent View, the user expects to interact with the child's Content.
3734    pub fn r#set_hit_regions(
3735        &self,
3736        mut transform_id: &TransformId,
3737        mut regions: &[HitRegion],
3738    ) -> Result<(), fidl::Error> {
3739        FlatlandProxyInterface::r#set_hit_regions(self, transform_id, regions)
3740    }
3741
3742    /// Identical to [`SetHitRegions`], except the hit region associated with [`transform_id`]
3743    /// covers an infinite region. The hit region is invariant against translation, scaling, and
3744    /// orientation of the Transform.
3745    ///
3746    /// An infinite hit region is still limited in extent by the View's clip boundary, just like a
3747    /// finite hit region.
3748    ///
3749    /// Calling this function replaces any previous values set on this Transform. To reset a
3750    /// Transform to "no hit testing": send an empty vector with [`SetHitRegions`].
3751    pub fn r#set_infinite_hit_region(
3752        &self,
3753        mut transform_id: &TransformId,
3754        mut hit_test: HitTestInteraction,
3755    ) -> Result<(), fidl::Error> {
3756        FlatlandProxyInterface::r#set_infinite_hit_region(self, transform_id, hit_test)
3757    }
3758
3759    /// The Viewport and View pair, together, represent the connection between two Flatland
3760    /// sessions. The Viewport is created in the parent, and the View is created in the child. The
3761    /// parent has control over how the child's View is integrated into its own View.
3762    ///
3763    /// Any illegal operations on ChildViewWatcher will cause both ChildViewWatcher channel and this
3764    /// Flatland channel to be torn down.
3765    ///
3766    /// `ViewportProperties` must have logical_size set. This is the initial size that will drive
3767    /// the layout of the child. The logical_size is also used as the default Content size, but
3768    /// subsequent changes to the logical_size will have no effect on the Content size.
3769    ///
3770    /// `ViewportProperties` may have inset field not set. In that case, the default value of
3771    /// (0, 0, 0, 0) is used.
3772    ///
3773    /// The logical_size must have positive X and Y components.
3774    ///
3775    /// Lifecycle note. The lifetime of the ChildViewWatcher channel is bound by the peer
3776    /// ViewCreationToken. When the ViewCreationToken dies, this ChildViewWatcher channel is
3777    /// destroyed.
3778    ///
3779    /// `viewport_id` must satisfy standard [`ContentId`] creation constraints.
3780    pub fn r#create_viewport(
3781        &self,
3782        mut viewport_id: &ContentId,
3783        mut token: fidl_fuchsia_ui_views::ViewportCreationToken,
3784        mut properties: &ViewportProperties,
3785        mut child_view_watcher: fidl::endpoints::ServerEnd<ChildViewWatcherMarker>,
3786    ) -> Result<(), fidl::Error> {
3787        FlatlandProxyInterface::r#create_viewport(
3788            self,
3789            viewport_id,
3790            token,
3791            properties,
3792            child_view_watcher,
3793        )
3794    }
3795
3796    /// An Image is a bitmap backed by a specific VMO in a BufferCollection.
3797    ///
3798    /// Image creation requires an allocated BufferCollection registered with Allocator. This
3799    /// function will fail unless all clients of the specified BufferCollection have set their
3800    /// constraints.
3801    ///
3802    /// The Image must reference a valid VMO index and must have ImageProperties that fall within
3803    /// the constraints specified by the backing BufferCollection (i.e. width and height within a
3804    /// valid range, etc.)
3805    ///
3806    /// `image_id` must satisfy standard [`ContentId`] creation constraints.
3807    pub fn r#create_image(
3808        &self,
3809        mut image_id: &ContentId,
3810        mut import_token: BufferCollectionImportToken,
3811        mut vmo_index: u32,
3812        mut properties: &ImageProperties,
3813    ) -> Result<(), fidl::Error> {
3814        FlatlandProxyInterface::r#create_image(self, image_id, import_token, vmo_index, properties)
3815    }
3816
3817    /// This function is used to determine the region (in texel space) of an image that will be used
3818    /// by Flatland when rendering. The image to be sampled is referenced by [`image_id`] and the
3819    /// sample region is specified by [`rect`] which itself is comprised of an origin point (x,y) as
3820    /// well as a width and height, in unnormalized coordinates. It is illegal to call this function
3821    /// on non-image content, or to sample a region outside of the texel space of the image. In
3822    /// other words, the region specifed by [`rect`] must not exceed the ranges (0, image_width) and
3823    /// (0, image_height). If (rect.x + rect.width > image_width) or (rect.y + rect.height >
3824    /// image_height) or if any of the values are negative, this will result in an error.
3825    ///
3826    /// If this method is not called, the default sample region is the rectangle with origin at
3827    /// (0, 0) and width and height set at ImageProperties from [`CreateImage`].
3828    ///
3829    /// `image_id` must refer to a valid, unreleased Image.
3830    pub fn r#set_image_sample_region(
3831        &self,
3832        mut image_id: &ContentId,
3833        mut rect: &fidl_fuchsia_math::RectF,
3834    ) -> Result<(), fidl::Error> {
3835        FlatlandProxyInterface::r#set_image_sample_region(self, image_id, rect)
3836    }
3837
3838    /// The content size for an Image is the size of the rectangle in the parent's logical
3839    /// coordinate space that the image occupies. This combined with the global translation of the
3840    /// transform it is attached to determines the size and location of where the content is
3841    /// rendered on the display.
3842    ///
3843    /// If this method is not called, the default image destination size is the width and height set
3844    /// at ImageProperties from [`CreateImage`]. The destination size will be affected by scaling if
3845    /// [`SetScale`] is used on the attached Transform or its parents.
3846    pub fn r#set_image_destination_size(
3847        &self,
3848        mut image_id: &ContentId,
3849        mut size: &fidl_fuchsia_math::SizeU,
3850    ) -> Result<(), fidl::Error> {
3851        FlatlandProxyInterface::r#set_image_destination_size(self, image_id, size)
3852    }
3853
3854    /// Determines the blend function to use when rendering the content specified by
3855    /// |image_id|. |image_id| must be a valid ContentId associated to a transform through
3856    /// a call to |CreateImage| or |CreateFilledRect|. For details on the different blend functions
3857    /// that are available, please refer to the BlendMode enum. If this function is not called, then
3858    /// the default blendmode is BlendMode::SRC.
3859    pub fn r#set_image_blending_function(
3860        &self,
3861        mut image_id: &ContentId,
3862        mut blend_mode: BlendMode,
3863    ) -> Result<(), fidl::Error> {
3864        FlatlandProxyInterface::r#set_image_blending_function(self, image_id, blend_mode)
3865    }
3866
3867    /// Determines the blend function to use when rendering the content specified by
3868    /// |image_id|. |image_id| must be a valid ContentId associated to a transform through
3869    /// a call to |CreateImage| or |CreateFilledRect|. For details on the different blend functions
3870    /// that are available, please refer to the BlendMode2 enum. If this function is not called,
3871    /// the default blendmode is BlendMode2::REPLACE.
3872    pub fn r#set_image_blend_mode(
3873        &self,
3874        mut image_id: &ContentId,
3875        mut blend_mode: BlendMode2,
3876    ) -> Result<(), fidl::Error> {
3877        FlatlandProxyInterface::r#set_image_blend_mode(self, image_id, blend_mode)
3878    }
3879
3880    /// Sets an opacity in linear space to be applied to a flatland image. Opacity values must
3881    /// be in the range [0.0, 1.0].
3882    pub fn r#set_image_opacity(
3883        &self,
3884        mut image_id: &ContentId,
3885        mut val: f32,
3886    ) -> Result<(), fidl::Error> {
3887        FlatlandProxyInterface::r#set_image_opacity(self, image_id, val)
3888    }
3889
3890    /// Sets the image flip to be applied to a flatland image. This call must be performed after a
3891    /// successful |CreateImage| call. If an invalid |image_id| is supplied, the channel will be
3892    /// closed due to FlatlandError::BAD_OPERATION. This flip will be applied to the Image before
3893    /// parent Transform Orientations. If this function is not called, then the default flip value
3894    /// is ImageFlip::NONE.
3895    pub fn r#set_image_flip(
3896        &self,
3897        mut image_id: &ContentId,
3898        mut flip: ImageFlip,
3899    ) -> Result<(), fidl::Error> {
3900        FlatlandProxyInterface::r#set_image_flip(self, image_id, flip)
3901    }
3902
3903    /// Creates a solid-color rectangle. By default a filled-rect does not have a defined
3904    /// color or size. It is necessary to call |SetSolidFill| to specify a color and size
3905    /// before a filled rect can be used for rendering. Not doing so will result the
3906    /// rectangle having a default size of (0,0) and so it will not show up when rendering.
3907    ///
3908    /// `rect_id` must satisfy standard [`ContentId`] creation constraints.
3909    pub fn r#create_filled_rect(&self, mut rect_id: &ContentId) -> Result<(), fidl::Error> {
3910        FlatlandProxyInterface::r#create_filled_rect(self, rect_id)
3911    }
3912
3913    /// Defines the color and size of a filled rect. |rect_id| must refer to content that
3914    /// was created via a call to CreateFilledRect. The color is not premultiplied. Color values
3915    /// must be within the range [0,1] inclusive, and normal 32-bit
3916    /// floating point values: https://en.wikipedia.org/wiki/Normal_number_%28computing%29. Values
3917    /// that do not conform to these specifications will cause the channel to close.
3918    /// The rectangle's top left corner will be at (0, 0) in its transform's coordinate space.
3919    /// Hence, its bottom right corner will be at (size.width, size.height).
3920    ///
3921    /// `rect_id` must refer to a valid, unreleased filled rectangle.
3922    pub fn r#set_solid_fill(
3923        &self,
3924        mut rect_id: &ContentId,
3925        mut color: &ColorRgba,
3926        mut size: &fidl_fuchsia_math::SizeU,
3927    ) -> Result<(), fidl::Error> {
3928        FlatlandProxyInterface::r#set_solid_fill(self, rect_id, color, size)
3929    }
3930
3931    /// Automatically garbage collects the rectangle when it is no longer needed for
3932    /// rendering. |rect_id| must have been instantiated with a call to
3933    /// |CreateFilledRect|. Once released, the ID immediately goes out of scope and is free
3934    /// to be used again.
3935    ///
3936    /// `rect_id` must refer to a valid, unreleased filled rectangle.
3937    pub fn r#release_filled_rect(&self, mut rect_id: &ContentId) -> Result<(), fidl::Error> {
3938        FlatlandProxyInterface::r#release_filled_rect(self, rect_id)
3939    }
3940
3941    /// Setting a piece of Content on a Transform makes that Content visible in the render tree as
3942    /// long as the Transform is visible from the root Transform. The Content will be rendered
3943    /// before, and therefore "behind", any Content attached to the descendants of the Transform.
3944    ///
3945    /// Because each Transform can have, at most, a single piece of Content on it, calling this
3946    /// function on a Transform that already has Content will replace that Content.
3947    ///
3948    /// A Content may be set on more than one Transform.
3949    ///
3950    /// Calling this function with a Content id of 0 will remove any Content currently on the
3951    /// Transform.
3952    ///
3953    /// `content_id` must refer to a valid, unreleased Content object, or 0 to clear.
3954    pub fn r#set_content(
3955        &self,
3956        mut transform_id: &TransformId,
3957        mut content_id: &ContentId,
3958    ) -> Result<(), fidl::Error> {
3959        FlatlandProxyInterface::r#set_content(self, transform_id, content_id)
3960    }
3961
3962    /// Transforms are usually sufficient to change how Content is presented. Viewports, however,
3963    /// have special properties that are not part of the Transform hierarchy. Those properties can
3964    /// be set using this function.
3965    pub fn r#set_viewport_properties(
3966        &self,
3967        mut viewport_id: &ContentId,
3968        mut properties: &ViewportProperties,
3969    ) -> Result<(), fidl::Error> {
3970        FlatlandProxyInterface::r#set_viewport_properties(self, viewport_id, properties)
3971    }
3972
3973    /// Released Transforms will be garbage collected by the system once they are no longer
3974    /// necessary for rendering. For Transforms, this means there is no path from any unreleased
3975    /// Transform to the newly-released Transform.
3976    ///
3977    /// Once released, the id immediately goes out of scope for future function calls and can be
3978    /// reused when creating new Transforms.
3979    ///
3980    /// It is an error to call functions with a released id (unless that id has been reused to
3981    /// construct a new Transform).
3982    pub fn r#release_transform(&self, mut transform_id: &TransformId) -> Result<(), fidl::Error> {
3983        FlatlandProxyInterface::r#release_transform(self, transform_id)
3984    }
3985
3986    /// Releases the View, which disconnects this Flatland session from its parent Viewport in
3987    /// another Flatland session.
3988    ///
3989    /// To clear the existing content from the screen without releasing the current View, use
3990    /// SetRootTransform(0) instead.
3991    ///
3992    /// Despite having a return type, this function is still feed-forward Like [`CreateView`] and
3993    /// requires a call to [`Present`] to be executed. The ViewCreationToken will be returned after
3994    /// the presented operations have been executed.
3995    pub fn r#release_view(&self) -> Result<(), fidl::Error> {
3996        FlatlandProxyInterface::r#release_view(self)
3997    }
3998
3999    /// Releases a Viewport from the scene, even if the Viewport is still connected to a Transform.
4000    /// Unlike other resources, Viewports are garbage collected by the system during the next
4001    /// [`Present`] because a removed Viewport is guaranteed to provide no renderable content.
4002    ///
4003    /// Use SetContent(transform_id, 0) to clean up references to released Viewports.
4004    ///
4005    /// Despite having a return type, this function is still feed-forward like [`CreateView`] and
4006    /// requires a call to [`Present`] to be executed. The ViewportCreationToken will be returned
4007    /// after the presented operations have been executed.
4008    pub fn r#release_viewport(
4009        &self,
4010        mut viewport_id: &ContentId,
4011    ) -> fidl::client::QueryResponseFut<
4012        fidl_fuchsia_ui_views::ViewportCreationToken,
4013        fidl::encoding::DefaultFuchsiaResourceDialect,
4014    > {
4015        FlatlandProxyInterface::r#release_viewport(self, viewport_id)
4016    }
4017
4018    /// Released Images will be garbage collected by the system once they are no longer necessary
4019    /// for rendering. For Images, this means the Image is no longer attached to any Transform and
4020    /// any pending rendering that references the Image is complete.
4021    ///
4022    /// Use SetContent(transform_id, 0) to clean up references to released Images.
4023    ///
4024    /// Once released, the id immediately goes out of scope for future function calls and can be
4025    /// reused when creating new Images.
4026    ///
4027    /// It is an error to call functions with a released id (unless that id has been reused to
4028    /// construct a new Image).
4029    pub fn r#release_image(&self, mut image_id: &ContentId) -> Result<(), fidl::Error> {
4030        FlatlandProxyInterface::r#release_image(self, image_id)
4031    }
4032
4033    /// This function will reset all state on this interface. This includes destroying all existing
4034    /// View and Viewports without returning the associated Token to the caller.
4035    pub fn r#clear(&self) -> Result<(), fidl::Error> {
4036        FlatlandProxyInterface::r#clear(self)
4037    }
4038
4039    /// Set debug name of the current client that can be used by Flatland to print as a prefix to
4040    /// logs to help client distinguish what is theirs. [`name`] can be an arbitrary string, but the
4041    /// current process name (see fsl::GetCurrentProcessName()) is a good default.
4042    pub fn r#set_debug_name(&self, mut name: &str) -> Result<(), fidl::Error> {
4043        FlatlandProxyInterface::r#set_debug_name(self, name)
4044    }
4045}
4046
4047impl FlatlandProxyInterface for FlatlandProxy {
4048    fn r#release_image_immediately(&self, mut image_id: &ContentId) -> Result<(), fidl::Error> {
4049        self.client.send::<TrustedFlatlandReleaseImageImmediatelyRequest>(
4050            (image_id,),
4051            0x245e1ac080772c8,
4052            fidl::encoding::DynamicFlags::empty(),
4053        )
4054    }
4055
4056    fn r#release_image_immediately2(&self, mut image_id: &ImageId) -> Result<(), fidl::Error> {
4057        self.client.send::<TrustedFlatlandReleaseImageImmediately2Request>(
4058            (image_id,),
4059            0x6d6a73d150589146,
4060            fidl::encoding::DynamicFlags::empty(),
4061        )
4062    }
4063
4064    fn r#create_layer(&self, mut layer_id: &LayerId) -> Result<(), fidl::Error> {
4065        self.client.send::<Flatland2CreateLayerRequest>(
4066            (layer_id,),
4067            0x60837bb0ce59f8a9,
4068            fidl::encoding::DynamicFlags::empty(),
4069        )
4070    }
4071
4072    fn r#release_layer(&self, mut layer_id: &LayerId) -> Result<(), fidl::Error> {
4073        self.client.send::<Flatland2ReleaseLayerRequest>(
4074            (layer_id,),
4075            0x60118a842b6f0756,
4076            fidl::encoding::DynamicFlags::empty(),
4077        )
4078    }
4079
4080    fn r#set_layer_image(
4081        &self,
4082        mut layer_id: &LayerId,
4083        mut image_id: &ImageId,
4084        mut acquire_fence: Option<WaitFence>,
4085        mut release_fence: Option<SignalFence>,
4086    ) -> Result<(), fidl::Error> {
4087        self.client.send::<Flatland2SetLayerImageRequest>(
4088            (layer_id, image_id, acquire_fence.as_mut(), release_fence.as_mut()),
4089            0x262302d9782d252c,
4090            fidl::encoding::DynamicFlags::empty(),
4091        )
4092    }
4093
4094    fn r#set_layer_properties(
4095        &self,
4096        mut layer_id: &LayerId,
4097        mut properties: &LayerProperties,
4098    ) -> Result<(), fidl::Error> {
4099        self.client.send::<Flatland2SetLayerPropertiesRequest>(
4100            (layer_id, properties),
4101            0x282d0e902aae8bb0,
4102            fidl::encoding::DynamicFlags::empty(),
4103        )
4104    }
4105
4106    fn r#reset_layer(&self, mut layer_id: &LayerId) -> Result<(), fidl::Error> {
4107        self.client.send::<Flatland2ResetLayerRequest>(
4108            (layer_id,),
4109            0x17bf541bf216ab2b,
4110            fidl::encoding::DynamicFlags::empty(),
4111        )
4112    }
4113
4114    fn r#create_layer_stack(&self, mut stack_id: &LayerStackId) -> Result<(), fidl::Error> {
4115        self.client.send::<Flatland2CreateLayerStackRequest>(
4116            (stack_id,),
4117            0x70debe3cd7371aa6,
4118            fidl::encoding::DynamicFlags::empty(),
4119        )
4120    }
4121
4122    fn r#release_layer_stack(&self, mut stack_id: &LayerStackId) -> Result<(), fidl::Error> {
4123        self.client.send::<Flatland2ReleaseLayerStackRequest>(
4124            (stack_id,),
4125            0x3ad3151aece3b1bb,
4126            fidl::encoding::DynamicFlags::empty(),
4127        )
4128    }
4129
4130    fn r#set_stack_layers(
4131        &self,
4132        mut stack_id: &LayerStackId,
4133        mut layers: &[LayerId],
4134    ) -> Result<(), fidl::Error> {
4135        self.client.send::<Flatland2SetStackLayersRequest>(
4136            (stack_id, layers),
4137            0x1e0bff0f5cca065a,
4138            fidl::encoding::DynamicFlags::empty(),
4139        )
4140    }
4141
4142    fn r#create_image2(
4143        &self,
4144        mut image_id: &ImageId,
4145        mut import_token: BufferCollectionImportToken,
4146        mut vmo_index: u32,
4147        mut properties: &ImageProperties,
4148    ) -> Result<(), fidl::Error> {
4149        self.client.send::<Flatland2CreateImage2Request>(
4150            (image_id, &mut import_token, vmo_index, properties),
4151            0x677fa7b23aaca46,
4152            fidl::encoding::DynamicFlags::empty(),
4153        )
4154    }
4155
4156    fn r#release_image2(&self, mut image_id: &ImageId) -> Result<(), fidl::Error> {
4157        self.client.send::<Flatland2ReleaseImage2Request>(
4158            (image_id,),
4159            0x7d0a041ed51aca06,
4160            fidl::encoding::DynamicFlags::empty(),
4161        )
4162    }
4163
4164    fn r#create_viewport2(
4165        &self,
4166        mut viewport_id: &ViewportId,
4167        mut token: fidl_fuchsia_ui_views::ViewportCreationToken,
4168        mut properties: &ViewportProperties,
4169        mut child_view_watcher: fidl::endpoints::ServerEnd<ChildViewWatcherMarker>,
4170    ) -> Result<(), fidl::Error> {
4171        self.client.send::<Flatland2CreateViewport2Request>(
4172            (viewport_id, &mut token, properties, child_view_watcher),
4173            0x1b646776764f1128,
4174            fidl::encoding::DynamicFlags::empty(),
4175        )
4176    }
4177
4178    type ReleaseViewport2ResponseFut = fidl::client::QueryResponseFut<
4179        fidl_fuchsia_ui_views::ViewportCreationToken,
4180        fidl::encoding::DefaultFuchsiaResourceDialect,
4181    >;
4182    fn r#release_viewport2(
4183        &self,
4184        mut viewport_id: &ViewportId,
4185    ) -> Self::ReleaseViewport2ResponseFut {
4186        fn _decode(
4187            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4188        ) -> Result<fidl_fuchsia_ui_views::ViewportCreationToken, fidl::Error> {
4189            let _response = fidl::client::decode_transaction_body::<
4190                Flatland2ReleaseViewport2Response,
4191                fidl::encoding::DefaultFuchsiaResourceDialect,
4192                0x18ef77414c7a9ae3,
4193            >(_buf?)?;
4194            Ok(_response.token)
4195        }
4196        self.client.send_query_and_decode::<
4197            Flatland2ReleaseViewport2Request,
4198            fidl_fuchsia_ui_views::ViewportCreationToken,
4199        >(
4200            (viewport_id,),
4201            0x18ef77414c7a9ae3,
4202            fidl::encoding::DynamicFlags::empty(),
4203            _decode,
4204        )
4205    }
4206
4207    fn r#set_viewport_properties2(
4208        &self,
4209        mut viewport_id: &ViewportId,
4210        mut properties: &ViewportProperties,
4211    ) -> Result<(), fidl::Error> {
4212        self.client.send::<Flatland2SetViewportProperties2Request>(
4213            (viewport_id, properties),
4214            0x95f2ec3b9e4beea,
4215            fidl::encoding::DynamicFlags::empty(),
4216        )
4217    }
4218
4219    fn r#set_transform_content(
4220        &self,
4221        mut transform_id: &TransformId,
4222        mut content: Option<&TransformContent>,
4223    ) -> Result<(), fidl::Error> {
4224        self.client.send::<Flatland2SetTransformContentRequest>(
4225            (transform_id, content),
4226            0x17e33f64f55e4ea9,
4227            fidl::encoding::DynamicFlags::empty(),
4228        )
4229    }
4230
4231    fn r#present(&self, mut args: PresentArgs) -> Result<(), fidl::Error> {
4232        self.client.send::<FlatlandPresentRequest>(
4233            (&mut args,),
4234            0x50acc2aa1f0acec7,
4235            fidl::encoding::DynamicFlags::empty(),
4236        )
4237    }
4238
4239    fn r#create_view(
4240        &self,
4241        mut token: fidl_fuchsia_ui_views::ViewCreationToken,
4242        mut parent_viewport_watcher: fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>,
4243    ) -> Result<(), fidl::Error> {
4244        self.client.send::<FlatlandCreateViewRequest>(
4245            (&mut token, parent_viewport_watcher),
4246            0x504686eb25864780,
4247            fidl::encoding::DynamicFlags::empty(),
4248        )
4249    }
4250
4251    fn r#create_view2(
4252        &self,
4253        mut token: fidl_fuchsia_ui_views::ViewCreationToken,
4254        mut view_identity: fidl_fuchsia_ui_views::ViewIdentityOnCreation,
4255        mut protocols: ViewBoundProtocols,
4256        mut parent_viewport_watcher: fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>,
4257    ) -> Result<(), fidl::Error> {
4258        self.client.send::<FlatlandCreateView2Request>(
4259            (&mut token, &mut view_identity, &mut protocols, parent_viewport_watcher),
4260            0x340a3a40c2fdbd5e,
4261            fidl::encoding::DynamicFlags::empty(),
4262        )
4263    }
4264
4265    fn r#create_transform(&self, mut transform_id: &TransformId) -> Result<(), fidl::Error> {
4266        self.client.send::<FlatlandCreateTransformRequest>(
4267            (transform_id,),
4268            0x5e042a4d3de3efb0,
4269            fidl::encoding::DynamicFlags::empty(),
4270        )
4271    }
4272
4273    fn r#set_translation(
4274        &self,
4275        mut transform_id: &TransformId,
4276        mut translation: &fidl_fuchsia_math::Vec_,
4277    ) -> Result<(), fidl::Error> {
4278        self.client.send::<FlatlandSetTranslationRequest>(
4279            (transform_id, translation),
4280            0x7863398291fba346,
4281            fidl::encoding::DynamicFlags::empty(),
4282        )
4283    }
4284
4285    fn r#set_orientation(
4286        &self,
4287        mut transform_id: &TransformId,
4288        mut orientation: Orientation,
4289    ) -> Result<(), fidl::Error> {
4290        self.client.send::<FlatlandSetOrientationRequest>(
4291            (transform_id, orientation),
4292            0x4915310bc4928edc,
4293            fidl::encoding::DynamicFlags::empty(),
4294        )
4295    }
4296
4297    fn r#set_scale(
4298        &self,
4299        mut transform_id: &TransformId,
4300        mut scale: &fidl_fuchsia_math::VecF,
4301    ) -> Result<(), fidl::Error> {
4302        self.client.send::<FlatlandSetScaleRequest>(
4303            (transform_id, scale),
4304            0x1ea1766fd8996bb4,
4305            fidl::encoding::DynamicFlags::empty(),
4306        )
4307    }
4308
4309    fn r#set_opacity(
4310        &self,
4311        mut transform_id: &TransformId,
4312        mut value: f32,
4313    ) -> Result<(), fidl::Error> {
4314        self.client.send::<FlatlandSetOpacityRequest>(
4315            (transform_id, value),
4316            0x3775fc2c00b432fa,
4317            fidl::encoding::DynamicFlags::empty(),
4318        )
4319    }
4320
4321    fn r#set_clip_boundary(
4322        &self,
4323        mut transform_id: &TransformId,
4324        mut rect: Option<&fidl_fuchsia_math::Rect>,
4325    ) -> Result<(), fidl::Error> {
4326        self.client.send::<FlatlandSetClipBoundaryRequest>(
4327            (transform_id, rect),
4328            0x6507843df12222d2,
4329            fidl::encoding::DynamicFlags::empty(),
4330        )
4331    }
4332
4333    fn r#add_child(
4334        &self,
4335        mut parent_transform_id: &TransformId,
4336        mut child_transform_id: &TransformId,
4337    ) -> Result<(), fidl::Error> {
4338        self.client.send::<FlatlandAddChildRequest>(
4339            (parent_transform_id, child_transform_id),
4340            0x67a8abd2f19b1a74,
4341            fidl::encoding::DynamicFlags::empty(),
4342        )
4343    }
4344
4345    fn r#remove_child(
4346        &self,
4347        mut parent_transform_id: &TransformId,
4348        mut child_transform_id: &TransformId,
4349    ) -> Result<(), fidl::Error> {
4350        self.client.send::<FlatlandRemoveChildRequest>(
4351            (parent_transform_id, child_transform_id),
4352            0x41d6cd90b298b67a,
4353            fidl::encoding::DynamicFlags::empty(),
4354        )
4355    }
4356
4357    fn r#replace_children(
4358        &self,
4359        mut parent_transform_id: &TransformId,
4360        mut new_child_transform_ids: &[TransformId],
4361    ) -> Result<(), fidl::Error> {
4362        self.client.send::<FlatlandReplaceChildrenRequest>(
4363            (parent_transform_id, new_child_transform_ids),
4364            0x5b6d86cbbff81316,
4365            fidl::encoding::DynamicFlags::empty(),
4366        )
4367    }
4368
4369    fn r#set_root_transform(&self, mut transform_id: &TransformId) -> Result<(), fidl::Error> {
4370        self.client.send::<FlatlandSetRootTransformRequest>(
4371            (transform_id,),
4372            0x6e80ca5bcc566cd8,
4373            fidl::encoding::DynamicFlags::empty(),
4374        )
4375    }
4376
4377    fn r#set_hit_regions(
4378        &self,
4379        mut transform_id: &TransformId,
4380        mut regions: &[HitRegion],
4381    ) -> Result<(), fidl::Error> {
4382        self.client.send::<FlatlandSetHitRegionsRequest>(
4383            (transform_id, regions),
4384            0x31c9d17b07c37ce4,
4385            fidl::encoding::DynamicFlags::empty(),
4386        )
4387    }
4388
4389    fn r#set_infinite_hit_region(
4390        &self,
4391        mut transform_id: &TransformId,
4392        mut hit_test: HitTestInteraction,
4393    ) -> Result<(), fidl::Error> {
4394        self.client.send::<FlatlandSetInfiniteHitRegionRequest>(
4395            (transform_id, hit_test),
4396            0x26d81af852d29562,
4397            fidl::encoding::DynamicFlags::empty(),
4398        )
4399    }
4400
4401    fn r#create_viewport(
4402        &self,
4403        mut viewport_id: &ContentId,
4404        mut token: fidl_fuchsia_ui_views::ViewportCreationToken,
4405        mut properties: &ViewportProperties,
4406        mut child_view_watcher: fidl::endpoints::ServerEnd<ChildViewWatcherMarker>,
4407    ) -> Result<(), fidl::Error> {
4408        self.client.send::<FlatlandCreateViewportRequest>(
4409            (viewport_id, &mut token, properties, child_view_watcher),
4410            0x2485fbcab7f943c,
4411            fidl::encoding::DynamicFlags::empty(),
4412        )
4413    }
4414
4415    fn r#create_image(
4416        &self,
4417        mut image_id: &ContentId,
4418        mut import_token: BufferCollectionImportToken,
4419        mut vmo_index: u32,
4420        mut properties: &ImageProperties,
4421    ) -> Result<(), fidl::Error> {
4422        self.client.send::<FlatlandCreateImageRequest>(
4423            (image_id, &mut import_token, vmo_index, properties),
4424            0x26fae823c4ebedad,
4425            fidl::encoding::DynamicFlags::empty(),
4426        )
4427    }
4428
4429    fn r#set_image_sample_region(
4430        &self,
4431        mut image_id: &ContentId,
4432        mut rect: &fidl_fuchsia_math::RectF,
4433    ) -> Result<(), fidl::Error> {
4434        self.client.send::<FlatlandSetImageSampleRegionRequest>(
4435            (image_id, rect),
4436            0x8039391d715eb28,
4437            fidl::encoding::DynamicFlags::empty(),
4438        )
4439    }
4440
4441    fn r#set_image_destination_size(
4442        &self,
4443        mut image_id: &ContentId,
4444        mut size: &fidl_fuchsia_math::SizeU,
4445    ) -> Result<(), fidl::Error> {
4446        self.client.send::<FlatlandSetImageDestinationSizeRequest>(
4447            (image_id, size),
4448            0x766cf99a2ec58446,
4449            fidl::encoding::DynamicFlags::empty(),
4450        )
4451    }
4452
4453    fn r#set_image_blending_function(
4454        &self,
4455        mut image_id: &ContentId,
4456        mut blend_mode: BlendMode,
4457    ) -> Result<(), fidl::Error> {
4458        self.client.send::<FlatlandSetImageBlendingFunctionRequest>(
4459            (image_id, blend_mode),
4460            0x10f5da1356275b7b,
4461            fidl::encoding::DynamicFlags::empty(),
4462        )
4463    }
4464
4465    fn r#set_image_blend_mode(
4466        &self,
4467        mut image_id: &ContentId,
4468        mut blend_mode: BlendMode2,
4469    ) -> Result<(), fidl::Error> {
4470        self.client.send::<FlatlandSetImageBlendModeRequest>(
4471            (image_id, blend_mode),
4472            0x5b1667f130c3de67,
4473            fidl::encoding::DynamicFlags::empty(),
4474        )
4475    }
4476
4477    fn r#set_image_opacity(
4478        &self,
4479        mut image_id: &ContentId,
4480        mut val: f32,
4481    ) -> Result<(), fidl::Error> {
4482        self.client.send::<FlatlandSetImageOpacityRequest>(
4483            (image_id, val),
4484            0x2da9e4ef4c2cff6f,
4485            fidl::encoding::DynamicFlags::empty(),
4486        )
4487    }
4488
4489    fn r#set_image_flip(
4490        &self,
4491        mut image_id: &ContentId,
4492        mut flip: ImageFlip,
4493    ) -> Result<(), fidl::Error> {
4494        self.client.send::<FlatlandSetImageFlipRequest>(
4495            (image_id, flip),
4496            0x21b20f2c14aae6bc,
4497            fidl::encoding::DynamicFlags::empty(),
4498        )
4499    }
4500
4501    fn r#create_filled_rect(&self, mut rect_id: &ContentId) -> Result<(), fidl::Error> {
4502        self.client.send::<FlatlandCreateFilledRectRequest>(
4503            (rect_id,),
4504            0x5e62355abc1c4c5d,
4505            fidl::encoding::DynamicFlags::empty(),
4506        )
4507    }
4508
4509    fn r#set_solid_fill(
4510        &self,
4511        mut rect_id: &ContentId,
4512        mut color: &ColorRgba,
4513        mut size: &fidl_fuchsia_math::SizeU,
4514    ) -> Result<(), fidl::Error> {
4515        self.client.send::<FlatlandSetSolidFillRequest>(
4516            (rect_id, color, size),
4517            0x32d6ef41e182dfa5,
4518            fidl::encoding::DynamicFlags::empty(),
4519        )
4520    }
4521
4522    fn r#release_filled_rect(&self, mut rect_id: &ContentId) -> Result<(), fidl::Error> {
4523        self.client.send::<FlatlandReleaseFilledRectRequest>(
4524            (rect_id,),
4525            0x7392cabe45618f9b,
4526            fidl::encoding::DynamicFlags::empty(),
4527        )
4528    }
4529
4530    fn r#set_content(
4531        &self,
4532        mut transform_id: &TransformId,
4533        mut content_id: &ContentId,
4534    ) -> Result<(), fidl::Error> {
4535        self.client.send::<FlatlandSetContentRequest>(
4536            (transform_id, content_id),
4537            0x4ed2cfc0ce130862,
4538            fidl::encoding::DynamicFlags::empty(),
4539        )
4540    }
4541
4542    fn r#set_viewport_properties(
4543        &self,
4544        mut viewport_id: &ContentId,
4545        mut properties: &ViewportProperties,
4546    ) -> Result<(), fidl::Error> {
4547        self.client.send::<FlatlandSetViewportPropertiesRequest>(
4548            (viewport_id, properties),
4549            0x66ab67e9608ddb9f,
4550            fidl::encoding::DynamicFlags::empty(),
4551        )
4552    }
4553
4554    fn r#release_transform(&self, mut transform_id: &TransformId) -> Result<(), fidl::Error> {
4555        self.client.send::<FlatlandReleaseTransformRequest>(
4556            (transform_id,),
4557            0xab9328419451c22,
4558            fidl::encoding::DynamicFlags::empty(),
4559        )
4560    }
4561
4562    fn r#release_view(&self) -> Result<(), fidl::Error> {
4563        self.client.send::<fidl::encoding::EmptyPayload>(
4564            (),
4565            0x5b35aab9baffecae,
4566            fidl::encoding::DynamicFlags::empty(),
4567        )
4568    }
4569
4570    type ReleaseViewportResponseFut = fidl::client::QueryResponseFut<
4571        fidl_fuchsia_ui_views::ViewportCreationToken,
4572        fidl::encoding::DefaultFuchsiaResourceDialect,
4573    >;
4574    fn r#release_viewport(&self, mut viewport_id: &ContentId) -> Self::ReleaseViewportResponseFut {
4575        fn _decode(
4576            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4577        ) -> Result<fidl_fuchsia_ui_views::ViewportCreationToken, fidl::Error> {
4578            let _response = fidl::client::decode_transaction_body::<
4579                FlatlandReleaseViewportResponse,
4580                fidl::encoding::DefaultFuchsiaResourceDialect,
4581                0xbad474aeb5293f9,
4582            >(_buf?)?;
4583            Ok(_response.token)
4584        }
4585        self.client.send_query_and_decode::<
4586            FlatlandReleaseViewportRequest,
4587            fidl_fuchsia_ui_views::ViewportCreationToken,
4588        >(
4589            (viewport_id,),
4590            0xbad474aeb5293f9,
4591            fidl::encoding::DynamicFlags::empty(),
4592            _decode,
4593        )
4594    }
4595
4596    fn r#release_image(&self, mut image_id: &ContentId) -> Result<(), fidl::Error> {
4597        self.client.send::<FlatlandReleaseImageRequest>(
4598            (image_id,),
4599            0xb884ffdbc72c111,
4600            fidl::encoding::DynamicFlags::empty(),
4601        )
4602    }
4603
4604    fn r#clear(&self) -> Result<(), fidl::Error> {
4605        self.client.send::<fidl::encoding::EmptyPayload>(
4606            (),
4607            0x4ec8817c02828c3e,
4608            fidl::encoding::DynamicFlags::empty(),
4609        )
4610    }
4611
4612    fn r#set_debug_name(&self, mut name: &str) -> Result<(), fidl::Error> {
4613        self.client.send::<FlatlandSetDebugNameRequest>(
4614            (name,),
4615            0x46a8b397e68a8888,
4616            fidl::encoding::DynamicFlags::empty(),
4617        )
4618    }
4619}
4620
4621pub struct FlatlandEventStream {
4622    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
4623}
4624
4625impl std::marker::Unpin for FlatlandEventStream {}
4626
4627impl futures::stream::FusedStream for FlatlandEventStream {
4628    fn is_terminated(&self) -> bool {
4629        self.event_receiver.is_terminated()
4630    }
4631}
4632
4633impl futures::Stream for FlatlandEventStream {
4634    type Item = Result<FlatlandEvent, fidl::Error>;
4635
4636    fn poll_next(
4637        mut self: std::pin::Pin<&mut Self>,
4638        cx: &mut std::task::Context<'_>,
4639    ) -> std::task::Poll<Option<Self::Item>> {
4640        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
4641            &mut self.event_receiver,
4642            cx
4643        )?) {
4644            Some(buf) => std::task::Poll::Ready(Some(FlatlandEvent::decode(buf))),
4645            None => std::task::Poll::Ready(None),
4646        }
4647    }
4648}
4649
4650#[derive(Debug)]
4651pub enum FlatlandEvent {
4652    OnNextFrameBegin { values: OnNextFrameBeginValues },
4653    OnFramePresented { frame_presented_info: fidl_fuchsia_scenic_scheduling::FramePresentedInfo },
4654    OnError { error: FlatlandError },
4655}
4656
4657impl FlatlandEvent {
4658    #[allow(irrefutable_let_patterns)]
4659    pub fn into_on_next_frame_begin(self) -> Option<OnNextFrameBeginValues> {
4660        if let FlatlandEvent::OnNextFrameBegin { values } = self { Some((values)) } else { None }
4661    }
4662    #[allow(irrefutable_let_patterns)]
4663    pub fn into_on_frame_presented(
4664        self,
4665    ) -> Option<fidl_fuchsia_scenic_scheduling::FramePresentedInfo> {
4666        if let FlatlandEvent::OnFramePresented { frame_presented_info } = self {
4667            Some((frame_presented_info))
4668        } else {
4669            None
4670        }
4671    }
4672    #[allow(irrefutable_let_patterns)]
4673    pub fn into_on_error(self) -> Option<FlatlandError> {
4674        if let FlatlandEvent::OnError { error } = self { Some((error)) } else { None }
4675    }
4676
4677    /// Decodes a message buffer as a [`FlatlandEvent`].
4678    fn decode(
4679        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
4680    ) -> Result<FlatlandEvent, fidl::Error> {
4681        let (bytes, _handles) = buf.split_mut();
4682        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4683        debug_assert_eq!(tx_header.tx_id, 0);
4684        match tx_header.ordinal {
4685            0x10f69a5cdeece84a => {
4686                let mut out = fidl::new_empty!(
4687                    FlatlandOnNextFrameBeginRequest,
4688                    fidl::encoding::DefaultFuchsiaResourceDialect
4689                );
4690                fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandOnNextFrameBeginRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
4691                Ok((FlatlandEvent::OnNextFrameBegin { values: out.values }))
4692            }
4693            0x56e43e1a5f30216d => {
4694                let mut out = fidl::new_empty!(
4695                    FlatlandOnFramePresentedRequest,
4696                    fidl::encoding::DefaultFuchsiaResourceDialect
4697                );
4698                fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandOnFramePresentedRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
4699                Ok((FlatlandEvent::OnFramePresented {
4700                    frame_presented_info: out.frame_presented_info,
4701                }))
4702            }
4703            0x1ebf39e90cd8b8d => {
4704                let mut out = fidl::new_empty!(
4705                    FlatlandOnErrorRequest,
4706                    fidl::encoding::DefaultFuchsiaResourceDialect
4707                );
4708                fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandOnErrorRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
4709                Ok((FlatlandEvent::OnError { error: out.error }))
4710            }
4711            _ => Err(fidl::Error::UnknownOrdinal {
4712                ordinal: tx_header.ordinal,
4713                protocol_name: <FlatlandMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4714            }),
4715        }
4716    }
4717}
4718
4719/// A Stream of incoming requests for fuchsia.ui.composition/Flatland.
4720pub struct FlatlandRequestStream {
4721    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4722    is_terminated: bool,
4723}
4724
4725impl std::marker::Unpin for FlatlandRequestStream {}
4726
4727impl futures::stream::FusedStream for FlatlandRequestStream {
4728    fn is_terminated(&self) -> bool {
4729        self.is_terminated
4730    }
4731}
4732
4733impl fidl::endpoints::RequestStream for FlatlandRequestStream {
4734    type Protocol = FlatlandMarker;
4735    type ControlHandle = FlatlandControlHandle;
4736
4737    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
4738        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
4739    }
4740
4741    fn control_handle(&self) -> Self::ControlHandle {
4742        FlatlandControlHandle { inner: self.inner.clone() }
4743    }
4744
4745    fn into_inner(
4746        self,
4747    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
4748    {
4749        (self.inner, self.is_terminated)
4750    }
4751
4752    fn from_inner(
4753        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4754        is_terminated: bool,
4755    ) -> Self {
4756        Self { inner, is_terminated }
4757    }
4758}
4759
4760impl futures::Stream for FlatlandRequestStream {
4761    type Item = Result<FlatlandRequest, fidl::Error>;
4762
4763    fn poll_next(
4764        mut self: std::pin::Pin<&mut Self>,
4765        cx: &mut std::task::Context<'_>,
4766    ) -> std::task::Poll<Option<Self::Item>> {
4767        let this = &mut *self;
4768        if this.inner.check_shutdown(cx) {
4769            this.is_terminated = true;
4770            return std::task::Poll::Ready(None);
4771        }
4772        if this.is_terminated {
4773            panic!("polled FlatlandRequestStream after completion");
4774        }
4775        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
4776            |bytes, handles| {
4777                match this.inner.channel().read_etc(cx, bytes, handles) {
4778                    std::task::Poll::Ready(Ok(())) => {}
4779                    std::task::Poll::Pending => return std::task::Poll::Pending,
4780                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
4781                        this.is_terminated = true;
4782                        return std::task::Poll::Ready(None);
4783                    }
4784                    std::task::Poll::Ready(Err(e)) => {
4785                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
4786                            e.into(),
4787                        ))));
4788                    }
4789                }
4790
4791                // A message has been received from the channel
4792                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4793
4794                std::task::Poll::Ready(Some(match header.ordinal {
4795                    0x245e1ac080772c8 => {
4796                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4797                        let mut req = fidl::new_empty!(
4798                            TrustedFlatlandReleaseImageImmediatelyRequest,
4799                            fidl::encoding::DefaultFuchsiaResourceDialect
4800                        );
4801                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<TrustedFlatlandReleaseImageImmediatelyRequest>(&header, _body_bytes, handles, &mut req)?;
4802                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4803                        Ok(FlatlandRequest::ReleaseImageImmediately {
4804                            image_id: req.image_id,
4805
4806                            control_handle,
4807                        })
4808                    }
4809                    0x6d6a73d150589146 => {
4810                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4811                        let mut req = fidl::new_empty!(
4812                            TrustedFlatlandReleaseImageImmediately2Request,
4813                            fidl::encoding::DefaultFuchsiaResourceDialect
4814                        );
4815                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<TrustedFlatlandReleaseImageImmediately2Request>(&header, _body_bytes, handles, &mut req)?;
4816                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4817                        Ok(FlatlandRequest::ReleaseImageImmediately2 {
4818                            image_id: req.image_id,
4819
4820                            control_handle,
4821                        })
4822                    }
4823                    0x60837bb0ce59f8a9 => {
4824                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4825                        let mut req = fidl::new_empty!(
4826                            Flatland2CreateLayerRequest,
4827                            fidl::encoding::DefaultFuchsiaResourceDialect
4828                        );
4829                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<Flatland2CreateLayerRequest>(&header, _body_bytes, handles, &mut req)?;
4830                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4831                        Ok(FlatlandRequest::CreateLayer { layer_id: req.layer_id, control_handle })
4832                    }
4833                    0x60118a842b6f0756 => {
4834                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4835                        let mut req = fidl::new_empty!(
4836                            Flatland2ReleaseLayerRequest,
4837                            fidl::encoding::DefaultFuchsiaResourceDialect
4838                        );
4839                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<Flatland2ReleaseLayerRequest>(&header, _body_bytes, handles, &mut req)?;
4840                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4841                        Ok(FlatlandRequest::ReleaseLayer { layer_id: req.layer_id, control_handle })
4842                    }
4843                    0x262302d9782d252c => {
4844                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4845                        let mut req = fidl::new_empty!(
4846                            Flatland2SetLayerImageRequest,
4847                            fidl::encoding::DefaultFuchsiaResourceDialect
4848                        );
4849                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<Flatland2SetLayerImageRequest>(&header, _body_bytes, handles, &mut req)?;
4850                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4851                        Ok(FlatlandRequest::SetLayerImage {
4852                            layer_id: req.layer_id,
4853                            image_id: req.image_id,
4854                            acquire_fence: req.acquire_fence,
4855                            release_fence: req.release_fence,
4856
4857                            control_handle,
4858                        })
4859                    }
4860                    0x282d0e902aae8bb0 => {
4861                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4862                        let mut req = fidl::new_empty!(
4863                            Flatland2SetLayerPropertiesRequest,
4864                            fidl::encoding::DefaultFuchsiaResourceDialect
4865                        );
4866                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<Flatland2SetLayerPropertiesRequest>(&header, _body_bytes, handles, &mut req)?;
4867                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4868                        Ok(FlatlandRequest::SetLayerProperties {
4869                            layer_id: req.layer_id,
4870                            properties: req.properties,
4871
4872                            control_handle,
4873                        })
4874                    }
4875                    0x17bf541bf216ab2b => {
4876                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4877                        let mut req = fidl::new_empty!(
4878                            Flatland2ResetLayerRequest,
4879                            fidl::encoding::DefaultFuchsiaResourceDialect
4880                        );
4881                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<Flatland2ResetLayerRequest>(&header, _body_bytes, handles, &mut req)?;
4882                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4883                        Ok(FlatlandRequest::ResetLayer { layer_id: req.layer_id, control_handle })
4884                    }
4885                    0x70debe3cd7371aa6 => {
4886                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4887                        let mut req = fidl::new_empty!(
4888                            Flatland2CreateLayerStackRequest,
4889                            fidl::encoding::DefaultFuchsiaResourceDialect
4890                        );
4891                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<Flatland2CreateLayerStackRequest>(&header, _body_bytes, handles, &mut req)?;
4892                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4893                        Ok(FlatlandRequest::CreateLayerStack {
4894                            stack_id: req.stack_id,
4895
4896                            control_handle,
4897                        })
4898                    }
4899                    0x3ad3151aece3b1bb => {
4900                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4901                        let mut req = fidl::new_empty!(
4902                            Flatland2ReleaseLayerStackRequest,
4903                            fidl::encoding::DefaultFuchsiaResourceDialect
4904                        );
4905                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<Flatland2ReleaseLayerStackRequest>(&header, _body_bytes, handles, &mut req)?;
4906                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4907                        Ok(FlatlandRequest::ReleaseLayerStack {
4908                            stack_id: req.stack_id,
4909
4910                            control_handle,
4911                        })
4912                    }
4913                    0x1e0bff0f5cca065a => {
4914                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4915                        let mut req = fidl::new_empty!(
4916                            Flatland2SetStackLayersRequest,
4917                            fidl::encoding::DefaultFuchsiaResourceDialect
4918                        );
4919                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<Flatland2SetStackLayersRequest>(&header, _body_bytes, handles, &mut req)?;
4920                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4921                        Ok(FlatlandRequest::SetStackLayers {
4922                            stack_id: req.stack_id,
4923                            layers: req.layers,
4924
4925                            control_handle,
4926                        })
4927                    }
4928                    0x677fa7b23aaca46 => {
4929                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4930                        let mut req = fidl::new_empty!(
4931                            Flatland2CreateImage2Request,
4932                            fidl::encoding::DefaultFuchsiaResourceDialect
4933                        );
4934                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<Flatland2CreateImage2Request>(&header, _body_bytes, handles, &mut req)?;
4935                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4936                        Ok(FlatlandRequest::CreateImage2 {
4937                            image_id: req.image_id,
4938                            import_token: req.import_token,
4939                            vmo_index: req.vmo_index,
4940                            properties: req.properties,
4941
4942                            control_handle,
4943                        })
4944                    }
4945                    0x7d0a041ed51aca06 => {
4946                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4947                        let mut req = fidl::new_empty!(
4948                            Flatland2ReleaseImage2Request,
4949                            fidl::encoding::DefaultFuchsiaResourceDialect
4950                        );
4951                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<Flatland2ReleaseImage2Request>(&header, _body_bytes, handles, &mut req)?;
4952                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4953                        Ok(FlatlandRequest::ReleaseImage2 {
4954                            image_id: req.image_id,
4955
4956                            control_handle,
4957                        })
4958                    }
4959                    0x1b646776764f1128 => {
4960                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4961                        let mut req = fidl::new_empty!(
4962                            Flatland2CreateViewport2Request,
4963                            fidl::encoding::DefaultFuchsiaResourceDialect
4964                        );
4965                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<Flatland2CreateViewport2Request>(&header, _body_bytes, handles, &mut req)?;
4966                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4967                        Ok(FlatlandRequest::CreateViewport2 {
4968                            viewport_id: req.viewport_id,
4969                            token: req.token,
4970                            properties: req.properties,
4971                            child_view_watcher: req.child_view_watcher,
4972
4973                            control_handle,
4974                        })
4975                    }
4976                    0x18ef77414c7a9ae3 => {
4977                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4978                        let mut req = fidl::new_empty!(
4979                            Flatland2ReleaseViewport2Request,
4980                            fidl::encoding::DefaultFuchsiaResourceDialect
4981                        );
4982                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<Flatland2ReleaseViewport2Request>(&header, _body_bytes, handles, &mut req)?;
4983                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4984                        Ok(FlatlandRequest::ReleaseViewport2 {
4985                            viewport_id: req.viewport_id,
4986
4987                            responder: FlatlandReleaseViewport2Responder {
4988                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4989                                tx_id: header.tx_id,
4990                            },
4991                        })
4992                    }
4993                    0x95f2ec3b9e4beea => {
4994                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4995                        let mut req = fidl::new_empty!(
4996                            Flatland2SetViewportProperties2Request,
4997                            fidl::encoding::DefaultFuchsiaResourceDialect
4998                        );
4999                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<Flatland2SetViewportProperties2Request>(&header, _body_bytes, handles, &mut req)?;
5000                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
5001                        Ok(FlatlandRequest::SetViewportProperties2 {
5002                            viewport_id: req.viewport_id,
5003                            properties: req.properties,
5004
5005                            control_handle,
5006                        })
5007                    }
5008                    0x17e33f64f55e4ea9 => {
5009                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5010                        let mut req = fidl::new_empty!(
5011                            Flatland2SetTransformContentRequest,
5012                            fidl::encoding::DefaultFuchsiaResourceDialect
5013                        );
5014                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<Flatland2SetTransformContentRequest>(&header, _body_bytes, handles, &mut req)?;
5015                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
5016                        Ok(FlatlandRequest::SetTransformContent {
5017                            transform_id: req.transform_id,
5018                            content: req.content,
5019
5020                            control_handle,
5021                        })
5022                    }
5023                    0x50acc2aa1f0acec7 => {
5024                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5025                        let mut req = fidl::new_empty!(
5026                            FlatlandPresentRequest,
5027                            fidl::encoding::DefaultFuchsiaResourceDialect
5028                        );
5029                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandPresentRequest>(&header, _body_bytes, handles, &mut req)?;
5030                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
5031                        Ok(FlatlandRequest::Present { args: req.args, control_handle })
5032                    }
5033                    0x504686eb25864780 => {
5034                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5035                        let mut req = fidl::new_empty!(
5036                            FlatlandCreateViewRequest,
5037                            fidl::encoding::DefaultFuchsiaResourceDialect
5038                        );
5039                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandCreateViewRequest>(&header, _body_bytes, handles, &mut req)?;
5040                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
5041                        Ok(FlatlandRequest::CreateView {
5042                            token: req.token,
5043                            parent_viewport_watcher: req.parent_viewport_watcher,
5044
5045                            control_handle,
5046                        })
5047                    }
5048                    0x340a3a40c2fdbd5e => {
5049                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5050                        let mut req = fidl::new_empty!(
5051                            FlatlandCreateView2Request,
5052                            fidl::encoding::DefaultFuchsiaResourceDialect
5053                        );
5054                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandCreateView2Request>(&header, _body_bytes, handles, &mut req)?;
5055                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
5056                        Ok(FlatlandRequest::CreateView2 {
5057                            token: req.token,
5058                            view_identity: req.view_identity,
5059                            protocols: req.protocols,
5060                            parent_viewport_watcher: req.parent_viewport_watcher,
5061
5062                            control_handle,
5063                        })
5064                    }
5065                    0x5e042a4d3de3efb0 => {
5066                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5067                        let mut req = fidl::new_empty!(
5068                            FlatlandCreateTransformRequest,
5069                            fidl::encoding::DefaultFuchsiaResourceDialect
5070                        );
5071                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandCreateTransformRequest>(&header, _body_bytes, handles, &mut req)?;
5072                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
5073                        Ok(FlatlandRequest::CreateTransform {
5074                            transform_id: req.transform_id,
5075
5076                            control_handle,
5077                        })
5078                    }
5079                    0x7863398291fba346 => {
5080                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5081                        let mut req = fidl::new_empty!(
5082                            FlatlandSetTranslationRequest,
5083                            fidl::encoding::DefaultFuchsiaResourceDialect
5084                        );
5085                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetTranslationRequest>(&header, _body_bytes, handles, &mut req)?;
5086                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
5087                        Ok(FlatlandRequest::SetTranslation {
5088                            transform_id: req.transform_id,
5089                            translation: req.translation,
5090
5091                            control_handle,
5092                        })
5093                    }
5094                    0x4915310bc4928edc => {
5095                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5096                        let mut req = fidl::new_empty!(
5097                            FlatlandSetOrientationRequest,
5098                            fidl::encoding::DefaultFuchsiaResourceDialect
5099                        );
5100                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetOrientationRequest>(&header, _body_bytes, handles, &mut req)?;
5101                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
5102                        Ok(FlatlandRequest::SetOrientation {
5103                            transform_id: req.transform_id,
5104                            orientation: req.orientation,
5105
5106                            control_handle,
5107                        })
5108                    }
5109                    0x1ea1766fd8996bb4 => {
5110                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5111                        let mut req = fidl::new_empty!(
5112                            FlatlandSetScaleRequest,
5113                            fidl::encoding::DefaultFuchsiaResourceDialect
5114                        );
5115                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetScaleRequest>(&header, _body_bytes, handles, &mut req)?;
5116                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
5117                        Ok(FlatlandRequest::SetScale {
5118                            transform_id: req.transform_id,
5119                            scale: req.scale,
5120
5121                            control_handle,
5122                        })
5123                    }
5124                    0x3775fc2c00b432fa => {
5125                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5126                        let mut req = fidl::new_empty!(
5127                            FlatlandSetOpacityRequest,
5128                            fidl::encoding::DefaultFuchsiaResourceDialect
5129                        );
5130                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetOpacityRequest>(&header, _body_bytes, handles, &mut req)?;
5131                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
5132                        Ok(FlatlandRequest::SetOpacity {
5133                            transform_id: req.transform_id,
5134                            value: req.value,
5135
5136                            control_handle,
5137                        })
5138                    }
5139                    0x6507843df12222d2 => {
5140                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5141                        let mut req = fidl::new_empty!(
5142                            FlatlandSetClipBoundaryRequest,
5143                            fidl::encoding::DefaultFuchsiaResourceDialect
5144                        );
5145                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetClipBoundaryRequest>(&header, _body_bytes, handles, &mut req)?;
5146                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
5147                        Ok(FlatlandRequest::SetClipBoundary {
5148                            transform_id: req.transform_id,
5149                            rect: req.rect,
5150
5151                            control_handle,
5152                        })
5153                    }
5154                    0x67a8abd2f19b1a74 => {
5155                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5156                        let mut req = fidl::new_empty!(
5157                            FlatlandAddChildRequest,
5158                            fidl::encoding::DefaultFuchsiaResourceDialect
5159                        );
5160                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandAddChildRequest>(&header, _body_bytes, handles, &mut req)?;
5161                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
5162                        Ok(FlatlandRequest::AddChild {
5163                            parent_transform_id: req.parent_transform_id,
5164                            child_transform_id: req.child_transform_id,
5165
5166                            control_handle,
5167                        })
5168                    }
5169                    0x41d6cd90b298b67a => {
5170                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5171                        let mut req = fidl::new_empty!(
5172                            FlatlandRemoveChildRequest,
5173                            fidl::encoding::DefaultFuchsiaResourceDialect
5174                        );
5175                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandRemoveChildRequest>(&header, _body_bytes, handles, &mut req)?;
5176                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
5177                        Ok(FlatlandRequest::RemoveChild {
5178                            parent_transform_id: req.parent_transform_id,
5179                            child_transform_id: req.child_transform_id,
5180
5181                            control_handle,
5182                        })
5183                    }
5184                    0x5b6d86cbbff81316 => {
5185                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5186                        let mut req = fidl::new_empty!(
5187                            FlatlandReplaceChildrenRequest,
5188                            fidl::encoding::DefaultFuchsiaResourceDialect
5189                        );
5190                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandReplaceChildrenRequest>(&header, _body_bytes, handles, &mut req)?;
5191                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
5192                        Ok(FlatlandRequest::ReplaceChildren {
5193                            parent_transform_id: req.parent_transform_id,
5194                            new_child_transform_ids: req.new_child_transform_ids,
5195
5196                            control_handle,
5197                        })
5198                    }
5199                    0x6e80ca5bcc566cd8 => {
5200                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5201                        let mut req = fidl::new_empty!(
5202                            FlatlandSetRootTransformRequest,
5203                            fidl::encoding::DefaultFuchsiaResourceDialect
5204                        );
5205                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetRootTransformRequest>(&header, _body_bytes, handles, &mut req)?;
5206                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
5207                        Ok(FlatlandRequest::SetRootTransform {
5208                            transform_id: req.transform_id,
5209
5210                            control_handle,
5211                        })
5212                    }
5213                    0x31c9d17b07c37ce4 => {
5214                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5215                        let mut req = fidl::new_empty!(
5216                            FlatlandSetHitRegionsRequest,
5217                            fidl::encoding::DefaultFuchsiaResourceDialect
5218                        );
5219                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetHitRegionsRequest>(&header, _body_bytes, handles, &mut req)?;
5220                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
5221                        Ok(FlatlandRequest::SetHitRegions {
5222                            transform_id: req.transform_id,
5223                            regions: req.regions,
5224
5225                            control_handle,
5226                        })
5227                    }
5228                    0x26d81af852d29562 => {
5229                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5230                        let mut req = fidl::new_empty!(
5231                            FlatlandSetInfiniteHitRegionRequest,
5232                            fidl::encoding::DefaultFuchsiaResourceDialect
5233                        );
5234                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetInfiniteHitRegionRequest>(&header, _body_bytes, handles, &mut req)?;
5235                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
5236                        Ok(FlatlandRequest::SetInfiniteHitRegion {
5237                            transform_id: req.transform_id,
5238                            hit_test: req.hit_test,
5239
5240                            control_handle,
5241                        })
5242                    }
5243                    0x2485fbcab7f943c => {
5244                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5245                        let mut req = fidl::new_empty!(
5246                            FlatlandCreateViewportRequest,
5247                            fidl::encoding::DefaultFuchsiaResourceDialect
5248                        );
5249                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandCreateViewportRequest>(&header, _body_bytes, handles, &mut req)?;
5250                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
5251                        Ok(FlatlandRequest::CreateViewport {
5252                            viewport_id: req.viewport_id,
5253                            token: req.token,
5254                            properties: req.properties,
5255                            child_view_watcher: req.child_view_watcher,
5256
5257                            control_handle,
5258                        })
5259                    }
5260                    0x26fae823c4ebedad => {
5261                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5262                        let mut req = fidl::new_empty!(
5263                            FlatlandCreateImageRequest,
5264                            fidl::encoding::DefaultFuchsiaResourceDialect
5265                        );
5266                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandCreateImageRequest>(&header, _body_bytes, handles, &mut req)?;
5267                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
5268                        Ok(FlatlandRequest::CreateImage {
5269                            image_id: req.image_id,
5270                            import_token: req.import_token,
5271                            vmo_index: req.vmo_index,
5272                            properties: req.properties,
5273
5274                            control_handle,
5275                        })
5276                    }
5277                    0x8039391d715eb28 => {
5278                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5279                        let mut req = fidl::new_empty!(
5280                            FlatlandSetImageSampleRegionRequest,
5281                            fidl::encoding::DefaultFuchsiaResourceDialect
5282                        );
5283                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetImageSampleRegionRequest>(&header, _body_bytes, handles, &mut req)?;
5284                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
5285                        Ok(FlatlandRequest::SetImageSampleRegion {
5286                            image_id: req.image_id,
5287                            rect: req.rect,
5288
5289                            control_handle,
5290                        })
5291                    }
5292                    0x766cf99a2ec58446 => {
5293                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5294                        let mut req = fidl::new_empty!(
5295                            FlatlandSetImageDestinationSizeRequest,
5296                            fidl::encoding::DefaultFuchsiaResourceDialect
5297                        );
5298                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetImageDestinationSizeRequest>(&header, _body_bytes, handles, &mut req)?;
5299                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
5300                        Ok(FlatlandRequest::SetImageDestinationSize {
5301                            image_id: req.image_id,
5302                            size: req.size,
5303
5304                            control_handle,
5305                        })
5306                    }
5307                    0x10f5da1356275b7b => {
5308                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5309                        let mut req = fidl::new_empty!(
5310                            FlatlandSetImageBlendingFunctionRequest,
5311                            fidl::encoding::DefaultFuchsiaResourceDialect
5312                        );
5313                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetImageBlendingFunctionRequest>(&header, _body_bytes, handles, &mut req)?;
5314                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
5315                        Ok(FlatlandRequest::SetImageBlendingFunction {
5316                            image_id: req.image_id,
5317                            blend_mode: req.blend_mode,
5318
5319                            control_handle,
5320                        })
5321                    }
5322                    0x5b1667f130c3de67 => {
5323                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5324                        let mut req = fidl::new_empty!(
5325                            FlatlandSetImageBlendModeRequest,
5326                            fidl::encoding::DefaultFuchsiaResourceDialect
5327                        );
5328                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetImageBlendModeRequest>(&header, _body_bytes, handles, &mut req)?;
5329                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
5330                        Ok(FlatlandRequest::SetImageBlendMode {
5331                            image_id: req.image_id,
5332                            blend_mode: req.blend_mode,
5333
5334                            control_handle,
5335                        })
5336                    }
5337                    0x2da9e4ef4c2cff6f => {
5338                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5339                        let mut req = fidl::new_empty!(
5340                            FlatlandSetImageOpacityRequest,
5341                            fidl::encoding::DefaultFuchsiaResourceDialect
5342                        );
5343                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetImageOpacityRequest>(&header, _body_bytes, handles, &mut req)?;
5344                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
5345                        Ok(FlatlandRequest::SetImageOpacity {
5346                            image_id: req.image_id,
5347                            val: req.val,
5348
5349                            control_handle,
5350                        })
5351                    }
5352                    0x21b20f2c14aae6bc => {
5353                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5354                        let mut req = fidl::new_empty!(
5355                            FlatlandSetImageFlipRequest,
5356                            fidl::encoding::DefaultFuchsiaResourceDialect
5357                        );
5358                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetImageFlipRequest>(&header, _body_bytes, handles, &mut req)?;
5359                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
5360                        Ok(FlatlandRequest::SetImageFlip {
5361                            image_id: req.image_id,
5362                            flip: req.flip,
5363
5364                            control_handle,
5365                        })
5366                    }
5367                    0x5e62355abc1c4c5d => {
5368                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5369                        let mut req = fidl::new_empty!(
5370                            FlatlandCreateFilledRectRequest,
5371                            fidl::encoding::DefaultFuchsiaResourceDialect
5372                        );
5373                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandCreateFilledRectRequest>(&header, _body_bytes, handles, &mut req)?;
5374                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
5375                        Ok(FlatlandRequest::CreateFilledRect {
5376                            rect_id: req.rect_id,
5377
5378                            control_handle,
5379                        })
5380                    }
5381                    0x32d6ef41e182dfa5 => {
5382                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5383                        let mut req = fidl::new_empty!(
5384                            FlatlandSetSolidFillRequest,
5385                            fidl::encoding::DefaultFuchsiaResourceDialect
5386                        );
5387                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetSolidFillRequest>(&header, _body_bytes, handles, &mut req)?;
5388                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
5389                        Ok(FlatlandRequest::SetSolidFill {
5390                            rect_id: req.rect_id,
5391                            color: req.color,
5392                            size: req.size,
5393
5394                            control_handle,
5395                        })
5396                    }
5397                    0x7392cabe45618f9b => {
5398                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5399                        let mut req = fidl::new_empty!(
5400                            FlatlandReleaseFilledRectRequest,
5401                            fidl::encoding::DefaultFuchsiaResourceDialect
5402                        );
5403                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandReleaseFilledRectRequest>(&header, _body_bytes, handles, &mut req)?;
5404                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
5405                        Ok(FlatlandRequest::ReleaseFilledRect {
5406                            rect_id: req.rect_id,
5407
5408                            control_handle,
5409                        })
5410                    }
5411                    0x4ed2cfc0ce130862 => {
5412                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5413                        let mut req = fidl::new_empty!(
5414                            FlatlandSetContentRequest,
5415                            fidl::encoding::DefaultFuchsiaResourceDialect
5416                        );
5417                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetContentRequest>(&header, _body_bytes, handles, &mut req)?;
5418                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
5419                        Ok(FlatlandRequest::SetContent {
5420                            transform_id: req.transform_id,
5421                            content_id: req.content_id,
5422
5423                            control_handle,
5424                        })
5425                    }
5426                    0x66ab67e9608ddb9f => {
5427                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5428                        let mut req = fidl::new_empty!(
5429                            FlatlandSetViewportPropertiesRequest,
5430                            fidl::encoding::DefaultFuchsiaResourceDialect
5431                        );
5432                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetViewportPropertiesRequest>(&header, _body_bytes, handles, &mut req)?;
5433                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
5434                        Ok(FlatlandRequest::SetViewportProperties {
5435                            viewport_id: req.viewport_id,
5436                            properties: req.properties,
5437
5438                            control_handle,
5439                        })
5440                    }
5441                    0xab9328419451c22 => {
5442                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5443                        let mut req = fidl::new_empty!(
5444                            FlatlandReleaseTransformRequest,
5445                            fidl::encoding::DefaultFuchsiaResourceDialect
5446                        );
5447                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandReleaseTransformRequest>(&header, _body_bytes, handles, &mut req)?;
5448                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
5449                        Ok(FlatlandRequest::ReleaseTransform {
5450                            transform_id: req.transform_id,
5451
5452                            control_handle,
5453                        })
5454                    }
5455                    0x5b35aab9baffecae => {
5456                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5457                        let mut req = fidl::new_empty!(
5458                            fidl::encoding::EmptyPayload,
5459                            fidl::encoding::DefaultFuchsiaResourceDialect
5460                        );
5461                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
5462                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
5463                        Ok(FlatlandRequest::ReleaseView { control_handle })
5464                    }
5465                    0xbad474aeb5293f9 => {
5466                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5467                        let mut req = fidl::new_empty!(
5468                            FlatlandReleaseViewportRequest,
5469                            fidl::encoding::DefaultFuchsiaResourceDialect
5470                        );
5471                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandReleaseViewportRequest>(&header, _body_bytes, handles, &mut req)?;
5472                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
5473                        Ok(FlatlandRequest::ReleaseViewport {
5474                            viewport_id: req.viewport_id,
5475
5476                            responder: FlatlandReleaseViewportResponder {
5477                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5478                                tx_id: header.tx_id,
5479                            },
5480                        })
5481                    }
5482                    0xb884ffdbc72c111 => {
5483                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5484                        let mut req = fidl::new_empty!(
5485                            FlatlandReleaseImageRequest,
5486                            fidl::encoding::DefaultFuchsiaResourceDialect
5487                        );
5488                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandReleaseImageRequest>(&header, _body_bytes, handles, &mut req)?;
5489                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
5490                        Ok(FlatlandRequest::ReleaseImage { image_id: req.image_id, control_handle })
5491                    }
5492                    0x4ec8817c02828c3e => {
5493                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5494                        let mut req = fidl::new_empty!(
5495                            fidl::encoding::EmptyPayload,
5496                            fidl::encoding::DefaultFuchsiaResourceDialect
5497                        );
5498                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
5499                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
5500                        Ok(FlatlandRequest::Clear { control_handle })
5501                    }
5502                    0x46a8b397e68a8888 => {
5503                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5504                        let mut req = fidl::new_empty!(
5505                            FlatlandSetDebugNameRequest,
5506                            fidl::encoding::DefaultFuchsiaResourceDialect
5507                        );
5508                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetDebugNameRequest>(&header, _body_bytes, handles, &mut req)?;
5509                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
5510                        Ok(FlatlandRequest::SetDebugName { name: req.name, control_handle })
5511                    }
5512                    _ => Err(fidl::Error::UnknownOrdinal {
5513                        ordinal: header.ordinal,
5514                        protocol_name:
5515                            <FlatlandMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5516                    }),
5517                }))
5518            },
5519        )
5520    }
5521}
5522
5523/// Each Flatland session contains a Graph, which consists of a set of objects, and the
5524/// relationships between those objects. The client can specify a subset of those objects
5525/// (specifically, the directed acyclic graph starting at the root transform) to be presented as
5526/// content to some kind of output -- usually, a display.
5527///
5528/// Flatland Graphs are both hierarchical, and distributed. Graphs from different Flatland sessions
5529/// may be connected together, allowing multiple processes to be involved in authoring content for a
5530/// particular output.
5531///
5532/// All functions in this protocol are feed-forward. The operations they represent are not fully
5533/// executed until [`Present`] is called.
5534#[derive(Debug)]
5535pub enum FlatlandRequest {
5536    /// Releases an image immediately, without waiting for the next present.
5537    ReleaseImageImmediately { image_id: ContentId, control_handle: FlatlandControlHandle },
5538    /// Releases an Image immediately, without waiting for the next present. This is a trusted
5539    /// memory-eviction path.
5540    ///
5541    /// The Image is forcibly unbound from any Layers that currently reference it. Those Layers
5542    /// behave as if their image was simply never set (they are invisible, but retain their image
5543    /// properties) until their next `SetLayerImage()`.
5544    ///
5545    /// Any pending release fences for the evicted Image's bindings will signal at the earliest
5546    /// safe point.
5547    ///
5548    /// This method is only available if Flatland2 is enabled and the session is trusted.
5549    ReleaseImageImmediately2 { image_id: ImageId, control_handle: FlatlandControlHandle },
5550    /// A Layer is a type of `Content` that composites either a single `Image` or a solid
5551    /// color. It separates visual properties (such as size, flip, opacity, and blending)
5552    /// from the raw pixel data.
5553    ///
5554    /// Unlike typical `Content` items which represent a static visual resource, a Layer is designed
5555    /// to be a dynamic container for an image sequence. Typical usage involves setting the layer's
5556    /// visual properties and image metadata infrequently, and then rapidly swapping the active
5557    /// `Image` (e.g. on every frame) with another image of matching metadata.
5558    ///
5559    /// This separation allows a single `Image` resource to be reused across multiple layers with
5560    /// different visual configurations simultaneously.
5561    ///
5562    /// To use a Layer:
5563    /// 1. Create a `Layer` using [`CreateLayer`].
5564    /// 2. Set properties on the `Layer` via [`SetLayerProperties`], including the
5565    ///    composition mode.
5566    /// 3. For an image layer, associate an `Image` with the `Layer` via [`SetLayerImage`].
5567    /// 4. Add the `Layer` to a `LayerStack` via [`SetStackLayers`].
5568    /// 5. Set the `LayerStack` as the content of a node via [`SetTransformContent`].
5569    ///
5570    /// `layer_id` must satisfy the identifier rules documented on [`LayerId`].
5571    CreateLayer { layer_id: LayerId, control_handle: FlatlandControlHandle },
5572    /// Released Layers will be garbage collected by the system once they are no longer necessary
5573    /// for rendering. For Layers, this means:
5574    /// - the Layer is no longer referenced by any LayerStack, and
5575    /// - any pending rendering that references the Layer is complete.
5576    ///
5577    /// `layer_id` must refer to a valid, unreleased Layer.
5578    ReleaseLayer { layer_id: LayerId, control_handle: FlatlandControlHandle },
5579    /// Associates an Image with the Layer.
5580    ///
5581    /// The binding is legal in any composition mode, and is sticky: it survives composition
5582    /// mode changes, and is replaced only by a later [`SetLayerImage`] call (or cleared by
5583    /// [`ResetLayer`]). The image is displayed only while the layer's composition mode is
5584    /// `IMAGE`.
5585    ///
5586    /// The bound image must be large enough for the layer's stored `sample_rect`; this is
5587    /// checked at [`fuchsia.ui.composition/Flatland.Present`], not here. See
5588    /// [`LayerProperties.sample_rect`].
5589    ///
5590    /// `layer_id` must refer to a valid, unreleased Layer.
5591    /// `image_id` must refer to a valid, unreleased Image.
5592    /// `acquire_fence` is an optional fence that must be signaled before the image is displayed.
5593    /// `release_fence` is an optional fence, signaled by Scenic when *this binding* no
5594    /// longer references the image. It is per-binding, not per-image: an image bound to
5595    /// several layers has one such fence per binding, and the image is safe to write only
5596    /// once every one of them has signaled.
5597    ///
5598    /// A binding is ended by:
5599    ///
5600    /// - being superseded by a later [`SetLayerImage`] on the same layer
5601    /// - [`ResetLayer`]
5602    /// - the layer ref-count reaching zero, either via [`ReleaseLayer`] or by being released
5603    ///   by a layer stack
5604    /// - destruction of the session, which ends every binding it holds
5605    ///
5606    /// For a binding ended while the session is alive, Scenic signals at the first frame
5607    /// retire after that point. Bindings that never reached the screen (e.g. one superseded
5608    /// within a single batch, or one lost when several
5609    /// [`fuchsia.ui.composition/Flatland.Present`] calls are squashed into a single
5610    /// frame) signal at that same retire rather than immediately. The signal is
5611    /// therefore conservative by at most one frame; it is never early.
5612    SetLayerImage {
5613        layer_id: LayerId,
5614        image_id: ImageId,
5615        acquire_fence: Option<Box<WaitFence>>,
5616        release_fence: Option<Box<SignalFence>>,
5617        control_handle: FlatlandControlHandle,
5618    },
5619    /// Sets properties of the Layer.
5620    ///
5621    /// The provided `properties` table is merged into the layer's stored properties: fields
5622    /// which are unset in `properties` retain their previously stored values. Stored
5623    /// properties are sticky; see [`LayerProperties`] for the full persistence semantics.
5624    ///
5625    /// Values are stored as given; validation which depends on other state (notably
5626    /// `sample_rect` against the bound image) happens at
5627    /// [`fuchsia.ui.composition/Flatland.Present`]. See [`LayerProperties.sample_rect`].
5628    ///
5629    /// `layer_id` must refer to a valid, unreleased Layer.
5630    SetLayerProperties {
5631        layer_id: LayerId,
5632        properties: LayerProperties,
5633        control_handle: FlatlandControlHandle,
5634    },
5635    /// Unbinds any Image bound to the layer and clears every stored [`LayerProperties`]
5636    /// field, returning the layer to its freshly-created state (composition mode
5637    /// `INVISIBLE`, all properties at their documented defaults). This is the only
5638    /// operation which forgets stored layer properties.
5639    ///
5640    /// `layer_id` must refer to a valid, unreleased Layer.
5641    ResetLayer { layer_id: LayerId, control_handle: FlatlandControlHandle },
5642    /// Creates a new layer stack with the specified `stack_id`.
5643    ///
5644    /// `stack_id` must satisfy the identifier rules documented on [`LayerId`].
5645    CreateLayerStack { stack_id: LayerStackId, control_handle: FlatlandControlHandle },
5646    /// Releases the layer stack with the specified `stack_id`.
5647    ReleaseLayerStack { stack_id: LayerStackId, control_handle: FlatlandControlHandle },
5648    /// Sets the layers in the stack. The order of layers in the vector determines their Z-order,
5649    /// with the first element being the back-most and the last element being the front-most.
5650    ///
5651    /// `stack_id` must refer to a valid, unreleased LayerStack. Each element of `layers`
5652    /// must refer to a valid, unreleased Layer. Duplicate layers within `layers` are
5653    /// disallowed.
5654    SetStackLayers {
5655        stack_id: LayerStackId,
5656        layers: Vec<LayerId>,
5657        control_handle: FlatlandControlHandle,
5658    },
5659    /// Creates an Image resource.
5660    ///
5661    /// `image_id` must satisfy the identifier rules documented on [`LayerId`].
5662    CreateImage2 {
5663        image_id: ImageId,
5664        import_token: BufferCollectionImportToken,
5665        vmo_index: u32,
5666        properties: ImageProperties,
5667        control_handle: FlatlandControlHandle,
5668    },
5669    /// Released Images will be garbage collected by the system once they are no longer necessary
5670    /// for rendering. For Images, this means:
5671    /// - the Image is no longer bound to any Layer, and
5672    /// - any pending rendering that references the Image is complete.
5673    ///
5674    /// The `image_id` value is freed for reuse immediately by the client (identifier uniqueness
5675    /// is instantaneous).
5676    ///
5677    /// Note: Per-binding release fences (passed to `SetLayerImage`) are unaffected by this call.
5678    /// They track the lifecycle of individual layer bindings, not the client's `image_id`.
5679    ///
5680    /// `image_id` must refer to a valid, unreleased Image.
5681    ReleaseImage2 { image_id: ImageId, control_handle: FlatlandControlHandle },
5682    /// Creates a Viewport resource.
5683    ///
5684    /// `viewport_id` must satisfy the identifier rules documented on [`LayerId`].
5685    CreateViewport2 {
5686        viewport_id: ViewportId,
5687        token: fidl_fuchsia_ui_views::ViewportCreationToken,
5688        properties: ViewportProperties,
5689        child_view_watcher: fidl::endpoints::ServerEnd<ChildViewWatcherMarker>,
5690        control_handle: FlatlandControlHandle,
5691    },
5692    /// Releases a Viewport from the scene.
5693    ReleaseViewport2 { viewport_id: ViewportId, responder: FlatlandReleaseViewport2Responder },
5694    /// Sets the properties of a Viewport.
5695    SetViewportProperties2 {
5696        viewport_id: ViewportId,
5697        properties: ViewportProperties,
5698        control_handle: FlatlandControlHandle,
5699    },
5700    /// Sets (or clears) the content of a Transform.
5701    ///
5702    /// The same content may be attached to more than one Transform; each attachment composites
5703    /// that content again under its own Transform's matrix, clip, and opacity, so a single
5704    /// LayerStack or Viewport can appear repeatedly in a scene without the client duplicating the
5705    /// underlying resources.
5706    ///
5707    /// A Transform's content can be cleared by not providing the optional `content`.
5708    ///
5709    /// If `content` is set, it must refer to a valid, unreleased LayerStack or Viewport.
5710    /// Unlike classic [`Flatland.SetContent`], a zero id does not clear the content.
5711    SetTransformContent {
5712        transform_id: TransformId,
5713        content: Option<Box<TransformContent>>,
5714        control_handle: FlatlandControlHandle,
5715    },
5716    /// Complete execution of all feed-forward operations.
5717    ///
5718    /// If executing an operation produces an error (e.g., CreateTransform(0)), an [`OnError`] event
5719    /// is emitted. Operations that produce errors are ignored and the channel is closed.
5720    ///
5721    /// If execution completes successfully, [`OnNextFrameBegin`] is emitted with valid frame
5722    /// production information.
5723    ///
5724    /// The client may only call [`Present`] when they have a non-zero number of present credits,
5725    /// which are tracked by the server. The server may increment the number of credits when it
5726    /// fires the [`OnNextFrameBegin`] event, which informs the client when it receives additional
5727    /// present credits. Each [`Present`] call uses one present credit and decrements the server
5728    /// count by one. If the client calls [`Present`] with no present credits, the server will
5729    /// return a `NO_PRESENTS_REMAINING` error.
5730    ///
5731    /// The client should assume that prior to receiving any [`OnNextFrameBegin`] events, they have
5732    /// one present credit.
5733    ///
5734    /// Every [`Present`] call results in one [`OnNextFrameBegin`] event, and one
5735    /// [`OnFramePresented`] event, typically in that order.
5736    ///
5737    /// When the commands flushed by [`Present`] make it to display, an [`OnFramePresented`] event
5738    /// is fired. This event includes information pertaining to all [`Present`]s that had content
5739    /// that were part of that frame.
5740    ///
5741    /// See [`fuchsia.ui.composition/PresentArgs`] documentation above for more detailed information
5742    /// on what arguments are passed in and their role.
5743    Present { args: PresentArgs, control_handle: FlatlandControlHandle },
5744    /// Two Flatland sessions may be connected in a parent-child relationship. The parent endpoint
5745    /// is held in a Viewport, and the child endpoint is held in a View. The parent Flatland
5746    /// session that creates a Viewport has control over how the child's View is integrated into
5747    /// its own View.
5748    ///
5749    /// The lifecycle of a parent-child connection starts with two endpoints of a channel object:
5750    /// a ViewportCreationToken and a ViewCreationToken. Out-of-band protocols pass the
5751    /// ViewportCreationToken to the parent, which calls [`CreateViewport`], and the
5752    /// ViewCreationToken to the child, which calls [`CreateView`].
5753    ///
5754    /// Only nodes connected to the Root Transform in this Flatland session will be rendered into
5755    /// the parent's Viewport.
5756    ///
5757    /// Calling [`CreateView`] a second time will disconnect the Root Transform from the existing
5758    /// parent's Viewport, and attach it to a new parent's Viewport. In other words, each View can
5759    /// only have one parent.
5760    ///
5761    /// This function is queued, meaning that the Root Transform will not be attached to the
5762    /// parent Viewport until [`Present`] is called. However, clients will receive information
5763    /// through their ParentViewportWatcher (e.g., LayoutInfo) immediately after calling this
5764    /// function, even if they have not called [`Present`] or [`SetRootTransform`]. This allows
5765    /// clients to wait for layout information from their parent before calling [`Present`].
5766    ///
5767    /// Any illegal operations on ParentViewportWatcher will cause both ParentViewportWatcher
5768    /// channel and this Flatland channel to be torn down.
5769    ///
5770    /// Lifecycle note. The lifetime of the ParentViewportWatcher channel is bound by the peer
5771    /// ViewportCreationToken. When the ViewportCreationToken dies, this ParentViewportWatcher
5772    /// channel is destroyed.
5773    ///
5774    /// Views and subgraphs of Views created using `CreateView` will not be represented in the
5775    /// ViewTree, and hence will not be able to participate in any ViewTree-dependent interactions
5776    /// such as touch, mouse or focus.
5777    /// The Flatland protocol provides no way for Views in the subgraph of a View created with
5778    /// `CreateView` to know that they are excluded from the ViewTree.
5779    CreateView {
5780        token: fidl_fuchsia_ui_views::ViewCreationToken,
5781        parent_viewport_watcher: fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>,
5782        control_handle: FlatlandControlHandle,
5783    },
5784    /// Identical to [`CreateView`], except it allows association of View identity (ViewRef) and
5785    /// view-bound protocols.
5786    CreateView2 {
5787        token: fidl_fuchsia_ui_views::ViewCreationToken,
5788        view_identity: fidl_fuchsia_ui_views::ViewIdentityOnCreation,
5789        protocols: ViewBoundProtocols,
5790        parent_viewport_watcher: fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>,
5791        control_handle: FlatlandControlHandle,
5792    },
5793    /// Creates a new Transform node. Transforms are a hierarchical piece of a Flatland graph. They
5794    /// can have children, and can reference Content. A sub-graph represented by a Transform and its
5795    /// descendants can be rendered to a display.
5796    ///
5797    /// Transforms are kept alive, even when released, as long as they are children of either an
5798    /// unreleased Transform, or the Root Transform.
5799    ///
5800    /// Each Transform can have a single piece of attached Content. Common types of Content include
5801    /// bitmaps, asynchronous streams of images, and Viewports to Views hosted in other Flatland
5802    /// sessions.
5803    ///
5804    /// Transforms have attributes. Child Transforms inherit the combined attributes of their
5805    /// parents. Content attached to a Transform is also affected by that Transform's attributes.
5806    ///
5807    /// When a sub-graph of Transforms is rendered, Content will be rendered back-to-front, starting
5808    /// with the Content on the root transform, and continuing recursively through all of its child
5809    /// Transforms in the order the children were added. See [`AddChild`] for more information.
5810    ///
5811    /// Zero is not a valid transform id. All other values are valid, assuming they are not already
5812    /// in use (see [`ReleaseTransform`] for more details).
5813    CreateTransform { transform_id: TransformId, control_handle: FlatlandControlHandle },
5814    /// All Transform objects support all attributes.
5815    ///
5816    /// Geometric attributes are applied in the following order:
5817    /// 1. Scale (relative to the parent transform's coordinate space)
5818    /// 2. Orientation (relative to the parent transform's coordinate space)
5819    /// 3. Translation (relative to the parent transforms's coordinate space,
5820    ///    unaffected by scale applied to the current transform).
5821    /// 4. Clipping (relative to the current transform's coordinate space)
5822    ///
5823    /// The effects of each of these attributes are cumulative. This means the transform's position
5824    /// in the view space, and its clip boundary, will be calculated based on that chain of
5825    /// geometric attributes going up to the root transform.
5826    ///
5827    /// For instance, in a nested hierarchy such as the following:
5828    ///     [Root-Transform -> Transform1 -> Transform2 -> CurrentTransform]
5829    /// If Transform1 is translated by [2,0] and Transform2 is translated by [0,1] then the
5830    /// view-space position of CurrentTransform will be [2,1].
5831    ///
5832    /// Sets the translation on a Transform. The order of geometric attribute application is
5833    /// addressed above.
5834    SetTranslation {
5835        transform_id: TransformId,
5836        translation: fidl_fuchsia_math::Vec_,
5837        control_handle: FlatlandControlHandle,
5838    },
5839    /// Sets the orientation on a Transform. The order of geometric attribute application is
5840    /// addressed in the documentation for [`SetTranslation`]. In Flatland, the +X axis is
5841    /// to the right and the +Y axis is down. There is no notion of a Z axis. CCW is defined
5842    /// from the POV of the user, as if a skeuomorphoic clock is displayed on the screen.
5843    SetOrientation {
5844        transform_id: TransformId,
5845        orientation: Orientation,
5846        control_handle: FlatlandControlHandle,
5847    },
5848    /// Sets the scale on a transform. The order of geometric attribute application is
5849    /// addressed above. The (x,y) values in the VecF |scale| refer to the scale factor in the
5850    /// x-axis (width) and y-axis (height) respectively. Scale values must be positive 32-bit
5851    /// floating point values: https://en.wikipedia.org/wiki/Normal_number_%28computing%29
5852    SetScale {
5853        transform_id: TransformId,
5854        scale: fidl_fuchsia_math::VecF,
5855        control_handle: FlatlandControlHandle,
5856    },
5857    /// Sets an opacity in linear space to be applied to a transform and its descendents,
5858    /// which include other transforms and content. Opacity values must be in the range
5859    /// of [0.0, 1.0], where 0.0 is completely transparent and 1.0 is completely opaque.
5860    /// Attempting to call this function with values outside that range will result in
5861    /// an error. A transform's opacity value is multiplied with that of its parent. This
5862    /// effect works differently from group opacity. Using group opacity, child nodes are
5863    /// rendered together first, and then have the parent's opacity applied as a post-effect.
5864    /// Here, opacity is applied to each child individually. This may result in a very
5865    /// different effect.
5866    SetOpacity { transform_id: TransformId, value: f32, control_handle: FlatlandControlHandle },
5867    /// Sets the bounds, expressed in the local coordinate space of the transform, that
5868    /// constrains the region that content attached to this transform can be rendered to.
5869    /// If the content's area exceeds the clip bounds, the area outside the bounds will
5870    /// not be rendered. These bounds are valid for all children of this transform node as
5871    /// well, which includes nested Flatland sessions and their node hierarchies.
5872    /// If a child transform attempts to set clip bounds larger than that of its parent,
5873    /// it will be clipped to the parent's clip bounds. The default state is for a transform
5874    /// to be unclipped, meaning it will not have any bounds placed on its render region.
5875    /// The clip width/height must be positive. Negative values will result in an error.
5876    /// Passing in an empty box to the |rect| parameter will remove the clip bounds.
5877    SetClipBoundary {
5878        transform_id: TransformId,
5879        rect: Option<Box<fidl_fuchsia_math::Rect>>,
5880        control_handle: FlatlandControlHandle,
5881    },
5882    /// Adds a child Transform to a parent Transform. The new child Transform,
5883    /// and any Content attached to it or its children, will be rendered on top
5884    /// of the parent's Content, as well as any previously added children.
5885    ///
5886    /// The caller must ensure that `child_transform_id` is valid and that there
5887    /// are no repetitions.  Sending a repeated `child_transform_id` over
5888    /// multiple calls will result in session closure.
5889    AddChild {
5890        parent_transform_id: TransformId,
5891        child_transform_id: TransformId,
5892        control_handle: FlatlandControlHandle,
5893    },
5894    /// Removes a child Transform from a parent Transform.
5895    RemoveChild {
5896        parent_transform_id: TransformId,
5897        child_transform_id: TransformId,
5898        control_handle: FlatlandControlHandle,
5899    },
5900    /// Removes all child Transforms from a parent Transform and replaces them
5901    /// with the new child transforms in `new_child_transform_ids`.  The caller
5902    /// must ensure that all `TransformId` values in `new_child_transform_ids`
5903    /// are valid and that there are no repetitions.  Sending a repeated
5904    /// `TransformId` in `new_child_transform_ids` will result in session
5905    /// closure.
5906    ReplaceChildren {
5907        parent_transform_id: TransformId,
5908        new_child_transform_ids: Vec<TransformId>,
5909        control_handle: FlatlandControlHandle,
5910    },
5911    /// Sets the Root Transform for the graph.
5912    ///
5913    /// The sub-graph defined by the Root Transform and its children will be rendered as View
5914    /// in the connected parent's Viewport (see [`CreateView`]). Any parents of the Root Transform
5915    /// in this Graph will be ignored.
5916    ///
5917    /// The Root Transform, and all children of the Root Transform, are kept alive if they are
5918    /// released (see [`ReleaseTransform`] for more details).
5919    ///
5920    /// There is only ever one Root. Since 0 is not a valid transform id (see [`CreateTransform`]),
5921    /// calling SetRootTransform(0) clears the current Root, destroying any previously released
5922    /// objects that are not referenced by the new root.
5923    ///
5924    /// Note that every View has a clip boundary equivalent to its logical size. Anything outside
5925    /// that clip boundary will not be rendered. Hence, the Root Transform has a useful coordinate
5926    /// space of (0, 0) to (logical_size.width, logical_size.height), where (0, 0) is the upper left
5927    /// corner.
5928    ///
5929    /// Setting the root transform installs a full screen hit region on the root transform. Clients
5930    /// may remove this hit region if they don't want users to be able to interact with the root
5931    /// transform's content. For additional details on hit regions, see the [`SetHitRegions`]
5932    /// documentation.
5933    ///
5934    /// Default hit region rules
5935    ///
5936    ///   A default hit region follows these rules:
5937    ///   - When [`SetRootTransform`](T) is called, T receives a maximal hit region, covering the
5938    ///   entire view.
5939    ///   - If [`SetHitRegions`] is called on T, either before or after [`SetRootTransform`](T),
5940    ///   then no default hit region is active and the client specified hit regions are used.
5941    ///   - If a transform is no longer the root transform, i.e., [`SetRootTransform`](U) is
5942    ///   called, then the original transform no longer has its default hit region.
5943    ///   - Clients can remove or modify the root transform's hit regions the same way they would
5944    ///   reset any other transform's hit regions, by calling [`SetHitRegions`] with the appropriate
5945    ///   vector.
5946    SetRootTransform { transform_id: TransformId, control_handle: FlatlandControlHandle },
5947    /// Sets the interactive areas for a Transform. By default, Content is not interactive; hit
5948    /// regions must be placed for a user to interact with the Content in a View. Because hit
5949    /// regions are described in the Flatland protocol, a Flatland session can synchronize Content
5950    /// and hit regions.
5951    ///
5952    /// Each hit region is placed in the coordinate space of the owning Transform, and may or may
5953    /// not interact with different types of hit testing, depending on its [`HitTestInteraction`]
5954    /// type. When there are multiple hit regions that intersect with a hit test, the precedence
5955    /// rules given below dictate which hit region has interacted with the hit test. Only Transforms
5956    /// that transitively connect to the root Transform have their hit regions interact with a hit
5957    /// test.
5958    ///
5959    /// Calling this function replaces any previous values set on this Transform. To reset a
5960    /// Transform to "no hit testing": send an empty vector with [`SetHitRegions`].
5961    ///
5962    /// Note that root transforms get a default hit region installed by Flatland. For more details,
5963    /// see the [`SetRootTransform`] documentation.
5964    ///
5965    /// Precedence rules
5966    ///   Within a Transform, if multiple hit regions overlap, the hit test examines each
5967    ///   intersecting hit region for a possible interaction. Thus, for a regular hit test R and an
5968    ///   accessibility hit test A, where R and A both intersect two hit regions D ([`DEFAULT`]) and
5969    ///   S ([`SEMANTICALLY_INVISIBLE`]) on the same Transform, (1) R interacts with both D and S,
5970    ///   and (2) A only interacts with D. Generally, hit regions that overlap in a single Transform
5971    ///   can cause confusing behavior.
5972    ///
5973    ///   Within a View, for a given hit test, the front-most Transform's hit regions take
5974    ///   precedence over those behind. This follows the expected reverse "render order" of
5975    ///   Transforms (described in [`CreateTransform`]), where a user expects to interact with
5976    ///   Content that is visible, or front-most.
5977    ///
5978    ///   Across Flatland sessions, for a given hit test, the front-most session's front-most
5979    ///   Transform's hit regions take precedence over those behind. This follows the expected
5980    ///   reverse "render order" of views, where a user expects to interact with the View that is
5981    ///   visible, or front-most. For example, if a child View owns Content that is rendered over
5982    ///   the parent View, the user expects to interact with the child's Content.
5983    SetHitRegions {
5984        transform_id: TransformId,
5985        regions: Vec<HitRegion>,
5986        control_handle: FlatlandControlHandle,
5987    },
5988    /// Identical to [`SetHitRegions`], except the hit region associated with [`transform_id`]
5989    /// covers an infinite region. The hit region is invariant against translation, scaling, and
5990    /// orientation of the Transform.
5991    ///
5992    /// An infinite hit region is still limited in extent by the View's clip boundary, just like a
5993    /// finite hit region.
5994    ///
5995    /// Calling this function replaces any previous values set on this Transform. To reset a
5996    /// Transform to "no hit testing": send an empty vector with [`SetHitRegions`].
5997    SetInfiniteHitRegion {
5998        transform_id: TransformId,
5999        hit_test: HitTestInteraction,
6000        control_handle: FlatlandControlHandle,
6001    },
6002    /// The Viewport and View pair, together, represent the connection between two Flatland
6003    /// sessions. The Viewport is created in the parent, and the View is created in the child. The
6004    /// parent has control over how the child's View is integrated into its own View.
6005    ///
6006    /// Any illegal operations on ChildViewWatcher will cause both ChildViewWatcher channel and this
6007    /// Flatland channel to be torn down.
6008    ///
6009    /// `ViewportProperties` must have logical_size set. This is the initial size that will drive
6010    /// the layout of the child. The logical_size is also used as the default Content size, but
6011    /// subsequent changes to the logical_size will have no effect on the Content size.
6012    ///
6013    /// `ViewportProperties` may have inset field not set. In that case, the default value of
6014    /// (0, 0, 0, 0) is used.
6015    ///
6016    /// The logical_size must have positive X and Y components.
6017    ///
6018    /// Lifecycle note. The lifetime of the ChildViewWatcher channel is bound by the peer
6019    /// ViewCreationToken. When the ViewCreationToken dies, this ChildViewWatcher channel is
6020    /// destroyed.
6021    ///
6022    /// `viewport_id` must satisfy standard [`ContentId`] creation constraints.
6023    CreateViewport {
6024        viewport_id: ContentId,
6025        token: fidl_fuchsia_ui_views::ViewportCreationToken,
6026        properties: ViewportProperties,
6027        child_view_watcher: fidl::endpoints::ServerEnd<ChildViewWatcherMarker>,
6028        control_handle: FlatlandControlHandle,
6029    },
6030    /// An Image is a bitmap backed by a specific VMO in a BufferCollection.
6031    ///
6032    /// Image creation requires an allocated BufferCollection registered with Allocator. This
6033    /// function will fail unless all clients of the specified BufferCollection have set their
6034    /// constraints.
6035    ///
6036    /// The Image must reference a valid VMO index and must have ImageProperties that fall within
6037    /// the constraints specified by the backing BufferCollection (i.e. width and height within a
6038    /// valid range, etc.)
6039    ///
6040    /// `image_id` must satisfy standard [`ContentId`] creation constraints.
6041    CreateImage {
6042        image_id: ContentId,
6043        import_token: BufferCollectionImportToken,
6044        vmo_index: u32,
6045        properties: ImageProperties,
6046        control_handle: FlatlandControlHandle,
6047    },
6048    /// This function is used to determine the region (in texel space) of an image that will be used
6049    /// by Flatland when rendering. The image to be sampled is referenced by [`image_id`] and the
6050    /// sample region is specified by [`rect`] which itself is comprised of an origin point (x,y) as
6051    /// well as a width and height, in unnormalized coordinates. It is illegal to call this function
6052    /// on non-image content, or to sample a region outside of the texel space of the image. In
6053    /// other words, the region specifed by [`rect`] must not exceed the ranges (0, image_width) and
6054    /// (0, image_height). If (rect.x + rect.width > image_width) or (rect.y + rect.height >
6055    /// image_height) or if any of the values are negative, this will result in an error.
6056    ///
6057    /// If this method is not called, the default sample region is the rectangle with origin at
6058    /// (0, 0) and width and height set at ImageProperties from [`CreateImage`].
6059    ///
6060    /// `image_id` must refer to a valid, unreleased Image.
6061    SetImageSampleRegion {
6062        image_id: ContentId,
6063        rect: fidl_fuchsia_math::RectF,
6064        control_handle: FlatlandControlHandle,
6065    },
6066    /// The content size for an Image is the size of the rectangle in the parent's logical
6067    /// coordinate space that the image occupies. This combined with the global translation of the
6068    /// transform it is attached to determines the size and location of where the content is
6069    /// rendered on the display.
6070    ///
6071    /// If this method is not called, the default image destination size is the width and height set
6072    /// at ImageProperties from [`CreateImage`]. The destination size will be affected by scaling if
6073    /// [`SetScale`] is used on the attached Transform or its parents.
6074    SetImageDestinationSize {
6075        image_id: ContentId,
6076        size: fidl_fuchsia_math::SizeU,
6077        control_handle: FlatlandControlHandle,
6078    },
6079    /// Determines the blend function to use when rendering the content specified by
6080    /// |image_id|. |image_id| must be a valid ContentId associated to a transform through
6081    /// a call to |CreateImage| or |CreateFilledRect|. For details on the different blend functions
6082    /// that are available, please refer to the BlendMode enum. If this function is not called, then
6083    /// the default blendmode is BlendMode::SRC.
6084    SetImageBlendingFunction {
6085        image_id: ContentId,
6086        blend_mode: BlendMode,
6087        control_handle: FlatlandControlHandle,
6088    },
6089    /// Determines the blend function to use when rendering the content specified by
6090    /// |image_id|. |image_id| must be a valid ContentId associated to a transform through
6091    /// a call to |CreateImage| or |CreateFilledRect|. For details on the different blend functions
6092    /// that are available, please refer to the BlendMode2 enum. If this function is not called,
6093    /// the default blendmode is BlendMode2::REPLACE.
6094    SetImageBlendMode {
6095        image_id: ContentId,
6096        blend_mode: BlendMode2,
6097        control_handle: FlatlandControlHandle,
6098    },
6099    /// Sets an opacity in linear space to be applied to a flatland image. Opacity values must
6100    /// be in the range [0.0, 1.0].
6101    SetImageOpacity { image_id: ContentId, val: f32, control_handle: FlatlandControlHandle },
6102    /// Sets the image flip to be applied to a flatland image. This call must be performed after a
6103    /// successful |CreateImage| call. If an invalid |image_id| is supplied, the channel will be
6104    /// closed due to FlatlandError::BAD_OPERATION. This flip will be applied to the Image before
6105    /// parent Transform Orientations. If this function is not called, then the default flip value
6106    /// is ImageFlip::NONE.
6107    SetImageFlip { image_id: ContentId, flip: ImageFlip, control_handle: FlatlandControlHandle },
6108    /// Creates a solid-color rectangle. By default a filled-rect does not have a defined
6109    /// color or size. It is necessary to call |SetSolidFill| to specify a color and size
6110    /// before a filled rect can be used for rendering. Not doing so will result the
6111    /// rectangle having a default size of (0,0) and so it will not show up when rendering.
6112    ///
6113    /// `rect_id` must satisfy standard [`ContentId`] creation constraints.
6114    CreateFilledRect { rect_id: ContentId, control_handle: FlatlandControlHandle },
6115    /// Defines the color and size of a filled rect. |rect_id| must refer to content that
6116    /// was created via a call to CreateFilledRect. The color is not premultiplied. Color values
6117    /// must be within the range [0,1] inclusive, and normal 32-bit
6118    /// floating point values: https://en.wikipedia.org/wiki/Normal_number_%28computing%29. Values
6119    /// that do not conform to these specifications will cause the channel to close.
6120    /// The rectangle's top left corner will be at (0, 0) in its transform's coordinate space.
6121    /// Hence, its bottom right corner will be at (size.width, size.height).
6122    ///
6123    /// `rect_id` must refer to a valid, unreleased filled rectangle.
6124    SetSolidFill {
6125        rect_id: ContentId,
6126        color: ColorRgba,
6127        size: fidl_fuchsia_math::SizeU,
6128        control_handle: FlatlandControlHandle,
6129    },
6130    /// Automatically garbage collects the rectangle when it is no longer needed for
6131    /// rendering. |rect_id| must have been instantiated with a call to
6132    /// |CreateFilledRect|. Once released, the ID immediately goes out of scope and is free
6133    /// to be used again.
6134    ///
6135    /// `rect_id` must refer to a valid, unreleased filled rectangle.
6136    ReleaseFilledRect { rect_id: ContentId, control_handle: FlatlandControlHandle },
6137    /// Setting a piece of Content on a Transform makes that Content visible in the render tree as
6138    /// long as the Transform is visible from the root Transform. The Content will be rendered
6139    /// before, and therefore "behind", any Content attached to the descendants of the Transform.
6140    ///
6141    /// Because each Transform can have, at most, a single piece of Content on it, calling this
6142    /// function on a Transform that already has Content will replace that Content.
6143    ///
6144    /// A Content may be set on more than one Transform.
6145    ///
6146    /// Calling this function with a Content id of 0 will remove any Content currently on the
6147    /// Transform.
6148    ///
6149    /// `content_id` must refer to a valid, unreleased Content object, or 0 to clear.
6150    SetContent {
6151        transform_id: TransformId,
6152        content_id: ContentId,
6153        control_handle: FlatlandControlHandle,
6154    },
6155    /// Transforms are usually sufficient to change how Content is presented. Viewports, however,
6156    /// have special properties that are not part of the Transform hierarchy. Those properties can
6157    /// be set using this function.
6158    SetViewportProperties {
6159        viewport_id: ContentId,
6160        properties: ViewportProperties,
6161        control_handle: FlatlandControlHandle,
6162    },
6163    /// Released Transforms will be garbage collected by the system once they are no longer
6164    /// necessary for rendering. For Transforms, this means there is no path from any unreleased
6165    /// Transform to the newly-released Transform.
6166    ///
6167    /// Once released, the id immediately goes out of scope for future function calls and can be
6168    /// reused when creating new Transforms.
6169    ///
6170    /// It is an error to call functions with a released id (unless that id has been reused to
6171    /// construct a new Transform).
6172    ReleaseTransform { transform_id: TransformId, control_handle: FlatlandControlHandle },
6173    /// Releases the View, which disconnects this Flatland session from its parent Viewport in
6174    /// another Flatland session.
6175    ///
6176    /// To clear the existing content from the screen without releasing the current View, use
6177    /// SetRootTransform(0) instead.
6178    ///
6179    /// Despite having a return type, this function is still feed-forward Like [`CreateView`] and
6180    /// requires a call to [`Present`] to be executed. The ViewCreationToken will be returned after
6181    /// the presented operations have been executed.
6182    ReleaseView { control_handle: FlatlandControlHandle },
6183    /// Releases a Viewport from the scene, even if the Viewport is still connected to a Transform.
6184    /// Unlike other resources, Viewports are garbage collected by the system during the next
6185    /// [`Present`] because a removed Viewport is guaranteed to provide no renderable content.
6186    ///
6187    /// Use SetContent(transform_id, 0) to clean up references to released Viewports.
6188    ///
6189    /// Despite having a return type, this function is still feed-forward like [`CreateView`] and
6190    /// requires a call to [`Present`] to be executed. The ViewportCreationToken will be returned
6191    /// after the presented operations have been executed.
6192    ReleaseViewport { viewport_id: ContentId, responder: FlatlandReleaseViewportResponder },
6193    /// Released Images will be garbage collected by the system once they are no longer necessary
6194    /// for rendering. For Images, this means the Image is no longer attached to any Transform and
6195    /// any pending rendering that references the Image is complete.
6196    ///
6197    /// Use SetContent(transform_id, 0) to clean up references to released Images.
6198    ///
6199    /// Once released, the id immediately goes out of scope for future function calls and can be
6200    /// reused when creating new Images.
6201    ///
6202    /// It is an error to call functions with a released id (unless that id has been reused to
6203    /// construct a new Image).
6204    ReleaseImage { image_id: ContentId, control_handle: FlatlandControlHandle },
6205    /// This function will reset all state on this interface. This includes destroying all existing
6206    /// View and Viewports without returning the associated Token to the caller.
6207    Clear { control_handle: FlatlandControlHandle },
6208    /// Set debug name of the current client that can be used by Flatland to print as a prefix to
6209    /// logs to help client distinguish what is theirs. [`name`] can be an arbitrary string, but the
6210    /// current process name (see fsl::GetCurrentProcessName()) is a good default.
6211    SetDebugName { name: String, control_handle: FlatlandControlHandle },
6212}
6213
6214impl FlatlandRequest {
6215    #[allow(irrefutable_let_patterns)]
6216    pub fn into_release_image_immediately(self) -> Option<(ContentId, FlatlandControlHandle)> {
6217        if let FlatlandRequest::ReleaseImageImmediately { image_id, control_handle } = self {
6218            Some((image_id, control_handle))
6219        } else {
6220            None
6221        }
6222    }
6223
6224    #[allow(irrefutable_let_patterns)]
6225    pub fn into_release_image_immediately2(self) -> Option<(ImageId, FlatlandControlHandle)> {
6226        if let FlatlandRequest::ReleaseImageImmediately2 { image_id, control_handle } = self {
6227            Some((image_id, control_handle))
6228        } else {
6229            None
6230        }
6231    }
6232
6233    #[allow(irrefutable_let_patterns)]
6234    pub fn into_create_layer(self) -> Option<(LayerId, FlatlandControlHandle)> {
6235        if let FlatlandRequest::CreateLayer { layer_id, control_handle } = self {
6236            Some((layer_id, control_handle))
6237        } else {
6238            None
6239        }
6240    }
6241
6242    #[allow(irrefutable_let_patterns)]
6243    pub fn into_release_layer(self) -> Option<(LayerId, FlatlandControlHandle)> {
6244        if let FlatlandRequest::ReleaseLayer { layer_id, control_handle } = self {
6245            Some((layer_id, control_handle))
6246        } else {
6247            None
6248        }
6249    }
6250
6251    #[allow(irrefutable_let_patterns)]
6252    pub fn into_set_layer_image(
6253        self,
6254    ) -> Option<(
6255        LayerId,
6256        ImageId,
6257        Option<Box<WaitFence>>,
6258        Option<Box<SignalFence>>,
6259        FlatlandControlHandle,
6260    )> {
6261        if let FlatlandRequest::SetLayerImage {
6262            layer_id,
6263            image_id,
6264            acquire_fence,
6265            release_fence,
6266            control_handle,
6267        } = self
6268        {
6269            Some((layer_id, image_id, acquire_fence, release_fence, control_handle))
6270        } else {
6271            None
6272        }
6273    }
6274
6275    #[allow(irrefutable_let_patterns)]
6276    pub fn into_set_layer_properties(
6277        self,
6278    ) -> Option<(LayerId, LayerProperties, FlatlandControlHandle)> {
6279        if let FlatlandRequest::SetLayerProperties { layer_id, properties, control_handle } = self {
6280            Some((layer_id, properties, control_handle))
6281        } else {
6282            None
6283        }
6284    }
6285
6286    #[allow(irrefutable_let_patterns)]
6287    pub fn into_reset_layer(self) -> Option<(LayerId, FlatlandControlHandle)> {
6288        if let FlatlandRequest::ResetLayer { layer_id, control_handle } = self {
6289            Some((layer_id, control_handle))
6290        } else {
6291            None
6292        }
6293    }
6294
6295    #[allow(irrefutable_let_patterns)]
6296    pub fn into_create_layer_stack(self) -> Option<(LayerStackId, FlatlandControlHandle)> {
6297        if let FlatlandRequest::CreateLayerStack { stack_id, control_handle } = self {
6298            Some((stack_id, control_handle))
6299        } else {
6300            None
6301        }
6302    }
6303
6304    #[allow(irrefutable_let_patterns)]
6305    pub fn into_release_layer_stack(self) -> Option<(LayerStackId, FlatlandControlHandle)> {
6306        if let FlatlandRequest::ReleaseLayerStack { stack_id, control_handle } = self {
6307            Some((stack_id, control_handle))
6308        } else {
6309            None
6310        }
6311    }
6312
6313    #[allow(irrefutable_let_patterns)]
6314    pub fn into_set_stack_layers(
6315        self,
6316    ) -> Option<(LayerStackId, Vec<LayerId>, FlatlandControlHandle)> {
6317        if let FlatlandRequest::SetStackLayers { stack_id, layers, control_handle } = self {
6318            Some((stack_id, layers, control_handle))
6319        } else {
6320            None
6321        }
6322    }
6323
6324    #[allow(irrefutable_let_patterns)]
6325    pub fn into_create_image2(
6326        self,
6327    ) -> Option<(ImageId, BufferCollectionImportToken, u32, ImageProperties, FlatlandControlHandle)>
6328    {
6329        if let FlatlandRequest::CreateImage2 {
6330            image_id,
6331            import_token,
6332            vmo_index,
6333            properties,
6334            control_handle,
6335        } = self
6336        {
6337            Some((image_id, import_token, vmo_index, properties, control_handle))
6338        } else {
6339            None
6340        }
6341    }
6342
6343    #[allow(irrefutable_let_patterns)]
6344    pub fn into_release_image2(self) -> Option<(ImageId, FlatlandControlHandle)> {
6345        if let FlatlandRequest::ReleaseImage2 { image_id, control_handle } = self {
6346            Some((image_id, control_handle))
6347        } else {
6348            None
6349        }
6350    }
6351
6352    #[allow(irrefutable_let_patterns)]
6353    pub fn into_create_viewport2(
6354        self,
6355    ) -> Option<(
6356        ViewportId,
6357        fidl_fuchsia_ui_views::ViewportCreationToken,
6358        ViewportProperties,
6359        fidl::endpoints::ServerEnd<ChildViewWatcherMarker>,
6360        FlatlandControlHandle,
6361    )> {
6362        if let FlatlandRequest::CreateViewport2 {
6363            viewport_id,
6364            token,
6365            properties,
6366            child_view_watcher,
6367            control_handle,
6368        } = self
6369        {
6370            Some((viewport_id, token, properties, child_view_watcher, control_handle))
6371        } else {
6372            None
6373        }
6374    }
6375
6376    #[allow(irrefutable_let_patterns)]
6377    pub fn into_release_viewport2(self) -> Option<(ViewportId, FlatlandReleaseViewport2Responder)> {
6378        if let FlatlandRequest::ReleaseViewport2 { viewport_id, responder } = self {
6379            Some((viewport_id, responder))
6380        } else {
6381            None
6382        }
6383    }
6384
6385    #[allow(irrefutable_let_patterns)]
6386    pub fn into_set_viewport_properties2(
6387        self,
6388    ) -> Option<(ViewportId, ViewportProperties, FlatlandControlHandle)> {
6389        if let FlatlandRequest::SetViewportProperties2 { viewport_id, properties, control_handle } =
6390            self
6391        {
6392            Some((viewport_id, properties, control_handle))
6393        } else {
6394            None
6395        }
6396    }
6397
6398    #[allow(irrefutable_let_patterns)]
6399    pub fn into_set_transform_content(
6400        self,
6401    ) -> Option<(TransformId, Option<Box<TransformContent>>, FlatlandControlHandle)> {
6402        if let FlatlandRequest::SetTransformContent { transform_id, content, control_handle } = self
6403        {
6404            Some((transform_id, content, control_handle))
6405        } else {
6406            None
6407        }
6408    }
6409
6410    #[allow(irrefutable_let_patterns)]
6411    pub fn into_present(self) -> Option<(PresentArgs, FlatlandControlHandle)> {
6412        if let FlatlandRequest::Present { args, control_handle } = self {
6413            Some((args, control_handle))
6414        } else {
6415            None
6416        }
6417    }
6418
6419    #[allow(irrefutable_let_patterns)]
6420    pub fn into_create_view(
6421        self,
6422    ) -> Option<(
6423        fidl_fuchsia_ui_views::ViewCreationToken,
6424        fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>,
6425        FlatlandControlHandle,
6426    )> {
6427        if let FlatlandRequest::CreateView { token, parent_viewport_watcher, control_handle } = self
6428        {
6429            Some((token, parent_viewport_watcher, control_handle))
6430        } else {
6431            None
6432        }
6433    }
6434
6435    #[allow(irrefutable_let_patterns)]
6436    pub fn into_create_view2(
6437        self,
6438    ) -> Option<(
6439        fidl_fuchsia_ui_views::ViewCreationToken,
6440        fidl_fuchsia_ui_views::ViewIdentityOnCreation,
6441        ViewBoundProtocols,
6442        fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>,
6443        FlatlandControlHandle,
6444    )> {
6445        if let FlatlandRequest::CreateView2 {
6446            token,
6447            view_identity,
6448            protocols,
6449            parent_viewport_watcher,
6450            control_handle,
6451        } = self
6452        {
6453            Some((token, view_identity, protocols, parent_viewport_watcher, control_handle))
6454        } else {
6455            None
6456        }
6457    }
6458
6459    #[allow(irrefutable_let_patterns)]
6460    pub fn into_create_transform(self) -> Option<(TransformId, FlatlandControlHandle)> {
6461        if let FlatlandRequest::CreateTransform { transform_id, control_handle } = self {
6462            Some((transform_id, control_handle))
6463        } else {
6464            None
6465        }
6466    }
6467
6468    #[allow(irrefutable_let_patterns)]
6469    pub fn into_set_translation(
6470        self,
6471    ) -> Option<(TransformId, fidl_fuchsia_math::Vec_, FlatlandControlHandle)> {
6472        if let FlatlandRequest::SetTranslation { transform_id, translation, control_handle } = self
6473        {
6474            Some((transform_id, translation, control_handle))
6475        } else {
6476            None
6477        }
6478    }
6479
6480    #[allow(irrefutable_let_patterns)]
6481    pub fn into_set_orientation(self) -> Option<(TransformId, Orientation, FlatlandControlHandle)> {
6482        if let FlatlandRequest::SetOrientation { transform_id, orientation, control_handle } = self
6483        {
6484            Some((transform_id, orientation, control_handle))
6485        } else {
6486            None
6487        }
6488    }
6489
6490    #[allow(irrefutable_let_patterns)]
6491    pub fn into_set_scale(
6492        self,
6493    ) -> Option<(TransformId, fidl_fuchsia_math::VecF, FlatlandControlHandle)> {
6494        if let FlatlandRequest::SetScale { transform_id, scale, control_handle } = self {
6495            Some((transform_id, scale, control_handle))
6496        } else {
6497            None
6498        }
6499    }
6500
6501    #[allow(irrefutable_let_patterns)]
6502    pub fn into_set_opacity(self) -> Option<(TransformId, f32, FlatlandControlHandle)> {
6503        if let FlatlandRequest::SetOpacity { transform_id, value, control_handle } = self {
6504            Some((transform_id, value, control_handle))
6505        } else {
6506            None
6507        }
6508    }
6509
6510    #[allow(irrefutable_let_patterns)]
6511    pub fn into_set_clip_boundary(
6512        self,
6513    ) -> Option<(TransformId, Option<Box<fidl_fuchsia_math::Rect>>, FlatlandControlHandle)> {
6514        if let FlatlandRequest::SetClipBoundary { transform_id, rect, control_handle } = self {
6515            Some((transform_id, rect, control_handle))
6516        } else {
6517            None
6518        }
6519    }
6520
6521    #[allow(irrefutable_let_patterns)]
6522    pub fn into_add_child(self) -> Option<(TransformId, TransformId, FlatlandControlHandle)> {
6523        if let FlatlandRequest::AddChild {
6524            parent_transform_id,
6525            child_transform_id,
6526            control_handle,
6527        } = self
6528        {
6529            Some((parent_transform_id, child_transform_id, control_handle))
6530        } else {
6531            None
6532        }
6533    }
6534
6535    #[allow(irrefutable_let_patterns)]
6536    pub fn into_remove_child(self) -> Option<(TransformId, TransformId, FlatlandControlHandle)> {
6537        if let FlatlandRequest::RemoveChild {
6538            parent_transform_id,
6539            child_transform_id,
6540            control_handle,
6541        } = self
6542        {
6543            Some((parent_transform_id, child_transform_id, control_handle))
6544        } else {
6545            None
6546        }
6547    }
6548
6549    #[allow(irrefutable_let_patterns)]
6550    pub fn into_replace_children(
6551        self,
6552    ) -> Option<(TransformId, Vec<TransformId>, FlatlandControlHandle)> {
6553        if let FlatlandRequest::ReplaceChildren {
6554            parent_transform_id,
6555            new_child_transform_ids,
6556            control_handle,
6557        } = self
6558        {
6559            Some((parent_transform_id, new_child_transform_ids, control_handle))
6560        } else {
6561            None
6562        }
6563    }
6564
6565    #[allow(irrefutable_let_patterns)]
6566    pub fn into_set_root_transform(self) -> Option<(TransformId, FlatlandControlHandle)> {
6567        if let FlatlandRequest::SetRootTransform { transform_id, control_handle } = self {
6568            Some((transform_id, control_handle))
6569        } else {
6570            None
6571        }
6572    }
6573
6574    #[allow(irrefutable_let_patterns)]
6575    pub fn into_set_hit_regions(
6576        self,
6577    ) -> Option<(TransformId, Vec<HitRegion>, FlatlandControlHandle)> {
6578        if let FlatlandRequest::SetHitRegions { transform_id, regions, control_handle } = self {
6579            Some((transform_id, regions, control_handle))
6580        } else {
6581            None
6582        }
6583    }
6584
6585    #[allow(irrefutable_let_patterns)]
6586    pub fn into_set_infinite_hit_region(
6587        self,
6588    ) -> Option<(TransformId, HitTestInteraction, FlatlandControlHandle)> {
6589        if let FlatlandRequest::SetInfiniteHitRegion { transform_id, hit_test, control_handle } =
6590            self
6591        {
6592            Some((transform_id, hit_test, control_handle))
6593        } else {
6594            None
6595        }
6596    }
6597
6598    #[allow(irrefutable_let_patterns)]
6599    pub fn into_create_viewport(
6600        self,
6601    ) -> Option<(
6602        ContentId,
6603        fidl_fuchsia_ui_views::ViewportCreationToken,
6604        ViewportProperties,
6605        fidl::endpoints::ServerEnd<ChildViewWatcherMarker>,
6606        FlatlandControlHandle,
6607    )> {
6608        if let FlatlandRequest::CreateViewport {
6609            viewport_id,
6610            token,
6611            properties,
6612            child_view_watcher,
6613            control_handle,
6614        } = self
6615        {
6616            Some((viewport_id, token, properties, child_view_watcher, control_handle))
6617        } else {
6618            None
6619        }
6620    }
6621
6622    #[allow(irrefutable_let_patterns)]
6623    pub fn into_create_image(
6624        self,
6625    ) -> Option<(ContentId, BufferCollectionImportToken, u32, ImageProperties, FlatlandControlHandle)>
6626    {
6627        if let FlatlandRequest::CreateImage {
6628            image_id,
6629            import_token,
6630            vmo_index,
6631            properties,
6632            control_handle,
6633        } = self
6634        {
6635            Some((image_id, import_token, vmo_index, properties, control_handle))
6636        } else {
6637            None
6638        }
6639    }
6640
6641    #[allow(irrefutable_let_patterns)]
6642    pub fn into_set_image_sample_region(
6643        self,
6644    ) -> Option<(ContentId, fidl_fuchsia_math::RectF, FlatlandControlHandle)> {
6645        if let FlatlandRequest::SetImageSampleRegion { image_id, rect, control_handle } = self {
6646            Some((image_id, rect, control_handle))
6647        } else {
6648            None
6649        }
6650    }
6651
6652    #[allow(irrefutable_let_patterns)]
6653    pub fn into_set_image_destination_size(
6654        self,
6655    ) -> Option<(ContentId, fidl_fuchsia_math::SizeU, FlatlandControlHandle)> {
6656        if let FlatlandRequest::SetImageDestinationSize { image_id, size, control_handle } = self {
6657            Some((image_id, size, control_handle))
6658        } else {
6659            None
6660        }
6661    }
6662
6663    #[allow(irrefutable_let_patterns)]
6664    pub fn into_set_image_blending_function(
6665        self,
6666    ) -> Option<(ContentId, BlendMode, FlatlandControlHandle)> {
6667        if let FlatlandRequest::SetImageBlendingFunction { image_id, blend_mode, control_handle } =
6668            self
6669        {
6670            Some((image_id, blend_mode, control_handle))
6671        } else {
6672            None
6673        }
6674    }
6675
6676    #[allow(irrefutable_let_patterns)]
6677    pub fn into_set_image_blend_mode(
6678        self,
6679    ) -> Option<(ContentId, BlendMode2, FlatlandControlHandle)> {
6680        if let FlatlandRequest::SetImageBlendMode { image_id, blend_mode, control_handle } = self {
6681            Some((image_id, blend_mode, control_handle))
6682        } else {
6683            None
6684        }
6685    }
6686
6687    #[allow(irrefutable_let_patterns)]
6688    pub fn into_set_image_opacity(self) -> Option<(ContentId, f32, FlatlandControlHandle)> {
6689        if let FlatlandRequest::SetImageOpacity { image_id, val, control_handle } = self {
6690            Some((image_id, val, control_handle))
6691        } else {
6692            None
6693        }
6694    }
6695
6696    #[allow(irrefutable_let_patterns)]
6697    pub fn into_set_image_flip(self) -> Option<(ContentId, ImageFlip, FlatlandControlHandle)> {
6698        if let FlatlandRequest::SetImageFlip { image_id, flip, control_handle } = self {
6699            Some((image_id, flip, control_handle))
6700        } else {
6701            None
6702        }
6703    }
6704
6705    #[allow(irrefutable_let_patterns)]
6706    pub fn into_create_filled_rect(self) -> Option<(ContentId, FlatlandControlHandle)> {
6707        if let FlatlandRequest::CreateFilledRect { rect_id, control_handle } = self {
6708            Some((rect_id, control_handle))
6709        } else {
6710            None
6711        }
6712    }
6713
6714    #[allow(irrefutable_let_patterns)]
6715    pub fn into_set_solid_fill(
6716        self,
6717    ) -> Option<(ContentId, ColorRgba, fidl_fuchsia_math::SizeU, FlatlandControlHandle)> {
6718        if let FlatlandRequest::SetSolidFill { rect_id, color, size, control_handle } = self {
6719            Some((rect_id, color, size, control_handle))
6720        } else {
6721            None
6722        }
6723    }
6724
6725    #[allow(irrefutable_let_patterns)]
6726    pub fn into_release_filled_rect(self) -> Option<(ContentId, FlatlandControlHandle)> {
6727        if let FlatlandRequest::ReleaseFilledRect { rect_id, control_handle } = self {
6728            Some((rect_id, control_handle))
6729        } else {
6730            None
6731        }
6732    }
6733
6734    #[allow(irrefutable_let_patterns)]
6735    pub fn into_set_content(self) -> Option<(TransformId, ContentId, FlatlandControlHandle)> {
6736        if let FlatlandRequest::SetContent { transform_id, content_id, control_handle } = self {
6737            Some((transform_id, content_id, control_handle))
6738        } else {
6739            None
6740        }
6741    }
6742
6743    #[allow(irrefutable_let_patterns)]
6744    pub fn into_set_viewport_properties(
6745        self,
6746    ) -> Option<(ContentId, ViewportProperties, FlatlandControlHandle)> {
6747        if let FlatlandRequest::SetViewportProperties { viewport_id, properties, control_handle } =
6748            self
6749        {
6750            Some((viewport_id, properties, control_handle))
6751        } else {
6752            None
6753        }
6754    }
6755
6756    #[allow(irrefutable_let_patterns)]
6757    pub fn into_release_transform(self) -> Option<(TransformId, FlatlandControlHandle)> {
6758        if let FlatlandRequest::ReleaseTransform { transform_id, control_handle } = self {
6759            Some((transform_id, control_handle))
6760        } else {
6761            None
6762        }
6763    }
6764
6765    #[allow(irrefutable_let_patterns)]
6766    pub fn into_release_view(self) -> Option<(FlatlandControlHandle)> {
6767        if let FlatlandRequest::ReleaseView { control_handle } = self {
6768            Some((control_handle))
6769        } else {
6770            None
6771        }
6772    }
6773
6774    #[allow(irrefutable_let_patterns)]
6775    pub fn into_release_viewport(self) -> Option<(ContentId, FlatlandReleaseViewportResponder)> {
6776        if let FlatlandRequest::ReleaseViewport { viewport_id, responder } = self {
6777            Some((viewport_id, responder))
6778        } else {
6779            None
6780        }
6781    }
6782
6783    #[allow(irrefutable_let_patterns)]
6784    pub fn into_release_image(self) -> Option<(ContentId, FlatlandControlHandle)> {
6785        if let FlatlandRequest::ReleaseImage { image_id, control_handle } = self {
6786            Some((image_id, control_handle))
6787        } else {
6788            None
6789        }
6790    }
6791
6792    #[allow(irrefutable_let_patterns)]
6793    pub fn into_clear(self) -> Option<(FlatlandControlHandle)> {
6794        if let FlatlandRequest::Clear { control_handle } = self {
6795            Some((control_handle))
6796        } else {
6797            None
6798        }
6799    }
6800
6801    #[allow(irrefutable_let_patterns)]
6802    pub fn into_set_debug_name(self) -> Option<(String, FlatlandControlHandle)> {
6803        if let FlatlandRequest::SetDebugName { name, control_handle } = self {
6804            Some((name, control_handle))
6805        } else {
6806            None
6807        }
6808    }
6809
6810    /// Name of the method defined in FIDL
6811    pub fn method_name(&self) -> &'static str {
6812        match *self {
6813            FlatlandRequest::ReleaseImageImmediately { .. } => "release_image_immediately",
6814            FlatlandRequest::ReleaseImageImmediately2 { .. } => "release_image_immediately2",
6815            FlatlandRequest::CreateLayer { .. } => "create_layer",
6816            FlatlandRequest::ReleaseLayer { .. } => "release_layer",
6817            FlatlandRequest::SetLayerImage { .. } => "set_layer_image",
6818            FlatlandRequest::SetLayerProperties { .. } => "set_layer_properties",
6819            FlatlandRequest::ResetLayer { .. } => "reset_layer",
6820            FlatlandRequest::CreateLayerStack { .. } => "create_layer_stack",
6821            FlatlandRequest::ReleaseLayerStack { .. } => "release_layer_stack",
6822            FlatlandRequest::SetStackLayers { .. } => "set_stack_layers",
6823            FlatlandRequest::CreateImage2 { .. } => "create_image2",
6824            FlatlandRequest::ReleaseImage2 { .. } => "release_image2",
6825            FlatlandRequest::CreateViewport2 { .. } => "create_viewport2",
6826            FlatlandRequest::ReleaseViewport2 { .. } => "release_viewport2",
6827            FlatlandRequest::SetViewportProperties2 { .. } => "set_viewport_properties2",
6828            FlatlandRequest::SetTransformContent { .. } => "set_transform_content",
6829            FlatlandRequest::Present { .. } => "present",
6830            FlatlandRequest::CreateView { .. } => "create_view",
6831            FlatlandRequest::CreateView2 { .. } => "create_view2",
6832            FlatlandRequest::CreateTransform { .. } => "create_transform",
6833            FlatlandRequest::SetTranslation { .. } => "set_translation",
6834            FlatlandRequest::SetOrientation { .. } => "set_orientation",
6835            FlatlandRequest::SetScale { .. } => "set_scale",
6836            FlatlandRequest::SetOpacity { .. } => "set_opacity",
6837            FlatlandRequest::SetClipBoundary { .. } => "set_clip_boundary",
6838            FlatlandRequest::AddChild { .. } => "add_child",
6839            FlatlandRequest::RemoveChild { .. } => "remove_child",
6840            FlatlandRequest::ReplaceChildren { .. } => "replace_children",
6841            FlatlandRequest::SetRootTransform { .. } => "set_root_transform",
6842            FlatlandRequest::SetHitRegions { .. } => "set_hit_regions",
6843            FlatlandRequest::SetInfiniteHitRegion { .. } => "set_infinite_hit_region",
6844            FlatlandRequest::CreateViewport { .. } => "create_viewport",
6845            FlatlandRequest::CreateImage { .. } => "create_image",
6846            FlatlandRequest::SetImageSampleRegion { .. } => "set_image_sample_region",
6847            FlatlandRequest::SetImageDestinationSize { .. } => "set_image_destination_size",
6848            FlatlandRequest::SetImageBlendingFunction { .. } => "set_image_blending_function",
6849            FlatlandRequest::SetImageBlendMode { .. } => "set_image_blend_mode",
6850            FlatlandRequest::SetImageOpacity { .. } => "set_image_opacity",
6851            FlatlandRequest::SetImageFlip { .. } => "set_image_flip",
6852            FlatlandRequest::CreateFilledRect { .. } => "create_filled_rect",
6853            FlatlandRequest::SetSolidFill { .. } => "set_solid_fill",
6854            FlatlandRequest::ReleaseFilledRect { .. } => "release_filled_rect",
6855            FlatlandRequest::SetContent { .. } => "set_content",
6856            FlatlandRequest::SetViewportProperties { .. } => "set_viewport_properties",
6857            FlatlandRequest::ReleaseTransform { .. } => "release_transform",
6858            FlatlandRequest::ReleaseView { .. } => "release_view",
6859            FlatlandRequest::ReleaseViewport { .. } => "release_viewport",
6860            FlatlandRequest::ReleaseImage { .. } => "release_image",
6861            FlatlandRequest::Clear { .. } => "clear",
6862            FlatlandRequest::SetDebugName { .. } => "set_debug_name",
6863        }
6864    }
6865}
6866
6867#[derive(Debug, Clone)]
6868pub struct FlatlandControlHandle {
6869    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6870}
6871
6872impl FlatlandControlHandle {
6873    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
6874        self.inner.shutdown_with_epitaph(status.into())
6875    }
6876}
6877
6878impl fidl::endpoints::ControlHandle for FlatlandControlHandle {
6879    fn shutdown(&self) {
6880        self.inner.shutdown()
6881    }
6882
6883    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
6884        self.inner.shutdown_with_epitaph(status)
6885    }
6886
6887    fn is_closed(&self) -> bool {
6888        self.inner.channel().is_closed()
6889    }
6890    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
6891        self.inner.channel().on_closed()
6892    }
6893
6894    #[cfg(target_os = "fuchsia")]
6895    fn signal_peer(
6896        &self,
6897        clear_mask: zx::Signals,
6898        set_mask: zx::Signals,
6899    ) -> Result<(), zx_status::Status> {
6900        use fidl::Peered;
6901        self.inner.channel().signal_peer(clear_mask, set_mask)
6902    }
6903}
6904
6905impl FlatlandControlHandle {
6906    pub fn send_on_next_frame_begin(
6907        &self,
6908        mut values: &OnNextFrameBeginValues,
6909    ) -> Result<(), fidl::Error> {
6910        self.inner.send::<FlatlandOnNextFrameBeginRequest>(
6911            (values,),
6912            0,
6913            0x10f69a5cdeece84a,
6914            fidl::encoding::DynamicFlags::empty(),
6915        )
6916    }
6917
6918    pub fn send_on_frame_presented(
6919        &self,
6920        mut frame_presented_info: &fidl_fuchsia_scenic_scheduling::FramePresentedInfo,
6921    ) -> Result<(), fidl::Error> {
6922        self.inner.send::<FlatlandOnFramePresentedRequest>(
6923            (frame_presented_info,),
6924            0,
6925            0x56e43e1a5f30216d,
6926            fidl::encoding::DynamicFlags::empty(),
6927        )
6928    }
6929
6930    pub fn send_on_error(&self, mut error: FlatlandError) -> Result<(), fidl::Error> {
6931        self.inner.send::<FlatlandOnErrorRequest>(
6932            (error,),
6933            0,
6934            0x1ebf39e90cd8b8d,
6935            fidl::encoding::DynamicFlags::empty(),
6936        )
6937    }
6938}
6939
6940#[must_use = "FIDL methods require a response to be sent"]
6941#[derive(Debug)]
6942pub struct FlatlandReleaseViewport2Responder {
6943    control_handle: std::mem::ManuallyDrop<FlatlandControlHandle>,
6944    tx_id: u32,
6945}
6946
6947/// Set the the channel to be shutdown (see [`FlatlandControlHandle::shutdown`])
6948/// if the responder is dropped without sending a response, so that the client
6949/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6950impl std::ops::Drop for FlatlandReleaseViewport2Responder {
6951    fn drop(&mut self) {
6952        self.control_handle.shutdown();
6953        // Safety: drops once, never accessed again
6954        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6955    }
6956}
6957
6958impl fidl::endpoints::Responder for FlatlandReleaseViewport2Responder {
6959    type ControlHandle = FlatlandControlHandle;
6960
6961    fn control_handle(&self) -> &FlatlandControlHandle {
6962        &self.control_handle
6963    }
6964
6965    fn drop_without_shutdown(mut self) {
6966        // Safety: drops once, never accessed again due to mem::forget
6967        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6968        // Prevent Drop from running (which would shut down the channel)
6969        std::mem::forget(self);
6970    }
6971}
6972
6973impl FlatlandReleaseViewport2Responder {
6974    /// Sends a response to the FIDL transaction.
6975    ///
6976    /// Sets the channel to shutdown if an error occurs.
6977    pub fn send(
6978        self,
6979        mut token: fidl_fuchsia_ui_views::ViewportCreationToken,
6980    ) -> Result<(), fidl::Error> {
6981        let _result = self.send_raw(token);
6982        if _result.is_err() {
6983            self.control_handle.shutdown();
6984        }
6985        self.drop_without_shutdown();
6986        _result
6987    }
6988
6989    /// Similar to "send" but does not shutdown the channel if an error occurs.
6990    pub fn send_no_shutdown_on_err(
6991        self,
6992        mut token: fidl_fuchsia_ui_views::ViewportCreationToken,
6993    ) -> Result<(), fidl::Error> {
6994        let _result = self.send_raw(token);
6995        self.drop_without_shutdown();
6996        _result
6997    }
6998
6999    fn send_raw(
7000        &self,
7001        mut token: fidl_fuchsia_ui_views::ViewportCreationToken,
7002    ) -> Result<(), fidl::Error> {
7003        self.control_handle.inner.send::<Flatland2ReleaseViewport2Response>(
7004            (&mut token,),
7005            self.tx_id,
7006            0x18ef77414c7a9ae3,
7007            fidl::encoding::DynamicFlags::empty(),
7008        )
7009    }
7010}
7011
7012#[must_use = "FIDL methods require a response to be sent"]
7013#[derive(Debug)]
7014pub struct FlatlandReleaseViewportResponder {
7015    control_handle: std::mem::ManuallyDrop<FlatlandControlHandle>,
7016    tx_id: u32,
7017}
7018
7019/// Set the the channel to be shutdown (see [`FlatlandControlHandle::shutdown`])
7020/// if the responder is dropped without sending a response, so that the client
7021/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7022impl std::ops::Drop for FlatlandReleaseViewportResponder {
7023    fn drop(&mut self) {
7024        self.control_handle.shutdown();
7025        // Safety: drops once, never accessed again
7026        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7027    }
7028}
7029
7030impl fidl::endpoints::Responder for FlatlandReleaseViewportResponder {
7031    type ControlHandle = FlatlandControlHandle;
7032
7033    fn control_handle(&self) -> &FlatlandControlHandle {
7034        &self.control_handle
7035    }
7036
7037    fn drop_without_shutdown(mut self) {
7038        // Safety: drops once, never accessed again due to mem::forget
7039        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7040        // Prevent Drop from running (which would shut down the channel)
7041        std::mem::forget(self);
7042    }
7043}
7044
7045impl FlatlandReleaseViewportResponder {
7046    /// Sends a response to the FIDL transaction.
7047    ///
7048    /// Sets the channel to shutdown if an error occurs.
7049    pub fn send(
7050        self,
7051        mut token: fidl_fuchsia_ui_views::ViewportCreationToken,
7052    ) -> Result<(), fidl::Error> {
7053        let _result = self.send_raw(token);
7054        if _result.is_err() {
7055            self.control_handle.shutdown();
7056        }
7057        self.drop_without_shutdown();
7058        _result
7059    }
7060
7061    /// Similar to "send" but does not shutdown the channel if an error occurs.
7062    pub fn send_no_shutdown_on_err(
7063        self,
7064        mut token: fidl_fuchsia_ui_views::ViewportCreationToken,
7065    ) -> Result<(), fidl::Error> {
7066        let _result = self.send_raw(token);
7067        self.drop_without_shutdown();
7068        _result
7069    }
7070
7071    fn send_raw(
7072        &self,
7073        mut token: fidl_fuchsia_ui_views::ViewportCreationToken,
7074    ) -> Result<(), fidl::Error> {
7075        self.control_handle.inner.send::<FlatlandReleaseViewportResponse>(
7076            (&mut token,),
7077            self.tx_id,
7078            0xbad474aeb5293f9,
7079            fidl::encoding::DynamicFlags::empty(),
7080        )
7081    }
7082}
7083
7084#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
7085pub struct Flatland2Marker;
7086
7087impl fidl::endpoints::ProtocolMarker for Flatland2Marker {
7088    type Proxy = Flatland2Proxy;
7089    type RequestStream = Flatland2RequestStream;
7090    #[cfg(target_os = "fuchsia")]
7091    type SynchronousProxy = Flatland2SynchronousProxy;
7092
7093    const DEBUG_NAME: &'static str = "(anonymous) Flatland2";
7094}
7095
7096pub trait Flatland2ProxyInterface: Send + Sync {
7097    fn r#create_layer(&self, layer_id: &LayerId) -> Result<(), fidl::Error>;
7098    fn r#release_layer(&self, layer_id: &LayerId) -> Result<(), fidl::Error>;
7099    fn r#set_layer_image(
7100        &self,
7101        layer_id: &LayerId,
7102        image_id: &ImageId,
7103        acquire_fence: Option<WaitFence>,
7104        release_fence: Option<SignalFence>,
7105    ) -> Result<(), fidl::Error>;
7106    fn r#set_layer_properties(
7107        &self,
7108        layer_id: &LayerId,
7109        properties: &LayerProperties,
7110    ) -> Result<(), fidl::Error>;
7111    fn r#reset_layer(&self, layer_id: &LayerId) -> Result<(), fidl::Error>;
7112    fn r#create_layer_stack(&self, stack_id: &LayerStackId) -> Result<(), fidl::Error>;
7113    fn r#release_layer_stack(&self, stack_id: &LayerStackId) -> Result<(), fidl::Error>;
7114    fn r#set_stack_layers(
7115        &self,
7116        stack_id: &LayerStackId,
7117        layers: &[LayerId],
7118    ) -> Result<(), fidl::Error>;
7119    fn r#create_image2(
7120        &self,
7121        image_id: &ImageId,
7122        import_token: BufferCollectionImportToken,
7123        vmo_index: u32,
7124        properties: &ImageProperties,
7125    ) -> Result<(), fidl::Error>;
7126    fn r#release_image2(&self, image_id: &ImageId) -> Result<(), fidl::Error>;
7127    fn r#create_viewport2(
7128        &self,
7129        viewport_id: &ViewportId,
7130        token: fidl_fuchsia_ui_views::ViewportCreationToken,
7131        properties: &ViewportProperties,
7132        child_view_watcher: fidl::endpoints::ServerEnd<ChildViewWatcherMarker>,
7133    ) -> Result<(), fidl::Error>;
7134    type ReleaseViewport2ResponseFut: std::future::Future<
7135            Output = Result<fidl_fuchsia_ui_views::ViewportCreationToken, fidl::Error>,
7136        > + Send;
7137    fn r#release_viewport2(&self, viewport_id: &ViewportId) -> Self::ReleaseViewport2ResponseFut;
7138    fn r#set_viewport_properties2(
7139        &self,
7140        viewport_id: &ViewportId,
7141        properties: &ViewportProperties,
7142    ) -> Result<(), fidl::Error>;
7143    fn r#set_transform_content(
7144        &self,
7145        transform_id: &TransformId,
7146        content: Option<&TransformContent>,
7147    ) -> Result<(), fidl::Error>;
7148}
7149#[derive(Debug)]
7150#[cfg(target_os = "fuchsia")]
7151pub struct Flatland2SynchronousProxy {
7152    client: fidl::client::sync::Client,
7153}
7154
7155#[cfg(target_os = "fuchsia")]
7156impl fidl::endpoints::SynchronousProxy for Flatland2SynchronousProxy {
7157    type Proxy = Flatland2Proxy;
7158    type Protocol = Flatland2Marker;
7159
7160    fn from_channel(inner: fidl::Channel) -> Self {
7161        Self::new(inner)
7162    }
7163
7164    fn into_channel(self) -> fidl::Channel {
7165        self.client.into_channel()
7166    }
7167
7168    fn as_channel(&self) -> &fidl::Channel {
7169        self.client.as_channel()
7170    }
7171}
7172
7173#[cfg(target_os = "fuchsia")]
7174impl Flatland2SynchronousProxy {
7175    pub fn new(channel: fidl::Channel) -> Self {
7176        Self { client: fidl::client::sync::Client::new(channel) }
7177    }
7178
7179    pub fn into_channel(self) -> fidl::Channel {
7180        self.client.into_channel()
7181    }
7182
7183    /// Waits until an event arrives and returns it. It is safe for other
7184    /// threads to make concurrent requests while waiting for an event.
7185    pub fn wait_for_event(
7186        &self,
7187        deadline: zx::MonotonicInstant,
7188    ) -> Result<Flatland2Event, fidl::Error> {
7189        Flatland2Event::decode(self.client.wait_for_event::<Flatland2Marker>(deadline)?)
7190    }
7191
7192    /// A Layer is a type of `Content` that composites either a single `Image` or a solid
7193    /// color. It separates visual properties (such as size, flip, opacity, and blending)
7194    /// from the raw pixel data.
7195    ///
7196    /// Unlike typical `Content` items which represent a static visual resource, a Layer is designed
7197    /// to be a dynamic container for an image sequence. Typical usage involves setting the layer's
7198    /// visual properties and image metadata infrequently, and then rapidly swapping the active
7199    /// `Image` (e.g. on every frame) with another image of matching metadata.
7200    ///
7201    /// This separation allows a single `Image` resource to be reused across multiple layers with
7202    /// different visual configurations simultaneously.
7203    ///
7204    /// To use a Layer:
7205    /// 1. Create a `Layer` using [`CreateLayer`].
7206    /// 2. Set properties on the `Layer` via [`SetLayerProperties`], including the
7207    ///    composition mode.
7208    /// 3. For an image layer, associate an `Image` with the `Layer` via [`SetLayerImage`].
7209    /// 4. Add the `Layer` to a `LayerStack` via [`SetStackLayers`].
7210    /// 5. Set the `LayerStack` as the content of a node via [`SetTransformContent`].
7211    ///
7212    /// `layer_id` must satisfy the identifier rules documented on [`LayerId`].
7213    pub fn r#create_layer(&self, mut layer_id: &LayerId) -> Result<(), fidl::Error> {
7214        self.client.send::<Flatland2CreateLayerRequest>(
7215            (layer_id,),
7216            0x60837bb0ce59f8a9,
7217            fidl::encoding::DynamicFlags::empty(),
7218        )
7219    }
7220
7221    /// Released Layers will be garbage collected by the system once they are no longer necessary
7222    /// for rendering. For Layers, this means:
7223    /// - the Layer is no longer referenced by any LayerStack, and
7224    /// - any pending rendering that references the Layer is complete.
7225    ///
7226    /// `layer_id` must refer to a valid, unreleased Layer.
7227    pub fn r#release_layer(&self, mut layer_id: &LayerId) -> Result<(), fidl::Error> {
7228        self.client.send::<Flatland2ReleaseLayerRequest>(
7229            (layer_id,),
7230            0x60118a842b6f0756,
7231            fidl::encoding::DynamicFlags::empty(),
7232        )
7233    }
7234
7235    /// Associates an Image with the Layer.
7236    ///
7237    /// The binding is legal in any composition mode, and is sticky: it survives composition
7238    /// mode changes, and is replaced only by a later [`SetLayerImage`] call (or cleared by
7239    /// [`ResetLayer`]). The image is displayed only while the layer's composition mode is
7240    /// `IMAGE`.
7241    ///
7242    /// The bound image must be large enough for the layer's stored `sample_rect`; this is
7243    /// checked at [`fuchsia.ui.composition/Flatland.Present`], not here. See
7244    /// [`LayerProperties.sample_rect`].
7245    ///
7246    /// `layer_id` must refer to a valid, unreleased Layer.
7247    /// `image_id` must refer to a valid, unreleased Image.
7248    /// `acquire_fence` is an optional fence that must be signaled before the image is displayed.
7249    /// `release_fence` is an optional fence, signaled by Scenic when *this binding* no
7250    /// longer references the image. It is per-binding, not per-image: an image bound to
7251    /// several layers has one such fence per binding, and the image is safe to write only
7252    /// once every one of them has signaled.
7253    ///
7254    /// A binding is ended by:
7255    ///
7256    /// - being superseded by a later [`SetLayerImage`] on the same layer
7257    /// - [`ResetLayer`]
7258    /// - the layer ref-count reaching zero, either via [`ReleaseLayer`] or by being released
7259    ///   by a layer stack
7260    /// - destruction of the session, which ends every binding it holds
7261    ///
7262    /// For a binding ended while the session is alive, Scenic signals at the first frame
7263    /// retire after that point. Bindings that never reached the screen (e.g. one superseded
7264    /// within a single batch, or one lost when several
7265    /// [`fuchsia.ui.composition/Flatland.Present`] calls are squashed into a single
7266    /// frame) signal at that same retire rather than immediately. The signal is
7267    /// therefore conservative by at most one frame; it is never early.
7268    pub fn r#set_layer_image(
7269        &self,
7270        mut layer_id: &LayerId,
7271        mut image_id: &ImageId,
7272        mut acquire_fence: Option<WaitFence>,
7273        mut release_fence: Option<SignalFence>,
7274    ) -> Result<(), fidl::Error> {
7275        self.client.send::<Flatland2SetLayerImageRequest>(
7276            (layer_id, image_id, acquire_fence.as_mut(), release_fence.as_mut()),
7277            0x262302d9782d252c,
7278            fidl::encoding::DynamicFlags::empty(),
7279        )
7280    }
7281
7282    /// Sets properties of the Layer.
7283    ///
7284    /// The provided `properties` table is merged into the layer's stored properties: fields
7285    /// which are unset in `properties` retain their previously stored values. Stored
7286    /// properties are sticky; see [`LayerProperties`] for the full persistence semantics.
7287    ///
7288    /// Values are stored as given; validation which depends on other state (notably
7289    /// `sample_rect` against the bound image) happens at
7290    /// [`fuchsia.ui.composition/Flatland.Present`]. See [`LayerProperties.sample_rect`].
7291    ///
7292    /// `layer_id` must refer to a valid, unreleased Layer.
7293    pub fn r#set_layer_properties(
7294        &self,
7295        mut layer_id: &LayerId,
7296        mut properties: &LayerProperties,
7297    ) -> Result<(), fidl::Error> {
7298        self.client.send::<Flatland2SetLayerPropertiesRequest>(
7299            (layer_id, properties),
7300            0x282d0e902aae8bb0,
7301            fidl::encoding::DynamicFlags::empty(),
7302        )
7303    }
7304
7305    /// Unbinds any Image bound to the layer and clears every stored [`LayerProperties`]
7306    /// field, returning the layer to its freshly-created state (composition mode
7307    /// `INVISIBLE`, all properties at their documented defaults). This is the only
7308    /// operation which forgets stored layer properties.
7309    ///
7310    /// `layer_id` must refer to a valid, unreleased Layer.
7311    pub fn r#reset_layer(&self, mut layer_id: &LayerId) -> Result<(), fidl::Error> {
7312        self.client.send::<Flatland2ResetLayerRequest>(
7313            (layer_id,),
7314            0x17bf541bf216ab2b,
7315            fidl::encoding::DynamicFlags::empty(),
7316        )
7317    }
7318
7319    /// Creates a new layer stack with the specified `stack_id`.
7320    ///
7321    /// `stack_id` must satisfy the identifier rules documented on [`LayerId`].
7322    pub fn r#create_layer_stack(&self, mut stack_id: &LayerStackId) -> Result<(), fidl::Error> {
7323        self.client.send::<Flatland2CreateLayerStackRequest>(
7324            (stack_id,),
7325            0x70debe3cd7371aa6,
7326            fidl::encoding::DynamicFlags::empty(),
7327        )
7328    }
7329
7330    /// Releases the layer stack with the specified `stack_id`.
7331    pub fn r#release_layer_stack(&self, mut stack_id: &LayerStackId) -> Result<(), fidl::Error> {
7332        self.client.send::<Flatland2ReleaseLayerStackRequest>(
7333            (stack_id,),
7334            0x3ad3151aece3b1bb,
7335            fidl::encoding::DynamicFlags::empty(),
7336        )
7337    }
7338
7339    /// Sets the layers in the stack. The order of layers in the vector determines their Z-order,
7340    /// with the first element being the back-most and the last element being the front-most.
7341    ///
7342    /// `stack_id` must refer to a valid, unreleased LayerStack. Each element of `layers`
7343    /// must refer to a valid, unreleased Layer. Duplicate layers within `layers` are
7344    /// disallowed.
7345    pub fn r#set_stack_layers(
7346        &self,
7347        mut stack_id: &LayerStackId,
7348        mut layers: &[LayerId],
7349    ) -> Result<(), fidl::Error> {
7350        self.client.send::<Flatland2SetStackLayersRequest>(
7351            (stack_id, layers),
7352            0x1e0bff0f5cca065a,
7353            fidl::encoding::DynamicFlags::empty(),
7354        )
7355    }
7356
7357    /// Creates an Image resource.
7358    ///
7359    /// `image_id` must satisfy the identifier rules documented on [`LayerId`].
7360    pub fn r#create_image2(
7361        &self,
7362        mut image_id: &ImageId,
7363        mut import_token: BufferCollectionImportToken,
7364        mut vmo_index: u32,
7365        mut properties: &ImageProperties,
7366    ) -> Result<(), fidl::Error> {
7367        self.client.send::<Flatland2CreateImage2Request>(
7368            (image_id, &mut import_token, vmo_index, properties),
7369            0x677fa7b23aaca46,
7370            fidl::encoding::DynamicFlags::empty(),
7371        )
7372    }
7373
7374    /// Released Images will be garbage collected by the system once they are no longer necessary
7375    /// for rendering. For Images, this means:
7376    /// - the Image is no longer bound to any Layer, and
7377    /// - any pending rendering that references the Image is complete.
7378    ///
7379    /// The `image_id` value is freed for reuse immediately by the client (identifier uniqueness
7380    /// is instantaneous).
7381    ///
7382    /// Note: Per-binding release fences (passed to `SetLayerImage`) are unaffected by this call.
7383    /// They track the lifecycle of individual layer bindings, not the client's `image_id`.
7384    ///
7385    /// `image_id` must refer to a valid, unreleased Image.
7386    pub fn r#release_image2(&self, mut image_id: &ImageId) -> Result<(), fidl::Error> {
7387        self.client.send::<Flatland2ReleaseImage2Request>(
7388            (image_id,),
7389            0x7d0a041ed51aca06,
7390            fidl::encoding::DynamicFlags::empty(),
7391        )
7392    }
7393
7394    /// Creates a Viewport resource.
7395    ///
7396    /// `viewport_id` must satisfy the identifier rules documented on [`LayerId`].
7397    pub fn r#create_viewport2(
7398        &self,
7399        mut viewport_id: &ViewportId,
7400        mut token: fidl_fuchsia_ui_views::ViewportCreationToken,
7401        mut properties: &ViewportProperties,
7402        mut child_view_watcher: fidl::endpoints::ServerEnd<ChildViewWatcherMarker>,
7403    ) -> Result<(), fidl::Error> {
7404        self.client.send::<Flatland2CreateViewport2Request>(
7405            (viewport_id, &mut token, properties, child_view_watcher),
7406            0x1b646776764f1128,
7407            fidl::encoding::DynamicFlags::empty(),
7408        )
7409    }
7410
7411    /// Releases a Viewport from the scene.
7412    pub fn r#release_viewport2(
7413        &self,
7414        mut viewport_id: &ViewportId,
7415        ___deadline: zx::MonotonicInstant,
7416    ) -> Result<fidl_fuchsia_ui_views::ViewportCreationToken, fidl::Error> {
7417        let _response = self.client.send_query::<
7418            Flatland2ReleaseViewport2Request,
7419            Flatland2ReleaseViewport2Response,
7420            Flatland2Marker,
7421        >(
7422            (viewport_id,),
7423            0x18ef77414c7a9ae3,
7424            fidl::encoding::DynamicFlags::empty(),
7425            ___deadline,
7426        )?;
7427        Ok(_response.token)
7428    }
7429
7430    /// Sets the properties of a Viewport.
7431    pub fn r#set_viewport_properties2(
7432        &self,
7433        mut viewport_id: &ViewportId,
7434        mut properties: &ViewportProperties,
7435    ) -> Result<(), fidl::Error> {
7436        self.client.send::<Flatland2SetViewportProperties2Request>(
7437            (viewport_id, properties),
7438            0x95f2ec3b9e4beea,
7439            fidl::encoding::DynamicFlags::empty(),
7440        )
7441    }
7442
7443    /// Sets (or clears) the content of a Transform.
7444    ///
7445    /// The same content may be attached to more than one Transform; each attachment composites
7446    /// that content again under its own Transform's matrix, clip, and opacity, so a single
7447    /// LayerStack or Viewport can appear repeatedly in a scene without the client duplicating the
7448    /// underlying resources.
7449    ///
7450    /// A Transform's content can be cleared by not providing the optional `content`.
7451    ///
7452    /// If `content` is set, it must refer to a valid, unreleased LayerStack or Viewport.
7453    /// Unlike classic [`Flatland.SetContent`], a zero id does not clear the content.
7454    pub fn r#set_transform_content(
7455        &self,
7456        mut transform_id: &TransformId,
7457        mut content: Option<&TransformContent>,
7458    ) -> Result<(), fidl::Error> {
7459        self.client.send::<Flatland2SetTransformContentRequest>(
7460            (transform_id, content),
7461            0x17e33f64f55e4ea9,
7462            fidl::encoding::DynamicFlags::empty(),
7463        )
7464    }
7465}
7466
7467#[cfg(target_os = "fuchsia")]
7468impl From<Flatland2SynchronousProxy> for zx::NullableHandle {
7469    fn from(value: Flatland2SynchronousProxy) -> Self {
7470        value.into_channel().into()
7471    }
7472}
7473
7474#[cfg(target_os = "fuchsia")]
7475impl From<fidl::Channel> for Flatland2SynchronousProxy {
7476    fn from(value: fidl::Channel) -> Self {
7477        Self::new(value)
7478    }
7479}
7480
7481#[cfg(target_os = "fuchsia")]
7482impl fidl::endpoints::FromClient for Flatland2SynchronousProxy {
7483    type Protocol = Flatland2Marker;
7484
7485    fn from_client(value: fidl::endpoints::ClientEnd<Flatland2Marker>) -> Self {
7486        Self::new(value.into_channel())
7487    }
7488}
7489
7490#[derive(Debug, Clone)]
7491pub struct Flatland2Proxy {
7492    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
7493}
7494
7495impl fidl::endpoints::Proxy for Flatland2Proxy {
7496    type Protocol = Flatland2Marker;
7497
7498    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
7499        Self::new(inner)
7500    }
7501
7502    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
7503        self.client.into_channel().map_err(|client| Self { client })
7504    }
7505
7506    fn as_channel(&self) -> &::fidl::AsyncChannel {
7507        self.client.as_channel()
7508    }
7509}
7510
7511impl Flatland2Proxy {
7512    /// Create a new Proxy for fuchsia.ui.composition/Flatland2.
7513    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
7514        let protocol_name = <Flatland2Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
7515        Self { client: fidl::client::Client::new(channel, protocol_name) }
7516    }
7517
7518    /// Get a Stream of events from the remote end of the protocol.
7519    ///
7520    /// # Panics
7521    ///
7522    /// Panics if the event stream was already taken.
7523    pub fn take_event_stream(&self) -> Flatland2EventStream {
7524        Flatland2EventStream { event_receiver: self.client.take_event_receiver() }
7525    }
7526
7527    /// A Layer is a type of `Content` that composites either a single `Image` or a solid
7528    /// color. It separates visual properties (such as size, flip, opacity, and blending)
7529    /// from the raw pixel data.
7530    ///
7531    /// Unlike typical `Content` items which represent a static visual resource, a Layer is designed
7532    /// to be a dynamic container for an image sequence. Typical usage involves setting the layer's
7533    /// visual properties and image metadata infrequently, and then rapidly swapping the active
7534    /// `Image` (e.g. on every frame) with another image of matching metadata.
7535    ///
7536    /// This separation allows a single `Image` resource to be reused across multiple layers with
7537    /// different visual configurations simultaneously.
7538    ///
7539    /// To use a Layer:
7540    /// 1. Create a `Layer` using [`CreateLayer`].
7541    /// 2. Set properties on the `Layer` via [`SetLayerProperties`], including the
7542    ///    composition mode.
7543    /// 3. For an image layer, associate an `Image` with the `Layer` via [`SetLayerImage`].
7544    /// 4. Add the `Layer` to a `LayerStack` via [`SetStackLayers`].
7545    /// 5. Set the `LayerStack` as the content of a node via [`SetTransformContent`].
7546    ///
7547    /// `layer_id` must satisfy the identifier rules documented on [`LayerId`].
7548    pub fn r#create_layer(&self, mut layer_id: &LayerId) -> Result<(), fidl::Error> {
7549        Flatland2ProxyInterface::r#create_layer(self, layer_id)
7550    }
7551
7552    /// Released Layers will be garbage collected by the system once they are no longer necessary
7553    /// for rendering. For Layers, this means:
7554    /// - the Layer is no longer referenced by any LayerStack, and
7555    /// - any pending rendering that references the Layer is complete.
7556    ///
7557    /// `layer_id` must refer to a valid, unreleased Layer.
7558    pub fn r#release_layer(&self, mut layer_id: &LayerId) -> Result<(), fidl::Error> {
7559        Flatland2ProxyInterface::r#release_layer(self, layer_id)
7560    }
7561
7562    /// Associates an Image with the Layer.
7563    ///
7564    /// The binding is legal in any composition mode, and is sticky: it survives composition
7565    /// mode changes, and is replaced only by a later [`SetLayerImage`] call (or cleared by
7566    /// [`ResetLayer`]). The image is displayed only while the layer's composition mode is
7567    /// `IMAGE`.
7568    ///
7569    /// The bound image must be large enough for the layer's stored `sample_rect`; this is
7570    /// checked at [`fuchsia.ui.composition/Flatland.Present`], not here. See
7571    /// [`LayerProperties.sample_rect`].
7572    ///
7573    /// `layer_id` must refer to a valid, unreleased Layer.
7574    /// `image_id` must refer to a valid, unreleased Image.
7575    /// `acquire_fence` is an optional fence that must be signaled before the image is displayed.
7576    /// `release_fence` is an optional fence, signaled by Scenic when *this binding* no
7577    /// longer references the image. It is per-binding, not per-image: an image bound to
7578    /// several layers has one such fence per binding, and the image is safe to write only
7579    /// once every one of them has signaled.
7580    ///
7581    /// A binding is ended by:
7582    ///
7583    /// - being superseded by a later [`SetLayerImage`] on the same layer
7584    /// - [`ResetLayer`]
7585    /// - the layer ref-count reaching zero, either via [`ReleaseLayer`] or by being released
7586    ///   by a layer stack
7587    /// - destruction of the session, which ends every binding it holds
7588    ///
7589    /// For a binding ended while the session is alive, Scenic signals at the first frame
7590    /// retire after that point. Bindings that never reached the screen (e.g. one superseded
7591    /// within a single batch, or one lost when several
7592    /// [`fuchsia.ui.composition/Flatland.Present`] calls are squashed into a single
7593    /// frame) signal at that same retire rather than immediately. The signal is
7594    /// therefore conservative by at most one frame; it is never early.
7595    pub fn r#set_layer_image(
7596        &self,
7597        mut layer_id: &LayerId,
7598        mut image_id: &ImageId,
7599        mut acquire_fence: Option<WaitFence>,
7600        mut release_fence: Option<SignalFence>,
7601    ) -> Result<(), fidl::Error> {
7602        Flatland2ProxyInterface::r#set_layer_image(
7603            self,
7604            layer_id,
7605            image_id,
7606            acquire_fence,
7607            release_fence,
7608        )
7609    }
7610
7611    /// Sets properties of the Layer.
7612    ///
7613    /// The provided `properties` table is merged into the layer's stored properties: fields
7614    /// which are unset in `properties` retain their previously stored values. Stored
7615    /// properties are sticky; see [`LayerProperties`] for the full persistence semantics.
7616    ///
7617    /// Values are stored as given; validation which depends on other state (notably
7618    /// `sample_rect` against the bound image) happens at
7619    /// [`fuchsia.ui.composition/Flatland.Present`]. See [`LayerProperties.sample_rect`].
7620    ///
7621    /// `layer_id` must refer to a valid, unreleased Layer.
7622    pub fn r#set_layer_properties(
7623        &self,
7624        mut layer_id: &LayerId,
7625        mut properties: &LayerProperties,
7626    ) -> Result<(), fidl::Error> {
7627        Flatland2ProxyInterface::r#set_layer_properties(self, layer_id, properties)
7628    }
7629
7630    /// Unbinds any Image bound to the layer and clears every stored [`LayerProperties`]
7631    /// field, returning the layer to its freshly-created state (composition mode
7632    /// `INVISIBLE`, all properties at their documented defaults). This is the only
7633    /// operation which forgets stored layer properties.
7634    ///
7635    /// `layer_id` must refer to a valid, unreleased Layer.
7636    pub fn r#reset_layer(&self, mut layer_id: &LayerId) -> Result<(), fidl::Error> {
7637        Flatland2ProxyInterface::r#reset_layer(self, layer_id)
7638    }
7639
7640    /// Creates a new layer stack with the specified `stack_id`.
7641    ///
7642    /// `stack_id` must satisfy the identifier rules documented on [`LayerId`].
7643    pub fn r#create_layer_stack(&self, mut stack_id: &LayerStackId) -> Result<(), fidl::Error> {
7644        Flatland2ProxyInterface::r#create_layer_stack(self, stack_id)
7645    }
7646
7647    /// Releases the layer stack with the specified `stack_id`.
7648    pub fn r#release_layer_stack(&self, mut stack_id: &LayerStackId) -> Result<(), fidl::Error> {
7649        Flatland2ProxyInterface::r#release_layer_stack(self, stack_id)
7650    }
7651
7652    /// Sets the layers in the stack. The order of layers in the vector determines their Z-order,
7653    /// with the first element being the back-most and the last element being the front-most.
7654    ///
7655    /// `stack_id` must refer to a valid, unreleased LayerStack. Each element of `layers`
7656    /// must refer to a valid, unreleased Layer. Duplicate layers within `layers` are
7657    /// disallowed.
7658    pub fn r#set_stack_layers(
7659        &self,
7660        mut stack_id: &LayerStackId,
7661        mut layers: &[LayerId],
7662    ) -> Result<(), fidl::Error> {
7663        Flatland2ProxyInterface::r#set_stack_layers(self, stack_id, layers)
7664    }
7665
7666    /// Creates an Image resource.
7667    ///
7668    /// `image_id` must satisfy the identifier rules documented on [`LayerId`].
7669    pub fn r#create_image2(
7670        &self,
7671        mut image_id: &ImageId,
7672        mut import_token: BufferCollectionImportToken,
7673        mut vmo_index: u32,
7674        mut properties: &ImageProperties,
7675    ) -> Result<(), fidl::Error> {
7676        Flatland2ProxyInterface::r#create_image2(
7677            self,
7678            image_id,
7679            import_token,
7680            vmo_index,
7681            properties,
7682        )
7683    }
7684
7685    /// Released Images will be garbage collected by the system once they are no longer necessary
7686    /// for rendering. For Images, this means:
7687    /// - the Image is no longer bound to any Layer, and
7688    /// - any pending rendering that references the Image is complete.
7689    ///
7690    /// The `image_id` value is freed for reuse immediately by the client (identifier uniqueness
7691    /// is instantaneous).
7692    ///
7693    /// Note: Per-binding release fences (passed to `SetLayerImage`) are unaffected by this call.
7694    /// They track the lifecycle of individual layer bindings, not the client's `image_id`.
7695    ///
7696    /// `image_id` must refer to a valid, unreleased Image.
7697    pub fn r#release_image2(&self, mut image_id: &ImageId) -> Result<(), fidl::Error> {
7698        Flatland2ProxyInterface::r#release_image2(self, image_id)
7699    }
7700
7701    /// Creates a Viewport resource.
7702    ///
7703    /// `viewport_id` must satisfy the identifier rules documented on [`LayerId`].
7704    pub fn r#create_viewport2(
7705        &self,
7706        mut viewport_id: &ViewportId,
7707        mut token: fidl_fuchsia_ui_views::ViewportCreationToken,
7708        mut properties: &ViewportProperties,
7709        mut child_view_watcher: fidl::endpoints::ServerEnd<ChildViewWatcherMarker>,
7710    ) -> Result<(), fidl::Error> {
7711        Flatland2ProxyInterface::r#create_viewport2(
7712            self,
7713            viewport_id,
7714            token,
7715            properties,
7716            child_view_watcher,
7717        )
7718    }
7719
7720    /// Releases a Viewport from the scene.
7721    pub fn r#release_viewport2(
7722        &self,
7723        mut viewport_id: &ViewportId,
7724    ) -> fidl::client::QueryResponseFut<
7725        fidl_fuchsia_ui_views::ViewportCreationToken,
7726        fidl::encoding::DefaultFuchsiaResourceDialect,
7727    > {
7728        Flatland2ProxyInterface::r#release_viewport2(self, viewport_id)
7729    }
7730
7731    /// Sets the properties of a Viewport.
7732    pub fn r#set_viewport_properties2(
7733        &self,
7734        mut viewport_id: &ViewportId,
7735        mut properties: &ViewportProperties,
7736    ) -> Result<(), fidl::Error> {
7737        Flatland2ProxyInterface::r#set_viewport_properties2(self, viewport_id, properties)
7738    }
7739
7740    /// Sets (or clears) the content of a Transform.
7741    ///
7742    /// The same content may be attached to more than one Transform; each attachment composites
7743    /// that content again under its own Transform's matrix, clip, and opacity, so a single
7744    /// LayerStack or Viewport can appear repeatedly in a scene without the client duplicating the
7745    /// underlying resources.
7746    ///
7747    /// A Transform's content can be cleared by not providing the optional `content`.
7748    ///
7749    /// If `content` is set, it must refer to a valid, unreleased LayerStack or Viewport.
7750    /// Unlike classic [`Flatland.SetContent`], a zero id does not clear the content.
7751    pub fn r#set_transform_content(
7752        &self,
7753        mut transform_id: &TransformId,
7754        mut content: Option<&TransformContent>,
7755    ) -> Result<(), fidl::Error> {
7756        Flatland2ProxyInterface::r#set_transform_content(self, transform_id, content)
7757    }
7758}
7759
7760impl Flatland2ProxyInterface for Flatland2Proxy {
7761    fn r#create_layer(&self, mut layer_id: &LayerId) -> Result<(), fidl::Error> {
7762        self.client.send::<Flatland2CreateLayerRequest>(
7763            (layer_id,),
7764            0x60837bb0ce59f8a9,
7765            fidl::encoding::DynamicFlags::empty(),
7766        )
7767    }
7768
7769    fn r#release_layer(&self, mut layer_id: &LayerId) -> Result<(), fidl::Error> {
7770        self.client.send::<Flatland2ReleaseLayerRequest>(
7771            (layer_id,),
7772            0x60118a842b6f0756,
7773            fidl::encoding::DynamicFlags::empty(),
7774        )
7775    }
7776
7777    fn r#set_layer_image(
7778        &self,
7779        mut layer_id: &LayerId,
7780        mut image_id: &ImageId,
7781        mut acquire_fence: Option<WaitFence>,
7782        mut release_fence: Option<SignalFence>,
7783    ) -> Result<(), fidl::Error> {
7784        self.client.send::<Flatland2SetLayerImageRequest>(
7785            (layer_id, image_id, acquire_fence.as_mut(), release_fence.as_mut()),
7786            0x262302d9782d252c,
7787            fidl::encoding::DynamicFlags::empty(),
7788        )
7789    }
7790
7791    fn r#set_layer_properties(
7792        &self,
7793        mut layer_id: &LayerId,
7794        mut properties: &LayerProperties,
7795    ) -> Result<(), fidl::Error> {
7796        self.client.send::<Flatland2SetLayerPropertiesRequest>(
7797            (layer_id, properties),
7798            0x282d0e902aae8bb0,
7799            fidl::encoding::DynamicFlags::empty(),
7800        )
7801    }
7802
7803    fn r#reset_layer(&self, mut layer_id: &LayerId) -> Result<(), fidl::Error> {
7804        self.client.send::<Flatland2ResetLayerRequest>(
7805            (layer_id,),
7806            0x17bf541bf216ab2b,
7807            fidl::encoding::DynamicFlags::empty(),
7808        )
7809    }
7810
7811    fn r#create_layer_stack(&self, mut stack_id: &LayerStackId) -> Result<(), fidl::Error> {
7812        self.client.send::<Flatland2CreateLayerStackRequest>(
7813            (stack_id,),
7814            0x70debe3cd7371aa6,
7815            fidl::encoding::DynamicFlags::empty(),
7816        )
7817    }
7818
7819    fn r#release_layer_stack(&self, mut stack_id: &LayerStackId) -> Result<(), fidl::Error> {
7820        self.client.send::<Flatland2ReleaseLayerStackRequest>(
7821            (stack_id,),
7822            0x3ad3151aece3b1bb,
7823            fidl::encoding::DynamicFlags::empty(),
7824        )
7825    }
7826
7827    fn r#set_stack_layers(
7828        &self,
7829        mut stack_id: &LayerStackId,
7830        mut layers: &[LayerId],
7831    ) -> Result<(), fidl::Error> {
7832        self.client.send::<Flatland2SetStackLayersRequest>(
7833            (stack_id, layers),
7834            0x1e0bff0f5cca065a,
7835            fidl::encoding::DynamicFlags::empty(),
7836        )
7837    }
7838
7839    fn r#create_image2(
7840        &self,
7841        mut image_id: &ImageId,
7842        mut import_token: BufferCollectionImportToken,
7843        mut vmo_index: u32,
7844        mut properties: &ImageProperties,
7845    ) -> Result<(), fidl::Error> {
7846        self.client.send::<Flatland2CreateImage2Request>(
7847            (image_id, &mut import_token, vmo_index, properties),
7848            0x677fa7b23aaca46,
7849            fidl::encoding::DynamicFlags::empty(),
7850        )
7851    }
7852
7853    fn r#release_image2(&self, mut image_id: &ImageId) -> Result<(), fidl::Error> {
7854        self.client.send::<Flatland2ReleaseImage2Request>(
7855            (image_id,),
7856            0x7d0a041ed51aca06,
7857            fidl::encoding::DynamicFlags::empty(),
7858        )
7859    }
7860
7861    fn r#create_viewport2(
7862        &self,
7863        mut viewport_id: &ViewportId,
7864        mut token: fidl_fuchsia_ui_views::ViewportCreationToken,
7865        mut properties: &ViewportProperties,
7866        mut child_view_watcher: fidl::endpoints::ServerEnd<ChildViewWatcherMarker>,
7867    ) -> Result<(), fidl::Error> {
7868        self.client.send::<Flatland2CreateViewport2Request>(
7869            (viewport_id, &mut token, properties, child_view_watcher),
7870            0x1b646776764f1128,
7871            fidl::encoding::DynamicFlags::empty(),
7872        )
7873    }
7874
7875    type ReleaseViewport2ResponseFut = fidl::client::QueryResponseFut<
7876        fidl_fuchsia_ui_views::ViewportCreationToken,
7877        fidl::encoding::DefaultFuchsiaResourceDialect,
7878    >;
7879    fn r#release_viewport2(
7880        &self,
7881        mut viewport_id: &ViewportId,
7882    ) -> Self::ReleaseViewport2ResponseFut {
7883        fn _decode(
7884            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7885        ) -> Result<fidl_fuchsia_ui_views::ViewportCreationToken, fidl::Error> {
7886            let _response = fidl::client::decode_transaction_body::<
7887                Flatland2ReleaseViewport2Response,
7888                fidl::encoding::DefaultFuchsiaResourceDialect,
7889                0x18ef77414c7a9ae3,
7890            >(_buf?)?;
7891            Ok(_response.token)
7892        }
7893        self.client.send_query_and_decode::<
7894            Flatland2ReleaseViewport2Request,
7895            fidl_fuchsia_ui_views::ViewportCreationToken,
7896        >(
7897            (viewport_id,),
7898            0x18ef77414c7a9ae3,
7899            fidl::encoding::DynamicFlags::empty(),
7900            _decode,
7901        )
7902    }
7903
7904    fn r#set_viewport_properties2(
7905        &self,
7906        mut viewport_id: &ViewportId,
7907        mut properties: &ViewportProperties,
7908    ) -> Result<(), fidl::Error> {
7909        self.client.send::<Flatland2SetViewportProperties2Request>(
7910            (viewport_id, properties),
7911            0x95f2ec3b9e4beea,
7912            fidl::encoding::DynamicFlags::empty(),
7913        )
7914    }
7915
7916    fn r#set_transform_content(
7917        &self,
7918        mut transform_id: &TransformId,
7919        mut content: Option<&TransformContent>,
7920    ) -> Result<(), fidl::Error> {
7921        self.client.send::<Flatland2SetTransformContentRequest>(
7922            (transform_id, content),
7923            0x17e33f64f55e4ea9,
7924            fidl::encoding::DynamicFlags::empty(),
7925        )
7926    }
7927}
7928
7929pub struct Flatland2EventStream {
7930    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
7931}
7932
7933impl std::marker::Unpin for Flatland2EventStream {}
7934
7935impl futures::stream::FusedStream for Flatland2EventStream {
7936    fn is_terminated(&self) -> bool {
7937        self.event_receiver.is_terminated()
7938    }
7939}
7940
7941impl futures::Stream for Flatland2EventStream {
7942    type Item = Result<Flatland2Event, fidl::Error>;
7943
7944    fn poll_next(
7945        mut self: std::pin::Pin<&mut Self>,
7946        cx: &mut std::task::Context<'_>,
7947    ) -> std::task::Poll<Option<Self::Item>> {
7948        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
7949            &mut self.event_receiver,
7950            cx
7951        )?) {
7952            Some(buf) => std::task::Poll::Ready(Some(Flatland2Event::decode(buf))),
7953            None => std::task::Poll::Ready(None),
7954        }
7955    }
7956}
7957
7958#[derive(Debug)]
7959pub enum Flatland2Event {}
7960
7961impl Flatland2Event {
7962    /// Decodes a message buffer as a [`Flatland2Event`].
7963    fn decode(
7964        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
7965    ) -> Result<Flatland2Event, fidl::Error> {
7966        let (bytes, _handles) = buf.split_mut();
7967        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7968        debug_assert_eq!(tx_header.tx_id, 0);
7969        match tx_header.ordinal {
7970            _ => Err(fidl::Error::UnknownOrdinal {
7971                ordinal: tx_header.ordinal,
7972                protocol_name: <Flatland2Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
7973            }),
7974        }
7975    }
7976}
7977
7978/// A Stream of incoming requests for fuchsia.ui.composition/Flatland2.
7979pub struct Flatland2RequestStream {
7980    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7981    is_terminated: bool,
7982}
7983
7984impl std::marker::Unpin for Flatland2RequestStream {}
7985
7986impl futures::stream::FusedStream for Flatland2RequestStream {
7987    fn is_terminated(&self) -> bool {
7988        self.is_terminated
7989    }
7990}
7991
7992impl fidl::endpoints::RequestStream for Flatland2RequestStream {
7993    type Protocol = Flatland2Marker;
7994    type ControlHandle = Flatland2ControlHandle;
7995
7996    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
7997        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
7998    }
7999
8000    fn control_handle(&self) -> Self::ControlHandle {
8001        Flatland2ControlHandle { inner: self.inner.clone() }
8002    }
8003
8004    fn into_inner(
8005        self,
8006    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
8007    {
8008        (self.inner, self.is_terminated)
8009    }
8010
8011    fn from_inner(
8012        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8013        is_terminated: bool,
8014    ) -> Self {
8015        Self { inner, is_terminated }
8016    }
8017}
8018
8019impl futures::Stream for Flatland2RequestStream {
8020    type Item = Result<Flatland2Request, fidl::Error>;
8021
8022    fn poll_next(
8023        mut self: std::pin::Pin<&mut Self>,
8024        cx: &mut std::task::Context<'_>,
8025    ) -> std::task::Poll<Option<Self::Item>> {
8026        let this = &mut *self;
8027        if this.inner.check_shutdown(cx) {
8028            this.is_terminated = true;
8029            return std::task::Poll::Ready(None);
8030        }
8031        if this.is_terminated {
8032            panic!("polled Flatland2RequestStream after completion");
8033        }
8034        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
8035            |bytes, handles| {
8036                match this.inner.channel().read_etc(cx, bytes, handles) {
8037                    std::task::Poll::Ready(Ok(())) => {}
8038                    std::task::Poll::Pending => return std::task::Poll::Pending,
8039                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
8040                        this.is_terminated = true;
8041                        return std::task::Poll::Ready(None);
8042                    }
8043                    std::task::Poll::Ready(Err(e)) => {
8044                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
8045                            e.into(),
8046                        ))));
8047                    }
8048                }
8049
8050                // A message has been received from the channel
8051                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
8052
8053                std::task::Poll::Ready(Some(match header.ordinal {
8054                    0x60837bb0ce59f8a9 => {
8055                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
8056                        let mut req = fidl::new_empty!(
8057                            Flatland2CreateLayerRequest,
8058                            fidl::encoding::DefaultFuchsiaResourceDialect
8059                        );
8060                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<Flatland2CreateLayerRequest>(&header, _body_bytes, handles, &mut req)?;
8061                        let control_handle = Flatland2ControlHandle { inner: this.inner.clone() };
8062                        Ok(Flatland2Request::CreateLayer { layer_id: req.layer_id, control_handle })
8063                    }
8064                    0x60118a842b6f0756 => {
8065                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
8066                        let mut req = fidl::new_empty!(
8067                            Flatland2ReleaseLayerRequest,
8068                            fidl::encoding::DefaultFuchsiaResourceDialect
8069                        );
8070                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<Flatland2ReleaseLayerRequest>(&header, _body_bytes, handles, &mut req)?;
8071                        let control_handle = Flatland2ControlHandle { inner: this.inner.clone() };
8072                        Ok(Flatland2Request::ReleaseLayer {
8073                            layer_id: req.layer_id,
8074
8075                            control_handle,
8076                        })
8077                    }
8078                    0x262302d9782d252c => {
8079                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
8080                        let mut req = fidl::new_empty!(
8081                            Flatland2SetLayerImageRequest,
8082                            fidl::encoding::DefaultFuchsiaResourceDialect
8083                        );
8084                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<Flatland2SetLayerImageRequest>(&header, _body_bytes, handles, &mut req)?;
8085                        let control_handle = Flatland2ControlHandle { inner: this.inner.clone() };
8086                        Ok(Flatland2Request::SetLayerImage {
8087                            layer_id: req.layer_id,
8088                            image_id: req.image_id,
8089                            acquire_fence: req.acquire_fence,
8090                            release_fence: req.release_fence,
8091
8092                            control_handle,
8093                        })
8094                    }
8095                    0x282d0e902aae8bb0 => {
8096                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
8097                        let mut req = fidl::new_empty!(
8098                            Flatland2SetLayerPropertiesRequest,
8099                            fidl::encoding::DefaultFuchsiaResourceDialect
8100                        );
8101                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<Flatland2SetLayerPropertiesRequest>(&header, _body_bytes, handles, &mut req)?;
8102                        let control_handle = Flatland2ControlHandle { inner: this.inner.clone() };
8103                        Ok(Flatland2Request::SetLayerProperties {
8104                            layer_id: req.layer_id,
8105                            properties: req.properties,
8106
8107                            control_handle,
8108                        })
8109                    }
8110                    0x17bf541bf216ab2b => {
8111                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
8112                        let mut req = fidl::new_empty!(
8113                            Flatland2ResetLayerRequest,
8114                            fidl::encoding::DefaultFuchsiaResourceDialect
8115                        );
8116                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<Flatland2ResetLayerRequest>(&header, _body_bytes, handles, &mut req)?;
8117                        let control_handle = Flatland2ControlHandle { inner: this.inner.clone() };
8118                        Ok(Flatland2Request::ResetLayer { layer_id: req.layer_id, control_handle })
8119                    }
8120                    0x70debe3cd7371aa6 => {
8121                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
8122                        let mut req = fidl::new_empty!(
8123                            Flatland2CreateLayerStackRequest,
8124                            fidl::encoding::DefaultFuchsiaResourceDialect
8125                        );
8126                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<Flatland2CreateLayerStackRequest>(&header, _body_bytes, handles, &mut req)?;
8127                        let control_handle = Flatland2ControlHandle { inner: this.inner.clone() };
8128                        Ok(Flatland2Request::CreateLayerStack {
8129                            stack_id: req.stack_id,
8130
8131                            control_handle,
8132                        })
8133                    }
8134                    0x3ad3151aece3b1bb => {
8135                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
8136                        let mut req = fidl::new_empty!(
8137                            Flatland2ReleaseLayerStackRequest,
8138                            fidl::encoding::DefaultFuchsiaResourceDialect
8139                        );
8140                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<Flatland2ReleaseLayerStackRequest>(&header, _body_bytes, handles, &mut req)?;
8141                        let control_handle = Flatland2ControlHandle { inner: this.inner.clone() };
8142                        Ok(Flatland2Request::ReleaseLayerStack {
8143                            stack_id: req.stack_id,
8144
8145                            control_handle,
8146                        })
8147                    }
8148                    0x1e0bff0f5cca065a => {
8149                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
8150                        let mut req = fidl::new_empty!(
8151                            Flatland2SetStackLayersRequest,
8152                            fidl::encoding::DefaultFuchsiaResourceDialect
8153                        );
8154                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<Flatland2SetStackLayersRequest>(&header, _body_bytes, handles, &mut req)?;
8155                        let control_handle = Flatland2ControlHandle { inner: this.inner.clone() };
8156                        Ok(Flatland2Request::SetStackLayers {
8157                            stack_id: req.stack_id,
8158                            layers: req.layers,
8159
8160                            control_handle,
8161                        })
8162                    }
8163                    0x677fa7b23aaca46 => {
8164                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
8165                        let mut req = fidl::new_empty!(
8166                            Flatland2CreateImage2Request,
8167                            fidl::encoding::DefaultFuchsiaResourceDialect
8168                        );
8169                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<Flatland2CreateImage2Request>(&header, _body_bytes, handles, &mut req)?;
8170                        let control_handle = Flatland2ControlHandle { inner: this.inner.clone() };
8171                        Ok(Flatland2Request::CreateImage2 {
8172                            image_id: req.image_id,
8173                            import_token: req.import_token,
8174                            vmo_index: req.vmo_index,
8175                            properties: req.properties,
8176
8177                            control_handle,
8178                        })
8179                    }
8180                    0x7d0a041ed51aca06 => {
8181                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
8182                        let mut req = fidl::new_empty!(
8183                            Flatland2ReleaseImage2Request,
8184                            fidl::encoding::DefaultFuchsiaResourceDialect
8185                        );
8186                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<Flatland2ReleaseImage2Request>(&header, _body_bytes, handles, &mut req)?;
8187                        let control_handle = Flatland2ControlHandle { inner: this.inner.clone() };
8188                        Ok(Flatland2Request::ReleaseImage2 {
8189                            image_id: req.image_id,
8190
8191                            control_handle,
8192                        })
8193                    }
8194                    0x1b646776764f1128 => {
8195                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
8196                        let mut req = fidl::new_empty!(
8197                            Flatland2CreateViewport2Request,
8198                            fidl::encoding::DefaultFuchsiaResourceDialect
8199                        );
8200                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<Flatland2CreateViewport2Request>(&header, _body_bytes, handles, &mut req)?;
8201                        let control_handle = Flatland2ControlHandle { inner: this.inner.clone() };
8202                        Ok(Flatland2Request::CreateViewport2 {
8203                            viewport_id: req.viewport_id,
8204                            token: req.token,
8205                            properties: req.properties,
8206                            child_view_watcher: req.child_view_watcher,
8207
8208                            control_handle,
8209                        })
8210                    }
8211                    0x18ef77414c7a9ae3 => {
8212                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
8213                        let mut req = fidl::new_empty!(
8214                            Flatland2ReleaseViewport2Request,
8215                            fidl::encoding::DefaultFuchsiaResourceDialect
8216                        );
8217                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<Flatland2ReleaseViewport2Request>(&header, _body_bytes, handles, &mut req)?;
8218                        let control_handle = Flatland2ControlHandle { inner: this.inner.clone() };
8219                        Ok(Flatland2Request::ReleaseViewport2 {
8220                            viewport_id: req.viewport_id,
8221
8222                            responder: Flatland2ReleaseViewport2Responder {
8223                                control_handle: std::mem::ManuallyDrop::new(control_handle),
8224                                tx_id: header.tx_id,
8225                            },
8226                        })
8227                    }
8228                    0x95f2ec3b9e4beea => {
8229                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
8230                        let mut req = fidl::new_empty!(
8231                            Flatland2SetViewportProperties2Request,
8232                            fidl::encoding::DefaultFuchsiaResourceDialect
8233                        );
8234                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<Flatland2SetViewportProperties2Request>(&header, _body_bytes, handles, &mut req)?;
8235                        let control_handle = Flatland2ControlHandle { inner: this.inner.clone() };
8236                        Ok(Flatland2Request::SetViewportProperties2 {
8237                            viewport_id: req.viewport_id,
8238                            properties: req.properties,
8239
8240                            control_handle,
8241                        })
8242                    }
8243                    0x17e33f64f55e4ea9 => {
8244                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
8245                        let mut req = fidl::new_empty!(
8246                            Flatland2SetTransformContentRequest,
8247                            fidl::encoding::DefaultFuchsiaResourceDialect
8248                        );
8249                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<Flatland2SetTransformContentRequest>(&header, _body_bytes, handles, &mut req)?;
8250                        let control_handle = Flatland2ControlHandle { inner: this.inner.clone() };
8251                        Ok(Flatland2Request::SetTransformContent {
8252                            transform_id: req.transform_id,
8253                            content: req.content,
8254
8255                            control_handle,
8256                        })
8257                    }
8258                    _ => Err(fidl::Error::UnknownOrdinal {
8259                        ordinal: header.ordinal,
8260                        protocol_name:
8261                            <Flatland2Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
8262                    }),
8263                }))
8264            },
8265        )
8266    }
8267}
8268
8269/// This protocol is composed into the "classic" [`Flatland`] protocol, and
8270/// cleans up some "warts" in the original design.
8271///
8272/// All methods defined in this protocol are ONLY available when Flatland2 is enabled
8273/// (e.g. via [`TrustedFlatlandConfig.use_flatland2_api`]). Calling these methods
8274/// when Flatland2 is not enabled will result in a channel closure.
8275///
8276/// Broadly speaking, the "warts" involve properties that are set on images when they shouldn't be.
8277/// For example, it should be possible to display two copies of the same image side by side, with
8278/// one image flipped `LEFT_RIGHT` to reflect the other.  This is impossible in the classic Flatland
8279/// API, because the flip is a property of the image.  In Flatland2, the flip is a property of
8280/// the layer, and the client's goal is easily achieved with two layers with the same image and
8281/// different flips.
8282///
8283/// Certain "classic" Flatland methods are disabled/illegal when Flatland2 is enabled.
8284/// Eventually these methods will be removed; Flatland2 will be the standard way to display
8285/// images in Flatland.  Until then, this "opt in" approach provides clients with a convenient way
8286/// to migrate to this modernized API.  The disabled methods are:
8287/// - [`fuchsia.ui.composition/Flatland.CreateFilledRect`]
8288/// - [`fuchsia.ui.composition/Flatland.CreateImage`]
8289/// - [`fuchsia.ui.composition/Flatland.CreateViewport`]
8290/// - [`fuchsia.ui.composition/Flatland.ReleaseFilledRect`]
8291/// - [`fuchsia.ui.composition/Flatland.ReleaseImage`]
8292/// - [`fuchsia.ui.composition/Flatland.ReleaseViewport`]
8293/// - [`fuchsia.ui.composition/Flatland.SetContent`]
8294/// - [`fuchsia.ui.composition/Flatland.SetImageBlendingFunction`]
8295/// - [`fuchsia.ui.composition/Flatland.SetImageBlendMode`]
8296/// - [`fuchsia.ui.composition/Flatland.SetImageDestinationSize`]
8297/// - [`fuchsia.ui.composition/Flatland.SetImageFlip`]
8298/// - [`fuchsia.ui.composition/Flatland.SetImageOpacity`]
8299/// - [`fuchsia.ui.composition/Flatland.SetSolidFill`]
8300/// - [`fuchsia.ui.composition/Flatland.SetImageSampleRegion`]
8301/// - [`fuchsia.ui.composition/Flatland.SetViewportProperties`]
8302/// - [`fuchsia.ui.composition/TrustedFlatland.ReleaseImageImmediately`]
8303#[derive(Debug)]
8304pub enum Flatland2Request {
8305    /// A Layer is a type of `Content` that composites either a single `Image` or a solid
8306    /// color. It separates visual properties (such as size, flip, opacity, and blending)
8307    /// from the raw pixel data.
8308    ///
8309    /// Unlike typical `Content` items which represent a static visual resource, a Layer is designed
8310    /// to be a dynamic container for an image sequence. Typical usage involves setting the layer's
8311    /// visual properties and image metadata infrequently, and then rapidly swapping the active
8312    /// `Image` (e.g. on every frame) with another image of matching metadata.
8313    ///
8314    /// This separation allows a single `Image` resource to be reused across multiple layers with
8315    /// different visual configurations simultaneously.
8316    ///
8317    /// To use a Layer:
8318    /// 1. Create a `Layer` using [`CreateLayer`].
8319    /// 2. Set properties on the `Layer` via [`SetLayerProperties`], including the
8320    ///    composition mode.
8321    /// 3. For an image layer, associate an `Image` with the `Layer` via [`SetLayerImage`].
8322    /// 4. Add the `Layer` to a `LayerStack` via [`SetStackLayers`].
8323    /// 5. Set the `LayerStack` as the content of a node via [`SetTransformContent`].
8324    ///
8325    /// `layer_id` must satisfy the identifier rules documented on [`LayerId`].
8326    CreateLayer { layer_id: LayerId, control_handle: Flatland2ControlHandle },
8327    /// Released Layers will be garbage collected by the system once they are no longer necessary
8328    /// for rendering. For Layers, this means:
8329    /// - the Layer is no longer referenced by any LayerStack, and
8330    /// - any pending rendering that references the Layer is complete.
8331    ///
8332    /// `layer_id` must refer to a valid, unreleased Layer.
8333    ReleaseLayer { layer_id: LayerId, control_handle: Flatland2ControlHandle },
8334    /// Associates an Image with the Layer.
8335    ///
8336    /// The binding is legal in any composition mode, and is sticky: it survives composition
8337    /// mode changes, and is replaced only by a later [`SetLayerImage`] call (or cleared by
8338    /// [`ResetLayer`]). The image is displayed only while the layer's composition mode is
8339    /// `IMAGE`.
8340    ///
8341    /// The bound image must be large enough for the layer's stored `sample_rect`; this is
8342    /// checked at [`fuchsia.ui.composition/Flatland.Present`], not here. See
8343    /// [`LayerProperties.sample_rect`].
8344    ///
8345    /// `layer_id` must refer to a valid, unreleased Layer.
8346    /// `image_id` must refer to a valid, unreleased Image.
8347    /// `acquire_fence` is an optional fence that must be signaled before the image is displayed.
8348    /// `release_fence` is an optional fence, signaled by Scenic when *this binding* no
8349    /// longer references the image. It is per-binding, not per-image: an image bound to
8350    /// several layers has one such fence per binding, and the image is safe to write only
8351    /// once every one of them has signaled.
8352    ///
8353    /// A binding is ended by:
8354    ///
8355    /// - being superseded by a later [`SetLayerImage`] on the same layer
8356    /// - [`ResetLayer`]
8357    /// - the layer ref-count reaching zero, either via [`ReleaseLayer`] or by being released
8358    ///   by a layer stack
8359    /// - destruction of the session, which ends every binding it holds
8360    ///
8361    /// For a binding ended while the session is alive, Scenic signals at the first frame
8362    /// retire after that point. Bindings that never reached the screen (e.g. one superseded
8363    /// within a single batch, or one lost when several
8364    /// [`fuchsia.ui.composition/Flatland.Present`] calls are squashed into a single
8365    /// frame) signal at that same retire rather than immediately. The signal is
8366    /// therefore conservative by at most one frame; it is never early.
8367    SetLayerImage {
8368        layer_id: LayerId,
8369        image_id: ImageId,
8370        acquire_fence: Option<Box<WaitFence>>,
8371        release_fence: Option<Box<SignalFence>>,
8372        control_handle: Flatland2ControlHandle,
8373    },
8374    /// Sets properties of the Layer.
8375    ///
8376    /// The provided `properties` table is merged into the layer's stored properties: fields
8377    /// which are unset in `properties` retain their previously stored values. Stored
8378    /// properties are sticky; see [`LayerProperties`] for the full persistence semantics.
8379    ///
8380    /// Values are stored as given; validation which depends on other state (notably
8381    /// `sample_rect` against the bound image) happens at
8382    /// [`fuchsia.ui.composition/Flatland.Present`]. See [`LayerProperties.sample_rect`].
8383    ///
8384    /// `layer_id` must refer to a valid, unreleased Layer.
8385    SetLayerProperties {
8386        layer_id: LayerId,
8387        properties: LayerProperties,
8388        control_handle: Flatland2ControlHandle,
8389    },
8390    /// Unbinds any Image bound to the layer and clears every stored [`LayerProperties`]
8391    /// field, returning the layer to its freshly-created state (composition mode
8392    /// `INVISIBLE`, all properties at their documented defaults). This is the only
8393    /// operation which forgets stored layer properties.
8394    ///
8395    /// `layer_id` must refer to a valid, unreleased Layer.
8396    ResetLayer { layer_id: LayerId, control_handle: Flatland2ControlHandle },
8397    /// Creates a new layer stack with the specified `stack_id`.
8398    ///
8399    /// `stack_id` must satisfy the identifier rules documented on [`LayerId`].
8400    CreateLayerStack { stack_id: LayerStackId, control_handle: Flatland2ControlHandle },
8401    /// Releases the layer stack with the specified `stack_id`.
8402    ReleaseLayerStack { stack_id: LayerStackId, control_handle: Flatland2ControlHandle },
8403    /// Sets the layers in the stack. The order of layers in the vector determines their Z-order,
8404    /// with the first element being the back-most and the last element being the front-most.
8405    ///
8406    /// `stack_id` must refer to a valid, unreleased LayerStack. Each element of `layers`
8407    /// must refer to a valid, unreleased Layer. Duplicate layers within `layers` are
8408    /// disallowed.
8409    SetStackLayers {
8410        stack_id: LayerStackId,
8411        layers: Vec<LayerId>,
8412        control_handle: Flatland2ControlHandle,
8413    },
8414    /// Creates an Image resource.
8415    ///
8416    /// `image_id` must satisfy the identifier rules documented on [`LayerId`].
8417    CreateImage2 {
8418        image_id: ImageId,
8419        import_token: BufferCollectionImportToken,
8420        vmo_index: u32,
8421        properties: ImageProperties,
8422        control_handle: Flatland2ControlHandle,
8423    },
8424    /// Released Images will be garbage collected by the system once they are no longer necessary
8425    /// for rendering. For Images, this means:
8426    /// - the Image is no longer bound to any Layer, and
8427    /// - any pending rendering that references the Image is complete.
8428    ///
8429    /// The `image_id` value is freed for reuse immediately by the client (identifier uniqueness
8430    /// is instantaneous).
8431    ///
8432    /// Note: Per-binding release fences (passed to `SetLayerImage`) are unaffected by this call.
8433    /// They track the lifecycle of individual layer bindings, not the client's `image_id`.
8434    ///
8435    /// `image_id` must refer to a valid, unreleased Image.
8436    ReleaseImage2 { image_id: ImageId, control_handle: Flatland2ControlHandle },
8437    /// Creates a Viewport resource.
8438    ///
8439    /// `viewport_id` must satisfy the identifier rules documented on [`LayerId`].
8440    CreateViewport2 {
8441        viewport_id: ViewportId,
8442        token: fidl_fuchsia_ui_views::ViewportCreationToken,
8443        properties: ViewportProperties,
8444        child_view_watcher: fidl::endpoints::ServerEnd<ChildViewWatcherMarker>,
8445        control_handle: Flatland2ControlHandle,
8446    },
8447    /// Releases a Viewport from the scene.
8448    ReleaseViewport2 { viewport_id: ViewportId, responder: Flatland2ReleaseViewport2Responder },
8449    /// Sets the properties of a Viewport.
8450    SetViewportProperties2 {
8451        viewport_id: ViewportId,
8452        properties: ViewportProperties,
8453        control_handle: Flatland2ControlHandle,
8454    },
8455    /// Sets (or clears) the content of a Transform.
8456    ///
8457    /// The same content may be attached to more than one Transform; each attachment composites
8458    /// that content again under its own Transform's matrix, clip, and opacity, so a single
8459    /// LayerStack or Viewport can appear repeatedly in a scene without the client duplicating the
8460    /// underlying resources.
8461    ///
8462    /// A Transform's content can be cleared by not providing the optional `content`.
8463    ///
8464    /// If `content` is set, it must refer to a valid, unreleased LayerStack or Viewport.
8465    /// Unlike classic [`Flatland.SetContent`], a zero id does not clear the content.
8466    SetTransformContent {
8467        transform_id: TransformId,
8468        content: Option<Box<TransformContent>>,
8469        control_handle: Flatland2ControlHandle,
8470    },
8471}
8472
8473impl Flatland2Request {
8474    #[allow(irrefutable_let_patterns)]
8475    pub fn into_create_layer(self) -> Option<(LayerId, Flatland2ControlHandle)> {
8476        if let Flatland2Request::CreateLayer { layer_id, control_handle } = self {
8477            Some((layer_id, control_handle))
8478        } else {
8479            None
8480        }
8481    }
8482
8483    #[allow(irrefutable_let_patterns)]
8484    pub fn into_release_layer(self) -> Option<(LayerId, Flatland2ControlHandle)> {
8485        if let Flatland2Request::ReleaseLayer { layer_id, control_handle } = self {
8486            Some((layer_id, control_handle))
8487        } else {
8488            None
8489        }
8490    }
8491
8492    #[allow(irrefutable_let_patterns)]
8493    pub fn into_set_layer_image(
8494        self,
8495    ) -> Option<(
8496        LayerId,
8497        ImageId,
8498        Option<Box<WaitFence>>,
8499        Option<Box<SignalFence>>,
8500        Flatland2ControlHandle,
8501    )> {
8502        if let Flatland2Request::SetLayerImage {
8503            layer_id,
8504            image_id,
8505            acquire_fence,
8506            release_fence,
8507            control_handle,
8508        } = self
8509        {
8510            Some((layer_id, image_id, acquire_fence, release_fence, control_handle))
8511        } else {
8512            None
8513        }
8514    }
8515
8516    #[allow(irrefutable_let_patterns)]
8517    pub fn into_set_layer_properties(
8518        self,
8519    ) -> Option<(LayerId, LayerProperties, Flatland2ControlHandle)> {
8520        if let Flatland2Request::SetLayerProperties { layer_id, properties, control_handle } = self
8521        {
8522            Some((layer_id, properties, control_handle))
8523        } else {
8524            None
8525        }
8526    }
8527
8528    #[allow(irrefutable_let_patterns)]
8529    pub fn into_reset_layer(self) -> Option<(LayerId, Flatland2ControlHandle)> {
8530        if let Flatland2Request::ResetLayer { layer_id, control_handle } = self {
8531            Some((layer_id, control_handle))
8532        } else {
8533            None
8534        }
8535    }
8536
8537    #[allow(irrefutable_let_patterns)]
8538    pub fn into_create_layer_stack(self) -> Option<(LayerStackId, Flatland2ControlHandle)> {
8539        if let Flatland2Request::CreateLayerStack { stack_id, control_handle } = self {
8540            Some((stack_id, control_handle))
8541        } else {
8542            None
8543        }
8544    }
8545
8546    #[allow(irrefutable_let_patterns)]
8547    pub fn into_release_layer_stack(self) -> Option<(LayerStackId, Flatland2ControlHandle)> {
8548        if let Flatland2Request::ReleaseLayerStack { stack_id, control_handle } = self {
8549            Some((stack_id, control_handle))
8550        } else {
8551            None
8552        }
8553    }
8554
8555    #[allow(irrefutable_let_patterns)]
8556    pub fn into_set_stack_layers(
8557        self,
8558    ) -> Option<(LayerStackId, Vec<LayerId>, Flatland2ControlHandle)> {
8559        if let Flatland2Request::SetStackLayers { stack_id, layers, control_handle } = self {
8560            Some((stack_id, layers, control_handle))
8561        } else {
8562            None
8563        }
8564    }
8565
8566    #[allow(irrefutable_let_patterns)]
8567    pub fn into_create_image2(
8568        self,
8569    ) -> Option<(ImageId, BufferCollectionImportToken, u32, ImageProperties, Flatland2ControlHandle)>
8570    {
8571        if let Flatland2Request::CreateImage2 {
8572            image_id,
8573            import_token,
8574            vmo_index,
8575            properties,
8576            control_handle,
8577        } = self
8578        {
8579            Some((image_id, import_token, vmo_index, properties, control_handle))
8580        } else {
8581            None
8582        }
8583    }
8584
8585    #[allow(irrefutable_let_patterns)]
8586    pub fn into_release_image2(self) -> Option<(ImageId, Flatland2ControlHandle)> {
8587        if let Flatland2Request::ReleaseImage2 { image_id, control_handle } = self {
8588            Some((image_id, control_handle))
8589        } else {
8590            None
8591        }
8592    }
8593
8594    #[allow(irrefutable_let_patterns)]
8595    pub fn into_create_viewport2(
8596        self,
8597    ) -> Option<(
8598        ViewportId,
8599        fidl_fuchsia_ui_views::ViewportCreationToken,
8600        ViewportProperties,
8601        fidl::endpoints::ServerEnd<ChildViewWatcherMarker>,
8602        Flatland2ControlHandle,
8603    )> {
8604        if let Flatland2Request::CreateViewport2 {
8605            viewport_id,
8606            token,
8607            properties,
8608            child_view_watcher,
8609            control_handle,
8610        } = self
8611        {
8612            Some((viewport_id, token, properties, child_view_watcher, control_handle))
8613        } else {
8614            None
8615        }
8616    }
8617
8618    #[allow(irrefutable_let_patterns)]
8619    pub fn into_release_viewport2(
8620        self,
8621    ) -> Option<(ViewportId, Flatland2ReleaseViewport2Responder)> {
8622        if let Flatland2Request::ReleaseViewport2 { viewport_id, responder } = self {
8623            Some((viewport_id, responder))
8624        } else {
8625            None
8626        }
8627    }
8628
8629    #[allow(irrefutable_let_patterns)]
8630    pub fn into_set_viewport_properties2(
8631        self,
8632    ) -> Option<(ViewportId, ViewportProperties, Flatland2ControlHandle)> {
8633        if let Flatland2Request::SetViewportProperties2 {
8634            viewport_id,
8635            properties,
8636            control_handle,
8637        } = self
8638        {
8639            Some((viewport_id, properties, control_handle))
8640        } else {
8641            None
8642        }
8643    }
8644
8645    #[allow(irrefutable_let_patterns)]
8646    pub fn into_set_transform_content(
8647        self,
8648    ) -> Option<(TransformId, Option<Box<TransformContent>>, Flatland2ControlHandle)> {
8649        if let Flatland2Request::SetTransformContent { transform_id, content, control_handle } =
8650            self
8651        {
8652            Some((transform_id, content, control_handle))
8653        } else {
8654            None
8655        }
8656    }
8657
8658    /// Name of the method defined in FIDL
8659    pub fn method_name(&self) -> &'static str {
8660        match *self {
8661            Flatland2Request::CreateLayer { .. } => "create_layer",
8662            Flatland2Request::ReleaseLayer { .. } => "release_layer",
8663            Flatland2Request::SetLayerImage { .. } => "set_layer_image",
8664            Flatland2Request::SetLayerProperties { .. } => "set_layer_properties",
8665            Flatland2Request::ResetLayer { .. } => "reset_layer",
8666            Flatland2Request::CreateLayerStack { .. } => "create_layer_stack",
8667            Flatland2Request::ReleaseLayerStack { .. } => "release_layer_stack",
8668            Flatland2Request::SetStackLayers { .. } => "set_stack_layers",
8669            Flatland2Request::CreateImage2 { .. } => "create_image2",
8670            Flatland2Request::ReleaseImage2 { .. } => "release_image2",
8671            Flatland2Request::CreateViewport2 { .. } => "create_viewport2",
8672            Flatland2Request::ReleaseViewport2 { .. } => "release_viewport2",
8673            Flatland2Request::SetViewportProperties2 { .. } => "set_viewport_properties2",
8674            Flatland2Request::SetTransformContent { .. } => "set_transform_content",
8675        }
8676    }
8677}
8678
8679#[derive(Debug, Clone)]
8680pub struct Flatland2ControlHandle {
8681    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8682}
8683
8684impl Flatland2ControlHandle {
8685    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
8686        self.inner.shutdown_with_epitaph(status.into())
8687    }
8688}
8689
8690impl fidl::endpoints::ControlHandle for Flatland2ControlHandle {
8691    fn shutdown(&self) {
8692        self.inner.shutdown()
8693    }
8694
8695    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
8696        self.inner.shutdown_with_epitaph(status)
8697    }
8698
8699    fn is_closed(&self) -> bool {
8700        self.inner.channel().is_closed()
8701    }
8702    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
8703        self.inner.channel().on_closed()
8704    }
8705
8706    #[cfg(target_os = "fuchsia")]
8707    fn signal_peer(
8708        &self,
8709        clear_mask: zx::Signals,
8710        set_mask: zx::Signals,
8711    ) -> Result<(), zx_status::Status> {
8712        use fidl::Peered;
8713        self.inner.channel().signal_peer(clear_mask, set_mask)
8714    }
8715}
8716
8717impl Flatland2ControlHandle {}
8718
8719#[must_use = "FIDL methods require a response to be sent"]
8720#[derive(Debug)]
8721pub struct Flatland2ReleaseViewport2Responder {
8722    control_handle: std::mem::ManuallyDrop<Flatland2ControlHandle>,
8723    tx_id: u32,
8724}
8725
8726/// Set the the channel to be shutdown (see [`Flatland2ControlHandle::shutdown`])
8727/// if the responder is dropped without sending a response, so that the client
8728/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
8729impl std::ops::Drop for Flatland2ReleaseViewport2Responder {
8730    fn drop(&mut self) {
8731        self.control_handle.shutdown();
8732        // Safety: drops once, never accessed again
8733        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8734    }
8735}
8736
8737impl fidl::endpoints::Responder for Flatland2ReleaseViewport2Responder {
8738    type ControlHandle = Flatland2ControlHandle;
8739
8740    fn control_handle(&self) -> &Flatland2ControlHandle {
8741        &self.control_handle
8742    }
8743
8744    fn drop_without_shutdown(mut self) {
8745        // Safety: drops once, never accessed again due to mem::forget
8746        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8747        // Prevent Drop from running (which would shut down the channel)
8748        std::mem::forget(self);
8749    }
8750}
8751
8752impl Flatland2ReleaseViewport2Responder {
8753    /// Sends a response to the FIDL transaction.
8754    ///
8755    /// Sets the channel to shutdown if an error occurs.
8756    pub fn send(
8757        self,
8758        mut token: fidl_fuchsia_ui_views::ViewportCreationToken,
8759    ) -> Result<(), fidl::Error> {
8760        let _result = self.send_raw(token);
8761        if _result.is_err() {
8762            self.control_handle.shutdown();
8763        }
8764        self.drop_without_shutdown();
8765        _result
8766    }
8767
8768    /// Similar to "send" but does not shutdown the channel if an error occurs.
8769    pub fn send_no_shutdown_on_err(
8770        self,
8771        mut token: fidl_fuchsia_ui_views::ViewportCreationToken,
8772    ) -> Result<(), fidl::Error> {
8773        let _result = self.send_raw(token);
8774        self.drop_without_shutdown();
8775        _result
8776    }
8777
8778    fn send_raw(
8779        &self,
8780        mut token: fidl_fuchsia_ui_views::ViewportCreationToken,
8781    ) -> Result<(), fidl::Error> {
8782        self.control_handle.inner.send::<Flatland2ReleaseViewport2Response>(
8783            (&mut token,),
8784            self.tx_id,
8785            0x18ef77414c7a9ae3,
8786            fidl::encoding::DynamicFlags::empty(),
8787        )
8788    }
8789}
8790
8791#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
8792pub struct FlatlandDisplayMarker;
8793
8794impl fidl::endpoints::ProtocolMarker for FlatlandDisplayMarker {
8795    type Proxy = FlatlandDisplayProxy;
8796    type RequestStream = FlatlandDisplayRequestStream;
8797    #[cfg(target_os = "fuchsia")]
8798    type SynchronousProxy = FlatlandDisplaySynchronousProxy;
8799
8800    const DEBUG_NAME: &'static str = "fuchsia.ui.composition.FlatlandDisplay";
8801}
8802impl fidl::endpoints::DiscoverableProtocolMarker for FlatlandDisplayMarker {}
8803
8804pub trait FlatlandDisplayProxyInterface: Send + Sync {
8805    fn r#set_content(
8806        &self,
8807        token: fidl_fuchsia_ui_views::ViewportCreationToken,
8808        child_view_watcher: fidl::endpoints::ServerEnd<ChildViewWatcherMarker>,
8809    ) -> Result<(), fidl::Error>;
8810    fn r#set_device_pixel_ratio(
8811        &self,
8812        device_pixel_ratio: &fidl_fuchsia_math::VecF,
8813    ) -> Result<(), fidl::Error>;
8814}
8815#[derive(Debug)]
8816#[cfg(target_os = "fuchsia")]
8817pub struct FlatlandDisplaySynchronousProxy {
8818    client: fidl::client::sync::Client,
8819}
8820
8821#[cfg(target_os = "fuchsia")]
8822impl fidl::endpoints::SynchronousProxy for FlatlandDisplaySynchronousProxy {
8823    type Proxy = FlatlandDisplayProxy;
8824    type Protocol = FlatlandDisplayMarker;
8825
8826    fn from_channel(inner: fidl::Channel) -> Self {
8827        Self::new(inner)
8828    }
8829
8830    fn into_channel(self) -> fidl::Channel {
8831        self.client.into_channel()
8832    }
8833
8834    fn as_channel(&self) -> &fidl::Channel {
8835        self.client.as_channel()
8836    }
8837}
8838
8839#[cfg(target_os = "fuchsia")]
8840impl FlatlandDisplaySynchronousProxy {
8841    pub fn new(channel: fidl::Channel) -> Self {
8842        Self { client: fidl::client::sync::Client::new(channel) }
8843    }
8844
8845    pub fn into_channel(self) -> fidl::Channel {
8846        self.client.into_channel()
8847    }
8848
8849    /// Waits until an event arrives and returns it. It is safe for other
8850    /// threads to make concurrent requests while waiting for an event.
8851    pub fn wait_for_event(
8852        &self,
8853        deadline: zx::MonotonicInstant,
8854    ) -> Result<FlatlandDisplayEvent, fidl::Error> {
8855        FlatlandDisplayEvent::decode(self.client.wait_for_event::<FlatlandDisplayMarker>(deadline)?)
8856    }
8857
8858    pub fn r#set_content(
8859        &self,
8860        mut token: fidl_fuchsia_ui_views::ViewportCreationToken,
8861        mut child_view_watcher: fidl::endpoints::ServerEnd<ChildViewWatcherMarker>,
8862    ) -> Result<(), fidl::Error> {
8863        self.client.send::<FlatlandDisplaySetContentRequest>(
8864            (&mut token, child_view_watcher),
8865            0x6748193a39918298,
8866            fidl::encoding::DynamicFlags::empty(),
8867        )
8868    }
8869
8870    /// Sets the ratio of display's physical pixels to device independent pixels that should be used
8871    /// for the tree of Flatland content that are attached to this display. See
8872    /// [`LayoutInfo.device_pixel_ratio`] for details.
8873    ///
8874    /// The default value is (1.0, 1.0). The valid values are 1.0 and above.
8875    pub fn r#set_device_pixel_ratio(
8876        &self,
8877        mut device_pixel_ratio: &fidl_fuchsia_math::VecF,
8878    ) -> Result<(), fidl::Error> {
8879        self.client.send::<FlatlandDisplaySetDevicePixelRatioRequest>(
8880            (device_pixel_ratio,),
8881            0x392c3e70cc0a81a4,
8882            fidl::encoding::DynamicFlags::empty(),
8883        )
8884    }
8885}
8886
8887#[cfg(target_os = "fuchsia")]
8888impl From<FlatlandDisplaySynchronousProxy> for zx::NullableHandle {
8889    fn from(value: FlatlandDisplaySynchronousProxy) -> Self {
8890        value.into_channel().into()
8891    }
8892}
8893
8894#[cfg(target_os = "fuchsia")]
8895impl From<fidl::Channel> for FlatlandDisplaySynchronousProxy {
8896    fn from(value: fidl::Channel) -> Self {
8897        Self::new(value)
8898    }
8899}
8900
8901#[cfg(target_os = "fuchsia")]
8902impl fidl::endpoints::FromClient for FlatlandDisplaySynchronousProxy {
8903    type Protocol = FlatlandDisplayMarker;
8904
8905    fn from_client(value: fidl::endpoints::ClientEnd<FlatlandDisplayMarker>) -> Self {
8906        Self::new(value.into_channel())
8907    }
8908}
8909
8910#[derive(Debug, Clone)]
8911pub struct FlatlandDisplayProxy {
8912    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
8913}
8914
8915impl fidl::endpoints::Proxy for FlatlandDisplayProxy {
8916    type Protocol = FlatlandDisplayMarker;
8917
8918    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
8919        Self::new(inner)
8920    }
8921
8922    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
8923        self.client.into_channel().map_err(|client| Self { client })
8924    }
8925
8926    fn as_channel(&self) -> &::fidl::AsyncChannel {
8927        self.client.as_channel()
8928    }
8929}
8930
8931impl FlatlandDisplayProxy {
8932    /// Create a new Proxy for fuchsia.ui.composition/FlatlandDisplay.
8933    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
8934        let protocol_name = <FlatlandDisplayMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
8935        Self { client: fidl::client::Client::new(channel, protocol_name) }
8936    }
8937
8938    /// Get a Stream of events from the remote end of the protocol.
8939    ///
8940    /// # Panics
8941    ///
8942    /// Panics if the event stream was already taken.
8943    pub fn take_event_stream(&self) -> FlatlandDisplayEventStream {
8944        FlatlandDisplayEventStream { event_receiver: self.client.take_event_receiver() }
8945    }
8946
8947    pub fn r#set_content(
8948        &self,
8949        mut token: fidl_fuchsia_ui_views::ViewportCreationToken,
8950        mut child_view_watcher: fidl::endpoints::ServerEnd<ChildViewWatcherMarker>,
8951    ) -> Result<(), fidl::Error> {
8952        FlatlandDisplayProxyInterface::r#set_content(self, token, child_view_watcher)
8953    }
8954
8955    /// Sets the ratio of display's physical pixels to device independent pixels that should be used
8956    /// for the tree of Flatland content that are attached to this display. See
8957    /// [`LayoutInfo.device_pixel_ratio`] for details.
8958    ///
8959    /// The default value is (1.0, 1.0). The valid values are 1.0 and above.
8960    pub fn r#set_device_pixel_ratio(
8961        &self,
8962        mut device_pixel_ratio: &fidl_fuchsia_math::VecF,
8963    ) -> Result<(), fidl::Error> {
8964        FlatlandDisplayProxyInterface::r#set_device_pixel_ratio(self, device_pixel_ratio)
8965    }
8966}
8967
8968impl FlatlandDisplayProxyInterface for FlatlandDisplayProxy {
8969    fn r#set_content(
8970        &self,
8971        mut token: fidl_fuchsia_ui_views::ViewportCreationToken,
8972        mut child_view_watcher: fidl::endpoints::ServerEnd<ChildViewWatcherMarker>,
8973    ) -> Result<(), fidl::Error> {
8974        self.client.send::<FlatlandDisplaySetContentRequest>(
8975            (&mut token, child_view_watcher),
8976            0x6748193a39918298,
8977            fidl::encoding::DynamicFlags::empty(),
8978        )
8979    }
8980
8981    fn r#set_device_pixel_ratio(
8982        &self,
8983        mut device_pixel_ratio: &fidl_fuchsia_math::VecF,
8984    ) -> Result<(), fidl::Error> {
8985        self.client.send::<FlatlandDisplaySetDevicePixelRatioRequest>(
8986            (device_pixel_ratio,),
8987            0x392c3e70cc0a81a4,
8988            fidl::encoding::DynamicFlags::empty(),
8989        )
8990    }
8991}
8992
8993pub struct FlatlandDisplayEventStream {
8994    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
8995}
8996
8997impl std::marker::Unpin for FlatlandDisplayEventStream {}
8998
8999impl futures::stream::FusedStream for FlatlandDisplayEventStream {
9000    fn is_terminated(&self) -> bool {
9001        self.event_receiver.is_terminated()
9002    }
9003}
9004
9005impl futures::Stream for FlatlandDisplayEventStream {
9006    type Item = Result<FlatlandDisplayEvent, fidl::Error>;
9007
9008    fn poll_next(
9009        mut self: std::pin::Pin<&mut Self>,
9010        cx: &mut std::task::Context<'_>,
9011    ) -> std::task::Poll<Option<Self::Item>> {
9012        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
9013            &mut self.event_receiver,
9014            cx
9015        )?) {
9016            Some(buf) => std::task::Poll::Ready(Some(FlatlandDisplayEvent::decode(buf))),
9017            None => std::task::Poll::Ready(None),
9018        }
9019    }
9020}
9021
9022#[derive(Debug)]
9023pub enum FlatlandDisplayEvent {}
9024
9025impl FlatlandDisplayEvent {
9026    /// Decodes a message buffer as a [`FlatlandDisplayEvent`].
9027    fn decode(
9028        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
9029    ) -> Result<FlatlandDisplayEvent, fidl::Error> {
9030        let (bytes, _handles) = buf.split_mut();
9031        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
9032        debug_assert_eq!(tx_header.tx_id, 0);
9033        match tx_header.ordinal {
9034            _ => Err(fidl::Error::UnknownOrdinal {
9035                ordinal: tx_header.ordinal,
9036                protocol_name:
9037                    <FlatlandDisplayMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
9038            }),
9039        }
9040    }
9041}
9042
9043/// A Stream of incoming requests for fuchsia.ui.composition/FlatlandDisplay.
9044pub struct FlatlandDisplayRequestStream {
9045    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
9046    is_terminated: bool,
9047}
9048
9049impl std::marker::Unpin for FlatlandDisplayRequestStream {}
9050
9051impl futures::stream::FusedStream for FlatlandDisplayRequestStream {
9052    fn is_terminated(&self) -> bool {
9053        self.is_terminated
9054    }
9055}
9056
9057impl fidl::endpoints::RequestStream for FlatlandDisplayRequestStream {
9058    type Protocol = FlatlandDisplayMarker;
9059    type ControlHandle = FlatlandDisplayControlHandle;
9060
9061    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
9062        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
9063    }
9064
9065    fn control_handle(&self) -> Self::ControlHandle {
9066        FlatlandDisplayControlHandle { inner: self.inner.clone() }
9067    }
9068
9069    fn into_inner(
9070        self,
9071    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
9072    {
9073        (self.inner, self.is_terminated)
9074    }
9075
9076    fn from_inner(
9077        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
9078        is_terminated: bool,
9079    ) -> Self {
9080        Self { inner, is_terminated }
9081    }
9082}
9083
9084impl futures::Stream for FlatlandDisplayRequestStream {
9085    type Item = Result<FlatlandDisplayRequest, fidl::Error>;
9086
9087    fn poll_next(
9088        mut self: std::pin::Pin<&mut Self>,
9089        cx: &mut std::task::Context<'_>,
9090    ) -> std::task::Poll<Option<Self::Item>> {
9091        let this = &mut *self;
9092        if this.inner.check_shutdown(cx) {
9093            this.is_terminated = true;
9094            return std::task::Poll::Ready(None);
9095        }
9096        if this.is_terminated {
9097            panic!("polled FlatlandDisplayRequestStream after completion");
9098        }
9099        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
9100            |bytes, handles| {
9101                match this.inner.channel().read_etc(cx, bytes, handles) {
9102                    std::task::Poll::Ready(Ok(())) => {}
9103                    std::task::Poll::Pending => return std::task::Poll::Pending,
9104                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
9105                        this.is_terminated = true;
9106                        return std::task::Poll::Ready(None);
9107                    }
9108                    std::task::Poll::Ready(Err(e)) => {
9109                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
9110                            e.into(),
9111                        ))));
9112                    }
9113                }
9114
9115                // A message has been received from the channel
9116                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
9117
9118                std::task::Poll::Ready(Some(match header.ordinal {
9119                    0x6748193a39918298 => {
9120                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
9121                        let mut req = fidl::new_empty!(
9122                            FlatlandDisplaySetContentRequest,
9123                            fidl::encoding::DefaultFuchsiaResourceDialect
9124                        );
9125                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandDisplaySetContentRequest>(&header, _body_bytes, handles, &mut req)?;
9126                        let control_handle =
9127                            FlatlandDisplayControlHandle { inner: this.inner.clone() };
9128                        Ok(FlatlandDisplayRequest::SetContent {
9129                            token: req.token,
9130                            child_view_watcher: req.child_view_watcher,
9131
9132                            control_handle,
9133                        })
9134                    }
9135                    0x392c3e70cc0a81a4 => {
9136                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
9137                        let mut req = fidl::new_empty!(
9138                            FlatlandDisplaySetDevicePixelRatioRequest,
9139                            fidl::encoding::DefaultFuchsiaResourceDialect
9140                        );
9141                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandDisplaySetDevicePixelRatioRequest>(&header, _body_bytes, handles, &mut req)?;
9142                        let control_handle =
9143                            FlatlandDisplayControlHandle { inner: this.inner.clone() };
9144                        Ok(FlatlandDisplayRequest::SetDevicePixelRatio {
9145                            device_pixel_ratio: req.device_pixel_ratio,
9146
9147                            control_handle,
9148                        })
9149                    }
9150                    _ => Err(fidl::Error::UnknownOrdinal {
9151                        ordinal: header.ordinal,
9152                        protocol_name:
9153                            <FlatlandDisplayMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
9154                    }),
9155                }))
9156            },
9157        )
9158    }
9159}
9160
9161/// This API connects to the singleton "primary display", and allows a tree of Flatland content to
9162/// be attached underneath.  Only one FlatlandDisplay client connection is allowed at one time.
9163#[derive(Debug)]
9164pub enum FlatlandDisplayRequest {
9165    SetContent {
9166        token: fidl_fuchsia_ui_views::ViewportCreationToken,
9167        child_view_watcher: fidl::endpoints::ServerEnd<ChildViewWatcherMarker>,
9168        control_handle: FlatlandDisplayControlHandle,
9169    },
9170    /// Sets the ratio of display's physical pixels to device independent pixels that should be used
9171    /// for the tree of Flatland content that are attached to this display. See
9172    /// [`LayoutInfo.device_pixel_ratio`] for details.
9173    ///
9174    /// The default value is (1.0, 1.0). The valid values are 1.0 and above.
9175    SetDevicePixelRatio {
9176        device_pixel_ratio: fidl_fuchsia_math::VecF,
9177        control_handle: FlatlandDisplayControlHandle,
9178    },
9179}
9180
9181impl FlatlandDisplayRequest {
9182    #[allow(irrefutable_let_patterns)]
9183    pub fn into_set_content(
9184        self,
9185    ) -> Option<(
9186        fidl_fuchsia_ui_views::ViewportCreationToken,
9187        fidl::endpoints::ServerEnd<ChildViewWatcherMarker>,
9188        FlatlandDisplayControlHandle,
9189    )> {
9190        if let FlatlandDisplayRequest::SetContent { token, child_view_watcher, control_handle } =
9191            self
9192        {
9193            Some((token, child_view_watcher, control_handle))
9194        } else {
9195            None
9196        }
9197    }
9198
9199    #[allow(irrefutable_let_patterns)]
9200    pub fn into_set_device_pixel_ratio(
9201        self,
9202    ) -> Option<(fidl_fuchsia_math::VecF, FlatlandDisplayControlHandle)> {
9203        if let FlatlandDisplayRequest::SetDevicePixelRatio { device_pixel_ratio, control_handle } =
9204            self
9205        {
9206            Some((device_pixel_ratio, control_handle))
9207        } else {
9208            None
9209        }
9210    }
9211
9212    /// Name of the method defined in FIDL
9213    pub fn method_name(&self) -> &'static str {
9214        match *self {
9215            FlatlandDisplayRequest::SetContent { .. } => "set_content",
9216            FlatlandDisplayRequest::SetDevicePixelRatio { .. } => "set_device_pixel_ratio",
9217        }
9218    }
9219}
9220
9221#[derive(Debug, Clone)]
9222pub struct FlatlandDisplayControlHandle {
9223    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
9224}
9225
9226impl FlatlandDisplayControlHandle {
9227    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
9228        self.inner.shutdown_with_epitaph(status.into())
9229    }
9230}
9231
9232impl fidl::endpoints::ControlHandle for FlatlandDisplayControlHandle {
9233    fn shutdown(&self) {
9234        self.inner.shutdown()
9235    }
9236
9237    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
9238        self.inner.shutdown_with_epitaph(status)
9239    }
9240
9241    fn is_closed(&self) -> bool {
9242        self.inner.channel().is_closed()
9243    }
9244    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
9245        self.inner.channel().on_closed()
9246    }
9247
9248    #[cfg(target_os = "fuchsia")]
9249    fn signal_peer(
9250        &self,
9251        clear_mask: zx::Signals,
9252        set_mask: zx::Signals,
9253    ) -> Result<(), zx_status::Status> {
9254        use fidl::Peered;
9255        self.inner.channel().signal_peer(clear_mask, set_mask)
9256    }
9257}
9258
9259impl FlatlandDisplayControlHandle {}
9260
9261#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
9262pub struct FlatlandFactoryMarker;
9263
9264impl fidl::endpoints::ProtocolMarker for FlatlandFactoryMarker {
9265    type Proxy = FlatlandFactoryProxy;
9266    type RequestStream = FlatlandFactoryRequestStream;
9267    #[cfg(target_os = "fuchsia")]
9268    type SynchronousProxy = FlatlandFactorySynchronousProxy;
9269
9270    const DEBUG_NAME: &'static str = "fuchsia.ui.composition.FlatlandFactory";
9271}
9272impl fidl::endpoints::DiscoverableProtocolMarker for FlatlandFactoryMarker {}
9273pub type FlatlandFactoryCreateFlatlandResult = Result<(), FlatlandFactoryError>;
9274
9275pub trait FlatlandFactoryProxyInterface: Send + Sync {
9276    type CreateFlatlandResponseFut: std::future::Future<Output = Result<FlatlandFactoryCreateFlatlandResult, fidl::Error>>
9277        + Send;
9278    fn r#create_flatland(
9279        &self,
9280        server_end: fidl::endpoints::ServerEnd<FlatlandMarker>,
9281        config: &FlatlandConfig,
9282    ) -> Self::CreateFlatlandResponseFut;
9283}
9284#[derive(Debug)]
9285#[cfg(target_os = "fuchsia")]
9286pub struct FlatlandFactorySynchronousProxy {
9287    client: fidl::client::sync::Client,
9288}
9289
9290#[cfg(target_os = "fuchsia")]
9291impl fidl::endpoints::SynchronousProxy for FlatlandFactorySynchronousProxy {
9292    type Proxy = FlatlandFactoryProxy;
9293    type Protocol = FlatlandFactoryMarker;
9294
9295    fn from_channel(inner: fidl::Channel) -> Self {
9296        Self::new(inner)
9297    }
9298
9299    fn into_channel(self) -> fidl::Channel {
9300        self.client.into_channel()
9301    }
9302
9303    fn as_channel(&self) -> &fidl::Channel {
9304        self.client.as_channel()
9305    }
9306}
9307
9308#[cfg(target_os = "fuchsia")]
9309impl FlatlandFactorySynchronousProxy {
9310    pub fn new(channel: fidl::Channel) -> Self {
9311        Self { client: fidl::client::sync::Client::new(channel) }
9312    }
9313
9314    pub fn into_channel(self) -> fidl::Channel {
9315        self.client.into_channel()
9316    }
9317
9318    /// Waits until an event arrives and returns it. It is safe for other
9319    /// threads to make concurrent requests while waiting for an event.
9320    pub fn wait_for_event(
9321        &self,
9322        deadline: zx::MonotonicInstant,
9323    ) -> Result<FlatlandFactoryEvent, fidl::Error> {
9324        FlatlandFactoryEvent::decode(self.client.wait_for_event::<FlatlandFactoryMarker>(deadline)?)
9325    }
9326
9327    /// Creates a new Flatland session with the specified configuration.
9328    ///
9329    /// Clients should optimistically assume connection success and immediately begin pipelining
9330    /// [`fuchsia.ui.composition/Flatland`] requests without waiting for this method to return.
9331    /// If session creation fails, the [`fuchsia.ui.composition/FlatlandFactory`] server closes the
9332    /// `Flatland` session channel and returns a [`fuchsia.ui.composition/FlatlandFactoryError`].
9333    /// Clients should asynchronously handle this failure and discard their `Flatland` client
9334    /// endpoint.
9335    ///
9336    /// ## Error
9337    ///
9338    /// Returns a `FlatlandFactoryError` if the operation fails.
9339    pub fn r#create_flatland(
9340        &self,
9341        mut server_end: fidl::endpoints::ServerEnd<FlatlandMarker>,
9342        mut config: &FlatlandConfig,
9343        ___deadline: zx::MonotonicInstant,
9344    ) -> Result<FlatlandFactoryCreateFlatlandResult, fidl::Error> {
9345        let _response = self.client.send_query::<
9346            FlatlandFactoryCreateFlatlandRequest,
9347            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, FlatlandFactoryError>,
9348            FlatlandFactoryMarker,
9349        >(
9350            (server_end, config,),
9351            0x5de80d9d7239b37e,
9352            fidl::encoding::DynamicFlags::empty(),
9353            ___deadline,
9354        )?;
9355        Ok(_response.map(|x| x))
9356    }
9357}
9358
9359#[cfg(target_os = "fuchsia")]
9360impl From<FlatlandFactorySynchronousProxy> for zx::NullableHandle {
9361    fn from(value: FlatlandFactorySynchronousProxy) -> Self {
9362        value.into_channel().into()
9363    }
9364}
9365
9366#[cfg(target_os = "fuchsia")]
9367impl From<fidl::Channel> for FlatlandFactorySynchronousProxy {
9368    fn from(value: fidl::Channel) -> Self {
9369        Self::new(value)
9370    }
9371}
9372
9373#[cfg(target_os = "fuchsia")]
9374impl fidl::endpoints::FromClient for FlatlandFactorySynchronousProxy {
9375    type Protocol = FlatlandFactoryMarker;
9376
9377    fn from_client(value: fidl::endpoints::ClientEnd<FlatlandFactoryMarker>) -> Self {
9378        Self::new(value.into_channel())
9379    }
9380}
9381
9382#[derive(Debug, Clone)]
9383pub struct FlatlandFactoryProxy {
9384    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
9385}
9386
9387impl fidl::endpoints::Proxy for FlatlandFactoryProxy {
9388    type Protocol = FlatlandFactoryMarker;
9389
9390    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
9391        Self::new(inner)
9392    }
9393
9394    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
9395        self.client.into_channel().map_err(|client| Self { client })
9396    }
9397
9398    fn as_channel(&self) -> &::fidl::AsyncChannel {
9399        self.client.as_channel()
9400    }
9401}
9402
9403impl FlatlandFactoryProxy {
9404    /// Create a new Proxy for fuchsia.ui.composition/FlatlandFactory.
9405    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
9406        let protocol_name = <FlatlandFactoryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
9407        Self { client: fidl::client::Client::new(channel, protocol_name) }
9408    }
9409
9410    /// Get a Stream of events from the remote end of the protocol.
9411    ///
9412    /// # Panics
9413    ///
9414    /// Panics if the event stream was already taken.
9415    pub fn take_event_stream(&self) -> FlatlandFactoryEventStream {
9416        FlatlandFactoryEventStream { event_receiver: self.client.take_event_receiver() }
9417    }
9418
9419    /// Creates a new Flatland session with the specified configuration.
9420    ///
9421    /// Clients should optimistically assume connection success and immediately begin pipelining
9422    /// [`fuchsia.ui.composition/Flatland`] requests without waiting for this method to return.
9423    /// If session creation fails, the [`fuchsia.ui.composition/FlatlandFactory`] server closes the
9424    /// `Flatland` session channel and returns a [`fuchsia.ui.composition/FlatlandFactoryError`].
9425    /// Clients should asynchronously handle this failure and discard their `Flatland` client
9426    /// endpoint.
9427    ///
9428    /// ## Error
9429    ///
9430    /// Returns a `FlatlandFactoryError` if the operation fails.
9431    pub fn r#create_flatland(
9432        &self,
9433        mut server_end: fidl::endpoints::ServerEnd<FlatlandMarker>,
9434        mut config: &FlatlandConfig,
9435    ) -> fidl::client::QueryResponseFut<
9436        FlatlandFactoryCreateFlatlandResult,
9437        fidl::encoding::DefaultFuchsiaResourceDialect,
9438    > {
9439        FlatlandFactoryProxyInterface::r#create_flatland(self, server_end, config)
9440    }
9441}
9442
9443impl FlatlandFactoryProxyInterface for FlatlandFactoryProxy {
9444    type CreateFlatlandResponseFut = fidl::client::QueryResponseFut<
9445        FlatlandFactoryCreateFlatlandResult,
9446        fidl::encoding::DefaultFuchsiaResourceDialect,
9447    >;
9448    fn r#create_flatland(
9449        &self,
9450        mut server_end: fidl::endpoints::ServerEnd<FlatlandMarker>,
9451        mut config: &FlatlandConfig,
9452    ) -> Self::CreateFlatlandResponseFut {
9453        fn _decode(
9454            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
9455        ) -> Result<FlatlandFactoryCreateFlatlandResult, fidl::Error> {
9456            let _response = fidl::client::decode_transaction_body::<
9457                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, FlatlandFactoryError>,
9458                fidl::encoding::DefaultFuchsiaResourceDialect,
9459                0x5de80d9d7239b37e,
9460            >(_buf?)?;
9461            Ok(_response.map(|x| x))
9462        }
9463        self.client.send_query_and_decode::<
9464            FlatlandFactoryCreateFlatlandRequest,
9465            FlatlandFactoryCreateFlatlandResult,
9466        >(
9467            (server_end, config,),
9468            0x5de80d9d7239b37e,
9469            fidl::encoding::DynamicFlags::empty(),
9470            _decode,
9471        )
9472    }
9473}
9474
9475pub struct FlatlandFactoryEventStream {
9476    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
9477}
9478
9479impl std::marker::Unpin for FlatlandFactoryEventStream {}
9480
9481impl futures::stream::FusedStream for FlatlandFactoryEventStream {
9482    fn is_terminated(&self) -> bool {
9483        self.event_receiver.is_terminated()
9484    }
9485}
9486
9487impl futures::Stream for FlatlandFactoryEventStream {
9488    type Item = Result<FlatlandFactoryEvent, fidl::Error>;
9489
9490    fn poll_next(
9491        mut self: std::pin::Pin<&mut Self>,
9492        cx: &mut std::task::Context<'_>,
9493    ) -> std::task::Poll<Option<Self::Item>> {
9494        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
9495            &mut self.event_receiver,
9496            cx
9497        )?) {
9498            Some(buf) => std::task::Poll::Ready(Some(FlatlandFactoryEvent::decode(buf))),
9499            None => std::task::Poll::Ready(None),
9500        }
9501    }
9502}
9503
9504#[derive(Debug)]
9505pub enum FlatlandFactoryEvent {}
9506
9507impl FlatlandFactoryEvent {
9508    /// Decodes a message buffer as a [`FlatlandFactoryEvent`].
9509    fn decode(
9510        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
9511    ) -> Result<FlatlandFactoryEvent, fidl::Error> {
9512        let (bytes, _handles) = buf.split_mut();
9513        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
9514        debug_assert_eq!(tx_header.tx_id, 0);
9515        match tx_header.ordinal {
9516            _ => Err(fidl::Error::UnknownOrdinal {
9517                ordinal: tx_header.ordinal,
9518                protocol_name:
9519                    <FlatlandFactoryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
9520            }),
9521        }
9522    }
9523}
9524
9525/// A Stream of incoming requests for fuchsia.ui.composition/FlatlandFactory.
9526pub struct FlatlandFactoryRequestStream {
9527    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
9528    is_terminated: bool,
9529}
9530
9531impl std::marker::Unpin for FlatlandFactoryRequestStream {}
9532
9533impl futures::stream::FusedStream for FlatlandFactoryRequestStream {
9534    fn is_terminated(&self) -> bool {
9535        self.is_terminated
9536    }
9537}
9538
9539impl fidl::endpoints::RequestStream for FlatlandFactoryRequestStream {
9540    type Protocol = FlatlandFactoryMarker;
9541    type ControlHandle = FlatlandFactoryControlHandle;
9542
9543    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
9544        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
9545    }
9546
9547    fn control_handle(&self) -> Self::ControlHandle {
9548        FlatlandFactoryControlHandle { inner: self.inner.clone() }
9549    }
9550
9551    fn into_inner(
9552        self,
9553    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
9554    {
9555        (self.inner, self.is_terminated)
9556    }
9557
9558    fn from_inner(
9559        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
9560        is_terminated: bool,
9561    ) -> Self {
9562        Self { inner, is_terminated }
9563    }
9564}
9565
9566impl futures::Stream for FlatlandFactoryRequestStream {
9567    type Item = Result<FlatlandFactoryRequest, fidl::Error>;
9568
9569    fn poll_next(
9570        mut self: std::pin::Pin<&mut Self>,
9571        cx: &mut std::task::Context<'_>,
9572    ) -> std::task::Poll<Option<Self::Item>> {
9573        let this = &mut *self;
9574        if this.inner.check_shutdown(cx) {
9575            this.is_terminated = true;
9576            return std::task::Poll::Ready(None);
9577        }
9578        if this.is_terminated {
9579            panic!("polled FlatlandFactoryRequestStream after completion");
9580        }
9581        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
9582            |bytes, handles| {
9583                match this.inner.channel().read_etc(cx, bytes, handles) {
9584                    std::task::Poll::Ready(Ok(())) => {}
9585                    std::task::Poll::Pending => return std::task::Poll::Pending,
9586                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
9587                        this.is_terminated = true;
9588                        return std::task::Poll::Ready(None);
9589                    }
9590                    std::task::Poll::Ready(Err(e)) => {
9591                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
9592                            e.into(),
9593                        ))));
9594                    }
9595                }
9596
9597                // A message has been received from the channel
9598                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
9599
9600                std::task::Poll::Ready(Some(match header.ordinal {
9601                    0x5de80d9d7239b37e => {
9602                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
9603                        let mut req = fidl::new_empty!(
9604                            FlatlandFactoryCreateFlatlandRequest,
9605                            fidl::encoding::DefaultFuchsiaResourceDialect
9606                        );
9607                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandFactoryCreateFlatlandRequest>(&header, _body_bytes, handles, &mut req)?;
9608                        let control_handle =
9609                            FlatlandFactoryControlHandle { inner: this.inner.clone() };
9610                        Ok(FlatlandFactoryRequest::CreateFlatland {
9611                            server_end: req.server_end,
9612                            config: req.config,
9613
9614                            responder: FlatlandFactoryCreateFlatlandResponder {
9615                                control_handle: std::mem::ManuallyDrop::new(control_handle),
9616                                tx_id: header.tx_id,
9617                            },
9618                        })
9619                    }
9620                    _ => Err(fidl::Error::UnknownOrdinal {
9621                        ordinal: header.ordinal,
9622                        protocol_name:
9623                            <FlatlandFactoryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
9624                    }),
9625                }))
9626            },
9627        )
9628    }
9629}
9630
9631/// Factory protocol for spawning regular (untrusted) Flatland sessions.
9632#[derive(Debug)]
9633pub enum FlatlandFactoryRequest {
9634    /// Creates a new Flatland session with the specified configuration.
9635    ///
9636    /// Clients should optimistically assume connection success and immediately begin pipelining
9637    /// [`fuchsia.ui.composition/Flatland`] requests without waiting for this method to return.
9638    /// If session creation fails, the [`fuchsia.ui.composition/FlatlandFactory`] server closes the
9639    /// `Flatland` session channel and returns a [`fuchsia.ui.composition/FlatlandFactoryError`].
9640    /// Clients should asynchronously handle this failure and discard their `Flatland` client
9641    /// endpoint.
9642    ///
9643    /// ## Error
9644    ///
9645    /// Returns a `FlatlandFactoryError` if the operation fails.
9646    CreateFlatland {
9647        server_end: fidl::endpoints::ServerEnd<FlatlandMarker>,
9648        config: FlatlandConfig,
9649        responder: FlatlandFactoryCreateFlatlandResponder,
9650    },
9651}
9652
9653impl FlatlandFactoryRequest {
9654    #[allow(irrefutable_let_patterns)]
9655    pub fn into_create_flatland(
9656        self,
9657    ) -> Option<(
9658        fidl::endpoints::ServerEnd<FlatlandMarker>,
9659        FlatlandConfig,
9660        FlatlandFactoryCreateFlatlandResponder,
9661    )> {
9662        if let FlatlandFactoryRequest::CreateFlatland { server_end, config, responder } = self {
9663            Some((server_end, config, responder))
9664        } else {
9665            None
9666        }
9667    }
9668
9669    /// Name of the method defined in FIDL
9670    pub fn method_name(&self) -> &'static str {
9671        match *self {
9672            FlatlandFactoryRequest::CreateFlatland { .. } => "create_flatland",
9673        }
9674    }
9675}
9676
9677#[derive(Debug, Clone)]
9678pub struct FlatlandFactoryControlHandle {
9679    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
9680}
9681
9682impl FlatlandFactoryControlHandle {
9683    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
9684        self.inner.shutdown_with_epitaph(status.into())
9685    }
9686}
9687
9688impl fidl::endpoints::ControlHandle for FlatlandFactoryControlHandle {
9689    fn shutdown(&self) {
9690        self.inner.shutdown()
9691    }
9692
9693    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
9694        self.inner.shutdown_with_epitaph(status)
9695    }
9696
9697    fn is_closed(&self) -> bool {
9698        self.inner.channel().is_closed()
9699    }
9700    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
9701        self.inner.channel().on_closed()
9702    }
9703
9704    #[cfg(target_os = "fuchsia")]
9705    fn signal_peer(
9706        &self,
9707        clear_mask: zx::Signals,
9708        set_mask: zx::Signals,
9709    ) -> Result<(), zx_status::Status> {
9710        use fidl::Peered;
9711        self.inner.channel().signal_peer(clear_mask, set_mask)
9712    }
9713}
9714
9715impl FlatlandFactoryControlHandle {}
9716
9717#[must_use = "FIDL methods require a response to be sent"]
9718#[derive(Debug)]
9719pub struct FlatlandFactoryCreateFlatlandResponder {
9720    control_handle: std::mem::ManuallyDrop<FlatlandFactoryControlHandle>,
9721    tx_id: u32,
9722}
9723
9724/// Set the the channel to be shutdown (see [`FlatlandFactoryControlHandle::shutdown`])
9725/// if the responder is dropped without sending a response, so that the client
9726/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
9727impl std::ops::Drop for FlatlandFactoryCreateFlatlandResponder {
9728    fn drop(&mut self) {
9729        self.control_handle.shutdown();
9730        // Safety: drops once, never accessed again
9731        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9732    }
9733}
9734
9735impl fidl::endpoints::Responder for FlatlandFactoryCreateFlatlandResponder {
9736    type ControlHandle = FlatlandFactoryControlHandle;
9737
9738    fn control_handle(&self) -> &FlatlandFactoryControlHandle {
9739        &self.control_handle
9740    }
9741
9742    fn drop_without_shutdown(mut self) {
9743        // Safety: drops once, never accessed again due to mem::forget
9744        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9745        // Prevent Drop from running (which would shut down the channel)
9746        std::mem::forget(self);
9747    }
9748}
9749
9750impl FlatlandFactoryCreateFlatlandResponder {
9751    /// Sends a response to the FIDL transaction.
9752    ///
9753    /// Sets the channel to shutdown if an error occurs.
9754    pub fn send(self, mut result: Result<(), FlatlandFactoryError>) -> Result<(), fidl::Error> {
9755        let _result = self.send_raw(result);
9756        if _result.is_err() {
9757            self.control_handle.shutdown();
9758        }
9759        self.drop_without_shutdown();
9760        _result
9761    }
9762
9763    /// Similar to "send" but does not shutdown the channel if an error occurs.
9764    pub fn send_no_shutdown_on_err(
9765        self,
9766        mut result: Result<(), FlatlandFactoryError>,
9767    ) -> Result<(), fidl::Error> {
9768        let _result = self.send_raw(result);
9769        self.drop_without_shutdown();
9770        _result
9771    }
9772
9773    fn send_raw(&self, mut result: Result<(), FlatlandFactoryError>) -> Result<(), fidl::Error> {
9774        self.control_handle.inner.send::<fidl::encoding::ResultType<
9775            fidl::encoding::EmptyStruct,
9776            FlatlandFactoryError,
9777        >>(
9778            result,
9779            self.tx_id,
9780            0x5de80d9d7239b37e,
9781            fidl::encoding::DynamicFlags::empty(),
9782        )
9783    }
9784}
9785
9786#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
9787pub struct ParentViewportWatcherMarker;
9788
9789impl fidl::endpoints::ProtocolMarker for ParentViewportWatcherMarker {
9790    type Proxy = ParentViewportWatcherProxy;
9791    type RequestStream = ParentViewportWatcherRequestStream;
9792    #[cfg(target_os = "fuchsia")]
9793    type SynchronousProxy = ParentViewportWatcherSynchronousProxy;
9794
9795    const DEBUG_NAME: &'static str = "(anonymous) ParentViewportWatcher";
9796}
9797
9798pub trait ParentViewportWatcherProxyInterface: Send + Sync {
9799    type GetLayoutResponseFut: std::future::Future<Output = Result<LayoutInfo, fidl::Error>> + Send;
9800    fn r#get_layout(&self) -> Self::GetLayoutResponseFut;
9801    type GetStatusResponseFut: std::future::Future<Output = Result<ParentViewportStatus, fidl::Error>>
9802        + Send;
9803    fn r#get_status(&self) -> Self::GetStatusResponseFut;
9804}
9805#[derive(Debug)]
9806#[cfg(target_os = "fuchsia")]
9807pub struct ParentViewportWatcherSynchronousProxy {
9808    client: fidl::client::sync::Client,
9809}
9810
9811#[cfg(target_os = "fuchsia")]
9812impl fidl::endpoints::SynchronousProxy for ParentViewportWatcherSynchronousProxy {
9813    type Proxy = ParentViewportWatcherProxy;
9814    type Protocol = ParentViewportWatcherMarker;
9815
9816    fn from_channel(inner: fidl::Channel) -> Self {
9817        Self::new(inner)
9818    }
9819
9820    fn into_channel(self) -> fidl::Channel {
9821        self.client.into_channel()
9822    }
9823
9824    fn as_channel(&self) -> &fidl::Channel {
9825        self.client.as_channel()
9826    }
9827}
9828
9829#[cfg(target_os = "fuchsia")]
9830impl ParentViewportWatcherSynchronousProxy {
9831    pub fn new(channel: fidl::Channel) -> Self {
9832        Self { client: fidl::client::sync::Client::new(channel) }
9833    }
9834
9835    pub fn into_channel(self) -> fidl::Channel {
9836        self.client.into_channel()
9837    }
9838
9839    /// Waits until an event arrives and returns it. It is safe for other
9840    /// threads to make concurrent requests while waiting for an event.
9841    pub fn wait_for_event(
9842        &self,
9843        deadline: zx::MonotonicInstant,
9844    ) -> Result<ParentViewportWatcherEvent, fidl::Error> {
9845        ParentViewportWatcherEvent::decode(
9846            self.client.wait_for_event::<ParentViewportWatcherMarker>(deadline)?,
9847        )
9848    }
9849
9850    /// A hanging get for receiving layout information. Clients may receive layout information
9851    /// before the ParentViewportWatcher operation has been presented. This allows children to
9852    /// layout their content before their first call to [`Present`]. In transition cases where two
9853    /// ParentViewportWatcher channels exist at the same time, both protocol sessions will be
9854    /// receiving different layout information.
9855    ///
9856    /// This hanging get will only fire when the LayoutInfo is different than the previously
9857    /// returned LayoutInfo. Note that, since LayoutInfo is a table, only some fields may have
9858    /// changed.
9859    ///
9860    /// It is invalid to call `GetLayout` while a previous call is still pending. Doing so will
9861    /// cause both this channel and the Flatland channel that handed out ParentViewportWatcher to be
9862    /// closed.
9863    pub fn r#get_layout(
9864        &self,
9865        ___deadline: zx::MonotonicInstant,
9866    ) -> Result<LayoutInfo, fidl::Error> {
9867        let _response = self.client.send_query::<
9868            fidl::encoding::EmptyPayload,
9869            ParentViewportWatcherGetLayoutResponse,
9870            ParentViewportWatcherMarker,
9871        >(
9872            (),
9873            0x3cbe5d9638e032,
9874            fidl::encoding::DynamicFlags::empty(),
9875            ___deadline,
9876        )?;
9877        Ok(_response.info)
9878    }
9879
9880    /// A hanging get for receiving the status of the parent Viewport. This provides global
9881    /// connectivity information to the child.
9882    ///
9883    /// This hanging get will only fire when the ParentViewportStatus is different than the
9884    /// previously returned ParentViewportStatus.
9885    ///
9886    /// It is invalid to call `GetStatus` while a previous call is still pending. Doing so will
9887    /// cause both this channel and the Flatland channel that handed out ParentViewportWatcher to be
9888    /// closed.
9889    pub fn r#get_status(
9890        &self,
9891        ___deadline: zx::MonotonicInstant,
9892    ) -> Result<ParentViewportStatus, fidl::Error> {
9893        let _response = self.client.send_query::<
9894            fidl::encoding::EmptyPayload,
9895            ParentViewportWatcherGetStatusResponse,
9896            ParentViewportWatcherMarker,
9897        >(
9898            (),
9899            0x7caa022f050d9ea6,
9900            fidl::encoding::DynamicFlags::empty(),
9901            ___deadline,
9902        )?;
9903        Ok(_response.status)
9904    }
9905}
9906
9907#[cfg(target_os = "fuchsia")]
9908impl From<ParentViewportWatcherSynchronousProxy> for zx::NullableHandle {
9909    fn from(value: ParentViewportWatcherSynchronousProxy) -> Self {
9910        value.into_channel().into()
9911    }
9912}
9913
9914#[cfg(target_os = "fuchsia")]
9915impl From<fidl::Channel> for ParentViewportWatcherSynchronousProxy {
9916    fn from(value: fidl::Channel) -> Self {
9917        Self::new(value)
9918    }
9919}
9920
9921#[cfg(target_os = "fuchsia")]
9922impl fidl::endpoints::FromClient for ParentViewportWatcherSynchronousProxy {
9923    type Protocol = ParentViewportWatcherMarker;
9924
9925    fn from_client(value: fidl::endpoints::ClientEnd<ParentViewportWatcherMarker>) -> Self {
9926        Self::new(value.into_channel())
9927    }
9928}
9929
9930#[derive(Debug, Clone)]
9931pub struct ParentViewportWatcherProxy {
9932    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
9933}
9934
9935impl fidl::endpoints::Proxy for ParentViewportWatcherProxy {
9936    type Protocol = ParentViewportWatcherMarker;
9937
9938    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
9939        Self::new(inner)
9940    }
9941
9942    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
9943        self.client.into_channel().map_err(|client| Self { client })
9944    }
9945
9946    fn as_channel(&self) -> &::fidl::AsyncChannel {
9947        self.client.as_channel()
9948    }
9949}
9950
9951impl ParentViewportWatcherProxy {
9952    /// Create a new Proxy for fuchsia.ui.composition/ParentViewportWatcher.
9953    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
9954        let protocol_name =
9955            <ParentViewportWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
9956        Self { client: fidl::client::Client::new(channel, protocol_name) }
9957    }
9958
9959    /// Get a Stream of events from the remote end of the protocol.
9960    ///
9961    /// # Panics
9962    ///
9963    /// Panics if the event stream was already taken.
9964    pub fn take_event_stream(&self) -> ParentViewportWatcherEventStream {
9965        ParentViewportWatcherEventStream { event_receiver: self.client.take_event_receiver() }
9966    }
9967
9968    /// A hanging get for receiving layout information. Clients may receive layout information
9969    /// before the ParentViewportWatcher operation has been presented. This allows children to
9970    /// layout their content before their first call to [`Present`]. In transition cases where two
9971    /// ParentViewportWatcher channels exist at the same time, both protocol sessions will be
9972    /// receiving different layout information.
9973    ///
9974    /// This hanging get will only fire when the LayoutInfo is different than the previously
9975    /// returned LayoutInfo. Note that, since LayoutInfo is a table, only some fields may have
9976    /// changed.
9977    ///
9978    /// It is invalid to call `GetLayout` while a previous call is still pending. Doing so will
9979    /// cause both this channel and the Flatland channel that handed out ParentViewportWatcher to be
9980    /// closed.
9981    pub fn r#get_layout(
9982        &self,
9983    ) -> fidl::client::QueryResponseFut<LayoutInfo, fidl::encoding::DefaultFuchsiaResourceDialect>
9984    {
9985        ParentViewportWatcherProxyInterface::r#get_layout(self)
9986    }
9987
9988    /// A hanging get for receiving the status of the parent Viewport. This provides global
9989    /// connectivity information to the child.
9990    ///
9991    /// This hanging get will only fire when the ParentViewportStatus is different than the
9992    /// previously returned ParentViewportStatus.
9993    ///
9994    /// It is invalid to call `GetStatus` while a previous call is still pending. Doing so will
9995    /// cause both this channel and the Flatland channel that handed out ParentViewportWatcher to be
9996    /// closed.
9997    pub fn r#get_status(
9998        &self,
9999    ) -> fidl::client::QueryResponseFut<
10000        ParentViewportStatus,
10001        fidl::encoding::DefaultFuchsiaResourceDialect,
10002    > {
10003        ParentViewportWatcherProxyInterface::r#get_status(self)
10004    }
10005}
10006
10007impl ParentViewportWatcherProxyInterface for ParentViewportWatcherProxy {
10008    type GetLayoutResponseFut =
10009        fidl::client::QueryResponseFut<LayoutInfo, fidl::encoding::DefaultFuchsiaResourceDialect>;
10010    fn r#get_layout(&self) -> Self::GetLayoutResponseFut {
10011        fn _decode(
10012            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
10013        ) -> Result<LayoutInfo, fidl::Error> {
10014            let _response = fidl::client::decode_transaction_body::<
10015                ParentViewportWatcherGetLayoutResponse,
10016                fidl::encoding::DefaultFuchsiaResourceDialect,
10017                0x3cbe5d9638e032,
10018            >(_buf?)?;
10019            Ok(_response.info)
10020        }
10021        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, LayoutInfo>(
10022            (),
10023            0x3cbe5d9638e032,
10024            fidl::encoding::DynamicFlags::empty(),
10025            _decode,
10026        )
10027    }
10028
10029    type GetStatusResponseFut = fidl::client::QueryResponseFut<
10030        ParentViewportStatus,
10031        fidl::encoding::DefaultFuchsiaResourceDialect,
10032    >;
10033    fn r#get_status(&self) -> Self::GetStatusResponseFut {
10034        fn _decode(
10035            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
10036        ) -> Result<ParentViewportStatus, fidl::Error> {
10037            let _response = fidl::client::decode_transaction_body::<
10038                ParentViewportWatcherGetStatusResponse,
10039                fidl::encoding::DefaultFuchsiaResourceDialect,
10040                0x7caa022f050d9ea6,
10041            >(_buf?)?;
10042            Ok(_response.status)
10043        }
10044        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ParentViewportStatus>(
10045            (),
10046            0x7caa022f050d9ea6,
10047            fidl::encoding::DynamicFlags::empty(),
10048            _decode,
10049        )
10050    }
10051}
10052
10053pub struct ParentViewportWatcherEventStream {
10054    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
10055}
10056
10057impl std::marker::Unpin for ParentViewportWatcherEventStream {}
10058
10059impl futures::stream::FusedStream for ParentViewportWatcherEventStream {
10060    fn is_terminated(&self) -> bool {
10061        self.event_receiver.is_terminated()
10062    }
10063}
10064
10065impl futures::Stream for ParentViewportWatcherEventStream {
10066    type Item = Result<ParentViewportWatcherEvent, fidl::Error>;
10067
10068    fn poll_next(
10069        mut self: std::pin::Pin<&mut Self>,
10070        cx: &mut std::task::Context<'_>,
10071    ) -> std::task::Poll<Option<Self::Item>> {
10072        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
10073            &mut self.event_receiver,
10074            cx
10075        )?) {
10076            Some(buf) => std::task::Poll::Ready(Some(ParentViewportWatcherEvent::decode(buf))),
10077            None => std::task::Poll::Ready(None),
10078        }
10079    }
10080}
10081
10082#[derive(Debug)]
10083pub enum ParentViewportWatcherEvent {}
10084
10085impl ParentViewportWatcherEvent {
10086    /// Decodes a message buffer as a [`ParentViewportWatcherEvent`].
10087    fn decode(
10088        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
10089    ) -> Result<ParentViewportWatcherEvent, fidl::Error> {
10090        let (bytes, _handles) = buf.split_mut();
10091        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
10092        debug_assert_eq!(tx_header.tx_id, 0);
10093        match tx_header.ordinal {
10094            _ => Err(fidl::Error::UnknownOrdinal {
10095                ordinal: tx_header.ordinal,
10096                protocol_name:
10097                    <ParentViewportWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
10098            }),
10099        }
10100    }
10101}
10102
10103/// A Stream of incoming requests for fuchsia.ui.composition/ParentViewportWatcher.
10104pub struct ParentViewportWatcherRequestStream {
10105    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
10106    is_terminated: bool,
10107}
10108
10109impl std::marker::Unpin for ParentViewportWatcherRequestStream {}
10110
10111impl futures::stream::FusedStream for ParentViewportWatcherRequestStream {
10112    fn is_terminated(&self) -> bool {
10113        self.is_terminated
10114    }
10115}
10116
10117impl fidl::endpoints::RequestStream for ParentViewportWatcherRequestStream {
10118    type Protocol = ParentViewportWatcherMarker;
10119    type ControlHandle = ParentViewportWatcherControlHandle;
10120
10121    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
10122        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
10123    }
10124
10125    fn control_handle(&self) -> Self::ControlHandle {
10126        ParentViewportWatcherControlHandle { inner: self.inner.clone() }
10127    }
10128
10129    fn into_inner(
10130        self,
10131    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
10132    {
10133        (self.inner, self.is_terminated)
10134    }
10135
10136    fn from_inner(
10137        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
10138        is_terminated: bool,
10139    ) -> Self {
10140        Self { inner, is_terminated }
10141    }
10142}
10143
10144impl futures::Stream for ParentViewportWatcherRequestStream {
10145    type Item = Result<ParentViewportWatcherRequest, fidl::Error>;
10146
10147    fn poll_next(
10148        mut self: std::pin::Pin<&mut Self>,
10149        cx: &mut std::task::Context<'_>,
10150    ) -> std::task::Poll<Option<Self::Item>> {
10151        let this = &mut *self;
10152        if this.inner.check_shutdown(cx) {
10153            this.is_terminated = true;
10154            return std::task::Poll::Ready(None);
10155        }
10156        if this.is_terminated {
10157            panic!("polled ParentViewportWatcherRequestStream after completion");
10158        }
10159        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
10160            |bytes, handles| {
10161                match this.inner.channel().read_etc(cx, bytes, handles) {
10162                    std::task::Poll::Ready(Ok(())) => {}
10163                    std::task::Poll::Pending => return std::task::Poll::Pending,
10164                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
10165                        this.is_terminated = true;
10166                        return std::task::Poll::Ready(None);
10167                    }
10168                    std::task::Poll::Ready(Err(e)) => {
10169                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
10170                            e.into(),
10171                        ))));
10172                    }
10173                }
10174
10175                // A message has been received from the channel
10176                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
10177
10178                std::task::Poll::Ready(Some(match header.ordinal {
10179                0x3cbe5d9638e032 => {
10180                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
10181                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
10182                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
10183                    let control_handle = ParentViewportWatcherControlHandle {
10184                        inner: this.inner.clone(),
10185                    };
10186                    Ok(ParentViewportWatcherRequest::GetLayout {
10187                        responder: ParentViewportWatcherGetLayoutResponder {
10188                            control_handle: std::mem::ManuallyDrop::new(control_handle),
10189                            tx_id: header.tx_id,
10190                        },
10191                    })
10192                }
10193                0x7caa022f050d9ea6 => {
10194                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
10195                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
10196                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
10197                    let control_handle = ParentViewportWatcherControlHandle {
10198                        inner: this.inner.clone(),
10199                    };
10200                    Ok(ParentViewportWatcherRequest::GetStatus {
10201                        responder: ParentViewportWatcherGetStatusResponder {
10202                            control_handle: std::mem::ManuallyDrop::new(control_handle),
10203                            tx_id: header.tx_id,
10204                        },
10205                    })
10206                }
10207                _ => Err(fidl::Error::UnknownOrdinal {
10208                    ordinal: header.ordinal,
10209                    protocol_name: <ParentViewportWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
10210                }),
10211            }))
10212            },
10213        )
10214    }
10215}
10216
10217/// A protocol that provides information about the parent Viewport attached to a Flatland session's
10218/// sole View.  Although Flatland sessions can have at most one view, it is possible to have
10219/// multiple ParentViewportWatchers during the brief transition period when replacing the session's
10220/// View with another, e.g. via [`CreateView`].  During this period, certain updates may be
10221/// duplicated and sent to each ParentViewportWatcher connection.
10222///
10223/// A ParentViewportWatcher will remain connected as long as the corresponding parent Viewport
10224/// exists; the connection will also be closed if the parents's ViewportCreationToken is dropped
10225/// without using it to create a Viewport.
10226#[derive(Debug)]
10227pub enum ParentViewportWatcherRequest {
10228    /// A hanging get for receiving layout information. Clients may receive layout information
10229    /// before the ParentViewportWatcher operation has been presented. This allows children to
10230    /// layout their content before their first call to [`Present`]. In transition cases where two
10231    /// ParentViewportWatcher channels exist at the same time, both protocol sessions will be
10232    /// receiving different layout information.
10233    ///
10234    /// This hanging get will only fire when the LayoutInfo is different than the previously
10235    /// returned LayoutInfo. Note that, since LayoutInfo is a table, only some fields may have
10236    /// changed.
10237    ///
10238    /// It is invalid to call `GetLayout` while a previous call is still pending. Doing so will
10239    /// cause both this channel and the Flatland channel that handed out ParentViewportWatcher to be
10240    /// closed.
10241    GetLayout { responder: ParentViewportWatcherGetLayoutResponder },
10242    /// A hanging get for receiving the status of the parent Viewport. This provides global
10243    /// connectivity information to the child.
10244    ///
10245    /// This hanging get will only fire when the ParentViewportStatus is different than the
10246    /// previously returned ParentViewportStatus.
10247    ///
10248    /// It is invalid to call `GetStatus` while a previous call is still pending. Doing so will
10249    /// cause both this channel and the Flatland channel that handed out ParentViewportWatcher to be
10250    /// closed.
10251    GetStatus { responder: ParentViewportWatcherGetStatusResponder },
10252}
10253
10254impl ParentViewportWatcherRequest {
10255    #[allow(irrefutable_let_patterns)]
10256    pub fn into_get_layout(self) -> Option<(ParentViewportWatcherGetLayoutResponder)> {
10257        if let ParentViewportWatcherRequest::GetLayout { responder } = self {
10258            Some((responder))
10259        } else {
10260            None
10261        }
10262    }
10263
10264    #[allow(irrefutable_let_patterns)]
10265    pub fn into_get_status(self) -> Option<(ParentViewportWatcherGetStatusResponder)> {
10266        if let ParentViewportWatcherRequest::GetStatus { responder } = self {
10267            Some((responder))
10268        } else {
10269            None
10270        }
10271    }
10272
10273    /// Name of the method defined in FIDL
10274    pub fn method_name(&self) -> &'static str {
10275        match *self {
10276            ParentViewportWatcherRequest::GetLayout { .. } => "get_layout",
10277            ParentViewportWatcherRequest::GetStatus { .. } => "get_status",
10278        }
10279    }
10280}
10281
10282#[derive(Debug, Clone)]
10283pub struct ParentViewportWatcherControlHandle {
10284    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
10285}
10286
10287impl ParentViewportWatcherControlHandle {
10288    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
10289        self.inner.shutdown_with_epitaph(status.into())
10290    }
10291}
10292
10293impl fidl::endpoints::ControlHandle for ParentViewportWatcherControlHandle {
10294    fn shutdown(&self) {
10295        self.inner.shutdown()
10296    }
10297
10298    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
10299        self.inner.shutdown_with_epitaph(status)
10300    }
10301
10302    fn is_closed(&self) -> bool {
10303        self.inner.channel().is_closed()
10304    }
10305    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
10306        self.inner.channel().on_closed()
10307    }
10308
10309    #[cfg(target_os = "fuchsia")]
10310    fn signal_peer(
10311        &self,
10312        clear_mask: zx::Signals,
10313        set_mask: zx::Signals,
10314    ) -> Result<(), zx_status::Status> {
10315        use fidl::Peered;
10316        self.inner.channel().signal_peer(clear_mask, set_mask)
10317    }
10318}
10319
10320impl ParentViewportWatcherControlHandle {}
10321
10322#[must_use = "FIDL methods require a response to be sent"]
10323#[derive(Debug)]
10324pub struct ParentViewportWatcherGetLayoutResponder {
10325    control_handle: std::mem::ManuallyDrop<ParentViewportWatcherControlHandle>,
10326    tx_id: u32,
10327}
10328
10329/// Set the the channel to be shutdown (see [`ParentViewportWatcherControlHandle::shutdown`])
10330/// if the responder is dropped without sending a response, so that the client
10331/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
10332impl std::ops::Drop for ParentViewportWatcherGetLayoutResponder {
10333    fn drop(&mut self) {
10334        self.control_handle.shutdown();
10335        // Safety: drops once, never accessed again
10336        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
10337    }
10338}
10339
10340impl fidl::endpoints::Responder for ParentViewportWatcherGetLayoutResponder {
10341    type ControlHandle = ParentViewportWatcherControlHandle;
10342
10343    fn control_handle(&self) -> &ParentViewportWatcherControlHandle {
10344        &self.control_handle
10345    }
10346
10347    fn drop_without_shutdown(mut self) {
10348        // Safety: drops once, never accessed again due to mem::forget
10349        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
10350        // Prevent Drop from running (which would shut down the channel)
10351        std::mem::forget(self);
10352    }
10353}
10354
10355impl ParentViewportWatcherGetLayoutResponder {
10356    /// Sends a response to the FIDL transaction.
10357    ///
10358    /// Sets the channel to shutdown if an error occurs.
10359    pub fn send(self, mut info: &LayoutInfo) -> Result<(), fidl::Error> {
10360        let _result = self.send_raw(info);
10361        if _result.is_err() {
10362            self.control_handle.shutdown();
10363        }
10364        self.drop_without_shutdown();
10365        _result
10366    }
10367
10368    /// Similar to "send" but does not shutdown the channel if an error occurs.
10369    pub fn send_no_shutdown_on_err(self, mut info: &LayoutInfo) -> Result<(), fidl::Error> {
10370        let _result = self.send_raw(info);
10371        self.drop_without_shutdown();
10372        _result
10373    }
10374
10375    fn send_raw(&self, mut info: &LayoutInfo) -> Result<(), fidl::Error> {
10376        self.control_handle.inner.send::<ParentViewportWatcherGetLayoutResponse>(
10377            (info,),
10378            self.tx_id,
10379            0x3cbe5d9638e032,
10380            fidl::encoding::DynamicFlags::empty(),
10381        )
10382    }
10383}
10384
10385#[must_use = "FIDL methods require a response to be sent"]
10386#[derive(Debug)]
10387pub struct ParentViewportWatcherGetStatusResponder {
10388    control_handle: std::mem::ManuallyDrop<ParentViewportWatcherControlHandle>,
10389    tx_id: u32,
10390}
10391
10392/// Set the the channel to be shutdown (see [`ParentViewportWatcherControlHandle::shutdown`])
10393/// if the responder is dropped without sending a response, so that the client
10394/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
10395impl std::ops::Drop for ParentViewportWatcherGetStatusResponder {
10396    fn drop(&mut self) {
10397        self.control_handle.shutdown();
10398        // Safety: drops once, never accessed again
10399        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
10400    }
10401}
10402
10403impl fidl::endpoints::Responder for ParentViewportWatcherGetStatusResponder {
10404    type ControlHandle = ParentViewportWatcherControlHandle;
10405
10406    fn control_handle(&self) -> &ParentViewportWatcherControlHandle {
10407        &self.control_handle
10408    }
10409
10410    fn drop_without_shutdown(mut self) {
10411        // Safety: drops once, never accessed again due to mem::forget
10412        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
10413        // Prevent Drop from running (which would shut down the channel)
10414        std::mem::forget(self);
10415    }
10416}
10417
10418impl ParentViewportWatcherGetStatusResponder {
10419    /// Sends a response to the FIDL transaction.
10420    ///
10421    /// Sets the channel to shutdown if an error occurs.
10422    pub fn send(self, mut status: ParentViewportStatus) -> Result<(), fidl::Error> {
10423        let _result = self.send_raw(status);
10424        if _result.is_err() {
10425            self.control_handle.shutdown();
10426        }
10427        self.drop_without_shutdown();
10428        _result
10429    }
10430
10431    /// Similar to "send" but does not shutdown the channel if an error occurs.
10432    pub fn send_no_shutdown_on_err(
10433        self,
10434        mut status: ParentViewportStatus,
10435    ) -> Result<(), fidl::Error> {
10436        let _result = self.send_raw(status);
10437        self.drop_without_shutdown();
10438        _result
10439    }
10440
10441    fn send_raw(&self, mut status: ParentViewportStatus) -> Result<(), fidl::Error> {
10442        self.control_handle.inner.send::<ParentViewportWatcherGetStatusResponse>(
10443            (status,),
10444            self.tx_id,
10445            0x7caa022f050d9ea6,
10446            fidl::encoding::DynamicFlags::empty(),
10447        )
10448    }
10449}
10450
10451#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
10452pub struct ScreenCaptureMarker;
10453
10454impl fidl::endpoints::ProtocolMarker for ScreenCaptureMarker {
10455    type Proxy = ScreenCaptureProxy;
10456    type RequestStream = ScreenCaptureRequestStream;
10457    #[cfg(target_os = "fuchsia")]
10458    type SynchronousProxy = ScreenCaptureSynchronousProxy;
10459
10460    const DEBUG_NAME: &'static str = "fuchsia.ui.composition.ScreenCapture";
10461}
10462impl fidl::endpoints::DiscoverableProtocolMarker for ScreenCaptureMarker {}
10463pub type ScreenCaptureConfigureResult = Result<(), ScreenCaptureError>;
10464pub type ScreenCaptureGetNextFrameResult = Result<FrameInfo, ScreenCaptureError>;
10465pub type ScreenCaptureReleaseFrameResult = Result<(), ScreenCaptureError>;
10466
10467pub trait ScreenCaptureProxyInterface: Send + Sync {
10468    type ConfigureResponseFut: std::future::Future<Output = Result<ScreenCaptureConfigureResult, fidl::Error>>
10469        + Send;
10470    fn r#configure(&self, payload: ScreenCaptureConfig) -> Self::ConfigureResponseFut;
10471    type GetNextFrameResponseFut: std::future::Future<Output = Result<ScreenCaptureGetNextFrameResult, fidl::Error>>
10472        + Send;
10473    fn r#get_next_frame(&self, payload: GetNextFrameArgs) -> Self::GetNextFrameResponseFut;
10474    type ReleaseFrameResponseFut: std::future::Future<Output = Result<ScreenCaptureReleaseFrameResult, fidl::Error>>
10475        + Send;
10476    fn r#release_frame(&self, buffer_id: u32) -> Self::ReleaseFrameResponseFut;
10477}
10478#[derive(Debug)]
10479#[cfg(target_os = "fuchsia")]
10480pub struct ScreenCaptureSynchronousProxy {
10481    client: fidl::client::sync::Client,
10482}
10483
10484#[cfg(target_os = "fuchsia")]
10485impl fidl::endpoints::SynchronousProxy for ScreenCaptureSynchronousProxy {
10486    type Proxy = ScreenCaptureProxy;
10487    type Protocol = ScreenCaptureMarker;
10488
10489    fn from_channel(inner: fidl::Channel) -> Self {
10490        Self::new(inner)
10491    }
10492
10493    fn into_channel(self) -> fidl::Channel {
10494        self.client.into_channel()
10495    }
10496
10497    fn as_channel(&self) -> &fidl::Channel {
10498        self.client.as_channel()
10499    }
10500}
10501
10502#[cfg(target_os = "fuchsia")]
10503impl ScreenCaptureSynchronousProxy {
10504    pub fn new(channel: fidl::Channel) -> Self {
10505        Self { client: fidl::client::sync::Client::new(channel) }
10506    }
10507
10508    pub fn into_channel(self) -> fidl::Channel {
10509        self.client.into_channel()
10510    }
10511
10512    /// Waits until an event arrives and returns it. It is safe for other
10513    /// threads to make concurrent requests while waiting for an event.
10514    pub fn wait_for_event(
10515        &self,
10516        deadline: zx::MonotonicInstant,
10517    ) -> Result<ScreenCaptureEvent, fidl::Error> {
10518        ScreenCaptureEvent::decode(self.client.wait_for_event::<ScreenCaptureMarker>(deadline)?)
10519    }
10520
10521    /// Clients should first use the Allocator protocol to register a
10522    /// BufferCollection. This function will fail with BAD_OPERATION unless all clients of the
10523    /// BufferCollection have set their constraints.
10524    ///
10525    /// Afterwards, clients should create and configure the images that will
10526    /// eventually be rendered to using this method. All the buffers in the
10527    /// collection from 0 to (buffer_count-1) may be used for screen capture.
10528    ///
10529    /// Clients are responsible for determining the rotation of the display,
10530    /// and applying the corrective rotation. For instance, if the display is
10531    /// mounted 90 degrees clockwise (the "top" is on the right, when looking
10532    /// at the display), then the client should specify a 270 degree rotation
10533    /// to account for it.
10534    ///
10535    /// Similarly, the clients are responsible for specifying a buffer big
10536    /// enough for the rotated image. If the buffer is too small, a best effort
10537    /// attempt will be made to render the image.
10538    ///
10539    /// Finally, clients request the server to render the current screen to the
10540    /// shared buffers using [`GetNextFrame`].
10541    ///
10542    /// [`Configure`] can be called again with a new BufferCollectionImportToken
10543    /// if the client wishes to change any of the configuration settings. In
10544    /// this case all the buffers from the previous call to [`Configure`] will
10545    /// be released.
10546    pub fn r#configure(
10547        &self,
10548        mut payload: ScreenCaptureConfig,
10549        ___deadline: zx::MonotonicInstant,
10550    ) -> Result<ScreenCaptureConfigureResult, fidl::Error> {
10551        let _response = self.client.send_query::<ScreenCaptureConfig, fidl::encoding::ResultType<
10552            fidl::encoding::EmptyStruct,
10553            ScreenCaptureError,
10554        >, ScreenCaptureMarker>(
10555            &mut payload,
10556            0x3b6e5af1d294afd9,
10557            fidl::encoding::DynamicFlags::empty(),
10558            ___deadline,
10559        )?;
10560        Ok(_response.map(|x| x))
10561    }
10562
10563    /// Following a successful call to [`Configure`], clients can call
10564    /// GetNextFrame. This will populate a buffer with the most recent frame.
10565    ///
10566    /// Clients should wait on the zx::event they pass for successful
10567    /// completion of the screenshot. It is not guaranteed that the screenshot
10568    /// will be completed by the time this function returns.
10569    ///
10570    /// The requested image will be in the BufferCollection that the client set
10571    /// up in the VMO at the index specified by buffer_id.
10572    ///
10573    /// When ScreenCapture is used to provide a stream, the rate that the
10574    /// client calls GetNextFrame will drive the frame rate.
10575    ///
10576    /// Errors:
10577    /// BAD_OPERATION if Configure was not called, or not called successfully
10578    /// MISSING_ARGS if a required argument is not present
10579    /// BUFFER_FULL if all buffers in the BufferCollection are in use. In this case, ReleaseFrame
10580    /// must be called to make a buffer available before this function can be called successfully.
10581    pub fn r#get_next_frame(
10582        &self,
10583        mut payload: GetNextFrameArgs,
10584        ___deadline: zx::MonotonicInstant,
10585    ) -> Result<ScreenCaptureGetNextFrameResult, fidl::Error> {
10586        let _response = self.client.send_query::<
10587            GetNextFrameArgs,
10588            fidl::encoding::ResultType<FrameInfo, ScreenCaptureError>,
10589            ScreenCaptureMarker,
10590        >(
10591            &mut payload,
10592            0x552c1580aab8c4a7,
10593            fidl::encoding::DynamicFlags::empty(),
10594            ___deadline,
10595        )?;
10596        Ok(_response.map(|x| x))
10597    }
10598
10599    /// Once the client no longer needs an image, they can call ReleaseFrame on
10600    /// the VMO index of the buffer so that the server can reuse it in the future.
10601    pub fn r#release_frame(
10602        &self,
10603        mut buffer_id: u32,
10604        ___deadline: zx::MonotonicInstant,
10605    ) -> Result<ScreenCaptureReleaseFrameResult, fidl::Error> {
10606        let _response =
10607            self.client.send_query::<ScreenCaptureReleaseFrameRequest, fidl::encoding::ResultType<
10608                fidl::encoding::EmptyStruct,
10609                ScreenCaptureError,
10610            >, ScreenCaptureMarker>(
10611                (buffer_id,),
10612                0x46704dce24e35950,
10613                fidl::encoding::DynamicFlags::empty(),
10614                ___deadline,
10615            )?;
10616        Ok(_response.map(|x| x))
10617    }
10618}
10619
10620#[cfg(target_os = "fuchsia")]
10621impl From<ScreenCaptureSynchronousProxy> for zx::NullableHandle {
10622    fn from(value: ScreenCaptureSynchronousProxy) -> Self {
10623        value.into_channel().into()
10624    }
10625}
10626
10627#[cfg(target_os = "fuchsia")]
10628impl From<fidl::Channel> for ScreenCaptureSynchronousProxy {
10629    fn from(value: fidl::Channel) -> Self {
10630        Self::new(value)
10631    }
10632}
10633
10634#[cfg(target_os = "fuchsia")]
10635impl fidl::endpoints::FromClient for ScreenCaptureSynchronousProxy {
10636    type Protocol = ScreenCaptureMarker;
10637
10638    fn from_client(value: fidl::endpoints::ClientEnd<ScreenCaptureMarker>) -> Self {
10639        Self::new(value.into_channel())
10640    }
10641}
10642
10643#[derive(Debug, Clone)]
10644pub struct ScreenCaptureProxy {
10645    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
10646}
10647
10648impl fidl::endpoints::Proxy for ScreenCaptureProxy {
10649    type Protocol = ScreenCaptureMarker;
10650
10651    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
10652        Self::new(inner)
10653    }
10654
10655    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
10656        self.client.into_channel().map_err(|client| Self { client })
10657    }
10658
10659    fn as_channel(&self) -> &::fidl::AsyncChannel {
10660        self.client.as_channel()
10661    }
10662}
10663
10664impl ScreenCaptureProxy {
10665    /// Create a new Proxy for fuchsia.ui.composition/ScreenCapture.
10666    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
10667        let protocol_name = <ScreenCaptureMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
10668        Self { client: fidl::client::Client::new(channel, protocol_name) }
10669    }
10670
10671    /// Get a Stream of events from the remote end of the protocol.
10672    ///
10673    /// # Panics
10674    ///
10675    /// Panics if the event stream was already taken.
10676    pub fn take_event_stream(&self) -> ScreenCaptureEventStream {
10677        ScreenCaptureEventStream { event_receiver: self.client.take_event_receiver() }
10678    }
10679
10680    /// Clients should first use the Allocator protocol to register a
10681    /// BufferCollection. This function will fail with BAD_OPERATION unless all clients of the
10682    /// BufferCollection have set their constraints.
10683    ///
10684    /// Afterwards, clients should create and configure the images that will
10685    /// eventually be rendered to using this method. All the buffers in the
10686    /// collection from 0 to (buffer_count-1) may be used for screen capture.
10687    ///
10688    /// Clients are responsible for determining the rotation of the display,
10689    /// and applying the corrective rotation. For instance, if the display is
10690    /// mounted 90 degrees clockwise (the "top" is on the right, when looking
10691    /// at the display), then the client should specify a 270 degree rotation
10692    /// to account for it.
10693    ///
10694    /// Similarly, the clients are responsible for specifying a buffer big
10695    /// enough for the rotated image. If the buffer is too small, a best effort
10696    /// attempt will be made to render the image.
10697    ///
10698    /// Finally, clients request the server to render the current screen to the
10699    /// shared buffers using [`GetNextFrame`].
10700    ///
10701    /// [`Configure`] can be called again with a new BufferCollectionImportToken
10702    /// if the client wishes to change any of the configuration settings. In
10703    /// this case all the buffers from the previous call to [`Configure`] will
10704    /// be released.
10705    pub fn r#configure(
10706        &self,
10707        mut payload: ScreenCaptureConfig,
10708    ) -> fidl::client::QueryResponseFut<
10709        ScreenCaptureConfigureResult,
10710        fidl::encoding::DefaultFuchsiaResourceDialect,
10711    > {
10712        ScreenCaptureProxyInterface::r#configure(self, payload)
10713    }
10714
10715    /// Following a successful call to [`Configure`], clients can call
10716    /// GetNextFrame. This will populate a buffer with the most recent frame.
10717    ///
10718    /// Clients should wait on the zx::event they pass for successful
10719    /// completion of the screenshot. It is not guaranteed that the screenshot
10720    /// will be completed by the time this function returns.
10721    ///
10722    /// The requested image will be in the BufferCollection that the client set
10723    /// up in the VMO at the index specified by buffer_id.
10724    ///
10725    /// When ScreenCapture is used to provide a stream, the rate that the
10726    /// client calls GetNextFrame will drive the frame rate.
10727    ///
10728    /// Errors:
10729    /// BAD_OPERATION if Configure was not called, or not called successfully
10730    /// MISSING_ARGS if a required argument is not present
10731    /// BUFFER_FULL if all buffers in the BufferCollection are in use. In this case, ReleaseFrame
10732    /// must be called to make a buffer available before this function can be called successfully.
10733    pub fn r#get_next_frame(
10734        &self,
10735        mut payload: GetNextFrameArgs,
10736    ) -> fidl::client::QueryResponseFut<
10737        ScreenCaptureGetNextFrameResult,
10738        fidl::encoding::DefaultFuchsiaResourceDialect,
10739    > {
10740        ScreenCaptureProxyInterface::r#get_next_frame(self, payload)
10741    }
10742
10743    /// Once the client no longer needs an image, they can call ReleaseFrame on
10744    /// the VMO index of the buffer so that the server can reuse it in the future.
10745    pub fn r#release_frame(
10746        &self,
10747        mut buffer_id: u32,
10748    ) -> fidl::client::QueryResponseFut<
10749        ScreenCaptureReleaseFrameResult,
10750        fidl::encoding::DefaultFuchsiaResourceDialect,
10751    > {
10752        ScreenCaptureProxyInterface::r#release_frame(self, buffer_id)
10753    }
10754}
10755
10756impl ScreenCaptureProxyInterface for ScreenCaptureProxy {
10757    type ConfigureResponseFut = fidl::client::QueryResponseFut<
10758        ScreenCaptureConfigureResult,
10759        fidl::encoding::DefaultFuchsiaResourceDialect,
10760    >;
10761    fn r#configure(&self, mut payload: ScreenCaptureConfig) -> Self::ConfigureResponseFut {
10762        fn _decode(
10763            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
10764        ) -> Result<ScreenCaptureConfigureResult, fidl::Error> {
10765            let _response = fidl::client::decode_transaction_body::<
10766                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, ScreenCaptureError>,
10767                fidl::encoding::DefaultFuchsiaResourceDialect,
10768                0x3b6e5af1d294afd9,
10769            >(_buf?)?;
10770            Ok(_response.map(|x| x))
10771        }
10772        self.client.send_query_and_decode::<ScreenCaptureConfig, ScreenCaptureConfigureResult>(
10773            &mut payload,
10774            0x3b6e5af1d294afd9,
10775            fidl::encoding::DynamicFlags::empty(),
10776            _decode,
10777        )
10778    }
10779
10780    type GetNextFrameResponseFut = fidl::client::QueryResponseFut<
10781        ScreenCaptureGetNextFrameResult,
10782        fidl::encoding::DefaultFuchsiaResourceDialect,
10783    >;
10784    fn r#get_next_frame(&self, mut payload: GetNextFrameArgs) -> Self::GetNextFrameResponseFut {
10785        fn _decode(
10786            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
10787        ) -> Result<ScreenCaptureGetNextFrameResult, fidl::Error> {
10788            let _response = fidl::client::decode_transaction_body::<
10789                fidl::encoding::ResultType<FrameInfo, ScreenCaptureError>,
10790                fidl::encoding::DefaultFuchsiaResourceDialect,
10791                0x552c1580aab8c4a7,
10792            >(_buf?)?;
10793            Ok(_response.map(|x| x))
10794        }
10795        self.client.send_query_and_decode::<GetNextFrameArgs, ScreenCaptureGetNextFrameResult>(
10796            &mut payload,
10797            0x552c1580aab8c4a7,
10798            fidl::encoding::DynamicFlags::empty(),
10799            _decode,
10800        )
10801    }
10802
10803    type ReleaseFrameResponseFut = fidl::client::QueryResponseFut<
10804        ScreenCaptureReleaseFrameResult,
10805        fidl::encoding::DefaultFuchsiaResourceDialect,
10806    >;
10807    fn r#release_frame(&self, mut buffer_id: u32) -> Self::ReleaseFrameResponseFut {
10808        fn _decode(
10809            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
10810        ) -> Result<ScreenCaptureReleaseFrameResult, fidl::Error> {
10811            let _response = fidl::client::decode_transaction_body::<
10812                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, ScreenCaptureError>,
10813                fidl::encoding::DefaultFuchsiaResourceDialect,
10814                0x46704dce24e35950,
10815            >(_buf?)?;
10816            Ok(_response.map(|x| x))
10817        }
10818        self.client.send_query_and_decode::<
10819            ScreenCaptureReleaseFrameRequest,
10820            ScreenCaptureReleaseFrameResult,
10821        >(
10822            (buffer_id,),
10823            0x46704dce24e35950,
10824            fidl::encoding::DynamicFlags::empty(),
10825            _decode,
10826        )
10827    }
10828}
10829
10830pub struct ScreenCaptureEventStream {
10831    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
10832}
10833
10834impl std::marker::Unpin for ScreenCaptureEventStream {}
10835
10836impl futures::stream::FusedStream for ScreenCaptureEventStream {
10837    fn is_terminated(&self) -> bool {
10838        self.event_receiver.is_terminated()
10839    }
10840}
10841
10842impl futures::Stream for ScreenCaptureEventStream {
10843    type Item = Result<ScreenCaptureEvent, fidl::Error>;
10844
10845    fn poll_next(
10846        mut self: std::pin::Pin<&mut Self>,
10847        cx: &mut std::task::Context<'_>,
10848    ) -> std::task::Poll<Option<Self::Item>> {
10849        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
10850            &mut self.event_receiver,
10851            cx
10852        )?) {
10853            Some(buf) => std::task::Poll::Ready(Some(ScreenCaptureEvent::decode(buf))),
10854            None => std::task::Poll::Ready(None),
10855        }
10856    }
10857}
10858
10859#[derive(Debug)]
10860pub enum ScreenCaptureEvent {}
10861
10862impl ScreenCaptureEvent {
10863    /// Decodes a message buffer as a [`ScreenCaptureEvent`].
10864    fn decode(
10865        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
10866    ) -> Result<ScreenCaptureEvent, fidl::Error> {
10867        let (bytes, _handles) = buf.split_mut();
10868        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
10869        debug_assert_eq!(tx_header.tx_id, 0);
10870        match tx_header.ordinal {
10871            _ => Err(fidl::Error::UnknownOrdinal {
10872                ordinal: tx_header.ordinal,
10873                protocol_name: <ScreenCaptureMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
10874            }),
10875        }
10876    }
10877}
10878
10879/// A Stream of incoming requests for fuchsia.ui.composition/ScreenCapture.
10880pub struct ScreenCaptureRequestStream {
10881    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
10882    is_terminated: bool,
10883}
10884
10885impl std::marker::Unpin for ScreenCaptureRequestStream {}
10886
10887impl futures::stream::FusedStream for ScreenCaptureRequestStream {
10888    fn is_terminated(&self) -> bool {
10889        self.is_terminated
10890    }
10891}
10892
10893impl fidl::endpoints::RequestStream for ScreenCaptureRequestStream {
10894    type Protocol = ScreenCaptureMarker;
10895    type ControlHandle = ScreenCaptureControlHandle;
10896
10897    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
10898        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
10899    }
10900
10901    fn control_handle(&self) -> Self::ControlHandle {
10902        ScreenCaptureControlHandle { inner: self.inner.clone() }
10903    }
10904
10905    fn into_inner(
10906        self,
10907    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
10908    {
10909        (self.inner, self.is_terminated)
10910    }
10911
10912    fn from_inner(
10913        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
10914        is_terminated: bool,
10915    ) -> Self {
10916        Self { inner, is_terminated }
10917    }
10918}
10919
10920impl futures::Stream for ScreenCaptureRequestStream {
10921    type Item = Result<ScreenCaptureRequest, fidl::Error>;
10922
10923    fn poll_next(
10924        mut self: std::pin::Pin<&mut Self>,
10925        cx: &mut std::task::Context<'_>,
10926    ) -> std::task::Poll<Option<Self::Item>> {
10927        let this = &mut *self;
10928        if this.inner.check_shutdown(cx) {
10929            this.is_terminated = true;
10930            return std::task::Poll::Ready(None);
10931        }
10932        if this.is_terminated {
10933            panic!("polled ScreenCaptureRequestStream after completion");
10934        }
10935        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
10936            |bytes, handles| {
10937                match this.inner.channel().read_etc(cx, bytes, handles) {
10938                    std::task::Poll::Ready(Ok(())) => {}
10939                    std::task::Poll::Pending => return std::task::Poll::Pending,
10940                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
10941                        this.is_terminated = true;
10942                        return std::task::Poll::Ready(None);
10943                    }
10944                    std::task::Poll::Ready(Err(e)) => {
10945                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
10946                            e.into(),
10947                        ))));
10948                    }
10949                }
10950
10951                // A message has been received from the channel
10952                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
10953
10954                std::task::Poll::Ready(Some(match header.ordinal {
10955                    0x3b6e5af1d294afd9 => {
10956                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
10957                        let mut req = fidl::new_empty!(
10958                            ScreenCaptureConfig,
10959                            fidl::encoding::DefaultFuchsiaResourceDialect
10960                        );
10961                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ScreenCaptureConfig>(&header, _body_bytes, handles, &mut req)?;
10962                        let control_handle =
10963                            ScreenCaptureControlHandle { inner: this.inner.clone() };
10964                        Ok(ScreenCaptureRequest::Configure {
10965                            payload: req,
10966                            responder: ScreenCaptureConfigureResponder {
10967                                control_handle: std::mem::ManuallyDrop::new(control_handle),
10968                                tx_id: header.tx_id,
10969                            },
10970                        })
10971                    }
10972                    0x552c1580aab8c4a7 => {
10973                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
10974                        let mut req = fidl::new_empty!(
10975                            GetNextFrameArgs,
10976                            fidl::encoding::DefaultFuchsiaResourceDialect
10977                        );
10978                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<GetNextFrameArgs>(&header, _body_bytes, handles, &mut req)?;
10979                        let control_handle =
10980                            ScreenCaptureControlHandle { inner: this.inner.clone() };
10981                        Ok(ScreenCaptureRequest::GetNextFrame {
10982                            payload: req,
10983                            responder: ScreenCaptureGetNextFrameResponder {
10984                                control_handle: std::mem::ManuallyDrop::new(control_handle),
10985                                tx_id: header.tx_id,
10986                            },
10987                        })
10988                    }
10989                    0x46704dce24e35950 => {
10990                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
10991                        let mut req = fidl::new_empty!(
10992                            ScreenCaptureReleaseFrameRequest,
10993                            fidl::encoding::DefaultFuchsiaResourceDialect
10994                        );
10995                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ScreenCaptureReleaseFrameRequest>(&header, _body_bytes, handles, &mut req)?;
10996                        let control_handle =
10997                            ScreenCaptureControlHandle { inner: this.inner.clone() };
10998                        Ok(ScreenCaptureRequest::ReleaseFrame {
10999                            buffer_id: req.buffer_id,
11000
11001                            responder: ScreenCaptureReleaseFrameResponder {
11002                                control_handle: std::mem::ManuallyDrop::new(control_handle),
11003                                tx_id: header.tx_id,
11004                            },
11005                        })
11006                    }
11007                    _ => Err(fidl::Error::UnknownOrdinal {
11008                        ordinal: header.ordinal,
11009                        protocol_name:
11010                            <ScreenCaptureMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
11011                    }),
11012                }))
11013            },
11014        )
11015    }
11016}
11017
11018/// This protocol provides a low-level ScreenCapture API for clients to use.
11019/// ScreenCapture clients should familiarize themselves with the
11020/// [`fuchsia.sysmem/BufferCollection`] and [`fuchsia.ui.composition/Allocator`] protocols
11021/// as those are necessary to create the BufferCollections and images ScreenCapture uses.
11022#[derive(Debug)]
11023pub enum ScreenCaptureRequest {
11024    /// Clients should first use the Allocator protocol to register a
11025    /// BufferCollection. This function will fail with BAD_OPERATION unless all clients of the
11026    /// BufferCollection have set their constraints.
11027    ///
11028    /// Afterwards, clients should create and configure the images that will
11029    /// eventually be rendered to using this method. All the buffers in the
11030    /// collection from 0 to (buffer_count-1) may be used for screen capture.
11031    ///
11032    /// Clients are responsible for determining the rotation of the display,
11033    /// and applying the corrective rotation. For instance, if the display is
11034    /// mounted 90 degrees clockwise (the "top" is on the right, when looking
11035    /// at the display), then the client should specify a 270 degree rotation
11036    /// to account for it.
11037    ///
11038    /// Similarly, the clients are responsible for specifying a buffer big
11039    /// enough for the rotated image. If the buffer is too small, a best effort
11040    /// attempt will be made to render the image.
11041    ///
11042    /// Finally, clients request the server to render the current screen to the
11043    /// shared buffers using [`GetNextFrame`].
11044    ///
11045    /// [`Configure`] can be called again with a new BufferCollectionImportToken
11046    /// if the client wishes to change any of the configuration settings. In
11047    /// this case all the buffers from the previous call to [`Configure`] will
11048    /// be released.
11049    Configure { payload: ScreenCaptureConfig, responder: ScreenCaptureConfigureResponder },
11050    /// Following a successful call to [`Configure`], clients can call
11051    /// GetNextFrame. This will populate a buffer with the most recent frame.
11052    ///
11053    /// Clients should wait on the zx::event they pass for successful
11054    /// completion of the screenshot. It is not guaranteed that the screenshot
11055    /// will be completed by the time this function returns.
11056    ///
11057    /// The requested image will be in the BufferCollection that the client set
11058    /// up in the VMO at the index specified by buffer_id.
11059    ///
11060    /// When ScreenCapture is used to provide a stream, the rate that the
11061    /// client calls GetNextFrame will drive the frame rate.
11062    ///
11063    /// Errors:
11064    /// BAD_OPERATION if Configure was not called, or not called successfully
11065    /// MISSING_ARGS if a required argument is not present
11066    /// BUFFER_FULL if all buffers in the BufferCollection are in use. In this case, ReleaseFrame
11067    /// must be called to make a buffer available before this function can be called successfully.
11068    GetNextFrame { payload: GetNextFrameArgs, responder: ScreenCaptureGetNextFrameResponder },
11069    /// Once the client no longer needs an image, they can call ReleaseFrame on
11070    /// the VMO index of the buffer so that the server can reuse it in the future.
11071    ReleaseFrame { buffer_id: u32, responder: ScreenCaptureReleaseFrameResponder },
11072}
11073
11074impl ScreenCaptureRequest {
11075    #[allow(irrefutable_let_patterns)]
11076    pub fn into_configure(self) -> Option<(ScreenCaptureConfig, ScreenCaptureConfigureResponder)> {
11077        if let ScreenCaptureRequest::Configure { payload, responder } = self {
11078            Some((payload, responder))
11079        } else {
11080            None
11081        }
11082    }
11083
11084    #[allow(irrefutable_let_patterns)]
11085    pub fn into_get_next_frame(
11086        self,
11087    ) -> Option<(GetNextFrameArgs, ScreenCaptureGetNextFrameResponder)> {
11088        if let ScreenCaptureRequest::GetNextFrame { payload, responder } = self {
11089            Some((payload, responder))
11090        } else {
11091            None
11092        }
11093    }
11094
11095    #[allow(irrefutable_let_patterns)]
11096    pub fn into_release_frame(self) -> Option<(u32, ScreenCaptureReleaseFrameResponder)> {
11097        if let ScreenCaptureRequest::ReleaseFrame { buffer_id, responder } = self {
11098            Some((buffer_id, responder))
11099        } else {
11100            None
11101        }
11102    }
11103
11104    /// Name of the method defined in FIDL
11105    pub fn method_name(&self) -> &'static str {
11106        match *self {
11107            ScreenCaptureRequest::Configure { .. } => "configure",
11108            ScreenCaptureRequest::GetNextFrame { .. } => "get_next_frame",
11109            ScreenCaptureRequest::ReleaseFrame { .. } => "release_frame",
11110        }
11111    }
11112}
11113
11114#[derive(Debug, Clone)]
11115pub struct ScreenCaptureControlHandle {
11116    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
11117}
11118
11119impl ScreenCaptureControlHandle {
11120    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
11121        self.inner.shutdown_with_epitaph(status.into())
11122    }
11123}
11124
11125impl fidl::endpoints::ControlHandle for ScreenCaptureControlHandle {
11126    fn shutdown(&self) {
11127        self.inner.shutdown()
11128    }
11129
11130    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
11131        self.inner.shutdown_with_epitaph(status)
11132    }
11133
11134    fn is_closed(&self) -> bool {
11135        self.inner.channel().is_closed()
11136    }
11137    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
11138        self.inner.channel().on_closed()
11139    }
11140
11141    #[cfg(target_os = "fuchsia")]
11142    fn signal_peer(
11143        &self,
11144        clear_mask: zx::Signals,
11145        set_mask: zx::Signals,
11146    ) -> Result<(), zx_status::Status> {
11147        use fidl::Peered;
11148        self.inner.channel().signal_peer(clear_mask, set_mask)
11149    }
11150}
11151
11152impl ScreenCaptureControlHandle {}
11153
11154#[must_use = "FIDL methods require a response to be sent"]
11155#[derive(Debug)]
11156pub struct ScreenCaptureConfigureResponder {
11157    control_handle: std::mem::ManuallyDrop<ScreenCaptureControlHandle>,
11158    tx_id: u32,
11159}
11160
11161/// Set the the channel to be shutdown (see [`ScreenCaptureControlHandle::shutdown`])
11162/// if the responder is dropped without sending a response, so that the client
11163/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
11164impl std::ops::Drop for ScreenCaptureConfigureResponder {
11165    fn drop(&mut self) {
11166        self.control_handle.shutdown();
11167        // Safety: drops once, never accessed again
11168        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
11169    }
11170}
11171
11172impl fidl::endpoints::Responder for ScreenCaptureConfigureResponder {
11173    type ControlHandle = ScreenCaptureControlHandle;
11174
11175    fn control_handle(&self) -> &ScreenCaptureControlHandle {
11176        &self.control_handle
11177    }
11178
11179    fn drop_without_shutdown(mut self) {
11180        // Safety: drops once, never accessed again due to mem::forget
11181        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
11182        // Prevent Drop from running (which would shut down the channel)
11183        std::mem::forget(self);
11184    }
11185}
11186
11187impl ScreenCaptureConfigureResponder {
11188    /// Sends a response to the FIDL transaction.
11189    ///
11190    /// Sets the channel to shutdown if an error occurs.
11191    pub fn send(self, mut result: Result<(), ScreenCaptureError>) -> Result<(), fidl::Error> {
11192        let _result = self.send_raw(result);
11193        if _result.is_err() {
11194            self.control_handle.shutdown();
11195        }
11196        self.drop_without_shutdown();
11197        _result
11198    }
11199
11200    /// Similar to "send" but does not shutdown the channel if an error occurs.
11201    pub fn send_no_shutdown_on_err(
11202        self,
11203        mut result: Result<(), ScreenCaptureError>,
11204    ) -> Result<(), fidl::Error> {
11205        let _result = self.send_raw(result);
11206        self.drop_without_shutdown();
11207        _result
11208    }
11209
11210    fn send_raw(&self, mut result: Result<(), ScreenCaptureError>) -> Result<(), fidl::Error> {
11211        self.control_handle.inner.send::<fidl::encoding::ResultType<
11212            fidl::encoding::EmptyStruct,
11213            ScreenCaptureError,
11214        >>(
11215            result,
11216            self.tx_id,
11217            0x3b6e5af1d294afd9,
11218            fidl::encoding::DynamicFlags::empty(),
11219        )
11220    }
11221}
11222
11223#[must_use = "FIDL methods require a response to be sent"]
11224#[derive(Debug)]
11225pub struct ScreenCaptureGetNextFrameResponder {
11226    control_handle: std::mem::ManuallyDrop<ScreenCaptureControlHandle>,
11227    tx_id: u32,
11228}
11229
11230/// Set the the channel to be shutdown (see [`ScreenCaptureControlHandle::shutdown`])
11231/// if the responder is dropped without sending a response, so that the client
11232/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
11233impl std::ops::Drop for ScreenCaptureGetNextFrameResponder {
11234    fn drop(&mut self) {
11235        self.control_handle.shutdown();
11236        // Safety: drops once, never accessed again
11237        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
11238    }
11239}
11240
11241impl fidl::endpoints::Responder for ScreenCaptureGetNextFrameResponder {
11242    type ControlHandle = ScreenCaptureControlHandle;
11243
11244    fn control_handle(&self) -> &ScreenCaptureControlHandle {
11245        &self.control_handle
11246    }
11247
11248    fn drop_without_shutdown(mut self) {
11249        // Safety: drops once, never accessed again due to mem::forget
11250        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
11251        // Prevent Drop from running (which would shut down the channel)
11252        std::mem::forget(self);
11253    }
11254}
11255
11256impl ScreenCaptureGetNextFrameResponder {
11257    /// Sends a response to the FIDL transaction.
11258    ///
11259    /// Sets the channel to shutdown if an error occurs.
11260    pub fn send(
11261        self,
11262        mut result: Result<FrameInfo, ScreenCaptureError>,
11263    ) -> Result<(), fidl::Error> {
11264        let _result = self.send_raw(result);
11265        if _result.is_err() {
11266            self.control_handle.shutdown();
11267        }
11268        self.drop_without_shutdown();
11269        _result
11270    }
11271
11272    /// Similar to "send" but does not shutdown the channel if an error occurs.
11273    pub fn send_no_shutdown_on_err(
11274        self,
11275        mut result: Result<FrameInfo, ScreenCaptureError>,
11276    ) -> Result<(), fidl::Error> {
11277        let _result = self.send_raw(result);
11278        self.drop_without_shutdown();
11279        _result
11280    }
11281
11282    fn send_raw(
11283        &self,
11284        mut result: Result<FrameInfo, ScreenCaptureError>,
11285    ) -> Result<(), fidl::Error> {
11286        self.control_handle.inner.send::<fidl::encoding::ResultType<FrameInfo, ScreenCaptureError>>(
11287            result.as_mut().map_err(|e| *e),
11288            self.tx_id,
11289            0x552c1580aab8c4a7,
11290            fidl::encoding::DynamicFlags::empty(),
11291        )
11292    }
11293}
11294
11295#[must_use = "FIDL methods require a response to be sent"]
11296#[derive(Debug)]
11297pub struct ScreenCaptureReleaseFrameResponder {
11298    control_handle: std::mem::ManuallyDrop<ScreenCaptureControlHandle>,
11299    tx_id: u32,
11300}
11301
11302/// Set the the channel to be shutdown (see [`ScreenCaptureControlHandle::shutdown`])
11303/// if the responder is dropped without sending a response, so that the client
11304/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
11305impl std::ops::Drop for ScreenCaptureReleaseFrameResponder {
11306    fn drop(&mut self) {
11307        self.control_handle.shutdown();
11308        // Safety: drops once, never accessed again
11309        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
11310    }
11311}
11312
11313impl fidl::endpoints::Responder for ScreenCaptureReleaseFrameResponder {
11314    type ControlHandle = ScreenCaptureControlHandle;
11315
11316    fn control_handle(&self) -> &ScreenCaptureControlHandle {
11317        &self.control_handle
11318    }
11319
11320    fn drop_without_shutdown(mut self) {
11321        // Safety: drops once, never accessed again due to mem::forget
11322        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
11323        // Prevent Drop from running (which would shut down the channel)
11324        std::mem::forget(self);
11325    }
11326}
11327
11328impl ScreenCaptureReleaseFrameResponder {
11329    /// Sends a response to the FIDL transaction.
11330    ///
11331    /// Sets the channel to shutdown if an error occurs.
11332    pub fn send(self, mut result: Result<(), ScreenCaptureError>) -> Result<(), fidl::Error> {
11333        let _result = self.send_raw(result);
11334        if _result.is_err() {
11335            self.control_handle.shutdown();
11336        }
11337        self.drop_without_shutdown();
11338        _result
11339    }
11340
11341    /// Similar to "send" but does not shutdown the channel if an error occurs.
11342    pub fn send_no_shutdown_on_err(
11343        self,
11344        mut result: Result<(), ScreenCaptureError>,
11345    ) -> Result<(), fidl::Error> {
11346        let _result = self.send_raw(result);
11347        self.drop_without_shutdown();
11348        _result
11349    }
11350
11351    fn send_raw(&self, mut result: Result<(), ScreenCaptureError>) -> Result<(), fidl::Error> {
11352        self.control_handle.inner.send::<fidl::encoding::ResultType<
11353            fidl::encoding::EmptyStruct,
11354            ScreenCaptureError,
11355        >>(
11356            result,
11357            self.tx_id,
11358            0x46704dce24e35950,
11359            fidl::encoding::DynamicFlags::empty(),
11360        )
11361    }
11362}
11363
11364#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
11365pub struct ScreenshotMarker;
11366
11367impl fidl::endpoints::ProtocolMarker for ScreenshotMarker {
11368    type Proxy = ScreenshotProxy;
11369    type RequestStream = ScreenshotRequestStream;
11370    #[cfg(target_os = "fuchsia")]
11371    type SynchronousProxy = ScreenshotSynchronousProxy;
11372
11373    const DEBUG_NAME: &'static str = "fuchsia.ui.composition.Screenshot";
11374}
11375impl fidl::endpoints::DiscoverableProtocolMarker for ScreenshotMarker {}
11376
11377pub trait ScreenshotProxyInterface: Send + Sync {
11378    type TakeResponseFut: std::future::Future<Output = Result<ScreenshotTakeResponse, fidl::Error>>
11379        + Send;
11380    fn r#take(&self, payload: ScreenshotTakeRequest) -> Self::TakeResponseFut;
11381    type TakeFileResponseFut: std::future::Future<Output = Result<ScreenshotTakeFileResponse, fidl::Error>>
11382        + Send;
11383    fn r#take_file(&self, payload: ScreenshotTakeFileRequest) -> Self::TakeFileResponseFut;
11384}
11385#[derive(Debug)]
11386#[cfg(target_os = "fuchsia")]
11387pub struct ScreenshotSynchronousProxy {
11388    client: fidl::client::sync::Client,
11389}
11390
11391#[cfg(target_os = "fuchsia")]
11392impl fidl::endpoints::SynchronousProxy for ScreenshotSynchronousProxy {
11393    type Proxy = ScreenshotProxy;
11394    type Protocol = ScreenshotMarker;
11395
11396    fn from_channel(inner: fidl::Channel) -> Self {
11397        Self::new(inner)
11398    }
11399
11400    fn into_channel(self) -> fidl::Channel {
11401        self.client.into_channel()
11402    }
11403
11404    fn as_channel(&self) -> &fidl::Channel {
11405        self.client.as_channel()
11406    }
11407}
11408
11409#[cfg(target_os = "fuchsia")]
11410impl ScreenshotSynchronousProxy {
11411    pub fn new(channel: fidl::Channel) -> Self {
11412        Self { client: fidl::client::sync::Client::new(channel) }
11413    }
11414
11415    pub fn into_channel(self) -> fidl::Channel {
11416        self.client.into_channel()
11417    }
11418
11419    /// Waits until an event arrives and returns it. It is safe for other
11420    /// threads to make concurrent requests while waiting for an event.
11421    pub fn wait_for_event(
11422        &self,
11423        deadline: zx::MonotonicInstant,
11424    ) -> Result<ScreenshotEvent, fidl::Error> {
11425        ScreenshotEvent::decode(self.client.wait_for_event::<ScreenshotMarker>(deadline)?)
11426    }
11427
11428    /// Collects the current graphical content of a display in a specified buffer `format` in the
11429    /// sRGB color space. Note that the sRGB color space is non-linear, meaning that unit tests
11430    /// doing pixel equality checks making use of non-fully saturated colors should convert to a
11431    /// linear color space.
11432    ///
11433    /// See https://fuchsia.dev/fuchsia-src/concepts/ui/scenic/color_spaces for more information.
11434    ///
11435    /// Screenshot is taken immediately, populated with the display's content from the most recent
11436    /// VSYNC.
11437    ///
11438    /// If the client calls [`Take`] a second time before a first [`Take`] call returns, the server
11439    /// will close the Screenshot connection with a ZX_ERR_SHOULD_WAIT epitaph.
11440    ///
11441    /// If capture fails due to an internal error, the server will close the Screenshot connection
11442    /// with a ZX_ERR_INTERNAL epitaph.
11443    pub fn r#take(
11444        &self,
11445        mut payload: ScreenshotTakeRequest,
11446        ___deadline: zx::MonotonicInstant,
11447    ) -> Result<ScreenshotTakeResponse, fidl::Error> {
11448        let _response = self
11449            .client
11450            .send_query::<ScreenshotTakeRequest, ScreenshotTakeResponse, ScreenshotMarker>(
11451                &mut payload,
11452                0x51341396e9fd2fd0,
11453                fidl::encoding::DynamicFlags::empty(),
11454                ___deadline,
11455            )?;
11456        Ok(_response)
11457    }
11458
11459    /// Collects the current graphical content of a display in a specified buffer `format` in the
11460    /// sRGB color space. Note that the sRGB color space is non-linear, meaning that unit tests
11461    /// doing pixel equality checks making use of non-fully saturated colors should convert to a
11462    /// linear color space.
11463    ///
11464    /// TODO(https://fxbug.dev/42065844): Link to fuchsia.dev documentation when it's up.
11465    ///
11466    /// Screenshot is taken immediately, populated with the display's content from the most recent
11467    /// VSYNC.
11468    ///
11469    /// If the client calls [`TakeFile`] a second time before a first [`TakeFile`] call returns,
11470    /// the server will close the Screenshot connection with a ZX_ERR_SHOULD_WAIT epitaph.
11471    ///
11472    /// If capture fails due to an internal error, the server will close the Screenshot connection
11473    /// with a ZX_ERR_INTERNAL epitaph.
11474    ///
11475    /// This call should be used if the client is on the host and does not support VMOs,
11476    /// as is the case for ffx tools.
11477    pub fn r#take_file(
11478        &self,
11479        mut payload: ScreenshotTakeFileRequest,
11480        ___deadline: zx::MonotonicInstant,
11481    ) -> Result<ScreenshotTakeFileResponse, fidl::Error> {
11482        let _response = self
11483            .client
11484            .send_query::<ScreenshotTakeFileRequest, ScreenshotTakeFileResponse, ScreenshotMarker>(
11485                &mut payload,
11486                0x470aeea0a4d32903,
11487                fidl::encoding::DynamicFlags::empty(),
11488                ___deadline,
11489            )?;
11490        Ok(_response)
11491    }
11492}
11493
11494#[cfg(target_os = "fuchsia")]
11495impl From<ScreenshotSynchronousProxy> for zx::NullableHandle {
11496    fn from(value: ScreenshotSynchronousProxy) -> Self {
11497        value.into_channel().into()
11498    }
11499}
11500
11501#[cfg(target_os = "fuchsia")]
11502impl From<fidl::Channel> for ScreenshotSynchronousProxy {
11503    fn from(value: fidl::Channel) -> Self {
11504        Self::new(value)
11505    }
11506}
11507
11508#[cfg(target_os = "fuchsia")]
11509impl fidl::endpoints::FromClient for ScreenshotSynchronousProxy {
11510    type Protocol = ScreenshotMarker;
11511
11512    fn from_client(value: fidl::endpoints::ClientEnd<ScreenshotMarker>) -> Self {
11513        Self::new(value.into_channel())
11514    }
11515}
11516
11517#[derive(Debug, Clone)]
11518pub struct ScreenshotProxy {
11519    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
11520}
11521
11522impl fidl::endpoints::Proxy for ScreenshotProxy {
11523    type Protocol = ScreenshotMarker;
11524
11525    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
11526        Self::new(inner)
11527    }
11528
11529    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
11530        self.client.into_channel().map_err(|client| Self { client })
11531    }
11532
11533    fn as_channel(&self) -> &::fidl::AsyncChannel {
11534        self.client.as_channel()
11535    }
11536}
11537
11538impl ScreenshotProxy {
11539    /// Create a new Proxy for fuchsia.ui.composition/Screenshot.
11540    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
11541        let protocol_name = <ScreenshotMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
11542        Self { client: fidl::client::Client::new(channel, protocol_name) }
11543    }
11544
11545    /// Get a Stream of events from the remote end of the protocol.
11546    ///
11547    /// # Panics
11548    ///
11549    /// Panics if the event stream was already taken.
11550    pub fn take_event_stream(&self) -> ScreenshotEventStream {
11551        ScreenshotEventStream { event_receiver: self.client.take_event_receiver() }
11552    }
11553
11554    /// Collects the current graphical content of a display in a specified buffer `format` in the
11555    /// sRGB color space. Note that the sRGB color space is non-linear, meaning that unit tests
11556    /// doing pixel equality checks making use of non-fully saturated colors should convert to a
11557    /// linear color space.
11558    ///
11559    /// See https://fuchsia.dev/fuchsia-src/concepts/ui/scenic/color_spaces for more information.
11560    ///
11561    /// Screenshot is taken immediately, populated with the display's content from the most recent
11562    /// VSYNC.
11563    ///
11564    /// If the client calls [`Take`] a second time before a first [`Take`] call returns, the server
11565    /// will close the Screenshot connection with a ZX_ERR_SHOULD_WAIT epitaph.
11566    ///
11567    /// If capture fails due to an internal error, the server will close the Screenshot connection
11568    /// with a ZX_ERR_INTERNAL epitaph.
11569    pub fn r#take(
11570        &self,
11571        mut payload: ScreenshotTakeRequest,
11572    ) -> fidl::client::QueryResponseFut<
11573        ScreenshotTakeResponse,
11574        fidl::encoding::DefaultFuchsiaResourceDialect,
11575    > {
11576        ScreenshotProxyInterface::r#take(self, payload)
11577    }
11578
11579    /// Collects the current graphical content of a display in a specified buffer `format` in the
11580    /// sRGB color space. Note that the sRGB color space is non-linear, meaning that unit tests
11581    /// doing pixel equality checks making use of non-fully saturated colors should convert to a
11582    /// linear color space.
11583    ///
11584    /// TODO(https://fxbug.dev/42065844): Link to fuchsia.dev documentation when it's up.
11585    ///
11586    /// Screenshot is taken immediately, populated with the display's content from the most recent
11587    /// VSYNC.
11588    ///
11589    /// If the client calls [`TakeFile`] a second time before a first [`TakeFile`] call returns,
11590    /// the server will close the Screenshot connection with a ZX_ERR_SHOULD_WAIT epitaph.
11591    ///
11592    /// If capture fails due to an internal error, the server will close the Screenshot connection
11593    /// with a ZX_ERR_INTERNAL epitaph.
11594    ///
11595    /// This call should be used if the client is on the host and does not support VMOs,
11596    /// as is the case for ffx tools.
11597    pub fn r#take_file(
11598        &self,
11599        mut payload: ScreenshotTakeFileRequest,
11600    ) -> fidl::client::QueryResponseFut<
11601        ScreenshotTakeFileResponse,
11602        fidl::encoding::DefaultFuchsiaResourceDialect,
11603    > {
11604        ScreenshotProxyInterface::r#take_file(self, payload)
11605    }
11606}
11607
11608impl ScreenshotProxyInterface for ScreenshotProxy {
11609    type TakeResponseFut = fidl::client::QueryResponseFut<
11610        ScreenshotTakeResponse,
11611        fidl::encoding::DefaultFuchsiaResourceDialect,
11612    >;
11613    fn r#take(&self, mut payload: ScreenshotTakeRequest) -> Self::TakeResponseFut {
11614        fn _decode(
11615            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
11616        ) -> Result<ScreenshotTakeResponse, fidl::Error> {
11617            let _response = fidl::client::decode_transaction_body::<
11618                ScreenshotTakeResponse,
11619                fidl::encoding::DefaultFuchsiaResourceDialect,
11620                0x51341396e9fd2fd0,
11621            >(_buf?)?;
11622            Ok(_response)
11623        }
11624        self.client.send_query_and_decode::<ScreenshotTakeRequest, ScreenshotTakeResponse>(
11625            &mut payload,
11626            0x51341396e9fd2fd0,
11627            fidl::encoding::DynamicFlags::empty(),
11628            _decode,
11629        )
11630    }
11631
11632    type TakeFileResponseFut = fidl::client::QueryResponseFut<
11633        ScreenshotTakeFileResponse,
11634        fidl::encoding::DefaultFuchsiaResourceDialect,
11635    >;
11636    fn r#take_file(&self, mut payload: ScreenshotTakeFileRequest) -> Self::TakeFileResponseFut {
11637        fn _decode(
11638            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
11639        ) -> Result<ScreenshotTakeFileResponse, fidl::Error> {
11640            let _response = fidl::client::decode_transaction_body::<
11641                ScreenshotTakeFileResponse,
11642                fidl::encoding::DefaultFuchsiaResourceDialect,
11643                0x470aeea0a4d32903,
11644            >(_buf?)?;
11645            Ok(_response)
11646        }
11647        self.client.send_query_and_decode::<ScreenshotTakeFileRequest, ScreenshotTakeFileResponse>(
11648            &mut payload,
11649            0x470aeea0a4d32903,
11650            fidl::encoding::DynamicFlags::empty(),
11651            _decode,
11652        )
11653    }
11654}
11655
11656pub struct ScreenshotEventStream {
11657    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
11658}
11659
11660impl std::marker::Unpin for ScreenshotEventStream {}
11661
11662impl futures::stream::FusedStream for ScreenshotEventStream {
11663    fn is_terminated(&self) -> bool {
11664        self.event_receiver.is_terminated()
11665    }
11666}
11667
11668impl futures::Stream for ScreenshotEventStream {
11669    type Item = Result<ScreenshotEvent, fidl::Error>;
11670
11671    fn poll_next(
11672        mut self: std::pin::Pin<&mut Self>,
11673        cx: &mut std::task::Context<'_>,
11674    ) -> std::task::Poll<Option<Self::Item>> {
11675        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
11676            &mut self.event_receiver,
11677            cx
11678        )?) {
11679            Some(buf) => std::task::Poll::Ready(Some(ScreenshotEvent::decode(buf))),
11680            None => std::task::Poll::Ready(None),
11681        }
11682    }
11683}
11684
11685#[derive(Debug)]
11686pub enum ScreenshotEvent {}
11687
11688impl ScreenshotEvent {
11689    /// Decodes a message buffer as a [`ScreenshotEvent`].
11690    fn decode(
11691        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
11692    ) -> Result<ScreenshotEvent, fidl::Error> {
11693        let (bytes, _handles) = buf.split_mut();
11694        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
11695        debug_assert_eq!(tx_header.tx_id, 0);
11696        match tx_header.ordinal {
11697            _ => Err(fidl::Error::UnknownOrdinal {
11698                ordinal: tx_header.ordinal,
11699                protocol_name: <ScreenshotMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
11700            }),
11701        }
11702    }
11703}
11704
11705/// A Stream of incoming requests for fuchsia.ui.composition/Screenshot.
11706pub struct ScreenshotRequestStream {
11707    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
11708    is_terminated: bool,
11709}
11710
11711impl std::marker::Unpin for ScreenshotRequestStream {}
11712
11713impl futures::stream::FusedStream for ScreenshotRequestStream {
11714    fn is_terminated(&self) -> bool {
11715        self.is_terminated
11716    }
11717}
11718
11719impl fidl::endpoints::RequestStream for ScreenshotRequestStream {
11720    type Protocol = ScreenshotMarker;
11721    type ControlHandle = ScreenshotControlHandle;
11722
11723    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
11724        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
11725    }
11726
11727    fn control_handle(&self) -> Self::ControlHandle {
11728        ScreenshotControlHandle { inner: self.inner.clone() }
11729    }
11730
11731    fn into_inner(
11732        self,
11733    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
11734    {
11735        (self.inner, self.is_terminated)
11736    }
11737
11738    fn from_inner(
11739        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
11740        is_terminated: bool,
11741    ) -> Self {
11742        Self { inner, is_terminated }
11743    }
11744}
11745
11746impl futures::Stream for ScreenshotRequestStream {
11747    type Item = Result<ScreenshotRequest, fidl::Error>;
11748
11749    fn poll_next(
11750        mut self: std::pin::Pin<&mut Self>,
11751        cx: &mut std::task::Context<'_>,
11752    ) -> std::task::Poll<Option<Self::Item>> {
11753        let this = &mut *self;
11754        if this.inner.check_shutdown(cx) {
11755            this.is_terminated = true;
11756            return std::task::Poll::Ready(None);
11757        }
11758        if this.is_terminated {
11759            panic!("polled ScreenshotRequestStream after completion");
11760        }
11761        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
11762            |bytes, handles| {
11763                match this.inner.channel().read_etc(cx, bytes, handles) {
11764                    std::task::Poll::Ready(Ok(())) => {}
11765                    std::task::Poll::Pending => return std::task::Poll::Pending,
11766                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
11767                        this.is_terminated = true;
11768                        return std::task::Poll::Ready(None);
11769                    }
11770                    std::task::Poll::Ready(Err(e)) => {
11771                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
11772                            e.into(),
11773                        ))));
11774                    }
11775                }
11776
11777                // A message has been received from the channel
11778                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
11779
11780                std::task::Poll::Ready(Some(match header.ordinal {
11781                    0x51341396e9fd2fd0 => {
11782                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
11783                        let mut req = fidl::new_empty!(
11784                            ScreenshotTakeRequest,
11785                            fidl::encoding::DefaultFuchsiaResourceDialect
11786                        );
11787                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ScreenshotTakeRequest>(&header, _body_bytes, handles, &mut req)?;
11788                        let control_handle = ScreenshotControlHandle { inner: this.inner.clone() };
11789                        Ok(ScreenshotRequest::Take {
11790                            payload: req,
11791                            responder: ScreenshotTakeResponder {
11792                                control_handle: std::mem::ManuallyDrop::new(control_handle),
11793                                tx_id: header.tx_id,
11794                            },
11795                        })
11796                    }
11797                    0x470aeea0a4d32903 => {
11798                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
11799                        let mut req = fidl::new_empty!(
11800                            ScreenshotTakeFileRequest,
11801                            fidl::encoding::DefaultFuchsiaResourceDialect
11802                        );
11803                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ScreenshotTakeFileRequest>(&header, _body_bytes, handles, &mut req)?;
11804                        let control_handle = ScreenshotControlHandle { inner: this.inner.clone() };
11805                        Ok(ScreenshotRequest::TakeFile {
11806                            payload: req,
11807                            responder: ScreenshotTakeFileResponder {
11808                                control_handle: std::mem::ManuallyDrop::new(control_handle),
11809                                tx_id: header.tx_id,
11810                            },
11811                        })
11812                    }
11813                    _ => Err(fidl::Error::UnknownOrdinal {
11814                        ordinal: header.ordinal,
11815                        protocol_name:
11816                            <ScreenshotMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
11817                    }),
11818                }))
11819            },
11820        )
11821    }
11822}
11823
11824/// Collects the current graphical content of a display.
11825#[derive(Debug)]
11826pub enum ScreenshotRequest {
11827    /// Collects the current graphical content of a display in a specified buffer `format` in the
11828    /// sRGB color space. Note that the sRGB color space is non-linear, meaning that unit tests
11829    /// doing pixel equality checks making use of non-fully saturated colors should convert to a
11830    /// linear color space.
11831    ///
11832    /// See https://fuchsia.dev/fuchsia-src/concepts/ui/scenic/color_spaces for more information.
11833    ///
11834    /// Screenshot is taken immediately, populated with the display's content from the most recent
11835    /// VSYNC.
11836    ///
11837    /// If the client calls [`Take`] a second time before a first [`Take`] call returns, the server
11838    /// will close the Screenshot connection with a ZX_ERR_SHOULD_WAIT epitaph.
11839    ///
11840    /// If capture fails due to an internal error, the server will close the Screenshot connection
11841    /// with a ZX_ERR_INTERNAL epitaph.
11842    Take { payload: ScreenshotTakeRequest, responder: ScreenshotTakeResponder },
11843    /// Collects the current graphical content of a display in a specified buffer `format` in the
11844    /// sRGB color space. Note that the sRGB color space is non-linear, meaning that unit tests
11845    /// doing pixel equality checks making use of non-fully saturated colors should convert to a
11846    /// linear color space.
11847    ///
11848    /// TODO(https://fxbug.dev/42065844): Link to fuchsia.dev documentation when it's up.
11849    ///
11850    /// Screenshot is taken immediately, populated with the display's content from the most recent
11851    /// VSYNC.
11852    ///
11853    /// If the client calls [`TakeFile`] a second time before a first [`TakeFile`] call returns,
11854    /// the server will close the Screenshot connection with a ZX_ERR_SHOULD_WAIT epitaph.
11855    ///
11856    /// If capture fails due to an internal error, the server will close the Screenshot connection
11857    /// with a ZX_ERR_INTERNAL epitaph.
11858    ///
11859    /// This call should be used if the client is on the host and does not support VMOs,
11860    /// as is the case for ffx tools.
11861    TakeFile { payload: ScreenshotTakeFileRequest, responder: ScreenshotTakeFileResponder },
11862}
11863
11864impl ScreenshotRequest {
11865    #[allow(irrefutable_let_patterns)]
11866    pub fn into_take(self) -> Option<(ScreenshotTakeRequest, ScreenshotTakeResponder)> {
11867        if let ScreenshotRequest::Take { payload, responder } = self {
11868            Some((payload, responder))
11869        } else {
11870            None
11871        }
11872    }
11873
11874    #[allow(irrefutable_let_patterns)]
11875    pub fn into_take_file(
11876        self,
11877    ) -> Option<(ScreenshotTakeFileRequest, ScreenshotTakeFileResponder)> {
11878        if let ScreenshotRequest::TakeFile { payload, responder } = self {
11879            Some((payload, responder))
11880        } else {
11881            None
11882        }
11883    }
11884
11885    /// Name of the method defined in FIDL
11886    pub fn method_name(&self) -> &'static str {
11887        match *self {
11888            ScreenshotRequest::Take { .. } => "take",
11889            ScreenshotRequest::TakeFile { .. } => "take_file",
11890        }
11891    }
11892}
11893
11894#[derive(Debug, Clone)]
11895pub struct ScreenshotControlHandle {
11896    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
11897}
11898
11899impl ScreenshotControlHandle {
11900    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
11901        self.inner.shutdown_with_epitaph(status.into())
11902    }
11903}
11904
11905impl fidl::endpoints::ControlHandle for ScreenshotControlHandle {
11906    fn shutdown(&self) {
11907        self.inner.shutdown()
11908    }
11909
11910    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
11911        self.inner.shutdown_with_epitaph(status)
11912    }
11913
11914    fn is_closed(&self) -> bool {
11915        self.inner.channel().is_closed()
11916    }
11917    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
11918        self.inner.channel().on_closed()
11919    }
11920
11921    #[cfg(target_os = "fuchsia")]
11922    fn signal_peer(
11923        &self,
11924        clear_mask: zx::Signals,
11925        set_mask: zx::Signals,
11926    ) -> Result<(), zx_status::Status> {
11927        use fidl::Peered;
11928        self.inner.channel().signal_peer(clear_mask, set_mask)
11929    }
11930}
11931
11932impl ScreenshotControlHandle {}
11933
11934#[must_use = "FIDL methods require a response to be sent"]
11935#[derive(Debug)]
11936pub struct ScreenshotTakeResponder {
11937    control_handle: std::mem::ManuallyDrop<ScreenshotControlHandle>,
11938    tx_id: u32,
11939}
11940
11941/// Set the the channel to be shutdown (see [`ScreenshotControlHandle::shutdown`])
11942/// if the responder is dropped without sending a response, so that the client
11943/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
11944impl std::ops::Drop for ScreenshotTakeResponder {
11945    fn drop(&mut self) {
11946        self.control_handle.shutdown();
11947        // Safety: drops once, never accessed again
11948        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
11949    }
11950}
11951
11952impl fidl::endpoints::Responder for ScreenshotTakeResponder {
11953    type ControlHandle = ScreenshotControlHandle;
11954
11955    fn control_handle(&self) -> &ScreenshotControlHandle {
11956        &self.control_handle
11957    }
11958
11959    fn drop_without_shutdown(mut self) {
11960        // Safety: drops once, never accessed again due to mem::forget
11961        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
11962        // Prevent Drop from running (which would shut down the channel)
11963        std::mem::forget(self);
11964    }
11965}
11966
11967impl ScreenshotTakeResponder {
11968    /// Sends a response to the FIDL transaction.
11969    ///
11970    /// Sets the channel to shutdown if an error occurs.
11971    pub fn send(self, mut payload: ScreenshotTakeResponse) -> Result<(), fidl::Error> {
11972        let _result = self.send_raw(payload);
11973        if _result.is_err() {
11974            self.control_handle.shutdown();
11975        }
11976        self.drop_without_shutdown();
11977        _result
11978    }
11979
11980    /// Similar to "send" but does not shutdown the channel if an error occurs.
11981    pub fn send_no_shutdown_on_err(
11982        self,
11983        mut payload: ScreenshotTakeResponse,
11984    ) -> Result<(), fidl::Error> {
11985        let _result = self.send_raw(payload);
11986        self.drop_without_shutdown();
11987        _result
11988    }
11989
11990    fn send_raw(&self, mut payload: ScreenshotTakeResponse) -> Result<(), fidl::Error> {
11991        self.control_handle.inner.send::<ScreenshotTakeResponse>(
11992            &mut payload,
11993            self.tx_id,
11994            0x51341396e9fd2fd0,
11995            fidl::encoding::DynamicFlags::empty(),
11996        )
11997    }
11998}
11999
12000#[must_use = "FIDL methods require a response to be sent"]
12001#[derive(Debug)]
12002pub struct ScreenshotTakeFileResponder {
12003    control_handle: std::mem::ManuallyDrop<ScreenshotControlHandle>,
12004    tx_id: u32,
12005}
12006
12007/// Set the the channel to be shutdown (see [`ScreenshotControlHandle::shutdown`])
12008/// if the responder is dropped without sending a response, so that the client
12009/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
12010impl std::ops::Drop for ScreenshotTakeFileResponder {
12011    fn drop(&mut self) {
12012        self.control_handle.shutdown();
12013        // Safety: drops once, never accessed again
12014        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
12015    }
12016}
12017
12018impl fidl::endpoints::Responder for ScreenshotTakeFileResponder {
12019    type ControlHandle = ScreenshotControlHandle;
12020
12021    fn control_handle(&self) -> &ScreenshotControlHandle {
12022        &self.control_handle
12023    }
12024
12025    fn drop_without_shutdown(mut self) {
12026        // Safety: drops once, never accessed again due to mem::forget
12027        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
12028        // Prevent Drop from running (which would shut down the channel)
12029        std::mem::forget(self);
12030    }
12031}
12032
12033impl ScreenshotTakeFileResponder {
12034    /// Sends a response to the FIDL transaction.
12035    ///
12036    /// Sets the channel to shutdown if an error occurs.
12037    pub fn send(self, mut payload: ScreenshotTakeFileResponse) -> Result<(), fidl::Error> {
12038        let _result = self.send_raw(payload);
12039        if _result.is_err() {
12040            self.control_handle.shutdown();
12041        }
12042        self.drop_without_shutdown();
12043        _result
12044    }
12045
12046    /// Similar to "send" but does not shutdown the channel if an error occurs.
12047    pub fn send_no_shutdown_on_err(
12048        self,
12049        mut payload: ScreenshotTakeFileResponse,
12050    ) -> Result<(), fidl::Error> {
12051        let _result = self.send_raw(payload);
12052        self.drop_without_shutdown();
12053        _result
12054    }
12055
12056    fn send_raw(&self, mut payload: ScreenshotTakeFileResponse) -> Result<(), fidl::Error> {
12057        self.control_handle.inner.send::<ScreenshotTakeFileResponse>(
12058            &mut payload,
12059            self.tx_id,
12060            0x470aeea0a4d32903,
12061            fidl::encoding::DynamicFlags::empty(),
12062        )
12063    }
12064}
12065
12066#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
12067pub struct TrustedFlatlandMarker;
12068
12069impl fidl::endpoints::ProtocolMarker for TrustedFlatlandMarker {
12070    type Proxy = TrustedFlatlandProxy;
12071    type RequestStream = TrustedFlatlandRequestStream;
12072    #[cfg(target_os = "fuchsia")]
12073    type SynchronousProxy = TrustedFlatlandSynchronousProxy;
12074
12075    const DEBUG_NAME: &'static str = "(anonymous) TrustedFlatland";
12076}
12077
12078pub trait TrustedFlatlandProxyInterface: Send + Sync {
12079    fn r#release_image_immediately(&self, image_id: &ContentId) -> Result<(), fidl::Error>;
12080    fn r#release_image_immediately2(&self, image_id: &ImageId) -> Result<(), fidl::Error>;
12081}
12082#[derive(Debug)]
12083#[cfg(target_os = "fuchsia")]
12084pub struct TrustedFlatlandSynchronousProxy {
12085    client: fidl::client::sync::Client,
12086}
12087
12088#[cfg(target_os = "fuchsia")]
12089impl fidl::endpoints::SynchronousProxy for TrustedFlatlandSynchronousProxy {
12090    type Proxy = TrustedFlatlandProxy;
12091    type Protocol = TrustedFlatlandMarker;
12092
12093    fn from_channel(inner: fidl::Channel) -> Self {
12094        Self::new(inner)
12095    }
12096
12097    fn into_channel(self) -> fidl::Channel {
12098        self.client.into_channel()
12099    }
12100
12101    fn as_channel(&self) -> &fidl::Channel {
12102        self.client.as_channel()
12103    }
12104}
12105
12106#[cfg(target_os = "fuchsia")]
12107impl TrustedFlatlandSynchronousProxy {
12108    pub fn new(channel: fidl::Channel) -> Self {
12109        Self { client: fidl::client::sync::Client::new(channel) }
12110    }
12111
12112    pub fn into_channel(self) -> fidl::Channel {
12113        self.client.into_channel()
12114    }
12115
12116    /// Waits until an event arrives and returns it. It is safe for other
12117    /// threads to make concurrent requests while waiting for an event.
12118    pub fn wait_for_event(
12119        &self,
12120        deadline: zx::MonotonicInstant,
12121    ) -> Result<TrustedFlatlandEvent, fidl::Error> {
12122        TrustedFlatlandEvent::decode(self.client.wait_for_event::<TrustedFlatlandMarker>(deadline)?)
12123    }
12124
12125    /// Releases an image immediately, without waiting for the next present.
12126    pub fn r#release_image_immediately(&self, mut image_id: &ContentId) -> Result<(), fidl::Error> {
12127        self.client.send::<TrustedFlatlandReleaseImageImmediatelyRequest>(
12128            (image_id,),
12129            0x245e1ac080772c8,
12130            fidl::encoding::DynamicFlags::empty(),
12131        )
12132    }
12133
12134    /// Releases an Image immediately, without waiting for the next present. This is a trusted
12135    /// memory-eviction path.
12136    ///
12137    /// The Image is forcibly unbound from any Layers that currently reference it. Those Layers
12138    /// behave as if their image was simply never set (they are invisible, but retain their image
12139    /// properties) until their next `SetLayerImage()`.
12140    ///
12141    /// Any pending release fences for the evicted Image's bindings will signal at the earliest
12142    /// safe point.
12143    ///
12144    /// This method is only available if Flatland2 is enabled and the session is trusted.
12145    pub fn r#release_image_immediately2(&self, mut image_id: &ImageId) -> Result<(), fidl::Error> {
12146        self.client.send::<TrustedFlatlandReleaseImageImmediately2Request>(
12147            (image_id,),
12148            0x6d6a73d150589146,
12149            fidl::encoding::DynamicFlags::empty(),
12150        )
12151    }
12152}
12153
12154#[cfg(target_os = "fuchsia")]
12155impl From<TrustedFlatlandSynchronousProxy> for zx::NullableHandle {
12156    fn from(value: TrustedFlatlandSynchronousProxy) -> Self {
12157        value.into_channel().into()
12158    }
12159}
12160
12161#[cfg(target_os = "fuchsia")]
12162impl From<fidl::Channel> for TrustedFlatlandSynchronousProxy {
12163    fn from(value: fidl::Channel) -> Self {
12164        Self::new(value)
12165    }
12166}
12167
12168#[cfg(target_os = "fuchsia")]
12169impl fidl::endpoints::FromClient for TrustedFlatlandSynchronousProxy {
12170    type Protocol = TrustedFlatlandMarker;
12171
12172    fn from_client(value: fidl::endpoints::ClientEnd<TrustedFlatlandMarker>) -> Self {
12173        Self::new(value.into_channel())
12174    }
12175}
12176
12177#[derive(Debug, Clone)]
12178pub struct TrustedFlatlandProxy {
12179    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
12180}
12181
12182impl fidl::endpoints::Proxy for TrustedFlatlandProxy {
12183    type Protocol = TrustedFlatlandMarker;
12184
12185    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
12186        Self::new(inner)
12187    }
12188
12189    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
12190        self.client.into_channel().map_err(|client| Self { client })
12191    }
12192
12193    fn as_channel(&self) -> &::fidl::AsyncChannel {
12194        self.client.as_channel()
12195    }
12196}
12197
12198impl TrustedFlatlandProxy {
12199    /// Create a new Proxy for fuchsia.ui.composition/TrustedFlatland.
12200    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
12201        let protocol_name = <TrustedFlatlandMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
12202        Self { client: fidl::client::Client::new(channel, protocol_name) }
12203    }
12204
12205    /// Get a Stream of events from the remote end of the protocol.
12206    ///
12207    /// # Panics
12208    ///
12209    /// Panics if the event stream was already taken.
12210    pub fn take_event_stream(&self) -> TrustedFlatlandEventStream {
12211        TrustedFlatlandEventStream { event_receiver: self.client.take_event_receiver() }
12212    }
12213
12214    /// Releases an image immediately, without waiting for the next present.
12215    pub fn r#release_image_immediately(&self, mut image_id: &ContentId) -> Result<(), fidl::Error> {
12216        TrustedFlatlandProxyInterface::r#release_image_immediately(self, image_id)
12217    }
12218
12219    /// Releases an Image immediately, without waiting for the next present. This is a trusted
12220    /// memory-eviction path.
12221    ///
12222    /// The Image is forcibly unbound from any Layers that currently reference it. Those Layers
12223    /// behave as if their image was simply never set (they are invisible, but retain their image
12224    /// properties) until their next `SetLayerImage()`.
12225    ///
12226    /// Any pending release fences for the evicted Image's bindings will signal at the earliest
12227    /// safe point.
12228    ///
12229    /// This method is only available if Flatland2 is enabled and the session is trusted.
12230    pub fn r#release_image_immediately2(&self, mut image_id: &ImageId) -> Result<(), fidl::Error> {
12231        TrustedFlatlandProxyInterface::r#release_image_immediately2(self, image_id)
12232    }
12233}
12234
12235impl TrustedFlatlandProxyInterface for TrustedFlatlandProxy {
12236    fn r#release_image_immediately(&self, mut image_id: &ContentId) -> Result<(), fidl::Error> {
12237        self.client.send::<TrustedFlatlandReleaseImageImmediatelyRequest>(
12238            (image_id,),
12239            0x245e1ac080772c8,
12240            fidl::encoding::DynamicFlags::empty(),
12241        )
12242    }
12243
12244    fn r#release_image_immediately2(&self, mut image_id: &ImageId) -> Result<(), fidl::Error> {
12245        self.client.send::<TrustedFlatlandReleaseImageImmediately2Request>(
12246            (image_id,),
12247            0x6d6a73d150589146,
12248            fidl::encoding::DynamicFlags::empty(),
12249        )
12250    }
12251}
12252
12253pub struct TrustedFlatlandEventStream {
12254    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
12255}
12256
12257impl std::marker::Unpin for TrustedFlatlandEventStream {}
12258
12259impl futures::stream::FusedStream for TrustedFlatlandEventStream {
12260    fn is_terminated(&self) -> bool {
12261        self.event_receiver.is_terminated()
12262    }
12263}
12264
12265impl futures::Stream for TrustedFlatlandEventStream {
12266    type Item = Result<TrustedFlatlandEvent, fidl::Error>;
12267
12268    fn poll_next(
12269        mut self: std::pin::Pin<&mut Self>,
12270        cx: &mut std::task::Context<'_>,
12271    ) -> std::task::Poll<Option<Self::Item>> {
12272        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
12273            &mut self.event_receiver,
12274            cx
12275        )?) {
12276            Some(buf) => std::task::Poll::Ready(Some(TrustedFlatlandEvent::decode(buf))),
12277            None => std::task::Poll::Ready(None),
12278        }
12279    }
12280}
12281
12282#[derive(Debug)]
12283pub enum TrustedFlatlandEvent {}
12284
12285impl TrustedFlatlandEvent {
12286    /// Decodes a message buffer as a [`TrustedFlatlandEvent`].
12287    fn decode(
12288        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
12289    ) -> Result<TrustedFlatlandEvent, fidl::Error> {
12290        let (bytes, _handles) = buf.split_mut();
12291        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
12292        debug_assert_eq!(tx_header.tx_id, 0);
12293        match tx_header.ordinal {
12294            _ => Err(fidl::Error::UnknownOrdinal {
12295                ordinal: tx_header.ordinal,
12296                protocol_name:
12297                    <TrustedFlatlandMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
12298            }),
12299        }
12300    }
12301}
12302
12303/// A Stream of incoming requests for fuchsia.ui.composition/TrustedFlatland.
12304pub struct TrustedFlatlandRequestStream {
12305    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
12306    is_terminated: bool,
12307}
12308
12309impl std::marker::Unpin for TrustedFlatlandRequestStream {}
12310
12311impl futures::stream::FusedStream for TrustedFlatlandRequestStream {
12312    fn is_terminated(&self) -> bool {
12313        self.is_terminated
12314    }
12315}
12316
12317impl fidl::endpoints::RequestStream for TrustedFlatlandRequestStream {
12318    type Protocol = TrustedFlatlandMarker;
12319    type ControlHandle = TrustedFlatlandControlHandle;
12320
12321    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
12322        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
12323    }
12324
12325    fn control_handle(&self) -> Self::ControlHandle {
12326        TrustedFlatlandControlHandle { inner: self.inner.clone() }
12327    }
12328
12329    fn into_inner(
12330        self,
12331    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
12332    {
12333        (self.inner, self.is_terminated)
12334    }
12335
12336    fn from_inner(
12337        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
12338        is_terminated: bool,
12339    ) -> Self {
12340        Self { inner, is_terminated }
12341    }
12342}
12343
12344impl futures::Stream for TrustedFlatlandRequestStream {
12345    type Item = Result<TrustedFlatlandRequest, fidl::Error>;
12346
12347    fn poll_next(
12348        mut self: std::pin::Pin<&mut Self>,
12349        cx: &mut std::task::Context<'_>,
12350    ) -> std::task::Poll<Option<Self::Item>> {
12351        let this = &mut *self;
12352        if this.inner.check_shutdown(cx) {
12353            this.is_terminated = true;
12354            return std::task::Poll::Ready(None);
12355        }
12356        if this.is_terminated {
12357            panic!("polled TrustedFlatlandRequestStream after completion");
12358        }
12359        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
12360            |bytes, handles| {
12361                match this.inner.channel().read_etc(cx, bytes, handles) {
12362                    std::task::Poll::Ready(Ok(())) => {}
12363                    std::task::Poll::Pending => return std::task::Poll::Pending,
12364                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
12365                        this.is_terminated = true;
12366                        return std::task::Poll::Ready(None);
12367                    }
12368                    std::task::Poll::Ready(Err(e)) => {
12369                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
12370                            e.into(),
12371                        ))));
12372                    }
12373                }
12374
12375                // A message has been received from the channel
12376                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
12377
12378                std::task::Poll::Ready(Some(match header.ordinal {
12379                    0x245e1ac080772c8 => {
12380                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
12381                        let mut req = fidl::new_empty!(
12382                            TrustedFlatlandReleaseImageImmediatelyRequest,
12383                            fidl::encoding::DefaultFuchsiaResourceDialect
12384                        );
12385                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<TrustedFlatlandReleaseImageImmediatelyRequest>(&header, _body_bytes, handles, &mut req)?;
12386                        let control_handle =
12387                            TrustedFlatlandControlHandle { inner: this.inner.clone() };
12388                        Ok(TrustedFlatlandRequest::ReleaseImageImmediately {
12389                            image_id: req.image_id,
12390
12391                            control_handle,
12392                        })
12393                    }
12394                    0x6d6a73d150589146 => {
12395                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
12396                        let mut req = fidl::new_empty!(
12397                            TrustedFlatlandReleaseImageImmediately2Request,
12398                            fidl::encoding::DefaultFuchsiaResourceDialect
12399                        );
12400                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<TrustedFlatlandReleaseImageImmediately2Request>(&header, _body_bytes, handles, &mut req)?;
12401                        let control_handle =
12402                            TrustedFlatlandControlHandle { inner: this.inner.clone() };
12403                        Ok(TrustedFlatlandRequest::ReleaseImageImmediately2 {
12404                            image_id: req.image_id,
12405
12406                            control_handle,
12407                        })
12408                    }
12409                    _ => Err(fidl::Error::UnknownOrdinal {
12410                        ordinal: header.ordinal,
12411                        protocol_name:
12412                            <TrustedFlatlandMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
12413                    }),
12414                }))
12415            },
12416        )
12417    }
12418}
12419
12420/// A privileged protocol for trusted Flatland sessions that require special capabilities.
12421///
12422/// This protocol is composed into the [Flatland] protocol. Methods in this protocol
12423/// are only available if the Flatland session was created via [TrustedFlatlandFactory].
12424#[derive(Debug)]
12425pub enum TrustedFlatlandRequest {
12426    /// Releases an image immediately, without waiting for the next present.
12427    ReleaseImageImmediately { image_id: ContentId, control_handle: TrustedFlatlandControlHandle },
12428    /// Releases an Image immediately, without waiting for the next present. This is a trusted
12429    /// memory-eviction path.
12430    ///
12431    /// The Image is forcibly unbound from any Layers that currently reference it. Those Layers
12432    /// behave as if their image was simply never set (they are invisible, but retain their image
12433    /// properties) until their next `SetLayerImage()`.
12434    ///
12435    /// Any pending release fences for the evicted Image's bindings will signal at the earliest
12436    /// safe point.
12437    ///
12438    /// This method is only available if Flatland2 is enabled and the session is trusted.
12439    ReleaseImageImmediately2 { image_id: ImageId, control_handle: TrustedFlatlandControlHandle },
12440}
12441
12442impl TrustedFlatlandRequest {
12443    #[allow(irrefutable_let_patterns)]
12444    pub fn into_release_image_immediately(
12445        self,
12446    ) -> Option<(ContentId, TrustedFlatlandControlHandle)> {
12447        if let TrustedFlatlandRequest::ReleaseImageImmediately { image_id, control_handle } = self {
12448            Some((image_id, control_handle))
12449        } else {
12450            None
12451        }
12452    }
12453
12454    #[allow(irrefutable_let_patterns)]
12455    pub fn into_release_image_immediately2(
12456        self,
12457    ) -> Option<(ImageId, TrustedFlatlandControlHandle)> {
12458        if let TrustedFlatlandRequest::ReleaseImageImmediately2 { image_id, control_handle } = self
12459        {
12460            Some((image_id, control_handle))
12461        } else {
12462            None
12463        }
12464    }
12465
12466    /// Name of the method defined in FIDL
12467    pub fn method_name(&self) -> &'static str {
12468        match *self {
12469            TrustedFlatlandRequest::ReleaseImageImmediately { .. } => "release_image_immediately",
12470            TrustedFlatlandRequest::ReleaseImageImmediately2 { .. } => "release_image_immediately2",
12471        }
12472    }
12473}
12474
12475#[derive(Debug, Clone)]
12476pub struct TrustedFlatlandControlHandle {
12477    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
12478}
12479
12480impl TrustedFlatlandControlHandle {
12481    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
12482        self.inner.shutdown_with_epitaph(status.into())
12483    }
12484}
12485
12486impl fidl::endpoints::ControlHandle for TrustedFlatlandControlHandle {
12487    fn shutdown(&self) {
12488        self.inner.shutdown()
12489    }
12490
12491    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
12492        self.inner.shutdown_with_epitaph(status)
12493    }
12494
12495    fn is_closed(&self) -> bool {
12496        self.inner.channel().is_closed()
12497    }
12498    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
12499        self.inner.channel().on_closed()
12500    }
12501
12502    #[cfg(target_os = "fuchsia")]
12503    fn signal_peer(
12504        &self,
12505        clear_mask: zx::Signals,
12506        set_mask: zx::Signals,
12507    ) -> Result<(), zx_status::Status> {
12508        use fidl::Peered;
12509        self.inner.channel().signal_peer(clear_mask, set_mask)
12510    }
12511}
12512
12513impl TrustedFlatlandControlHandle {}
12514
12515#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
12516pub struct TrustedFlatlandFactoryMarker;
12517
12518impl fidl::endpoints::ProtocolMarker for TrustedFlatlandFactoryMarker {
12519    type Proxy = TrustedFlatlandFactoryProxy;
12520    type RequestStream = TrustedFlatlandFactoryRequestStream;
12521    #[cfg(target_os = "fuchsia")]
12522    type SynchronousProxy = TrustedFlatlandFactorySynchronousProxy;
12523
12524    const DEBUG_NAME: &'static str = "fuchsia.ui.composition.TrustedFlatlandFactory";
12525}
12526impl fidl::endpoints::DiscoverableProtocolMarker for TrustedFlatlandFactoryMarker {}
12527pub type TrustedFlatlandFactoryCreateFlatlandResult = Result<(), TrustedFlatlandFactoryError>;
12528
12529pub trait TrustedFlatlandFactoryProxyInterface: Send + Sync {
12530    type CreateFlatlandResponseFut: std::future::Future<
12531            Output = Result<TrustedFlatlandFactoryCreateFlatlandResult, fidl::Error>,
12532        > + Send;
12533    fn r#create_flatland(
12534        &self,
12535        server_end: fidl::endpoints::ServerEnd<FlatlandMarker>,
12536        config: TrustedFlatlandConfig,
12537    ) -> Self::CreateFlatlandResponseFut;
12538}
12539#[derive(Debug)]
12540#[cfg(target_os = "fuchsia")]
12541pub struct TrustedFlatlandFactorySynchronousProxy {
12542    client: fidl::client::sync::Client,
12543}
12544
12545#[cfg(target_os = "fuchsia")]
12546impl fidl::endpoints::SynchronousProxy for TrustedFlatlandFactorySynchronousProxy {
12547    type Proxy = TrustedFlatlandFactoryProxy;
12548    type Protocol = TrustedFlatlandFactoryMarker;
12549
12550    fn from_channel(inner: fidl::Channel) -> Self {
12551        Self::new(inner)
12552    }
12553
12554    fn into_channel(self) -> fidl::Channel {
12555        self.client.into_channel()
12556    }
12557
12558    fn as_channel(&self) -> &fidl::Channel {
12559        self.client.as_channel()
12560    }
12561}
12562
12563#[cfg(target_os = "fuchsia")]
12564impl TrustedFlatlandFactorySynchronousProxy {
12565    pub fn new(channel: fidl::Channel) -> Self {
12566        Self { client: fidl::client::sync::Client::new(channel) }
12567    }
12568
12569    pub fn into_channel(self) -> fidl::Channel {
12570        self.client.into_channel()
12571    }
12572
12573    /// Waits until an event arrives and returns it. It is safe for other
12574    /// threads to make concurrent requests while waiting for an event.
12575    pub fn wait_for_event(
12576        &self,
12577        deadline: zx::MonotonicInstant,
12578    ) -> Result<TrustedFlatlandFactoryEvent, fidl::Error> {
12579        TrustedFlatlandFactoryEvent::decode(
12580            self.client.wait_for_event::<TrustedFlatlandFactoryMarker>(deadline)?,
12581        )
12582    }
12583
12584    /// Creates a new Flatland session with the specified configuration.
12585    ///
12586    /// ## Error
12587    ///
12588    /// Returns a [TrustedFlatlandFactoryError] error if the operation fails.
12589    pub fn r#create_flatland(
12590        &self,
12591        mut server_end: fidl::endpoints::ServerEnd<FlatlandMarker>,
12592        mut config: TrustedFlatlandConfig,
12593        ___deadline: zx::MonotonicInstant,
12594    ) -> Result<TrustedFlatlandFactoryCreateFlatlandResult, fidl::Error> {
12595        let _response = self.client.send_query::<
12596            TrustedFlatlandFactoryCreateFlatlandRequest,
12597            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, TrustedFlatlandFactoryError>,
12598            TrustedFlatlandFactoryMarker,
12599        >(
12600            (server_end, &mut config,),
12601            0x48e89c53f00561dc,
12602            fidl::encoding::DynamicFlags::empty(),
12603            ___deadline,
12604        )?;
12605        Ok(_response.map(|x| x))
12606    }
12607}
12608
12609#[cfg(target_os = "fuchsia")]
12610impl From<TrustedFlatlandFactorySynchronousProxy> for zx::NullableHandle {
12611    fn from(value: TrustedFlatlandFactorySynchronousProxy) -> Self {
12612        value.into_channel().into()
12613    }
12614}
12615
12616#[cfg(target_os = "fuchsia")]
12617impl From<fidl::Channel> for TrustedFlatlandFactorySynchronousProxy {
12618    fn from(value: fidl::Channel) -> Self {
12619        Self::new(value)
12620    }
12621}
12622
12623#[cfg(target_os = "fuchsia")]
12624impl fidl::endpoints::FromClient for TrustedFlatlandFactorySynchronousProxy {
12625    type Protocol = TrustedFlatlandFactoryMarker;
12626
12627    fn from_client(value: fidl::endpoints::ClientEnd<TrustedFlatlandFactoryMarker>) -> Self {
12628        Self::new(value.into_channel())
12629    }
12630}
12631
12632#[derive(Debug, Clone)]
12633pub struct TrustedFlatlandFactoryProxy {
12634    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
12635}
12636
12637impl fidl::endpoints::Proxy for TrustedFlatlandFactoryProxy {
12638    type Protocol = TrustedFlatlandFactoryMarker;
12639
12640    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
12641        Self::new(inner)
12642    }
12643
12644    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
12645        self.client.into_channel().map_err(|client| Self { client })
12646    }
12647
12648    fn as_channel(&self) -> &::fidl::AsyncChannel {
12649        self.client.as_channel()
12650    }
12651}
12652
12653impl TrustedFlatlandFactoryProxy {
12654    /// Create a new Proxy for fuchsia.ui.composition/TrustedFlatlandFactory.
12655    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
12656        let protocol_name =
12657            <TrustedFlatlandFactoryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
12658        Self { client: fidl::client::Client::new(channel, protocol_name) }
12659    }
12660
12661    /// Get a Stream of events from the remote end of the protocol.
12662    ///
12663    /// # Panics
12664    ///
12665    /// Panics if the event stream was already taken.
12666    pub fn take_event_stream(&self) -> TrustedFlatlandFactoryEventStream {
12667        TrustedFlatlandFactoryEventStream { event_receiver: self.client.take_event_receiver() }
12668    }
12669
12670    /// Creates a new Flatland session with the specified configuration.
12671    ///
12672    /// ## Error
12673    ///
12674    /// Returns a [TrustedFlatlandFactoryError] error if the operation fails.
12675    pub fn r#create_flatland(
12676        &self,
12677        mut server_end: fidl::endpoints::ServerEnd<FlatlandMarker>,
12678        mut config: TrustedFlatlandConfig,
12679    ) -> fidl::client::QueryResponseFut<
12680        TrustedFlatlandFactoryCreateFlatlandResult,
12681        fidl::encoding::DefaultFuchsiaResourceDialect,
12682    > {
12683        TrustedFlatlandFactoryProxyInterface::r#create_flatland(self, server_end, config)
12684    }
12685}
12686
12687impl TrustedFlatlandFactoryProxyInterface for TrustedFlatlandFactoryProxy {
12688    type CreateFlatlandResponseFut = fidl::client::QueryResponseFut<
12689        TrustedFlatlandFactoryCreateFlatlandResult,
12690        fidl::encoding::DefaultFuchsiaResourceDialect,
12691    >;
12692    fn r#create_flatland(
12693        &self,
12694        mut server_end: fidl::endpoints::ServerEnd<FlatlandMarker>,
12695        mut config: TrustedFlatlandConfig,
12696    ) -> Self::CreateFlatlandResponseFut {
12697        fn _decode(
12698            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
12699        ) -> Result<TrustedFlatlandFactoryCreateFlatlandResult, fidl::Error> {
12700            let _response = fidl::client::decode_transaction_body::<
12701                fidl::encoding::ResultType<
12702                    fidl::encoding::EmptyStruct,
12703                    TrustedFlatlandFactoryError,
12704                >,
12705                fidl::encoding::DefaultFuchsiaResourceDialect,
12706                0x48e89c53f00561dc,
12707            >(_buf?)?;
12708            Ok(_response.map(|x| x))
12709        }
12710        self.client.send_query_and_decode::<
12711            TrustedFlatlandFactoryCreateFlatlandRequest,
12712            TrustedFlatlandFactoryCreateFlatlandResult,
12713        >(
12714            (server_end, &mut config,),
12715            0x48e89c53f00561dc,
12716            fidl::encoding::DynamicFlags::empty(),
12717            _decode,
12718        )
12719    }
12720}
12721
12722pub struct TrustedFlatlandFactoryEventStream {
12723    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
12724}
12725
12726impl std::marker::Unpin for TrustedFlatlandFactoryEventStream {}
12727
12728impl futures::stream::FusedStream for TrustedFlatlandFactoryEventStream {
12729    fn is_terminated(&self) -> bool {
12730        self.event_receiver.is_terminated()
12731    }
12732}
12733
12734impl futures::Stream for TrustedFlatlandFactoryEventStream {
12735    type Item = Result<TrustedFlatlandFactoryEvent, fidl::Error>;
12736
12737    fn poll_next(
12738        mut self: std::pin::Pin<&mut Self>,
12739        cx: &mut std::task::Context<'_>,
12740    ) -> std::task::Poll<Option<Self::Item>> {
12741        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
12742            &mut self.event_receiver,
12743            cx
12744        )?) {
12745            Some(buf) => std::task::Poll::Ready(Some(TrustedFlatlandFactoryEvent::decode(buf))),
12746            None => std::task::Poll::Ready(None),
12747        }
12748    }
12749}
12750
12751#[derive(Debug)]
12752pub enum TrustedFlatlandFactoryEvent {}
12753
12754impl TrustedFlatlandFactoryEvent {
12755    /// Decodes a message buffer as a [`TrustedFlatlandFactoryEvent`].
12756    fn decode(
12757        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
12758    ) -> Result<TrustedFlatlandFactoryEvent, fidl::Error> {
12759        let (bytes, _handles) = buf.split_mut();
12760        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
12761        debug_assert_eq!(tx_header.tx_id, 0);
12762        match tx_header.ordinal {
12763            _ => Err(fidl::Error::UnknownOrdinal {
12764                ordinal: tx_header.ordinal,
12765                protocol_name:
12766                    <TrustedFlatlandFactoryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
12767            }),
12768        }
12769    }
12770}
12771
12772/// A Stream of incoming requests for fuchsia.ui.composition/TrustedFlatlandFactory.
12773pub struct TrustedFlatlandFactoryRequestStream {
12774    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
12775    is_terminated: bool,
12776}
12777
12778impl std::marker::Unpin for TrustedFlatlandFactoryRequestStream {}
12779
12780impl futures::stream::FusedStream for TrustedFlatlandFactoryRequestStream {
12781    fn is_terminated(&self) -> bool {
12782        self.is_terminated
12783    }
12784}
12785
12786impl fidl::endpoints::RequestStream for TrustedFlatlandFactoryRequestStream {
12787    type Protocol = TrustedFlatlandFactoryMarker;
12788    type ControlHandle = TrustedFlatlandFactoryControlHandle;
12789
12790    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
12791        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
12792    }
12793
12794    fn control_handle(&self) -> Self::ControlHandle {
12795        TrustedFlatlandFactoryControlHandle { inner: self.inner.clone() }
12796    }
12797
12798    fn into_inner(
12799        self,
12800    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
12801    {
12802        (self.inner, self.is_terminated)
12803    }
12804
12805    fn from_inner(
12806        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
12807        is_terminated: bool,
12808    ) -> Self {
12809        Self { inner, is_terminated }
12810    }
12811}
12812
12813impl futures::Stream for TrustedFlatlandFactoryRequestStream {
12814    type Item = Result<TrustedFlatlandFactoryRequest, fidl::Error>;
12815
12816    fn poll_next(
12817        mut self: std::pin::Pin<&mut Self>,
12818        cx: &mut std::task::Context<'_>,
12819    ) -> std::task::Poll<Option<Self::Item>> {
12820        let this = &mut *self;
12821        if this.inner.check_shutdown(cx) {
12822            this.is_terminated = true;
12823            return std::task::Poll::Ready(None);
12824        }
12825        if this.is_terminated {
12826            panic!("polled TrustedFlatlandFactoryRequestStream after completion");
12827        }
12828        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
12829            |bytes, handles| {
12830                match this.inner.channel().read_etc(cx, bytes, handles) {
12831                    std::task::Poll::Ready(Ok(())) => {}
12832                    std::task::Poll::Pending => return std::task::Poll::Pending,
12833                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
12834                        this.is_terminated = true;
12835                        return std::task::Poll::Ready(None);
12836                    }
12837                    std::task::Poll::Ready(Err(e)) => {
12838                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
12839                            e.into(),
12840                        ))));
12841                    }
12842                }
12843
12844                // A message has been received from the channel
12845                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
12846
12847                std::task::Poll::Ready(Some(match header.ordinal {
12848                0x48e89c53f00561dc => {
12849                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
12850                    let mut req = fidl::new_empty!(TrustedFlatlandFactoryCreateFlatlandRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
12851                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<TrustedFlatlandFactoryCreateFlatlandRequest>(&header, _body_bytes, handles, &mut req)?;
12852                    let control_handle = TrustedFlatlandFactoryControlHandle {
12853                        inner: this.inner.clone(),
12854                    };
12855                    Ok(TrustedFlatlandFactoryRequest::CreateFlatland {server_end: req.server_end,
12856config: req.config,
12857
12858                        responder: TrustedFlatlandFactoryCreateFlatlandResponder {
12859                            control_handle: std::mem::ManuallyDrop::new(control_handle),
12860                            tx_id: header.tx_id,
12861                        },
12862                    })
12863                }
12864                _ => Err(fidl::Error::UnknownOrdinal {
12865                    ordinal: header.ordinal,
12866                    protocol_name: <TrustedFlatlandFactoryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
12867                }),
12868            }))
12869            },
12870        )
12871    }
12872}
12873
12874/// A privileged factory for creating Flatland sessions with special configurations.
12875///
12876/// This protocol is intended for trusted clients that require fine-grained control over
12877/// Flatland's behavior for performance-critical applications. It is not intended for
12878/// general use. Misuse of this API can negatively impact system performance and stability.
12879#[derive(Debug)]
12880pub enum TrustedFlatlandFactoryRequest {
12881    /// Creates a new Flatland session with the specified configuration.
12882    ///
12883    /// ## Error
12884    ///
12885    /// Returns a [TrustedFlatlandFactoryError] error if the operation fails.
12886    CreateFlatland {
12887        server_end: fidl::endpoints::ServerEnd<FlatlandMarker>,
12888        config: TrustedFlatlandConfig,
12889        responder: TrustedFlatlandFactoryCreateFlatlandResponder,
12890    },
12891}
12892
12893impl TrustedFlatlandFactoryRequest {
12894    #[allow(irrefutable_let_patterns)]
12895    pub fn into_create_flatland(
12896        self,
12897    ) -> Option<(
12898        fidl::endpoints::ServerEnd<FlatlandMarker>,
12899        TrustedFlatlandConfig,
12900        TrustedFlatlandFactoryCreateFlatlandResponder,
12901    )> {
12902        if let TrustedFlatlandFactoryRequest::CreateFlatland { server_end, config, responder } =
12903            self
12904        {
12905            Some((server_end, config, responder))
12906        } else {
12907            None
12908        }
12909    }
12910
12911    /// Name of the method defined in FIDL
12912    pub fn method_name(&self) -> &'static str {
12913        match *self {
12914            TrustedFlatlandFactoryRequest::CreateFlatland { .. } => "create_flatland",
12915        }
12916    }
12917}
12918
12919#[derive(Debug, Clone)]
12920pub struct TrustedFlatlandFactoryControlHandle {
12921    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
12922}
12923
12924impl TrustedFlatlandFactoryControlHandle {
12925    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
12926        self.inner.shutdown_with_epitaph(status.into())
12927    }
12928}
12929
12930impl fidl::endpoints::ControlHandle for TrustedFlatlandFactoryControlHandle {
12931    fn shutdown(&self) {
12932        self.inner.shutdown()
12933    }
12934
12935    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
12936        self.inner.shutdown_with_epitaph(status)
12937    }
12938
12939    fn is_closed(&self) -> bool {
12940        self.inner.channel().is_closed()
12941    }
12942    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
12943        self.inner.channel().on_closed()
12944    }
12945
12946    #[cfg(target_os = "fuchsia")]
12947    fn signal_peer(
12948        &self,
12949        clear_mask: zx::Signals,
12950        set_mask: zx::Signals,
12951    ) -> Result<(), zx_status::Status> {
12952        use fidl::Peered;
12953        self.inner.channel().signal_peer(clear_mask, set_mask)
12954    }
12955}
12956
12957impl TrustedFlatlandFactoryControlHandle {}
12958
12959#[must_use = "FIDL methods require a response to be sent"]
12960#[derive(Debug)]
12961pub struct TrustedFlatlandFactoryCreateFlatlandResponder {
12962    control_handle: std::mem::ManuallyDrop<TrustedFlatlandFactoryControlHandle>,
12963    tx_id: u32,
12964}
12965
12966/// Set the the channel to be shutdown (see [`TrustedFlatlandFactoryControlHandle::shutdown`])
12967/// if the responder is dropped without sending a response, so that the client
12968/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
12969impl std::ops::Drop for TrustedFlatlandFactoryCreateFlatlandResponder {
12970    fn drop(&mut self) {
12971        self.control_handle.shutdown();
12972        // Safety: drops once, never accessed again
12973        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
12974    }
12975}
12976
12977impl fidl::endpoints::Responder for TrustedFlatlandFactoryCreateFlatlandResponder {
12978    type ControlHandle = TrustedFlatlandFactoryControlHandle;
12979
12980    fn control_handle(&self) -> &TrustedFlatlandFactoryControlHandle {
12981        &self.control_handle
12982    }
12983
12984    fn drop_without_shutdown(mut self) {
12985        // Safety: drops once, never accessed again due to mem::forget
12986        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
12987        // Prevent Drop from running (which would shut down the channel)
12988        std::mem::forget(self);
12989    }
12990}
12991
12992impl TrustedFlatlandFactoryCreateFlatlandResponder {
12993    /// Sends a response to the FIDL transaction.
12994    ///
12995    /// Sets the channel to shutdown if an error occurs.
12996    pub fn send(
12997        self,
12998        mut result: Result<(), TrustedFlatlandFactoryError>,
12999    ) -> Result<(), fidl::Error> {
13000        let _result = self.send_raw(result);
13001        if _result.is_err() {
13002            self.control_handle.shutdown();
13003        }
13004        self.drop_without_shutdown();
13005        _result
13006    }
13007
13008    /// Similar to "send" but does not shutdown the channel if an error occurs.
13009    pub fn send_no_shutdown_on_err(
13010        self,
13011        mut result: Result<(), TrustedFlatlandFactoryError>,
13012    ) -> Result<(), fidl::Error> {
13013        let _result = self.send_raw(result);
13014        self.drop_without_shutdown();
13015        _result
13016    }
13017
13018    fn send_raw(
13019        &self,
13020        mut result: Result<(), TrustedFlatlandFactoryError>,
13021    ) -> Result<(), fidl::Error> {
13022        self.control_handle.inner.send::<fidl::encoding::ResultType<
13023            fidl::encoding::EmptyStruct,
13024            TrustedFlatlandFactoryError,
13025        >>(
13026            result,
13027            self.tx_id,
13028            0x48e89c53f00561dc,
13029            fidl::encoding::DynamicFlags::empty(),
13030        )
13031    }
13032}
13033
13034mod internal {
13035    use super::*;
13036
13037    impl fidl::encoding::ResourceTypeMarker for AllocatorRegisterBufferCollectionRequest {
13038        type Borrowed<'a> = &'a mut Self;
13039        fn take_or_borrow<'a>(
13040            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
13041        ) -> Self::Borrowed<'a> {
13042            value
13043        }
13044    }
13045
13046    unsafe impl fidl::encoding::TypeMarker for AllocatorRegisterBufferCollectionRequest {
13047        type Owned = Self;
13048
13049        #[inline(always)]
13050        fn inline_align(_context: fidl::encoding::Context) -> usize {
13051            8
13052        }
13053
13054        #[inline(always)]
13055        fn inline_size(_context: fidl::encoding::Context) -> usize {
13056            16
13057        }
13058    }
13059
13060    unsafe impl
13061        fidl::encoding::Encode<
13062            AllocatorRegisterBufferCollectionRequest,
13063            fidl::encoding::DefaultFuchsiaResourceDialect,
13064        > for &mut AllocatorRegisterBufferCollectionRequest
13065    {
13066        #[inline]
13067        unsafe fn encode(
13068            self,
13069            encoder: &mut fidl::encoding::Encoder<
13070                '_,
13071                fidl::encoding::DefaultFuchsiaResourceDialect,
13072            >,
13073            offset: usize,
13074            _depth: fidl::encoding::Depth,
13075        ) -> fidl::Result<()> {
13076            encoder.debug_check_bounds::<AllocatorRegisterBufferCollectionRequest>(offset);
13077            // Delegate to tuple encoding.
13078            fidl::encoding::Encode::<AllocatorRegisterBufferCollectionRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
13079                (
13080                    <RegisterBufferCollectionArgs as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.args),
13081                ),
13082                encoder, offset, _depth
13083            )
13084        }
13085    }
13086    unsafe impl<
13087        T0: fidl::encoding::Encode<
13088                RegisterBufferCollectionArgs,
13089                fidl::encoding::DefaultFuchsiaResourceDialect,
13090            >,
13091    >
13092        fidl::encoding::Encode<
13093            AllocatorRegisterBufferCollectionRequest,
13094            fidl::encoding::DefaultFuchsiaResourceDialect,
13095        > for (T0,)
13096    {
13097        #[inline]
13098        unsafe fn encode(
13099            self,
13100            encoder: &mut fidl::encoding::Encoder<
13101                '_,
13102                fidl::encoding::DefaultFuchsiaResourceDialect,
13103            >,
13104            offset: usize,
13105            depth: fidl::encoding::Depth,
13106        ) -> fidl::Result<()> {
13107            encoder.debug_check_bounds::<AllocatorRegisterBufferCollectionRequest>(offset);
13108            // Zero out padding regions. There's no need to apply masks
13109            // because the unmasked parts will be overwritten by fields.
13110            // Write the fields.
13111            self.0.encode(encoder, offset + 0, depth)?;
13112            Ok(())
13113        }
13114    }
13115
13116    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
13117        for AllocatorRegisterBufferCollectionRequest
13118    {
13119        #[inline(always)]
13120        fn new_empty() -> Self {
13121            Self {
13122                args: fidl::new_empty!(
13123                    RegisterBufferCollectionArgs,
13124                    fidl::encoding::DefaultFuchsiaResourceDialect
13125                ),
13126            }
13127        }
13128
13129        #[inline]
13130        unsafe fn decode(
13131            &mut self,
13132            decoder: &mut fidl::encoding::Decoder<
13133                '_,
13134                fidl::encoding::DefaultFuchsiaResourceDialect,
13135            >,
13136            offset: usize,
13137            _depth: fidl::encoding::Depth,
13138        ) -> fidl::Result<()> {
13139            decoder.debug_check_bounds::<Self>(offset);
13140            // Verify that padding bytes are zero.
13141            fidl::decode!(
13142                RegisterBufferCollectionArgs,
13143                fidl::encoding::DefaultFuchsiaResourceDialect,
13144                &mut self.args,
13145                decoder,
13146                offset + 0,
13147                _depth
13148            )?;
13149            Ok(())
13150        }
13151    }
13152
13153    impl fidl::encoding::ResourceTypeMarker for BufferCollectionExportToken {
13154        type Borrowed<'a> = &'a mut Self;
13155        fn take_or_borrow<'a>(
13156            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
13157        ) -> Self::Borrowed<'a> {
13158            value
13159        }
13160    }
13161
13162    unsafe impl fidl::encoding::TypeMarker for BufferCollectionExportToken {
13163        type Owned = Self;
13164
13165        #[inline(always)]
13166        fn inline_align(_context: fidl::encoding::Context) -> usize {
13167            4
13168        }
13169
13170        #[inline(always)]
13171        fn inline_size(_context: fidl::encoding::Context) -> usize {
13172            4
13173        }
13174    }
13175
13176    unsafe impl
13177        fidl::encoding::Encode<
13178            BufferCollectionExportToken,
13179            fidl::encoding::DefaultFuchsiaResourceDialect,
13180        > for &mut BufferCollectionExportToken
13181    {
13182        #[inline]
13183        unsafe fn encode(
13184            self,
13185            encoder: &mut fidl::encoding::Encoder<
13186                '_,
13187                fidl::encoding::DefaultFuchsiaResourceDialect,
13188            >,
13189            offset: usize,
13190            _depth: fidl::encoding::Depth,
13191        ) -> fidl::Result<()> {
13192            encoder.debug_check_bounds::<BufferCollectionExportToken>(offset);
13193            // Delegate to tuple encoding.
13194            fidl::encoding::Encode::<
13195                BufferCollectionExportToken,
13196                fidl::encoding::DefaultFuchsiaResourceDialect,
13197            >::encode(
13198                (<fidl::encoding::HandleType<
13199                    fidl::EventPair,
13200                    { fidl::ObjectType::EVENTPAIR.into_raw() },
13201                    2147483648,
13202                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
13203                    &mut self.value
13204                ),),
13205                encoder,
13206                offset,
13207                _depth,
13208            )
13209        }
13210    }
13211    unsafe impl<
13212        T0: fidl::encoding::Encode<
13213                fidl::encoding::HandleType<
13214                    fidl::EventPair,
13215                    { fidl::ObjectType::EVENTPAIR.into_raw() },
13216                    2147483648,
13217                >,
13218                fidl::encoding::DefaultFuchsiaResourceDialect,
13219            >,
13220    >
13221        fidl::encoding::Encode<
13222            BufferCollectionExportToken,
13223            fidl::encoding::DefaultFuchsiaResourceDialect,
13224        > for (T0,)
13225    {
13226        #[inline]
13227        unsafe fn encode(
13228            self,
13229            encoder: &mut fidl::encoding::Encoder<
13230                '_,
13231                fidl::encoding::DefaultFuchsiaResourceDialect,
13232            >,
13233            offset: usize,
13234            depth: fidl::encoding::Depth,
13235        ) -> fidl::Result<()> {
13236            encoder.debug_check_bounds::<BufferCollectionExportToken>(offset);
13237            // Zero out padding regions. There's no need to apply masks
13238            // because the unmasked parts will be overwritten by fields.
13239            // Write the fields.
13240            self.0.encode(encoder, offset + 0, depth)?;
13241            Ok(())
13242        }
13243    }
13244
13245    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
13246        for BufferCollectionExportToken
13247    {
13248        #[inline(always)]
13249        fn new_empty() -> Self {
13250            Self {
13251                value: fidl::new_empty!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
13252            }
13253        }
13254
13255        #[inline]
13256        unsafe fn decode(
13257            &mut self,
13258            decoder: &mut fidl::encoding::Decoder<
13259                '_,
13260                fidl::encoding::DefaultFuchsiaResourceDialect,
13261            >,
13262            offset: usize,
13263            _depth: fidl::encoding::Depth,
13264        ) -> fidl::Result<()> {
13265            decoder.debug_check_bounds::<Self>(offset);
13266            // Verify that padding bytes are zero.
13267            fidl::decode!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.value, decoder, offset + 0, _depth)?;
13268            Ok(())
13269        }
13270    }
13271
13272    impl fidl::encoding::ResourceTypeMarker for BufferCollectionImportToken {
13273        type Borrowed<'a> = &'a mut Self;
13274        fn take_or_borrow<'a>(
13275            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
13276        ) -> Self::Borrowed<'a> {
13277            value
13278        }
13279    }
13280
13281    unsafe impl fidl::encoding::TypeMarker for BufferCollectionImportToken {
13282        type Owned = Self;
13283
13284        #[inline(always)]
13285        fn inline_align(_context: fidl::encoding::Context) -> usize {
13286            4
13287        }
13288
13289        #[inline(always)]
13290        fn inline_size(_context: fidl::encoding::Context) -> usize {
13291            4
13292        }
13293    }
13294
13295    unsafe impl
13296        fidl::encoding::Encode<
13297            BufferCollectionImportToken,
13298            fidl::encoding::DefaultFuchsiaResourceDialect,
13299        > for &mut BufferCollectionImportToken
13300    {
13301        #[inline]
13302        unsafe fn encode(
13303            self,
13304            encoder: &mut fidl::encoding::Encoder<
13305                '_,
13306                fidl::encoding::DefaultFuchsiaResourceDialect,
13307            >,
13308            offset: usize,
13309            _depth: fidl::encoding::Depth,
13310        ) -> fidl::Result<()> {
13311            encoder.debug_check_bounds::<BufferCollectionImportToken>(offset);
13312            // Delegate to tuple encoding.
13313            fidl::encoding::Encode::<
13314                BufferCollectionImportToken,
13315                fidl::encoding::DefaultFuchsiaResourceDialect,
13316            >::encode(
13317                (<fidl::encoding::HandleType<
13318                    fidl::EventPair,
13319                    { fidl::ObjectType::EVENTPAIR.into_raw() },
13320                    2147483648,
13321                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
13322                    &mut self.value
13323                ),),
13324                encoder,
13325                offset,
13326                _depth,
13327            )
13328        }
13329    }
13330    unsafe impl<
13331        T0: fidl::encoding::Encode<
13332                fidl::encoding::HandleType<
13333                    fidl::EventPair,
13334                    { fidl::ObjectType::EVENTPAIR.into_raw() },
13335                    2147483648,
13336                >,
13337                fidl::encoding::DefaultFuchsiaResourceDialect,
13338            >,
13339    >
13340        fidl::encoding::Encode<
13341            BufferCollectionImportToken,
13342            fidl::encoding::DefaultFuchsiaResourceDialect,
13343        > for (T0,)
13344    {
13345        #[inline]
13346        unsafe fn encode(
13347            self,
13348            encoder: &mut fidl::encoding::Encoder<
13349                '_,
13350                fidl::encoding::DefaultFuchsiaResourceDialect,
13351            >,
13352            offset: usize,
13353            depth: fidl::encoding::Depth,
13354        ) -> fidl::Result<()> {
13355            encoder.debug_check_bounds::<BufferCollectionImportToken>(offset);
13356            // Zero out padding regions. There's no need to apply masks
13357            // because the unmasked parts will be overwritten by fields.
13358            // Write the fields.
13359            self.0.encode(encoder, offset + 0, depth)?;
13360            Ok(())
13361        }
13362    }
13363
13364    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
13365        for BufferCollectionImportToken
13366    {
13367        #[inline(always)]
13368        fn new_empty() -> Self {
13369            Self {
13370                value: fidl::new_empty!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
13371            }
13372        }
13373
13374        #[inline]
13375        unsafe fn decode(
13376            &mut self,
13377            decoder: &mut fidl::encoding::Decoder<
13378                '_,
13379                fidl::encoding::DefaultFuchsiaResourceDialect,
13380            >,
13381            offset: usize,
13382            _depth: fidl::encoding::Depth,
13383        ) -> fidl::Result<()> {
13384            decoder.debug_check_bounds::<Self>(offset);
13385            // Verify that padding bytes are zero.
13386            fidl::decode!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.value, decoder, offset + 0, _depth)?;
13387            Ok(())
13388        }
13389    }
13390
13391    impl fidl::encoding::ResourceTypeMarker for ChildViewWatcherGetViewRefResponse {
13392        type Borrowed<'a> = &'a mut Self;
13393        fn take_or_borrow<'a>(
13394            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
13395        ) -> Self::Borrowed<'a> {
13396            value
13397        }
13398    }
13399
13400    unsafe impl fidl::encoding::TypeMarker for ChildViewWatcherGetViewRefResponse {
13401        type Owned = Self;
13402
13403        #[inline(always)]
13404        fn inline_align(_context: fidl::encoding::Context) -> usize {
13405            4
13406        }
13407
13408        #[inline(always)]
13409        fn inline_size(_context: fidl::encoding::Context) -> usize {
13410            4
13411        }
13412    }
13413
13414    unsafe impl
13415        fidl::encoding::Encode<
13416            ChildViewWatcherGetViewRefResponse,
13417            fidl::encoding::DefaultFuchsiaResourceDialect,
13418        > for &mut ChildViewWatcherGetViewRefResponse
13419    {
13420        #[inline]
13421        unsafe fn encode(
13422            self,
13423            encoder: &mut fidl::encoding::Encoder<
13424                '_,
13425                fidl::encoding::DefaultFuchsiaResourceDialect,
13426            >,
13427            offset: usize,
13428            _depth: fidl::encoding::Depth,
13429        ) -> fidl::Result<()> {
13430            encoder.debug_check_bounds::<ChildViewWatcherGetViewRefResponse>(offset);
13431            // Delegate to tuple encoding.
13432            fidl::encoding::Encode::<ChildViewWatcherGetViewRefResponse, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
13433                (
13434                    <fidl_fuchsia_ui_views::ViewRef as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.view_ref),
13435                ),
13436                encoder, offset, _depth
13437            )
13438        }
13439    }
13440    unsafe impl<
13441        T0: fidl::encoding::Encode<
13442                fidl_fuchsia_ui_views::ViewRef,
13443                fidl::encoding::DefaultFuchsiaResourceDialect,
13444            >,
13445    >
13446        fidl::encoding::Encode<
13447            ChildViewWatcherGetViewRefResponse,
13448            fidl::encoding::DefaultFuchsiaResourceDialect,
13449        > for (T0,)
13450    {
13451        #[inline]
13452        unsafe fn encode(
13453            self,
13454            encoder: &mut fidl::encoding::Encoder<
13455                '_,
13456                fidl::encoding::DefaultFuchsiaResourceDialect,
13457            >,
13458            offset: usize,
13459            depth: fidl::encoding::Depth,
13460        ) -> fidl::Result<()> {
13461            encoder.debug_check_bounds::<ChildViewWatcherGetViewRefResponse>(offset);
13462            // Zero out padding regions. There's no need to apply masks
13463            // because the unmasked parts will be overwritten by fields.
13464            // Write the fields.
13465            self.0.encode(encoder, offset + 0, depth)?;
13466            Ok(())
13467        }
13468    }
13469
13470    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
13471        for ChildViewWatcherGetViewRefResponse
13472    {
13473        #[inline(always)]
13474        fn new_empty() -> Self {
13475            Self {
13476                view_ref: fidl::new_empty!(
13477                    fidl_fuchsia_ui_views::ViewRef,
13478                    fidl::encoding::DefaultFuchsiaResourceDialect
13479                ),
13480            }
13481        }
13482
13483        #[inline]
13484        unsafe fn decode(
13485            &mut self,
13486            decoder: &mut fidl::encoding::Decoder<
13487                '_,
13488                fidl::encoding::DefaultFuchsiaResourceDialect,
13489            >,
13490            offset: usize,
13491            _depth: fidl::encoding::Depth,
13492        ) -> fidl::Result<()> {
13493            decoder.debug_check_bounds::<Self>(offset);
13494            // Verify that padding bytes are zero.
13495            fidl::decode!(
13496                fidl_fuchsia_ui_views::ViewRef,
13497                fidl::encoding::DefaultFuchsiaResourceDialect,
13498                &mut self.view_ref,
13499                decoder,
13500                offset + 0,
13501                _depth
13502            )?;
13503            Ok(())
13504        }
13505    }
13506
13507    impl fidl::encoding::ResourceTypeMarker for Flatland2CreateImage2Request {
13508        type Borrowed<'a> = &'a mut Self;
13509        fn take_or_borrow<'a>(
13510            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
13511        ) -> Self::Borrowed<'a> {
13512            value
13513        }
13514    }
13515
13516    unsafe impl fidl::encoding::TypeMarker for Flatland2CreateImage2Request {
13517        type Owned = Self;
13518
13519        #[inline(always)]
13520        fn inline_align(_context: fidl::encoding::Context) -> usize {
13521            8
13522        }
13523
13524        #[inline(always)]
13525        fn inline_size(_context: fidl::encoding::Context) -> usize {
13526            32
13527        }
13528    }
13529
13530    unsafe impl
13531        fidl::encoding::Encode<
13532            Flatland2CreateImage2Request,
13533            fidl::encoding::DefaultFuchsiaResourceDialect,
13534        > for &mut Flatland2CreateImage2Request
13535    {
13536        #[inline]
13537        unsafe fn encode(
13538            self,
13539            encoder: &mut fidl::encoding::Encoder<
13540                '_,
13541                fidl::encoding::DefaultFuchsiaResourceDialect,
13542            >,
13543            offset: usize,
13544            _depth: fidl::encoding::Depth,
13545        ) -> fidl::Result<()> {
13546            encoder.debug_check_bounds::<Flatland2CreateImage2Request>(offset);
13547            // Delegate to tuple encoding.
13548            fidl::encoding::Encode::<Flatland2CreateImage2Request, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
13549                (
13550                    <ImageId as fidl::encoding::ValueTypeMarker>::borrow(&self.image_id),
13551                    <BufferCollectionImportToken as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.import_token),
13552                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.vmo_index),
13553                    <ImageProperties as fidl::encoding::ValueTypeMarker>::borrow(&self.properties),
13554                ),
13555                encoder, offset, _depth
13556            )
13557        }
13558    }
13559    unsafe impl<
13560        T0: fidl::encoding::Encode<ImageId, fidl::encoding::DefaultFuchsiaResourceDialect>,
13561        T1: fidl::encoding::Encode<
13562                BufferCollectionImportToken,
13563                fidl::encoding::DefaultFuchsiaResourceDialect,
13564            >,
13565        T2: fidl::encoding::Encode<u32, fidl::encoding::DefaultFuchsiaResourceDialect>,
13566        T3: fidl::encoding::Encode<ImageProperties, fidl::encoding::DefaultFuchsiaResourceDialect>,
13567    >
13568        fidl::encoding::Encode<
13569            Flatland2CreateImage2Request,
13570            fidl::encoding::DefaultFuchsiaResourceDialect,
13571        > for (T0, T1, T2, T3)
13572    {
13573        #[inline]
13574        unsafe fn encode(
13575            self,
13576            encoder: &mut fidl::encoding::Encoder<
13577                '_,
13578                fidl::encoding::DefaultFuchsiaResourceDialect,
13579            >,
13580            offset: usize,
13581            depth: fidl::encoding::Depth,
13582        ) -> fidl::Result<()> {
13583            encoder.debug_check_bounds::<Flatland2CreateImage2Request>(offset);
13584            // Zero out padding regions. There's no need to apply masks
13585            // because the unmasked parts will be overwritten by fields.
13586            // Write the fields.
13587            self.0.encode(encoder, offset + 0, depth)?;
13588            self.1.encode(encoder, offset + 8, depth)?;
13589            self.2.encode(encoder, offset + 12, depth)?;
13590            self.3.encode(encoder, offset + 16, depth)?;
13591            Ok(())
13592        }
13593    }
13594
13595    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
13596        for Flatland2CreateImage2Request
13597    {
13598        #[inline(always)]
13599        fn new_empty() -> Self {
13600            Self {
13601                image_id: fidl::new_empty!(ImageId, fidl::encoding::DefaultFuchsiaResourceDialect),
13602                import_token: fidl::new_empty!(
13603                    BufferCollectionImportToken,
13604                    fidl::encoding::DefaultFuchsiaResourceDialect
13605                ),
13606                vmo_index: fidl::new_empty!(u32, fidl::encoding::DefaultFuchsiaResourceDialect),
13607                properties: fidl::new_empty!(
13608                    ImageProperties,
13609                    fidl::encoding::DefaultFuchsiaResourceDialect
13610                ),
13611            }
13612        }
13613
13614        #[inline]
13615        unsafe fn decode(
13616            &mut self,
13617            decoder: &mut fidl::encoding::Decoder<
13618                '_,
13619                fidl::encoding::DefaultFuchsiaResourceDialect,
13620            >,
13621            offset: usize,
13622            _depth: fidl::encoding::Depth,
13623        ) -> fidl::Result<()> {
13624            decoder.debug_check_bounds::<Self>(offset);
13625            // Verify that padding bytes are zero.
13626            fidl::decode!(
13627                ImageId,
13628                fidl::encoding::DefaultFuchsiaResourceDialect,
13629                &mut self.image_id,
13630                decoder,
13631                offset + 0,
13632                _depth
13633            )?;
13634            fidl::decode!(
13635                BufferCollectionImportToken,
13636                fidl::encoding::DefaultFuchsiaResourceDialect,
13637                &mut self.import_token,
13638                decoder,
13639                offset + 8,
13640                _depth
13641            )?;
13642            fidl::decode!(
13643                u32,
13644                fidl::encoding::DefaultFuchsiaResourceDialect,
13645                &mut self.vmo_index,
13646                decoder,
13647                offset + 12,
13648                _depth
13649            )?;
13650            fidl::decode!(
13651                ImageProperties,
13652                fidl::encoding::DefaultFuchsiaResourceDialect,
13653                &mut self.properties,
13654                decoder,
13655                offset + 16,
13656                _depth
13657            )?;
13658            Ok(())
13659        }
13660    }
13661
13662    impl fidl::encoding::ResourceTypeMarker for Flatland2CreateViewport2Request {
13663        type Borrowed<'a> = &'a mut Self;
13664        fn take_or_borrow<'a>(
13665            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
13666        ) -> Self::Borrowed<'a> {
13667            value
13668        }
13669    }
13670
13671    unsafe impl fidl::encoding::TypeMarker for Flatland2CreateViewport2Request {
13672        type Owned = Self;
13673
13674        #[inline(always)]
13675        fn inline_align(_context: fidl::encoding::Context) -> usize {
13676            8
13677        }
13678
13679        #[inline(always)]
13680        fn inline_size(_context: fidl::encoding::Context) -> usize {
13681            40
13682        }
13683    }
13684
13685    unsafe impl
13686        fidl::encoding::Encode<
13687            Flatland2CreateViewport2Request,
13688            fidl::encoding::DefaultFuchsiaResourceDialect,
13689        > for &mut Flatland2CreateViewport2Request
13690    {
13691        #[inline]
13692        unsafe fn encode(
13693            self,
13694            encoder: &mut fidl::encoding::Encoder<
13695                '_,
13696                fidl::encoding::DefaultFuchsiaResourceDialect,
13697            >,
13698            offset: usize,
13699            _depth: fidl::encoding::Depth,
13700        ) -> fidl::Result<()> {
13701            encoder.debug_check_bounds::<Flatland2CreateViewport2Request>(offset);
13702            // Delegate to tuple encoding.
13703            fidl::encoding::Encode::<Flatland2CreateViewport2Request, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
13704                (
13705                    <ViewportId as fidl::encoding::ValueTypeMarker>::borrow(&self.viewport_id),
13706                    <fidl_fuchsia_ui_views::ViewportCreationToken as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.token),
13707                    <ViewportProperties as fidl::encoding::ValueTypeMarker>::borrow(&self.properties),
13708                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ChildViewWatcherMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.child_view_watcher),
13709                ),
13710                encoder, offset, _depth
13711            )
13712        }
13713    }
13714    unsafe impl<
13715        T0: fidl::encoding::Encode<ViewportId, fidl::encoding::DefaultFuchsiaResourceDialect>,
13716        T1: fidl::encoding::Encode<
13717                fidl_fuchsia_ui_views::ViewportCreationToken,
13718                fidl::encoding::DefaultFuchsiaResourceDialect,
13719            >,
13720        T2: fidl::encoding::Encode<ViewportProperties, fidl::encoding::DefaultFuchsiaResourceDialect>,
13721        T3: fidl::encoding::Encode<
13722                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ChildViewWatcherMarker>>,
13723                fidl::encoding::DefaultFuchsiaResourceDialect,
13724            >,
13725    >
13726        fidl::encoding::Encode<
13727            Flatland2CreateViewport2Request,
13728            fidl::encoding::DefaultFuchsiaResourceDialect,
13729        > for (T0, T1, T2, T3)
13730    {
13731        #[inline]
13732        unsafe fn encode(
13733            self,
13734            encoder: &mut fidl::encoding::Encoder<
13735                '_,
13736                fidl::encoding::DefaultFuchsiaResourceDialect,
13737            >,
13738            offset: usize,
13739            depth: fidl::encoding::Depth,
13740        ) -> fidl::Result<()> {
13741            encoder.debug_check_bounds::<Flatland2CreateViewport2Request>(offset);
13742            // Zero out padding regions. There's no need to apply masks
13743            // because the unmasked parts will be overwritten by fields.
13744            unsafe {
13745                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
13746                (ptr as *mut u64).write_unaligned(0);
13747            }
13748            unsafe {
13749                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(32);
13750                (ptr as *mut u64).write_unaligned(0);
13751            }
13752            // Write the fields.
13753            self.0.encode(encoder, offset + 0, depth)?;
13754            self.1.encode(encoder, offset + 8, depth)?;
13755            self.2.encode(encoder, offset + 16, depth)?;
13756            self.3.encode(encoder, offset + 32, depth)?;
13757            Ok(())
13758        }
13759    }
13760
13761    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
13762        for Flatland2CreateViewport2Request
13763    {
13764        #[inline(always)]
13765        fn new_empty() -> Self {
13766            Self {
13767                viewport_id: fidl::new_empty!(
13768                    ViewportId,
13769                    fidl::encoding::DefaultFuchsiaResourceDialect
13770                ),
13771                token: fidl::new_empty!(
13772                    fidl_fuchsia_ui_views::ViewportCreationToken,
13773                    fidl::encoding::DefaultFuchsiaResourceDialect
13774                ),
13775                properties: fidl::new_empty!(
13776                    ViewportProperties,
13777                    fidl::encoding::DefaultFuchsiaResourceDialect
13778                ),
13779                child_view_watcher: fidl::new_empty!(
13780                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ChildViewWatcherMarker>>,
13781                    fidl::encoding::DefaultFuchsiaResourceDialect
13782                ),
13783            }
13784        }
13785
13786        #[inline]
13787        unsafe fn decode(
13788            &mut self,
13789            decoder: &mut fidl::encoding::Decoder<
13790                '_,
13791                fidl::encoding::DefaultFuchsiaResourceDialect,
13792            >,
13793            offset: usize,
13794            _depth: fidl::encoding::Depth,
13795        ) -> fidl::Result<()> {
13796            decoder.debug_check_bounds::<Self>(offset);
13797            // Verify that padding bytes are zero.
13798            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(8) };
13799            let padval = unsafe { (ptr as *const u64).read_unaligned() };
13800            let mask = 0xffffffff00000000u64;
13801            let maskedval = padval & mask;
13802            if maskedval != 0 {
13803                return Err(fidl::Error::NonZeroPadding {
13804                    padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
13805                });
13806            }
13807            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(32) };
13808            let padval = unsafe { (ptr as *const u64).read_unaligned() };
13809            let mask = 0xffffffff00000000u64;
13810            let maskedval = padval & mask;
13811            if maskedval != 0 {
13812                return Err(fidl::Error::NonZeroPadding {
13813                    padding_start: offset + 32 + ((mask as u64).trailing_zeros() / 8) as usize,
13814                });
13815            }
13816            fidl::decode!(
13817                ViewportId,
13818                fidl::encoding::DefaultFuchsiaResourceDialect,
13819                &mut self.viewport_id,
13820                decoder,
13821                offset + 0,
13822                _depth
13823            )?;
13824            fidl::decode!(
13825                fidl_fuchsia_ui_views::ViewportCreationToken,
13826                fidl::encoding::DefaultFuchsiaResourceDialect,
13827                &mut self.token,
13828                decoder,
13829                offset + 8,
13830                _depth
13831            )?;
13832            fidl::decode!(
13833                ViewportProperties,
13834                fidl::encoding::DefaultFuchsiaResourceDialect,
13835                &mut self.properties,
13836                decoder,
13837                offset + 16,
13838                _depth
13839            )?;
13840            fidl::decode!(
13841                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ChildViewWatcherMarker>>,
13842                fidl::encoding::DefaultFuchsiaResourceDialect,
13843                &mut self.child_view_watcher,
13844                decoder,
13845                offset + 32,
13846                _depth
13847            )?;
13848            Ok(())
13849        }
13850    }
13851
13852    impl fidl::encoding::ResourceTypeMarker for Flatland2ReleaseViewport2Response {
13853        type Borrowed<'a> = &'a mut Self;
13854        fn take_or_borrow<'a>(
13855            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
13856        ) -> Self::Borrowed<'a> {
13857            value
13858        }
13859    }
13860
13861    unsafe impl fidl::encoding::TypeMarker for Flatland2ReleaseViewport2Response {
13862        type Owned = Self;
13863
13864        #[inline(always)]
13865        fn inline_align(_context: fidl::encoding::Context) -> usize {
13866            4
13867        }
13868
13869        #[inline(always)]
13870        fn inline_size(_context: fidl::encoding::Context) -> usize {
13871            4
13872        }
13873    }
13874
13875    unsafe impl
13876        fidl::encoding::Encode<
13877            Flatland2ReleaseViewport2Response,
13878            fidl::encoding::DefaultFuchsiaResourceDialect,
13879        > for &mut Flatland2ReleaseViewport2Response
13880    {
13881        #[inline]
13882        unsafe fn encode(
13883            self,
13884            encoder: &mut fidl::encoding::Encoder<
13885                '_,
13886                fidl::encoding::DefaultFuchsiaResourceDialect,
13887            >,
13888            offset: usize,
13889            _depth: fidl::encoding::Depth,
13890        ) -> fidl::Result<()> {
13891            encoder.debug_check_bounds::<Flatland2ReleaseViewport2Response>(offset);
13892            // Delegate to tuple encoding.
13893            fidl::encoding::Encode::<Flatland2ReleaseViewport2Response, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
13894                (
13895                    <fidl_fuchsia_ui_views::ViewportCreationToken as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.token),
13896                ),
13897                encoder, offset, _depth
13898            )
13899        }
13900    }
13901    unsafe impl<
13902        T0: fidl::encoding::Encode<
13903                fidl_fuchsia_ui_views::ViewportCreationToken,
13904                fidl::encoding::DefaultFuchsiaResourceDialect,
13905            >,
13906    >
13907        fidl::encoding::Encode<
13908            Flatland2ReleaseViewport2Response,
13909            fidl::encoding::DefaultFuchsiaResourceDialect,
13910        > for (T0,)
13911    {
13912        #[inline]
13913        unsafe fn encode(
13914            self,
13915            encoder: &mut fidl::encoding::Encoder<
13916                '_,
13917                fidl::encoding::DefaultFuchsiaResourceDialect,
13918            >,
13919            offset: usize,
13920            depth: fidl::encoding::Depth,
13921        ) -> fidl::Result<()> {
13922            encoder.debug_check_bounds::<Flatland2ReleaseViewport2Response>(offset);
13923            // Zero out padding regions. There's no need to apply masks
13924            // because the unmasked parts will be overwritten by fields.
13925            // Write the fields.
13926            self.0.encode(encoder, offset + 0, depth)?;
13927            Ok(())
13928        }
13929    }
13930
13931    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
13932        for Flatland2ReleaseViewport2Response
13933    {
13934        #[inline(always)]
13935        fn new_empty() -> Self {
13936            Self {
13937                token: fidl::new_empty!(
13938                    fidl_fuchsia_ui_views::ViewportCreationToken,
13939                    fidl::encoding::DefaultFuchsiaResourceDialect
13940                ),
13941            }
13942        }
13943
13944        #[inline]
13945        unsafe fn decode(
13946            &mut self,
13947            decoder: &mut fidl::encoding::Decoder<
13948                '_,
13949                fidl::encoding::DefaultFuchsiaResourceDialect,
13950            >,
13951            offset: usize,
13952            _depth: fidl::encoding::Depth,
13953        ) -> fidl::Result<()> {
13954            decoder.debug_check_bounds::<Self>(offset);
13955            // Verify that padding bytes are zero.
13956            fidl::decode!(
13957                fidl_fuchsia_ui_views::ViewportCreationToken,
13958                fidl::encoding::DefaultFuchsiaResourceDialect,
13959                &mut self.token,
13960                decoder,
13961                offset + 0,
13962                _depth
13963            )?;
13964            Ok(())
13965        }
13966    }
13967
13968    impl fidl::encoding::ResourceTypeMarker for Flatland2SetLayerImageRequest {
13969        type Borrowed<'a> = &'a mut Self;
13970        fn take_or_borrow<'a>(
13971            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
13972        ) -> Self::Borrowed<'a> {
13973            value
13974        }
13975    }
13976
13977    unsafe impl fidl::encoding::TypeMarker for Flatland2SetLayerImageRequest {
13978        type Owned = Self;
13979
13980        #[inline(always)]
13981        fn inline_align(_context: fidl::encoding::Context) -> usize {
13982            8
13983        }
13984
13985        #[inline(always)]
13986        fn inline_size(_context: fidl::encoding::Context) -> usize {
13987            48
13988        }
13989    }
13990
13991    unsafe impl
13992        fidl::encoding::Encode<
13993            Flatland2SetLayerImageRequest,
13994            fidl::encoding::DefaultFuchsiaResourceDialect,
13995        > for &mut Flatland2SetLayerImageRequest
13996    {
13997        #[inline]
13998        unsafe fn encode(
13999            self,
14000            encoder: &mut fidl::encoding::Encoder<
14001                '_,
14002                fidl::encoding::DefaultFuchsiaResourceDialect,
14003            >,
14004            offset: usize,
14005            _depth: fidl::encoding::Depth,
14006        ) -> fidl::Result<()> {
14007            encoder.debug_check_bounds::<Flatland2SetLayerImageRequest>(offset);
14008            // Delegate to tuple encoding.
14009            fidl::encoding::Encode::<Flatland2SetLayerImageRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
14010                (
14011                    <LayerId as fidl::encoding::ValueTypeMarker>::borrow(&self.layer_id),
14012                    <ImageId as fidl::encoding::ValueTypeMarker>::borrow(&self.image_id),
14013                    <fidl::encoding::OptionalUnion<WaitFence> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.acquire_fence),
14014                    <fidl::encoding::OptionalUnion<SignalFence> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.release_fence),
14015                ),
14016                encoder, offset, _depth
14017            )
14018        }
14019    }
14020    unsafe impl<
14021        T0: fidl::encoding::Encode<LayerId, fidl::encoding::DefaultFuchsiaResourceDialect>,
14022        T1: fidl::encoding::Encode<ImageId, fidl::encoding::DefaultFuchsiaResourceDialect>,
14023        T2: fidl::encoding::Encode<
14024                fidl::encoding::OptionalUnion<WaitFence>,
14025                fidl::encoding::DefaultFuchsiaResourceDialect,
14026            >,
14027        T3: fidl::encoding::Encode<
14028                fidl::encoding::OptionalUnion<SignalFence>,
14029                fidl::encoding::DefaultFuchsiaResourceDialect,
14030            >,
14031    >
14032        fidl::encoding::Encode<
14033            Flatland2SetLayerImageRequest,
14034            fidl::encoding::DefaultFuchsiaResourceDialect,
14035        > for (T0, T1, T2, T3)
14036    {
14037        #[inline]
14038        unsafe fn encode(
14039            self,
14040            encoder: &mut fidl::encoding::Encoder<
14041                '_,
14042                fidl::encoding::DefaultFuchsiaResourceDialect,
14043            >,
14044            offset: usize,
14045            depth: fidl::encoding::Depth,
14046        ) -> fidl::Result<()> {
14047            encoder.debug_check_bounds::<Flatland2SetLayerImageRequest>(offset);
14048            // Zero out padding regions. There's no need to apply masks
14049            // because the unmasked parts will be overwritten by fields.
14050            // Write the fields.
14051            self.0.encode(encoder, offset + 0, depth)?;
14052            self.1.encode(encoder, offset + 8, depth)?;
14053            self.2.encode(encoder, offset + 16, depth)?;
14054            self.3.encode(encoder, offset + 32, depth)?;
14055            Ok(())
14056        }
14057    }
14058
14059    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
14060        for Flatland2SetLayerImageRequest
14061    {
14062        #[inline(always)]
14063        fn new_empty() -> Self {
14064            Self {
14065                layer_id: fidl::new_empty!(LayerId, fidl::encoding::DefaultFuchsiaResourceDialect),
14066                image_id: fidl::new_empty!(ImageId, fidl::encoding::DefaultFuchsiaResourceDialect),
14067                acquire_fence: fidl::new_empty!(
14068                    fidl::encoding::OptionalUnion<WaitFence>,
14069                    fidl::encoding::DefaultFuchsiaResourceDialect
14070                ),
14071                release_fence: fidl::new_empty!(
14072                    fidl::encoding::OptionalUnion<SignalFence>,
14073                    fidl::encoding::DefaultFuchsiaResourceDialect
14074                ),
14075            }
14076        }
14077
14078        #[inline]
14079        unsafe fn decode(
14080            &mut self,
14081            decoder: &mut fidl::encoding::Decoder<
14082                '_,
14083                fidl::encoding::DefaultFuchsiaResourceDialect,
14084            >,
14085            offset: usize,
14086            _depth: fidl::encoding::Depth,
14087        ) -> fidl::Result<()> {
14088            decoder.debug_check_bounds::<Self>(offset);
14089            // Verify that padding bytes are zero.
14090            fidl::decode!(
14091                LayerId,
14092                fidl::encoding::DefaultFuchsiaResourceDialect,
14093                &mut self.layer_id,
14094                decoder,
14095                offset + 0,
14096                _depth
14097            )?;
14098            fidl::decode!(
14099                ImageId,
14100                fidl::encoding::DefaultFuchsiaResourceDialect,
14101                &mut self.image_id,
14102                decoder,
14103                offset + 8,
14104                _depth
14105            )?;
14106            fidl::decode!(
14107                fidl::encoding::OptionalUnion<WaitFence>,
14108                fidl::encoding::DefaultFuchsiaResourceDialect,
14109                &mut self.acquire_fence,
14110                decoder,
14111                offset + 16,
14112                _depth
14113            )?;
14114            fidl::decode!(
14115                fidl::encoding::OptionalUnion<SignalFence>,
14116                fidl::encoding::DefaultFuchsiaResourceDialect,
14117                &mut self.release_fence,
14118                decoder,
14119                offset + 32,
14120                _depth
14121            )?;
14122            Ok(())
14123        }
14124    }
14125
14126    impl fidl::encoding::ResourceTypeMarker for FlatlandCreateFilledRectRequest {
14127        type Borrowed<'a> = &'a mut Self;
14128        fn take_or_borrow<'a>(
14129            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
14130        ) -> Self::Borrowed<'a> {
14131            value
14132        }
14133    }
14134
14135    unsafe impl fidl::encoding::TypeMarker for FlatlandCreateFilledRectRequest {
14136        type Owned = Self;
14137
14138        #[inline(always)]
14139        fn inline_align(_context: fidl::encoding::Context) -> usize {
14140            8
14141        }
14142
14143        #[inline(always)]
14144        fn inline_size(_context: fidl::encoding::Context) -> usize {
14145            8
14146        }
14147        #[inline(always)]
14148        fn encode_is_copy() -> bool {
14149            true
14150        }
14151
14152        #[inline(always)]
14153        fn decode_is_copy() -> bool {
14154            true
14155        }
14156    }
14157
14158    unsafe impl
14159        fidl::encoding::Encode<
14160            FlatlandCreateFilledRectRequest,
14161            fidl::encoding::DefaultFuchsiaResourceDialect,
14162        > for &mut FlatlandCreateFilledRectRequest
14163    {
14164        #[inline]
14165        unsafe fn encode(
14166            self,
14167            encoder: &mut fidl::encoding::Encoder<
14168                '_,
14169                fidl::encoding::DefaultFuchsiaResourceDialect,
14170            >,
14171            offset: usize,
14172            _depth: fidl::encoding::Depth,
14173        ) -> fidl::Result<()> {
14174            encoder.debug_check_bounds::<FlatlandCreateFilledRectRequest>(offset);
14175            unsafe {
14176                // Copy the object into the buffer.
14177                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
14178                (buf_ptr as *mut FlatlandCreateFilledRectRequest)
14179                    .write_unaligned((self as *const FlatlandCreateFilledRectRequest).read());
14180                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
14181                // done second because the memcpy will write garbage to these bytes.
14182            }
14183            Ok(())
14184        }
14185    }
14186    unsafe impl<
14187        T0: fidl::encoding::Encode<ContentId, fidl::encoding::DefaultFuchsiaResourceDialect>,
14188    >
14189        fidl::encoding::Encode<
14190            FlatlandCreateFilledRectRequest,
14191            fidl::encoding::DefaultFuchsiaResourceDialect,
14192        > for (T0,)
14193    {
14194        #[inline]
14195        unsafe fn encode(
14196            self,
14197            encoder: &mut fidl::encoding::Encoder<
14198                '_,
14199                fidl::encoding::DefaultFuchsiaResourceDialect,
14200            >,
14201            offset: usize,
14202            depth: fidl::encoding::Depth,
14203        ) -> fidl::Result<()> {
14204            encoder.debug_check_bounds::<FlatlandCreateFilledRectRequest>(offset);
14205            // Zero out padding regions. There's no need to apply masks
14206            // because the unmasked parts will be overwritten by fields.
14207            // Write the fields.
14208            self.0.encode(encoder, offset + 0, depth)?;
14209            Ok(())
14210        }
14211    }
14212
14213    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
14214        for FlatlandCreateFilledRectRequest
14215    {
14216        #[inline(always)]
14217        fn new_empty() -> Self {
14218            Self {
14219                rect_id: fidl::new_empty!(ContentId, fidl::encoding::DefaultFuchsiaResourceDialect),
14220            }
14221        }
14222
14223        #[inline]
14224        unsafe fn decode(
14225            &mut self,
14226            decoder: &mut fidl::encoding::Decoder<
14227                '_,
14228                fidl::encoding::DefaultFuchsiaResourceDialect,
14229            >,
14230            offset: usize,
14231            _depth: fidl::encoding::Depth,
14232        ) -> fidl::Result<()> {
14233            decoder.debug_check_bounds::<Self>(offset);
14234            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
14235            // Verify that padding bytes are zero.
14236            // Copy from the buffer into the object.
14237            unsafe {
14238                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
14239            }
14240            Ok(())
14241        }
14242    }
14243
14244    impl fidl::encoding::ResourceTypeMarker for FlatlandCreateImageRequest {
14245        type Borrowed<'a> = &'a mut Self;
14246        fn take_or_borrow<'a>(
14247            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
14248        ) -> Self::Borrowed<'a> {
14249            value
14250        }
14251    }
14252
14253    unsafe impl fidl::encoding::TypeMarker for FlatlandCreateImageRequest {
14254        type Owned = Self;
14255
14256        #[inline(always)]
14257        fn inline_align(_context: fidl::encoding::Context) -> usize {
14258            8
14259        }
14260
14261        #[inline(always)]
14262        fn inline_size(_context: fidl::encoding::Context) -> usize {
14263            32
14264        }
14265    }
14266
14267    unsafe impl
14268        fidl::encoding::Encode<
14269            FlatlandCreateImageRequest,
14270            fidl::encoding::DefaultFuchsiaResourceDialect,
14271        > for &mut FlatlandCreateImageRequest
14272    {
14273        #[inline]
14274        unsafe fn encode(
14275            self,
14276            encoder: &mut fidl::encoding::Encoder<
14277                '_,
14278                fidl::encoding::DefaultFuchsiaResourceDialect,
14279            >,
14280            offset: usize,
14281            _depth: fidl::encoding::Depth,
14282        ) -> fidl::Result<()> {
14283            encoder.debug_check_bounds::<FlatlandCreateImageRequest>(offset);
14284            // Delegate to tuple encoding.
14285            fidl::encoding::Encode::<FlatlandCreateImageRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
14286                (
14287                    <ContentId as fidl::encoding::ValueTypeMarker>::borrow(&self.image_id),
14288                    <BufferCollectionImportToken as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.import_token),
14289                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.vmo_index),
14290                    <ImageProperties as fidl::encoding::ValueTypeMarker>::borrow(&self.properties),
14291                ),
14292                encoder, offset, _depth
14293            )
14294        }
14295    }
14296    unsafe impl<
14297        T0: fidl::encoding::Encode<ContentId, fidl::encoding::DefaultFuchsiaResourceDialect>,
14298        T1: fidl::encoding::Encode<
14299                BufferCollectionImportToken,
14300                fidl::encoding::DefaultFuchsiaResourceDialect,
14301            >,
14302        T2: fidl::encoding::Encode<u32, fidl::encoding::DefaultFuchsiaResourceDialect>,
14303        T3: fidl::encoding::Encode<ImageProperties, fidl::encoding::DefaultFuchsiaResourceDialect>,
14304    >
14305        fidl::encoding::Encode<
14306            FlatlandCreateImageRequest,
14307            fidl::encoding::DefaultFuchsiaResourceDialect,
14308        > for (T0, T1, T2, T3)
14309    {
14310        #[inline]
14311        unsafe fn encode(
14312            self,
14313            encoder: &mut fidl::encoding::Encoder<
14314                '_,
14315                fidl::encoding::DefaultFuchsiaResourceDialect,
14316            >,
14317            offset: usize,
14318            depth: fidl::encoding::Depth,
14319        ) -> fidl::Result<()> {
14320            encoder.debug_check_bounds::<FlatlandCreateImageRequest>(offset);
14321            // Zero out padding regions. There's no need to apply masks
14322            // because the unmasked parts will be overwritten by fields.
14323            // Write the fields.
14324            self.0.encode(encoder, offset + 0, depth)?;
14325            self.1.encode(encoder, offset + 8, depth)?;
14326            self.2.encode(encoder, offset + 12, depth)?;
14327            self.3.encode(encoder, offset + 16, depth)?;
14328            Ok(())
14329        }
14330    }
14331
14332    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
14333        for FlatlandCreateImageRequest
14334    {
14335        #[inline(always)]
14336        fn new_empty() -> Self {
14337            Self {
14338                image_id: fidl::new_empty!(
14339                    ContentId,
14340                    fidl::encoding::DefaultFuchsiaResourceDialect
14341                ),
14342                import_token: fidl::new_empty!(
14343                    BufferCollectionImportToken,
14344                    fidl::encoding::DefaultFuchsiaResourceDialect
14345                ),
14346                vmo_index: fidl::new_empty!(u32, fidl::encoding::DefaultFuchsiaResourceDialect),
14347                properties: fidl::new_empty!(
14348                    ImageProperties,
14349                    fidl::encoding::DefaultFuchsiaResourceDialect
14350                ),
14351            }
14352        }
14353
14354        #[inline]
14355        unsafe fn decode(
14356            &mut self,
14357            decoder: &mut fidl::encoding::Decoder<
14358                '_,
14359                fidl::encoding::DefaultFuchsiaResourceDialect,
14360            >,
14361            offset: usize,
14362            _depth: fidl::encoding::Depth,
14363        ) -> fidl::Result<()> {
14364            decoder.debug_check_bounds::<Self>(offset);
14365            // Verify that padding bytes are zero.
14366            fidl::decode!(
14367                ContentId,
14368                fidl::encoding::DefaultFuchsiaResourceDialect,
14369                &mut self.image_id,
14370                decoder,
14371                offset + 0,
14372                _depth
14373            )?;
14374            fidl::decode!(
14375                BufferCollectionImportToken,
14376                fidl::encoding::DefaultFuchsiaResourceDialect,
14377                &mut self.import_token,
14378                decoder,
14379                offset + 8,
14380                _depth
14381            )?;
14382            fidl::decode!(
14383                u32,
14384                fidl::encoding::DefaultFuchsiaResourceDialect,
14385                &mut self.vmo_index,
14386                decoder,
14387                offset + 12,
14388                _depth
14389            )?;
14390            fidl::decode!(
14391                ImageProperties,
14392                fidl::encoding::DefaultFuchsiaResourceDialect,
14393                &mut self.properties,
14394                decoder,
14395                offset + 16,
14396                _depth
14397            )?;
14398            Ok(())
14399        }
14400    }
14401
14402    impl fidl::encoding::ResourceTypeMarker for FlatlandCreateView2Request {
14403        type Borrowed<'a> = &'a mut Self;
14404        fn take_or_borrow<'a>(
14405            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
14406        ) -> Self::Borrowed<'a> {
14407            value
14408        }
14409    }
14410
14411    unsafe impl fidl::encoding::TypeMarker for FlatlandCreateView2Request {
14412        type Owned = Self;
14413
14414        #[inline(always)]
14415        fn inline_align(_context: fidl::encoding::Context) -> usize {
14416            8
14417        }
14418
14419        #[inline(always)]
14420        fn inline_size(_context: fidl::encoding::Context) -> usize {
14421            40
14422        }
14423    }
14424
14425    unsafe impl
14426        fidl::encoding::Encode<
14427            FlatlandCreateView2Request,
14428            fidl::encoding::DefaultFuchsiaResourceDialect,
14429        > for &mut FlatlandCreateView2Request
14430    {
14431        #[inline]
14432        unsafe fn encode(
14433            self,
14434            encoder: &mut fidl::encoding::Encoder<
14435                '_,
14436                fidl::encoding::DefaultFuchsiaResourceDialect,
14437            >,
14438            offset: usize,
14439            _depth: fidl::encoding::Depth,
14440        ) -> fidl::Result<()> {
14441            encoder.debug_check_bounds::<FlatlandCreateView2Request>(offset);
14442            // Delegate to tuple encoding.
14443            fidl::encoding::Encode::<FlatlandCreateView2Request, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
14444                (
14445                    <fidl_fuchsia_ui_views::ViewCreationToken as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.token),
14446                    <fidl_fuchsia_ui_views::ViewIdentityOnCreation as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.view_identity),
14447                    <ViewBoundProtocols as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.protocols),
14448                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.parent_viewport_watcher),
14449                ),
14450                encoder, offset, _depth
14451            )
14452        }
14453    }
14454    unsafe impl<
14455        T0: fidl::encoding::Encode<
14456                fidl_fuchsia_ui_views::ViewCreationToken,
14457                fidl::encoding::DefaultFuchsiaResourceDialect,
14458            >,
14459        T1: fidl::encoding::Encode<
14460                fidl_fuchsia_ui_views::ViewIdentityOnCreation,
14461                fidl::encoding::DefaultFuchsiaResourceDialect,
14462            >,
14463        T2: fidl::encoding::Encode<ViewBoundProtocols, fidl::encoding::DefaultFuchsiaResourceDialect>,
14464        T3: fidl::encoding::Encode<
14465                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>>,
14466                fidl::encoding::DefaultFuchsiaResourceDialect,
14467            >,
14468    >
14469        fidl::encoding::Encode<
14470            FlatlandCreateView2Request,
14471            fidl::encoding::DefaultFuchsiaResourceDialect,
14472        > for (T0, T1, T2, T3)
14473    {
14474        #[inline]
14475        unsafe fn encode(
14476            self,
14477            encoder: &mut fidl::encoding::Encoder<
14478                '_,
14479                fidl::encoding::DefaultFuchsiaResourceDialect,
14480            >,
14481            offset: usize,
14482            depth: fidl::encoding::Depth,
14483        ) -> fidl::Result<()> {
14484            encoder.debug_check_bounds::<FlatlandCreateView2Request>(offset);
14485            // Zero out padding regions. There's no need to apply masks
14486            // because the unmasked parts will be overwritten by fields.
14487            unsafe {
14488                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
14489                (ptr as *mut u64).write_unaligned(0);
14490            }
14491            unsafe {
14492                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(32);
14493                (ptr as *mut u64).write_unaligned(0);
14494            }
14495            // Write the fields.
14496            self.0.encode(encoder, offset + 0, depth)?;
14497            self.1.encode(encoder, offset + 4, depth)?;
14498            self.2.encode(encoder, offset + 16, depth)?;
14499            self.3.encode(encoder, offset + 32, depth)?;
14500            Ok(())
14501        }
14502    }
14503
14504    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
14505        for FlatlandCreateView2Request
14506    {
14507        #[inline(always)]
14508        fn new_empty() -> Self {
14509            Self {
14510                token: fidl::new_empty!(
14511                    fidl_fuchsia_ui_views::ViewCreationToken,
14512                    fidl::encoding::DefaultFuchsiaResourceDialect
14513                ),
14514                view_identity: fidl::new_empty!(
14515                    fidl_fuchsia_ui_views::ViewIdentityOnCreation,
14516                    fidl::encoding::DefaultFuchsiaResourceDialect
14517                ),
14518                protocols: fidl::new_empty!(
14519                    ViewBoundProtocols,
14520                    fidl::encoding::DefaultFuchsiaResourceDialect
14521                ),
14522                parent_viewport_watcher: fidl::new_empty!(
14523                    fidl::encoding::Endpoint<
14524                        fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>,
14525                    >,
14526                    fidl::encoding::DefaultFuchsiaResourceDialect
14527                ),
14528            }
14529        }
14530
14531        #[inline]
14532        unsafe fn decode(
14533            &mut self,
14534            decoder: &mut fidl::encoding::Decoder<
14535                '_,
14536                fidl::encoding::DefaultFuchsiaResourceDialect,
14537            >,
14538            offset: usize,
14539            _depth: fidl::encoding::Depth,
14540        ) -> fidl::Result<()> {
14541            decoder.debug_check_bounds::<Self>(offset);
14542            // Verify that padding bytes are zero.
14543            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(8) };
14544            let padval = unsafe { (ptr as *const u64).read_unaligned() };
14545            let mask = 0xffffffff00000000u64;
14546            let maskedval = padval & mask;
14547            if maskedval != 0 {
14548                return Err(fidl::Error::NonZeroPadding {
14549                    padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
14550                });
14551            }
14552            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(32) };
14553            let padval = unsafe { (ptr as *const u64).read_unaligned() };
14554            let mask = 0xffffffff00000000u64;
14555            let maskedval = padval & mask;
14556            if maskedval != 0 {
14557                return Err(fidl::Error::NonZeroPadding {
14558                    padding_start: offset + 32 + ((mask as u64).trailing_zeros() / 8) as usize,
14559                });
14560            }
14561            fidl::decode!(
14562                fidl_fuchsia_ui_views::ViewCreationToken,
14563                fidl::encoding::DefaultFuchsiaResourceDialect,
14564                &mut self.token,
14565                decoder,
14566                offset + 0,
14567                _depth
14568            )?;
14569            fidl::decode!(
14570                fidl_fuchsia_ui_views::ViewIdentityOnCreation,
14571                fidl::encoding::DefaultFuchsiaResourceDialect,
14572                &mut self.view_identity,
14573                decoder,
14574                offset + 4,
14575                _depth
14576            )?;
14577            fidl::decode!(
14578                ViewBoundProtocols,
14579                fidl::encoding::DefaultFuchsiaResourceDialect,
14580                &mut self.protocols,
14581                decoder,
14582                offset + 16,
14583                _depth
14584            )?;
14585            fidl::decode!(
14586                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>>,
14587                fidl::encoding::DefaultFuchsiaResourceDialect,
14588                &mut self.parent_viewport_watcher,
14589                decoder,
14590                offset + 32,
14591                _depth
14592            )?;
14593            Ok(())
14594        }
14595    }
14596
14597    impl fidl::encoding::ResourceTypeMarker for FlatlandCreateViewRequest {
14598        type Borrowed<'a> = &'a mut Self;
14599        fn take_or_borrow<'a>(
14600            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
14601        ) -> Self::Borrowed<'a> {
14602            value
14603        }
14604    }
14605
14606    unsafe impl fidl::encoding::TypeMarker for FlatlandCreateViewRequest {
14607        type Owned = Self;
14608
14609        #[inline(always)]
14610        fn inline_align(_context: fidl::encoding::Context) -> usize {
14611            4
14612        }
14613
14614        #[inline(always)]
14615        fn inline_size(_context: fidl::encoding::Context) -> usize {
14616            8
14617        }
14618    }
14619
14620    unsafe impl
14621        fidl::encoding::Encode<
14622            FlatlandCreateViewRequest,
14623            fidl::encoding::DefaultFuchsiaResourceDialect,
14624        > for &mut FlatlandCreateViewRequest
14625    {
14626        #[inline]
14627        unsafe fn encode(
14628            self,
14629            encoder: &mut fidl::encoding::Encoder<
14630                '_,
14631                fidl::encoding::DefaultFuchsiaResourceDialect,
14632            >,
14633            offset: usize,
14634            _depth: fidl::encoding::Depth,
14635        ) -> fidl::Result<()> {
14636            encoder.debug_check_bounds::<FlatlandCreateViewRequest>(offset);
14637            // Delegate to tuple encoding.
14638            fidl::encoding::Encode::<FlatlandCreateViewRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
14639                (
14640                    <fidl_fuchsia_ui_views::ViewCreationToken as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.token),
14641                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.parent_viewport_watcher),
14642                ),
14643                encoder, offset, _depth
14644            )
14645        }
14646    }
14647    unsafe impl<
14648        T0: fidl::encoding::Encode<
14649                fidl_fuchsia_ui_views::ViewCreationToken,
14650                fidl::encoding::DefaultFuchsiaResourceDialect,
14651            >,
14652        T1: fidl::encoding::Encode<
14653                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>>,
14654                fidl::encoding::DefaultFuchsiaResourceDialect,
14655            >,
14656    >
14657        fidl::encoding::Encode<
14658            FlatlandCreateViewRequest,
14659            fidl::encoding::DefaultFuchsiaResourceDialect,
14660        > for (T0, T1)
14661    {
14662        #[inline]
14663        unsafe fn encode(
14664            self,
14665            encoder: &mut fidl::encoding::Encoder<
14666                '_,
14667                fidl::encoding::DefaultFuchsiaResourceDialect,
14668            >,
14669            offset: usize,
14670            depth: fidl::encoding::Depth,
14671        ) -> fidl::Result<()> {
14672            encoder.debug_check_bounds::<FlatlandCreateViewRequest>(offset);
14673            // Zero out padding regions. There's no need to apply masks
14674            // because the unmasked parts will be overwritten by fields.
14675            // Write the fields.
14676            self.0.encode(encoder, offset + 0, depth)?;
14677            self.1.encode(encoder, offset + 4, depth)?;
14678            Ok(())
14679        }
14680    }
14681
14682    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
14683        for FlatlandCreateViewRequest
14684    {
14685        #[inline(always)]
14686        fn new_empty() -> Self {
14687            Self {
14688                token: fidl::new_empty!(
14689                    fidl_fuchsia_ui_views::ViewCreationToken,
14690                    fidl::encoding::DefaultFuchsiaResourceDialect
14691                ),
14692                parent_viewport_watcher: fidl::new_empty!(
14693                    fidl::encoding::Endpoint<
14694                        fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>,
14695                    >,
14696                    fidl::encoding::DefaultFuchsiaResourceDialect
14697                ),
14698            }
14699        }
14700
14701        #[inline]
14702        unsafe fn decode(
14703            &mut self,
14704            decoder: &mut fidl::encoding::Decoder<
14705                '_,
14706                fidl::encoding::DefaultFuchsiaResourceDialect,
14707            >,
14708            offset: usize,
14709            _depth: fidl::encoding::Depth,
14710        ) -> fidl::Result<()> {
14711            decoder.debug_check_bounds::<Self>(offset);
14712            // Verify that padding bytes are zero.
14713            fidl::decode!(
14714                fidl_fuchsia_ui_views::ViewCreationToken,
14715                fidl::encoding::DefaultFuchsiaResourceDialect,
14716                &mut self.token,
14717                decoder,
14718                offset + 0,
14719                _depth
14720            )?;
14721            fidl::decode!(
14722                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>>,
14723                fidl::encoding::DefaultFuchsiaResourceDialect,
14724                &mut self.parent_viewport_watcher,
14725                decoder,
14726                offset + 4,
14727                _depth
14728            )?;
14729            Ok(())
14730        }
14731    }
14732
14733    impl fidl::encoding::ResourceTypeMarker for FlatlandCreateViewportRequest {
14734        type Borrowed<'a> = &'a mut Self;
14735        fn take_or_borrow<'a>(
14736            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
14737        ) -> Self::Borrowed<'a> {
14738            value
14739        }
14740    }
14741
14742    unsafe impl fidl::encoding::TypeMarker for FlatlandCreateViewportRequest {
14743        type Owned = Self;
14744
14745        #[inline(always)]
14746        fn inline_align(_context: fidl::encoding::Context) -> usize {
14747            8
14748        }
14749
14750        #[inline(always)]
14751        fn inline_size(_context: fidl::encoding::Context) -> usize {
14752            40
14753        }
14754    }
14755
14756    unsafe impl
14757        fidl::encoding::Encode<
14758            FlatlandCreateViewportRequest,
14759            fidl::encoding::DefaultFuchsiaResourceDialect,
14760        > for &mut FlatlandCreateViewportRequest
14761    {
14762        #[inline]
14763        unsafe fn encode(
14764            self,
14765            encoder: &mut fidl::encoding::Encoder<
14766                '_,
14767                fidl::encoding::DefaultFuchsiaResourceDialect,
14768            >,
14769            offset: usize,
14770            _depth: fidl::encoding::Depth,
14771        ) -> fidl::Result<()> {
14772            encoder.debug_check_bounds::<FlatlandCreateViewportRequest>(offset);
14773            // Delegate to tuple encoding.
14774            fidl::encoding::Encode::<FlatlandCreateViewportRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
14775                (
14776                    <ContentId as fidl::encoding::ValueTypeMarker>::borrow(&self.viewport_id),
14777                    <fidl_fuchsia_ui_views::ViewportCreationToken as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.token),
14778                    <ViewportProperties as fidl::encoding::ValueTypeMarker>::borrow(&self.properties),
14779                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ChildViewWatcherMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.child_view_watcher),
14780                ),
14781                encoder, offset, _depth
14782            )
14783        }
14784    }
14785    unsafe impl<
14786        T0: fidl::encoding::Encode<ContentId, fidl::encoding::DefaultFuchsiaResourceDialect>,
14787        T1: fidl::encoding::Encode<
14788                fidl_fuchsia_ui_views::ViewportCreationToken,
14789                fidl::encoding::DefaultFuchsiaResourceDialect,
14790            >,
14791        T2: fidl::encoding::Encode<ViewportProperties, fidl::encoding::DefaultFuchsiaResourceDialect>,
14792        T3: fidl::encoding::Encode<
14793                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ChildViewWatcherMarker>>,
14794                fidl::encoding::DefaultFuchsiaResourceDialect,
14795            >,
14796    >
14797        fidl::encoding::Encode<
14798            FlatlandCreateViewportRequest,
14799            fidl::encoding::DefaultFuchsiaResourceDialect,
14800        > for (T0, T1, T2, T3)
14801    {
14802        #[inline]
14803        unsafe fn encode(
14804            self,
14805            encoder: &mut fidl::encoding::Encoder<
14806                '_,
14807                fidl::encoding::DefaultFuchsiaResourceDialect,
14808            >,
14809            offset: usize,
14810            depth: fidl::encoding::Depth,
14811        ) -> fidl::Result<()> {
14812            encoder.debug_check_bounds::<FlatlandCreateViewportRequest>(offset);
14813            // Zero out padding regions. There's no need to apply masks
14814            // because the unmasked parts will be overwritten by fields.
14815            unsafe {
14816                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
14817                (ptr as *mut u64).write_unaligned(0);
14818            }
14819            unsafe {
14820                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(32);
14821                (ptr as *mut u64).write_unaligned(0);
14822            }
14823            // Write the fields.
14824            self.0.encode(encoder, offset + 0, depth)?;
14825            self.1.encode(encoder, offset + 8, depth)?;
14826            self.2.encode(encoder, offset + 16, depth)?;
14827            self.3.encode(encoder, offset + 32, depth)?;
14828            Ok(())
14829        }
14830    }
14831
14832    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
14833        for FlatlandCreateViewportRequest
14834    {
14835        #[inline(always)]
14836        fn new_empty() -> Self {
14837            Self {
14838                viewport_id: fidl::new_empty!(
14839                    ContentId,
14840                    fidl::encoding::DefaultFuchsiaResourceDialect
14841                ),
14842                token: fidl::new_empty!(
14843                    fidl_fuchsia_ui_views::ViewportCreationToken,
14844                    fidl::encoding::DefaultFuchsiaResourceDialect
14845                ),
14846                properties: fidl::new_empty!(
14847                    ViewportProperties,
14848                    fidl::encoding::DefaultFuchsiaResourceDialect
14849                ),
14850                child_view_watcher: fidl::new_empty!(
14851                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ChildViewWatcherMarker>>,
14852                    fidl::encoding::DefaultFuchsiaResourceDialect
14853                ),
14854            }
14855        }
14856
14857        #[inline]
14858        unsafe fn decode(
14859            &mut self,
14860            decoder: &mut fidl::encoding::Decoder<
14861                '_,
14862                fidl::encoding::DefaultFuchsiaResourceDialect,
14863            >,
14864            offset: usize,
14865            _depth: fidl::encoding::Depth,
14866        ) -> fidl::Result<()> {
14867            decoder.debug_check_bounds::<Self>(offset);
14868            // Verify that padding bytes are zero.
14869            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(8) };
14870            let padval = unsafe { (ptr as *const u64).read_unaligned() };
14871            let mask = 0xffffffff00000000u64;
14872            let maskedval = padval & mask;
14873            if maskedval != 0 {
14874                return Err(fidl::Error::NonZeroPadding {
14875                    padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
14876                });
14877            }
14878            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(32) };
14879            let padval = unsafe { (ptr as *const u64).read_unaligned() };
14880            let mask = 0xffffffff00000000u64;
14881            let maskedval = padval & mask;
14882            if maskedval != 0 {
14883                return Err(fidl::Error::NonZeroPadding {
14884                    padding_start: offset + 32 + ((mask as u64).trailing_zeros() / 8) as usize,
14885                });
14886            }
14887            fidl::decode!(
14888                ContentId,
14889                fidl::encoding::DefaultFuchsiaResourceDialect,
14890                &mut self.viewport_id,
14891                decoder,
14892                offset + 0,
14893                _depth
14894            )?;
14895            fidl::decode!(
14896                fidl_fuchsia_ui_views::ViewportCreationToken,
14897                fidl::encoding::DefaultFuchsiaResourceDialect,
14898                &mut self.token,
14899                decoder,
14900                offset + 8,
14901                _depth
14902            )?;
14903            fidl::decode!(
14904                ViewportProperties,
14905                fidl::encoding::DefaultFuchsiaResourceDialect,
14906                &mut self.properties,
14907                decoder,
14908                offset + 16,
14909                _depth
14910            )?;
14911            fidl::decode!(
14912                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ChildViewWatcherMarker>>,
14913                fidl::encoding::DefaultFuchsiaResourceDialect,
14914                &mut self.child_view_watcher,
14915                decoder,
14916                offset + 32,
14917                _depth
14918            )?;
14919            Ok(())
14920        }
14921    }
14922
14923    impl fidl::encoding::ResourceTypeMarker for FlatlandDisplaySetContentRequest {
14924        type Borrowed<'a> = &'a mut Self;
14925        fn take_or_borrow<'a>(
14926            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
14927        ) -> Self::Borrowed<'a> {
14928            value
14929        }
14930    }
14931
14932    unsafe impl fidl::encoding::TypeMarker for FlatlandDisplaySetContentRequest {
14933        type Owned = Self;
14934
14935        #[inline(always)]
14936        fn inline_align(_context: fidl::encoding::Context) -> usize {
14937            4
14938        }
14939
14940        #[inline(always)]
14941        fn inline_size(_context: fidl::encoding::Context) -> usize {
14942            8
14943        }
14944    }
14945
14946    unsafe impl
14947        fidl::encoding::Encode<
14948            FlatlandDisplaySetContentRequest,
14949            fidl::encoding::DefaultFuchsiaResourceDialect,
14950        > for &mut FlatlandDisplaySetContentRequest
14951    {
14952        #[inline]
14953        unsafe fn encode(
14954            self,
14955            encoder: &mut fidl::encoding::Encoder<
14956                '_,
14957                fidl::encoding::DefaultFuchsiaResourceDialect,
14958            >,
14959            offset: usize,
14960            _depth: fidl::encoding::Depth,
14961        ) -> fidl::Result<()> {
14962            encoder.debug_check_bounds::<FlatlandDisplaySetContentRequest>(offset);
14963            // Delegate to tuple encoding.
14964            fidl::encoding::Encode::<FlatlandDisplaySetContentRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
14965                (
14966                    <fidl_fuchsia_ui_views::ViewportCreationToken as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.token),
14967                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ChildViewWatcherMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.child_view_watcher),
14968                ),
14969                encoder, offset, _depth
14970            )
14971        }
14972    }
14973    unsafe impl<
14974        T0: fidl::encoding::Encode<
14975                fidl_fuchsia_ui_views::ViewportCreationToken,
14976                fidl::encoding::DefaultFuchsiaResourceDialect,
14977            >,
14978        T1: fidl::encoding::Encode<
14979                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ChildViewWatcherMarker>>,
14980                fidl::encoding::DefaultFuchsiaResourceDialect,
14981            >,
14982    >
14983        fidl::encoding::Encode<
14984            FlatlandDisplaySetContentRequest,
14985            fidl::encoding::DefaultFuchsiaResourceDialect,
14986        > for (T0, T1)
14987    {
14988        #[inline]
14989        unsafe fn encode(
14990            self,
14991            encoder: &mut fidl::encoding::Encoder<
14992                '_,
14993                fidl::encoding::DefaultFuchsiaResourceDialect,
14994            >,
14995            offset: usize,
14996            depth: fidl::encoding::Depth,
14997        ) -> fidl::Result<()> {
14998            encoder.debug_check_bounds::<FlatlandDisplaySetContentRequest>(offset);
14999            // Zero out padding regions. There's no need to apply masks
15000            // because the unmasked parts will be overwritten by fields.
15001            // Write the fields.
15002            self.0.encode(encoder, offset + 0, depth)?;
15003            self.1.encode(encoder, offset + 4, depth)?;
15004            Ok(())
15005        }
15006    }
15007
15008    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
15009        for FlatlandDisplaySetContentRequest
15010    {
15011        #[inline(always)]
15012        fn new_empty() -> Self {
15013            Self {
15014                token: fidl::new_empty!(
15015                    fidl_fuchsia_ui_views::ViewportCreationToken,
15016                    fidl::encoding::DefaultFuchsiaResourceDialect
15017                ),
15018                child_view_watcher: fidl::new_empty!(
15019                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ChildViewWatcherMarker>>,
15020                    fidl::encoding::DefaultFuchsiaResourceDialect
15021                ),
15022            }
15023        }
15024
15025        #[inline]
15026        unsafe fn decode(
15027            &mut self,
15028            decoder: &mut fidl::encoding::Decoder<
15029                '_,
15030                fidl::encoding::DefaultFuchsiaResourceDialect,
15031            >,
15032            offset: usize,
15033            _depth: fidl::encoding::Depth,
15034        ) -> fidl::Result<()> {
15035            decoder.debug_check_bounds::<Self>(offset);
15036            // Verify that padding bytes are zero.
15037            fidl::decode!(
15038                fidl_fuchsia_ui_views::ViewportCreationToken,
15039                fidl::encoding::DefaultFuchsiaResourceDialect,
15040                &mut self.token,
15041                decoder,
15042                offset + 0,
15043                _depth
15044            )?;
15045            fidl::decode!(
15046                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ChildViewWatcherMarker>>,
15047                fidl::encoding::DefaultFuchsiaResourceDialect,
15048                &mut self.child_view_watcher,
15049                decoder,
15050                offset + 4,
15051                _depth
15052            )?;
15053            Ok(())
15054        }
15055    }
15056
15057    impl fidl::encoding::ResourceTypeMarker for FlatlandFactoryCreateFlatlandRequest {
15058        type Borrowed<'a> = &'a mut Self;
15059        fn take_or_borrow<'a>(
15060            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
15061        ) -> Self::Borrowed<'a> {
15062            value
15063        }
15064    }
15065
15066    unsafe impl fidl::encoding::TypeMarker for FlatlandFactoryCreateFlatlandRequest {
15067        type Owned = Self;
15068
15069        #[inline(always)]
15070        fn inline_align(_context: fidl::encoding::Context) -> usize {
15071            8
15072        }
15073
15074        #[inline(always)]
15075        fn inline_size(_context: fidl::encoding::Context) -> usize {
15076            24
15077        }
15078    }
15079
15080    unsafe impl
15081        fidl::encoding::Encode<
15082            FlatlandFactoryCreateFlatlandRequest,
15083            fidl::encoding::DefaultFuchsiaResourceDialect,
15084        > for &mut FlatlandFactoryCreateFlatlandRequest
15085    {
15086        #[inline]
15087        unsafe fn encode(
15088            self,
15089            encoder: &mut fidl::encoding::Encoder<
15090                '_,
15091                fidl::encoding::DefaultFuchsiaResourceDialect,
15092            >,
15093            offset: usize,
15094            _depth: fidl::encoding::Depth,
15095        ) -> fidl::Result<()> {
15096            encoder.debug_check_bounds::<FlatlandFactoryCreateFlatlandRequest>(offset);
15097            // Delegate to tuple encoding.
15098            fidl::encoding::Encode::<FlatlandFactoryCreateFlatlandRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
15099                (
15100                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<FlatlandMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.server_end),
15101                    <FlatlandConfig as fidl::encoding::ValueTypeMarker>::borrow(&self.config),
15102                ),
15103                encoder, offset, _depth
15104            )
15105        }
15106    }
15107    unsafe impl<
15108        T0: fidl::encoding::Encode<
15109                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<FlatlandMarker>>,
15110                fidl::encoding::DefaultFuchsiaResourceDialect,
15111            >,
15112        T1: fidl::encoding::Encode<FlatlandConfig, fidl::encoding::DefaultFuchsiaResourceDialect>,
15113    >
15114        fidl::encoding::Encode<
15115            FlatlandFactoryCreateFlatlandRequest,
15116            fidl::encoding::DefaultFuchsiaResourceDialect,
15117        > for (T0, T1)
15118    {
15119        #[inline]
15120        unsafe fn encode(
15121            self,
15122            encoder: &mut fidl::encoding::Encoder<
15123                '_,
15124                fidl::encoding::DefaultFuchsiaResourceDialect,
15125            >,
15126            offset: usize,
15127            depth: fidl::encoding::Depth,
15128        ) -> fidl::Result<()> {
15129            encoder.debug_check_bounds::<FlatlandFactoryCreateFlatlandRequest>(offset);
15130            // Zero out padding regions. There's no need to apply masks
15131            // because the unmasked parts will be overwritten by fields.
15132            unsafe {
15133                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
15134                (ptr as *mut u64).write_unaligned(0);
15135            }
15136            // Write the fields.
15137            self.0.encode(encoder, offset + 0, depth)?;
15138            self.1.encode(encoder, offset + 8, depth)?;
15139            Ok(())
15140        }
15141    }
15142
15143    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
15144        for FlatlandFactoryCreateFlatlandRequest
15145    {
15146        #[inline(always)]
15147        fn new_empty() -> Self {
15148            Self {
15149                server_end: fidl::new_empty!(
15150                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<FlatlandMarker>>,
15151                    fidl::encoding::DefaultFuchsiaResourceDialect
15152                ),
15153                config: fidl::new_empty!(
15154                    FlatlandConfig,
15155                    fidl::encoding::DefaultFuchsiaResourceDialect
15156                ),
15157            }
15158        }
15159
15160        #[inline]
15161        unsafe fn decode(
15162            &mut self,
15163            decoder: &mut fidl::encoding::Decoder<
15164                '_,
15165                fidl::encoding::DefaultFuchsiaResourceDialect,
15166            >,
15167            offset: usize,
15168            _depth: fidl::encoding::Depth,
15169        ) -> fidl::Result<()> {
15170            decoder.debug_check_bounds::<Self>(offset);
15171            // Verify that padding bytes are zero.
15172            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
15173            let padval = unsafe { (ptr as *const u64).read_unaligned() };
15174            let mask = 0xffffffff00000000u64;
15175            let maskedval = padval & mask;
15176            if maskedval != 0 {
15177                return Err(fidl::Error::NonZeroPadding {
15178                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
15179                });
15180            }
15181            fidl::decode!(
15182                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<FlatlandMarker>>,
15183                fidl::encoding::DefaultFuchsiaResourceDialect,
15184                &mut self.server_end,
15185                decoder,
15186                offset + 0,
15187                _depth
15188            )?;
15189            fidl::decode!(
15190                FlatlandConfig,
15191                fidl::encoding::DefaultFuchsiaResourceDialect,
15192                &mut self.config,
15193                decoder,
15194                offset + 8,
15195                _depth
15196            )?;
15197            Ok(())
15198        }
15199    }
15200
15201    impl fidl::encoding::ResourceTypeMarker for FlatlandPresentRequest {
15202        type Borrowed<'a> = &'a mut Self;
15203        fn take_or_borrow<'a>(
15204            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
15205        ) -> Self::Borrowed<'a> {
15206            value
15207        }
15208    }
15209
15210    unsafe impl fidl::encoding::TypeMarker for FlatlandPresentRequest {
15211        type Owned = Self;
15212
15213        #[inline(always)]
15214        fn inline_align(_context: fidl::encoding::Context) -> usize {
15215            8
15216        }
15217
15218        #[inline(always)]
15219        fn inline_size(_context: fidl::encoding::Context) -> usize {
15220            16
15221        }
15222    }
15223
15224    unsafe impl
15225        fidl::encoding::Encode<
15226            FlatlandPresentRequest,
15227            fidl::encoding::DefaultFuchsiaResourceDialect,
15228        > for &mut FlatlandPresentRequest
15229    {
15230        #[inline]
15231        unsafe fn encode(
15232            self,
15233            encoder: &mut fidl::encoding::Encoder<
15234                '_,
15235                fidl::encoding::DefaultFuchsiaResourceDialect,
15236            >,
15237            offset: usize,
15238            _depth: fidl::encoding::Depth,
15239        ) -> fidl::Result<()> {
15240            encoder.debug_check_bounds::<FlatlandPresentRequest>(offset);
15241            // Delegate to tuple encoding.
15242            fidl::encoding::Encode::<
15243                FlatlandPresentRequest,
15244                fidl::encoding::DefaultFuchsiaResourceDialect,
15245            >::encode(
15246                (<PresentArgs as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
15247                    &mut self.args,
15248                ),),
15249                encoder,
15250                offset,
15251                _depth,
15252            )
15253        }
15254    }
15255    unsafe impl<
15256        T0: fidl::encoding::Encode<PresentArgs, fidl::encoding::DefaultFuchsiaResourceDialect>,
15257    >
15258        fidl::encoding::Encode<
15259            FlatlandPresentRequest,
15260            fidl::encoding::DefaultFuchsiaResourceDialect,
15261        > for (T0,)
15262    {
15263        #[inline]
15264        unsafe fn encode(
15265            self,
15266            encoder: &mut fidl::encoding::Encoder<
15267                '_,
15268                fidl::encoding::DefaultFuchsiaResourceDialect,
15269            >,
15270            offset: usize,
15271            depth: fidl::encoding::Depth,
15272        ) -> fidl::Result<()> {
15273            encoder.debug_check_bounds::<FlatlandPresentRequest>(offset);
15274            // Zero out padding regions. There's no need to apply masks
15275            // because the unmasked parts will be overwritten by fields.
15276            // Write the fields.
15277            self.0.encode(encoder, offset + 0, depth)?;
15278            Ok(())
15279        }
15280    }
15281
15282    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
15283        for FlatlandPresentRequest
15284    {
15285        #[inline(always)]
15286        fn new_empty() -> Self {
15287            Self {
15288                args: fidl::new_empty!(PresentArgs, fidl::encoding::DefaultFuchsiaResourceDialect),
15289            }
15290        }
15291
15292        #[inline]
15293        unsafe fn decode(
15294            &mut self,
15295            decoder: &mut fidl::encoding::Decoder<
15296                '_,
15297                fidl::encoding::DefaultFuchsiaResourceDialect,
15298            >,
15299            offset: usize,
15300            _depth: fidl::encoding::Depth,
15301        ) -> fidl::Result<()> {
15302            decoder.debug_check_bounds::<Self>(offset);
15303            // Verify that padding bytes are zero.
15304            fidl::decode!(
15305                PresentArgs,
15306                fidl::encoding::DefaultFuchsiaResourceDialect,
15307                &mut self.args,
15308                decoder,
15309                offset + 0,
15310                _depth
15311            )?;
15312            Ok(())
15313        }
15314    }
15315
15316    impl fidl::encoding::ResourceTypeMarker for FlatlandReleaseViewportResponse {
15317        type Borrowed<'a> = &'a mut Self;
15318        fn take_or_borrow<'a>(
15319            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
15320        ) -> Self::Borrowed<'a> {
15321            value
15322        }
15323    }
15324
15325    unsafe impl fidl::encoding::TypeMarker for FlatlandReleaseViewportResponse {
15326        type Owned = Self;
15327
15328        #[inline(always)]
15329        fn inline_align(_context: fidl::encoding::Context) -> usize {
15330            4
15331        }
15332
15333        #[inline(always)]
15334        fn inline_size(_context: fidl::encoding::Context) -> usize {
15335            4
15336        }
15337    }
15338
15339    unsafe impl
15340        fidl::encoding::Encode<
15341            FlatlandReleaseViewportResponse,
15342            fidl::encoding::DefaultFuchsiaResourceDialect,
15343        > for &mut FlatlandReleaseViewportResponse
15344    {
15345        #[inline]
15346        unsafe fn encode(
15347            self,
15348            encoder: &mut fidl::encoding::Encoder<
15349                '_,
15350                fidl::encoding::DefaultFuchsiaResourceDialect,
15351            >,
15352            offset: usize,
15353            _depth: fidl::encoding::Depth,
15354        ) -> fidl::Result<()> {
15355            encoder.debug_check_bounds::<FlatlandReleaseViewportResponse>(offset);
15356            // Delegate to tuple encoding.
15357            fidl::encoding::Encode::<FlatlandReleaseViewportResponse, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
15358                (
15359                    <fidl_fuchsia_ui_views::ViewportCreationToken as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.token),
15360                ),
15361                encoder, offset, _depth
15362            )
15363        }
15364    }
15365    unsafe impl<
15366        T0: fidl::encoding::Encode<
15367                fidl_fuchsia_ui_views::ViewportCreationToken,
15368                fidl::encoding::DefaultFuchsiaResourceDialect,
15369            >,
15370    >
15371        fidl::encoding::Encode<
15372            FlatlandReleaseViewportResponse,
15373            fidl::encoding::DefaultFuchsiaResourceDialect,
15374        > for (T0,)
15375    {
15376        #[inline]
15377        unsafe fn encode(
15378            self,
15379            encoder: &mut fidl::encoding::Encoder<
15380                '_,
15381                fidl::encoding::DefaultFuchsiaResourceDialect,
15382            >,
15383            offset: usize,
15384            depth: fidl::encoding::Depth,
15385        ) -> fidl::Result<()> {
15386            encoder.debug_check_bounds::<FlatlandReleaseViewportResponse>(offset);
15387            // Zero out padding regions. There's no need to apply masks
15388            // because the unmasked parts will be overwritten by fields.
15389            // Write the fields.
15390            self.0.encode(encoder, offset + 0, depth)?;
15391            Ok(())
15392        }
15393    }
15394
15395    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
15396        for FlatlandReleaseViewportResponse
15397    {
15398        #[inline(always)]
15399        fn new_empty() -> Self {
15400            Self {
15401                token: fidl::new_empty!(
15402                    fidl_fuchsia_ui_views::ViewportCreationToken,
15403                    fidl::encoding::DefaultFuchsiaResourceDialect
15404                ),
15405            }
15406        }
15407
15408        #[inline]
15409        unsafe fn decode(
15410            &mut self,
15411            decoder: &mut fidl::encoding::Decoder<
15412                '_,
15413                fidl::encoding::DefaultFuchsiaResourceDialect,
15414            >,
15415            offset: usize,
15416            _depth: fidl::encoding::Depth,
15417        ) -> fidl::Result<()> {
15418            decoder.debug_check_bounds::<Self>(offset);
15419            // Verify that padding bytes are zero.
15420            fidl::decode!(
15421                fidl_fuchsia_ui_views::ViewportCreationToken,
15422                fidl::encoding::DefaultFuchsiaResourceDialect,
15423                &mut self.token,
15424                decoder,
15425                offset + 0,
15426                _depth
15427            )?;
15428            Ok(())
15429        }
15430    }
15431
15432    impl fidl::encoding::ResourceTypeMarker for FlatlandSetSolidFillRequest {
15433        type Borrowed<'a> = &'a mut Self;
15434        fn take_or_borrow<'a>(
15435            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
15436        ) -> Self::Borrowed<'a> {
15437            value
15438        }
15439    }
15440
15441    unsafe impl fidl::encoding::TypeMarker for FlatlandSetSolidFillRequest {
15442        type Owned = Self;
15443
15444        #[inline(always)]
15445        fn inline_align(_context: fidl::encoding::Context) -> usize {
15446            8
15447        }
15448
15449        #[inline(always)]
15450        fn inline_size(_context: fidl::encoding::Context) -> usize {
15451            32
15452        }
15453    }
15454
15455    unsafe impl
15456        fidl::encoding::Encode<
15457            FlatlandSetSolidFillRequest,
15458            fidl::encoding::DefaultFuchsiaResourceDialect,
15459        > for &mut FlatlandSetSolidFillRequest
15460    {
15461        #[inline]
15462        unsafe fn encode(
15463            self,
15464            encoder: &mut fidl::encoding::Encoder<
15465                '_,
15466                fidl::encoding::DefaultFuchsiaResourceDialect,
15467            >,
15468            offset: usize,
15469            _depth: fidl::encoding::Depth,
15470        ) -> fidl::Result<()> {
15471            encoder.debug_check_bounds::<FlatlandSetSolidFillRequest>(offset);
15472            // Delegate to tuple encoding.
15473            fidl::encoding::Encode::<
15474                FlatlandSetSolidFillRequest,
15475                fidl::encoding::DefaultFuchsiaResourceDialect,
15476            >::encode(
15477                (
15478                    <ContentId as fidl::encoding::ValueTypeMarker>::borrow(&self.rect_id),
15479                    <ColorRgba as fidl::encoding::ValueTypeMarker>::borrow(&self.color),
15480                    <fidl_fuchsia_math::SizeU as fidl::encoding::ValueTypeMarker>::borrow(
15481                        &self.size,
15482                    ),
15483                ),
15484                encoder,
15485                offset,
15486                _depth,
15487            )
15488        }
15489    }
15490    unsafe impl<
15491        T0: fidl::encoding::Encode<ContentId, fidl::encoding::DefaultFuchsiaResourceDialect>,
15492        T1: fidl::encoding::Encode<ColorRgba, fidl::encoding::DefaultFuchsiaResourceDialect>,
15493        T2: fidl::encoding::Encode<
15494                fidl_fuchsia_math::SizeU,
15495                fidl::encoding::DefaultFuchsiaResourceDialect,
15496            >,
15497    >
15498        fidl::encoding::Encode<
15499            FlatlandSetSolidFillRequest,
15500            fidl::encoding::DefaultFuchsiaResourceDialect,
15501        > for (T0, T1, T2)
15502    {
15503        #[inline]
15504        unsafe fn encode(
15505            self,
15506            encoder: &mut fidl::encoding::Encoder<
15507                '_,
15508                fidl::encoding::DefaultFuchsiaResourceDialect,
15509            >,
15510            offset: usize,
15511            depth: fidl::encoding::Depth,
15512        ) -> fidl::Result<()> {
15513            encoder.debug_check_bounds::<FlatlandSetSolidFillRequest>(offset);
15514            // Zero out padding regions. There's no need to apply masks
15515            // because the unmasked parts will be overwritten by fields.
15516            // Write the fields.
15517            self.0.encode(encoder, offset + 0, depth)?;
15518            self.1.encode(encoder, offset + 8, depth)?;
15519            self.2.encode(encoder, offset + 24, depth)?;
15520            Ok(())
15521        }
15522    }
15523
15524    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
15525        for FlatlandSetSolidFillRequest
15526    {
15527        #[inline(always)]
15528        fn new_empty() -> Self {
15529            Self {
15530                rect_id: fidl::new_empty!(ContentId, fidl::encoding::DefaultFuchsiaResourceDialect),
15531                color: fidl::new_empty!(ColorRgba, fidl::encoding::DefaultFuchsiaResourceDialect),
15532                size: fidl::new_empty!(
15533                    fidl_fuchsia_math::SizeU,
15534                    fidl::encoding::DefaultFuchsiaResourceDialect
15535                ),
15536            }
15537        }
15538
15539        #[inline]
15540        unsafe fn decode(
15541            &mut self,
15542            decoder: &mut fidl::encoding::Decoder<
15543                '_,
15544                fidl::encoding::DefaultFuchsiaResourceDialect,
15545            >,
15546            offset: usize,
15547            _depth: fidl::encoding::Depth,
15548        ) -> fidl::Result<()> {
15549            decoder.debug_check_bounds::<Self>(offset);
15550            // Verify that padding bytes are zero.
15551            fidl::decode!(
15552                ContentId,
15553                fidl::encoding::DefaultFuchsiaResourceDialect,
15554                &mut self.rect_id,
15555                decoder,
15556                offset + 0,
15557                _depth
15558            )?;
15559            fidl::decode!(
15560                ColorRgba,
15561                fidl::encoding::DefaultFuchsiaResourceDialect,
15562                &mut self.color,
15563                decoder,
15564                offset + 8,
15565                _depth
15566            )?;
15567            fidl::decode!(
15568                fidl_fuchsia_math::SizeU,
15569                fidl::encoding::DefaultFuchsiaResourceDialect,
15570                &mut self.size,
15571                decoder,
15572                offset + 24,
15573                _depth
15574            )?;
15575            Ok(())
15576        }
15577    }
15578
15579    impl fidl::encoding::ResourceTypeMarker for TrustedFlatlandFactoryCreateFlatlandRequest {
15580        type Borrowed<'a> = &'a mut Self;
15581        fn take_or_borrow<'a>(
15582            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
15583        ) -> Self::Borrowed<'a> {
15584            value
15585        }
15586    }
15587
15588    unsafe impl fidl::encoding::TypeMarker for TrustedFlatlandFactoryCreateFlatlandRequest {
15589        type Owned = Self;
15590
15591        #[inline(always)]
15592        fn inline_align(_context: fidl::encoding::Context) -> usize {
15593            8
15594        }
15595
15596        #[inline(always)]
15597        fn inline_size(_context: fidl::encoding::Context) -> usize {
15598            24
15599        }
15600    }
15601
15602    unsafe impl
15603        fidl::encoding::Encode<
15604            TrustedFlatlandFactoryCreateFlatlandRequest,
15605            fidl::encoding::DefaultFuchsiaResourceDialect,
15606        > for &mut TrustedFlatlandFactoryCreateFlatlandRequest
15607    {
15608        #[inline]
15609        unsafe fn encode(
15610            self,
15611            encoder: &mut fidl::encoding::Encoder<
15612                '_,
15613                fidl::encoding::DefaultFuchsiaResourceDialect,
15614            >,
15615            offset: usize,
15616            _depth: fidl::encoding::Depth,
15617        ) -> fidl::Result<()> {
15618            encoder.debug_check_bounds::<TrustedFlatlandFactoryCreateFlatlandRequest>(offset);
15619            // Delegate to tuple encoding.
15620            fidl::encoding::Encode::<TrustedFlatlandFactoryCreateFlatlandRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
15621                (
15622                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<FlatlandMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.server_end),
15623                    <TrustedFlatlandConfig as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.config),
15624                ),
15625                encoder, offset, _depth
15626            )
15627        }
15628    }
15629    unsafe impl<
15630        T0: fidl::encoding::Encode<
15631                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<FlatlandMarker>>,
15632                fidl::encoding::DefaultFuchsiaResourceDialect,
15633            >,
15634        T1: fidl::encoding::Encode<
15635                TrustedFlatlandConfig,
15636                fidl::encoding::DefaultFuchsiaResourceDialect,
15637            >,
15638    >
15639        fidl::encoding::Encode<
15640            TrustedFlatlandFactoryCreateFlatlandRequest,
15641            fidl::encoding::DefaultFuchsiaResourceDialect,
15642        > for (T0, T1)
15643    {
15644        #[inline]
15645        unsafe fn encode(
15646            self,
15647            encoder: &mut fidl::encoding::Encoder<
15648                '_,
15649                fidl::encoding::DefaultFuchsiaResourceDialect,
15650            >,
15651            offset: usize,
15652            depth: fidl::encoding::Depth,
15653        ) -> fidl::Result<()> {
15654            encoder.debug_check_bounds::<TrustedFlatlandFactoryCreateFlatlandRequest>(offset);
15655            // Zero out padding regions. There's no need to apply masks
15656            // because the unmasked parts will be overwritten by fields.
15657            unsafe {
15658                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
15659                (ptr as *mut u64).write_unaligned(0);
15660            }
15661            // Write the fields.
15662            self.0.encode(encoder, offset + 0, depth)?;
15663            self.1.encode(encoder, offset + 8, depth)?;
15664            Ok(())
15665        }
15666    }
15667
15668    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
15669        for TrustedFlatlandFactoryCreateFlatlandRequest
15670    {
15671        #[inline(always)]
15672        fn new_empty() -> Self {
15673            Self {
15674                server_end: fidl::new_empty!(
15675                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<FlatlandMarker>>,
15676                    fidl::encoding::DefaultFuchsiaResourceDialect
15677                ),
15678                config: fidl::new_empty!(
15679                    TrustedFlatlandConfig,
15680                    fidl::encoding::DefaultFuchsiaResourceDialect
15681                ),
15682            }
15683        }
15684
15685        #[inline]
15686        unsafe fn decode(
15687            &mut self,
15688            decoder: &mut fidl::encoding::Decoder<
15689                '_,
15690                fidl::encoding::DefaultFuchsiaResourceDialect,
15691            >,
15692            offset: usize,
15693            _depth: fidl::encoding::Depth,
15694        ) -> fidl::Result<()> {
15695            decoder.debug_check_bounds::<Self>(offset);
15696            // Verify that padding bytes are zero.
15697            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
15698            let padval = unsafe { (ptr as *const u64).read_unaligned() };
15699            let mask = 0xffffffff00000000u64;
15700            let maskedval = padval & mask;
15701            if maskedval != 0 {
15702                return Err(fidl::Error::NonZeroPadding {
15703                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
15704                });
15705            }
15706            fidl::decode!(
15707                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<FlatlandMarker>>,
15708                fidl::encoding::DefaultFuchsiaResourceDialect,
15709                &mut self.server_end,
15710                decoder,
15711                offset + 0,
15712                _depth
15713            )?;
15714            fidl::decode!(
15715                TrustedFlatlandConfig,
15716                fidl::encoding::DefaultFuchsiaResourceDialect,
15717                &mut self.config,
15718                decoder,
15719                offset + 8,
15720                _depth
15721            )?;
15722            Ok(())
15723        }
15724    }
15725
15726    impl FrameInfo {
15727        #[inline(always)]
15728        fn max_ordinal_present(&self) -> u64 {
15729            if let Some(_) = self.buffer_id {
15730                return 1;
15731            }
15732            0
15733        }
15734    }
15735
15736    impl fidl::encoding::ResourceTypeMarker for FrameInfo {
15737        type Borrowed<'a> = &'a mut Self;
15738        fn take_or_borrow<'a>(
15739            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
15740        ) -> Self::Borrowed<'a> {
15741            value
15742        }
15743    }
15744
15745    unsafe impl fidl::encoding::TypeMarker for FrameInfo {
15746        type Owned = Self;
15747
15748        #[inline(always)]
15749        fn inline_align(_context: fidl::encoding::Context) -> usize {
15750            8
15751        }
15752
15753        #[inline(always)]
15754        fn inline_size(_context: fidl::encoding::Context) -> usize {
15755            16
15756        }
15757    }
15758
15759    unsafe impl fidl::encoding::Encode<FrameInfo, fidl::encoding::DefaultFuchsiaResourceDialect>
15760        for &mut FrameInfo
15761    {
15762        unsafe fn encode(
15763            self,
15764            encoder: &mut fidl::encoding::Encoder<
15765                '_,
15766                fidl::encoding::DefaultFuchsiaResourceDialect,
15767            >,
15768            offset: usize,
15769            mut depth: fidl::encoding::Depth,
15770        ) -> fidl::Result<()> {
15771            encoder.debug_check_bounds::<FrameInfo>(offset);
15772            // Vector header
15773            let max_ordinal: u64 = self.max_ordinal_present();
15774            encoder.write_num(max_ordinal, offset);
15775            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
15776            // Calling encoder.out_of_line_offset(0) is not allowed.
15777            if max_ordinal == 0 {
15778                return Ok(());
15779            }
15780            depth.increment()?;
15781            let envelope_size = 8;
15782            let bytes_len = max_ordinal as usize * envelope_size;
15783            #[allow(unused_variables)]
15784            let offset = encoder.out_of_line_offset(bytes_len);
15785            let mut _prev_end_offset: usize = 0;
15786            if 1 > max_ordinal {
15787                return Ok(());
15788            }
15789
15790            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
15791            // are envelope_size bytes.
15792            let cur_offset: usize = (1 - 1) * envelope_size;
15793
15794            // Zero reserved fields.
15795            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
15796
15797            // Safety:
15798            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
15799            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
15800            //   envelope_size bytes, there is always sufficient room.
15801            fidl::encoding::encode_in_envelope_optional::<
15802                u32,
15803                fidl::encoding::DefaultFuchsiaResourceDialect,
15804            >(
15805                self.buffer_id.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
15806                encoder,
15807                offset + cur_offset,
15808                depth,
15809            )?;
15810
15811            _prev_end_offset = cur_offset + envelope_size;
15812
15813            Ok(())
15814        }
15815    }
15816
15817    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for FrameInfo {
15818        #[inline(always)]
15819        fn new_empty() -> Self {
15820            Self::default()
15821        }
15822
15823        unsafe fn decode(
15824            &mut self,
15825            decoder: &mut fidl::encoding::Decoder<
15826                '_,
15827                fidl::encoding::DefaultFuchsiaResourceDialect,
15828            >,
15829            offset: usize,
15830            mut depth: fidl::encoding::Depth,
15831        ) -> fidl::Result<()> {
15832            decoder.debug_check_bounds::<Self>(offset);
15833            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
15834                None => return Err(fidl::Error::NotNullable),
15835                Some(len) => len,
15836            };
15837            // Calling decoder.out_of_line_offset(0) is not allowed.
15838            if len == 0 {
15839                return Ok(());
15840            };
15841            depth.increment()?;
15842            let envelope_size = 8;
15843            let bytes_len = len * envelope_size;
15844            let offset = decoder.out_of_line_offset(bytes_len)?;
15845            // Decode the envelope for each type.
15846            let mut _next_ordinal_to_read = 0;
15847            let mut next_offset = offset;
15848            let end_offset = offset + bytes_len;
15849            _next_ordinal_to_read += 1;
15850            if next_offset >= end_offset {
15851                return Ok(());
15852            }
15853
15854            // Decode unknown envelopes for gaps in ordinals.
15855            while _next_ordinal_to_read < 1 {
15856                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
15857                _next_ordinal_to_read += 1;
15858                next_offset += envelope_size;
15859            }
15860
15861            let next_out_of_line = decoder.next_out_of_line();
15862            let handles_before = decoder.remaining_handles();
15863            if let Some((inlined, num_bytes, num_handles)) =
15864                fidl::encoding::decode_envelope_header(decoder, next_offset)?
15865            {
15866                let member_inline_size =
15867                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
15868                if inlined != (member_inline_size <= 4) {
15869                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
15870                }
15871                let inner_offset;
15872                let mut inner_depth = depth.clone();
15873                if inlined {
15874                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
15875                    inner_offset = next_offset;
15876                } else {
15877                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
15878                    inner_depth.increment()?;
15879                }
15880                let val_ref = self.buffer_id.get_or_insert_with(|| {
15881                    fidl::new_empty!(u32, fidl::encoding::DefaultFuchsiaResourceDialect)
15882                });
15883                fidl::decode!(
15884                    u32,
15885                    fidl::encoding::DefaultFuchsiaResourceDialect,
15886                    val_ref,
15887                    decoder,
15888                    inner_offset,
15889                    inner_depth
15890                )?;
15891                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
15892                {
15893                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
15894                }
15895                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
15896                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
15897                }
15898            }
15899
15900            next_offset += envelope_size;
15901
15902            // Decode the remaining unknown envelopes.
15903            while next_offset < end_offset {
15904                _next_ordinal_to_read += 1;
15905                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
15906                next_offset += envelope_size;
15907            }
15908
15909            Ok(())
15910        }
15911    }
15912
15913    impl GetNextFrameArgs {
15914        #[inline(always)]
15915        fn max_ordinal_present(&self) -> u64 {
15916            if let Some(_) = self.event {
15917                return 1;
15918            }
15919            0
15920        }
15921    }
15922
15923    impl fidl::encoding::ResourceTypeMarker for GetNextFrameArgs {
15924        type Borrowed<'a> = &'a mut Self;
15925        fn take_or_borrow<'a>(
15926            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
15927        ) -> Self::Borrowed<'a> {
15928            value
15929        }
15930    }
15931
15932    unsafe impl fidl::encoding::TypeMarker for GetNextFrameArgs {
15933        type Owned = Self;
15934
15935        #[inline(always)]
15936        fn inline_align(_context: fidl::encoding::Context) -> usize {
15937            8
15938        }
15939
15940        #[inline(always)]
15941        fn inline_size(_context: fidl::encoding::Context) -> usize {
15942            16
15943        }
15944    }
15945
15946    unsafe impl
15947        fidl::encoding::Encode<GetNextFrameArgs, fidl::encoding::DefaultFuchsiaResourceDialect>
15948        for &mut GetNextFrameArgs
15949    {
15950        unsafe fn encode(
15951            self,
15952            encoder: &mut fidl::encoding::Encoder<
15953                '_,
15954                fidl::encoding::DefaultFuchsiaResourceDialect,
15955            >,
15956            offset: usize,
15957            mut depth: fidl::encoding::Depth,
15958        ) -> fidl::Result<()> {
15959            encoder.debug_check_bounds::<GetNextFrameArgs>(offset);
15960            // Vector header
15961            let max_ordinal: u64 = self.max_ordinal_present();
15962            encoder.write_num(max_ordinal, offset);
15963            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
15964            // Calling encoder.out_of_line_offset(0) is not allowed.
15965            if max_ordinal == 0 {
15966                return Ok(());
15967            }
15968            depth.increment()?;
15969            let envelope_size = 8;
15970            let bytes_len = max_ordinal as usize * envelope_size;
15971            #[allow(unused_variables)]
15972            let offset = encoder.out_of_line_offset(bytes_len);
15973            let mut _prev_end_offset: usize = 0;
15974            if 1 > max_ordinal {
15975                return Ok(());
15976            }
15977
15978            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
15979            // are envelope_size bytes.
15980            let cur_offset: usize = (1 - 1) * envelope_size;
15981
15982            // Zero reserved fields.
15983            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
15984
15985            // Safety:
15986            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
15987            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
15988            //   envelope_size bytes, there is always sufficient room.
15989            fidl::encoding::encode_in_envelope_optional::<
15990                fidl::encoding::HandleType<
15991                    fidl::Event,
15992                    { fidl::ObjectType::EVENT.into_raw() },
15993                    2147483648,
15994                >,
15995                fidl::encoding::DefaultFuchsiaResourceDialect,
15996            >(
15997                self.event.as_mut().map(
15998                    <fidl::encoding::HandleType<
15999                        fidl::Event,
16000                        { fidl::ObjectType::EVENT.into_raw() },
16001                        2147483648,
16002                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
16003                ),
16004                encoder,
16005                offset + cur_offset,
16006                depth,
16007            )?;
16008
16009            _prev_end_offset = cur_offset + envelope_size;
16010
16011            Ok(())
16012        }
16013    }
16014
16015    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
16016        for GetNextFrameArgs
16017    {
16018        #[inline(always)]
16019        fn new_empty() -> Self {
16020            Self::default()
16021        }
16022
16023        unsafe fn decode(
16024            &mut self,
16025            decoder: &mut fidl::encoding::Decoder<
16026                '_,
16027                fidl::encoding::DefaultFuchsiaResourceDialect,
16028            >,
16029            offset: usize,
16030            mut depth: fidl::encoding::Depth,
16031        ) -> fidl::Result<()> {
16032            decoder.debug_check_bounds::<Self>(offset);
16033            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
16034                None => return Err(fidl::Error::NotNullable),
16035                Some(len) => len,
16036            };
16037            // Calling decoder.out_of_line_offset(0) is not allowed.
16038            if len == 0 {
16039                return Ok(());
16040            };
16041            depth.increment()?;
16042            let envelope_size = 8;
16043            let bytes_len = len * envelope_size;
16044            let offset = decoder.out_of_line_offset(bytes_len)?;
16045            // Decode the envelope for each type.
16046            let mut _next_ordinal_to_read = 0;
16047            let mut next_offset = offset;
16048            let end_offset = offset + bytes_len;
16049            _next_ordinal_to_read += 1;
16050            if next_offset >= end_offset {
16051                return Ok(());
16052            }
16053
16054            // Decode unknown envelopes for gaps in ordinals.
16055            while _next_ordinal_to_read < 1 {
16056                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
16057                _next_ordinal_to_read += 1;
16058                next_offset += envelope_size;
16059            }
16060
16061            let next_out_of_line = decoder.next_out_of_line();
16062            let handles_before = decoder.remaining_handles();
16063            if let Some((inlined, num_bytes, num_handles)) =
16064                fidl::encoding::decode_envelope_header(decoder, next_offset)?
16065            {
16066                let member_inline_size = <fidl::encoding::HandleType<
16067                    fidl::Event,
16068                    { fidl::ObjectType::EVENT.into_raw() },
16069                    2147483648,
16070                > as fidl::encoding::TypeMarker>::inline_size(
16071                    decoder.context
16072                );
16073                if inlined != (member_inline_size <= 4) {
16074                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
16075                }
16076                let inner_offset;
16077                let mut inner_depth = depth.clone();
16078                if inlined {
16079                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
16080                    inner_offset = next_offset;
16081                } else {
16082                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
16083                    inner_depth.increment()?;
16084                }
16085                let val_ref =
16086                self.event.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
16087                fidl::decode!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
16088                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
16089                {
16090                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
16091                }
16092                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
16093                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
16094                }
16095            }
16096
16097            next_offset += envelope_size;
16098
16099            // Decode the remaining unknown envelopes.
16100            while next_offset < end_offset {
16101                _next_ordinal_to_read += 1;
16102                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
16103                next_offset += envelope_size;
16104            }
16105
16106            Ok(())
16107        }
16108    }
16109
16110    impl PresentArgs {
16111        #[inline(always)]
16112        fn max_ordinal_present(&self) -> u64 {
16113            if let Some(_) = self.release_counters {
16114                return 8;
16115            }
16116            if let Some(_) = self.present_fences {
16117                return 7;
16118            }
16119            if let Some(_) = self.unsquashable {
16120                return 4;
16121            }
16122            if let Some(_) = self.release_fences {
16123                return 3;
16124            }
16125            if let Some(_) = self.acquire_fences {
16126                return 2;
16127            }
16128            if let Some(_) = self.requested_presentation_time {
16129                return 1;
16130            }
16131            0
16132        }
16133    }
16134
16135    impl fidl::encoding::ResourceTypeMarker for PresentArgs {
16136        type Borrowed<'a> = &'a mut Self;
16137        fn take_or_borrow<'a>(
16138            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
16139        ) -> Self::Borrowed<'a> {
16140            value
16141        }
16142    }
16143
16144    unsafe impl fidl::encoding::TypeMarker for PresentArgs {
16145        type Owned = Self;
16146
16147        #[inline(always)]
16148        fn inline_align(_context: fidl::encoding::Context) -> usize {
16149            8
16150        }
16151
16152        #[inline(always)]
16153        fn inline_size(_context: fidl::encoding::Context) -> usize {
16154            16
16155        }
16156    }
16157
16158    unsafe impl fidl::encoding::Encode<PresentArgs, fidl::encoding::DefaultFuchsiaResourceDialect>
16159        for &mut PresentArgs
16160    {
16161        unsafe fn encode(
16162            self,
16163            encoder: &mut fidl::encoding::Encoder<
16164                '_,
16165                fidl::encoding::DefaultFuchsiaResourceDialect,
16166            >,
16167            offset: usize,
16168            mut depth: fidl::encoding::Depth,
16169        ) -> fidl::Result<()> {
16170            encoder.debug_check_bounds::<PresentArgs>(offset);
16171            // Vector header
16172            let max_ordinal: u64 = self.max_ordinal_present();
16173            encoder.write_num(max_ordinal, offset);
16174            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
16175            // Calling encoder.out_of_line_offset(0) is not allowed.
16176            if max_ordinal == 0 {
16177                return Ok(());
16178            }
16179            depth.increment()?;
16180            let envelope_size = 8;
16181            let bytes_len = max_ordinal as usize * envelope_size;
16182            #[allow(unused_variables)]
16183            let offset = encoder.out_of_line_offset(bytes_len);
16184            let mut _prev_end_offset: usize = 0;
16185            if 1 > max_ordinal {
16186                return Ok(());
16187            }
16188
16189            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
16190            // are envelope_size bytes.
16191            let cur_offset: usize = (1 - 1) * envelope_size;
16192
16193            // Zero reserved fields.
16194            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
16195
16196            // Safety:
16197            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
16198            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
16199            //   envelope_size bytes, there is always sufficient room.
16200            fidl::encoding::encode_in_envelope_optional::<
16201                i64,
16202                fidl::encoding::DefaultFuchsiaResourceDialect,
16203            >(
16204                self.requested_presentation_time
16205                    .as_ref()
16206                    .map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
16207                encoder,
16208                offset + cur_offset,
16209                depth,
16210            )?;
16211
16212            _prev_end_offset = cur_offset + envelope_size;
16213            if 2 > max_ordinal {
16214                return Ok(());
16215            }
16216
16217            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
16218            // are envelope_size bytes.
16219            let cur_offset: usize = (2 - 1) * envelope_size;
16220
16221            // Zero reserved fields.
16222            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
16223
16224            // Safety:
16225            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
16226            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
16227            //   envelope_size bytes, there is always sufficient room.
16228            fidl::encoding::encode_in_envelope_optional::<
16229                fidl::encoding::Vector<
16230                    fidl::encoding::HandleType<
16231                        fidl::Event,
16232                        { fidl::ObjectType::EVENT.into_raw() },
16233                        2147483648,
16234                    >,
16235                    16,
16236                >,
16237                fidl::encoding::DefaultFuchsiaResourceDialect,
16238            >(
16239                self.acquire_fences.as_mut().map(
16240                    <fidl::encoding::Vector<
16241                        fidl::encoding::HandleType<
16242                            fidl::Event,
16243                            { fidl::ObjectType::EVENT.into_raw() },
16244                            2147483648,
16245                        >,
16246                        16,
16247                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
16248                ),
16249                encoder,
16250                offset + cur_offset,
16251                depth,
16252            )?;
16253
16254            _prev_end_offset = cur_offset + envelope_size;
16255            if 3 > max_ordinal {
16256                return Ok(());
16257            }
16258
16259            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
16260            // are envelope_size bytes.
16261            let cur_offset: usize = (3 - 1) * envelope_size;
16262
16263            // Zero reserved fields.
16264            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
16265
16266            // Safety:
16267            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
16268            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
16269            //   envelope_size bytes, there is always sufficient room.
16270            fidl::encoding::encode_in_envelope_optional::<
16271                fidl::encoding::Vector<
16272                    fidl::encoding::HandleType<
16273                        fidl::Event,
16274                        { fidl::ObjectType::EVENT.into_raw() },
16275                        2147483648,
16276                    >,
16277                    16,
16278                >,
16279                fidl::encoding::DefaultFuchsiaResourceDialect,
16280            >(
16281                self.release_fences.as_mut().map(
16282                    <fidl::encoding::Vector<
16283                        fidl::encoding::HandleType<
16284                            fidl::Event,
16285                            { fidl::ObjectType::EVENT.into_raw() },
16286                            2147483648,
16287                        >,
16288                        16,
16289                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
16290                ),
16291                encoder,
16292                offset + cur_offset,
16293                depth,
16294            )?;
16295
16296            _prev_end_offset = cur_offset + envelope_size;
16297            if 4 > max_ordinal {
16298                return Ok(());
16299            }
16300
16301            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
16302            // are envelope_size bytes.
16303            let cur_offset: usize = (4 - 1) * envelope_size;
16304
16305            // Zero reserved fields.
16306            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
16307
16308            // Safety:
16309            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
16310            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
16311            //   envelope_size bytes, there is always sufficient room.
16312            fidl::encoding::encode_in_envelope_optional::<
16313                bool,
16314                fidl::encoding::DefaultFuchsiaResourceDialect,
16315            >(
16316                self.unsquashable.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
16317                encoder,
16318                offset + cur_offset,
16319                depth,
16320            )?;
16321
16322            _prev_end_offset = cur_offset + envelope_size;
16323            if 7 > max_ordinal {
16324                return Ok(());
16325            }
16326
16327            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
16328            // are envelope_size bytes.
16329            let cur_offset: usize = (7 - 1) * envelope_size;
16330
16331            // Zero reserved fields.
16332            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
16333
16334            // Safety:
16335            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
16336            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
16337            //   envelope_size bytes, there is always sufficient room.
16338            fidl::encoding::encode_in_envelope_optional::<
16339                fidl::encoding::Vector<
16340                    fidl::encoding::HandleType<
16341                        fidl::Counter,
16342                        { fidl::ObjectType::COUNTER.into_raw() },
16343                        2147483648,
16344                    >,
16345                    16,
16346                >,
16347                fidl::encoding::DefaultFuchsiaResourceDialect,
16348            >(
16349                self.present_fences.as_mut().map(
16350                    <fidl::encoding::Vector<
16351                        fidl::encoding::HandleType<
16352                            fidl::Counter,
16353                            { fidl::ObjectType::COUNTER.into_raw() },
16354                            2147483648,
16355                        >,
16356                        16,
16357                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
16358                ),
16359                encoder,
16360                offset + cur_offset,
16361                depth,
16362            )?;
16363
16364            _prev_end_offset = cur_offset + envelope_size;
16365            if 8 > max_ordinal {
16366                return Ok(());
16367            }
16368
16369            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
16370            // are envelope_size bytes.
16371            let cur_offset: usize = (8 - 1) * envelope_size;
16372
16373            // Zero reserved fields.
16374            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
16375
16376            // Safety:
16377            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
16378            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
16379            //   envelope_size bytes, there is always sufficient room.
16380            fidl::encoding::encode_in_envelope_optional::<
16381                fidl::encoding::Vector<
16382                    fidl::encoding::HandleType<
16383                        fidl::Counter,
16384                        { fidl::ObjectType::COUNTER.into_raw() },
16385                        2147483648,
16386                    >,
16387                    16,
16388                >,
16389                fidl::encoding::DefaultFuchsiaResourceDialect,
16390            >(
16391                self.release_counters.as_mut().map(
16392                    <fidl::encoding::Vector<
16393                        fidl::encoding::HandleType<
16394                            fidl::Counter,
16395                            { fidl::ObjectType::COUNTER.into_raw() },
16396                            2147483648,
16397                        >,
16398                        16,
16399                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
16400                ),
16401                encoder,
16402                offset + cur_offset,
16403                depth,
16404            )?;
16405
16406            _prev_end_offset = cur_offset + envelope_size;
16407
16408            Ok(())
16409        }
16410    }
16411
16412    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for PresentArgs {
16413        #[inline(always)]
16414        fn new_empty() -> Self {
16415            Self::default()
16416        }
16417
16418        unsafe fn decode(
16419            &mut self,
16420            decoder: &mut fidl::encoding::Decoder<
16421                '_,
16422                fidl::encoding::DefaultFuchsiaResourceDialect,
16423            >,
16424            offset: usize,
16425            mut depth: fidl::encoding::Depth,
16426        ) -> fidl::Result<()> {
16427            decoder.debug_check_bounds::<Self>(offset);
16428            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
16429                None => return Err(fidl::Error::NotNullable),
16430                Some(len) => len,
16431            };
16432            // Calling decoder.out_of_line_offset(0) is not allowed.
16433            if len == 0 {
16434                return Ok(());
16435            };
16436            depth.increment()?;
16437            let envelope_size = 8;
16438            let bytes_len = len * envelope_size;
16439            let offset = decoder.out_of_line_offset(bytes_len)?;
16440            // Decode the envelope for each type.
16441            let mut _next_ordinal_to_read = 0;
16442            let mut next_offset = offset;
16443            let end_offset = offset + bytes_len;
16444            _next_ordinal_to_read += 1;
16445            if next_offset >= end_offset {
16446                return Ok(());
16447            }
16448
16449            // Decode unknown envelopes for gaps in ordinals.
16450            while _next_ordinal_to_read < 1 {
16451                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
16452                _next_ordinal_to_read += 1;
16453                next_offset += envelope_size;
16454            }
16455
16456            let next_out_of_line = decoder.next_out_of_line();
16457            let handles_before = decoder.remaining_handles();
16458            if let Some((inlined, num_bytes, num_handles)) =
16459                fidl::encoding::decode_envelope_header(decoder, next_offset)?
16460            {
16461                let member_inline_size =
16462                    <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
16463                if inlined != (member_inline_size <= 4) {
16464                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
16465                }
16466                let inner_offset;
16467                let mut inner_depth = depth.clone();
16468                if inlined {
16469                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
16470                    inner_offset = next_offset;
16471                } else {
16472                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
16473                    inner_depth.increment()?;
16474                }
16475                let val_ref = self.requested_presentation_time.get_or_insert_with(|| {
16476                    fidl::new_empty!(i64, fidl::encoding::DefaultFuchsiaResourceDialect)
16477                });
16478                fidl::decode!(
16479                    i64,
16480                    fidl::encoding::DefaultFuchsiaResourceDialect,
16481                    val_ref,
16482                    decoder,
16483                    inner_offset,
16484                    inner_depth
16485                )?;
16486                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
16487                {
16488                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
16489                }
16490                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
16491                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
16492                }
16493            }
16494
16495            next_offset += envelope_size;
16496            _next_ordinal_to_read += 1;
16497            if next_offset >= end_offset {
16498                return Ok(());
16499            }
16500
16501            // Decode unknown envelopes for gaps in ordinals.
16502            while _next_ordinal_to_read < 2 {
16503                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
16504                _next_ordinal_to_read += 1;
16505                next_offset += envelope_size;
16506            }
16507
16508            let next_out_of_line = decoder.next_out_of_line();
16509            let handles_before = decoder.remaining_handles();
16510            if let Some((inlined, num_bytes, num_handles)) =
16511                fidl::encoding::decode_envelope_header(decoder, next_offset)?
16512            {
16513                let member_inline_size = <fidl::encoding::Vector<
16514                    fidl::encoding::HandleType<
16515                        fidl::Event,
16516                        { fidl::ObjectType::EVENT.into_raw() },
16517                        2147483648,
16518                    >,
16519                    16,
16520                > as fidl::encoding::TypeMarker>::inline_size(
16521                    decoder.context
16522                );
16523                if inlined != (member_inline_size <= 4) {
16524                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
16525                }
16526                let inner_offset;
16527                let mut inner_depth = depth.clone();
16528                if inlined {
16529                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
16530                    inner_offset = next_offset;
16531                } else {
16532                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
16533                    inner_depth.increment()?;
16534                }
16535                let val_ref = self.acquire_fences.get_or_insert_with(|| {
16536                    fidl::new_empty!(
16537                        fidl::encoding::Vector<
16538                            fidl::encoding::HandleType<
16539                                fidl::Event,
16540                                { fidl::ObjectType::EVENT.into_raw() },
16541                                2147483648,
16542                            >,
16543                            16,
16544                        >,
16545                        fidl::encoding::DefaultFuchsiaResourceDialect
16546                    )
16547                });
16548                fidl::decode!(
16549                    fidl::encoding::Vector<
16550                        fidl::encoding::HandleType<
16551                            fidl::Event,
16552                            { fidl::ObjectType::EVENT.into_raw() },
16553                            2147483648,
16554                        >,
16555                        16,
16556                    >,
16557                    fidl::encoding::DefaultFuchsiaResourceDialect,
16558                    val_ref,
16559                    decoder,
16560                    inner_offset,
16561                    inner_depth
16562                )?;
16563                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
16564                {
16565                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
16566                }
16567                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
16568                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
16569                }
16570            }
16571
16572            next_offset += envelope_size;
16573            _next_ordinal_to_read += 1;
16574            if next_offset >= end_offset {
16575                return Ok(());
16576            }
16577
16578            // Decode unknown envelopes for gaps in ordinals.
16579            while _next_ordinal_to_read < 3 {
16580                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
16581                _next_ordinal_to_read += 1;
16582                next_offset += envelope_size;
16583            }
16584
16585            let next_out_of_line = decoder.next_out_of_line();
16586            let handles_before = decoder.remaining_handles();
16587            if let Some((inlined, num_bytes, num_handles)) =
16588                fidl::encoding::decode_envelope_header(decoder, next_offset)?
16589            {
16590                let member_inline_size = <fidl::encoding::Vector<
16591                    fidl::encoding::HandleType<
16592                        fidl::Event,
16593                        { fidl::ObjectType::EVENT.into_raw() },
16594                        2147483648,
16595                    >,
16596                    16,
16597                > as fidl::encoding::TypeMarker>::inline_size(
16598                    decoder.context
16599                );
16600                if inlined != (member_inline_size <= 4) {
16601                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
16602                }
16603                let inner_offset;
16604                let mut inner_depth = depth.clone();
16605                if inlined {
16606                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
16607                    inner_offset = next_offset;
16608                } else {
16609                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
16610                    inner_depth.increment()?;
16611                }
16612                let val_ref = self.release_fences.get_or_insert_with(|| {
16613                    fidl::new_empty!(
16614                        fidl::encoding::Vector<
16615                            fidl::encoding::HandleType<
16616                                fidl::Event,
16617                                { fidl::ObjectType::EVENT.into_raw() },
16618                                2147483648,
16619                            >,
16620                            16,
16621                        >,
16622                        fidl::encoding::DefaultFuchsiaResourceDialect
16623                    )
16624                });
16625                fidl::decode!(
16626                    fidl::encoding::Vector<
16627                        fidl::encoding::HandleType<
16628                            fidl::Event,
16629                            { fidl::ObjectType::EVENT.into_raw() },
16630                            2147483648,
16631                        >,
16632                        16,
16633                    >,
16634                    fidl::encoding::DefaultFuchsiaResourceDialect,
16635                    val_ref,
16636                    decoder,
16637                    inner_offset,
16638                    inner_depth
16639                )?;
16640                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
16641                {
16642                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
16643                }
16644                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
16645                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
16646                }
16647            }
16648
16649            next_offset += envelope_size;
16650            _next_ordinal_to_read += 1;
16651            if next_offset >= end_offset {
16652                return Ok(());
16653            }
16654
16655            // Decode unknown envelopes for gaps in ordinals.
16656            while _next_ordinal_to_read < 4 {
16657                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
16658                _next_ordinal_to_read += 1;
16659                next_offset += envelope_size;
16660            }
16661
16662            let next_out_of_line = decoder.next_out_of_line();
16663            let handles_before = decoder.remaining_handles();
16664            if let Some((inlined, num_bytes, num_handles)) =
16665                fidl::encoding::decode_envelope_header(decoder, next_offset)?
16666            {
16667                let member_inline_size =
16668                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
16669                if inlined != (member_inline_size <= 4) {
16670                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
16671                }
16672                let inner_offset;
16673                let mut inner_depth = depth.clone();
16674                if inlined {
16675                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
16676                    inner_offset = next_offset;
16677                } else {
16678                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
16679                    inner_depth.increment()?;
16680                }
16681                let val_ref = self.unsquashable.get_or_insert_with(|| {
16682                    fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
16683                });
16684                fidl::decode!(
16685                    bool,
16686                    fidl::encoding::DefaultFuchsiaResourceDialect,
16687                    val_ref,
16688                    decoder,
16689                    inner_offset,
16690                    inner_depth
16691                )?;
16692                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
16693                {
16694                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
16695                }
16696                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
16697                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
16698                }
16699            }
16700
16701            next_offset += envelope_size;
16702            _next_ordinal_to_read += 1;
16703            if next_offset >= end_offset {
16704                return Ok(());
16705            }
16706
16707            // Decode unknown envelopes for gaps in ordinals.
16708            while _next_ordinal_to_read < 7 {
16709                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
16710                _next_ordinal_to_read += 1;
16711                next_offset += envelope_size;
16712            }
16713
16714            let next_out_of_line = decoder.next_out_of_line();
16715            let handles_before = decoder.remaining_handles();
16716            if let Some((inlined, num_bytes, num_handles)) =
16717                fidl::encoding::decode_envelope_header(decoder, next_offset)?
16718            {
16719                let member_inline_size = <fidl::encoding::Vector<
16720                    fidl::encoding::HandleType<
16721                        fidl::Counter,
16722                        { fidl::ObjectType::COUNTER.into_raw() },
16723                        2147483648,
16724                    >,
16725                    16,
16726                > as fidl::encoding::TypeMarker>::inline_size(
16727                    decoder.context
16728                );
16729                if inlined != (member_inline_size <= 4) {
16730                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
16731                }
16732                let inner_offset;
16733                let mut inner_depth = depth.clone();
16734                if inlined {
16735                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
16736                    inner_offset = next_offset;
16737                } else {
16738                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
16739                    inner_depth.increment()?;
16740                }
16741                let val_ref = self.present_fences.get_or_insert_with(|| {
16742                    fidl::new_empty!(
16743                        fidl::encoding::Vector<
16744                            fidl::encoding::HandleType<
16745                                fidl::Counter,
16746                                { fidl::ObjectType::COUNTER.into_raw() },
16747                                2147483648,
16748                            >,
16749                            16,
16750                        >,
16751                        fidl::encoding::DefaultFuchsiaResourceDialect
16752                    )
16753                });
16754                fidl::decode!(
16755                    fidl::encoding::Vector<
16756                        fidl::encoding::HandleType<
16757                            fidl::Counter,
16758                            { fidl::ObjectType::COUNTER.into_raw() },
16759                            2147483648,
16760                        >,
16761                        16,
16762                    >,
16763                    fidl::encoding::DefaultFuchsiaResourceDialect,
16764                    val_ref,
16765                    decoder,
16766                    inner_offset,
16767                    inner_depth
16768                )?;
16769                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
16770                {
16771                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
16772                }
16773                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
16774                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
16775                }
16776            }
16777
16778            next_offset += envelope_size;
16779            _next_ordinal_to_read += 1;
16780            if next_offset >= end_offset {
16781                return Ok(());
16782            }
16783
16784            // Decode unknown envelopes for gaps in ordinals.
16785            while _next_ordinal_to_read < 8 {
16786                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
16787                _next_ordinal_to_read += 1;
16788                next_offset += envelope_size;
16789            }
16790
16791            let next_out_of_line = decoder.next_out_of_line();
16792            let handles_before = decoder.remaining_handles();
16793            if let Some((inlined, num_bytes, num_handles)) =
16794                fidl::encoding::decode_envelope_header(decoder, next_offset)?
16795            {
16796                let member_inline_size = <fidl::encoding::Vector<
16797                    fidl::encoding::HandleType<
16798                        fidl::Counter,
16799                        { fidl::ObjectType::COUNTER.into_raw() },
16800                        2147483648,
16801                    >,
16802                    16,
16803                > as fidl::encoding::TypeMarker>::inline_size(
16804                    decoder.context
16805                );
16806                if inlined != (member_inline_size <= 4) {
16807                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
16808                }
16809                let inner_offset;
16810                let mut inner_depth = depth.clone();
16811                if inlined {
16812                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
16813                    inner_offset = next_offset;
16814                } else {
16815                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
16816                    inner_depth.increment()?;
16817                }
16818                let val_ref = self.release_counters.get_or_insert_with(|| {
16819                    fidl::new_empty!(
16820                        fidl::encoding::Vector<
16821                            fidl::encoding::HandleType<
16822                                fidl::Counter,
16823                                { fidl::ObjectType::COUNTER.into_raw() },
16824                                2147483648,
16825                            >,
16826                            16,
16827                        >,
16828                        fidl::encoding::DefaultFuchsiaResourceDialect
16829                    )
16830                });
16831                fidl::decode!(
16832                    fidl::encoding::Vector<
16833                        fidl::encoding::HandleType<
16834                            fidl::Counter,
16835                            { fidl::ObjectType::COUNTER.into_raw() },
16836                            2147483648,
16837                        >,
16838                        16,
16839                    >,
16840                    fidl::encoding::DefaultFuchsiaResourceDialect,
16841                    val_ref,
16842                    decoder,
16843                    inner_offset,
16844                    inner_depth
16845                )?;
16846                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
16847                {
16848                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
16849                }
16850                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
16851                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
16852                }
16853            }
16854
16855            next_offset += envelope_size;
16856
16857            // Decode the remaining unknown envelopes.
16858            while next_offset < end_offset {
16859                _next_ordinal_to_read += 1;
16860                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
16861                next_offset += envelope_size;
16862            }
16863
16864            Ok(())
16865        }
16866    }
16867
16868    impl RegisterBufferCollectionArgs {
16869        #[inline(always)]
16870        fn max_ordinal_present(&self) -> u64 {
16871            if let Some(_) = self.buffer_collection_token2 {
16872                return 5;
16873            }
16874            if let Some(_) = self.usages {
16875                return 4;
16876            }
16877            if let Some(_) = self.usage {
16878                return 3;
16879            }
16880            if let Some(_) = self.buffer_collection_token {
16881                return 2;
16882            }
16883            if let Some(_) = self.export_token {
16884                return 1;
16885            }
16886            0
16887        }
16888    }
16889
16890    impl fidl::encoding::ResourceTypeMarker for RegisterBufferCollectionArgs {
16891        type Borrowed<'a> = &'a mut Self;
16892        fn take_or_borrow<'a>(
16893            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
16894        ) -> Self::Borrowed<'a> {
16895            value
16896        }
16897    }
16898
16899    unsafe impl fidl::encoding::TypeMarker for RegisterBufferCollectionArgs {
16900        type Owned = Self;
16901
16902        #[inline(always)]
16903        fn inline_align(_context: fidl::encoding::Context) -> usize {
16904            8
16905        }
16906
16907        #[inline(always)]
16908        fn inline_size(_context: fidl::encoding::Context) -> usize {
16909            16
16910        }
16911    }
16912
16913    unsafe impl
16914        fidl::encoding::Encode<
16915            RegisterBufferCollectionArgs,
16916            fidl::encoding::DefaultFuchsiaResourceDialect,
16917        > for &mut RegisterBufferCollectionArgs
16918    {
16919        unsafe fn encode(
16920            self,
16921            encoder: &mut fidl::encoding::Encoder<
16922                '_,
16923                fidl::encoding::DefaultFuchsiaResourceDialect,
16924            >,
16925            offset: usize,
16926            mut depth: fidl::encoding::Depth,
16927        ) -> fidl::Result<()> {
16928            encoder.debug_check_bounds::<RegisterBufferCollectionArgs>(offset);
16929            // Vector header
16930            let max_ordinal: u64 = self.max_ordinal_present();
16931            encoder.write_num(max_ordinal, offset);
16932            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
16933            // Calling encoder.out_of_line_offset(0) is not allowed.
16934            if max_ordinal == 0 {
16935                return Ok(());
16936            }
16937            depth.increment()?;
16938            let envelope_size = 8;
16939            let bytes_len = max_ordinal as usize * envelope_size;
16940            #[allow(unused_variables)]
16941            let offset = encoder.out_of_line_offset(bytes_len);
16942            let mut _prev_end_offset: usize = 0;
16943            if 1 > max_ordinal {
16944                return Ok(());
16945            }
16946
16947            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
16948            // are envelope_size bytes.
16949            let cur_offset: usize = (1 - 1) * envelope_size;
16950
16951            // Zero reserved fields.
16952            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
16953
16954            // Safety:
16955            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
16956            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
16957            //   envelope_size bytes, there is always sufficient room.
16958            fidl::encoding::encode_in_envelope_optional::<BufferCollectionExportToken, fidl::encoding::DefaultFuchsiaResourceDialect>(
16959            self.export_token.as_mut().map(<BufferCollectionExportToken as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
16960            encoder, offset + cur_offset, depth
16961        )?;
16962
16963            _prev_end_offset = cur_offset + envelope_size;
16964            if 2 > max_ordinal {
16965                return Ok(());
16966            }
16967
16968            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
16969            // are envelope_size bytes.
16970            let cur_offset: usize = (2 - 1) * envelope_size;
16971
16972            // Zero reserved fields.
16973            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
16974
16975            // Safety:
16976            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
16977            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
16978            //   envelope_size bytes, there is always sufficient room.
16979            fidl::encoding::encode_in_envelope_optional::<
16980                fidl::encoding::Endpoint<
16981                    fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem::BufferCollectionTokenMarker>,
16982                >,
16983                fidl::encoding::DefaultFuchsiaResourceDialect,
16984            >(
16985                self.buffer_collection_token.as_mut().map(
16986                    <fidl::encoding::Endpoint<
16987                        fidl::endpoints::ClientEnd<
16988                            fidl_fuchsia_sysmem::BufferCollectionTokenMarker,
16989                        >,
16990                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
16991                ),
16992                encoder,
16993                offset + cur_offset,
16994                depth,
16995            )?;
16996
16997            _prev_end_offset = cur_offset + envelope_size;
16998            if 3 > max_ordinal {
16999                return Ok(());
17000            }
17001
17002            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
17003            // are envelope_size bytes.
17004            let cur_offset: usize = (3 - 1) * envelope_size;
17005
17006            // Zero reserved fields.
17007            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
17008
17009            // Safety:
17010            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
17011            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
17012            //   envelope_size bytes, there is always sufficient room.
17013            fidl::encoding::encode_in_envelope_optional::<
17014                RegisterBufferCollectionUsage,
17015                fidl::encoding::DefaultFuchsiaResourceDialect,
17016            >(
17017                self.usage.as_ref().map(
17018                    <RegisterBufferCollectionUsage as fidl::encoding::ValueTypeMarker>::borrow,
17019                ),
17020                encoder,
17021                offset + cur_offset,
17022                depth,
17023            )?;
17024
17025            _prev_end_offset = cur_offset + envelope_size;
17026            if 4 > max_ordinal {
17027                return Ok(());
17028            }
17029
17030            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
17031            // are envelope_size bytes.
17032            let cur_offset: usize = (4 - 1) * envelope_size;
17033
17034            // Zero reserved fields.
17035            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
17036
17037            // Safety:
17038            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
17039            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
17040            //   envelope_size bytes, there is always sufficient room.
17041            fidl::encoding::encode_in_envelope_optional::<
17042                RegisterBufferCollectionUsages,
17043                fidl::encoding::DefaultFuchsiaResourceDialect,
17044            >(
17045                self.usages.as_ref().map(
17046                    <RegisterBufferCollectionUsages as fidl::encoding::ValueTypeMarker>::borrow,
17047                ),
17048                encoder,
17049                offset + cur_offset,
17050                depth,
17051            )?;
17052
17053            _prev_end_offset = cur_offset + envelope_size;
17054            if 5 > max_ordinal {
17055                return Ok(());
17056            }
17057
17058            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
17059            // are envelope_size bytes.
17060            let cur_offset: usize = (5 - 1) * envelope_size;
17061
17062            // Zero reserved fields.
17063            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
17064
17065            // Safety:
17066            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
17067            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
17068            //   envelope_size bytes, there is always sufficient room.
17069            fidl::encoding::encode_in_envelope_optional::<
17070                fidl::encoding::Endpoint<
17071                    fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem2::BufferCollectionTokenMarker>,
17072                >,
17073                fidl::encoding::DefaultFuchsiaResourceDialect,
17074            >(
17075                self.buffer_collection_token2.as_mut().map(
17076                    <fidl::encoding::Endpoint<
17077                        fidl::endpoints::ClientEnd<
17078                            fidl_fuchsia_sysmem2::BufferCollectionTokenMarker,
17079                        >,
17080                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
17081                ),
17082                encoder,
17083                offset + cur_offset,
17084                depth,
17085            )?;
17086
17087            _prev_end_offset = cur_offset + envelope_size;
17088
17089            Ok(())
17090        }
17091    }
17092
17093    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
17094        for RegisterBufferCollectionArgs
17095    {
17096        #[inline(always)]
17097        fn new_empty() -> Self {
17098            Self::default()
17099        }
17100
17101        unsafe fn decode(
17102            &mut self,
17103            decoder: &mut fidl::encoding::Decoder<
17104                '_,
17105                fidl::encoding::DefaultFuchsiaResourceDialect,
17106            >,
17107            offset: usize,
17108            mut depth: fidl::encoding::Depth,
17109        ) -> fidl::Result<()> {
17110            decoder.debug_check_bounds::<Self>(offset);
17111            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
17112                None => return Err(fidl::Error::NotNullable),
17113                Some(len) => len,
17114            };
17115            // Calling decoder.out_of_line_offset(0) is not allowed.
17116            if len == 0 {
17117                return Ok(());
17118            };
17119            depth.increment()?;
17120            let envelope_size = 8;
17121            let bytes_len = len * envelope_size;
17122            let offset = decoder.out_of_line_offset(bytes_len)?;
17123            // Decode the envelope for each type.
17124            let mut _next_ordinal_to_read = 0;
17125            let mut next_offset = offset;
17126            let end_offset = offset + bytes_len;
17127            _next_ordinal_to_read += 1;
17128            if next_offset >= end_offset {
17129                return Ok(());
17130            }
17131
17132            // Decode unknown envelopes for gaps in ordinals.
17133            while _next_ordinal_to_read < 1 {
17134                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
17135                _next_ordinal_to_read += 1;
17136                next_offset += envelope_size;
17137            }
17138
17139            let next_out_of_line = decoder.next_out_of_line();
17140            let handles_before = decoder.remaining_handles();
17141            if let Some((inlined, num_bytes, num_handles)) =
17142                fidl::encoding::decode_envelope_header(decoder, next_offset)?
17143            {
17144                let member_inline_size =
17145                    <BufferCollectionExportToken as fidl::encoding::TypeMarker>::inline_size(
17146                        decoder.context,
17147                    );
17148                if inlined != (member_inline_size <= 4) {
17149                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
17150                }
17151                let inner_offset;
17152                let mut inner_depth = depth.clone();
17153                if inlined {
17154                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
17155                    inner_offset = next_offset;
17156                } else {
17157                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
17158                    inner_depth.increment()?;
17159                }
17160                let val_ref = self.export_token.get_or_insert_with(|| {
17161                    fidl::new_empty!(
17162                        BufferCollectionExportToken,
17163                        fidl::encoding::DefaultFuchsiaResourceDialect
17164                    )
17165                });
17166                fidl::decode!(
17167                    BufferCollectionExportToken,
17168                    fidl::encoding::DefaultFuchsiaResourceDialect,
17169                    val_ref,
17170                    decoder,
17171                    inner_offset,
17172                    inner_depth
17173                )?;
17174                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
17175                {
17176                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
17177                }
17178                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
17179                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
17180                }
17181            }
17182
17183            next_offset += envelope_size;
17184            _next_ordinal_to_read += 1;
17185            if next_offset >= end_offset {
17186                return Ok(());
17187            }
17188
17189            // Decode unknown envelopes for gaps in ordinals.
17190            while _next_ordinal_to_read < 2 {
17191                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
17192                _next_ordinal_to_read += 1;
17193                next_offset += envelope_size;
17194            }
17195
17196            let next_out_of_line = decoder.next_out_of_line();
17197            let handles_before = decoder.remaining_handles();
17198            if let Some((inlined, num_bytes, num_handles)) =
17199                fidl::encoding::decode_envelope_header(decoder, next_offset)?
17200            {
17201                let member_inline_size = <fidl::encoding::Endpoint<
17202                    fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem::BufferCollectionTokenMarker>,
17203                > as fidl::encoding::TypeMarker>::inline_size(
17204                    decoder.context
17205                );
17206                if inlined != (member_inline_size <= 4) {
17207                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
17208                }
17209                let inner_offset;
17210                let mut inner_depth = depth.clone();
17211                if inlined {
17212                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
17213                    inner_offset = next_offset;
17214                } else {
17215                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
17216                    inner_depth.increment()?;
17217                }
17218                let val_ref = self.buffer_collection_token.get_or_insert_with(|| {
17219                    fidl::new_empty!(
17220                        fidl::encoding::Endpoint<
17221                            fidl::endpoints::ClientEnd<
17222                                fidl_fuchsia_sysmem::BufferCollectionTokenMarker,
17223                            >,
17224                        >,
17225                        fidl::encoding::DefaultFuchsiaResourceDialect
17226                    )
17227                });
17228                fidl::decode!(
17229                    fidl::encoding::Endpoint<
17230                        fidl::endpoints::ClientEnd<
17231                            fidl_fuchsia_sysmem::BufferCollectionTokenMarker,
17232                        >,
17233                    >,
17234                    fidl::encoding::DefaultFuchsiaResourceDialect,
17235                    val_ref,
17236                    decoder,
17237                    inner_offset,
17238                    inner_depth
17239                )?;
17240                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
17241                {
17242                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
17243                }
17244                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
17245                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
17246                }
17247            }
17248
17249            next_offset += envelope_size;
17250            _next_ordinal_to_read += 1;
17251            if next_offset >= end_offset {
17252                return Ok(());
17253            }
17254
17255            // Decode unknown envelopes for gaps in ordinals.
17256            while _next_ordinal_to_read < 3 {
17257                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
17258                _next_ordinal_to_read += 1;
17259                next_offset += envelope_size;
17260            }
17261
17262            let next_out_of_line = decoder.next_out_of_line();
17263            let handles_before = decoder.remaining_handles();
17264            if let Some((inlined, num_bytes, num_handles)) =
17265                fidl::encoding::decode_envelope_header(decoder, next_offset)?
17266            {
17267                let member_inline_size =
17268                    <RegisterBufferCollectionUsage as fidl::encoding::TypeMarker>::inline_size(
17269                        decoder.context,
17270                    );
17271                if inlined != (member_inline_size <= 4) {
17272                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
17273                }
17274                let inner_offset;
17275                let mut inner_depth = depth.clone();
17276                if inlined {
17277                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
17278                    inner_offset = next_offset;
17279                } else {
17280                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
17281                    inner_depth.increment()?;
17282                }
17283                let val_ref = self.usage.get_or_insert_with(|| {
17284                    fidl::new_empty!(
17285                        RegisterBufferCollectionUsage,
17286                        fidl::encoding::DefaultFuchsiaResourceDialect
17287                    )
17288                });
17289                fidl::decode!(
17290                    RegisterBufferCollectionUsage,
17291                    fidl::encoding::DefaultFuchsiaResourceDialect,
17292                    val_ref,
17293                    decoder,
17294                    inner_offset,
17295                    inner_depth
17296                )?;
17297                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
17298                {
17299                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
17300                }
17301                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
17302                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
17303                }
17304            }
17305
17306            next_offset += envelope_size;
17307            _next_ordinal_to_read += 1;
17308            if next_offset >= end_offset {
17309                return Ok(());
17310            }
17311
17312            // Decode unknown envelopes for gaps in ordinals.
17313            while _next_ordinal_to_read < 4 {
17314                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
17315                _next_ordinal_to_read += 1;
17316                next_offset += envelope_size;
17317            }
17318
17319            let next_out_of_line = decoder.next_out_of_line();
17320            let handles_before = decoder.remaining_handles();
17321            if let Some((inlined, num_bytes, num_handles)) =
17322                fidl::encoding::decode_envelope_header(decoder, next_offset)?
17323            {
17324                let member_inline_size =
17325                    <RegisterBufferCollectionUsages as fidl::encoding::TypeMarker>::inline_size(
17326                        decoder.context,
17327                    );
17328                if inlined != (member_inline_size <= 4) {
17329                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
17330                }
17331                let inner_offset;
17332                let mut inner_depth = depth.clone();
17333                if inlined {
17334                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
17335                    inner_offset = next_offset;
17336                } else {
17337                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
17338                    inner_depth.increment()?;
17339                }
17340                let val_ref = self.usages.get_or_insert_with(|| {
17341                    fidl::new_empty!(
17342                        RegisterBufferCollectionUsages,
17343                        fidl::encoding::DefaultFuchsiaResourceDialect
17344                    )
17345                });
17346                fidl::decode!(
17347                    RegisterBufferCollectionUsages,
17348                    fidl::encoding::DefaultFuchsiaResourceDialect,
17349                    val_ref,
17350                    decoder,
17351                    inner_offset,
17352                    inner_depth
17353                )?;
17354                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
17355                {
17356                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
17357                }
17358                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
17359                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
17360                }
17361            }
17362
17363            next_offset += envelope_size;
17364            _next_ordinal_to_read += 1;
17365            if next_offset >= end_offset {
17366                return Ok(());
17367            }
17368
17369            // Decode unknown envelopes for gaps in ordinals.
17370            while _next_ordinal_to_read < 5 {
17371                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
17372                _next_ordinal_to_read += 1;
17373                next_offset += envelope_size;
17374            }
17375
17376            let next_out_of_line = decoder.next_out_of_line();
17377            let handles_before = decoder.remaining_handles();
17378            if let Some((inlined, num_bytes, num_handles)) =
17379                fidl::encoding::decode_envelope_header(decoder, next_offset)?
17380            {
17381                let member_inline_size = <fidl::encoding::Endpoint<
17382                    fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem2::BufferCollectionTokenMarker>,
17383                > as fidl::encoding::TypeMarker>::inline_size(
17384                    decoder.context
17385                );
17386                if inlined != (member_inline_size <= 4) {
17387                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
17388                }
17389                let inner_offset;
17390                let mut inner_depth = depth.clone();
17391                if inlined {
17392                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
17393                    inner_offset = next_offset;
17394                } else {
17395                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
17396                    inner_depth.increment()?;
17397                }
17398                let val_ref = self.buffer_collection_token2.get_or_insert_with(|| {
17399                    fidl::new_empty!(
17400                        fidl::encoding::Endpoint<
17401                            fidl::endpoints::ClientEnd<
17402                                fidl_fuchsia_sysmem2::BufferCollectionTokenMarker,
17403                            >,
17404                        >,
17405                        fidl::encoding::DefaultFuchsiaResourceDialect
17406                    )
17407                });
17408                fidl::decode!(
17409                    fidl::encoding::Endpoint<
17410                        fidl::endpoints::ClientEnd<
17411                            fidl_fuchsia_sysmem2::BufferCollectionTokenMarker,
17412                        >,
17413                    >,
17414                    fidl::encoding::DefaultFuchsiaResourceDialect,
17415                    val_ref,
17416                    decoder,
17417                    inner_offset,
17418                    inner_depth
17419                )?;
17420                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
17421                {
17422                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
17423                }
17424                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
17425                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
17426                }
17427            }
17428
17429            next_offset += envelope_size;
17430
17431            // Decode the remaining unknown envelopes.
17432            while next_offset < end_offset {
17433                _next_ordinal_to_read += 1;
17434                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
17435                next_offset += envelope_size;
17436            }
17437
17438            Ok(())
17439        }
17440    }
17441
17442    impl ScreenCaptureConfig {
17443        #[inline(always)]
17444        fn max_ordinal_present(&self) -> u64 {
17445            if let Some(_) = self.rotation {
17446                return 4;
17447            }
17448            if let Some(_) = self.buffer_count {
17449                return 3;
17450            }
17451            if let Some(_) = self.size {
17452                return 2;
17453            }
17454            if let Some(_) = self.import_token {
17455                return 1;
17456            }
17457            0
17458        }
17459    }
17460
17461    impl fidl::encoding::ResourceTypeMarker for ScreenCaptureConfig {
17462        type Borrowed<'a> = &'a mut Self;
17463        fn take_or_borrow<'a>(
17464            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
17465        ) -> Self::Borrowed<'a> {
17466            value
17467        }
17468    }
17469
17470    unsafe impl fidl::encoding::TypeMarker for ScreenCaptureConfig {
17471        type Owned = Self;
17472
17473        #[inline(always)]
17474        fn inline_align(_context: fidl::encoding::Context) -> usize {
17475            8
17476        }
17477
17478        #[inline(always)]
17479        fn inline_size(_context: fidl::encoding::Context) -> usize {
17480            16
17481        }
17482    }
17483
17484    unsafe impl
17485        fidl::encoding::Encode<ScreenCaptureConfig, fidl::encoding::DefaultFuchsiaResourceDialect>
17486        for &mut ScreenCaptureConfig
17487    {
17488        unsafe fn encode(
17489            self,
17490            encoder: &mut fidl::encoding::Encoder<
17491                '_,
17492                fidl::encoding::DefaultFuchsiaResourceDialect,
17493            >,
17494            offset: usize,
17495            mut depth: fidl::encoding::Depth,
17496        ) -> fidl::Result<()> {
17497            encoder.debug_check_bounds::<ScreenCaptureConfig>(offset);
17498            // Vector header
17499            let max_ordinal: u64 = self.max_ordinal_present();
17500            encoder.write_num(max_ordinal, offset);
17501            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
17502            // Calling encoder.out_of_line_offset(0) is not allowed.
17503            if max_ordinal == 0 {
17504                return Ok(());
17505            }
17506            depth.increment()?;
17507            let envelope_size = 8;
17508            let bytes_len = max_ordinal as usize * envelope_size;
17509            #[allow(unused_variables)]
17510            let offset = encoder.out_of_line_offset(bytes_len);
17511            let mut _prev_end_offset: usize = 0;
17512            if 1 > max_ordinal {
17513                return Ok(());
17514            }
17515
17516            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
17517            // are envelope_size bytes.
17518            let cur_offset: usize = (1 - 1) * envelope_size;
17519
17520            // Zero reserved fields.
17521            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
17522
17523            // Safety:
17524            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
17525            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
17526            //   envelope_size bytes, there is always sufficient room.
17527            fidl::encoding::encode_in_envelope_optional::<BufferCollectionImportToken, fidl::encoding::DefaultFuchsiaResourceDialect>(
17528            self.import_token.as_mut().map(<BufferCollectionImportToken as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
17529            encoder, offset + cur_offset, depth
17530        )?;
17531
17532            _prev_end_offset = cur_offset + envelope_size;
17533            if 2 > max_ordinal {
17534                return Ok(());
17535            }
17536
17537            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
17538            // are envelope_size bytes.
17539            let cur_offset: usize = (2 - 1) * envelope_size;
17540
17541            // Zero reserved fields.
17542            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
17543
17544            // Safety:
17545            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
17546            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
17547            //   envelope_size bytes, there is always sufficient room.
17548            fidl::encoding::encode_in_envelope_optional::<
17549                fidl_fuchsia_math::SizeU,
17550                fidl::encoding::DefaultFuchsiaResourceDialect,
17551            >(
17552                self.size
17553                    .as_ref()
17554                    .map(<fidl_fuchsia_math::SizeU as fidl::encoding::ValueTypeMarker>::borrow),
17555                encoder,
17556                offset + cur_offset,
17557                depth,
17558            )?;
17559
17560            _prev_end_offset = cur_offset + envelope_size;
17561            if 3 > max_ordinal {
17562                return Ok(());
17563            }
17564
17565            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
17566            // are envelope_size bytes.
17567            let cur_offset: usize = (3 - 1) * envelope_size;
17568
17569            // Zero reserved fields.
17570            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
17571
17572            // Safety:
17573            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
17574            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
17575            //   envelope_size bytes, there is always sufficient room.
17576            fidl::encoding::encode_in_envelope_optional::<
17577                u32,
17578                fidl::encoding::DefaultFuchsiaResourceDialect,
17579            >(
17580                self.buffer_count.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
17581                encoder,
17582                offset + cur_offset,
17583                depth,
17584            )?;
17585
17586            _prev_end_offset = cur_offset + envelope_size;
17587            if 4 > max_ordinal {
17588                return Ok(());
17589            }
17590
17591            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
17592            // are envelope_size bytes.
17593            let cur_offset: usize = (4 - 1) * envelope_size;
17594
17595            // Zero reserved fields.
17596            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
17597
17598            // Safety:
17599            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
17600            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
17601            //   envelope_size bytes, there is always sufficient room.
17602            fidl::encoding::encode_in_envelope_optional::<
17603                Rotation,
17604                fidl::encoding::DefaultFuchsiaResourceDialect,
17605            >(
17606                self.rotation.as_ref().map(<Rotation as fidl::encoding::ValueTypeMarker>::borrow),
17607                encoder,
17608                offset + cur_offset,
17609                depth,
17610            )?;
17611
17612            _prev_end_offset = cur_offset + envelope_size;
17613
17614            Ok(())
17615        }
17616    }
17617
17618    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
17619        for ScreenCaptureConfig
17620    {
17621        #[inline(always)]
17622        fn new_empty() -> Self {
17623            Self::default()
17624        }
17625
17626        unsafe fn decode(
17627            &mut self,
17628            decoder: &mut fidl::encoding::Decoder<
17629                '_,
17630                fidl::encoding::DefaultFuchsiaResourceDialect,
17631            >,
17632            offset: usize,
17633            mut depth: fidl::encoding::Depth,
17634        ) -> fidl::Result<()> {
17635            decoder.debug_check_bounds::<Self>(offset);
17636            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
17637                None => return Err(fidl::Error::NotNullable),
17638                Some(len) => len,
17639            };
17640            // Calling decoder.out_of_line_offset(0) is not allowed.
17641            if len == 0 {
17642                return Ok(());
17643            };
17644            depth.increment()?;
17645            let envelope_size = 8;
17646            let bytes_len = len * envelope_size;
17647            let offset = decoder.out_of_line_offset(bytes_len)?;
17648            // Decode the envelope for each type.
17649            let mut _next_ordinal_to_read = 0;
17650            let mut next_offset = offset;
17651            let end_offset = offset + bytes_len;
17652            _next_ordinal_to_read += 1;
17653            if next_offset >= end_offset {
17654                return Ok(());
17655            }
17656
17657            // Decode unknown envelopes for gaps in ordinals.
17658            while _next_ordinal_to_read < 1 {
17659                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
17660                _next_ordinal_to_read += 1;
17661                next_offset += envelope_size;
17662            }
17663
17664            let next_out_of_line = decoder.next_out_of_line();
17665            let handles_before = decoder.remaining_handles();
17666            if let Some((inlined, num_bytes, num_handles)) =
17667                fidl::encoding::decode_envelope_header(decoder, next_offset)?
17668            {
17669                let member_inline_size =
17670                    <BufferCollectionImportToken as fidl::encoding::TypeMarker>::inline_size(
17671                        decoder.context,
17672                    );
17673                if inlined != (member_inline_size <= 4) {
17674                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
17675                }
17676                let inner_offset;
17677                let mut inner_depth = depth.clone();
17678                if inlined {
17679                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
17680                    inner_offset = next_offset;
17681                } else {
17682                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
17683                    inner_depth.increment()?;
17684                }
17685                let val_ref = self.import_token.get_or_insert_with(|| {
17686                    fidl::new_empty!(
17687                        BufferCollectionImportToken,
17688                        fidl::encoding::DefaultFuchsiaResourceDialect
17689                    )
17690                });
17691                fidl::decode!(
17692                    BufferCollectionImportToken,
17693                    fidl::encoding::DefaultFuchsiaResourceDialect,
17694                    val_ref,
17695                    decoder,
17696                    inner_offset,
17697                    inner_depth
17698                )?;
17699                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
17700                {
17701                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
17702                }
17703                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
17704                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
17705                }
17706            }
17707
17708            next_offset += envelope_size;
17709            _next_ordinal_to_read += 1;
17710            if next_offset >= end_offset {
17711                return Ok(());
17712            }
17713
17714            // Decode unknown envelopes for gaps in ordinals.
17715            while _next_ordinal_to_read < 2 {
17716                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
17717                _next_ordinal_to_read += 1;
17718                next_offset += envelope_size;
17719            }
17720
17721            let next_out_of_line = decoder.next_out_of_line();
17722            let handles_before = decoder.remaining_handles();
17723            if let Some((inlined, num_bytes, num_handles)) =
17724                fidl::encoding::decode_envelope_header(decoder, next_offset)?
17725            {
17726                let member_inline_size =
17727                    <fidl_fuchsia_math::SizeU as fidl::encoding::TypeMarker>::inline_size(
17728                        decoder.context,
17729                    );
17730                if inlined != (member_inline_size <= 4) {
17731                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
17732                }
17733                let inner_offset;
17734                let mut inner_depth = depth.clone();
17735                if inlined {
17736                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
17737                    inner_offset = next_offset;
17738                } else {
17739                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
17740                    inner_depth.increment()?;
17741                }
17742                let val_ref = self.size.get_or_insert_with(|| {
17743                    fidl::new_empty!(
17744                        fidl_fuchsia_math::SizeU,
17745                        fidl::encoding::DefaultFuchsiaResourceDialect
17746                    )
17747                });
17748                fidl::decode!(
17749                    fidl_fuchsia_math::SizeU,
17750                    fidl::encoding::DefaultFuchsiaResourceDialect,
17751                    val_ref,
17752                    decoder,
17753                    inner_offset,
17754                    inner_depth
17755                )?;
17756                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
17757                {
17758                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
17759                }
17760                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
17761                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
17762                }
17763            }
17764
17765            next_offset += envelope_size;
17766            _next_ordinal_to_read += 1;
17767            if next_offset >= end_offset {
17768                return Ok(());
17769            }
17770
17771            // Decode unknown envelopes for gaps in ordinals.
17772            while _next_ordinal_to_read < 3 {
17773                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
17774                _next_ordinal_to_read += 1;
17775                next_offset += envelope_size;
17776            }
17777
17778            let next_out_of_line = decoder.next_out_of_line();
17779            let handles_before = decoder.remaining_handles();
17780            if let Some((inlined, num_bytes, num_handles)) =
17781                fidl::encoding::decode_envelope_header(decoder, next_offset)?
17782            {
17783                let member_inline_size =
17784                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
17785                if inlined != (member_inline_size <= 4) {
17786                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
17787                }
17788                let inner_offset;
17789                let mut inner_depth = depth.clone();
17790                if inlined {
17791                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
17792                    inner_offset = next_offset;
17793                } else {
17794                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
17795                    inner_depth.increment()?;
17796                }
17797                let val_ref = self.buffer_count.get_or_insert_with(|| {
17798                    fidl::new_empty!(u32, fidl::encoding::DefaultFuchsiaResourceDialect)
17799                });
17800                fidl::decode!(
17801                    u32,
17802                    fidl::encoding::DefaultFuchsiaResourceDialect,
17803                    val_ref,
17804                    decoder,
17805                    inner_offset,
17806                    inner_depth
17807                )?;
17808                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
17809                {
17810                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
17811                }
17812                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
17813                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
17814                }
17815            }
17816
17817            next_offset += envelope_size;
17818            _next_ordinal_to_read += 1;
17819            if next_offset >= end_offset {
17820                return Ok(());
17821            }
17822
17823            // Decode unknown envelopes for gaps in ordinals.
17824            while _next_ordinal_to_read < 4 {
17825                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
17826                _next_ordinal_to_read += 1;
17827                next_offset += envelope_size;
17828            }
17829
17830            let next_out_of_line = decoder.next_out_of_line();
17831            let handles_before = decoder.remaining_handles();
17832            if let Some((inlined, num_bytes, num_handles)) =
17833                fidl::encoding::decode_envelope_header(decoder, next_offset)?
17834            {
17835                let member_inline_size =
17836                    <Rotation as fidl::encoding::TypeMarker>::inline_size(decoder.context);
17837                if inlined != (member_inline_size <= 4) {
17838                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
17839                }
17840                let inner_offset;
17841                let mut inner_depth = depth.clone();
17842                if inlined {
17843                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
17844                    inner_offset = next_offset;
17845                } else {
17846                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
17847                    inner_depth.increment()?;
17848                }
17849                let val_ref = self.rotation.get_or_insert_with(|| {
17850                    fidl::new_empty!(Rotation, fidl::encoding::DefaultFuchsiaResourceDialect)
17851                });
17852                fidl::decode!(
17853                    Rotation,
17854                    fidl::encoding::DefaultFuchsiaResourceDialect,
17855                    val_ref,
17856                    decoder,
17857                    inner_offset,
17858                    inner_depth
17859                )?;
17860                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
17861                {
17862                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
17863                }
17864                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
17865                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
17866                }
17867            }
17868
17869            next_offset += envelope_size;
17870
17871            // Decode the remaining unknown envelopes.
17872            while next_offset < end_offset {
17873                _next_ordinal_to_read += 1;
17874                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
17875                next_offset += envelope_size;
17876            }
17877
17878            Ok(())
17879        }
17880    }
17881
17882    impl ScreenshotTakeFileRequest {
17883        #[inline(always)]
17884        fn max_ordinal_present(&self) -> u64 {
17885            if let Some(_) = self.format {
17886                return 1;
17887            }
17888            0
17889        }
17890    }
17891
17892    impl fidl::encoding::ResourceTypeMarker for ScreenshotTakeFileRequest {
17893        type Borrowed<'a> = &'a mut Self;
17894        fn take_or_borrow<'a>(
17895            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
17896        ) -> Self::Borrowed<'a> {
17897            value
17898        }
17899    }
17900
17901    unsafe impl fidl::encoding::TypeMarker for ScreenshotTakeFileRequest {
17902        type Owned = Self;
17903
17904        #[inline(always)]
17905        fn inline_align(_context: fidl::encoding::Context) -> usize {
17906            8
17907        }
17908
17909        #[inline(always)]
17910        fn inline_size(_context: fidl::encoding::Context) -> usize {
17911            16
17912        }
17913    }
17914
17915    unsafe impl
17916        fidl::encoding::Encode<
17917            ScreenshotTakeFileRequest,
17918            fidl::encoding::DefaultFuchsiaResourceDialect,
17919        > for &mut ScreenshotTakeFileRequest
17920    {
17921        unsafe fn encode(
17922            self,
17923            encoder: &mut fidl::encoding::Encoder<
17924                '_,
17925                fidl::encoding::DefaultFuchsiaResourceDialect,
17926            >,
17927            offset: usize,
17928            mut depth: fidl::encoding::Depth,
17929        ) -> fidl::Result<()> {
17930            encoder.debug_check_bounds::<ScreenshotTakeFileRequest>(offset);
17931            // Vector header
17932            let max_ordinal: u64 = self.max_ordinal_present();
17933            encoder.write_num(max_ordinal, offset);
17934            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
17935            // Calling encoder.out_of_line_offset(0) is not allowed.
17936            if max_ordinal == 0 {
17937                return Ok(());
17938            }
17939            depth.increment()?;
17940            let envelope_size = 8;
17941            let bytes_len = max_ordinal as usize * envelope_size;
17942            #[allow(unused_variables)]
17943            let offset = encoder.out_of_line_offset(bytes_len);
17944            let mut _prev_end_offset: usize = 0;
17945            if 1 > max_ordinal {
17946                return Ok(());
17947            }
17948
17949            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
17950            // are envelope_size bytes.
17951            let cur_offset: usize = (1 - 1) * envelope_size;
17952
17953            // Zero reserved fields.
17954            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
17955
17956            // Safety:
17957            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
17958            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
17959            //   envelope_size bytes, there is always sufficient room.
17960            fidl::encoding::encode_in_envelope_optional::<
17961                ScreenshotFormat,
17962                fidl::encoding::DefaultFuchsiaResourceDialect,
17963            >(
17964                self.format
17965                    .as_ref()
17966                    .map(<ScreenshotFormat as fidl::encoding::ValueTypeMarker>::borrow),
17967                encoder,
17968                offset + cur_offset,
17969                depth,
17970            )?;
17971
17972            _prev_end_offset = cur_offset + envelope_size;
17973
17974            Ok(())
17975        }
17976    }
17977
17978    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
17979        for ScreenshotTakeFileRequest
17980    {
17981        #[inline(always)]
17982        fn new_empty() -> Self {
17983            Self::default()
17984        }
17985
17986        unsafe fn decode(
17987            &mut self,
17988            decoder: &mut fidl::encoding::Decoder<
17989                '_,
17990                fidl::encoding::DefaultFuchsiaResourceDialect,
17991            >,
17992            offset: usize,
17993            mut depth: fidl::encoding::Depth,
17994        ) -> fidl::Result<()> {
17995            decoder.debug_check_bounds::<Self>(offset);
17996            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
17997                None => return Err(fidl::Error::NotNullable),
17998                Some(len) => len,
17999            };
18000            // Calling decoder.out_of_line_offset(0) is not allowed.
18001            if len == 0 {
18002                return Ok(());
18003            };
18004            depth.increment()?;
18005            let envelope_size = 8;
18006            let bytes_len = len * envelope_size;
18007            let offset = decoder.out_of_line_offset(bytes_len)?;
18008            // Decode the envelope for each type.
18009            let mut _next_ordinal_to_read = 0;
18010            let mut next_offset = offset;
18011            let end_offset = offset + bytes_len;
18012            _next_ordinal_to_read += 1;
18013            if next_offset >= end_offset {
18014                return Ok(());
18015            }
18016
18017            // Decode unknown envelopes for gaps in ordinals.
18018            while _next_ordinal_to_read < 1 {
18019                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
18020                _next_ordinal_to_read += 1;
18021                next_offset += envelope_size;
18022            }
18023
18024            let next_out_of_line = decoder.next_out_of_line();
18025            let handles_before = decoder.remaining_handles();
18026            if let Some((inlined, num_bytes, num_handles)) =
18027                fidl::encoding::decode_envelope_header(decoder, next_offset)?
18028            {
18029                let member_inline_size =
18030                    <ScreenshotFormat as fidl::encoding::TypeMarker>::inline_size(decoder.context);
18031                if inlined != (member_inline_size <= 4) {
18032                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
18033                }
18034                let inner_offset;
18035                let mut inner_depth = depth.clone();
18036                if inlined {
18037                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
18038                    inner_offset = next_offset;
18039                } else {
18040                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
18041                    inner_depth.increment()?;
18042                }
18043                let val_ref = self.format.get_or_insert_with(|| {
18044                    fidl::new_empty!(
18045                        ScreenshotFormat,
18046                        fidl::encoding::DefaultFuchsiaResourceDialect
18047                    )
18048                });
18049                fidl::decode!(
18050                    ScreenshotFormat,
18051                    fidl::encoding::DefaultFuchsiaResourceDialect,
18052                    val_ref,
18053                    decoder,
18054                    inner_offset,
18055                    inner_depth
18056                )?;
18057                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
18058                {
18059                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
18060                }
18061                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
18062                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
18063                }
18064            }
18065
18066            next_offset += envelope_size;
18067
18068            // Decode the remaining unknown envelopes.
18069            while next_offset < end_offset {
18070                _next_ordinal_to_read += 1;
18071                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
18072                next_offset += envelope_size;
18073            }
18074
18075            Ok(())
18076        }
18077    }
18078
18079    impl ScreenshotTakeFileResponse {
18080        #[inline(always)]
18081        fn max_ordinal_present(&self) -> u64 {
18082            if let Some(_) = self.size {
18083                return 2;
18084            }
18085            if let Some(_) = self.file {
18086                return 1;
18087            }
18088            0
18089        }
18090    }
18091
18092    impl fidl::encoding::ResourceTypeMarker for ScreenshotTakeFileResponse {
18093        type Borrowed<'a> = &'a mut Self;
18094        fn take_or_borrow<'a>(
18095            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
18096        ) -> Self::Borrowed<'a> {
18097            value
18098        }
18099    }
18100
18101    unsafe impl fidl::encoding::TypeMarker for ScreenshotTakeFileResponse {
18102        type Owned = Self;
18103
18104        #[inline(always)]
18105        fn inline_align(_context: fidl::encoding::Context) -> usize {
18106            8
18107        }
18108
18109        #[inline(always)]
18110        fn inline_size(_context: fidl::encoding::Context) -> usize {
18111            16
18112        }
18113    }
18114
18115    unsafe impl
18116        fidl::encoding::Encode<
18117            ScreenshotTakeFileResponse,
18118            fidl::encoding::DefaultFuchsiaResourceDialect,
18119        > for &mut ScreenshotTakeFileResponse
18120    {
18121        unsafe fn encode(
18122            self,
18123            encoder: &mut fidl::encoding::Encoder<
18124                '_,
18125                fidl::encoding::DefaultFuchsiaResourceDialect,
18126            >,
18127            offset: usize,
18128            mut depth: fidl::encoding::Depth,
18129        ) -> fidl::Result<()> {
18130            encoder.debug_check_bounds::<ScreenshotTakeFileResponse>(offset);
18131            // Vector header
18132            let max_ordinal: u64 = self.max_ordinal_present();
18133            encoder.write_num(max_ordinal, offset);
18134            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
18135            // Calling encoder.out_of_line_offset(0) is not allowed.
18136            if max_ordinal == 0 {
18137                return Ok(());
18138            }
18139            depth.increment()?;
18140            let envelope_size = 8;
18141            let bytes_len = max_ordinal as usize * envelope_size;
18142            #[allow(unused_variables)]
18143            let offset = encoder.out_of_line_offset(bytes_len);
18144            let mut _prev_end_offset: usize = 0;
18145            if 1 > max_ordinal {
18146                return Ok(());
18147            }
18148
18149            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
18150            // are envelope_size bytes.
18151            let cur_offset: usize = (1 - 1) * envelope_size;
18152
18153            // Zero reserved fields.
18154            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
18155
18156            // Safety:
18157            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
18158            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
18159            //   envelope_size bytes, there is always sufficient room.
18160            fidl::encoding::encode_in_envelope_optional::<
18161                fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>>,
18162                fidl::encoding::DefaultFuchsiaResourceDialect,
18163            >(
18164                self.file.as_mut().map(
18165                    <fidl::encoding::Endpoint<
18166                        fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
18167                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
18168                ),
18169                encoder,
18170                offset + cur_offset,
18171                depth,
18172            )?;
18173
18174            _prev_end_offset = cur_offset + envelope_size;
18175            if 2 > max_ordinal {
18176                return Ok(());
18177            }
18178
18179            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
18180            // are envelope_size bytes.
18181            let cur_offset: usize = (2 - 1) * envelope_size;
18182
18183            // Zero reserved fields.
18184            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
18185
18186            // Safety:
18187            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
18188            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
18189            //   envelope_size bytes, there is always sufficient room.
18190            fidl::encoding::encode_in_envelope_optional::<
18191                fidl_fuchsia_math::SizeU,
18192                fidl::encoding::DefaultFuchsiaResourceDialect,
18193            >(
18194                self.size
18195                    .as_ref()
18196                    .map(<fidl_fuchsia_math::SizeU as fidl::encoding::ValueTypeMarker>::borrow),
18197                encoder,
18198                offset + cur_offset,
18199                depth,
18200            )?;
18201
18202            _prev_end_offset = cur_offset + envelope_size;
18203
18204            Ok(())
18205        }
18206    }
18207
18208    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
18209        for ScreenshotTakeFileResponse
18210    {
18211        #[inline(always)]
18212        fn new_empty() -> Self {
18213            Self::default()
18214        }
18215
18216        unsafe fn decode(
18217            &mut self,
18218            decoder: &mut fidl::encoding::Decoder<
18219                '_,
18220                fidl::encoding::DefaultFuchsiaResourceDialect,
18221            >,
18222            offset: usize,
18223            mut depth: fidl::encoding::Depth,
18224        ) -> fidl::Result<()> {
18225            decoder.debug_check_bounds::<Self>(offset);
18226            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
18227                None => return Err(fidl::Error::NotNullable),
18228                Some(len) => len,
18229            };
18230            // Calling decoder.out_of_line_offset(0) is not allowed.
18231            if len == 0 {
18232                return Ok(());
18233            };
18234            depth.increment()?;
18235            let envelope_size = 8;
18236            let bytes_len = len * envelope_size;
18237            let offset = decoder.out_of_line_offset(bytes_len)?;
18238            // Decode the envelope for each type.
18239            let mut _next_ordinal_to_read = 0;
18240            let mut next_offset = offset;
18241            let end_offset = offset + bytes_len;
18242            _next_ordinal_to_read += 1;
18243            if next_offset >= end_offset {
18244                return Ok(());
18245            }
18246
18247            // Decode unknown envelopes for gaps in ordinals.
18248            while _next_ordinal_to_read < 1 {
18249                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
18250                _next_ordinal_to_read += 1;
18251                next_offset += envelope_size;
18252            }
18253
18254            let next_out_of_line = decoder.next_out_of_line();
18255            let handles_before = decoder.remaining_handles();
18256            if let Some((inlined, num_bytes, num_handles)) =
18257                fidl::encoding::decode_envelope_header(decoder, next_offset)?
18258            {
18259                let member_inline_size = <fidl::encoding::Endpoint<
18260                    fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
18261                > as fidl::encoding::TypeMarker>::inline_size(
18262                    decoder.context
18263                );
18264                if inlined != (member_inline_size <= 4) {
18265                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
18266                }
18267                let inner_offset;
18268                let mut inner_depth = depth.clone();
18269                if inlined {
18270                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
18271                    inner_offset = next_offset;
18272                } else {
18273                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
18274                    inner_depth.increment()?;
18275                }
18276                let val_ref = self.file.get_or_insert_with(|| {
18277                    fidl::new_empty!(
18278                        fidl::encoding::Endpoint<
18279                            fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
18280                        >,
18281                        fidl::encoding::DefaultFuchsiaResourceDialect
18282                    )
18283                });
18284                fidl::decode!(
18285                    fidl::encoding::Endpoint<
18286                        fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
18287                    >,
18288                    fidl::encoding::DefaultFuchsiaResourceDialect,
18289                    val_ref,
18290                    decoder,
18291                    inner_offset,
18292                    inner_depth
18293                )?;
18294                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
18295                {
18296                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
18297                }
18298                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
18299                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
18300                }
18301            }
18302
18303            next_offset += envelope_size;
18304            _next_ordinal_to_read += 1;
18305            if next_offset >= end_offset {
18306                return Ok(());
18307            }
18308
18309            // Decode unknown envelopes for gaps in ordinals.
18310            while _next_ordinal_to_read < 2 {
18311                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
18312                _next_ordinal_to_read += 1;
18313                next_offset += envelope_size;
18314            }
18315
18316            let next_out_of_line = decoder.next_out_of_line();
18317            let handles_before = decoder.remaining_handles();
18318            if let Some((inlined, num_bytes, num_handles)) =
18319                fidl::encoding::decode_envelope_header(decoder, next_offset)?
18320            {
18321                let member_inline_size =
18322                    <fidl_fuchsia_math::SizeU as fidl::encoding::TypeMarker>::inline_size(
18323                        decoder.context,
18324                    );
18325                if inlined != (member_inline_size <= 4) {
18326                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
18327                }
18328                let inner_offset;
18329                let mut inner_depth = depth.clone();
18330                if inlined {
18331                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
18332                    inner_offset = next_offset;
18333                } else {
18334                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
18335                    inner_depth.increment()?;
18336                }
18337                let val_ref = self.size.get_or_insert_with(|| {
18338                    fidl::new_empty!(
18339                        fidl_fuchsia_math::SizeU,
18340                        fidl::encoding::DefaultFuchsiaResourceDialect
18341                    )
18342                });
18343                fidl::decode!(
18344                    fidl_fuchsia_math::SizeU,
18345                    fidl::encoding::DefaultFuchsiaResourceDialect,
18346                    val_ref,
18347                    decoder,
18348                    inner_offset,
18349                    inner_depth
18350                )?;
18351                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
18352                {
18353                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
18354                }
18355                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
18356                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
18357                }
18358            }
18359
18360            next_offset += envelope_size;
18361
18362            // Decode the remaining unknown envelopes.
18363            while next_offset < end_offset {
18364                _next_ordinal_to_read += 1;
18365                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
18366                next_offset += envelope_size;
18367            }
18368
18369            Ok(())
18370        }
18371    }
18372
18373    impl ScreenshotTakeRequest {
18374        #[inline(always)]
18375        fn max_ordinal_present(&self) -> u64 {
18376            if let Some(_) = self.format {
18377                return 1;
18378            }
18379            0
18380        }
18381    }
18382
18383    impl fidl::encoding::ResourceTypeMarker for ScreenshotTakeRequest {
18384        type Borrowed<'a> = &'a mut Self;
18385        fn take_or_borrow<'a>(
18386            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
18387        ) -> Self::Borrowed<'a> {
18388            value
18389        }
18390    }
18391
18392    unsafe impl fidl::encoding::TypeMarker for ScreenshotTakeRequest {
18393        type Owned = Self;
18394
18395        #[inline(always)]
18396        fn inline_align(_context: fidl::encoding::Context) -> usize {
18397            8
18398        }
18399
18400        #[inline(always)]
18401        fn inline_size(_context: fidl::encoding::Context) -> usize {
18402            16
18403        }
18404    }
18405
18406    unsafe impl
18407        fidl::encoding::Encode<ScreenshotTakeRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
18408        for &mut ScreenshotTakeRequest
18409    {
18410        unsafe fn encode(
18411            self,
18412            encoder: &mut fidl::encoding::Encoder<
18413                '_,
18414                fidl::encoding::DefaultFuchsiaResourceDialect,
18415            >,
18416            offset: usize,
18417            mut depth: fidl::encoding::Depth,
18418        ) -> fidl::Result<()> {
18419            encoder.debug_check_bounds::<ScreenshotTakeRequest>(offset);
18420            // Vector header
18421            let max_ordinal: u64 = self.max_ordinal_present();
18422            encoder.write_num(max_ordinal, offset);
18423            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
18424            // Calling encoder.out_of_line_offset(0) is not allowed.
18425            if max_ordinal == 0 {
18426                return Ok(());
18427            }
18428            depth.increment()?;
18429            let envelope_size = 8;
18430            let bytes_len = max_ordinal as usize * envelope_size;
18431            #[allow(unused_variables)]
18432            let offset = encoder.out_of_line_offset(bytes_len);
18433            let mut _prev_end_offset: usize = 0;
18434            if 1 > max_ordinal {
18435                return Ok(());
18436            }
18437
18438            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
18439            // are envelope_size bytes.
18440            let cur_offset: usize = (1 - 1) * envelope_size;
18441
18442            // Zero reserved fields.
18443            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
18444
18445            // Safety:
18446            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
18447            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
18448            //   envelope_size bytes, there is always sufficient room.
18449            fidl::encoding::encode_in_envelope_optional::<
18450                ScreenshotFormat,
18451                fidl::encoding::DefaultFuchsiaResourceDialect,
18452            >(
18453                self.format
18454                    .as_ref()
18455                    .map(<ScreenshotFormat as fidl::encoding::ValueTypeMarker>::borrow),
18456                encoder,
18457                offset + cur_offset,
18458                depth,
18459            )?;
18460
18461            _prev_end_offset = cur_offset + envelope_size;
18462
18463            Ok(())
18464        }
18465    }
18466
18467    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
18468        for ScreenshotTakeRequest
18469    {
18470        #[inline(always)]
18471        fn new_empty() -> Self {
18472            Self::default()
18473        }
18474
18475        unsafe fn decode(
18476            &mut self,
18477            decoder: &mut fidl::encoding::Decoder<
18478                '_,
18479                fidl::encoding::DefaultFuchsiaResourceDialect,
18480            >,
18481            offset: usize,
18482            mut depth: fidl::encoding::Depth,
18483        ) -> fidl::Result<()> {
18484            decoder.debug_check_bounds::<Self>(offset);
18485            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
18486                None => return Err(fidl::Error::NotNullable),
18487                Some(len) => len,
18488            };
18489            // Calling decoder.out_of_line_offset(0) is not allowed.
18490            if len == 0 {
18491                return Ok(());
18492            };
18493            depth.increment()?;
18494            let envelope_size = 8;
18495            let bytes_len = len * envelope_size;
18496            let offset = decoder.out_of_line_offset(bytes_len)?;
18497            // Decode the envelope for each type.
18498            let mut _next_ordinal_to_read = 0;
18499            let mut next_offset = offset;
18500            let end_offset = offset + bytes_len;
18501            _next_ordinal_to_read += 1;
18502            if next_offset >= end_offset {
18503                return Ok(());
18504            }
18505
18506            // Decode unknown envelopes for gaps in ordinals.
18507            while _next_ordinal_to_read < 1 {
18508                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
18509                _next_ordinal_to_read += 1;
18510                next_offset += envelope_size;
18511            }
18512
18513            let next_out_of_line = decoder.next_out_of_line();
18514            let handles_before = decoder.remaining_handles();
18515            if let Some((inlined, num_bytes, num_handles)) =
18516                fidl::encoding::decode_envelope_header(decoder, next_offset)?
18517            {
18518                let member_inline_size =
18519                    <ScreenshotFormat as fidl::encoding::TypeMarker>::inline_size(decoder.context);
18520                if inlined != (member_inline_size <= 4) {
18521                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
18522                }
18523                let inner_offset;
18524                let mut inner_depth = depth.clone();
18525                if inlined {
18526                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
18527                    inner_offset = next_offset;
18528                } else {
18529                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
18530                    inner_depth.increment()?;
18531                }
18532                let val_ref = self.format.get_or_insert_with(|| {
18533                    fidl::new_empty!(
18534                        ScreenshotFormat,
18535                        fidl::encoding::DefaultFuchsiaResourceDialect
18536                    )
18537                });
18538                fidl::decode!(
18539                    ScreenshotFormat,
18540                    fidl::encoding::DefaultFuchsiaResourceDialect,
18541                    val_ref,
18542                    decoder,
18543                    inner_offset,
18544                    inner_depth
18545                )?;
18546                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
18547                {
18548                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
18549                }
18550                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
18551                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
18552                }
18553            }
18554
18555            next_offset += envelope_size;
18556
18557            // Decode the remaining unknown envelopes.
18558            while next_offset < end_offset {
18559                _next_ordinal_to_read += 1;
18560                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
18561                next_offset += envelope_size;
18562            }
18563
18564            Ok(())
18565        }
18566    }
18567
18568    impl ScreenshotTakeResponse {
18569        #[inline(always)]
18570        fn max_ordinal_present(&self) -> u64 {
18571            if let Some(_) = self.size {
18572                return 2;
18573            }
18574            if let Some(_) = self.vmo {
18575                return 1;
18576            }
18577            0
18578        }
18579    }
18580
18581    impl fidl::encoding::ResourceTypeMarker for ScreenshotTakeResponse {
18582        type Borrowed<'a> = &'a mut Self;
18583        fn take_or_borrow<'a>(
18584            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
18585        ) -> Self::Borrowed<'a> {
18586            value
18587        }
18588    }
18589
18590    unsafe impl fidl::encoding::TypeMarker for ScreenshotTakeResponse {
18591        type Owned = Self;
18592
18593        #[inline(always)]
18594        fn inline_align(_context: fidl::encoding::Context) -> usize {
18595            8
18596        }
18597
18598        #[inline(always)]
18599        fn inline_size(_context: fidl::encoding::Context) -> usize {
18600            16
18601        }
18602    }
18603
18604    unsafe impl
18605        fidl::encoding::Encode<
18606            ScreenshotTakeResponse,
18607            fidl::encoding::DefaultFuchsiaResourceDialect,
18608        > for &mut ScreenshotTakeResponse
18609    {
18610        unsafe fn encode(
18611            self,
18612            encoder: &mut fidl::encoding::Encoder<
18613                '_,
18614                fidl::encoding::DefaultFuchsiaResourceDialect,
18615            >,
18616            offset: usize,
18617            mut depth: fidl::encoding::Depth,
18618        ) -> fidl::Result<()> {
18619            encoder.debug_check_bounds::<ScreenshotTakeResponse>(offset);
18620            // Vector header
18621            let max_ordinal: u64 = self.max_ordinal_present();
18622            encoder.write_num(max_ordinal, offset);
18623            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
18624            // Calling encoder.out_of_line_offset(0) is not allowed.
18625            if max_ordinal == 0 {
18626                return Ok(());
18627            }
18628            depth.increment()?;
18629            let envelope_size = 8;
18630            let bytes_len = max_ordinal as usize * envelope_size;
18631            #[allow(unused_variables)]
18632            let offset = encoder.out_of_line_offset(bytes_len);
18633            let mut _prev_end_offset: usize = 0;
18634            if 1 > max_ordinal {
18635                return Ok(());
18636            }
18637
18638            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
18639            // are envelope_size bytes.
18640            let cur_offset: usize = (1 - 1) * envelope_size;
18641
18642            // Zero reserved fields.
18643            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
18644
18645            // Safety:
18646            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
18647            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
18648            //   envelope_size bytes, there is always sufficient room.
18649            fidl::encoding::encode_in_envelope_optional::<
18650                fidl::encoding::HandleType<
18651                    fidl::Vmo,
18652                    { fidl::ObjectType::VMO.into_raw() },
18653                    2147483648,
18654                >,
18655                fidl::encoding::DefaultFuchsiaResourceDialect,
18656            >(
18657                self.vmo.as_mut().map(
18658                    <fidl::encoding::HandleType<
18659                        fidl::Vmo,
18660                        { fidl::ObjectType::VMO.into_raw() },
18661                        2147483648,
18662                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
18663                ),
18664                encoder,
18665                offset + cur_offset,
18666                depth,
18667            )?;
18668
18669            _prev_end_offset = cur_offset + envelope_size;
18670            if 2 > max_ordinal {
18671                return Ok(());
18672            }
18673
18674            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
18675            // are envelope_size bytes.
18676            let cur_offset: usize = (2 - 1) * envelope_size;
18677
18678            // Zero reserved fields.
18679            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
18680
18681            // Safety:
18682            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
18683            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
18684            //   envelope_size bytes, there is always sufficient room.
18685            fidl::encoding::encode_in_envelope_optional::<
18686                fidl_fuchsia_math::SizeU,
18687                fidl::encoding::DefaultFuchsiaResourceDialect,
18688            >(
18689                self.size
18690                    .as_ref()
18691                    .map(<fidl_fuchsia_math::SizeU as fidl::encoding::ValueTypeMarker>::borrow),
18692                encoder,
18693                offset + cur_offset,
18694                depth,
18695            )?;
18696
18697            _prev_end_offset = cur_offset + envelope_size;
18698
18699            Ok(())
18700        }
18701    }
18702
18703    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
18704        for ScreenshotTakeResponse
18705    {
18706        #[inline(always)]
18707        fn new_empty() -> Self {
18708            Self::default()
18709        }
18710
18711        unsafe fn decode(
18712            &mut self,
18713            decoder: &mut fidl::encoding::Decoder<
18714                '_,
18715                fidl::encoding::DefaultFuchsiaResourceDialect,
18716            >,
18717            offset: usize,
18718            mut depth: fidl::encoding::Depth,
18719        ) -> fidl::Result<()> {
18720            decoder.debug_check_bounds::<Self>(offset);
18721            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
18722                None => return Err(fidl::Error::NotNullable),
18723                Some(len) => len,
18724            };
18725            // Calling decoder.out_of_line_offset(0) is not allowed.
18726            if len == 0 {
18727                return Ok(());
18728            };
18729            depth.increment()?;
18730            let envelope_size = 8;
18731            let bytes_len = len * envelope_size;
18732            let offset = decoder.out_of_line_offset(bytes_len)?;
18733            // Decode the envelope for each type.
18734            let mut _next_ordinal_to_read = 0;
18735            let mut next_offset = offset;
18736            let end_offset = offset + bytes_len;
18737            _next_ordinal_to_read += 1;
18738            if next_offset >= end_offset {
18739                return Ok(());
18740            }
18741
18742            // Decode unknown envelopes for gaps in ordinals.
18743            while _next_ordinal_to_read < 1 {
18744                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
18745                _next_ordinal_to_read += 1;
18746                next_offset += envelope_size;
18747            }
18748
18749            let next_out_of_line = decoder.next_out_of_line();
18750            let handles_before = decoder.remaining_handles();
18751            if let Some((inlined, num_bytes, num_handles)) =
18752                fidl::encoding::decode_envelope_header(decoder, next_offset)?
18753            {
18754                let member_inline_size = <fidl::encoding::HandleType<
18755                    fidl::Vmo,
18756                    { fidl::ObjectType::VMO.into_raw() },
18757                    2147483648,
18758                > as fidl::encoding::TypeMarker>::inline_size(
18759                    decoder.context
18760                );
18761                if inlined != (member_inline_size <= 4) {
18762                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
18763                }
18764                let inner_offset;
18765                let mut inner_depth = depth.clone();
18766                if inlined {
18767                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
18768                    inner_offset = next_offset;
18769                } else {
18770                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
18771                    inner_depth.increment()?;
18772                }
18773                let val_ref =
18774                self.vmo.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
18775                fidl::decode!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
18776                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
18777                {
18778                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
18779                }
18780                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
18781                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
18782                }
18783            }
18784
18785            next_offset += envelope_size;
18786            _next_ordinal_to_read += 1;
18787            if next_offset >= end_offset {
18788                return Ok(());
18789            }
18790
18791            // Decode unknown envelopes for gaps in ordinals.
18792            while _next_ordinal_to_read < 2 {
18793                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
18794                _next_ordinal_to_read += 1;
18795                next_offset += envelope_size;
18796            }
18797
18798            let next_out_of_line = decoder.next_out_of_line();
18799            let handles_before = decoder.remaining_handles();
18800            if let Some((inlined, num_bytes, num_handles)) =
18801                fidl::encoding::decode_envelope_header(decoder, next_offset)?
18802            {
18803                let member_inline_size =
18804                    <fidl_fuchsia_math::SizeU as fidl::encoding::TypeMarker>::inline_size(
18805                        decoder.context,
18806                    );
18807                if inlined != (member_inline_size <= 4) {
18808                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
18809                }
18810                let inner_offset;
18811                let mut inner_depth = depth.clone();
18812                if inlined {
18813                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
18814                    inner_offset = next_offset;
18815                } else {
18816                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
18817                    inner_depth.increment()?;
18818                }
18819                let val_ref = self.size.get_or_insert_with(|| {
18820                    fidl::new_empty!(
18821                        fidl_fuchsia_math::SizeU,
18822                        fidl::encoding::DefaultFuchsiaResourceDialect
18823                    )
18824                });
18825                fidl::decode!(
18826                    fidl_fuchsia_math::SizeU,
18827                    fidl::encoding::DefaultFuchsiaResourceDialect,
18828                    val_ref,
18829                    decoder,
18830                    inner_offset,
18831                    inner_depth
18832                )?;
18833                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
18834                {
18835                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
18836                }
18837                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
18838                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
18839                }
18840            }
18841
18842            next_offset += envelope_size;
18843
18844            // Decode the remaining unknown envelopes.
18845            while next_offset < end_offset {
18846                _next_ordinal_to_read += 1;
18847                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
18848                next_offset += envelope_size;
18849            }
18850
18851            Ok(())
18852        }
18853    }
18854
18855    impl TrustedFlatlandConfig {
18856        #[inline(always)]
18857        fn max_ordinal_present(&self) -> u64 {
18858            if let Some(_) = self.use_flatland2_api {
18859                return 5;
18860            }
18861            if let Some(_) = self.skips_on_frame_presented {
18862                return 4;
18863            }
18864            if let Some(_) = self.skips_present_credits {
18865                return 3;
18866            }
18867            if let Some(_) = self.pass_acquire_fences {
18868                return 2;
18869            }
18870            if let Some(_) = self.schedule_asap {
18871                return 1;
18872            }
18873            0
18874        }
18875    }
18876
18877    impl fidl::encoding::ResourceTypeMarker for TrustedFlatlandConfig {
18878        type Borrowed<'a> = &'a mut Self;
18879        fn take_or_borrow<'a>(
18880            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
18881        ) -> Self::Borrowed<'a> {
18882            value
18883        }
18884    }
18885
18886    unsafe impl fidl::encoding::TypeMarker for TrustedFlatlandConfig {
18887        type Owned = Self;
18888
18889        #[inline(always)]
18890        fn inline_align(_context: fidl::encoding::Context) -> usize {
18891            8
18892        }
18893
18894        #[inline(always)]
18895        fn inline_size(_context: fidl::encoding::Context) -> usize {
18896            16
18897        }
18898    }
18899
18900    unsafe impl
18901        fidl::encoding::Encode<TrustedFlatlandConfig, fidl::encoding::DefaultFuchsiaResourceDialect>
18902        for &mut TrustedFlatlandConfig
18903    {
18904        unsafe fn encode(
18905            self,
18906            encoder: &mut fidl::encoding::Encoder<
18907                '_,
18908                fidl::encoding::DefaultFuchsiaResourceDialect,
18909            >,
18910            offset: usize,
18911            mut depth: fidl::encoding::Depth,
18912        ) -> fidl::Result<()> {
18913            encoder.debug_check_bounds::<TrustedFlatlandConfig>(offset);
18914            // Vector header
18915            let max_ordinal: u64 = self.max_ordinal_present();
18916            encoder.write_num(max_ordinal, offset);
18917            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
18918            // Calling encoder.out_of_line_offset(0) is not allowed.
18919            if max_ordinal == 0 {
18920                return Ok(());
18921            }
18922            depth.increment()?;
18923            let envelope_size = 8;
18924            let bytes_len = max_ordinal as usize * envelope_size;
18925            #[allow(unused_variables)]
18926            let offset = encoder.out_of_line_offset(bytes_len);
18927            let mut _prev_end_offset: usize = 0;
18928            if 1 > max_ordinal {
18929                return Ok(());
18930            }
18931
18932            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
18933            // are envelope_size bytes.
18934            let cur_offset: usize = (1 - 1) * envelope_size;
18935
18936            // Zero reserved fields.
18937            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
18938
18939            // Safety:
18940            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
18941            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
18942            //   envelope_size bytes, there is always sufficient room.
18943            fidl::encoding::encode_in_envelope_optional::<
18944                bool,
18945                fidl::encoding::DefaultFuchsiaResourceDialect,
18946            >(
18947                self.schedule_asap.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
18948                encoder,
18949                offset + cur_offset,
18950                depth,
18951            )?;
18952
18953            _prev_end_offset = cur_offset + envelope_size;
18954            if 2 > max_ordinal {
18955                return Ok(());
18956            }
18957
18958            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
18959            // are envelope_size bytes.
18960            let cur_offset: usize = (2 - 1) * envelope_size;
18961
18962            // Zero reserved fields.
18963            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
18964
18965            // Safety:
18966            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
18967            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
18968            //   envelope_size bytes, there is always sufficient room.
18969            fidl::encoding::encode_in_envelope_optional::<
18970                bool,
18971                fidl::encoding::DefaultFuchsiaResourceDialect,
18972            >(
18973                self.pass_acquire_fences
18974                    .as_ref()
18975                    .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
18976                encoder,
18977                offset + cur_offset,
18978                depth,
18979            )?;
18980
18981            _prev_end_offset = cur_offset + envelope_size;
18982            if 3 > max_ordinal {
18983                return Ok(());
18984            }
18985
18986            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
18987            // are envelope_size bytes.
18988            let cur_offset: usize = (3 - 1) * envelope_size;
18989
18990            // Zero reserved fields.
18991            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
18992
18993            // Safety:
18994            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
18995            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
18996            //   envelope_size bytes, there is always sufficient room.
18997            fidl::encoding::encode_in_envelope_optional::<
18998                bool,
18999                fidl::encoding::DefaultFuchsiaResourceDialect,
19000            >(
19001                self.skips_present_credits
19002                    .as_ref()
19003                    .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
19004                encoder,
19005                offset + cur_offset,
19006                depth,
19007            )?;
19008
19009            _prev_end_offset = cur_offset + envelope_size;
19010            if 4 > max_ordinal {
19011                return Ok(());
19012            }
19013
19014            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
19015            // are envelope_size bytes.
19016            let cur_offset: usize = (4 - 1) * envelope_size;
19017
19018            // Zero reserved fields.
19019            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
19020
19021            // Safety:
19022            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
19023            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
19024            //   envelope_size bytes, there is always sufficient room.
19025            fidl::encoding::encode_in_envelope_optional::<
19026                bool,
19027                fidl::encoding::DefaultFuchsiaResourceDialect,
19028            >(
19029                self.skips_on_frame_presented
19030                    .as_ref()
19031                    .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
19032                encoder,
19033                offset + cur_offset,
19034                depth,
19035            )?;
19036
19037            _prev_end_offset = cur_offset + envelope_size;
19038            if 5 > max_ordinal {
19039                return Ok(());
19040            }
19041
19042            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
19043            // are envelope_size bytes.
19044            let cur_offset: usize = (5 - 1) * envelope_size;
19045
19046            // Zero reserved fields.
19047            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
19048
19049            // Safety:
19050            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
19051            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
19052            //   envelope_size bytes, there is always sufficient room.
19053            fidl::encoding::encode_in_envelope_optional::<
19054                bool,
19055                fidl::encoding::DefaultFuchsiaResourceDialect,
19056            >(
19057                self.use_flatland2_api
19058                    .as_ref()
19059                    .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
19060                encoder,
19061                offset + cur_offset,
19062                depth,
19063            )?;
19064
19065            _prev_end_offset = cur_offset + envelope_size;
19066
19067            Ok(())
19068        }
19069    }
19070
19071    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
19072        for TrustedFlatlandConfig
19073    {
19074        #[inline(always)]
19075        fn new_empty() -> Self {
19076            Self::default()
19077        }
19078
19079        unsafe fn decode(
19080            &mut self,
19081            decoder: &mut fidl::encoding::Decoder<
19082                '_,
19083                fidl::encoding::DefaultFuchsiaResourceDialect,
19084            >,
19085            offset: usize,
19086            mut depth: fidl::encoding::Depth,
19087        ) -> fidl::Result<()> {
19088            decoder.debug_check_bounds::<Self>(offset);
19089            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
19090                None => return Err(fidl::Error::NotNullable),
19091                Some(len) => len,
19092            };
19093            // Calling decoder.out_of_line_offset(0) is not allowed.
19094            if len == 0 {
19095                return Ok(());
19096            };
19097            depth.increment()?;
19098            let envelope_size = 8;
19099            let bytes_len = len * envelope_size;
19100            let offset = decoder.out_of_line_offset(bytes_len)?;
19101            // Decode the envelope for each type.
19102            let mut _next_ordinal_to_read = 0;
19103            let mut next_offset = offset;
19104            let end_offset = offset + bytes_len;
19105            _next_ordinal_to_read += 1;
19106            if next_offset >= end_offset {
19107                return Ok(());
19108            }
19109
19110            // Decode unknown envelopes for gaps in ordinals.
19111            while _next_ordinal_to_read < 1 {
19112                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
19113                _next_ordinal_to_read += 1;
19114                next_offset += envelope_size;
19115            }
19116
19117            let next_out_of_line = decoder.next_out_of_line();
19118            let handles_before = decoder.remaining_handles();
19119            if let Some((inlined, num_bytes, num_handles)) =
19120                fidl::encoding::decode_envelope_header(decoder, next_offset)?
19121            {
19122                let member_inline_size =
19123                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
19124                if inlined != (member_inline_size <= 4) {
19125                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
19126                }
19127                let inner_offset;
19128                let mut inner_depth = depth.clone();
19129                if inlined {
19130                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
19131                    inner_offset = next_offset;
19132                } else {
19133                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
19134                    inner_depth.increment()?;
19135                }
19136                let val_ref = self.schedule_asap.get_or_insert_with(|| {
19137                    fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
19138                });
19139                fidl::decode!(
19140                    bool,
19141                    fidl::encoding::DefaultFuchsiaResourceDialect,
19142                    val_ref,
19143                    decoder,
19144                    inner_offset,
19145                    inner_depth
19146                )?;
19147                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
19148                {
19149                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
19150                }
19151                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
19152                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
19153                }
19154            }
19155
19156            next_offset += envelope_size;
19157            _next_ordinal_to_read += 1;
19158            if next_offset >= end_offset {
19159                return Ok(());
19160            }
19161
19162            // Decode unknown envelopes for gaps in ordinals.
19163            while _next_ordinal_to_read < 2 {
19164                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
19165                _next_ordinal_to_read += 1;
19166                next_offset += envelope_size;
19167            }
19168
19169            let next_out_of_line = decoder.next_out_of_line();
19170            let handles_before = decoder.remaining_handles();
19171            if let Some((inlined, num_bytes, num_handles)) =
19172                fidl::encoding::decode_envelope_header(decoder, next_offset)?
19173            {
19174                let member_inline_size =
19175                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
19176                if inlined != (member_inline_size <= 4) {
19177                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
19178                }
19179                let inner_offset;
19180                let mut inner_depth = depth.clone();
19181                if inlined {
19182                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
19183                    inner_offset = next_offset;
19184                } else {
19185                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
19186                    inner_depth.increment()?;
19187                }
19188                let val_ref = self.pass_acquire_fences.get_or_insert_with(|| {
19189                    fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
19190                });
19191                fidl::decode!(
19192                    bool,
19193                    fidl::encoding::DefaultFuchsiaResourceDialect,
19194                    val_ref,
19195                    decoder,
19196                    inner_offset,
19197                    inner_depth
19198                )?;
19199                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
19200                {
19201                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
19202                }
19203                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
19204                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
19205                }
19206            }
19207
19208            next_offset += envelope_size;
19209            _next_ordinal_to_read += 1;
19210            if next_offset >= end_offset {
19211                return Ok(());
19212            }
19213
19214            // Decode unknown envelopes for gaps in ordinals.
19215            while _next_ordinal_to_read < 3 {
19216                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
19217                _next_ordinal_to_read += 1;
19218                next_offset += envelope_size;
19219            }
19220
19221            let next_out_of_line = decoder.next_out_of_line();
19222            let handles_before = decoder.remaining_handles();
19223            if let Some((inlined, num_bytes, num_handles)) =
19224                fidl::encoding::decode_envelope_header(decoder, next_offset)?
19225            {
19226                let member_inline_size =
19227                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
19228                if inlined != (member_inline_size <= 4) {
19229                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
19230                }
19231                let inner_offset;
19232                let mut inner_depth = depth.clone();
19233                if inlined {
19234                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
19235                    inner_offset = next_offset;
19236                } else {
19237                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
19238                    inner_depth.increment()?;
19239                }
19240                let val_ref = self.skips_present_credits.get_or_insert_with(|| {
19241                    fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
19242                });
19243                fidl::decode!(
19244                    bool,
19245                    fidl::encoding::DefaultFuchsiaResourceDialect,
19246                    val_ref,
19247                    decoder,
19248                    inner_offset,
19249                    inner_depth
19250                )?;
19251                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
19252                {
19253                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
19254                }
19255                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
19256                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
19257                }
19258            }
19259
19260            next_offset += envelope_size;
19261            _next_ordinal_to_read += 1;
19262            if next_offset >= end_offset {
19263                return Ok(());
19264            }
19265
19266            // Decode unknown envelopes for gaps in ordinals.
19267            while _next_ordinal_to_read < 4 {
19268                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
19269                _next_ordinal_to_read += 1;
19270                next_offset += envelope_size;
19271            }
19272
19273            let next_out_of_line = decoder.next_out_of_line();
19274            let handles_before = decoder.remaining_handles();
19275            if let Some((inlined, num_bytes, num_handles)) =
19276                fidl::encoding::decode_envelope_header(decoder, next_offset)?
19277            {
19278                let member_inline_size =
19279                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
19280                if inlined != (member_inline_size <= 4) {
19281                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
19282                }
19283                let inner_offset;
19284                let mut inner_depth = depth.clone();
19285                if inlined {
19286                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
19287                    inner_offset = next_offset;
19288                } else {
19289                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
19290                    inner_depth.increment()?;
19291                }
19292                let val_ref = self.skips_on_frame_presented.get_or_insert_with(|| {
19293                    fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
19294                });
19295                fidl::decode!(
19296                    bool,
19297                    fidl::encoding::DefaultFuchsiaResourceDialect,
19298                    val_ref,
19299                    decoder,
19300                    inner_offset,
19301                    inner_depth
19302                )?;
19303                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
19304                {
19305                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
19306                }
19307                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
19308                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
19309                }
19310            }
19311
19312            next_offset += envelope_size;
19313            _next_ordinal_to_read += 1;
19314            if next_offset >= end_offset {
19315                return Ok(());
19316            }
19317
19318            // Decode unknown envelopes for gaps in ordinals.
19319            while _next_ordinal_to_read < 5 {
19320                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
19321                _next_ordinal_to_read += 1;
19322                next_offset += envelope_size;
19323            }
19324
19325            let next_out_of_line = decoder.next_out_of_line();
19326            let handles_before = decoder.remaining_handles();
19327            if let Some((inlined, num_bytes, num_handles)) =
19328                fidl::encoding::decode_envelope_header(decoder, next_offset)?
19329            {
19330                let member_inline_size =
19331                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
19332                if inlined != (member_inline_size <= 4) {
19333                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
19334                }
19335                let inner_offset;
19336                let mut inner_depth = depth.clone();
19337                if inlined {
19338                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
19339                    inner_offset = next_offset;
19340                } else {
19341                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
19342                    inner_depth.increment()?;
19343                }
19344                let val_ref = self.use_flatland2_api.get_or_insert_with(|| {
19345                    fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
19346                });
19347                fidl::decode!(
19348                    bool,
19349                    fidl::encoding::DefaultFuchsiaResourceDialect,
19350                    val_ref,
19351                    decoder,
19352                    inner_offset,
19353                    inner_depth
19354                )?;
19355                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
19356                {
19357                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
19358                }
19359                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
19360                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
19361                }
19362            }
19363
19364            next_offset += envelope_size;
19365
19366            // Decode the remaining unknown envelopes.
19367            while next_offset < end_offset {
19368                _next_ordinal_to_read += 1;
19369                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
19370                next_offset += envelope_size;
19371            }
19372
19373            Ok(())
19374        }
19375    }
19376
19377    impl ViewBoundProtocols {
19378        #[inline(always)]
19379        fn max_ordinal_present(&self) -> u64 {
19380            if let Some(_) = self.mouse_source_v2 {
19381                return 6;
19382            }
19383            if let Some(_) = self.touch_source_v2 {
19384                return 5;
19385            }
19386            if let Some(_) = self.mouse_source {
19387                return 4;
19388            }
19389            if let Some(_) = self.touch_source {
19390                return 3;
19391            }
19392            if let Some(_) = self.view_focuser {
19393                return 2;
19394            }
19395            if let Some(_) = self.view_ref_focused {
19396                return 1;
19397            }
19398            0
19399        }
19400    }
19401
19402    impl fidl::encoding::ResourceTypeMarker for ViewBoundProtocols {
19403        type Borrowed<'a> = &'a mut Self;
19404        fn take_or_borrow<'a>(
19405            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
19406        ) -> Self::Borrowed<'a> {
19407            value
19408        }
19409    }
19410
19411    unsafe impl fidl::encoding::TypeMarker for ViewBoundProtocols {
19412        type Owned = Self;
19413
19414        #[inline(always)]
19415        fn inline_align(_context: fidl::encoding::Context) -> usize {
19416            8
19417        }
19418
19419        #[inline(always)]
19420        fn inline_size(_context: fidl::encoding::Context) -> usize {
19421            16
19422        }
19423    }
19424
19425    unsafe impl
19426        fidl::encoding::Encode<ViewBoundProtocols, fidl::encoding::DefaultFuchsiaResourceDialect>
19427        for &mut ViewBoundProtocols
19428    {
19429        unsafe fn encode(
19430            self,
19431            encoder: &mut fidl::encoding::Encoder<
19432                '_,
19433                fidl::encoding::DefaultFuchsiaResourceDialect,
19434            >,
19435            offset: usize,
19436            mut depth: fidl::encoding::Depth,
19437        ) -> fidl::Result<()> {
19438            encoder.debug_check_bounds::<ViewBoundProtocols>(offset);
19439            // Vector header
19440            let max_ordinal: u64 = self.max_ordinal_present();
19441            encoder.write_num(max_ordinal, offset);
19442            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
19443            // Calling encoder.out_of_line_offset(0) is not allowed.
19444            if max_ordinal == 0 {
19445                return Ok(());
19446            }
19447            depth.increment()?;
19448            let envelope_size = 8;
19449            let bytes_len = max_ordinal as usize * envelope_size;
19450            #[allow(unused_variables)]
19451            let offset = encoder.out_of_line_offset(bytes_len);
19452            let mut _prev_end_offset: usize = 0;
19453            if 1 > max_ordinal {
19454                return Ok(());
19455            }
19456
19457            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
19458            // are envelope_size bytes.
19459            let cur_offset: usize = (1 - 1) * envelope_size;
19460
19461            // Zero reserved fields.
19462            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
19463
19464            // Safety:
19465            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
19466            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
19467            //   envelope_size bytes, there is always sufficient room.
19468            fidl::encoding::encode_in_envelope_optional::<
19469                fidl::encoding::Endpoint<
19470                    fidl::endpoints::ServerEnd<fidl_fuchsia_ui_views::ViewRefFocusedMarker>,
19471                >,
19472                fidl::encoding::DefaultFuchsiaResourceDialect,
19473            >(
19474                self.view_ref_focused.as_mut().map(
19475                    <fidl::encoding::Endpoint<
19476                        fidl::endpoints::ServerEnd<fidl_fuchsia_ui_views::ViewRefFocusedMarker>,
19477                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
19478                ),
19479                encoder,
19480                offset + cur_offset,
19481                depth,
19482            )?;
19483
19484            _prev_end_offset = cur_offset + envelope_size;
19485            if 2 > max_ordinal {
19486                return Ok(());
19487            }
19488
19489            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
19490            // are envelope_size bytes.
19491            let cur_offset: usize = (2 - 1) * envelope_size;
19492
19493            // Zero reserved fields.
19494            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
19495
19496            // Safety:
19497            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
19498            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
19499            //   envelope_size bytes, there is always sufficient room.
19500            fidl::encoding::encode_in_envelope_optional::<
19501                fidl::encoding::Endpoint<
19502                    fidl::endpoints::ServerEnd<fidl_fuchsia_ui_views::FocuserMarker>,
19503                >,
19504                fidl::encoding::DefaultFuchsiaResourceDialect,
19505            >(
19506                self.view_focuser.as_mut().map(
19507                    <fidl::encoding::Endpoint<
19508                        fidl::endpoints::ServerEnd<fidl_fuchsia_ui_views::FocuserMarker>,
19509                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
19510                ),
19511                encoder,
19512                offset + cur_offset,
19513                depth,
19514            )?;
19515
19516            _prev_end_offset = cur_offset + envelope_size;
19517            if 3 > max_ordinal {
19518                return Ok(());
19519            }
19520
19521            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
19522            // are envelope_size bytes.
19523            let cur_offset: usize = (3 - 1) * envelope_size;
19524
19525            // Zero reserved fields.
19526            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
19527
19528            // Safety:
19529            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
19530            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
19531            //   envelope_size bytes, there is always sufficient room.
19532            fidl::encoding::encode_in_envelope_optional::<
19533                fidl::encoding::Endpoint<
19534                    fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::TouchSourceMarker>,
19535                >,
19536                fidl::encoding::DefaultFuchsiaResourceDialect,
19537            >(
19538                self.touch_source.as_mut().map(
19539                    <fidl::encoding::Endpoint<
19540                        fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::TouchSourceMarker>,
19541                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
19542                ),
19543                encoder,
19544                offset + cur_offset,
19545                depth,
19546            )?;
19547
19548            _prev_end_offset = cur_offset + envelope_size;
19549            if 4 > max_ordinal {
19550                return Ok(());
19551            }
19552
19553            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
19554            // are envelope_size bytes.
19555            let cur_offset: usize = (4 - 1) * envelope_size;
19556
19557            // Zero reserved fields.
19558            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
19559
19560            // Safety:
19561            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
19562            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
19563            //   envelope_size bytes, there is always sufficient room.
19564            fidl::encoding::encode_in_envelope_optional::<
19565                fidl::encoding::Endpoint<
19566                    fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::MouseSourceMarker>,
19567                >,
19568                fidl::encoding::DefaultFuchsiaResourceDialect,
19569            >(
19570                self.mouse_source.as_mut().map(
19571                    <fidl::encoding::Endpoint<
19572                        fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::MouseSourceMarker>,
19573                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
19574                ),
19575                encoder,
19576                offset + cur_offset,
19577                depth,
19578            )?;
19579
19580            _prev_end_offset = cur_offset + envelope_size;
19581            if 5 > max_ordinal {
19582                return Ok(());
19583            }
19584
19585            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
19586            // are envelope_size bytes.
19587            let cur_offset: usize = (5 - 1) * envelope_size;
19588
19589            // Zero reserved fields.
19590            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
19591
19592            // Safety:
19593            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
19594            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
19595            //   envelope_size bytes, there is always sufficient room.
19596            fidl::encoding::encode_in_envelope_optional::<
19597                fidl::encoding::Endpoint<
19598                    fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::TouchSourceV2Marker>,
19599                >,
19600                fidl::encoding::DefaultFuchsiaResourceDialect,
19601            >(
19602                self.touch_source_v2.as_mut().map(
19603                    <fidl::encoding::Endpoint<
19604                        fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::TouchSourceV2Marker>,
19605                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
19606                ),
19607                encoder,
19608                offset + cur_offset,
19609                depth,
19610            )?;
19611
19612            _prev_end_offset = cur_offset + envelope_size;
19613            if 6 > max_ordinal {
19614                return Ok(());
19615            }
19616
19617            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
19618            // are envelope_size bytes.
19619            let cur_offset: usize = (6 - 1) * envelope_size;
19620
19621            // Zero reserved fields.
19622            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
19623
19624            // Safety:
19625            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
19626            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
19627            //   envelope_size bytes, there is always sufficient room.
19628            fidl::encoding::encode_in_envelope_optional::<
19629                fidl::encoding::Endpoint<
19630                    fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::MouseSourceV2Marker>,
19631                >,
19632                fidl::encoding::DefaultFuchsiaResourceDialect,
19633            >(
19634                self.mouse_source_v2.as_mut().map(
19635                    <fidl::encoding::Endpoint<
19636                        fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::MouseSourceV2Marker>,
19637                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
19638                ),
19639                encoder,
19640                offset + cur_offset,
19641                depth,
19642            )?;
19643
19644            _prev_end_offset = cur_offset + envelope_size;
19645
19646            Ok(())
19647        }
19648    }
19649
19650    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
19651        for ViewBoundProtocols
19652    {
19653        #[inline(always)]
19654        fn new_empty() -> Self {
19655            Self::default()
19656        }
19657
19658        unsafe fn decode(
19659            &mut self,
19660            decoder: &mut fidl::encoding::Decoder<
19661                '_,
19662                fidl::encoding::DefaultFuchsiaResourceDialect,
19663            >,
19664            offset: usize,
19665            mut depth: fidl::encoding::Depth,
19666        ) -> fidl::Result<()> {
19667            decoder.debug_check_bounds::<Self>(offset);
19668            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
19669                None => return Err(fidl::Error::NotNullable),
19670                Some(len) => len,
19671            };
19672            // Calling decoder.out_of_line_offset(0) is not allowed.
19673            if len == 0 {
19674                return Ok(());
19675            };
19676            depth.increment()?;
19677            let envelope_size = 8;
19678            let bytes_len = len * envelope_size;
19679            let offset = decoder.out_of_line_offset(bytes_len)?;
19680            // Decode the envelope for each type.
19681            let mut _next_ordinal_to_read = 0;
19682            let mut next_offset = offset;
19683            let end_offset = offset + bytes_len;
19684            _next_ordinal_to_read += 1;
19685            if next_offset >= end_offset {
19686                return Ok(());
19687            }
19688
19689            // Decode unknown envelopes for gaps in ordinals.
19690            while _next_ordinal_to_read < 1 {
19691                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
19692                _next_ordinal_to_read += 1;
19693                next_offset += envelope_size;
19694            }
19695
19696            let next_out_of_line = decoder.next_out_of_line();
19697            let handles_before = decoder.remaining_handles();
19698            if let Some((inlined, num_bytes, num_handles)) =
19699                fidl::encoding::decode_envelope_header(decoder, next_offset)?
19700            {
19701                let member_inline_size = <fidl::encoding::Endpoint<
19702                    fidl::endpoints::ServerEnd<fidl_fuchsia_ui_views::ViewRefFocusedMarker>,
19703                > as fidl::encoding::TypeMarker>::inline_size(
19704                    decoder.context
19705                );
19706                if inlined != (member_inline_size <= 4) {
19707                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
19708                }
19709                let inner_offset;
19710                let mut inner_depth = depth.clone();
19711                if inlined {
19712                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
19713                    inner_offset = next_offset;
19714                } else {
19715                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
19716                    inner_depth.increment()?;
19717                }
19718                let val_ref = self.view_ref_focused.get_or_insert_with(|| {
19719                    fidl::new_empty!(
19720                        fidl::encoding::Endpoint<
19721                            fidl::endpoints::ServerEnd<fidl_fuchsia_ui_views::ViewRefFocusedMarker>,
19722                        >,
19723                        fidl::encoding::DefaultFuchsiaResourceDialect
19724                    )
19725                });
19726                fidl::decode!(
19727                    fidl::encoding::Endpoint<
19728                        fidl::endpoints::ServerEnd<fidl_fuchsia_ui_views::ViewRefFocusedMarker>,
19729                    >,
19730                    fidl::encoding::DefaultFuchsiaResourceDialect,
19731                    val_ref,
19732                    decoder,
19733                    inner_offset,
19734                    inner_depth
19735                )?;
19736                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
19737                {
19738                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
19739                }
19740                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
19741                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
19742                }
19743            }
19744
19745            next_offset += envelope_size;
19746            _next_ordinal_to_read += 1;
19747            if next_offset >= end_offset {
19748                return Ok(());
19749            }
19750
19751            // Decode unknown envelopes for gaps in ordinals.
19752            while _next_ordinal_to_read < 2 {
19753                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
19754                _next_ordinal_to_read += 1;
19755                next_offset += envelope_size;
19756            }
19757
19758            let next_out_of_line = decoder.next_out_of_line();
19759            let handles_before = decoder.remaining_handles();
19760            if let Some((inlined, num_bytes, num_handles)) =
19761                fidl::encoding::decode_envelope_header(decoder, next_offset)?
19762            {
19763                let member_inline_size = <fidl::encoding::Endpoint<
19764                    fidl::endpoints::ServerEnd<fidl_fuchsia_ui_views::FocuserMarker>,
19765                > as fidl::encoding::TypeMarker>::inline_size(
19766                    decoder.context
19767                );
19768                if inlined != (member_inline_size <= 4) {
19769                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
19770                }
19771                let inner_offset;
19772                let mut inner_depth = depth.clone();
19773                if inlined {
19774                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
19775                    inner_offset = next_offset;
19776                } else {
19777                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
19778                    inner_depth.increment()?;
19779                }
19780                let val_ref = self.view_focuser.get_or_insert_with(|| {
19781                    fidl::new_empty!(
19782                        fidl::encoding::Endpoint<
19783                            fidl::endpoints::ServerEnd<fidl_fuchsia_ui_views::FocuserMarker>,
19784                        >,
19785                        fidl::encoding::DefaultFuchsiaResourceDialect
19786                    )
19787                });
19788                fidl::decode!(
19789                    fidl::encoding::Endpoint<
19790                        fidl::endpoints::ServerEnd<fidl_fuchsia_ui_views::FocuserMarker>,
19791                    >,
19792                    fidl::encoding::DefaultFuchsiaResourceDialect,
19793                    val_ref,
19794                    decoder,
19795                    inner_offset,
19796                    inner_depth
19797                )?;
19798                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
19799                {
19800                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
19801                }
19802                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
19803                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
19804                }
19805            }
19806
19807            next_offset += envelope_size;
19808            _next_ordinal_to_read += 1;
19809            if next_offset >= end_offset {
19810                return Ok(());
19811            }
19812
19813            // Decode unknown envelopes for gaps in ordinals.
19814            while _next_ordinal_to_read < 3 {
19815                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
19816                _next_ordinal_to_read += 1;
19817                next_offset += envelope_size;
19818            }
19819
19820            let next_out_of_line = decoder.next_out_of_line();
19821            let handles_before = decoder.remaining_handles();
19822            if let Some((inlined, num_bytes, num_handles)) =
19823                fidl::encoding::decode_envelope_header(decoder, next_offset)?
19824            {
19825                let member_inline_size = <fidl::encoding::Endpoint<
19826                    fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::TouchSourceMarker>,
19827                > as fidl::encoding::TypeMarker>::inline_size(
19828                    decoder.context
19829                );
19830                if inlined != (member_inline_size <= 4) {
19831                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
19832                }
19833                let inner_offset;
19834                let mut inner_depth = depth.clone();
19835                if inlined {
19836                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
19837                    inner_offset = next_offset;
19838                } else {
19839                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
19840                    inner_depth.increment()?;
19841                }
19842                let val_ref = self.touch_source.get_or_insert_with(|| {
19843                    fidl::new_empty!(
19844                        fidl::encoding::Endpoint<
19845                            fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::TouchSourceMarker>,
19846                        >,
19847                        fidl::encoding::DefaultFuchsiaResourceDialect
19848                    )
19849                });
19850                fidl::decode!(
19851                    fidl::encoding::Endpoint<
19852                        fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::TouchSourceMarker>,
19853                    >,
19854                    fidl::encoding::DefaultFuchsiaResourceDialect,
19855                    val_ref,
19856                    decoder,
19857                    inner_offset,
19858                    inner_depth
19859                )?;
19860                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
19861                {
19862                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
19863                }
19864                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
19865                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
19866                }
19867            }
19868
19869            next_offset += envelope_size;
19870            _next_ordinal_to_read += 1;
19871            if next_offset >= end_offset {
19872                return Ok(());
19873            }
19874
19875            // Decode unknown envelopes for gaps in ordinals.
19876            while _next_ordinal_to_read < 4 {
19877                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
19878                _next_ordinal_to_read += 1;
19879                next_offset += envelope_size;
19880            }
19881
19882            let next_out_of_line = decoder.next_out_of_line();
19883            let handles_before = decoder.remaining_handles();
19884            if let Some((inlined, num_bytes, num_handles)) =
19885                fidl::encoding::decode_envelope_header(decoder, next_offset)?
19886            {
19887                let member_inline_size = <fidl::encoding::Endpoint<
19888                    fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::MouseSourceMarker>,
19889                > as fidl::encoding::TypeMarker>::inline_size(
19890                    decoder.context
19891                );
19892                if inlined != (member_inline_size <= 4) {
19893                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
19894                }
19895                let inner_offset;
19896                let mut inner_depth = depth.clone();
19897                if inlined {
19898                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
19899                    inner_offset = next_offset;
19900                } else {
19901                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
19902                    inner_depth.increment()?;
19903                }
19904                let val_ref = self.mouse_source.get_or_insert_with(|| {
19905                    fidl::new_empty!(
19906                        fidl::encoding::Endpoint<
19907                            fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::MouseSourceMarker>,
19908                        >,
19909                        fidl::encoding::DefaultFuchsiaResourceDialect
19910                    )
19911                });
19912                fidl::decode!(
19913                    fidl::encoding::Endpoint<
19914                        fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::MouseSourceMarker>,
19915                    >,
19916                    fidl::encoding::DefaultFuchsiaResourceDialect,
19917                    val_ref,
19918                    decoder,
19919                    inner_offset,
19920                    inner_depth
19921                )?;
19922                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
19923                {
19924                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
19925                }
19926                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
19927                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
19928                }
19929            }
19930
19931            next_offset += envelope_size;
19932            _next_ordinal_to_read += 1;
19933            if next_offset >= end_offset {
19934                return Ok(());
19935            }
19936
19937            // Decode unknown envelopes for gaps in ordinals.
19938            while _next_ordinal_to_read < 5 {
19939                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
19940                _next_ordinal_to_read += 1;
19941                next_offset += envelope_size;
19942            }
19943
19944            let next_out_of_line = decoder.next_out_of_line();
19945            let handles_before = decoder.remaining_handles();
19946            if let Some((inlined, num_bytes, num_handles)) =
19947                fidl::encoding::decode_envelope_header(decoder, next_offset)?
19948            {
19949                let member_inline_size = <fidl::encoding::Endpoint<
19950                    fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::TouchSourceV2Marker>,
19951                > as fidl::encoding::TypeMarker>::inline_size(
19952                    decoder.context
19953                );
19954                if inlined != (member_inline_size <= 4) {
19955                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
19956                }
19957                let inner_offset;
19958                let mut inner_depth = depth.clone();
19959                if inlined {
19960                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
19961                    inner_offset = next_offset;
19962                } else {
19963                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
19964                    inner_depth.increment()?;
19965                }
19966                let val_ref = self.touch_source_v2.get_or_insert_with(|| {
19967                    fidl::new_empty!(
19968                        fidl::encoding::Endpoint<
19969                            fidl::endpoints::ServerEnd<
19970                                fidl_fuchsia_ui_pointer::TouchSourceV2Marker,
19971                            >,
19972                        >,
19973                        fidl::encoding::DefaultFuchsiaResourceDialect
19974                    )
19975                });
19976                fidl::decode!(
19977                    fidl::encoding::Endpoint<
19978                        fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::TouchSourceV2Marker>,
19979                    >,
19980                    fidl::encoding::DefaultFuchsiaResourceDialect,
19981                    val_ref,
19982                    decoder,
19983                    inner_offset,
19984                    inner_depth
19985                )?;
19986                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
19987                {
19988                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
19989                }
19990                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
19991                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
19992                }
19993            }
19994
19995            next_offset += envelope_size;
19996            _next_ordinal_to_read += 1;
19997            if next_offset >= end_offset {
19998                return Ok(());
19999            }
20000
20001            // Decode unknown envelopes for gaps in ordinals.
20002            while _next_ordinal_to_read < 6 {
20003                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
20004                _next_ordinal_to_read += 1;
20005                next_offset += envelope_size;
20006            }
20007
20008            let next_out_of_line = decoder.next_out_of_line();
20009            let handles_before = decoder.remaining_handles();
20010            if let Some((inlined, num_bytes, num_handles)) =
20011                fidl::encoding::decode_envelope_header(decoder, next_offset)?
20012            {
20013                let member_inline_size = <fidl::encoding::Endpoint<
20014                    fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::MouseSourceV2Marker>,
20015                > as fidl::encoding::TypeMarker>::inline_size(
20016                    decoder.context
20017                );
20018                if inlined != (member_inline_size <= 4) {
20019                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
20020                }
20021                let inner_offset;
20022                let mut inner_depth = depth.clone();
20023                if inlined {
20024                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
20025                    inner_offset = next_offset;
20026                } else {
20027                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
20028                    inner_depth.increment()?;
20029                }
20030                let val_ref = self.mouse_source_v2.get_or_insert_with(|| {
20031                    fidl::new_empty!(
20032                        fidl::encoding::Endpoint<
20033                            fidl::endpoints::ServerEnd<
20034                                fidl_fuchsia_ui_pointer::MouseSourceV2Marker,
20035                            >,
20036                        >,
20037                        fidl::encoding::DefaultFuchsiaResourceDialect
20038                    )
20039                });
20040                fidl::decode!(
20041                    fidl::encoding::Endpoint<
20042                        fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::MouseSourceV2Marker>,
20043                    >,
20044                    fidl::encoding::DefaultFuchsiaResourceDialect,
20045                    val_ref,
20046                    decoder,
20047                    inner_offset,
20048                    inner_depth
20049                )?;
20050                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
20051                {
20052                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
20053                }
20054                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
20055                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
20056                }
20057            }
20058
20059            next_offset += envelope_size;
20060
20061            // Decode the remaining unknown envelopes.
20062            while next_offset < end_offset {
20063                _next_ordinal_to_read += 1;
20064                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
20065                next_offset += envelope_size;
20066            }
20067
20068            Ok(())
20069        }
20070    }
20071
20072    impl fidl::encoding::ResourceTypeMarker for SignalFence {
20073        type Borrowed<'a> = &'a mut Self;
20074        fn take_or_borrow<'a>(
20075            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
20076        ) -> Self::Borrowed<'a> {
20077            value
20078        }
20079    }
20080
20081    unsafe impl fidl::encoding::TypeMarker for SignalFence {
20082        type Owned = Self;
20083
20084        #[inline(always)]
20085        fn inline_align(_context: fidl::encoding::Context) -> usize {
20086            8
20087        }
20088
20089        #[inline(always)]
20090        fn inline_size(_context: fidl::encoding::Context) -> usize {
20091            16
20092        }
20093    }
20094
20095    unsafe impl fidl::encoding::Encode<SignalFence, fidl::encoding::DefaultFuchsiaResourceDialect>
20096        for &mut SignalFence
20097    {
20098        #[inline]
20099        unsafe fn encode(
20100            self,
20101            encoder: &mut fidl::encoding::Encoder<
20102                '_,
20103                fidl::encoding::DefaultFuchsiaResourceDialect,
20104            >,
20105            offset: usize,
20106            _depth: fidl::encoding::Depth,
20107        ) -> fidl::Result<()> {
20108            encoder.debug_check_bounds::<SignalFence>(offset);
20109            encoder.write_num::<u64>(self.ordinal(), offset);
20110            match self {
20111                SignalFence::Basic(ref mut val) => fidl::encoding::encode_in_envelope::<
20112                    fidl::encoding::HandleType<
20113                        fidl::NullableHandle,
20114                        { fidl::ObjectType::NONE.into_raw() },
20115                        2147483648,
20116                    >,
20117                    fidl::encoding::DefaultFuchsiaResourceDialect,
20118                >(
20119                    <fidl::encoding::HandleType<
20120                        fidl::NullableHandle,
20121                        { fidl::ObjectType::NONE.into_raw() },
20122                        2147483648,
20123                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
20124                        val
20125                    ),
20126                    encoder,
20127                    offset + 8,
20128                    _depth,
20129                ),
20130                SignalFence::Timestamp(ref mut val) => fidl::encoding::encode_in_envelope::<
20131                    fidl::encoding::HandleType<
20132                        fidl::Counter,
20133                        { fidl::ObjectType::COUNTER.into_raw() },
20134                        2147483648,
20135                    >,
20136                    fidl::encoding::DefaultFuchsiaResourceDialect,
20137                >(
20138                    <fidl::encoding::HandleType<
20139                        fidl::Counter,
20140                        { fidl::ObjectType::COUNTER.into_raw() },
20141                        2147483648,
20142                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
20143                        val
20144                    ),
20145                    encoder,
20146                    offset + 8,
20147                    _depth,
20148                ),
20149            }
20150        }
20151    }
20152
20153    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for SignalFence {
20154        #[inline(always)]
20155        fn new_empty() -> Self {
20156            Self::Basic(
20157                fidl::new_empty!(fidl::encoding::HandleType<fidl::NullableHandle, { fidl::ObjectType::NONE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
20158            )
20159        }
20160
20161        #[inline]
20162        unsafe fn decode(
20163            &mut self,
20164            decoder: &mut fidl::encoding::Decoder<
20165                '_,
20166                fidl::encoding::DefaultFuchsiaResourceDialect,
20167            >,
20168            offset: usize,
20169            mut depth: fidl::encoding::Depth,
20170        ) -> fidl::Result<()> {
20171            decoder.debug_check_bounds::<Self>(offset);
20172            #[allow(unused_variables)]
20173            let next_out_of_line = decoder.next_out_of_line();
20174            let handles_before = decoder.remaining_handles();
20175            let (ordinal, inlined, num_bytes, num_handles) =
20176                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
20177
20178            let member_inline_size = match ordinal {
20179                1 => <fidl::encoding::HandleType<
20180                    fidl::NullableHandle,
20181                    { fidl::ObjectType::NONE.into_raw() },
20182                    2147483648,
20183                > as fidl::encoding::TypeMarker>::inline_size(decoder.context),
20184                2 => <fidl::encoding::HandleType<
20185                    fidl::Counter,
20186                    { fidl::ObjectType::COUNTER.into_raw() },
20187                    2147483648,
20188                > as fidl::encoding::TypeMarker>::inline_size(decoder.context),
20189                _ => return Err(fidl::Error::UnknownUnionTag),
20190            };
20191
20192            if inlined != (member_inline_size <= 4) {
20193                return Err(fidl::Error::InvalidInlineBitInEnvelope);
20194            }
20195            let _inner_offset;
20196            if inlined {
20197                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
20198                _inner_offset = offset + 8;
20199            } else {
20200                depth.increment()?;
20201                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
20202            }
20203            match ordinal {
20204                1 => {
20205                    #[allow(irrefutable_let_patterns)]
20206                    if let SignalFence::Basic(_) = self {
20207                        // Do nothing, read the value into the object
20208                    } else {
20209                        // Initialize `self` to the right variant
20210                        *self = SignalFence::Basic(
20211                            fidl::new_empty!(fidl::encoding::HandleType<fidl::NullableHandle, { fidl::ObjectType::NONE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
20212                        );
20213                    }
20214                    #[allow(irrefutable_let_patterns)]
20215                    if let SignalFence::Basic(ref mut val) = self {
20216                        fidl::decode!(fidl::encoding::HandleType<fidl::NullableHandle, { fidl::ObjectType::NONE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val, decoder, _inner_offset, depth)?;
20217                    } else {
20218                        unreachable!()
20219                    }
20220                }
20221                2 => {
20222                    #[allow(irrefutable_let_patterns)]
20223                    if let SignalFence::Timestamp(_) = self {
20224                        // Do nothing, read the value into the object
20225                    } else {
20226                        // Initialize `self` to the right variant
20227                        *self = SignalFence::Timestamp(
20228                            fidl::new_empty!(fidl::encoding::HandleType<fidl::Counter, { fidl::ObjectType::COUNTER.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
20229                        );
20230                    }
20231                    #[allow(irrefutable_let_patterns)]
20232                    if let SignalFence::Timestamp(ref mut val) = self {
20233                        fidl::decode!(fidl::encoding::HandleType<fidl::Counter, { fidl::ObjectType::COUNTER.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val, decoder, _inner_offset, depth)?;
20234                    } else {
20235                        unreachable!()
20236                    }
20237                }
20238                ordinal => panic!("unexpected ordinal {:?}", ordinal),
20239            }
20240            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
20241                return Err(fidl::Error::InvalidNumBytesInEnvelope);
20242            }
20243            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
20244                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
20245            }
20246            Ok(())
20247        }
20248    }
20249
20250    impl fidl::encoding::ResourceTypeMarker for WaitFence {
20251        type Borrowed<'a> = &'a mut Self;
20252        fn take_or_borrow<'a>(
20253            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
20254        ) -> Self::Borrowed<'a> {
20255            value
20256        }
20257    }
20258
20259    unsafe impl fidl::encoding::TypeMarker for WaitFence {
20260        type Owned = Self;
20261
20262        #[inline(always)]
20263        fn inline_align(_context: fidl::encoding::Context) -> usize {
20264            8
20265        }
20266
20267        #[inline(always)]
20268        fn inline_size(_context: fidl::encoding::Context) -> usize {
20269            16
20270        }
20271    }
20272
20273    unsafe impl fidl::encoding::Encode<WaitFence, fidl::encoding::DefaultFuchsiaResourceDialect>
20274        for &mut WaitFence
20275    {
20276        #[inline]
20277        unsafe fn encode(
20278            self,
20279            encoder: &mut fidl::encoding::Encoder<
20280                '_,
20281                fidl::encoding::DefaultFuchsiaResourceDialect,
20282            >,
20283            offset: usize,
20284            _depth: fidl::encoding::Depth,
20285        ) -> fidl::Result<()> {
20286            encoder.debug_check_bounds::<WaitFence>(offset);
20287            encoder.write_num::<u64>(self.ordinal(), offset);
20288            match self {
20289                WaitFence::Basic(ref mut val) => fidl::encoding::encode_in_envelope::<
20290                    fidl::encoding::HandleType<
20291                        fidl::NullableHandle,
20292                        { fidl::ObjectType::NONE.into_raw() },
20293                        2147483648,
20294                    >,
20295                    fidl::encoding::DefaultFuchsiaResourceDialect,
20296                >(
20297                    <fidl::encoding::HandleType<
20298                        fidl::NullableHandle,
20299                        { fidl::ObjectType::NONE.into_raw() },
20300                        2147483648,
20301                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
20302                        val
20303                    ),
20304                    encoder,
20305                    offset + 8,
20306                    _depth,
20307                ),
20308                WaitFence::Timestamp(ref mut val) => fidl::encoding::encode_in_envelope::<
20309                    fidl::encoding::HandleType<
20310                        fidl::Counter,
20311                        { fidl::ObjectType::COUNTER.into_raw() },
20312                        2147483648,
20313                    >,
20314                    fidl::encoding::DefaultFuchsiaResourceDialect,
20315                >(
20316                    <fidl::encoding::HandleType<
20317                        fidl::Counter,
20318                        { fidl::ObjectType::COUNTER.into_raw() },
20319                        2147483648,
20320                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
20321                        val
20322                    ),
20323                    encoder,
20324                    offset + 8,
20325                    _depth,
20326                ),
20327            }
20328        }
20329    }
20330
20331    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for WaitFence {
20332        #[inline(always)]
20333        fn new_empty() -> Self {
20334            Self::Basic(
20335                fidl::new_empty!(fidl::encoding::HandleType<fidl::NullableHandle, { fidl::ObjectType::NONE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
20336            )
20337        }
20338
20339        #[inline]
20340        unsafe fn decode(
20341            &mut self,
20342            decoder: &mut fidl::encoding::Decoder<
20343                '_,
20344                fidl::encoding::DefaultFuchsiaResourceDialect,
20345            >,
20346            offset: usize,
20347            mut depth: fidl::encoding::Depth,
20348        ) -> fidl::Result<()> {
20349            decoder.debug_check_bounds::<Self>(offset);
20350            #[allow(unused_variables)]
20351            let next_out_of_line = decoder.next_out_of_line();
20352            let handles_before = decoder.remaining_handles();
20353            let (ordinal, inlined, num_bytes, num_handles) =
20354                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
20355
20356            let member_inline_size = match ordinal {
20357                1 => <fidl::encoding::HandleType<
20358                    fidl::NullableHandle,
20359                    { fidl::ObjectType::NONE.into_raw() },
20360                    2147483648,
20361                > as fidl::encoding::TypeMarker>::inline_size(decoder.context),
20362                2 => <fidl::encoding::HandleType<
20363                    fidl::Counter,
20364                    { fidl::ObjectType::COUNTER.into_raw() },
20365                    2147483648,
20366                > as fidl::encoding::TypeMarker>::inline_size(decoder.context),
20367                _ => return Err(fidl::Error::UnknownUnionTag),
20368            };
20369
20370            if inlined != (member_inline_size <= 4) {
20371                return Err(fidl::Error::InvalidInlineBitInEnvelope);
20372            }
20373            let _inner_offset;
20374            if inlined {
20375                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
20376                _inner_offset = offset + 8;
20377            } else {
20378                depth.increment()?;
20379                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
20380            }
20381            match ordinal {
20382                1 => {
20383                    #[allow(irrefutable_let_patterns)]
20384                    if let WaitFence::Basic(_) = self {
20385                        // Do nothing, read the value into the object
20386                    } else {
20387                        // Initialize `self` to the right variant
20388                        *self = WaitFence::Basic(
20389                            fidl::new_empty!(fidl::encoding::HandleType<fidl::NullableHandle, { fidl::ObjectType::NONE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
20390                        );
20391                    }
20392                    #[allow(irrefutable_let_patterns)]
20393                    if let WaitFence::Basic(ref mut val) = self {
20394                        fidl::decode!(fidl::encoding::HandleType<fidl::NullableHandle, { fidl::ObjectType::NONE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val, decoder, _inner_offset, depth)?;
20395                    } else {
20396                        unreachable!()
20397                    }
20398                }
20399                2 => {
20400                    #[allow(irrefutable_let_patterns)]
20401                    if let WaitFence::Timestamp(_) = self {
20402                        // Do nothing, read the value into the object
20403                    } else {
20404                        // Initialize `self` to the right variant
20405                        *self = WaitFence::Timestamp(
20406                            fidl::new_empty!(fidl::encoding::HandleType<fidl::Counter, { fidl::ObjectType::COUNTER.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
20407                        );
20408                    }
20409                    #[allow(irrefutable_let_patterns)]
20410                    if let WaitFence::Timestamp(ref mut val) = self {
20411                        fidl::decode!(fidl::encoding::HandleType<fidl::Counter, { fidl::ObjectType::COUNTER.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val, decoder, _inner_offset, depth)?;
20412                    } else {
20413                        unreachable!()
20414                    }
20415                }
20416                ordinal => panic!("unexpected ordinal {:?}", ordinal),
20417            }
20418            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
20419                return Err(fidl::Error::InvalidNumBytesInEnvelope);
20420            }
20421            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
20422                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
20423            }
20424            Ok(())
20425        }
20426    }
20427}