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, Eq, Hash, Ord, PartialEq, PartialOrd)]
58#[repr(C)]
59pub struct FlatlandCreateFilledRectRequest {
60    pub rect_id: ContentId,
61}
62
63impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
64    for FlatlandCreateFilledRectRequest
65{
66}
67
68#[derive(Debug, PartialEq)]
69pub struct FlatlandCreateImageRequest {
70    pub image_id: ContentId,
71    pub import_token: BufferCollectionImportToken,
72    pub vmo_index: u32,
73    pub properties: ImageProperties,
74}
75
76impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
77    for FlatlandCreateImageRequest
78{
79}
80
81#[derive(Debug, PartialEq)]
82pub struct FlatlandCreateView2Request {
83    /// A typed wrapper for a channel, representing the child endpoint of the connection
84    /// between two Flatland instances.
85    pub token: fidl_fuchsia_ui_views::ViewCreationToken,
86    /// The ViewRef to strongly associate with [`token`].
87    pub view_identity: fidl_fuchsia_ui_views::ViewIdentityOnCreation,
88    /// The protocol endpoints that are strongly bound to the ViewRef in [`view_identity`].
89    /// The protocols are bound when the view is created and installed in the view tree.
90    pub protocols: ViewBoundProtocols,
91    pub parent_viewport_watcher: fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>,
92}
93
94impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
95    for FlatlandCreateView2Request
96{
97}
98
99#[derive(Debug, PartialEq)]
100pub struct FlatlandCreateViewRequest {
101    pub token: fidl_fuchsia_ui_views::ViewCreationToken,
102    pub parent_viewport_watcher: fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>,
103}
104
105impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for FlatlandCreateViewRequest {}
106
107#[derive(Debug, PartialEq)]
108pub struct FlatlandCreateViewportRequest {
109    pub viewport_id: ContentId,
110    /// A typed wrapper for a channel, representing the parent endpoint of the connection
111    /// between two Flatland instances.
112    pub token: fidl_fuchsia_ui_views::ViewportCreationToken,
113    pub properties: ViewportProperties,
114    pub child_view_watcher: fidl::endpoints::ServerEnd<ChildViewWatcherMarker>,
115}
116
117impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
118    for FlatlandCreateViewportRequest
119{
120}
121
122#[derive(Debug, PartialEq)]
123pub struct FlatlandDisplaySetContentRequest {
124    pub token: fidl_fuchsia_ui_views::ViewportCreationToken,
125    pub child_view_watcher: fidl::endpoints::ServerEnd<ChildViewWatcherMarker>,
126}
127
128impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
129    for FlatlandDisplaySetContentRequest
130{
131}
132
133#[derive(Debug, PartialEq)]
134pub struct FlatlandPresentRequest {
135    pub args: PresentArgs,
136}
137
138impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for FlatlandPresentRequest {}
139
140#[derive(Debug, PartialEq)]
141pub struct FlatlandReleaseViewportResponse {
142    pub token: fidl_fuchsia_ui_views::ViewportCreationToken,
143}
144
145impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
146    for FlatlandReleaseViewportResponse
147{
148}
149
150#[derive(Debug, PartialEq)]
151pub struct FlatlandSetSolidFillRequest {
152    pub rect_id: ContentId,
153    pub color: ColorRgba,
154    pub size: fidl_fuchsia_math::SizeU,
155}
156
157impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
158    for FlatlandSetSolidFillRequest
159{
160}
161
162#[derive(Debug, PartialEq)]
163pub struct TrustedFlatlandFactoryCreateFlatlandRequest {
164    /// The server end of the `fuchsia.ui.composition.Flatland` protocol to be created.
165    pub server_end: fidl::endpoints::ServerEnd<FlatlandMarker>,
166    /// The configuration for the new Flatland instance. See `TrustedFlatlandConfig` for
167    /// details on available options.
168    pub config: TrustedFlatlandConfig,
169}
170
171impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
172    for TrustedFlatlandFactoryCreateFlatlandRequest
173{
174}
175
176/// Metadata about the frame rendered by [`GetNextFrame`].
177#[derive(Debug, Default, PartialEq)]
178pub struct FrameInfo {
179    /// The index of the VMO where the requested frame has been rendered. Required.
180    pub buffer_id: Option<u32>,
181    #[doc(hidden)]
182    pub __source_breaking: fidl::marker::SourceBreaking,
183}
184
185impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for FrameInfo {}
186
187/// The arguments passed into the [`GetNextFrame`] call. All fields are necessary.
188#[derive(Debug, Default, PartialEq)]
189pub struct GetNextFrameArgs {
190    /// The event that will signal when the requested frame has been rendered. Required.
191    pub event: Option<fidl::Event>,
192    #[doc(hidden)]
193    pub __source_breaking: fidl::marker::SourceBreaking,
194}
195
196impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for GetNextFrameArgs {}
197
198/// Arguments passed into [`Present`]. All arguments are optional, and if an
199/// argument is omitted Flatland will use a reasonable default, specified below.
200#[derive(Debug, Default, PartialEq)]
201pub struct PresentArgs {
202    /// `requested_presentation_time` specifies the time on or after which the client would like the
203    /// enqueued operations to take visible effect (light up pixels on the screen), expressed in
204    /// nanoseconds in the `CLOCK_MONOTONIC` timebase.
205    ///
206    /// The default `requested_presentation_time` is 0.
207    ///
208    /// Using a `requested_presentation_time` in the present or past (such as 0) schedules enqueued
209    /// operations to take visible effect as soon as possible, during the next frame to be prepared.
210    ///
211    /// Using a `requested_presentation_time` in the future schedules the enqueued operations to
212    /// take visible effect on or as closely as possible after the stated time, but no earlier.
213    ///
214    /// Each rendered frame has a target presentation time. This is when Flatland aims to have the
215    /// frame presented to the user. Before rendering a frame, Flatland applies all
216    /// enqueued operations associated with all squashable calls to [`Present`] whose
217    /// `requested_presentation_time` is on or before the frame's target presentation time.
218    pub requested_presentation_time: Option<i64>,
219    /// Flatland will wait until all of a Flatland instance's `acquire_fences` are ready before it
220    /// will execute the presented commands. Not signaling `acquire_fences` will block the current
221    /// [`Present`] as well as the following ones even if their `acquire_fences` are signaled.
222    ///
223    /// The default `acquire_fences` value is the empty vector.
224    pub acquire_fences: Option<Vec<fidl::Event>>,
225    /// Flatland will signal all `release_fences` when it is safe to reuse resources which no longer
226    /// appear in the local scene graph at the time of the current [`Present`].  At the latest, this
227    /// will happen when the local scene graph (checkpointed at this [`Present`]) has been
228    /// integrated into the global scene graph, and the global scene has been displayed on screen.
229    ///
230    /// (Under some circumstances, the fences may be signaled earlier, but clients do not need to
231    /// worry about this: the fences will only be signaled when it is safe to reuse the associated
232    /// resources).
233    ///
234    /// These fences are intended to manage the reuse of shared memory resources such as sysmem
235    /// buffers.  For example, it is undesirable for the client to render into an image which is
236    /// currently displayed on screen, because this may result in graphical artifacts such as
237    /// tearing.
238    ///
239    /// It is up to the client to maintain the mapping between each fence and the resources which
240    /// will become reusable when the fence is signaled.  A common strategy is to keep track of
241    /// resources which were used by the previous [`Present`] but are no longer used by the current
242    /// [`Present`].  For example, if an image is removed from the scene by the current [`Present`],
243    /// the client would insert a fence here.  When the fence is later signaled, the client knows
244    /// that it is safe to render into the image and insert it into the local scene graph in a
245    /// subsequent [`Present`].
246    ///
247    /// If an error occurs, Flatland may close the channel without signaling these fences.  Clients
248    /// may immediately release shared buffers, but they should not immediately modify such buffers,
249    /// because they may still be displayed on screen.  There is currently no good signal available
250    /// to the client about when it is safe to reuse shared buffers.
251    ///
252    /// The default `release_fences` value is the empty vector.
253    pub release_fences: Option<Vec<fidl::Event>>,
254    /// If `unsquashable` is true, then the update is guaranteed to be uniquely shown for at
255    /// least one vsync interval.
256    ///
257    /// If `unsquashable` is false, then the update can be combined with those that come after
258    /// it.
259    ///
260    /// If absent, `unsquashable` is false.
261    pub unsquashable: Option<bool>,
262    /// Flatland will signal all `present_fences` when the frame corresponding to this `Present`
263    /// is reported as displayed by the display hardware.  Additionally, each fence will have the
264    /// monotonic timestamp of the corresponding vsync written into it.
265    ///
266    /// The default `present_fences` value is the empty vector.
267    pub present_fences: Option<Vec<fidl::Counter>>,
268    /// Flatland will signal all `release_counters` when it is safe to reuse resources which no
269    /// longer appear in the local scene graph at the time of the current `Present` (i.e. resources
270    /// from the previous present). This is similar to `release_fences` but by using counters
271    /// instead of events, counters hold the monotonic timestamp of when resources became safe for
272    /// reuse. The event based `release_fences` can be used simultaneously with `release_counters`
273    /// for resources that don't care about this timestamp.
274    ///
275    /// The default `release_counters` value is the empty vector.
276    pub release_counters: Option<Vec<fidl::Counter>>,
277    #[doc(hidden)]
278    pub __source_breaking: fidl::marker::SourceBreaking,
279}
280
281impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for PresentArgs {}
282
283/// The table of arguments for [`RegisterBufferCollection`]. Note that some
284/// fields below are REQUIRED.
285#[derive(Debug, Default, PartialEq)]
286pub struct RegisterBufferCollectionArgs {
287    /// Clients can send [`export_token`] to register buffer collections with Allocator to be used
288    /// later in [`fuchsia.ui.composition/Flatland`] instances or other Scenic APIs, such as
289    /// Screenshot.
290    ///
291    /// For example, by passing a [`BufferCollectionImportToken`] containing the matching peer of
292    /// [`BufferCollectionExportToken`], they can create image resources via
293    /// [`fuchsia.ui.composition/Flatland.CreateImage`].
294    ///
295    /// Clients should wait for the response before using `import_token`.
296    ///
297    /// This field is REQUIRED.
298    pub export_token: Option<BufferCollectionExportToken>,
299    pub buffer_collection_token:
300        Option<fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem::BufferCollectionTokenMarker>>,
301    /// The client can register a buffer collection for various uses, each
302    /// coming with their own unique constraints.
303    ///
304    /// This field is OPTIONAL. If `usage` is omitted it will be treated as if
305    /// it has the DEFAULT option.
306    ///
307    /// # Deprecation
308    ///
309    /// This arg is deprecated at API version 9 with addition of |usages|.
310    ///
311    /// If both the `usages` and `usage` fields are set, `usages` takes precedence and `usage` is
312    /// ignored.
313    pub usage: Option<RegisterBufferCollectionUsage>,
314    /// The client can register a buffer collection for various uses and has the ability to
315    /// combine usages if multiple are needed.
316    ///
317    /// This field is OPTIONAL. If `usages` is omitted it will be treated as if
318    /// it has only the DEFAULT option.
319    pub usages: Option<RegisterBufferCollectionUsages>,
320    /// Flatland participates in the allocation of buffers by setting constraints on the
321    /// BufferCollection referenced by `buffer_collection_token`. It will not block on buffers
322    /// being allocated until the client creates content using the BufferCollection.
323    ///
324    /// The buffer collection registered with `export_token` is available and kept alive as long
325    /// as the client holds a valid [`BufferCollectionImportToken`]. They will be garbage collected
326    /// when all [`BufferCollectionImportToken`]s are closed and all the associated Image resources
327    /// are released.
328    ///
329    /// Exactly one of `buffer_collection_token2` / `buffer_collection_token` must be set.
330    pub buffer_collection_token2:
331        Option<fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem2::BufferCollectionTokenMarker>>,
332    #[doc(hidden)]
333    pub __source_breaking: fidl::marker::SourceBreaking,
334}
335
336impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
337    for RegisterBufferCollectionArgs
338{
339}
340
341/// The arguments passed into the [`Configure`] call. Note that not all fields are necessary.
342#[derive(Debug, Default, PartialEq)]
343pub struct ScreenCaptureConfig {
344    /// The import token referencing a BufferCollection registered with
345    /// Allocator. Required.
346    pub import_token: Option<BufferCollectionImportToken>,
347    /// The size of the image in pixels. Required.
348    pub size: Option<fidl_fuchsia_math::SizeU>,
349    /// The number of buffers in the BufferCollection. Required.
350    pub buffer_count: Option<u32>,
351    /// The rotation to be applied to the stream of images. Optional; if absent no rotation is
352    /// applied.
353    pub rotation: Option<Rotation>,
354    #[doc(hidden)]
355    pub __source_breaking: fidl::marker::SourceBreaking,
356}
357
358impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for ScreenCaptureConfig {}
359
360#[derive(Debug, Default, PartialEq)]
361pub struct ScreenshotTakeFileRequest {
362    /// Format of the requested screenshot.
363    pub format: Option<ScreenshotFormat>,
364    #[doc(hidden)]
365    pub __source_breaking: fidl::marker::SourceBreaking,
366}
367
368impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for ScreenshotTakeFileRequest {}
369
370#[derive(Debug, Default, PartialEq)]
371pub struct ScreenshotTakeFileResponse {
372    /// |fuchsia.io.File| channel used to read the generated screenshot file data.
373    /// The server side of the channel is stored on the device until ZX_CHANNEL_PEER_CLOSED
374    /// is detected.
375    ///
376    /// Basic usage: After the client recieves the client end of the file channel,
377    /// to avoid memory pile-ups, it should finish reading the data
378    /// before calling [`TakeFile`] again. When finished reading,
379    /// the client should call [`Close`] on the |fuchsia.io.File| channel, this will release
380    /// the memory allocated on the server side.
381    pub file: Option<fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>>,
382    /// Size of the screenshot in pixels.
383    pub size: Option<fidl_fuchsia_math::SizeU>,
384    #[doc(hidden)]
385    pub __source_breaking: fidl::marker::SourceBreaking,
386}
387
388impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
389    for ScreenshotTakeFileResponse
390{
391}
392
393#[derive(Debug, Default, PartialEq)]
394pub struct ScreenshotTakeRequest {
395    /// Format of the requested screenshot.
396    pub format: Option<ScreenshotFormat>,
397    #[doc(hidden)]
398    pub __source_breaking: fidl::marker::SourceBreaking,
399}
400
401impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for ScreenshotTakeRequest {}
402
403#[derive(Debug, Default, PartialEq)]
404pub struct ScreenshotTakeResponse {
405    /// CPU mappable read-only VMO that contains screenshot data. The server owns the VMO and
406    /// may reuse for the next [`Take`]. The VMO is guaranteed to be accessible after mapping.
407    /// In some allocations, VMO::read() might not be available, i.e. on emulator.
408    ///
409    /// Basic usage: After the client receives a VMO handle, to ensure data stability, it should
410    /// finish reading the VMO before calling [`Take`] again. When finished reading, the client
411    /// should drop the VMO handle.
412    ///
413    /// Advanced usage: To edit the data, or to persist it beyond the next [`Take`] call, the
414    /// client should copy the data to a private VMO.
415    pub vmo: Option<fidl::Vmo>,
416    /// Size of the screenshot in pixels.
417    pub size: Option<fidl_fuchsia_math::SizeU>,
418    #[doc(hidden)]
419    pub __source_breaking: fidl::marker::SourceBreaking,
420}
421
422impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for ScreenshotTakeResponse {}
423
424/// All arguments are optional; default values will be provided if they are absent.
425/// By default, the resulting Flatland will behave identically to connecting
426/// to the `fuchsia.ui.composition.Flatland` service instead of connecting via the factory.
427#[derive(Debug, Default, PartialEq)]
428pub struct TrustedFlatlandConfig {
429    /// If true and `requested_presentation_time` in [`fuchsia.ui.composition/Flatland.Present`] is
430    /// set to 0 or less than or equal to the nearest presentation time, a frame will be scheduled
431    /// to be presented as soon as all acquire fences are signaled, instead of waiting for other
432    /// clients to present within the same vsync. This allows the caller to decide when to wake up
433    /// for preparing a frame.
434    ///
435    /// If `requested_presentation_time` is set to a value greater than the nearest presentation
436    /// time, this flag will have no effect and the wakeup time decision will be made by the
437    /// scheduler.
438    ///
439    /// If absent, `schedule_asap` is false.
440    pub schedule_asap: Option<bool>,
441    /// If true, Scenic should pass acquire fences to the drivers for composition HW, instead of
442    /// waiting for them on CPU. This can improve performance by reducing CPU overhead.
443    ///
444    /// If absent, `pass_acquire_fences` is false.
445    pub pass_acquire_fences: Option<bool>,
446    /// If true, the client will not utilize Flatland's built in frame-scheduling mechanism and
447    /// will ignore present credits, instead relying on their own flow control system.
448    ///
449    /// If absent, `skips_present_credits` is false.
450    pub skips_present_credits: Option<bool>,
451    #[doc(hidden)]
452    pub __source_breaking: fidl::marker::SourceBreaking,
453}
454
455impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for TrustedFlatlandConfig {}
456
457/// The protocol endpoints bound to a Flatland ViewCreationToken. These protocols operate on the
458/// View that ViewCreationToken created in the Flatland session.
459#[derive(Debug, Default, PartialEq)]
460pub struct ViewBoundProtocols {
461    /// Learn when a View gains focus.
462    ///
463    /// Server-bound ViewRef. The [`view_ref_focused`] client does not specify the ViewRef
464    /// explicitly; instead, the server implementation uses the ViewRef used in View creation for
465    /// reporting focus movement on/off this View.
466    pub view_ref_focused:
467        Option<fidl::endpoints::ServerEnd<fidl_fuchsia_ui_views::ViewRefFocusedMarker>>,
468    /// Enable a View to request focus transfer to a child (target) View.
469    ///
470    /// Server-bound ViewRef. The [`view_focuser`] client does not specify the "requestor" ViewRef
471    /// explicitly, only the "target" ViewRef. Instead, the server implementation uses the ViewRef
472    /// used in View creation as the "requestor" ViewRef.
473    pub view_focuser: Option<fidl::endpoints::ServerEnd<fidl_fuchsia_ui_views::FocuserMarker>>,
474    /// Receive touch events that are associated with a View.
475    pub touch_source:
476        Option<fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::TouchSourceMarker>>,
477    /// Receive mouse events that are associated with a View.
478    pub mouse_source:
479        Option<fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::MouseSourceMarker>>,
480    #[doc(hidden)]
481    pub __source_breaking: fidl::marker::SourceBreaking,
482}
483
484impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for ViewBoundProtocols {}
485
486#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
487pub struct AllocatorMarker;
488
489impl fidl::endpoints::ProtocolMarker for AllocatorMarker {
490    type Proxy = AllocatorProxy;
491    type RequestStream = AllocatorRequestStream;
492    #[cfg(target_os = "fuchsia")]
493    type SynchronousProxy = AllocatorSynchronousProxy;
494
495    const DEBUG_NAME: &'static str = "fuchsia.ui.composition.Allocator";
496}
497impl fidl::endpoints::DiscoverableProtocolMarker for AllocatorMarker {}
498pub type AllocatorRegisterBufferCollectionResult = Result<(), RegisterBufferCollectionError>;
499
500pub trait AllocatorProxyInterface: Send + Sync {
501    type RegisterBufferCollectionResponseFut: std::future::Future<Output = Result<AllocatorRegisterBufferCollectionResult, fidl::Error>>
502        + Send;
503    fn r#register_buffer_collection(
504        &self,
505        args: RegisterBufferCollectionArgs,
506    ) -> Self::RegisterBufferCollectionResponseFut;
507}
508#[derive(Debug)]
509#[cfg(target_os = "fuchsia")]
510pub struct AllocatorSynchronousProxy {
511    client: fidl::client::sync::Client,
512}
513
514#[cfg(target_os = "fuchsia")]
515impl fidl::endpoints::SynchronousProxy for AllocatorSynchronousProxy {
516    type Proxy = AllocatorProxy;
517    type Protocol = AllocatorMarker;
518
519    fn from_channel(inner: fidl::Channel) -> Self {
520        Self::new(inner)
521    }
522
523    fn into_channel(self) -> fidl::Channel {
524        self.client.into_channel()
525    }
526
527    fn as_channel(&self) -> &fidl::Channel {
528        self.client.as_channel()
529    }
530}
531
532#[cfg(target_os = "fuchsia")]
533impl AllocatorSynchronousProxy {
534    pub fn new(channel: fidl::Channel) -> Self {
535        Self { client: fidl::client::sync::Client::new(channel) }
536    }
537
538    pub fn into_channel(self) -> fidl::Channel {
539        self.client.into_channel()
540    }
541
542    /// Waits until an event arrives and returns it. It is safe for other
543    /// threads to make concurrent requests while waiting for an event.
544    pub fn wait_for_event(
545        &self,
546        deadline: zx::MonotonicInstant,
547    ) -> Result<AllocatorEvent, fidl::Error> {
548        AllocatorEvent::decode(self.client.wait_for_event::<AllocatorMarker>(deadline)?)
549    }
550
551    /// A BufferCollection is a set of VMOs created by Sysmem and shared by a number of
552    /// participants, one of which is the Flatland Renderer. Some content, such as Images, use a
553    /// BufferCollection as their backing memory.
554    ///
555    /// See [`RegisterBufferCollectionArgs`] for information on each argument.
556    pub fn r#register_buffer_collection(
557        &self,
558        mut args: RegisterBufferCollectionArgs,
559        ___deadline: zx::MonotonicInstant,
560    ) -> Result<AllocatorRegisterBufferCollectionResult, fidl::Error> {
561        let _response = self
562            .client
563            .send_query::<AllocatorRegisterBufferCollectionRequest, fidl::encoding::ResultType<
564                fidl::encoding::EmptyStruct,
565                RegisterBufferCollectionError,
566            >, AllocatorMarker>(
567                (&mut args,),
568                0x494b7ea578d1061e,
569                fidl::encoding::DynamicFlags::empty(),
570                ___deadline,
571            )?;
572        Ok(_response.map(|x| x))
573    }
574}
575
576#[cfg(target_os = "fuchsia")]
577impl From<AllocatorSynchronousProxy> for zx::NullableHandle {
578    fn from(value: AllocatorSynchronousProxy) -> Self {
579        value.into_channel().into()
580    }
581}
582
583#[cfg(target_os = "fuchsia")]
584impl From<fidl::Channel> for AllocatorSynchronousProxy {
585    fn from(value: fidl::Channel) -> Self {
586        Self::new(value)
587    }
588}
589
590#[cfg(target_os = "fuchsia")]
591impl fidl::endpoints::FromClient for AllocatorSynchronousProxy {
592    type Protocol = AllocatorMarker;
593
594    fn from_client(value: fidl::endpoints::ClientEnd<AllocatorMarker>) -> Self {
595        Self::new(value.into_channel())
596    }
597}
598
599#[derive(Debug, Clone)]
600pub struct AllocatorProxy {
601    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
602}
603
604impl fidl::endpoints::Proxy for AllocatorProxy {
605    type Protocol = AllocatorMarker;
606
607    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
608        Self::new(inner)
609    }
610
611    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
612        self.client.into_channel().map_err(|client| Self { client })
613    }
614
615    fn as_channel(&self) -> &::fidl::AsyncChannel {
616        self.client.as_channel()
617    }
618}
619
620impl AllocatorProxy {
621    /// Create a new Proxy for fuchsia.ui.composition/Allocator.
622    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
623        let protocol_name = <AllocatorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
624        Self { client: fidl::client::Client::new(channel, protocol_name) }
625    }
626
627    /// Get a Stream of events from the remote end of the protocol.
628    ///
629    /// # Panics
630    ///
631    /// Panics if the event stream was already taken.
632    pub fn take_event_stream(&self) -> AllocatorEventStream {
633        AllocatorEventStream { event_receiver: self.client.take_event_receiver() }
634    }
635
636    /// A BufferCollection is a set of VMOs created by Sysmem and shared by a number of
637    /// participants, one of which is the Flatland Renderer. Some content, such as Images, use a
638    /// BufferCollection as their backing memory.
639    ///
640    /// See [`RegisterBufferCollectionArgs`] for information on each argument.
641    pub fn r#register_buffer_collection(
642        &self,
643        mut args: RegisterBufferCollectionArgs,
644    ) -> fidl::client::QueryResponseFut<
645        AllocatorRegisterBufferCollectionResult,
646        fidl::encoding::DefaultFuchsiaResourceDialect,
647    > {
648        AllocatorProxyInterface::r#register_buffer_collection(self, args)
649    }
650}
651
652impl AllocatorProxyInterface for AllocatorProxy {
653    type RegisterBufferCollectionResponseFut = fidl::client::QueryResponseFut<
654        AllocatorRegisterBufferCollectionResult,
655        fidl::encoding::DefaultFuchsiaResourceDialect,
656    >;
657    fn r#register_buffer_collection(
658        &self,
659        mut args: RegisterBufferCollectionArgs,
660    ) -> Self::RegisterBufferCollectionResponseFut {
661        fn _decode(
662            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
663        ) -> Result<AllocatorRegisterBufferCollectionResult, fidl::Error> {
664            let _response = fidl::client::decode_transaction_body::<
665                fidl::encoding::ResultType<
666                    fidl::encoding::EmptyStruct,
667                    RegisterBufferCollectionError,
668                >,
669                fidl::encoding::DefaultFuchsiaResourceDialect,
670                0x494b7ea578d1061e,
671            >(_buf?)?;
672            Ok(_response.map(|x| x))
673        }
674        self.client.send_query_and_decode::<
675            AllocatorRegisterBufferCollectionRequest,
676            AllocatorRegisterBufferCollectionResult,
677        >(
678            (&mut args,),
679            0x494b7ea578d1061e,
680            fidl::encoding::DynamicFlags::empty(),
681            _decode,
682        )
683    }
684}
685
686pub struct AllocatorEventStream {
687    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
688}
689
690impl std::marker::Unpin for AllocatorEventStream {}
691
692impl futures::stream::FusedStream for AllocatorEventStream {
693    fn is_terminated(&self) -> bool {
694        self.event_receiver.is_terminated()
695    }
696}
697
698impl futures::Stream for AllocatorEventStream {
699    type Item = Result<AllocatorEvent, fidl::Error>;
700
701    fn poll_next(
702        mut self: std::pin::Pin<&mut Self>,
703        cx: &mut std::task::Context<'_>,
704    ) -> std::task::Poll<Option<Self::Item>> {
705        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
706            &mut self.event_receiver,
707            cx
708        )?) {
709            Some(buf) => std::task::Poll::Ready(Some(AllocatorEvent::decode(buf))),
710            None => std::task::Poll::Ready(None),
711        }
712    }
713}
714
715#[derive(Debug)]
716pub enum AllocatorEvent {}
717
718impl AllocatorEvent {
719    /// Decodes a message buffer as a [`AllocatorEvent`].
720    fn decode(
721        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
722    ) -> Result<AllocatorEvent, fidl::Error> {
723        let (bytes, _handles) = buf.split_mut();
724        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
725        debug_assert_eq!(tx_header.tx_id, 0);
726        match tx_header.ordinal {
727            _ => Err(fidl::Error::UnknownOrdinal {
728                ordinal: tx_header.ordinal,
729                protocol_name: <AllocatorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
730            }),
731        }
732    }
733}
734
735/// A Stream of incoming requests for fuchsia.ui.composition/Allocator.
736pub struct AllocatorRequestStream {
737    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
738    is_terminated: bool,
739}
740
741impl std::marker::Unpin for AllocatorRequestStream {}
742
743impl futures::stream::FusedStream for AllocatorRequestStream {
744    fn is_terminated(&self) -> bool {
745        self.is_terminated
746    }
747}
748
749impl fidl::endpoints::RequestStream for AllocatorRequestStream {
750    type Protocol = AllocatorMarker;
751    type ControlHandle = AllocatorControlHandle;
752
753    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
754        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
755    }
756
757    fn control_handle(&self) -> Self::ControlHandle {
758        AllocatorControlHandle { inner: self.inner.clone() }
759    }
760
761    fn into_inner(
762        self,
763    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
764    {
765        (self.inner, self.is_terminated)
766    }
767
768    fn from_inner(
769        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
770        is_terminated: bool,
771    ) -> Self {
772        Self { inner, is_terminated }
773    }
774}
775
776impl futures::Stream for AllocatorRequestStream {
777    type Item = Result<AllocatorRequest, fidl::Error>;
778
779    fn poll_next(
780        mut self: std::pin::Pin<&mut Self>,
781        cx: &mut std::task::Context<'_>,
782    ) -> std::task::Poll<Option<Self::Item>> {
783        let this = &mut *self;
784        if this.inner.check_shutdown(cx) {
785            this.is_terminated = true;
786            return std::task::Poll::Ready(None);
787        }
788        if this.is_terminated {
789            panic!("polled AllocatorRequestStream after completion");
790        }
791        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
792            |bytes, handles| {
793                match this.inner.channel().read_etc(cx, bytes, handles) {
794                    std::task::Poll::Ready(Ok(())) => {}
795                    std::task::Poll::Pending => return std::task::Poll::Pending,
796                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
797                        this.is_terminated = true;
798                        return std::task::Poll::Ready(None);
799                    }
800                    std::task::Poll::Ready(Err(e)) => {
801                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
802                            e.into(),
803                        ))));
804                    }
805                }
806
807                // A message has been received from the channel
808                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
809
810                std::task::Poll::Ready(Some(match header.ordinal {
811                    0x494b7ea578d1061e => {
812                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
813                        let mut req = fidl::new_empty!(
814                            AllocatorRegisterBufferCollectionRequest,
815                            fidl::encoding::DefaultFuchsiaResourceDialect
816                        );
817                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AllocatorRegisterBufferCollectionRequest>(&header, _body_bytes, handles, &mut req)?;
818                        let control_handle = AllocatorControlHandle { inner: this.inner.clone() };
819                        Ok(AllocatorRequest::RegisterBufferCollection {
820                            args: req.args,
821
822                            responder: AllocatorRegisterBufferCollectionResponder {
823                                control_handle: std::mem::ManuallyDrop::new(control_handle),
824                                tx_id: header.tx_id,
825                            },
826                        })
827                    }
828                    _ => Err(fidl::Error::UnknownOrdinal {
829                        ordinal: header.ordinal,
830                        protocol_name:
831                            <AllocatorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
832                    }),
833                }))
834            },
835        )
836    }
837}
838
839#[derive(Debug)]
840pub enum AllocatorRequest {
841    /// A BufferCollection is a set of VMOs created by Sysmem and shared by a number of
842    /// participants, one of which is the Flatland Renderer. Some content, such as Images, use a
843    /// BufferCollection as their backing memory.
844    ///
845    /// See [`RegisterBufferCollectionArgs`] for information on each argument.
846    RegisterBufferCollection {
847        args: RegisterBufferCollectionArgs,
848        responder: AllocatorRegisterBufferCollectionResponder,
849    },
850}
851
852impl AllocatorRequest {
853    #[allow(irrefutable_let_patterns)]
854    pub fn into_register_buffer_collection(
855        self,
856    ) -> Option<(RegisterBufferCollectionArgs, AllocatorRegisterBufferCollectionResponder)> {
857        if let AllocatorRequest::RegisterBufferCollection { args, responder } = self {
858            Some((args, responder))
859        } else {
860            None
861        }
862    }
863
864    /// Name of the method defined in FIDL
865    pub fn method_name(&self) -> &'static str {
866        match *self {
867            AllocatorRequest::RegisterBufferCollection { .. } => "register_buffer_collection",
868        }
869    }
870}
871
872#[derive(Debug, Clone)]
873pub struct AllocatorControlHandle {
874    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
875}
876
877impl fidl::endpoints::ControlHandle for AllocatorControlHandle {
878    fn shutdown(&self) {
879        self.inner.shutdown()
880    }
881
882    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
883        self.inner.shutdown_with_epitaph(status)
884    }
885
886    fn is_closed(&self) -> bool {
887        self.inner.channel().is_closed()
888    }
889    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
890        self.inner.channel().on_closed()
891    }
892
893    #[cfg(target_os = "fuchsia")]
894    fn signal_peer(
895        &self,
896        clear_mask: zx::Signals,
897        set_mask: zx::Signals,
898    ) -> Result<(), zx_status::Status> {
899        use fidl::Peered;
900        self.inner.channel().signal_peer(clear_mask, set_mask)
901    }
902}
903
904impl AllocatorControlHandle {}
905
906#[must_use = "FIDL methods require a response to be sent"]
907#[derive(Debug)]
908pub struct AllocatorRegisterBufferCollectionResponder {
909    control_handle: std::mem::ManuallyDrop<AllocatorControlHandle>,
910    tx_id: u32,
911}
912
913/// Set the the channel to be shutdown (see [`AllocatorControlHandle::shutdown`])
914/// if the responder is dropped without sending a response, so that the client
915/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
916impl std::ops::Drop for AllocatorRegisterBufferCollectionResponder {
917    fn drop(&mut self) {
918        self.control_handle.shutdown();
919        // Safety: drops once, never accessed again
920        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
921    }
922}
923
924impl fidl::endpoints::Responder for AllocatorRegisterBufferCollectionResponder {
925    type ControlHandle = AllocatorControlHandle;
926
927    fn control_handle(&self) -> &AllocatorControlHandle {
928        &self.control_handle
929    }
930
931    fn drop_without_shutdown(mut self) {
932        // Safety: drops once, never accessed again due to mem::forget
933        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
934        // Prevent Drop from running (which would shut down the channel)
935        std::mem::forget(self);
936    }
937}
938
939impl AllocatorRegisterBufferCollectionResponder {
940    /// Sends a response to the FIDL transaction.
941    ///
942    /// Sets the channel to shutdown if an error occurs.
943    pub fn send(
944        self,
945        mut result: Result<(), RegisterBufferCollectionError>,
946    ) -> Result<(), fidl::Error> {
947        let _result = self.send_raw(result);
948        if _result.is_err() {
949            self.control_handle.shutdown();
950        }
951        self.drop_without_shutdown();
952        _result
953    }
954
955    /// Similar to "send" but does not shutdown the channel if an error occurs.
956    pub fn send_no_shutdown_on_err(
957        self,
958        mut result: Result<(), RegisterBufferCollectionError>,
959    ) -> Result<(), fidl::Error> {
960        let _result = self.send_raw(result);
961        self.drop_without_shutdown();
962        _result
963    }
964
965    fn send_raw(
966        &self,
967        mut result: Result<(), RegisterBufferCollectionError>,
968    ) -> Result<(), fidl::Error> {
969        self.control_handle.inner.send::<fidl::encoding::ResultType<
970            fidl::encoding::EmptyStruct,
971            RegisterBufferCollectionError,
972        >>(
973            result,
974            self.tx_id,
975            0x494b7ea578d1061e,
976            fidl::encoding::DynamicFlags::empty(),
977        )
978    }
979}
980
981#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
982pub struct ChildViewWatcherMarker;
983
984impl fidl::endpoints::ProtocolMarker for ChildViewWatcherMarker {
985    type Proxy = ChildViewWatcherProxy;
986    type RequestStream = ChildViewWatcherRequestStream;
987    #[cfg(target_os = "fuchsia")]
988    type SynchronousProxy = ChildViewWatcherSynchronousProxy;
989
990    const DEBUG_NAME: &'static str = "(anonymous) ChildViewWatcher";
991}
992
993pub trait ChildViewWatcherProxyInterface: Send + Sync {
994    type GetStatusResponseFut: std::future::Future<Output = Result<ChildViewStatus, fidl::Error>>
995        + Send;
996    fn r#get_status(&self) -> Self::GetStatusResponseFut;
997    type GetViewRefResponseFut: std::future::Future<Output = Result<fidl_fuchsia_ui_views::ViewRef, fidl::Error>>
998        + Send;
999    fn r#get_view_ref(&self) -> Self::GetViewRefResponseFut;
1000}
1001#[derive(Debug)]
1002#[cfg(target_os = "fuchsia")]
1003pub struct ChildViewWatcherSynchronousProxy {
1004    client: fidl::client::sync::Client,
1005}
1006
1007#[cfg(target_os = "fuchsia")]
1008impl fidl::endpoints::SynchronousProxy for ChildViewWatcherSynchronousProxy {
1009    type Proxy = ChildViewWatcherProxy;
1010    type Protocol = ChildViewWatcherMarker;
1011
1012    fn from_channel(inner: fidl::Channel) -> Self {
1013        Self::new(inner)
1014    }
1015
1016    fn into_channel(self) -> fidl::Channel {
1017        self.client.into_channel()
1018    }
1019
1020    fn as_channel(&self) -> &fidl::Channel {
1021        self.client.as_channel()
1022    }
1023}
1024
1025#[cfg(target_os = "fuchsia")]
1026impl ChildViewWatcherSynchronousProxy {
1027    pub fn new(channel: fidl::Channel) -> Self {
1028        Self { client: fidl::client::sync::Client::new(channel) }
1029    }
1030
1031    pub fn into_channel(self) -> fidl::Channel {
1032        self.client.into_channel()
1033    }
1034
1035    /// Waits until an event arrives and returns it. It is safe for other
1036    /// threads to make concurrent requests while waiting for an event.
1037    pub fn wait_for_event(
1038        &self,
1039        deadline: zx::MonotonicInstant,
1040    ) -> Result<ChildViewWatcherEvent, fidl::Error> {
1041        ChildViewWatcherEvent::decode(
1042            self.client.wait_for_event::<ChildViewWatcherMarker>(deadline)?,
1043        )
1044    }
1045
1046    /// A hanging get for receiving the status of a View. This provides information to the parent,
1047    /// such as whether or not the child has successfully presented content through this View.
1048    ///
1049    /// This hanging get will only fire when the ChildViewStatus is different than the previously
1050    /// returned ChildViewStatus.  This can happen immediately, and even if the creator of the
1051    /// Viewport hasn't yet called Present() after calling CreateViewport().  This allows the parent
1052    /// to know that the child has content ready to display before the parent modifies their own
1053    /// local scene graph to incorporate the child content.
1054    ///
1055    /// It is invalid to call `GetStatus` while a previous call is still pending. Doing so will
1056    /// cause both this channel and the Flatland channel that handed out ChildViewWatcher to be
1057    /// closed.
1058    pub fn r#get_status(
1059        &self,
1060        ___deadline: zx::MonotonicInstant,
1061    ) -> Result<ChildViewStatus, fidl::Error> {
1062        let _response = self.client.send_query::<
1063            fidl::encoding::EmptyPayload,
1064            ChildViewWatcherGetStatusResponse,
1065            ChildViewWatcherMarker,
1066        >(
1067            (),
1068            0x1d622075f4fc8243,
1069            fidl::encoding::DynamicFlags::empty(),
1070            ___deadline,
1071        )?;
1072        Ok(_response.status)
1073    }
1074
1075    /// Hanging get to receive the ViewRef of the child View. This will only fire when the View ref
1076    /// is different from the previously-returned View ref. Note: currently the View ref will not
1077    /// change after it is first received, but this will change if/when the API changes to allow
1078    /// relinking of views.
1079    ///
1080    /// The ViewRef is not returned until the View is included in the View tree, in other words when
1081    /// there is a chain of ancestor transforms all the way back up to the root of the scene graph,
1082    /// i.e. the display.
1083    ///
1084    /// It is invalid to call `GetViewRef` while a previous call is still pending. Doing so will
1085    /// cause both this channel and the Flatland channel that handed out ChildViewWatcher to be
1086    /// closed.
1087    ///
1088    /// A `GetViewRef` call will hang if the View was created using `CreateView`, but returns the
1089    /// View if the View was created using CreateView2. This is because `CreateView` does not mint
1090    /// a ViewRef for that View.
1091    pub fn r#get_view_ref(
1092        &self,
1093        ___deadline: zx::MonotonicInstant,
1094    ) -> Result<fidl_fuchsia_ui_views::ViewRef, fidl::Error> {
1095        let _response = self.client.send_query::<
1096            fidl::encoding::EmptyPayload,
1097            ChildViewWatcherGetViewRefResponse,
1098            ChildViewWatcherMarker,
1099        >(
1100            (),
1101            0x3b2f3ca31e8908b4,
1102            fidl::encoding::DynamicFlags::empty(),
1103            ___deadline,
1104        )?;
1105        Ok(_response.view_ref)
1106    }
1107}
1108
1109#[cfg(target_os = "fuchsia")]
1110impl From<ChildViewWatcherSynchronousProxy> for zx::NullableHandle {
1111    fn from(value: ChildViewWatcherSynchronousProxy) -> Self {
1112        value.into_channel().into()
1113    }
1114}
1115
1116#[cfg(target_os = "fuchsia")]
1117impl From<fidl::Channel> for ChildViewWatcherSynchronousProxy {
1118    fn from(value: fidl::Channel) -> Self {
1119        Self::new(value)
1120    }
1121}
1122
1123#[cfg(target_os = "fuchsia")]
1124impl fidl::endpoints::FromClient for ChildViewWatcherSynchronousProxy {
1125    type Protocol = ChildViewWatcherMarker;
1126
1127    fn from_client(value: fidl::endpoints::ClientEnd<ChildViewWatcherMarker>) -> Self {
1128        Self::new(value.into_channel())
1129    }
1130}
1131
1132#[derive(Debug, Clone)]
1133pub struct ChildViewWatcherProxy {
1134    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1135}
1136
1137impl fidl::endpoints::Proxy for ChildViewWatcherProxy {
1138    type Protocol = ChildViewWatcherMarker;
1139
1140    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1141        Self::new(inner)
1142    }
1143
1144    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1145        self.client.into_channel().map_err(|client| Self { client })
1146    }
1147
1148    fn as_channel(&self) -> &::fidl::AsyncChannel {
1149        self.client.as_channel()
1150    }
1151}
1152
1153impl ChildViewWatcherProxy {
1154    /// Create a new Proxy for fuchsia.ui.composition/ChildViewWatcher.
1155    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1156        let protocol_name = <ChildViewWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1157        Self { client: fidl::client::Client::new(channel, protocol_name) }
1158    }
1159
1160    /// Get a Stream of events from the remote end of the protocol.
1161    ///
1162    /// # Panics
1163    ///
1164    /// Panics if the event stream was already taken.
1165    pub fn take_event_stream(&self) -> ChildViewWatcherEventStream {
1166        ChildViewWatcherEventStream { event_receiver: self.client.take_event_receiver() }
1167    }
1168
1169    /// A hanging get for receiving the status of a View. This provides information to the parent,
1170    /// such as whether or not the child has successfully presented content through this View.
1171    ///
1172    /// This hanging get will only fire when the ChildViewStatus is different than the previously
1173    /// returned ChildViewStatus.  This can happen immediately, and even if the creator of the
1174    /// Viewport hasn't yet called Present() after calling CreateViewport().  This allows the parent
1175    /// to know that the child has content ready to display before the parent modifies their own
1176    /// local scene graph to incorporate the child content.
1177    ///
1178    /// It is invalid to call `GetStatus` while a previous call is still pending. Doing so will
1179    /// cause both this channel and the Flatland channel that handed out ChildViewWatcher to be
1180    /// closed.
1181    pub fn r#get_status(
1182        &self,
1183    ) -> fidl::client::QueryResponseFut<
1184        ChildViewStatus,
1185        fidl::encoding::DefaultFuchsiaResourceDialect,
1186    > {
1187        ChildViewWatcherProxyInterface::r#get_status(self)
1188    }
1189
1190    /// Hanging get to receive the ViewRef of the child View. This will only fire when the View ref
1191    /// is different from the previously-returned View ref. Note: currently the View ref will not
1192    /// change after it is first received, but this will change if/when the API changes to allow
1193    /// relinking of views.
1194    ///
1195    /// The ViewRef is not returned until the View is included in the View tree, in other words when
1196    /// there is a chain of ancestor transforms all the way back up to the root of the scene graph,
1197    /// i.e. the display.
1198    ///
1199    /// It is invalid to call `GetViewRef` while a previous call is still pending. Doing so will
1200    /// cause both this channel and the Flatland channel that handed out ChildViewWatcher to be
1201    /// closed.
1202    ///
1203    /// A `GetViewRef` call will hang if the View was created using `CreateView`, but returns the
1204    /// View if the View was created using CreateView2. This is because `CreateView` does not mint
1205    /// a ViewRef for that View.
1206    pub fn r#get_view_ref(
1207        &self,
1208    ) -> fidl::client::QueryResponseFut<
1209        fidl_fuchsia_ui_views::ViewRef,
1210        fidl::encoding::DefaultFuchsiaResourceDialect,
1211    > {
1212        ChildViewWatcherProxyInterface::r#get_view_ref(self)
1213    }
1214}
1215
1216impl ChildViewWatcherProxyInterface for ChildViewWatcherProxy {
1217    type GetStatusResponseFut = fidl::client::QueryResponseFut<
1218        ChildViewStatus,
1219        fidl::encoding::DefaultFuchsiaResourceDialect,
1220    >;
1221    fn r#get_status(&self) -> Self::GetStatusResponseFut {
1222        fn _decode(
1223            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1224        ) -> Result<ChildViewStatus, fidl::Error> {
1225            let _response = fidl::client::decode_transaction_body::<
1226                ChildViewWatcherGetStatusResponse,
1227                fidl::encoding::DefaultFuchsiaResourceDialect,
1228                0x1d622075f4fc8243,
1229            >(_buf?)?;
1230            Ok(_response.status)
1231        }
1232        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ChildViewStatus>(
1233            (),
1234            0x1d622075f4fc8243,
1235            fidl::encoding::DynamicFlags::empty(),
1236            _decode,
1237        )
1238    }
1239
1240    type GetViewRefResponseFut = fidl::client::QueryResponseFut<
1241        fidl_fuchsia_ui_views::ViewRef,
1242        fidl::encoding::DefaultFuchsiaResourceDialect,
1243    >;
1244    fn r#get_view_ref(&self) -> Self::GetViewRefResponseFut {
1245        fn _decode(
1246            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1247        ) -> Result<fidl_fuchsia_ui_views::ViewRef, fidl::Error> {
1248            let _response = fidl::client::decode_transaction_body::<
1249                ChildViewWatcherGetViewRefResponse,
1250                fidl::encoding::DefaultFuchsiaResourceDialect,
1251                0x3b2f3ca31e8908b4,
1252            >(_buf?)?;
1253            Ok(_response.view_ref)
1254        }
1255        self.client
1256            .send_query_and_decode::<fidl::encoding::EmptyPayload, fidl_fuchsia_ui_views::ViewRef>(
1257                (),
1258                0x3b2f3ca31e8908b4,
1259                fidl::encoding::DynamicFlags::empty(),
1260                _decode,
1261            )
1262    }
1263}
1264
1265pub struct ChildViewWatcherEventStream {
1266    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1267}
1268
1269impl std::marker::Unpin for ChildViewWatcherEventStream {}
1270
1271impl futures::stream::FusedStream for ChildViewWatcherEventStream {
1272    fn is_terminated(&self) -> bool {
1273        self.event_receiver.is_terminated()
1274    }
1275}
1276
1277impl futures::Stream for ChildViewWatcherEventStream {
1278    type Item = Result<ChildViewWatcherEvent, fidl::Error>;
1279
1280    fn poll_next(
1281        mut self: std::pin::Pin<&mut Self>,
1282        cx: &mut std::task::Context<'_>,
1283    ) -> std::task::Poll<Option<Self::Item>> {
1284        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1285            &mut self.event_receiver,
1286            cx
1287        )?) {
1288            Some(buf) => std::task::Poll::Ready(Some(ChildViewWatcherEvent::decode(buf))),
1289            None => std::task::Poll::Ready(None),
1290        }
1291    }
1292}
1293
1294#[derive(Debug)]
1295pub enum ChildViewWatcherEvent {}
1296
1297impl ChildViewWatcherEvent {
1298    /// Decodes a message buffer as a [`ChildViewWatcherEvent`].
1299    fn decode(
1300        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1301    ) -> Result<ChildViewWatcherEvent, fidl::Error> {
1302        let (bytes, _handles) = buf.split_mut();
1303        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1304        debug_assert_eq!(tx_header.tx_id, 0);
1305        match tx_header.ordinal {
1306            _ => Err(fidl::Error::UnknownOrdinal {
1307                ordinal: tx_header.ordinal,
1308                protocol_name:
1309                    <ChildViewWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1310            }),
1311        }
1312    }
1313}
1314
1315/// A Stream of incoming requests for fuchsia.ui.composition/ChildViewWatcher.
1316pub struct ChildViewWatcherRequestStream {
1317    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1318    is_terminated: bool,
1319}
1320
1321impl std::marker::Unpin for ChildViewWatcherRequestStream {}
1322
1323impl futures::stream::FusedStream for ChildViewWatcherRequestStream {
1324    fn is_terminated(&self) -> bool {
1325        self.is_terminated
1326    }
1327}
1328
1329impl fidl::endpoints::RequestStream for ChildViewWatcherRequestStream {
1330    type Protocol = ChildViewWatcherMarker;
1331    type ControlHandle = ChildViewWatcherControlHandle;
1332
1333    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1334        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1335    }
1336
1337    fn control_handle(&self) -> Self::ControlHandle {
1338        ChildViewWatcherControlHandle { inner: self.inner.clone() }
1339    }
1340
1341    fn into_inner(
1342        self,
1343    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1344    {
1345        (self.inner, self.is_terminated)
1346    }
1347
1348    fn from_inner(
1349        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1350        is_terminated: bool,
1351    ) -> Self {
1352        Self { inner, is_terminated }
1353    }
1354}
1355
1356impl futures::Stream for ChildViewWatcherRequestStream {
1357    type Item = Result<ChildViewWatcherRequest, fidl::Error>;
1358
1359    fn poll_next(
1360        mut self: std::pin::Pin<&mut Self>,
1361        cx: &mut std::task::Context<'_>,
1362    ) -> std::task::Poll<Option<Self::Item>> {
1363        let this = &mut *self;
1364        if this.inner.check_shutdown(cx) {
1365            this.is_terminated = true;
1366            return std::task::Poll::Ready(None);
1367        }
1368        if this.is_terminated {
1369            panic!("polled ChildViewWatcherRequestStream after completion");
1370        }
1371        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1372            |bytes, handles| {
1373                match this.inner.channel().read_etc(cx, bytes, handles) {
1374                    std::task::Poll::Ready(Ok(())) => {}
1375                    std::task::Poll::Pending => return std::task::Poll::Pending,
1376                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1377                        this.is_terminated = true;
1378                        return std::task::Poll::Ready(None);
1379                    }
1380                    std::task::Poll::Ready(Err(e)) => {
1381                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1382                            e.into(),
1383                        ))));
1384                    }
1385                }
1386
1387                // A message has been received from the channel
1388                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1389
1390                std::task::Poll::Ready(Some(match header.ordinal {
1391                    0x1d622075f4fc8243 => {
1392                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1393                        let mut req = fidl::new_empty!(
1394                            fidl::encoding::EmptyPayload,
1395                            fidl::encoding::DefaultFuchsiaResourceDialect
1396                        );
1397                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1398                        let control_handle =
1399                            ChildViewWatcherControlHandle { inner: this.inner.clone() };
1400                        Ok(ChildViewWatcherRequest::GetStatus {
1401                            responder: ChildViewWatcherGetStatusResponder {
1402                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1403                                tx_id: header.tx_id,
1404                            },
1405                        })
1406                    }
1407                    0x3b2f3ca31e8908b4 => {
1408                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1409                        let mut req = fidl::new_empty!(
1410                            fidl::encoding::EmptyPayload,
1411                            fidl::encoding::DefaultFuchsiaResourceDialect
1412                        );
1413                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1414                        let control_handle =
1415                            ChildViewWatcherControlHandle { inner: this.inner.clone() };
1416                        Ok(ChildViewWatcherRequest::GetViewRef {
1417                            responder: ChildViewWatcherGetViewRefResponder {
1418                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1419                                tx_id: header.tx_id,
1420                            },
1421                        })
1422                    }
1423                    _ => Err(fidl::Error::UnknownOrdinal {
1424                        ordinal: header.ordinal,
1425                        protocol_name:
1426                            <ChildViewWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1427                    }),
1428                }))
1429            },
1430        )
1431    }
1432}
1433
1434/// A protocol that provides information about a particular child View which is attached to the
1435/// Viewport owned by the parent client; connections to this protocol are estabished in
1436/// [`CreateViewport`].  Since a Flatland instance may contain any number of Viewports, each of
1437/// which may or may not be attached to a transform, the client can maintain connections to an
1438/// equal number of ChildViewWatcher instances.
1439///
1440/// Each ChildViewWatcher instance will remain connected as long as the corresponding child View
1441/// exists; the connection will also be closed if the child's ViewCreationToken is dropped without
1442/// using it to create a View.
1443#[derive(Debug)]
1444pub enum ChildViewWatcherRequest {
1445    /// A hanging get for receiving the status of a View. This provides information to the parent,
1446    /// such as whether or not the child has successfully presented content through this View.
1447    ///
1448    /// This hanging get will only fire when the ChildViewStatus is different than the previously
1449    /// returned ChildViewStatus.  This can happen immediately, and even if the creator of the
1450    /// Viewport hasn't yet called Present() after calling CreateViewport().  This allows the parent
1451    /// to know that the child has content ready to display before the parent modifies their own
1452    /// local scene graph to incorporate the child content.
1453    ///
1454    /// It is invalid to call `GetStatus` while a previous call is still pending. Doing so will
1455    /// cause both this channel and the Flatland channel that handed out ChildViewWatcher to be
1456    /// closed.
1457    GetStatus { responder: ChildViewWatcherGetStatusResponder },
1458    /// Hanging get to receive the ViewRef of the child View. This will only fire when the View ref
1459    /// is different from the previously-returned View ref. Note: currently the View ref will not
1460    /// change after it is first received, but this will change if/when the API changes to allow
1461    /// relinking of views.
1462    ///
1463    /// The ViewRef is not returned until the View is included in the View tree, in other words when
1464    /// there is a chain of ancestor transforms all the way back up to the root of the scene graph,
1465    /// i.e. the display.
1466    ///
1467    /// It is invalid to call `GetViewRef` while a previous call is still pending. Doing so will
1468    /// cause both this channel and the Flatland channel that handed out ChildViewWatcher to be
1469    /// closed.
1470    ///
1471    /// A `GetViewRef` call will hang if the View was created using `CreateView`, but returns the
1472    /// View if the View was created using CreateView2. This is because `CreateView` does not mint
1473    /// a ViewRef for that View.
1474    GetViewRef { responder: ChildViewWatcherGetViewRefResponder },
1475}
1476
1477impl ChildViewWatcherRequest {
1478    #[allow(irrefutable_let_patterns)]
1479    pub fn into_get_status(self) -> Option<(ChildViewWatcherGetStatusResponder)> {
1480        if let ChildViewWatcherRequest::GetStatus { responder } = self {
1481            Some((responder))
1482        } else {
1483            None
1484        }
1485    }
1486
1487    #[allow(irrefutable_let_patterns)]
1488    pub fn into_get_view_ref(self) -> Option<(ChildViewWatcherGetViewRefResponder)> {
1489        if let ChildViewWatcherRequest::GetViewRef { responder } = self {
1490            Some((responder))
1491        } else {
1492            None
1493        }
1494    }
1495
1496    /// Name of the method defined in FIDL
1497    pub fn method_name(&self) -> &'static str {
1498        match *self {
1499            ChildViewWatcherRequest::GetStatus { .. } => "get_status",
1500            ChildViewWatcherRequest::GetViewRef { .. } => "get_view_ref",
1501        }
1502    }
1503}
1504
1505#[derive(Debug, Clone)]
1506pub struct ChildViewWatcherControlHandle {
1507    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1508}
1509
1510impl fidl::endpoints::ControlHandle for ChildViewWatcherControlHandle {
1511    fn shutdown(&self) {
1512        self.inner.shutdown()
1513    }
1514
1515    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1516        self.inner.shutdown_with_epitaph(status)
1517    }
1518
1519    fn is_closed(&self) -> bool {
1520        self.inner.channel().is_closed()
1521    }
1522    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1523        self.inner.channel().on_closed()
1524    }
1525
1526    #[cfg(target_os = "fuchsia")]
1527    fn signal_peer(
1528        &self,
1529        clear_mask: zx::Signals,
1530        set_mask: zx::Signals,
1531    ) -> Result<(), zx_status::Status> {
1532        use fidl::Peered;
1533        self.inner.channel().signal_peer(clear_mask, set_mask)
1534    }
1535}
1536
1537impl ChildViewWatcherControlHandle {}
1538
1539#[must_use = "FIDL methods require a response to be sent"]
1540#[derive(Debug)]
1541pub struct ChildViewWatcherGetStatusResponder {
1542    control_handle: std::mem::ManuallyDrop<ChildViewWatcherControlHandle>,
1543    tx_id: u32,
1544}
1545
1546/// Set the the channel to be shutdown (see [`ChildViewWatcherControlHandle::shutdown`])
1547/// if the responder is dropped without sending a response, so that the client
1548/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1549impl std::ops::Drop for ChildViewWatcherGetStatusResponder {
1550    fn drop(&mut self) {
1551        self.control_handle.shutdown();
1552        // Safety: drops once, never accessed again
1553        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1554    }
1555}
1556
1557impl fidl::endpoints::Responder for ChildViewWatcherGetStatusResponder {
1558    type ControlHandle = ChildViewWatcherControlHandle;
1559
1560    fn control_handle(&self) -> &ChildViewWatcherControlHandle {
1561        &self.control_handle
1562    }
1563
1564    fn drop_without_shutdown(mut self) {
1565        // Safety: drops once, never accessed again due to mem::forget
1566        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1567        // Prevent Drop from running (which would shut down the channel)
1568        std::mem::forget(self);
1569    }
1570}
1571
1572impl ChildViewWatcherGetStatusResponder {
1573    /// Sends a response to the FIDL transaction.
1574    ///
1575    /// Sets the channel to shutdown if an error occurs.
1576    pub fn send(self, mut status: ChildViewStatus) -> Result<(), fidl::Error> {
1577        let _result = self.send_raw(status);
1578        if _result.is_err() {
1579            self.control_handle.shutdown();
1580        }
1581        self.drop_without_shutdown();
1582        _result
1583    }
1584
1585    /// Similar to "send" but does not shutdown the channel if an error occurs.
1586    pub fn send_no_shutdown_on_err(self, mut status: ChildViewStatus) -> Result<(), fidl::Error> {
1587        let _result = self.send_raw(status);
1588        self.drop_without_shutdown();
1589        _result
1590    }
1591
1592    fn send_raw(&self, mut status: ChildViewStatus) -> Result<(), fidl::Error> {
1593        self.control_handle.inner.send::<ChildViewWatcherGetStatusResponse>(
1594            (status,),
1595            self.tx_id,
1596            0x1d622075f4fc8243,
1597            fidl::encoding::DynamicFlags::empty(),
1598        )
1599    }
1600}
1601
1602#[must_use = "FIDL methods require a response to be sent"]
1603#[derive(Debug)]
1604pub struct ChildViewWatcherGetViewRefResponder {
1605    control_handle: std::mem::ManuallyDrop<ChildViewWatcherControlHandle>,
1606    tx_id: u32,
1607}
1608
1609/// Set the the channel to be shutdown (see [`ChildViewWatcherControlHandle::shutdown`])
1610/// if the responder is dropped without sending a response, so that the client
1611/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1612impl std::ops::Drop for ChildViewWatcherGetViewRefResponder {
1613    fn drop(&mut self) {
1614        self.control_handle.shutdown();
1615        // Safety: drops once, never accessed again
1616        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1617    }
1618}
1619
1620impl fidl::endpoints::Responder for ChildViewWatcherGetViewRefResponder {
1621    type ControlHandle = ChildViewWatcherControlHandle;
1622
1623    fn control_handle(&self) -> &ChildViewWatcherControlHandle {
1624        &self.control_handle
1625    }
1626
1627    fn drop_without_shutdown(mut self) {
1628        // Safety: drops once, never accessed again due to mem::forget
1629        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1630        // Prevent Drop from running (which would shut down the channel)
1631        std::mem::forget(self);
1632    }
1633}
1634
1635impl ChildViewWatcherGetViewRefResponder {
1636    /// Sends a response to the FIDL transaction.
1637    ///
1638    /// Sets the channel to shutdown if an error occurs.
1639    pub fn send(self, mut view_ref: fidl_fuchsia_ui_views::ViewRef) -> Result<(), fidl::Error> {
1640        let _result = self.send_raw(view_ref);
1641        if _result.is_err() {
1642            self.control_handle.shutdown();
1643        }
1644        self.drop_without_shutdown();
1645        _result
1646    }
1647
1648    /// Similar to "send" but does not shutdown the channel if an error occurs.
1649    pub fn send_no_shutdown_on_err(
1650        self,
1651        mut view_ref: fidl_fuchsia_ui_views::ViewRef,
1652    ) -> Result<(), fidl::Error> {
1653        let _result = self.send_raw(view_ref);
1654        self.drop_without_shutdown();
1655        _result
1656    }
1657
1658    fn send_raw(&self, mut view_ref: fidl_fuchsia_ui_views::ViewRef) -> Result<(), fidl::Error> {
1659        self.control_handle.inner.send::<ChildViewWatcherGetViewRefResponse>(
1660            (&mut view_ref,),
1661            self.tx_id,
1662            0x3b2f3ca31e8908b4,
1663            fidl::encoding::DynamicFlags::empty(),
1664        )
1665    }
1666}
1667
1668#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1669pub struct FlatlandMarker;
1670
1671impl fidl::endpoints::ProtocolMarker for FlatlandMarker {
1672    type Proxy = FlatlandProxy;
1673    type RequestStream = FlatlandRequestStream;
1674    #[cfg(target_os = "fuchsia")]
1675    type SynchronousProxy = FlatlandSynchronousProxy;
1676
1677    const DEBUG_NAME: &'static str = "fuchsia.ui.composition.Flatland";
1678}
1679impl fidl::endpoints::DiscoverableProtocolMarker for FlatlandMarker {}
1680
1681pub trait FlatlandProxyInterface: Send + Sync {
1682    fn r#release_image_immediately(&self, image_id: &ContentId) -> Result<(), fidl::Error>;
1683    fn r#present(&self, args: PresentArgs) -> Result<(), fidl::Error>;
1684    fn r#create_view(
1685        &self,
1686        token: fidl_fuchsia_ui_views::ViewCreationToken,
1687        parent_viewport_watcher: fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>,
1688    ) -> Result<(), fidl::Error>;
1689    fn r#create_view2(
1690        &self,
1691        token: fidl_fuchsia_ui_views::ViewCreationToken,
1692        view_identity: fidl_fuchsia_ui_views::ViewIdentityOnCreation,
1693        protocols: ViewBoundProtocols,
1694        parent_viewport_watcher: fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>,
1695    ) -> Result<(), fidl::Error>;
1696    fn r#create_transform(&self, transform_id: &TransformId) -> Result<(), fidl::Error>;
1697    fn r#set_translation(
1698        &self,
1699        transform_id: &TransformId,
1700        translation: &fidl_fuchsia_math::Vec_,
1701    ) -> Result<(), fidl::Error>;
1702    fn r#set_orientation(
1703        &self,
1704        transform_id: &TransformId,
1705        orientation: Orientation,
1706    ) -> Result<(), fidl::Error>;
1707    fn r#set_scale(
1708        &self,
1709        transform_id: &TransformId,
1710        scale: &fidl_fuchsia_math::VecF,
1711    ) -> Result<(), fidl::Error>;
1712    fn r#set_opacity(&self, transform_id: &TransformId, value: f32) -> Result<(), fidl::Error>;
1713    fn r#set_clip_boundary(
1714        &self,
1715        transform_id: &TransformId,
1716        rect: Option<&fidl_fuchsia_math::Rect>,
1717    ) -> Result<(), fidl::Error>;
1718    fn r#add_child(
1719        &self,
1720        parent_transform_id: &TransformId,
1721        child_transform_id: &TransformId,
1722    ) -> Result<(), fidl::Error>;
1723    fn r#remove_child(
1724        &self,
1725        parent_transform_id: &TransformId,
1726        child_transform_id: &TransformId,
1727    ) -> Result<(), fidl::Error>;
1728    fn r#replace_children(
1729        &self,
1730        parent_transform_id: &TransformId,
1731        new_child_transform_ids: &[TransformId],
1732    ) -> Result<(), fidl::Error>;
1733    fn r#set_root_transform(&self, transform_id: &TransformId) -> Result<(), fidl::Error>;
1734    fn r#set_hit_regions(
1735        &self,
1736        transform_id: &TransformId,
1737        regions: &[HitRegion],
1738    ) -> Result<(), fidl::Error>;
1739    fn r#set_infinite_hit_region(
1740        &self,
1741        transform_id: &TransformId,
1742        hit_test: HitTestInteraction,
1743    ) -> Result<(), fidl::Error>;
1744    fn r#create_viewport(
1745        &self,
1746        viewport_id: &ContentId,
1747        token: fidl_fuchsia_ui_views::ViewportCreationToken,
1748        properties: &ViewportProperties,
1749        child_view_watcher: fidl::endpoints::ServerEnd<ChildViewWatcherMarker>,
1750    ) -> Result<(), fidl::Error>;
1751    fn r#create_image(
1752        &self,
1753        image_id: &ContentId,
1754        import_token: BufferCollectionImportToken,
1755        vmo_index: u32,
1756        properties: &ImageProperties,
1757    ) -> Result<(), fidl::Error>;
1758    fn r#set_image_sample_region(
1759        &self,
1760        image_id: &ContentId,
1761        rect: &fidl_fuchsia_math::RectF,
1762    ) -> Result<(), fidl::Error>;
1763    fn r#set_image_destination_size(
1764        &self,
1765        image_id: &ContentId,
1766        size: &fidl_fuchsia_math::SizeU,
1767    ) -> Result<(), fidl::Error>;
1768    fn r#set_image_blending_function(
1769        &self,
1770        image_id: &ContentId,
1771        blend_mode: BlendMode,
1772    ) -> Result<(), fidl::Error>;
1773    fn r#set_image_blend_mode(
1774        &self,
1775        image_id: &ContentId,
1776        blend_mode: BlendMode2,
1777    ) -> Result<(), fidl::Error>;
1778    fn r#set_image_opacity(&self, image_id: &ContentId, val: f32) -> Result<(), fidl::Error>;
1779    fn r#set_image_flip(&self, image_id: &ContentId, flip: ImageFlip) -> Result<(), fidl::Error>;
1780    fn r#create_filled_rect(&self, rect_id: &ContentId) -> Result<(), fidl::Error>;
1781    fn r#set_solid_fill(
1782        &self,
1783        rect_id: &ContentId,
1784        color: &ColorRgba,
1785        size: &fidl_fuchsia_math::SizeU,
1786    ) -> Result<(), fidl::Error>;
1787    fn r#release_filled_rect(&self, rect_id: &ContentId) -> Result<(), fidl::Error>;
1788    fn r#set_content(
1789        &self,
1790        transform_id: &TransformId,
1791        content_id: &ContentId,
1792    ) -> Result<(), fidl::Error>;
1793    fn r#set_viewport_properties(
1794        &self,
1795        viewport_id: &ContentId,
1796        properties: &ViewportProperties,
1797    ) -> Result<(), fidl::Error>;
1798    fn r#release_transform(&self, transform_id: &TransformId) -> Result<(), fidl::Error>;
1799    fn r#release_view(&self) -> Result<(), fidl::Error>;
1800    type ReleaseViewportResponseFut: std::future::Future<
1801            Output = Result<fidl_fuchsia_ui_views::ViewportCreationToken, fidl::Error>,
1802        > + Send;
1803    fn r#release_viewport(&self, viewport_id: &ContentId) -> Self::ReleaseViewportResponseFut;
1804    fn r#release_image(&self, image_id: &ContentId) -> Result<(), fidl::Error>;
1805    fn r#clear(&self) -> Result<(), fidl::Error>;
1806    fn r#set_debug_name(&self, name: &str) -> Result<(), fidl::Error>;
1807}
1808#[derive(Debug)]
1809#[cfg(target_os = "fuchsia")]
1810pub struct FlatlandSynchronousProxy {
1811    client: fidl::client::sync::Client,
1812}
1813
1814#[cfg(target_os = "fuchsia")]
1815impl fidl::endpoints::SynchronousProxy for FlatlandSynchronousProxy {
1816    type Proxy = FlatlandProxy;
1817    type Protocol = FlatlandMarker;
1818
1819    fn from_channel(inner: fidl::Channel) -> Self {
1820        Self::new(inner)
1821    }
1822
1823    fn into_channel(self) -> fidl::Channel {
1824        self.client.into_channel()
1825    }
1826
1827    fn as_channel(&self) -> &fidl::Channel {
1828        self.client.as_channel()
1829    }
1830}
1831
1832#[cfg(target_os = "fuchsia")]
1833impl FlatlandSynchronousProxy {
1834    pub fn new(channel: fidl::Channel) -> Self {
1835        Self { client: fidl::client::sync::Client::new(channel) }
1836    }
1837
1838    pub fn into_channel(self) -> fidl::Channel {
1839        self.client.into_channel()
1840    }
1841
1842    /// Waits until an event arrives and returns it. It is safe for other
1843    /// threads to make concurrent requests while waiting for an event.
1844    pub fn wait_for_event(
1845        &self,
1846        deadline: zx::MonotonicInstant,
1847    ) -> Result<FlatlandEvent, fidl::Error> {
1848        FlatlandEvent::decode(self.client.wait_for_event::<FlatlandMarker>(deadline)?)
1849    }
1850
1851    /// Releases an image immediately, without waiting for the next present.
1852    pub fn r#release_image_immediately(&self, mut image_id: &ContentId) -> Result<(), fidl::Error> {
1853        self.client.send::<TrustedFlatlandReleaseImageImmediatelyRequest>(
1854            (image_id,),
1855            0x245e1ac080772c8,
1856            fidl::encoding::DynamicFlags::empty(),
1857        )
1858    }
1859
1860    /// Complete execution of all feed-forward operations.
1861    ///
1862    /// If executing an operation produces an error (e.g., CreateTransform(0)), an [`OnError`] event
1863    /// is emitted. Operations that produce errors are ignored and the channel is closed.
1864    ///
1865    /// If the execution is completed successfully, [`OnNextFrameBegin`] emits NO_ERROR along
1866    /// with other valid fields.
1867    ///
1868    /// The client may only call [`Present`] when they have a non-zero number of present credits,
1869    /// which are tracked by the server. The server may increment the number of credits when it
1870    /// fires the [`OnNextFrameBegin`] event, which informs the client when it receives additional
1871    /// present credits. Each [`Present`] call uses one present credit and decrements the server
1872    /// count by one. If the client calls [`Present`] with no present credits, the server will
1873    /// return a `NO_PRESENTS_REMAINING` error.
1874    ///
1875    /// The client should assume that prior to receiving any [`OnNextFrameBegin`] events, they have
1876    /// one present credit.
1877    ///
1878    /// Every [`Present`] call results in one [`OnNextFrameBegin`] event, and one
1879    /// [`OnFramePresented`] event, typically in that order.
1880    ///
1881    /// When the commands flushed by [`Present`] make it to display, an [`OnFramePresented`] event
1882    /// is fired. This event includes information pertaining to all [`Present`]s that had content
1883    /// that were part of that frame.
1884    ///
1885    /// See [`fuchsia.ui.composition/PresentArgs`] documentation above for more detailed information
1886    /// on what arguments are passed in and their role.
1887    pub fn r#present(&self, mut args: PresentArgs) -> Result<(), fidl::Error> {
1888        self.client.send::<FlatlandPresentRequest>(
1889            (&mut args,),
1890            0x50acc2aa1f0acec7,
1891            fidl::encoding::DynamicFlags::empty(),
1892        )
1893    }
1894
1895    /// Two Flatland instances may be connected in a parent-child relationship. The parent endpoint
1896    /// is held in a Viewport, and the child endpoint is held in a View. The parent Flatland
1897    /// instance that creates a Viewport has control over how the child's View is integrated into
1898    /// its own View.
1899    ///
1900    /// The lifecycle of a parent-child connection starts with two endpoints of a channel object:
1901    /// a ViewportCreationToken and a ViewCreationToken. Out-of-band protocols pass the
1902    /// ViewportCreationToken to the parent, which calls [`CreateViewport`], and the
1903    /// ViewCreationToken to the child, which calls [`CreateView`].
1904    ///
1905    /// Only nodes connected to the Root Transform in this Flatland instance will be rendered into
1906    /// the parent's Viewport.
1907    ///
1908    /// Calling [`CreateView`] a second time will disconnect the Root Transform from the existing
1909    /// parent's Viewport, and attach it to a new parent's Viewport. In other words, each View can
1910    /// only have one parent.
1911    ///
1912    /// This function is queued, meaning that the Root Transform will not be attached to the
1913    /// parent Viewport until [`Present`] is called. However, clients will receive information
1914    /// through their ParentViewportWatcher (e.g., LayoutInfo) immediately after calling this
1915    /// function, even if they have not called [`Present`] or [`SetRootTransform`]. This allows
1916    /// clients to wait for layout information from their parent before calling [`Present`].
1917    ///
1918    /// Any illegal operations on ParentViewportWatcher will cause both ParentViewportWatcher
1919    /// channel and this Flatland channel to be torn down.
1920    ///
1921    /// Lifecycle note. The lifetime of the ParentViewportWatcher channel is bound by the peer
1922    /// ViewportCreationToken. When the ViewportCreationToken dies, this ParentViewportWatcher
1923    /// channel is destroyed.
1924    ///
1925    /// Views and subgraphs of Views created using `CreateView` will not be represented in the
1926    /// ViewTree, and hence will not be able to participate in any ViewTree-dependent interactions
1927    /// such as touch, mouse or focus.
1928    /// The Flatland protocol provides no way for Views in the subgraph of a View created with
1929    /// `CreateView` to know that they are excluded from the ViewTree.
1930    pub fn r#create_view(
1931        &self,
1932        mut token: fidl_fuchsia_ui_views::ViewCreationToken,
1933        mut parent_viewport_watcher: fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>,
1934    ) -> Result<(), fidl::Error> {
1935        self.client.send::<FlatlandCreateViewRequest>(
1936            (&mut token, parent_viewport_watcher),
1937            0x504686eb25864780,
1938            fidl::encoding::DynamicFlags::empty(),
1939        )
1940    }
1941
1942    /// Identical to [`CreateView`], except it allows association of View identity (ViewRef) and
1943    /// view-bound protocols.
1944    pub fn r#create_view2(
1945        &self,
1946        mut token: fidl_fuchsia_ui_views::ViewCreationToken,
1947        mut view_identity: fidl_fuchsia_ui_views::ViewIdentityOnCreation,
1948        mut protocols: ViewBoundProtocols,
1949        mut parent_viewport_watcher: fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>,
1950    ) -> Result<(), fidl::Error> {
1951        self.client.send::<FlatlandCreateView2Request>(
1952            (&mut token, &mut view_identity, &mut protocols, parent_viewport_watcher),
1953            0x340a3a40c2fdbd5e,
1954            fidl::encoding::DynamicFlags::empty(),
1955        )
1956    }
1957
1958    /// Creates a new Transform node. Transforms are a hierarchical piece of a Flatland graph. They
1959    /// can have children, and can reference Content. A sub-graph represented by a Transform and its
1960    /// descendants can be rendered to a display.
1961    ///
1962    /// Transforms are kept alive, even when released, as long as they are children of either an
1963    /// unreleased Transform, or the Root Transform.
1964    ///
1965    /// Each Transform can have a single piece of attached Content. Common types of Content include
1966    /// bitmaps, asynchronous streams of images, and Viewports to Views hosted in other Flatland
1967    /// instances.
1968    ///
1969    /// Transforms have attributes. Child Transforms inherit the combined attributes of their
1970    /// parents. Content attached to a Transform is also affected by that Transform's attributes.
1971    ///
1972    /// When a sub-graph of Transforms is rendered, Content will be rendered back-to-front, starting
1973    /// with the Content on the root transform, and continuing recursively through all of its child
1974    /// Transforms in the order the children were added. See [`AddChild`] for more information.
1975    ///
1976    /// Zero is not a valid transform id. All other values are valid, assuming they are not already
1977    /// in use (see [`ReleaseTransform`] for more details).
1978    pub fn r#create_transform(&self, mut transform_id: &TransformId) -> Result<(), fidl::Error> {
1979        self.client.send::<FlatlandCreateTransformRequest>(
1980            (transform_id,),
1981            0x5e042a4d3de3efb0,
1982            fidl::encoding::DynamicFlags::empty(),
1983        )
1984    }
1985
1986    /// All Transform objects support all attributes.
1987    ///
1988    /// Geometric attributes are applied in the following order:
1989    /// 1. Scale (relative to the parent transform's coordinate space)
1990    /// 2. Orientation (relative to the parent transform's coordinate space)
1991    /// 3. Translation (relative to the parent transforms's coordinate space,
1992    ///    unaffected by scale applied to the current transform).
1993    /// 4. Clipping (relative to the current transform's coordinate space)
1994    ///
1995    /// The effects of each of these attributes are cumulative. This means the transform's position
1996    /// in the view space, and its clip boundary, will be calculated based on that chain of
1997    /// geometric attributes going up to the root transform.
1998    ///
1999    /// For instance, in a nested hierarchy such as the following:
2000    ///     [Root-Transform -> Transform1 -> Transform2 -> CurrentTransform]
2001    /// If Transform1 is translated by [2,0] and Transform2 is translated by [0,1] then the
2002    /// view-space position of CurrentTransform will be [2,1].
2003    ///
2004    /// Sets the translation on a Transform. The order of geometric attribute application is
2005    /// addressed above.
2006    pub fn r#set_translation(
2007        &self,
2008        mut transform_id: &TransformId,
2009        mut translation: &fidl_fuchsia_math::Vec_,
2010    ) -> Result<(), fidl::Error> {
2011        self.client.send::<FlatlandSetTranslationRequest>(
2012            (transform_id, translation),
2013            0x7863398291fba346,
2014            fidl::encoding::DynamicFlags::empty(),
2015        )
2016    }
2017
2018    /// Sets the orientation on a Transform. The order of geometric attribute application is
2019    /// addressed in the documentation for [`SetTranslation`]. In Flatland, the +X axis is
2020    /// to the right and the +Y axis is down. There is no notion of a Z axis. CCW is defined
2021    /// from the POV of the user, as if a skeuomorphoic clock is displayed on the screen.
2022    pub fn r#set_orientation(
2023        &self,
2024        mut transform_id: &TransformId,
2025        mut orientation: Orientation,
2026    ) -> Result<(), fidl::Error> {
2027        self.client.send::<FlatlandSetOrientationRequest>(
2028            (transform_id, orientation),
2029            0x4915310bc4928edc,
2030            fidl::encoding::DynamicFlags::empty(),
2031        )
2032    }
2033
2034    /// Sets the scale on a transform. The order of geometric attribute application is
2035    /// addressed above. The (x,y) values in the VecF |scale| refer to the scale factor in the
2036    /// x-axis (width) and y-axis (height) respectively. Scale values must be normal 32-bit
2037    /// floating point values: https://en.wikipedia.org/wiki/Normal_number_%28computing%29
2038    pub fn r#set_scale(
2039        &self,
2040        mut transform_id: &TransformId,
2041        mut scale: &fidl_fuchsia_math::VecF,
2042    ) -> Result<(), fidl::Error> {
2043        self.client.send::<FlatlandSetScaleRequest>(
2044            (transform_id, scale),
2045            0x1ea1766fd8996bb4,
2046            fidl::encoding::DynamicFlags::empty(),
2047        )
2048    }
2049
2050    /// Sets an opacity in linear space to be applied to a transform and its descendents,
2051    /// which include other transforms and content. Opacity values must be in the range
2052    /// of [0.0, 1.0], where 0.0 is completely transparent and 1.0 is completely opaque.
2053    /// Attempting to call this function with values outside that range will result in
2054    /// an error. A transform's opacity value is multiplied with that of its parent. This
2055    /// effect works differently from group opacity. Using group opacity, child nodes are
2056    /// rendered together first, and then have the parent's opacity applied as a post-effect.
2057    /// Here, opacity is applied to each child individually. This may result in a very
2058    /// different effect.
2059    pub fn r#set_opacity(
2060        &self,
2061        mut transform_id: &TransformId,
2062        mut value: f32,
2063    ) -> Result<(), fidl::Error> {
2064        self.client.send::<FlatlandSetOpacityRequest>(
2065            (transform_id, value),
2066            0x3775fc2c00b432fa,
2067            fidl::encoding::DynamicFlags::empty(),
2068        )
2069    }
2070
2071    /// Sets the bounds, expressed in the local coordinate space of the transform, that
2072    /// constrains the region that content attached to this transform can be rendered to.
2073    /// If the content's area exceeds the clip bounds, the area outside the bounds will
2074    /// not be rendered. These bounds are valid for all children of this transform node as
2075    /// well, which includes nested Flatland instances and their node hierarchies.
2076    /// If a child transform attempts to set clip bounds larger than that of its parent,
2077    /// it will be clipped to the parent's clip bounds. The default state is for a transform
2078    /// to be unclipped, meaning it will not have any bounds placed on its render region.
2079    /// The clip width/height must be positive. Negative values will result in an error.
2080    /// Passing in an empty box to the |rect| parameter will remove the clip bounds.
2081    pub fn r#set_clip_boundary(
2082        &self,
2083        mut transform_id: &TransformId,
2084        mut rect: Option<&fidl_fuchsia_math::Rect>,
2085    ) -> Result<(), fidl::Error> {
2086        self.client.send::<FlatlandSetClipBoundaryRequest>(
2087            (transform_id, rect),
2088            0x6507843df12222d2,
2089            fidl::encoding::DynamicFlags::empty(),
2090        )
2091    }
2092
2093    /// Adds a child Transform to a parent Transform. The new child Transform,
2094    /// and any Content attached to it or its children, will be rendered on top
2095    /// of the parent's Content, as well as any previously added children.
2096    ///
2097    /// The caller must ensure that `child_transform_id` is valid and that there
2098    /// are no repetitions.  Sending a repeated `child_transform_id` over
2099    /// multiple calls will result in session closure.
2100    pub fn r#add_child(
2101        &self,
2102        mut parent_transform_id: &TransformId,
2103        mut child_transform_id: &TransformId,
2104    ) -> Result<(), fidl::Error> {
2105        self.client.send::<FlatlandAddChildRequest>(
2106            (parent_transform_id, child_transform_id),
2107            0x67a8abd2f19b1a74,
2108            fidl::encoding::DynamicFlags::empty(),
2109        )
2110    }
2111
2112    /// Removes a child Transform from a parent Transform.
2113    pub fn r#remove_child(
2114        &self,
2115        mut parent_transform_id: &TransformId,
2116        mut child_transform_id: &TransformId,
2117    ) -> Result<(), fidl::Error> {
2118        self.client.send::<FlatlandRemoveChildRequest>(
2119            (parent_transform_id, child_transform_id),
2120            0x41d6cd90b298b67a,
2121            fidl::encoding::DynamicFlags::empty(),
2122        )
2123    }
2124
2125    /// Removes all child Transforms from a parent Transform and replaces them
2126    /// with the new child transforms in `new_child_transform_ids`.  The caller
2127    /// must ensure that all `TransformId` values in `new_child_transform_ids`
2128    /// are valid and that there are no repetitions.  Sending a repeated
2129    /// `TransformId` in `new_child_transform_ids` will result in session
2130    /// closure.
2131    pub fn r#replace_children(
2132        &self,
2133        mut parent_transform_id: &TransformId,
2134        mut new_child_transform_ids: &[TransformId],
2135    ) -> Result<(), fidl::Error> {
2136        self.client.send::<FlatlandReplaceChildrenRequest>(
2137            (parent_transform_id, new_child_transform_ids),
2138            0x5b6d86cbbff81316,
2139            fidl::encoding::DynamicFlags::empty(),
2140        )
2141    }
2142
2143    /// Sets the Root Transform for the graph.
2144    ///
2145    /// The sub-graph defined by the Root Transform and its children will be rendered as View
2146    /// in the connected parent's Viewport (see [`CreateView`]). Any parents of the Root Transform
2147    /// in this Graph will be ignored.
2148    ///
2149    /// The Root Transform, and all children of the Root Transform, are kept alive if they are
2150    /// released (see [`ReleaseTransform`] for more details).
2151    ///
2152    /// There is only ever one Root. Since 0 is not a valid transform id (see [`CreateTransform`]),
2153    /// calling SetRootTransform(0) clears the current Root, destroying any previously released
2154    /// objects that are not referenced by the new root.
2155    ///
2156    /// Note that every View has a clip boundary equivalent to its logical size. Anything outside
2157    /// that clip boundary will not be rendered. Hence, the Root Transform has a useful coordinate
2158    /// space of (0, 0) to (logical_size.width, logical_size.height), where (0, 0) is the upper left
2159    /// corner.
2160    ///
2161    /// Setting the root transform installs a full screen hit region on the root transform. Clients
2162    /// may remove this hit region if they don't want users to be able to interact with the root
2163    /// transform's content. For additional details on hit regions, see the [`SetHitRegions`]
2164    /// documentation.
2165    ///
2166    /// Default hit region rules
2167    ///
2168    ///   A default hit region follows these rules:
2169    ///   - When [`SetRootTransform`](T) is called, T receives a maximal hit region, covering the
2170    ///   entire view.
2171    ///   - If [`SetHitRegions`] is called on T, either before or after [`SetRootTransform`](T),
2172    ///   then no default hit region is active and the client specified hit regions are used.
2173    ///   - If a transform is no longer the root transform, i.e., [`SetRootTransform`](U) is
2174    ///   called, then the original transform no longer has its default hit region.
2175    ///   - Clients can remove or modify the root transform's hit regions the same way they would
2176    ///   reset any other transform's hit regions, by calling [`SetHitRegions`] with the appropriate
2177    ///   vector.
2178    pub fn r#set_root_transform(&self, mut transform_id: &TransformId) -> Result<(), fidl::Error> {
2179        self.client.send::<FlatlandSetRootTransformRequest>(
2180            (transform_id,),
2181            0x6e80ca5bcc566cd8,
2182            fidl::encoding::DynamicFlags::empty(),
2183        )
2184    }
2185
2186    /// Sets the interactive areas for a Transform. By default, Content is not interactive; hit
2187    /// regions must be placed for a user to interact with the Content in a View. Because hit
2188    /// regions are described in the Flatland protocol, a Flatland instance can synchronize Content
2189    /// and hit regions.
2190    ///
2191    /// Each hit region is placed in the coordinate space of the owning Transform, and may or may
2192    /// not interact with different types of hit testing, depending on its [`HitTestInteraction`]
2193    /// type. When there are multiple hit regions that intersect with a hit test, the precedence
2194    /// rules given below dictate which hit region has interacted with the hit test. Only Transforms
2195    /// that transitively connect to the root Transform have their hit regions interact with a hit
2196    /// test.
2197    ///
2198    /// Calling this function replaces any previous values set on this Transform. To reset a
2199    /// Transform to "no hit testing": send an empty vector with [`SetHitRegions`].
2200    ///
2201    /// Note that root transforms get a default hit region installed by Flatland. For more details,
2202    /// see the [`SetRootTransform`] documentation.
2203    ///
2204    /// Precedence rules
2205    ///   Within a Transform, if multiple hit regions overlap, the hit test examines each
2206    ///   intersecting hit region for a possible interaction. Thus, for a regular hit test R and an
2207    ///   accessibility hit test A, where R and A both intersect two hit regions D ([`DEFAULT`]) and
2208    ///   S ([`SEMANTICALLY_INVISIBLE`]) on the same Transform, (1) R interacts with both D and S,
2209    ///   and (2) A only interacts with D. Generally, hit regions that overlap in a single Transform
2210    ///   can cause confusing behavior.
2211    ///
2212    ///   Within a View, for a given hit test, the front-most Transform's hit regions take
2213    ///   precedence over those behind. This follows the expected reverse "render order" of
2214    ///   Transforms (described in [`CreateTransform`]), where a user expects to interact with
2215    ///   Content that is visible, or front-most.
2216    ///
2217    ///   Across Flatland instances, for a given hit test, the front-most instance's front-most
2218    ///   Transform's hit regions take precedence over those behind. This follows the expected
2219    ///   reverse "render order" of views, where a user expects to interact with the View that is
2220    ///   visible, or front-most. For example, if a child View owns Content that is rendered over
2221    ///   the parent View, the user expects to interact with the child's Content.
2222    pub fn r#set_hit_regions(
2223        &self,
2224        mut transform_id: &TransformId,
2225        mut regions: &[HitRegion],
2226    ) -> Result<(), fidl::Error> {
2227        self.client.send::<FlatlandSetHitRegionsRequest>(
2228            (transform_id, regions),
2229            0x31c9d17b07c37ce4,
2230            fidl::encoding::DynamicFlags::empty(),
2231        )
2232    }
2233
2234    /// Identical to [`SetHitRegions`], except the hit region associated with [`transform_id`]
2235    /// covers an infinite region. The hit region is invariant against translation, scaling, and
2236    /// orientation of the Transform.
2237    ///
2238    /// An infinite hit region is still limited in extent by the View's clip boundary, just like a
2239    /// finite hit region.
2240    ///
2241    /// Calling this function replaces any previous values set on this Transform. To reset a
2242    /// Transform to "no hit testing": send an empty vector with [`SetHitRegions`].
2243    pub fn r#set_infinite_hit_region(
2244        &self,
2245        mut transform_id: &TransformId,
2246        mut hit_test: HitTestInteraction,
2247    ) -> Result<(), fidl::Error> {
2248        self.client.send::<FlatlandSetInfiniteHitRegionRequest>(
2249            (transform_id, hit_test),
2250            0x26d81af852d29562,
2251            fidl::encoding::DynamicFlags::empty(),
2252        )
2253    }
2254
2255    /// The Viewport and View pair, together, represent the connection between two Flatland
2256    /// instances. The Viewport is created in the parent, and the View is created in the child. The
2257    /// parent has control over how the child's View is integrated into its own View.
2258    ///
2259    /// Any illegal operations on ChildViewWatcher will cause both ChildViewWatcher channel and this
2260    /// Flatland channel to be torn down.
2261    ///
2262    /// `ViewportProperties` must have logical_size set. This is the initial size that will drive
2263    /// the layout of the child. The logical_size is also used as the default Content size, but
2264    /// subsequent changes to the logical_size will have no effect on the Content size.
2265    ///
2266    /// `ViewportProperties` may have inset field not set. In that case, the default value of
2267    /// (0, 0, 0, 0) is used.
2268    ///
2269    /// The logical_size must have positive X and Y components.
2270    ///
2271    /// Zero is not a valid ContentId. All other values are valid, assuming they are not already
2272    /// in use for another piece of Content (see [`ReleaseViewport`] for more details).
2273    ///
2274    /// Lifecycle note. The lifetime of the ChildViewWatcher channel is bound by the peer
2275    /// ViewCreationToken. When the ViewCreationToken dies, this ChildViewWatcher channel is
2276    /// destroyed.
2277    pub fn r#create_viewport(
2278        &self,
2279        mut viewport_id: &ContentId,
2280        mut token: fidl_fuchsia_ui_views::ViewportCreationToken,
2281        mut properties: &ViewportProperties,
2282        mut child_view_watcher: fidl::endpoints::ServerEnd<ChildViewWatcherMarker>,
2283    ) -> Result<(), fidl::Error> {
2284        self.client.send::<FlatlandCreateViewportRequest>(
2285            (viewport_id, &mut token, properties, child_view_watcher),
2286            0x2485fbcab7f943c,
2287            fidl::encoding::DynamicFlags::empty(),
2288        )
2289    }
2290
2291    /// An Image is a bitmap backed by a specific VMO in a BufferCollection.
2292    ///
2293    /// Image creation requires an allocated BufferCollection registered with Allocator. This
2294    /// function will fail unless all clients of the specified BufferCollection have set their
2295    /// constraints.
2296    ///
2297    /// The Image must reference a valid VMO index and must have ImageProperties that fall within
2298    /// the constraints specified by the backing BufferCollection (i.e. width and height within a
2299    /// valid range, etc.)
2300    ///
2301    /// Zero is not a valid Image id. All other values are valid, assuming they are not already in
2302    /// use for another piece of Content (see [`ReleaseImage`] for more details).
2303    pub fn r#create_image(
2304        &self,
2305        mut image_id: &ContentId,
2306        mut import_token: BufferCollectionImportToken,
2307        mut vmo_index: u32,
2308        mut properties: &ImageProperties,
2309    ) -> Result<(), fidl::Error> {
2310        self.client.send::<FlatlandCreateImageRequest>(
2311            (image_id, &mut import_token, vmo_index, properties),
2312            0x26fae823c4ebedad,
2313            fidl::encoding::DynamicFlags::empty(),
2314        )
2315    }
2316
2317    /// This function is used to determine the region (in texel space) of an image that will be used
2318    /// by Flatland when rendering. The image to be sampled is referenced by [`image_id`] and the
2319    /// sample region is specified by [`rect`] which itself is comprised of an origin point (x,y) as
2320    /// well as a width and height, in unnormalized coordinates. It is illegal to call this function
2321    /// on non-image content, or to sample a region outside of the texel space of the image. In
2322    /// other words, the region specifed by [`rect`] must not exceed the ranges (0, image_width) and
2323    /// (0, image_height). If (rect.x + rect.width > image_width) or (rect.y + rect.height >
2324    /// image_height) or if any of the values are negative, this will result in an error.
2325    ///
2326    /// If this method is not called, the default sample region is the rectangle with origin at
2327    /// (0, 0) and width and height set at ImageProperties from [`CreateImage`].
2328    pub fn r#set_image_sample_region(
2329        &self,
2330        mut image_id: &ContentId,
2331        mut rect: &fidl_fuchsia_math::RectF,
2332    ) -> Result<(), fidl::Error> {
2333        self.client.send::<FlatlandSetImageSampleRegionRequest>(
2334            (image_id, rect),
2335            0x8039391d715eb28,
2336            fidl::encoding::DynamicFlags::empty(),
2337        )
2338    }
2339
2340    /// The content size for an Image is the size of the rectangle in the parent's logical
2341    /// coordinate space that the image occupies. This combined with the global translation of the
2342    /// transform it is attached to determines the size and location of where the content is
2343    /// rendered on the display.
2344    ///
2345    /// If this method is not called, the default image destination size is the width and height set
2346    /// at ImageProperties from [`CreateImage`]. The destination size will be affected by scaling if
2347    /// [`SetScale`] is used on the attached Transform or its parents.
2348    pub fn r#set_image_destination_size(
2349        &self,
2350        mut image_id: &ContentId,
2351        mut size: &fidl_fuchsia_math::SizeU,
2352    ) -> Result<(), fidl::Error> {
2353        self.client.send::<FlatlandSetImageDestinationSizeRequest>(
2354            (image_id, size),
2355            0x766cf99a2ec58446,
2356            fidl::encoding::DynamicFlags::empty(),
2357        )
2358    }
2359
2360    /// Determines the blend function to use when rendering the content specified by
2361    /// |image_id|. |image_id| must be a valid ContentId associated to a transform through
2362    /// a call to |CreateImage| or |CreateFilledRect|. For details on the different blend functions
2363    /// that are available, please refer to the BlendMode enum. If this function is not called, then
2364    /// the default blendmode is BlendMode::SRC.
2365    pub fn r#set_image_blending_function(
2366        &self,
2367        mut image_id: &ContentId,
2368        mut blend_mode: BlendMode,
2369    ) -> Result<(), fidl::Error> {
2370        self.client.send::<FlatlandSetImageBlendingFunctionRequest>(
2371            (image_id, blend_mode),
2372            0x10f5da1356275b7b,
2373            fidl::encoding::DynamicFlags::empty(),
2374        )
2375    }
2376
2377    /// Determines the blend function to use when rendering the content specified by
2378    /// |image_id|. |image_id| must be a valid ContentId associated to a transform through
2379    /// a call to |CreateImage| or |CreateFilledRect|. For details on the different blend functions
2380    /// that are available, please refer to the BlendMode2 enum. If this function is not called,
2381    /// the default blendmode is BlendMode2::REPLACE.
2382    pub fn r#set_image_blend_mode(
2383        &self,
2384        mut image_id: &ContentId,
2385        mut blend_mode: BlendMode2,
2386    ) -> Result<(), fidl::Error> {
2387        self.client.send::<FlatlandSetImageBlendModeRequest>(
2388            (image_id, blend_mode),
2389            0x5b1667f130c3de67,
2390            fidl::encoding::DynamicFlags::empty(),
2391        )
2392    }
2393
2394    /// Sets an opacity in linear space to be applied to a flatland image. Opacity values must
2395    /// be in the range [0.0, 1.0].
2396    pub fn r#set_image_opacity(
2397        &self,
2398        mut image_id: &ContentId,
2399        mut val: f32,
2400    ) -> Result<(), fidl::Error> {
2401        self.client.send::<FlatlandSetImageOpacityRequest>(
2402            (image_id, val),
2403            0x2da9e4ef4c2cff6f,
2404            fidl::encoding::DynamicFlags::empty(),
2405        )
2406    }
2407
2408    /// Sets the image flip to be applied to a flatland image. This call must be performed after a
2409    /// successful |CreateImage| call. If an invalid |image_id| is supplied, the channel will be
2410    /// closed due to FlatlandError::BAD_OPERATION. This flip will be applied to the Image before
2411    /// parent Transform Orientations. If this function is not called, then the default flip value
2412    /// is ImageFlip::NONE.
2413    pub fn r#set_image_flip(
2414        &self,
2415        mut image_id: &ContentId,
2416        mut flip: ImageFlip,
2417    ) -> Result<(), fidl::Error> {
2418        self.client.send::<FlatlandSetImageFlipRequest>(
2419            (image_id, flip),
2420            0x21b20f2c14aae6bc,
2421            fidl::encoding::DynamicFlags::empty(),
2422        )
2423    }
2424
2425    /// Creates a solid-color rectangle. By default a filled-rect does not have a defined
2426    /// color or size. It is necessary to call |SetSolidFill| to specify a color and size
2427    /// before a filled rect can be used for rendering. Not doing so will result the
2428    pub fn r#create_filled_rect(&self, mut rect_id: &ContentId) -> Result<(), fidl::Error> {
2429        self.client.send::<FlatlandCreateFilledRectRequest>(
2430            (rect_id,),
2431            0x5e62355abc1c4c5d,
2432            fidl::encoding::DynamicFlags::empty(),
2433        )
2434    }
2435
2436    /// Defines the color and size of a filled rect. |rect_id| must refer to content that
2437    /// was created via a call to CreateFilledRect. The color is not premultiplied. Color values
2438    /// must be within the range [0,1] inclusive, and normal 32-bit
2439    /// floating point values: https://en.wikipedia.org/wiki/Normal_number_%28computing%29. Values
2440    /// that do not conform to these specifications will cause the channel to close.
2441    /// The rectangle's top left corner will be at (0, 0) in its transform's coordinate space.
2442    /// Hence, its bottom right corner will be at (size.width, size.height).
2443    pub fn r#set_solid_fill(
2444        &self,
2445        mut rect_id: &ContentId,
2446        mut color: &ColorRgba,
2447        mut size: &fidl_fuchsia_math::SizeU,
2448    ) -> Result<(), fidl::Error> {
2449        self.client.send::<FlatlandSetSolidFillRequest>(
2450            (rect_id, color, size),
2451            0x32d6ef41e182dfa5,
2452            fidl::encoding::DynamicFlags::empty(),
2453        )
2454    }
2455
2456    /// Automatically garbage collects the rectangle when it is no longer needed for
2457    /// rendering. |rect_id| must have been instantiated with a call to
2458    /// |CreateFilledRect|. Once released, the ID immediately goes out of scope and is free
2459    /// to be used again.
2460    pub fn r#release_filled_rect(&self, mut rect_id: &ContentId) -> Result<(), fidl::Error> {
2461        self.client.send::<FlatlandReleaseFilledRectRequest>(
2462            (rect_id,),
2463            0x7392cabe45618f9b,
2464            fidl::encoding::DynamicFlags::empty(),
2465        )
2466    }
2467
2468    /// Setting a piece of Content on a Transform makes that Content visible in the render tree as
2469    /// long as the Transform is visible from the root Transform. The Content will be rendered
2470    /// before, and therefore "behind", any Content attached to the descendants of the Transform.
2471    ///
2472    /// Because each Transform can have, at most, a single piece of Content on it, calling this
2473    /// function on a Transform that already has Content will replace that Content.
2474    ///
2475    /// A Content may be set on more than one Transform.
2476    ///
2477    /// Calling this function with a Content id of 0 will remove any Content currently on the
2478    /// Transform.
2479    pub fn r#set_content(
2480        &self,
2481        mut transform_id: &TransformId,
2482        mut content_id: &ContentId,
2483    ) -> Result<(), fidl::Error> {
2484        self.client.send::<FlatlandSetContentRequest>(
2485            (transform_id, content_id),
2486            0x4ed2cfc0ce130862,
2487            fidl::encoding::DynamicFlags::empty(),
2488        )
2489    }
2490
2491    /// Transforms are usually sufficient to change how Content is presented. Viewports, however,
2492    /// have special properties that are not part of the Transform hierarchy. Those properties can
2493    /// be set using this function.
2494    pub fn r#set_viewport_properties(
2495        &self,
2496        mut viewport_id: &ContentId,
2497        mut properties: &ViewportProperties,
2498    ) -> Result<(), fidl::Error> {
2499        self.client.send::<FlatlandSetViewportPropertiesRequest>(
2500            (viewport_id, properties),
2501            0x66ab67e9608ddb9f,
2502            fidl::encoding::DynamicFlags::empty(),
2503        )
2504    }
2505
2506    /// Released Transforms will be garbage collected by the system once they are no longer
2507    /// necessary for rendering. For Transforms, this means there is no path from any unreleased
2508    /// Transform to the newly-released Transform.
2509    ///
2510    /// Once released, the id immediately goes out of scope for future function calls and can be
2511    /// reused when creating new Transforms.
2512    ///
2513    /// It is an error to call functions with a released id (unless that id has been reused to
2514    /// construct a new Transform).
2515    pub fn r#release_transform(&self, mut transform_id: &TransformId) -> Result<(), fidl::Error> {
2516        self.client.send::<FlatlandReleaseTransformRequest>(
2517            (transform_id,),
2518            0xab9328419451c22,
2519            fidl::encoding::DynamicFlags::empty(),
2520        )
2521    }
2522
2523    pub fn r#release_view(&self) -> Result<(), fidl::Error> {
2524        self.client.send::<fidl::encoding::EmptyPayload>(
2525            (),
2526            0x5b35aab9baffecae,
2527            fidl::encoding::DynamicFlags::empty(),
2528        )
2529    }
2530
2531    /// Releases a Viewport from the scene, even if the Viewport is still connected to a Transform.
2532    /// Unlike other resources, Viewports are garbage collected by the system during the next
2533    /// [`Present`] because a removed Viewport is guaranteed to provide no renderable content.
2534    ///
2535    /// Use SetContent(transform_id, 0) to clean up references to released Viewports.
2536    ///
2537    /// Despite having a return type, this function is still feed-forward like [`CreateView`] and
2538    /// requires a call to [`Present`] to be executed. The ViewportCreationToken will be returned
2539    /// after the presented operations have been executed.
2540    pub fn r#release_viewport(
2541        &self,
2542        mut viewport_id: &ContentId,
2543        ___deadline: zx::MonotonicInstant,
2544    ) -> Result<fidl_fuchsia_ui_views::ViewportCreationToken, fidl::Error> {
2545        let _response = self.client.send_query::<
2546            FlatlandReleaseViewportRequest,
2547            FlatlandReleaseViewportResponse,
2548            FlatlandMarker,
2549        >(
2550            (viewport_id,),
2551            0xbad474aeb5293f9,
2552            fidl::encoding::DynamicFlags::empty(),
2553            ___deadline,
2554        )?;
2555        Ok(_response.token)
2556    }
2557
2558    /// Released Images will be garbage collected by the system once they are no longer necessary
2559    /// for rendering. For Images, this means the Image is no longer attached to any Transform and
2560    /// any pending rendering that references the Image is complete.
2561    ///
2562    /// Use SetContent(transform_id, 0) to clean up references to released Images.
2563    ///
2564    /// Once released, the id immediately goes out of scope for future function calls and can be
2565    /// reused when creating new Images.
2566    ///
2567    /// It is an error to call functions with a released id (unless that id has been reused to
2568    /// construct a new Image).
2569    pub fn r#release_image(&self, mut image_id: &ContentId) -> Result<(), fidl::Error> {
2570        self.client.send::<FlatlandReleaseImageRequest>(
2571            (image_id,),
2572            0xb884ffdbc72c111,
2573            fidl::encoding::DynamicFlags::empty(),
2574        )
2575    }
2576
2577    /// This function will reset all state on this interface. This includes destroying all existing
2578    /// View and Viewports without returning the associated Token to the caller.
2579    pub fn r#clear(&self) -> Result<(), fidl::Error> {
2580        self.client.send::<fidl::encoding::EmptyPayload>(
2581            (),
2582            0x4ec8817c02828c3e,
2583            fidl::encoding::DynamicFlags::empty(),
2584        )
2585    }
2586
2587    /// Set debug name of the current client that can be used by Flatland to print as a prefix to
2588    /// logs to help client distinguish what is theirs. [`name`] can be an arbitrary string, but the
2589    /// current process name (see fsl::GetCurrentProcessName()) is a good default.
2590    pub fn r#set_debug_name(&self, mut name: &str) -> Result<(), fidl::Error> {
2591        self.client.send::<FlatlandSetDebugNameRequest>(
2592            (name,),
2593            0x46a8b397e68a8888,
2594            fidl::encoding::DynamicFlags::empty(),
2595        )
2596    }
2597}
2598
2599#[cfg(target_os = "fuchsia")]
2600impl From<FlatlandSynchronousProxy> for zx::NullableHandle {
2601    fn from(value: FlatlandSynchronousProxy) -> Self {
2602        value.into_channel().into()
2603    }
2604}
2605
2606#[cfg(target_os = "fuchsia")]
2607impl From<fidl::Channel> for FlatlandSynchronousProxy {
2608    fn from(value: fidl::Channel) -> Self {
2609        Self::new(value)
2610    }
2611}
2612
2613#[cfg(target_os = "fuchsia")]
2614impl fidl::endpoints::FromClient for FlatlandSynchronousProxy {
2615    type Protocol = FlatlandMarker;
2616
2617    fn from_client(value: fidl::endpoints::ClientEnd<FlatlandMarker>) -> Self {
2618        Self::new(value.into_channel())
2619    }
2620}
2621
2622#[derive(Debug, Clone)]
2623pub struct FlatlandProxy {
2624    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2625}
2626
2627impl fidl::endpoints::Proxy for FlatlandProxy {
2628    type Protocol = FlatlandMarker;
2629
2630    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2631        Self::new(inner)
2632    }
2633
2634    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2635        self.client.into_channel().map_err(|client| Self { client })
2636    }
2637
2638    fn as_channel(&self) -> &::fidl::AsyncChannel {
2639        self.client.as_channel()
2640    }
2641}
2642
2643impl FlatlandProxy {
2644    /// Create a new Proxy for fuchsia.ui.composition/Flatland.
2645    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2646        let protocol_name = <FlatlandMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2647        Self { client: fidl::client::Client::new(channel, protocol_name) }
2648    }
2649
2650    /// Get a Stream of events from the remote end of the protocol.
2651    ///
2652    /// # Panics
2653    ///
2654    /// Panics if the event stream was already taken.
2655    pub fn take_event_stream(&self) -> FlatlandEventStream {
2656        FlatlandEventStream { event_receiver: self.client.take_event_receiver() }
2657    }
2658
2659    /// Releases an image immediately, without waiting for the next present.
2660    pub fn r#release_image_immediately(&self, mut image_id: &ContentId) -> Result<(), fidl::Error> {
2661        FlatlandProxyInterface::r#release_image_immediately(self, image_id)
2662    }
2663
2664    /// Complete execution of all feed-forward operations.
2665    ///
2666    /// If executing an operation produces an error (e.g., CreateTransform(0)), an [`OnError`] event
2667    /// is emitted. Operations that produce errors are ignored and the channel is closed.
2668    ///
2669    /// If the execution is completed successfully, [`OnNextFrameBegin`] emits NO_ERROR along
2670    /// with other valid fields.
2671    ///
2672    /// The client may only call [`Present`] when they have a non-zero number of present credits,
2673    /// which are tracked by the server. The server may increment the number of credits when it
2674    /// fires the [`OnNextFrameBegin`] event, which informs the client when it receives additional
2675    /// present credits. Each [`Present`] call uses one present credit and decrements the server
2676    /// count by one. If the client calls [`Present`] with no present credits, the server will
2677    /// return a `NO_PRESENTS_REMAINING` error.
2678    ///
2679    /// The client should assume that prior to receiving any [`OnNextFrameBegin`] events, they have
2680    /// one present credit.
2681    ///
2682    /// Every [`Present`] call results in one [`OnNextFrameBegin`] event, and one
2683    /// [`OnFramePresented`] event, typically in that order.
2684    ///
2685    /// When the commands flushed by [`Present`] make it to display, an [`OnFramePresented`] event
2686    /// is fired. This event includes information pertaining to all [`Present`]s that had content
2687    /// that were part of that frame.
2688    ///
2689    /// See [`fuchsia.ui.composition/PresentArgs`] documentation above for more detailed information
2690    /// on what arguments are passed in and their role.
2691    pub fn r#present(&self, mut args: PresentArgs) -> Result<(), fidl::Error> {
2692        FlatlandProxyInterface::r#present(self, args)
2693    }
2694
2695    /// Two Flatland instances may be connected in a parent-child relationship. The parent endpoint
2696    /// is held in a Viewport, and the child endpoint is held in a View. The parent Flatland
2697    /// instance that creates a Viewport has control over how the child's View is integrated into
2698    /// its own View.
2699    ///
2700    /// The lifecycle of a parent-child connection starts with two endpoints of a channel object:
2701    /// a ViewportCreationToken and a ViewCreationToken. Out-of-band protocols pass the
2702    /// ViewportCreationToken to the parent, which calls [`CreateViewport`], and the
2703    /// ViewCreationToken to the child, which calls [`CreateView`].
2704    ///
2705    /// Only nodes connected to the Root Transform in this Flatland instance will be rendered into
2706    /// the parent's Viewport.
2707    ///
2708    /// Calling [`CreateView`] a second time will disconnect the Root Transform from the existing
2709    /// parent's Viewport, and attach it to a new parent's Viewport. In other words, each View can
2710    /// only have one parent.
2711    ///
2712    /// This function is queued, meaning that the Root Transform will not be attached to the
2713    /// parent Viewport until [`Present`] is called. However, clients will receive information
2714    /// through their ParentViewportWatcher (e.g., LayoutInfo) immediately after calling this
2715    /// function, even if they have not called [`Present`] or [`SetRootTransform`]. This allows
2716    /// clients to wait for layout information from their parent before calling [`Present`].
2717    ///
2718    /// Any illegal operations on ParentViewportWatcher will cause both ParentViewportWatcher
2719    /// channel and this Flatland channel to be torn down.
2720    ///
2721    /// Lifecycle note. The lifetime of the ParentViewportWatcher channel is bound by the peer
2722    /// ViewportCreationToken. When the ViewportCreationToken dies, this ParentViewportWatcher
2723    /// channel is destroyed.
2724    ///
2725    /// Views and subgraphs of Views created using `CreateView` will not be represented in the
2726    /// ViewTree, and hence will not be able to participate in any ViewTree-dependent interactions
2727    /// such as touch, mouse or focus.
2728    /// The Flatland protocol provides no way for Views in the subgraph of a View created with
2729    /// `CreateView` to know that they are excluded from the ViewTree.
2730    pub fn r#create_view(
2731        &self,
2732        mut token: fidl_fuchsia_ui_views::ViewCreationToken,
2733        mut parent_viewport_watcher: fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>,
2734    ) -> Result<(), fidl::Error> {
2735        FlatlandProxyInterface::r#create_view(self, token, parent_viewport_watcher)
2736    }
2737
2738    /// Identical to [`CreateView`], except it allows association of View identity (ViewRef) and
2739    /// view-bound protocols.
2740    pub fn r#create_view2(
2741        &self,
2742        mut token: fidl_fuchsia_ui_views::ViewCreationToken,
2743        mut view_identity: fidl_fuchsia_ui_views::ViewIdentityOnCreation,
2744        mut protocols: ViewBoundProtocols,
2745        mut parent_viewport_watcher: fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>,
2746    ) -> Result<(), fidl::Error> {
2747        FlatlandProxyInterface::r#create_view2(
2748            self,
2749            token,
2750            view_identity,
2751            protocols,
2752            parent_viewport_watcher,
2753        )
2754    }
2755
2756    /// Creates a new Transform node. Transforms are a hierarchical piece of a Flatland graph. They
2757    /// can have children, and can reference Content. A sub-graph represented by a Transform and its
2758    /// descendants can be rendered to a display.
2759    ///
2760    /// Transforms are kept alive, even when released, as long as they are children of either an
2761    /// unreleased Transform, or the Root Transform.
2762    ///
2763    /// Each Transform can have a single piece of attached Content. Common types of Content include
2764    /// bitmaps, asynchronous streams of images, and Viewports to Views hosted in other Flatland
2765    /// instances.
2766    ///
2767    /// Transforms have attributes. Child Transforms inherit the combined attributes of their
2768    /// parents. Content attached to a Transform is also affected by that Transform's attributes.
2769    ///
2770    /// When a sub-graph of Transforms is rendered, Content will be rendered back-to-front, starting
2771    /// with the Content on the root transform, and continuing recursively through all of its child
2772    /// Transforms in the order the children were added. See [`AddChild`] for more information.
2773    ///
2774    /// Zero is not a valid transform id. All other values are valid, assuming they are not already
2775    /// in use (see [`ReleaseTransform`] for more details).
2776    pub fn r#create_transform(&self, mut transform_id: &TransformId) -> Result<(), fidl::Error> {
2777        FlatlandProxyInterface::r#create_transform(self, transform_id)
2778    }
2779
2780    /// All Transform objects support all attributes.
2781    ///
2782    /// Geometric attributes are applied in the following order:
2783    /// 1. Scale (relative to the parent transform's coordinate space)
2784    /// 2. Orientation (relative to the parent transform's coordinate space)
2785    /// 3. Translation (relative to the parent transforms's coordinate space,
2786    ///    unaffected by scale applied to the current transform).
2787    /// 4. Clipping (relative to the current transform's coordinate space)
2788    ///
2789    /// The effects of each of these attributes are cumulative. This means the transform's position
2790    /// in the view space, and its clip boundary, will be calculated based on that chain of
2791    /// geometric attributes going up to the root transform.
2792    ///
2793    /// For instance, in a nested hierarchy such as the following:
2794    ///     [Root-Transform -> Transform1 -> Transform2 -> CurrentTransform]
2795    /// If Transform1 is translated by [2,0] and Transform2 is translated by [0,1] then the
2796    /// view-space position of CurrentTransform will be [2,1].
2797    ///
2798    /// Sets the translation on a Transform. The order of geometric attribute application is
2799    /// addressed above.
2800    pub fn r#set_translation(
2801        &self,
2802        mut transform_id: &TransformId,
2803        mut translation: &fidl_fuchsia_math::Vec_,
2804    ) -> Result<(), fidl::Error> {
2805        FlatlandProxyInterface::r#set_translation(self, transform_id, translation)
2806    }
2807
2808    /// Sets the orientation on a Transform. The order of geometric attribute application is
2809    /// addressed in the documentation for [`SetTranslation`]. In Flatland, the +X axis is
2810    /// to the right and the +Y axis is down. There is no notion of a Z axis. CCW is defined
2811    /// from the POV of the user, as if a skeuomorphoic clock is displayed on the screen.
2812    pub fn r#set_orientation(
2813        &self,
2814        mut transform_id: &TransformId,
2815        mut orientation: Orientation,
2816    ) -> Result<(), fidl::Error> {
2817        FlatlandProxyInterface::r#set_orientation(self, transform_id, orientation)
2818    }
2819
2820    /// Sets the scale on a transform. The order of geometric attribute application is
2821    /// addressed above. The (x,y) values in the VecF |scale| refer to the scale factor in the
2822    /// x-axis (width) and y-axis (height) respectively. Scale values must be normal 32-bit
2823    /// floating point values: https://en.wikipedia.org/wiki/Normal_number_%28computing%29
2824    pub fn r#set_scale(
2825        &self,
2826        mut transform_id: &TransformId,
2827        mut scale: &fidl_fuchsia_math::VecF,
2828    ) -> Result<(), fidl::Error> {
2829        FlatlandProxyInterface::r#set_scale(self, transform_id, scale)
2830    }
2831
2832    /// Sets an opacity in linear space to be applied to a transform and its descendents,
2833    /// which include other transforms and content. Opacity values must be in the range
2834    /// of [0.0, 1.0], where 0.0 is completely transparent and 1.0 is completely opaque.
2835    /// Attempting to call this function with values outside that range will result in
2836    /// an error. A transform's opacity value is multiplied with that of its parent. This
2837    /// effect works differently from group opacity. Using group opacity, child nodes are
2838    /// rendered together first, and then have the parent's opacity applied as a post-effect.
2839    /// Here, opacity is applied to each child individually. This may result in a very
2840    /// different effect.
2841    pub fn r#set_opacity(
2842        &self,
2843        mut transform_id: &TransformId,
2844        mut value: f32,
2845    ) -> Result<(), fidl::Error> {
2846        FlatlandProxyInterface::r#set_opacity(self, transform_id, value)
2847    }
2848
2849    /// Sets the bounds, expressed in the local coordinate space of the transform, that
2850    /// constrains the region that content attached to this transform can be rendered to.
2851    /// If the content's area exceeds the clip bounds, the area outside the bounds will
2852    /// not be rendered. These bounds are valid for all children of this transform node as
2853    /// well, which includes nested Flatland instances and their node hierarchies.
2854    /// If a child transform attempts to set clip bounds larger than that of its parent,
2855    /// it will be clipped to the parent's clip bounds. The default state is for a transform
2856    /// to be unclipped, meaning it will not have any bounds placed on its render region.
2857    /// The clip width/height must be positive. Negative values will result in an error.
2858    /// Passing in an empty box to the |rect| parameter will remove the clip bounds.
2859    pub fn r#set_clip_boundary(
2860        &self,
2861        mut transform_id: &TransformId,
2862        mut rect: Option<&fidl_fuchsia_math::Rect>,
2863    ) -> Result<(), fidl::Error> {
2864        FlatlandProxyInterface::r#set_clip_boundary(self, transform_id, rect)
2865    }
2866
2867    /// Adds a child Transform to a parent Transform. The new child Transform,
2868    /// and any Content attached to it or its children, will be rendered on top
2869    /// of the parent's Content, as well as any previously added children.
2870    ///
2871    /// The caller must ensure that `child_transform_id` is valid and that there
2872    /// are no repetitions.  Sending a repeated `child_transform_id` over
2873    /// multiple calls will result in session closure.
2874    pub fn r#add_child(
2875        &self,
2876        mut parent_transform_id: &TransformId,
2877        mut child_transform_id: &TransformId,
2878    ) -> Result<(), fidl::Error> {
2879        FlatlandProxyInterface::r#add_child(self, parent_transform_id, child_transform_id)
2880    }
2881
2882    /// Removes a child Transform from a parent Transform.
2883    pub fn r#remove_child(
2884        &self,
2885        mut parent_transform_id: &TransformId,
2886        mut child_transform_id: &TransformId,
2887    ) -> Result<(), fidl::Error> {
2888        FlatlandProxyInterface::r#remove_child(self, parent_transform_id, child_transform_id)
2889    }
2890
2891    /// Removes all child Transforms from a parent Transform and replaces them
2892    /// with the new child transforms in `new_child_transform_ids`.  The caller
2893    /// must ensure that all `TransformId` values in `new_child_transform_ids`
2894    /// are valid and that there are no repetitions.  Sending a repeated
2895    /// `TransformId` in `new_child_transform_ids` will result in session
2896    /// closure.
2897    pub fn r#replace_children(
2898        &self,
2899        mut parent_transform_id: &TransformId,
2900        mut new_child_transform_ids: &[TransformId],
2901    ) -> Result<(), fidl::Error> {
2902        FlatlandProxyInterface::r#replace_children(
2903            self,
2904            parent_transform_id,
2905            new_child_transform_ids,
2906        )
2907    }
2908
2909    /// Sets the Root Transform for the graph.
2910    ///
2911    /// The sub-graph defined by the Root Transform and its children will be rendered as View
2912    /// in the connected parent's Viewport (see [`CreateView`]). Any parents of the Root Transform
2913    /// in this Graph will be ignored.
2914    ///
2915    /// The Root Transform, and all children of the Root Transform, are kept alive if they are
2916    /// released (see [`ReleaseTransform`] for more details).
2917    ///
2918    /// There is only ever one Root. Since 0 is not a valid transform id (see [`CreateTransform`]),
2919    /// calling SetRootTransform(0) clears the current Root, destroying any previously released
2920    /// objects that are not referenced by the new root.
2921    ///
2922    /// Note that every View has a clip boundary equivalent to its logical size. Anything outside
2923    /// that clip boundary will not be rendered. Hence, the Root Transform has a useful coordinate
2924    /// space of (0, 0) to (logical_size.width, logical_size.height), where (0, 0) is the upper left
2925    /// corner.
2926    ///
2927    /// Setting the root transform installs a full screen hit region on the root transform. Clients
2928    /// may remove this hit region if they don't want users to be able to interact with the root
2929    /// transform's content. For additional details on hit regions, see the [`SetHitRegions`]
2930    /// documentation.
2931    ///
2932    /// Default hit region rules
2933    ///
2934    ///   A default hit region follows these rules:
2935    ///   - When [`SetRootTransform`](T) is called, T receives a maximal hit region, covering the
2936    ///   entire view.
2937    ///   - If [`SetHitRegions`] is called on T, either before or after [`SetRootTransform`](T),
2938    ///   then no default hit region is active and the client specified hit regions are used.
2939    ///   - If a transform is no longer the root transform, i.e., [`SetRootTransform`](U) is
2940    ///   called, then the original transform no longer has its default hit region.
2941    ///   - Clients can remove or modify the root transform's hit regions the same way they would
2942    ///   reset any other transform's hit regions, by calling [`SetHitRegions`] with the appropriate
2943    ///   vector.
2944    pub fn r#set_root_transform(&self, mut transform_id: &TransformId) -> Result<(), fidl::Error> {
2945        FlatlandProxyInterface::r#set_root_transform(self, transform_id)
2946    }
2947
2948    /// Sets the interactive areas for a Transform. By default, Content is not interactive; hit
2949    /// regions must be placed for a user to interact with the Content in a View. Because hit
2950    /// regions are described in the Flatland protocol, a Flatland instance can synchronize Content
2951    /// and hit regions.
2952    ///
2953    /// Each hit region is placed in the coordinate space of the owning Transform, and may or may
2954    /// not interact with different types of hit testing, depending on its [`HitTestInteraction`]
2955    /// type. When there are multiple hit regions that intersect with a hit test, the precedence
2956    /// rules given below dictate which hit region has interacted with the hit test. Only Transforms
2957    /// that transitively connect to the root Transform have their hit regions interact with a hit
2958    /// test.
2959    ///
2960    /// Calling this function replaces any previous values set on this Transform. To reset a
2961    /// Transform to "no hit testing": send an empty vector with [`SetHitRegions`].
2962    ///
2963    /// Note that root transforms get a default hit region installed by Flatland. For more details,
2964    /// see the [`SetRootTransform`] documentation.
2965    ///
2966    /// Precedence rules
2967    ///   Within a Transform, if multiple hit regions overlap, the hit test examines each
2968    ///   intersecting hit region for a possible interaction. Thus, for a regular hit test R and an
2969    ///   accessibility hit test A, where R and A both intersect two hit regions D ([`DEFAULT`]) and
2970    ///   S ([`SEMANTICALLY_INVISIBLE`]) on the same Transform, (1) R interacts with both D and S,
2971    ///   and (2) A only interacts with D. Generally, hit regions that overlap in a single Transform
2972    ///   can cause confusing behavior.
2973    ///
2974    ///   Within a View, for a given hit test, the front-most Transform's hit regions take
2975    ///   precedence over those behind. This follows the expected reverse "render order" of
2976    ///   Transforms (described in [`CreateTransform`]), where a user expects to interact with
2977    ///   Content that is visible, or front-most.
2978    ///
2979    ///   Across Flatland instances, for a given hit test, the front-most instance's front-most
2980    ///   Transform's hit regions take precedence over those behind. This follows the expected
2981    ///   reverse "render order" of views, where a user expects to interact with the View that is
2982    ///   visible, or front-most. For example, if a child View owns Content that is rendered over
2983    ///   the parent View, the user expects to interact with the child's Content.
2984    pub fn r#set_hit_regions(
2985        &self,
2986        mut transform_id: &TransformId,
2987        mut regions: &[HitRegion],
2988    ) -> Result<(), fidl::Error> {
2989        FlatlandProxyInterface::r#set_hit_regions(self, transform_id, regions)
2990    }
2991
2992    /// Identical to [`SetHitRegions`], except the hit region associated with [`transform_id`]
2993    /// covers an infinite region. The hit region is invariant against translation, scaling, and
2994    /// orientation of the Transform.
2995    ///
2996    /// An infinite hit region is still limited in extent by the View's clip boundary, just like a
2997    /// finite hit region.
2998    ///
2999    /// Calling this function replaces any previous values set on this Transform. To reset a
3000    /// Transform to "no hit testing": send an empty vector with [`SetHitRegions`].
3001    pub fn r#set_infinite_hit_region(
3002        &self,
3003        mut transform_id: &TransformId,
3004        mut hit_test: HitTestInteraction,
3005    ) -> Result<(), fidl::Error> {
3006        FlatlandProxyInterface::r#set_infinite_hit_region(self, transform_id, hit_test)
3007    }
3008
3009    /// The Viewport and View pair, together, represent the connection between two Flatland
3010    /// instances. The Viewport is created in the parent, and the View is created in the child. The
3011    /// parent has control over how the child's View is integrated into its own View.
3012    ///
3013    /// Any illegal operations on ChildViewWatcher will cause both ChildViewWatcher channel and this
3014    /// Flatland channel to be torn down.
3015    ///
3016    /// `ViewportProperties` must have logical_size set. This is the initial size that will drive
3017    /// the layout of the child. The logical_size is also used as the default Content size, but
3018    /// subsequent changes to the logical_size will have no effect on the Content size.
3019    ///
3020    /// `ViewportProperties` may have inset field not set. In that case, the default value of
3021    /// (0, 0, 0, 0) is used.
3022    ///
3023    /// The logical_size must have positive X and Y components.
3024    ///
3025    /// Zero is not a valid ContentId. All other values are valid, assuming they are not already
3026    /// in use for another piece of Content (see [`ReleaseViewport`] for more details).
3027    ///
3028    /// Lifecycle note. The lifetime of the ChildViewWatcher channel is bound by the peer
3029    /// ViewCreationToken. When the ViewCreationToken dies, this ChildViewWatcher channel is
3030    /// destroyed.
3031    pub fn r#create_viewport(
3032        &self,
3033        mut viewport_id: &ContentId,
3034        mut token: fidl_fuchsia_ui_views::ViewportCreationToken,
3035        mut properties: &ViewportProperties,
3036        mut child_view_watcher: fidl::endpoints::ServerEnd<ChildViewWatcherMarker>,
3037    ) -> Result<(), fidl::Error> {
3038        FlatlandProxyInterface::r#create_viewport(
3039            self,
3040            viewport_id,
3041            token,
3042            properties,
3043            child_view_watcher,
3044        )
3045    }
3046
3047    /// An Image is a bitmap backed by a specific VMO in a BufferCollection.
3048    ///
3049    /// Image creation requires an allocated BufferCollection registered with Allocator. This
3050    /// function will fail unless all clients of the specified BufferCollection have set their
3051    /// constraints.
3052    ///
3053    /// The Image must reference a valid VMO index and must have ImageProperties that fall within
3054    /// the constraints specified by the backing BufferCollection (i.e. width and height within a
3055    /// valid range, etc.)
3056    ///
3057    /// Zero is not a valid Image id. All other values are valid, assuming they are not already in
3058    /// use for another piece of Content (see [`ReleaseImage`] for more details).
3059    pub fn r#create_image(
3060        &self,
3061        mut image_id: &ContentId,
3062        mut import_token: BufferCollectionImportToken,
3063        mut vmo_index: u32,
3064        mut properties: &ImageProperties,
3065    ) -> Result<(), fidl::Error> {
3066        FlatlandProxyInterface::r#create_image(self, image_id, import_token, vmo_index, properties)
3067    }
3068
3069    /// This function is used to determine the region (in texel space) of an image that will be used
3070    /// by Flatland when rendering. The image to be sampled is referenced by [`image_id`] and the
3071    /// sample region is specified by [`rect`] which itself is comprised of an origin point (x,y) as
3072    /// well as a width and height, in unnormalized coordinates. It is illegal to call this function
3073    /// on non-image content, or to sample a region outside of the texel space of the image. In
3074    /// other words, the region specifed by [`rect`] must not exceed the ranges (0, image_width) and
3075    /// (0, image_height). If (rect.x + rect.width > image_width) or (rect.y + rect.height >
3076    /// image_height) or if any of the values are negative, this will result in an error.
3077    ///
3078    /// If this method is not called, the default sample region is the rectangle with origin at
3079    /// (0, 0) and width and height set at ImageProperties from [`CreateImage`].
3080    pub fn r#set_image_sample_region(
3081        &self,
3082        mut image_id: &ContentId,
3083        mut rect: &fidl_fuchsia_math::RectF,
3084    ) -> Result<(), fidl::Error> {
3085        FlatlandProxyInterface::r#set_image_sample_region(self, image_id, rect)
3086    }
3087
3088    /// The content size for an Image is the size of the rectangle in the parent's logical
3089    /// coordinate space that the image occupies. This combined with the global translation of the
3090    /// transform it is attached to determines the size and location of where the content is
3091    /// rendered on the display.
3092    ///
3093    /// If this method is not called, the default image destination size is the width and height set
3094    /// at ImageProperties from [`CreateImage`]. The destination size will be affected by scaling if
3095    /// [`SetScale`] is used on the attached Transform or its parents.
3096    pub fn r#set_image_destination_size(
3097        &self,
3098        mut image_id: &ContentId,
3099        mut size: &fidl_fuchsia_math::SizeU,
3100    ) -> Result<(), fidl::Error> {
3101        FlatlandProxyInterface::r#set_image_destination_size(self, image_id, size)
3102    }
3103
3104    /// Determines the blend function to use when rendering the content specified by
3105    /// |image_id|. |image_id| must be a valid ContentId associated to a transform through
3106    /// a call to |CreateImage| or |CreateFilledRect|. For details on the different blend functions
3107    /// that are available, please refer to the BlendMode enum. If this function is not called, then
3108    /// the default blendmode is BlendMode::SRC.
3109    pub fn r#set_image_blending_function(
3110        &self,
3111        mut image_id: &ContentId,
3112        mut blend_mode: BlendMode,
3113    ) -> Result<(), fidl::Error> {
3114        FlatlandProxyInterface::r#set_image_blending_function(self, image_id, blend_mode)
3115    }
3116
3117    /// Determines the blend function to use when rendering the content specified by
3118    /// |image_id|. |image_id| must be a valid ContentId associated to a transform through
3119    /// a call to |CreateImage| or |CreateFilledRect|. For details on the different blend functions
3120    /// that are available, please refer to the BlendMode2 enum. If this function is not called,
3121    /// the default blendmode is BlendMode2::REPLACE.
3122    pub fn r#set_image_blend_mode(
3123        &self,
3124        mut image_id: &ContentId,
3125        mut blend_mode: BlendMode2,
3126    ) -> Result<(), fidl::Error> {
3127        FlatlandProxyInterface::r#set_image_blend_mode(self, image_id, blend_mode)
3128    }
3129
3130    /// Sets an opacity in linear space to be applied to a flatland image. Opacity values must
3131    /// be in the range [0.0, 1.0].
3132    pub fn r#set_image_opacity(
3133        &self,
3134        mut image_id: &ContentId,
3135        mut val: f32,
3136    ) -> Result<(), fidl::Error> {
3137        FlatlandProxyInterface::r#set_image_opacity(self, image_id, val)
3138    }
3139
3140    /// Sets the image flip to be applied to a flatland image. This call must be performed after a
3141    /// successful |CreateImage| call. If an invalid |image_id| is supplied, the channel will be
3142    /// closed due to FlatlandError::BAD_OPERATION. This flip will be applied to the Image before
3143    /// parent Transform Orientations. If this function is not called, then the default flip value
3144    /// is ImageFlip::NONE.
3145    pub fn r#set_image_flip(
3146        &self,
3147        mut image_id: &ContentId,
3148        mut flip: ImageFlip,
3149    ) -> Result<(), fidl::Error> {
3150        FlatlandProxyInterface::r#set_image_flip(self, image_id, flip)
3151    }
3152
3153    /// Creates a solid-color rectangle. By default a filled-rect does not have a defined
3154    /// color or size. It is necessary to call |SetSolidFill| to specify a color and size
3155    /// before a filled rect can be used for rendering. Not doing so will result the
3156    pub fn r#create_filled_rect(&self, mut rect_id: &ContentId) -> Result<(), fidl::Error> {
3157        FlatlandProxyInterface::r#create_filled_rect(self, rect_id)
3158    }
3159
3160    /// Defines the color and size of a filled rect. |rect_id| must refer to content that
3161    /// was created via a call to CreateFilledRect. The color is not premultiplied. Color values
3162    /// must be within the range [0,1] inclusive, and normal 32-bit
3163    /// floating point values: https://en.wikipedia.org/wiki/Normal_number_%28computing%29. Values
3164    /// that do not conform to these specifications will cause the channel to close.
3165    /// The rectangle's top left corner will be at (0, 0) in its transform's coordinate space.
3166    /// Hence, its bottom right corner will be at (size.width, size.height).
3167    pub fn r#set_solid_fill(
3168        &self,
3169        mut rect_id: &ContentId,
3170        mut color: &ColorRgba,
3171        mut size: &fidl_fuchsia_math::SizeU,
3172    ) -> Result<(), fidl::Error> {
3173        FlatlandProxyInterface::r#set_solid_fill(self, rect_id, color, size)
3174    }
3175
3176    /// Automatically garbage collects the rectangle when it is no longer needed for
3177    /// rendering. |rect_id| must have been instantiated with a call to
3178    /// |CreateFilledRect|. Once released, the ID immediately goes out of scope and is free
3179    /// to be used again.
3180    pub fn r#release_filled_rect(&self, mut rect_id: &ContentId) -> Result<(), fidl::Error> {
3181        FlatlandProxyInterface::r#release_filled_rect(self, rect_id)
3182    }
3183
3184    /// Setting a piece of Content on a Transform makes that Content visible in the render tree as
3185    /// long as the Transform is visible from the root Transform. The Content will be rendered
3186    /// before, and therefore "behind", any Content attached to the descendants of the Transform.
3187    ///
3188    /// Because each Transform can have, at most, a single piece of Content on it, calling this
3189    /// function on a Transform that already has Content will replace that Content.
3190    ///
3191    /// A Content may be set on more than one Transform.
3192    ///
3193    /// Calling this function with a Content id of 0 will remove any Content currently on the
3194    /// Transform.
3195    pub fn r#set_content(
3196        &self,
3197        mut transform_id: &TransformId,
3198        mut content_id: &ContentId,
3199    ) -> Result<(), fidl::Error> {
3200        FlatlandProxyInterface::r#set_content(self, transform_id, content_id)
3201    }
3202
3203    /// Transforms are usually sufficient to change how Content is presented. Viewports, however,
3204    /// have special properties that are not part of the Transform hierarchy. Those properties can
3205    /// be set using this function.
3206    pub fn r#set_viewport_properties(
3207        &self,
3208        mut viewport_id: &ContentId,
3209        mut properties: &ViewportProperties,
3210    ) -> Result<(), fidl::Error> {
3211        FlatlandProxyInterface::r#set_viewport_properties(self, viewport_id, properties)
3212    }
3213
3214    /// Released Transforms will be garbage collected by the system once they are no longer
3215    /// necessary for rendering. For Transforms, this means there is no path from any unreleased
3216    /// Transform to the newly-released Transform.
3217    ///
3218    /// Once released, the id immediately goes out of scope for future function calls and can be
3219    /// reused when creating new Transforms.
3220    ///
3221    /// It is an error to call functions with a released id (unless that id has been reused to
3222    /// construct a new Transform).
3223    pub fn r#release_transform(&self, mut transform_id: &TransformId) -> Result<(), fidl::Error> {
3224        FlatlandProxyInterface::r#release_transform(self, transform_id)
3225    }
3226
3227    pub fn r#release_view(&self) -> Result<(), fidl::Error> {
3228        FlatlandProxyInterface::r#release_view(self)
3229    }
3230
3231    /// Releases a Viewport from the scene, even if the Viewport is still connected to a Transform.
3232    /// Unlike other resources, Viewports are garbage collected by the system during the next
3233    /// [`Present`] because a removed Viewport is guaranteed to provide no renderable content.
3234    ///
3235    /// Use SetContent(transform_id, 0) to clean up references to released Viewports.
3236    ///
3237    /// Despite having a return type, this function is still feed-forward like [`CreateView`] and
3238    /// requires a call to [`Present`] to be executed. The ViewportCreationToken will be returned
3239    /// after the presented operations have been executed.
3240    pub fn r#release_viewport(
3241        &self,
3242        mut viewport_id: &ContentId,
3243    ) -> fidl::client::QueryResponseFut<
3244        fidl_fuchsia_ui_views::ViewportCreationToken,
3245        fidl::encoding::DefaultFuchsiaResourceDialect,
3246    > {
3247        FlatlandProxyInterface::r#release_viewport(self, viewport_id)
3248    }
3249
3250    /// Released Images will be garbage collected by the system once they are no longer necessary
3251    /// for rendering. For Images, this means the Image is no longer attached to any Transform and
3252    /// any pending rendering that references the Image is complete.
3253    ///
3254    /// Use SetContent(transform_id, 0) to clean up references to released Images.
3255    ///
3256    /// Once released, the id immediately goes out of scope for future function calls and can be
3257    /// reused when creating new Images.
3258    ///
3259    /// It is an error to call functions with a released id (unless that id has been reused to
3260    /// construct a new Image).
3261    pub fn r#release_image(&self, mut image_id: &ContentId) -> Result<(), fidl::Error> {
3262        FlatlandProxyInterface::r#release_image(self, image_id)
3263    }
3264
3265    /// This function will reset all state on this interface. This includes destroying all existing
3266    /// View and Viewports without returning the associated Token to the caller.
3267    pub fn r#clear(&self) -> Result<(), fidl::Error> {
3268        FlatlandProxyInterface::r#clear(self)
3269    }
3270
3271    /// Set debug name of the current client that can be used by Flatland to print as a prefix to
3272    /// logs to help client distinguish what is theirs. [`name`] can be an arbitrary string, but the
3273    /// current process name (see fsl::GetCurrentProcessName()) is a good default.
3274    pub fn r#set_debug_name(&self, mut name: &str) -> Result<(), fidl::Error> {
3275        FlatlandProxyInterface::r#set_debug_name(self, name)
3276    }
3277}
3278
3279impl FlatlandProxyInterface for FlatlandProxy {
3280    fn r#release_image_immediately(&self, mut image_id: &ContentId) -> Result<(), fidl::Error> {
3281        self.client.send::<TrustedFlatlandReleaseImageImmediatelyRequest>(
3282            (image_id,),
3283            0x245e1ac080772c8,
3284            fidl::encoding::DynamicFlags::empty(),
3285        )
3286    }
3287
3288    fn r#present(&self, mut args: PresentArgs) -> Result<(), fidl::Error> {
3289        self.client.send::<FlatlandPresentRequest>(
3290            (&mut args,),
3291            0x50acc2aa1f0acec7,
3292            fidl::encoding::DynamicFlags::empty(),
3293        )
3294    }
3295
3296    fn r#create_view(
3297        &self,
3298        mut token: fidl_fuchsia_ui_views::ViewCreationToken,
3299        mut parent_viewport_watcher: fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>,
3300    ) -> Result<(), fidl::Error> {
3301        self.client.send::<FlatlandCreateViewRequest>(
3302            (&mut token, parent_viewport_watcher),
3303            0x504686eb25864780,
3304            fidl::encoding::DynamicFlags::empty(),
3305        )
3306    }
3307
3308    fn r#create_view2(
3309        &self,
3310        mut token: fidl_fuchsia_ui_views::ViewCreationToken,
3311        mut view_identity: fidl_fuchsia_ui_views::ViewIdentityOnCreation,
3312        mut protocols: ViewBoundProtocols,
3313        mut parent_viewport_watcher: fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>,
3314    ) -> Result<(), fidl::Error> {
3315        self.client.send::<FlatlandCreateView2Request>(
3316            (&mut token, &mut view_identity, &mut protocols, parent_viewport_watcher),
3317            0x340a3a40c2fdbd5e,
3318            fidl::encoding::DynamicFlags::empty(),
3319        )
3320    }
3321
3322    fn r#create_transform(&self, mut transform_id: &TransformId) -> Result<(), fidl::Error> {
3323        self.client.send::<FlatlandCreateTransformRequest>(
3324            (transform_id,),
3325            0x5e042a4d3de3efb0,
3326            fidl::encoding::DynamicFlags::empty(),
3327        )
3328    }
3329
3330    fn r#set_translation(
3331        &self,
3332        mut transform_id: &TransformId,
3333        mut translation: &fidl_fuchsia_math::Vec_,
3334    ) -> Result<(), fidl::Error> {
3335        self.client.send::<FlatlandSetTranslationRequest>(
3336            (transform_id, translation),
3337            0x7863398291fba346,
3338            fidl::encoding::DynamicFlags::empty(),
3339        )
3340    }
3341
3342    fn r#set_orientation(
3343        &self,
3344        mut transform_id: &TransformId,
3345        mut orientation: Orientation,
3346    ) -> Result<(), fidl::Error> {
3347        self.client.send::<FlatlandSetOrientationRequest>(
3348            (transform_id, orientation),
3349            0x4915310bc4928edc,
3350            fidl::encoding::DynamicFlags::empty(),
3351        )
3352    }
3353
3354    fn r#set_scale(
3355        &self,
3356        mut transform_id: &TransformId,
3357        mut scale: &fidl_fuchsia_math::VecF,
3358    ) -> Result<(), fidl::Error> {
3359        self.client.send::<FlatlandSetScaleRequest>(
3360            (transform_id, scale),
3361            0x1ea1766fd8996bb4,
3362            fidl::encoding::DynamicFlags::empty(),
3363        )
3364    }
3365
3366    fn r#set_opacity(
3367        &self,
3368        mut transform_id: &TransformId,
3369        mut value: f32,
3370    ) -> Result<(), fidl::Error> {
3371        self.client.send::<FlatlandSetOpacityRequest>(
3372            (transform_id, value),
3373            0x3775fc2c00b432fa,
3374            fidl::encoding::DynamicFlags::empty(),
3375        )
3376    }
3377
3378    fn r#set_clip_boundary(
3379        &self,
3380        mut transform_id: &TransformId,
3381        mut rect: Option<&fidl_fuchsia_math::Rect>,
3382    ) -> Result<(), fidl::Error> {
3383        self.client.send::<FlatlandSetClipBoundaryRequest>(
3384            (transform_id, rect),
3385            0x6507843df12222d2,
3386            fidl::encoding::DynamicFlags::empty(),
3387        )
3388    }
3389
3390    fn r#add_child(
3391        &self,
3392        mut parent_transform_id: &TransformId,
3393        mut child_transform_id: &TransformId,
3394    ) -> Result<(), fidl::Error> {
3395        self.client.send::<FlatlandAddChildRequest>(
3396            (parent_transform_id, child_transform_id),
3397            0x67a8abd2f19b1a74,
3398            fidl::encoding::DynamicFlags::empty(),
3399        )
3400    }
3401
3402    fn r#remove_child(
3403        &self,
3404        mut parent_transform_id: &TransformId,
3405        mut child_transform_id: &TransformId,
3406    ) -> Result<(), fidl::Error> {
3407        self.client.send::<FlatlandRemoveChildRequest>(
3408            (parent_transform_id, child_transform_id),
3409            0x41d6cd90b298b67a,
3410            fidl::encoding::DynamicFlags::empty(),
3411        )
3412    }
3413
3414    fn r#replace_children(
3415        &self,
3416        mut parent_transform_id: &TransformId,
3417        mut new_child_transform_ids: &[TransformId],
3418    ) -> Result<(), fidl::Error> {
3419        self.client.send::<FlatlandReplaceChildrenRequest>(
3420            (parent_transform_id, new_child_transform_ids),
3421            0x5b6d86cbbff81316,
3422            fidl::encoding::DynamicFlags::empty(),
3423        )
3424    }
3425
3426    fn r#set_root_transform(&self, mut transform_id: &TransformId) -> Result<(), fidl::Error> {
3427        self.client.send::<FlatlandSetRootTransformRequest>(
3428            (transform_id,),
3429            0x6e80ca5bcc566cd8,
3430            fidl::encoding::DynamicFlags::empty(),
3431        )
3432    }
3433
3434    fn r#set_hit_regions(
3435        &self,
3436        mut transform_id: &TransformId,
3437        mut regions: &[HitRegion],
3438    ) -> Result<(), fidl::Error> {
3439        self.client.send::<FlatlandSetHitRegionsRequest>(
3440            (transform_id, regions),
3441            0x31c9d17b07c37ce4,
3442            fidl::encoding::DynamicFlags::empty(),
3443        )
3444    }
3445
3446    fn r#set_infinite_hit_region(
3447        &self,
3448        mut transform_id: &TransformId,
3449        mut hit_test: HitTestInteraction,
3450    ) -> Result<(), fidl::Error> {
3451        self.client.send::<FlatlandSetInfiniteHitRegionRequest>(
3452            (transform_id, hit_test),
3453            0x26d81af852d29562,
3454            fidl::encoding::DynamicFlags::empty(),
3455        )
3456    }
3457
3458    fn r#create_viewport(
3459        &self,
3460        mut viewport_id: &ContentId,
3461        mut token: fidl_fuchsia_ui_views::ViewportCreationToken,
3462        mut properties: &ViewportProperties,
3463        mut child_view_watcher: fidl::endpoints::ServerEnd<ChildViewWatcherMarker>,
3464    ) -> Result<(), fidl::Error> {
3465        self.client.send::<FlatlandCreateViewportRequest>(
3466            (viewport_id, &mut token, properties, child_view_watcher),
3467            0x2485fbcab7f943c,
3468            fidl::encoding::DynamicFlags::empty(),
3469        )
3470    }
3471
3472    fn r#create_image(
3473        &self,
3474        mut image_id: &ContentId,
3475        mut import_token: BufferCollectionImportToken,
3476        mut vmo_index: u32,
3477        mut properties: &ImageProperties,
3478    ) -> Result<(), fidl::Error> {
3479        self.client.send::<FlatlandCreateImageRequest>(
3480            (image_id, &mut import_token, vmo_index, properties),
3481            0x26fae823c4ebedad,
3482            fidl::encoding::DynamicFlags::empty(),
3483        )
3484    }
3485
3486    fn r#set_image_sample_region(
3487        &self,
3488        mut image_id: &ContentId,
3489        mut rect: &fidl_fuchsia_math::RectF,
3490    ) -> Result<(), fidl::Error> {
3491        self.client.send::<FlatlandSetImageSampleRegionRequest>(
3492            (image_id, rect),
3493            0x8039391d715eb28,
3494            fidl::encoding::DynamicFlags::empty(),
3495        )
3496    }
3497
3498    fn r#set_image_destination_size(
3499        &self,
3500        mut image_id: &ContentId,
3501        mut size: &fidl_fuchsia_math::SizeU,
3502    ) -> Result<(), fidl::Error> {
3503        self.client.send::<FlatlandSetImageDestinationSizeRequest>(
3504            (image_id, size),
3505            0x766cf99a2ec58446,
3506            fidl::encoding::DynamicFlags::empty(),
3507        )
3508    }
3509
3510    fn r#set_image_blending_function(
3511        &self,
3512        mut image_id: &ContentId,
3513        mut blend_mode: BlendMode,
3514    ) -> Result<(), fidl::Error> {
3515        self.client.send::<FlatlandSetImageBlendingFunctionRequest>(
3516            (image_id, blend_mode),
3517            0x10f5da1356275b7b,
3518            fidl::encoding::DynamicFlags::empty(),
3519        )
3520    }
3521
3522    fn r#set_image_blend_mode(
3523        &self,
3524        mut image_id: &ContentId,
3525        mut blend_mode: BlendMode2,
3526    ) -> Result<(), fidl::Error> {
3527        self.client.send::<FlatlandSetImageBlendModeRequest>(
3528            (image_id, blend_mode),
3529            0x5b1667f130c3de67,
3530            fidl::encoding::DynamicFlags::empty(),
3531        )
3532    }
3533
3534    fn r#set_image_opacity(
3535        &self,
3536        mut image_id: &ContentId,
3537        mut val: f32,
3538    ) -> Result<(), fidl::Error> {
3539        self.client.send::<FlatlandSetImageOpacityRequest>(
3540            (image_id, val),
3541            0x2da9e4ef4c2cff6f,
3542            fidl::encoding::DynamicFlags::empty(),
3543        )
3544    }
3545
3546    fn r#set_image_flip(
3547        &self,
3548        mut image_id: &ContentId,
3549        mut flip: ImageFlip,
3550    ) -> Result<(), fidl::Error> {
3551        self.client.send::<FlatlandSetImageFlipRequest>(
3552            (image_id, flip),
3553            0x21b20f2c14aae6bc,
3554            fidl::encoding::DynamicFlags::empty(),
3555        )
3556    }
3557
3558    fn r#create_filled_rect(&self, mut rect_id: &ContentId) -> Result<(), fidl::Error> {
3559        self.client.send::<FlatlandCreateFilledRectRequest>(
3560            (rect_id,),
3561            0x5e62355abc1c4c5d,
3562            fidl::encoding::DynamicFlags::empty(),
3563        )
3564    }
3565
3566    fn r#set_solid_fill(
3567        &self,
3568        mut rect_id: &ContentId,
3569        mut color: &ColorRgba,
3570        mut size: &fidl_fuchsia_math::SizeU,
3571    ) -> Result<(), fidl::Error> {
3572        self.client.send::<FlatlandSetSolidFillRequest>(
3573            (rect_id, color, size),
3574            0x32d6ef41e182dfa5,
3575            fidl::encoding::DynamicFlags::empty(),
3576        )
3577    }
3578
3579    fn r#release_filled_rect(&self, mut rect_id: &ContentId) -> Result<(), fidl::Error> {
3580        self.client.send::<FlatlandReleaseFilledRectRequest>(
3581            (rect_id,),
3582            0x7392cabe45618f9b,
3583            fidl::encoding::DynamicFlags::empty(),
3584        )
3585    }
3586
3587    fn r#set_content(
3588        &self,
3589        mut transform_id: &TransformId,
3590        mut content_id: &ContentId,
3591    ) -> Result<(), fidl::Error> {
3592        self.client.send::<FlatlandSetContentRequest>(
3593            (transform_id, content_id),
3594            0x4ed2cfc0ce130862,
3595            fidl::encoding::DynamicFlags::empty(),
3596        )
3597    }
3598
3599    fn r#set_viewport_properties(
3600        &self,
3601        mut viewport_id: &ContentId,
3602        mut properties: &ViewportProperties,
3603    ) -> Result<(), fidl::Error> {
3604        self.client.send::<FlatlandSetViewportPropertiesRequest>(
3605            (viewport_id, properties),
3606            0x66ab67e9608ddb9f,
3607            fidl::encoding::DynamicFlags::empty(),
3608        )
3609    }
3610
3611    fn r#release_transform(&self, mut transform_id: &TransformId) -> Result<(), fidl::Error> {
3612        self.client.send::<FlatlandReleaseTransformRequest>(
3613            (transform_id,),
3614            0xab9328419451c22,
3615            fidl::encoding::DynamicFlags::empty(),
3616        )
3617    }
3618
3619    fn r#release_view(&self) -> Result<(), fidl::Error> {
3620        self.client.send::<fidl::encoding::EmptyPayload>(
3621            (),
3622            0x5b35aab9baffecae,
3623            fidl::encoding::DynamicFlags::empty(),
3624        )
3625    }
3626
3627    type ReleaseViewportResponseFut = fidl::client::QueryResponseFut<
3628        fidl_fuchsia_ui_views::ViewportCreationToken,
3629        fidl::encoding::DefaultFuchsiaResourceDialect,
3630    >;
3631    fn r#release_viewport(&self, mut viewport_id: &ContentId) -> Self::ReleaseViewportResponseFut {
3632        fn _decode(
3633            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3634        ) -> Result<fidl_fuchsia_ui_views::ViewportCreationToken, fidl::Error> {
3635            let _response = fidl::client::decode_transaction_body::<
3636                FlatlandReleaseViewportResponse,
3637                fidl::encoding::DefaultFuchsiaResourceDialect,
3638                0xbad474aeb5293f9,
3639            >(_buf?)?;
3640            Ok(_response.token)
3641        }
3642        self.client.send_query_and_decode::<
3643            FlatlandReleaseViewportRequest,
3644            fidl_fuchsia_ui_views::ViewportCreationToken,
3645        >(
3646            (viewport_id,),
3647            0xbad474aeb5293f9,
3648            fidl::encoding::DynamicFlags::empty(),
3649            _decode,
3650        )
3651    }
3652
3653    fn r#release_image(&self, mut image_id: &ContentId) -> Result<(), fidl::Error> {
3654        self.client.send::<FlatlandReleaseImageRequest>(
3655            (image_id,),
3656            0xb884ffdbc72c111,
3657            fidl::encoding::DynamicFlags::empty(),
3658        )
3659    }
3660
3661    fn r#clear(&self) -> Result<(), fidl::Error> {
3662        self.client.send::<fidl::encoding::EmptyPayload>(
3663            (),
3664            0x4ec8817c02828c3e,
3665            fidl::encoding::DynamicFlags::empty(),
3666        )
3667    }
3668
3669    fn r#set_debug_name(&self, mut name: &str) -> Result<(), fidl::Error> {
3670        self.client.send::<FlatlandSetDebugNameRequest>(
3671            (name,),
3672            0x46a8b397e68a8888,
3673            fidl::encoding::DynamicFlags::empty(),
3674        )
3675    }
3676}
3677
3678pub struct FlatlandEventStream {
3679    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
3680}
3681
3682impl std::marker::Unpin for FlatlandEventStream {}
3683
3684impl futures::stream::FusedStream for FlatlandEventStream {
3685    fn is_terminated(&self) -> bool {
3686        self.event_receiver.is_terminated()
3687    }
3688}
3689
3690impl futures::Stream for FlatlandEventStream {
3691    type Item = Result<FlatlandEvent, fidl::Error>;
3692
3693    fn poll_next(
3694        mut self: std::pin::Pin<&mut Self>,
3695        cx: &mut std::task::Context<'_>,
3696    ) -> std::task::Poll<Option<Self::Item>> {
3697        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
3698            &mut self.event_receiver,
3699            cx
3700        )?) {
3701            Some(buf) => std::task::Poll::Ready(Some(FlatlandEvent::decode(buf))),
3702            None => std::task::Poll::Ready(None),
3703        }
3704    }
3705}
3706
3707#[derive(Debug)]
3708pub enum FlatlandEvent {
3709    OnNextFrameBegin { values: OnNextFrameBeginValues },
3710    OnFramePresented { frame_presented_info: fidl_fuchsia_scenic_scheduling::FramePresentedInfo },
3711    OnError { error: FlatlandError },
3712}
3713
3714impl FlatlandEvent {
3715    #[allow(irrefutable_let_patterns)]
3716    pub fn into_on_next_frame_begin(self) -> Option<OnNextFrameBeginValues> {
3717        if let FlatlandEvent::OnNextFrameBegin { values } = self { Some((values)) } else { None }
3718    }
3719    #[allow(irrefutable_let_patterns)]
3720    pub fn into_on_frame_presented(
3721        self,
3722    ) -> Option<fidl_fuchsia_scenic_scheduling::FramePresentedInfo> {
3723        if let FlatlandEvent::OnFramePresented { frame_presented_info } = self {
3724            Some((frame_presented_info))
3725        } else {
3726            None
3727        }
3728    }
3729    #[allow(irrefutable_let_patterns)]
3730    pub fn into_on_error(self) -> Option<FlatlandError> {
3731        if let FlatlandEvent::OnError { error } = self { Some((error)) } else { None }
3732    }
3733
3734    /// Decodes a message buffer as a [`FlatlandEvent`].
3735    fn decode(
3736        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3737    ) -> Result<FlatlandEvent, fidl::Error> {
3738        let (bytes, _handles) = buf.split_mut();
3739        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3740        debug_assert_eq!(tx_header.tx_id, 0);
3741        match tx_header.ordinal {
3742            0x10f69a5cdeece84a => {
3743                let mut out = fidl::new_empty!(
3744                    FlatlandOnNextFrameBeginRequest,
3745                    fidl::encoding::DefaultFuchsiaResourceDialect
3746                );
3747                fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandOnNextFrameBeginRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
3748                Ok((FlatlandEvent::OnNextFrameBegin { values: out.values }))
3749            }
3750            0x56e43e1a5f30216d => {
3751                let mut out = fidl::new_empty!(
3752                    FlatlandOnFramePresentedRequest,
3753                    fidl::encoding::DefaultFuchsiaResourceDialect
3754                );
3755                fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandOnFramePresentedRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
3756                Ok((FlatlandEvent::OnFramePresented {
3757                    frame_presented_info: out.frame_presented_info,
3758                }))
3759            }
3760            0x1ebf39e90cd8b8d => {
3761                let mut out = fidl::new_empty!(
3762                    FlatlandOnErrorRequest,
3763                    fidl::encoding::DefaultFuchsiaResourceDialect
3764                );
3765                fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandOnErrorRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
3766                Ok((FlatlandEvent::OnError { error: out.error }))
3767            }
3768            _ => Err(fidl::Error::UnknownOrdinal {
3769                ordinal: tx_header.ordinal,
3770                protocol_name: <FlatlandMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3771            }),
3772        }
3773    }
3774}
3775
3776/// A Stream of incoming requests for fuchsia.ui.composition/Flatland.
3777pub struct FlatlandRequestStream {
3778    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3779    is_terminated: bool,
3780}
3781
3782impl std::marker::Unpin for FlatlandRequestStream {}
3783
3784impl futures::stream::FusedStream for FlatlandRequestStream {
3785    fn is_terminated(&self) -> bool {
3786        self.is_terminated
3787    }
3788}
3789
3790impl fidl::endpoints::RequestStream for FlatlandRequestStream {
3791    type Protocol = FlatlandMarker;
3792    type ControlHandle = FlatlandControlHandle;
3793
3794    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
3795        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3796    }
3797
3798    fn control_handle(&self) -> Self::ControlHandle {
3799        FlatlandControlHandle { inner: self.inner.clone() }
3800    }
3801
3802    fn into_inner(
3803        self,
3804    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3805    {
3806        (self.inner, self.is_terminated)
3807    }
3808
3809    fn from_inner(
3810        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3811        is_terminated: bool,
3812    ) -> Self {
3813        Self { inner, is_terminated }
3814    }
3815}
3816
3817impl futures::Stream for FlatlandRequestStream {
3818    type Item = Result<FlatlandRequest, fidl::Error>;
3819
3820    fn poll_next(
3821        mut self: std::pin::Pin<&mut Self>,
3822        cx: &mut std::task::Context<'_>,
3823    ) -> std::task::Poll<Option<Self::Item>> {
3824        let this = &mut *self;
3825        if this.inner.check_shutdown(cx) {
3826            this.is_terminated = true;
3827            return std::task::Poll::Ready(None);
3828        }
3829        if this.is_terminated {
3830            panic!("polled FlatlandRequestStream after completion");
3831        }
3832        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3833            |bytes, handles| {
3834                match this.inner.channel().read_etc(cx, bytes, handles) {
3835                    std::task::Poll::Ready(Ok(())) => {}
3836                    std::task::Poll::Pending => return std::task::Poll::Pending,
3837                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3838                        this.is_terminated = true;
3839                        return std::task::Poll::Ready(None);
3840                    }
3841                    std::task::Poll::Ready(Err(e)) => {
3842                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3843                            e.into(),
3844                        ))));
3845                    }
3846                }
3847
3848                // A message has been received from the channel
3849                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3850
3851                std::task::Poll::Ready(Some(match header.ordinal {
3852                    0x245e1ac080772c8 => {
3853                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3854                        let mut req = fidl::new_empty!(
3855                            TrustedFlatlandReleaseImageImmediatelyRequest,
3856                            fidl::encoding::DefaultFuchsiaResourceDialect
3857                        );
3858                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<TrustedFlatlandReleaseImageImmediatelyRequest>(&header, _body_bytes, handles, &mut req)?;
3859                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
3860                        Ok(FlatlandRequest::ReleaseImageImmediately {
3861                            image_id: req.image_id,
3862
3863                            control_handle,
3864                        })
3865                    }
3866                    0x50acc2aa1f0acec7 => {
3867                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3868                        let mut req = fidl::new_empty!(
3869                            FlatlandPresentRequest,
3870                            fidl::encoding::DefaultFuchsiaResourceDialect
3871                        );
3872                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandPresentRequest>(&header, _body_bytes, handles, &mut req)?;
3873                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
3874                        Ok(FlatlandRequest::Present { args: req.args, control_handle })
3875                    }
3876                    0x504686eb25864780 => {
3877                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3878                        let mut req = fidl::new_empty!(
3879                            FlatlandCreateViewRequest,
3880                            fidl::encoding::DefaultFuchsiaResourceDialect
3881                        );
3882                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandCreateViewRequest>(&header, _body_bytes, handles, &mut req)?;
3883                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
3884                        Ok(FlatlandRequest::CreateView {
3885                            token: req.token,
3886                            parent_viewport_watcher: req.parent_viewport_watcher,
3887
3888                            control_handle,
3889                        })
3890                    }
3891                    0x340a3a40c2fdbd5e => {
3892                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3893                        let mut req = fidl::new_empty!(
3894                            FlatlandCreateView2Request,
3895                            fidl::encoding::DefaultFuchsiaResourceDialect
3896                        );
3897                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandCreateView2Request>(&header, _body_bytes, handles, &mut req)?;
3898                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
3899                        Ok(FlatlandRequest::CreateView2 {
3900                            token: req.token,
3901                            view_identity: req.view_identity,
3902                            protocols: req.protocols,
3903                            parent_viewport_watcher: req.parent_viewport_watcher,
3904
3905                            control_handle,
3906                        })
3907                    }
3908                    0x5e042a4d3de3efb0 => {
3909                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3910                        let mut req = fidl::new_empty!(
3911                            FlatlandCreateTransformRequest,
3912                            fidl::encoding::DefaultFuchsiaResourceDialect
3913                        );
3914                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandCreateTransformRequest>(&header, _body_bytes, handles, &mut req)?;
3915                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
3916                        Ok(FlatlandRequest::CreateTransform {
3917                            transform_id: req.transform_id,
3918
3919                            control_handle,
3920                        })
3921                    }
3922                    0x7863398291fba346 => {
3923                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3924                        let mut req = fidl::new_empty!(
3925                            FlatlandSetTranslationRequest,
3926                            fidl::encoding::DefaultFuchsiaResourceDialect
3927                        );
3928                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetTranslationRequest>(&header, _body_bytes, handles, &mut req)?;
3929                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
3930                        Ok(FlatlandRequest::SetTranslation {
3931                            transform_id: req.transform_id,
3932                            translation: req.translation,
3933
3934                            control_handle,
3935                        })
3936                    }
3937                    0x4915310bc4928edc => {
3938                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3939                        let mut req = fidl::new_empty!(
3940                            FlatlandSetOrientationRequest,
3941                            fidl::encoding::DefaultFuchsiaResourceDialect
3942                        );
3943                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetOrientationRequest>(&header, _body_bytes, handles, &mut req)?;
3944                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
3945                        Ok(FlatlandRequest::SetOrientation {
3946                            transform_id: req.transform_id,
3947                            orientation: req.orientation,
3948
3949                            control_handle,
3950                        })
3951                    }
3952                    0x1ea1766fd8996bb4 => {
3953                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3954                        let mut req = fidl::new_empty!(
3955                            FlatlandSetScaleRequest,
3956                            fidl::encoding::DefaultFuchsiaResourceDialect
3957                        );
3958                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetScaleRequest>(&header, _body_bytes, handles, &mut req)?;
3959                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
3960                        Ok(FlatlandRequest::SetScale {
3961                            transform_id: req.transform_id,
3962                            scale: req.scale,
3963
3964                            control_handle,
3965                        })
3966                    }
3967                    0x3775fc2c00b432fa => {
3968                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3969                        let mut req = fidl::new_empty!(
3970                            FlatlandSetOpacityRequest,
3971                            fidl::encoding::DefaultFuchsiaResourceDialect
3972                        );
3973                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetOpacityRequest>(&header, _body_bytes, handles, &mut req)?;
3974                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
3975                        Ok(FlatlandRequest::SetOpacity {
3976                            transform_id: req.transform_id,
3977                            value: req.value,
3978
3979                            control_handle,
3980                        })
3981                    }
3982                    0x6507843df12222d2 => {
3983                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3984                        let mut req = fidl::new_empty!(
3985                            FlatlandSetClipBoundaryRequest,
3986                            fidl::encoding::DefaultFuchsiaResourceDialect
3987                        );
3988                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetClipBoundaryRequest>(&header, _body_bytes, handles, &mut req)?;
3989                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
3990                        Ok(FlatlandRequest::SetClipBoundary {
3991                            transform_id: req.transform_id,
3992                            rect: req.rect,
3993
3994                            control_handle,
3995                        })
3996                    }
3997                    0x67a8abd2f19b1a74 => {
3998                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3999                        let mut req = fidl::new_empty!(
4000                            FlatlandAddChildRequest,
4001                            fidl::encoding::DefaultFuchsiaResourceDialect
4002                        );
4003                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandAddChildRequest>(&header, _body_bytes, handles, &mut req)?;
4004                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4005                        Ok(FlatlandRequest::AddChild {
4006                            parent_transform_id: req.parent_transform_id,
4007                            child_transform_id: req.child_transform_id,
4008
4009                            control_handle,
4010                        })
4011                    }
4012                    0x41d6cd90b298b67a => {
4013                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4014                        let mut req = fidl::new_empty!(
4015                            FlatlandRemoveChildRequest,
4016                            fidl::encoding::DefaultFuchsiaResourceDialect
4017                        );
4018                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandRemoveChildRequest>(&header, _body_bytes, handles, &mut req)?;
4019                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4020                        Ok(FlatlandRequest::RemoveChild {
4021                            parent_transform_id: req.parent_transform_id,
4022                            child_transform_id: req.child_transform_id,
4023
4024                            control_handle,
4025                        })
4026                    }
4027                    0x5b6d86cbbff81316 => {
4028                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4029                        let mut req = fidl::new_empty!(
4030                            FlatlandReplaceChildrenRequest,
4031                            fidl::encoding::DefaultFuchsiaResourceDialect
4032                        );
4033                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandReplaceChildrenRequest>(&header, _body_bytes, handles, &mut req)?;
4034                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4035                        Ok(FlatlandRequest::ReplaceChildren {
4036                            parent_transform_id: req.parent_transform_id,
4037                            new_child_transform_ids: req.new_child_transform_ids,
4038
4039                            control_handle,
4040                        })
4041                    }
4042                    0x6e80ca5bcc566cd8 => {
4043                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4044                        let mut req = fidl::new_empty!(
4045                            FlatlandSetRootTransformRequest,
4046                            fidl::encoding::DefaultFuchsiaResourceDialect
4047                        );
4048                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetRootTransformRequest>(&header, _body_bytes, handles, &mut req)?;
4049                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4050                        Ok(FlatlandRequest::SetRootTransform {
4051                            transform_id: req.transform_id,
4052
4053                            control_handle,
4054                        })
4055                    }
4056                    0x31c9d17b07c37ce4 => {
4057                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4058                        let mut req = fidl::new_empty!(
4059                            FlatlandSetHitRegionsRequest,
4060                            fidl::encoding::DefaultFuchsiaResourceDialect
4061                        );
4062                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetHitRegionsRequest>(&header, _body_bytes, handles, &mut req)?;
4063                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4064                        Ok(FlatlandRequest::SetHitRegions {
4065                            transform_id: req.transform_id,
4066                            regions: req.regions,
4067
4068                            control_handle,
4069                        })
4070                    }
4071                    0x26d81af852d29562 => {
4072                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4073                        let mut req = fidl::new_empty!(
4074                            FlatlandSetInfiniteHitRegionRequest,
4075                            fidl::encoding::DefaultFuchsiaResourceDialect
4076                        );
4077                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetInfiniteHitRegionRequest>(&header, _body_bytes, handles, &mut req)?;
4078                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4079                        Ok(FlatlandRequest::SetInfiniteHitRegion {
4080                            transform_id: req.transform_id,
4081                            hit_test: req.hit_test,
4082
4083                            control_handle,
4084                        })
4085                    }
4086                    0x2485fbcab7f943c => {
4087                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4088                        let mut req = fidl::new_empty!(
4089                            FlatlandCreateViewportRequest,
4090                            fidl::encoding::DefaultFuchsiaResourceDialect
4091                        );
4092                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandCreateViewportRequest>(&header, _body_bytes, handles, &mut req)?;
4093                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4094                        Ok(FlatlandRequest::CreateViewport {
4095                            viewport_id: req.viewport_id,
4096                            token: req.token,
4097                            properties: req.properties,
4098                            child_view_watcher: req.child_view_watcher,
4099
4100                            control_handle,
4101                        })
4102                    }
4103                    0x26fae823c4ebedad => {
4104                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4105                        let mut req = fidl::new_empty!(
4106                            FlatlandCreateImageRequest,
4107                            fidl::encoding::DefaultFuchsiaResourceDialect
4108                        );
4109                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandCreateImageRequest>(&header, _body_bytes, handles, &mut req)?;
4110                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4111                        Ok(FlatlandRequest::CreateImage {
4112                            image_id: req.image_id,
4113                            import_token: req.import_token,
4114                            vmo_index: req.vmo_index,
4115                            properties: req.properties,
4116
4117                            control_handle,
4118                        })
4119                    }
4120                    0x8039391d715eb28 => {
4121                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4122                        let mut req = fidl::new_empty!(
4123                            FlatlandSetImageSampleRegionRequest,
4124                            fidl::encoding::DefaultFuchsiaResourceDialect
4125                        );
4126                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetImageSampleRegionRequest>(&header, _body_bytes, handles, &mut req)?;
4127                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4128                        Ok(FlatlandRequest::SetImageSampleRegion {
4129                            image_id: req.image_id,
4130                            rect: req.rect,
4131
4132                            control_handle,
4133                        })
4134                    }
4135                    0x766cf99a2ec58446 => {
4136                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4137                        let mut req = fidl::new_empty!(
4138                            FlatlandSetImageDestinationSizeRequest,
4139                            fidl::encoding::DefaultFuchsiaResourceDialect
4140                        );
4141                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetImageDestinationSizeRequest>(&header, _body_bytes, handles, &mut req)?;
4142                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4143                        Ok(FlatlandRequest::SetImageDestinationSize {
4144                            image_id: req.image_id,
4145                            size: req.size,
4146
4147                            control_handle,
4148                        })
4149                    }
4150                    0x10f5da1356275b7b => {
4151                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4152                        let mut req = fidl::new_empty!(
4153                            FlatlandSetImageBlendingFunctionRequest,
4154                            fidl::encoding::DefaultFuchsiaResourceDialect
4155                        );
4156                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetImageBlendingFunctionRequest>(&header, _body_bytes, handles, &mut req)?;
4157                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4158                        Ok(FlatlandRequest::SetImageBlendingFunction {
4159                            image_id: req.image_id,
4160                            blend_mode: req.blend_mode,
4161
4162                            control_handle,
4163                        })
4164                    }
4165                    0x5b1667f130c3de67 => {
4166                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4167                        let mut req = fidl::new_empty!(
4168                            FlatlandSetImageBlendModeRequest,
4169                            fidl::encoding::DefaultFuchsiaResourceDialect
4170                        );
4171                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetImageBlendModeRequest>(&header, _body_bytes, handles, &mut req)?;
4172                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4173                        Ok(FlatlandRequest::SetImageBlendMode {
4174                            image_id: req.image_id,
4175                            blend_mode: req.blend_mode,
4176
4177                            control_handle,
4178                        })
4179                    }
4180                    0x2da9e4ef4c2cff6f => {
4181                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4182                        let mut req = fidl::new_empty!(
4183                            FlatlandSetImageOpacityRequest,
4184                            fidl::encoding::DefaultFuchsiaResourceDialect
4185                        );
4186                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetImageOpacityRequest>(&header, _body_bytes, handles, &mut req)?;
4187                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4188                        Ok(FlatlandRequest::SetImageOpacity {
4189                            image_id: req.image_id,
4190                            val: req.val,
4191
4192                            control_handle,
4193                        })
4194                    }
4195                    0x21b20f2c14aae6bc => {
4196                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4197                        let mut req = fidl::new_empty!(
4198                            FlatlandSetImageFlipRequest,
4199                            fidl::encoding::DefaultFuchsiaResourceDialect
4200                        );
4201                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetImageFlipRequest>(&header, _body_bytes, handles, &mut req)?;
4202                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4203                        Ok(FlatlandRequest::SetImageFlip {
4204                            image_id: req.image_id,
4205                            flip: req.flip,
4206
4207                            control_handle,
4208                        })
4209                    }
4210                    0x5e62355abc1c4c5d => {
4211                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4212                        let mut req = fidl::new_empty!(
4213                            FlatlandCreateFilledRectRequest,
4214                            fidl::encoding::DefaultFuchsiaResourceDialect
4215                        );
4216                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandCreateFilledRectRequest>(&header, _body_bytes, handles, &mut req)?;
4217                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4218                        Ok(FlatlandRequest::CreateFilledRect {
4219                            rect_id: req.rect_id,
4220
4221                            control_handle,
4222                        })
4223                    }
4224                    0x32d6ef41e182dfa5 => {
4225                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4226                        let mut req = fidl::new_empty!(
4227                            FlatlandSetSolidFillRequest,
4228                            fidl::encoding::DefaultFuchsiaResourceDialect
4229                        );
4230                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetSolidFillRequest>(&header, _body_bytes, handles, &mut req)?;
4231                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4232                        Ok(FlatlandRequest::SetSolidFill {
4233                            rect_id: req.rect_id,
4234                            color: req.color,
4235                            size: req.size,
4236
4237                            control_handle,
4238                        })
4239                    }
4240                    0x7392cabe45618f9b => {
4241                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4242                        let mut req = fidl::new_empty!(
4243                            FlatlandReleaseFilledRectRequest,
4244                            fidl::encoding::DefaultFuchsiaResourceDialect
4245                        );
4246                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandReleaseFilledRectRequest>(&header, _body_bytes, handles, &mut req)?;
4247                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4248                        Ok(FlatlandRequest::ReleaseFilledRect {
4249                            rect_id: req.rect_id,
4250
4251                            control_handle,
4252                        })
4253                    }
4254                    0x4ed2cfc0ce130862 => {
4255                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4256                        let mut req = fidl::new_empty!(
4257                            FlatlandSetContentRequest,
4258                            fidl::encoding::DefaultFuchsiaResourceDialect
4259                        );
4260                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetContentRequest>(&header, _body_bytes, handles, &mut req)?;
4261                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4262                        Ok(FlatlandRequest::SetContent {
4263                            transform_id: req.transform_id,
4264                            content_id: req.content_id,
4265
4266                            control_handle,
4267                        })
4268                    }
4269                    0x66ab67e9608ddb9f => {
4270                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4271                        let mut req = fidl::new_empty!(
4272                            FlatlandSetViewportPropertiesRequest,
4273                            fidl::encoding::DefaultFuchsiaResourceDialect
4274                        );
4275                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetViewportPropertiesRequest>(&header, _body_bytes, handles, &mut req)?;
4276                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4277                        Ok(FlatlandRequest::SetViewportProperties {
4278                            viewport_id: req.viewport_id,
4279                            properties: req.properties,
4280
4281                            control_handle,
4282                        })
4283                    }
4284                    0xab9328419451c22 => {
4285                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4286                        let mut req = fidl::new_empty!(
4287                            FlatlandReleaseTransformRequest,
4288                            fidl::encoding::DefaultFuchsiaResourceDialect
4289                        );
4290                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandReleaseTransformRequest>(&header, _body_bytes, handles, &mut req)?;
4291                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4292                        Ok(FlatlandRequest::ReleaseTransform {
4293                            transform_id: req.transform_id,
4294
4295                            control_handle,
4296                        })
4297                    }
4298                    0x5b35aab9baffecae => {
4299                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4300                        let mut req = fidl::new_empty!(
4301                            fidl::encoding::EmptyPayload,
4302                            fidl::encoding::DefaultFuchsiaResourceDialect
4303                        );
4304                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
4305                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4306                        Ok(FlatlandRequest::ReleaseView { control_handle })
4307                    }
4308                    0xbad474aeb5293f9 => {
4309                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4310                        let mut req = fidl::new_empty!(
4311                            FlatlandReleaseViewportRequest,
4312                            fidl::encoding::DefaultFuchsiaResourceDialect
4313                        );
4314                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandReleaseViewportRequest>(&header, _body_bytes, handles, &mut req)?;
4315                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4316                        Ok(FlatlandRequest::ReleaseViewport {
4317                            viewport_id: req.viewport_id,
4318
4319                            responder: FlatlandReleaseViewportResponder {
4320                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4321                                tx_id: header.tx_id,
4322                            },
4323                        })
4324                    }
4325                    0xb884ffdbc72c111 => {
4326                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4327                        let mut req = fidl::new_empty!(
4328                            FlatlandReleaseImageRequest,
4329                            fidl::encoding::DefaultFuchsiaResourceDialect
4330                        );
4331                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandReleaseImageRequest>(&header, _body_bytes, handles, &mut req)?;
4332                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4333                        Ok(FlatlandRequest::ReleaseImage { image_id: req.image_id, control_handle })
4334                    }
4335                    0x4ec8817c02828c3e => {
4336                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4337                        let mut req = fidl::new_empty!(
4338                            fidl::encoding::EmptyPayload,
4339                            fidl::encoding::DefaultFuchsiaResourceDialect
4340                        );
4341                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
4342                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4343                        Ok(FlatlandRequest::Clear { control_handle })
4344                    }
4345                    0x46a8b397e68a8888 => {
4346                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4347                        let mut req = fidl::new_empty!(
4348                            FlatlandSetDebugNameRequest,
4349                            fidl::encoding::DefaultFuchsiaResourceDialect
4350                        );
4351                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetDebugNameRequest>(&header, _body_bytes, handles, &mut req)?;
4352                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4353                        Ok(FlatlandRequest::SetDebugName { name: req.name, control_handle })
4354                    }
4355                    _ => Err(fidl::Error::UnknownOrdinal {
4356                        ordinal: header.ordinal,
4357                        protocol_name:
4358                            <FlatlandMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4359                    }),
4360                }))
4361            },
4362        )
4363    }
4364}
4365
4366/// Each Flatland instance contains a Graph, which consists of a set of objects, and the
4367/// relationships between those objects. The client can specify a subset of those objects
4368/// (specifically, the directed acyclic graph starting at the root transform) to be presented as
4369/// content to some kind of output -- usually, a display.
4370///
4371/// Flatland Graphs are both hierarchical, and distributed. Graphs from different Flatland instances
4372/// may be connected together, allowing multiple processes to be involved in authoring content for a
4373/// particular output.
4374///
4375/// All functions in this protocol are feed-forward. The operations they represent are not fully
4376/// executed until [`Present`] is called.
4377#[derive(Debug)]
4378pub enum FlatlandRequest {
4379    /// Releases an image immediately, without waiting for the next present.
4380    ReleaseImageImmediately {
4381        image_id: ContentId,
4382        control_handle: FlatlandControlHandle,
4383    },
4384    /// Complete execution of all feed-forward operations.
4385    ///
4386    /// If executing an operation produces an error (e.g., CreateTransform(0)), an [`OnError`] event
4387    /// is emitted. Operations that produce errors are ignored and the channel is closed.
4388    ///
4389    /// If the execution is completed successfully, [`OnNextFrameBegin`] emits NO_ERROR along
4390    /// with other valid fields.
4391    ///
4392    /// The client may only call [`Present`] when they have a non-zero number of present credits,
4393    /// which are tracked by the server. The server may increment the number of credits when it
4394    /// fires the [`OnNextFrameBegin`] event, which informs the client when it receives additional
4395    /// present credits. Each [`Present`] call uses one present credit and decrements the server
4396    /// count by one. If the client calls [`Present`] with no present credits, the server will
4397    /// return a `NO_PRESENTS_REMAINING` error.
4398    ///
4399    /// The client should assume that prior to receiving any [`OnNextFrameBegin`] events, they have
4400    /// one present credit.
4401    ///
4402    /// Every [`Present`] call results in one [`OnNextFrameBegin`] event, and one
4403    /// [`OnFramePresented`] event, typically in that order.
4404    ///
4405    /// When the commands flushed by [`Present`] make it to display, an [`OnFramePresented`] event
4406    /// is fired. This event includes information pertaining to all [`Present`]s that had content
4407    /// that were part of that frame.
4408    ///
4409    /// See [`fuchsia.ui.composition/PresentArgs`] documentation above for more detailed information
4410    /// on what arguments are passed in and their role.
4411    Present {
4412        args: PresentArgs,
4413        control_handle: FlatlandControlHandle,
4414    },
4415    /// Two Flatland instances may be connected in a parent-child relationship. The parent endpoint
4416    /// is held in a Viewport, and the child endpoint is held in a View. The parent Flatland
4417    /// instance that creates a Viewport has control over how the child's View is integrated into
4418    /// its own View.
4419    ///
4420    /// The lifecycle of a parent-child connection starts with two endpoints of a channel object:
4421    /// a ViewportCreationToken and a ViewCreationToken. Out-of-band protocols pass the
4422    /// ViewportCreationToken to the parent, which calls [`CreateViewport`], and the
4423    /// ViewCreationToken to the child, which calls [`CreateView`].
4424    ///
4425    /// Only nodes connected to the Root Transform in this Flatland instance will be rendered into
4426    /// the parent's Viewport.
4427    ///
4428    /// Calling [`CreateView`] a second time will disconnect the Root Transform from the existing
4429    /// parent's Viewport, and attach it to a new parent's Viewport. In other words, each View can
4430    /// only have one parent.
4431    ///
4432    /// This function is queued, meaning that the Root Transform will not be attached to the
4433    /// parent Viewport until [`Present`] is called. However, clients will receive information
4434    /// through their ParentViewportWatcher (e.g., LayoutInfo) immediately after calling this
4435    /// function, even if they have not called [`Present`] or [`SetRootTransform`]. This allows
4436    /// clients to wait for layout information from their parent before calling [`Present`].
4437    ///
4438    /// Any illegal operations on ParentViewportWatcher will cause both ParentViewportWatcher
4439    /// channel and this Flatland channel to be torn down.
4440    ///
4441    /// Lifecycle note. The lifetime of the ParentViewportWatcher channel is bound by the peer
4442    /// ViewportCreationToken. When the ViewportCreationToken dies, this ParentViewportWatcher
4443    /// channel is destroyed.
4444    ///
4445    /// Views and subgraphs of Views created using `CreateView` will not be represented in the
4446    /// ViewTree, and hence will not be able to participate in any ViewTree-dependent interactions
4447    /// such as touch, mouse or focus.
4448    /// The Flatland protocol provides no way for Views in the subgraph of a View created with
4449    /// `CreateView` to know that they are excluded from the ViewTree.
4450    CreateView {
4451        token: fidl_fuchsia_ui_views::ViewCreationToken,
4452        parent_viewport_watcher: fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>,
4453        control_handle: FlatlandControlHandle,
4454    },
4455    /// Identical to [`CreateView`], except it allows association of View identity (ViewRef) and
4456    /// view-bound protocols.
4457    CreateView2 {
4458        token: fidl_fuchsia_ui_views::ViewCreationToken,
4459        view_identity: fidl_fuchsia_ui_views::ViewIdentityOnCreation,
4460        protocols: ViewBoundProtocols,
4461        parent_viewport_watcher: fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>,
4462        control_handle: FlatlandControlHandle,
4463    },
4464    /// Creates a new Transform node. Transforms are a hierarchical piece of a Flatland graph. They
4465    /// can have children, and can reference Content. A sub-graph represented by a Transform and its
4466    /// descendants can be rendered to a display.
4467    ///
4468    /// Transforms are kept alive, even when released, as long as they are children of either an
4469    /// unreleased Transform, or the Root Transform.
4470    ///
4471    /// Each Transform can have a single piece of attached Content. Common types of Content include
4472    /// bitmaps, asynchronous streams of images, and Viewports to Views hosted in other Flatland
4473    /// instances.
4474    ///
4475    /// Transforms have attributes. Child Transforms inherit the combined attributes of their
4476    /// parents. Content attached to a Transform is also affected by that Transform's attributes.
4477    ///
4478    /// When a sub-graph of Transforms is rendered, Content will be rendered back-to-front, starting
4479    /// with the Content on the root transform, and continuing recursively through all of its child
4480    /// Transforms in the order the children were added. See [`AddChild`] for more information.
4481    ///
4482    /// Zero is not a valid transform id. All other values are valid, assuming they are not already
4483    /// in use (see [`ReleaseTransform`] for more details).
4484    CreateTransform {
4485        transform_id: TransformId,
4486        control_handle: FlatlandControlHandle,
4487    },
4488    /// All Transform objects support all attributes.
4489    ///
4490    /// Geometric attributes are applied in the following order:
4491    /// 1. Scale (relative to the parent transform's coordinate space)
4492    /// 2. Orientation (relative to the parent transform's coordinate space)
4493    /// 3. Translation (relative to the parent transforms's coordinate space,
4494    ///    unaffected by scale applied to the current transform).
4495    /// 4. Clipping (relative to the current transform's coordinate space)
4496    ///
4497    /// The effects of each of these attributes are cumulative. This means the transform's position
4498    /// in the view space, and its clip boundary, will be calculated based on that chain of
4499    /// geometric attributes going up to the root transform.
4500    ///
4501    /// For instance, in a nested hierarchy such as the following:
4502    ///     [Root-Transform -> Transform1 -> Transform2 -> CurrentTransform]
4503    /// If Transform1 is translated by [2,0] and Transform2 is translated by [0,1] then the
4504    /// view-space position of CurrentTransform will be [2,1].
4505    ///
4506    /// Sets the translation on a Transform. The order of geometric attribute application is
4507    /// addressed above.
4508    SetTranslation {
4509        transform_id: TransformId,
4510        translation: fidl_fuchsia_math::Vec_,
4511        control_handle: FlatlandControlHandle,
4512    },
4513    /// Sets the orientation on a Transform. The order of geometric attribute application is
4514    /// addressed in the documentation for [`SetTranslation`]. In Flatland, the +X axis is
4515    /// to the right and the +Y axis is down. There is no notion of a Z axis. CCW is defined
4516    /// from the POV of the user, as if a skeuomorphoic clock is displayed on the screen.
4517    SetOrientation {
4518        transform_id: TransformId,
4519        orientation: Orientation,
4520        control_handle: FlatlandControlHandle,
4521    },
4522    /// Sets the scale on a transform. The order of geometric attribute application is
4523    /// addressed above. The (x,y) values in the VecF |scale| refer to the scale factor in the
4524    /// x-axis (width) and y-axis (height) respectively. Scale values must be normal 32-bit
4525    /// floating point values: https://en.wikipedia.org/wiki/Normal_number_%28computing%29
4526    SetScale {
4527        transform_id: TransformId,
4528        scale: fidl_fuchsia_math::VecF,
4529        control_handle: FlatlandControlHandle,
4530    },
4531    /// Sets an opacity in linear space to be applied to a transform and its descendents,
4532    /// which include other transforms and content. Opacity values must be in the range
4533    /// of [0.0, 1.0], where 0.0 is completely transparent and 1.0 is completely opaque.
4534    /// Attempting to call this function with values outside that range will result in
4535    /// an error. A transform's opacity value is multiplied with that of its parent. This
4536    /// effect works differently from group opacity. Using group opacity, child nodes are
4537    /// rendered together first, and then have the parent's opacity applied as a post-effect.
4538    /// Here, opacity is applied to each child individually. This may result in a very
4539    /// different effect.
4540    SetOpacity {
4541        transform_id: TransformId,
4542        value: f32,
4543        control_handle: FlatlandControlHandle,
4544    },
4545    /// Sets the bounds, expressed in the local coordinate space of the transform, that
4546    /// constrains the region that content attached to this transform can be rendered to.
4547    /// If the content's area exceeds the clip bounds, the area outside the bounds will
4548    /// not be rendered. These bounds are valid for all children of this transform node as
4549    /// well, which includes nested Flatland instances and their node hierarchies.
4550    /// If a child transform attempts to set clip bounds larger than that of its parent,
4551    /// it will be clipped to the parent's clip bounds. The default state is for a transform
4552    /// to be unclipped, meaning it will not have any bounds placed on its render region.
4553    /// The clip width/height must be positive. Negative values will result in an error.
4554    /// Passing in an empty box to the |rect| parameter will remove the clip bounds.
4555    SetClipBoundary {
4556        transform_id: TransformId,
4557        rect: Option<Box<fidl_fuchsia_math::Rect>>,
4558        control_handle: FlatlandControlHandle,
4559    },
4560    /// Adds a child Transform to a parent Transform. The new child Transform,
4561    /// and any Content attached to it or its children, will be rendered on top
4562    /// of the parent's Content, as well as any previously added children.
4563    ///
4564    /// The caller must ensure that `child_transform_id` is valid and that there
4565    /// are no repetitions.  Sending a repeated `child_transform_id` over
4566    /// multiple calls will result in session closure.
4567    AddChild {
4568        parent_transform_id: TransformId,
4569        child_transform_id: TransformId,
4570        control_handle: FlatlandControlHandle,
4571    },
4572    /// Removes a child Transform from a parent Transform.
4573    RemoveChild {
4574        parent_transform_id: TransformId,
4575        child_transform_id: TransformId,
4576        control_handle: FlatlandControlHandle,
4577    },
4578    /// Removes all child Transforms from a parent Transform and replaces them
4579    /// with the new child transforms in `new_child_transform_ids`.  The caller
4580    /// must ensure that all `TransformId` values in `new_child_transform_ids`
4581    /// are valid and that there are no repetitions.  Sending a repeated
4582    /// `TransformId` in `new_child_transform_ids` will result in session
4583    /// closure.
4584    ReplaceChildren {
4585        parent_transform_id: TransformId,
4586        new_child_transform_ids: Vec<TransformId>,
4587        control_handle: FlatlandControlHandle,
4588    },
4589    /// Sets the Root Transform for the graph.
4590    ///
4591    /// The sub-graph defined by the Root Transform and its children will be rendered as View
4592    /// in the connected parent's Viewport (see [`CreateView`]). Any parents of the Root Transform
4593    /// in this Graph will be ignored.
4594    ///
4595    /// The Root Transform, and all children of the Root Transform, are kept alive if they are
4596    /// released (see [`ReleaseTransform`] for more details).
4597    ///
4598    /// There is only ever one Root. Since 0 is not a valid transform id (see [`CreateTransform`]),
4599    /// calling SetRootTransform(0) clears the current Root, destroying any previously released
4600    /// objects that are not referenced by the new root.
4601    ///
4602    /// Note that every View has a clip boundary equivalent to its logical size. Anything outside
4603    /// that clip boundary will not be rendered. Hence, the Root Transform has a useful coordinate
4604    /// space of (0, 0) to (logical_size.width, logical_size.height), where (0, 0) is the upper left
4605    /// corner.
4606    ///
4607    /// Setting the root transform installs a full screen hit region on the root transform. Clients
4608    /// may remove this hit region if they don't want users to be able to interact with the root
4609    /// transform's content. For additional details on hit regions, see the [`SetHitRegions`]
4610    /// documentation.
4611    ///
4612    /// Default hit region rules
4613    ///
4614    ///   A default hit region follows these rules:
4615    ///   - When [`SetRootTransform`](T) is called, T receives a maximal hit region, covering the
4616    ///   entire view.
4617    ///   - If [`SetHitRegions`] is called on T, either before or after [`SetRootTransform`](T),
4618    ///   then no default hit region is active and the client specified hit regions are used.
4619    ///   - If a transform is no longer the root transform, i.e., [`SetRootTransform`](U) is
4620    ///   called, then the original transform no longer has its default hit region.
4621    ///   - Clients can remove or modify the root transform's hit regions the same way they would
4622    ///   reset any other transform's hit regions, by calling [`SetHitRegions`] with the appropriate
4623    ///   vector.
4624    SetRootTransform {
4625        transform_id: TransformId,
4626        control_handle: FlatlandControlHandle,
4627    },
4628    /// Sets the interactive areas for a Transform. By default, Content is not interactive; hit
4629    /// regions must be placed for a user to interact with the Content in a View. Because hit
4630    /// regions are described in the Flatland protocol, a Flatland instance can synchronize Content
4631    /// and hit regions.
4632    ///
4633    /// Each hit region is placed in the coordinate space of the owning Transform, and may or may
4634    /// not interact with different types of hit testing, depending on its [`HitTestInteraction`]
4635    /// type. When there are multiple hit regions that intersect with a hit test, the precedence
4636    /// rules given below dictate which hit region has interacted with the hit test. Only Transforms
4637    /// that transitively connect to the root Transform have their hit regions interact with a hit
4638    /// test.
4639    ///
4640    /// Calling this function replaces any previous values set on this Transform. To reset a
4641    /// Transform to "no hit testing": send an empty vector with [`SetHitRegions`].
4642    ///
4643    /// Note that root transforms get a default hit region installed by Flatland. For more details,
4644    /// see the [`SetRootTransform`] documentation.
4645    ///
4646    /// Precedence rules
4647    ///   Within a Transform, if multiple hit regions overlap, the hit test examines each
4648    ///   intersecting hit region for a possible interaction. Thus, for a regular hit test R and an
4649    ///   accessibility hit test A, where R and A both intersect two hit regions D ([`DEFAULT`]) and
4650    ///   S ([`SEMANTICALLY_INVISIBLE`]) on the same Transform, (1) R interacts with both D and S,
4651    ///   and (2) A only interacts with D. Generally, hit regions that overlap in a single Transform
4652    ///   can cause confusing behavior.
4653    ///
4654    ///   Within a View, for a given hit test, the front-most Transform's hit regions take
4655    ///   precedence over those behind. This follows the expected reverse "render order" of
4656    ///   Transforms (described in [`CreateTransform`]), where a user expects to interact with
4657    ///   Content that is visible, or front-most.
4658    ///
4659    ///   Across Flatland instances, for a given hit test, the front-most instance's front-most
4660    ///   Transform's hit regions take precedence over those behind. This follows the expected
4661    ///   reverse "render order" of views, where a user expects to interact with the View that is
4662    ///   visible, or front-most. For example, if a child View owns Content that is rendered over
4663    ///   the parent View, the user expects to interact with the child's Content.
4664    SetHitRegions {
4665        transform_id: TransformId,
4666        regions: Vec<HitRegion>,
4667        control_handle: FlatlandControlHandle,
4668    },
4669    /// Identical to [`SetHitRegions`], except the hit region associated with [`transform_id`]
4670    /// covers an infinite region. The hit region is invariant against translation, scaling, and
4671    /// orientation of the Transform.
4672    ///
4673    /// An infinite hit region is still limited in extent by the View's clip boundary, just like a
4674    /// finite hit region.
4675    ///
4676    /// Calling this function replaces any previous values set on this Transform. To reset a
4677    /// Transform to "no hit testing": send an empty vector with [`SetHitRegions`].
4678    SetInfiniteHitRegion {
4679        transform_id: TransformId,
4680        hit_test: HitTestInteraction,
4681        control_handle: FlatlandControlHandle,
4682    },
4683    /// The Viewport and View pair, together, represent the connection between two Flatland
4684    /// instances. The Viewport is created in the parent, and the View is created in the child. The
4685    /// parent has control over how the child's View is integrated into its own View.
4686    ///
4687    /// Any illegal operations on ChildViewWatcher will cause both ChildViewWatcher channel and this
4688    /// Flatland channel to be torn down.
4689    ///
4690    /// `ViewportProperties` must have logical_size set. This is the initial size that will drive
4691    /// the layout of the child. The logical_size is also used as the default Content size, but
4692    /// subsequent changes to the logical_size will have no effect on the Content size.
4693    ///
4694    /// `ViewportProperties` may have inset field not set. In that case, the default value of
4695    /// (0, 0, 0, 0) is used.
4696    ///
4697    /// The logical_size must have positive X and Y components.
4698    ///
4699    /// Zero is not a valid ContentId. All other values are valid, assuming they are not already
4700    /// in use for another piece of Content (see [`ReleaseViewport`] for more details).
4701    ///
4702    /// Lifecycle note. The lifetime of the ChildViewWatcher channel is bound by the peer
4703    /// ViewCreationToken. When the ViewCreationToken dies, this ChildViewWatcher channel is
4704    /// destroyed.
4705    CreateViewport {
4706        viewport_id: ContentId,
4707        token: fidl_fuchsia_ui_views::ViewportCreationToken,
4708        properties: ViewportProperties,
4709        child_view_watcher: fidl::endpoints::ServerEnd<ChildViewWatcherMarker>,
4710        control_handle: FlatlandControlHandle,
4711    },
4712    /// An Image is a bitmap backed by a specific VMO in a BufferCollection.
4713    ///
4714    /// Image creation requires an allocated BufferCollection registered with Allocator. This
4715    /// function will fail unless all clients of the specified BufferCollection have set their
4716    /// constraints.
4717    ///
4718    /// The Image must reference a valid VMO index and must have ImageProperties that fall within
4719    /// the constraints specified by the backing BufferCollection (i.e. width and height within a
4720    /// valid range, etc.)
4721    ///
4722    /// Zero is not a valid Image id. All other values are valid, assuming they are not already in
4723    /// use for another piece of Content (see [`ReleaseImage`] for more details).
4724    CreateImage {
4725        image_id: ContentId,
4726        import_token: BufferCollectionImportToken,
4727        vmo_index: u32,
4728        properties: ImageProperties,
4729        control_handle: FlatlandControlHandle,
4730    },
4731    /// This function is used to determine the region (in texel space) of an image that will be used
4732    /// by Flatland when rendering. The image to be sampled is referenced by [`image_id`] and the
4733    /// sample region is specified by [`rect`] which itself is comprised of an origin point (x,y) as
4734    /// well as a width and height, in unnormalized coordinates. It is illegal to call this function
4735    /// on non-image content, or to sample a region outside of the texel space of the image. In
4736    /// other words, the region specifed by [`rect`] must not exceed the ranges (0, image_width) and
4737    /// (0, image_height). If (rect.x + rect.width > image_width) or (rect.y + rect.height >
4738    /// image_height) or if any of the values are negative, this will result in an error.
4739    ///
4740    /// If this method is not called, the default sample region is the rectangle with origin at
4741    /// (0, 0) and width and height set at ImageProperties from [`CreateImage`].
4742    SetImageSampleRegion {
4743        image_id: ContentId,
4744        rect: fidl_fuchsia_math::RectF,
4745        control_handle: FlatlandControlHandle,
4746    },
4747    /// The content size for an Image is the size of the rectangle in the parent's logical
4748    /// coordinate space that the image occupies. This combined with the global translation of the
4749    /// transform it is attached to determines the size and location of where the content is
4750    /// rendered on the display.
4751    ///
4752    /// If this method is not called, the default image destination size is the width and height set
4753    /// at ImageProperties from [`CreateImage`]. The destination size will be affected by scaling if
4754    /// [`SetScale`] is used on the attached Transform or its parents.
4755    SetImageDestinationSize {
4756        image_id: ContentId,
4757        size: fidl_fuchsia_math::SizeU,
4758        control_handle: FlatlandControlHandle,
4759    },
4760    /// Determines the blend function to use when rendering the content specified by
4761    /// |image_id|. |image_id| must be a valid ContentId associated to a transform through
4762    /// a call to |CreateImage| or |CreateFilledRect|. For details on the different blend functions
4763    /// that are available, please refer to the BlendMode enum. If this function is not called, then
4764    /// the default blendmode is BlendMode::SRC.
4765    SetImageBlendingFunction {
4766        image_id: ContentId,
4767        blend_mode: BlendMode,
4768        control_handle: FlatlandControlHandle,
4769    },
4770    /// Determines the blend function to use when rendering the content specified by
4771    /// |image_id|. |image_id| must be a valid ContentId associated to a transform through
4772    /// a call to |CreateImage| or |CreateFilledRect|. For details on the different blend functions
4773    /// that are available, please refer to the BlendMode2 enum. If this function is not called,
4774    /// the default blendmode is BlendMode2::REPLACE.
4775    SetImageBlendMode {
4776        image_id: ContentId,
4777        blend_mode: BlendMode2,
4778        control_handle: FlatlandControlHandle,
4779    },
4780    /// Sets an opacity in linear space to be applied to a flatland image. Opacity values must
4781    /// be in the range [0.0, 1.0].
4782    SetImageOpacity {
4783        image_id: ContentId,
4784        val: f32,
4785        control_handle: FlatlandControlHandle,
4786    },
4787    /// Sets the image flip to be applied to a flatland image. This call must be performed after a
4788    /// successful |CreateImage| call. If an invalid |image_id| is supplied, the channel will be
4789    /// closed due to FlatlandError::BAD_OPERATION. This flip will be applied to the Image before
4790    /// parent Transform Orientations. If this function is not called, then the default flip value
4791    /// is ImageFlip::NONE.
4792    SetImageFlip {
4793        image_id: ContentId,
4794        flip: ImageFlip,
4795        control_handle: FlatlandControlHandle,
4796    },
4797    /// Creates a solid-color rectangle. By default a filled-rect does not have a defined
4798    /// color or size. It is necessary to call |SetSolidFill| to specify a color and size
4799    /// before a filled rect can be used for rendering. Not doing so will result the
4800    CreateFilledRect {
4801        rect_id: ContentId,
4802        control_handle: FlatlandControlHandle,
4803    },
4804    /// Defines the color and size of a filled rect. |rect_id| must refer to content that
4805    /// was created via a call to CreateFilledRect. The color is not premultiplied. Color values
4806    /// must be within the range [0,1] inclusive, and normal 32-bit
4807    /// floating point values: https://en.wikipedia.org/wiki/Normal_number_%28computing%29. Values
4808    /// that do not conform to these specifications will cause the channel to close.
4809    /// The rectangle's top left corner will be at (0, 0) in its transform's coordinate space.
4810    /// Hence, its bottom right corner will be at (size.width, size.height).
4811    SetSolidFill {
4812        rect_id: ContentId,
4813        color: ColorRgba,
4814        size: fidl_fuchsia_math::SizeU,
4815        control_handle: FlatlandControlHandle,
4816    },
4817    /// Automatically garbage collects the rectangle when it is no longer needed for
4818    /// rendering. |rect_id| must have been instantiated with a call to
4819    /// |CreateFilledRect|. Once released, the ID immediately goes out of scope and is free
4820    /// to be used again.
4821    ReleaseFilledRect {
4822        rect_id: ContentId,
4823        control_handle: FlatlandControlHandle,
4824    },
4825    /// Setting a piece of Content on a Transform makes that Content visible in the render tree as
4826    /// long as the Transform is visible from the root Transform. The Content will be rendered
4827    /// before, and therefore "behind", any Content attached to the descendants of the Transform.
4828    ///
4829    /// Because each Transform can have, at most, a single piece of Content on it, calling this
4830    /// function on a Transform that already has Content will replace that Content.
4831    ///
4832    /// A Content may be set on more than one Transform.
4833    ///
4834    /// Calling this function with a Content id of 0 will remove any Content currently on the
4835    /// Transform.
4836    SetContent {
4837        transform_id: TransformId,
4838        content_id: ContentId,
4839        control_handle: FlatlandControlHandle,
4840    },
4841    /// Transforms are usually sufficient to change how Content is presented. Viewports, however,
4842    /// have special properties that are not part of the Transform hierarchy. Those properties can
4843    /// be set using this function.
4844    SetViewportProperties {
4845        viewport_id: ContentId,
4846        properties: ViewportProperties,
4847        control_handle: FlatlandControlHandle,
4848    },
4849    /// Released Transforms will be garbage collected by the system once they are no longer
4850    /// necessary for rendering. For Transforms, this means there is no path from any unreleased
4851    /// Transform to the newly-released Transform.
4852    ///
4853    /// Once released, the id immediately goes out of scope for future function calls and can be
4854    /// reused when creating new Transforms.
4855    ///
4856    /// It is an error to call functions with a released id (unless that id has been reused to
4857    /// construct a new Transform).
4858    ReleaseTransform {
4859        transform_id: TransformId,
4860        control_handle: FlatlandControlHandle,
4861    },
4862    ReleaseView {
4863        control_handle: FlatlandControlHandle,
4864    },
4865    /// Releases a Viewport from the scene, even if the Viewport is still connected to a Transform.
4866    /// Unlike other resources, Viewports are garbage collected by the system during the next
4867    /// [`Present`] because a removed Viewport is guaranteed to provide no renderable content.
4868    ///
4869    /// Use SetContent(transform_id, 0) to clean up references to released Viewports.
4870    ///
4871    /// Despite having a return type, this function is still feed-forward like [`CreateView`] and
4872    /// requires a call to [`Present`] to be executed. The ViewportCreationToken will be returned
4873    /// after the presented operations have been executed.
4874    ReleaseViewport {
4875        viewport_id: ContentId,
4876        responder: FlatlandReleaseViewportResponder,
4877    },
4878    /// Released Images will be garbage collected by the system once they are no longer necessary
4879    /// for rendering. For Images, this means the Image is no longer attached to any Transform and
4880    /// any pending rendering that references the Image is complete.
4881    ///
4882    /// Use SetContent(transform_id, 0) to clean up references to released Images.
4883    ///
4884    /// Once released, the id immediately goes out of scope for future function calls and can be
4885    /// reused when creating new Images.
4886    ///
4887    /// It is an error to call functions with a released id (unless that id has been reused to
4888    /// construct a new Image).
4889    ReleaseImage {
4890        image_id: ContentId,
4891        control_handle: FlatlandControlHandle,
4892    },
4893    /// This function will reset all state on this interface. This includes destroying all existing
4894    /// View and Viewports without returning the associated Token to the caller.
4895    Clear {
4896        control_handle: FlatlandControlHandle,
4897    },
4898    /// Set debug name of the current client that can be used by Flatland to print as a prefix to
4899    /// logs to help client distinguish what is theirs. [`name`] can be an arbitrary string, but the
4900    /// current process name (see fsl::GetCurrentProcessName()) is a good default.
4901    SetDebugName {
4902        name: String,
4903        control_handle: FlatlandControlHandle,
4904    },
4905}
4906
4907impl FlatlandRequest {
4908    #[allow(irrefutable_let_patterns)]
4909    pub fn into_release_image_immediately(self) -> Option<(ContentId, FlatlandControlHandle)> {
4910        if let FlatlandRequest::ReleaseImageImmediately { image_id, control_handle } = self {
4911            Some((image_id, control_handle))
4912        } else {
4913            None
4914        }
4915    }
4916
4917    #[allow(irrefutable_let_patterns)]
4918    pub fn into_present(self) -> Option<(PresentArgs, FlatlandControlHandle)> {
4919        if let FlatlandRequest::Present { args, control_handle } = self {
4920            Some((args, control_handle))
4921        } else {
4922            None
4923        }
4924    }
4925
4926    #[allow(irrefutable_let_patterns)]
4927    pub fn into_create_view(
4928        self,
4929    ) -> Option<(
4930        fidl_fuchsia_ui_views::ViewCreationToken,
4931        fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>,
4932        FlatlandControlHandle,
4933    )> {
4934        if let FlatlandRequest::CreateView { token, parent_viewport_watcher, control_handle } = self
4935        {
4936            Some((token, parent_viewport_watcher, control_handle))
4937        } else {
4938            None
4939        }
4940    }
4941
4942    #[allow(irrefutable_let_patterns)]
4943    pub fn into_create_view2(
4944        self,
4945    ) -> Option<(
4946        fidl_fuchsia_ui_views::ViewCreationToken,
4947        fidl_fuchsia_ui_views::ViewIdentityOnCreation,
4948        ViewBoundProtocols,
4949        fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>,
4950        FlatlandControlHandle,
4951    )> {
4952        if let FlatlandRequest::CreateView2 {
4953            token,
4954            view_identity,
4955            protocols,
4956            parent_viewport_watcher,
4957            control_handle,
4958        } = self
4959        {
4960            Some((token, view_identity, protocols, parent_viewport_watcher, control_handle))
4961        } else {
4962            None
4963        }
4964    }
4965
4966    #[allow(irrefutable_let_patterns)]
4967    pub fn into_create_transform(self) -> Option<(TransformId, FlatlandControlHandle)> {
4968        if let FlatlandRequest::CreateTransform { transform_id, control_handle } = self {
4969            Some((transform_id, control_handle))
4970        } else {
4971            None
4972        }
4973    }
4974
4975    #[allow(irrefutable_let_patterns)]
4976    pub fn into_set_translation(
4977        self,
4978    ) -> Option<(TransformId, fidl_fuchsia_math::Vec_, FlatlandControlHandle)> {
4979        if let FlatlandRequest::SetTranslation { transform_id, translation, control_handle } = self
4980        {
4981            Some((transform_id, translation, control_handle))
4982        } else {
4983            None
4984        }
4985    }
4986
4987    #[allow(irrefutable_let_patterns)]
4988    pub fn into_set_orientation(self) -> Option<(TransformId, Orientation, FlatlandControlHandle)> {
4989        if let FlatlandRequest::SetOrientation { transform_id, orientation, control_handle } = self
4990        {
4991            Some((transform_id, orientation, control_handle))
4992        } else {
4993            None
4994        }
4995    }
4996
4997    #[allow(irrefutable_let_patterns)]
4998    pub fn into_set_scale(
4999        self,
5000    ) -> Option<(TransformId, fidl_fuchsia_math::VecF, FlatlandControlHandle)> {
5001        if let FlatlandRequest::SetScale { transform_id, scale, control_handle } = self {
5002            Some((transform_id, scale, control_handle))
5003        } else {
5004            None
5005        }
5006    }
5007
5008    #[allow(irrefutable_let_patterns)]
5009    pub fn into_set_opacity(self) -> Option<(TransformId, f32, FlatlandControlHandle)> {
5010        if let FlatlandRequest::SetOpacity { transform_id, value, control_handle } = self {
5011            Some((transform_id, value, control_handle))
5012        } else {
5013            None
5014        }
5015    }
5016
5017    #[allow(irrefutable_let_patterns)]
5018    pub fn into_set_clip_boundary(
5019        self,
5020    ) -> Option<(TransformId, Option<Box<fidl_fuchsia_math::Rect>>, FlatlandControlHandle)> {
5021        if let FlatlandRequest::SetClipBoundary { transform_id, rect, control_handle } = self {
5022            Some((transform_id, rect, control_handle))
5023        } else {
5024            None
5025        }
5026    }
5027
5028    #[allow(irrefutable_let_patterns)]
5029    pub fn into_add_child(self) -> Option<(TransformId, TransformId, FlatlandControlHandle)> {
5030        if let FlatlandRequest::AddChild {
5031            parent_transform_id,
5032            child_transform_id,
5033            control_handle,
5034        } = self
5035        {
5036            Some((parent_transform_id, child_transform_id, control_handle))
5037        } else {
5038            None
5039        }
5040    }
5041
5042    #[allow(irrefutable_let_patterns)]
5043    pub fn into_remove_child(self) -> Option<(TransformId, TransformId, FlatlandControlHandle)> {
5044        if let FlatlandRequest::RemoveChild {
5045            parent_transform_id,
5046            child_transform_id,
5047            control_handle,
5048        } = self
5049        {
5050            Some((parent_transform_id, child_transform_id, control_handle))
5051        } else {
5052            None
5053        }
5054    }
5055
5056    #[allow(irrefutable_let_patterns)]
5057    pub fn into_replace_children(
5058        self,
5059    ) -> Option<(TransformId, Vec<TransformId>, FlatlandControlHandle)> {
5060        if let FlatlandRequest::ReplaceChildren {
5061            parent_transform_id,
5062            new_child_transform_ids,
5063            control_handle,
5064        } = self
5065        {
5066            Some((parent_transform_id, new_child_transform_ids, control_handle))
5067        } else {
5068            None
5069        }
5070    }
5071
5072    #[allow(irrefutable_let_patterns)]
5073    pub fn into_set_root_transform(self) -> Option<(TransformId, FlatlandControlHandle)> {
5074        if let FlatlandRequest::SetRootTransform { transform_id, control_handle } = self {
5075            Some((transform_id, control_handle))
5076        } else {
5077            None
5078        }
5079    }
5080
5081    #[allow(irrefutable_let_patterns)]
5082    pub fn into_set_hit_regions(
5083        self,
5084    ) -> Option<(TransformId, Vec<HitRegion>, FlatlandControlHandle)> {
5085        if let FlatlandRequest::SetHitRegions { transform_id, regions, control_handle } = self {
5086            Some((transform_id, regions, control_handle))
5087        } else {
5088            None
5089        }
5090    }
5091
5092    #[allow(irrefutable_let_patterns)]
5093    pub fn into_set_infinite_hit_region(
5094        self,
5095    ) -> Option<(TransformId, HitTestInteraction, FlatlandControlHandle)> {
5096        if let FlatlandRequest::SetInfiniteHitRegion { transform_id, hit_test, control_handle } =
5097            self
5098        {
5099            Some((transform_id, hit_test, control_handle))
5100        } else {
5101            None
5102        }
5103    }
5104
5105    #[allow(irrefutable_let_patterns)]
5106    pub fn into_create_viewport(
5107        self,
5108    ) -> Option<(
5109        ContentId,
5110        fidl_fuchsia_ui_views::ViewportCreationToken,
5111        ViewportProperties,
5112        fidl::endpoints::ServerEnd<ChildViewWatcherMarker>,
5113        FlatlandControlHandle,
5114    )> {
5115        if let FlatlandRequest::CreateViewport {
5116            viewport_id,
5117            token,
5118            properties,
5119            child_view_watcher,
5120            control_handle,
5121        } = self
5122        {
5123            Some((viewport_id, token, properties, child_view_watcher, control_handle))
5124        } else {
5125            None
5126        }
5127    }
5128
5129    #[allow(irrefutable_let_patterns)]
5130    pub fn into_create_image(
5131        self,
5132    ) -> Option<(ContentId, BufferCollectionImportToken, u32, ImageProperties, FlatlandControlHandle)>
5133    {
5134        if let FlatlandRequest::CreateImage {
5135            image_id,
5136            import_token,
5137            vmo_index,
5138            properties,
5139            control_handle,
5140        } = self
5141        {
5142            Some((image_id, import_token, vmo_index, properties, control_handle))
5143        } else {
5144            None
5145        }
5146    }
5147
5148    #[allow(irrefutable_let_patterns)]
5149    pub fn into_set_image_sample_region(
5150        self,
5151    ) -> Option<(ContentId, fidl_fuchsia_math::RectF, FlatlandControlHandle)> {
5152        if let FlatlandRequest::SetImageSampleRegion { image_id, rect, control_handle } = self {
5153            Some((image_id, rect, control_handle))
5154        } else {
5155            None
5156        }
5157    }
5158
5159    #[allow(irrefutable_let_patterns)]
5160    pub fn into_set_image_destination_size(
5161        self,
5162    ) -> Option<(ContentId, fidl_fuchsia_math::SizeU, FlatlandControlHandle)> {
5163        if let FlatlandRequest::SetImageDestinationSize { image_id, size, control_handle } = self {
5164            Some((image_id, size, control_handle))
5165        } else {
5166            None
5167        }
5168    }
5169
5170    #[allow(irrefutable_let_patterns)]
5171    pub fn into_set_image_blending_function(
5172        self,
5173    ) -> Option<(ContentId, BlendMode, FlatlandControlHandle)> {
5174        if let FlatlandRequest::SetImageBlendingFunction { image_id, blend_mode, control_handle } =
5175            self
5176        {
5177            Some((image_id, blend_mode, control_handle))
5178        } else {
5179            None
5180        }
5181    }
5182
5183    #[allow(irrefutable_let_patterns)]
5184    pub fn into_set_image_blend_mode(
5185        self,
5186    ) -> Option<(ContentId, BlendMode2, FlatlandControlHandle)> {
5187        if let FlatlandRequest::SetImageBlendMode { image_id, blend_mode, control_handle } = self {
5188            Some((image_id, blend_mode, control_handle))
5189        } else {
5190            None
5191        }
5192    }
5193
5194    #[allow(irrefutable_let_patterns)]
5195    pub fn into_set_image_opacity(self) -> Option<(ContentId, f32, FlatlandControlHandle)> {
5196        if let FlatlandRequest::SetImageOpacity { image_id, val, control_handle } = self {
5197            Some((image_id, val, control_handle))
5198        } else {
5199            None
5200        }
5201    }
5202
5203    #[allow(irrefutable_let_patterns)]
5204    pub fn into_set_image_flip(self) -> Option<(ContentId, ImageFlip, FlatlandControlHandle)> {
5205        if let FlatlandRequest::SetImageFlip { image_id, flip, control_handle } = self {
5206            Some((image_id, flip, control_handle))
5207        } else {
5208            None
5209        }
5210    }
5211
5212    #[allow(irrefutable_let_patterns)]
5213    pub fn into_create_filled_rect(self) -> Option<(ContentId, FlatlandControlHandle)> {
5214        if let FlatlandRequest::CreateFilledRect { rect_id, control_handle } = self {
5215            Some((rect_id, control_handle))
5216        } else {
5217            None
5218        }
5219    }
5220
5221    #[allow(irrefutable_let_patterns)]
5222    pub fn into_set_solid_fill(
5223        self,
5224    ) -> Option<(ContentId, ColorRgba, fidl_fuchsia_math::SizeU, FlatlandControlHandle)> {
5225        if let FlatlandRequest::SetSolidFill { rect_id, color, size, control_handle } = self {
5226            Some((rect_id, color, size, control_handle))
5227        } else {
5228            None
5229        }
5230    }
5231
5232    #[allow(irrefutable_let_patterns)]
5233    pub fn into_release_filled_rect(self) -> Option<(ContentId, FlatlandControlHandle)> {
5234        if let FlatlandRequest::ReleaseFilledRect { rect_id, control_handle } = self {
5235            Some((rect_id, control_handle))
5236        } else {
5237            None
5238        }
5239    }
5240
5241    #[allow(irrefutable_let_patterns)]
5242    pub fn into_set_content(self) -> Option<(TransformId, ContentId, FlatlandControlHandle)> {
5243        if let FlatlandRequest::SetContent { transform_id, content_id, control_handle } = self {
5244            Some((transform_id, content_id, control_handle))
5245        } else {
5246            None
5247        }
5248    }
5249
5250    #[allow(irrefutable_let_patterns)]
5251    pub fn into_set_viewport_properties(
5252        self,
5253    ) -> Option<(ContentId, ViewportProperties, FlatlandControlHandle)> {
5254        if let FlatlandRequest::SetViewportProperties { viewport_id, properties, control_handle } =
5255            self
5256        {
5257            Some((viewport_id, properties, control_handle))
5258        } else {
5259            None
5260        }
5261    }
5262
5263    #[allow(irrefutable_let_patterns)]
5264    pub fn into_release_transform(self) -> Option<(TransformId, FlatlandControlHandle)> {
5265        if let FlatlandRequest::ReleaseTransform { transform_id, control_handle } = self {
5266            Some((transform_id, control_handle))
5267        } else {
5268            None
5269        }
5270    }
5271
5272    #[allow(irrefutable_let_patterns)]
5273    pub fn into_release_view(self) -> Option<(FlatlandControlHandle)> {
5274        if let FlatlandRequest::ReleaseView { control_handle } = self {
5275            Some((control_handle))
5276        } else {
5277            None
5278        }
5279    }
5280
5281    #[allow(irrefutable_let_patterns)]
5282    pub fn into_release_viewport(self) -> Option<(ContentId, FlatlandReleaseViewportResponder)> {
5283        if let FlatlandRequest::ReleaseViewport { viewport_id, responder } = self {
5284            Some((viewport_id, responder))
5285        } else {
5286            None
5287        }
5288    }
5289
5290    #[allow(irrefutable_let_patterns)]
5291    pub fn into_release_image(self) -> Option<(ContentId, FlatlandControlHandle)> {
5292        if let FlatlandRequest::ReleaseImage { image_id, control_handle } = self {
5293            Some((image_id, control_handle))
5294        } else {
5295            None
5296        }
5297    }
5298
5299    #[allow(irrefutable_let_patterns)]
5300    pub fn into_clear(self) -> Option<(FlatlandControlHandle)> {
5301        if let FlatlandRequest::Clear { control_handle } = self {
5302            Some((control_handle))
5303        } else {
5304            None
5305        }
5306    }
5307
5308    #[allow(irrefutable_let_patterns)]
5309    pub fn into_set_debug_name(self) -> Option<(String, FlatlandControlHandle)> {
5310        if let FlatlandRequest::SetDebugName { name, control_handle } = self {
5311            Some((name, control_handle))
5312        } else {
5313            None
5314        }
5315    }
5316
5317    /// Name of the method defined in FIDL
5318    pub fn method_name(&self) -> &'static str {
5319        match *self {
5320            FlatlandRequest::ReleaseImageImmediately { .. } => "release_image_immediately",
5321            FlatlandRequest::Present { .. } => "present",
5322            FlatlandRequest::CreateView { .. } => "create_view",
5323            FlatlandRequest::CreateView2 { .. } => "create_view2",
5324            FlatlandRequest::CreateTransform { .. } => "create_transform",
5325            FlatlandRequest::SetTranslation { .. } => "set_translation",
5326            FlatlandRequest::SetOrientation { .. } => "set_orientation",
5327            FlatlandRequest::SetScale { .. } => "set_scale",
5328            FlatlandRequest::SetOpacity { .. } => "set_opacity",
5329            FlatlandRequest::SetClipBoundary { .. } => "set_clip_boundary",
5330            FlatlandRequest::AddChild { .. } => "add_child",
5331            FlatlandRequest::RemoveChild { .. } => "remove_child",
5332            FlatlandRequest::ReplaceChildren { .. } => "replace_children",
5333            FlatlandRequest::SetRootTransform { .. } => "set_root_transform",
5334            FlatlandRequest::SetHitRegions { .. } => "set_hit_regions",
5335            FlatlandRequest::SetInfiniteHitRegion { .. } => "set_infinite_hit_region",
5336            FlatlandRequest::CreateViewport { .. } => "create_viewport",
5337            FlatlandRequest::CreateImage { .. } => "create_image",
5338            FlatlandRequest::SetImageSampleRegion { .. } => "set_image_sample_region",
5339            FlatlandRequest::SetImageDestinationSize { .. } => "set_image_destination_size",
5340            FlatlandRequest::SetImageBlendingFunction { .. } => "set_image_blending_function",
5341            FlatlandRequest::SetImageBlendMode { .. } => "set_image_blend_mode",
5342            FlatlandRequest::SetImageOpacity { .. } => "set_image_opacity",
5343            FlatlandRequest::SetImageFlip { .. } => "set_image_flip",
5344            FlatlandRequest::CreateFilledRect { .. } => "create_filled_rect",
5345            FlatlandRequest::SetSolidFill { .. } => "set_solid_fill",
5346            FlatlandRequest::ReleaseFilledRect { .. } => "release_filled_rect",
5347            FlatlandRequest::SetContent { .. } => "set_content",
5348            FlatlandRequest::SetViewportProperties { .. } => "set_viewport_properties",
5349            FlatlandRequest::ReleaseTransform { .. } => "release_transform",
5350            FlatlandRequest::ReleaseView { .. } => "release_view",
5351            FlatlandRequest::ReleaseViewport { .. } => "release_viewport",
5352            FlatlandRequest::ReleaseImage { .. } => "release_image",
5353            FlatlandRequest::Clear { .. } => "clear",
5354            FlatlandRequest::SetDebugName { .. } => "set_debug_name",
5355        }
5356    }
5357}
5358
5359#[derive(Debug, Clone)]
5360pub struct FlatlandControlHandle {
5361    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5362}
5363
5364impl fidl::endpoints::ControlHandle for FlatlandControlHandle {
5365    fn shutdown(&self) {
5366        self.inner.shutdown()
5367    }
5368
5369    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
5370        self.inner.shutdown_with_epitaph(status)
5371    }
5372
5373    fn is_closed(&self) -> bool {
5374        self.inner.channel().is_closed()
5375    }
5376    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
5377        self.inner.channel().on_closed()
5378    }
5379
5380    #[cfg(target_os = "fuchsia")]
5381    fn signal_peer(
5382        &self,
5383        clear_mask: zx::Signals,
5384        set_mask: zx::Signals,
5385    ) -> Result<(), zx_status::Status> {
5386        use fidl::Peered;
5387        self.inner.channel().signal_peer(clear_mask, set_mask)
5388    }
5389}
5390
5391impl FlatlandControlHandle {
5392    pub fn send_on_next_frame_begin(
5393        &self,
5394        mut values: &OnNextFrameBeginValues,
5395    ) -> Result<(), fidl::Error> {
5396        self.inner.send::<FlatlandOnNextFrameBeginRequest>(
5397            (values,),
5398            0,
5399            0x10f69a5cdeece84a,
5400            fidl::encoding::DynamicFlags::empty(),
5401        )
5402    }
5403
5404    pub fn send_on_frame_presented(
5405        &self,
5406        mut frame_presented_info: &fidl_fuchsia_scenic_scheduling::FramePresentedInfo,
5407    ) -> Result<(), fidl::Error> {
5408        self.inner.send::<FlatlandOnFramePresentedRequest>(
5409            (frame_presented_info,),
5410            0,
5411            0x56e43e1a5f30216d,
5412            fidl::encoding::DynamicFlags::empty(),
5413        )
5414    }
5415
5416    pub fn send_on_error(&self, mut error: FlatlandError) -> Result<(), fidl::Error> {
5417        self.inner.send::<FlatlandOnErrorRequest>(
5418            (error,),
5419            0,
5420            0x1ebf39e90cd8b8d,
5421            fidl::encoding::DynamicFlags::empty(),
5422        )
5423    }
5424}
5425
5426#[must_use = "FIDL methods require a response to be sent"]
5427#[derive(Debug)]
5428pub struct FlatlandReleaseViewportResponder {
5429    control_handle: std::mem::ManuallyDrop<FlatlandControlHandle>,
5430    tx_id: u32,
5431}
5432
5433/// Set the the channel to be shutdown (see [`FlatlandControlHandle::shutdown`])
5434/// if the responder is dropped without sending a response, so that the client
5435/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5436impl std::ops::Drop for FlatlandReleaseViewportResponder {
5437    fn drop(&mut self) {
5438        self.control_handle.shutdown();
5439        // Safety: drops once, never accessed again
5440        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5441    }
5442}
5443
5444impl fidl::endpoints::Responder for FlatlandReleaseViewportResponder {
5445    type ControlHandle = FlatlandControlHandle;
5446
5447    fn control_handle(&self) -> &FlatlandControlHandle {
5448        &self.control_handle
5449    }
5450
5451    fn drop_without_shutdown(mut self) {
5452        // Safety: drops once, never accessed again due to mem::forget
5453        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5454        // Prevent Drop from running (which would shut down the channel)
5455        std::mem::forget(self);
5456    }
5457}
5458
5459impl FlatlandReleaseViewportResponder {
5460    /// Sends a response to the FIDL transaction.
5461    ///
5462    /// Sets the channel to shutdown if an error occurs.
5463    pub fn send(
5464        self,
5465        mut token: fidl_fuchsia_ui_views::ViewportCreationToken,
5466    ) -> Result<(), fidl::Error> {
5467        let _result = self.send_raw(token);
5468        if _result.is_err() {
5469            self.control_handle.shutdown();
5470        }
5471        self.drop_without_shutdown();
5472        _result
5473    }
5474
5475    /// Similar to "send" but does not shutdown the channel if an error occurs.
5476    pub fn send_no_shutdown_on_err(
5477        self,
5478        mut token: fidl_fuchsia_ui_views::ViewportCreationToken,
5479    ) -> Result<(), fidl::Error> {
5480        let _result = self.send_raw(token);
5481        self.drop_without_shutdown();
5482        _result
5483    }
5484
5485    fn send_raw(
5486        &self,
5487        mut token: fidl_fuchsia_ui_views::ViewportCreationToken,
5488    ) -> Result<(), fidl::Error> {
5489        self.control_handle.inner.send::<FlatlandReleaseViewportResponse>(
5490            (&mut token,),
5491            self.tx_id,
5492            0xbad474aeb5293f9,
5493            fidl::encoding::DynamicFlags::empty(),
5494        )
5495    }
5496}
5497
5498#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
5499pub struct FlatlandDisplayMarker;
5500
5501impl fidl::endpoints::ProtocolMarker for FlatlandDisplayMarker {
5502    type Proxy = FlatlandDisplayProxy;
5503    type RequestStream = FlatlandDisplayRequestStream;
5504    #[cfg(target_os = "fuchsia")]
5505    type SynchronousProxy = FlatlandDisplaySynchronousProxy;
5506
5507    const DEBUG_NAME: &'static str = "fuchsia.ui.composition.FlatlandDisplay";
5508}
5509impl fidl::endpoints::DiscoverableProtocolMarker for FlatlandDisplayMarker {}
5510
5511pub trait FlatlandDisplayProxyInterface: Send + Sync {
5512    fn r#set_content(
5513        &self,
5514        token: fidl_fuchsia_ui_views::ViewportCreationToken,
5515        child_view_watcher: fidl::endpoints::ServerEnd<ChildViewWatcherMarker>,
5516    ) -> Result<(), fidl::Error>;
5517    fn r#set_device_pixel_ratio(
5518        &self,
5519        device_pixel_ratio: &fidl_fuchsia_math::VecF,
5520    ) -> Result<(), fidl::Error>;
5521}
5522#[derive(Debug)]
5523#[cfg(target_os = "fuchsia")]
5524pub struct FlatlandDisplaySynchronousProxy {
5525    client: fidl::client::sync::Client,
5526}
5527
5528#[cfg(target_os = "fuchsia")]
5529impl fidl::endpoints::SynchronousProxy for FlatlandDisplaySynchronousProxy {
5530    type Proxy = FlatlandDisplayProxy;
5531    type Protocol = FlatlandDisplayMarker;
5532
5533    fn from_channel(inner: fidl::Channel) -> Self {
5534        Self::new(inner)
5535    }
5536
5537    fn into_channel(self) -> fidl::Channel {
5538        self.client.into_channel()
5539    }
5540
5541    fn as_channel(&self) -> &fidl::Channel {
5542        self.client.as_channel()
5543    }
5544}
5545
5546#[cfg(target_os = "fuchsia")]
5547impl FlatlandDisplaySynchronousProxy {
5548    pub fn new(channel: fidl::Channel) -> Self {
5549        Self { client: fidl::client::sync::Client::new(channel) }
5550    }
5551
5552    pub fn into_channel(self) -> fidl::Channel {
5553        self.client.into_channel()
5554    }
5555
5556    /// Waits until an event arrives and returns it. It is safe for other
5557    /// threads to make concurrent requests while waiting for an event.
5558    pub fn wait_for_event(
5559        &self,
5560        deadline: zx::MonotonicInstant,
5561    ) -> Result<FlatlandDisplayEvent, fidl::Error> {
5562        FlatlandDisplayEvent::decode(self.client.wait_for_event::<FlatlandDisplayMarker>(deadline)?)
5563    }
5564
5565    pub fn r#set_content(
5566        &self,
5567        mut token: fidl_fuchsia_ui_views::ViewportCreationToken,
5568        mut child_view_watcher: fidl::endpoints::ServerEnd<ChildViewWatcherMarker>,
5569    ) -> Result<(), fidl::Error> {
5570        self.client.send::<FlatlandDisplaySetContentRequest>(
5571            (&mut token, child_view_watcher),
5572            0x6748193a39918298,
5573            fidl::encoding::DynamicFlags::empty(),
5574        )
5575    }
5576
5577    /// Sets the ratio of display's physical pixels to device independent pixels that should be used
5578    /// for the tree of Flatland content that are attached to this display. See
5579    /// [`LayoutInfo.device_pixel_ratio`] for details.
5580    ///
5581    /// The default value is (1.0, 1.0). The valid values are 1.0 and above.
5582    pub fn r#set_device_pixel_ratio(
5583        &self,
5584        mut device_pixel_ratio: &fidl_fuchsia_math::VecF,
5585    ) -> Result<(), fidl::Error> {
5586        self.client.send::<FlatlandDisplaySetDevicePixelRatioRequest>(
5587            (device_pixel_ratio,),
5588            0x392c3e70cc0a81a4,
5589            fidl::encoding::DynamicFlags::empty(),
5590        )
5591    }
5592}
5593
5594#[cfg(target_os = "fuchsia")]
5595impl From<FlatlandDisplaySynchronousProxy> for zx::NullableHandle {
5596    fn from(value: FlatlandDisplaySynchronousProxy) -> Self {
5597        value.into_channel().into()
5598    }
5599}
5600
5601#[cfg(target_os = "fuchsia")]
5602impl From<fidl::Channel> for FlatlandDisplaySynchronousProxy {
5603    fn from(value: fidl::Channel) -> Self {
5604        Self::new(value)
5605    }
5606}
5607
5608#[cfg(target_os = "fuchsia")]
5609impl fidl::endpoints::FromClient for FlatlandDisplaySynchronousProxy {
5610    type Protocol = FlatlandDisplayMarker;
5611
5612    fn from_client(value: fidl::endpoints::ClientEnd<FlatlandDisplayMarker>) -> Self {
5613        Self::new(value.into_channel())
5614    }
5615}
5616
5617#[derive(Debug, Clone)]
5618pub struct FlatlandDisplayProxy {
5619    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
5620}
5621
5622impl fidl::endpoints::Proxy for FlatlandDisplayProxy {
5623    type Protocol = FlatlandDisplayMarker;
5624
5625    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
5626        Self::new(inner)
5627    }
5628
5629    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
5630        self.client.into_channel().map_err(|client| Self { client })
5631    }
5632
5633    fn as_channel(&self) -> &::fidl::AsyncChannel {
5634        self.client.as_channel()
5635    }
5636}
5637
5638impl FlatlandDisplayProxy {
5639    /// Create a new Proxy for fuchsia.ui.composition/FlatlandDisplay.
5640    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
5641        let protocol_name = <FlatlandDisplayMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
5642        Self { client: fidl::client::Client::new(channel, protocol_name) }
5643    }
5644
5645    /// Get a Stream of events from the remote end of the protocol.
5646    ///
5647    /// # Panics
5648    ///
5649    /// Panics if the event stream was already taken.
5650    pub fn take_event_stream(&self) -> FlatlandDisplayEventStream {
5651        FlatlandDisplayEventStream { event_receiver: self.client.take_event_receiver() }
5652    }
5653
5654    pub fn r#set_content(
5655        &self,
5656        mut token: fidl_fuchsia_ui_views::ViewportCreationToken,
5657        mut child_view_watcher: fidl::endpoints::ServerEnd<ChildViewWatcherMarker>,
5658    ) -> Result<(), fidl::Error> {
5659        FlatlandDisplayProxyInterface::r#set_content(self, token, child_view_watcher)
5660    }
5661
5662    /// Sets the ratio of display's physical pixels to device independent pixels that should be used
5663    /// for the tree of Flatland content that are attached to this display. See
5664    /// [`LayoutInfo.device_pixel_ratio`] for details.
5665    ///
5666    /// The default value is (1.0, 1.0). The valid values are 1.0 and above.
5667    pub fn r#set_device_pixel_ratio(
5668        &self,
5669        mut device_pixel_ratio: &fidl_fuchsia_math::VecF,
5670    ) -> Result<(), fidl::Error> {
5671        FlatlandDisplayProxyInterface::r#set_device_pixel_ratio(self, device_pixel_ratio)
5672    }
5673}
5674
5675impl FlatlandDisplayProxyInterface for FlatlandDisplayProxy {
5676    fn r#set_content(
5677        &self,
5678        mut token: fidl_fuchsia_ui_views::ViewportCreationToken,
5679        mut child_view_watcher: fidl::endpoints::ServerEnd<ChildViewWatcherMarker>,
5680    ) -> Result<(), fidl::Error> {
5681        self.client.send::<FlatlandDisplaySetContentRequest>(
5682            (&mut token, child_view_watcher),
5683            0x6748193a39918298,
5684            fidl::encoding::DynamicFlags::empty(),
5685        )
5686    }
5687
5688    fn r#set_device_pixel_ratio(
5689        &self,
5690        mut device_pixel_ratio: &fidl_fuchsia_math::VecF,
5691    ) -> Result<(), fidl::Error> {
5692        self.client.send::<FlatlandDisplaySetDevicePixelRatioRequest>(
5693            (device_pixel_ratio,),
5694            0x392c3e70cc0a81a4,
5695            fidl::encoding::DynamicFlags::empty(),
5696        )
5697    }
5698}
5699
5700pub struct FlatlandDisplayEventStream {
5701    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
5702}
5703
5704impl std::marker::Unpin for FlatlandDisplayEventStream {}
5705
5706impl futures::stream::FusedStream for FlatlandDisplayEventStream {
5707    fn is_terminated(&self) -> bool {
5708        self.event_receiver.is_terminated()
5709    }
5710}
5711
5712impl futures::Stream for FlatlandDisplayEventStream {
5713    type Item = Result<FlatlandDisplayEvent, fidl::Error>;
5714
5715    fn poll_next(
5716        mut self: std::pin::Pin<&mut Self>,
5717        cx: &mut std::task::Context<'_>,
5718    ) -> std::task::Poll<Option<Self::Item>> {
5719        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
5720            &mut self.event_receiver,
5721            cx
5722        )?) {
5723            Some(buf) => std::task::Poll::Ready(Some(FlatlandDisplayEvent::decode(buf))),
5724            None => std::task::Poll::Ready(None),
5725        }
5726    }
5727}
5728
5729#[derive(Debug)]
5730pub enum FlatlandDisplayEvent {}
5731
5732impl FlatlandDisplayEvent {
5733    /// Decodes a message buffer as a [`FlatlandDisplayEvent`].
5734    fn decode(
5735        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
5736    ) -> Result<FlatlandDisplayEvent, fidl::Error> {
5737        let (bytes, _handles) = buf.split_mut();
5738        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5739        debug_assert_eq!(tx_header.tx_id, 0);
5740        match tx_header.ordinal {
5741            _ => Err(fidl::Error::UnknownOrdinal {
5742                ordinal: tx_header.ordinal,
5743                protocol_name:
5744                    <FlatlandDisplayMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5745            }),
5746        }
5747    }
5748}
5749
5750/// A Stream of incoming requests for fuchsia.ui.composition/FlatlandDisplay.
5751pub struct FlatlandDisplayRequestStream {
5752    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5753    is_terminated: bool,
5754}
5755
5756impl std::marker::Unpin for FlatlandDisplayRequestStream {}
5757
5758impl futures::stream::FusedStream for FlatlandDisplayRequestStream {
5759    fn is_terminated(&self) -> bool {
5760        self.is_terminated
5761    }
5762}
5763
5764impl fidl::endpoints::RequestStream for FlatlandDisplayRequestStream {
5765    type Protocol = FlatlandDisplayMarker;
5766    type ControlHandle = FlatlandDisplayControlHandle;
5767
5768    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
5769        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
5770    }
5771
5772    fn control_handle(&self) -> Self::ControlHandle {
5773        FlatlandDisplayControlHandle { inner: self.inner.clone() }
5774    }
5775
5776    fn into_inner(
5777        self,
5778    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
5779    {
5780        (self.inner, self.is_terminated)
5781    }
5782
5783    fn from_inner(
5784        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5785        is_terminated: bool,
5786    ) -> Self {
5787        Self { inner, is_terminated }
5788    }
5789}
5790
5791impl futures::Stream for FlatlandDisplayRequestStream {
5792    type Item = Result<FlatlandDisplayRequest, fidl::Error>;
5793
5794    fn poll_next(
5795        mut self: std::pin::Pin<&mut Self>,
5796        cx: &mut std::task::Context<'_>,
5797    ) -> std::task::Poll<Option<Self::Item>> {
5798        let this = &mut *self;
5799        if this.inner.check_shutdown(cx) {
5800            this.is_terminated = true;
5801            return std::task::Poll::Ready(None);
5802        }
5803        if this.is_terminated {
5804            panic!("polled FlatlandDisplayRequestStream after completion");
5805        }
5806        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
5807            |bytes, handles| {
5808                match this.inner.channel().read_etc(cx, bytes, handles) {
5809                    std::task::Poll::Ready(Ok(())) => {}
5810                    std::task::Poll::Pending => return std::task::Poll::Pending,
5811                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
5812                        this.is_terminated = true;
5813                        return std::task::Poll::Ready(None);
5814                    }
5815                    std::task::Poll::Ready(Err(e)) => {
5816                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
5817                            e.into(),
5818                        ))));
5819                    }
5820                }
5821
5822                // A message has been received from the channel
5823                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5824
5825                std::task::Poll::Ready(Some(match header.ordinal {
5826                    0x6748193a39918298 => {
5827                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5828                        let mut req = fidl::new_empty!(
5829                            FlatlandDisplaySetContentRequest,
5830                            fidl::encoding::DefaultFuchsiaResourceDialect
5831                        );
5832                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandDisplaySetContentRequest>(&header, _body_bytes, handles, &mut req)?;
5833                        let control_handle =
5834                            FlatlandDisplayControlHandle { inner: this.inner.clone() };
5835                        Ok(FlatlandDisplayRequest::SetContent {
5836                            token: req.token,
5837                            child_view_watcher: req.child_view_watcher,
5838
5839                            control_handle,
5840                        })
5841                    }
5842                    0x392c3e70cc0a81a4 => {
5843                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5844                        let mut req = fidl::new_empty!(
5845                            FlatlandDisplaySetDevicePixelRatioRequest,
5846                            fidl::encoding::DefaultFuchsiaResourceDialect
5847                        );
5848                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandDisplaySetDevicePixelRatioRequest>(&header, _body_bytes, handles, &mut req)?;
5849                        let control_handle =
5850                            FlatlandDisplayControlHandle { inner: this.inner.clone() };
5851                        Ok(FlatlandDisplayRequest::SetDevicePixelRatio {
5852                            device_pixel_ratio: req.device_pixel_ratio,
5853
5854                            control_handle,
5855                        })
5856                    }
5857                    _ => Err(fidl::Error::UnknownOrdinal {
5858                        ordinal: header.ordinal,
5859                        protocol_name:
5860                            <FlatlandDisplayMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5861                    }),
5862                }))
5863            },
5864        )
5865    }
5866}
5867
5868/// This API connects to the singleton "primary display", and allows a tree of Flatland content to
5869/// be attached underneath.  Only one FlatlandDisplay client connection is allowed at one time.
5870#[derive(Debug)]
5871pub enum FlatlandDisplayRequest {
5872    SetContent {
5873        token: fidl_fuchsia_ui_views::ViewportCreationToken,
5874        child_view_watcher: fidl::endpoints::ServerEnd<ChildViewWatcherMarker>,
5875        control_handle: FlatlandDisplayControlHandle,
5876    },
5877    /// Sets the ratio of display's physical pixels to device independent pixels that should be used
5878    /// for the tree of Flatland content that are attached to this display. See
5879    /// [`LayoutInfo.device_pixel_ratio`] for details.
5880    ///
5881    /// The default value is (1.0, 1.0). The valid values are 1.0 and above.
5882    SetDevicePixelRatio {
5883        device_pixel_ratio: fidl_fuchsia_math::VecF,
5884        control_handle: FlatlandDisplayControlHandle,
5885    },
5886}
5887
5888impl FlatlandDisplayRequest {
5889    #[allow(irrefutable_let_patterns)]
5890    pub fn into_set_content(
5891        self,
5892    ) -> Option<(
5893        fidl_fuchsia_ui_views::ViewportCreationToken,
5894        fidl::endpoints::ServerEnd<ChildViewWatcherMarker>,
5895        FlatlandDisplayControlHandle,
5896    )> {
5897        if let FlatlandDisplayRequest::SetContent { token, child_view_watcher, control_handle } =
5898            self
5899        {
5900            Some((token, child_view_watcher, control_handle))
5901        } else {
5902            None
5903        }
5904    }
5905
5906    #[allow(irrefutable_let_patterns)]
5907    pub fn into_set_device_pixel_ratio(
5908        self,
5909    ) -> Option<(fidl_fuchsia_math::VecF, FlatlandDisplayControlHandle)> {
5910        if let FlatlandDisplayRequest::SetDevicePixelRatio { device_pixel_ratio, control_handle } =
5911            self
5912        {
5913            Some((device_pixel_ratio, control_handle))
5914        } else {
5915            None
5916        }
5917    }
5918
5919    /// Name of the method defined in FIDL
5920    pub fn method_name(&self) -> &'static str {
5921        match *self {
5922            FlatlandDisplayRequest::SetContent { .. } => "set_content",
5923            FlatlandDisplayRequest::SetDevicePixelRatio { .. } => "set_device_pixel_ratio",
5924        }
5925    }
5926}
5927
5928#[derive(Debug, Clone)]
5929pub struct FlatlandDisplayControlHandle {
5930    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5931}
5932
5933impl fidl::endpoints::ControlHandle for FlatlandDisplayControlHandle {
5934    fn shutdown(&self) {
5935        self.inner.shutdown()
5936    }
5937
5938    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
5939        self.inner.shutdown_with_epitaph(status)
5940    }
5941
5942    fn is_closed(&self) -> bool {
5943        self.inner.channel().is_closed()
5944    }
5945    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
5946        self.inner.channel().on_closed()
5947    }
5948
5949    #[cfg(target_os = "fuchsia")]
5950    fn signal_peer(
5951        &self,
5952        clear_mask: zx::Signals,
5953        set_mask: zx::Signals,
5954    ) -> Result<(), zx_status::Status> {
5955        use fidl::Peered;
5956        self.inner.channel().signal_peer(clear_mask, set_mask)
5957    }
5958}
5959
5960impl FlatlandDisplayControlHandle {}
5961
5962#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
5963pub struct ParentViewportWatcherMarker;
5964
5965impl fidl::endpoints::ProtocolMarker for ParentViewportWatcherMarker {
5966    type Proxy = ParentViewportWatcherProxy;
5967    type RequestStream = ParentViewportWatcherRequestStream;
5968    #[cfg(target_os = "fuchsia")]
5969    type SynchronousProxy = ParentViewportWatcherSynchronousProxy;
5970
5971    const DEBUG_NAME: &'static str = "(anonymous) ParentViewportWatcher";
5972}
5973
5974pub trait ParentViewportWatcherProxyInterface: Send + Sync {
5975    type GetLayoutResponseFut: std::future::Future<Output = Result<LayoutInfo, fidl::Error>> + Send;
5976    fn r#get_layout(&self) -> Self::GetLayoutResponseFut;
5977    type GetStatusResponseFut: std::future::Future<Output = Result<ParentViewportStatus, fidl::Error>>
5978        + Send;
5979    fn r#get_status(&self) -> Self::GetStatusResponseFut;
5980}
5981#[derive(Debug)]
5982#[cfg(target_os = "fuchsia")]
5983pub struct ParentViewportWatcherSynchronousProxy {
5984    client: fidl::client::sync::Client,
5985}
5986
5987#[cfg(target_os = "fuchsia")]
5988impl fidl::endpoints::SynchronousProxy for ParentViewportWatcherSynchronousProxy {
5989    type Proxy = ParentViewportWatcherProxy;
5990    type Protocol = ParentViewportWatcherMarker;
5991
5992    fn from_channel(inner: fidl::Channel) -> Self {
5993        Self::new(inner)
5994    }
5995
5996    fn into_channel(self) -> fidl::Channel {
5997        self.client.into_channel()
5998    }
5999
6000    fn as_channel(&self) -> &fidl::Channel {
6001        self.client.as_channel()
6002    }
6003}
6004
6005#[cfg(target_os = "fuchsia")]
6006impl ParentViewportWatcherSynchronousProxy {
6007    pub fn new(channel: fidl::Channel) -> Self {
6008        Self { client: fidl::client::sync::Client::new(channel) }
6009    }
6010
6011    pub fn into_channel(self) -> fidl::Channel {
6012        self.client.into_channel()
6013    }
6014
6015    /// Waits until an event arrives and returns it. It is safe for other
6016    /// threads to make concurrent requests while waiting for an event.
6017    pub fn wait_for_event(
6018        &self,
6019        deadline: zx::MonotonicInstant,
6020    ) -> Result<ParentViewportWatcherEvent, fidl::Error> {
6021        ParentViewportWatcherEvent::decode(
6022            self.client.wait_for_event::<ParentViewportWatcherMarker>(deadline)?,
6023        )
6024    }
6025
6026    /// A hanging get for receiving layout information. Clients may receive layout information
6027    /// before the ParentViewportWatcher operation has been presented. This allows children to
6028    /// layout their content before their first call to [`Present`]. In transition cases where two
6029    /// ParentViewportWatcher channels exist at the same time, both protocol instances will be
6030    /// receiving different layout information.
6031    ///
6032    /// This hanging get will only fire when the LayoutInfo is different than the previously
6033    /// returned LayoutInfo. Note that, since LayoutInfo is a table, only some fields may have
6034    /// changed.
6035    ///
6036    /// It is invalid to call `GetLayout` while a previous call is still pending. Doing so will
6037    /// cause both this channel and the Flatland channel that handed out ParentViewportWatcher to be
6038    /// closed.
6039    pub fn r#get_layout(
6040        &self,
6041        ___deadline: zx::MonotonicInstant,
6042    ) -> Result<LayoutInfo, fidl::Error> {
6043        let _response = self.client.send_query::<
6044            fidl::encoding::EmptyPayload,
6045            ParentViewportWatcherGetLayoutResponse,
6046            ParentViewportWatcherMarker,
6047        >(
6048            (),
6049            0x3cbe5d9638e032,
6050            fidl::encoding::DynamicFlags::empty(),
6051            ___deadline,
6052        )?;
6053        Ok(_response.info)
6054    }
6055
6056    /// A hanging get for receiving the status of the parent Viewport. This provides global
6057    /// connectivity information to the child.
6058    ///
6059    /// This hanging get will only fire when the ParentViewportStatus is different than the
6060    /// previously returned ParentViewportStatus.
6061    ///
6062    /// It is invalid to call `GetStatus` while a previous call is still pending. Doing so will
6063    /// cause both this channel and the Flatland channel that handed out ParentViewportWatcher to be
6064    /// closed.
6065    pub fn r#get_status(
6066        &self,
6067        ___deadline: zx::MonotonicInstant,
6068    ) -> Result<ParentViewportStatus, fidl::Error> {
6069        let _response = self.client.send_query::<
6070            fidl::encoding::EmptyPayload,
6071            ParentViewportWatcherGetStatusResponse,
6072            ParentViewportWatcherMarker,
6073        >(
6074            (),
6075            0x7caa022f050d9ea6,
6076            fidl::encoding::DynamicFlags::empty(),
6077            ___deadline,
6078        )?;
6079        Ok(_response.status)
6080    }
6081}
6082
6083#[cfg(target_os = "fuchsia")]
6084impl From<ParentViewportWatcherSynchronousProxy> for zx::NullableHandle {
6085    fn from(value: ParentViewportWatcherSynchronousProxy) -> Self {
6086        value.into_channel().into()
6087    }
6088}
6089
6090#[cfg(target_os = "fuchsia")]
6091impl From<fidl::Channel> for ParentViewportWatcherSynchronousProxy {
6092    fn from(value: fidl::Channel) -> Self {
6093        Self::new(value)
6094    }
6095}
6096
6097#[cfg(target_os = "fuchsia")]
6098impl fidl::endpoints::FromClient for ParentViewportWatcherSynchronousProxy {
6099    type Protocol = ParentViewportWatcherMarker;
6100
6101    fn from_client(value: fidl::endpoints::ClientEnd<ParentViewportWatcherMarker>) -> Self {
6102        Self::new(value.into_channel())
6103    }
6104}
6105
6106#[derive(Debug, Clone)]
6107pub struct ParentViewportWatcherProxy {
6108    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
6109}
6110
6111impl fidl::endpoints::Proxy for ParentViewportWatcherProxy {
6112    type Protocol = ParentViewportWatcherMarker;
6113
6114    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
6115        Self::new(inner)
6116    }
6117
6118    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
6119        self.client.into_channel().map_err(|client| Self { client })
6120    }
6121
6122    fn as_channel(&self) -> &::fidl::AsyncChannel {
6123        self.client.as_channel()
6124    }
6125}
6126
6127impl ParentViewportWatcherProxy {
6128    /// Create a new Proxy for fuchsia.ui.composition/ParentViewportWatcher.
6129    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
6130        let protocol_name =
6131            <ParentViewportWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
6132        Self { client: fidl::client::Client::new(channel, protocol_name) }
6133    }
6134
6135    /// Get a Stream of events from the remote end of the protocol.
6136    ///
6137    /// # Panics
6138    ///
6139    /// Panics if the event stream was already taken.
6140    pub fn take_event_stream(&self) -> ParentViewportWatcherEventStream {
6141        ParentViewportWatcherEventStream { event_receiver: self.client.take_event_receiver() }
6142    }
6143
6144    /// A hanging get for receiving layout information. Clients may receive layout information
6145    /// before the ParentViewportWatcher operation has been presented. This allows children to
6146    /// layout their content before their first call to [`Present`]. In transition cases where two
6147    /// ParentViewportWatcher channels exist at the same time, both protocol instances will be
6148    /// receiving different layout information.
6149    ///
6150    /// This hanging get will only fire when the LayoutInfo is different than the previously
6151    /// returned LayoutInfo. Note that, since LayoutInfo is a table, only some fields may have
6152    /// changed.
6153    ///
6154    /// It is invalid to call `GetLayout` while a previous call is still pending. Doing so will
6155    /// cause both this channel and the Flatland channel that handed out ParentViewportWatcher to be
6156    /// closed.
6157    pub fn r#get_layout(
6158        &self,
6159    ) -> fidl::client::QueryResponseFut<LayoutInfo, fidl::encoding::DefaultFuchsiaResourceDialect>
6160    {
6161        ParentViewportWatcherProxyInterface::r#get_layout(self)
6162    }
6163
6164    /// A hanging get for receiving the status of the parent Viewport. This provides global
6165    /// connectivity information to the child.
6166    ///
6167    /// This hanging get will only fire when the ParentViewportStatus is different than the
6168    /// previously returned ParentViewportStatus.
6169    ///
6170    /// It is invalid to call `GetStatus` while a previous call is still pending. Doing so will
6171    /// cause both this channel and the Flatland channel that handed out ParentViewportWatcher to be
6172    /// closed.
6173    pub fn r#get_status(
6174        &self,
6175    ) -> fidl::client::QueryResponseFut<
6176        ParentViewportStatus,
6177        fidl::encoding::DefaultFuchsiaResourceDialect,
6178    > {
6179        ParentViewportWatcherProxyInterface::r#get_status(self)
6180    }
6181}
6182
6183impl ParentViewportWatcherProxyInterface for ParentViewportWatcherProxy {
6184    type GetLayoutResponseFut =
6185        fidl::client::QueryResponseFut<LayoutInfo, fidl::encoding::DefaultFuchsiaResourceDialect>;
6186    fn r#get_layout(&self) -> Self::GetLayoutResponseFut {
6187        fn _decode(
6188            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6189        ) -> Result<LayoutInfo, fidl::Error> {
6190            let _response = fidl::client::decode_transaction_body::<
6191                ParentViewportWatcherGetLayoutResponse,
6192                fidl::encoding::DefaultFuchsiaResourceDialect,
6193                0x3cbe5d9638e032,
6194            >(_buf?)?;
6195            Ok(_response.info)
6196        }
6197        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, LayoutInfo>(
6198            (),
6199            0x3cbe5d9638e032,
6200            fidl::encoding::DynamicFlags::empty(),
6201            _decode,
6202        )
6203    }
6204
6205    type GetStatusResponseFut = fidl::client::QueryResponseFut<
6206        ParentViewportStatus,
6207        fidl::encoding::DefaultFuchsiaResourceDialect,
6208    >;
6209    fn r#get_status(&self) -> Self::GetStatusResponseFut {
6210        fn _decode(
6211            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6212        ) -> Result<ParentViewportStatus, fidl::Error> {
6213            let _response = fidl::client::decode_transaction_body::<
6214                ParentViewportWatcherGetStatusResponse,
6215                fidl::encoding::DefaultFuchsiaResourceDialect,
6216                0x7caa022f050d9ea6,
6217            >(_buf?)?;
6218            Ok(_response.status)
6219        }
6220        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ParentViewportStatus>(
6221            (),
6222            0x7caa022f050d9ea6,
6223            fidl::encoding::DynamicFlags::empty(),
6224            _decode,
6225        )
6226    }
6227}
6228
6229pub struct ParentViewportWatcherEventStream {
6230    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
6231}
6232
6233impl std::marker::Unpin for ParentViewportWatcherEventStream {}
6234
6235impl futures::stream::FusedStream for ParentViewportWatcherEventStream {
6236    fn is_terminated(&self) -> bool {
6237        self.event_receiver.is_terminated()
6238    }
6239}
6240
6241impl futures::Stream for ParentViewportWatcherEventStream {
6242    type Item = Result<ParentViewportWatcherEvent, fidl::Error>;
6243
6244    fn poll_next(
6245        mut self: std::pin::Pin<&mut Self>,
6246        cx: &mut std::task::Context<'_>,
6247    ) -> std::task::Poll<Option<Self::Item>> {
6248        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
6249            &mut self.event_receiver,
6250            cx
6251        )?) {
6252            Some(buf) => std::task::Poll::Ready(Some(ParentViewportWatcherEvent::decode(buf))),
6253            None => std::task::Poll::Ready(None),
6254        }
6255    }
6256}
6257
6258#[derive(Debug)]
6259pub enum ParentViewportWatcherEvent {}
6260
6261impl ParentViewportWatcherEvent {
6262    /// Decodes a message buffer as a [`ParentViewportWatcherEvent`].
6263    fn decode(
6264        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
6265    ) -> Result<ParentViewportWatcherEvent, fidl::Error> {
6266        let (bytes, _handles) = buf.split_mut();
6267        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6268        debug_assert_eq!(tx_header.tx_id, 0);
6269        match tx_header.ordinal {
6270            _ => Err(fidl::Error::UnknownOrdinal {
6271                ordinal: tx_header.ordinal,
6272                protocol_name:
6273                    <ParentViewportWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6274            }),
6275        }
6276    }
6277}
6278
6279/// A Stream of incoming requests for fuchsia.ui.composition/ParentViewportWatcher.
6280pub struct ParentViewportWatcherRequestStream {
6281    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6282    is_terminated: bool,
6283}
6284
6285impl std::marker::Unpin for ParentViewportWatcherRequestStream {}
6286
6287impl futures::stream::FusedStream for ParentViewportWatcherRequestStream {
6288    fn is_terminated(&self) -> bool {
6289        self.is_terminated
6290    }
6291}
6292
6293impl fidl::endpoints::RequestStream for ParentViewportWatcherRequestStream {
6294    type Protocol = ParentViewportWatcherMarker;
6295    type ControlHandle = ParentViewportWatcherControlHandle;
6296
6297    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
6298        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
6299    }
6300
6301    fn control_handle(&self) -> Self::ControlHandle {
6302        ParentViewportWatcherControlHandle { inner: self.inner.clone() }
6303    }
6304
6305    fn into_inner(
6306        self,
6307    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
6308    {
6309        (self.inner, self.is_terminated)
6310    }
6311
6312    fn from_inner(
6313        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6314        is_terminated: bool,
6315    ) -> Self {
6316        Self { inner, is_terminated }
6317    }
6318}
6319
6320impl futures::Stream for ParentViewportWatcherRequestStream {
6321    type Item = Result<ParentViewportWatcherRequest, fidl::Error>;
6322
6323    fn poll_next(
6324        mut self: std::pin::Pin<&mut Self>,
6325        cx: &mut std::task::Context<'_>,
6326    ) -> std::task::Poll<Option<Self::Item>> {
6327        let this = &mut *self;
6328        if this.inner.check_shutdown(cx) {
6329            this.is_terminated = true;
6330            return std::task::Poll::Ready(None);
6331        }
6332        if this.is_terminated {
6333            panic!("polled ParentViewportWatcherRequestStream after completion");
6334        }
6335        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
6336            |bytes, handles| {
6337                match this.inner.channel().read_etc(cx, bytes, handles) {
6338                    std::task::Poll::Ready(Ok(())) => {}
6339                    std::task::Poll::Pending => return std::task::Poll::Pending,
6340                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
6341                        this.is_terminated = true;
6342                        return std::task::Poll::Ready(None);
6343                    }
6344                    std::task::Poll::Ready(Err(e)) => {
6345                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
6346                            e.into(),
6347                        ))));
6348                    }
6349                }
6350
6351                // A message has been received from the channel
6352                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6353
6354                std::task::Poll::Ready(Some(match header.ordinal {
6355                0x3cbe5d9638e032 => {
6356                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6357                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
6358                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
6359                    let control_handle = ParentViewportWatcherControlHandle {
6360                        inner: this.inner.clone(),
6361                    };
6362                    Ok(ParentViewportWatcherRequest::GetLayout {
6363                        responder: ParentViewportWatcherGetLayoutResponder {
6364                            control_handle: std::mem::ManuallyDrop::new(control_handle),
6365                            tx_id: header.tx_id,
6366                        },
6367                    })
6368                }
6369                0x7caa022f050d9ea6 => {
6370                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6371                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
6372                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
6373                    let control_handle = ParentViewportWatcherControlHandle {
6374                        inner: this.inner.clone(),
6375                    };
6376                    Ok(ParentViewportWatcherRequest::GetStatus {
6377                        responder: ParentViewportWatcherGetStatusResponder {
6378                            control_handle: std::mem::ManuallyDrop::new(control_handle),
6379                            tx_id: header.tx_id,
6380                        },
6381                    })
6382                }
6383                _ => Err(fidl::Error::UnknownOrdinal {
6384                    ordinal: header.ordinal,
6385                    protocol_name: <ParentViewportWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6386                }),
6387            }))
6388            },
6389        )
6390    }
6391}
6392
6393/// A protocol that provides information about the parent Viewport attached to a Flatland instance's
6394/// sole View.  Although Flatland instances can have at most one view, it is possible to have
6395/// multiple ParentViewportWatchers during the brief transition period when replacing the instance's
6396/// View with another, e.g. via [`CreateView`].  During this period, certain updates may be
6397/// duplicated and sent to each ParentViewportWatcher connection.
6398///
6399/// A ParentViewportWatcher will remain connected as long as the corresponding parent Viewport
6400/// exists; the connection will also be closed if the parents's ViewportCreationToken is dropped
6401/// without using it to create a Viewport.
6402#[derive(Debug)]
6403pub enum ParentViewportWatcherRequest {
6404    /// A hanging get for receiving layout information. Clients may receive layout information
6405    /// before the ParentViewportWatcher operation has been presented. This allows children to
6406    /// layout their content before their first call to [`Present`]. In transition cases where two
6407    /// ParentViewportWatcher channels exist at the same time, both protocol instances will be
6408    /// receiving different layout information.
6409    ///
6410    /// This hanging get will only fire when the LayoutInfo is different than the previously
6411    /// returned LayoutInfo. Note that, since LayoutInfo is a table, only some fields may have
6412    /// changed.
6413    ///
6414    /// It is invalid to call `GetLayout` while a previous call is still pending. Doing so will
6415    /// cause both this channel and the Flatland channel that handed out ParentViewportWatcher to be
6416    /// closed.
6417    GetLayout { responder: ParentViewportWatcherGetLayoutResponder },
6418    /// A hanging get for receiving the status of the parent Viewport. This provides global
6419    /// connectivity information to the child.
6420    ///
6421    /// This hanging get will only fire when the ParentViewportStatus is different than the
6422    /// previously returned ParentViewportStatus.
6423    ///
6424    /// It is invalid to call `GetStatus` while a previous call is still pending. Doing so will
6425    /// cause both this channel and the Flatland channel that handed out ParentViewportWatcher to be
6426    /// closed.
6427    GetStatus { responder: ParentViewportWatcherGetStatusResponder },
6428}
6429
6430impl ParentViewportWatcherRequest {
6431    #[allow(irrefutable_let_patterns)]
6432    pub fn into_get_layout(self) -> Option<(ParentViewportWatcherGetLayoutResponder)> {
6433        if let ParentViewportWatcherRequest::GetLayout { responder } = self {
6434            Some((responder))
6435        } else {
6436            None
6437        }
6438    }
6439
6440    #[allow(irrefutable_let_patterns)]
6441    pub fn into_get_status(self) -> Option<(ParentViewportWatcherGetStatusResponder)> {
6442        if let ParentViewportWatcherRequest::GetStatus { responder } = self {
6443            Some((responder))
6444        } else {
6445            None
6446        }
6447    }
6448
6449    /// Name of the method defined in FIDL
6450    pub fn method_name(&self) -> &'static str {
6451        match *self {
6452            ParentViewportWatcherRequest::GetLayout { .. } => "get_layout",
6453            ParentViewportWatcherRequest::GetStatus { .. } => "get_status",
6454        }
6455    }
6456}
6457
6458#[derive(Debug, Clone)]
6459pub struct ParentViewportWatcherControlHandle {
6460    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6461}
6462
6463impl fidl::endpoints::ControlHandle for ParentViewportWatcherControlHandle {
6464    fn shutdown(&self) {
6465        self.inner.shutdown()
6466    }
6467
6468    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
6469        self.inner.shutdown_with_epitaph(status)
6470    }
6471
6472    fn is_closed(&self) -> bool {
6473        self.inner.channel().is_closed()
6474    }
6475    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
6476        self.inner.channel().on_closed()
6477    }
6478
6479    #[cfg(target_os = "fuchsia")]
6480    fn signal_peer(
6481        &self,
6482        clear_mask: zx::Signals,
6483        set_mask: zx::Signals,
6484    ) -> Result<(), zx_status::Status> {
6485        use fidl::Peered;
6486        self.inner.channel().signal_peer(clear_mask, set_mask)
6487    }
6488}
6489
6490impl ParentViewportWatcherControlHandle {}
6491
6492#[must_use = "FIDL methods require a response to be sent"]
6493#[derive(Debug)]
6494pub struct ParentViewportWatcherGetLayoutResponder {
6495    control_handle: std::mem::ManuallyDrop<ParentViewportWatcherControlHandle>,
6496    tx_id: u32,
6497}
6498
6499/// Set the the channel to be shutdown (see [`ParentViewportWatcherControlHandle::shutdown`])
6500/// if the responder is dropped without sending a response, so that the client
6501/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6502impl std::ops::Drop for ParentViewportWatcherGetLayoutResponder {
6503    fn drop(&mut self) {
6504        self.control_handle.shutdown();
6505        // Safety: drops once, never accessed again
6506        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6507    }
6508}
6509
6510impl fidl::endpoints::Responder for ParentViewportWatcherGetLayoutResponder {
6511    type ControlHandle = ParentViewportWatcherControlHandle;
6512
6513    fn control_handle(&self) -> &ParentViewportWatcherControlHandle {
6514        &self.control_handle
6515    }
6516
6517    fn drop_without_shutdown(mut self) {
6518        // Safety: drops once, never accessed again due to mem::forget
6519        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6520        // Prevent Drop from running (which would shut down the channel)
6521        std::mem::forget(self);
6522    }
6523}
6524
6525impl ParentViewportWatcherGetLayoutResponder {
6526    /// Sends a response to the FIDL transaction.
6527    ///
6528    /// Sets the channel to shutdown if an error occurs.
6529    pub fn send(self, mut info: &LayoutInfo) -> Result<(), fidl::Error> {
6530        let _result = self.send_raw(info);
6531        if _result.is_err() {
6532            self.control_handle.shutdown();
6533        }
6534        self.drop_without_shutdown();
6535        _result
6536    }
6537
6538    /// Similar to "send" but does not shutdown the channel if an error occurs.
6539    pub fn send_no_shutdown_on_err(self, mut info: &LayoutInfo) -> Result<(), fidl::Error> {
6540        let _result = self.send_raw(info);
6541        self.drop_without_shutdown();
6542        _result
6543    }
6544
6545    fn send_raw(&self, mut info: &LayoutInfo) -> Result<(), fidl::Error> {
6546        self.control_handle.inner.send::<ParentViewportWatcherGetLayoutResponse>(
6547            (info,),
6548            self.tx_id,
6549            0x3cbe5d9638e032,
6550            fidl::encoding::DynamicFlags::empty(),
6551        )
6552    }
6553}
6554
6555#[must_use = "FIDL methods require a response to be sent"]
6556#[derive(Debug)]
6557pub struct ParentViewportWatcherGetStatusResponder {
6558    control_handle: std::mem::ManuallyDrop<ParentViewportWatcherControlHandle>,
6559    tx_id: u32,
6560}
6561
6562/// Set the the channel to be shutdown (see [`ParentViewportWatcherControlHandle::shutdown`])
6563/// if the responder is dropped without sending a response, so that the client
6564/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6565impl std::ops::Drop for ParentViewportWatcherGetStatusResponder {
6566    fn drop(&mut self) {
6567        self.control_handle.shutdown();
6568        // Safety: drops once, never accessed again
6569        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6570    }
6571}
6572
6573impl fidl::endpoints::Responder for ParentViewportWatcherGetStatusResponder {
6574    type ControlHandle = ParentViewportWatcherControlHandle;
6575
6576    fn control_handle(&self) -> &ParentViewportWatcherControlHandle {
6577        &self.control_handle
6578    }
6579
6580    fn drop_without_shutdown(mut self) {
6581        // Safety: drops once, never accessed again due to mem::forget
6582        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6583        // Prevent Drop from running (which would shut down the channel)
6584        std::mem::forget(self);
6585    }
6586}
6587
6588impl ParentViewportWatcherGetStatusResponder {
6589    /// Sends a response to the FIDL transaction.
6590    ///
6591    /// Sets the channel to shutdown if an error occurs.
6592    pub fn send(self, mut status: ParentViewportStatus) -> Result<(), fidl::Error> {
6593        let _result = self.send_raw(status);
6594        if _result.is_err() {
6595            self.control_handle.shutdown();
6596        }
6597        self.drop_without_shutdown();
6598        _result
6599    }
6600
6601    /// Similar to "send" but does not shutdown the channel if an error occurs.
6602    pub fn send_no_shutdown_on_err(
6603        self,
6604        mut status: ParentViewportStatus,
6605    ) -> Result<(), fidl::Error> {
6606        let _result = self.send_raw(status);
6607        self.drop_without_shutdown();
6608        _result
6609    }
6610
6611    fn send_raw(&self, mut status: ParentViewportStatus) -> Result<(), fidl::Error> {
6612        self.control_handle.inner.send::<ParentViewportWatcherGetStatusResponse>(
6613            (status,),
6614            self.tx_id,
6615            0x7caa022f050d9ea6,
6616            fidl::encoding::DynamicFlags::empty(),
6617        )
6618    }
6619}
6620
6621#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
6622pub struct ScreenCaptureMarker;
6623
6624impl fidl::endpoints::ProtocolMarker for ScreenCaptureMarker {
6625    type Proxy = ScreenCaptureProxy;
6626    type RequestStream = ScreenCaptureRequestStream;
6627    #[cfg(target_os = "fuchsia")]
6628    type SynchronousProxy = ScreenCaptureSynchronousProxy;
6629
6630    const DEBUG_NAME: &'static str = "fuchsia.ui.composition.ScreenCapture";
6631}
6632impl fidl::endpoints::DiscoverableProtocolMarker for ScreenCaptureMarker {}
6633pub type ScreenCaptureConfigureResult = Result<(), ScreenCaptureError>;
6634pub type ScreenCaptureGetNextFrameResult = Result<FrameInfo, ScreenCaptureError>;
6635pub type ScreenCaptureReleaseFrameResult = Result<(), ScreenCaptureError>;
6636
6637pub trait ScreenCaptureProxyInterface: Send + Sync {
6638    type ConfigureResponseFut: std::future::Future<Output = Result<ScreenCaptureConfigureResult, fidl::Error>>
6639        + Send;
6640    fn r#configure(&self, payload: ScreenCaptureConfig) -> Self::ConfigureResponseFut;
6641    type GetNextFrameResponseFut: std::future::Future<Output = Result<ScreenCaptureGetNextFrameResult, fidl::Error>>
6642        + Send;
6643    fn r#get_next_frame(&self, payload: GetNextFrameArgs) -> Self::GetNextFrameResponseFut;
6644    type ReleaseFrameResponseFut: std::future::Future<Output = Result<ScreenCaptureReleaseFrameResult, fidl::Error>>
6645        + Send;
6646    fn r#release_frame(&self, buffer_id: u32) -> Self::ReleaseFrameResponseFut;
6647}
6648#[derive(Debug)]
6649#[cfg(target_os = "fuchsia")]
6650pub struct ScreenCaptureSynchronousProxy {
6651    client: fidl::client::sync::Client,
6652}
6653
6654#[cfg(target_os = "fuchsia")]
6655impl fidl::endpoints::SynchronousProxy for ScreenCaptureSynchronousProxy {
6656    type Proxy = ScreenCaptureProxy;
6657    type Protocol = ScreenCaptureMarker;
6658
6659    fn from_channel(inner: fidl::Channel) -> Self {
6660        Self::new(inner)
6661    }
6662
6663    fn into_channel(self) -> fidl::Channel {
6664        self.client.into_channel()
6665    }
6666
6667    fn as_channel(&self) -> &fidl::Channel {
6668        self.client.as_channel()
6669    }
6670}
6671
6672#[cfg(target_os = "fuchsia")]
6673impl ScreenCaptureSynchronousProxy {
6674    pub fn new(channel: fidl::Channel) -> Self {
6675        Self { client: fidl::client::sync::Client::new(channel) }
6676    }
6677
6678    pub fn into_channel(self) -> fidl::Channel {
6679        self.client.into_channel()
6680    }
6681
6682    /// Waits until an event arrives and returns it. It is safe for other
6683    /// threads to make concurrent requests while waiting for an event.
6684    pub fn wait_for_event(
6685        &self,
6686        deadline: zx::MonotonicInstant,
6687    ) -> Result<ScreenCaptureEvent, fidl::Error> {
6688        ScreenCaptureEvent::decode(self.client.wait_for_event::<ScreenCaptureMarker>(deadline)?)
6689    }
6690
6691    /// Clients should first use the Allocator protocol to register a
6692    /// BufferCollection. This function will fail with BAD_OPERATION unless all clients of the
6693    /// BufferCollection have set their constraints.
6694    ///
6695    /// Afterwards, clients should create and configure the images that will
6696    /// eventually be rendered to using this method. All the buffers in the
6697    /// collection from 0 to (buffer_count-1) may be used for screen capture.
6698    ///
6699    /// Clients are responsible for determining the rotation of the display,
6700    /// and applying the corrective rotation. For instance, if the display is
6701    /// mounted 90 degrees clockwise (the "top" is on the right, when looking
6702    /// at the display), then the client should specify a 270 degree rotation
6703    /// to account for it.
6704    ///
6705    /// Similarly, the clients are responsible for specifying a buffer big
6706    /// enough for the rotated image. If the buffer is too small, a best effort
6707    /// attempt will be made to render the image.
6708    ///
6709    /// Finally, clients request the server to render the current screen to the
6710    /// shared buffers using [`GetNextFrame`].
6711    ///
6712    /// [`Configure`] can be called again with a new BufferCollectionImportToken
6713    /// if the client wishes to change any of the configuration settings. In
6714    /// this case all the buffers from the previous call to [`Configure`] will
6715    /// be released.
6716    pub fn r#configure(
6717        &self,
6718        mut payload: ScreenCaptureConfig,
6719        ___deadline: zx::MonotonicInstant,
6720    ) -> Result<ScreenCaptureConfigureResult, fidl::Error> {
6721        let _response = self.client.send_query::<ScreenCaptureConfig, fidl::encoding::ResultType<
6722            fidl::encoding::EmptyStruct,
6723            ScreenCaptureError,
6724        >, ScreenCaptureMarker>(
6725            &mut payload,
6726            0x3b6e5af1d294afd9,
6727            fidl::encoding::DynamicFlags::empty(),
6728            ___deadline,
6729        )?;
6730        Ok(_response.map(|x| x))
6731    }
6732
6733    /// Following a successful call to [`Configure`], clients can call
6734    /// GetNextFrame. This will populate a buffer with the most recent frame.
6735    ///
6736    /// Clients should wait on the zx::event they pass for successful
6737    /// completion of the screenshot. It is not guaranteed that the screenshot
6738    /// will be completed by the time this function returns.
6739    ///
6740    /// The requested image will be in the BufferCollection that the client set
6741    /// up in the VMO at the index specified by buffer_id.
6742    ///
6743    /// When ScreenCapture is used to provide a stream, the rate that the
6744    /// client calls GetNextFrame will drive the frame rate.
6745    ///
6746    /// Errors:
6747    /// BAD_OPERATION if Configure was not called, or not called successfully
6748    /// MISSING_ARGS if a required argument is not present
6749    /// BUFFER_FULL if all buffers in the BufferCollection are in use. In this case, ReleaseFrame
6750    /// must be called to make a buffer available before this function can be called successfully.
6751    pub fn r#get_next_frame(
6752        &self,
6753        mut payload: GetNextFrameArgs,
6754        ___deadline: zx::MonotonicInstant,
6755    ) -> Result<ScreenCaptureGetNextFrameResult, fidl::Error> {
6756        let _response = self.client.send_query::<
6757            GetNextFrameArgs,
6758            fidl::encoding::ResultType<FrameInfo, ScreenCaptureError>,
6759            ScreenCaptureMarker,
6760        >(
6761            &mut payload,
6762            0x552c1580aab8c4a7,
6763            fidl::encoding::DynamicFlags::empty(),
6764            ___deadline,
6765        )?;
6766        Ok(_response.map(|x| x))
6767    }
6768
6769    /// Once the client no longer needs an image, they can call ReleaseFrame on
6770    /// the VMO index of the buffer so that the server can reuse it in the future.
6771    pub fn r#release_frame(
6772        &self,
6773        mut buffer_id: u32,
6774        ___deadline: zx::MonotonicInstant,
6775    ) -> Result<ScreenCaptureReleaseFrameResult, fidl::Error> {
6776        let _response =
6777            self.client.send_query::<ScreenCaptureReleaseFrameRequest, fidl::encoding::ResultType<
6778                fidl::encoding::EmptyStruct,
6779                ScreenCaptureError,
6780            >, ScreenCaptureMarker>(
6781                (buffer_id,),
6782                0x46704dce24e35950,
6783                fidl::encoding::DynamicFlags::empty(),
6784                ___deadline,
6785            )?;
6786        Ok(_response.map(|x| x))
6787    }
6788}
6789
6790#[cfg(target_os = "fuchsia")]
6791impl From<ScreenCaptureSynchronousProxy> for zx::NullableHandle {
6792    fn from(value: ScreenCaptureSynchronousProxy) -> Self {
6793        value.into_channel().into()
6794    }
6795}
6796
6797#[cfg(target_os = "fuchsia")]
6798impl From<fidl::Channel> for ScreenCaptureSynchronousProxy {
6799    fn from(value: fidl::Channel) -> Self {
6800        Self::new(value)
6801    }
6802}
6803
6804#[cfg(target_os = "fuchsia")]
6805impl fidl::endpoints::FromClient for ScreenCaptureSynchronousProxy {
6806    type Protocol = ScreenCaptureMarker;
6807
6808    fn from_client(value: fidl::endpoints::ClientEnd<ScreenCaptureMarker>) -> Self {
6809        Self::new(value.into_channel())
6810    }
6811}
6812
6813#[derive(Debug, Clone)]
6814pub struct ScreenCaptureProxy {
6815    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
6816}
6817
6818impl fidl::endpoints::Proxy for ScreenCaptureProxy {
6819    type Protocol = ScreenCaptureMarker;
6820
6821    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
6822        Self::new(inner)
6823    }
6824
6825    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
6826        self.client.into_channel().map_err(|client| Self { client })
6827    }
6828
6829    fn as_channel(&self) -> &::fidl::AsyncChannel {
6830        self.client.as_channel()
6831    }
6832}
6833
6834impl ScreenCaptureProxy {
6835    /// Create a new Proxy for fuchsia.ui.composition/ScreenCapture.
6836    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
6837        let protocol_name = <ScreenCaptureMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
6838        Self { client: fidl::client::Client::new(channel, protocol_name) }
6839    }
6840
6841    /// Get a Stream of events from the remote end of the protocol.
6842    ///
6843    /// # Panics
6844    ///
6845    /// Panics if the event stream was already taken.
6846    pub fn take_event_stream(&self) -> ScreenCaptureEventStream {
6847        ScreenCaptureEventStream { event_receiver: self.client.take_event_receiver() }
6848    }
6849
6850    /// Clients should first use the Allocator protocol to register a
6851    /// BufferCollection. This function will fail with BAD_OPERATION unless all clients of the
6852    /// BufferCollection have set their constraints.
6853    ///
6854    /// Afterwards, clients should create and configure the images that will
6855    /// eventually be rendered to using this method. All the buffers in the
6856    /// collection from 0 to (buffer_count-1) may be used for screen capture.
6857    ///
6858    /// Clients are responsible for determining the rotation of the display,
6859    /// and applying the corrective rotation. For instance, if the display is
6860    /// mounted 90 degrees clockwise (the "top" is on the right, when looking
6861    /// at the display), then the client should specify a 270 degree rotation
6862    /// to account for it.
6863    ///
6864    /// Similarly, the clients are responsible for specifying a buffer big
6865    /// enough for the rotated image. If the buffer is too small, a best effort
6866    /// attempt will be made to render the image.
6867    ///
6868    /// Finally, clients request the server to render the current screen to the
6869    /// shared buffers using [`GetNextFrame`].
6870    ///
6871    /// [`Configure`] can be called again with a new BufferCollectionImportToken
6872    /// if the client wishes to change any of the configuration settings. In
6873    /// this case all the buffers from the previous call to [`Configure`] will
6874    /// be released.
6875    pub fn r#configure(
6876        &self,
6877        mut payload: ScreenCaptureConfig,
6878    ) -> fidl::client::QueryResponseFut<
6879        ScreenCaptureConfigureResult,
6880        fidl::encoding::DefaultFuchsiaResourceDialect,
6881    > {
6882        ScreenCaptureProxyInterface::r#configure(self, payload)
6883    }
6884
6885    /// Following a successful call to [`Configure`], clients can call
6886    /// GetNextFrame. This will populate a buffer with the most recent frame.
6887    ///
6888    /// Clients should wait on the zx::event they pass for successful
6889    /// completion of the screenshot. It is not guaranteed that the screenshot
6890    /// will be completed by the time this function returns.
6891    ///
6892    /// The requested image will be in the BufferCollection that the client set
6893    /// up in the VMO at the index specified by buffer_id.
6894    ///
6895    /// When ScreenCapture is used to provide a stream, the rate that the
6896    /// client calls GetNextFrame will drive the frame rate.
6897    ///
6898    /// Errors:
6899    /// BAD_OPERATION if Configure was not called, or not called successfully
6900    /// MISSING_ARGS if a required argument is not present
6901    /// BUFFER_FULL if all buffers in the BufferCollection are in use. In this case, ReleaseFrame
6902    /// must be called to make a buffer available before this function can be called successfully.
6903    pub fn r#get_next_frame(
6904        &self,
6905        mut payload: GetNextFrameArgs,
6906    ) -> fidl::client::QueryResponseFut<
6907        ScreenCaptureGetNextFrameResult,
6908        fidl::encoding::DefaultFuchsiaResourceDialect,
6909    > {
6910        ScreenCaptureProxyInterface::r#get_next_frame(self, payload)
6911    }
6912
6913    /// Once the client no longer needs an image, they can call ReleaseFrame on
6914    /// the VMO index of the buffer so that the server can reuse it in the future.
6915    pub fn r#release_frame(
6916        &self,
6917        mut buffer_id: u32,
6918    ) -> fidl::client::QueryResponseFut<
6919        ScreenCaptureReleaseFrameResult,
6920        fidl::encoding::DefaultFuchsiaResourceDialect,
6921    > {
6922        ScreenCaptureProxyInterface::r#release_frame(self, buffer_id)
6923    }
6924}
6925
6926impl ScreenCaptureProxyInterface for ScreenCaptureProxy {
6927    type ConfigureResponseFut = fidl::client::QueryResponseFut<
6928        ScreenCaptureConfigureResult,
6929        fidl::encoding::DefaultFuchsiaResourceDialect,
6930    >;
6931    fn r#configure(&self, mut payload: ScreenCaptureConfig) -> Self::ConfigureResponseFut {
6932        fn _decode(
6933            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6934        ) -> Result<ScreenCaptureConfigureResult, fidl::Error> {
6935            let _response = fidl::client::decode_transaction_body::<
6936                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, ScreenCaptureError>,
6937                fidl::encoding::DefaultFuchsiaResourceDialect,
6938                0x3b6e5af1d294afd9,
6939            >(_buf?)?;
6940            Ok(_response.map(|x| x))
6941        }
6942        self.client.send_query_and_decode::<ScreenCaptureConfig, ScreenCaptureConfigureResult>(
6943            &mut payload,
6944            0x3b6e5af1d294afd9,
6945            fidl::encoding::DynamicFlags::empty(),
6946            _decode,
6947        )
6948    }
6949
6950    type GetNextFrameResponseFut = fidl::client::QueryResponseFut<
6951        ScreenCaptureGetNextFrameResult,
6952        fidl::encoding::DefaultFuchsiaResourceDialect,
6953    >;
6954    fn r#get_next_frame(&self, mut payload: GetNextFrameArgs) -> Self::GetNextFrameResponseFut {
6955        fn _decode(
6956            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6957        ) -> Result<ScreenCaptureGetNextFrameResult, fidl::Error> {
6958            let _response = fidl::client::decode_transaction_body::<
6959                fidl::encoding::ResultType<FrameInfo, ScreenCaptureError>,
6960                fidl::encoding::DefaultFuchsiaResourceDialect,
6961                0x552c1580aab8c4a7,
6962            >(_buf?)?;
6963            Ok(_response.map(|x| x))
6964        }
6965        self.client.send_query_and_decode::<GetNextFrameArgs, ScreenCaptureGetNextFrameResult>(
6966            &mut payload,
6967            0x552c1580aab8c4a7,
6968            fidl::encoding::DynamicFlags::empty(),
6969            _decode,
6970        )
6971    }
6972
6973    type ReleaseFrameResponseFut = fidl::client::QueryResponseFut<
6974        ScreenCaptureReleaseFrameResult,
6975        fidl::encoding::DefaultFuchsiaResourceDialect,
6976    >;
6977    fn r#release_frame(&self, mut buffer_id: u32) -> Self::ReleaseFrameResponseFut {
6978        fn _decode(
6979            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6980        ) -> Result<ScreenCaptureReleaseFrameResult, fidl::Error> {
6981            let _response = fidl::client::decode_transaction_body::<
6982                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, ScreenCaptureError>,
6983                fidl::encoding::DefaultFuchsiaResourceDialect,
6984                0x46704dce24e35950,
6985            >(_buf?)?;
6986            Ok(_response.map(|x| x))
6987        }
6988        self.client.send_query_and_decode::<
6989            ScreenCaptureReleaseFrameRequest,
6990            ScreenCaptureReleaseFrameResult,
6991        >(
6992            (buffer_id,),
6993            0x46704dce24e35950,
6994            fidl::encoding::DynamicFlags::empty(),
6995            _decode,
6996        )
6997    }
6998}
6999
7000pub struct ScreenCaptureEventStream {
7001    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
7002}
7003
7004impl std::marker::Unpin for ScreenCaptureEventStream {}
7005
7006impl futures::stream::FusedStream for ScreenCaptureEventStream {
7007    fn is_terminated(&self) -> bool {
7008        self.event_receiver.is_terminated()
7009    }
7010}
7011
7012impl futures::Stream for ScreenCaptureEventStream {
7013    type Item = Result<ScreenCaptureEvent, fidl::Error>;
7014
7015    fn poll_next(
7016        mut self: std::pin::Pin<&mut Self>,
7017        cx: &mut std::task::Context<'_>,
7018    ) -> std::task::Poll<Option<Self::Item>> {
7019        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
7020            &mut self.event_receiver,
7021            cx
7022        )?) {
7023            Some(buf) => std::task::Poll::Ready(Some(ScreenCaptureEvent::decode(buf))),
7024            None => std::task::Poll::Ready(None),
7025        }
7026    }
7027}
7028
7029#[derive(Debug)]
7030pub enum ScreenCaptureEvent {}
7031
7032impl ScreenCaptureEvent {
7033    /// Decodes a message buffer as a [`ScreenCaptureEvent`].
7034    fn decode(
7035        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
7036    ) -> Result<ScreenCaptureEvent, fidl::Error> {
7037        let (bytes, _handles) = buf.split_mut();
7038        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7039        debug_assert_eq!(tx_header.tx_id, 0);
7040        match tx_header.ordinal {
7041            _ => Err(fidl::Error::UnknownOrdinal {
7042                ordinal: tx_header.ordinal,
7043                protocol_name: <ScreenCaptureMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
7044            }),
7045        }
7046    }
7047}
7048
7049/// A Stream of incoming requests for fuchsia.ui.composition/ScreenCapture.
7050pub struct ScreenCaptureRequestStream {
7051    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7052    is_terminated: bool,
7053}
7054
7055impl std::marker::Unpin for ScreenCaptureRequestStream {}
7056
7057impl futures::stream::FusedStream for ScreenCaptureRequestStream {
7058    fn is_terminated(&self) -> bool {
7059        self.is_terminated
7060    }
7061}
7062
7063impl fidl::endpoints::RequestStream for ScreenCaptureRequestStream {
7064    type Protocol = ScreenCaptureMarker;
7065    type ControlHandle = ScreenCaptureControlHandle;
7066
7067    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
7068        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
7069    }
7070
7071    fn control_handle(&self) -> Self::ControlHandle {
7072        ScreenCaptureControlHandle { inner: self.inner.clone() }
7073    }
7074
7075    fn into_inner(
7076        self,
7077    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
7078    {
7079        (self.inner, self.is_terminated)
7080    }
7081
7082    fn from_inner(
7083        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7084        is_terminated: bool,
7085    ) -> Self {
7086        Self { inner, is_terminated }
7087    }
7088}
7089
7090impl futures::Stream for ScreenCaptureRequestStream {
7091    type Item = Result<ScreenCaptureRequest, fidl::Error>;
7092
7093    fn poll_next(
7094        mut self: std::pin::Pin<&mut Self>,
7095        cx: &mut std::task::Context<'_>,
7096    ) -> std::task::Poll<Option<Self::Item>> {
7097        let this = &mut *self;
7098        if this.inner.check_shutdown(cx) {
7099            this.is_terminated = true;
7100            return std::task::Poll::Ready(None);
7101        }
7102        if this.is_terminated {
7103            panic!("polled ScreenCaptureRequestStream after completion");
7104        }
7105        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
7106            |bytes, handles| {
7107                match this.inner.channel().read_etc(cx, bytes, handles) {
7108                    std::task::Poll::Ready(Ok(())) => {}
7109                    std::task::Poll::Pending => return std::task::Poll::Pending,
7110                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
7111                        this.is_terminated = true;
7112                        return std::task::Poll::Ready(None);
7113                    }
7114                    std::task::Poll::Ready(Err(e)) => {
7115                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
7116                            e.into(),
7117                        ))));
7118                    }
7119                }
7120
7121                // A message has been received from the channel
7122                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7123
7124                std::task::Poll::Ready(Some(match header.ordinal {
7125                    0x3b6e5af1d294afd9 => {
7126                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7127                        let mut req = fidl::new_empty!(
7128                            ScreenCaptureConfig,
7129                            fidl::encoding::DefaultFuchsiaResourceDialect
7130                        );
7131                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ScreenCaptureConfig>(&header, _body_bytes, handles, &mut req)?;
7132                        let control_handle =
7133                            ScreenCaptureControlHandle { inner: this.inner.clone() };
7134                        Ok(ScreenCaptureRequest::Configure {
7135                            payload: req,
7136                            responder: ScreenCaptureConfigureResponder {
7137                                control_handle: std::mem::ManuallyDrop::new(control_handle),
7138                                tx_id: header.tx_id,
7139                            },
7140                        })
7141                    }
7142                    0x552c1580aab8c4a7 => {
7143                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7144                        let mut req = fidl::new_empty!(
7145                            GetNextFrameArgs,
7146                            fidl::encoding::DefaultFuchsiaResourceDialect
7147                        );
7148                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<GetNextFrameArgs>(&header, _body_bytes, handles, &mut req)?;
7149                        let control_handle =
7150                            ScreenCaptureControlHandle { inner: this.inner.clone() };
7151                        Ok(ScreenCaptureRequest::GetNextFrame {
7152                            payload: req,
7153                            responder: ScreenCaptureGetNextFrameResponder {
7154                                control_handle: std::mem::ManuallyDrop::new(control_handle),
7155                                tx_id: header.tx_id,
7156                            },
7157                        })
7158                    }
7159                    0x46704dce24e35950 => {
7160                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7161                        let mut req = fidl::new_empty!(
7162                            ScreenCaptureReleaseFrameRequest,
7163                            fidl::encoding::DefaultFuchsiaResourceDialect
7164                        );
7165                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ScreenCaptureReleaseFrameRequest>(&header, _body_bytes, handles, &mut req)?;
7166                        let control_handle =
7167                            ScreenCaptureControlHandle { inner: this.inner.clone() };
7168                        Ok(ScreenCaptureRequest::ReleaseFrame {
7169                            buffer_id: req.buffer_id,
7170
7171                            responder: ScreenCaptureReleaseFrameResponder {
7172                                control_handle: std::mem::ManuallyDrop::new(control_handle),
7173                                tx_id: header.tx_id,
7174                            },
7175                        })
7176                    }
7177                    _ => Err(fidl::Error::UnknownOrdinal {
7178                        ordinal: header.ordinal,
7179                        protocol_name:
7180                            <ScreenCaptureMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
7181                    }),
7182                }))
7183            },
7184        )
7185    }
7186}
7187
7188/// This protocol provides a low-level ScreenCapture API for clients to use.
7189/// ScreenCapture clients should familiarize themselves with the
7190/// [`fuchsia.sysmem/BufferCollection`] and [`fuchsia.ui.composition/Allocator`] protocols
7191/// as those are necessary to create the BufferCollections and images ScreenCapture uses.
7192#[derive(Debug)]
7193pub enum ScreenCaptureRequest {
7194    /// Clients should first use the Allocator protocol to register a
7195    /// BufferCollection. This function will fail with BAD_OPERATION unless all clients of the
7196    /// BufferCollection have set their constraints.
7197    ///
7198    /// Afterwards, clients should create and configure the images that will
7199    /// eventually be rendered to using this method. All the buffers in the
7200    /// collection from 0 to (buffer_count-1) may be used for screen capture.
7201    ///
7202    /// Clients are responsible for determining the rotation of the display,
7203    /// and applying the corrective rotation. For instance, if the display is
7204    /// mounted 90 degrees clockwise (the "top" is on the right, when looking
7205    /// at the display), then the client should specify a 270 degree rotation
7206    /// to account for it.
7207    ///
7208    /// Similarly, the clients are responsible for specifying a buffer big
7209    /// enough for the rotated image. If the buffer is too small, a best effort
7210    /// attempt will be made to render the image.
7211    ///
7212    /// Finally, clients request the server to render the current screen to the
7213    /// shared buffers using [`GetNextFrame`].
7214    ///
7215    /// [`Configure`] can be called again with a new BufferCollectionImportToken
7216    /// if the client wishes to change any of the configuration settings. In
7217    /// this case all the buffers from the previous call to [`Configure`] will
7218    /// be released.
7219    Configure { payload: ScreenCaptureConfig, responder: ScreenCaptureConfigureResponder },
7220    /// Following a successful call to [`Configure`], clients can call
7221    /// GetNextFrame. This will populate a buffer with the most recent frame.
7222    ///
7223    /// Clients should wait on the zx::event they pass for successful
7224    /// completion of the screenshot. It is not guaranteed that the screenshot
7225    /// will be completed by the time this function returns.
7226    ///
7227    /// The requested image will be in the BufferCollection that the client set
7228    /// up in the VMO at the index specified by buffer_id.
7229    ///
7230    /// When ScreenCapture is used to provide a stream, the rate that the
7231    /// client calls GetNextFrame will drive the frame rate.
7232    ///
7233    /// Errors:
7234    /// BAD_OPERATION if Configure was not called, or not called successfully
7235    /// MISSING_ARGS if a required argument is not present
7236    /// BUFFER_FULL if all buffers in the BufferCollection are in use. In this case, ReleaseFrame
7237    /// must be called to make a buffer available before this function can be called successfully.
7238    GetNextFrame { payload: GetNextFrameArgs, responder: ScreenCaptureGetNextFrameResponder },
7239    /// Once the client no longer needs an image, they can call ReleaseFrame on
7240    /// the VMO index of the buffer so that the server can reuse it in the future.
7241    ReleaseFrame { buffer_id: u32, responder: ScreenCaptureReleaseFrameResponder },
7242}
7243
7244impl ScreenCaptureRequest {
7245    #[allow(irrefutable_let_patterns)]
7246    pub fn into_configure(self) -> Option<(ScreenCaptureConfig, ScreenCaptureConfigureResponder)> {
7247        if let ScreenCaptureRequest::Configure { payload, responder } = self {
7248            Some((payload, responder))
7249        } else {
7250            None
7251        }
7252    }
7253
7254    #[allow(irrefutable_let_patterns)]
7255    pub fn into_get_next_frame(
7256        self,
7257    ) -> Option<(GetNextFrameArgs, ScreenCaptureGetNextFrameResponder)> {
7258        if let ScreenCaptureRequest::GetNextFrame { payload, responder } = self {
7259            Some((payload, responder))
7260        } else {
7261            None
7262        }
7263    }
7264
7265    #[allow(irrefutable_let_patterns)]
7266    pub fn into_release_frame(self) -> Option<(u32, ScreenCaptureReleaseFrameResponder)> {
7267        if let ScreenCaptureRequest::ReleaseFrame { buffer_id, responder } = self {
7268            Some((buffer_id, responder))
7269        } else {
7270            None
7271        }
7272    }
7273
7274    /// Name of the method defined in FIDL
7275    pub fn method_name(&self) -> &'static str {
7276        match *self {
7277            ScreenCaptureRequest::Configure { .. } => "configure",
7278            ScreenCaptureRequest::GetNextFrame { .. } => "get_next_frame",
7279            ScreenCaptureRequest::ReleaseFrame { .. } => "release_frame",
7280        }
7281    }
7282}
7283
7284#[derive(Debug, Clone)]
7285pub struct ScreenCaptureControlHandle {
7286    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7287}
7288
7289impl fidl::endpoints::ControlHandle for ScreenCaptureControlHandle {
7290    fn shutdown(&self) {
7291        self.inner.shutdown()
7292    }
7293
7294    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
7295        self.inner.shutdown_with_epitaph(status)
7296    }
7297
7298    fn is_closed(&self) -> bool {
7299        self.inner.channel().is_closed()
7300    }
7301    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
7302        self.inner.channel().on_closed()
7303    }
7304
7305    #[cfg(target_os = "fuchsia")]
7306    fn signal_peer(
7307        &self,
7308        clear_mask: zx::Signals,
7309        set_mask: zx::Signals,
7310    ) -> Result<(), zx_status::Status> {
7311        use fidl::Peered;
7312        self.inner.channel().signal_peer(clear_mask, set_mask)
7313    }
7314}
7315
7316impl ScreenCaptureControlHandle {}
7317
7318#[must_use = "FIDL methods require a response to be sent"]
7319#[derive(Debug)]
7320pub struct ScreenCaptureConfigureResponder {
7321    control_handle: std::mem::ManuallyDrop<ScreenCaptureControlHandle>,
7322    tx_id: u32,
7323}
7324
7325/// Set the the channel to be shutdown (see [`ScreenCaptureControlHandle::shutdown`])
7326/// if the responder is dropped without sending a response, so that the client
7327/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7328impl std::ops::Drop for ScreenCaptureConfigureResponder {
7329    fn drop(&mut self) {
7330        self.control_handle.shutdown();
7331        // Safety: drops once, never accessed again
7332        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7333    }
7334}
7335
7336impl fidl::endpoints::Responder for ScreenCaptureConfigureResponder {
7337    type ControlHandle = ScreenCaptureControlHandle;
7338
7339    fn control_handle(&self) -> &ScreenCaptureControlHandle {
7340        &self.control_handle
7341    }
7342
7343    fn drop_without_shutdown(mut self) {
7344        // Safety: drops once, never accessed again due to mem::forget
7345        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7346        // Prevent Drop from running (which would shut down the channel)
7347        std::mem::forget(self);
7348    }
7349}
7350
7351impl ScreenCaptureConfigureResponder {
7352    /// Sends a response to the FIDL transaction.
7353    ///
7354    /// Sets the channel to shutdown if an error occurs.
7355    pub fn send(self, mut result: Result<(), ScreenCaptureError>) -> Result<(), fidl::Error> {
7356        let _result = self.send_raw(result);
7357        if _result.is_err() {
7358            self.control_handle.shutdown();
7359        }
7360        self.drop_without_shutdown();
7361        _result
7362    }
7363
7364    /// Similar to "send" but does not shutdown the channel if an error occurs.
7365    pub fn send_no_shutdown_on_err(
7366        self,
7367        mut result: Result<(), ScreenCaptureError>,
7368    ) -> Result<(), fidl::Error> {
7369        let _result = self.send_raw(result);
7370        self.drop_without_shutdown();
7371        _result
7372    }
7373
7374    fn send_raw(&self, mut result: Result<(), ScreenCaptureError>) -> Result<(), fidl::Error> {
7375        self.control_handle.inner.send::<fidl::encoding::ResultType<
7376            fidl::encoding::EmptyStruct,
7377            ScreenCaptureError,
7378        >>(
7379            result,
7380            self.tx_id,
7381            0x3b6e5af1d294afd9,
7382            fidl::encoding::DynamicFlags::empty(),
7383        )
7384    }
7385}
7386
7387#[must_use = "FIDL methods require a response to be sent"]
7388#[derive(Debug)]
7389pub struct ScreenCaptureGetNextFrameResponder {
7390    control_handle: std::mem::ManuallyDrop<ScreenCaptureControlHandle>,
7391    tx_id: u32,
7392}
7393
7394/// Set the the channel to be shutdown (see [`ScreenCaptureControlHandle::shutdown`])
7395/// if the responder is dropped without sending a response, so that the client
7396/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7397impl std::ops::Drop for ScreenCaptureGetNextFrameResponder {
7398    fn drop(&mut self) {
7399        self.control_handle.shutdown();
7400        // Safety: drops once, never accessed again
7401        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7402    }
7403}
7404
7405impl fidl::endpoints::Responder for ScreenCaptureGetNextFrameResponder {
7406    type ControlHandle = ScreenCaptureControlHandle;
7407
7408    fn control_handle(&self) -> &ScreenCaptureControlHandle {
7409        &self.control_handle
7410    }
7411
7412    fn drop_without_shutdown(mut self) {
7413        // Safety: drops once, never accessed again due to mem::forget
7414        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7415        // Prevent Drop from running (which would shut down the channel)
7416        std::mem::forget(self);
7417    }
7418}
7419
7420impl ScreenCaptureGetNextFrameResponder {
7421    /// Sends a response to the FIDL transaction.
7422    ///
7423    /// Sets the channel to shutdown if an error occurs.
7424    pub fn send(
7425        self,
7426        mut result: Result<FrameInfo, ScreenCaptureError>,
7427    ) -> Result<(), fidl::Error> {
7428        let _result = self.send_raw(result);
7429        if _result.is_err() {
7430            self.control_handle.shutdown();
7431        }
7432        self.drop_without_shutdown();
7433        _result
7434    }
7435
7436    /// Similar to "send" but does not shutdown the channel if an error occurs.
7437    pub fn send_no_shutdown_on_err(
7438        self,
7439        mut result: Result<FrameInfo, ScreenCaptureError>,
7440    ) -> Result<(), fidl::Error> {
7441        let _result = self.send_raw(result);
7442        self.drop_without_shutdown();
7443        _result
7444    }
7445
7446    fn send_raw(
7447        &self,
7448        mut result: Result<FrameInfo, ScreenCaptureError>,
7449    ) -> Result<(), fidl::Error> {
7450        self.control_handle.inner.send::<fidl::encoding::ResultType<FrameInfo, ScreenCaptureError>>(
7451            result.as_mut().map_err(|e| *e),
7452            self.tx_id,
7453            0x552c1580aab8c4a7,
7454            fidl::encoding::DynamicFlags::empty(),
7455        )
7456    }
7457}
7458
7459#[must_use = "FIDL methods require a response to be sent"]
7460#[derive(Debug)]
7461pub struct ScreenCaptureReleaseFrameResponder {
7462    control_handle: std::mem::ManuallyDrop<ScreenCaptureControlHandle>,
7463    tx_id: u32,
7464}
7465
7466/// Set the the channel to be shutdown (see [`ScreenCaptureControlHandle::shutdown`])
7467/// if the responder is dropped without sending a response, so that the client
7468/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7469impl std::ops::Drop for ScreenCaptureReleaseFrameResponder {
7470    fn drop(&mut self) {
7471        self.control_handle.shutdown();
7472        // Safety: drops once, never accessed again
7473        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7474    }
7475}
7476
7477impl fidl::endpoints::Responder for ScreenCaptureReleaseFrameResponder {
7478    type ControlHandle = ScreenCaptureControlHandle;
7479
7480    fn control_handle(&self) -> &ScreenCaptureControlHandle {
7481        &self.control_handle
7482    }
7483
7484    fn drop_without_shutdown(mut self) {
7485        // Safety: drops once, never accessed again due to mem::forget
7486        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7487        // Prevent Drop from running (which would shut down the channel)
7488        std::mem::forget(self);
7489    }
7490}
7491
7492impl ScreenCaptureReleaseFrameResponder {
7493    /// Sends a response to the FIDL transaction.
7494    ///
7495    /// Sets the channel to shutdown if an error occurs.
7496    pub fn send(self, mut result: Result<(), ScreenCaptureError>) -> Result<(), fidl::Error> {
7497        let _result = self.send_raw(result);
7498        if _result.is_err() {
7499            self.control_handle.shutdown();
7500        }
7501        self.drop_without_shutdown();
7502        _result
7503    }
7504
7505    /// Similar to "send" but does not shutdown the channel if an error occurs.
7506    pub fn send_no_shutdown_on_err(
7507        self,
7508        mut result: Result<(), ScreenCaptureError>,
7509    ) -> Result<(), fidl::Error> {
7510        let _result = self.send_raw(result);
7511        self.drop_without_shutdown();
7512        _result
7513    }
7514
7515    fn send_raw(&self, mut result: Result<(), ScreenCaptureError>) -> Result<(), fidl::Error> {
7516        self.control_handle.inner.send::<fidl::encoding::ResultType<
7517            fidl::encoding::EmptyStruct,
7518            ScreenCaptureError,
7519        >>(
7520            result,
7521            self.tx_id,
7522            0x46704dce24e35950,
7523            fidl::encoding::DynamicFlags::empty(),
7524        )
7525    }
7526}
7527
7528#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
7529pub struct ScreenshotMarker;
7530
7531impl fidl::endpoints::ProtocolMarker for ScreenshotMarker {
7532    type Proxy = ScreenshotProxy;
7533    type RequestStream = ScreenshotRequestStream;
7534    #[cfg(target_os = "fuchsia")]
7535    type SynchronousProxy = ScreenshotSynchronousProxy;
7536
7537    const DEBUG_NAME: &'static str = "fuchsia.ui.composition.Screenshot";
7538}
7539impl fidl::endpoints::DiscoverableProtocolMarker for ScreenshotMarker {}
7540
7541pub trait ScreenshotProxyInterface: Send + Sync {
7542    type TakeResponseFut: std::future::Future<Output = Result<ScreenshotTakeResponse, fidl::Error>>
7543        + Send;
7544    fn r#take(&self, payload: ScreenshotTakeRequest) -> Self::TakeResponseFut;
7545    type TakeFileResponseFut: std::future::Future<Output = Result<ScreenshotTakeFileResponse, fidl::Error>>
7546        + Send;
7547    fn r#take_file(&self, payload: ScreenshotTakeFileRequest) -> Self::TakeFileResponseFut;
7548}
7549#[derive(Debug)]
7550#[cfg(target_os = "fuchsia")]
7551pub struct ScreenshotSynchronousProxy {
7552    client: fidl::client::sync::Client,
7553}
7554
7555#[cfg(target_os = "fuchsia")]
7556impl fidl::endpoints::SynchronousProxy for ScreenshotSynchronousProxy {
7557    type Proxy = ScreenshotProxy;
7558    type Protocol = ScreenshotMarker;
7559
7560    fn from_channel(inner: fidl::Channel) -> Self {
7561        Self::new(inner)
7562    }
7563
7564    fn into_channel(self) -> fidl::Channel {
7565        self.client.into_channel()
7566    }
7567
7568    fn as_channel(&self) -> &fidl::Channel {
7569        self.client.as_channel()
7570    }
7571}
7572
7573#[cfg(target_os = "fuchsia")]
7574impl ScreenshotSynchronousProxy {
7575    pub fn new(channel: fidl::Channel) -> Self {
7576        Self { client: fidl::client::sync::Client::new(channel) }
7577    }
7578
7579    pub fn into_channel(self) -> fidl::Channel {
7580        self.client.into_channel()
7581    }
7582
7583    /// Waits until an event arrives and returns it. It is safe for other
7584    /// threads to make concurrent requests while waiting for an event.
7585    pub fn wait_for_event(
7586        &self,
7587        deadline: zx::MonotonicInstant,
7588    ) -> Result<ScreenshotEvent, fidl::Error> {
7589        ScreenshotEvent::decode(self.client.wait_for_event::<ScreenshotMarker>(deadline)?)
7590    }
7591
7592    /// Collects the current graphical content of a display in a specified buffer `format` in the
7593    /// sRGB color space. Note that the sRGB color space is non-linear, meaning that unit tests
7594    /// doing pixel equality checks making use of non-fully saturated colors should convert to a
7595    /// linear color space.
7596    ///
7597    /// See https://fuchsia.dev/fuchsia-src/concepts/ui/scenic/color_spaces for more information.
7598    ///
7599    /// Screenshot is taken immediately, populated with the display's content from the most recent
7600    /// VSYNC.
7601    ///
7602    /// If the client calls [`Take`] a second time before a first [`Take`] call returns, the server
7603    /// will close the Screenshot connection with a ZX_ERR_SHOULD_WAIT epitaph.
7604    ///
7605    /// If capture fails due to an internal error, the server will close the Screenshot connection
7606    /// with a ZX_ERR_INTERNAL epitaph.
7607    pub fn r#take(
7608        &self,
7609        mut payload: ScreenshotTakeRequest,
7610        ___deadline: zx::MonotonicInstant,
7611    ) -> Result<ScreenshotTakeResponse, fidl::Error> {
7612        let _response = self
7613            .client
7614            .send_query::<ScreenshotTakeRequest, ScreenshotTakeResponse, ScreenshotMarker>(
7615                &mut payload,
7616                0x51341396e9fd2fd0,
7617                fidl::encoding::DynamicFlags::empty(),
7618                ___deadline,
7619            )?;
7620        Ok(_response)
7621    }
7622
7623    /// Collects the current graphical content of a display in a specified buffer `format` in the
7624    /// sRGB color space. Note that the sRGB color space is non-linear, meaning that unit tests
7625    /// doing pixel equality checks making use of non-fully saturated colors should convert to a
7626    /// linear color space.
7627    ///
7628    /// TODO(https://fxbug.dev/42065844): Link to fuchsia.dev documentation when it's up.
7629    ///
7630    /// Screenshot is taken immediately, populated with the display's content from the most recent
7631    /// VSYNC.
7632    ///
7633    /// If the client calls [`TakeFile`] a second time before a first [`TakeFile`] call returns,
7634    /// the server will close the Screenshot connection with a ZX_ERR_SHOULD_WAIT epitaph.
7635    ///
7636    /// If capture fails due to an internal error, the server will close the Screenshot connection
7637    /// with a ZX_ERR_INTERNAL epitaph.
7638    ///
7639    /// This call should be used if the client is on the host and does not support VMOs,
7640    /// as is the case for ffx tools.
7641    pub fn r#take_file(
7642        &self,
7643        mut payload: ScreenshotTakeFileRequest,
7644        ___deadline: zx::MonotonicInstant,
7645    ) -> Result<ScreenshotTakeFileResponse, fidl::Error> {
7646        let _response = self
7647            .client
7648            .send_query::<ScreenshotTakeFileRequest, ScreenshotTakeFileResponse, ScreenshotMarker>(
7649                &mut payload,
7650                0x470aeea0a4d32903,
7651                fidl::encoding::DynamicFlags::empty(),
7652                ___deadline,
7653            )?;
7654        Ok(_response)
7655    }
7656}
7657
7658#[cfg(target_os = "fuchsia")]
7659impl From<ScreenshotSynchronousProxy> for zx::NullableHandle {
7660    fn from(value: ScreenshotSynchronousProxy) -> Self {
7661        value.into_channel().into()
7662    }
7663}
7664
7665#[cfg(target_os = "fuchsia")]
7666impl From<fidl::Channel> for ScreenshotSynchronousProxy {
7667    fn from(value: fidl::Channel) -> Self {
7668        Self::new(value)
7669    }
7670}
7671
7672#[cfg(target_os = "fuchsia")]
7673impl fidl::endpoints::FromClient for ScreenshotSynchronousProxy {
7674    type Protocol = ScreenshotMarker;
7675
7676    fn from_client(value: fidl::endpoints::ClientEnd<ScreenshotMarker>) -> Self {
7677        Self::new(value.into_channel())
7678    }
7679}
7680
7681#[derive(Debug, Clone)]
7682pub struct ScreenshotProxy {
7683    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
7684}
7685
7686impl fidl::endpoints::Proxy for ScreenshotProxy {
7687    type Protocol = ScreenshotMarker;
7688
7689    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
7690        Self::new(inner)
7691    }
7692
7693    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
7694        self.client.into_channel().map_err(|client| Self { client })
7695    }
7696
7697    fn as_channel(&self) -> &::fidl::AsyncChannel {
7698        self.client.as_channel()
7699    }
7700}
7701
7702impl ScreenshotProxy {
7703    /// Create a new Proxy for fuchsia.ui.composition/Screenshot.
7704    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
7705        let protocol_name = <ScreenshotMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
7706        Self { client: fidl::client::Client::new(channel, protocol_name) }
7707    }
7708
7709    /// Get a Stream of events from the remote end of the protocol.
7710    ///
7711    /// # Panics
7712    ///
7713    /// Panics if the event stream was already taken.
7714    pub fn take_event_stream(&self) -> ScreenshotEventStream {
7715        ScreenshotEventStream { event_receiver: self.client.take_event_receiver() }
7716    }
7717
7718    /// Collects the current graphical content of a display in a specified buffer `format` in the
7719    /// sRGB color space. Note that the sRGB color space is non-linear, meaning that unit tests
7720    /// doing pixel equality checks making use of non-fully saturated colors should convert to a
7721    /// linear color space.
7722    ///
7723    /// See https://fuchsia.dev/fuchsia-src/concepts/ui/scenic/color_spaces for more information.
7724    ///
7725    /// Screenshot is taken immediately, populated with the display's content from the most recent
7726    /// VSYNC.
7727    ///
7728    /// If the client calls [`Take`] a second time before a first [`Take`] call returns, the server
7729    /// will close the Screenshot connection with a ZX_ERR_SHOULD_WAIT epitaph.
7730    ///
7731    /// If capture fails due to an internal error, the server will close the Screenshot connection
7732    /// with a ZX_ERR_INTERNAL epitaph.
7733    pub fn r#take(
7734        &self,
7735        mut payload: ScreenshotTakeRequest,
7736    ) -> fidl::client::QueryResponseFut<
7737        ScreenshotTakeResponse,
7738        fidl::encoding::DefaultFuchsiaResourceDialect,
7739    > {
7740        ScreenshotProxyInterface::r#take(self, payload)
7741    }
7742
7743    /// Collects the current graphical content of a display in a specified buffer `format` in the
7744    /// sRGB color space. Note that the sRGB color space is non-linear, meaning that unit tests
7745    /// doing pixel equality checks making use of non-fully saturated colors should convert to a
7746    /// linear color space.
7747    ///
7748    /// TODO(https://fxbug.dev/42065844): Link to fuchsia.dev documentation when it's up.
7749    ///
7750    /// Screenshot is taken immediately, populated with the display's content from the most recent
7751    /// VSYNC.
7752    ///
7753    /// If the client calls [`TakeFile`] a second time before a first [`TakeFile`] call returns,
7754    /// the server will close the Screenshot connection with a ZX_ERR_SHOULD_WAIT epitaph.
7755    ///
7756    /// If capture fails due to an internal error, the server will close the Screenshot connection
7757    /// with a ZX_ERR_INTERNAL epitaph.
7758    ///
7759    /// This call should be used if the client is on the host and does not support VMOs,
7760    /// as is the case for ffx tools.
7761    pub fn r#take_file(
7762        &self,
7763        mut payload: ScreenshotTakeFileRequest,
7764    ) -> fidl::client::QueryResponseFut<
7765        ScreenshotTakeFileResponse,
7766        fidl::encoding::DefaultFuchsiaResourceDialect,
7767    > {
7768        ScreenshotProxyInterface::r#take_file(self, payload)
7769    }
7770}
7771
7772impl ScreenshotProxyInterface for ScreenshotProxy {
7773    type TakeResponseFut = fidl::client::QueryResponseFut<
7774        ScreenshotTakeResponse,
7775        fidl::encoding::DefaultFuchsiaResourceDialect,
7776    >;
7777    fn r#take(&self, mut payload: ScreenshotTakeRequest) -> Self::TakeResponseFut {
7778        fn _decode(
7779            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7780        ) -> Result<ScreenshotTakeResponse, fidl::Error> {
7781            let _response = fidl::client::decode_transaction_body::<
7782                ScreenshotTakeResponse,
7783                fidl::encoding::DefaultFuchsiaResourceDialect,
7784                0x51341396e9fd2fd0,
7785            >(_buf?)?;
7786            Ok(_response)
7787        }
7788        self.client.send_query_and_decode::<ScreenshotTakeRequest, ScreenshotTakeResponse>(
7789            &mut payload,
7790            0x51341396e9fd2fd0,
7791            fidl::encoding::DynamicFlags::empty(),
7792            _decode,
7793        )
7794    }
7795
7796    type TakeFileResponseFut = fidl::client::QueryResponseFut<
7797        ScreenshotTakeFileResponse,
7798        fidl::encoding::DefaultFuchsiaResourceDialect,
7799    >;
7800    fn r#take_file(&self, mut payload: ScreenshotTakeFileRequest) -> Self::TakeFileResponseFut {
7801        fn _decode(
7802            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7803        ) -> Result<ScreenshotTakeFileResponse, fidl::Error> {
7804            let _response = fidl::client::decode_transaction_body::<
7805                ScreenshotTakeFileResponse,
7806                fidl::encoding::DefaultFuchsiaResourceDialect,
7807                0x470aeea0a4d32903,
7808            >(_buf?)?;
7809            Ok(_response)
7810        }
7811        self.client.send_query_and_decode::<ScreenshotTakeFileRequest, ScreenshotTakeFileResponse>(
7812            &mut payload,
7813            0x470aeea0a4d32903,
7814            fidl::encoding::DynamicFlags::empty(),
7815            _decode,
7816        )
7817    }
7818}
7819
7820pub struct ScreenshotEventStream {
7821    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
7822}
7823
7824impl std::marker::Unpin for ScreenshotEventStream {}
7825
7826impl futures::stream::FusedStream for ScreenshotEventStream {
7827    fn is_terminated(&self) -> bool {
7828        self.event_receiver.is_terminated()
7829    }
7830}
7831
7832impl futures::Stream for ScreenshotEventStream {
7833    type Item = Result<ScreenshotEvent, fidl::Error>;
7834
7835    fn poll_next(
7836        mut self: std::pin::Pin<&mut Self>,
7837        cx: &mut std::task::Context<'_>,
7838    ) -> std::task::Poll<Option<Self::Item>> {
7839        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
7840            &mut self.event_receiver,
7841            cx
7842        )?) {
7843            Some(buf) => std::task::Poll::Ready(Some(ScreenshotEvent::decode(buf))),
7844            None => std::task::Poll::Ready(None),
7845        }
7846    }
7847}
7848
7849#[derive(Debug)]
7850pub enum ScreenshotEvent {}
7851
7852impl ScreenshotEvent {
7853    /// Decodes a message buffer as a [`ScreenshotEvent`].
7854    fn decode(
7855        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
7856    ) -> Result<ScreenshotEvent, fidl::Error> {
7857        let (bytes, _handles) = buf.split_mut();
7858        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7859        debug_assert_eq!(tx_header.tx_id, 0);
7860        match tx_header.ordinal {
7861            _ => Err(fidl::Error::UnknownOrdinal {
7862                ordinal: tx_header.ordinal,
7863                protocol_name: <ScreenshotMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
7864            }),
7865        }
7866    }
7867}
7868
7869/// A Stream of incoming requests for fuchsia.ui.composition/Screenshot.
7870pub struct ScreenshotRequestStream {
7871    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7872    is_terminated: bool,
7873}
7874
7875impl std::marker::Unpin for ScreenshotRequestStream {}
7876
7877impl futures::stream::FusedStream for ScreenshotRequestStream {
7878    fn is_terminated(&self) -> bool {
7879        self.is_terminated
7880    }
7881}
7882
7883impl fidl::endpoints::RequestStream for ScreenshotRequestStream {
7884    type Protocol = ScreenshotMarker;
7885    type ControlHandle = ScreenshotControlHandle;
7886
7887    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
7888        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
7889    }
7890
7891    fn control_handle(&self) -> Self::ControlHandle {
7892        ScreenshotControlHandle { inner: self.inner.clone() }
7893    }
7894
7895    fn into_inner(
7896        self,
7897    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
7898    {
7899        (self.inner, self.is_terminated)
7900    }
7901
7902    fn from_inner(
7903        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7904        is_terminated: bool,
7905    ) -> Self {
7906        Self { inner, is_terminated }
7907    }
7908}
7909
7910impl futures::Stream for ScreenshotRequestStream {
7911    type Item = Result<ScreenshotRequest, fidl::Error>;
7912
7913    fn poll_next(
7914        mut self: std::pin::Pin<&mut Self>,
7915        cx: &mut std::task::Context<'_>,
7916    ) -> std::task::Poll<Option<Self::Item>> {
7917        let this = &mut *self;
7918        if this.inner.check_shutdown(cx) {
7919            this.is_terminated = true;
7920            return std::task::Poll::Ready(None);
7921        }
7922        if this.is_terminated {
7923            panic!("polled ScreenshotRequestStream after completion");
7924        }
7925        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
7926            |bytes, handles| {
7927                match this.inner.channel().read_etc(cx, bytes, handles) {
7928                    std::task::Poll::Ready(Ok(())) => {}
7929                    std::task::Poll::Pending => return std::task::Poll::Pending,
7930                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
7931                        this.is_terminated = true;
7932                        return std::task::Poll::Ready(None);
7933                    }
7934                    std::task::Poll::Ready(Err(e)) => {
7935                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
7936                            e.into(),
7937                        ))));
7938                    }
7939                }
7940
7941                // A message has been received from the channel
7942                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7943
7944                std::task::Poll::Ready(Some(match header.ordinal {
7945                    0x51341396e9fd2fd0 => {
7946                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7947                        let mut req = fidl::new_empty!(
7948                            ScreenshotTakeRequest,
7949                            fidl::encoding::DefaultFuchsiaResourceDialect
7950                        );
7951                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ScreenshotTakeRequest>(&header, _body_bytes, handles, &mut req)?;
7952                        let control_handle = ScreenshotControlHandle { inner: this.inner.clone() };
7953                        Ok(ScreenshotRequest::Take {
7954                            payload: req,
7955                            responder: ScreenshotTakeResponder {
7956                                control_handle: std::mem::ManuallyDrop::new(control_handle),
7957                                tx_id: header.tx_id,
7958                            },
7959                        })
7960                    }
7961                    0x470aeea0a4d32903 => {
7962                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7963                        let mut req = fidl::new_empty!(
7964                            ScreenshotTakeFileRequest,
7965                            fidl::encoding::DefaultFuchsiaResourceDialect
7966                        );
7967                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ScreenshotTakeFileRequest>(&header, _body_bytes, handles, &mut req)?;
7968                        let control_handle = ScreenshotControlHandle { inner: this.inner.clone() };
7969                        Ok(ScreenshotRequest::TakeFile {
7970                            payload: req,
7971                            responder: ScreenshotTakeFileResponder {
7972                                control_handle: std::mem::ManuallyDrop::new(control_handle),
7973                                tx_id: header.tx_id,
7974                            },
7975                        })
7976                    }
7977                    _ => Err(fidl::Error::UnknownOrdinal {
7978                        ordinal: header.ordinal,
7979                        protocol_name:
7980                            <ScreenshotMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
7981                    }),
7982                }))
7983            },
7984        )
7985    }
7986}
7987
7988/// Collects the current graphical content of a display.
7989#[derive(Debug)]
7990pub enum ScreenshotRequest {
7991    /// Collects the current graphical content of a display in a specified buffer `format` in the
7992    /// sRGB color space. Note that the sRGB color space is non-linear, meaning that unit tests
7993    /// doing pixel equality checks making use of non-fully saturated colors should convert to a
7994    /// linear color space.
7995    ///
7996    /// See https://fuchsia.dev/fuchsia-src/concepts/ui/scenic/color_spaces for more information.
7997    ///
7998    /// Screenshot is taken immediately, populated with the display's content from the most recent
7999    /// VSYNC.
8000    ///
8001    /// If the client calls [`Take`] a second time before a first [`Take`] call returns, the server
8002    /// will close the Screenshot connection with a ZX_ERR_SHOULD_WAIT epitaph.
8003    ///
8004    /// If capture fails due to an internal error, the server will close the Screenshot connection
8005    /// with a ZX_ERR_INTERNAL epitaph.
8006    Take { payload: ScreenshotTakeRequest, responder: ScreenshotTakeResponder },
8007    /// Collects the current graphical content of a display in a specified buffer `format` in the
8008    /// sRGB color space. Note that the sRGB color space is non-linear, meaning that unit tests
8009    /// doing pixel equality checks making use of non-fully saturated colors should convert to a
8010    /// linear color space.
8011    ///
8012    /// TODO(https://fxbug.dev/42065844): Link to fuchsia.dev documentation when it's up.
8013    ///
8014    /// Screenshot is taken immediately, populated with the display's content from the most recent
8015    /// VSYNC.
8016    ///
8017    /// If the client calls [`TakeFile`] a second time before a first [`TakeFile`] call returns,
8018    /// the server will close the Screenshot connection with a ZX_ERR_SHOULD_WAIT epitaph.
8019    ///
8020    /// If capture fails due to an internal error, the server will close the Screenshot connection
8021    /// with a ZX_ERR_INTERNAL epitaph.
8022    ///
8023    /// This call should be used if the client is on the host and does not support VMOs,
8024    /// as is the case for ffx tools.
8025    TakeFile { payload: ScreenshotTakeFileRequest, responder: ScreenshotTakeFileResponder },
8026}
8027
8028impl ScreenshotRequest {
8029    #[allow(irrefutable_let_patterns)]
8030    pub fn into_take(self) -> Option<(ScreenshotTakeRequest, ScreenshotTakeResponder)> {
8031        if let ScreenshotRequest::Take { payload, responder } = self {
8032            Some((payload, responder))
8033        } else {
8034            None
8035        }
8036    }
8037
8038    #[allow(irrefutable_let_patterns)]
8039    pub fn into_take_file(
8040        self,
8041    ) -> Option<(ScreenshotTakeFileRequest, ScreenshotTakeFileResponder)> {
8042        if let ScreenshotRequest::TakeFile { payload, responder } = self {
8043            Some((payload, responder))
8044        } else {
8045            None
8046        }
8047    }
8048
8049    /// Name of the method defined in FIDL
8050    pub fn method_name(&self) -> &'static str {
8051        match *self {
8052            ScreenshotRequest::Take { .. } => "take",
8053            ScreenshotRequest::TakeFile { .. } => "take_file",
8054        }
8055    }
8056}
8057
8058#[derive(Debug, Clone)]
8059pub struct ScreenshotControlHandle {
8060    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8061}
8062
8063impl fidl::endpoints::ControlHandle for ScreenshotControlHandle {
8064    fn shutdown(&self) {
8065        self.inner.shutdown()
8066    }
8067
8068    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
8069        self.inner.shutdown_with_epitaph(status)
8070    }
8071
8072    fn is_closed(&self) -> bool {
8073        self.inner.channel().is_closed()
8074    }
8075    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
8076        self.inner.channel().on_closed()
8077    }
8078
8079    #[cfg(target_os = "fuchsia")]
8080    fn signal_peer(
8081        &self,
8082        clear_mask: zx::Signals,
8083        set_mask: zx::Signals,
8084    ) -> Result<(), zx_status::Status> {
8085        use fidl::Peered;
8086        self.inner.channel().signal_peer(clear_mask, set_mask)
8087    }
8088}
8089
8090impl ScreenshotControlHandle {}
8091
8092#[must_use = "FIDL methods require a response to be sent"]
8093#[derive(Debug)]
8094pub struct ScreenshotTakeResponder {
8095    control_handle: std::mem::ManuallyDrop<ScreenshotControlHandle>,
8096    tx_id: u32,
8097}
8098
8099/// Set the the channel to be shutdown (see [`ScreenshotControlHandle::shutdown`])
8100/// if the responder is dropped without sending a response, so that the client
8101/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
8102impl std::ops::Drop for ScreenshotTakeResponder {
8103    fn drop(&mut self) {
8104        self.control_handle.shutdown();
8105        // Safety: drops once, never accessed again
8106        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8107    }
8108}
8109
8110impl fidl::endpoints::Responder for ScreenshotTakeResponder {
8111    type ControlHandle = ScreenshotControlHandle;
8112
8113    fn control_handle(&self) -> &ScreenshotControlHandle {
8114        &self.control_handle
8115    }
8116
8117    fn drop_without_shutdown(mut self) {
8118        // Safety: drops once, never accessed again due to mem::forget
8119        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8120        // Prevent Drop from running (which would shut down the channel)
8121        std::mem::forget(self);
8122    }
8123}
8124
8125impl ScreenshotTakeResponder {
8126    /// Sends a response to the FIDL transaction.
8127    ///
8128    /// Sets the channel to shutdown if an error occurs.
8129    pub fn send(self, mut payload: ScreenshotTakeResponse) -> Result<(), fidl::Error> {
8130        let _result = self.send_raw(payload);
8131        if _result.is_err() {
8132            self.control_handle.shutdown();
8133        }
8134        self.drop_without_shutdown();
8135        _result
8136    }
8137
8138    /// Similar to "send" but does not shutdown the channel if an error occurs.
8139    pub fn send_no_shutdown_on_err(
8140        self,
8141        mut payload: ScreenshotTakeResponse,
8142    ) -> Result<(), fidl::Error> {
8143        let _result = self.send_raw(payload);
8144        self.drop_without_shutdown();
8145        _result
8146    }
8147
8148    fn send_raw(&self, mut payload: ScreenshotTakeResponse) -> Result<(), fidl::Error> {
8149        self.control_handle.inner.send::<ScreenshotTakeResponse>(
8150            &mut payload,
8151            self.tx_id,
8152            0x51341396e9fd2fd0,
8153            fidl::encoding::DynamicFlags::empty(),
8154        )
8155    }
8156}
8157
8158#[must_use = "FIDL methods require a response to be sent"]
8159#[derive(Debug)]
8160pub struct ScreenshotTakeFileResponder {
8161    control_handle: std::mem::ManuallyDrop<ScreenshotControlHandle>,
8162    tx_id: u32,
8163}
8164
8165/// Set the the channel to be shutdown (see [`ScreenshotControlHandle::shutdown`])
8166/// if the responder is dropped without sending a response, so that the client
8167/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
8168impl std::ops::Drop for ScreenshotTakeFileResponder {
8169    fn drop(&mut self) {
8170        self.control_handle.shutdown();
8171        // Safety: drops once, never accessed again
8172        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8173    }
8174}
8175
8176impl fidl::endpoints::Responder for ScreenshotTakeFileResponder {
8177    type ControlHandle = ScreenshotControlHandle;
8178
8179    fn control_handle(&self) -> &ScreenshotControlHandle {
8180        &self.control_handle
8181    }
8182
8183    fn drop_without_shutdown(mut self) {
8184        // Safety: drops once, never accessed again due to mem::forget
8185        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8186        // Prevent Drop from running (which would shut down the channel)
8187        std::mem::forget(self);
8188    }
8189}
8190
8191impl ScreenshotTakeFileResponder {
8192    /// Sends a response to the FIDL transaction.
8193    ///
8194    /// Sets the channel to shutdown if an error occurs.
8195    pub fn send(self, mut payload: ScreenshotTakeFileResponse) -> Result<(), fidl::Error> {
8196        let _result = self.send_raw(payload);
8197        if _result.is_err() {
8198            self.control_handle.shutdown();
8199        }
8200        self.drop_without_shutdown();
8201        _result
8202    }
8203
8204    /// Similar to "send" but does not shutdown the channel if an error occurs.
8205    pub fn send_no_shutdown_on_err(
8206        self,
8207        mut payload: ScreenshotTakeFileResponse,
8208    ) -> Result<(), fidl::Error> {
8209        let _result = self.send_raw(payload);
8210        self.drop_without_shutdown();
8211        _result
8212    }
8213
8214    fn send_raw(&self, mut payload: ScreenshotTakeFileResponse) -> Result<(), fidl::Error> {
8215        self.control_handle.inner.send::<ScreenshotTakeFileResponse>(
8216            &mut payload,
8217            self.tx_id,
8218            0x470aeea0a4d32903,
8219            fidl::encoding::DynamicFlags::empty(),
8220        )
8221    }
8222}
8223
8224#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
8225pub struct TrustedFlatlandMarker;
8226
8227impl fidl::endpoints::ProtocolMarker for TrustedFlatlandMarker {
8228    type Proxy = TrustedFlatlandProxy;
8229    type RequestStream = TrustedFlatlandRequestStream;
8230    #[cfg(target_os = "fuchsia")]
8231    type SynchronousProxy = TrustedFlatlandSynchronousProxy;
8232
8233    const DEBUG_NAME: &'static str = "(anonymous) TrustedFlatland";
8234}
8235
8236pub trait TrustedFlatlandProxyInterface: Send + Sync {
8237    fn r#release_image_immediately(&self, image_id: &ContentId) -> Result<(), fidl::Error>;
8238}
8239#[derive(Debug)]
8240#[cfg(target_os = "fuchsia")]
8241pub struct TrustedFlatlandSynchronousProxy {
8242    client: fidl::client::sync::Client,
8243}
8244
8245#[cfg(target_os = "fuchsia")]
8246impl fidl::endpoints::SynchronousProxy for TrustedFlatlandSynchronousProxy {
8247    type Proxy = TrustedFlatlandProxy;
8248    type Protocol = TrustedFlatlandMarker;
8249
8250    fn from_channel(inner: fidl::Channel) -> Self {
8251        Self::new(inner)
8252    }
8253
8254    fn into_channel(self) -> fidl::Channel {
8255        self.client.into_channel()
8256    }
8257
8258    fn as_channel(&self) -> &fidl::Channel {
8259        self.client.as_channel()
8260    }
8261}
8262
8263#[cfg(target_os = "fuchsia")]
8264impl TrustedFlatlandSynchronousProxy {
8265    pub fn new(channel: fidl::Channel) -> Self {
8266        Self { client: fidl::client::sync::Client::new(channel) }
8267    }
8268
8269    pub fn into_channel(self) -> fidl::Channel {
8270        self.client.into_channel()
8271    }
8272
8273    /// Waits until an event arrives and returns it. It is safe for other
8274    /// threads to make concurrent requests while waiting for an event.
8275    pub fn wait_for_event(
8276        &self,
8277        deadline: zx::MonotonicInstant,
8278    ) -> Result<TrustedFlatlandEvent, fidl::Error> {
8279        TrustedFlatlandEvent::decode(self.client.wait_for_event::<TrustedFlatlandMarker>(deadline)?)
8280    }
8281
8282    /// Releases an image immediately, without waiting for the next present.
8283    pub fn r#release_image_immediately(&self, mut image_id: &ContentId) -> Result<(), fidl::Error> {
8284        self.client.send::<TrustedFlatlandReleaseImageImmediatelyRequest>(
8285            (image_id,),
8286            0x245e1ac080772c8,
8287            fidl::encoding::DynamicFlags::empty(),
8288        )
8289    }
8290}
8291
8292#[cfg(target_os = "fuchsia")]
8293impl From<TrustedFlatlandSynchronousProxy> for zx::NullableHandle {
8294    fn from(value: TrustedFlatlandSynchronousProxy) -> Self {
8295        value.into_channel().into()
8296    }
8297}
8298
8299#[cfg(target_os = "fuchsia")]
8300impl From<fidl::Channel> for TrustedFlatlandSynchronousProxy {
8301    fn from(value: fidl::Channel) -> Self {
8302        Self::new(value)
8303    }
8304}
8305
8306#[cfg(target_os = "fuchsia")]
8307impl fidl::endpoints::FromClient for TrustedFlatlandSynchronousProxy {
8308    type Protocol = TrustedFlatlandMarker;
8309
8310    fn from_client(value: fidl::endpoints::ClientEnd<TrustedFlatlandMarker>) -> Self {
8311        Self::new(value.into_channel())
8312    }
8313}
8314
8315#[derive(Debug, Clone)]
8316pub struct TrustedFlatlandProxy {
8317    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
8318}
8319
8320impl fidl::endpoints::Proxy for TrustedFlatlandProxy {
8321    type Protocol = TrustedFlatlandMarker;
8322
8323    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
8324        Self::new(inner)
8325    }
8326
8327    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
8328        self.client.into_channel().map_err(|client| Self { client })
8329    }
8330
8331    fn as_channel(&self) -> &::fidl::AsyncChannel {
8332        self.client.as_channel()
8333    }
8334}
8335
8336impl TrustedFlatlandProxy {
8337    /// Create a new Proxy for fuchsia.ui.composition/TrustedFlatland.
8338    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
8339        let protocol_name = <TrustedFlatlandMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
8340        Self { client: fidl::client::Client::new(channel, protocol_name) }
8341    }
8342
8343    /// Get a Stream of events from the remote end of the protocol.
8344    ///
8345    /// # Panics
8346    ///
8347    /// Panics if the event stream was already taken.
8348    pub fn take_event_stream(&self) -> TrustedFlatlandEventStream {
8349        TrustedFlatlandEventStream { event_receiver: self.client.take_event_receiver() }
8350    }
8351
8352    /// Releases an image immediately, without waiting for the next present.
8353    pub fn r#release_image_immediately(&self, mut image_id: &ContentId) -> Result<(), fidl::Error> {
8354        TrustedFlatlandProxyInterface::r#release_image_immediately(self, image_id)
8355    }
8356}
8357
8358impl TrustedFlatlandProxyInterface for TrustedFlatlandProxy {
8359    fn r#release_image_immediately(&self, mut image_id: &ContentId) -> Result<(), fidl::Error> {
8360        self.client.send::<TrustedFlatlandReleaseImageImmediatelyRequest>(
8361            (image_id,),
8362            0x245e1ac080772c8,
8363            fidl::encoding::DynamicFlags::empty(),
8364        )
8365    }
8366}
8367
8368pub struct TrustedFlatlandEventStream {
8369    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
8370}
8371
8372impl std::marker::Unpin for TrustedFlatlandEventStream {}
8373
8374impl futures::stream::FusedStream for TrustedFlatlandEventStream {
8375    fn is_terminated(&self) -> bool {
8376        self.event_receiver.is_terminated()
8377    }
8378}
8379
8380impl futures::Stream for TrustedFlatlandEventStream {
8381    type Item = Result<TrustedFlatlandEvent, fidl::Error>;
8382
8383    fn poll_next(
8384        mut self: std::pin::Pin<&mut Self>,
8385        cx: &mut std::task::Context<'_>,
8386    ) -> std::task::Poll<Option<Self::Item>> {
8387        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
8388            &mut self.event_receiver,
8389            cx
8390        )?) {
8391            Some(buf) => std::task::Poll::Ready(Some(TrustedFlatlandEvent::decode(buf))),
8392            None => std::task::Poll::Ready(None),
8393        }
8394    }
8395}
8396
8397#[derive(Debug)]
8398pub enum TrustedFlatlandEvent {}
8399
8400impl TrustedFlatlandEvent {
8401    /// Decodes a message buffer as a [`TrustedFlatlandEvent`].
8402    fn decode(
8403        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
8404    ) -> Result<TrustedFlatlandEvent, fidl::Error> {
8405        let (bytes, _handles) = buf.split_mut();
8406        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
8407        debug_assert_eq!(tx_header.tx_id, 0);
8408        match tx_header.ordinal {
8409            _ => Err(fidl::Error::UnknownOrdinal {
8410                ordinal: tx_header.ordinal,
8411                protocol_name:
8412                    <TrustedFlatlandMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
8413            }),
8414        }
8415    }
8416}
8417
8418/// A Stream of incoming requests for fuchsia.ui.composition/TrustedFlatland.
8419pub struct TrustedFlatlandRequestStream {
8420    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8421    is_terminated: bool,
8422}
8423
8424impl std::marker::Unpin for TrustedFlatlandRequestStream {}
8425
8426impl futures::stream::FusedStream for TrustedFlatlandRequestStream {
8427    fn is_terminated(&self) -> bool {
8428        self.is_terminated
8429    }
8430}
8431
8432impl fidl::endpoints::RequestStream for TrustedFlatlandRequestStream {
8433    type Protocol = TrustedFlatlandMarker;
8434    type ControlHandle = TrustedFlatlandControlHandle;
8435
8436    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
8437        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
8438    }
8439
8440    fn control_handle(&self) -> Self::ControlHandle {
8441        TrustedFlatlandControlHandle { inner: self.inner.clone() }
8442    }
8443
8444    fn into_inner(
8445        self,
8446    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
8447    {
8448        (self.inner, self.is_terminated)
8449    }
8450
8451    fn from_inner(
8452        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8453        is_terminated: bool,
8454    ) -> Self {
8455        Self { inner, is_terminated }
8456    }
8457}
8458
8459impl futures::Stream for TrustedFlatlandRequestStream {
8460    type Item = Result<TrustedFlatlandRequest, fidl::Error>;
8461
8462    fn poll_next(
8463        mut self: std::pin::Pin<&mut Self>,
8464        cx: &mut std::task::Context<'_>,
8465    ) -> std::task::Poll<Option<Self::Item>> {
8466        let this = &mut *self;
8467        if this.inner.check_shutdown(cx) {
8468            this.is_terminated = true;
8469            return std::task::Poll::Ready(None);
8470        }
8471        if this.is_terminated {
8472            panic!("polled TrustedFlatlandRequestStream after completion");
8473        }
8474        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
8475            |bytes, handles| {
8476                match this.inner.channel().read_etc(cx, bytes, handles) {
8477                    std::task::Poll::Ready(Ok(())) => {}
8478                    std::task::Poll::Pending => return std::task::Poll::Pending,
8479                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
8480                        this.is_terminated = true;
8481                        return std::task::Poll::Ready(None);
8482                    }
8483                    std::task::Poll::Ready(Err(e)) => {
8484                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
8485                            e.into(),
8486                        ))));
8487                    }
8488                }
8489
8490                // A message has been received from the channel
8491                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
8492
8493                std::task::Poll::Ready(Some(match header.ordinal {
8494                    0x245e1ac080772c8 => {
8495                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
8496                        let mut req = fidl::new_empty!(
8497                            TrustedFlatlandReleaseImageImmediatelyRequest,
8498                            fidl::encoding::DefaultFuchsiaResourceDialect
8499                        );
8500                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<TrustedFlatlandReleaseImageImmediatelyRequest>(&header, _body_bytes, handles, &mut req)?;
8501                        let control_handle =
8502                            TrustedFlatlandControlHandle { inner: this.inner.clone() };
8503                        Ok(TrustedFlatlandRequest::ReleaseImageImmediately {
8504                            image_id: req.image_id,
8505
8506                            control_handle,
8507                        })
8508                    }
8509                    _ => Err(fidl::Error::UnknownOrdinal {
8510                        ordinal: header.ordinal,
8511                        protocol_name:
8512                            <TrustedFlatlandMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
8513                    }),
8514                }))
8515            },
8516        )
8517    }
8518}
8519
8520/// A privileged protocol for trusted Flatland instances that require special capabilities.
8521///
8522/// This protocol is composed into [`fuchsia.ui.composition/Flatland`]. Methods in this protocol
8523/// are only available if the `Flatland` instance was created through
8524/// [`fuchsia.ui.composition/TrustedFlatlandFactory`].
8525#[derive(Debug)]
8526pub enum TrustedFlatlandRequest {
8527    /// Releases an image immediately, without waiting for the next present.
8528    ReleaseImageImmediately { image_id: ContentId, control_handle: TrustedFlatlandControlHandle },
8529}
8530
8531impl TrustedFlatlandRequest {
8532    #[allow(irrefutable_let_patterns)]
8533    pub fn into_release_image_immediately(
8534        self,
8535    ) -> Option<(ContentId, TrustedFlatlandControlHandle)> {
8536        if let TrustedFlatlandRequest::ReleaseImageImmediately { image_id, control_handle } = self {
8537            Some((image_id, control_handle))
8538        } else {
8539            None
8540        }
8541    }
8542
8543    /// Name of the method defined in FIDL
8544    pub fn method_name(&self) -> &'static str {
8545        match *self {
8546            TrustedFlatlandRequest::ReleaseImageImmediately { .. } => "release_image_immediately",
8547        }
8548    }
8549}
8550
8551#[derive(Debug, Clone)]
8552pub struct TrustedFlatlandControlHandle {
8553    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8554}
8555
8556impl fidl::endpoints::ControlHandle for TrustedFlatlandControlHandle {
8557    fn shutdown(&self) {
8558        self.inner.shutdown()
8559    }
8560
8561    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
8562        self.inner.shutdown_with_epitaph(status)
8563    }
8564
8565    fn is_closed(&self) -> bool {
8566        self.inner.channel().is_closed()
8567    }
8568    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
8569        self.inner.channel().on_closed()
8570    }
8571
8572    #[cfg(target_os = "fuchsia")]
8573    fn signal_peer(
8574        &self,
8575        clear_mask: zx::Signals,
8576        set_mask: zx::Signals,
8577    ) -> Result<(), zx_status::Status> {
8578        use fidl::Peered;
8579        self.inner.channel().signal_peer(clear_mask, set_mask)
8580    }
8581}
8582
8583impl TrustedFlatlandControlHandle {}
8584
8585#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
8586pub struct TrustedFlatlandFactoryMarker;
8587
8588impl fidl::endpoints::ProtocolMarker for TrustedFlatlandFactoryMarker {
8589    type Proxy = TrustedFlatlandFactoryProxy;
8590    type RequestStream = TrustedFlatlandFactoryRequestStream;
8591    #[cfg(target_os = "fuchsia")]
8592    type SynchronousProxy = TrustedFlatlandFactorySynchronousProxy;
8593
8594    const DEBUG_NAME: &'static str = "fuchsia.ui.composition.TrustedFlatlandFactory";
8595}
8596impl fidl::endpoints::DiscoverableProtocolMarker for TrustedFlatlandFactoryMarker {}
8597pub type TrustedFlatlandFactoryCreateFlatlandResult = Result<(), TrustedFlatlandFactoryError>;
8598
8599pub trait TrustedFlatlandFactoryProxyInterface: Send + Sync {
8600    type CreateFlatlandResponseFut: std::future::Future<
8601            Output = Result<TrustedFlatlandFactoryCreateFlatlandResult, fidl::Error>,
8602        > + Send;
8603    fn r#create_flatland(
8604        &self,
8605        server_end: fidl::endpoints::ServerEnd<FlatlandMarker>,
8606        config: TrustedFlatlandConfig,
8607    ) -> Self::CreateFlatlandResponseFut;
8608}
8609#[derive(Debug)]
8610#[cfg(target_os = "fuchsia")]
8611pub struct TrustedFlatlandFactorySynchronousProxy {
8612    client: fidl::client::sync::Client,
8613}
8614
8615#[cfg(target_os = "fuchsia")]
8616impl fidl::endpoints::SynchronousProxy for TrustedFlatlandFactorySynchronousProxy {
8617    type Proxy = TrustedFlatlandFactoryProxy;
8618    type Protocol = TrustedFlatlandFactoryMarker;
8619
8620    fn from_channel(inner: fidl::Channel) -> Self {
8621        Self::new(inner)
8622    }
8623
8624    fn into_channel(self) -> fidl::Channel {
8625        self.client.into_channel()
8626    }
8627
8628    fn as_channel(&self) -> &fidl::Channel {
8629        self.client.as_channel()
8630    }
8631}
8632
8633#[cfg(target_os = "fuchsia")]
8634impl TrustedFlatlandFactorySynchronousProxy {
8635    pub fn new(channel: fidl::Channel) -> Self {
8636        Self { client: fidl::client::sync::Client::new(channel) }
8637    }
8638
8639    pub fn into_channel(self) -> fidl::Channel {
8640        self.client.into_channel()
8641    }
8642
8643    /// Waits until an event arrives and returns it. It is safe for other
8644    /// threads to make concurrent requests while waiting for an event.
8645    pub fn wait_for_event(
8646        &self,
8647        deadline: zx::MonotonicInstant,
8648    ) -> Result<TrustedFlatlandFactoryEvent, fidl::Error> {
8649        TrustedFlatlandFactoryEvent::decode(
8650            self.client.wait_for_event::<TrustedFlatlandFactoryMarker>(deadline)?,
8651        )
8652    }
8653
8654    /// Creates a new Flatland instance with the specified configuration.
8655    ///
8656    /// ## Error
8657    ///
8658    /// Returns a `TrustedFlatlandFactoryError` error if the operation fails.
8659    pub fn r#create_flatland(
8660        &self,
8661        mut server_end: fidl::endpoints::ServerEnd<FlatlandMarker>,
8662        mut config: TrustedFlatlandConfig,
8663        ___deadline: zx::MonotonicInstant,
8664    ) -> Result<TrustedFlatlandFactoryCreateFlatlandResult, fidl::Error> {
8665        let _response = self.client.send_query::<
8666            TrustedFlatlandFactoryCreateFlatlandRequest,
8667            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, TrustedFlatlandFactoryError>,
8668            TrustedFlatlandFactoryMarker,
8669        >(
8670            (server_end, &mut config,),
8671            0x48e89c53f00561dc,
8672            fidl::encoding::DynamicFlags::empty(),
8673            ___deadline,
8674        )?;
8675        Ok(_response.map(|x| x))
8676    }
8677}
8678
8679#[cfg(target_os = "fuchsia")]
8680impl From<TrustedFlatlandFactorySynchronousProxy> for zx::NullableHandle {
8681    fn from(value: TrustedFlatlandFactorySynchronousProxy) -> Self {
8682        value.into_channel().into()
8683    }
8684}
8685
8686#[cfg(target_os = "fuchsia")]
8687impl From<fidl::Channel> for TrustedFlatlandFactorySynchronousProxy {
8688    fn from(value: fidl::Channel) -> Self {
8689        Self::new(value)
8690    }
8691}
8692
8693#[cfg(target_os = "fuchsia")]
8694impl fidl::endpoints::FromClient for TrustedFlatlandFactorySynchronousProxy {
8695    type Protocol = TrustedFlatlandFactoryMarker;
8696
8697    fn from_client(value: fidl::endpoints::ClientEnd<TrustedFlatlandFactoryMarker>) -> Self {
8698        Self::new(value.into_channel())
8699    }
8700}
8701
8702#[derive(Debug, Clone)]
8703pub struct TrustedFlatlandFactoryProxy {
8704    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
8705}
8706
8707impl fidl::endpoints::Proxy for TrustedFlatlandFactoryProxy {
8708    type Protocol = TrustedFlatlandFactoryMarker;
8709
8710    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
8711        Self::new(inner)
8712    }
8713
8714    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
8715        self.client.into_channel().map_err(|client| Self { client })
8716    }
8717
8718    fn as_channel(&self) -> &::fidl::AsyncChannel {
8719        self.client.as_channel()
8720    }
8721}
8722
8723impl TrustedFlatlandFactoryProxy {
8724    /// Create a new Proxy for fuchsia.ui.composition/TrustedFlatlandFactory.
8725    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
8726        let protocol_name =
8727            <TrustedFlatlandFactoryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
8728        Self { client: fidl::client::Client::new(channel, protocol_name) }
8729    }
8730
8731    /// Get a Stream of events from the remote end of the protocol.
8732    ///
8733    /// # Panics
8734    ///
8735    /// Panics if the event stream was already taken.
8736    pub fn take_event_stream(&self) -> TrustedFlatlandFactoryEventStream {
8737        TrustedFlatlandFactoryEventStream { event_receiver: self.client.take_event_receiver() }
8738    }
8739
8740    /// Creates a new Flatland instance with the specified configuration.
8741    ///
8742    /// ## Error
8743    ///
8744    /// Returns a `TrustedFlatlandFactoryError` error if the operation fails.
8745    pub fn r#create_flatland(
8746        &self,
8747        mut server_end: fidl::endpoints::ServerEnd<FlatlandMarker>,
8748        mut config: TrustedFlatlandConfig,
8749    ) -> fidl::client::QueryResponseFut<
8750        TrustedFlatlandFactoryCreateFlatlandResult,
8751        fidl::encoding::DefaultFuchsiaResourceDialect,
8752    > {
8753        TrustedFlatlandFactoryProxyInterface::r#create_flatland(self, server_end, config)
8754    }
8755}
8756
8757impl TrustedFlatlandFactoryProxyInterface for TrustedFlatlandFactoryProxy {
8758    type CreateFlatlandResponseFut = fidl::client::QueryResponseFut<
8759        TrustedFlatlandFactoryCreateFlatlandResult,
8760        fidl::encoding::DefaultFuchsiaResourceDialect,
8761    >;
8762    fn r#create_flatland(
8763        &self,
8764        mut server_end: fidl::endpoints::ServerEnd<FlatlandMarker>,
8765        mut config: TrustedFlatlandConfig,
8766    ) -> Self::CreateFlatlandResponseFut {
8767        fn _decode(
8768            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
8769        ) -> Result<TrustedFlatlandFactoryCreateFlatlandResult, fidl::Error> {
8770            let _response = fidl::client::decode_transaction_body::<
8771                fidl::encoding::ResultType<
8772                    fidl::encoding::EmptyStruct,
8773                    TrustedFlatlandFactoryError,
8774                >,
8775                fidl::encoding::DefaultFuchsiaResourceDialect,
8776                0x48e89c53f00561dc,
8777            >(_buf?)?;
8778            Ok(_response.map(|x| x))
8779        }
8780        self.client.send_query_and_decode::<
8781            TrustedFlatlandFactoryCreateFlatlandRequest,
8782            TrustedFlatlandFactoryCreateFlatlandResult,
8783        >(
8784            (server_end, &mut config,),
8785            0x48e89c53f00561dc,
8786            fidl::encoding::DynamicFlags::empty(),
8787            _decode,
8788        )
8789    }
8790}
8791
8792pub struct TrustedFlatlandFactoryEventStream {
8793    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
8794}
8795
8796impl std::marker::Unpin for TrustedFlatlandFactoryEventStream {}
8797
8798impl futures::stream::FusedStream for TrustedFlatlandFactoryEventStream {
8799    fn is_terminated(&self) -> bool {
8800        self.event_receiver.is_terminated()
8801    }
8802}
8803
8804impl futures::Stream for TrustedFlatlandFactoryEventStream {
8805    type Item = Result<TrustedFlatlandFactoryEvent, fidl::Error>;
8806
8807    fn poll_next(
8808        mut self: std::pin::Pin<&mut Self>,
8809        cx: &mut std::task::Context<'_>,
8810    ) -> std::task::Poll<Option<Self::Item>> {
8811        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
8812            &mut self.event_receiver,
8813            cx
8814        )?) {
8815            Some(buf) => std::task::Poll::Ready(Some(TrustedFlatlandFactoryEvent::decode(buf))),
8816            None => std::task::Poll::Ready(None),
8817        }
8818    }
8819}
8820
8821#[derive(Debug)]
8822pub enum TrustedFlatlandFactoryEvent {}
8823
8824impl TrustedFlatlandFactoryEvent {
8825    /// Decodes a message buffer as a [`TrustedFlatlandFactoryEvent`].
8826    fn decode(
8827        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
8828    ) -> Result<TrustedFlatlandFactoryEvent, fidl::Error> {
8829        let (bytes, _handles) = buf.split_mut();
8830        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
8831        debug_assert_eq!(tx_header.tx_id, 0);
8832        match tx_header.ordinal {
8833            _ => Err(fidl::Error::UnknownOrdinal {
8834                ordinal: tx_header.ordinal,
8835                protocol_name:
8836                    <TrustedFlatlandFactoryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
8837            }),
8838        }
8839    }
8840}
8841
8842/// A Stream of incoming requests for fuchsia.ui.composition/TrustedFlatlandFactory.
8843pub struct TrustedFlatlandFactoryRequestStream {
8844    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8845    is_terminated: bool,
8846}
8847
8848impl std::marker::Unpin for TrustedFlatlandFactoryRequestStream {}
8849
8850impl futures::stream::FusedStream for TrustedFlatlandFactoryRequestStream {
8851    fn is_terminated(&self) -> bool {
8852        self.is_terminated
8853    }
8854}
8855
8856impl fidl::endpoints::RequestStream for TrustedFlatlandFactoryRequestStream {
8857    type Protocol = TrustedFlatlandFactoryMarker;
8858    type ControlHandle = TrustedFlatlandFactoryControlHandle;
8859
8860    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
8861        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
8862    }
8863
8864    fn control_handle(&self) -> Self::ControlHandle {
8865        TrustedFlatlandFactoryControlHandle { inner: self.inner.clone() }
8866    }
8867
8868    fn into_inner(
8869        self,
8870    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
8871    {
8872        (self.inner, self.is_terminated)
8873    }
8874
8875    fn from_inner(
8876        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8877        is_terminated: bool,
8878    ) -> Self {
8879        Self { inner, is_terminated }
8880    }
8881}
8882
8883impl futures::Stream for TrustedFlatlandFactoryRequestStream {
8884    type Item = Result<TrustedFlatlandFactoryRequest, fidl::Error>;
8885
8886    fn poll_next(
8887        mut self: std::pin::Pin<&mut Self>,
8888        cx: &mut std::task::Context<'_>,
8889    ) -> std::task::Poll<Option<Self::Item>> {
8890        let this = &mut *self;
8891        if this.inner.check_shutdown(cx) {
8892            this.is_terminated = true;
8893            return std::task::Poll::Ready(None);
8894        }
8895        if this.is_terminated {
8896            panic!("polled TrustedFlatlandFactoryRequestStream after completion");
8897        }
8898        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
8899            |bytes, handles| {
8900                match this.inner.channel().read_etc(cx, bytes, handles) {
8901                    std::task::Poll::Ready(Ok(())) => {}
8902                    std::task::Poll::Pending => return std::task::Poll::Pending,
8903                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
8904                        this.is_terminated = true;
8905                        return std::task::Poll::Ready(None);
8906                    }
8907                    std::task::Poll::Ready(Err(e)) => {
8908                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
8909                            e.into(),
8910                        ))));
8911                    }
8912                }
8913
8914                // A message has been received from the channel
8915                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
8916
8917                std::task::Poll::Ready(Some(match header.ordinal {
8918                0x48e89c53f00561dc => {
8919                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
8920                    let mut req = fidl::new_empty!(TrustedFlatlandFactoryCreateFlatlandRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
8921                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<TrustedFlatlandFactoryCreateFlatlandRequest>(&header, _body_bytes, handles, &mut req)?;
8922                    let control_handle = TrustedFlatlandFactoryControlHandle {
8923                        inner: this.inner.clone(),
8924                    };
8925                    Ok(TrustedFlatlandFactoryRequest::CreateFlatland {server_end: req.server_end,
8926config: req.config,
8927
8928                        responder: TrustedFlatlandFactoryCreateFlatlandResponder {
8929                            control_handle: std::mem::ManuallyDrop::new(control_handle),
8930                            tx_id: header.tx_id,
8931                        },
8932                    })
8933                }
8934                _ => Err(fidl::Error::UnknownOrdinal {
8935                    ordinal: header.ordinal,
8936                    protocol_name: <TrustedFlatlandFactoryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
8937                }),
8938            }))
8939            },
8940        )
8941    }
8942}
8943
8944/// A privileged factory for creating Flatland instances with special configurations.
8945///
8946/// This protocol is intended for trusted clients that require fine-grained control over
8947/// Flatland's behavior for performance-critical applications. It is not intended for
8948/// general use. Misuse of this API can negatively impact system performance and stability.
8949#[derive(Debug)]
8950pub enum TrustedFlatlandFactoryRequest {
8951    /// Creates a new Flatland instance with the specified configuration.
8952    ///
8953    /// ## Error
8954    ///
8955    /// Returns a `TrustedFlatlandFactoryError` error if the operation fails.
8956    CreateFlatland {
8957        server_end: fidl::endpoints::ServerEnd<FlatlandMarker>,
8958        config: TrustedFlatlandConfig,
8959        responder: TrustedFlatlandFactoryCreateFlatlandResponder,
8960    },
8961}
8962
8963impl TrustedFlatlandFactoryRequest {
8964    #[allow(irrefutable_let_patterns)]
8965    pub fn into_create_flatland(
8966        self,
8967    ) -> Option<(
8968        fidl::endpoints::ServerEnd<FlatlandMarker>,
8969        TrustedFlatlandConfig,
8970        TrustedFlatlandFactoryCreateFlatlandResponder,
8971    )> {
8972        if let TrustedFlatlandFactoryRequest::CreateFlatland { server_end, config, responder } =
8973            self
8974        {
8975            Some((server_end, config, responder))
8976        } else {
8977            None
8978        }
8979    }
8980
8981    /// Name of the method defined in FIDL
8982    pub fn method_name(&self) -> &'static str {
8983        match *self {
8984            TrustedFlatlandFactoryRequest::CreateFlatland { .. } => "create_flatland",
8985        }
8986    }
8987}
8988
8989#[derive(Debug, Clone)]
8990pub struct TrustedFlatlandFactoryControlHandle {
8991    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8992}
8993
8994impl fidl::endpoints::ControlHandle for TrustedFlatlandFactoryControlHandle {
8995    fn shutdown(&self) {
8996        self.inner.shutdown()
8997    }
8998
8999    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
9000        self.inner.shutdown_with_epitaph(status)
9001    }
9002
9003    fn is_closed(&self) -> bool {
9004        self.inner.channel().is_closed()
9005    }
9006    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
9007        self.inner.channel().on_closed()
9008    }
9009
9010    #[cfg(target_os = "fuchsia")]
9011    fn signal_peer(
9012        &self,
9013        clear_mask: zx::Signals,
9014        set_mask: zx::Signals,
9015    ) -> Result<(), zx_status::Status> {
9016        use fidl::Peered;
9017        self.inner.channel().signal_peer(clear_mask, set_mask)
9018    }
9019}
9020
9021impl TrustedFlatlandFactoryControlHandle {}
9022
9023#[must_use = "FIDL methods require a response to be sent"]
9024#[derive(Debug)]
9025pub struct TrustedFlatlandFactoryCreateFlatlandResponder {
9026    control_handle: std::mem::ManuallyDrop<TrustedFlatlandFactoryControlHandle>,
9027    tx_id: u32,
9028}
9029
9030/// Set the the channel to be shutdown (see [`TrustedFlatlandFactoryControlHandle::shutdown`])
9031/// if the responder is dropped without sending a response, so that the client
9032/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
9033impl std::ops::Drop for TrustedFlatlandFactoryCreateFlatlandResponder {
9034    fn drop(&mut self) {
9035        self.control_handle.shutdown();
9036        // Safety: drops once, never accessed again
9037        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9038    }
9039}
9040
9041impl fidl::endpoints::Responder for TrustedFlatlandFactoryCreateFlatlandResponder {
9042    type ControlHandle = TrustedFlatlandFactoryControlHandle;
9043
9044    fn control_handle(&self) -> &TrustedFlatlandFactoryControlHandle {
9045        &self.control_handle
9046    }
9047
9048    fn drop_without_shutdown(mut self) {
9049        // Safety: drops once, never accessed again due to mem::forget
9050        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9051        // Prevent Drop from running (which would shut down the channel)
9052        std::mem::forget(self);
9053    }
9054}
9055
9056impl TrustedFlatlandFactoryCreateFlatlandResponder {
9057    /// Sends a response to the FIDL transaction.
9058    ///
9059    /// Sets the channel to shutdown if an error occurs.
9060    pub fn send(
9061        self,
9062        mut result: Result<(), TrustedFlatlandFactoryError>,
9063    ) -> Result<(), fidl::Error> {
9064        let _result = self.send_raw(result);
9065        if _result.is_err() {
9066            self.control_handle.shutdown();
9067        }
9068        self.drop_without_shutdown();
9069        _result
9070    }
9071
9072    /// Similar to "send" but does not shutdown the channel if an error occurs.
9073    pub fn send_no_shutdown_on_err(
9074        self,
9075        mut result: Result<(), TrustedFlatlandFactoryError>,
9076    ) -> Result<(), fidl::Error> {
9077        let _result = self.send_raw(result);
9078        self.drop_without_shutdown();
9079        _result
9080    }
9081
9082    fn send_raw(
9083        &self,
9084        mut result: Result<(), TrustedFlatlandFactoryError>,
9085    ) -> Result<(), fidl::Error> {
9086        self.control_handle.inner.send::<fidl::encoding::ResultType<
9087            fidl::encoding::EmptyStruct,
9088            TrustedFlatlandFactoryError,
9089        >>(
9090            result,
9091            self.tx_id,
9092            0x48e89c53f00561dc,
9093            fidl::encoding::DynamicFlags::empty(),
9094        )
9095    }
9096}
9097
9098mod internal {
9099    use super::*;
9100
9101    impl fidl::encoding::ResourceTypeMarker for AllocatorRegisterBufferCollectionRequest {
9102        type Borrowed<'a> = &'a mut Self;
9103        fn take_or_borrow<'a>(
9104            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9105        ) -> Self::Borrowed<'a> {
9106            value
9107        }
9108    }
9109
9110    unsafe impl fidl::encoding::TypeMarker for AllocatorRegisterBufferCollectionRequest {
9111        type Owned = Self;
9112
9113        #[inline(always)]
9114        fn inline_align(_context: fidl::encoding::Context) -> usize {
9115            8
9116        }
9117
9118        #[inline(always)]
9119        fn inline_size(_context: fidl::encoding::Context) -> usize {
9120            16
9121        }
9122    }
9123
9124    unsafe impl
9125        fidl::encoding::Encode<
9126            AllocatorRegisterBufferCollectionRequest,
9127            fidl::encoding::DefaultFuchsiaResourceDialect,
9128        > for &mut AllocatorRegisterBufferCollectionRequest
9129    {
9130        #[inline]
9131        unsafe fn encode(
9132            self,
9133            encoder: &mut fidl::encoding::Encoder<
9134                '_,
9135                fidl::encoding::DefaultFuchsiaResourceDialect,
9136            >,
9137            offset: usize,
9138            _depth: fidl::encoding::Depth,
9139        ) -> fidl::Result<()> {
9140            encoder.debug_check_bounds::<AllocatorRegisterBufferCollectionRequest>(offset);
9141            // Delegate to tuple encoding.
9142            fidl::encoding::Encode::<AllocatorRegisterBufferCollectionRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
9143                (
9144                    <RegisterBufferCollectionArgs as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.args),
9145                ),
9146                encoder, offset, _depth
9147            )
9148        }
9149    }
9150    unsafe impl<
9151        T0: fidl::encoding::Encode<
9152                RegisterBufferCollectionArgs,
9153                fidl::encoding::DefaultFuchsiaResourceDialect,
9154            >,
9155    >
9156        fidl::encoding::Encode<
9157            AllocatorRegisterBufferCollectionRequest,
9158            fidl::encoding::DefaultFuchsiaResourceDialect,
9159        > for (T0,)
9160    {
9161        #[inline]
9162        unsafe fn encode(
9163            self,
9164            encoder: &mut fidl::encoding::Encoder<
9165                '_,
9166                fidl::encoding::DefaultFuchsiaResourceDialect,
9167            >,
9168            offset: usize,
9169            depth: fidl::encoding::Depth,
9170        ) -> fidl::Result<()> {
9171            encoder.debug_check_bounds::<AllocatorRegisterBufferCollectionRequest>(offset);
9172            // Zero out padding regions. There's no need to apply masks
9173            // because the unmasked parts will be overwritten by fields.
9174            // Write the fields.
9175            self.0.encode(encoder, offset + 0, depth)?;
9176            Ok(())
9177        }
9178    }
9179
9180    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
9181        for AllocatorRegisterBufferCollectionRequest
9182    {
9183        #[inline(always)]
9184        fn new_empty() -> Self {
9185            Self {
9186                args: fidl::new_empty!(
9187                    RegisterBufferCollectionArgs,
9188                    fidl::encoding::DefaultFuchsiaResourceDialect
9189                ),
9190            }
9191        }
9192
9193        #[inline]
9194        unsafe fn decode(
9195            &mut self,
9196            decoder: &mut fidl::encoding::Decoder<
9197                '_,
9198                fidl::encoding::DefaultFuchsiaResourceDialect,
9199            >,
9200            offset: usize,
9201            _depth: fidl::encoding::Depth,
9202        ) -> fidl::Result<()> {
9203            decoder.debug_check_bounds::<Self>(offset);
9204            // Verify that padding bytes are zero.
9205            fidl::decode!(
9206                RegisterBufferCollectionArgs,
9207                fidl::encoding::DefaultFuchsiaResourceDialect,
9208                &mut self.args,
9209                decoder,
9210                offset + 0,
9211                _depth
9212            )?;
9213            Ok(())
9214        }
9215    }
9216
9217    impl fidl::encoding::ResourceTypeMarker for BufferCollectionExportToken {
9218        type Borrowed<'a> = &'a mut Self;
9219        fn take_or_borrow<'a>(
9220            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9221        ) -> Self::Borrowed<'a> {
9222            value
9223        }
9224    }
9225
9226    unsafe impl fidl::encoding::TypeMarker for BufferCollectionExportToken {
9227        type Owned = Self;
9228
9229        #[inline(always)]
9230        fn inline_align(_context: fidl::encoding::Context) -> usize {
9231            4
9232        }
9233
9234        #[inline(always)]
9235        fn inline_size(_context: fidl::encoding::Context) -> usize {
9236            4
9237        }
9238    }
9239
9240    unsafe impl
9241        fidl::encoding::Encode<
9242            BufferCollectionExportToken,
9243            fidl::encoding::DefaultFuchsiaResourceDialect,
9244        > for &mut BufferCollectionExportToken
9245    {
9246        #[inline]
9247        unsafe fn encode(
9248            self,
9249            encoder: &mut fidl::encoding::Encoder<
9250                '_,
9251                fidl::encoding::DefaultFuchsiaResourceDialect,
9252            >,
9253            offset: usize,
9254            _depth: fidl::encoding::Depth,
9255        ) -> fidl::Result<()> {
9256            encoder.debug_check_bounds::<BufferCollectionExportToken>(offset);
9257            // Delegate to tuple encoding.
9258            fidl::encoding::Encode::<
9259                BufferCollectionExportToken,
9260                fidl::encoding::DefaultFuchsiaResourceDialect,
9261            >::encode(
9262                (<fidl::encoding::HandleType<
9263                    fidl::EventPair,
9264                    { fidl::ObjectType::EVENTPAIR.into_raw() },
9265                    2147483648,
9266                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
9267                    &mut self.value
9268                ),),
9269                encoder,
9270                offset,
9271                _depth,
9272            )
9273        }
9274    }
9275    unsafe impl<
9276        T0: fidl::encoding::Encode<
9277                fidl::encoding::HandleType<
9278                    fidl::EventPair,
9279                    { fidl::ObjectType::EVENTPAIR.into_raw() },
9280                    2147483648,
9281                >,
9282                fidl::encoding::DefaultFuchsiaResourceDialect,
9283            >,
9284    >
9285        fidl::encoding::Encode<
9286            BufferCollectionExportToken,
9287            fidl::encoding::DefaultFuchsiaResourceDialect,
9288        > for (T0,)
9289    {
9290        #[inline]
9291        unsafe fn encode(
9292            self,
9293            encoder: &mut fidl::encoding::Encoder<
9294                '_,
9295                fidl::encoding::DefaultFuchsiaResourceDialect,
9296            >,
9297            offset: usize,
9298            depth: fidl::encoding::Depth,
9299        ) -> fidl::Result<()> {
9300            encoder.debug_check_bounds::<BufferCollectionExportToken>(offset);
9301            // Zero out padding regions. There's no need to apply masks
9302            // because the unmasked parts will be overwritten by fields.
9303            // Write the fields.
9304            self.0.encode(encoder, offset + 0, depth)?;
9305            Ok(())
9306        }
9307    }
9308
9309    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
9310        for BufferCollectionExportToken
9311    {
9312        #[inline(always)]
9313        fn new_empty() -> Self {
9314            Self {
9315                value: fidl::new_empty!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
9316            }
9317        }
9318
9319        #[inline]
9320        unsafe fn decode(
9321            &mut self,
9322            decoder: &mut fidl::encoding::Decoder<
9323                '_,
9324                fidl::encoding::DefaultFuchsiaResourceDialect,
9325            >,
9326            offset: usize,
9327            _depth: fidl::encoding::Depth,
9328        ) -> fidl::Result<()> {
9329            decoder.debug_check_bounds::<Self>(offset);
9330            // Verify that padding bytes are zero.
9331            fidl::decode!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.value, decoder, offset + 0, _depth)?;
9332            Ok(())
9333        }
9334    }
9335
9336    impl fidl::encoding::ResourceTypeMarker for BufferCollectionImportToken {
9337        type Borrowed<'a> = &'a mut Self;
9338        fn take_or_borrow<'a>(
9339            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9340        ) -> Self::Borrowed<'a> {
9341            value
9342        }
9343    }
9344
9345    unsafe impl fidl::encoding::TypeMarker for BufferCollectionImportToken {
9346        type Owned = Self;
9347
9348        #[inline(always)]
9349        fn inline_align(_context: fidl::encoding::Context) -> usize {
9350            4
9351        }
9352
9353        #[inline(always)]
9354        fn inline_size(_context: fidl::encoding::Context) -> usize {
9355            4
9356        }
9357    }
9358
9359    unsafe impl
9360        fidl::encoding::Encode<
9361            BufferCollectionImportToken,
9362            fidl::encoding::DefaultFuchsiaResourceDialect,
9363        > for &mut BufferCollectionImportToken
9364    {
9365        #[inline]
9366        unsafe fn encode(
9367            self,
9368            encoder: &mut fidl::encoding::Encoder<
9369                '_,
9370                fidl::encoding::DefaultFuchsiaResourceDialect,
9371            >,
9372            offset: usize,
9373            _depth: fidl::encoding::Depth,
9374        ) -> fidl::Result<()> {
9375            encoder.debug_check_bounds::<BufferCollectionImportToken>(offset);
9376            // Delegate to tuple encoding.
9377            fidl::encoding::Encode::<
9378                BufferCollectionImportToken,
9379                fidl::encoding::DefaultFuchsiaResourceDialect,
9380            >::encode(
9381                (<fidl::encoding::HandleType<
9382                    fidl::EventPair,
9383                    { fidl::ObjectType::EVENTPAIR.into_raw() },
9384                    2147483648,
9385                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
9386                    &mut self.value
9387                ),),
9388                encoder,
9389                offset,
9390                _depth,
9391            )
9392        }
9393    }
9394    unsafe impl<
9395        T0: fidl::encoding::Encode<
9396                fidl::encoding::HandleType<
9397                    fidl::EventPair,
9398                    { fidl::ObjectType::EVENTPAIR.into_raw() },
9399                    2147483648,
9400                >,
9401                fidl::encoding::DefaultFuchsiaResourceDialect,
9402            >,
9403    >
9404        fidl::encoding::Encode<
9405            BufferCollectionImportToken,
9406            fidl::encoding::DefaultFuchsiaResourceDialect,
9407        > for (T0,)
9408    {
9409        #[inline]
9410        unsafe fn encode(
9411            self,
9412            encoder: &mut fidl::encoding::Encoder<
9413                '_,
9414                fidl::encoding::DefaultFuchsiaResourceDialect,
9415            >,
9416            offset: usize,
9417            depth: fidl::encoding::Depth,
9418        ) -> fidl::Result<()> {
9419            encoder.debug_check_bounds::<BufferCollectionImportToken>(offset);
9420            // Zero out padding regions. There's no need to apply masks
9421            // because the unmasked parts will be overwritten by fields.
9422            // Write the fields.
9423            self.0.encode(encoder, offset + 0, depth)?;
9424            Ok(())
9425        }
9426    }
9427
9428    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
9429        for BufferCollectionImportToken
9430    {
9431        #[inline(always)]
9432        fn new_empty() -> Self {
9433            Self {
9434                value: fidl::new_empty!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
9435            }
9436        }
9437
9438        #[inline]
9439        unsafe fn decode(
9440            &mut self,
9441            decoder: &mut fidl::encoding::Decoder<
9442                '_,
9443                fidl::encoding::DefaultFuchsiaResourceDialect,
9444            >,
9445            offset: usize,
9446            _depth: fidl::encoding::Depth,
9447        ) -> fidl::Result<()> {
9448            decoder.debug_check_bounds::<Self>(offset);
9449            // Verify that padding bytes are zero.
9450            fidl::decode!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.value, decoder, offset + 0, _depth)?;
9451            Ok(())
9452        }
9453    }
9454
9455    impl fidl::encoding::ResourceTypeMarker for ChildViewWatcherGetViewRefResponse {
9456        type Borrowed<'a> = &'a mut Self;
9457        fn take_or_borrow<'a>(
9458            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9459        ) -> Self::Borrowed<'a> {
9460            value
9461        }
9462    }
9463
9464    unsafe impl fidl::encoding::TypeMarker for ChildViewWatcherGetViewRefResponse {
9465        type Owned = Self;
9466
9467        #[inline(always)]
9468        fn inline_align(_context: fidl::encoding::Context) -> usize {
9469            4
9470        }
9471
9472        #[inline(always)]
9473        fn inline_size(_context: fidl::encoding::Context) -> usize {
9474            4
9475        }
9476    }
9477
9478    unsafe impl
9479        fidl::encoding::Encode<
9480            ChildViewWatcherGetViewRefResponse,
9481            fidl::encoding::DefaultFuchsiaResourceDialect,
9482        > for &mut ChildViewWatcherGetViewRefResponse
9483    {
9484        #[inline]
9485        unsafe fn encode(
9486            self,
9487            encoder: &mut fidl::encoding::Encoder<
9488                '_,
9489                fidl::encoding::DefaultFuchsiaResourceDialect,
9490            >,
9491            offset: usize,
9492            _depth: fidl::encoding::Depth,
9493        ) -> fidl::Result<()> {
9494            encoder.debug_check_bounds::<ChildViewWatcherGetViewRefResponse>(offset);
9495            // Delegate to tuple encoding.
9496            fidl::encoding::Encode::<ChildViewWatcherGetViewRefResponse, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
9497                (
9498                    <fidl_fuchsia_ui_views::ViewRef as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.view_ref),
9499                ),
9500                encoder, offset, _depth
9501            )
9502        }
9503    }
9504    unsafe impl<
9505        T0: fidl::encoding::Encode<
9506                fidl_fuchsia_ui_views::ViewRef,
9507                fidl::encoding::DefaultFuchsiaResourceDialect,
9508            >,
9509    >
9510        fidl::encoding::Encode<
9511            ChildViewWatcherGetViewRefResponse,
9512            fidl::encoding::DefaultFuchsiaResourceDialect,
9513        > for (T0,)
9514    {
9515        #[inline]
9516        unsafe fn encode(
9517            self,
9518            encoder: &mut fidl::encoding::Encoder<
9519                '_,
9520                fidl::encoding::DefaultFuchsiaResourceDialect,
9521            >,
9522            offset: usize,
9523            depth: fidl::encoding::Depth,
9524        ) -> fidl::Result<()> {
9525            encoder.debug_check_bounds::<ChildViewWatcherGetViewRefResponse>(offset);
9526            // Zero out padding regions. There's no need to apply masks
9527            // because the unmasked parts will be overwritten by fields.
9528            // Write the fields.
9529            self.0.encode(encoder, offset + 0, depth)?;
9530            Ok(())
9531        }
9532    }
9533
9534    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
9535        for ChildViewWatcherGetViewRefResponse
9536    {
9537        #[inline(always)]
9538        fn new_empty() -> Self {
9539            Self {
9540                view_ref: fidl::new_empty!(
9541                    fidl_fuchsia_ui_views::ViewRef,
9542                    fidl::encoding::DefaultFuchsiaResourceDialect
9543                ),
9544            }
9545        }
9546
9547        #[inline]
9548        unsafe fn decode(
9549            &mut self,
9550            decoder: &mut fidl::encoding::Decoder<
9551                '_,
9552                fidl::encoding::DefaultFuchsiaResourceDialect,
9553            >,
9554            offset: usize,
9555            _depth: fidl::encoding::Depth,
9556        ) -> fidl::Result<()> {
9557            decoder.debug_check_bounds::<Self>(offset);
9558            // Verify that padding bytes are zero.
9559            fidl::decode!(
9560                fidl_fuchsia_ui_views::ViewRef,
9561                fidl::encoding::DefaultFuchsiaResourceDialect,
9562                &mut self.view_ref,
9563                decoder,
9564                offset + 0,
9565                _depth
9566            )?;
9567            Ok(())
9568        }
9569    }
9570
9571    impl fidl::encoding::ResourceTypeMarker for FlatlandCreateFilledRectRequest {
9572        type Borrowed<'a> = &'a mut Self;
9573        fn take_or_borrow<'a>(
9574            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9575        ) -> Self::Borrowed<'a> {
9576            value
9577        }
9578    }
9579
9580    unsafe impl fidl::encoding::TypeMarker for FlatlandCreateFilledRectRequest {
9581        type Owned = Self;
9582
9583        #[inline(always)]
9584        fn inline_align(_context: fidl::encoding::Context) -> usize {
9585            8
9586        }
9587
9588        #[inline(always)]
9589        fn inline_size(_context: fidl::encoding::Context) -> usize {
9590            8
9591        }
9592        #[inline(always)]
9593        fn encode_is_copy() -> bool {
9594            true
9595        }
9596
9597        #[inline(always)]
9598        fn decode_is_copy() -> bool {
9599            true
9600        }
9601    }
9602
9603    unsafe impl
9604        fidl::encoding::Encode<
9605            FlatlandCreateFilledRectRequest,
9606            fidl::encoding::DefaultFuchsiaResourceDialect,
9607        > for &mut FlatlandCreateFilledRectRequest
9608    {
9609        #[inline]
9610        unsafe fn encode(
9611            self,
9612            encoder: &mut fidl::encoding::Encoder<
9613                '_,
9614                fidl::encoding::DefaultFuchsiaResourceDialect,
9615            >,
9616            offset: usize,
9617            _depth: fidl::encoding::Depth,
9618        ) -> fidl::Result<()> {
9619            encoder.debug_check_bounds::<FlatlandCreateFilledRectRequest>(offset);
9620            unsafe {
9621                // Copy the object into the buffer.
9622                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
9623                (buf_ptr as *mut FlatlandCreateFilledRectRequest)
9624                    .write_unaligned((self as *const FlatlandCreateFilledRectRequest).read());
9625                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
9626                // done second because the memcpy will write garbage to these bytes.
9627            }
9628            Ok(())
9629        }
9630    }
9631    unsafe impl<
9632        T0: fidl::encoding::Encode<ContentId, fidl::encoding::DefaultFuchsiaResourceDialect>,
9633    >
9634        fidl::encoding::Encode<
9635            FlatlandCreateFilledRectRequest,
9636            fidl::encoding::DefaultFuchsiaResourceDialect,
9637        > for (T0,)
9638    {
9639        #[inline]
9640        unsafe fn encode(
9641            self,
9642            encoder: &mut fidl::encoding::Encoder<
9643                '_,
9644                fidl::encoding::DefaultFuchsiaResourceDialect,
9645            >,
9646            offset: usize,
9647            depth: fidl::encoding::Depth,
9648        ) -> fidl::Result<()> {
9649            encoder.debug_check_bounds::<FlatlandCreateFilledRectRequest>(offset);
9650            // Zero out padding regions. There's no need to apply masks
9651            // because the unmasked parts will be overwritten by fields.
9652            // Write the fields.
9653            self.0.encode(encoder, offset + 0, depth)?;
9654            Ok(())
9655        }
9656    }
9657
9658    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
9659        for FlatlandCreateFilledRectRequest
9660    {
9661        #[inline(always)]
9662        fn new_empty() -> Self {
9663            Self {
9664                rect_id: fidl::new_empty!(ContentId, fidl::encoding::DefaultFuchsiaResourceDialect),
9665            }
9666        }
9667
9668        #[inline]
9669        unsafe fn decode(
9670            &mut self,
9671            decoder: &mut fidl::encoding::Decoder<
9672                '_,
9673                fidl::encoding::DefaultFuchsiaResourceDialect,
9674            >,
9675            offset: usize,
9676            _depth: fidl::encoding::Depth,
9677        ) -> fidl::Result<()> {
9678            decoder.debug_check_bounds::<Self>(offset);
9679            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
9680            // Verify that padding bytes are zero.
9681            // Copy from the buffer into the object.
9682            unsafe {
9683                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
9684            }
9685            Ok(())
9686        }
9687    }
9688
9689    impl fidl::encoding::ResourceTypeMarker for FlatlandCreateImageRequest {
9690        type Borrowed<'a> = &'a mut Self;
9691        fn take_or_borrow<'a>(
9692            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9693        ) -> Self::Borrowed<'a> {
9694            value
9695        }
9696    }
9697
9698    unsafe impl fidl::encoding::TypeMarker for FlatlandCreateImageRequest {
9699        type Owned = Self;
9700
9701        #[inline(always)]
9702        fn inline_align(_context: fidl::encoding::Context) -> usize {
9703            8
9704        }
9705
9706        #[inline(always)]
9707        fn inline_size(_context: fidl::encoding::Context) -> usize {
9708            32
9709        }
9710    }
9711
9712    unsafe impl
9713        fidl::encoding::Encode<
9714            FlatlandCreateImageRequest,
9715            fidl::encoding::DefaultFuchsiaResourceDialect,
9716        > for &mut FlatlandCreateImageRequest
9717    {
9718        #[inline]
9719        unsafe fn encode(
9720            self,
9721            encoder: &mut fidl::encoding::Encoder<
9722                '_,
9723                fidl::encoding::DefaultFuchsiaResourceDialect,
9724            >,
9725            offset: usize,
9726            _depth: fidl::encoding::Depth,
9727        ) -> fidl::Result<()> {
9728            encoder.debug_check_bounds::<FlatlandCreateImageRequest>(offset);
9729            // Delegate to tuple encoding.
9730            fidl::encoding::Encode::<FlatlandCreateImageRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
9731                (
9732                    <ContentId as fidl::encoding::ValueTypeMarker>::borrow(&self.image_id),
9733                    <BufferCollectionImportToken as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.import_token),
9734                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.vmo_index),
9735                    <ImageProperties as fidl::encoding::ValueTypeMarker>::borrow(&self.properties),
9736                ),
9737                encoder, offset, _depth
9738            )
9739        }
9740    }
9741    unsafe impl<
9742        T0: fidl::encoding::Encode<ContentId, fidl::encoding::DefaultFuchsiaResourceDialect>,
9743        T1: fidl::encoding::Encode<
9744                BufferCollectionImportToken,
9745                fidl::encoding::DefaultFuchsiaResourceDialect,
9746            >,
9747        T2: fidl::encoding::Encode<u32, fidl::encoding::DefaultFuchsiaResourceDialect>,
9748        T3: fidl::encoding::Encode<ImageProperties, fidl::encoding::DefaultFuchsiaResourceDialect>,
9749    >
9750        fidl::encoding::Encode<
9751            FlatlandCreateImageRequest,
9752            fidl::encoding::DefaultFuchsiaResourceDialect,
9753        > for (T0, T1, T2, T3)
9754    {
9755        #[inline]
9756        unsafe fn encode(
9757            self,
9758            encoder: &mut fidl::encoding::Encoder<
9759                '_,
9760                fidl::encoding::DefaultFuchsiaResourceDialect,
9761            >,
9762            offset: usize,
9763            depth: fidl::encoding::Depth,
9764        ) -> fidl::Result<()> {
9765            encoder.debug_check_bounds::<FlatlandCreateImageRequest>(offset);
9766            // Zero out padding regions. There's no need to apply masks
9767            // because the unmasked parts will be overwritten by fields.
9768            // Write the fields.
9769            self.0.encode(encoder, offset + 0, depth)?;
9770            self.1.encode(encoder, offset + 8, depth)?;
9771            self.2.encode(encoder, offset + 12, depth)?;
9772            self.3.encode(encoder, offset + 16, depth)?;
9773            Ok(())
9774        }
9775    }
9776
9777    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
9778        for FlatlandCreateImageRequest
9779    {
9780        #[inline(always)]
9781        fn new_empty() -> Self {
9782            Self {
9783                image_id: fidl::new_empty!(
9784                    ContentId,
9785                    fidl::encoding::DefaultFuchsiaResourceDialect
9786                ),
9787                import_token: fidl::new_empty!(
9788                    BufferCollectionImportToken,
9789                    fidl::encoding::DefaultFuchsiaResourceDialect
9790                ),
9791                vmo_index: fidl::new_empty!(u32, fidl::encoding::DefaultFuchsiaResourceDialect),
9792                properties: fidl::new_empty!(
9793                    ImageProperties,
9794                    fidl::encoding::DefaultFuchsiaResourceDialect
9795                ),
9796            }
9797        }
9798
9799        #[inline]
9800        unsafe fn decode(
9801            &mut self,
9802            decoder: &mut fidl::encoding::Decoder<
9803                '_,
9804                fidl::encoding::DefaultFuchsiaResourceDialect,
9805            >,
9806            offset: usize,
9807            _depth: fidl::encoding::Depth,
9808        ) -> fidl::Result<()> {
9809            decoder.debug_check_bounds::<Self>(offset);
9810            // Verify that padding bytes are zero.
9811            fidl::decode!(
9812                ContentId,
9813                fidl::encoding::DefaultFuchsiaResourceDialect,
9814                &mut self.image_id,
9815                decoder,
9816                offset + 0,
9817                _depth
9818            )?;
9819            fidl::decode!(
9820                BufferCollectionImportToken,
9821                fidl::encoding::DefaultFuchsiaResourceDialect,
9822                &mut self.import_token,
9823                decoder,
9824                offset + 8,
9825                _depth
9826            )?;
9827            fidl::decode!(
9828                u32,
9829                fidl::encoding::DefaultFuchsiaResourceDialect,
9830                &mut self.vmo_index,
9831                decoder,
9832                offset + 12,
9833                _depth
9834            )?;
9835            fidl::decode!(
9836                ImageProperties,
9837                fidl::encoding::DefaultFuchsiaResourceDialect,
9838                &mut self.properties,
9839                decoder,
9840                offset + 16,
9841                _depth
9842            )?;
9843            Ok(())
9844        }
9845    }
9846
9847    impl fidl::encoding::ResourceTypeMarker for FlatlandCreateView2Request {
9848        type Borrowed<'a> = &'a mut Self;
9849        fn take_or_borrow<'a>(
9850            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9851        ) -> Self::Borrowed<'a> {
9852            value
9853        }
9854    }
9855
9856    unsafe impl fidl::encoding::TypeMarker for FlatlandCreateView2Request {
9857        type Owned = Self;
9858
9859        #[inline(always)]
9860        fn inline_align(_context: fidl::encoding::Context) -> usize {
9861            8
9862        }
9863
9864        #[inline(always)]
9865        fn inline_size(_context: fidl::encoding::Context) -> usize {
9866            40
9867        }
9868    }
9869
9870    unsafe impl
9871        fidl::encoding::Encode<
9872            FlatlandCreateView2Request,
9873            fidl::encoding::DefaultFuchsiaResourceDialect,
9874        > for &mut FlatlandCreateView2Request
9875    {
9876        #[inline]
9877        unsafe fn encode(
9878            self,
9879            encoder: &mut fidl::encoding::Encoder<
9880                '_,
9881                fidl::encoding::DefaultFuchsiaResourceDialect,
9882            >,
9883            offset: usize,
9884            _depth: fidl::encoding::Depth,
9885        ) -> fidl::Result<()> {
9886            encoder.debug_check_bounds::<FlatlandCreateView2Request>(offset);
9887            // Delegate to tuple encoding.
9888            fidl::encoding::Encode::<FlatlandCreateView2Request, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
9889                (
9890                    <fidl_fuchsia_ui_views::ViewCreationToken as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.token),
9891                    <fidl_fuchsia_ui_views::ViewIdentityOnCreation as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.view_identity),
9892                    <ViewBoundProtocols as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.protocols),
9893                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.parent_viewport_watcher),
9894                ),
9895                encoder, offset, _depth
9896            )
9897        }
9898    }
9899    unsafe impl<
9900        T0: fidl::encoding::Encode<
9901                fidl_fuchsia_ui_views::ViewCreationToken,
9902                fidl::encoding::DefaultFuchsiaResourceDialect,
9903            >,
9904        T1: fidl::encoding::Encode<
9905                fidl_fuchsia_ui_views::ViewIdentityOnCreation,
9906                fidl::encoding::DefaultFuchsiaResourceDialect,
9907            >,
9908        T2: fidl::encoding::Encode<ViewBoundProtocols, fidl::encoding::DefaultFuchsiaResourceDialect>,
9909        T3: fidl::encoding::Encode<
9910                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>>,
9911                fidl::encoding::DefaultFuchsiaResourceDialect,
9912            >,
9913    >
9914        fidl::encoding::Encode<
9915            FlatlandCreateView2Request,
9916            fidl::encoding::DefaultFuchsiaResourceDialect,
9917        > for (T0, T1, T2, T3)
9918    {
9919        #[inline]
9920        unsafe fn encode(
9921            self,
9922            encoder: &mut fidl::encoding::Encoder<
9923                '_,
9924                fidl::encoding::DefaultFuchsiaResourceDialect,
9925            >,
9926            offset: usize,
9927            depth: fidl::encoding::Depth,
9928        ) -> fidl::Result<()> {
9929            encoder.debug_check_bounds::<FlatlandCreateView2Request>(offset);
9930            // Zero out padding regions. There's no need to apply masks
9931            // because the unmasked parts will be overwritten by fields.
9932            unsafe {
9933                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
9934                (ptr as *mut u64).write_unaligned(0);
9935            }
9936            unsafe {
9937                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(32);
9938                (ptr as *mut u64).write_unaligned(0);
9939            }
9940            // Write the fields.
9941            self.0.encode(encoder, offset + 0, depth)?;
9942            self.1.encode(encoder, offset + 4, depth)?;
9943            self.2.encode(encoder, offset + 16, depth)?;
9944            self.3.encode(encoder, offset + 32, depth)?;
9945            Ok(())
9946        }
9947    }
9948
9949    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
9950        for FlatlandCreateView2Request
9951    {
9952        #[inline(always)]
9953        fn new_empty() -> Self {
9954            Self {
9955                token: fidl::new_empty!(
9956                    fidl_fuchsia_ui_views::ViewCreationToken,
9957                    fidl::encoding::DefaultFuchsiaResourceDialect
9958                ),
9959                view_identity: fidl::new_empty!(
9960                    fidl_fuchsia_ui_views::ViewIdentityOnCreation,
9961                    fidl::encoding::DefaultFuchsiaResourceDialect
9962                ),
9963                protocols: fidl::new_empty!(
9964                    ViewBoundProtocols,
9965                    fidl::encoding::DefaultFuchsiaResourceDialect
9966                ),
9967                parent_viewport_watcher: fidl::new_empty!(
9968                    fidl::encoding::Endpoint<
9969                        fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>,
9970                    >,
9971                    fidl::encoding::DefaultFuchsiaResourceDialect
9972                ),
9973            }
9974        }
9975
9976        #[inline]
9977        unsafe fn decode(
9978            &mut self,
9979            decoder: &mut fidl::encoding::Decoder<
9980                '_,
9981                fidl::encoding::DefaultFuchsiaResourceDialect,
9982            >,
9983            offset: usize,
9984            _depth: fidl::encoding::Depth,
9985        ) -> fidl::Result<()> {
9986            decoder.debug_check_bounds::<Self>(offset);
9987            // Verify that padding bytes are zero.
9988            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(8) };
9989            let padval = unsafe { (ptr as *const u64).read_unaligned() };
9990            let mask = 0xffffffff00000000u64;
9991            let maskedval = padval & mask;
9992            if maskedval != 0 {
9993                return Err(fidl::Error::NonZeroPadding {
9994                    padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
9995                });
9996            }
9997            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(32) };
9998            let padval = unsafe { (ptr as *const u64).read_unaligned() };
9999            let mask = 0xffffffff00000000u64;
10000            let maskedval = padval & mask;
10001            if maskedval != 0 {
10002                return Err(fidl::Error::NonZeroPadding {
10003                    padding_start: offset + 32 + ((mask as u64).trailing_zeros() / 8) as usize,
10004                });
10005            }
10006            fidl::decode!(
10007                fidl_fuchsia_ui_views::ViewCreationToken,
10008                fidl::encoding::DefaultFuchsiaResourceDialect,
10009                &mut self.token,
10010                decoder,
10011                offset + 0,
10012                _depth
10013            )?;
10014            fidl::decode!(
10015                fidl_fuchsia_ui_views::ViewIdentityOnCreation,
10016                fidl::encoding::DefaultFuchsiaResourceDialect,
10017                &mut self.view_identity,
10018                decoder,
10019                offset + 4,
10020                _depth
10021            )?;
10022            fidl::decode!(
10023                ViewBoundProtocols,
10024                fidl::encoding::DefaultFuchsiaResourceDialect,
10025                &mut self.protocols,
10026                decoder,
10027                offset + 16,
10028                _depth
10029            )?;
10030            fidl::decode!(
10031                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>>,
10032                fidl::encoding::DefaultFuchsiaResourceDialect,
10033                &mut self.parent_viewport_watcher,
10034                decoder,
10035                offset + 32,
10036                _depth
10037            )?;
10038            Ok(())
10039        }
10040    }
10041
10042    impl fidl::encoding::ResourceTypeMarker for FlatlandCreateViewRequest {
10043        type Borrowed<'a> = &'a mut Self;
10044        fn take_or_borrow<'a>(
10045            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10046        ) -> Self::Borrowed<'a> {
10047            value
10048        }
10049    }
10050
10051    unsafe impl fidl::encoding::TypeMarker for FlatlandCreateViewRequest {
10052        type Owned = Self;
10053
10054        #[inline(always)]
10055        fn inline_align(_context: fidl::encoding::Context) -> usize {
10056            4
10057        }
10058
10059        #[inline(always)]
10060        fn inline_size(_context: fidl::encoding::Context) -> usize {
10061            8
10062        }
10063    }
10064
10065    unsafe impl
10066        fidl::encoding::Encode<
10067            FlatlandCreateViewRequest,
10068            fidl::encoding::DefaultFuchsiaResourceDialect,
10069        > for &mut FlatlandCreateViewRequest
10070    {
10071        #[inline]
10072        unsafe fn encode(
10073            self,
10074            encoder: &mut fidl::encoding::Encoder<
10075                '_,
10076                fidl::encoding::DefaultFuchsiaResourceDialect,
10077            >,
10078            offset: usize,
10079            _depth: fidl::encoding::Depth,
10080        ) -> fidl::Result<()> {
10081            encoder.debug_check_bounds::<FlatlandCreateViewRequest>(offset);
10082            // Delegate to tuple encoding.
10083            fidl::encoding::Encode::<FlatlandCreateViewRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
10084                (
10085                    <fidl_fuchsia_ui_views::ViewCreationToken as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.token),
10086                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.parent_viewport_watcher),
10087                ),
10088                encoder, offset, _depth
10089            )
10090        }
10091    }
10092    unsafe impl<
10093        T0: fidl::encoding::Encode<
10094                fidl_fuchsia_ui_views::ViewCreationToken,
10095                fidl::encoding::DefaultFuchsiaResourceDialect,
10096            >,
10097        T1: fidl::encoding::Encode<
10098                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>>,
10099                fidl::encoding::DefaultFuchsiaResourceDialect,
10100            >,
10101    >
10102        fidl::encoding::Encode<
10103            FlatlandCreateViewRequest,
10104            fidl::encoding::DefaultFuchsiaResourceDialect,
10105        > for (T0, T1)
10106    {
10107        #[inline]
10108        unsafe fn encode(
10109            self,
10110            encoder: &mut fidl::encoding::Encoder<
10111                '_,
10112                fidl::encoding::DefaultFuchsiaResourceDialect,
10113            >,
10114            offset: usize,
10115            depth: fidl::encoding::Depth,
10116        ) -> fidl::Result<()> {
10117            encoder.debug_check_bounds::<FlatlandCreateViewRequest>(offset);
10118            // Zero out padding regions. There's no need to apply masks
10119            // because the unmasked parts will be overwritten by fields.
10120            // Write the fields.
10121            self.0.encode(encoder, offset + 0, depth)?;
10122            self.1.encode(encoder, offset + 4, depth)?;
10123            Ok(())
10124        }
10125    }
10126
10127    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10128        for FlatlandCreateViewRequest
10129    {
10130        #[inline(always)]
10131        fn new_empty() -> Self {
10132            Self {
10133                token: fidl::new_empty!(
10134                    fidl_fuchsia_ui_views::ViewCreationToken,
10135                    fidl::encoding::DefaultFuchsiaResourceDialect
10136                ),
10137                parent_viewport_watcher: fidl::new_empty!(
10138                    fidl::encoding::Endpoint<
10139                        fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>,
10140                    >,
10141                    fidl::encoding::DefaultFuchsiaResourceDialect
10142                ),
10143            }
10144        }
10145
10146        #[inline]
10147        unsafe fn decode(
10148            &mut self,
10149            decoder: &mut fidl::encoding::Decoder<
10150                '_,
10151                fidl::encoding::DefaultFuchsiaResourceDialect,
10152            >,
10153            offset: usize,
10154            _depth: fidl::encoding::Depth,
10155        ) -> fidl::Result<()> {
10156            decoder.debug_check_bounds::<Self>(offset);
10157            // Verify that padding bytes are zero.
10158            fidl::decode!(
10159                fidl_fuchsia_ui_views::ViewCreationToken,
10160                fidl::encoding::DefaultFuchsiaResourceDialect,
10161                &mut self.token,
10162                decoder,
10163                offset + 0,
10164                _depth
10165            )?;
10166            fidl::decode!(
10167                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>>,
10168                fidl::encoding::DefaultFuchsiaResourceDialect,
10169                &mut self.parent_viewport_watcher,
10170                decoder,
10171                offset + 4,
10172                _depth
10173            )?;
10174            Ok(())
10175        }
10176    }
10177
10178    impl fidl::encoding::ResourceTypeMarker for FlatlandCreateViewportRequest {
10179        type Borrowed<'a> = &'a mut Self;
10180        fn take_or_borrow<'a>(
10181            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10182        ) -> Self::Borrowed<'a> {
10183            value
10184        }
10185    }
10186
10187    unsafe impl fidl::encoding::TypeMarker for FlatlandCreateViewportRequest {
10188        type Owned = Self;
10189
10190        #[inline(always)]
10191        fn inline_align(_context: fidl::encoding::Context) -> usize {
10192            8
10193        }
10194
10195        #[inline(always)]
10196        fn inline_size(_context: fidl::encoding::Context) -> usize {
10197            40
10198        }
10199    }
10200
10201    unsafe impl
10202        fidl::encoding::Encode<
10203            FlatlandCreateViewportRequest,
10204            fidl::encoding::DefaultFuchsiaResourceDialect,
10205        > for &mut FlatlandCreateViewportRequest
10206    {
10207        #[inline]
10208        unsafe fn encode(
10209            self,
10210            encoder: &mut fidl::encoding::Encoder<
10211                '_,
10212                fidl::encoding::DefaultFuchsiaResourceDialect,
10213            >,
10214            offset: usize,
10215            _depth: fidl::encoding::Depth,
10216        ) -> fidl::Result<()> {
10217            encoder.debug_check_bounds::<FlatlandCreateViewportRequest>(offset);
10218            // Delegate to tuple encoding.
10219            fidl::encoding::Encode::<FlatlandCreateViewportRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
10220                (
10221                    <ContentId as fidl::encoding::ValueTypeMarker>::borrow(&self.viewport_id),
10222                    <fidl_fuchsia_ui_views::ViewportCreationToken as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.token),
10223                    <ViewportProperties as fidl::encoding::ValueTypeMarker>::borrow(&self.properties),
10224                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ChildViewWatcherMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.child_view_watcher),
10225                ),
10226                encoder, offset, _depth
10227            )
10228        }
10229    }
10230    unsafe impl<
10231        T0: fidl::encoding::Encode<ContentId, fidl::encoding::DefaultFuchsiaResourceDialect>,
10232        T1: fidl::encoding::Encode<
10233                fidl_fuchsia_ui_views::ViewportCreationToken,
10234                fidl::encoding::DefaultFuchsiaResourceDialect,
10235            >,
10236        T2: fidl::encoding::Encode<ViewportProperties, fidl::encoding::DefaultFuchsiaResourceDialect>,
10237        T3: fidl::encoding::Encode<
10238                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ChildViewWatcherMarker>>,
10239                fidl::encoding::DefaultFuchsiaResourceDialect,
10240            >,
10241    >
10242        fidl::encoding::Encode<
10243            FlatlandCreateViewportRequest,
10244            fidl::encoding::DefaultFuchsiaResourceDialect,
10245        > for (T0, T1, T2, T3)
10246    {
10247        #[inline]
10248        unsafe fn encode(
10249            self,
10250            encoder: &mut fidl::encoding::Encoder<
10251                '_,
10252                fidl::encoding::DefaultFuchsiaResourceDialect,
10253            >,
10254            offset: usize,
10255            depth: fidl::encoding::Depth,
10256        ) -> fidl::Result<()> {
10257            encoder.debug_check_bounds::<FlatlandCreateViewportRequest>(offset);
10258            // Zero out padding regions. There's no need to apply masks
10259            // because the unmasked parts will be overwritten by fields.
10260            unsafe {
10261                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
10262                (ptr as *mut u64).write_unaligned(0);
10263            }
10264            unsafe {
10265                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(32);
10266                (ptr as *mut u64).write_unaligned(0);
10267            }
10268            // Write the fields.
10269            self.0.encode(encoder, offset + 0, depth)?;
10270            self.1.encode(encoder, offset + 8, depth)?;
10271            self.2.encode(encoder, offset + 16, depth)?;
10272            self.3.encode(encoder, offset + 32, depth)?;
10273            Ok(())
10274        }
10275    }
10276
10277    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10278        for FlatlandCreateViewportRequest
10279    {
10280        #[inline(always)]
10281        fn new_empty() -> Self {
10282            Self {
10283                viewport_id: fidl::new_empty!(
10284                    ContentId,
10285                    fidl::encoding::DefaultFuchsiaResourceDialect
10286                ),
10287                token: fidl::new_empty!(
10288                    fidl_fuchsia_ui_views::ViewportCreationToken,
10289                    fidl::encoding::DefaultFuchsiaResourceDialect
10290                ),
10291                properties: fidl::new_empty!(
10292                    ViewportProperties,
10293                    fidl::encoding::DefaultFuchsiaResourceDialect
10294                ),
10295                child_view_watcher: fidl::new_empty!(
10296                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ChildViewWatcherMarker>>,
10297                    fidl::encoding::DefaultFuchsiaResourceDialect
10298                ),
10299            }
10300        }
10301
10302        #[inline]
10303        unsafe fn decode(
10304            &mut self,
10305            decoder: &mut fidl::encoding::Decoder<
10306                '_,
10307                fidl::encoding::DefaultFuchsiaResourceDialect,
10308            >,
10309            offset: usize,
10310            _depth: fidl::encoding::Depth,
10311        ) -> fidl::Result<()> {
10312            decoder.debug_check_bounds::<Self>(offset);
10313            // Verify that padding bytes are zero.
10314            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(8) };
10315            let padval = unsafe { (ptr as *const u64).read_unaligned() };
10316            let mask = 0xffffffff00000000u64;
10317            let maskedval = padval & mask;
10318            if maskedval != 0 {
10319                return Err(fidl::Error::NonZeroPadding {
10320                    padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
10321                });
10322            }
10323            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(32) };
10324            let padval = unsafe { (ptr as *const u64).read_unaligned() };
10325            let mask = 0xffffffff00000000u64;
10326            let maskedval = padval & mask;
10327            if maskedval != 0 {
10328                return Err(fidl::Error::NonZeroPadding {
10329                    padding_start: offset + 32 + ((mask as u64).trailing_zeros() / 8) as usize,
10330                });
10331            }
10332            fidl::decode!(
10333                ContentId,
10334                fidl::encoding::DefaultFuchsiaResourceDialect,
10335                &mut self.viewport_id,
10336                decoder,
10337                offset + 0,
10338                _depth
10339            )?;
10340            fidl::decode!(
10341                fidl_fuchsia_ui_views::ViewportCreationToken,
10342                fidl::encoding::DefaultFuchsiaResourceDialect,
10343                &mut self.token,
10344                decoder,
10345                offset + 8,
10346                _depth
10347            )?;
10348            fidl::decode!(
10349                ViewportProperties,
10350                fidl::encoding::DefaultFuchsiaResourceDialect,
10351                &mut self.properties,
10352                decoder,
10353                offset + 16,
10354                _depth
10355            )?;
10356            fidl::decode!(
10357                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ChildViewWatcherMarker>>,
10358                fidl::encoding::DefaultFuchsiaResourceDialect,
10359                &mut self.child_view_watcher,
10360                decoder,
10361                offset + 32,
10362                _depth
10363            )?;
10364            Ok(())
10365        }
10366    }
10367
10368    impl fidl::encoding::ResourceTypeMarker for FlatlandDisplaySetContentRequest {
10369        type Borrowed<'a> = &'a mut Self;
10370        fn take_or_borrow<'a>(
10371            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10372        ) -> Self::Borrowed<'a> {
10373            value
10374        }
10375    }
10376
10377    unsafe impl fidl::encoding::TypeMarker for FlatlandDisplaySetContentRequest {
10378        type Owned = Self;
10379
10380        #[inline(always)]
10381        fn inline_align(_context: fidl::encoding::Context) -> usize {
10382            4
10383        }
10384
10385        #[inline(always)]
10386        fn inline_size(_context: fidl::encoding::Context) -> usize {
10387            8
10388        }
10389    }
10390
10391    unsafe impl
10392        fidl::encoding::Encode<
10393            FlatlandDisplaySetContentRequest,
10394            fidl::encoding::DefaultFuchsiaResourceDialect,
10395        > for &mut FlatlandDisplaySetContentRequest
10396    {
10397        #[inline]
10398        unsafe fn encode(
10399            self,
10400            encoder: &mut fidl::encoding::Encoder<
10401                '_,
10402                fidl::encoding::DefaultFuchsiaResourceDialect,
10403            >,
10404            offset: usize,
10405            _depth: fidl::encoding::Depth,
10406        ) -> fidl::Result<()> {
10407            encoder.debug_check_bounds::<FlatlandDisplaySetContentRequest>(offset);
10408            // Delegate to tuple encoding.
10409            fidl::encoding::Encode::<FlatlandDisplaySetContentRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
10410                (
10411                    <fidl_fuchsia_ui_views::ViewportCreationToken as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.token),
10412                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ChildViewWatcherMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.child_view_watcher),
10413                ),
10414                encoder, offset, _depth
10415            )
10416        }
10417    }
10418    unsafe impl<
10419        T0: fidl::encoding::Encode<
10420                fidl_fuchsia_ui_views::ViewportCreationToken,
10421                fidl::encoding::DefaultFuchsiaResourceDialect,
10422            >,
10423        T1: fidl::encoding::Encode<
10424                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ChildViewWatcherMarker>>,
10425                fidl::encoding::DefaultFuchsiaResourceDialect,
10426            >,
10427    >
10428        fidl::encoding::Encode<
10429            FlatlandDisplaySetContentRequest,
10430            fidl::encoding::DefaultFuchsiaResourceDialect,
10431        > for (T0, T1)
10432    {
10433        #[inline]
10434        unsafe fn encode(
10435            self,
10436            encoder: &mut fidl::encoding::Encoder<
10437                '_,
10438                fidl::encoding::DefaultFuchsiaResourceDialect,
10439            >,
10440            offset: usize,
10441            depth: fidl::encoding::Depth,
10442        ) -> fidl::Result<()> {
10443            encoder.debug_check_bounds::<FlatlandDisplaySetContentRequest>(offset);
10444            // Zero out padding regions. There's no need to apply masks
10445            // because the unmasked parts will be overwritten by fields.
10446            // Write the fields.
10447            self.0.encode(encoder, offset + 0, depth)?;
10448            self.1.encode(encoder, offset + 4, depth)?;
10449            Ok(())
10450        }
10451    }
10452
10453    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10454        for FlatlandDisplaySetContentRequest
10455    {
10456        #[inline(always)]
10457        fn new_empty() -> Self {
10458            Self {
10459                token: fidl::new_empty!(
10460                    fidl_fuchsia_ui_views::ViewportCreationToken,
10461                    fidl::encoding::DefaultFuchsiaResourceDialect
10462                ),
10463                child_view_watcher: fidl::new_empty!(
10464                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ChildViewWatcherMarker>>,
10465                    fidl::encoding::DefaultFuchsiaResourceDialect
10466                ),
10467            }
10468        }
10469
10470        #[inline]
10471        unsafe fn decode(
10472            &mut self,
10473            decoder: &mut fidl::encoding::Decoder<
10474                '_,
10475                fidl::encoding::DefaultFuchsiaResourceDialect,
10476            >,
10477            offset: usize,
10478            _depth: fidl::encoding::Depth,
10479        ) -> fidl::Result<()> {
10480            decoder.debug_check_bounds::<Self>(offset);
10481            // Verify that padding bytes are zero.
10482            fidl::decode!(
10483                fidl_fuchsia_ui_views::ViewportCreationToken,
10484                fidl::encoding::DefaultFuchsiaResourceDialect,
10485                &mut self.token,
10486                decoder,
10487                offset + 0,
10488                _depth
10489            )?;
10490            fidl::decode!(
10491                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ChildViewWatcherMarker>>,
10492                fidl::encoding::DefaultFuchsiaResourceDialect,
10493                &mut self.child_view_watcher,
10494                decoder,
10495                offset + 4,
10496                _depth
10497            )?;
10498            Ok(())
10499        }
10500    }
10501
10502    impl fidl::encoding::ResourceTypeMarker for FlatlandPresentRequest {
10503        type Borrowed<'a> = &'a mut Self;
10504        fn take_or_borrow<'a>(
10505            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10506        ) -> Self::Borrowed<'a> {
10507            value
10508        }
10509    }
10510
10511    unsafe impl fidl::encoding::TypeMarker for FlatlandPresentRequest {
10512        type Owned = Self;
10513
10514        #[inline(always)]
10515        fn inline_align(_context: fidl::encoding::Context) -> usize {
10516            8
10517        }
10518
10519        #[inline(always)]
10520        fn inline_size(_context: fidl::encoding::Context) -> usize {
10521            16
10522        }
10523    }
10524
10525    unsafe impl
10526        fidl::encoding::Encode<
10527            FlatlandPresentRequest,
10528            fidl::encoding::DefaultFuchsiaResourceDialect,
10529        > for &mut FlatlandPresentRequest
10530    {
10531        #[inline]
10532        unsafe fn encode(
10533            self,
10534            encoder: &mut fidl::encoding::Encoder<
10535                '_,
10536                fidl::encoding::DefaultFuchsiaResourceDialect,
10537            >,
10538            offset: usize,
10539            _depth: fidl::encoding::Depth,
10540        ) -> fidl::Result<()> {
10541            encoder.debug_check_bounds::<FlatlandPresentRequest>(offset);
10542            // Delegate to tuple encoding.
10543            fidl::encoding::Encode::<
10544                FlatlandPresentRequest,
10545                fidl::encoding::DefaultFuchsiaResourceDialect,
10546            >::encode(
10547                (<PresentArgs as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
10548                    &mut self.args,
10549                ),),
10550                encoder,
10551                offset,
10552                _depth,
10553            )
10554        }
10555    }
10556    unsafe impl<
10557        T0: fidl::encoding::Encode<PresentArgs, fidl::encoding::DefaultFuchsiaResourceDialect>,
10558    >
10559        fidl::encoding::Encode<
10560            FlatlandPresentRequest,
10561            fidl::encoding::DefaultFuchsiaResourceDialect,
10562        > for (T0,)
10563    {
10564        #[inline]
10565        unsafe fn encode(
10566            self,
10567            encoder: &mut fidl::encoding::Encoder<
10568                '_,
10569                fidl::encoding::DefaultFuchsiaResourceDialect,
10570            >,
10571            offset: usize,
10572            depth: fidl::encoding::Depth,
10573        ) -> fidl::Result<()> {
10574            encoder.debug_check_bounds::<FlatlandPresentRequest>(offset);
10575            // Zero out padding regions. There's no need to apply masks
10576            // because the unmasked parts will be overwritten by fields.
10577            // Write the fields.
10578            self.0.encode(encoder, offset + 0, depth)?;
10579            Ok(())
10580        }
10581    }
10582
10583    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10584        for FlatlandPresentRequest
10585    {
10586        #[inline(always)]
10587        fn new_empty() -> Self {
10588            Self {
10589                args: fidl::new_empty!(PresentArgs, fidl::encoding::DefaultFuchsiaResourceDialect),
10590            }
10591        }
10592
10593        #[inline]
10594        unsafe fn decode(
10595            &mut self,
10596            decoder: &mut fidl::encoding::Decoder<
10597                '_,
10598                fidl::encoding::DefaultFuchsiaResourceDialect,
10599            >,
10600            offset: usize,
10601            _depth: fidl::encoding::Depth,
10602        ) -> fidl::Result<()> {
10603            decoder.debug_check_bounds::<Self>(offset);
10604            // Verify that padding bytes are zero.
10605            fidl::decode!(
10606                PresentArgs,
10607                fidl::encoding::DefaultFuchsiaResourceDialect,
10608                &mut self.args,
10609                decoder,
10610                offset + 0,
10611                _depth
10612            )?;
10613            Ok(())
10614        }
10615    }
10616
10617    impl fidl::encoding::ResourceTypeMarker for FlatlandReleaseViewportResponse {
10618        type Borrowed<'a> = &'a mut Self;
10619        fn take_or_borrow<'a>(
10620            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10621        ) -> Self::Borrowed<'a> {
10622            value
10623        }
10624    }
10625
10626    unsafe impl fidl::encoding::TypeMarker for FlatlandReleaseViewportResponse {
10627        type Owned = Self;
10628
10629        #[inline(always)]
10630        fn inline_align(_context: fidl::encoding::Context) -> usize {
10631            4
10632        }
10633
10634        #[inline(always)]
10635        fn inline_size(_context: fidl::encoding::Context) -> usize {
10636            4
10637        }
10638    }
10639
10640    unsafe impl
10641        fidl::encoding::Encode<
10642            FlatlandReleaseViewportResponse,
10643            fidl::encoding::DefaultFuchsiaResourceDialect,
10644        > for &mut FlatlandReleaseViewportResponse
10645    {
10646        #[inline]
10647        unsafe fn encode(
10648            self,
10649            encoder: &mut fidl::encoding::Encoder<
10650                '_,
10651                fidl::encoding::DefaultFuchsiaResourceDialect,
10652            >,
10653            offset: usize,
10654            _depth: fidl::encoding::Depth,
10655        ) -> fidl::Result<()> {
10656            encoder.debug_check_bounds::<FlatlandReleaseViewportResponse>(offset);
10657            // Delegate to tuple encoding.
10658            fidl::encoding::Encode::<FlatlandReleaseViewportResponse, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
10659                (
10660                    <fidl_fuchsia_ui_views::ViewportCreationToken as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.token),
10661                ),
10662                encoder, offset, _depth
10663            )
10664        }
10665    }
10666    unsafe impl<
10667        T0: fidl::encoding::Encode<
10668                fidl_fuchsia_ui_views::ViewportCreationToken,
10669                fidl::encoding::DefaultFuchsiaResourceDialect,
10670            >,
10671    >
10672        fidl::encoding::Encode<
10673            FlatlandReleaseViewportResponse,
10674            fidl::encoding::DefaultFuchsiaResourceDialect,
10675        > for (T0,)
10676    {
10677        #[inline]
10678        unsafe fn encode(
10679            self,
10680            encoder: &mut fidl::encoding::Encoder<
10681                '_,
10682                fidl::encoding::DefaultFuchsiaResourceDialect,
10683            >,
10684            offset: usize,
10685            depth: fidl::encoding::Depth,
10686        ) -> fidl::Result<()> {
10687            encoder.debug_check_bounds::<FlatlandReleaseViewportResponse>(offset);
10688            // Zero out padding regions. There's no need to apply masks
10689            // because the unmasked parts will be overwritten by fields.
10690            // Write the fields.
10691            self.0.encode(encoder, offset + 0, depth)?;
10692            Ok(())
10693        }
10694    }
10695
10696    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10697        for FlatlandReleaseViewportResponse
10698    {
10699        #[inline(always)]
10700        fn new_empty() -> Self {
10701            Self {
10702                token: fidl::new_empty!(
10703                    fidl_fuchsia_ui_views::ViewportCreationToken,
10704                    fidl::encoding::DefaultFuchsiaResourceDialect
10705                ),
10706            }
10707        }
10708
10709        #[inline]
10710        unsafe fn decode(
10711            &mut self,
10712            decoder: &mut fidl::encoding::Decoder<
10713                '_,
10714                fidl::encoding::DefaultFuchsiaResourceDialect,
10715            >,
10716            offset: usize,
10717            _depth: fidl::encoding::Depth,
10718        ) -> fidl::Result<()> {
10719            decoder.debug_check_bounds::<Self>(offset);
10720            // Verify that padding bytes are zero.
10721            fidl::decode!(
10722                fidl_fuchsia_ui_views::ViewportCreationToken,
10723                fidl::encoding::DefaultFuchsiaResourceDialect,
10724                &mut self.token,
10725                decoder,
10726                offset + 0,
10727                _depth
10728            )?;
10729            Ok(())
10730        }
10731    }
10732
10733    impl fidl::encoding::ResourceTypeMarker for FlatlandSetSolidFillRequest {
10734        type Borrowed<'a> = &'a mut Self;
10735        fn take_or_borrow<'a>(
10736            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10737        ) -> Self::Borrowed<'a> {
10738            value
10739        }
10740    }
10741
10742    unsafe impl fidl::encoding::TypeMarker for FlatlandSetSolidFillRequest {
10743        type Owned = Self;
10744
10745        #[inline(always)]
10746        fn inline_align(_context: fidl::encoding::Context) -> usize {
10747            8
10748        }
10749
10750        #[inline(always)]
10751        fn inline_size(_context: fidl::encoding::Context) -> usize {
10752            32
10753        }
10754    }
10755
10756    unsafe impl
10757        fidl::encoding::Encode<
10758            FlatlandSetSolidFillRequest,
10759            fidl::encoding::DefaultFuchsiaResourceDialect,
10760        > for &mut FlatlandSetSolidFillRequest
10761    {
10762        #[inline]
10763        unsafe fn encode(
10764            self,
10765            encoder: &mut fidl::encoding::Encoder<
10766                '_,
10767                fidl::encoding::DefaultFuchsiaResourceDialect,
10768            >,
10769            offset: usize,
10770            _depth: fidl::encoding::Depth,
10771        ) -> fidl::Result<()> {
10772            encoder.debug_check_bounds::<FlatlandSetSolidFillRequest>(offset);
10773            // Delegate to tuple encoding.
10774            fidl::encoding::Encode::<
10775                FlatlandSetSolidFillRequest,
10776                fidl::encoding::DefaultFuchsiaResourceDialect,
10777            >::encode(
10778                (
10779                    <ContentId as fidl::encoding::ValueTypeMarker>::borrow(&self.rect_id),
10780                    <ColorRgba as fidl::encoding::ValueTypeMarker>::borrow(&self.color),
10781                    <fidl_fuchsia_math::SizeU as fidl::encoding::ValueTypeMarker>::borrow(
10782                        &self.size,
10783                    ),
10784                ),
10785                encoder,
10786                offset,
10787                _depth,
10788            )
10789        }
10790    }
10791    unsafe impl<
10792        T0: fidl::encoding::Encode<ContentId, fidl::encoding::DefaultFuchsiaResourceDialect>,
10793        T1: fidl::encoding::Encode<ColorRgba, fidl::encoding::DefaultFuchsiaResourceDialect>,
10794        T2: fidl::encoding::Encode<
10795                fidl_fuchsia_math::SizeU,
10796                fidl::encoding::DefaultFuchsiaResourceDialect,
10797            >,
10798    >
10799        fidl::encoding::Encode<
10800            FlatlandSetSolidFillRequest,
10801            fidl::encoding::DefaultFuchsiaResourceDialect,
10802        > for (T0, T1, T2)
10803    {
10804        #[inline]
10805        unsafe fn encode(
10806            self,
10807            encoder: &mut fidl::encoding::Encoder<
10808                '_,
10809                fidl::encoding::DefaultFuchsiaResourceDialect,
10810            >,
10811            offset: usize,
10812            depth: fidl::encoding::Depth,
10813        ) -> fidl::Result<()> {
10814            encoder.debug_check_bounds::<FlatlandSetSolidFillRequest>(offset);
10815            // Zero out padding regions. There's no need to apply masks
10816            // because the unmasked parts will be overwritten by fields.
10817            // Write the fields.
10818            self.0.encode(encoder, offset + 0, depth)?;
10819            self.1.encode(encoder, offset + 8, depth)?;
10820            self.2.encode(encoder, offset + 24, depth)?;
10821            Ok(())
10822        }
10823    }
10824
10825    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10826        for FlatlandSetSolidFillRequest
10827    {
10828        #[inline(always)]
10829        fn new_empty() -> Self {
10830            Self {
10831                rect_id: fidl::new_empty!(ContentId, fidl::encoding::DefaultFuchsiaResourceDialect),
10832                color: fidl::new_empty!(ColorRgba, fidl::encoding::DefaultFuchsiaResourceDialect),
10833                size: fidl::new_empty!(
10834                    fidl_fuchsia_math::SizeU,
10835                    fidl::encoding::DefaultFuchsiaResourceDialect
10836                ),
10837            }
10838        }
10839
10840        #[inline]
10841        unsafe fn decode(
10842            &mut self,
10843            decoder: &mut fidl::encoding::Decoder<
10844                '_,
10845                fidl::encoding::DefaultFuchsiaResourceDialect,
10846            >,
10847            offset: usize,
10848            _depth: fidl::encoding::Depth,
10849        ) -> fidl::Result<()> {
10850            decoder.debug_check_bounds::<Self>(offset);
10851            // Verify that padding bytes are zero.
10852            fidl::decode!(
10853                ContentId,
10854                fidl::encoding::DefaultFuchsiaResourceDialect,
10855                &mut self.rect_id,
10856                decoder,
10857                offset + 0,
10858                _depth
10859            )?;
10860            fidl::decode!(
10861                ColorRgba,
10862                fidl::encoding::DefaultFuchsiaResourceDialect,
10863                &mut self.color,
10864                decoder,
10865                offset + 8,
10866                _depth
10867            )?;
10868            fidl::decode!(
10869                fidl_fuchsia_math::SizeU,
10870                fidl::encoding::DefaultFuchsiaResourceDialect,
10871                &mut self.size,
10872                decoder,
10873                offset + 24,
10874                _depth
10875            )?;
10876            Ok(())
10877        }
10878    }
10879
10880    impl fidl::encoding::ResourceTypeMarker for TrustedFlatlandFactoryCreateFlatlandRequest {
10881        type Borrowed<'a> = &'a mut Self;
10882        fn take_or_borrow<'a>(
10883            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10884        ) -> Self::Borrowed<'a> {
10885            value
10886        }
10887    }
10888
10889    unsafe impl fidl::encoding::TypeMarker for TrustedFlatlandFactoryCreateFlatlandRequest {
10890        type Owned = Self;
10891
10892        #[inline(always)]
10893        fn inline_align(_context: fidl::encoding::Context) -> usize {
10894            8
10895        }
10896
10897        #[inline(always)]
10898        fn inline_size(_context: fidl::encoding::Context) -> usize {
10899            24
10900        }
10901    }
10902
10903    unsafe impl
10904        fidl::encoding::Encode<
10905            TrustedFlatlandFactoryCreateFlatlandRequest,
10906            fidl::encoding::DefaultFuchsiaResourceDialect,
10907        > for &mut TrustedFlatlandFactoryCreateFlatlandRequest
10908    {
10909        #[inline]
10910        unsafe fn encode(
10911            self,
10912            encoder: &mut fidl::encoding::Encoder<
10913                '_,
10914                fidl::encoding::DefaultFuchsiaResourceDialect,
10915            >,
10916            offset: usize,
10917            _depth: fidl::encoding::Depth,
10918        ) -> fidl::Result<()> {
10919            encoder.debug_check_bounds::<TrustedFlatlandFactoryCreateFlatlandRequest>(offset);
10920            // Delegate to tuple encoding.
10921            fidl::encoding::Encode::<TrustedFlatlandFactoryCreateFlatlandRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
10922                (
10923                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<FlatlandMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.server_end),
10924                    <TrustedFlatlandConfig as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.config),
10925                ),
10926                encoder, offset, _depth
10927            )
10928        }
10929    }
10930    unsafe impl<
10931        T0: fidl::encoding::Encode<
10932                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<FlatlandMarker>>,
10933                fidl::encoding::DefaultFuchsiaResourceDialect,
10934            >,
10935        T1: fidl::encoding::Encode<
10936                TrustedFlatlandConfig,
10937                fidl::encoding::DefaultFuchsiaResourceDialect,
10938            >,
10939    >
10940        fidl::encoding::Encode<
10941            TrustedFlatlandFactoryCreateFlatlandRequest,
10942            fidl::encoding::DefaultFuchsiaResourceDialect,
10943        > for (T0, T1)
10944    {
10945        #[inline]
10946        unsafe fn encode(
10947            self,
10948            encoder: &mut fidl::encoding::Encoder<
10949                '_,
10950                fidl::encoding::DefaultFuchsiaResourceDialect,
10951            >,
10952            offset: usize,
10953            depth: fidl::encoding::Depth,
10954        ) -> fidl::Result<()> {
10955            encoder.debug_check_bounds::<TrustedFlatlandFactoryCreateFlatlandRequest>(offset);
10956            // Zero out padding regions. There's no need to apply masks
10957            // because the unmasked parts will be overwritten by fields.
10958            unsafe {
10959                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
10960                (ptr as *mut u64).write_unaligned(0);
10961            }
10962            // Write the fields.
10963            self.0.encode(encoder, offset + 0, depth)?;
10964            self.1.encode(encoder, offset + 8, depth)?;
10965            Ok(())
10966        }
10967    }
10968
10969    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10970        for TrustedFlatlandFactoryCreateFlatlandRequest
10971    {
10972        #[inline(always)]
10973        fn new_empty() -> Self {
10974            Self {
10975                server_end: fidl::new_empty!(
10976                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<FlatlandMarker>>,
10977                    fidl::encoding::DefaultFuchsiaResourceDialect
10978                ),
10979                config: fidl::new_empty!(
10980                    TrustedFlatlandConfig,
10981                    fidl::encoding::DefaultFuchsiaResourceDialect
10982                ),
10983            }
10984        }
10985
10986        #[inline]
10987        unsafe fn decode(
10988            &mut self,
10989            decoder: &mut fidl::encoding::Decoder<
10990                '_,
10991                fidl::encoding::DefaultFuchsiaResourceDialect,
10992            >,
10993            offset: usize,
10994            _depth: fidl::encoding::Depth,
10995        ) -> fidl::Result<()> {
10996            decoder.debug_check_bounds::<Self>(offset);
10997            // Verify that padding bytes are zero.
10998            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
10999            let padval = unsafe { (ptr as *const u64).read_unaligned() };
11000            let mask = 0xffffffff00000000u64;
11001            let maskedval = padval & mask;
11002            if maskedval != 0 {
11003                return Err(fidl::Error::NonZeroPadding {
11004                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
11005                });
11006            }
11007            fidl::decode!(
11008                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<FlatlandMarker>>,
11009                fidl::encoding::DefaultFuchsiaResourceDialect,
11010                &mut self.server_end,
11011                decoder,
11012                offset + 0,
11013                _depth
11014            )?;
11015            fidl::decode!(
11016                TrustedFlatlandConfig,
11017                fidl::encoding::DefaultFuchsiaResourceDialect,
11018                &mut self.config,
11019                decoder,
11020                offset + 8,
11021                _depth
11022            )?;
11023            Ok(())
11024        }
11025    }
11026
11027    impl FrameInfo {
11028        #[inline(always)]
11029        fn max_ordinal_present(&self) -> u64 {
11030            if let Some(_) = self.buffer_id {
11031                return 1;
11032            }
11033            0
11034        }
11035    }
11036
11037    impl fidl::encoding::ResourceTypeMarker for FrameInfo {
11038        type Borrowed<'a> = &'a mut Self;
11039        fn take_or_borrow<'a>(
11040            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11041        ) -> Self::Borrowed<'a> {
11042            value
11043        }
11044    }
11045
11046    unsafe impl fidl::encoding::TypeMarker for FrameInfo {
11047        type Owned = Self;
11048
11049        #[inline(always)]
11050        fn inline_align(_context: fidl::encoding::Context) -> usize {
11051            8
11052        }
11053
11054        #[inline(always)]
11055        fn inline_size(_context: fidl::encoding::Context) -> usize {
11056            16
11057        }
11058    }
11059
11060    unsafe impl fidl::encoding::Encode<FrameInfo, fidl::encoding::DefaultFuchsiaResourceDialect>
11061        for &mut FrameInfo
11062    {
11063        unsafe fn encode(
11064            self,
11065            encoder: &mut fidl::encoding::Encoder<
11066                '_,
11067                fidl::encoding::DefaultFuchsiaResourceDialect,
11068            >,
11069            offset: usize,
11070            mut depth: fidl::encoding::Depth,
11071        ) -> fidl::Result<()> {
11072            encoder.debug_check_bounds::<FrameInfo>(offset);
11073            // Vector header
11074            let max_ordinal: u64 = self.max_ordinal_present();
11075            encoder.write_num(max_ordinal, offset);
11076            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
11077            // Calling encoder.out_of_line_offset(0) is not allowed.
11078            if max_ordinal == 0 {
11079                return Ok(());
11080            }
11081            depth.increment()?;
11082            let envelope_size = 8;
11083            let bytes_len = max_ordinal as usize * envelope_size;
11084            #[allow(unused_variables)]
11085            let offset = encoder.out_of_line_offset(bytes_len);
11086            let mut _prev_end_offset: usize = 0;
11087            if 1 > max_ordinal {
11088                return Ok(());
11089            }
11090
11091            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11092            // are envelope_size bytes.
11093            let cur_offset: usize = (1 - 1) * envelope_size;
11094
11095            // Zero reserved fields.
11096            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11097
11098            // Safety:
11099            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11100            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11101            //   envelope_size bytes, there is always sufficient room.
11102            fidl::encoding::encode_in_envelope_optional::<
11103                u32,
11104                fidl::encoding::DefaultFuchsiaResourceDialect,
11105            >(
11106                self.buffer_id.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
11107                encoder,
11108                offset + cur_offset,
11109                depth,
11110            )?;
11111
11112            _prev_end_offset = cur_offset + envelope_size;
11113
11114            Ok(())
11115        }
11116    }
11117
11118    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for FrameInfo {
11119        #[inline(always)]
11120        fn new_empty() -> Self {
11121            Self::default()
11122        }
11123
11124        unsafe fn decode(
11125            &mut self,
11126            decoder: &mut fidl::encoding::Decoder<
11127                '_,
11128                fidl::encoding::DefaultFuchsiaResourceDialect,
11129            >,
11130            offset: usize,
11131            mut depth: fidl::encoding::Depth,
11132        ) -> fidl::Result<()> {
11133            decoder.debug_check_bounds::<Self>(offset);
11134            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
11135                None => return Err(fidl::Error::NotNullable),
11136                Some(len) => len,
11137            };
11138            // Calling decoder.out_of_line_offset(0) is not allowed.
11139            if len == 0 {
11140                return Ok(());
11141            };
11142            depth.increment()?;
11143            let envelope_size = 8;
11144            let bytes_len = len * envelope_size;
11145            let offset = decoder.out_of_line_offset(bytes_len)?;
11146            // Decode the envelope for each type.
11147            let mut _next_ordinal_to_read = 0;
11148            let mut next_offset = offset;
11149            let end_offset = offset + bytes_len;
11150            _next_ordinal_to_read += 1;
11151            if next_offset >= end_offset {
11152                return Ok(());
11153            }
11154
11155            // Decode unknown envelopes for gaps in ordinals.
11156            while _next_ordinal_to_read < 1 {
11157                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11158                _next_ordinal_to_read += 1;
11159                next_offset += envelope_size;
11160            }
11161
11162            let next_out_of_line = decoder.next_out_of_line();
11163            let handles_before = decoder.remaining_handles();
11164            if let Some((inlined, num_bytes, num_handles)) =
11165                fidl::encoding::decode_envelope_header(decoder, next_offset)?
11166            {
11167                let member_inline_size =
11168                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
11169                if inlined != (member_inline_size <= 4) {
11170                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
11171                }
11172                let inner_offset;
11173                let mut inner_depth = depth.clone();
11174                if inlined {
11175                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11176                    inner_offset = next_offset;
11177                } else {
11178                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11179                    inner_depth.increment()?;
11180                }
11181                let val_ref = self.buffer_id.get_or_insert_with(|| {
11182                    fidl::new_empty!(u32, fidl::encoding::DefaultFuchsiaResourceDialect)
11183                });
11184                fidl::decode!(
11185                    u32,
11186                    fidl::encoding::DefaultFuchsiaResourceDialect,
11187                    val_ref,
11188                    decoder,
11189                    inner_offset,
11190                    inner_depth
11191                )?;
11192                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11193                {
11194                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
11195                }
11196                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11197                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11198                }
11199            }
11200
11201            next_offset += envelope_size;
11202
11203            // Decode the remaining unknown envelopes.
11204            while next_offset < end_offset {
11205                _next_ordinal_to_read += 1;
11206                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11207                next_offset += envelope_size;
11208            }
11209
11210            Ok(())
11211        }
11212    }
11213
11214    impl GetNextFrameArgs {
11215        #[inline(always)]
11216        fn max_ordinal_present(&self) -> u64 {
11217            if let Some(_) = self.event {
11218                return 1;
11219            }
11220            0
11221        }
11222    }
11223
11224    impl fidl::encoding::ResourceTypeMarker for GetNextFrameArgs {
11225        type Borrowed<'a> = &'a mut Self;
11226        fn take_or_borrow<'a>(
11227            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11228        ) -> Self::Borrowed<'a> {
11229            value
11230        }
11231    }
11232
11233    unsafe impl fidl::encoding::TypeMarker for GetNextFrameArgs {
11234        type Owned = Self;
11235
11236        #[inline(always)]
11237        fn inline_align(_context: fidl::encoding::Context) -> usize {
11238            8
11239        }
11240
11241        #[inline(always)]
11242        fn inline_size(_context: fidl::encoding::Context) -> usize {
11243            16
11244        }
11245    }
11246
11247    unsafe impl
11248        fidl::encoding::Encode<GetNextFrameArgs, fidl::encoding::DefaultFuchsiaResourceDialect>
11249        for &mut GetNextFrameArgs
11250    {
11251        unsafe fn encode(
11252            self,
11253            encoder: &mut fidl::encoding::Encoder<
11254                '_,
11255                fidl::encoding::DefaultFuchsiaResourceDialect,
11256            >,
11257            offset: usize,
11258            mut depth: fidl::encoding::Depth,
11259        ) -> fidl::Result<()> {
11260            encoder.debug_check_bounds::<GetNextFrameArgs>(offset);
11261            // Vector header
11262            let max_ordinal: u64 = self.max_ordinal_present();
11263            encoder.write_num(max_ordinal, offset);
11264            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
11265            // Calling encoder.out_of_line_offset(0) is not allowed.
11266            if max_ordinal == 0 {
11267                return Ok(());
11268            }
11269            depth.increment()?;
11270            let envelope_size = 8;
11271            let bytes_len = max_ordinal as usize * envelope_size;
11272            #[allow(unused_variables)]
11273            let offset = encoder.out_of_line_offset(bytes_len);
11274            let mut _prev_end_offset: usize = 0;
11275            if 1 > max_ordinal {
11276                return Ok(());
11277            }
11278
11279            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11280            // are envelope_size bytes.
11281            let cur_offset: usize = (1 - 1) * envelope_size;
11282
11283            // Zero reserved fields.
11284            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11285
11286            // Safety:
11287            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11288            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11289            //   envelope_size bytes, there is always sufficient room.
11290            fidl::encoding::encode_in_envelope_optional::<
11291                fidl::encoding::HandleType<
11292                    fidl::Event,
11293                    { fidl::ObjectType::EVENT.into_raw() },
11294                    2147483648,
11295                >,
11296                fidl::encoding::DefaultFuchsiaResourceDialect,
11297            >(
11298                self.event.as_mut().map(
11299                    <fidl::encoding::HandleType<
11300                        fidl::Event,
11301                        { fidl::ObjectType::EVENT.into_raw() },
11302                        2147483648,
11303                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
11304                ),
11305                encoder,
11306                offset + cur_offset,
11307                depth,
11308            )?;
11309
11310            _prev_end_offset = cur_offset + envelope_size;
11311
11312            Ok(())
11313        }
11314    }
11315
11316    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11317        for GetNextFrameArgs
11318    {
11319        #[inline(always)]
11320        fn new_empty() -> Self {
11321            Self::default()
11322        }
11323
11324        unsafe fn decode(
11325            &mut self,
11326            decoder: &mut fidl::encoding::Decoder<
11327                '_,
11328                fidl::encoding::DefaultFuchsiaResourceDialect,
11329            >,
11330            offset: usize,
11331            mut depth: fidl::encoding::Depth,
11332        ) -> fidl::Result<()> {
11333            decoder.debug_check_bounds::<Self>(offset);
11334            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
11335                None => return Err(fidl::Error::NotNullable),
11336                Some(len) => len,
11337            };
11338            // Calling decoder.out_of_line_offset(0) is not allowed.
11339            if len == 0 {
11340                return Ok(());
11341            };
11342            depth.increment()?;
11343            let envelope_size = 8;
11344            let bytes_len = len * envelope_size;
11345            let offset = decoder.out_of_line_offset(bytes_len)?;
11346            // Decode the envelope for each type.
11347            let mut _next_ordinal_to_read = 0;
11348            let mut next_offset = offset;
11349            let end_offset = offset + bytes_len;
11350            _next_ordinal_to_read += 1;
11351            if next_offset >= end_offset {
11352                return Ok(());
11353            }
11354
11355            // Decode unknown envelopes for gaps in ordinals.
11356            while _next_ordinal_to_read < 1 {
11357                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11358                _next_ordinal_to_read += 1;
11359                next_offset += envelope_size;
11360            }
11361
11362            let next_out_of_line = decoder.next_out_of_line();
11363            let handles_before = decoder.remaining_handles();
11364            if let Some((inlined, num_bytes, num_handles)) =
11365                fidl::encoding::decode_envelope_header(decoder, next_offset)?
11366            {
11367                let member_inline_size = <fidl::encoding::HandleType<
11368                    fidl::Event,
11369                    { fidl::ObjectType::EVENT.into_raw() },
11370                    2147483648,
11371                > as fidl::encoding::TypeMarker>::inline_size(
11372                    decoder.context
11373                );
11374                if inlined != (member_inline_size <= 4) {
11375                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
11376                }
11377                let inner_offset;
11378                let mut inner_depth = depth.clone();
11379                if inlined {
11380                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11381                    inner_offset = next_offset;
11382                } else {
11383                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11384                    inner_depth.increment()?;
11385                }
11386                let val_ref =
11387                self.event.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
11388                fidl::decode!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
11389                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11390                {
11391                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
11392                }
11393                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11394                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11395                }
11396            }
11397
11398            next_offset += envelope_size;
11399
11400            // Decode the remaining unknown envelopes.
11401            while next_offset < end_offset {
11402                _next_ordinal_to_read += 1;
11403                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11404                next_offset += envelope_size;
11405            }
11406
11407            Ok(())
11408        }
11409    }
11410
11411    impl PresentArgs {
11412        #[inline(always)]
11413        fn max_ordinal_present(&self) -> u64 {
11414            if let Some(_) = self.release_counters {
11415                return 8;
11416            }
11417            if let Some(_) = self.present_fences {
11418                return 7;
11419            }
11420            if let Some(_) = self.unsquashable {
11421                return 4;
11422            }
11423            if let Some(_) = self.release_fences {
11424                return 3;
11425            }
11426            if let Some(_) = self.acquire_fences {
11427                return 2;
11428            }
11429            if let Some(_) = self.requested_presentation_time {
11430                return 1;
11431            }
11432            0
11433        }
11434    }
11435
11436    impl fidl::encoding::ResourceTypeMarker for PresentArgs {
11437        type Borrowed<'a> = &'a mut Self;
11438        fn take_or_borrow<'a>(
11439            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11440        ) -> Self::Borrowed<'a> {
11441            value
11442        }
11443    }
11444
11445    unsafe impl fidl::encoding::TypeMarker for PresentArgs {
11446        type Owned = Self;
11447
11448        #[inline(always)]
11449        fn inline_align(_context: fidl::encoding::Context) -> usize {
11450            8
11451        }
11452
11453        #[inline(always)]
11454        fn inline_size(_context: fidl::encoding::Context) -> usize {
11455            16
11456        }
11457    }
11458
11459    unsafe impl fidl::encoding::Encode<PresentArgs, fidl::encoding::DefaultFuchsiaResourceDialect>
11460        for &mut PresentArgs
11461    {
11462        unsafe fn encode(
11463            self,
11464            encoder: &mut fidl::encoding::Encoder<
11465                '_,
11466                fidl::encoding::DefaultFuchsiaResourceDialect,
11467            >,
11468            offset: usize,
11469            mut depth: fidl::encoding::Depth,
11470        ) -> fidl::Result<()> {
11471            encoder.debug_check_bounds::<PresentArgs>(offset);
11472            // Vector header
11473            let max_ordinal: u64 = self.max_ordinal_present();
11474            encoder.write_num(max_ordinal, offset);
11475            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
11476            // Calling encoder.out_of_line_offset(0) is not allowed.
11477            if max_ordinal == 0 {
11478                return Ok(());
11479            }
11480            depth.increment()?;
11481            let envelope_size = 8;
11482            let bytes_len = max_ordinal as usize * envelope_size;
11483            #[allow(unused_variables)]
11484            let offset = encoder.out_of_line_offset(bytes_len);
11485            let mut _prev_end_offset: usize = 0;
11486            if 1 > max_ordinal {
11487                return Ok(());
11488            }
11489
11490            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11491            // are envelope_size bytes.
11492            let cur_offset: usize = (1 - 1) * envelope_size;
11493
11494            // Zero reserved fields.
11495            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11496
11497            // Safety:
11498            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11499            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11500            //   envelope_size bytes, there is always sufficient room.
11501            fidl::encoding::encode_in_envelope_optional::<
11502                i64,
11503                fidl::encoding::DefaultFuchsiaResourceDialect,
11504            >(
11505                self.requested_presentation_time
11506                    .as_ref()
11507                    .map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
11508                encoder,
11509                offset + cur_offset,
11510                depth,
11511            )?;
11512
11513            _prev_end_offset = cur_offset + envelope_size;
11514            if 2 > max_ordinal {
11515                return Ok(());
11516            }
11517
11518            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11519            // are envelope_size bytes.
11520            let cur_offset: usize = (2 - 1) * envelope_size;
11521
11522            // Zero reserved fields.
11523            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11524
11525            // Safety:
11526            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11527            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11528            //   envelope_size bytes, there is always sufficient room.
11529            fidl::encoding::encode_in_envelope_optional::<
11530                fidl::encoding::Vector<
11531                    fidl::encoding::HandleType<
11532                        fidl::Event,
11533                        { fidl::ObjectType::EVENT.into_raw() },
11534                        2147483648,
11535                    >,
11536                    16,
11537                >,
11538                fidl::encoding::DefaultFuchsiaResourceDialect,
11539            >(
11540                self.acquire_fences.as_mut().map(
11541                    <fidl::encoding::Vector<
11542                        fidl::encoding::HandleType<
11543                            fidl::Event,
11544                            { fidl::ObjectType::EVENT.into_raw() },
11545                            2147483648,
11546                        >,
11547                        16,
11548                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
11549                ),
11550                encoder,
11551                offset + cur_offset,
11552                depth,
11553            )?;
11554
11555            _prev_end_offset = cur_offset + envelope_size;
11556            if 3 > max_ordinal {
11557                return Ok(());
11558            }
11559
11560            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11561            // are envelope_size bytes.
11562            let cur_offset: usize = (3 - 1) * envelope_size;
11563
11564            // Zero reserved fields.
11565            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11566
11567            // Safety:
11568            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11569            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11570            //   envelope_size bytes, there is always sufficient room.
11571            fidl::encoding::encode_in_envelope_optional::<
11572                fidl::encoding::Vector<
11573                    fidl::encoding::HandleType<
11574                        fidl::Event,
11575                        { fidl::ObjectType::EVENT.into_raw() },
11576                        2147483648,
11577                    >,
11578                    16,
11579                >,
11580                fidl::encoding::DefaultFuchsiaResourceDialect,
11581            >(
11582                self.release_fences.as_mut().map(
11583                    <fidl::encoding::Vector<
11584                        fidl::encoding::HandleType<
11585                            fidl::Event,
11586                            { fidl::ObjectType::EVENT.into_raw() },
11587                            2147483648,
11588                        >,
11589                        16,
11590                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
11591                ),
11592                encoder,
11593                offset + cur_offset,
11594                depth,
11595            )?;
11596
11597            _prev_end_offset = cur_offset + envelope_size;
11598            if 4 > max_ordinal {
11599                return Ok(());
11600            }
11601
11602            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11603            // are envelope_size bytes.
11604            let cur_offset: usize = (4 - 1) * envelope_size;
11605
11606            // Zero reserved fields.
11607            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11608
11609            // Safety:
11610            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11611            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11612            //   envelope_size bytes, there is always sufficient room.
11613            fidl::encoding::encode_in_envelope_optional::<
11614                bool,
11615                fidl::encoding::DefaultFuchsiaResourceDialect,
11616            >(
11617                self.unsquashable.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
11618                encoder,
11619                offset + cur_offset,
11620                depth,
11621            )?;
11622
11623            _prev_end_offset = cur_offset + envelope_size;
11624            if 7 > max_ordinal {
11625                return Ok(());
11626            }
11627
11628            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11629            // are envelope_size bytes.
11630            let cur_offset: usize = (7 - 1) * envelope_size;
11631
11632            // Zero reserved fields.
11633            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11634
11635            // Safety:
11636            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11637            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11638            //   envelope_size bytes, there is always sufficient room.
11639            fidl::encoding::encode_in_envelope_optional::<
11640                fidl::encoding::Vector<
11641                    fidl::encoding::HandleType<
11642                        fidl::Counter,
11643                        { fidl::ObjectType::COUNTER.into_raw() },
11644                        2147483648,
11645                    >,
11646                    16,
11647                >,
11648                fidl::encoding::DefaultFuchsiaResourceDialect,
11649            >(
11650                self.present_fences.as_mut().map(
11651                    <fidl::encoding::Vector<
11652                        fidl::encoding::HandleType<
11653                            fidl::Counter,
11654                            { fidl::ObjectType::COUNTER.into_raw() },
11655                            2147483648,
11656                        >,
11657                        16,
11658                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
11659                ),
11660                encoder,
11661                offset + cur_offset,
11662                depth,
11663            )?;
11664
11665            _prev_end_offset = cur_offset + envelope_size;
11666            if 8 > max_ordinal {
11667                return Ok(());
11668            }
11669
11670            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11671            // are envelope_size bytes.
11672            let cur_offset: usize = (8 - 1) * envelope_size;
11673
11674            // Zero reserved fields.
11675            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11676
11677            // Safety:
11678            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11679            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11680            //   envelope_size bytes, there is always sufficient room.
11681            fidl::encoding::encode_in_envelope_optional::<
11682                fidl::encoding::Vector<
11683                    fidl::encoding::HandleType<
11684                        fidl::Counter,
11685                        { fidl::ObjectType::COUNTER.into_raw() },
11686                        2147483648,
11687                    >,
11688                    16,
11689                >,
11690                fidl::encoding::DefaultFuchsiaResourceDialect,
11691            >(
11692                self.release_counters.as_mut().map(
11693                    <fidl::encoding::Vector<
11694                        fidl::encoding::HandleType<
11695                            fidl::Counter,
11696                            { fidl::ObjectType::COUNTER.into_raw() },
11697                            2147483648,
11698                        >,
11699                        16,
11700                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
11701                ),
11702                encoder,
11703                offset + cur_offset,
11704                depth,
11705            )?;
11706
11707            _prev_end_offset = cur_offset + envelope_size;
11708
11709            Ok(())
11710        }
11711    }
11712
11713    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for PresentArgs {
11714        #[inline(always)]
11715        fn new_empty() -> Self {
11716            Self::default()
11717        }
11718
11719        unsafe fn decode(
11720            &mut self,
11721            decoder: &mut fidl::encoding::Decoder<
11722                '_,
11723                fidl::encoding::DefaultFuchsiaResourceDialect,
11724            >,
11725            offset: usize,
11726            mut depth: fidl::encoding::Depth,
11727        ) -> fidl::Result<()> {
11728            decoder.debug_check_bounds::<Self>(offset);
11729            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
11730                None => return Err(fidl::Error::NotNullable),
11731                Some(len) => len,
11732            };
11733            // Calling decoder.out_of_line_offset(0) is not allowed.
11734            if len == 0 {
11735                return Ok(());
11736            };
11737            depth.increment()?;
11738            let envelope_size = 8;
11739            let bytes_len = len * envelope_size;
11740            let offset = decoder.out_of_line_offset(bytes_len)?;
11741            // Decode the envelope for each type.
11742            let mut _next_ordinal_to_read = 0;
11743            let mut next_offset = offset;
11744            let end_offset = offset + bytes_len;
11745            _next_ordinal_to_read += 1;
11746            if next_offset >= end_offset {
11747                return Ok(());
11748            }
11749
11750            // Decode unknown envelopes for gaps in ordinals.
11751            while _next_ordinal_to_read < 1 {
11752                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11753                _next_ordinal_to_read += 1;
11754                next_offset += envelope_size;
11755            }
11756
11757            let next_out_of_line = decoder.next_out_of_line();
11758            let handles_before = decoder.remaining_handles();
11759            if let Some((inlined, num_bytes, num_handles)) =
11760                fidl::encoding::decode_envelope_header(decoder, next_offset)?
11761            {
11762                let member_inline_size =
11763                    <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
11764                if inlined != (member_inline_size <= 4) {
11765                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
11766                }
11767                let inner_offset;
11768                let mut inner_depth = depth.clone();
11769                if inlined {
11770                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11771                    inner_offset = next_offset;
11772                } else {
11773                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11774                    inner_depth.increment()?;
11775                }
11776                let val_ref = self.requested_presentation_time.get_or_insert_with(|| {
11777                    fidl::new_empty!(i64, fidl::encoding::DefaultFuchsiaResourceDialect)
11778                });
11779                fidl::decode!(
11780                    i64,
11781                    fidl::encoding::DefaultFuchsiaResourceDialect,
11782                    val_ref,
11783                    decoder,
11784                    inner_offset,
11785                    inner_depth
11786                )?;
11787                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11788                {
11789                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
11790                }
11791                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11792                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11793                }
11794            }
11795
11796            next_offset += envelope_size;
11797            _next_ordinal_to_read += 1;
11798            if next_offset >= end_offset {
11799                return Ok(());
11800            }
11801
11802            // Decode unknown envelopes for gaps in ordinals.
11803            while _next_ordinal_to_read < 2 {
11804                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11805                _next_ordinal_to_read += 1;
11806                next_offset += envelope_size;
11807            }
11808
11809            let next_out_of_line = decoder.next_out_of_line();
11810            let handles_before = decoder.remaining_handles();
11811            if let Some((inlined, num_bytes, num_handles)) =
11812                fidl::encoding::decode_envelope_header(decoder, next_offset)?
11813            {
11814                let member_inline_size = <fidl::encoding::Vector<
11815                    fidl::encoding::HandleType<
11816                        fidl::Event,
11817                        { fidl::ObjectType::EVENT.into_raw() },
11818                        2147483648,
11819                    >,
11820                    16,
11821                > as fidl::encoding::TypeMarker>::inline_size(
11822                    decoder.context
11823                );
11824                if inlined != (member_inline_size <= 4) {
11825                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
11826                }
11827                let inner_offset;
11828                let mut inner_depth = depth.clone();
11829                if inlined {
11830                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11831                    inner_offset = next_offset;
11832                } else {
11833                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11834                    inner_depth.increment()?;
11835                }
11836                let val_ref = self.acquire_fences.get_or_insert_with(|| {
11837                    fidl::new_empty!(
11838                        fidl::encoding::Vector<
11839                            fidl::encoding::HandleType<
11840                                fidl::Event,
11841                                { fidl::ObjectType::EVENT.into_raw() },
11842                                2147483648,
11843                            >,
11844                            16,
11845                        >,
11846                        fidl::encoding::DefaultFuchsiaResourceDialect
11847                    )
11848                });
11849                fidl::decode!(
11850                    fidl::encoding::Vector<
11851                        fidl::encoding::HandleType<
11852                            fidl::Event,
11853                            { fidl::ObjectType::EVENT.into_raw() },
11854                            2147483648,
11855                        >,
11856                        16,
11857                    >,
11858                    fidl::encoding::DefaultFuchsiaResourceDialect,
11859                    val_ref,
11860                    decoder,
11861                    inner_offset,
11862                    inner_depth
11863                )?;
11864                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11865                {
11866                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
11867                }
11868                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11869                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11870                }
11871            }
11872
11873            next_offset += envelope_size;
11874            _next_ordinal_to_read += 1;
11875            if next_offset >= end_offset {
11876                return Ok(());
11877            }
11878
11879            // Decode unknown envelopes for gaps in ordinals.
11880            while _next_ordinal_to_read < 3 {
11881                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11882                _next_ordinal_to_read += 1;
11883                next_offset += envelope_size;
11884            }
11885
11886            let next_out_of_line = decoder.next_out_of_line();
11887            let handles_before = decoder.remaining_handles();
11888            if let Some((inlined, num_bytes, num_handles)) =
11889                fidl::encoding::decode_envelope_header(decoder, next_offset)?
11890            {
11891                let member_inline_size = <fidl::encoding::Vector<
11892                    fidl::encoding::HandleType<
11893                        fidl::Event,
11894                        { fidl::ObjectType::EVENT.into_raw() },
11895                        2147483648,
11896                    >,
11897                    16,
11898                > as fidl::encoding::TypeMarker>::inline_size(
11899                    decoder.context
11900                );
11901                if inlined != (member_inline_size <= 4) {
11902                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
11903                }
11904                let inner_offset;
11905                let mut inner_depth = depth.clone();
11906                if inlined {
11907                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11908                    inner_offset = next_offset;
11909                } else {
11910                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11911                    inner_depth.increment()?;
11912                }
11913                let val_ref = self.release_fences.get_or_insert_with(|| {
11914                    fidl::new_empty!(
11915                        fidl::encoding::Vector<
11916                            fidl::encoding::HandleType<
11917                                fidl::Event,
11918                                { fidl::ObjectType::EVENT.into_raw() },
11919                                2147483648,
11920                            >,
11921                            16,
11922                        >,
11923                        fidl::encoding::DefaultFuchsiaResourceDialect
11924                    )
11925                });
11926                fidl::decode!(
11927                    fidl::encoding::Vector<
11928                        fidl::encoding::HandleType<
11929                            fidl::Event,
11930                            { fidl::ObjectType::EVENT.into_raw() },
11931                            2147483648,
11932                        >,
11933                        16,
11934                    >,
11935                    fidl::encoding::DefaultFuchsiaResourceDialect,
11936                    val_ref,
11937                    decoder,
11938                    inner_offset,
11939                    inner_depth
11940                )?;
11941                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11942                {
11943                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
11944                }
11945                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11946                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11947                }
11948            }
11949
11950            next_offset += envelope_size;
11951            _next_ordinal_to_read += 1;
11952            if next_offset >= end_offset {
11953                return Ok(());
11954            }
11955
11956            // Decode unknown envelopes for gaps in ordinals.
11957            while _next_ordinal_to_read < 4 {
11958                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11959                _next_ordinal_to_read += 1;
11960                next_offset += envelope_size;
11961            }
11962
11963            let next_out_of_line = decoder.next_out_of_line();
11964            let handles_before = decoder.remaining_handles();
11965            if let Some((inlined, num_bytes, num_handles)) =
11966                fidl::encoding::decode_envelope_header(decoder, next_offset)?
11967            {
11968                let member_inline_size =
11969                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
11970                if inlined != (member_inline_size <= 4) {
11971                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
11972                }
11973                let inner_offset;
11974                let mut inner_depth = depth.clone();
11975                if inlined {
11976                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11977                    inner_offset = next_offset;
11978                } else {
11979                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11980                    inner_depth.increment()?;
11981                }
11982                let val_ref = self.unsquashable.get_or_insert_with(|| {
11983                    fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
11984                });
11985                fidl::decode!(
11986                    bool,
11987                    fidl::encoding::DefaultFuchsiaResourceDialect,
11988                    val_ref,
11989                    decoder,
11990                    inner_offset,
11991                    inner_depth
11992                )?;
11993                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11994                {
11995                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
11996                }
11997                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11998                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11999                }
12000            }
12001
12002            next_offset += envelope_size;
12003            _next_ordinal_to_read += 1;
12004            if next_offset >= end_offset {
12005                return Ok(());
12006            }
12007
12008            // Decode unknown envelopes for gaps in ordinals.
12009            while _next_ordinal_to_read < 7 {
12010                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12011                _next_ordinal_to_read += 1;
12012                next_offset += envelope_size;
12013            }
12014
12015            let next_out_of_line = decoder.next_out_of_line();
12016            let handles_before = decoder.remaining_handles();
12017            if let Some((inlined, num_bytes, num_handles)) =
12018                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12019            {
12020                let member_inline_size = <fidl::encoding::Vector<
12021                    fidl::encoding::HandleType<
12022                        fidl::Counter,
12023                        { fidl::ObjectType::COUNTER.into_raw() },
12024                        2147483648,
12025                    >,
12026                    16,
12027                > as fidl::encoding::TypeMarker>::inline_size(
12028                    decoder.context
12029                );
12030                if inlined != (member_inline_size <= 4) {
12031                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12032                }
12033                let inner_offset;
12034                let mut inner_depth = depth.clone();
12035                if inlined {
12036                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12037                    inner_offset = next_offset;
12038                } else {
12039                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12040                    inner_depth.increment()?;
12041                }
12042                let val_ref = self.present_fences.get_or_insert_with(|| {
12043                    fidl::new_empty!(
12044                        fidl::encoding::Vector<
12045                            fidl::encoding::HandleType<
12046                                fidl::Counter,
12047                                { fidl::ObjectType::COUNTER.into_raw() },
12048                                2147483648,
12049                            >,
12050                            16,
12051                        >,
12052                        fidl::encoding::DefaultFuchsiaResourceDialect
12053                    )
12054                });
12055                fidl::decode!(
12056                    fidl::encoding::Vector<
12057                        fidl::encoding::HandleType<
12058                            fidl::Counter,
12059                            { fidl::ObjectType::COUNTER.into_raw() },
12060                            2147483648,
12061                        >,
12062                        16,
12063                    >,
12064                    fidl::encoding::DefaultFuchsiaResourceDialect,
12065                    val_ref,
12066                    decoder,
12067                    inner_offset,
12068                    inner_depth
12069                )?;
12070                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12071                {
12072                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12073                }
12074                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12075                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12076                }
12077            }
12078
12079            next_offset += envelope_size;
12080            _next_ordinal_to_read += 1;
12081            if next_offset >= end_offset {
12082                return Ok(());
12083            }
12084
12085            // Decode unknown envelopes for gaps in ordinals.
12086            while _next_ordinal_to_read < 8 {
12087                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12088                _next_ordinal_to_read += 1;
12089                next_offset += envelope_size;
12090            }
12091
12092            let next_out_of_line = decoder.next_out_of_line();
12093            let handles_before = decoder.remaining_handles();
12094            if let Some((inlined, num_bytes, num_handles)) =
12095                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12096            {
12097                let member_inline_size = <fidl::encoding::Vector<
12098                    fidl::encoding::HandleType<
12099                        fidl::Counter,
12100                        { fidl::ObjectType::COUNTER.into_raw() },
12101                        2147483648,
12102                    >,
12103                    16,
12104                > as fidl::encoding::TypeMarker>::inline_size(
12105                    decoder.context
12106                );
12107                if inlined != (member_inline_size <= 4) {
12108                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12109                }
12110                let inner_offset;
12111                let mut inner_depth = depth.clone();
12112                if inlined {
12113                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12114                    inner_offset = next_offset;
12115                } else {
12116                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12117                    inner_depth.increment()?;
12118                }
12119                let val_ref = self.release_counters.get_or_insert_with(|| {
12120                    fidl::new_empty!(
12121                        fidl::encoding::Vector<
12122                            fidl::encoding::HandleType<
12123                                fidl::Counter,
12124                                { fidl::ObjectType::COUNTER.into_raw() },
12125                                2147483648,
12126                            >,
12127                            16,
12128                        >,
12129                        fidl::encoding::DefaultFuchsiaResourceDialect
12130                    )
12131                });
12132                fidl::decode!(
12133                    fidl::encoding::Vector<
12134                        fidl::encoding::HandleType<
12135                            fidl::Counter,
12136                            { fidl::ObjectType::COUNTER.into_raw() },
12137                            2147483648,
12138                        >,
12139                        16,
12140                    >,
12141                    fidl::encoding::DefaultFuchsiaResourceDialect,
12142                    val_ref,
12143                    decoder,
12144                    inner_offset,
12145                    inner_depth
12146                )?;
12147                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12148                {
12149                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12150                }
12151                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12152                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12153                }
12154            }
12155
12156            next_offset += envelope_size;
12157
12158            // Decode the remaining unknown envelopes.
12159            while next_offset < end_offset {
12160                _next_ordinal_to_read += 1;
12161                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12162                next_offset += envelope_size;
12163            }
12164
12165            Ok(())
12166        }
12167    }
12168
12169    impl RegisterBufferCollectionArgs {
12170        #[inline(always)]
12171        fn max_ordinal_present(&self) -> u64 {
12172            if let Some(_) = self.buffer_collection_token2 {
12173                return 5;
12174            }
12175            if let Some(_) = self.usages {
12176                return 4;
12177            }
12178            if let Some(_) = self.usage {
12179                return 3;
12180            }
12181            if let Some(_) = self.buffer_collection_token {
12182                return 2;
12183            }
12184            if let Some(_) = self.export_token {
12185                return 1;
12186            }
12187            0
12188        }
12189    }
12190
12191    impl fidl::encoding::ResourceTypeMarker for RegisterBufferCollectionArgs {
12192        type Borrowed<'a> = &'a mut Self;
12193        fn take_or_borrow<'a>(
12194            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12195        ) -> Self::Borrowed<'a> {
12196            value
12197        }
12198    }
12199
12200    unsafe impl fidl::encoding::TypeMarker for RegisterBufferCollectionArgs {
12201        type Owned = Self;
12202
12203        #[inline(always)]
12204        fn inline_align(_context: fidl::encoding::Context) -> usize {
12205            8
12206        }
12207
12208        #[inline(always)]
12209        fn inline_size(_context: fidl::encoding::Context) -> usize {
12210            16
12211        }
12212    }
12213
12214    unsafe impl
12215        fidl::encoding::Encode<
12216            RegisterBufferCollectionArgs,
12217            fidl::encoding::DefaultFuchsiaResourceDialect,
12218        > for &mut RegisterBufferCollectionArgs
12219    {
12220        unsafe fn encode(
12221            self,
12222            encoder: &mut fidl::encoding::Encoder<
12223                '_,
12224                fidl::encoding::DefaultFuchsiaResourceDialect,
12225            >,
12226            offset: usize,
12227            mut depth: fidl::encoding::Depth,
12228        ) -> fidl::Result<()> {
12229            encoder.debug_check_bounds::<RegisterBufferCollectionArgs>(offset);
12230            // Vector header
12231            let max_ordinal: u64 = self.max_ordinal_present();
12232            encoder.write_num(max_ordinal, offset);
12233            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
12234            // Calling encoder.out_of_line_offset(0) is not allowed.
12235            if max_ordinal == 0 {
12236                return Ok(());
12237            }
12238            depth.increment()?;
12239            let envelope_size = 8;
12240            let bytes_len = max_ordinal as usize * envelope_size;
12241            #[allow(unused_variables)]
12242            let offset = encoder.out_of_line_offset(bytes_len);
12243            let mut _prev_end_offset: usize = 0;
12244            if 1 > max_ordinal {
12245                return Ok(());
12246            }
12247
12248            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12249            // are envelope_size bytes.
12250            let cur_offset: usize = (1 - 1) * envelope_size;
12251
12252            // Zero reserved fields.
12253            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12254
12255            // Safety:
12256            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12257            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12258            //   envelope_size bytes, there is always sufficient room.
12259            fidl::encoding::encode_in_envelope_optional::<BufferCollectionExportToken, fidl::encoding::DefaultFuchsiaResourceDialect>(
12260            self.export_token.as_mut().map(<BufferCollectionExportToken as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
12261            encoder, offset + cur_offset, depth
12262        )?;
12263
12264            _prev_end_offset = cur_offset + envelope_size;
12265            if 2 > max_ordinal {
12266                return Ok(());
12267            }
12268
12269            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12270            // are envelope_size bytes.
12271            let cur_offset: usize = (2 - 1) * envelope_size;
12272
12273            // Zero reserved fields.
12274            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12275
12276            // Safety:
12277            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12278            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12279            //   envelope_size bytes, there is always sufficient room.
12280            fidl::encoding::encode_in_envelope_optional::<
12281                fidl::encoding::Endpoint<
12282                    fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem::BufferCollectionTokenMarker>,
12283                >,
12284                fidl::encoding::DefaultFuchsiaResourceDialect,
12285            >(
12286                self.buffer_collection_token.as_mut().map(
12287                    <fidl::encoding::Endpoint<
12288                        fidl::endpoints::ClientEnd<
12289                            fidl_fuchsia_sysmem::BufferCollectionTokenMarker,
12290                        >,
12291                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
12292                ),
12293                encoder,
12294                offset + cur_offset,
12295                depth,
12296            )?;
12297
12298            _prev_end_offset = cur_offset + envelope_size;
12299            if 3 > max_ordinal {
12300                return Ok(());
12301            }
12302
12303            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12304            // are envelope_size bytes.
12305            let cur_offset: usize = (3 - 1) * envelope_size;
12306
12307            // Zero reserved fields.
12308            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12309
12310            // Safety:
12311            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12312            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12313            //   envelope_size bytes, there is always sufficient room.
12314            fidl::encoding::encode_in_envelope_optional::<
12315                RegisterBufferCollectionUsage,
12316                fidl::encoding::DefaultFuchsiaResourceDialect,
12317            >(
12318                self.usage.as_ref().map(
12319                    <RegisterBufferCollectionUsage as fidl::encoding::ValueTypeMarker>::borrow,
12320                ),
12321                encoder,
12322                offset + cur_offset,
12323                depth,
12324            )?;
12325
12326            _prev_end_offset = cur_offset + envelope_size;
12327            if 4 > max_ordinal {
12328                return Ok(());
12329            }
12330
12331            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12332            // are envelope_size bytes.
12333            let cur_offset: usize = (4 - 1) * envelope_size;
12334
12335            // Zero reserved fields.
12336            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12337
12338            // Safety:
12339            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12340            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12341            //   envelope_size bytes, there is always sufficient room.
12342            fidl::encoding::encode_in_envelope_optional::<
12343                RegisterBufferCollectionUsages,
12344                fidl::encoding::DefaultFuchsiaResourceDialect,
12345            >(
12346                self.usages.as_ref().map(
12347                    <RegisterBufferCollectionUsages as fidl::encoding::ValueTypeMarker>::borrow,
12348                ),
12349                encoder,
12350                offset + cur_offset,
12351                depth,
12352            )?;
12353
12354            _prev_end_offset = cur_offset + envelope_size;
12355            if 5 > max_ordinal {
12356                return Ok(());
12357            }
12358
12359            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12360            // are envelope_size bytes.
12361            let cur_offset: usize = (5 - 1) * envelope_size;
12362
12363            // Zero reserved fields.
12364            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12365
12366            // Safety:
12367            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12368            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12369            //   envelope_size bytes, there is always sufficient room.
12370            fidl::encoding::encode_in_envelope_optional::<
12371                fidl::encoding::Endpoint<
12372                    fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem2::BufferCollectionTokenMarker>,
12373                >,
12374                fidl::encoding::DefaultFuchsiaResourceDialect,
12375            >(
12376                self.buffer_collection_token2.as_mut().map(
12377                    <fidl::encoding::Endpoint<
12378                        fidl::endpoints::ClientEnd<
12379                            fidl_fuchsia_sysmem2::BufferCollectionTokenMarker,
12380                        >,
12381                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
12382                ),
12383                encoder,
12384                offset + cur_offset,
12385                depth,
12386            )?;
12387
12388            _prev_end_offset = cur_offset + envelope_size;
12389
12390            Ok(())
12391        }
12392    }
12393
12394    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
12395        for RegisterBufferCollectionArgs
12396    {
12397        #[inline(always)]
12398        fn new_empty() -> Self {
12399            Self::default()
12400        }
12401
12402        unsafe fn decode(
12403            &mut self,
12404            decoder: &mut fidl::encoding::Decoder<
12405                '_,
12406                fidl::encoding::DefaultFuchsiaResourceDialect,
12407            >,
12408            offset: usize,
12409            mut depth: fidl::encoding::Depth,
12410        ) -> fidl::Result<()> {
12411            decoder.debug_check_bounds::<Self>(offset);
12412            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
12413                None => return Err(fidl::Error::NotNullable),
12414                Some(len) => len,
12415            };
12416            // Calling decoder.out_of_line_offset(0) is not allowed.
12417            if len == 0 {
12418                return Ok(());
12419            };
12420            depth.increment()?;
12421            let envelope_size = 8;
12422            let bytes_len = len * envelope_size;
12423            let offset = decoder.out_of_line_offset(bytes_len)?;
12424            // Decode the envelope for each type.
12425            let mut _next_ordinal_to_read = 0;
12426            let mut next_offset = offset;
12427            let end_offset = offset + bytes_len;
12428            _next_ordinal_to_read += 1;
12429            if next_offset >= end_offset {
12430                return Ok(());
12431            }
12432
12433            // Decode unknown envelopes for gaps in ordinals.
12434            while _next_ordinal_to_read < 1 {
12435                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12436                _next_ordinal_to_read += 1;
12437                next_offset += envelope_size;
12438            }
12439
12440            let next_out_of_line = decoder.next_out_of_line();
12441            let handles_before = decoder.remaining_handles();
12442            if let Some((inlined, num_bytes, num_handles)) =
12443                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12444            {
12445                let member_inline_size =
12446                    <BufferCollectionExportToken as fidl::encoding::TypeMarker>::inline_size(
12447                        decoder.context,
12448                    );
12449                if inlined != (member_inline_size <= 4) {
12450                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12451                }
12452                let inner_offset;
12453                let mut inner_depth = depth.clone();
12454                if inlined {
12455                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12456                    inner_offset = next_offset;
12457                } else {
12458                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12459                    inner_depth.increment()?;
12460                }
12461                let val_ref = self.export_token.get_or_insert_with(|| {
12462                    fidl::new_empty!(
12463                        BufferCollectionExportToken,
12464                        fidl::encoding::DefaultFuchsiaResourceDialect
12465                    )
12466                });
12467                fidl::decode!(
12468                    BufferCollectionExportToken,
12469                    fidl::encoding::DefaultFuchsiaResourceDialect,
12470                    val_ref,
12471                    decoder,
12472                    inner_offset,
12473                    inner_depth
12474                )?;
12475                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12476                {
12477                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12478                }
12479                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12480                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12481                }
12482            }
12483
12484            next_offset += envelope_size;
12485            _next_ordinal_to_read += 1;
12486            if next_offset >= end_offset {
12487                return Ok(());
12488            }
12489
12490            // Decode unknown envelopes for gaps in ordinals.
12491            while _next_ordinal_to_read < 2 {
12492                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12493                _next_ordinal_to_read += 1;
12494                next_offset += envelope_size;
12495            }
12496
12497            let next_out_of_line = decoder.next_out_of_line();
12498            let handles_before = decoder.remaining_handles();
12499            if let Some((inlined, num_bytes, num_handles)) =
12500                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12501            {
12502                let member_inline_size = <fidl::encoding::Endpoint<
12503                    fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem::BufferCollectionTokenMarker>,
12504                > as fidl::encoding::TypeMarker>::inline_size(
12505                    decoder.context
12506                );
12507                if inlined != (member_inline_size <= 4) {
12508                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12509                }
12510                let inner_offset;
12511                let mut inner_depth = depth.clone();
12512                if inlined {
12513                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12514                    inner_offset = next_offset;
12515                } else {
12516                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12517                    inner_depth.increment()?;
12518                }
12519                let val_ref = self.buffer_collection_token.get_or_insert_with(|| {
12520                    fidl::new_empty!(
12521                        fidl::encoding::Endpoint<
12522                            fidl::endpoints::ClientEnd<
12523                                fidl_fuchsia_sysmem::BufferCollectionTokenMarker,
12524                            >,
12525                        >,
12526                        fidl::encoding::DefaultFuchsiaResourceDialect
12527                    )
12528                });
12529                fidl::decode!(
12530                    fidl::encoding::Endpoint<
12531                        fidl::endpoints::ClientEnd<
12532                            fidl_fuchsia_sysmem::BufferCollectionTokenMarker,
12533                        >,
12534                    >,
12535                    fidl::encoding::DefaultFuchsiaResourceDialect,
12536                    val_ref,
12537                    decoder,
12538                    inner_offset,
12539                    inner_depth
12540                )?;
12541                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12542                {
12543                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12544                }
12545                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12546                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12547                }
12548            }
12549
12550            next_offset += envelope_size;
12551            _next_ordinal_to_read += 1;
12552            if next_offset >= end_offset {
12553                return Ok(());
12554            }
12555
12556            // Decode unknown envelopes for gaps in ordinals.
12557            while _next_ordinal_to_read < 3 {
12558                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12559                _next_ordinal_to_read += 1;
12560                next_offset += envelope_size;
12561            }
12562
12563            let next_out_of_line = decoder.next_out_of_line();
12564            let handles_before = decoder.remaining_handles();
12565            if let Some((inlined, num_bytes, num_handles)) =
12566                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12567            {
12568                let member_inline_size =
12569                    <RegisterBufferCollectionUsage as fidl::encoding::TypeMarker>::inline_size(
12570                        decoder.context,
12571                    );
12572                if inlined != (member_inline_size <= 4) {
12573                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12574                }
12575                let inner_offset;
12576                let mut inner_depth = depth.clone();
12577                if inlined {
12578                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12579                    inner_offset = next_offset;
12580                } else {
12581                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12582                    inner_depth.increment()?;
12583                }
12584                let val_ref = self.usage.get_or_insert_with(|| {
12585                    fidl::new_empty!(
12586                        RegisterBufferCollectionUsage,
12587                        fidl::encoding::DefaultFuchsiaResourceDialect
12588                    )
12589                });
12590                fidl::decode!(
12591                    RegisterBufferCollectionUsage,
12592                    fidl::encoding::DefaultFuchsiaResourceDialect,
12593                    val_ref,
12594                    decoder,
12595                    inner_offset,
12596                    inner_depth
12597                )?;
12598                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12599                {
12600                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12601                }
12602                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12603                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12604                }
12605            }
12606
12607            next_offset += envelope_size;
12608            _next_ordinal_to_read += 1;
12609            if next_offset >= end_offset {
12610                return Ok(());
12611            }
12612
12613            // Decode unknown envelopes for gaps in ordinals.
12614            while _next_ordinal_to_read < 4 {
12615                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12616                _next_ordinal_to_read += 1;
12617                next_offset += envelope_size;
12618            }
12619
12620            let next_out_of_line = decoder.next_out_of_line();
12621            let handles_before = decoder.remaining_handles();
12622            if let Some((inlined, num_bytes, num_handles)) =
12623                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12624            {
12625                let member_inline_size =
12626                    <RegisterBufferCollectionUsages as fidl::encoding::TypeMarker>::inline_size(
12627                        decoder.context,
12628                    );
12629                if inlined != (member_inline_size <= 4) {
12630                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12631                }
12632                let inner_offset;
12633                let mut inner_depth = depth.clone();
12634                if inlined {
12635                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12636                    inner_offset = next_offset;
12637                } else {
12638                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12639                    inner_depth.increment()?;
12640                }
12641                let val_ref = self.usages.get_or_insert_with(|| {
12642                    fidl::new_empty!(
12643                        RegisterBufferCollectionUsages,
12644                        fidl::encoding::DefaultFuchsiaResourceDialect
12645                    )
12646                });
12647                fidl::decode!(
12648                    RegisterBufferCollectionUsages,
12649                    fidl::encoding::DefaultFuchsiaResourceDialect,
12650                    val_ref,
12651                    decoder,
12652                    inner_offset,
12653                    inner_depth
12654                )?;
12655                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12656                {
12657                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12658                }
12659                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12660                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12661                }
12662            }
12663
12664            next_offset += envelope_size;
12665            _next_ordinal_to_read += 1;
12666            if next_offset >= end_offset {
12667                return Ok(());
12668            }
12669
12670            // Decode unknown envelopes for gaps in ordinals.
12671            while _next_ordinal_to_read < 5 {
12672                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12673                _next_ordinal_to_read += 1;
12674                next_offset += envelope_size;
12675            }
12676
12677            let next_out_of_line = decoder.next_out_of_line();
12678            let handles_before = decoder.remaining_handles();
12679            if let Some((inlined, num_bytes, num_handles)) =
12680                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12681            {
12682                let member_inline_size = <fidl::encoding::Endpoint<
12683                    fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem2::BufferCollectionTokenMarker>,
12684                > as fidl::encoding::TypeMarker>::inline_size(
12685                    decoder.context
12686                );
12687                if inlined != (member_inline_size <= 4) {
12688                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12689                }
12690                let inner_offset;
12691                let mut inner_depth = depth.clone();
12692                if inlined {
12693                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12694                    inner_offset = next_offset;
12695                } else {
12696                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12697                    inner_depth.increment()?;
12698                }
12699                let val_ref = self.buffer_collection_token2.get_or_insert_with(|| {
12700                    fidl::new_empty!(
12701                        fidl::encoding::Endpoint<
12702                            fidl::endpoints::ClientEnd<
12703                                fidl_fuchsia_sysmem2::BufferCollectionTokenMarker,
12704                            >,
12705                        >,
12706                        fidl::encoding::DefaultFuchsiaResourceDialect
12707                    )
12708                });
12709                fidl::decode!(
12710                    fidl::encoding::Endpoint<
12711                        fidl::endpoints::ClientEnd<
12712                            fidl_fuchsia_sysmem2::BufferCollectionTokenMarker,
12713                        >,
12714                    >,
12715                    fidl::encoding::DefaultFuchsiaResourceDialect,
12716                    val_ref,
12717                    decoder,
12718                    inner_offset,
12719                    inner_depth
12720                )?;
12721                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12722                {
12723                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12724                }
12725                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12726                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12727                }
12728            }
12729
12730            next_offset += envelope_size;
12731
12732            // Decode the remaining unknown envelopes.
12733            while next_offset < end_offset {
12734                _next_ordinal_to_read += 1;
12735                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12736                next_offset += envelope_size;
12737            }
12738
12739            Ok(())
12740        }
12741    }
12742
12743    impl ScreenCaptureConfig {
12744        #[inline(always)]
12745        fn max_ordinal_present(&self) -> u64 {
12746            if let Some(_) = self.rotation {
12747                return 4;
12748            }
12749            if let Some(_) = self.buffer_count {
12750                return 3;
12751            }
12752            if let Some(_) = self.size {
12753                return 2;
12754            }
12755            if let Some(_) = self.import_token {
12756                return 1;
12757            }
12758            0
12759        }
12760    }
12761
12762    impl fidl::encoding::ResourceTypeMarker for ScreenCaptureConfig {
12763        type Borrowed<'a> = &'a mut Self;
12764        fn take_or_borrow<'a>(
12765            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12766        ) -> Self::Borrowed<'a> {
12767            value
12768        }
12769    }
12770
12771    unsafe impl fidl::encoding::TypeMarker for ScreenCaptureConfig {
12772        type Owned = Self;
12773
12774        #[inline(always)]
12775        fn inline_align(_context: fidl::encoding::Context) -> usize {
12776            8
12777        }
12778
12779        #[inline(always)]
12780        fn inline_size(_context: fidl::encoding::Context) -> usize {
12781            16
12782        }
12783    }
12784
12785    unsafe impl
12786        fidl::encoding::Encode<ScreenCaptureConfig, fidl::encoding::DefaultFuchsiaResourceDialect>
12787        for &mut ScreenCaptureConfig
12788    {
12789        unsafe fn encode(
12790            self,
12791            encoder: &mut fidl::encoding::Encoder<
12792                '_,
12793                fidl::encoding::DefaultFuchsiaResourceDialect,
12794            >,
12795            offset: usize,
12796            mut depth: fidl::encoding::Depth,
12797        ) -> fidl::Result<()> {
12798            encoder.debug_check_bounds::<ScreenCaptureConfig>(offset);
12799            // Vector header
12800            let max_ordinal: u64 = self.max_ordinal_present();
12801            encoder.write_num(max_ordinal, offset);
12802            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
12803            // Calling encoder.out_of_line_offset(0) is not allowed.
12804            if max_ordinal == 0 {
12805                return Ok(());
12806            }
12807            depth.increment()?;
12808            let envelope_size = 8;
12809            let bytes_len = max_ordinal as usize * envelope_size;
12810            #[allow(unused_variables)]
12811            let offset = encoder.out_of_line_offset(bytes_len);
12812            let mut _prev_end_offset: usize = 0;
12813            if 1 > max_ordinal {
12814                return Ok(());
12815            }
12816
12817            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12818            // are envelope_size bytes.
12819            let cur_offset: usize = (1 - 1) * envelope_size;
12820
12821            // Zero reserved fields.
12822            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12823
12824            // Safety:
12825            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12826            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12827            //   envelope_size bytes, there is always sufficient room.
12828            fidl::encoding::encode_in_envelope_optional::<BufferCollectionImportToken, fidl::encoding::DefaultFuchsiaResourceDialect>(
12829            self.import_token.as_mut().map(<BufferCollectionImportToken as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
12830            encoder, offset + cur_offset, depth
12831        )?;
12832
12833            _prev_end_offset = cur_offset + envelope_size;
12834            if 2 > max_ordinal {
12835                return Ok(());
12836            }
12837
12838            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12839            // are envelope_size bytes.
12840            let cur_offset: usize = (2 - 1) * envelope_size;
12841
12842            // Zero reserved fields.
12843            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12844
12845            // Safety:
12846            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12847            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12848            //   envelope_size bytes, there is always sufficient room.
12849            fidl::encoding::encode_in_envelope_optional::<
12850                fidl_fuchsia_math::SizeU,
12851                fidl::encoding::DefaultFuchsiaResourceDialect,
12852            >(
12853                self.size
12854                    .as_ref()
12855                    .map(<fidl_fuchsia_math::SizeU as fidl::encoding::ValueTypeMarker>::borrow),
12856                encoder,
12857                offset + cur_offset,
12858                depth,
12859            )?;
12860
12861            _prev_end_offset = cur_offset + envelope_size;
12862            if 3 > max_ordinal {
12863                return Ok(());
12864            }
12865
12866            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12867            // are envelope_size bytes.
12868            let cur_offset: usize = (3 - 1) * envelope_size;
12869
12870            // Zero reserved fields.
12871            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12872
12873            // Safety:
12874            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12875            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12876            //   envelope_size bytes, there is always sufficient room.
12877            fidl::encoding::encode_in_envelope_optional::<
12878                u32,
12879                fidl::encoding::DefaultFuchsiaResourceDialect,
12880            >(
12881                self.buffer_count.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
12882                encoder,
12883                offset + cur_offset,
12884                depth,
12885            )?;
12886
12887            _prev_end_offset = cur_offset + envelope_size;
12888            if 4 > max_ordinal {
12889                return Ok(());
12890            }
12891
12892            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12893            // are envelope_size bytes.
12894            let cur_offset: usize = (4 - 1) * envelope_size;
12895
12896            // Zero reserved fields.
12897            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12898
12899            // Safety:
12900            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12901            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12902            //   envelope_size bytes, there is always sufficient room.
12903            fidl::encoding::encode_in_envelope_optional::<
12904                Rotation,
12905                fidl::encoding::DefaultFuchsiaResourceDialect,
12906            >(
12907                self.rotation.as_ref().map(<Rotation as fidl::encoding::ValueTypeMarker>::borrow),
12908                encoder,
12909                offset + cur_offset,
12910                depth,
12911            )?;
12912
12913            _prev_end_offset = cur_offset + envelope_size;
12914
12915            Ok(())
12916        }
12917    }
12918
12919    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
12920        for ScreenCaptureConfig
12921    {
12922        #[inline(always)]
12923        fn new_empty() -> Self {
12924            Self::default()
12925        }
12926
12927        unsafe fn decode(
12928            &mut self,
12929            decoder: &mut fidl::encoding::Decoder<
12930                '_,
12931                fidl::encoding::DefaultFuchsiaResourceDialect,
12932            >,
12933            offset: usize,
12934            mut depth: fidl::encoding::Depth,
12935        ) -> fidl::Result<()> {
12936            decoder.debug_check_bounds::<Self>(offset);
12937            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
12938                None => return Err(fidl::Error::NotNullable),
12939                Some(len) => len,
12940            };
12941            // Calling decoder.out_of_line_offset(0) is not allowed.
12942            if len == 0 {
12943                return Ok(());
12944            };
12945            depth.increment()?;
12946            let envelope_size = 8;
12947            let bytes_len = len * envelope_size;
12948            let offset = decoder.out_of_line_offset(bytes_len)?;
12949            // Decode the envelope for each type.
12950            let mut _next_ordinal_to_read = 0;
12951            let mut next_offset = offset;
12952            let end_offset = offset + bytes_len;
12953            _next_ordinal_to_read += 1;
12954            if next_offset >= end_offset {
12955                return Ok(());
12956            }
12957
12958            // Decode unknown envelopes for gaps in ordinals.
12959            while _next_ordinal_to_read < 1 {
12960                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12961                _next_ordinal_to_read += 1;
12962                next_offset += envelope_size;
12963            }
12964
12965            let next_out_of_line = decoder.next_out_of_line();
12966            let handles_before = decoder.remaining_handles();
12967            if let Some((inlined, num_bytes, num_handles)) =
12968                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12969            {
12970                let member_inline_size =
12971                    <BufferCollectionImportToken as fidl::encoding::TypeMarker>::inline_size(
12972                        decoder.context,
12973                    );
12974                if inlined != (member_inline_size <= 4) {
12975                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12976                }
12977                let inner_offset;
12978                let mut inner_depth = depth.clone();
12979                if inlined {
12980                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12981                    inner_offset = next_offset;
12982                } else {
12983                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12984                    inner_depth.increment()?;
12985                }
12986                let val_ref = self.import_token.get_or_insert_with(|| {
12987                    fidl::new_empty!(
12988                        BufferCollectionImportToken,
12989                        fidl::encoding::DefaultFuchsiaResourceDialect
12990                    )
12991                });
12992                fidl::decode!(
12993                    BufferCollectionImportToken,
12994                    fidl::encoding::DefaultFuchsiaResourceDialect,
12995                    val_ref,
12996                    decoder,
12997                    inner_offset,
12998                    inner_depth
12999                )?;
13000                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
13001                {
13002                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
13003                }
13004                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
13005                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
13006                }
13007            }
13008
13009            next_offset += envelope_size;
13010            _next_ordinal_to_read += 1;
13011            if next_offset >= end_offset {
13012                return Ok(());
13013            }
13014
13015            // Decode unknown envelopes for gaps in ordinals.
13016            while _next_ordinal_to_read < 2 {
13017                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13018                _next_ordinal_to_read += 1;
13019                next_offset += envelope_size;
13020            }
13021
13022            let next_out_of_line = decoder.next_out_of_line();
13023            let handles_before = decoder.remaining_handles();
13024            if let Some((inlined, num_bytes, num_handles)) =
13025                fidl::encoding::decode_envelope_header(decoder, next_offset)?
13026            {
13027                let member_inline_size =
13028                    <fidl_fuchsia_math::SizeU as fidl::encoding::TypeMarker>::inline_size(
13029                        decoder.context,
13030                    );
13031                if inlined != (member_inline_size <= 4) {
13032                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
13033                }
13034                let inner_offset;
13035                let mut inner_depth = depth.clone();
13036                if inlined {
13037                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
13038                    inner_offset = next_offset;
13039                } else {
13040                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
13041                    inner_depth.increment()?;
13042                }
13043                let val_ref = self.size.get_or_insert_with(|| {
13044                    fidl::new_empty!(
13045                        fidl_fuchsia_math::SizeU,
13046                        fidl::encoding::DefaultFuchsiaResourceDialect
13047                    )
13048                });
13049                fidl::decode!(
13050                    fidl_fuchsia_math::SizeU,
13051                    fidl::encoding::DefaultFuchsiaResourceDialect,
13052                    val_ref,
13053                    decoder,
13054                    inner_offset,
13055                    inner_depth
13056                )?;
13057                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
13058                {
13059                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
13060                }
13061                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
13062                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
13063                }
13064            }
13065
13066            next_offset += envelope_size;
13067            _next_ordinal_to_read += 1;
13068            if next_offset >= end_offset {
13069                return Ok(());
13070            }
13071
13072            // Decode unknown envelopes for gaps in ordinals.
13073            while _next_ordinal_to_read < 3 {
13074                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13075                _next_ordinal_to_read += 1;
13076                next_offset += envelope_size;
13077            }
13078
13079            let next_out_of_line = decoder.next_out_of_line();
13080            let handles_before = decoder.remaining_handles();
13081            if let Some((inlined, num_bytes, num_handles)) =
13082                fidl::encoding::decode_envelope_header(decoder, next_offset)?
13083            {
13084                let member_inline_size =
13085                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
13086                if inlined != (member_inline_size <= 4) {
13087                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
13088                }
13089                let inner_offset;
13090                let mut inner_depth = depth.clone();
13091                if inlined {
13092                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
13093                    inner_offset = next_offset;
13094                } else {
13095                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
13096                    inner_depth.increment()?;
13097                }
13098                let val_ref = self.buffer_count.get_or_insert_with(|| {
13099                    fidl::new_empty!(u32, fidl::encoding::DefaultFuchsiaResourceDialect)
13100                });
13101                fidl::decode!(
13102                    u32,
13103                    fidl::encoding::DefaultFuchsiaResourceDialect,
13104                    val_ref,
13105                    decoder,
13106                    inner_offset,
13107                    inner_depth
13108                )?;
13109                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
13110                {
13111                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
13112                }
13113                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
13114                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
13115                }
13116            }
13117
13118            next_offset += envelope_size;
13119            _next_ordinal_to_read += 1;
13120            if next_offset >= end_offset {
13121                return Ok(());
13122            }
13123
13124            // Decode unknown envelopes for gaps in ordinals.
13125            while _next_ordinal_to_read < 4 {
13126                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13127                _next_ordinal_to_read += 1;
13128                next_offset += envelope_size;
13129            }
13130
13131            let next_out_of_line = decoder.next_out_of_line();
13132            let handles_before = decoder.remaining_handles();
13133            if let Some((inlined, num_bytes, num_handles)) =
13134                fidl::encoding::decode_envelope_header(decoder, next_offset)?
13135            {
13136                let member_inline_size =
13137                    <Rotation as fidl::encoding::TypeMarker>::inline_size(decoder.context);
13138                if inlined != (member_inline_size <= 4) {
13139                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
13140                }
13141                let inner_offset;
13142                let mut inner_depth = depth.clone();
13143                if inlined {
13144                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
13145                    inner_offset = next_offset;
13146                } else {
13147                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
13148                    inner_depth.increment()?;
13149                }
13150                let val_ref = self.rotation.get_or_insert_with(|| {
13151                    fidl::new_empty!(Rotation, fidl::encoding::DefaultFuchsiaResourceDialect)
13152                });
13153                fidl::decode!(
13154                    Rotation,
13155                    fidl::encoding::DefaultFuchsiaResourceDialect,
13156                    val_ref,
13157                    decoder,
13158                    inner_offset,
13159                    inner_depth
13160                )?;
13161                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
13162                {
13163                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
13164                }
13165                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
13166                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
13167                }
13168            }
13169
13170            next_offset += envelope_size;
13171
13172            // Decode the remaining unknown envelopes.
13173            while next_offset < end_offset {
13174                _next_ordinal_to_read += 1;
13175                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13176                next_offset += envelope_size;
13177            }
13178
13179            Ok(())
13180        }
13181    }
13182
13183    impl ScreenshotTakeFileRequest {
13184        #[inline(always)]
13185        fn max_ordinal_present(&self) -> u64 {
13186            if let Some(_) = self.format {
13187                return 1;
13188            }
13189            0
13190        }
13191    }
13192
13193    impl fidl::encoding::ResourceTypeMarker for ScreenshotTakeFileRequest {
13194        type Borrowed<'a> = &'a mut Self;
13195        fn take_or_borrow<'a>(
13196            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
13197        ) -> Self::Borrowed<'a> {
13198            value
13199        }
13200    }
13201
13202    unsafe impl fidl::encoding::TypeMarker for ScreenshotTakeFileRequest {
13203        type Owned = Self;
13204
13205        #[inline(always)]
13206        fn inline_align(_context: fidl::encoding::Context) -> usize {
13207            8
13208        }
13209
13210        #[inline(always)]
13211        fn inline_size(_context: fidl::encoding::Context) -> usize {
13212            16
13213        }
13214    }
13215
13216    unsafe impl
13217        fidl::encoding::Encode<
13218            ScreenshotTakeFileRequest,
13219            fidl::encoding::DefaultFuchsiaResourceDialect,
13220        > for &mut ScreenshotTakeFileRequest
13221    {
13222        unsafe fn encode(
13223            self,
13224            encoder: &mut fidl::encoding::Encoder<
13225                '_,
13226                fidl::encoding::DefaultFuchsiaResourceDialect,
13227            >,
13228            offset: usize,
13229            mut depth: fidl::encoding::Depth,
13230        ) -> fidl::Result<()> {
13231            encoder.debug_check_bounds::<ScreenshotTakeFileRequest>(offset);
13232            // Vector header
13233            let max_ordinal: u64 = self.max_ordinal_present();
13234            encoder.write_num(max_ordinal, offset);
13235            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
13236            // Calling encoder.out_of_line_offset(0) is not allowed.
13237            if max_ordinal == 0 {
13238                return Ok(());
13239            }
13240            depth.increment()?;
13241            let envelope_size = 8;
13242            let bytes_len = max_ordinal as usize * envelope_size;
13243            #[allow(unused_variables)]
13244            let offset = encoder.out_of_line_offset(bytes_len);
13245            let mut _prev_end_offset: usize = 0;
13246            if 1 > max_ordinal {
13247                return Ok(());
13248            }
13249
13250            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
13251            // are envelope_size bytes.
13252            let cur_offset: usize = (1 - 1) * envelope_size;
13253
13254            // Zero reserved fields.
13255            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
13256
13257            // Safety:
13258            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
13259            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
13260            //   envelope_size bytes, there is always sufficient room.
13261            fidl::encoding::encode_in_envelope_optional::<
13262                ScreenshotFormat,
13263                fidl::encoding::DefaultFuchsiaResourceDialect,
13264            >(
13265                self.format
13266                    .as_ref()
13267                    .map(<ScreenshotFormat as fidl::encoding::ValueTypeMarker>::borrow),
13268                encoder,
13269                offset + cur_offset,
13270                depth,
13271            )?;
13272
13273            _prev_end_offset = cur_offset + envelope_size;
13274
13275            Ok(())
13276        }
13277    }
13278
13279    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
13280        for ScreenshotTakeFileRequest
13281    {
13282        #[inline(always)]
13283        fn new_empty() -> Self {
13284            Self::default()
13285        }
13286
13287        unsafe fn decode(
13288            &mut self,
13289            decoder: &mut fidl::encoding::Decoder<
13290                '_,
13291                fidl::encoding::DefaultFuchsiaResourceDialect,
13292            >,
13293            offset: usize,
13294            mut depth: fidl::encoding::Depth,
13295        ) -> fidl::Result<()> {
13296            decoder.debug_check_bounds::<Self>(offset);
13297            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
13298                None => return Err(fidl::Error::NotNullable),
13299                Some(len) => len,
13300            };
13301            // Calling decoder.out_of_line_offset(0) is not allowed.
13302            if len == 0 {
13303                return Ok(());
13304            };
13305            depth.increment()?;
13306            let envelope_size = 8;
13307            let bytes_len = len * envelope_size;
13308            let offset = decoder.out_of_line_offset(bytes_len)?;
13309            // Decode the envelope for each type.
13310            let mut _next_ordinal_to_read = 0;
13311            let mut next_offset = offset;
13312            let end_offset = offset + bytes_len;
13313            _next_ordinal_to_read += 1;
13314            if next_offset >= end_offset {
13315                return Ok(());
13316            }
13317
13318            // Decode unknown envelopes for gaps in ordinals.
13319            while _next_ordinal_to_read < 1 {
13320                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13321                _next_ordinal_to_read += 1;
13322                next_offset += envelope_size;
13323            }
13324
13325            let next_out_of_line = decoder.next_out_of_line();
13326            let handles_before = decoder.remaining_handles();
13327            if let Some((inlined, num_bytes, num_handles)) =
13328                fidl::encoding::decode_envelope_header(decoder, next_offset)?
13329            {
13330                let member_inline_size =
13331                    <ScreenshotFormat as fidl::encoding::TypeMarker>::inline_size(decoder.context);
13332                if inlined != (member_inline_size <= 4) {
13333                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
13334                }
13335                let inner_offset;
13336                let mut inner_depth = depth.clone();
13337                if inlined {
13338                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
13339                    inner_offset = next_offset;
13340                } else {
13341                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
13342                    inner_depth.increment()?;
13343                }
13344                let val_ref = self.format.get_or_insert_with(|| {
13345                    fidl::new_empty!(
13346                        ScreenshotFormat,
13347                        fidl::encoding::DefaultFuchsiaResourceDialect
13348                    )
13349                });
13350                fidl::decode!(
13351                    ScreenshotFormat,
13352                    fidl::encoding::DefaultFuchsiaResourceDialect,
13353                    val_ref,
13354                    decoder,
13355                    inner_offset,
13356                    inner_depth
13357                )?;
13358                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
13359                {
13360                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
13361                }
13362                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
13363                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
13364                }
13365            }
13366
13367            next_offset += envelope_size;
13368
13369            // Decode the remaining unknown envelopes.
13370            while next_offset < end_offset {
13371                _next_ordinal_to_read += 1;
13372                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13373                next_offset += envelope_size;
13374            }
13375
13376            Ok(())
13377        }
13378    }
13379
13380    impl ScreenshotTakeFileResponse {
13381        #[inline(always)]
13382        fn max_ordinal_present(&self) -> u64 {
13383            if let Some(_) = self.size {
13384                return 2;
13385            }
13386            if let Some(_) = self.file {
13387                return 1;
13388            }
13389            0
13390        }
13391    }
13392
13393    impl fidl::encoding::ResourceTypeMarker for ScreenshotTakeFileResponse {
13394        type Borrowed<'a> = &'a mut Self;
13395        fn take_or_borrow<'a>(
13396            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
13397        ) -> Self::Borrowed<'a> {
13398            value
13399        }
13400    }
13401
13402    unsafe impl fidl::encoding::TypeMarker for ScreenshotTakeFileResponse {
13403        type Owned = Self;
13404
13405        #[inline(always)]
13406        fn inline_align(_context: fidl::encoding::Context) -> usize {
13407            8
13408        }
13409
13410        #[inline(always)]
13411        fn inline_size(_context: fidl::encoding::Context) -> usize {
13412            16
13413        }
13414    }
13415
13416    unsafe impl
13417        fidl::encoding::Encode<
13418            ScreenshotTakeFileResponse,
13419            fidl::encoding::DefaultFuchsiaResourceDialect,
13420        > for &mut ScreenshotTakeFileResponse
13421    {
13422        unsafe fn encode(
13423            self,
13424            encoder: &mut fidl::encoding::Encoder<
13425                '_,
13426                fidl::encoding::DefaultFuchsiaResourceDialect,
13427            >,
13428            offset: usize,
13429            mut depth: fidl::encoding::Depth,
13430        ) -> fidl::Result<()> {
13431            encoder.debug_check_bounds::<ScreenshotTakeFileResponse>(offset);
13432            // Vector header
13433            let max_ordinal: u64 = self.max_ordinal_present();
13434            encoder.write_num(max_ordinal, offset);
13435            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
13436            // Calling encoder.out_of_line_offset(0) is not allowed.
13437            if max_ordinal == 0 {
13438                return Ok(());
13439            }
13440            depth.increment()?;
13441            let envelope_size = 8;
13442            let bytes_len = max_ordinal as usize * envelope_size;
13443            #[allow(unused_variables)]
13444            let offset = encoder.out_of_line_offset(bytes_len);
13445            let mut _prev_end_offset: usize = 0;
13446            if 1 > max_ordinal {
13447                return Ok(());
13448            }
13449
13450            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
13451            // are envelope_size bytes.
13452            let cur_offset: usize = (1 - 1) * envelope_size;
13453
13454            // Zero reserved fields.
13455            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
13456
13457            // Safety:
13458            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
13459            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
13460            //   envelope_size bytes, there is always sufficient room.
13461            fidl::encoding::encode_in_envelope_optional::<
13462                fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>>,
13463                fidl::encoding::DefaultFuchsiaResourceDialect,
13464            >(
13465                self.file.as_mut().map(
13466                    <fidl::encoding::Endpoint<
13467                        fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
13468                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
13469                ),
13470                encoder,
13471                offset + cur_offset,
13472                depth,
13473            )?;
13474
13475            _prev_end_offset = cur_offset + envelope_size;
13476            if 2 > max_ordinal {
13477                return Ok(());
13478            }
13479
13480            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
13481            // are envelope_size bytes.
13482            let cur_offset: usize = (2 - 1) * envelope_size;
13483
13484            // Zero reserved fields.
13485            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
13486
13487            // Safety:
13488            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
13489            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
13490            //   envelope_size bytes, there is always sufficient room.
13491            fidl::encoding::encode_in_envelope_optional::<
13492                fidl_fuchsia_math::SizeU,
13493                fidl::encoding::DefaultFuchsiaResourceDialect,
13494            >(
13495                self.size
13496                    .as_ref()
13497                    .map(<fidl_fuchsia_math::SizeU as fidl::encoding::ValueTypeMarker>::borrow),
13498                encoder,
13499                offset + cur_offset,
13500                depth,
13501            )?;
13502
13503            _prev_end_offset = cur_offset + envelope_size;
13504
13505            Ok(())
13506        }
13507    }
13508
13509    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
13510        for ScreenshotTakeFileResponse
13511    {
13512        #[inline(always)]
13513        fn new_empty() -> Self {
13514            Self::default()
13515        }
13516
13517        unsafe fn decode(
13518            &mut self,
13519            decoder: &mut fidl::encoding::Decoder<
13520                '_,
13521                fidl::encoding::DefaultFuchsiaResourceDialect,
13522            >,
13523            offset: usize,
13524            mut depth: fidl::encoding::Depth,
13525        ) -> fidl::Result<()> {
13526            decoder.debug_check_bounds::<Self>(offset);
13527            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
13528                None => return Err(fidl::Error::NotNullable),
13529                Some(len) => len,
13530            };
13531            // Calling decoder.out_of_line_offset(0) is not allowed.
13532            if len == 0 {
13533                return Ok(());
13534            };
13535            depth.increment()?;
13536            let envelope_size = 8;
13537            let bytes_len = len * envelope_size;
13538            let offset = decoder.out_of_line_offset(bytes_len)?;
13539            // Decode the envelope for each type.
13540            let mut _next_ordinal_to_read = 0;
13541            let mut next_offset = offset;
13542            let end_offset = offset + bytes_len;
13543            _next_ordinal_to_read += 1;
13544            if next_offset >= end_offset {
13545                return Ok(());
13546            }
13547
13548            // Decode unknown envelopes for gaps in ordinals.
13549            while _next_ordinal_to_read < 1 {
13550                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13551                _next_ordinal_to_read += 1;
13552                next_offset += envelope_size;
13553            }
13554
13555            let next_out_of_line = decoder.next_out_of_line();
13556            let handles_before = decoder.remaining_handles();
13557            if let Some((inlined, num_bytes, num_handles)) =
13558                fidl::encoding::decode_envelope_header(decoder, next_offset)?
13559            {
13560                let member_inline_size = <fidl::encoding::Endpoint<
13561                    fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
13562                > as fidl::encoding::TypeMarker>::inline_size(
13563                    decoder.context
13564                );
13565                if inlined != (member_inline_size <= 4) {
13566                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
13567                }
13568                let inner_offset;
13569                let mut inner_depth = depth.clone();
13570                if inlined {
13571                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
13572                    inner_offset = next_offset;
13573                } else {
13574                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
13575                    inner_depth.increment()?;
13576                }
13577                let val_ref = self.file.get_or_insert_with(|| {
13578                    fidl::new_empty!(
13579                        fidl::encoding::Endpoint<
13580                            fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
13581                        >,
13582                        fidl::encoding::DefaultFuchsiaResourceDialect
13583                    )
13584                });
13585                fidl::decode!(
13586                    fidl::encoding::Endpoint<
13587                        fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
13588                    >,
13589                    fidl::encoding::DefaultFuchsiaResourceDialect,
13590                    val_ref,
13591                    decoder,
13592                    inner_offset,
13593                    inner_depth
13594                )?;
13595                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
13596                {
13597                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
13598                }
13599                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
13600                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
13601                }
13602            }
13603
13604            next_offset += envelope_size;
13605            _next_ordinal_to_read += 1;
13606            if next_offset >= end_offset {
13607                return Ok(());
13608            }
13609
13610            // Decode unknown envelopes for gaps in ordinals.
13611            while _next_ordinal_to_read < 2 {
13612                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13613                _next_ordinal_to_read += 1;
13614                next_offset += envelope_size;
13615            }
13616
13617            let next_out_of_line = decoder.next_out_of_line();
13618            let handles_before = decoder.remaining_handles();
13619            if let Some((inlined, num_bytes, num_handles)) =
13620                fidl::encoding::decode_envelope_header(decoder, next_offset)?
13621            {
13622                let member_inline_size =
13623                    <fidl_fuchsia_math::SizeU as fidl::encoding::TypeMarker>::inline_size(
13624                        decoder.context,
13625                    );
13626                if inlined != (member_inline_size <= 4) {
13627                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
13628                }
13629                let inner_offset;
13630                let mut inner_depth = depth.clone();
13631                if inlined {
13632                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
13633                    inner_offset = next_offset;
13634                } else {
13635                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
13636                    inner_depth.increment()?;
13637                }
13638                let val_ref = self.size.get_or_insert_with(|| {
13639                    fidl::new_empty!(
13640                        fidl_fuchsia_math::SizeU,
13641                        fidl::encoding::DefaultFuchsiaResourceDialect
13642                    )
13643                });
13644                fidl::decode!(
13645                    fidl_fuchsia_math::SizeU,
13646                    fidl::encoding::DefaultFuchsiaResourceDialect,
13647                    val_ref,
13648                    decoder,
13649                    inner_offset,
13650                    inner_depth
13651                )?;
13652                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
13653                {
13654                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
13655                }
13656                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
13657                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
13658                }
13659            }
13660
13661            next_offset += envelope_size;
13662
13663            // Decode the remaining unknown envelopes.
13664            while next_offset < end_offset {
13665                _next_ordinal_to_read += 1;
13666                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13667                next_offset += envelope_size;
13668            }
13669
13670            Ok(())
13671        }
13672    }
13673
13674    impl ScreenshotTakeRequest {
13675        #[inline(always)]
13676        fn max_ordinal_present(&self) -> u64 {
13677            if let Some(_) = self.format {
13678                return 1;
13679            }
13680            0
13681        }
13682    }
13683
13684    impl fidl::encoding::ResourceTypeMarker for ScreenshotTakeRequest {
13685        type Borrowed<'a> = &'a mut Self;
13686        fn take_or_borrow<'a>(
13687            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
13688        ) -> Self::Borrowed<'a> {
13689            value
13690        }
13691    }
13692
13693    unsafe impl fidl::encoding::TypeMarker for ScreenshotTakeRequest {
13694        type Owned = Self;
13695
13696        #[inline(always)]
13697        fn inline_align(_context: fidl::encoding::Context) -> usize {
13698            8
13699        }
13700
13701        #[inline(always)]
13702        fn inline_size(_context: fidl::encoding::Context) -> usize {
13703            16
13704        }
13705    }
13706
13707    unsafe impl
13708        fidl::encoding::Encode<ScreenshotTakeRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
13709        for &mut ScreenshotTakeRequest
13710    {
13711        unsafe fn encode(
13712            self,
13713            encoder: &mut fidl::encoding::Encoder<
13714                '_,
13715                fidl::encoding::DefaultFuchsiaResourceDialect,
13716            >,
13717            offset: usize,
13718            mut depth: fidl::encoding::Depth,
13719        ) -> fidl::Result<()> {
13720            encoder.debug_check_bounds::<ScreenshotTakeRequest>(offset);
13721            // Vector header
13722            let max_ordinal: u64 = self.max_ordinal_present();
13723            encoder.write_num(max_ordinal, offset);
13724            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
13725            // Calling encoder.out_of_line_offset(0) is not allowed.
13726            if max_ordinal == 0 {
13727                return Ok(());
13728            }
13729            depth.increment()?;
13730            let envelope_size = 8;
13731            let bytes_len = max_ordinal as usize * envelope_size;
13732            #[allow(unused_variables)]
13733            let offset = encoder.out_of_line_offset(bytes_len);
13734            let mut _prev_end_offset: usize = 0;
13735            if 1 > max_ordinal {
13736                return Ok(());
13737            }
13738
13739            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
13740            // are envelope_size bytes.
13741            let cur_offset: usize = (1 - 1) * envelope_size;
13742
13743            // Zero reserved fields.
13744            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
13745
13746            // Safety:
13747            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
13748            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
13749            //   envelope_size bytes, there is always sufficient room.
13750            fidl::encoding::encode_in_envelope_optional::<
13751                ScreenshotFormat,
13752                fidl::encoding::DefaultFuchsiaResourceDialect,
13753            >(
13754                self.format
13755                    .as_ref()
13756                    .map(<ScreenshotFormat as fidl::encoding::ValueTypeMarker>::borrow),
13757                encoder,
13758                offset + cur_offset,
13759                depth,
13760            )?;
13761
13762            _prev_end_offset = cur_offset + envelope_size;
13763
13764            Ok(())
13765        }
13766    }
13767
13768    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
13769        for ScreenshotTakeRequest
13770    {
13771        #[inline(always)]
13772        fn new_empty() -> Self {
13773            Self::default()
13774        }
13775
13776        unsafe fn decode(
13777            &mut self,
13778            decoder: &mut fidl::encoding::Decoder<
13779                '_,
13780                fidl::encoding::DefaultFuchsiaResourceDialect,
13781            >,
13782            offset: usize,
13783            mut depth: fidl::encoding::Depth,
13784        ) -> fidl::Result<()> {
13785            decoder.debug_check_bounds::<Self>(offset);
13786            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
13787                None => return Err(fidl::Error::NotNullable),
13788                Some(len) => len,
13789            };
13790            // Calling decoder.out_of_line_offset(0) is not allowed.
13791            if len == 0 {
13792                return Ok(());
13793            };
13794            depth.increment()?;
13795            let envelope_size = 8;
13796            let bytes_len = len * envelope_size;
13797            let offset = decoder.out_of_line_offset(bytes_len)?;
13798            // Decode the envelope for each type.
13799            let mut _next_ordinal_to_read = 0;
13800            let mut next_offset = offset;
13801            let end_offset = offset + bytes_len;
13802            _next_ordinal_to_read += 1;
13803            if next_offset >= end_offset {
13804                return Ok(());
13805            }
13806
13807            // Decode unknown envelopes for gaps in ordinals.
13808            while _next_ordinal_to_read < 1 {
13809                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13810                _next_ordinal_to_read += 1;
13811                next_offset += envelope_size;
13812            }
13813
13814            let next_out_of_line = decoder.next_out_of_line();
13815            let handles_before = decoder.remaining_handles();
13816            if let Some((inlined, num_bytes, num_handles)) =
13817                fidl::encoding::decode_envelope_header(decoder, next_offset)?
13818            {
13819                let member_inline_size =
13820                    <ScreenshotFormat as fidl::encoding::TypeMarker>::inline_size(decoder.context);
13821                if inlined != (member_inline_size <= 4) {
13822                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
13823                }
13824                let inner_offset;
13825                let mut inner_depth = depth.clone();
13826                if inlined {
13827                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
13828                    inner_offset = next_offset;
13829                } else {
13830                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
13831                    inner_depth.increment()?;
13832                }
13833                let val_ref = self.format.get_or_insert_with(|| {
13834                    fidl::new_empty!(
13835                        ScreenshotFormat,
13836                        fidl::encoding::DefaultFuchsiaResourceDialect
13837                    )
13838                });
13839                fidl::decode!(
13840                    ScreenshotFormat,
13841                    fidl::encoding::DefaultFuchsiaResourceDialect,
13842                    val_ref,
13843                    decoder,
13844                    inner_offset,
13845                    inner_depth
13846                )?;
13847                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
13848                {
13849                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
13850                }
13851                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
13852                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
13853                }
13854            }
13855
13856            next_offset += envelope_size;
13857
13858            // Decode the remaining unknown envelopes.
13859            while next_offset < end_offset {
13860                _next_ordinal_to_read += 1;
13861                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13862                next_offset += envelope_size;
13863            }
13864
13865            Ok(())
13866        }
13867    }
13868
13869    impl ScreenshotTakeResponse {
13870        #[inline(always)]
13871        fn max_ordinal_present(&self) -> u64 {
13872            if let Some(_) = self.size {
13873                return 2;
13874            }
13875            if let Some(_) = self.vmo {
13876                return 1;
13877            }
13878            0
13879        }
13880    }
13881
13882    impl fidl::encoding::ResourceTypeMarker for ScreenshotTakeResponse {
13883        type Borrowed<'a> = &'a mut Self;
13884        fn take_or_borrow<'a>(
13885            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
13886        ) -> Self::Borrowed<'a> {
13887            value
13888        }
13889    }
13890
13891    unsafe impl fidl::encoding::TypeMarker for ScreenshotTakeResponse {
13892        type Owned = Self;
13893
13894        #[inline(always)]
13895        fn inline_align(_context: fidl::encoding::Context) -> usize {
13896            8
13897        }
13898
13899        #[inline(always)]
13900        fn inline_size(_context: fidl::encoding::Context) -> usize {
13901            16
13902        }
13903    }
13904
13905    unsafe impl
13906        fidl::encoding::Encode<
13907            ScreenshotTakeResponse,
13908            fidl::encoding::DefaultFuchsiaResourceDialect,
13909        > for &mut ScreenshotTakeResponse
13910    {
13911        unsafe fn encode(
13912            self,
13913            encoder: &mut fidl::encoding::Encoder<
13914                '_,
13915                fidl::encoding::DefaultFuchsiaResourceDialect,
13916            >,
13917            offset: usize,
13918            mut depth: fidl::encoding::Depth,
13919        ) -> fidl::Result<()> {
13920            encoder.debug_check_bounds::<ScreenshotTakeResponse>(offset);
13921            // Vector header
13922            let max_ordinal: u64 = self.max_ordinal_present();
13923            encoder.write_num(max_ordinal, offset);
13924            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
13925            // Calling encoder.out_of_line_offset(0) is not allowed.
13926            if max_ordinal == 0 {
13927                return Ok(());
13928            }
13929            depth.increment()?;
13930            let envelope_size = 8;
13931            let bytes_len = max_ordinal as usize * envelope_size;
13932            #[allow(unused_variables)]
13933            let offset = encoder.out_of_line_offset(bytes_len);
13934            let mut _prev_end_offset: usize = 0;
13935            if 1 > max_ordinal {
13936                return Ok(());
13937            }
13938
13939            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
13940            // are envelope_size bytes.
13941            let cur_offset: usize = (1 - 1) * envelope_size;
13942
13943            // Zero reserved fields.
13944            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
13945
13946            // Safety:
13947            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
13948            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
13949            //   envelope_size bytes, there is always sufficient room.
13950            fidl::encoding::encode_in_envelope_optional::<
13951                fidl::encoding::HandleType<
13952                    fidl::Vmo,
13953                    { fidl::ObjectType::VMO.into_raw() },
13954                    2147483648,
13955                >,
13956                fidl::encoding::DefaultFuchsiaResourceDialect,
13957            >(
13958                self.vmo.as_mut().map(
13959                    <fidl::encoding::HandleType<
13960                        fidl::Vmo,
13961                        { fidl::ObjectType::VMO.into_raw() },
13962                        2147483648,
13963                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
13964                ),
13965                encoder,
13966                offset + cur_offset,
13967                depth,
13968            )?;
13969
13970            _prev_end_offset = cur_offset + envelope_size;
13971            if 2 > max_ordinal {
13972                return Ok(());
13973            }
13974
13975            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
13976            // are envelope_size bytes.
13977            let cur_offset: usize = (2 - 1) * envelope_size;
13978
13979            // Zero reserved fields.
13980            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
13981
13982            // Safety:
13983            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
13984            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
13985            //   envelope_size bytes, there is always sufficient room.
13986            fidl::encoding::encode_in_envelope_optional::<
13987                fidl_fuchsia_math::SizeU,
13988                fidl::encoding::DefaultFuchsiaResourceDialect,
13989            >(
13990                self.size
13991                    .as_ref()
13992                    .map(<fidl_fuchsia_math::SizeU as fidl::encoding::ValueTypeMarker>::borrow),
13993                encoder,
13994                offset + cur_offset,
13995                depth,
13996            )?;
13997
13998            _prev_end_offset = cur_offset + envelope_size;
13999
14000            Ok(())
14001        }
14002    }
14003
14004    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
14005        for ScreenshotTakeResponse
14006    {
14007        #[inline(always)]
14008        fn new_empty() -> Self {
14009            Self::default()
14010        }
14011
14012        unsafe fn decode(
14013            &mut self,
14014            decoder: &mut fidl::encoding::Decoder<
14015                '_,
14016                fidl::encoding::DefaultFuchsiaResourceDialect,
14017            >,
14018            offset: usize,
14019            mut depth: fidl::encoding::Depth,
14020        ) -> fidl::Result<()> {
14021            decoder.debug_check_bounds::<Self>(offset);
14022            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
14023                None => return Err(fidl::Error::NotNullable),
14024                Some(len) => len,
14025            };
14026            // Calling decoder.out_of_line_offset(0) is not allowed.
14027            if len == 0 {
14028                return Ok(());
14029            };
14030            depth.increment()?;
14031            let envelope_size = 8;
14032            let bytes_len = len * envelope_size;
14033            let offset = decoder.out_of_line_offset(bytes_len)?;
14034            // Decode the envelope for each type.
14035            let mut _next_ordinal_to_read = 0;
14036            let mut next_offset = offset;
14037            let end_offset = offset + bytes_len;
14038            _next_ordinal_to_read += 1;
14039            if next_offset >= end_offset {
14040                return Ok(());
14041            }
14042
14043            // Decode unknown envelopes for gaps in ordinals.
14044            while _next_ordinal_to_read < 1 {
14045                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
14046                _next_ordinal_to_read += 1;
14047                next_offset += envelope_size;
14048            }
14049
14050            let next_out_of_line = decoder.next_out_of_line();
14051            let handles_before = decoder.remaining_handles();
14052            if let Some((inlined, num_bytes, num_handles)) =
14053                fidl::encoding::decode_envelope_header(decoder, next_offset)?
14054            {
14055                let member_inline_size = <fidl::encoding::HandleType<
14056                    fidl::Vmo,
14057                    { fidl::ObjectType::VMO.into_raw() },
14058                    2147483648,
14059                > as fidl::encoding::TypeMarker>::inline_size(
14060                    decoder.context
14061                );
14062                if inlined != (member_inline_size <= 4) {
14063                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
14064                }
14065                let inner_offset;
14066                let mut inner_depth = depth.clone();
14067                if inlined {
14068                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
14069                    inner_offset = next_offset;
14070                } else {
14071                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
14072                    inner_depth.increment()?;
14073                }
14074                let val_ref =
14075                self.vmo.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
14076                fidl::decode!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
14077                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
14078                {
14079                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
14080                }
14081                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
14082                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
14083                }
14084            }
14085
14086            next_offset += envelope_size;
14087            _next_ordinal_to_read += 1;
14088            if next_offset >= end_offset {
14089                return Ok(());
14090            }
14091
14092            // Decode unknown envelopes for gaps in ordinals.
14093            while _next_ordinal_to_read < 2 {
14094                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
14095                _next_ordinal_to_read += 1;
14096                next_offset += envelope_size;
14097            }
14098
14099            let next_out_of_line = decoder.next_out_of_line();
14100            let handles_before = decoder.remaining_handles();
14101            if let Some((inlined, num_bytes, num_handles)) =
14102                fidl::encoding::decode_envelope_header(decoder, next_offset)?
14103            {
14104                let member_inline_size =
14105                    <fidl_fuchsia_math::SizeU as fidl::encoding::TypeMarker>::inline_size(
14106                        decoder.context,
14107                    );
14108                if inlined != (member_inline_size <= 4) {
14109                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
14110                }
14111                let inner_offset;
14112                let mut inner_depth = depth.clone();
14113                if inlined {
14114                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
14115                    inner_offset = next_offset;
14116                } else {
14117                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
14118                    inner_depth.increment()?;
14119                }
14120                let val_ref = self.size.get_or_insert_with(|| {
14121                    fidl::new_empty!(
14122                        fidl_fuchsia_math::SizeU,
14123                        fidl::encoding::DefaultFuchsiaResourceDialect
14124                    )
14125                });
14126                fidl::decode!(
14127                    fidl_fuchsia_math::SizeU,
14128                    fidl::encoding::DefaultFuchsiaResourceDialect,
14129                    val_ref,
14130                    decoder,
14131                    inner_offset,
14132                    inner_depth
14133                )?;
14134                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
14135                {
14136                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
14137                }
14138                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
14139                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
14140                }
14141            }
14142
14143            next_offset += envelope_size;
14144
14145            // Decode the remaining unknown envelopes.
14146            while next_offset < end_offset {
14147                _next_ordinal_to_read += 1;
14148                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
14149                next_offset += envelope_size;
14150            }
14151
14152            Ok(())
14153        }
14154    }
14155
14156    impl TrustedFlatlandConfig {
14157        #[inline(always)]
14158        fn max_ordinal_present(&self) -> u64 {
14159            if let Some(_) = self.skips_present_credits {
14160                return 3;
14161            }
14162            if let Some(_) = self.pass_acquire_fences {
14163                return 2;
14164            }
14165            if let Some(_) = self.schedule_asap {
14166                return 1;
14167            }
14168            0
14169        }
14170    }
14171
14172    impl fidl::encoding::ResourceTypeMarker for TrustedFlatlandConfig {
14173        type Borrowed<'a> = &'a mut Self;
14174        fn take_or_borrow<'a>(
14175            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
14176        ) -> Self::Borrowed<'a> {
14177            value
14178        }
14179    }
14180
14181    unsafe impl fidl::encoding::TypeMarker for TrustedFlatlandConfig {
14182        type Owned = Self;
14183
14184        #[inline(always)]
14185        fn inline_align(_context: fidl::encoding::Context) -> usize {
14186            8
14187        }
14188
14189        #[inline(always)]
14190        fn inline_size(_context: fidl::encoding::Context) -> usize {
14191            16
14192        }
14193    }
14194
14195    unsafe impl
14196        fidl::encoding::Encode<TrustedFlatlandConfig, fidl::encoding::DefaultFuchsiaResourceDialect>
14197        for &mut TrustedFlatlandConfig
14198    {
14199        unsafe fn encode(
14200            self,
14201            encoder: &mut fidl::encoding::Encoder<
14202                '_,
14203                fidl::encoding::DefaultFuchsiaResourceDialect,
14204            >,
14205            offset: usize,
14206            mut depth: fidl::encoding::Depth,
14207        ) -> fidl::Result<()> {
14208            encoder.debug_check_bounds::<TrustedFlatlandConfig>(offset);
14209            // Vector header
14210            let max_ordinal: u64 = self.max_ordinal_present();
14211            encoder.write_num(max_ordinal, offset);
14212            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
14213            // Calling encoder.out_of_line_offset(0) is not allowed.
14214            if max_ordinal == 0 {
14215                return Ok(());
14216            }
14217            depth.increment()?;
14218            let envelope_size = 8;
14219            let bytes_len = max_ordinal as usize * envelope_size;
14220            #[allow(unused_variables)]
14221            let offset = encoder.out_of_line_offset(bytes_len);
14222            let mut _prev_end_offset: usize = 0;
14223            if 1 > max_ordinal {
14224                return Ok(());
14225            }
14226
14227            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
14228            // are envelope_size bytes.
14229            let cur_offset: usize = (1 - 1) * envelope_size;
14230
14231            // Zero reserved fields.
14232            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
14233
14234            // Safety:
14235            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
14236            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
14237            //   envelope_size bytes, there is always sufficient room.
14238            fidl::encoding::encode_in_envelope_optional::<
14239                bool,
14240                fidl::encoding::DefaultFuchsiaResourceDialect,
14241            >(
14242                self.schedule_asap.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
14243                encoder,
14244                offset + cur_offset,
14245                depth,
14246            )?;
14247
14248            _prev_end_offset = cur_offset + envelope_size;
14249            if 2 > max_ordinal {
14250                return Ok(());
14251            }
14252
14253            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
14254            // are envelope_size bytes.
14255            let cur_offset: usize = (2 - 1) * envelope_size;
14256
14257            // Zero reserved fields.
14258            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
14259
14260            // Safety:
14261            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
14262            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
14263            //   envelope_size bytes, there is always sufficient room.
14264            fidl::encoding::encode_in_envelope_optional::<
14265                bool,
14266                fidl::encoding::DefaultFuchsiaResourceDialect,
14267            >(
14268                self.pass_acquire_fences
14269                    .as_ref()
14270                    .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
14271                encoder,
14272                offset + cur_offset,
14273                depth,
14274            )?;
14275
14276            _prev_end_offset = cur_offset + envelope_size;
14277            if 3 > max_ordinal {
14278                return Ok(());
14279            }
14280
14281            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
14282            // are envelope_size bytes.
14283            let cur_offset: usize = (3 - 1) * envelope_size;
14284
14285            // Zero reserved fields.
14286            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
14287
14288            // Safety:
14289            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
14290            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
14291            //   envelope_size bytes, there is always sufficient room.
14292            fidl::encoding::encode_in_envelope_optional::<
14293                bool,
14294                fidl::encoding::DefaultFuchsiaResourceDialect,
14295            >(
14296                self.skips_present_credits
14297                    .as_ref()
14298                    .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
14299                encoder,
14300                offset + cur_offset,
14301                depth,
14302            )?;
14303
14304            _prev_end_offset = cur_offset + envelope_size;
14305
14306            Ok(())
14307        }
14308    }
14309
14310    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
14311        for TrustedFlatlandConfig
14312    {
14313        #[inline(always)]
14314        fn new_empty() -> Self {
14315            Self::default()
14316        }
14317
14318        unsafe fn decode(
14319            &mut self,
14320            decoder: &mut fidl::encoding::Decoder<
14321                '_,
14322                fidl::encoding::DefaultFuchsiaResourceDialect,
14323            >,
14324            offset: usize,
14325            mut depth: fidl::encoding::Depth,
14326        ) -> fidl::Result<()> {
14327            decoder.debug_check_bounds::<Self>(offset);
14328            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
14329                None => return Err(fidl::Error::NotNullable),
14330                Some(len) => len,
14331            };
14332            // Calling decoder.out_of_line_offset(0) is not allowed.
14333            if len == 0 {
14334                return Ok(());
14335            };
14336            depth.increment()?;
14337            let envelope_size = 8;
14338            let bytes_len = len * envelope_size;
14339            let offset = decoder.out_of_line_offset(bytes_len)?;
14340            // Decode the envelope for each type.
14341            let mut _next_ordinal_to_read = 0;
14342            let mut next_offset = offset;
14343            let end_offset = offset + bytes_len;
14344            _next_ordinal_to_read += 1;
14345            if next_offset >= end_offset {
14346                return Ok(());
14347            }
14348
14349            // Decode unknown envelopes for gaps in ordinals.
14350            while _next_ordinal_to_read < 1 {
14351                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
14352                _next_ordinal_to_read += 1;
14353                next_offset += envelope_size;
14354            }
14355
14356            let next_out_of_line = decoder.next_out_of_line();
14357            let handles_before = decoder.remaining_handles();
14358            if let Some((inlined, num_bytes, num_handles)) =
14359                fidl::encoding::decode_envelope_header(decoder, next_offset)?
14360            {
14361                let member_inline_size =
14362                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
14363                if inlined != (member_inline_size <= 4) {
14364                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
14365                }
14366                let inner_offset;
14367                let mut inner_depth = depth.clone();
14368                if inlined {
14369                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
14370                    inner_offset = next_offset;
14371                } else {
14372                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
14373                    inner_depth.increment()?;
14374                }
14375                let val_ref = self.schedule_asap.get_or_insert_with(|| {
14376                    fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
14377                });
14378                fidl::decode!(
14379                    bool,
14380                    fidl::encoding::DefaultFuchsiaResourceDialect,
14381                    val_ref,
14382                    decoder,
14383                    inner_offset,
14384                    inner_depth
14385                )?;
14386                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
14387                {
14388                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
14389                }
14390                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
14391                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
14392                }
14393            }
14394
14395            next_offset += envelope_size;
14396            _next_ordinal_to_read += 1;
14397            if next_offset >= end_offset {
14398                return Ok(());
14399            }
14400
14401            // Decode unknown envelopes for gaps in ordinals.
14402            while _next_ordinal_to_read < 2 {
14403                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
14404                _next_ordinal_to_read += 1;
14405                next_offset += envelope_size;
14406            }
14407
14408            let next_out_of_line = decoder.next_out_of_line();
14409            let handles_before = decoder.remaining_handles();
14410            if let Some((inlined, num_bytes, num_handles)) =
14411                fidl::encoding::decode_envelope_header(decoder, next_offset)?
14412            {
14413                let member_inline_size =
14414                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
14415                if inlined != (member_inline_size <= 4) {
14416                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
14417                }
14418                let inner_offset;
14419                let mut inner_depth = depth.clone();
14420                if inlined {
14421                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
14422                    inner_offset = next_offset;
14423                } else {
14424                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
14425                    inner_depth.increment()?;
14426                }
14427                let val_ref = self.pass_acquire_fences.get_or_insert_with(|| {
14428                    fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
14429                });
14430                fidl::decode!(
14431                    bool,
14432                    fidl::encoding::DefaultFuchsiaResourceDialect,
14433                    val_ref,
14434                    decoder,
14435                    inner_offset,
14436                    inner_depth
14437                )?;
14438                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
14439                {
14440                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
14441                }
14442                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
14443                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
14444                }
14445            }
14446
14447            next_offset += envelope_size;
14448            _next_ordinal_to_read += 1;
14449            if next_offset >= end_offset {
14450                return Ok(());
14451            }
14452
14453            // Decode unknown envelopes for gaps in ordinals.
14454            while _next_ordinal_to_read < 3 {
14455                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
14456                _next_ordinal_to_read += 1;
14457                next_offset += envelope_size;
14458            }
14459
14460            let next_out_of_line = decoder.next_out_of_line();
14461            let handles_before = decoder.remaining_handles();
14462            if let Some((inlined, num_bytes, num_handles)) =
14463                fidl::encoding::decode_envelope_header(decoder, next_offset)?
14464            {
14465                let member_inline_size =
14466                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
14467                if inlined != (member_inline_size <= 4) {
14468                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
14469                }
14470                let inner_offset;
14471                let mut inner_depth = depth.clone();
14472                if inlined {
14473                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
14474                    inner_offset = next_offset;
14475                } else {
14476                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
14477                    inner_depth.increment()?;
14478                }
14479                let val_ref = self.skips_present_credits.get_or_insert_with(|| {
14480                    fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
14481                });
14482                fidl::decode!(
14483                    bool,
14484                    fidl::encoding::DefaultFuchsiaResourceDialect,
14485                    val_ref,
14486                    decoder,
14487                    inner_offset,
14488                    inner_depth
14489                )?;
14490                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
14491                {
14492                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
14493                }
14494                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
14495                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
14496                }
14497            }
14498
14499            next_offset += envelope_size;
14500
14501            // Decode the remaining unknown envelopes.
14502            while next_offset < end_offset {
14503                _next_ordinal_to_read += 1;
14504                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
14505                next_offset += envelope_size;
14506            }
14507
14508            Ok(())
14509        }
14510    }
14511
14512    impl ViewBoundProtocols {
14513        #[inline(always)]
14514        fn max_ordinal_present(&self) -> u64 {
14515            if let Some(_) = self.mouse_source {
14516                return 4;
14517            }
14518            if let Some(_) = self.touch_source {
14519                return 3;
14520            }
14521            if let Some(_) = self.view_focuser {
14522                return 2;
14523            }
14524            if let Some(_) = self.view_ref_focused {
14525                return 1;
14526            }
14527            0
14528        }
14529    }
14530
14531    impl fidl::encoding::ResourceTypeMarker for ViewBoundProtocols {
14532        type Borrowed<'a> = &'a mut Self;
14533        fn take_or_borrow<'a>(
14534            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
14535        ) -> Self::Borrowed<'a> {
14536            value
14537        }
14538    }
14539
14540    unsafe impl fidl::encoding::TypeMarker for ViewBoundProtocols {
14541        type Owned = Self;
14542
14543        #[inline(always)]
14544        fn inline_align(_context: fidl::encoding::Context) -> usize {
14545            8
14546        }
14547
14548        #[inline(always)]
14549        fn inline_size(_context: fidl::encoding::Context) -> usize {
14550            16
14551        }
14552    }
14553
14554    unsafe impl
14555        fidl::encoding::Encode<ViewBoundProtocols, fidl::encoding::DefaultFuchsiaResourceDialect>
14556        for &mut ViewBoundProtocols
14557    {
14558        unsafe fn encode(
14559            self,
14560            encoder: &mut fidl::encoding::Encoder<
14561                '_,
14562                fidl::encoding::DefaultFuchsiaResourceDialect,
14563            >,
14564            offset: usize,
14565            mut depth: fidl::encoding::Depth,
14566        ) -> fidl::Result<()> {
14567            encoder.debug_check_bounds::<ViewBoundProtocols>(offset);
14568            // Vector header
14569            let max_ordinal: u64 = self.max_ordinal_present();
14570            encoder.write_num(max_ordinal, offset);
14571            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
14572            // Calling encoder.out_of_line_offset(0) is not allowed.
14573            if max_ordinal == 0 {
14574                return Ok(());
14575            }
14576            depth.increment()?;
14577            let envelope_size = 8;
14578            let bytes_len = max_ordinal as usize * envelope_size;
14579            #[allow(unused_variables)]
14580            let offset = encoder.out_of_line_offset(bytes_len);
14581            let mut _prev_end_offset: usize = 0;
14582            if 1 > max_ordinal {
14583                return Ok(());
14584            }
14585
14586            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
14587            // are envelope_size bytes.
14588            let cur_offset: usize = (1 - 1) * envelope_size;
14589
14590            // Zero reserved fields.
14591            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
14592
14593            // Safety:
14594            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
14595            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
14596            //   envelope_size bytes, there is always sufficient room.
14597            fidl::encoding::encode_in_envelope_optional::<
14598                fidl::encoding::Endpoint<
14599                    fidl::endpoints::ServerEnd<fidl_fuchsia_ui_views::ViewRefFocusedMarker>,
14600                >,
14601                fidl::encoding::DefaultFuchsiaResourceDialect,
14602            >(
14603                self.view_ref_focused.as_mut().map(
14604                    <fidl::encoding::Endpoint<
14605                        fidl::endpoints::ServerEnd<fidl_fuchsia_ui_views::ViewRefFocusedMarker>,
14606                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
14607                ),
14608                encoder,
14609                offset + cur_offset,
14610                depth,
14611            )?;
14612
14613            _prev_end_offset = cur_offset + envelope_size;
14614            if 2 > max_ordinal {
14615                return Ok(());
14616            }
14617
14618            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
14619            // are envelope_size bytes.
14620            let cur_offset: usize = (2 - 1) * envelope_size;
14621
14622            // Zero reserved fields.
14623            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
14624
14625            // Safety:
14626            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
14627            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
14628            //   envelope_size bytes, there is always sufficient room.
14629            fidl::encoding::encode_in_envelope_optional::<
14630                fidl::encoding::Endpoint<
14631                    fidl::endpoints::ServerEnd<fidl_fuchsia_ui_views::FocuserMarker>,
14632                >,
14633                fidl::encoding::DefaultFuchsiaResourceDialect,
14634            >(
14635                self.view_focuser.as_mut().map(
14636                    <fidl::encoding::Endpoint<
14637                        fidl::endpoints::ServerEnd<fidl_fuchsia_ui_views::FocuserMarker>,
14638                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
14639                ),
14640                encoder,
14641                offset + cur_offset,
14642                depth,
14643            )?;
14644
14645            _prev_end_offset = cur_offset + envelope_size;
14646            if 3 > max_ordinal {
14647                return Ok(());
14648            }
14649
14650            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
14651            // are envelope_size bytes.
14652            let cur_offset: usize = (3 - 1) * envelope_size;
14653
14654            // Zero reserved fields.
14655            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
14656
14657            // Safety:
14658            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
14659            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
14660            //   envelope_size bytes, there is always sufficient room.
14661            fidl::encoding::encode_in_envelope_optional::<
14662                fidl::encoding::Endpoint<
14663                    fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::TouchSourceMarker>,
14664                >,
14665                fidl::encoding::DefaultFuchsiaResourceDialect,
14666            >(
14667                self.touch_source.as_mut().map(
14668                    <fidl::encoding::Endpoint<
14669                        fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::TouchSourceMarker>,
14670                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
14671                ),
14672                encoder,
14673                offset + cur_offset,
14674                depth,
14675            )?;
14676
14677            _prev_end_offset = cur_offset + envelope_size;
14678            if 4 > max_ordinal {
14679                return Ok(());
14680            }
14681
14682            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
14683            // are envelope_size bytes.
14684            let cur_offset: usize = (4 - 1) * envelope_size;
14685
14686            // Zero reserved fields.
14687            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
14688
14689            // Safety:
14690            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
14691            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
14692            //   envelope_size bytes, there is always sufficient room.
14693            fidl::encoding::encode_in_envelope_optional::<
14694                fidl::encoding::Endpoint<
14695                    fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::MouseSourceMarker>,
14696                >,
14697                fidl::encoding::DefaultFuchsiaResourceDialect,
14698            >(
14699                self.mouse_source.as_mut().map(
14700                    <fidl::encoding::Endpoint<
14701                        fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::MouseSourceMarker>,
14702                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
14703                ),
14704                encoder,
14705                offset + cur_offset,
14706                depth,
14707            )?;
14708
14709            _prev_end_offset = cur_offset + envelope_size;
14710
14711            Ok(())
14712        }
14713    }
14714
14715    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
14716        for ViewBoundProtocols
14717    {
14718        #[inline(always)]
14719        fn new_empty() -> Self {
14720            Self::default()
14721        }
14722
14723        unsafe fn decode(
14724            &mut self,
14725            decoder: &mut fidl::encoding::Decoder<
14726                '_,
14727                fidl::encoding::DefaultFuchsiaResourceDialect,
14728            >,
14729            offset: usize,
14730            mut depth: fidl::encoding::Depth,
14731        ) -> fidl::Result<()> {
14732            decoder.debug_check_bounds::<Self>(offset);
14733            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
14734                None => return Err(fidl::Error::NotNullable),
14735                Some(len) => len,
14736            };
14737            // Calling decoder.out_of_line_offset(0) is not allowed.
14738            if len == 0 {
14739                return Ok(());
14740            };
14741            depth.increment()?;
14742            let envelope_size = 8;
14743            let bytes_len = len * envelope_size;
14744            let offset = decoder.out_of_line_offset(bytes_len)?;
14745            // Decode the envelope for each type.
14746            let mut _next_ordinal_to_read = 0;
14747            let mut next_offset = offset;
14748            let end_offset = offset + bytes_len;
14749            _next_ordinal_to_read += 1;
14750            if next_offset >= end_offset {
14751                return Ok(());
14752            }
14753
14754            // Decode unknown envelopes for gaps in ordinals.
14755            while _next_ordinal_to_read < 1 {
14756                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
14757                _next_ordinal_to_read += 1;
14758                next_offset += envelope_size;
14759            }
14760
14761            let next_out_of_line = decoder.next_out_of_line();
14762            let handles_before = decoder.remaining_handles();
14763            if let Some((inlined, num_bytes, num_handles)) =
14764                fidl::encoding::decode_envelope_header(decoder, next_offset)?
14765            {
14766                let member_inline_size = <fidl::encoding::Endpoint<
14767                    fidl::endpoints::ServerEnd<fidl_fuchsia_ui_views::ViewRefFocusedMarker>,
14768                > as fidl::encoding::TypeMarker>::inline_size(
14769                    decoder.context
14770                );
14771                if inlined != (member_inline_size <= 4) {
14772                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
14773                }
14774                let inner_offset;
14775                let mut inner_depth = depth.clone();
14776                if inlined {
14777                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
14778                    inner_offset = next_offset;
14779                } else {
14780                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
14781                    inner_depth.increment()?;
14782                }
14783                let val_ref = self.view_ref_focused.get_or_insert_with(|| {
14784                    fidl::new_empty!(
14785                        fidl::encoding::Endpoint<
14786                            fidl::endpoints::ServerEnd<fidl_fuchsia_ui_views::ViewRefFocusedMarker>,
14787                        >,
14788                        fidl::encoding::DefaultFuchsiaResourceDialect
14789                    )
14790                });
14791                fidl::decode!(
14792                    fidl::encoding::Endpoint<
14793                        fidl::endpoints::ServerEnd<fidl_fuchsia_ui_views::ViewRefFocusedMarker>,
14794                    >,
14795                    fidl::encoding::DefaultFuchsiaResourceDialect,
14796                    val_ref,
14797                    decoder,
14798                    inner_offset,
14799                    inner_depth
14800                )?;
14801                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
14802                {
14803                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
14804                }
14805                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
14806                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
14807                }
14808            }
14809
14810            next_offset += envelope_size;
14811            _next_ordinal_to_read += 1;
14812            if next_offset >= end_offset {
14813                return Ok(());
14814            }
14815
14816            // Decode unknown envelopes for gaps in ordinals.
14817            while _next_ordinal_to_read < 2 {
14818                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
14819                _next_ordinal_to_read += 1;
14820                next_offset += envelope_size;
14821            }
14822
14823            let next_out_of_line = decoder.next_out_of_line();
14824            let handles_before = decoder.remaining_handles();
14825            if let Some((inlined, num_bytes, num_handles)) =
14826                fidl::encoding::decode_envelope_header(decoder, next_offset)?
14827            {
14828                let member_inline_size = <fidl::encoding::Endpoint<
14829                    fidl::endpoints::ServerEnd<fidl_fuchsia_ui_views::FocuserMarker>,
14830                > as fidl::encoding::TypeMarker>::inline_size(
14831                    decoder.context
14832                );
14833                if inlined != (member_inline_size <= 4) {
14834                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
14835                }
14836                let inner_offset;
14837                let mut inner_depth = depth.clone();
14838                if inlined {
14839                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
14840                    inner_offset = next_offset;
14841                } else {
14842                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
14843                    inner_depth.increment()?;
14844                }
14845                let val_ref = self.view_focuser.get_or_insert_with(|| {
14846                    fidl::new_empty!(
14847                        fidl::encoding::Endpoint<
14848                            fidl::endpoints::ServerEnd<fidl_fuchsia_ui_views::FocuserMarker>,
14849                        >,
14850                        fidl::encoding::DefaultFuchsiaResourceDialect
14851                    )
14852                });
14853                fidl::decode!(
14854                    fidl::encoding::Endpoint<
14855                        fidl::endpoints::ServerEnd<fidl_fuchsia_ui_views::FocuserMarker>,
14856                    >,
14857                    fidl::encoding::DefaultFuchsiaResourceDialect,
14858                    val_ref,
14859                    decoder,
14860                    inner_offset,
14861                    inner_depth
14862                )?;
14863                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
14864                {
14865                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
14866                }
14867                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
14868                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
14869                }
14870            }
14871
14872            next_offset += envelope_size;
14873            _next_ordinal_to_read += 1;
14874            if next_offset >= end_offset {
14875                return Ok(());
14876            }
14877
14878            // Decode unknown envelopes for gaps in ordinals.
14879            while _next_ordinal_to_read < 3 {
14880                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
14881                _next_ordinal_to_read += 1;
14882                next_offset += envelope_size;
14883            }
14884
14885            let next_out_of_line = decoder.next_out_of_line();
14886            let handles_before = decoder.remaining_handles();
14887            if let Some((inlined, num_bytes, num_handles)) =
14888                fidl::encoding::decode_envelope_header(decoder, next_offset)?
14889            {
14890                let member_inline_size = <fidl::encoding::Endpoint<
14891                    fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::TouchSourceMarker>,
14892                > as fidl::encoding::TypeMarker>::inline_size(
14893                    decoder.context
14894                );
14895                if inlined != (member_inline_size <= 4) {
14896                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
14897                }
14898                let inner_offset;
14899                let mut inner_depth = depth.clone();
14900                if inlined {
14901                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
14902                    inner_offset = next_offset;
14903                } else {
14904                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
14905                    inner_depth.increment()?;
14906                }
14907                let val_ref = self.touch_source.get_or_insert_with(|| {
14908                    fidl::new_empty!(
14909                        fidl::encoding::Endpoint<
14910                            fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::TouchSourceMarker>,
14911                        >,
14912                        fidl::encoding::DefaultFuchsiaResourceDialect
14913                    )
14914                });
14915                fidl::decode!(
14916                    fidl::encoding::Endpoint<
14917                        fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::TouchSourceMarker>,
14918                    >,
14919                    fidl::encoding::DefaultFuchsiaResourceDialect,
14920                    val_ref,
14921                    decoder,
14922                    inner_offset,
14923                    inner_depth
14924                )?;
14925                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
14926                {
14927                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
14928                }
14929                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
14930                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
14931                }
14932            }
14933
14934            next_offset += envelope_size;
14935            _next_ordinal_to_read += 1;
14936            if next_offset >= end_offset {
14937                return Ok(());
14938            }
14939
14940            // Decode unknown envelopes for gaps in ordinals.
14941            while _next_ordinal_to_read < 4 {
14942                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
14943                _next_ordinal_to_read += 1;
14944                next_offset += envelope_size;
14945            }
14946
14947            let next_out_of_line = decoder.next_out_of_line();
14948            let handles_before = decoder.remaining_handles();
14949            if let Some((inlined, num_bytes, num_handles)) =
14950                fidl::encoding::decode_envelope_header(decoder, next_offset)?
14951            {
14952                let member_inline_size = <fidl::encoding::Endpoint<
14953                    fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::MouseSourceMarker>,
14954                > as fidl::encoding::TypeMarker>::inline_size(
14955                    decoder.context
14956                );
14957                if inlined != (member_inline_size <= 4) {
14958                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
14959                }
14960                let inner_offset;
14961                let mut inner_depth = depth.clone();
14962                if inlined {
14963                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
14964                    inner_offset = next_offset;
14965                } else {
14966                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
14967                    inner_depth.increment()?;
14968                }
14969                let val_ref = self.mouse_source.get_or_insert_with(|| {
14970                    fidl::new_empty!(
14971                        fidl::encoding::Endpoint<
14972                            fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::MouseSourceMarker>,
14973                        >,
14974                        fidl::encoding::DefaultFuchsiaResourceDialect
14975                    )
14976                });
14977                fidl::decode!(
14978                    fidl::encoding::Endpoint<
14979                        fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::MouseSourceMarker>,
14980                    >,
14981                    fidl::encoding::DefaultFuchsiaResourceDialect,
14982                    val_ref,
14983                    decoder,
14984                    inner_offset,
14985                    inner_depth
14986                )?;
14987                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
14988                {
14989                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
14990                }
14991                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
14992                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
14993                }
14994            }
14995
14996            next_offset += envelope_size;
14997
14998            // Decode the remaining unknown envelopes.
14999            while next_offset < end_offset {
15000                _next_ordinal_to_read += 1;
15001                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
15002                next_offset += envelope_size;
15003            }
15004
15005            Ok(())
15006        }
15007    }
15008}