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 [Flatland] protocol to be created.
165    pub server_end: fidl::endpoints::ServerEnd<FlatlandMarker>,
166    /// The configuration for the new Flatland session. 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 [Flatland] service instead of connecting via the factory.
427#[derive(Debug, Default, PartialEq)]
428pub struct TrustedFlatlandConfig {
429    /// If true and the [PresentArgs.requested_presentation_time] passed to [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    /// If true, the client will not receive [Flatland.OnFramePresented] events.
452    ///
453    /// If absent, `skips_on_frame_presented` is false.
454    pub skips_on_frame_presented: Option<bool>,
455    #[doc(hidden)]
456    pub __source_breaking: fidl::marker::SourceBreaking,
457}
458
459impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for TrustedFlatlandConfig {}
460
461/// The protocol endpoints bound to a Flatland ViewCreationToken. These protocols operate on the
462/// View that ViewCreationToken created in the Flatland session.
463#[derive(Debug, Default, PartialEq)]
464pub struct ViewBoundProtocols {
465    /// Learn when a View gains focus.
466    ///
467    /// Server-bound ViewRef. The [`view_ref_focused`] client does not specify the ViewRef
468    /// explicitly; instead, the server implementation uses the ViewRef used in View creation for
469    /// reporting focus movement on/off this View.
470    pub view_ref_focused:
471        Option<fidl::endpoints::ServerEnd<fidl_fuchsia_ui_views::ViewRefFocusedMarker>>,
472    /// Enable a View to request focus transfer to a child (target) View.
473    ///
474    /// Server-bound ViewRef. The [`view_focuser`] client does not specify the "requestor" ViewRef
475    /// explicitly, only the "target" ViewRef. Instead, the server implementation uses the ViewRef
476    /// used in View creation as the "requestor" ViewRef.
477    pub view_focuser: Option<fidl::endpoints::ServerEnd<fidl_fuchsia_ui_views::FocuserMarker>>,
478    /// Receive touch events that are associated with a View.
479    pub touch_source:
480        Option<fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::TouchSourceMarker>>,
481    /// Receive mouse events that are associated with a View.
482    pub mouse_source:
483        Option<fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::MouseSourceMarker>>,
484    #[doc(hidden)]
485    pub __source_breaking: fidl::marker::SourceBreaking,
486}
487
488impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for ViewBoundProtocols {}
489
490#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
491pub struct AllocatorMarker;
492
493impl fidl::endpoints::ProtocolMarker for AllocatorMarker {
494    type Proxy = AllocatorProxy;
495    type RequestStream = AllocatorRequestStream;
496    #[cfg(target_os = "fuchsia")]
497    type SynchronousProxy = AllocatorSynchronousProxy;
498
499    const DEBUG_NAME: &'static str = "fuchsia.ui.composition.Allocator";
500}
501impl fidl::endpoints::DiscoverableProtocolMarker for AllocatorMarker {}
502pub type AllocatorRegisterBufferCollectionResult = Result<(), RegisterBufferCollectionError>;
503
504pub trait AllocatorProxyInterface: Send + Sync {
505    type RegisterBufferCollectionResponseFut: std::future::Future<Output = Result<AllocatorRegisterBufferCollectionResult, fidl::Error>>
506        + Send;
507    fn r#register_buffer_collection(
508        &self,
509        args: RegisterBufferCollectionArgs,
510    ) -> Self::RegisterBufferCollectionResponseFut;
511}
512#[derive(Debug)]
513#[cfg(target_os = "fuchsia")]
514pub struct AllocatorSynchronousProxy {
515    client: fidl::client::sync::Client,
516}
517
518#[cfg(target_os = "fuchsia")]
519impl fidl::endpoints::SynchronousProxy for AllocatorSynchronousProxy {
520    type Proxy = AllocatorProxy;
521    type Protocol = AllocatorMarker;
522
523    fn from_channel(inner: fidl::Channel) -> Self {
524        Self::new(inner)
525    }
526
527    fn into_channel(self) -> fidl::Channel {
528        self.client.into_channel()
529    }
530
531    fn as_channel(&self) -> &fidl::Channel {
532        self.client.as_channel()
533    }
534}
535
536#[cfg(target_os = "fuchsia")]
537impl AllocatorSynchronousProxy {
538    pub fn new(channel: fidl::Channel) -> Self {
539        Self { client: fidl::client::sync::Client::new(channel) }
540    }
541
542    pub fn into_channel(self) -> fidl::Channel {
543        self.client.into_channel()
544    }
545
546    /// Waits until an event arrives and returns it. It is safe for other
547    /// threads to make concurrent requests while waiting for an event.
548    pub fn wait_for_event(
549        &self,
550        deadline: zx::MonotonicInstant,
551    ) -> Result<AllocatorEvent, fidl::Error> {
552        AllocatorEvent::decode(self.client.wait_for_event::<AllocatorMarker>(deadline)?)
553    }
554
555    /// A BufferCollection is a set of VMOs created by Sysmem and shared by a number of
556    /// participants, one of which is the Flatland Renderer. Some content, such as Images, use a
557    /// BufferCollection as their backing memory.
558    ///
559    /// See [`RegisterBufferCollectionArgs`] for information on each argument.
560    pub fn r#register_buffer_collection(
561        &self,
562        mut args: RegisterBufferCollectionArgs,
563        ___deadline: zx::MonotonicInstant,
564    ) -> Result<AllocatorRegisterBufferCollectionResult, fidl::Error> {
565        let _response = self
566            .client
567            .send_query::<AllocatorRegisterBufferCollectionRequest, fidl::encoding::ResultType<
568                fidl::encoding::EmptyStruct,
569                RegisterBufferCollectionError,
570            >, AllocatorMarker>(
571                (&mut args,),
572                0x494b7ea578d1061e,
573                fidl::encoding::DynamicFlags::empty(),
574                ___deadline,
575            )?;
576        Ok(_response.map(|x| x))
577    }
578}
579
580#[cfg(target_os = "fuchsia")]
581impl From<AllocatorSynchronousProxy> for zx::NullableHandle {
582    fn from(value: AllocatorSynchronousProxy) -> Self {
583        value.into_channel().into()
584    }
585}
586
587#[cfg(target_os = "fuchsia")]
588impl From<fidl::Channel> for AllocatorSynchronousProxy {
589    fn from(value: fidl::Channel) -> Self {
590        Self::new(value)
591    }
592}
593
594#[cfg(target_os = "fuchsia")]
595impl fidl::endpoints::FromClient for AllocatorSynchronousProxy {
596    type Protocol = AllocatorMarker;
597
598    fn from_client(value: fidl::endpoints::ClientEnd<AllocatorMarker>) -> Self {
599        Self::new(value.into_channel())
600    }
601}
602
603#[derive(Debug, Clone)]
604pub struct AllocatorProxy {
605    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
606}
607
608impl fidl::endpoints::Proxy for AllocatorProxy {
609    type Protocol = AllocatorMarker;
610
611    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
612        Self::new(inner)
613    }
614
615    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
616        self.client.into_channel().map_err(|client| Self { client })
617    }
618
619    fn as_channel(&self) -> &::fidl::AsyncChannel {
620        self.client.as_channel()
621    }
622}
623
624impl AllocatorProxy {
625    /// Create a new Proxy for fuchsia.ui.composition/Allocator.
626    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
627        let protocol_name = <AllocatorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
628        Self { client: fidl::client::Client::new(channel, protocol_name) }
629    }
630
631    /// Get a Stream of events from the remote end of the protocol.
632    ///
633    /// # Panics
634    ///
635    /// Panics if the event stream was already taken.
636    pub fn take_event_stream(&self) -> AllocatorEventStream {
637        AllocatorEventStream { event_receiver: self.client.take_event_receiver() }
638    }
639
640    /// A BufferCollection is a set of VMOs created by Sysmem and shared by a number of
641    /// participants, one of which is the Flatland Renderer. Some content, such as Images, use a
642    /// BufferCollection as their backing memory.
643    ///
644    /// See [`RegisterBufferCollectionArgs`] for information on each argument.
645    pub fn r#register_buffer_collection(
646        &self,
647        mut args: RegisterBufferCollectionArgs,
648    ) -> fidl::client::QueryResponseFut<
649        AllocatorRegisterBufferCollectionResult,
650        fidl::encoding::DefaultFuchsiaResourceDialect,
651    > {
652        AllocatorProxyInterface::r#register_buffer_collection(self, args)
653    }
654}
655
656impl AllocatorProxyInterface for AllocatorProxy {
657    type RegisterBufferCollectionResponseFut = fidl::client::QueryResponseFut<
658        AllocatorRegisterBufferCollectionResult,
659        fidl::encoding::DefaultFuchsiaResourceDialect,
660    >;
661    fn r#register_buffer_collection(
662        &self,
663        mut args: RegisterBufferCollectionArgs,
664    ) -> Self::RegisterBufferCollectionResponseFut {
665        fn _decode(
666            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
667        ) -> Result<AllocatorRegisterBufferCollectionResult, fidl::Error> {
668            let _response = fidl::client::decode_transaction_body::<
669                fidl::encoding::ResultType<
670                    fidl::encoding::EmptyStruct,
671                    RegisterBufferCollectionError,
672                >,
673                fidl::encoding::DefaultFuchsiaResourceDialect,
674                0x494b7ea578d1061e,
675            >(_buf?)?;
676            Ok(_response.map(|x| x))
677        }
678        self.client.send_query_and_decode::<
679            AllocatorRegisterBufferCollectionRequest,
680            AllocatorRegisterBufferCollectionResult,
681        >(
682            (&mut args,),
683            0x494b7ea578d1061e,
684            fidl::encoding::DynamicFlags::empty(),
685            _decode,
686        )
687    }
688}
689
690pub struct AllocatorEventStream {
691    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
692}
693
694impl std::marker::Unpin for AllocatorEventStream {}
695
696impl futures::stream::FusedStream for AllocatorEventStream {
697    fn is_terminated(&self) -> bool {
698        self.event_receiver.is_terminated()
699    }
700}
701
702impl futures::Stream for AllocatorEventStream {
703    type Item = Result<AllocatorEvent, fidl::Error>;
704
705    fn poll_next(
706        mut self: std::pin::Pin<&mut Self>,
707        cx: &mut std::task::Context<'_>,
708    ) -> std::task::Poll<Option<Self::Item>> {
709        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
710            &mut self.event_receiver,
711            cx
712        )?) {
713            Some(buf) => std::task::Poll::Ready(Some(AllocatorEvent::decode(buf))),
714            None => std::task::Poll::Ready(None),
715        }
716    }
717}
718
719#[derive(Debug)]
720pub enum AllocatorEvent {}
721
722impl AllocatorEvent {
723    /// Decodes a message buffer as a [`AllocatorEvent`].
724    fn decode(
725        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
726    ) -> Result<AllocatorEvent, fidl::Error> {
727        let (bytes, _handles) = buf.split_mut();
728        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
729        debug_assert_eq!(tx_header.tx_id, 0);
730        match tx_header.ordinal {
731            _ => Err(fidl::Error::UnknownOrdinal {
732                ordinal: tx_header.ordinal,
733                protocol_name: <AllocatorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
734            }),
735        }
736    }
737}
738
739/// A Stream of incoming requests for fuchsia.ui.composition/Allocator.
740pub struct AllocatorRequestStream {
741    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
742    is_terminated: bool,
743}
744
745impl std::marker::Unpin for AllocatorRequestStream {}
746
747impl futures::stream::FusedStream for AllocatorRequestStream {
748    fn is_terminated(&self) -> bool {
749        self.is_terminated
750    }
751}
752
753impl fidl::endpoints::RequestStream for AllocatorRequestStream {
754    type Protocol = AllocatorMarker;
755    type ControlHandle = AllocatorControlHandle;
756
757    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
758        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
759    }
760
761    fn control_handle(&self) -> Self::ControlHandle {
762        AllocatorControlHandle { inner: self.inner.clone() }
763    }
764
765    fn into_inner(
766        self,
767    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
768    {
769        (self.inner, self.is_terminated)
770    }
771
772    fn from_inner(
773        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
774        is_terminated: bool,
775    ) -> Self {
776        Self { inner, is_terminated }
777    }
778}
779
780impl futures::Stream for AllocatorRequestStream {
781    type Item = Result<AllocatorRequest, fidl::Error>;
782
783    fn poll_next(
784        mut self: std::pin::Pin<&mut Self>,
785        cx: &mut std::task::Context<'_>,
786    ) -> std::task::Poll<Option<Self::Item>> {
787        let this = &mut *self;
788        if this.inner.check_shutdown(cx) {
789            this.is_terminated = true;
790            return std::task::Poll::Ready(None);
791        }
792        if this.is_terminated {
793            panic!("polled AllocatorRequestStream after completion");
794        }
795        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
796            |bytes, handles| {
797                match this.inner.channel().read_etc(cx, bytes, handles) {
798                    std::task::Poll::Ready(Ok(())) => {}
799                    std::task::Poll::Pending => return std::task::Poll::Pending,
800                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
801                        this.is_terminated = true;
802                        return std::task::Poll::Ready(None);
803                    }
804                    std::task::Poll::Ready(Err(e)) => {
805                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
806                            e.into(),
807                        ))));
808                    }
809                }
810
811                // A message has been received from the channel
812                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
813
814                std::task::Poll::Ready(Some(match header.ordinal {
815                    0x494b7ea578d1061e => {
816                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
817                        let mut req = fidl::new_empty!(
818                            AllocatorRegisterBufferCollectionRequest,
819                            fidl::encoding::DefaultFuchsiaResourceDialect
820                        );
821                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AllocatorRegisterBufferCollectionRequest>(&header, _body_bytes, handles, &mut req)?;
822                        let control_handle = AllocatorControlHandle { inner: this.inner.clone() };
823                        Ok(AllocatorRequest::RegisterBufferCollection {
824                            args: req.args,
825
826                            responder: AllocatorRegisterBufferCollectionResponder {
827                                control_handle: std::mem::ManuallyDrop::new(control_handle),
828                                tx_id: header.tx_id,
829                            },
830                        })
831                    }
832                    _ => Err(fidl::Error::UnknownOrdinal {
833                        ordinal: header.ordinal,
834                        protocol_name:
835                            <AllocatorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
836                    }),
837                }))
838            },
839        )
840    }
841}
842
843#[derive(Debug)]
844pub enum AllocatorRequest {
845    /// A BufferCollection is a set of VMOs created by Sysmem and shared by a number of
846    /// participants, one of which is the Flatland Renderer. Some content, such as Images, use a
847    /// BufferCollection as their backing memory.
848    ///
849    /// See [`RegisterBufferCollectionArgs`] for information on each argument.
850    RegisterBufferCollection {
851        args: RegisterBufferCollectionArgs,
852        responder: AllocatorRegisterBufferCollectionResponder,
853    },
854}
855
856impl AllocatorRequest {
857    #[allow(irrefutable_let_patterns)]
858    pub fn into_register_buffer_collection(
859        self,
860    ) -> Option<(RegisterBufferCollectionArgs, AllocatorRegisterBufferCollectionResponder)> {
861        if let AllocatorRequest::RegisterBufferCollection { args, responder } = self {
862            Some((args, responder))
863        } else {
864            None
865        }
866    }
867
868    /// Name of the method defined in FIDL
869    pub fn method_name(&self) -> &'static str {
870        match *self {
871            AllocatorRequest::RegisterBufferCollection { .. } => "register_buffer_collection",
872        }
873    }
874}
875
876#[derive(Debug, Clone)]
877pub struct AllocatorControlHandle {
878    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
879}
880
881impl AllocatorControlHandle {
882    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
883        self.inner.shutdown_with_epitaph(status.into())
884    }
885}
886
887impl fidl::endpoints::ControlHandle for AllocatorControlHandle {
888    fn shutdown(&self) {
889        self.inner.shutdown()
890    }
891
892    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
893        self.inner.shutdown_with_epitaph(status)
894    }
895
896    fn is_closed(&self) -> bool {
897        self.inner.channel().is_closed()
898    }
899    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
900        self.inner.channel().on_closed()
901    }
902
903    #[cfg(target_os = "fuchsia")]
904    fn signal_peer(
905        &self,
906        clear_mask: zx::Signals,
907        set_mask: zx::Signals,
908    ) -> Result<(), zx_status::Status> {
909        use fidl::Peered;
910        self.inner.channel().signal_peer(clear_mask, set_mask)
911    }
912}
913
914impl AllocatorControlHandle {}
915
916#[must_use = "FIDL methods require a response to be sent"]
917#[derive(Debug)]
918pub struct AllocatorRegisterBufferCollectionResponder {
919    control_handle: std::mem::ManuallyDrop<AllocatorControlHandle>,
920    tx_id: u32,
921}
922
923/// Set the the channel to be shutdown (see [`AllocatorControlHandle::shutdown`])
924/// if the responder is dropped without sending a response, so that the client
925/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
926impl std::ops::Drop for AllocatorRegisterBufferCollectionResponder {
927    fn drop(&mut self) {
928        self.control_handle.shutdown();
929        // Safety: drops once, never accessed again
930        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
931    }
932}
933
934impl fidl::endpoints::Responder for AllocatorRegisterBufferCollectionResponder {
935    type ControlHandle = AllocatorControlHandle;
936
937    fn control_handle(&self) -> &AllocatorControlHandle {
938        &self.control_handle
939    }
940
941    fn drop_without_shutdown(mut self) {
942        // Safety: drops once, never accessed again due to mem::forget
943        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
944        // Prevent Drop from running (which would shut down the channel)
945        std::mem::forget(self);
946    }
947}
948
949impl AllocatorRegisterBufferCollectionResponder {
950    /// Sends a response to the FIDL transaction.
951    ///
952    /// Sets the channel to shutdown if an error occurs.
953    pub fn send(
954        self,
955        mut result: Result<(), RegisterBufferCollectionError>,
956    ) -> Result<(), fidl::Error> {
957        let _result = self.send_raw(result);
958        if _result.is_err() {
959            self.control_handle.shutdown();
960        }
961        self.drop_without_shutdown();
962        _result
963    }
964
965    /// Similar to "send" but does not shutdown the channel if an error occurs.
966    pub fn send_no_shutdown_on_err(
967        self,
968        mut result: Result<(), RegisterBufferCollectionError>,
969    ) -> Result<(), fidl::Error> {
970        let _result = self.send_raw(result);
971        self.drop_without_shutdown();
972        _result
973    }
974
975    fn send_raw(
976        &self,
977        mut result: Result<(), RegisterBufferCollectionError>,
978    ) -> Result<(), fidl::Error> {
979        self.control_handle.inner.send::<fidl::encoding::ResultType<
980            fidl::encoding::EmptyStruct,
981            RegisterBufferCollectionError,
982        >>(
983            result,
984            self.tx_id,
985            0x494b7ea578d1061e,
986            fidl::encoding::DynamicFlags::empty(),
987        )
988    }
989}
990
991#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
992pub struct ChildViewWatcherMarker;
993
994impl fidl::endpoints::ProtocolMarker for ChildViewWatcherMarker {
995    type Proxy = ChildViewWatcherProxy;
996    type RequestStream = ChildViewWatcherRequestStream;
997    #[cfg(target_os = "fuchsia")]
998    type SynchronousProxy = ChildViewWatcherSynchronousProxy;
999
1000    const DEBUG_NAME: &'static str = "(anonymous) ChildViewWatcher";
1001}
1002
1003pub trait ChildViewWatcherProxyInterface: Send + Sync {
1004    type GetStatusResponseFut: std::future::Future<Output = Result<ChildViewStatus, fidl::Error>>
1005        + Send;
1006    fn r#get_status(&self) -> Self::GetStatusResponseFut;
1007    type GetViewRefResponseFut: std::future::Future<Output = Result<fidl_fuchsia_ui_views::ViewRef, fidl::Error>>
1008        + Send;
1009    fn r#get_view_ref(&self) -> Self::GetViewRefResponseFut;
1010}
1011#[derive(Debug)]
1012#[cfg(target_os = "fuchsia")]
1013pub struct ChildViewWatcherSynchronousProxy {
1014    client: fidl::client::sync::Client,
1015}
1016
1017#[cfg(target_os = "fuchsia")]
1018impl fidl::endpoints::SynchronousProxy for ChildViewWatcherSynchronousProxy {
1019    type Proxy = ChildViewWatcherProxy;
1020    type Protocol = ChildViewWatcherMarker;
1021
1022    fn from_channel(inner: fidl::Channel) -> Self {
1023        Self::new(inner)
1024    }
1025
1026    fn into_channel(self) -> fidl::Channel {
1027        self.client.into_channel()
1028    }
1029
1030    fn as_channel(&self) -> &fidl::Channel {
1031        self.client.as_channel()
1032    }
1033}
1034
1035#[cfg(target_os = "fuchsia")]
1036impl ChildViewWatcherSynchronousProxy {
1037    pub fn new(channel: fidl::Channel) -> Self {
1038        Self { client: fidl::client::sync::Client::new(channel) }
1039    }
1040
1041    pub fn into_channel(self) -> fidl::Channel {
1042        self.client.into_channel()
1043    }
1044
1045    /// Waits until an event arrives and returns it. It is safe for other
1046    /// threads to make concurrent requests while waiting for an event.
1047    pub fn wait_for_event(
1048        &self,
1049        deadline: zx::MonotonicInstant,
1050    ) -> Result<ChildViewWatcherEvent, fidl::Error> {
1051        ChildViewWatcherEvent::decode(
1052            self.client.wait_for_event::<ChildViewWatcherMarker>(deadline)?,
1053        )
1054    }
1055
1056    /// A hanging get for receiving the status of a View. This provides information to the parent,
1057    /// such as whether or not the child has successfully presented content through this View.
1058    ///
1059    /// This hanging get will only fire when the ChildViewStatus is different than the previously
1060    /// returned ChildViewStatus.  This can happen immediately, and even if the creator of the
1061    /// Viewport hasn't yet called Present() after calling CreateViewport().  This allows the parent
1062    /// to know that the child has content ready to display before the parent modifies their own
1063    /// local scene graph to incorporate the child content.
1064    ///
1065    /// It is invalid to call `GetStatus` while a previous call is still pending. Doing so will
1066    /// cause both this channel and the Flatland channel that handed out ChildViewWatcher to be
1067    /// closed.
1068    pub fn r#get_status(
1069        &self,
1070        ___deadline: zx::MonotonicInstant,
1071    ) -> Result<ChildViewStatus, fidl::Error> {
1072        let _response = self.client.send_query::<
1073            fidl::encoding::EmptyPayload,
1074            ChildViewWatcherGetStatusResponse,
1075            ChildViewWatcherMarker,
1076        >(
1077            (),
1078            0x1d622075f4fc8243,
1079            fidl::encoding::DynamicFlags::empty(),
1080            ___deadline,
1081        )?;
1082        Ok(_response.status)
1083    }
1084
1085    /// Hanging get to receive the ViewRef of the child View. This will only fire when the View ref
1086    /// is different from the previously-returned View ref. Note: currently the View ref will not
1087    /// change after it is first received, but this will change if/when the API changes to allow
1088    /// relinking of views.
1089    ///
1090    /// The ViewRef is not returned until the View is included in the View tree, in other words when
1091    /// there is a chain of ancestor transforms all the way back up to the root of the scene graph,
1092    /// i.e. the display.
1093    ///
1094    /// It is invalid to call `GetViewRef` while a previous call is still pending. Doing so will
1095    /// cause both this channel and the Flatland channel that handed out ChildViewWatcher to be
1096    /// closed.
1097    ///
1098    /// A `GetViewRef` call will hang if the View was created using `CreateView`, but returns the
1099    /// View if the View was created using CreateView2. This is because `CreateView` does not mint
1100    /// a ViewRef for that View.
1101    pub fn r#get_view_ref(
1102        &self,
1103        ___deadline: zx::MonotonicInstant,
1104    ) -> Result<fidl_fuchsia_ui_views::ViewRef, fidl::Error> {
1105        let _response = self.client.send_query::<
1106            fidl::encoding::EmptyPayload,
1107            ChildViewWatcherGetViewRefResponse,
1108            ChildViewWatcherMarker,
1109        >(
1110            (),
1111            0x3b2f3ca31e8908b4,
1112            fidl::encoding::DynamicFlags::empty(),
1113            ___deadline,
1114        )?;
1115        Ok(_response.view_ref)
1116    }
1117}
1118
1119#[cfg(target_os = "fuchsia")]
1120impl From<ChildViewWatcherSynchronousProxy> for zx::NullableHandle {
1121    fn from(value: ChildViewWatcherSynchronousProxy) -> Self {
1122        value.into_channel().into()
1123    }
1124}
1125
1126#[cfg(target_os = "fuchsia")]
1127impl From<fidl::Channel> for ChildViewWatcherSynchronousProxy {
1128    fn from(value: fidl::Channel) -> Self {
1129        Self::new(value)
1130    }
1131}
1132
1133#[cfg(target_os = "fuchsia")]
1134impl fidl::endpoints::FromClient for ChildViewWatcherSynchronousProxy {
1135    type Protocol = ChildViewWatcherMarker;
1136
1137    fn from_client(value: fidl::endpoints::ClientEnd<ChildViewWatcherMarker>) -> Self {
1138        Self::new(value.into_channel())
1139    }
1140}
1141
1142#[derive(Debug, Clone)]
1143pub struct ChildViewWatcherProxy {
1144    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1145}
1146
1147impl fidl::endpoints::Proxy for ChildViewWatcherProxy {
1148    type Protocol = ChildViewWatcherMarker;
1149
1150    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1151        Self::new(inner)
1152    }
1153
1154    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1155        self.client.into_channel().map_err(|client| Self { client })
1156    }
1157
1158    fn as_channel(&self) -> &::fidl::AsyncChannel {
1159        self.client.as_channel()
1160    }
1161}
1162
1163impl ChildViewWatcherProxy {
1164    /// Create a new Proxy for fuchsia.ui.composition/ChildViewWatcher.
1165    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1166        let protocol_name = <ChildViewWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1167        Self { client: fidl::client::Client::new(channel, protocol_name) }
1168    }
1169
1170    /// Get a Stream of events from the remote end of the protocol.
1171    ///
1172    /// # Panics
1173    ///
1174    /// Panics if the event stream was already taken.
1175    pub fn take_event_stream(&self) -> ChildViewWatcherEventStream {
1176        ChildViewWatcherEventStream { event_receiver: self.client.take_event_receiver() }
1177    }
1178
1179    /// A hanging get for receiving the status of a View. This provides information to the parent,
1180    /// such as whether or not the child has successfully presented content through this View.
1181    ///
1182    /// This hanging get will only fire when the ChildViewStatus is different than the previously
1183    /// returned ChildViewStatus.  This can happen immediately, and even if the creator of the
1184    /// Viewport hasn't yet called Present() after calling CreateViewport().  This allows the parent
1185    /// to know that the child has content ready to display before the parent modifies their own
1186    /// local scene graph to incorporate the child content.
1187    ///
1188    /// It is invalid to call `GetStatus` while a previous call is still pending. Doing so will
1189    /// cause both this channel and the Flatland channel that handed out ChildViewWatcher to be
1190    /// closed.
1191    pub fn r#get_status(
1192        &self,
1193    ) -> fidl::client::QueryResponseFut<
1194        ChildViewStatus,
1195        fidl::encoding::DefaultFuchsiaResourceDialect,
1196    > {
1197        ChildViewWatcherProxyInterface::r#get_status(self)
1198    }
1199
1200    /// Hanging get to receive the ViewRef of the child View. This will only fire when the View ref
1201    /// is different from the previously-returned View ref. Note: currently the View ref will not
1202    /// change after it is first received, but this will change if/when the API changes to allow
1203    /// relinking of views.
1204    ///
1205    /// The ViewRef is not returned until the View is included in the View tree, in other words when
1206    /// there is a chain of ancestor transforms all the way back up to the root of the scene graph,
1207    /// i.e. the display.
1208    ///
1209    /// It is invalid to call `GetViewRef` while a previous call is still pending. Doing so will
1210    /// cause both this channel and the Flatland channel that handed out ChildViewWatcher to be
1211    /// closed.
1212    ///
1213    /// A `GetViewRef` call will hang if the View was created using `CreateView`, but returns the
1214    /// View if the View was created using CreateView2. This is because `CreateView` does not mint
1215    /// a ViewRef for that View.
1216    pub fn r#get_view_ref(
1217        &self,
1218    ) -> fidl::client::QueryResponseFut<
1219        fidl_fuchsia_ui_views::ViewRef,
1220        fidl::encoding::DefaultFuchsiaResourceDialect,
1221    > {
1222        ChildViewWatcherProxyInterface::r#get_view_ref(self)
1223    }
1224}
1225
1226impl ChildViewWatcherProxyInterface for ChildViewWatcherProxy {
1227    type GetStatusResponseFut = fidl::client::QueryResponseFut<
1228        ChildViewStatus,
1229        fidl::encoding::DefaultFuchsiaResourceDialect,
1230    >;
1231    fn r#get_status(&self) -> Self::GetStatusResponseFut {
1232        fn _decode(
1233            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1234        ) -> Result<ChildViewStatus, fidl::Error> {
1235            let _response = fidl::client::decode_transaction_body::<
1236                ChildViewWatcherGetStatusResponse,
1237                fidl::encoding::DefaultFuchsiaResourceDialect,
1238                0x1d622075f4fc8243,
1239            >(_buf?)?;
1240            Ok(_response.status)
1241        }
1242        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ChildViewStatus>(
1243            (),
1244            0x1d622075f4fc8243,
1245            fidl::encoding::DynamicFlags::empty(),
1246            _decode,
1247        )
1248    }
1249
1250    type GetViewRefResponseFut = fidl::client::QueryResponseFut<
1251        fidl_fuchsia_ui_views::ViewRef,
1252        fidl::encoding::DefaultFuchsiaResourceDialect,
1253    >;
1254    fn r#get_view_ref(&self) -> Self::GetViewRefResponseFut {
1255        fn _decode(
1256            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1257        ) -> Result<fidl_fuchsia_ui_views::ViewRef, fidl::Error> {
1258            let _response = fidl::client::decode_transaction_body::<
1259                ChildViewWatcherGetViewRefResponse,
1260                fidl::encoding::DefaultFuchsiaResourceDialect,
1261                0x3b2f3ca31e8908b4,
1262            >(_buf?)?;
1263            Ok(_response.view_ref)
1264        }
1265        self.client
1266            .send_query_and_decode::<fidl::encoding::EmptyPayload, fidl_fuchsia_ui_views::ViewRef>(
1267                (),
1268                0x3b2f3ca31e8908b4,
1269                fidl::encoding::DynamicFlags::empty(),
1270                _decode,
1271            )
1272    }
1273}
1274
1275pub struct ChildViewWatcherEventStream {
1276    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1277}
1278
1279impl std::marker::Unpin for ChildViewWatcherEventStream {}
1280
1281impl futures::stream::FusedStream for ChildViewWatcherEventStream {
1282    fn is_terminated(&self) -> bool {
1283        self.event_receiver.is_terminated()
1284    }
1285}
1286
1287impl futures::Stream for ChildViewWatcherEventStream {
1288    type Item = Result<ChildViewWatcherEvent, fidl::Error>;
1289
1290    fn poll_next(
1291        mut self: std::pin::Pin<&mut Self>,
1292        cx: &mut std::task::Context<'_>,
1293    ) -> std::task::Poll<Option<Self::Item>> {
1294        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1295            &mut self.event_receiver,
1296            cx
1297        )?) {
1298            Some(buf) => std::task::Poll::Ready(Some(ChildViewWatcherEvent::decode(buf))),
1299            None => std::task::Poll::Ready(None),
1300        }
1301    }
1302}
1303
1304#[derive(Debug)]
1305pub enum ChildViewWatcherEvent {}
1306
1307impl ChildViewWatcherEvent {
1308    /// Decodes a message buffer as a [`ChildViewWatcherEvent`].
1309    fn decode(
1310        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1311    ) -> Result<ChildViewWatcherEvent, fidl::Error> {
1312        let (bytes, _handles) = buf.split_mut();
1313        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1314        debug_assert_eq!(tx_header.tx_id, 0);
1315        match tx_header.ordinal {
1316            _ => Err(fidl::Error::UnknownOrdinal {
1317                ordinal: tx_header.ordinal,
1318                protocol_name:
1319                    <ChildViewWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1320            }),
1321        }
1322    }
1323}
1324
1325/// A Stream of incoming requests for fuchsia.ui.composition/ChildViewWatcher.
1326pub struct ChildViewWatcherRequestStream {
1327    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1328    is_terminated: bool,
1329}
1330
1331impl std::marker::Unpin for ChildViewWatcherRequestStream {}
1332
1333impl futures::stream::FusedStream for ChildViewWatcherRequestStream {
1334    fn is_terminated(&self) -> bool {
1335        self.is_terminated
1336    }
1337}
1338
1339impl fidl::endpoints::RequestStream for ChildViewWatcherRequestStream {
1340    type Protocol = ChildViewWatcherMarker;
1341    type ControlHandle = ChildViewWatcherControlHandle;
1342
1343    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1344        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1345    }
1346
1347    fn control_handle(&self) -> Self::ControlHandle {
1348        ChildViewWatcherControlHandle { inner: self.inner.clone() }
1349    }
1350
1351    fn into_inner(
1352        self,
1353    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1354    {
1355        (self.inner, self.is_terminated)
1356    }
1357
1358    fn from_inner(
1359        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1360        is_terminated: bool,
1361    ) -> Self {
1362        Self { inner, is_terminated }
1363    }
1364}
1365
1366impl futures::Stream for ChildViewWatcherRequestStream {
1367    type Item = Result<ChildViewWatcherRequest, fidl::Error>;
1368
1369    fn poll_next(
1370        mut self: std::pin::Pin<&mut Self>,
1371        cx: &mut std::task::Context<'_>,
1372    ) -> std::task::Poll<Option<Self::Item>> {
1373        let this = &mut *self;
1374        if this.inner.check_shutdown(cx) {
1375            this.is_terminated = true;
1376            return std::task::Poll::Ready(None);
1377        }
1378        if this.is_terminated {
1379            panic!("polled ChildViewWatcherRequestStream after completion");
1380        }
1381        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1382            |bytes, handles| {
1383                match this.inner.channel().read_etc(cx, bytes, handles) {
1384                    std::task::Poll::Ready(Ok(())) => {}
1385                    std::task::Poll::Pending => return std::task::Poll::Pending,
1386                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1387                        this.is_terminated = true;
1388                        return std::task::Poll::Ready(None);
1389                    }
1390                    std::task::Poll::Ready(Err(e)) => {
1391                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1392                            e.into(),
1393                        ))));
1394                    }
1395                }
1396
1397                // A message has been received from the channel
1398                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1399
1400                std::task::Poll::Ready(Some(match header.ordinal {
1401                    0x1d622075f4fc8243 => {
1402                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1403                        let mut req = fidl::new_empty!(
1404                            fidl::encoding::EmptyPayload,
1405                            fidl::encoding::DefaultFuchsiaResourceDialect
1406                        );
1407                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1408                        let control_handle =
1409                            ChildViewWatcherControlHandle { inner: this.inner.clone() };
1410                        Ok(ChildViewWatcherRequest::GetStatus {
1411                            responder: ChildViewWatcherGetStatusResponder {
1412                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1413                                tx_id: header.tx_id,
1414                            },
1415                        })
1416                    }
1417                    0x3b2f3ca31e8908b4 => {
1418                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1419                        let mut req = fidl::new_empty!(
1420                            fidl::encoding::EmptyPayload,
1421                            fidl::encoding::DefaultFuchsiaResourceDialect
1422                        );
1423                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1424                        let control_handle =
1425                            ChildViewWatcherControlHandle { inner: this.inner.clone() };
1426                        Ok(ChildViewWatcherRequest::GetViewRef {
1427                            responder: ChildViewWatcherGetViewRefResponder {
1428                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1429                                tx_id: header.tx_id,
1430                            },
1431                        })
1432                    }
1433                    _ => Err(fidl::Error::UnknownOrdinal {
1434                        ordinal: header.ordinal,
1435                        protocol_name:
1436                            <ChildViewWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1437                    }),
1438                }))
1439            },
1440        )
1441    }
1442}
1443
1444/// A protocol that provides information about a particular child View which is attached to the
1445/// Viewport owned by the parent client; connections to this protocol are estabished in
1446/// [`CreateViewport`].  Since a Flatland instance may contain any number of Viewports, each of
1447/// which may or may not be attached to a transform, the client can maintain connections to an
1448/// equal number of ChildViewWatcher instances.
1449///
1450/// Each ChildViewWatcher instance will remain connected as long as the corresponding child View
1451/// exists; the connection will also be closed if the child's ViewCreationToken is dropped without
1452/// using it to create a View.
1453#[derive(Debug)]
1454pub enum ChildViewWatcherRequest {
1455    /// A hanging get for receiving the status of a View. This provides information to the parent,
1456    /// such as whether or not the child has successfully presented content through this View.
1457    ///
1458    /// This hanging get will only fire when the ChildViewStatus is different than the previously
1459    /// returned ChildViewStatus.  This can happen immediately, and even if the creator of the
1460    /// Viewport hasn't yet called Present() after calling CreateViewport().  This allows the parent
1461    /// to know that the child has content ready to display before the parent modifies their own
1462    /// local scene graph to incorporate the child content.
1463    ///
1464    /// It is invalid to call `GetStatus` while a previous call is still pending. Doing so will
1465    /// cause both this channel and the Flatland channel that handed out ChildViewWatcher to be
1466    /// closed.
1467    GetStatus { responder: ChildViewWatcherGetStatusResponder },
1468    /// Hanging get to receive the ViewRef of the child View. This will only fire when the View ref
1469    /// is different from the previously-returned View ref. Note: currently the View ref will not
1470    /// change after it is first received, but this will change if/when the API changes to allow
1471    /// relinking of views.
1472    ///
1473    /// The ViewRef is not returned until the View is included in the View tree, in other words when
1474    /// there is a chain of ancestor transforms all the way back up to the root of the scene graph,
1475    /// i.e. the display.
1476    ///
1477    /// It is invalid to call `GetViewRef` while a previous call is still pending. Doing so will
1478    /// cause both this channel and the Flatland channel that handed out ChildViewWatcher to be
1479    /// closed.
1480    ///
1481    /// A `GetViewRef` call will hang if the View was created using `CreateView`, but returns the
1482    /// View if the View was created using CreateView2. This is because `CreateView` does not mint
1483    /// a ViewRef for that View.
1484    GetViewRef { responder: ChildViewWatcherGetViewRefResponder },
1485}
1486
1487impl ChildViewWatcherRequest {
1488    #[allow(irrefutable_let_patterns)]
1489    pub fn into_get_status(self) -> Option<(ChildViewWatcherGetStatusResponder)> {
1490        if let ChildViewWatcherRequest::GetStatus { responder } = self {
1491            Some((responder))
1492        } else {
1493            None
1494        }
1495    }
1496
1497    #[allow(irrefutable_let_patterns)]
1498    pub fn into_get_view_ref(self) -> Option<(ChildViewWatcherGetViewRefResponder)> {
1499        if let ChildViewWatcherRequest::GetViewRef { responder } = self {
1500            Some((responder))
1501        } else {
1502            None
1503        }
1504    }
1505
1506    /// Name of the method defined in FIDL
1507    pub fn method_name(&self) -> &'static str {
1508        match *self {
1509            ChildViewWatcherRequest::GetStatus { .. } => "get_status",
1510            ChildViewWatcherRequest::GetViewRef { .. } => "get_view_ref",
1511        }
1512    }
1513}
1514
1515#[derive(Debug, Clone)]
1516pub struct ChildViewWatcherControlHandle {
1517    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1518}
1519
1520impl ChildViewWatcherControlHandle {
1521    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
1522        self.inner.shutdown_with_epitaph(status.into())
1523    }
1524}
1525
1526impl fidl::endpoints::ControlHandle for ChildViewWatcherControlHandle {
1527    fn shutdown(&self) {
1528        self.inner.shutdown()
1529    }
1530
1531    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
1532        self.inner.shutdown_with_epitaph(status)
1533    }
1534
1535    fn is_closed(&self) -> bool {
1536        self.inner.channel().is_closed()
1537    }
1538    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1539        self.inner.channel().on_closed()
1540    }
1541
1542    #[cfg(target_os = "fuchsia")]
1543    fn signal_peer(
1544        &self,
1545        clear_mask: zx::Signals,
1546        set_mask: zx::Signals,
1547    ) -> Result<(), zx_status::Status> {
1548        use fidl::Peered;
1549        self.inner.channel().signal_peer(clear_mask, set_mask)
1550    }
1551}
1552
1553impl ChildViewWatcherControlHandle {}
1554
1555#[must_use = "FIDL methods require a response to be sent"]
1556#[derive(Debug)]
1557pub struct ChildViewWatcherGetStatusResponder {
1558    control_handle: std::mem::ManuallyDrop<ChildViewWatcherControlHandle>,
1559    tx_id: u32,
1560}
1561
1562/// Set the the channel to be shutdown (see [`ChildViewWatcherControlHandle::shutdown`])
1563/// if the responder is dropped without sending a response, so that the client
1564/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1565impl std::ops::Drop for ChildViewWatcherGetStatusResponder {
1566    fn drop(&mut self) {
1567        self.control_handle.shutdown();
1568        // Safety: drops once, never accessed again
1569        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1570    }
1571}
1572
1573impl fidl::endpoints::Responder for ChildViewWatcherGetStatusResponder {
1574    type ControlHandle = ChildViewWatcherControlHandle;
1575
1576    fn control_handle(&self) -> &ChildViewWatcherControlHandle {
1577        &self.control_handle
1578    }
1579
1580    fn drop_without_shutdown(mut self) {
1581        // Safety: drops once, never accessed again due to mem::forget
1582        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1583        // Prevent Drop from running (which would shut down the channel)
1584        std::mem::forget(self);
1585    }
1586}
1587
1588impl ChildViewWatcherGetStatusResponder {
1589    /// Sends a response to the FIDL transaction.
1590    ///
1591    /// Sets the channel to shutdown if an error occurs.
1592    pub fn send(self, mut status: ChildViewStatus) -> Result<(), fidl::Error> {
1593        let _result = self.send_raw(status);
1594        if _result.is_err() {
1595            self.control_handle.shutdown();
1596        }
1597        self.drop_without_shutdown();
1598        _result
1599    }
1600
1601    /// Similar to "send" but does not shutdown the channel if an error occurs.
1602    pub fn send_no_shutdown_on_err(self, mut status: ChildViewStatus) -> Result<(), fidl::Error> {
1603        let _result = self.send_raw(status);
1604        self.drop_without_shutdown();
1605        _result
1606    }
1607
1608    fn send_raw(&self, mut status: ChildViewStatus) -> Result<(), fidl::Error> {
1609        self.control_handle.inner.send::<ChildViewWatcherGetStatusResponse>(
1610            (status,),
1611            self.tx_id,
1612            0x1d622075f4fc8243,
1613            fidl::encoding::DynamicFlags::empty(),
1614        )
1615    }
1616}
1617
1618#[must_use = "FIDL methods require a response to be sent"]
1619#[derive(Debug)]
1620pub struct ChildViewWatcherGetViewRefResponder {
1621    control_handle: std::mem::ManuallyDrop<ChildViewWatcherControlHandle>,
1622    tx_id: u32,
1623}
1624
1625/// Set the the channel to be shutdown (see [`ChildViewWatcherControlHandle::shutdown`])
1626/// if the responder is dropped without sending a response, so that the client
1627/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1628impl std::ops::Drop for ChildViewWatcherGetViewRefResponder {
1629    fn drop(&mut self) {
1630        self.control_handle.shutdown();
1631        // Safety: drops once, never accessed again
1632        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1633    }
1634}
1635
1636impl fidl::endpoints::Responder for ChildViewWatcherGetViewRefResponder {
1637    type ControlHandle = ChildViewWatcherControlHandle;
1638
1639    fn control_handle(&self) -> &ChildViewWatcherControlHandle {
1640        &self.control_handle
1641    }
1642
1643    fn drop_without_shutdown(mut self) {
1644        // Safety: drops once, never accessed again due to mem::forget
1645        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1646        // Prevent Drop from running (which would shut down the channel)
1647        std::mem::forget(self);
1648    }
1649}
1650
1651impl ChildViewWatcherGetViewRefResponder {
1652    /// Sends a response to the FIDL transaction.
1653    ///
1654    /// Sets the channel to shutdown if an error occurs.
1655    pub fn send(self, mut view_ref: fidl_fuchsia_ui_views::ViewRef) -> Result<(), fidl::Error> {
1656        let _result = self.send_raw(view_ref);
1657        if _result.is_err() {
1658            self.control_handle.shutdown();
1659        }
1660        self.drop_without_shutdown();
1661        _result
1662    }
1663
1664    /// Similar to "send" but does not shutdown the channel if an error occurs.
1665    pub fn send_no_shutdown_on_err(
1666        self,
1667        mut view_ref: fidl_fuchsia_ui_views::ViewRef,
1668    ) -> Result<(), fidl::Error> {
1669        let _result = self.send_raw(view_ref);
1670        self.drop_without_shutdown();
1671        _result
1672    }
1673
1674    fn send_raw(&self, mut view_ref: fidl_fuchsia_ui_views::ViewRef) -> Result<(), fidl::Error> {
1675        self.control_handle.inner.send::<ChildViewWatcherGetViewRefResponse>(
1676            (&mut view_ref,),
1677            self.tx_id,
1678            0x3b2f3ca31e8908b4,
1679            fidl::encoding::DynamicFlags::empty(),
1680        )
1681    }
1682}
1683
1684#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1685pub struct FlatlandMarker;
1686
1687impl fidl::endpoints::ProtocolMarker for FlatlandMarker {
1688    type Proxy = FlatlandProxy;
1689    type RequestStream = FlatlandRequestStream;
1690    #[cfg(target_os = "fuchsia")]
1691    type SynchronousProxy = FlatlandSynchronousProxy;
1692
1693    const DEBUG_NAME: &'static str = "fuchsia.ui.composition.Flatland";
1694}
1695impl fidl::endpoints::DiscoverableProtocolMarker for FlatlandMarker {}
1696
1697pub trait FlatlandProxyInterface: Send + Sync {
1698    fn r#release_image_immediately(&self, image_id: &ContentId) -> Result<(), fidl::Error>;
1699    fn r#present(&self, args: PresentArgs) -> Result<(), fidl::Error>;
1700    fn r#create_view(
1701        &self,
1702        token: fidl_fuchsia_ui_views::ViewCreationToken,
1703        parent_viewport_watcher: fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>,
1704    ) -> Result<(), fidl::Error>;
1705    fn r#create_view2(
1706        &self,
1707        token: fidl_fuchsia_ui_views::ViewCreationToken,
1708        view_identity: fidl_fuchsia_ui_views::ViewIdentityOnCreation,
1709        protocols: ViewBoundProtocols,
1710        parent_viewport_watcher: fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>,
1711    ) -> Result<(), fidl::Error>;
1712    fn r#create_transform(&self, transform_id: &TransformId) -> Result<(), fidl::Error>;
1713    fn r#set_translation(
1714        &self,
1715        transform_id: &TransformId,
1716        translation: &fidl_fuchsia_math::Vec_,
1717    ) -> Result<(), fidl::Error>;
1718    fn r#set_orientation(
1719        &self,
1720        transform_id: &TransformId,
1721        orientation: Orientation,
1722    ) -> Result<(), fidl::Error>;
1723    fn r#set_scale(
1724        &self,
1725        transform_id: &TransformId,
1726        scale: &fidl_fuchsia_math::VecF,
1727    ) -> Result<(), fidl::Error>;
1728    fn r#set_opacity(&self, transform_id: &TransformId, value: f32) -> Result<(), fidl::Error>;
1729    fn r#set_clip_boundary(
1730        &self,
1731        transform_id: &TransformId,
1732        rect: Option<&fidl_fuchsia_math::Rect>,
1733    ) -> Result<(), fidl::Error>;
1734    fn r#add_child(
1735        &self,
1736        parent_transform_id: &TransformId,
1737        child_transform_id: &TransformId,
1738    ) -> Result<(), fidl::Error>;
1739    fn r#remove_child(
1740        &self,
1741        parent_transform_id: &TransformId,
1742        child_transform_id: &TransformId,
1743    ) -> Result<(), fidl::Error>;
1744    fn r#replace_children(
1745        &self,
1746        parent_transform_id: &TransformId,
1747        new_child_transform_ids: &[TransformId],
1748    ) -> Result<(), fidl::Error>;
1749    fn r#set_root_transform(&self, transform_id: &TransformId) -> Result<(), fidl::Error>;
1750    fn r#set_hit_regions(
1751        &self,
1752        transform_id: &TransformId,
1753        regions: &[HitRegion],
1754    ) -> Result<(), fidl::Error>;
1755    fn r#set_infinite_hit_region(
1756        &self,
1757        transform_id: &TransformId,
1758        hit_test: HitTestInteraction,
1759    ) -> Result<(), fidl::Error>;
1760    fn r#create_viewport(
1761        &self,
1762        viewport_id: &ContentId,
1763        token: fidl_fuchsia_ui_views::ViewportCreationToken,
1764        properties: &ViewportProperties,
1765        child_view_watcher: fidl::endpoints::ServerEnd<ChildViewWatcherMarker>,
1766    ) -> Result<(), fidl::Error>;
1767    fn r#create_image(
1768        &self,
1769        image_id: &ContentId,
1770        import_token: BufferCollectionImportToken,
1771        vmo_index: u32,
1772        properties: &ImageProperties,
1773    ) -> Result<(), fidl::Error>;
1774    fn r#set_image_sample_region(
1775        &self,
1776        image_id: &ContentId,
1777        rect: &fidl_fuchsia_math::RectF,
1778    ) -> Result<(), fidl::Error>;
1779    fn r#set_image_destination_size(
1780        &self,
1781        image_id: &ContentId,
1782        size: &fidl_fuchsia_math::SizeU,
1783    ) -> Result<(), fidl::Error>;
1784    fn r#set_image_blending_function(
1785        &self,
1786        image_id: &ContentId,
1787        blend_mode: BlendMode,
1788    ) -> Result<(), fidl::Error>;
1789    fn r#set_image_blend_mode(
1790        &self,
1791        image_id: &ContentId,
1792        blend_mode: BlendMode2,
1793    ) -> Result<(), fidl::Error>;
1794    fn r#set_image_opacity(&self, image_id: &ContentId, val: f32) -> Result<(), fidl::Error>;
1795    fn r#set_image_flip(&self, image_id: &ContentId, flip: ImageFlip) -> Result<(), fidl::Error>;
1796    fn r#create_filled_rect(&self, rect_id: &ContentId) -> Result<(), fidl::Error>;
1797    fn r#set_solid_fill(
1798        &self,
1799        rect_id: &ContentId,
1800        color: &ColorRgba,
1801        size: &fidl_fuchsia_math::SizeU,
1802    ) -> Result<(), fidl::Error>;
1803    fn r#release_filled_rect(&self, rect_id: &ContentId) -> Result<(), fidl::Error>;
1804    fn r#set_content(
1805        &self,
1806        transform_id: &TransformId,
1807        content_id: &ContentId,
1808    ) -> Result<(), fidl::Error>;
1809    fn r#set_viewport_properties(
1810        &self,
1811        viewport_id: &ContentId,
1812        properties: &ViewportProperties,
1813    ) -> Result<(), fidl::Error>;
1814    fn r#release_transform(&self, transform_id: &TransformId) -> Result<(), fidl::Error>;
1815    fn r#release_view(&self) -> Result<(), fidl::Error>;
1816    type ReleaseViewportResponseFut: std::future::Future<
1817            Output = Result<fidl_fuchsia_ui_views::ViewportCreationToken, fidl::Error>,
1818        > + Send;
1819    fn r#release_viewport(&self, viewport_id: &ContentId) -> Self::ReleaseViewportResponseFut;
1820    fn r#release_image(&self, image_id: &ContentId) -> Result<(), fidl::Error>;
1821    fn r#clear(&self) -> Result<(), fidl::Error>;
1822    fn r#set_debug_name(&self, name: &str) -> Result<(), fidl::Error>;
1823}
1824#[derive(Debug)]
1825#[cfg(target_os = "fuchsia")]
1826pub struct FlatlandSynchronousProxy {
1827    client: fidl::client::sync::Client,
1828}
1829
1830#[cfg(target_os = "fuchsia")]
1831impl fidl::endpoints::SynchronousProxy for FlatlandSynchronousProxy {
1832    type Proxy = FlatlandProxy;
1833    type Protocol = FlatlandMarker;
1834
1835    fn from_channel(inner: fidl::Channel) -> Self {
1836        Self::new(inner)
1837    }
1838
1839    fn into_channel(self) -> fidl::Channel {
1840        self.client.into_channel()
1841    }
1842
1843    fn as_channel(&self) -> &fidl::Channel {
1844        self.client.as_channel()
1845    }
1846}
1847
1848#[cfg(target_os = "fuchsia")]
1849impl FlatlandSynchronousProxy {
1850    pub fn new(channel: fidl::Channel) -> Self {
1851        Self { client: fidl::client::sync::Client::new(channel) }
1852    }
1853
1854    pub fn into_channel(self) -> fidl::Channel {
1855        self.client.into_channel()
1856    }
1857
1858    /// Waits until an event arrives and returns it. It is safe for other
1859    /// threads to make concurrent requests while waiting for an event.
1860    pub fn wait_for_event(
1861        &self,
1862        deadline: zx::MonotonicInstant,
1863    ) -> Result<FlatlandEvent, fidl::Error> {
1864        FlatlandEvent::decode(self.client.wait_for_event::<FlatlandMarker>(deadline)?)
1865    }
1866
1867    /// Releases an image immediately, without waiting for the next present.
1868    pub fn r#release_image_immediately(&self, mut image_id: &ContentId) -> Result<(), fidl::Error> {
1869        self.client.send::<TrustedFlatlandReleaseImageImmediatelyRequest>(
1870            (image_id,),
1871            0x245e1ac080772c8,
1872            fidl::encoding::DynamicFlags::empty(),
1873        )
1874    }
1875
1876    /// Complete execution of all feed-forward operations.
1877    ///
1878    /// If executing an operation produces an error (e.g., CreateTransform(0)), an [`OnError`] event
1879    /// is emitted. Operations that produce errors are ignored and the channel is closed.
1880    ///
1881    /// If the execution is completed successfully, [`OnNextFrameBegin`] emits NO_ERROR along
1882    /// with other valid fields.
1883    ///
1884    /// The client may only call [`Present`] when they have a non-zero number of present credits,
1885    /// which are tracked by the server. The server may increment the number of credits when it
1886    /// fires the [`OnNextFrameBegin`] event, which informs the client when it receives additional
1887    /// present credits. Each [`Present`] call uses one present credit and decrements the server
1888    /// count by one. If the client calls [`Present`] with no present credits, the server will
1889    /// return a `NO_PRESENTS_REMAINING` error.
1890    ///
1891    /// The client should assume that prior to receiving any [`OnNextFrameBegin`] events, they have
1892    /// one present credit.
1893    ///
1894    /// Every [`Present`] call results in one [`OnNextFrameBegin`] event, and one
1895    /// [`OnFramePresented`] event, typically in that order.
1896    ///
1897    /// When the commands flushed by [`Present`] make it to display, an [`OnFramePresented`] event
1898    /// is fired. This event includes information pertaining to all [`Present`]s that had content
1899    /// that were part of that frame.
1900    ///
1901    /// See [`fuchsia.ui.composition/PresentArgs`] documentation above for more detailed information
1902    /// on what arguments are passed in and their role.
1903    pub fn r#present(&self, mut args: PresentArgs) -> Result<(), fidl::Error> {
1904        self.client.send::<FlatlandPresentRequest>(
1905            (&mut args,),
1906            0x50acc2aa1f0acec7,
1907            fidl::encoding::DynamicFlags::empty(),
1908        )
1909    }
1910
1911    /// Two Flatland instances may be connected in a parent-child relationship. The parent endpoint
1912    /// is held in a Viewport, and the child endpoint is held in a View. The parent Flatland
1913    /// instance that creates a Viewport has control over how the child's View is integrated into
1914    /// its own View.
1915    ///
1916    /// The lifecycle of a parent-child connection starts with two endpoints of a channel object:
1917    /// a ViewportCreationToken and a ViewCreationToken. Out-of-band protocols pass the
1918    /// ViewportCreationToken to the parent, which calls [`CreateViewport`], and the
1919    /// ViewCreationToken to the child, which calls [`CreateView`].
1920    ///
1921    /// Only nodes connected to the Root Transform in this Flatland instance will be rendered into
1922    /// the parent's Viewport.
1923    ///
1924    /// Calling [`CreateView`] a second time will disconnect the Root Transform from the existing
1925    /// parent's Viewport, and attach it to a new parent's Viewport. In other words, each View can
1926    /// only have one parent.
1927    ///
1928    /// This function is queued, meaning that the Root Transform will not be attached to the
1929    /// parent Viewport until [`Present`] is called. However, clients will receive information
1930    /// through their ParentViewportWatcher (e.g., LayoutInfo) immediately after calling this
1931    /// function, even if they have not called [`Present`] or [`SetRootTransform`]. This allows
1932    /// clients to wait for layout information from their parent before calling [`Present`].
1933    ///
1934    /// Any illegal operations on ParentViewportWatcher will cause both ParentViewportWatcher
1935    /// channel and this Flatland channel to be torn down.
1936    ///
1937    /// Lifecycle note. The lifetime of the ParentViewportWatcher channel is bound by the peer
1938    /// ViewportCreationToken. When the ViewportCreationToken dies, this ParentViewportWatcher
1939    /// channel is destroyed.
1940    ///
1941    /// Views and subgraphs of Views created using `CreateView` will not be represented in the
1942    /// ViewTree, and hence will not be able to participate in any ViewTree-dependent interactions
1943    /// such as touch, mouse or focus.
1944    /// The Flatland protocol provides no way for Views in the subgraph of a View created with
1945    /// `CreateView` to know that they are excluded from the ViewTree.
1946    pub fn r#create_view(
1947        &self,
1948        mut token: fidl_fuchsia_ui_views::ViewCreationToken,
1949        mut parent_viewport_watcher: fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>,
1950    ) -> Result<(), fidl::Error> {
1951        self.client.send::<FlatlandCreateViewRequest>(
1952            (&mut token, parent_viewport_watcher),
1953            0x504686eb25864780,
1954            fidl::encoding::DynamicFlags::empty(),
1955        )
1956    }
1957
1958    /// Identical to [`CreateView`], except it allows association of View identity (ViewRef) and
1959    /// view-bound protocols.
1960    pub fn r#create_view2(
1961        &self,
1962        mut token: fidl_fuchsia_ui_views::ViewCreationToken,
1963        mut view_identity: fidl_fuchsia_ui_views::ViewIdentityOnCreation,
1964        mut protocols: ViewBoundProtocols,
1965        mut parent_viewport_watcher: fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>,
1966    ) -> Result<(), fidl::Error> {
1967        self.client.send::<FlatlandCreateView2Request>(
1968            (&mut token, &mut view_identity, &mut protocols, parent_viewport_watcher),
1969            0x340a3a40c2fdbd5e,
1970            fidl::encoding::DynamicFlags::empty(),
1971        )
1972    }
1973
1974    /// Creates a new Transform node. Transforms are a hierarchical piece of a Flatland graph. They
1975    /// can have children, and can reference Content. A sub-graph represented by a Transform and its
1976    /// descendants can be rendered to a display.
1977    ///
1978    /// Transforms are kept alive, even when released, as long as they are children of either an
1979    /// unreleased Transform, or the Root Transform.
1980    ///
1981    /// Each Transform can have a single piece of attached Content. Common types of Content include
1982    /// bitmaps, asynchronous streams of images, and Viewports to Views hosted in other Flatland
1983    /// instances.
1984    ///
1985    /// Transforms have attributes. Child Transforms inherit the combined attributes of their
1986    /// parents. Content attached to a Transform is also affected by that Transform's attributes.
1987    ///
1988    /// When a sub-graph of Transforms is rendered, Content will be rendered back-to-front, starting
1989    /// with the Content on the root transform, and continuing recursively through all of its child
1990    /// Transforms in the order the children were added. See [`AddChild`] for more information.
1991    ///
1992    /// Zero is not a valid transform id. All other values are valid, assuming they are not already
1993    /// in use (see [`ReleaseTransform`] for more details).
1994    pub fn r#create_transform(&self, mut transform_id: &TransformId) -> Result<(), fidl::Error> {
1995        self.client.send::<FlatlandCreateTransformRequest>(
1996            (transform_id,),
1997            0x5e042a4d3de3efb0,
1998            fidl::encoding::DynamicFlags::empty(),
1999        )
2000    }
2001
2002    /// All Transform objects support all attributes.
2003    ///
2004    /// Geometric attributes are applied in the following order:
2005    /// 1. Scale (relative to the parent transform's coordinate space)
2006    /// 2. Orientation (relative to the parent transform's coordinate space)
2007    /// 3. Translation (relative to the parent transforms's coordinate space,
2008    ///    unaffected by scale applied to the current transform).
2009    /// 4. Clipping (relative to the current transform's coordinate space)
2010    ///
2011    /// The effects of each of these attributes are cumulative. This means the transform's position
2012    /// in the view space, and its clip boundary, will be calculated based on that chain of
2013    /// geometric attributes going up to the root transform.
2014    ///
2015    /// For instance, in a nested hierarchy such as the following:
2016    ///     [Root-Transform -> Transform1 -> Transform2 -> CurrentTransform]
2017    /// If Transform1 is translated by [2,0] and Transform2 is translated by [0,1] then the
2018    /// view-space position of CurrentTransform will be [2,1].
2019    ///
2020    /// Sets the translation on a Transform. The order of geometric attribute application is
2021    /// addressed above.
2022    pub fn r#set_translation(
2023        &self,
2024        mut transform_id: &TransformId,
2025        mut translation: &fidl_fuchsia_math::Vec_,
2026    ) -> Result<(), fidl::Error> {
2027        self.client.send::<FlatlandSetTranslationRequest>(
2028            (transform_id, translation),
2029            0x7863398291fba346,
2030            fidl::encoding::DynamicFlags::empty(),
2031        )
2032    }
2033
2034    /// Sets the orientation on a Transform. The order of geometric attribute application is
2035    /// addressed in the documentation for [`SetTranslation`]. In Flatland, the +X axis is
2036    /// to the right and the +Y axis is down. There is no notion of a Z axis. CCW is defined
2037    /// from the POV of the user, as if a skeuomorphoic clock is displayed on the screen.
2038    pub fn r#set_orientation(
2039        &self,
2040        mut transform_id: &TransformId,
2041        mut orientation: Orientation,
2042    ) -> Result<(), fidl::Error> {
2043        self.client.send::<FlatlandSetOrientationRequest>(
2044            (transform_id, orientation),
2045            0x4915310bc4928edc,
2046            fidl::encoding::DynamicFlags::empty(),
2047        )
2048    }
2049
2050    /// Sets the scale on a transform. The order of geometric attribute application is
2051    /// addressed above. The (x,y) values in the VecF |scale| refer to the scale factor in the
2052    /// x-axis (width) and y-axis (height) respectively. Scale values must be positive 32-bit
2053    /// floating point values: https://en.wikipedia.org/wiki/Normal_number_%28computing%29
2054    pub fn r#set_scale(
2055        &self,
2056        mut transform_id: &TransformId,
2057        mut scale: &fidl_fuchsia_math::VecF,
2058    ) -> Result<(), fidl::Error> {
2059        self.client.send::<FlatlandSetScaleRequest>(
2060            (transform_id, scale),
2061            0x1ea1766fd8996bb4,
2062            fidl::encoding::DynamicFlags::empty(),
2063        )
2064    }
2065
2066    /// Sets an opacity in linear space to be applied to a transform and its descendents,
2067    /// which include other transforms and content. Opacity values must be in the range
2068    /// of [0.0, 1.0], where 0.0 is completely transparent and 1.0 is completely opaque.
2069    /// Attempting to call this function with values outside that range will result in
2070    /// an error. A transform's opacity value is multiplied with that of its parent. This
2071    /// effect works differently from group opacity. Using group opacity, child nodes are
2072    /// rendered together first, and then have the parent's opacity applied as a post-effect.
2073    /// Here, opacity is applied to each child individually. This may result in a very
2074    /// different effect.
2075    pub fn r#set_opacity(
2076        &self,
2077        mut transform_id: &TransformId,
2078        mut value: f32,
2079    ) -> Result<(), fidl::Error> {
2080        self.client.send::<FlatlandSetOpacityRequest>(
2081            (transform_id, value),
2082            0x3775fc2c00b432fa,
2083            fidl::encoding::DynamicFlags::empty(),
2084        )
2085    }
2086
2087    /// Sets the bounds, expressed in the local coordinate space of the transform, that
2088    /// constrains the region that content attached to this transform can be rendered to.
2089    /// If the content's area exceeds the clip bounds, the area outside the bounds will
2090    /// not be rendered. These bounds are valid for all children of this transform node as
2091    /// well, which includes nested Flatland instances and their node hierarchies.
2092    /// If a child transform attempts to set clip bounds larger than that of its parent,
2093    /// it will be clipped to the parent's clip bounds. The default state is for a transform
2094    /// to be unclipped, meaning it will not have any bounds placed on its render region.
2095    /// The clip width/height must be positive. Negative values will result in an error.
2096    /// Passing in an empty box to the |rect| parameter will remove the clip bounds.
2097    pub fn r#set_clip_boundary(
2098        &self,
2099        mut transform_id: &TransformId,
2100        mut rect: Option<&fidl_fuchsia_math::Rect>,
2101    ) -> Result<(), fidl::Error> {
2102        self.client.send::<FlatlandSetClipBoundaryRequest>(
2103            (transform_id, rect),
2104            0x6507843df12222d2,
2105            fidl::encoding::DynamicFlags::empty(),
2106        )
2107    }
2108
2109    /// Adds a child Transform to a parent Transform. The new child Transform,
2110    /// and any Content attached to it or its children, will be rendered on top
2111    /// of the parent's Content, as well as any previously added children.
2112    ///
2113    /// The caller must ensure that `child_transform_id` is valid and that there
2114    /// are no repetitions.  Sending a repeated `child_transform_id` over
2115    /// multiple calls will result in session closure.
2116    pub fn r#add_child(
2117        &self,
2118        mut parent_transform_id: &TransformId,
2119        mut child_transform_id: &TransformId,
2120    ) -> Result<(), fidl::Error> {
2121        self.client.send::<FlatlandAddChildRequest>(
2122            (parent_transform_id, child_transform_id),
2123            0x67a8abd2f19b1a74,
2124            fidl::encoding::DynamicFlags::empty(),
2125        )
2126    }
2127
2128    /// Removes a child Transform from a parent Transform.
2129    pub fn r#remove_child(
2130        &self,
2131        mut parent_transform_id: &TransformId,
2132        mut child_transform_id: &TransformId,
2133    ) -> Result<(), fidl::Error> {
2134        self.client.send::<FlatlandRemoveChildRequest>(
2135            (parent_transform_id, child_transform_id),
2136            0x41d6cd90b298b67a,
2137            fidl::encoding::DynamicFlags::empty(),
2138        )
2139    }
2140
2141    /// Removes all child Transforms from a parent Transform and replaces them
2142    /// with the new child transforms in `new_child_transform_ids`.  The caller
2143    /// must ensure that all `TransformId` values in `new_child_transform_ids`
2144    /// are valid and that there are no repetitions.  Sending a repeated
2145    /// `TransformId` in `new_child_transform_ids` will result in session
2146    /// closure.
2147    pub fn r#replace_children(
2148        &self,
2149        mut parent_transform_id: &TransformId,
2150        mut new_child_transform_ids: &[TransformId],
2151    ) -> Result<(), fidl::Error> {
2152        self.client.send::<FlatlandReplaceChildrenRequest>(
2153            (parent_transform_id, new_child_transform_ids),
2154            0x5b6d86cbbff81316,
2155            fidl::encoding::DynamicFlags::empty(),
2156        )
2157    }
2158
2159    /// Sets the Root Transform for the graph.
2160    ///
2161    /// The sub-graph defined by the Root Transform and its children will be rendered as View
2162    /// in the connected parent's Viewport (see [`CreateView`]). Any parents of the Root Transform
2163    /// in this Graph will be ignored.
2164    ///
2165    /// The Root Transform, and all children of the Root Transform, are kept alive if they are
2166    /// released (see [`ReleaseTransform`] for more details).
2167    ///
2168    /// There is only ever one Root. Since 0 is not a valid transform id (see [`CreateTransform`]),
2169    /// calling SetRootTransform(0) clears the current Root, destroying any previously released
2170    /// objects that are not referenced by the new root.
2171    ///
2172    /// Note that every View has a clip boundary equivalent to its logical size. Anything outside
2173    /// that clip boundary will not be rendered. Hence, the Root Transform has a useful coordinate
2174    /// space of (0, 0) to (logical_size.width, logical_size.height), where (0, 0) is the upper left
2175    /// corner.
2176    ///
2177    /// Setting the root transform installs a full screen hit region on the root transform. Clients
2178    /// may remove this hit region if they don't want users to be able to interact with the root
2179    /// transform's content. For additional details on hit regions, see the [`SetHitRegions`]
2180    /// documentation.
2181    ///
2182    /// Default hit region rules
2183    ///
2184    ///   A default hit region follows these rules:
2185    ///   - When [`SetRootTransform`](T) is called, T receives a maximal hit region, covering the
2186    ///   entire view.
2187    ///   - If [`SetHitRegions`] is called on T, either before or after [`SetRootTransform`](T),
2188    ///   then no default hit region is active and the client specified hit regions are used.
2189    ///   - If a transform is no longer the root transform, i.e., [`SetRootTransform`](U) is
2190    ///   called, then the original transform no longer has its default hit region.
2191    ///   - Clients can remove or modify the root transform's hit regions the same way they would
2192    ///   reset any other transform's hit regions, by calling [`SetHitRegions`] with the appropriate
2193    ///   vector.
2194    pub fn r#set_root_transform(&self, mut transform_id: &TransformId) -> Result<(), fidl::Error> {
2195        self.client.send::<FlatlandSetRootTransformRequest>(
2196            (transform_id,),
2197            0x6e80ca5bcc566cd8,
2198            fidl::encoding::DynamicFlags::empty(),
2199        )
2200    }
2201
2202    /// Sets the interactive areas for a Transform. By default, Content is not interactive; hit
2203    /// regions must be placed for a user to interact with the Content in a View. Because hit
2204    /// regions are described in the Flatland protocol, a Flatland instance can synchronize Content
2205    /// and hit regions.
2206    ///
2207    /// Each hit region is placed in the coordinate space of the owning Transform, and may or may
2208    /// not interact with different types of hit testing, depending on its [`HitTestInteraction`]
2209    /// type. When there are multiple hit regions that intersect with a hit test, the precedence
2210    /// rules given below dictate which hit region has interacted with the hit test. Only Transforms
2211    /// that transitively connect to the root Transform have their hit regions interact with a hit
2212    /// test.
2213    ///
2214    /// Calling this function replaces any previous values set on this Transform. To reset a
2215    /// Transform to "no hit testing": send an empty vector with [`SetHitRegions`].
2216    ///
2217    /// Note that root transforms get a default hit region installed by Flatland. For more details,
2218    /// see the [`SetRootTransform`] documentation.
2219    ///
2220    /// Precedence rules
2221    ///   Within a Transform, if multiple hit regions overlap, the hit test examines each
2222    ///   intersecting hit region for a possible interaction. Thus, for a regular hit test R and an
2223    ///   accessibility hit test A, where R and A both intersect two hit regions D ([`DEFAULT`]) and
2224    ///   S ([`SEMANTICALLY_INVISIBLE`]) on the same Transform, (1) R interacts with both D and S,
2225    ///   and (2) A only interacts with D. Generally, hit regions that overlap in a single Transform
2226    ///   can cause confusing behavior.
2227    ///
2228    ///   Within a View, for a given hit test, the front-most Transform's hit regions take
2229    ///   precedence over those behind. This follows the expected reverse "render order" of
2230    ///   Transforms (described in [`CreateTransform`]), where a user expects to interact with
2231    ///   Content that is visible, or front-most.
2232    ///
2233    ///   Across Flatland instances, for a given hit test, the front-most instance's front-most
2234    ///   Transform's hit regions take precedence over those behind. This follows the expected
2235    ///   reverse "render order" of views, where a user expects to interact with the View that is
2236    ///   visible, or front-most. For example, if a child View owns Content that is rendered over
2237    ///   the parent View, the user expects to interact with the child's Content.
2238    pub fn r#set_hit_regions(
2239        &self,
2240        mut transform_id: &TransformId,
2241        mut regions: &[HitRegion],
2242    ) -> Result<(), fidl::Error> {
2243        self.client.send::<FlatlandSetHitRegionsRequest>(
2244            (transform_id, regions),
2245            0x31c9d17b07c37ce4,
2246            fidl::encoding::DynamicFlags::empty(),
2247        )
2248    }
2249
2250    /// Identical to [`SetHitRegions`], except the hit region associated with [`transform_id`]
2251    /// covers an infinite region. The hit region is invariant against translation, scaling, and
2252    /// orientation of the Transform.
2253    ///
2254    /// An infinite hit region is still limited in extent by the View's clip boundary, just like a
2255    /// finite hit region.
2256    ///
2257    /// Calling this function replaces any previous values set on this Transform. To reset a
2258    /// Transform to "no hit testing": send an empty vector with [`SetHitRegions`].
2259    pub fn r#set_infinite_hit_region(
2260        &self,
2261        mut transform_id: &TransformId,
2262        mut hit_test: HitTestInteraction,
2263    ) -> Result<(), fidl::Error> {
2264        self.client.send::<FlatlandSetInfiniteHitRegionRequest>(
2265            (transform_id, hit_test),
2266            0x26d81af852d29562,
2267            fidl::encoding::DynamicFlags::empty(),
2268        )
2269    }
2270
2271    /// The Viewport and View pair, together, represent the connection between two Flatland
2272    /// instances. The Viewport is created in the parent, and the View is created in the child. The
2273    /// parent has control over how the child's View is integrated into its own View.
2274    ///
2275    /// Any illegal operations on ChildViewWatcher will cause both ChildViewWatcher channel and this
2276    /// Flatland channel to be torn down.
2277    ///
2278    /// `ViewportProperties` must have logical_size set. This is the initial size that will drive
2279    /// the layout of the child. The logical_size is also used as the default Content size, but
2280    /// subsequent changes to the logical_size will have no effect on the Content size.
2281    ///
2282    /// `ViewportProperties` may have inset field not set. In that case, the default value of
2283    /// (0, 0, 0, 0) is used.
2284    ///
2285    /// The logical_size must have positive X and Y components.
2286    ///
2287    /// Zero is not a valid ContentId. All other values are valid, assuming they are not already
2288    /// in use for another piece of Content (see [`ReleaseViewport`] for more details).
2289    ///
2290    /// Lifecycle note. The lifetime of the ChildViewWatcher channel is bound by the peer
2291    /// ViewCreationToken. When the ViewCreationToken dies, this ChildViewWatcher channel is
2292    /// destroyed.
2293    pub fn r#create_viewport(
2294        &self,
2295        mut viewport_id: &ContentId,
2296        mut token: fidl_fuchsia_ui_views::ViewportCreationToken,
2297        mut properties: &ViewportProperties,
2298        mut child_view_watcher: fidl::endpoints::ServerEnd<ChildViewWatcherMarker>,
2299    ) -> Result<(), fidl::Error> {
2300        self.client.send::<FlatlandCreateViewportRequest>(
2301            (viewport_id, &mut token, properties, child_view_watcher),
2302            0x2485fbcab7f943c,
2303            fidl::encoding::DynamicFlags::empty(),
2304        )
2305    }
2306
2307    /// An Image is a bitmap backed by a specific VMO in a BufferCollection.
2308    ///
2309    /// Image creation requires an allocated BufferCollection registered with Allocator. This
2310    /// function will fail unless all clients of the specified BufferCollection have set their
2311    /// constraints.
2312    ///
2313    /// The Image must reference a valid VMO index and must have ImageProperties that fall within
2314    /// the constraints specified by the backing BufferCollection (i.e. width and height within a
2315    /// valid range, etc.)
2316    ///
2317    /// Zero is not a valid Image id. All other values are valid, assuming they are not already in
2318    /// use for another piece of Content (see [`ReleaseImage`] for more details).
2319    pub fn r#create_image(
2320        &self,
2321        mut image_id: &ContentId,
2322        mut import_token: BufferCollectionImportToken,
2323        mut vmo_index: u32,
2324        mut properties: &ImageProperties,
2325    ) -> Result<(), fidl::Error> {
2326        self.client.send::<FlatlandCreateImageRequest>(
2327            (image_id, &mut import_token, vmo_index, properties),
2328            0x26fae823c4ebedad,
2329            fidl::encoding::DynamicFlags::empty(),
2330        )
2331    }
2332
2333    /// This function is used to determine the region (in texel space) of an image that will be used
2334    /// by Flatland when rendering. The image to be sampled is referenced by [`image_id`] and the
2335    /// sample region is specified by [`rect`] which itself is comprised of an origin point (x,y) as
2336    /// well as a width and height, in unnormalized coordinates. It is illegal to call this function
2337    /// on non-image content, or to sample a region outside of the texel space of the image. In
2338    /// other words, the region specifed by [`rect`] must not exceed the ranges (0, image_width) and
2339    /// (0, image_height). If (rect.x + rect.width > image_width) or (rect.y + rect.height >
2340    /// image_height) or if any of the values are negative, this will result in an error.
2341    ///
2342    /// If this method is not called, the default sample region is the rectangle with origin at
2343    /// (0, 0) and width and height set at ImageProperties from [`CreateImage`].
2344    pub fn r#set_image_sample_region(
2345        &self,
2346        mut image_id: &ContentId,
2347        mut rect: &fidl_fuchsia_math::RectF,
2348    ) -> Result<(), fidl::Error> {
2349        self.client.send::<FlatlandSetImageSampleRegionRequest>(
2350            (image_id, rect),
2351            0x8039391d715eb28,
2352            fidl::encoding::DynamicFlags::empty(),
2353        )
2354    }
2355
2356    /// The content size for an Image is the size of the rectangle in the parent's logical
2357    /// coordinate space that the image occupies. This combined with the global translation of the
2358    /// transform it is attached to determines the size and location of where the content is
2359    /// rendered on the display.
2360    ///
2361    /// If this method is not called, the default image destination size is the width and height set
2362    /// at ImageProperties from [`CreateImage`]. The destination size will be affected by scaling if
2363    /// [`SetScale`] is used on the attached Transform or its parents.
2364    pub fn r#set_image_destination_size(
2365        &self,
2366        mut image_id: &ContentId,
2367        mut size: &fidl_fuchsia_math::SizeU,
2368    ) -> Result<(), fidl::Error> {
2369        self.client.send::<FlatlandSetImageDestinationSizeRequest>(
2370            (image_id, size),
2371            0x766cf99a2ec58446,
2372            fidl::encoding::DynamicFlags::empty(),
2373        )
2374    }
2375
2376    /// Determines the blend function to use when rendering the content specified by
2377    /// |image_id|. |image_id| must be a valid ContentId associated to a transform through
2378    /// a call to |CreateImage| or |CreateFilledRect|. For details on the different blend functions
2379    /// that are available, please refer to the BlendMode enum. If this function is not called, then
2380    /// the default blendmode is BlendMode::SRC.
2381    pub fn r#set_image_blending_function(
2382        &self,
2383        mut image_id: &ContentId,
2384        mut blend_mode: BlendMode,
2385    ) -> Result<(), fidl::Error> {
2386        self.client.send::<FlatlandSetImageBlendingFunctionRequest>(
2387            (image_id, blend_mode),
2388            0x10f5da1356275b7b,
2389            fidl::encoding::DynamicFlags::empty(),
2390        )
2391    }
2392
2393    /// Determines the blend function to use when rendering the content specified by
2394    /// |image_id|. |image_id| must be a valid ContentId associated to a transform through
2395    /// a call to |CreateImage| or |CreateFilledRect|. For details on the different blend functions
2396    /// that are available, please refer to the BlendMode2 enum. If this function is not called,
2397    /// the default blendmode is BlendMode2::REPLACE.
2398    pub fn r#set_image_blend_mode(
2399        &self,
2400        mut image_id: &ContentId,
2401        mut blend_mode: BlendMode2,
2402    ) -> Result<(), fidl::Error> {
2403        self.client.send::<FlatlandSetImageBlendModeRequest>(
2404            (image_id, blend_mode),
2405            0x5b1667f130c3de67,
2406            fidl::encoding::DynamicFlags::empty(),
2407        )
2408    }
2409
2410    /// Sets an opacity in linear space to be applied to a flatland image. Opacity values must
2411    /// be in the range [0.0, 1.0].
2412    pub fn r#set_image_opacity(
2413        &self,
2414        mut image_id: &ContentId,
2415        mut val: f32,
2416    ) -> Result<(), fidl::Error> {
2417        self.client.send::<FlatlandSetImageOpacityRequest>(
2418            (image_id, val),
2419            0x2da9e4ef4c2cff6f,
2420            fidl::encoding::DynamicFlags::empty(),
2421        )
2422    }
2423
2424    /// Sets the image flip to be applied to a flatland image. This call must be performed after a
2425    /// successful |CreateImage| call. If an invalid |image_id| is supplied, the channel will be
2426    /// closed due to FlatlandError::BAD_OPERATION. This flip will be applied to the Image before
2427    /// parent Transform Orientations. If this function is not called, then the default flip value
2428    /// is ImageFlip::NONE.
2429    pub fn r#set_image_flip(
2430        &self,
2431        mut image_id: &ContentId,
2432        mut flip: ImageFlip,
2433    ) -> Result<(), fidl::Error> {
2434        self.client.send::<FlatlandSetImageFlipRequest>(
2435            (image_id, flip),
2436            0x21b20f2c14aae6bc,
2437            fidl::encoding::DynamicFlags::empty(),
2438        )
2439    }
2440
2441    /// Creates a solid-color rectangle. By default a filled-rect does not have a defined
2442    /// color or size. It is necessary to call |SetSolidFill| to specify a color and size
2443    /// before a filled rect can be used for rendering. Not doing so will result the
2444    pub fn r#create_filled_rect(&self, mut rect_id: &ContentId) -> Result<(), fidl::Error> {
2445        self.client.send::<FlatlandCreateFilledRectRequest>(
2446            (rect_id,),
2447            0x5e62355abc1c4c5d,
2448            fidl::encoding::DynamicFlags::empty(),
2449        )
2450    }
2451
2452    /// Defines the color and size of a filled rect. |rect_id| must refer to content that
2453    /// was created via a call to CreateFilledRect. The color is not premultiplied. Color values
2454    /// must be within the range [0,1] inclusive, and normal 32-bit
2455    /// floating point values: https://en.wikipedia.org/wiki/Normal_number_%28computing%29. Values
2456    /// that do not conform to these specifications will cause the channel to close.
2457    /// The rectangle's top left corner will be at (0, 0) in its transform's coordinate space.
2458    /// Hence, its bottom right corner will be at (size.width, size.height).
2459    pub fn r#set_solid_fill(
2460        &self,
2461        mut rect_id: &ContentId,
2462        mut color: &ColorRgba,
2463        mut size: &fidl_fuchsia_math::SizeU,
2464    ) -> Result<(), fidl::Error> {
2465        self.client.send::<FlatlandSetSolidFillRequest>(
2466            (rect_id, color, size),
2467            0x32d6ef41e182dfa5,
2468            fidl::encoding::DynamicFlags::empty(),
2469        )
2470    }
2471
2472    /// Automatically garbage collects the rectangle when it is no longer needed for
2473    /// rendering. |rect_id| must have been instantiated with a call to
2474    /// |CreateFilledRect|. Once released, the ID immediately goes out of scope and is free
2475    /// to be used again.
2476    pub fn r#release_filled_rect(&self, mut rect_id: &ContentId) -> Result<(), fidl::Error> {
2477        self.client.send::<FlatlandReleaseFilledRectRequest>(
2478            (rect_id,),
2479            0x7392cabe45618f9b,
2480            fidl::encoding::DynamicFlags::empty(),
2481        )
2482    }
2483
2484    /// Setting a piece of Content on a Transform makes that Content visible in the render tree as
2485    /// long as the Transform is visible from the root Transform. The Content will be rendered
2486    /// before, and therefore "behind", any Content attached to the descendants of the Transform.
2487    ///
2488    /// Because each Transform can have, at most, a single piece of Content on it, calling this
2489    /// function on a Transform that already has Content will replace that Content.
2490    ///
2491    /// A Content may be set on more than one Transform.
2492    ///
2493    /// Calling this function with a Content id of 0 will remove any Content currently on the
2494    /// Transform.
2495    pub fn r#set_content(
2496        &self,
2497        mut transform_id: &TransformId,
2498        mut content_id: &ContentId,
2499    ) -> Result<(), fidl::Error> {
2500        self.client.send::<FlatlandSetContentRequest>(
2501            (transform_id, content_id),
2502            0x4ed2cfc0ce130862,
2503            fidl::encoding::DynamicFlags::empty(),
2504        )
2505    }
2506
2507    /// Transforms are usually sufficient to change how Content is presented. Viewports, however,
2508    /// have special properties that are not part of the Transform hierarchy. Those properties can
2509    /// be set using this function.
2510    pub fn r#set_viewport_properties(
2511        &self,
2512        mut viewport_id: &ContentId,
2513        mut properties: &ViewportProperties,
2514    ) -> Result<(), fidl::Error> {
2515        self.client.send::<FlatlandSetViewportPropertiesRequest>(
2516            (viewport_id, properties),
2517            0x66ab67e9608ddb9f,
2518            fidl::encoding::DynamicFlags::empty(),
2519        )
2520    }
2521
2522    /// Released Transforms will be garbage collected by the system once they are no longer
2523    /// necessary for rendering. For Transforms, this means there is no path from any unreleased
2524    /// Transform to the newly-released Transform.
2525    ///
2526    /// Once released, the id immediately goes out of scope for future function calls and can be
2527    /// reused when creating new Transforms.
2528    ///
2529    /// It is an error to call functions with a released id (unless that id has been reused to
2530    /// construct a new Transform).
2531    pub fn r#release_transform(&self, mut transform_id: &TransformId) -> Result<(), fidl::Error> {
2532        self.client.send::<FlatlandReleaseTransformRequest>(
2533            (transform_id,),
2534            0xab9328419451c22,
2535            fidl::encoding::DynamicFlags::empty(),
2536        )
2537    }
2538
2539    pub fn r#release_view(&self) -> Result<(), fidl::Error> {
2540        self.client.send::<fidl::encoding::EmptyPayload>(
2541            (),
2542            0x5b35aab9baffecae,
2543            fidl::encoding::DynamicFlags::empty(),
2544        )
2545    }
2546
2547    /// Releases a Viewport from the scene, even if the Viewport is still connected to a Transform.
2548    /// Unlike other resources, Viewports are garbage collected by the system during the next
2549    /// [`Present`] because a removed Viewport is guaranteed to provide no renderable content.
2550    ///
2551    /// Use SetContent(transform_id, 0) to clean up references to released Viewports.
2552    ///
2553    /// Despite having a return type, this function is still feed-forward like [`CreateView`] and
2554    /// requires a call to [`Present`] to be executed. The ViewportCreationToken will be returned
2555    /// after the presented operations have been executed.
2556    pub fn r#release_viewport(
2557        &self,
2558        mut viewport_id: &ContentId,
2559        ___deadline: zx::MonotonicInstant,
2560    ) -> Result<fidl_fuchsia_ui_views::ViewportCreationToken, fidl::Error> {
2561        let _response = self.client.send_query::<
2562            FlatlandReleaseViewportRequest,
2563            FlatlandReleaseViewportResponse,
2564            FlatlandMarker,
2565        >(
2566            (viewport_id,),
2567            0xbad474aeb5293f9,
2568            fidl::encoding::DynamicFlags::empty(),
2569            ___deadline,
2570        )?;
2571        Ok(_response.token)
2572    }
2573
2574    /// Released Images will be garbage collected by the system once they are no longer necessary
2575    /// for rendering. For Images, this means the Image is no longer attached to any Transform and
2576    /// any pending rendering that references the Image is complete.
2577    ///
2578    /// Use SetContent(transform_id, 0) to clean up references to released Images.
2579    ///
2580    /// Once released, the id immediately goes out of scope for future function calls and can be
2581    /// reused when creating new Images.
2582    ///
2583    /// It is an error to call functions with a released id (unless that id has been reused to
2584    /// construct a new Image).
2585    pub fn r#release_image(&self, mut image_id: &ContentId) -> Result<(), fidl::Error> {
2586        self.client.send::<FlatlandReleaseImageRequest>(
2587            (image_id,),
2588            0xb884ffdbc72c111,
2589            fidl::encoding::DynamicFlags::empty(),
2590        )
2591    }
2592
2593    /// This function will reset all state on this interface. This includes destroying all existing
2594    /// View and Viewports without returning the associated Token to the caller.
2595    pub fn r#clear(&self) -> Result<(), fidl::Error> {
2596        self.client.send::<fidl::encoding::EmptyPayload>(
2597            (),
2598            0x4ec8817c02828c3e,
2599            fidl::encoding::DynamicFlags::empty(),
2600        )
2601    }
2602
2603    /// Set debug name of the current client that can be used by Flatland to print as a prefix to
2604    /// logs to help client distinguish what is theirs. [`name`] can be an arbitrary string, but the
2605    /// current process name (see fsl::GetCurrentProcessName()) is a good default.
2606    pub fn r#set_debug_name(&self, mut name: &str) -> Result<(), fidl::Error> {
2607        self.client.send::<FlatlandSetDebugNameRequest>(
2608            (name,),
2609            0x46a8b397e68a8888,
2610            fidl::encoding::DynamicFlags::empty(),
2611        )
2612    }
2613}
2614
2615#[cfg(target_os = "fuchsia")]
2616impl From<FlatlandSynchronousProxy> for zx::NullableHandle {
2617    fn from(value: FlatlandSynchronousProxy) -> Self {
2618        value.into_channel().into()
2619    }
2620}
2621
2622#[cfg(target_os = "fuchsia")]
2623impl From<fidl::Channel> for FlatlandSynchronousProxy {
2624    fn from(value: fidl::Channel) -> Self {
2625        Self::new(value)
2626    }
2627}
2628
2629#[cfg(target_os = "fuchsia")]
2630impl fidl::endpoints::FromClient for FlatlandSynchronousProxy {
2631    type Protocol = FlatlandMarker;
2632
2633    fn from_client(value: fidl::endpoints::ClientEnd<FlatlandMarker>) -> Self {
2634        Self::new(value.into_channel())
2635    }
2636}
2637
2638#[derive(Debug, Clone)]
2639pub struct FlatlandProxy {
2640    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2641}
2642
2643impl fidl::endpoints::Proxy for FlatlandProxy {
2644    type Protocol = FlatlandMarker;
2645
2646    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2647        Self::new(inner)
2648    }
2649
2650    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2651        self.client.into_channel().map_err(|client| Self { client })
2652    }
2653
2654    fn as_channel(&self) -> &::fidl::AsyncChannel {
2655        self.client.as_channel()
2656    }
2657}
2658
2659impl FlatlandProxy {
2660    /// Create a new Proxy for fuchsia.ui.composition/Flatland.
2661    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2662        let protocol_name = <FlatlandMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2663        Self { client: fidl::client::Client::new(channel, protocol_name) }
2664    }
2665
2666    /// Get a Stream of events from the remote end of the protocol.
2667    ///
2668    /// # Panics
2669    ///
2670    /// Panics if the event stream was already taken.
2671    pub fn take_event_stream(&self) -> FlatlandEventStream {
2672        FlatlandEventStream { event_receiver: self.client.take_event_receiver() }
2673    }
2674
2675    /// Releases an image immediately, without waiting for the next present.
2676    pub fn r#release_image_immediately(&self, mut image_id: &ContentId) -> Result<(), fidl::Error> {
2677        FlatlandProxyInterface::r#release_image_immediately(self, image_id)
2678    }
2679
2680    /// Complete execution of all feed-forward operations.
2681    ///
2682    /// If executing an operation produces an error (e.g., CreateTransform(0)), an [`OnError`] event
2683    /// is emitted. Operations that produce errors are ignored and the channel is closed.
2684    ///
2685    /// If the execution is completed successfully, [`OnNextFrameBegin`] emits NO_ERROR along
2686    /// with other valid fields.
2687    ///
2688    /// The client may only call [`Present`] when they have a non-zero number of present credits,
2689    /// which are tracked by the server. The server may increment the number of credits when it
2690    /// fires the [`OnNextFrameBegin`] event, which informs the client when it receives additional
2691    /// present credits. Each [`Present`] call uses one present credit and decrements the server
2692    /// count by one. If the client calls [`Present`] with no present credits, the server will
2693    /// return a `NO_PRESENTS_REMAINING` error.
2694    ///
2695    /// The client should assume that prior to receiving any [`OnNextFrameBegin`] events, they have
2696    /// one present credit.
2697    ///
2698    /// Every [`Present`] call results in one [`OnNextFrameBegin`] event, and one
2699    /// [`OnFramePresented`] event, typically in that order.
2700    ///
2701    /// When the commands flushed by [`Present`] make it to display, an [`OnFramePresented`] event
2702    /// is fired. This event includes information pertaining to all [`Present`]s that had content
2703    /// that were part of that frame.
2704    ///
2705    /// See [`fuchsia.ui.composition/PresentArgs`] documentation above for more detailed information
2706    /// on what arguments are passed in and their role.
2707    pub fn r#present(&self, mut args: PresentArgs) -> Result<(), fidl::Error> {
2708        FlatlandProxyInterface::r#present(self, args)
2709    }
2710
2711    /// Two Flatland instances may be connected in a parent-child relationship. The parent endpoint
2712    /// is held in a Viewport, and the child endpoint is held in a View. The parent Flatland
2713    /// instance that creates a Viewport has control over how the child's View is integrated into
2714    /// its own View.
2715    ///
2716    /// The lifecycle of a parent-child connection starts with two endpoints of a channel object:
2717    /// a ViewportCreationToken and a ViewCreationToken. Out-of-band protocols pass the
2718    /// ViewportCreationToken to the parent, which calls [`CreateViewport`], and the
2719    /// ViewCreationToken to the child, which calls [`CreateView`].
2720    ///
2721    /// Only nodes connected to the Root Transform in this Flatland instance will be rendered into
2722    /// the parent's Viewport.
2723    ///
2724    /// Calling [`CreateView`] a second time will disconnect the Root Transform from the existing
2725    /// parent's Viewport, and attach it to a new parent's Viewport. In other words, each View can
2726    /// only have one parent.
2727    ///
2728    /// This function is queued, meaning that the Root Transform will not be attached to the
2729    /// parent Viewport until [`Present`] is called. However, clients will receive information
2730    /// through their ParentViewportWatcher (e.g., LayoutInfo) immediately after calling this
2731    /// function, even if they have not called [`Present`] or [`SetRootTransform`]. This allows
2732    /// clients to wait for layout information from their parent before calling [`Present`].
2733    ///
2734    /// Any illegal operations on ParentViewportWatcher will cause both ParentViewportWatcher
2735    /// channel and this Flatland channel to be torn down.
2736    ///
2737    /// Lifecycle note. The lifetime of the ParentViewportWatcher channel is bound by the peer
2738    /// ViewportCreationToken. When the ViewportCreationToken dies, this ParentViewportWatcher
2739    /// channel is destroyed.
2740    ///
2741    /// Views and subgraphs of Views created using `CreateView` will not be represented in the
2742    /// ViewTree, and hence will not be able to participate in any ViewTree-dependent interactions
2743    /// such as touch, mouse or focus.
2744    /// The Flatland protocol provides no way for Views in the subgraph of a View created with
2745    /// `CreateView` to know that they are excluded from the ViewTree.
2746    pub fn r#create_view(
2747        &self,
2748        mut token: fidl_fuchsia_ui_views::ViewCreationToken,
2749        mut parent_viewport_watcher: fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>,
2750    ) -> Result<(), fidl::Error> {
2751        FlatlandProxyInterface::r#create_view(self, token, parent_viewport_watcher)
2752    }
2753
2754    /// Identical to [`CreateView`], except it allows association of View identity (ViewRef) and
2755    /// view-bound protocols.
2756    pub fn r#create_view2(
2757        &self,
2758        mut token: fidl_fuchsia_ui_views::ViewCreationToken,
2759        mut view_identity: fidl_fuchsia_ui_views::ViewIdentityOnCreation,
2760        mut protocols: ViewBoundProtocols,
2761        mut parent_viewport_watcher: fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>,
2762    ) -> Result<(), fidl::Error> {
2763        FlatlandProxyInterface::r#create_view2(
2764            self,
2765            token,
2766            view_identity,
2767            protocols,
2768            parent_viewport_watcher,
2769        )
2770    }
2771
2772    /// Creates a new Transform node. Transforms are a hierarchical piece of a Flatland graph. They
2773    /// can have children, and can reference Content. A sub-graph represented by a Transform and its
2774    /// descendants can be rendered to a display.
2775    ///
2776    /// Transforms are kept alive, even when released, as long as they are children of either an
2777    /// unreleased Transform, or the Root Transform.
2778    ///
2779    /// Each Transform can have a single piece of attached Content. Common types of Content include
2780    /// bitmaps, asynchronous streams of images, and Viewports to Views hosted in other Flatland
2781    /// instances.
2782    ///
2783    /// Transforms have attributes. Child Transforms inherit the combined attributes of their
2784    /// parents. Content attached to a Transform is also affected by that Transform's attributes.
2785    ///
2786    /// When a sub-graph of Transforms is rendered, Content will be rendered back-to-front, starting
2787    /// with the Content on the root transform, and continuing recursively through all of its child
2788    /// Transforms in the order the children were added. See [`AddChild`] for more information.
2789    ///
2790    /// Zero is not a valid transform id. All other values are valid, assuming they are not already
2791    /// in use (see [`ReleaseTransform`] for more details).
2792    pub fn r#create_transform(&self, mut transform_id: &TransformId) -> Result<(), fidl::Error> {
2793        FlatlandProxyInterface::r#create_transform(self, transform_id)
2794    }
2795
2796    /// All Transform objects support all attributes.
2797    ///
2798    /// Geometric attributes are applied in the following order:
2799    /// 1. Scale (relative to the parent transform's coordinate space)
2800    /// 2. Orientation (relative to the parent transform's coordinate space)
2801    /// 3. Translation (relative to the parent transforms's coordinate space,
2802    ///    unaffected by scale applied to the current transform).
2803    /// 4. Clipping (relative to the current transform's coordinate space)
2804    ///
2805    /// The effects of each of these attributes are cumulative. This means the transform's position
2806    /// in the view space, and its clip boundary, will be calculated based on that chain of
2807    /// geometric attributes going up to the root transform.
2808    ///
2809    /// For instance, in a nested hierarchy such as the following:
2810    ///     [Root-Transform -> Transform1 -> Transform2 -> CurrentTransform]
2811    /// If Transform1 is translated by [2,0] and Transform2 is translated by [0,1] then the
2812    /// view-space position of CurrentTransform will be [2,1].
2813    ///
2814    /// Sets the translation on a Transform. The order of geometric attribute application is
2815    /// addressed above.
2816    pub fn r#set_translation(
2817        &self,
2818        mut transform_id: &TransformId,
2819        mut translation: &fidl_fuchsia_math::Vec_,
2820    ) -> Result<(), fidl::Error> {
2821        FlatlandProxyInterface::r#set_translation(self, transform_id, translation)
2822    }
2823
2824    /// Sets the orientation on a Transform. The order of geometric attribute application is
2825    /// addressed in the documentation for [`SetTranslation`]. In Flatland, the +X axis is
2826    /// to the right and the +Y axis is down. There is no notion of a Z axis. CCW is defined
2827    /// from the POV of the user, as if a skeuomorphoic clock is displayed on the screen.
2828    pub fn r#set_orientation(
2829        &self,
2830        mut transform_id: &TransformId,
2831        mut orientation: Orientation,
2832    ) -> Result<(), fidl::Error> {
2833        FlatlandProxyInterface::r#set_orientation(self, transform_id, orientation)
2834    }
2835
2836    /// Sets the scale on a transform. The order of geometric attribute application is
2837    /// addressed above. The (x,y) values in the VecF |scale| refer to the scale factor in the
2838    /// x-axis (width) and y-axis (height) respectively. Scale values must be positive 32-bit
2839    /// floating point values: https://en.wikipedia.org/wiki/Normal_number_%28computing%29
2840    pub fn r#set_scale(
2841        &self,
2842        mut transform_id: &TransformId,
2843        mut scale: &fidl_fuchsia_math::VecF,
2844    ) -> Result<(), fidl::Error> {
2845        FlatlandProxyInterface::r#set_scale(self, transform_id, scale)
2846    }
2847
2848    /// Sets an opacity in linear space to be applied to a transform and its descendents,
2849    /// which include other transforms and content. Opacity values must be in the range
2850    /// of [0.0, 1.0], where 0.0 is completely transparent and 1.0 is completely opaque.
2851    /// Attempting to call this function with values outside that range will result in
2852    /// an error. A transform's opacity value is multiplied with that of its parent. This
2853    /// effect works differently from group opacity. Using group opacity, child nodes are
2854    /// rendered together first, and then have the parent's opacity applied as a post-effect.
2855    /// Here, opacity is applied to each child individually. This may result in a very
2856    /// different effect.
2857    pub fn r#set_opacity(
2858        &self,
2859        mut transform_id: &TransformId,
2860        mut value: f32,
2861    ) -> Result<(), fidl::Error> {
2862        FlatlandProxyInterface::r#set_opacity(self, transform_id, value)
2863    }
2864
2865    /// Sets the bounds, expressed in the local coordinate space of the transform, that
2866    /// constrains the region that content attached to this transform can be rendered to.
2867    /// If the content's area exceeds the clip bounds, the area outside the bounds will
2868    /// not be rendered. These bounds are valid for all children of this transform node as
2869    /// well, which includes nested Flatland instances and their node hierarchies.
2870    /// If a child transform attempts to set clip bounds larger than that of its parent,
2871    /// it will be clipped to the parent's clip bounds. The default state is for a transform
2872    /// to be unclipped, meaning it will not have any bounds placed on its render region.
2873    /// The clip width/height must be positive. Negative values will result in an error.
2874    /// Passing in an empty box to the |rect| parameter will remove the clip bounds.
2875    pub fn r#set_clip_boundary(
2876        &self,
2877        mut transform_id: &TransformId,
2878        mut rect: Option<&fidl_fuchsia_math::Rect>,
2879    ) -> Result<(), fidl::Error> {
2880        FlatlandProxyInterface::r#set_clip_boundary(self, transform_id, rect)
2881    }
2882
2883    /// Adds a child Transform to a parent Transform. The new child Transform,
2884    /// and any Content attached to it or its children, will be rendered on top
2885    /// of the parent's Content, as well as any previously added children.
2886    ///
2887    /// The caller must ensure that `child_transform_id` is valid and that there
2888    /// are no repetitions.  Sending a repeated `child_transform_id` over
2889    /// multiple calls will result in session closure.
2890    pub fn r#add_child(
2891        &self,
2892        mut parent_transform_id: &TransformId,
2893        mut child_transform_id: &TransformId,
2894    ) -> Result<(), fidl::Error> {
2895        FlatlandProxyInterface::r#add_child(self, parent_transform_id, child_transform_id)
2896    }
2897
2898    /// Removes a child Transform from a parent Transform.
2899    pub fn r#remove_child(
2900        &self,
2901        mut parent_transform_id: &TransformId,
2902        mut child_transform_id: &TransformId,
2903    ) -> Result<(), fidl::Error> {
2904        FlatlandProxyInterface::r#remove_child(self, parent_transform_id, child_transform_id)
2905    }
2906
2907    /// Removes all child Transforms from a parent Transform and replaces them
2908    /// with the new child transforms in `new_child_transform_ids`.  The caller
2909    /// must ensure that all `TransformId` values in `new_child_transform_ids`
2910    /// are valid and that there are no repetitions.  Sending a repeated
2911    /// `TransformId` in `new_child_transform_ids` will result in session
2912    /// closure.
2913    pub fn r#replace_children(
2914        &self,
2915        mut parent_transform_id: &TransformId,
2916        mut new_child_transform_ids: &[TransformId],
2917    ) -> Result<(), fidl::Error> {
2918        FlatlandProxyInterface::r#replace_children(
2919            self,
2920            parent_transform_id,
2921            new_child_transform_ids,
2922        )
2923    }
2924
2925    /// Sets the Root Transform for the graph.
2926    ///
2927    /// The sub-graph defined by the Root Transform and its children will be rendered as View
2928    /// in the connected parent's Viewport (see [`CreateView`]). Any parents of the Root Transform
2929    /// in this Graph will be ignored.
2930    ///
2931    /// The Root Transform, and all children of the Root Transform, are kept alive if they are
2932    /// released (see [`ReleaseTransform`] for more details).
2933    ///
2934    /// There is only ever one Root. Since 0 is not a valid transform id (see [`CreateTransform`]),
2935    /// calling SetRootTransform(0) clears the current Root, destroying any previously released
2936    /// objects that are not referenced by the new root.
2937    ///
2938    /// Note that every View has a clip boundary equivalent to its logical size. Anything outside
2939    /// that clip boundary will not be rendered. Hence, the Root Transform has a useful coordinate
2940    /// space of (0, 0) to (logical_size.width, logical_size.height), where (0, 0) is the upper left
2941    /// corner.
2942    ///
2943    /// Setting the root transform installs a full screen hit region on the root transform. Clients
2944    /// may remove this hit region if they don't want users to be able to interact with the root
2945    /// transform's content. For additional details on hit regions, see the [`SetHitRegions`]
2946    /// documentation.
2947    ///
2948    /// Default hit region rules
2949    ///
2950    ///   A default hit region follows these rules:
2951    ///   - When [`SetRootTransform`](T) is called, T receives a maximal hit region, covering the
2952    ///   entire view.
2953    ///   - If [`SetHitRegions`] is called on T, either before or after [`SetRootTransform`](T),
2954    ///   then no default hit region is active and the client specified hit regions are used.
2955    ///   - If a transform is no longer the root transform, i.e., [`SetRootTransform`](U) is
2956    ///   called, then the original transform no longer has its default hit region.
2957    ///   - Clients can remove or modify the root transform's hit regions the same way they would
2958    ///   reset any other transform's hit regions, by calling [`SetHitRegions`] with the appropriate
2959    ///   vector.
2960    pub fn r#set_root_transform(&self, mut transform_id: &TransformId) -> Result<(), fidl::Error> {
2961        FlatlandProxyInterface::r#set_root_transform(self, transform_id)
2962    }
2963
2964    /// Sets the interactive areas for a Transform. By default, Content is not interactive; hit
2965    /// regions must be placed for a user to interact with the Content in a View. Because hit
2966    /// regions are described in the Flatland protocol, a Flatland instance can synchronize Content
2967    /// and hit regions.
2968    ///
2969    /// Each hit region is placed in the coordinate space of the owning Transform, and may or may
2970    /// not interact with different types of hit testing, depending on its [`HitTestInteraction`]
2971    /// type. When there are multiple hit regions that intersect with a hit test, the precedence
2972    /// rules given below dictate which hit region has interacted with the hit test. Only Transforms
2973    /// that transitively connect to the root Transform have their hit regions interact with a hit
2974    /// test.
2975    ///
2976    /// Calling this function replaces any previous values set on this Transform. To reset a
2977    /// Transform to "no hit testing": send an empty vector with [`SetHitRegions`].
2978    ///
2979    /// Note that root transforms get a default hit region installed by Flatland. For more details,
2980    /// see the [`SetRootTransform`] documentation.
2981    ///
2982    /// Precedence rules
2983    ///   Within a Transform, if multiple hit regions overlap, the hit test examines each
2984    ///   intersecting hit region for a possible interaction. Thus, for a regular hit test R and an
2985    ///   accessibility hit test A, where R and A both intersect two hit regions D ([`DEFAULT`]) and
2986    ///   S ([`SEMANTICALLY_INVISIBLE`]) on the same Transform, (1) R interacts with both D and S,
2987    ///   and (2) A only interacts with D. Generally, hit regions that overlap in a single Transform
2988    ///   can cause confusing behavior.
2989    ///
2990    ///   Within a View, for a given hit test, the front-most Transform's hit regions take
2991    ///   precedence over those behind. This follows the expected reverse "render order" of
2992    ///   Transforms (described in [`CreateTransform`]), where a user expects to interact with
2993    ///   Content that is visible, or front-most.
2994    ///
2995    ///   Across Flatland instances, for a given hit test, the front-most instance's front-most
2996    ///   Transform's hit regions take precedence over those behind. This follows the expected
2997    ///   reverse "render order" of views, where a user expects to interact with the View that is
2998    ///   visible, or front-most. For example, if a child View owns Content that is rendered over
2999    ///   the parent View, the user expects to interact with the child's Content.
3000    pub fn r#set_hit_regions(
3001        &self,
3002        mut transform_id: &TransformId,
3003        mut regions: &[HitRegion],
3004    ) -> Result<(), fidl::Error> {
3005        FlatlandProxyInterface::r#set_hit_regions(self, transform_id, regions)
3006    }
3007
3008    /// Identical to [`SetHitRegions`], except the hit region associated with [`transform_id`]
3009    /// covers an infinite region. The hit region is invariant against translation, scaling, and
3010    /// orientation of the Transform.
3011    ///
3012    /// An infinite hit region is still limited in extent by the View's clip boundary, just like a
3013    /// finite hit region.
3014    ///
3015    /// Calling this function replaces any previous values set on this Transform. To reset a
3016    /// Transform to "no hit testing": send an empty vector with [`SetHitRegions`].
3017    pub fn r#set_infinite_hit_region(
3018        &self,
3019        mut transform_id: &TransformId,
3020        mut hit_test: HitTestInteraction,
3021    ) -> Result<(), fidl::Error> {
3022        FlatlandProxyInterface::r#set_infinite_hit_region(self, transform_id, hit_test)
3023    }
3024
3025    /// The Viewport and View pair, together, represent the connection between two Flatland
3026    /// instances. The Viewport is created in the parent, and the View is created in the child. The
3027    /// parent has control over how the child's View is integrated into its own View.
3028    ///
3029    /// Any illegal operations on ChildViewWatcher will cause both ChildViewWatcher channel and this
3030    /// Flatland channel to be torn down.
3031    ///
3032    /// `ViewportProperties` must have logical_size set. This is the initial size that will drive
3033    /// the layout of the child. The logical_size is also used as the default Content size, but
3034    /// subsequent changes to the logical_size will have no effect on the Content size.
3035    ///
3036    /// `ViewportProperties` may have inset field not set. In that case, the default value of
3037    /// (0, 0, 0, 0) is used.
3038    ///
3039    /// The logical_size must have positive X and Y components.
3040    ///
3041    /// Zero is not a valid ContentId. All other values are valid, assuming they are not already
3042    /// in use for another piece of Content (see [`ReleaseViewport`] for more details).
3043    ///
3044    /// Lifecycle note. The lifetime of the ChildViewWatcher channel is bound by the peer
3045    /// ViewCreationToken. When the ViewCreationToken dies, this ChildViewWatcher channel is
3046    /// destroyed.
3047    pub fn r#create_viewport(
3048        &self,
3049        mut viewport_id: &ContentId,
3050        mut token: fidl_fuchsia_ui_views::ViewportCreationToken,
3051        mut properties: &ViewportProperties,
3052        mut child_view_watcher: fidl::endpoints::ServerEnd<ChildViewWatcherMarker>,
3053    ) -> Result<(), fidl::Error> {
3054        FlatlandProxyInterface::r#create_viewport(
3055            self,
3056            viewport_id,
3057            token,
3058            properties,
3059            child_view_watcher,
3060        )
3061    }
3062
3063    /// An Image is a bitmap backed by a specific VMO in a BufferCollection.
3064    ///
3065    /// Image creation requires an allocated BufferCollection registered with Allocator. This
3066    /// function will fail unless all clients of the specified BufferCollection have set their
3067    /// constraints.
3068    ///
3069    /// The Image must reference a valid VMO index and must have ImageProperties that fall within
3070    /// the constraints specified by the backing BufferCollection (i.e. width and height within a
3071    /// valid range, etc.)
3072    ///
3073    /// Zero is not a valid Image id. All other values are valid, assuming they are not already in
3074    /// use for another piece of Content (see [`ReleaseImage`] for more details).
3075    pub fn r#create_image(
3076        &self,
3077        mut image_id: &ContentId,
3078        mut import_token: BufferCollectionImportToken,
3079        mut vmo_index: u32,
3080        mut properties: &ImageProperties,
3081    ) -> Result<(), fidl::Error> {
3082        FlatlandProxyInterface::r#create_image(self, image_id, import_token, vmo_index, properties)
3083    }
3084
3085    /// This function is used to determine the region (in texel space) of an image that will be used
3086    /// by Flatland when rendering. The image to be sampled is referenced by [`image_id`] and the
3087    /// sample region is specified by [`rect`] which itself is comprised of an origin point (x,y) as
3088    /// well as a width and height, in unnormalized coordinates. It is illegal to call this function
3089    /// on non-image content, or to sample a region outside of the texel space of the image. In
3090    /// other words, the region specifed by [`rect`] must not exceed the ranges (0, image_width) and
3091    /// (0, image_height). If (rect.x + rect.width > image_width) or (rect.y + rect.height >
3092    /// image_height) or if any of the values are negative, this will result in an error.
3093    ///
3094    /// If this method is not called, the default sample region is the rectangle with origin at
3095    /// (0, 0) and width and height set at ImageProperties from [`CreateImage`].
3096    pub fn r#set_image_sample_region(
3097        &self,
3098        mut image_id: &ContentId,
3099        mut rect: &fidl_fuchsia_math::RectF,
3100    ) -> Result<(), fidl::Error> {
3101        FlatlandProxyInterface::r#set_image_sample_region(self, image_id, rect)
3102    }
3103
3104    /// The content size for an Image is the size of the rectangle in the parent's logical
3105    /// coordinate space that the image occupies. This combined with the global translation of the
3106    /// transform it is attached to determines the size and location of where the content is
3107    /// rendered on the display.
3108    ///
3109    /// If this method is not called, the default image destination size is the width and height set
3110    /// at ImageProperties from [`CreateImage`]. The destination size will be affected by scaling if
3111    /// [`SetScale`] is used on the attached Transform or its parents.
3112    pub fn r#set_image_destination_size(
3113        &self,
3114        mut image_id: &ContentId,
3115        mut size: &fidl_fuchsia_math::SizeU,
3116    ) -> Result<(), fidl::Error> {
3117        FlatlandProxyInterface::r#set_image_destination_size(self, image_id, size)
3118    }
3119
3120    /// Determines the blend function to use when rendering the content specified by
3121    /// |image_id|. |image_id| must be a valid ContentId associated to a transform through
3122    /// a call to |CreateImage| or |CreateFilledRect|. For details on the different blend functions
3123    /// that are available, please refer to the BlendMode enum. If this function is not called, then
3124    /// the default blendmode is BlendMode::SRC.
3125    pub fn r#set_image_blending_function(
3126        &self,
3127        mut image_id: &ContentId,
3128        mut blend_mode: BlendMode,
3129    ) -> Result<(), fidl::Error> {
3130        FlatlandProxyInterface::r#set_image_blending_function(self, image_id, blend_mode)
3131    }
3132
3133    /// Determines the blend function to use when rendering the content specified by
3134    /// |image_id|. |image_id| must be a valid ContentId associated to a transform through
3135    /// a call to |CreateImage| or |CreateFilledRect|. For details on the different blend functions
3136    /// that are available, please refer to the BlendMode2 enum. If this function is not called,
3137    /// the default blendmode is BlendMode2::REPLACE.
3138    pub fn r#set_image_blend_mode(
3139        &self,
3140        mut image_id: &ContentId,
3141        mut blend_mode: BlendMode2,
3142    ) -> Result<(), fidl::Error> {
3143        FlatlandProxyInterface::r#set_image_blend_mode(self, image_id, blend_mode)
3144    }
3145
3146    /// Sets an opacity in linear space to be applied to a flatland image. Opacity values must
3147    /// be in the range [0.0, 1.0].
3148    pub fn r#set_image_opacity(
3149        &self,
3150        mut image_id: &ContentId,
3151        mut val: f32,
3152    ) -> Result<(), fidl::Error> {
3153        FlatlandProxyInterface::r#set_image_opacity(self, image_id, val)
3154    }
3155
3156    /// Sets the image flip to be applied to a flatland image. This call must be performed after a
3157    /// successful |CreateImage| call. If an invalid |image_id| is supplied, the channel will be
3158    /// closed due to FlatlandError::BAD_OPERATION. This flip will be applied to the Image before
3159    /// parent Transform Orientations. If this function is not called, then the default flip value
3160    /// is ImageFlip::NONE.
3161    pub fn r#set_image_flip(
3162        &self,
3163        mut image_id: &ContentId,
3164        mut flip: ImageFlip,
3165    ) -> Result<(), fidl::Error> {
3166        FlatlandProxyInterface::r#set_image_flip(self, image_id, flip)
3167    }
3168
3169    /// Creates a solid-color rectangle. By default a filled-rect does not have a defined
3170    /// color or size. It is necessary to call |SetSolidFill| to specify a color and size
3171    /// before a filled rect can be used for rendering. Not doing so will result the
3172    pub fn r#create_filled_rect(&self, mut rect_id: &ContentId) -> Result<(), fidl::Error> {
3173        FlatlandProxyInterface::r#create_filled_rect(self, rect_id)
3174    }
3175
3176    /// Defines the color and size of a filled rect. |rect_id| must refer to content that
3177    /// was created via a call to CreateFilledRect. The color is not premultiplied. Color values
3178    /// must be within the range [0,1] inclusive, and normal 32-bit
3179    /// floating point values: https://en.wikipedia.org/wiki/Normal_number_%28computing%29. Values
3180    /// that do not conform to these specifications will cause the channel to close.
3181    /// The rectangle's top left corner will be at (0, 0) in its transform's coordinate space.
3182    /// Hence, its bottom right corner will be at (size.width, size.height).
3183    pub fn r#set_solid_fill(
3184        &self,
3185        mut rect_id: &ContentId,
3186        mut color: &ColorRgba,
3187        mut size: &fidl_fuchsia_math::SizeU,
3188    ) -> Result<(), fidl::Error> {
3189        FlatlandProxyInterface::r#set_solid_fill(self, rect_id, color, size)
3190    }
3191
3192    /// Automatically garbage collects the rectangle when it is no longer needed for
3193    /// rendering. |rect_id| must have been instantiated with a call to
3194    /// |CreateFilledRect|. Once released, the ID immediately goes out of scope and is free
3195    /// to be used again.
3196    pub fn r#release_filled_rect(&self, mut rect_id: &ContentId) -> Result<(), fidl::Error> {
3197        FlatlandProxyInterface::r#release_filled_rect(self, rect_id)
3198    }
3199
3200    /// Setting a piece of Content on a Transform makes that Content visible in the render tree as
3201    /// long as the Transform is visible from the root Transform. The Content will be rendered
3202    /// before, and therefore "behind", any Content attached to the descendants of the Transform.
3203    ///
3204    /// Because each Transform can have, at most, a single piece of Content on it, calling this
3205    /// function on a Transform that already has Content will replace that Content.
3206    ///
3207    /// A Content may be set on more than one Transform.
3208    ///
3209    /// Calling this function with a Content id of 0 will remove any Content currently on the
3210    /// Transform.
3211    pub fn r#set_content(
3212        &self,
3213        mut transform_id: &TransformId,
3214        mut content_id: &ContentId,
3215    ) -> Result<(), fidl::Error> {
3216        FlatlandProxyInterface::r#set_content(self, transform_id, content_id)
3217    }
3218
3219    /// Transforms are usually sufficient to change how Content is presented. Viewports, however,
3220    /// have special properties that are not part of the Transform hierarchy. Those properties can
3221    /// be set using this function.
3222    pub fn r#set_viewport_properties(
3223        &self,
3224        mut viewport_id: &ContentId,
3225        mut properties: &ViewportProperties,
3226    ) -> Result<(), fidl::Error> {
3227        FlatlandProxyInterface::r#set_viewport_properties(self, viewport_id, properties)
3228    }
3229
3230    /// Released Transforms will be garbage collected by the system once they are no longer
3231    /// necessary for rendering. For Transforms, this means there is no path from any unreleased
3232    /// Transform to the newly-released Transform.
3233    ///
3234    /// Once released, the id immediately goes out of scope for future function calls and can be
3235    /// reused when creating new Transforms.
3236    ///
3237    /// It is an error to call functions with a released id (unless that id has been reused to
3238    /// construct a new Transform).
3239    pub fn r#release_transform(&self, mut transform_id: &TransformId) -> Result<(), fidl::Error> {
3240        FlatlandProxyInterface::r#release_transform(self, transform_id)
3241    }
3242
3243    pub fn r#release_view(&self) -> Result<(), fidl::Error> {
3244        FlatlandProxyInterface::r#release_view(self)
3245    }
3246
3247    /// Releases a Viewport from the scene, even if the Viewport is still connected to a Transform.
3248    /// Unlike other resources, Viewports are garbage collected by the system during the next
3249    /// [`Present`] because a removed Viewport is guaranteed to provide no renderable content.
3250    ///
3251    /// Use SetContent(transform_id, 0) to clean up references to released Viewports.
3252    ///
3253    /// Despite having a return type, this function is still feed-forward like [`CreateView`] and
3254    /// requires a call to [`Present`] to be executed. The ViewportCreationToken will be returned
3255    /// after the presented operations have been executed.
3256    pub fn r#release_viewport(
3257        &self,
3258        mut viewport_id: &ContentId,
3259    ) -> fidl::client::QueryResponseFut<
3260        fidl_fuchsia_ui_views::ViewportCreationToken,
3261        fidl::encoding::DefaultFuchsiaResourceDialect,
3262    > {
3263        FlatlandProxyInterface::r#release_viewport(self, viewport_id)
3264    }
3265
3266    /// Released Images will be garbage collected by the system once they are no longer necessary
3267    /// for rendering. For Images, this means the Image is no longer attached to any Transform and
3268    /// any pending rendering that references the Image is complete.
3269    ///
3270    /// Use SetContent(transform_id, 0) to clean up references to released Images.
3271    ///
3272    /// Once released, the id immediately goes out of scope for future function calls and can be
3273    /// reused when creating new Images.
3274    ///
3275    /// It is an error to call functions with a released id (unless that id has been reused to
3276    /// construct a new Image).
3277    pub fn r#release_image(&self, mut image_id: &ContentId) -> Result<(), fidl::Error> {
3278        FlatlandProxyInterface::r#release_image(self, image_id)
3279    }
3280
3281    /// This function will reset all state on this interface. This includes destroying all existing
3282    /// View and Viewports without returning the associated Token to the caller.
3283    pub fn r#clear(&self) -> Result<(), fidl::Error> {
3284        FlatlandProxyInterface::r#clear(self)
3285    }
3286
3287    /// Set debug name of the current client that can be used by Flatland to print as a prefix to
3288    /// logs to help client distinguish what is theirs. [`name`] can be an arbitrary string, but the
3289    /// current process name (see fsl::GetCurrentProcessName()) is a good default.
3290    pub fn r#set_debug_name(&self, mut name: &str) -> Result<(), fidl::Error> {
3291        FlatlandProxyInterface::r#set_debug_name(self, name)
3292    }
3293}
3294
3295impl FlatlandProxyInterface for FlatlandProxy {
3296    fn r#release_image_immediately(&self, mut image_id: &ContentId) -> Result<(), fidl::Error> {
3297        self.client.send::<TrustedFlatlandReleaseImageImmediatelyRequest>(
3298            (image_id,),
3299            0x245e1ac080772c8,
3300            fidl::encoding::DynamicFlags::empty(),
3301        )
3302    }
3303
3304    fn r#present(&self, mut args: PresentArgs) -> Result<(), fidl::Error> {
3305        self.client.send::<FlatlandPresentRequest>(
3306            (&mut args,),
3307            0x50acc2aa1f0acec7,
3308            fidl::encoding::DynamicFlags::empty(),
3309        )
3310    }
3311
3312    fn r#create_view(
3313        &self,
3314        mut token: fidl_fuchsia_ui_views::ViewCreationToken,
3315        mut parent_viewport_watcher: fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>,
3316    ) -> Result<(), fidl::Error> {
3317        self.client.send::<FlatlandCreateViewRequest>(
3318            (&mut token, parent_viewport_watcher),
3319            0x504686eb25864780,
3320            fidl::encoding::DynamicFlags::empty(),
3321        )
3322    }
3323
3324    fn r#create_view2(
3325        &self,
3326        mut token: fidl_fuchsia_ui_views::ViewCreationToken,
3327        mut view_identity: fidl_fuchsia_ui_views::ViewIdentityOnCreation,
3328        mut protocols: ViewBoundProtocols,
3329        mut parent_viewport_watcher: fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>,
3330    ) -> Result<(), fidl::Error> {
3331        self.client.send::<FlatlandCreateView2Request>(
3332            (&mut token, &mut view_identity, &mut protocols, parent_viewport_watcher),
3333            0x340a3a40c2fdbd5e,
3334            fidl::encoding::DynamicFlags::empty(),
3335        )
3336    }
3337
3338    fn r#create_transform(&self, mut transform_id: &TransformId) -> Result<(), fidl::Error> {
3339        self.client.send::<FlatlandCreateTransformRequest>(
3340            (transform_id,),
3341            0x5e042a4d3de3efb0,
3342            fidl::encoding::DynamicFlags::empty(),
3343        )
3344    }
3345
3346    fn r#set_translation(
3347        &self,
3348        mut transform_id: &TransformId,
3349        mut translation: &fidl_fuchsia_math::Vec_,
3350    ) -> Result<(), fidl::Error> {
3351        self.client.send::<FlatlandSetTranslationRequest>(
3352            (transform_id, translation),
3353            0x7863398291fba346,
3354            fidl::encoding::DynamicFlags::empty(),
3355        )
3356    }
3357
3358    fn r#set_orientation(
3359        &self,
3360        mut transform_id: &TransformId,
3361        mut orientation: Orientation,
3362    ) -> Result<(), fidl::Error> {
3363        self.client.send::<FlatlandSetOrientationRequest>(
3364            (transform_id, orientation),
3365            0x4915310bc4928edc,
3366            fidl::encoding::DynamicFlags::empty(),
3367        )
3368    }
3369
3370    fn r#set_scale(
3371        &self,
3372        mut transform_id: &TransformId,
3373        mut scale: &fidl_fuchsia_math::VecF,
3374    ) -> Result<(), fidl::Error> {
3375        self.client.send::<FlatlandSetScaleRequest>(
3376            (transform_id, scale),
3377            0x1ea1766fd8996bb4,
3378            fidl::encoding::DynamicFlags::empty(),
3379        )
3380    }
3381
3382    fn r#set_opacity(
3383        &self,
3384        mut transform_id: &TransformId,
3385        mut value: f32,
3386    ) -> Result<(), fidl::Error> {
3387        self.client.send::<FlatlandSetOpacityRequest>(
3388            (transform_id, value),
3389            0x3775fc2c00b432fa,
3390            fidl::encoding::DynamicFlags::empty(),
3391        )
3392    }
3393
3394    fn r#set_clip_boundary(
3395        &self,
3396        mut transform_id: &TransformId,
3397        mut rect: Option<&fidl_fuchsia_math::Rect>,
3398    ) -> Result<(), fidl::Error> {
3399        self.client.send::<FlatlandSetClipBoundaryRequest>(
3400            (transform_id, rect),
3401            0x6507843df12222d2,
3402            fidl::encoding::DynamicFlags::empty(),
3403        )
3404    }
3405
3406    fn r#add_child(
3407        &self,
3408        mut parent_transform_id: &TransformId,
3409        mut child_transform_id: &TransformId,
3410    ) -> Result<(), fidl::Error> {
3411        self.client.send::<FlatlandAddChildRequest>(
3412            (parent_transform_id, child_transform_id),
3413            0x67a8abd2f19b1a74,
3414            fidl::encoding::DynamicFlags::empty(),
3415        )
3416    }
3417
3418    fn r#remove_child(
3419        &self,
3420        mut parent_transform_id: &TransformId,
3421        mut child_transform_id: &TransformId,
3422    ) -> Result<(), fidl::Error> {
3423        self.client.send::<FlatlandRemoveChildRequest>(
3424            (parent_transform_id, child_transform_id),
3425            0x41d6cd90b298b67a,
3426            fidl::encoding::DynamicFlags::empty(),
3427        )
3428    }
3429
3430    fn r#replace_children(
3431        &self,
3432        mut parent_transform_id: &TransformId,
3433        mut new_child_transform_ids: &[TransformId],
3434    ) -> Result<(), fidl::Error> {
3435        self.client.send::<FlatlandReplaceChildrenRequest>(
3436            (parent_transform_id, new_child_transform_ids),
3437            0x5b6d86cbbff81316,
3438            fidl::encoding::DynamicFlags::empty(),
3439        )
3440    }
3441
3442    fn r#set_root_transform(&self, mut transform_id: &TransformId) -> Result<(), fidl::Error> {
3443        self.client.send::<FlatlandSetRootTransformRequest>(
3444            (transform_id,),
3445            0x6e80ca5bcc566cd8,
3446            fidl::encoding::DynamicFlags::empty(),
3447        )
3448    }
3449
3450    fn r#set_hit_regions(
3451        &self,
3452        mut transform_id: &TransformId,
3453        mut regions: &[HitRegion],
3454    ) -> Result<(), fidl::Error> {
3455        self.client.send::<FlatlandSetHitRegionsRequest>(
3456            (transform_id, regions),
3457            0x31c9d17b07c37ce4,
3458            fidl::encoding::DynamicFlags::empty(),
3459        )
3460    }
3461
3462    fn r#set_infinite_hit_region(
3463        &self,
3464        mut transform_id: &TransformId,
3465        mut hit_test: HitTestInteraction,
3466    ) -> Result<(), fidl::Error> {
3467        self.client.send::<FlatlandSetInfiniteHitRegionRequest>(
3468            (transform_id, hit_test),
3469            0x26d81af852d29562,
3470            fidl::encoding::DynamicFlags::empty(),
3471        )
3472    }
3473
3474    fn r#create_viewport(
3475        &self,
3476        mut viewport_id: &ContentId,
3477        mut token: fidl_fuchsia_ui_views::ViewportCreationToken,
3478        mut properties: &ViewportProperties,
3479        mut child_view_watcher: fidl::endpoints::ServerEnd<ChildViewWatcherMarker>,
3480    ) -> Result<(), fidl::Error> {
3481        self.client.send::<FlatlandCreateViewportRequest>(
3482            (viewport_id, &mut token, properties, child_view_watcher),
3483            0x2485fbcab7f943c,
3484            fidl::encoding::DynamicFlags::empty(),
3485        )
3486    }
3487
3488    fn r#create_image(
3489        &self,
3490        mut image_id: &ContentId,
3491        mut import_token: BufferCollectionImportToken,
3492        mut vmo_index: u32,
3493        mut properties: &ImageProperties,
3494    ) -> Result<(), fidl::Error> {
3495        self.client.send::<FlatlandCreateImageRequest>(
3496            (image_id, &mut import_token, vmo_index, properties),
3497            0x26fae823c4ebedad,
3498            fidl::encoding::DynamicFlags::empty(),
3499        )
3500    }
3501
3502    fn r#set_image_sample_region(
3503        &self,
3504        mut image_id: &ContentId,
3505        mut rect: &fidl_fuchsia_math::RectF,
3506    ) -> Result<(), fidl::Error> {
3507        self.client.send::<FlatlandSetImageSampleRegionRequest>(
3508            (image_id, rect),
3509            0x8039391d715eb28,
3510            fidl::encoding::DynamicFlags::empty(),
3511        )
3512    }
3513
3514    fn r#set_image_destination_size(
3515        &self,
3516        mut image_id: &ContentId,
3517        mut size: &fidl_fuchsia_math::SizeU,
3518    ) -> Result<(), fidl::Error> {
3519        self.client.send::<FlatlandSetImageDestinationSizeRequest>(
3520            (image_id, size),
3521            0x766cf99a2ec58446,
3522            fidl::encoding::DynamicFlags::empty(),
3523        )
3524    }
3525
3526    fn r#set_image_blending_function(
3527        &self,
3528        mut image_id: &ContentId,
3529        mut blend_mode: BlendMode,
3530    ) -> Result<(), fidl::Error> {
3531        self.client.send::<FlatlandSetImageBlendingFunctionRequest>(
3532            (image_id, blend_mode),
3533            0x10f5da1356275b7b,
3534            fidl::encoding::DynamicFlags::empty(),
3535        )
3536    }
3537
3538    fn r#set_image_blend_mode(
3539        &self,
3540        mut image_id: &ContentId,
3541        mut blend_mode: BlendMode2,
3542    ) -> Result<(), fidl::Error> {
3543        self.client.send::<FlatlandSetImageBlendModeRequest>(
3544            (image_id, blend_mode),
3545            0x5b1667f130c3de67,
3546            fidl::encoding::DynamicFlags::empty(),
3547        )
3548    }
3549
3550    fn r#set_image_opacity(
3551        &self,
3552        mut image_id: &ContentId,
3553        mut val: f32,
3554    ) -> Result<(), fidl::Error> {
3555        self.client.send::<FlatlandSetImageOpacityRequest>(
3556            (image_id, val),
3557            0x2da9e4ef4c2cff6f,
3558            fidl::encoding::DynamicFlags::empty(),
3559        )
3560    }
3561
3562    fn r#set_image_flip(
3563        &self,
3564        mut image_id: &ContentId,
3565        mut flip: ImageFlip,
3566    ) -> Result<(), fidl::Error> {
3567        self.client.send::<FlatlandSetImageFlipRequest>(
3568            (image_id, flip),
3569            0x21b20f2c14aae6bc,
3570            fidl::encoding::DynamicFlags::empty(),
3571        )
3572    }
3573
3574    fn r#create_filled_rect(&self, mut rect_id: &ContentId) -> Result<(), fidl::Error> {
3575        self.client.send::<FlatlandCreateFilledRectRequest>(
3576            (rect_id,),
3577            0x5e62355abc1c4c5d,
3578            fidl::encoding::DynamicFlags::empty(),
3579        )
3580    }
3581
3582    fn r#set_solid_fill(
3583        &self,
3584        mut rect_id: &ContentId,
3585        mut color: &ColorRgba,
3586        mut size: &fidl_fuchsia_math::SizeU,
3587    ) -> Result<(), fidl::Error> {
3588        self.client.send::<FlatlandSetSolidFillRequest>(
3589            (rect_id, color, size),
3590            0x32d6ef41e182dfa5,
3591            fidl::encoding::DynamicFlags::empty(),
3592        )
3593    }
3594
3595    fn r#release_filled_rect(&self, mut rect_id: &ContentId) -> Result<(), fidl::Error> {
3596        self.client.send::<FlatlandReleaseFilledRectRequest>(
3597            (rect_id,),
3598            0x7392cabe45618f9b,
3599            fidl::encoding::DynamicFlags::empty(),
3600        )
3601    }
3602
3603    fn r#set_content(
3604        &self,
3605        mut transform_id: &TransformId,
3606        mut content_id: &ContentId,
3607    ) -> Result<(), fidl::Error> {
3608        self.client.send::<FlatlandSetContentRequest>(
3609            (transform_id, content_id),
3610            0x4ed2cfc0ce130862,
3611            fidl::encoding::DynamicFlags::empty(),
3612        )
3613    }
3614
3615    fn r#set_viewport_properties(
3616        &self,
3617        mut viewport_id: &ContentId,
3618        mut properties: &ViewportProperties,
3619    ) -> Result<(), fidl::Error> {
3620        self.client.send::<FlatlandSetViewportPropertiesRequest>(
3621            (viewport_id, properties),
3622            0x66ab67e9608ddb9f,
3623            fidl::encoding::DynamicFlags::empty(),
3624        )
3625    }
3626
3627    fn r#release_transform(&self, mut transform_id: &TransformId) -> Result<(), fidl::Error> {
3628        self.client.send::<FlatlandReleaseTransformRequest>(
3629            (transform_id,),
3630            0xab9328419451c22,
3631            fidl::encoding::DynamicFlags::empty(),
3632        )
3633    }
3634
3635    fn r#release_view(&self) -> Result<(), fidl::Error> {
3636        self.client.send::<fidl::encoding::EmptyPayload>(
3637            (),
3638            0x5b35aab9baffecae,
3639            fidl::encoding::DynamicFlags::empty(),
3640        )
3641    }
3642
3643    type ReleaseViewportResponseFut = fidl::client::QueryResponseFut<
3644        fidl_fuchsia_ui_views::ViewportCreationToken,
3645        fidl::encoding::DefaultFuchsiaResourceDialect,
3646    >;
3647    fn r#release_viewport(&self, mut viewport_id: &ContentId) -> Self::ReleaseViewportResponseFut {
3648        fn _decode(
3649            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3650        ) -> Result<fidl_fuchsia_ui_views::ViewportCreationToken, fidl::Error> {
3651            let _response = fidl::client::decode_transaction_body::<
3652                FlatlandReleaseViewportResponse,
3653                fidl::encoding::DefaultFuchsiaResourceDialect,
3654                0xbad474aeb5293f9,
3655            >(_buf?)?;
3656            Ok(_response.token)
3657        }
3658        self.client.send_query_and_decode::<
3659            FlatlandReleaseViewportRequest,
3660            fidl_fuchsia_ui_views::ViewportCreationToken,
3661        >(
3662            (viewport_id,),
3663            0xbad474aeb5293f9,
3664            fidl::encoding::DynamicFlags::empty(),
3665            _decode,
3666        )
3667    }
3668
3669    fn r#release_image(&self, mut image_id: &ContentId) -> Result<(), fidl::Error> {
3670        self.client.send::<FlatlandReleaseImageRequest>(
3671            (image_id,),
3672            0xb884ffdbc72c111,
3673            fidl::encoding::DynamicFlags::empty(),
3674        )
3675    }
3676
3677    fn r#clear(&self) -> Result<(), fidl::Error> {
3678        self.client.send::<fidl::encoding::EmptyPayload>(
3679            (),
3680            0x4ec8817c02828c3e,
3681            fidl::encoding::DynamicFlags::empty(),
3682        )
3683    }
3684
3685    fn r#set_debug_name(&self, mut name: &str) -> Result<(), fidl::Error> {
3686        self.client.send::<FlatlandSetDebugNameRequest>(
3687            (name,),
3688            0x46a8b397e68a8888,
3689            fidl::encoding::DynamicFlags::empty(),
3690        )
3691    }
3692}
3693
3694pub struct FlatlandEventStream {
3695    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
3696}
3697
3698impl std::marker::Unpin for FlatlandEventStream {}
3699
3700impl futures::stream::FusedStream for FlatlandEventStream {
3701    fn is_terminated(&self) -> bool {
3702        self.event_receiver.is_terminated()
3703    }
3704}
3705
3706impl futures::Stream for FlatlandEventStream {
3707    type Item = Result<FlatlandEvent, fidl::Error>;
3708
3709    fn poll_next(
3710        mut self: std::pin::Pin<&mut Self>,
3711        cx: &mut std::task::Context<'_>,
3712    ) -> std::task::Poll<Option<Self::Item>> {
3713        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
3714            &mut self.event_receiver,
3715            cx
3716        )?) {
3717            Some(buf) => std::task::Poll::Ready(Some(FlatlandEvent::decode(buf))),
3718            None => std::task::Poll::Ready(None),
3719        }
3720    }
3721}
3722
3723#[derive(Debug)]
3724pub enum FlatlandEvent {
3725    OnNextFrameBegin { values: OnNextFrameBeginValues },
3726    OnFramePresented { frame_presented_info: fidl_fuchsia_scenic_scheduling::FramePresentedInfo },
3727    OnError { error: FlatlandError },
3728}
3729
3730impl FlatlandEvent {
3731    #[allow(irrefutable_let_patterns)]
3732    pub fn into_on_next_frame_begin(self) -> Option<OnNextFrameBeginValues> {
3733        if let FlatlandEvent::OnNextFrameBegin { values } = self { Some((values)) } else { None }
3734    }
3735    #[allow(irrefutable_let_patterns)]
3736    pub fn into_on_frame_presented(
3737        self,
3738    ) -> Option<fidl_fuchsia_scenic_scheduling::FramePresentedInfo> {
3739        if let FlatlandEvent::OnFramePresented { frame_presented_info } = self {
3740            Some((frame_presented_info))
3741        } else {
3742            None
3743        }
3744    }
3745    #[allow(irrefutable_let_patterns)]
3746    pub fn into_on_error(self) -> Option<FlatlandError> {
3747        if let FlatlandEvent::OnError { error } = self { Some((error)) } else { None }
3748    }
3749
3750    /// Decodes a message buffer as a [`FlatlandEvent`].
3751    fn decode(
3752        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3753    ) -> Result<FlatlandEvent, fidl::Error> {
3754        let (bytes, _handles) = buf.split_mut();
3755        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3756        debug_assert_eq!(tx_header.tx_id, 0);
3757        match tx_header.ordinal {
3758            0x10f69a5cdeece84a => {
3759                let mut out = fidl::new_empty!(
3760                    FlatlandOnNextFrameBeginRequest,
3761                    fidl::encoding::DefaultFuchsiaResourceDialect
3762                );
3763                fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandOnNextFrameBeginRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
3764                Ok((FlatlandEvent::OnNextFrameBegin { values: out.values }))
3765            }
3766            0x56e43e1a5f30216d => {
3767                let mut out = fidl::new_empty!(
3768                    FlatlandOnFramePresentedRequest,
3769                    fidl::encoding::DefaultFuchsiaResourceDialect
3770                );
3771                fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandOnFramePresentedRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
3772                Ok((FlatlandEvent::OnFramePresented {
3773                    frame_presented_info: out.frame_presented_info,
3774                }))
3775            }
3776            0x1ebf39e90cd8b8d => {
3777                let mut out = fidl::new_empty!(
3778                    FlatlandOnErrorRequest,
3779                    fidl::encoding::DefaultFuchsiaResourceDialect
3780                );
3781                fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandOnErrorRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
3782                Ok((FlatlandEvent::OnError { error: out.error }))
3783            }
3784            _ => Err(fidl::Error::UnknownOrdinal {
3785                ordinal: tx_header.ordinal,
3786                protocol_name: <FlatlandMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3787            }),
3788        }
3789    }
3790}
3791
3792/// A Stream of incoming requests for fuchsia.ui.composition/Flatland.
3793pub struct FlatlandRequestStream {
3794    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3795    is_terminated: bool,
3796}
3797
3798impl std::marker::Unpin for FlatlandRequestStream {}
3799
3800impl futures::stream::FusedStream for FlatlandRequestStream {
3801    fn is_terminated(&self) -> bool {
3802        self.is_terminated
3803    }
3804}
3805
3806impl fidl::endpoints::RequestStream for FlatlandRequestStream {
3807    type Protocol = FlatlandMarker;
3808    type ControlHandle = FlatlandControlHandle;
3809
3810    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
3811        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3812    }
3813
3814    fn control_handle(&self) -> Self::ControlHandle {
3815        FlatlandControlHandle { inner: self.inner.clone() }
3816    }
3817
3818    fn into_inner(
3819        self,
3820    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3821    {
3822        (self.inner, self.is_terminated)
3823    }
3824
3825    fn from_inner(
3826        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3827        is_terminated: bool,
3828    ) -> Self {
3829        Self { inner, is_terminated }
3830    }
3831}
3832
3833impl futures::Stream for FlatlandRequestStream {
3834    type Item = Result<FlatlandRequest, fidl::Error>;
3835
3836    fn poll_next(
3837        mut self: std::pin::Pin<&mut Self>,
3838        cx: &mut std::task::Context<'_>,
3839    ) -> std::task::Poll<Option<Self::Item>> {
3840        let this = &mut *self;
3841        if this.inner.check_shutdown(cx) {
3842            this.is_terminated = true;
3843            return std::task::Poll::Ready(None);
3844        }
3845        if this.is_terminated {
3846            panic!("polled FlatlandRequestStream after completion");
3847        }
3848        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3849            |bytes, handles| {
3850                match this.inner.channel().read_etc(cx, bytes, handles) {
3851                    std::task::Poll::Ready(Ok(())) => {}
3852                    std::task::Poll::Pending => return std::task::Poll::Pending,
3853                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3854                        this.is_terminated = true;
3855                        return std::task::Poll::Ready(None);
3856                    }
3857                    std::task::Poll::Ready(Err(e)) => {
3858                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3859                            e.into(),
3860                        ))));
3861                    }
3862                }
3863
3864                // A message has been received from the channel
3865                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3866
3867                std::task::Poll::Ready(Some(match header.ordinal {
3868                    0x245e1ac080772c8 => {
3869                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3870                        let mut req = fidl::new_empty!(
3871                            TrustedFlatlandReleaseImageImmediatelyRequest,
3872                            fidl::encoding::DefaultFuchsiaResourceDialect
3873                        );
3874                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<TrustedFlatlandReleaseImageImmediatelyRequest>(&header, _body_bytes, handles, &mut req)?;
3875                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
3876                        Ok(FlatlandRequest::ReleaseImageImmediately {
3877                            image_id: req.image_id,
3878
3879                            control_handle,
3880                        })
3881                    }
3882                    0x50acc2aa1f0acec7 => {
3883                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3884                        let mut req = fidl::new_empty!(
3885                            FlatlandPresentRequest,
3886                            fidl::encoding::DefaultFuchsiaResourceDialect
3887                        );
3888                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandPresentRequest>(&header, _body_bytes, handles, &mut req)?;
3889                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
3890                        Ok(FlatlandRequest::Present { args: req.args, control_handle })
3891                    }
3892                    0x504686eb25864780 => {
3893                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3894                        let mut req = fidl::new_empty!(
3895                            FlatlandCreateViewRequest,
3896                            fidl::encoding::DefaultFuchsiaResourceDialect
3897                        );
3898                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandCreateViewRequest>(&header, _body_bytes, handles, &mut req)?;
3899                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
3900                        Ok(FlatlandRequest::CreateView {
3901                            token: req.token,
3902                            parent_viewport_watcher: req.parent_viewport_watcher,
3903
3904                            control_handle,
3905                        })
3906                    }
3907                    0x340a3a40c2fdbd5e => {
3908                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3909                        let mut req = fidl::new_empty!(
3910                            FlatlandCreateView2Request,
3911                            fidl::encoding::DefaultFuchsiaResourceDialect
3912                        );
3913                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandCreateView2Request>(&header, _body_bytes, handles, &mut req)?;
3914                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
3915                        Ok(FlatlandRequest::CreateView2 {
3916                            token: req.token,
3917                            view_identity: req.view_identity,
3918                            protocols: req.protocols,
3919                            parent_viewport_watcher: req.parent_viewport_watcher,
3920
3921                            control_handle,
3922                        })
3923                    }
3924                    0x5e042a4d3de3efb0 => {
3925                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3926                        let mut req = fidl::new_empty!(
3927                            FlatlandCreateTransformRequest,
3928                            fidl::encoding::DefaultFuchsiaResourceDialect
3929                        );
3930                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandCreateTransformRequest>(&header, _body_bytes, handles, &mut req)?;
3931                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
3932                        Ok(FlatlandRequest::CreateTransform {
3933                            transform_id: req.transform_id,
3934
3935                            control_handle,
3936                        })
3937                    }
3938                    0x7863398291fba346 => {
3939                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3940                        let mut req = fidl::new_empty!(
3941                            FlatlandSetTranslationRequest,
3942                            fidl::encoding::DefaultFuchsiaResourceDialect
3943                        );
3944                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetTranslationRequest>(&header, _body_bytes, handles, &mut req)?;
3945                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
3946                        Ok(FlatlandRequest::SetTranslation {
3947                            transform_id: req.transform_id,
3948                            translation: req.translation,
3949
3950                            control_handle,
3951                        })
3952                    }
3953                    0x4915310bc4928edc => {
3954                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3955                        let mut req = fidl::new_empty!(
3956                            FlatlandSetOrientationRequest,
3957                            fidl::encoding::DefaultFuchsiaResourceDialect
3958                        );
3959                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetOrientationRequest>(&header, _body_bytes, handles, &mut req)?;
3960                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
3961                        Ok(FlatlandRequest::SetOrientation {
3962                            transform_id: req.transform_id,
3963                            orientation: req.orientation,
3964
3965                            control_handle,
3966                        })
3967                    }
3968                    0x1ea1766fd8996bb4 => {
3969                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3970                        let mut req = fidl::new_empty!(
3971                            FlatlandSetScaleRequest,
3972                            fidl::encoding::DefaultFuchsiaResourceDialect
3973                        );
3974                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetScaleRequest>(&header, _body_bytes, handles, &mut req)?;
3975                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
3976                        Ok(FlatlandRequest::SetScale {
3977                            transform_id: req.transform_id,
3978                            scale: req.scale,
3979
3980                            control_handle,
3981                        })
3982                    }
3983                    0x3775fc2c00b432fa => {
3984                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3985                        let mut req = fidl::new_empty!(
3986                            FlatlandSetOpacityRequest,
3987                            fidl::encoding::DefaultFuchsiaResourceDialect
3988                        );
3989                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetOpacityRequest>(&header, _body_bytes, handles, &mut req)?;
3990                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
3991                        Ok(FlatlandRequest::SetOpacity {
3992                            transform_id: req.transform_id,
3993                            value: req.value,
3994
3995                            control_handle,
3996                        })
3997                    }
3998                    0x6507843df12222d2 => {
3999                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4000                        let mut req = fidl::new_empty!(
4001                            FlatlandSetClipBoundaryRequest,
4002                            fidl::encoding::DefaultFuchsiaResourceDialect
4003                        );
4004                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetClipBoundaryRequest>(&header, _body_bytes, handles, &mut req)?;
4005                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4006                        Ok(FlatlandRequest::SetClipBoundary {
4007                            transform_id: req.transform_id,
4008                            rect: req.rect,
4009
4010                            control_handle,
4011                        })
4012                    }
4013                    0x67a8abd2f19b1a74 => {
4014                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4015                        let mut req = fidl::new_empty!(
4016                            FlatlandAddChildRequest,
4017                            fidl::encoding::DefaultFuchsiaResourceDialect
4018                        );
4019                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandAddChildRequest>(&header, _body_bytes, handles, &mut req)?;
4020                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4021                        Ok(FlatlandRequest::AddChild {
4022                            parent_transform_id: req.parent_transform_id,
4023                            child_transform_id: req.child_transform_id,
4024
4025                            control_handle,
4026                        })
4027                    }
4028                    0x41d6cd90b298b67a => {
4029                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4030                        let mut req = fidl::new_empty!(
4031                            FlatlandRemoveChildRequest,
4032                            fidl::encoding::DefaultFuchsiaResourceDialect
4033                        );
4034                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandRemoveChildRequest>(&header, _body_bytes, handles, &mut req)?;
4035                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4036                        Ok(FlatlandRequest::RemoveChild {
4037                            parent_transform_id: req.parent_transform_id,
4038                            child_transform_id: req.child_transform_id,
4039
4040                            control_handle,
4041                        })
4042                    }
4043                    0x5b6d86cbbff81316 => {
4044                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4045                        let mut req = fidl::new_empty!(
4046                            FlatlandReplaceChildrenRequest,
4047                            fidl::encoding::DefaultFuchsiaResourceDialect
4048                        );
4049                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandReplaceChildrenRequest>(&header, _body_bytes, handles, &mut req)?;
4050                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4051                        Ok(FlatlandRequest::ReplaceChildren {
4052                            parent_transform_id: req.parent_transform_id,
4053                            new_child_transform_ids: req.new_child_transform_ids,
4054
4055                            control_handle,
4056                        })
4057                    }
4058                    0x6e80ca5bcc566cd8 => {
4059                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4060                        let mut req = fidl::new_empty!(
4061                            FlatlandSetRootTransformRequest,
4062                            fidl::encoding::DefaultFuchsiaResourceDialect
4063                        );
4064                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetRootTransformRequest>(&header, _body_bytes, handles, &mut req)?;
4065                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4066                        Ok(FlatlandRequest::SetRootTransform {
4067                            transform_id: req.transform_id,
4068
4069                            control_handle,
4070                        })
4071                    }
4072                    0x31c9d17b07c37ce4 => {
4073                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4074                        let mut req = fidl::new_empty!(
4075                            FlatlandSetHitRegionsRequest,
4076                            fidl::encoding::DefaultFuchsiaResourceDialect
4077                        );
4078                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetHitRegionsRequest>(&header, _body_bytes, handles, &mut req)?;
4079                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4080                        Ok(FlatlandRequest::SetHitRegions {
4081                            transform_id: req.transform_id,
4082                            regions: req.regions,
4083
4084                            control_handle,
4085                        })
4086                    }
4087                    0x26d81af852d29562 => {
4088                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4089                        let mut req = fidl::new_empty!(
4090                            FlatlandSetInfiniteHitRegionRequest,
4091                            fidl::encoding::DefaultFuchsiaResourceDialect
4092                        );
4093                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetInfiniteHitRegionRequest>(&header, _body_bytes, handles, &mut req)?;
4094                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4095                        Ok(FlatlandRequest::SetInfiniteHitRegion {
4096                            transform_id: req.transform_id,
4097                            hit_test: req.hit_test,
4098
4099                            control_handle,
4100                        })
4101                    }
4102                    0x2485fbcab7f943c => {
4103                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4104                        let mut req = fidl::new_empty!(
4105                            FlatlandCreateViewportRequest,
4106                            fidl::encoding::DefaultFuchsiaResourceDialect
4107                        );
4108                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandCreateViewportRequest>(&header, _body_bytes, handles, &mut req)?;
4109                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4110                        Ok(FlatlandRequest::CreateViewport {
4111                            viewport_id: req.viewport_id,
4112                            token: req.token,
4113                            properties: req.properties,
4114                            child_view_watcher: req.child_view_watcher,
4115
4116                            control_handle,
4117                        })
4118                    }
4119                    0x26fae823c4ebedad => {
4120                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4121                        let mut req = fidl::new_empty!(
4122                            FlatlandCreateImageRequest,
4123                            fidl::encoding::DefaultFuchsiaResourceDialect
4124                        );
4125                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandCreateImageRequest>(&header, _body_bytes, handles, &mut req)?;
4126                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4127                        Ok(FlatlandRequest::CreateImage {
4128                            image_id: req.image_id,
4129                            import_token: req.import_token,
4130                            vmo_index: req.vmo_index,
4131                            properties: req.properties,
4132
4133                            control_handle,
4134                        })
4135                    }
4136                    0x8039391d715eb28 => {
4137                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4138                        let mut req = fidl::new_empty!(
4139                            FlatlandSetImageSampleRegionRequest,
4140                            fidl::encoding::DefaultFuchsiaResourceDialect
4141                        );
4142                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetImageSampleRegionRequest>(&header, _body_bytes, handles, &mut req)?;
4143                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4144                        Ok(FlatlandRequest::SetImageSampleRegion {
4145                            image_id: req.image_id,
4146                            rect: req.rect,
4147
4148                            control_handle,
4149                        })
4150                    }
4151                    0x766cf99a2ec58446 => {
4152                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4153                        let mut req = fidl::new_empty!(
4154                            FlatlandSetImageDestinationSizeRequest,
4155                            fidl::encoding::DefaultFuchsiaResourceDialect
4156                        );
4157                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetImageDestinationSizeRequest>(&header, _body_bytes, handles, &mut req)?;
4158                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4159                        Ok(FlatlandRequest::SetImageDestinationSize {
4160                            image_id: req.image_id,
4161                            size: req.size,
4162
4163                            control_handle,
4164                        })
4165                    }
4166                    0x10f5da1356275b7b => {
4167                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4168                        let mut req = fidl::new_empty!(
4169                            FlatlandSetImageBlendingFunctionRequest,
4170                            fidl::encoding::DefaultFuchsiaResourceDialect
4171                        );
4172                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetImageBlendingFunctionRequest>(&header, _body_bytes, handles, &mut req)?;
4173                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4174                        Ok(FlatlandRequest::SetImageBlendingFunction {
4175                            image_id: req.image_id,
4176                            blend_mode: req.blend_mode,
4177
4178                            control_handle,
4179                        })
4180                    }
4181                    0x5b1667f130c3de67 => {
4182                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4183                        let mut req = fidl::new_empty!(
4184                            FlatlandSetImageBlendModeRequest,
4185                            fidl::encoding::DefaultFuchsiaResourceDialect
4186                        );
4187                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetImageBlendModeRequest>(&header, _body_bytes, handles, &mut req)?;
4188                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4189                        Ok(FlatlandRequest::SetImageBlendMode {
4190                            image_id: req.image_id,
4191                            blend_mode: req.blend_mode,
4192
4193                            control_handle,
4194                        })
4195                    }
4196                    0x2da9e4ef4c2cff6f => {
4197                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4198                        let mut req = fidl::new_empty!(
4199                            FlatlandSetImageOpacityRequest,
4200                            fidl::encoding::DefaultFuchsiaResourceDialect
4201                        );
4202                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetImageOpacityRequest>(&header, _body_bytes, handles, &mut req)?;
4203                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4204                        Ok(FlatlandRequest::SetImageOpacity {
4205                            image_id: req.image_id,
4206                            val: req.val,
4207
4208                            control_handle,
4209                        })
4210                    }
4211                    0x21b20f2c14aae6bc => {
4212                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4213                        let mut req = fidl::new_empty!(
4214                            FlatlandSetImageFlipRequest,
4215                            fidl::encoding::DefaultFuchsiaResourceDialect
4216                        );
4217                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetImageFlipRequest>(&header, _body_bytes, handles, &mut req)?;
4218                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4219                        Ok(FlatlandRequest::SetImageFlip {
4220                            image_id: req.image_id,
4221                            flip: req.flip,
4222
4223                            control_handle,
4224                        })
4225                    }
4226                    0x5e62355abc1c4c5d => {
4227                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4228                        let mut req = fidl::new_empty!(
4229                            FlatlandCreateFilledRectRequest,
4230                            fidl::encoding::DefaultFuchsiaResourceDialect
4231                        );
4232                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandCreateFilledRectRequest>(&header, _body_bytes, handles, &mut req)?;
4233                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4234                        Ok(FlatlandRequest::CreateFilledRect {
4235                            rect_id: req.rect_id,
4236
4237                            control_handle,
4238                        })
4239                    }
4240                    0x32d6ef41e182dfa5 => {
4241                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4242                        let mut req = fidl::new_empty!(
4243                            FlatlandSetSolidFillRequest,
4244                            fidl::encoding::DefaultFuchsiaResourceDialect
4245                        );
4246                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetSolidFillRequest>(&header, _body_bytes, handles, &mut req)?;
4247                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4248                        Ok(FlatlandRequest::SetSolidFill {
4249                            rect_id: req.rect_id,
4250                            color: req.color,
4251                            size: req.size,
4252
4253                            control_handle,
4254                        })
4255                    }
4256                    0x7392cabe45618f9b => {
4257                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4258                        let mut req = fidl::new_empty!(
4259                            FlatlandReleaseFilledRectRequest,
4260                            fidl::encoding::DefaultFuchsiaResourceDialect
4261                        );
4262                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandReleaseFilledRectRequest>(&header, _body_bytes, handles, &mut req)?;
4263                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4264                        Ok(FlatlandRequest::ReleaseFilledRect {
4265                            rect_id: req.rect_id,
4266
4267                            control_handle,
4268                        })
4269                    }
4270                    0x4ed2cfc0ce130862 => {
4271                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4272                        let mut req = fidl::new_empty!(
4273                            FlatlandSetContentRequest,
4274                            fidl::encoding::DefaultFuchsiaResourceDialect
4275                        );
4276                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetContentRequest>(&header, _body_bytes, handles, &mut req)?;
4277                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4278                        Ok(FlatlandRequest::SetContent {
4279                            transform_id: req.transform_id,
4280                            content_id: req.content_id,
4281
4282                            control_handle,
4283                        })
4284                    }
4285                    0x66ab67e9608ddb9f => {
4286                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4287                        let mut req = fidl::new_empty!(
4288                            FlatlandSetViewportPropertiesRequest,
4289                            fidl::encoding::DefaultFuchsiaResourceDialect
4290                        );
4291                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetViewportPropertiesRequest>(&header, _body_bytes, handles, &mut req)?;
4292                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4293                        Ok(FlatlandRequest::SetViewportProperties {
4294                            viewport_id: req.viewport_id,
4295                            properties: req.properties,
4296
4297                            control_handle,
4298                        })
4299                    }
4300                    0xab9328419451c22 => {
4301                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4302                        let mut req = fidl::new_empty!(
4303                            FlatlandReleaseTransformRequest,
4304                            fidl::encoding::DefaultFuchsiaResourceDialect
4305                        );
4306                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandReleaseTransformRequest>(&header, _body_bytes, handles, &mut req)?;
4307                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4308                        Ok(FlatlandRequest::ReleaseTransform {
4309                            transform_id: req.transform_id,
4310
4311                            control_handle,
4312                        })
4313                    }
4314                    0x5b35aab9baffecae => {
4315                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4316                        let mut req = fidl::new_empty!(
4317                            fidl::encoding::EmptyPayload,
4318                            fidl::encoding::DefaultFuchsiaResourceDialect
4319                        );
4320                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
4321                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4322                        Ok(FlatlandRequest::ReleaseView { control_handle })
4323                    }
4324                    0xbad474aeb5293f9 => {
4325                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4326                        let mut req = fidl::new_empty!(
4327                            FlatlandReleaseViewportRequest,
4328                            fidl::encoding::DefaultFuchsiaResourceDialect
4329                        );
4330                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandReleaseViewportRequest>(&header, _body_bytes, handles, &mut req)?;
4331                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4332                        Ok(FlatlandRequest::ReleaseViewport {
4333                            viewport_id: req.viewport_id,
4334
4335                            responder: FlatlandReleaseViewportResponder {
4336                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4337                                tx_id: header.tx_id,
4338                            },
4339                        })
4340                    }
4341                    0xb884ffdbc72c111 => {
4342                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4343                        let mut req = fidl::new_empty!(
4344                            FlatlandReleaseImageRequest,
4345                            fidl::encoding::DefaultFuchsiaResourceDialect
4346                        );
4347                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandReleaseImageRequest>(&header, _body_bytes, handles, &mut req)?;
4348                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4349                        Ok(FlatlandRequest::ReleaseImage { image_id: req.image_id, control_handle })
4350                    }
4351                    0x4ec8817c02828c3e => {
4352                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4353                        let mut req = fidl::new_empty!(
4354                            fidl::encoding::EmptyPayload,
4355                            fidl::encoding::DefaultFuchsiaResourceDialect
4356                        );
4357                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
4358                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4359                        Ok(FlatlandRequest::Clear { control_handle })
4360                    }
4361                    0x46a8b397e68a8888 => {
4362                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4363                        let mut req = fidl::new_empty!(
4364                            FlatlandSetDebugNameRequest,
4365                            fidl::encoding::DefaultFuchsiaResourceDialect
4366                        );
4367                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetDebugNameRequest>(&header, _body_bytes, handles, &mut req)?;
4368                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4369                        Ok(FlatlandRequest::SetDebugName { name: req.name, control_handle })
4370                    }
4371                    _ => Err(fidl::Error::UnknownOrdinal {
4372                        ordinal: header.ordinal,
4373                        protocol_name:
4374                            <FlatlandMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4375                    }),
4376                }))
4377            },
4378        )
4379    }
4380}
4381
4382/// Each Flatland instance contains a Graph, which consists of a set of objects, and the
4383/// relationships between those objects. The client can specify a subset of those objects
4384/// (specifically, the directed acyclic graph starting at the root transform) to be presented as
4385/// content to some kind of output -- usually, a display.
4386///
4387/// Flatland Graphs are both hierarchical, and distributed. Graphs from different Flatland instances
4388/// may be connected together, allowing multiple processes to be involved in authoring content for a
4389/// particular output.
4390///
4391/// All functions in this protocol are feed-forward. The operations they represent are not fully
4392/// executed until [`Present`] is called.
4393#[derive(Debug)]
4394pub enum FlatlandRequest {
4395    /// Releases an image immediately, without waiting for the next present.
4396    ReleaseImageImmediately {
4397        image_id: ContentId,
4398        control_handle: FlatlandControlHandle,
4399    },
4400    /// Complete execution of all feed-forward operations.
4401    ///
4402    /// If executing an operation produces an error (e.g., CreateTransform(0)), an [`OnError`] event
4403    /// is emitted. Operations that produce errors are ignored and the channel is closed.
4404    ///
4405    /// If the execution is completed successfully, [`OnNextFrameBegin`] emits NO_ERROR along
4406    /// with other valid fields.
4407    ///
4408    /// The client may only call [`Present`] when they have a non-zero number of present credits,
4409    /// which are tracked by the server. The server may increment the number of credits when it
4410    /// fires the [`OnNextFrameBegin`] event, which informs the client when it receives additional
4411    /// present credits. Each [`Present`] call uses one present credit and decrements the server
4412    /// count by one. If the client calls [`Present`] with no present credits, the server will
4413    /// return a `NO_PRESENTS_REMAINING` error.
4414    ///
4415    /// The client should assume that prior to receiving any [`OnNextFrameBegin`] events, they have
4416    /// one present credit.
4417    ///
4418    /// Every [`Present`] call results in one [`OnNextFrameBegin`] event, and one
4419    /// [`OnFramePresented`] event, typically in that order.
4420    ///
4421    /// When the commands flushed by [`Present`] make it to display, an [`OnFramePresented`] event
4422    /// is fired. This event includes information pertaining to all [`Present`]s that had content
4423    /// that were part of that frame.
4424    ///
4425    /// See [`fuchsia.ui.composition/PresentArgs`] documentation above for more detailed information
4426    /// on what arguments are passed in and their role.
4427    Present {
4428        args: PresentArgs,
4429        control_handle: FlatlandControlHandle,
4430    },
4431    /// Two Flatland instances may be connected in a parent-child relationship. The parent endpoint
4432    /// is held in a Viewport, and the child endpoint is held in a View. The parent Flatland
4433    /// instance that creates a Viewport has control over how the child's View is integrated into
4434    /// its own View.
4435    ///
4436    /// The lifecycle of a parent-child connection starts with two endpoints of a channel object:
4437    /// a ViewportCreationToken and a ViewCreationToken. Out-of-band protocols pass the
4438    /// ViewportCreationToken to the parent, which calls [`CreateViewport`], and the
4439    /// ViewCreationToken to the child, which calls [`CreateView`].
4440    ///
4441    /// Only nodes connected to the Root Transform in this Flatland instance will be rendered into
4442    /// the parent's Viewport.
4443    ///
4444    /// Calling [`CreateView`] a second time will disconnect the Root Transform from the existing
4445    /// parent's Viewport, and attach it to a new parent's Viewport. In other words, each View can
4446    /// only have one parent.
4447    ///
4448    /// This function is queued, meaning that the Root Transform will not be attached to the
4449    /// parent Viewport until [`Present`] is called. However, clients will receive information
4450    /// through their ParentViewportWatcher (e.g., LayoutInfo) immediately after calling this
4451    /// function, even if they have not called [`Present`] or [`SetRootTransform`]. This allows
4452    /// clients to wait for layout information from their parent before calling [`Present`].
4453    ///
4454    /// Any illegal operations on ParentViewportWatcher will cause both ParentViewportWatcher
4455    /// channel and this Flatland channel to be torn down.
4456    ///
4457    /// Lifecycle note. The lifetime of the ParentViewportWatcher channel is bound by the peer
4458    /// ViewportCreationToken. When the ViewportCreationToken dies, this ParentViewportWatcher
4459    /// channel is destroyed.
4460    ///
4461    /// Views and subgraphs of Views created using `CreateView` will not be represented in the
4462    /// ViewTree, and hence will not be able to participate in any ViewTree-dependent interactions
4463    /// such as touch, mouse or focus.
4464    /// The Flatland protocol provides no way for Views in the subgraph of a View created with
4465    /// `CreateView` to know that they are excluded from the ViewTree.
4466    CreateView {
4467        token: fidl_fuchsia_ui_views::ViewCreationToken,
4468        parent_viewport_watcher: fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>,
4469        control_handle: FlatlandControlHandle,
4470    },
4471    /// Identical to [`CreateView`], except it allows association of View identity (ViewRef) and
4472    /// view-bound protocols.
4473    CreateView2 {
4474        token: fidl_fuchsia_ui_views::ViewCreationToken,
4475        view_identity: fidl_fuchsia_ui_views::ViewIdentityOnCreation,
4476        protocols: ViewBoundProtocols,
4477        parent_viewport_watcher: fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>,
4478        control_handle: FlatlandControlHandle,
4479    },
4480    /// Creates a new Transform node. Transforms are a hierarchical piece of a Flatland graph. They
4481    /// can have children, and can reference Content. A sub-graph represented by a Transform and its
4482    /// descendants can be rendered to a display.
4483    ///
4484    /// Transforms are kept alive, even when released, as long as they are children of either an
4485    /// unreleased Transform, or the Root Transform.
4486    ///
4487    /// Each Transform can have a single piece of attached Content. Common types of Content include
4488    /// bitmaps, asynchronous streams of images, and Viewports to Views hosted in other Flatland
4489    /// instances.
4490    ///
4491    /// Transforms have attributes. Child Transforms inherit the combined attributes of their
4492    /// parents. Content attached to a Transform is also affected by that Transform's attributes.
4493    ///
4494    /// When a sub-graph of Transforms is rendered, Content will be rendered back-to-front, starting
4495    /// with the Content on the root transform, and continuing recursively through all of its child
4496    /// Transforms in the order the children were added. See [`AddChild`] for more information.
4497    ///
4498    /// Zero is not a valid transform id. All other values are valid, assuming they are not already
4499    /// in use (see [`ReleaseTransform`] for more details).
4500    CreateTransform {
4501        transform_id: TransformId,
4502        control_handle: FlatlandControlHandle,
4503    },
4504    /// All Transform objects support all attributes.
4505    ///
4506    /// Geometric attributes are applied in the following order:
4507    /// 1. Scale (relative to the parent transform's coordinate space)
4508    /// 2. Orientation (relative to the parent transform's coordinate space)
4509    /// 3. Translation (relative to the parent transforms's coordinate space,
4510    ///    unaffected by scale applied to the current transform).
4511    /// 4. Clipping (relative to the current transform's coordinate space)
4512    ///
4513    /// The effects of each of these attributes are cumulative. This means the transform's position
4514    /// in the view space, and its clip boundary, will be calculated based on that chain of
4515    /// geometric attributes going up to the root transform.
4516    ///
4517    /// For instance, in a nested hierarchy such as the following:
4518    ///     [Root-Transform -> Transform1 -> Transform2 -> CurrentTransform]
4519    /// If Transform1 is translated by [2,0] and Transform2 is translated by [0,1] then the
4520    /// view-space position of CurrentTransform will be [2,1].
4521    ///
4522    /// Sets the translation on a Transform. The order of geometric attribute application is
4523    /// addressed above.
4524    SetTranslation {
4525        transform_id: TransformId,
4526        translation: fidl_fuchsia_math::Vec_,
4527        control_handle: FlatlandControlHandle,
4528    },
4529    /// Sets the orientation on a Transform. The order of geometric attribute application is
4530    /// addressed in the documentation for [`SetTranslation`]. In Flatland, the +X axis is
4531    /// to the right and the +Y axis is down. There is no notion of a Z axis. CCW is defined
4532    /// from the POV of the user, as if a skeuomorphoic clock is displayed on the screen.
4533    SetOrientation {
4534        transform_id: TransformId,
4535        orientation: Orientation,
4536        control_handle: FlatlandControlHandle,
4537    },
4538    /// Sets the scale on a transform. The order of geometric attribute application is
4539    /// addressed above. The (x,y) values in the VecF |scale| refer to the scale factor in the
4540    /// x-axis (width) and y-axis (height) respectively. Scale values must be positive 32-bit
4541    /// floating point values: https://en.wikipedia.org/wiki/Normal_number_%28computing%29
4542    SetScale {
4543        transform_id: TransformId,
4544        scale: fidl_fuchsia_math::VecF,
4545        control_handle: FlatlandControlHandle,
4546    },
4547    /// Sets an opacity in linear space to be applied to a transform and its descendents,
4548    /// which include other transforms and content. Opacity values must be in the range
4549    /// of [0.0, 1.0], where 0.0 is completely transparent and 1.0 is completely opaque.
4550    /// Attempting to call this function with values outside that range will result in
4551    /// an error. A transform's opacity value is multiplied with that of its parent. This
4552    /// effect works differently from group opacity. Using group opacity, child nodes are
4553    /// rendered together first, and then have the parent's opacity applied as a post-effect.
4554    /// Here, opacity is applied to each child individually. This may result in a very
4555    /// different effect.
4556    SetOpacity {
4557        transform_id: TransformId,
4558        value: f32,
4559        control_handle: FlatlandControlHandle,
4560    },
4561    /// Sets the bounds, expressed in the local coordinate space of the transform, that
4562    /// constrains the region that content attached to this transform can be rendered to.
4563    /// If the content's area exceeds the clip bounds, the area outside the bounds will
4564    /// not be rendered. These bounds are valid for all children of this transform node as
4565    /// well, which includes nested Flatland instances and their node hierarchies.
4566    /// If a child transform attempts to set clip bounds larger than that of its parent,
4567    /// it will be clipped to the parent's clip bounds. The default state is for a transform
4568    /// to be unclipped, meaning it will not have any bounds placed on its render region.
4569    /// The clip width/height must be positive. Negative values will result in an error.
4570    /// Passing in an empty box to the |rect| parameter will remove the clip bounds.
4571    SetClipBoundary {
4572        transform_id: TransformId,
4573        rect: Option<Box<fidl_fuchsia_math::Rect>>,
4574        control_handle: FlatlandControlHandle,
4575    },
4576    /// Adds a child Transform to a parent Transform. The new child Transform,
4577    /// and any Content attached to it or its children, will be rendered on top
4578    /// of the parent's Content, as well as any previously added children.
4579    ///
4580    /// The caller must ensure that `child_transform_id` is valid and that there
4581    /// are no repetitions.  Sending a repeated `child_transform_id` over
4582    /// multiple calls will result in session closure.
4583    AddChild {
4584        parent_transform_id: TransformId,
4585        child_transform_id: TransformId,
4586        control_handle: FlatlandControlHandle,
4587    },
4588    /// Removes a child Transform from a parent Transform.
4589    RemoveChild {
4590        parent_transform_id: TransformId,
4591        child_transform_id: TransformId,
4592        control_handle: FlatlandControlHandle,
4593    },
4594    /// Removes all child Transforms from a parent Transform and replaces them
4595    /// with the new child transforms in `new_child_transform_ids`.  The caller
4596    /// must ensure that all `TransformId` values in `new_child_transform_ids`
4597    /// are valid and that there are no repetitions.  Sending a repeated
4598    /// `TransformId` in `new_child_transform_ids` will result in session
4599    /// closure.
4600    ReplaceChildren {
4601        parent_transform_id: TransformId,
4602        new_child_transform_ids: Vec<TransformId>,
4603        control_handle: FlatlandControlHandle,
4604    },
4605    /// Sets the Root Transform for the graph.
4606    ///
4607    /// The sub-graph defined by the Root Transform and its children will be rendered as View
4608    /// in the connected parent's Viewport (see [`CreateView`]). Any parents of the Root Transform
4609    /// in this Graph will be ignored.
4610    ///
4611    /// The Root Transform, and all children of the Root Transform, are kept alive if they are
4612    /// released (see [`ReleaseTransform`] for more details).
4613    ///
4614    /// There is only ever one Root. Since 0 is not a valid transform id (see [`CreateTransform`]),
4615    /// calling SetRootTransform(0) clears the current Root, destroying any previously released
4616    /// objects that are not referenced by the new root.
4617    ///
4618    /// Note that every View has a clip boundary equivalent to its logical size. Anything outside
4619    /// that clip boundary will not be rendered. Hence, the Root Transform has a useful coordinate
4620    /// space of (0, 0) to (logical_size.width, logical_size.height), where (0, 0) is the upper left
4621    /// corner.
4622    ///
4623    /// Setting the root transform installs a full screen hit region on the root transform. Clients
4624    /// may remove this hit region if they don't want users to be able to interact with the root
4625    /// transform's content. For additional details on hit regions, see the [`SetHitRegions`]
4626    /// documentation.
4627    ///
4628    /// Default hit region rules
4629    ///
4630    ///   A default hit region follows these rules:
4631    ///   - When [`SetRootTransform`](T) is called, T receives a maximal hit region, covering the
4632    ///   entire view.
4633    ///   - If [`SetHitRegions`] is called on T, either before or after [`SetRootTransform`](T),
4634    ///   then no default hit region is active and the client specified hit regions are used.
4635    ///   - If a transform is no longer the root transform, i.e., [`SetRootTransform`](U) is
4636    ///   called, then the original transform no longer has its default hit region.
4637    ///   - Clients can remove or modify the root transform's hit regions the same way they would
4638    ///   reset any other transform's hit regions, by calling [`SetHitRegions`] with the appropriate
4639    ///   vector.
4640    SetRootTransform {
4641        transform_id: TransformId,
4642        control_handle: FlatlandControlHandle,
4643    },
4644    /// Sets the interactive areas for a Transform. By default, Content is not interactive; hit
4645    /// regions must be placed for a user to interact with the Content in a View. Because hit
4646    /// regions are described in the Flatland protocol, a Flatland instance can synchronize Content
4647    /// and hit regions.
4648    ///
4649    /// Each hit region is placed in the coordinate space of the owning Transform, and may or may
4650    /// not interact with different types of hit testing, depending on its [`HitTestInteraction`]
4651    /// type. When there are multiple hit regions that intersect with a hit test, the precedence
4652    /// rules given below dictate which hit region has interacted with the hit test. Only Transforms
4653    /// that transitively connect to the root Transform have their hit regions interact with a hit
4654    /// test.
4655    ///
4656    /// Calling this function replaces any previous values set on this Transform. To reset a
4657    /// Transform to "no hit testing": send an empty vector with [`SetHitRegions`].
4658    ///
4659    /// Note that root transforms get a default hit region installed by Flatland. For more details,
4660    /// see the [`SetRootTransform`] documentation.
4661    ///
4662    /// Precedence rules
4663    ///   Within a Transform, if multiple hit regions overlap, the hit test examines each
4664    ///   intersecting hit region for a possible interaction. Thus, for a regular hit test R and an
4665    ///   accessibility hit test A, where R and A both intersect two hit regions D ([`DEFAULT`]) and
4666    ///   S ([`SEMANTICALLY_INVISIBLE`]) on the same Transform, (1) R interacts with both D and S,
4667    ///   and (2) A only interacts with D. Generally, hit regions that overlap in a single Transform
4668    ///   can cause confusing behavior.
4669    ///
4670    ///   Within a View, for a given hit test, the front-most Transform's hit regions take
4671    ///   precedence over those behind. This follows the expected reverse "render order" of
4672    ///   Transforms (described in [`CreateTransform`]), where a user expects to interact with
4673    ///   Content that is visible, or front-most.
4674    ///
4675    ///   Across Flatland instances, for a given hit test, the front-most instance's front-most
4676    ///   Transform's hit regions take precedence over those behind. This follows the expected
4677    ///   reverse "render order" of views, where a user expects to interact with the View that is
4678    ///   visible, or front-most. For example, if a child View owns Content that is rendered over
4679    ///   the parent View, the user expects to interact with the child's Content.
4680    SetHitRegions {
4681        transform_id: TransformId,
4682        regions: Vec<HitRegion>,
4683        control_handle: FlatlandControlHandle,
4684    },
4685    /// Identical to [`SetHitRegions`], except the hit region associated with [`transform_id`]
4686    /// covers an infinite region. The hit region is invariant against translation, scaling, and
4687    /// orientation of the Transform.
4688    ///
4689    /// An infinite hit region is still limited in extent by the View's clip boundary, just like a
4690    /// finite hit region.
4691    ///
4692    /// Calling this function replaces any previous values set on this Transform. To reset a
4693    /// Transform to "no hit testing": send an empty vector with [`SetHitRegions`].
4694    SetInfiniteHitRegion {
4695        transform_id: TransformId,
4696        hit_test: HitTestInteraction,
4697        control_handle: FlatlandControlHandle,
4698    },
4699    /// The Viewport and View pair, together, represent the connection between two Flatland
4700    /// instances. The Viewport is created in the parent, and the View is created in the child. The
4701    /// parent has control over how the child's View is integrated into its own View.
4702    ///
4703    /// Any illegal operations on ChildViewWatcher will cause both ChildViewWatcher channel and this
4704    /// Flatland channel to be torn down.
4705    ///
4706    /// `ViewportProperties` must have logical_size set. This is the initial size that will drive
4707    /// the layout of the child. The logical_size is also used as the default Content size, but
4708    /// subsequent changes to the logical_size will have no effect on the Content size.
4709    ///
4710    /// `ViewportProperties` may have inset field not set. In that case, the default value of
4711    /// (0, 0, 0, 0) is used.
4712    ///
4713    /// The logical_size must have positive X and Y components.
4714    ///
4715    /// Zero is not a valid ContentId. All other values are valid, assuming they are not already
4716    /// in use for another piece of Content (see [`ReleaseViewport`] for more details).
4717    ///
4718    /// Lifecycle note. The lifetime of the ChildViewWatcher channel is bound by the peer
4719    /// ViewCreationToken. When the ViewCreationToken dies, this ChildViewWatcher channel is
4720    /// destroyed.
4721    CreateViewport {
4722        viewport_id: ContentId,
4723        token: fidl_fuchsia_ui_views::ViewportCreationToken,
4724        properties: ViewportProperties,
4725        child_view_watcher: fidl::endpoints::ServerEnd<ChildViewWatcherMarker>,
4726        control_handle: FlatlandControlHandle,
4727    },
4728    /// An Image is a bitmap backed by a specific VMO in a BufferCollection.
4729    ///
4730    /// Image creation requires an allocated BufferCollection registered with Allocator. This
4731    /// function will fail unless all clients of the specified BufferCollection have set their
4732    /// constraints.
4733    ///
4734    /// The Image must reference a valid VMO index and must have ImageProperties that fall within
4735    /// the constraints specified by the backing BufferCollection (i.e. width and height within a
4736    /// valid range, etc.)
4737    ///
4738    /// Zero is not a valid Image id. All other values are valid, assuming they are not already in
4739    /// use for another piece of Content (see [`ReleaseImage`] for more details).
4740    CreateImage {
4741        image_id: ContentId,
4742        import_token: BufferCollectionImportToken,
4743        vmo_index: u32,
4744        properties: ImageProperties,
4745        control_handle: FlatlandControlHandle,
4746    },
4747    /// This function is used to determine the region (in texel space) of an image that will be used
4748    /// by Flatland when rendering. The image to be sampled is referenced by [`image_id`] and the
4749    /// sample region is specified by [`rect`] which itself is comprised of an origin point (x,y) as
4750    /// well as a width and height, in unnormalized coordinates. It is illegal to call this function
4751    /// on non-image content, or to sample a region outside of the texel space of the image. In
4752    /// other words, the region specifed by [`rect`] must not exceed the ranges (0, image_width) and
4753    /// (0, image_height). If (rect.x + rect.width > image_width) or (rect.y + rect.height >
4754    /// image_height) or if any of the values are negative, this will result in an error.
4755    ///
4756    /// If this method is not called, the default sample region is the rectangle with origin at
4757    /// (0, 0) and width and height set at ImageProperties from [`CreateImage`].
4758    SetImageSampleRegion {
4759        image_id: ContentId,
4760        rect: fidl_fuchsia_math::RectF,
4761        control_handle: FlatlandControlHandle,
4762    },
4763    /// The content size for an Image is the size of the rectangle in the parent's logical
4764    /// coordinate space that the image occupies. This combined with the global translation of the
4765    /// transform it is attached to determines the size and location of where the content is
4766    /// rendered on the display.
4767    ///
4768    /// If this method is not called, the default image destination size is the width and height set
4769    /// at ImageProperties from [`CreateImage`]. The destination size will be affected by scaling if
4770    /// [`SetScale`] is used on the attached Transform or its parents.
4771    SetImageDestinationSize {
4772        image_id: ContentId,
4773        size: fidl_fuchsia_math::SizeU,
4774        control_handle: FlatlandControlHandle,
4775    },
4776    /// Determines the blend function to use when rendering the content specified by
4777    /// |image_id|. |image_id| must be a valid ContentId associated to a transform through
4778    /// a call to |CreateImage| or |CreateFilledRect|. For details on the different blend functions
4779    /// that are available, please refer to the BlendMode enum. If this function is not called, then
4780    /// the default blendmode is BlendMode::SRC.
4781    SetImageBlendingFunction {
4782        image_id: ContentId,
4783        blend_mode: BlendMode,
4784        control_handle: FlatlandControlHandle,
4785    },
4786    /// Determines the blend function to use when rendering the content specified by
4787    /// |image_id|. |image_id| must be a valid ContentId associated to a transform through
4788    /// a call to |CreateImage| or |CreateFilledRect|. For details on the different blend functions
4789    /// that are available, please refer to the BlendMode2 enum. If this function is not called,
4790    /// the default blendmode is BlendMode2::REPLACE.
4791    SetImageBlendMode {
4792        image_id: ContentId,
4793        blend_mode: BlendMode2,
4794        control_handle: FlatlandControlHandle,
4795    },
4796    /// Sets an opacity in linear space to be applied to a flatland image. Opacity values must
4797    /// be in the range [0.0, 1.0].
4798    SetImageOpacity {
4799        image_id: ContentId,
4800        val: f32,
4801        control_handle: FlatlandControlHandle,
4802    },
4803    /// Sets the image flip to be applied to a flatland image. This call must be performed after a
4804    /// successful |CreateImage| call. If an invalid |image_id| is supplied, the channel will be
4805    /// closed due to FlatlandError::BAD_OPERATION. This flip will be applied to the Image before
4806    /// parent Transform Orientations. If this function is not called, then the default flip value
4807    /// is ImageFlip::NONE.
4808    SetImageFlip {
4809        image_id: ContentId,
4810        flip: ImageFlip,
4811        control_handle: FlatlandControlHandle,
4812    },
4813    /// Creates a solid-color rectangle. By default a filled-rect does not have a defined
4814    /// color or size. It is necessary to call |SetSolidFill| to specify a color and size
4815    /// before a filled rect can be used for rendering. Not doing so will result the
4816    CreateFilledRect {
4817        rect_id: ContentId,
4818        control_handle: FlatlandControlHandle,
4819    },
4820    /// Defines the color and size of a filled rect. |rect_id| must refer to content that
4821    /// was created via a call to CreateFilledRect. The color is not premultiplied. Color values
4822    /// must be within the range [0,1] inclusive, and normal 32-bit
4823    /// floating point values: https://en.wikipedia.org/wiki/Normal_number_%28computing%29. Values
4824    /// that do not conform to these specifications will cause the channel to close.
4825    /// The rectangle's top left corner will be at (0, 0) in its transform's coordinate space.
4826    /// Hence, its bottom right corner will be at (size.width, size.height).
4827    SetSolidFill {
4828        rect_id: ContentId,
4829        color: ColorRgba,
4830        size: fidl_fuchsia_math::SizeU,
4831        control_handle: FlatlandControlHandle,
4832    },
4833    /// Automatically garbage collects the rectangle when it is no longer needed for
4834    /// rendering. |rect_id| must have been instantiated with a call to
4835    /// |CreateFilledRect|. Once released, the ID immediately goes out of scope and is free
4836    /// to be used again.
4837    ReleaseFilledRect {
4838        rect_id: ContentId,
4839        control_handle: FlatlandControlHandle,
4840    },
4841    /// Setting a piece of Content on a Transform makes that Content visible in the render tree as
4842    /// long as the Transform is visible from the root Transform. The Content will be rendered
4843    /// before, and therefore "behind", any Content attached to the descendants of the Transform.
4844    ///
4845    /// Because each Transform can have, at most, a single piece of Content on it, calling this
4846    /// function on a Transform that already has Content will replace that Content.
4847    ///
4848    /// A Content may be set on more than one Transform.
4849    ///
4850    /// Calling this function with a Content id of 0 will remove any Content currently on the
4851    /// Transform.
4852    SetContent {
4853        transform_id: TransformId,
4854        content_id: ContentId,
4855        control_handle: FlatlandControlHandle,
4856    },
4857    /// Transforms are usually sufficient to change how Content is presented. Viewports, however,
4858    /// have special properties that are not part of the Transform hierarchy. Those properties can
4859    /// be set using this function.
4860    SetViewportProperties {
4861        viewport_id: ContentId,
4862        properties: ViewportProperties,
4863        control_handle: FlatlandControlHandle,
4864    },
4865    /// Released Transforms will be garbage collected by the system once they are no longer
4866    /// necessary for rendering. For Transforms, this means there is no path from any unreleased
4867    /// Transform to the newly-released Transform.
4868    ///
4869    /// Once released, the id immediately goes out of scope for future function calls and can be
4870    /// reused when creating new Transforms.
4871    ///
4872    /// It is an error to call functions with a released id (unless that id has been reused to
4873    /// construct a new Transform).
4874    ReleaseTransform {
4875        transform_id: TransformId,
4876        control_handle: FlatlandControlHandle,
4877    },
4878    ReleaseView {
4879        control_handle: FlatlandControlHandle,
4880    },
4881    /// Releases a Viewport from the scene, even if the Viewport is still connected to a Transform.
4882    /// Unlike other resources, Viewports are garbage collected by the system during the next
4883    /// [`Present`] because a removed Viewport is guaranteed to provide no renderable content.
4884    ///
4885    /// Use SetContent(transform_id, 0) to clean up references to released Viewports.
4886    ///
4887    /// Despite having a return type, this function is still feed-forward like [`CreateView`] and
4888    /// requires a call to [`Present`] to be executed. The ViewportCreationToken will be returned
4889    /// after the presented operations have been executed.
4890    ReleaseViewport {
4891        viewport_id: ContentId,
4892        responder: FlatlandReleaseViewportResponder,
4893    },
4894    /// Released Images will be garbage collected by the system once they are no longer necessary
4895    /// for rendering. For Images, this means the Image is no longer attached to any Transform and
4896    /// any pending rendering that references the Image is complete.
4897    ///
4898    /// Use SetContent(transform_id, 0) to clean up references to released Images.
4899    ///
4900    /// Once released, the id immediately goes out of scope for future function calls and can be
4901    /// reused when creating new Images.
4902    ///
4903    /// It is an error to call functions with a released id (unless that id has been reused to
4904    /// construct a new Image).
4905    ReleaseImage {
4906        image_id: ContentId,
4907        control_handle: FlatlandControlHandle,
4908    },
4909    /// This function will reset all state on this interface. This includes destroying all existing
4910    /// View and Viewports without returning the associated Token to the caller.
4911    Clear {
4912        control_handle: FlatlandControlHandle,
4913    },
4914    /// Set debug name of the current client that can be used by Flatland to print as a prefix to
4915    /// logs to help client distinguish what is theirs. [`name`] can be an arbitrary string, but the
4916    /// current process name (see fsl::GetCurrentProcessName()) is a good default.
4917    SetDebugName {
4918        name: String,
4919        control_handle: FlatlandControlHandle,
4920    },
4921}
4922
4923impl FlatlandRequest {
4924    #[allow(irrefutable_let_patterns)]
4925    pub fn into_release_image_immediately(self) -> Option<(ContentId, FlatlandControlHandle)> {
4926        if let FlatlandRequest::ReleaseImageImmediately { image_id, control_handle } = self {
4927            Some((image_id, control_handle))
4928        } else {
4929            None
4930        }
4931    }
4932
4933    #[allow(irrefutable_let_patterns)]
4934    pub fn into_present(self) -> Option<(PresentArgs, FlatlandControlHandle)> {
4935        if let FlatlandRequest::Present { args, control_handle } = self {
4936            Some((args, control_handle))
4937        } else {
4938            None
4939        }
4940    }
4941
4942    #[allow(irrefutable_let_patterns)]
4943    pub fn into_create_view(
4944        self,
4945    ) -> Option<(
4946        fidl_fuchsia_ui_views::ViewCreationToken,
4947        fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>,
4948        FlatlandControlHandle,
4949    )> {
4950        if let FlatlandRequest::CreateView { token, parent_viewport_watcher, control_handle } = self
4951        {
4952            Some((token, parent_viewport_watcher, control_handle))
4953        } else {
4954            None
4955        }
4956    }
4957
4958    #[allow(irrefutable_let_patterns)]
4959    pub fn into_create_view2(
4960        self,
4961    ) -> Option<(
4962        fidl_fuchsia_ui_views::ViewCreationToken,
4963        fidl_fuchsia_ui_views::ViewIdentityOnCreation,
4964        ViewBoundProtocols,
4965        fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>,
4966        FlatlandControlHandle,
4967    )> {
4968        if let FlatlandRequest::CreateView2 {
4969            token,
4970            view_identity,
4971            protocols,
4972            parent_viewport_watcher,
4973            control_handle,
4974        } = self
4975        {
4976            Some((token, view_identity, protocols, parent_viewport_watcher, control_handle))
4977        } else {
4978            None
4979        }
4980    }
4981
4982    #[allow(irrefutable_let_patterns)]
4983    pub fn into_create_transform(self) -> Option<(TransformId, FlatlandControlHandle)> {
4984        if let FlatlandRequest::CreateTransform { transform_id, control_handle } = self {
4985            Some((transform_id, control_handle))
4986        } else {
4987            None
4988        }
4989    }
4990
4991    #[allow(irrefutable_let_patterns)]
4992    pub fn into_set_translation(
4993        self,
4994    ) -> Option<(TransformId, fidl_fuchsia_math::Vec_, FlatlandControlHandle)> {
4995        if let FlatlandRequest::SetTranslation { transform_id, translation, control_handle } = self
4996        {
4997            Some((transform_id, translation, control_handle))
4998        } else {
4999            None
5000        }
5001    }
5002
5003    #[allow(irrefutable_let_patterns)]
5004    pub fn into_set_orientation(self) -> Option<(TransformId, Orientation, FlatlandControlHandle)> {
5005        if let FlatlandRequest::SetOrientation { transform_id, orientation, control_handle } = self
5006        {
5007            Some((transform_id, orientation, control_handle))
5008        } else {
5009            None
5010        }
5011    }
5012
5013    #[allow(irrefutable_let_patterns)]
5014    pub fn into_set_scale(
5015        self,
5016    ) -> Option<(TransformId, fidl_fuchsia_math::VecF, FlatlandControlHandle)> {
5017        if let FlatlandRequest::SetScale { transform_id, scale, control_handle } = self {
5018            Some((transform_id, scale, control_handle))
5019        } else {
5020            None
5021        }
5022    }
5023
5024    #[allow(irrefutable_let_patterns)]
5025    pub fn into_set_opacity(self) -> Option<(TransformId, f32, FlatlandControlHandle)> {
5026        if let FlatlandRequest::SetOpacity { transform_id, value, control_handle } = self {
5027            Some((transform_id, value, control_handle))
5028        } else {
5029            None
5030        }
5031    }
5032
5033    #[allow(irrefutable_let_patterns)]
5034    pub fn into_set_clip_boundary(
5035        self,
5036    ) -> Option<(TransformId, Option<Box<fidl_fuchsia_math::Rect>>, FlatlandControlHandle)> {
5037        if let FlatlandRequest::SetClipBoundary { transform_id, rect, control_handle } = self {
5038            Some((transform_id, rect, control_handle))
5039        } else {
5040            None
5041        }
5042    }
5043
5044    #[allow(irrefutable_let_patterns)]
5045    pub fn into_add_child(self) -> Option<(TransformId, TransformId, FlatlandControlHandle)> {
5046        if let FlatlandRequest::AddChild {
5047            parent_transform_id,
5048            child_transform_id,
5049            control_handle,
5050        } = self
5051        {
5052            Some((parent_transform_id, child_transform_id, control_handle))
5053        } else {
5054            None
5055        }
5056    }
5057
5058    #[allow(irrefutable_let_patterns)]
5059    pub fn into_remove_child(self) -> Option<(TransformId, TransformId, FlatlandControlHandle)> {
5060        if let FlatlandRequest::RemoveChild {
5061            parent_transform_id,
5062            child_transform_id,
5063            control_handle,
5064        } = self
5065        {
5066            Some((parent_transform_id, child_transform_id, control_handle))
5067        } else {
5068            None
5069        }
5070    }
5071
5072    #[allow(irrefutable_let_patterns)]
5073    pub fn into_replace_children(
5074        self,
5075    ) -> Option<(TransformId, Vec<TransformId>, FlatlandControlHandle)> {
5076        if let FlatlandRequest::ReplaceChildren {
5077            parent_transform_id,
5078            new_child_transform_ids,
5079            control_handle,
5080        } = self
5081        {
5082            Some((parent_transform_id, new_child_transform_ids, control_handle))
5083        } else {
5084            None
5085        }
5086    }
5087
5088    #[allow(irrefutable_let_patterns)]
5089    pub fn into_set_root_transform(self) -> Option<(TransformId, FlatlandControlHandle)> {
5090        if let FlatlandRequest::SetRootTransform { transform_id, control_handle } = self {
5091            Some((transform_id, control_handle))
5092        } else {
5093            None
5094        }
5095    }
5096
5097    #[allow(irrefutable_let_patterns)]
5098    pub fn into_set_hit_regions(
5099        self,
5100    ) -> Option<(TransformId, Vec<HitRegion>, FlatlandControlHandle)> {
5101        if let FlatlandRequest::SetHitRegions { transform_id, regions, control_handle } = self {
5102            Some((transform_id, regions, control_handle))
5103        } else {
5104            None
5105        }
5106    }
5107
5108    #[allow(irrefutable_let_patterns)]
5109    pub fn into_set_infinite_hit_region(
5110        self,
5111    ) -> Option<(TransformId, HitTestInteraction, FlatlandControlHandle)> {
5112        if let FlatlandRequest::SetInfiniteHitRegion { transform_id, hit_test, control_handle } =
5113            self
5114        {
5115            Some((transform_id, hit_test, control_handle))
5116        } else {
5117            None
5118        }
5119    }
5120
5121    #[allow(irrefutable_let_patterns)]
5122    pub fn into_create_viewport(
5123        self,
5124    ) -> Option<(
5125        ContentId,
5126        fidl_fuchsia_ui_views::ViewportCreationToken,
5127        ViewportProperties,
5128        fidl::endpoints::ServerEnd<ChildViewWatcherMarker>,
5129        FlatlandControlHandle,
5130    )> {
5131        if let FlatlandRequest::CreateViewport {
5132            viewport_id,
5133            token,
5134            properties,
5135            child_view_watcher,
5136            control_handle,
5137        } = self
5138        {
5139            Some((viewport_id, token, properties, child_view_watcher, control_handle))
5140        } else {
5141            None
5142        }
5143    }
5144
5145    #[allow(irrefutable_let_patterns)]
5146    pub fn into_create_image(
5147        self,
5148    ) -> Option<(ContentId, BufferCollectionImportToken, u32, ImageProperties, FlatlandControlHandle)>
5149    {
5150        if let FlatlandRequest::CreateImage {
5151            image_id,
5152            import_token,
5153            vmo_index,
5154            properties,
5155            control_handle,
5156        } = self
5157        {
5158            Some((image_id, import_token, vmo_index, properties, control_handle))
5159        } else {
5160            None
5161        }
5162    }
5163
5164    #[allow(irrefutable_let_patterns)]
5165    pub fn into_set_image_sample_region(
5166        self,
5167    ) -> Option<(ContentId, fidl_fuchsia_math::RectF, FlatlandControlHandle)> {
5168        if let FlatlandRequest::SetImageSampleRegion { image_id, rect, control_handle } = self {
5169            Some((image_id, rect, control_handle))
5170        } else {
5171            None
5172        }
5173    }
5174
5175    #[allow(irrefutable_let_patterns)]
5176    pub fn into_set_image_destination_size(
5177        self,
5178    ) -> Option<(ContentId, fidl_fuchsia_math::SizeU, FlatlandControlHandle)> {
5179        if let FlatlandRequest::SetImageDestinationSize { image_id, size, control_handle } = self {
5180            Some((image_id, size, control_handle))
5181        } else {
5182            None
5183        }
5184    }
5185
5186    #[allow(irrefutable_let_patterns)]
5187    pub fn into_set_image_blending_function(
5188        self,
5189    ) -> Option<(ContentId, BlendMode, FlatlandControlHandle)> {
5190        if let FlatlandRequest::SetImageBlendingFunction { image_id, blend_mode, control_handle } =
5191            self
5192        {
5193            Some((image_id, blend_mode, control_handle))
5194        } else {
5195            None
5196        }
5197    }
5198
5199    #[allow(irrefutable_let_patterns)]
5200    pub fn into_set_image_blend_mode(
5201        self,
5202    ) -> Option<(ContentId, BlendMode2, FlatlandControlHandle)> {
5203        if let FlatlandRequest::SetImageBlendMode { image_id, blend_mode, control_handle } = self {
5204            Some((image_id, blend_mode, control_handle))
5205        } else {
5206            None
5207        }
5208    }
5209
5210    #[allow(irrefutable_let_patterns)]
5211    pub fn into_set_image_opacity(self) -> Option<(ContentId, f32, FlatlandControlHandle)> {
5212        if let FlatlandRequest::SetImageOpacity { image_id, val, control_handle } = self {
5213            Some((image_id, val, control_handle))
5214        } else {
5215            None
5216        }
5217    }
5218
5219    #[allow(irrefutable_let_patterns)]
5220    pub fn into_set_image_flip(self) -> Option<(ContentId, ImageFlip, FlatlandControlHandle)> {
5221        if let FlatlandRequest::SetImageFlip { image_id, flip, control_handle } = self {
5222            Some((image_id, flip, control_handle))
5223        } else {
5224            None
5225        }
5226    }
5227
5228    #[allow(irrefutable_let_patterns)]
5229    pub fn into_create_filled_rect(self) -> Option<(ContentId, FlatlandControlHandle)> {
5230        if let FlatlandRequest::CreateFilledRect { rect_id, control_handle } = self {
5231            Some((rect_id, control_handle))
5232        } else {
5233            None
5234        }
5235    }
5236
5237    #[allow(irrefutable_let_patterns)]
5238    pub fn into_set_solid_fill(
5239        self,
5240    ) -> Option<(ContentId, ColorRgba, fidl_fuchsia_math::SizeU, FlatlandControlHandle)> {
5241        if let FlatlandRequest::SetSolidFill { rect_id, color, size, control_handle } = self {
5242            Some((rect_id, color, size, control_handle))
5243        } else {
5244            None
5245        }
5246    }
5247
5248    #[allow(irrefutable_let_patterns)]
5249    pub fn into_release_filled_rect(self) -> Option<(ContentId, FlatlandControlHandle)> {
5250        if let FlatlandRequest::ReleaseFilledRect { rect_id, control_handle } = self {
5251            Some((rect_id, control_handle))
5252        } else {
5253            None
5254        }
5255    }
5256
5257    #[allow(irrefutable_let_patterns)]
5258    pub fn into_set_content(self) -> Option<(TransformId, ContentId, FlatlandControlHandle)> {
5259        if let FlatlandRequest::SetContent { transform_id, content_id, control_handle } = self {
5260            Some((transform_id, content_id, control_handle))
5261        } else {
5262            None
5263        }
5264    }
5265
5266    #[allow(irrefutable_let_patterns)]
5267    pub fn into_set_viewport_properties(
5268        self,
5269    ) -> Option<(ContentId, ViewportProperties, FlatlandControlHandle)> {
5270        if let FlatlandRequest::SetViewportProperties { viewport_id, properties, control_handle } =
5271            self
5272        {
5273            Some((viewport_id, properties, control_handle))
5274        } else {
5275            None
5276        }
5277    }
5278
5279    #[allow(irrefutable_let_patterns)]
5280    pub fn into_release_transform(self) -> Option<(TransformId, FlatlandControlHandle)> {
5281        if let FlatlandRequest::ReleaseTransform { transform_id, control_handle } = self {
5282            Some((transform_id, control_handle))
5283        } else {
5284            None
5285        }
5286    }
5287
5288    #[allow(irrefutable_let_patterns)]
5289    pub fn into_release_view(self) -> Option<(FlatlandControlHandle)> {
5290        if let FlatlandRequest::ReleaseView { control_handle } = self {
5291            Some((control_handle))
5292        } else {
5293            None
5294        }
5295    }
5296
5297    #[allow(irrefutable_let_patterns)]
5298    pub fn into_release_viewport(self) -> Option<(ContentId, FlatlandReleaseViewportResponder)> {
5299        if let FlatlandRequest::ReleaseViewport { viewport_id, responder } = self {
5300            Some((viewport_id, responder))
5301        } else {
5302            None
5303        }
5304    }
5305
5306    #[allow(irrefutable_let_patterns)]
5307    pub fn into_release_image(self) -> Option<(ContentId, FlatlandControlHandle)> {
5308        if let FlatlandRequest::ReleaseImage { image_id, control_handle } = self {
5309            Some((image_id, control_handle))
5310        } else {
5311            None
5312        }
5313    }
5314
5315    #[allow(irrefutable_let_patterns)]
5316    pub fn into_clear(self) -> Option<(FlatlandControlHandle)> {
5317        if let FlatlandRequest::Clear { control_handle } = self {
5318            Some((control_handle))
5319        } else {
5320            None
5321        }
5322    }
5323
5324    #[allow(irrefutable_let_patterns)]
5325    pub fn into_set_debug_name(self) -> Option<(String, FlatlandControlHandle)> {
5326        if let FlatlandRequest::SetDebugName { name, control_handle } = self {
5327            Some((name, control_handle))
5328        } else {
5329            None
5330        }
5331    }
5332
5333    /// Name of the method defined in FIDL
5334    pub fn method_name(&self) -> &'static str {
5335        match *self {
5336            FlatlandRequest::ReleaseImageImmediately { .. } => "release_image_immediately",
5337            FlatlandRequest::Present { .. } => "present",
5338            FlatlandRequest::CreateView { .. } => "create_view",
5339            FlatlandRequest::CreateView2 { .. } => "create_view2",
5340            FlatlandRequest::CreateTransform { .. } => "create_transform",
5341            FlatlandRequest::SetTranslation { .. } => "set_translation",
5342            FlatlandRequest::SetOrientation { .. } => "set_orientation",
5343            FlatlandRequest::SetScale { .. } => "set_scale",
5344            FlatlandRequest::SetOpacity { .. } => "set_opacity",
5345            FlatlandRequest::SetClipBoundary { .. } => "set_clip_boundary",
5346            FlatlandRequest::AddChild { .. } => "add_child",
5347            FlatlandRequest::RemoveChild { .. } => "remove_child",
5348            FlatlandRequest::ReplaceChildren { .. } => "replace_children",
5349            FlatlandRequest::SetRootTransform { .. } => "set_root_transform",
5350            FlatlandRequest::SetHitRegions { .. } => "set_hit_regions",
5351            FlatlandRequest::SetInfiniteHitRegion { .. } => "set_infinite_hit_region",
5352            FlatlandRequest::CreateViewport { .. } => "create_viewport",
5353            FlatlandRequest::CreateImage { .. } => "create_image",
5354            FlatlandRequest::SetImageSampleRegion { .. } => "set_image_sample_region",
5355            FlatlandRequest::SetImageDestinationSize { .. } => "set_image_destination_size",
5356            FlatlandRequest::SetImageBlendingFunction { .. } => "set_image_blending_function",
5357            FlatlandRequest::SetImageBlendMode { .. } => "set_image_blend_mode",
5358            FlatlandRequest::SetImageOpacity { .. } => "set_image_opacity",
5359            FlatlandRequest::SetImageFlip { .. } => "set_image_flip",
5360            FlatlandRequest::CreateFilledRect { .. } => "create_filled_rect",
5361            FlatlandRequest::SetSolidFill { .. } => "set_solid_fill",
5362            FlatlandRequest::ReleaseFilledRect { .. } => "release_filled_rect",
5363            FlatlandRequest::SetContent { .. } => "set_content",
5364            FlatlandRequest::SetViewportProperties { .. } => "set_viewport_properties",
5365            FlatlandRequest::ReleaseTransform { .. } => "release_transform",
5366            FlatlandRequest::ReleaseView { .. } => "release_view",
5367            FlatlandRequest::ReleaseViewport { .. } => "release_viewport",
5368            FlatlandRequest::ReleaseImage { .. } => "release_image",
5369            FlatlandRequest::Clear { .. } => "clear",
5370            FlatlandRequest::SetDebugName { .. } => "set_debug_name",
5371        }
5372    }
5373}
5374
5375#[derive(Debug, Clone)]
5376pub struct FlatlandControlHandle {
5377    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5378}
5379
5380impl FlatlandControlHandle {
5381    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
5382        self.inner.shutdown_with_epitaph(status.into())
5383    }
5384}
5385
5386impl fidl::endpoints::ControlHandle for FlatlandControlHandle {
5387    fn shutdown(&self) {
5388        self.inner.shutdown()
5389    }
5390
5391    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
5392        self.inner.shutdown_with_epitaph(status)
5393    }
5394
5395    fn is_closed(&self) -> bool {
5396        self.inner.channel().is_closed()
5397    }
5398    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
5399        self.inner.channel().on_closed()
5400    }
5401
5402    #[cfg(target_os = "fuchsia")]
5403    fn signal_peer(
5404        &self,
5405        clear_mask: zx::Signals,
5406        set_mask: zx::Signals,
5407    ) -> Result<(), zx_status::Status> {
5408        use fidl::Peered;
5409        self.inner.channel().signal_peer(clear_mask, set_mask)
5410    }
5411}
5412
5413impl FlatlandControlHandle {
5414    pub fn send_on_next_frame_begin(
5415        &self,
5416        mut values: &OnNextFrameBeginValues,
5417    ) -> Result<(), fidl::Error> {
5418        self.inner.send::<FlatlandOnNextFrameBeginRequest>(
5419            (values,),
5420            0,
5421            0x10f69a5cdeece84a,
5422            fidl::encoding::DynamicFlags::empty(),
5423        )
5424    }
5425
5426    pub fn send_on_frame_presented(
5427        &self,
5428        mut frame_presented_info: &fidl_fuchsia_scenic_scheduling::FramePresentedInfo,
5429    ) -> Result<(), fidl::Error> {
5430        self.inner.send::<FlatlandOnFramePresentedRequest>(
5431            (frame_presented_info,),
5432            0,
5433            0x56e43e1a5f30216d,
5434            fidl::encoding::DynamicFlags::empty(),
5435        )
5436    }
5437
5438    pub fn send_on_error(&self, mut error: FlatlandError) -> Result<(), fidl::Error> {
5439        self.inner.send::<FlatlandOnErrorRequest>(
5440            (error,),
5441            0,
5442            0x1ebf39e90cd8b8d,
5443            fidl::encoding::DynamicFlags::empty(),
5444        )
5445    }
5446}
5447
5448#[must_use = "FIDL methods require a response to be sent"]
5449#[derive(Debug)]
5450pub struct FlatlandReleaseViewportResponder {
5451    control_handle: std::mem::ManuallyDrop<FlatlandControlHandle>,
5452    tx_id: u32,
5453}
5454
5455/// Set the the channel to be shutdown (see [`FlatlandControlHandle::shutdown`])
5456/// if the responder is dropped without sending a response, so that the client
5457/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5458impl std::ops::Drop for FlatlandReleaseViewportResponder {
5459    fn drop(&mut self) {
5460        self.control_handle.shutdown();
5461        // Safety: drops once, never accessed again
5462        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5463    }
5464}
5465
5466impl fidl::endpoints::Responder for FlatlandReleaseViewportResponder {
5467    type ControlHandle = FlatlandControlHandle;
5468
5469    fn control_handle(&self) -> &FlatlandControlHandle {
5470        &self.control_handle
5471    }
5472
5473    fn drop_without_shutdown(mut self) {
5474        // Safety: drops once, never accessed again due to mem::forget
5475        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5476        // Prevent Drop from running (which would shut down the channel)
5477        std::mem::forget(self);
5478    }
5479}
5480
5481impl FlatlandReleaseViewportResponder {
5482    /// Sends a response to the FIDL transaction.
5483    ///
5484    /// Sets the channel to shutdown if an error occurs.
5485    pub fn send(
5486        self,
5487        mut token: fidl_fuchsia_ui_views::ViewportCreationToken,
5488    ) -> Result<(), fidl::Error> {
5489        let _result = self.send_raw(token);
5490        if _result.is_err() {
5491            self.control_handle.shutdown();
5492        }
5493        self.drop_without_shutdown();
5494        _result
5495    }
5496
5497    /// Similar to "send" but does not shutdown the channel if an error occurs.
5498    pub fn send_no_shutdown_on_err(
5499        self,
5500        mut token: fidl_fuchsia_ui_views::ViewportCreationToken,
5501    ) -> Result<(), fidl::Error> {
5502        let _result = self.send_raw(token);
5503        self.drop_without_shutdown();
5504        _result
5505    }
5506
5507    fn send_raw(
5508        &self,
5509        mut token: fidl_fuchsia_ui_views::ViewportCreationToken,
5510    ) -> Result<(), fidl::Error> {
5511        self.control_handle.inner.send::<FlatlandReleaseViewportResponse>(
5512            (&mut token,),
5513            self.tx_id,
5514            0xbad474aeb5293f9,
5515            fidl::encoding::DynamicFlags::empty(),
5516        )
5517    }
5518}
5519
5520#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
5521pub struct FlatlandDisplayMarker;
5522
5523impl fidl::endpoints::ProtocolMarker for FlatlandDisplayMarker {
5524    type Proxy = FlatlandDisplayProxy;
5525    type RequestStream = FlatlandDisplayRequestStream;
5526    #[cfg(target_os = "fuchsia")]
5527    type SynchronousProxy = FlatlandDisplaySynchronousProxy;
5528
5529    const DEBUG_NAME: &'static str = "fuchsia.ui.composition.FlatlandDisplay";
5530}
5531impl fidl::endpoints::DiscoverableProtocolMarker for FlatlandDisplayMarker {}
5532
5533pub trait FlatlandDisplayProxyInterface: Send + Sync {
5534    fn r#set_content(
5535        &self,
5536        token: fidl_fuchsia_ui_views::ViewportCreationToken,
5537        child_view_watcher: fidl::endpoints::ServerEnd<ChildViewWatcherMarker>,
5538    ) -> Result<(), fidl::Error>;
5539    fn r#set_device_pixel_ratio(
5540        &self,
5541        device_pixel_ratio: &fidl_fuchsia_math::VecF,
5542    ) -> Result<(), fidl::Error>;
5543}
5544#[derive(Debug)]
5545#[cfg(target_os = "fuchsia")]
5546pub struct FlatlandDisplaySynchronousProxy {
5547    client: fidl::client::sync::Client,
5548}
5549
5550#[cfg(target_os = "fuchsia")]
5551impl fidl::endpoints::SynchronousProxy for FlatlandDisplaySynchronousProxy {
5552    type Proxy = FlatlandDisplayProxy;
5553    type Protocol = FlatlandDisplayMarker;
5554
5555    fn from_channel(inner: fidl::Channel) -> Self {
5556        Self::new(inner)
5557    }
5558
5559    fn into_channel(self) -> fidl::Channel {
5560        self.client.into_channel()
5561    }
5562
5563    fn as_channel(&self) -> &fidl::Channel {
5564        self.client.as_channel()
5565    }
5566}
5567
5568#[cfg(target_os = "fuchsia")]
5569impl FlatlandDisplaySynchronousProxy {
5570    pub fn new(channel: fidl::Channel) -> Self {
5571        Self { client: fidl::client::sync::Client::new(channel) }
5572    }
5573
5574    pub fn into_channel(self) -> fidl::Channel {
5575        self.client.into_channel()
5576    }
5577
5578    /// Waits until an event arrives and returns it. It is safe for other
5579    /// threads to make concurrent requests while waiting for an event.
5580    pub fn wait_for_event(
5581        &self,
5582        deadline: zx::MonotonicInstant,
5583    ) -> Result<FlatlandDisplayEvent, fidl::Error> {
5584        FlatlandDisplayEvent::decode(self.client.wait_for_event::<FlatlandDisplayMarker>(deadline)?)
5585    }
5586
5587    pub fn r#set_content(
5588        &self,
5589        mut token: fidl_fuchsia_ui_views::ViewportCreationToken,
5590        mut child_view_watcher: fidl::endpoints::ServerEnd<ChildViewWatcherMarker>,
5591    ) -> Result<(), fidl::Error> {
5592        self.client.send::<FlatlandDisplaySetContentRequest>(
5593            (&mut token, child_view_watcher),
5594            0x6748193a39918298,
5595            fidl::encoding::DynamicFlags::empty(),
5596        )
5597    }
5598
5599    /// Sets the ratio of display's physical pixels to device independent pixels that should be used
5600    /// for the tree of Flatland content that are attached to this display. See
5601    /// [`LayoutInfo.device_pixel_ratio`] for details.
5602    ///
5603    /// The default value is (1.0, 1.0). The valid values are 1.0 and above.
5604    pub fn r#set_device_pixel_ratio(
5605        &self,
5606        mut device_pixel_ratio: &fidl_fuchsia_math::VecF,
5607    ) -> Result<(), fidl::Error> {
5608        self.client.send::<FlatlandDisplaySetDevicePixelRatioRequest>(
5609            (device_pixel_ratio,),
5610            0x392c3e70cc0a81a4,
5611            fidl::encoding::DynamicFlags::empty(),
5612        )
5613    }
5614}
5615
5616#[cfg(target_os = "fuchsia")]
5617impl From<FlatlandDisplaySynchronousProxy> for zx::NullableHandle {
5618    fn from(value: FlatlandDisplaySynchronousProxy) -> Self {
5619        value.into_channel().into()
5620    }
5621}
5622
5623#[cfg(target_os = "fuchsia")]
5624impl From<fidl::Channel> for FlatlandDisplaySynchronousProxy {
5625    fn from(value: fidl::Channel) -> Self {
5626        Self::new(value)
5627    }
5628}
5629
5630#[cfg(target_os = "fuchsia")]
5631impl fidl::endpoints::FromClient for FlatlandDisplaySynchronousProxy {
5632    type Protocol = FlatlandDisplayMarker;
5633
5634    fn from_client(value: fidl::endpoints::ClientEnd<FlatlandDisplayMarker>) -> Self {
5635        Self::new(value.into_channel())
5636    }
5637}
5638
5639#[derive(Debug, Clone)]
5640pub struct FlatlandDisplayProxy {
5641    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
5642}
5643
5644impl fidl::endpoints::Proxy for FlatlandDisplayProxy {
5645    type Protocol = FlatlandDisplayMarker;
5646
5647    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
5648        Self::new(inner)
5649    }
5650
5651    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
5652        self.client.into_channel().map_err(|client| Self { client })
5653    }
5654
5655    fn as_channel(&self) -> &::fidl::AsyncChannel {
5656        self.client.as_channel()
5657    }
5658}
5659
5660impl FlatlandDisplayProxy {
5661    /// Create a new Proxy for fuchsia.ui.composition/FlatlandDisplay.
5662    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
5663        let protocol_name = <FlatlandDisplayMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
5664        Self { client: fidl::client::Client::new(channel, protocol_name) }
5665    }
5666
5667    /// Get a Stream of events from the remote end of the protocol.
5668    ///
5669    /// # Panics
5670    ///
5671    /// Panics if the event stream was already taken.
5672    pub fn take_event_stream(&self) -> FlatlandDisplayEventStream {
5673        FlatlandDisplayEventStream { event_receiver: self.client.take_event_receiver() }
5674    }
5675
5676    pub 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        FlatlandDisplayProxyInterface::r#set_content(self, token, child_view_watcher)
5682    }
5683
5684    /// Sets the ratio of display's physical pixels to device independent pixels that should be used
5685    /// for the tree of Flatland content that are attached to this display. See
5686    /// [`LayoutInfo.device_pixel_ratio`] for details.
5687    ///
5688    /// The default value is (1.0, 1.0). The valid values are 1.0 and above.
5689    pub fn r#set_device_pixel_ratio(
5690        &self,
5691        mut device_pixel_ratio: &fidl_fuchsia_math::VecF,
5692    ) -> Result<(), fidl::Error> {
5693        FlatlandDisplayProxyInterface::r#set_device_pixel_ratio(self, device_pixel_ratio)
5694    }
5695}
5696
5697impl FlatlandDisplayProxyInterface for FlatlandDisplayProxy {
5698    fn r#set_content(
5699        &self,
5700        mut token: fidl_fuchsia_ui_views::ViewportCreationToken,
5701        mut child_view_watcher: fidl::endpoints::ServerEnd<ChildViewWatcherMarker>,
5702    ) -> Result<(), fidl::Error> {
5703        self.client.send::<FlatlandDisplaySetContentRequest>(
5704            (&mut token, child_view_watcher),
5705            0x6748193a39918298,
5706            fidl::encoding::DynamicFlags::empty(),
5707        )
5708    }
5709
5710    fn r#set_device_pixel_ratio(
5711        &self,
5712        mut device_pixel_ratio: &fidl_fuchsia_math::VecF,
5713    ) -> Result<(), fidl::Error> {
5714        self.client.send::<FlatlandDisplaySetDevicePixelRatioRequest>(
5715            (device_pixel_ratio,),
5716            0x392c3e70cc0a81a4,
5717            fidl::encoding::DynamicFlags::empty(),
5718        )
5719    }
5720}
5721
5722pub struct FlatlandDisplayEventStream {
5723    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
5724}
5725
5726impl std::marker::Unpin for FlatlandDisplayEventStream {}
5727
5728impl futures::stream::FusedStream for FlatlandDisplayEventStream {
5729    fn is_terminated(&self) -> bool {
5730        self.event_receiver.is_terminated()
5731    }
5732}
5733
5734impl futures::Stream for FlatlandDisplayEventStream {
5735    type Item = Result<FlatlandDisplayEvent, fidl::Error>;
5736
5737    fn poll_next(
5738        mut self: std::pin::Pin<&mut Self>,
5739        cx: &mut std::task::Context<'_>,
5740    ) -> std::task::Poll<Option<Self::Item>> {
5741        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
5742            &mut self.event_receiver,
5743            cx
5744        )?) {
5745            Some(buf) => std::task::Poll::Ready(Some(FlatlandDisplayEvent::decode(buf))),
5746            None => std::task::Poll::Ready(None),
5747        }
5748    }
5749}
5750
5751#[derive(Debug)]
5752pub enum FlatlandDisplayEvent {}
5753
5754impl FlatlandDisplayEvent {
5755    /// Decodes a message buffer as a [`FlatlandDisplayEvent`].
5756    fn decode(
5757        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
5758    ) -> Result<FlatlandDisplayEvent, fidl::Error> {
5759        let (bytes, _handles) = buf.split_mut();
5760        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5761        debug_assert_eq!(tx_header.tx_id, 0);
5762        match tx_header.ordinal {
5763            _ => Err(fidl::Error::UnknownOrdinal {
5764                ordinal: tx_header.ordinal,
5765                protocol_name:
5766                    <FlatlandDisplayMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5767            }),
5768        }
5769    }
5770}
5771
5772/// A Stream of incoming requests for fuchsia.ui.composition/FlatlandDisplay.
5773pub struct FlatlandDisplayRequestStream {
5774    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5775    is_terminated: bool,
5776}
5777
5778impl std::marker::Unpin for FlatlandDisplayRequestStream {}
5779
5780impl futures::stream::FusedStream for FlatlandDisplayRequestStream {
5781    fn is_terminated(&self) -> bool {
5782        self.is_terminated
5783    }
5784}
5785
5786impl fidl::endpoints::RequestStream for FlatlandDisplayRequestStream {
5787    type Protocol = FlatlandDisplayMarker;
5788    type ControlHandle = FlatlandDisplayControlHandle;
5789
5790    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
5791        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
5792    }
5793
5794    fn control_handle(&self) -> Self::ControlHandle {
5795        FlatlandDisplayControlHandle { inner: self.inner.clone() }
5796    }
5797
5798    fn into_inner(
5799        self,
5800    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
5801    {
5802        (self.inner, self.is_terminated)
5803    }
5804
5805    fn from_inner(
5806        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5807        is_terminated: bool,
5808    ) -> Self {
5809        Self { inner, is_terminated }
5810    }
5811}
5812
5813impl futures::Stream for FlatlandDisplayRequestStream {
5814    type Item = Result<FlatlandDisplayRequest, fidl::Error>;
5815
5816    fn poll_next(
5817        mut self: std::pin::Pin<&mut Self>,
5818        cx: &mut std::task::Context<'_>,
5819    ) -> std::task::Poll<Option<Self::Item>> {
5820        let this = &mut *self;
5821        if this.inner.check_shutdown(cx) {
5822            this.is_terminated = true;
5823            return std::task::Poll::Ready(None);
5824        }
5825        if this.is_terminated {
5826            panic!("polled FlatlandDisplayRequestStream after completion");
5827        }
5828        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
5829            |bytes, handles| {
5830                match this.inner.channel().read_etc(cx, bytes, handles) {
5831                    std::task::Poll::Ready(Ok(())) => {}
5832                    std::task::Poll::Pending => return std::task::Poll::Pending,
5833                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
5834                        this.is_terminated = true;
5835                        return std::task::Poll::Ready(None);
5836                    }
5837                    std::task::Poll::Ready(Err(e)) => {
5838                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
5839                            e.into(),
5840                        ))));
5841                    }
5842                }
5843
5844                // A message has been received from the channel
5845                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5846
5847                std::task::Poll::Ready(Some(match header.ordinal {
5848                    0x6748193a39918298 => {
5849                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5850                        let mut req = fidl::new_empty!(
5851                            FlatlandDisplaySetContentRequest,
5852                            fidl::encoding::DefaultFuchsiaResourceDialect
5853                        );
5854                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandDisplaySetContentRequest>(&header, _body_bytes, handles, &mut req)?;
5855                        let control_handle =
5856                            FlatlandDisplayControlHandle { inner: this.inner.clone() };
5857                        Ok(FlatlandDisplayRequest::SetContent {
5858                            token: req.token,
5859                            child_view_watcher: req.child_view_watcher,
5860
5861                            control_handle,
5862                        })
5863                    }
5864                    0x392c3e70cc0a81a4 => {
5865                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5866                        let mut req = fidl::new_empty!(
5867                            FlatlandDisplaySetDevicePixelRatioRequest,
5868                            fidl::encoding::DefaultFuchsiaResourceDialect
5869                        );
5870                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandDisplaySetDevicePixelRatioRequest>(&header, _body_bytes, handles, &mut req)?;
5871                        let control_handle =
5872                            FlatlandDisplayControlHandle { inner: this.inner.clone() };
5873                        Ok(FlatlandDisplayRequest::SetDevicePixelRatio {
5874                            device_pixel_ratio: req.device_pixel_ratio,
5875
5876                            control_handle,
5877                        })
5878                    }
5879                    _ => Err(fidl::Error::UnknownOrdinal {
5880                        ordinal: header.ordinal,
5881                        protocol_name:
5882                            <FlatlandDisplayMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5883                    }),
5884                }))
5885            },
5886        )
5887    }
5888}
5889
5890/// This API connects to the singleton "primary display", and allows a tree of Flatland content to
5891/// be attached underneath.  Only one FlatlandDisplay client connection is allowed at one time.
5892#[derive(Debug)]
5893pub enum FlatlandDisplayRequest {
5894    SetContent {
5895        token: fidl_fuchsia_ui_views::ViewportCreationToken,
5896        child_view_watcher: fidl::endpoints::ServerEnd<ChildViewWatcherMarker>,
5897        control_handle: FlatlandDisplayControlHandle,
5898    },
5899    /// Sets the ratio of display's physical pixels to device independent pixels that should be used
5900    /// for the tree of Flatland content that are attached to this display. See
5901    /// [`LayoutInfo.device_pixel_ratio`] for details.
5902    ///
5903    /// The default value is (1.0, 1.0). The valid values are 1.0 and above.
5904    SetDevicePixelRatio {
5905        device_pixel_ratio: fidl_fuchsia_math::VecF,
5906        control_handle: FlatlandDisplayControlHandle,
5907    },
5908}
5909
5910impl FlatlandDisplayRequest {
5911    #[allow(irrefutable_let_patterns)]
5912    pub fn into_set_content(
5913        self,
5914    ) -> Option<(
5915        fidl_fuchsia_ui_views::ViewportCreationToken,
5916        fidl::endpoints::ServerEnd<ChildViewWatcherMarker>,
5917        FlatlandDisplayControlHandle,
5918    )> {
5919        if let FlatlandDisplayRequest::SetContent { token, child_view_watcher, control_handle } =
5920            self
5921        {
5922            Some((token, child_view_watcher, control_handle))
5923        } else {
5924            None
5925        }
5926    }
5927
5928    #[allow(irrefutable_let_patterns)]
5929    pub fn into_set_device_pixel_ratio(
5930        self,
5931    ) -> Option<(fidl_fuchsia_math::VecF, FlatlandDisplayControlHandle)> {
5932        if let FlatlandDisplayRequest::SetDevicePixelRatio { device_pixel_ratio, control_handle } =
5933            self
5934        {
5935            Some((device_pixel_ratio, control_handle))
5936        } else {
5937            None
5938        }
5939    }
5940
5941    /// Name of the method defined in FIDL
5942    pub fn method_name(&self) -> &'static str {
5943        match *self {
5944            FlatlandDisplayRequest::SetContent { .. } => "set_content",
5945            FlatlandDisplayRequest::SetDevicePixelRatio { .. } => "set_device_pixel_ratio",
5946        }
5947    }
5948}
5949
5950#[derive(Debug, Clone)]
5951pub struct FlatlandDisplayControlHandle {
5952    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5953}
5954
5955impl FlatlandDisplayControlHandle {
5956    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
5957        self.inner.shutdown_with_epitaph(status.into())
5958    }
5959}
5960
5961impl fidl::endpoints::ControlHandle for FlatlandDisplayControlHandle {
5962    fn shutdown(&self) {
5963        self.inner.shutdown()
5964    }
5965
5966    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
5967        self.inner.shutdown_with_epitaph(status)
5968    }
5969
5970    fn is_closed(&self) -> bool {
5971        self.inner.channel().is_closed()
5972    }
5973    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
5974        self.inner.channel().on_closed()
5975    }
5976
5977    #[cfg(target_os = "fuchsia")]
5978    fn signal_peer(
5979        &self,
5980        clear_mask: zx::Signals,
5981        set_mask: zx::Signals,
5982    ) -> Result<(), zx_status::Status> {
5983        use fidl::Peered;
5984        self.inner.channel().signal_peer(clear_mask, set_mask)
5985    }
5986}
5987
5988impl FlatlandDisplayControlHandle {}
5989
5990#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
5991pub struct ParentViewportWatcherMarker;
5992
5993impl fidl::endpoints::ProtocolMarker for ParentViewportWatcherMarker {
5994    type Proxy = ParentViewportWatcherProxy;
5995    type RequestStream = ParentViewportWatcherRequestStream;
5996    #[cfg(target_os = "fuchsia")]
5997    type SynchronousProxy = ParentViewportWatcherSynchronousProxy;
5998
5999    const DEBUG_NAME: &'static str = "(anonymous) ParentViewportWatcher";
6000}
6001
6002pub trait ParentViewportWatcherProxyInterface: Send + Sync {
6003    type GetLayoutResponseFut: std::future::Future<Output = Result<LayoutInfo, fidl::Error>> + Send;
6004    fn r#get_layout(&self) -> Self::GetLayoutResponseFut;
6005    type GetStatusResponseFut: std::future::Future<Output = Result<ParentViewportStatus, fidl::Error>>
6006        + Send;
6007    fn r#get_status(&self) -> Self::GetStatusResponseFut;
6008}
6009#[derive(Debug)]
6010#[cfg(target_os = "fuchsia")]
6011pub struct ParentViewportWatcherSynchronousProxy {
6012    client: fidl::client::sync::Client,
6013}
6014
6015#[cfg(target_os = "fuchsia")]
6016impl fidl::endpoints::SynchronousProxy for ParentViewportWatcherSynchronousProxy {
6017    type Proxy = ParentViewportWatcherProxy;
6018    type Protocol = ParentViewportWatcherMarker;
6019
6020    fn from_channel(inner: fidl::Channel) -> Self {
6021        Self::new(inner)
6022    }
6023
6024    fn into_channel(self) -> fidl::Channel {
6025        self.client.into_channel()
6026    }
6027
6028    fn as_channel(&self) -> &fidl::Channel {
6029        self.client.as_channel()
6030    }
6031}
6032
6033#[cfg(target_os = "fuchsia")]
6034impl ParentViewportWatcherSynchronousProxy {
6035    pub fn new(channel: fidl::Channel) -> Self {
6036        Self { client: fidl::client::sync::Client::new(channel) }
6037    }
6038
6039    pub fn into_channel(self) -> fidl::Channel {
6040        self.client.into_channel()
6041    }
6042
6043    /// Waits until an event arrives and returns it. It is safe for other
6044    /// threads to make concurrent requests while waiting for an event.
6045    pub fn wait_for_event(
6046        &self,
6047        deadline: zx::MonotonicInstant,
6048    ) -> Result<ParentViewportWatcherEvent, fidl::Error> {
6049        ParentViewportWatcherEvent::decode(
6050            self.client.wait_for_event::<ParentViewportWatcherMarker>(deadline)?,
6051        )
6052    }
6053
6054    /// A hanging get for receiving layout information. Clients may receive layout information
6055    /// before the ParentViewportWatcher operation has been presented. This allows children to
6056    /// layout their content before their first call to [`Present`]. In transition cases where two
6057    /// ParentViewportWatcher channels exist at the same time, both protocol instances will be
6058    /// receiving different layout information.
6059    ///
6060    /// This hanging get will only fire when the LayoutInfo is different than the previously
6061    /// returned LayoutInfo. Note that, since LayoutInfo is a table, only some fields may have
6062    /// changed.
6063    ///
6064    /// It is invalid to call `GetLayout` while a previous call is still pending. Doing so will
6065    /// cause both this channel and the Flatland channel that handed out ParentViewportWatcher to be
6066    /// closed.
6067    pub fn r#get_layout(
6068        &self,
6069        ___deadline: zx::MonotonicInstant,
6070    ) -> Result<LayoutInfo, fidl::Error> {
6071        let _response = self.client.send_query::<
6072            fidl::encoding::EmptyPayload,
6073            ParentViewportWatcherGetLayoutResponse,
6074            ParentViewportWatcherMarker,
6075        >(
6076            (),
6077            0x3cbe5d9638e032,
6078            fidl::encoding::DynamicFlags::empty(),
6079            ___deadline,
6080        )?;
6081        Ok(_response.info)
6082    }
6083
6084    /// A hanging get for receiving the status of the parent Viewport. This provides global
6085    /// connectivity information to the child.
6086    ///
6087    /// This hanging get will only fire when the ParentViewportStatus is different than the
6088    /// previously returned ParentViewportStatus.
6089    ///
6090    /// It is invalid to call `GetStatus` while a previous call is still pending. Doing so will
6091    /// cause both this channel and the Flatland channel that handed out ParentViewportWatcher to be
6092    /// closed.
6093    pub fn r#get_status(
6094        &self,
6095        ___deadline: zx::MonotonicInstant,
6096    ) -> Result<ParentViewportStatus, fidl::Error> {
6097        let _response = self.client.send_query::<
6098            fidl::encoding::EmptyPayload,
6099            ParentViewportWatcherGetStatusResponse,
6100            ParentViewportWatcherMarker,
6101        >(
6102            (),
6103            0x7caa022f050d9ea6,
6104            fidl::encoding::DynamicFlags::empty(),
6105            ___deadline,
6106        )?;
6107        Ok(_response.status)
6108    }
6109}
6110
6111#[cfg(target_os = "fuchsia")]
6112impl From<ParentViewportWatcherSynchronousProxy> for zx::NullableHandle {
6113    fn from(value: ParentViewportWatcherSynchronousProxy) -> Self {
6114        value.into_channel().into()
6115    }
6116}
6117
6118#[cfg(target_os = "fuchsia")]
6119impl From<fidl::Channel> for ParentViewportWatcherSynchronousProxy {
6120    fn from(value: fidl::Channel) -> Self {
6121        Self::new(value)
6122    }
6123}
6124
6125#[cfg(target_os = "fuchsia")]
6126impl fidl::endpoints::FromClient for ParentViewportWatcherSynchronousProxy {
6127    type Protocol = ParentViewportWatcherMarker;
6128
6129    fn from_client(value: fidl::endpoints::ClientEnd<ParentViewportWatcherMarker>) -> Self {
6130        Self::new(value.into_channel())
6131    }
6132}
6133
6134#[derive(Debug, Clone)]
6135pub struct ParentViewportWatcherProxy {
6136    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
6137}
6138
6139impl fidl::endpoints::Proxy for ParentViewportWatcherProxy {
6140    type Protocol = ParentViewportWatcherMarker;
6141
6142    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
6143        Self::new(inner)
6144    }
6145
6146    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
6147        self.client.into_channel().map_err(|client| Self { client })
6148    }
6149
6150    fn as_channel(&self) -> &::fidl::AsyncChannel {
6151        self.client.as_channel()
6152    }
6153}
6154
6155impl ParentViewportWatcherProxy {
6156    /// Create a new Proxy for fuchsia.ui.composition/ParentViewportWatcher.
6157    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
6158        let protocol_name =
6159            <ParentViewportWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
6160        Self { client: fidl::client::Client::new(channel, protocol_name) }
6161    }
6162
6163    /// Get a Stream of events from the remote end of the protocol.
6164    ///
6165    /// # Panics
6166    ///
6167    /// Panics if the event stream was already taken.
6168    pub fn take_event_stream(&self) -> ParentViewportWatcherEventStream {
6169        ParentViewportWatcherEventStream { event_receiver: self.client.take_event_receiver() }
6170    }
6171
6172    /// A hanging get for receiving layout information. Clients may receive layout information
6173    /// before the ParentViewportWatcher operation has been presented. This allows children to
6174    /// layout their content before their first call to [`Present`]. In transition cases where two
6175    /// ParentViewportWatcher channels exist at the same time, both protocol instances will be
6176    /// receiving different layout information.
6177    ///
6178    /// This hanging get will only fire when the LayoutInfo is different than the previously
6179    /// returned LayoutInfo. Note that, since LayoutInfo is a table, only some fields may have
6180    /// changed.
6181    ///
6182    /// It is invalid to call `GetLayout` while a previous call is still pending. Doing so will
6183    /// cause both this channel and the Flatland channel that handed out ParentViewportWatcher to be
6184    /// closed.
6185    pub fn r#get_layout(
6186        &self,
6187    ) -> fidl::client::QueryResponseFut<LayoutInfo, fidl::encoding::DefaultFuchsiaResourceDialect>
6188    {
6189        ParentViewportWatcherProxyInterface::r#get_layout(self)
6190    }
6191
6192    /// A hanging get for receiving the status of the parent Viewport. This provides global
6193    /// connectivity information to the child.
6194    ///
6195    /// This hanging get will only fire when the ParentViewportStatus is different than the
6196    /// previously returned ParentViewportStatus.
6197    ///
6198    /// It is invalid to call `GetStatus` while a previous call is still pending. Doing so will
6199    /// cause both this channel and the Flatland channel that handed out ParentViewportWatcher to be
6200    /// closed.
6201    pub fn r#get_status(
6202        &self,
6203    ) -> fidl::client::QueryResponseFut<
6204        ParentViewportStatus,
6205        fidl::encoding::DefaultFuchsiaResourceDialect,
6206    > {
6207        ParentViewportWatcherProxyInterface::r#get_status(self)
6208    }
6209}
6210
6211impl ParentViewportWatcherProxyInterface for ParentViewportWatcherProxy {
6212    type GetLayoutResponseFut =
6213        fidl::client::QueryResponseFut<LayoutInfo, fidl::encoding::DefaultFuchsiaResourceDialect>;
6214    fn r#get_layout(&self) -> Self::GetLayoutResponseFut {
6215        fn _decode(
6216            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6217        ) -> Result<LayoutInfo, fidl::Error> {
6218            let _response = fidl::client::decode_transaction_body::<
6219                ParentViewportWatcherGetLayoutResponse,
6220                fidl::encoding::DefaultFuchsiaResourceDialect,
6221                0x3cbe5d9638e032,
6222            >(_buf?)?;
6223            Ok(_response.info)
6224        }
6225        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, LayoutInfo>(
6226            (),
6227            0x3cbe5d9638e032,
6228            fidl::encoding::DynamicFlags::empty(),
6229            _decode,
6230        )
6231    }
6232
6233    type GetStatusResponseFut = fidl::client::QueryResponseFut<
6234        ParentViewportStatus,
6235        fidl::encoding::DefaultFuchsiaResourceDialect,
6236    >;
6237    fn r#get_status(&self) -> Self::GetStatusResponseFut {
6238        fn _decode(
6239            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6240        ) -> Result<ParentViewportStatus, fidl::Error> {
6241            let _response = fidl::client::decode_transaction_body::<
6242                ParentViewportWatcherGetStatusResponse,
6243                fidl::encoding::DefaultFuchsiaResourceDialect,
6244                0x7caa022f050d9ea6,
6245            >(_buf?)?;
6246            Ok(_response.status)
6247        }
6248        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ParentViewportStatus>(
6249            (),
6250            0x7caa022f050d9ea6,
6251            fidl::encoding::DynamicFlags::empty(),
6252            _decode,
6253        )
6254    }
6255}
6256
6257pub struct ParentViewportWatcherEventStream {
6258    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
6259}
6260
6261impl std::marker::Unpin for ParentViewportWatcherEventStream {}
6262
6263impl futures::stream::FusedStream for ParentViewportWatcherEventStream {
6264    fn is_terminated(&self) -> bool {
6265        self.event_receiver.is_terminated()
6266    }
6267}
6268
6269impl futures::Stream for ParentViewportWatcherEventStream {
6270    type Item = Result<ParentViewportWatcherEvent, fidl::Error>;
6271
6272    fn poll_next(
6273        mut self: std::pin::Pin<&mut Self>,
6274        cx: &mut std::task::Context<'_>,
6275    ) -> std::task::Poll<Option<Self::Item>> {
6276        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
6277            &mut self.event_receiver,
6278            cx
6279        )?) {
6280            Some(buf) => std::task::Poll::Ready(Some(ParentViewportWatcherEvent::decode(buf))),
6281            None => std::task::Poll::Ready(None),
6282        }
6283    }
6284}
6285
6286#[derive(Debug)]
6287pub enum ParentViewportWatcherEvent {}
6288
6289impl ParentViewportWatcherEvent {
6290    /// Decodes a message buffer as a [`ParentViewportWatcherEvent`].
6291    fn decode(
6292        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
6293    ) -> Result<ParentViewportWatcherEvent, fidl::Error> {
6294        let (bytes, _handles) = buf.split_mut();
6295        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6296        debug_assert_eq!(tx_header.tx_id, 0);
6297        match tx_header.ordinal {
6298            _ => Err(fidl::Error::UnknownOrdinal {
6299                ordinal: tx_header.ordinal,
6300                protocol_name:
6301                    <ParentViewportWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6302            }),
6303        }
6304    }
6305}
6306
6307/// A Stream of incoming requests for fuchsia.ui.composition/ParentViewportWatcher.
6308pub struct ParentViewportWatcherRequestStream {
6309    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6310    is_terminated: bool,
6311}
6312
6313impl std::marker::Unpin for ParentViewportWatcherRequestStream {}
6314
6315impl futures::stream::FusedStream for ParentViewportWatcherRequestStream {
6316    fn is_terminated(&self) -> bool {
6317        self.is_terminated
6318    }
6319}
6320
6321impl fidl::endpoints::RequestStream for ParentViewportWatcherRequestStream {
6322    type Protocol = ParentViewportWatcherMarker;
6323    type ControlHandle = ParentViewportWatcherControlHandle;
6324
6325    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
6326        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
6327    }
6328
6329    fn control_handle(&self) -> Self::ControlHandle {
6330        ParentViewportWatcherControlHandle { inner: self.inner.clone() }
6331    }
6332
6333    fn into_inner(
6334        self,
6335    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
6336    {
6337        (self.inner, self.is_terminated)
6338    }
6339
6340    fn from_inner(
6341        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6342        is_terminated: bool,
6343    ) -> Self {
6344        Self { inner, is_terminated }
6345    }
6346}
6347
6348impl futures::Stream for ParentViewportWatcherRequestStream {
6349    type Item = Result<ParentViewportWatcherRequest, fidl::Error>;
6350
6351    fn poll_next(
6352        mut self: std::pin::Pin<&mut Self>,
6353        cx: &mut std::task::Context<'_>,
6354    ) -> std::task::Poll<Option<Self::Item>> {
6355        let this = &mut *self;
6356        if this.inner.check_shutdown(cx) {
6357            this.is_terminated = true;
6358            return std::task::Poll::Ready(None);
6359        }
6360        if this.is_terminated {
6361            panic!("polled ParentViewportWatcherRequestStream after completion");
6362        }
6363        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
6364            |bytes, handles| {
6365                match this.inner.channel().read_etc(cx, bytes, handles) {
6366                    std::task::Poll::Ready(Ok(())) => {}
6367                    std::task::Poll::Pending => return std::task::Poll::Pending,
6368                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
6369                        this.is_terminated = true;
6370                        return std::task::Poll::Ready(None);
6371                    }
6372                    std::task::Poll::Ready(Err(e)) => {
6373                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
6374                            e.into(),
6375                        ))));
6376                    }
6377                }
6378
6379                // A message has been received from the channel
6380                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6381
6382                std::task::Poll::Ready(Some(match header.ordinal {
6383                0x3cbe5d9638e032 => {
6384                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6385                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
6386                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
6387                    let control_handle = ParentViewportWatcherControlHandle {
6388                        inner: this.inner.clone(),
6389                    };
6390                    Ok(ParentViewportWatcherRequest::GetLayout {
6391                        responder: ParentViewportWatcherGetLayoutResponder {
6392                            control_handle: std::mem::ManuallyDrop::new(control_handle),
6393                            tx_id: header.tx_id,
6394                        },
6395                    })
6396                }
6397                0x7caa022f050d9ea6 => {
6398                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6399                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
6400                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
6401                    let control_handle = ParentViewportWatcherControlHandle {
6402                        inner: this.inner.clone(),
6403                    };
6404                    Ok(ParentViewportWatcherRequest::GetStatus {
6405                        responder: ParentViewportWatcherGetStatusResponder {
6406                            control_handle: std::mem::ManuallyDrop::new(control_handle),
6407                            tx_id: header.tx_id,
6408                        },
6409                    })
6410                }
6411                _ => Err(fidl::Error::UnknownOrdinal {
6412                    ordinal: header.ordinal,
6413                    protocol_name: <ParentViewportWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6414                }),
6415            }))
6416            },
6417        )
6418    }
6419}
6420
6421/// A protocol that provides information about the parent Viewport attached to a Flatland instance's
6422/// sole View.  Although Flatland instances can have at most one view, it is possible to have
6423/// multiple ParentViewportWatchers during the brief transition period when replacing the instance's
6424/// View with another, e.g. via [`CreateView`].  During this period, certain updates may be
6425/// duplicated and sent to each ParentViewportWatcher connection.
6426///
6427/// A ParentViewportWatcher will remain connected as long as the corresponding parent Viewport
6428/// exists; the connection will also be closed if the parents's ViewportCreationToken is dropped
6429/// without using it to create a Viewport.
6430#[derive(Debug)]
6431pub enum ParentViewportWatcherRequest {
6432    /// A hanging get for receiving layout information. Clients may receive layout information
6433    /// before the ParentViewportWatcher operation has been presented. This allows children to
6434    /// layout their content before their first call to [`Present`]. In transition cases where two
6435    /// ParentViewportWatcher channels exist at the same time, both protocol instances will be
6436    /// receiving different layout information.
6437    ///
6438    /// This hanging get will only fire when the LayoutInfo is different than the previously
6439    /// returned LayoutInfo. Note that, since LayoutInfo is a table, only some fields may have
6440    /// changed.
6441    ///
6442    /// It is invalid to call `GetLayout` while a previous call is still pending. Doing so will
6443    /// cause both this channel and the Flatland channel that handed out ParentViewportWatcher to be
6444    /// closed.
6445    GetLayout { responder: ParentViewportWatcherGetLayoutResponder },
6446    /// A hanging get for receiving the status of the parent Viewport. This provides global
6447    /// connectivity information to the child.
6448    ///
6449    /// This hanging get will only fire when the ParentViewportStatus is different than the
6450    /// previously returned ParentViewportStatus.
6451    ///
6452    /// It is invalid to call `GetStatus` while a previous call is still pending. Doing so will
6453    /// cause both this channel and the Flatland channel that handed out ParentViewportWatcher to be
6454    /// closed.
6455    GetStatus { responder: ParentViewportWatcherGetStatusResponder },
6456}
6457
6458impl ParentViewportWatcherRequest {
6459    #[allow(irrefutable_let_patterns)]
6460    pub fn into_get_layout(self) -> Option<(ParentViewportWatcherGetLayoutResponder)> {
6461        if let ParentViewportWatcherRequest::GetLayout { responder } = self {
6462            Some((responder))
6463        } else {
6464            None
6465        }
6466    }
6467
6468    #[allow(irrefutable_let_patterns)]
6469    pub fn into_get_status(self) -> Option<(ParentViewportWatcherGetStatusResponder)> {
6470        if let ParentViewportWatcherRequest::GetStatus { responder } = self {
6471            Some((responder))
6472        } else {
6473            None
6474        }
6475    }
6476
6477    /// Name of the method defined in FIDL
6478    pub fn method_name(&self) -> &'static str {
6479        match *self {
6480            ParentViewportWatcherRequest::GetLayout { .. } => "get_layout",
6481            ParentViewportWatcherRequest::GetStatus { .. } => "get_status",
6482        }
6483    }
6484}
6485
6486#[derive(Debug, Clone)]
6487pub struct ParentViewportWatcherControlHandle {
6488    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6489}
6490
6491impl ParentViewportWatcherControlHandle {
6492    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
6493        self.inner.shutdown_with_epitaph(status.into())
6494    }
6495}
6496
6497impl fidl::endpoints::ControlHandle for ParentViewportWatcherControlHandle {
6498    fn shutdown(&self) {
6499        self.inner.shutdown()
6500    }
6501
6502    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
6503        self.inner.shutdown_with_epitaph(status)
6504    }
6505
6506    fn is_closed(&self) -> bool {
6507        self.inner.channel().is_closed()
6508    }
6509    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
6510        self.inner.channel().on_closed()
6511    }
6512
6513    #[cfg(target_os = "fuchsia")]
6514    fn signal_peer(
6515        &self,
6516        clear_mask: zx::Signals,
6517        set_mask: zx::Signals,
6518    ) -> Result<(), zx_status::Status> {
6519        use fidl::Peered;
6520        self.inner.channel().signal_peer(clear_mask, set_mask)
6521    }
6522}
6523
6524impl ParentViewportWatcherControlHandle {}
6525
6526#[must_use = "FIDL methods require a response to be sent"]
6527#[derive(Debug)]
6528pub struct ParentViewportWatcherGetLayoutResponder {
6529    control_handle: std::mem::ManuallyDrop<ParentViewportWatcherControlHandle>,
6530    tx_id: u32,
6531}
6532
6533/// Set the the channel to be shutdown (see [`ParentViewportWatcherControlHandle::shutdown`])
6534/// if the responder is dropped without sending a response, so that the client
6535/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6536impl std::ops::Drop for ParentViewportWatcherGetLayoutResponder {
6537    fn drop(&mut self) {
6538        self.control_handle.shutdown();
6539        // Safety: drops once, never accessed again
6540        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6541    }
6542}
6543
6544impl fidl::endpoints::Responder for ParentViewportWatcherGetLayoutResponder {
6545    type ControlHandle = ParentViewportWatcherControlHandle;
6546
6547    fn control_handle(&self) -> &ParentViewportWatcherControlHandle {
6548        &self.control_handle
6549    }
6550
6551    fn drop_without_shutdown(mut self) {
6552        // Safety: drops once, never accessed again due to mem::forget
6553        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6554        // Prevent Drop from running (which would shut down the channel)
6555        std::mem::forget(self);
6556    }
6557}
6558
6559impl ParentViewportWatcherGetLayoutResponder {
6560    /// Sends a response to the FIDL transaction.
6561    ///
6562    /// Sets the channel to shutdown if an error occurs.
6563    pub fn send(self, mut info: &LayoutInfo) -> Result<(), fidl::Error> {
6564        let _result = self.send_raw(info);
6565        if _result.is_err() {
6566            self.control_handle.shutdown();
6567        }
6568        self.drop_without_shutdown();
6569        _result
6570    }
6571
6572    /// Similar to "send" but does not shutdown the channel if an error occurs.
6573    pub fn send_no_shutdown_on_err(self, mut info: &LayoutInfo) -> Result<(), fidl::Error> {
6574        let _result = self.send_raw(info);
6575        self.drop_without_shutdown();
6576        _result
6577    }
6578
6579    fn send_raw(&self, mut info: &LayoutInfo) -> Result<(), fidl::Error> {
6580        self.control_handle.inner.send::<ParentViewportWatcherGetLayoutResponse>(
6581            (info,),
6582            self.tx_id,
6583            0x3cbe5d9638e032,
6584            fidl::encoding::DynamicFlags::empty(),
6585        )
6586    }
6587}
6588
6589#[must_use = "FIDL methods require a response to be sent"]
6590#[derive(Debug)]
6591pub struct ParentViewportWatcherGetStatusResponder {
6592    control_handle: std::mem::ManuallyDrop<ParentViewportWatcherControlHandle>,
6593    tx_id: u32,
6594}
6595
6596/// Set the the channel to be shutdown (see [`ParentViewportWatcherControlHandle::shutdown`])
6597/// if the responder is dropped without sending a response, so that the client
6598/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6599impl std::ops::Drop for ParentViewportWatcherGetStatusResponder {
6600    fn drop(&mut self) {
6601        self.control_handle.shutdown();
6602        // Safety: drops once, never accessed again
6603        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6604    }
6605}
6606
6607impl fidl::endpoints::Responder for ParentViewportWatcherGetStatusResponder {
6608    type ControlHandle = ParentViewportWatcherControlHandle;
6609
6610    fn control_handle(&self) -> &ParentViewportWatcherControlHandle {
6611        &self.control_handle
6612    }
6613
6614    fn drop_without_shutdown(mut self) {
6615        // Safety: drops once, never accessed again due to mem::forget
6616        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6617        // Prevent Drop from running (which would shut down the channel)
6618        std::mem::forget(self);
6619    }
6620}
6621
6622impl ParentViewportWatcherGetStatusResponder {
6623    /// Sends a response to the FIDL transaction.
6624    ///
6625    /// Sets the channel to shutdown if an error occurs.
6626    pub fn send(self, mut status: ParentViewportStatus) -> Result<(), fidl::Error> {
6627        let _result = self.send_raw(status);
6628        if _result.is_err() {
6629            self.control_handle.shutdown();
6630        }
6631        self.drop_without_shutdown();
6632        _result
6633    }
6634
6635    /// Similar to "send" but does not shutdown the channel if an error occurs.
6636    pub fn send_no_shutdown_on_err(
6637        self,
6638        mut status: ParentViewportStatus,
6639    ) -> Result<(), fidl::Error> {
6640        let _result = self.send_raw(status);
6641        self.drop_without_shutdown();
6642        _result
6643    }
6644
6645    fn send_raw(&self, mut status: ParentViewportStatus) -> Result<(), fidl::Error> {
6646        self.control_handle.inner.send::<ParentViewportWatcherGetStatusResponse>(
6647            (status,),
6648            self.tx_id,
6649            0x7caa022f050d9ea6,
6650            fidl::encoding::DynamicFlags::empty(),
6651        )
6652    }
6653}
6654
6655#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
6656pub struct ScreenCaptureMarker;
6657
6658impl fidl::endpoints::ProtocolMarker for ScreenCaptureMarker {
6659    type Proxy = ScreenCaptureProxy;
6660    type RequestStream = ScreenCaptureRequestStream;
6661    #[cfg(target_os = "fuchsia")]
6662    type SynchronousProxy = ScreenCaptureSynchronousProxy;
6663
6664    const DEBUG_NAME: &'static str = "fuchsia.ui.composition.ScreenCapture";
6665}
6666impl fidl::endpoints::DiscoverableProtocolMarker for ScreenCaptureMarker {}
6667pub type ScreenCaptureConfigureResult = Result<(), ScreenCaptureError>;
6668pub type ScreenCaptureGetNextFrameResult = Result<FrameInfo, ScreenCaptureError>;
6669pub type ScreenCaptureReleaseFrameResult = Result<(), ScreenCaptureError>;
6670
6671pub trait ScreenCaptureProxyInterface: Send + Sync {
6672    type ConfigureResponseFut: std::future::Future<Output = Result<ScreenCaptureConfigureResult, fidl::Error>>
6673        + Send;
6674    fn r#configure(&self, payload: ScreenCaptureConfig) -> Self::ConfigureResponseFut;
6675    type GetNextFrameResponseFut: std::future::Future<Output = Result<ScreenCaptureGetNextFrameResult, fidl::Error>>
6676        + Send;
6677    fn r#get_next_frame(&self, payload: GetNextFrameArgs) -> Self::GetNextFrameResponseFut;
6678    type ReleaseFrameResponseFut: std::future::Future<Output = Result<ScreenCaptureReleaseFrameResult, fidl::Error>>
6679        + Send;
6680    fn r#release_frame(&self, buffer_id: u32) -> Self::ReleaseFrameResponseFut;
6681}
6682#[derive(Debug)]
6683#[cfg(target_os = "fuchsia")]
6684pub struct ScreenCaptureSynchronousProxy {
6685    client: fidl::client::sync::Client,
6686}
6687
6688#[cfg(target_os = "fuchsia")]
6689impl fidl::endpoints::SynchronousProxy for ScreenCaptureSynchronousProxy {
6690    type Proxy = ScreenCaptureProxy;
6691    type Protocol = ScreenCaptureMarker;
6692
6693    fn from_channel(inner: fidl::Channel) -> Self {
6694        Self::new(inner)
6695    }
6696
6697    fn into_channel(self) -> fidl::Channel {
6698        self.client.into_channel()
6699    }
6700
6701    fn as_channel(&self) -> &fidl::Channel {
6702        self.client.as_channel()
6703    }
6704}
6705
6706#[cfg(target_os = "fuchsia")]
6707impl ScreenCaptureSynchronousProxy {
6708    pub fn new(channel: fidl::Channel) -> Self {
6709        Self { client: fidl::client::sync::Client::new(channel) }
6710    }
6711
6712    pub fn into_channel(self) -> fidl::Channel {
6713        self.client.into_channel()
6714    }
6715
6716    /// Waits until an event arrives and returns it. It is safe for other
6717    /// threads to make concurrent requests while waiting for an event.
6718    pub fn wait_for_event(
6719        &self,
6720        deadline: zx::MonotonicInstant,
6721    ) -> Result<ScreenCaptureEvent, fidl::Error> {
6722        ScreenCaptureEvent::decode(self.client.wait_for_event::<ScreenCaptureMarker>(deadline)?)
6723    }
6724
6725    /// Clients should first use the Allocator protocol to register a
6726    /// BufferCollection. This function will fail with BAD_OPERATION unless all clients of the
6727    /// BufferCollection have set their constraints.
6728    ///
6729    /// Afterwards, clients should create and configure the images that will
6730    /// eventually be rendered to using this method. All the buffers in the
6731    /// collection from 0 to (buffer_count-1) may be used for screen capture.
6732    ///
6733    /// Clients are responsible for determining the rotation of the display,
6734    /// and applying the corrective rotation. For instance, if the display is
6735    /// mounted 90 degrees clockwise (the "top" is on the right, when looking
6736    /// at the display), then the client should specify a 270 degree rotation
6737    /// to account for it.
6738    ///
6739    /// Similarly, the clients are responsible for specifying a buffer big
6740    /// enough for the rotated image. If the buffer is too small, a best effort
6741    /// attempt will be made to render the image.
6742    ///
6743    /// Finally, clients request the server to render the current screen to the
6744    /// shared buffers using [`GetNextFrame`].
6745    ///
6746    /// [`Configure`] can be called again with a new BufferCollectionImportToken
6747    /// if the client wishes to change any of the configuration settings. In
6748    /// this case all the buffers from the previous call to [`Configure`] will
6749    /// be released.
6750    pub fn r#configure(
6751        &self,
6752        mut payload: ScreenCaptureConfig,
6753        ___deadline: zx::MonotonicInstant,
6754    ) -> Result<ScreenCaptureConfigureResult, fidl::Error> {
6755        let _response = self.client.send_query::<ScreenCaptureConfig, fidl::encoding::ResultType<
6756            fidl::encoding::EmptyStruct,
6757            ScreenCaptureError,
6758        >, ScreenCaptureMarker>(
6759            &mut payload,
6760            0x3b6e5af1d294afd9,
6761            fidl::encoding::DynamicFlags::empty(),
6762            ___deadline,
6763        )?;
6764        Ok(_response.map(|x| x))
6765    }
6766
6767    /// Following a successful call to [`Configure`], clients can call
6768    /// GetNextFrame. This will populate a buffer with the most recent frame.
6769    ///
6770    /// Clients should wait on the zx::event they pass for successful
6771    /// completion of the screenshot. It is not guaranteed that the screenshot
6772    /// will be completed by the time this function returns.
6773    ///
6774    /// The requested image will be in the BufferCollection that the client set
6775    /// up in the VMO at the index specified by buffer_id.
6776    ///
6777    /// When ScreenCapture is used to provide a stream, the rate that the
6778    /// client calls GetNextFrame will drive the frame rate.
6779    ///
6780    /// Errors:
6781    /// BAD_OPERATION if Configure was not called, or not called successfully
6782    /// MISSING_ARGS if a required argument is not present
6783    /// BUFFER_FULL if all buffers in the BufferCollection are in use. In this case, ReleaseFrame
6784    /// must be called to make a buffer available before this function can be called successfully.
6785    pub fn r#get_next_frame(
6786        &self,
6787        mut payload: GetNextFrameArgs,
6788        ___deadline: zx::MonotonicInstant,
6789    ) -> Result<ScreenCaptureGetNextFrameResult, fidl::Error> {
6790        let _response = self.client.send_query::<
6791            GetNextFrameArgs,
6792            fidl::encoding::ResultType<FrameInfo, ScreenCaptureError>,
6793            ScreenCaptureMarker,
6794        >(
6795            &mut payload,
6796            0x552c1580aab8c4a7,
6797            fidl::encoding::DynamicFlags::empty(),
6798            ___deadline,
6799        )?;
6800        Ok(_response.map(|x| x))
6801    }
6802
6803    /// Once the client no longer needs an image, they can call ReleaseFrame on
6804    /// the VMO index of the buffer so that the server can reuse it in the future.
6805    pub fn r#release_frame(
6806        &self,
6807        mut buffer_id: u32,
6808        ___deadline: zx::MonotonicInstant,
6809    ) -> Result<ScreenCaptureReleaseFrameResult, fidl::Error> {
6810        let _response =
6811            self.client.send_query::<ScreenCaptureReleaseFrameRequest, fidl::encoding::ResultType<
6812                fidl::encoding::EmptyStruct,
6813                ScreenCaptureError,
6814            >, ScreenCaptureMarker>(
6815                (buffer_id,),
6816                0x46704dce24e35950,
6817                fidl::encoding::DynamicFlags::empty(),
6818                ___deadline,
6819            )?;
6820        Ok(_response.map(|x| x))
6821    }
6822}
6823
6824#[cfg(target_os = "fuchsia")]
6825impl From<ScreenCaptureSynchronousProxy> for zx::NullableHandle {
6826    fn from(value: ScreenCaptureSynchronousProxy) -> Self {
6827        value.into_channel().into()
6828    }
6829}
6830
6831#[cfg(target_os = "fuchsia")]
6832impl From<fidl::Channel> for ScreenCaptureSynchronousProxy {
6833    fn from(value: fidl::Channel) -> Self {
6834        Self::new(value)
6835    }
6836}
6837
6838#[cfg(target_os = "fuchsia")]
6839impl fidl::endpoints::FromClient for ScreenCaptureSynchronousProxy {
6840    type Protocol = ScreenCaptureMarker;
6841
6842    fn from_client(value: fidl::endpoints::ClientEnd<ScreenCaptureMarker>) -> Self {
6843        Self::new(value.into_channel())
6844    }
6845}
6846
6847#[derive(Debug, Clone)]
6848pub struct ScreenCaptureProxy {
6849    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
6850}
6851
6852impl fidl::endpoints::Proxy for ScreenCaptureProxy {
6853    type Protocol = ScreenCaptureMarker;
6854
6855    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
6856        Self::new(inner)
6857    }
6858
6859    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
6860        self.client.into_channel().map_err(|client| Self { client })
6861    }
6862
6863    fn as_channel(&self) -> &::fidl::AsyncChannel {
6864        self.client.as_channel()
6865    }
6866}
6867
6868impl ScreenCaptureProxy {
6869    /// Create a new Proxy for fuchsia.ui.composition/ScreenCapture.
6870    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
6871        let protocol_name = <ScreenCaptureMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
6872        Self { client: fidl::client::Client::new(channel, protocol_name) }
6873    }
6874
6875    /// Get a Stream of events from the remote end of the protocol.
6876    ///
6877    /// # Panics
6878    ///
6879    /// Panics if the event stream was already taken.
6880    pub fn take_event_stream(&self) -> ScreenCaptureEventStream {
6881        ScreenCaptureEventStream { event_receiver: self.client.take_event_receiver() }
6882    }
6883
6884    /// Clients should first use the Allocator protocol to register a
6885    /// BufferCollection. This function will fail with BAD_OPERATION unless all clients of the
6886    /// BufferCollection have set their constraints.
6887    ///
6888    /// Afterwards, clients should create and configure the images that will
6889    /// eventually be rendered to using this method. All the buffers in the
6890    /// collection from 0 to (buffer_count-1) may be used for screen capture.
6891    ///
6892    /// Clients are responsible for determining the rotation of the display,
6893    /// and applying the corrective rotation. For instance, if the display is
6894    /// mounted 90 degrees clockwise (the "top" is on the right, when looking
6895    /// at the display), then the client should specify a 270 degree rotation
6896    /// to account for it.
6897    ///
6898    /// Similarly, the clients are responsible for specifying a buffer big
6899    /// enough for the rotated image. If the buffer is too small, a best effort
6900    /// attempt will be made to render the image.
6901    ///
6902    /// Finally, clients request the server to render the current screen to the
6903    /// shared buffers using [`GetNextFrame`].
6904    ///
6905    /// [`Configure`] can be called again with a new BufferCollectionImportToken
6906    /// if the client wishes to change any of the configuration settings. In
6907    /// this case all the buffers from the previous call to [`Configure`] will
6908    /// be released.
6909    pub fn r#configure(
6910        &self,
6911        mut payload: ScreenCaptureConfig,
6912    ) -> fidl::client::QueryResponseFut<
6913        ScreenCaptureConfigureResult,
6914        fidl::encoding::DefaultFuchsiaResourceDialect,
6915    > {
6916        ScreenCaptureProxyInterface::r#configure(self, payload)
6917    }
6918
6919    /// Following a successful call to [`Configure`], clients can call
6920    /// GetNextFrame. This will populate a buffer with the most recent frame.
6921    ///
6922    /// Clients should wait on the zx::event they pass for successful
6923    /// completion of the screenshot. It is not guaranteed that the screenshot
6924    /// will be completed by the time this function returns.
6925    ///
6926    /// The requested image will be in the BufferCollection that the client set
6927    /// up in the VMO at the index specified by buffer_id.
6928    ///
6929    /// When ScreenCapture is used to provide a stream, the rate that the
6930    /// client calls GetNextFrame will drive the frame rate.
6931    ///
6932    /// Errors:
6933    /// BAD_OPERATION if Configure was not called, or not called successfully
6934    /// MISSING_ARGS if a required argument is not present
6935    /// BUFFER_FULL if all buffers in the BufferCollection are in use. In this case, ReleaseFrame
6936    /// must be called to make a buffer available before this function can be called successfully.
6937    pub fn r#get_next_frame(
6938        &self,
6939        mut payload: GetNextFrameArgs,
6940    ) -> fidl::client::QueryResponseFut<
6941        ScreenCaptureGetNextFrameResult,
6942        fidl::encoding::DefaultFuchsiaResourceDialect,
6943    > {
6944        ScreenCaptureProxyInterface::r#get_next_frame(self, payload)
6945    }
6946
6947    /// Once the client no longer needs an image, they can call ReleaseFrame on
6948    /// the VMO index of the buffer so that the server can reuse it in the future.
6949    pub fn r#release_frame(
6950        &self,
6951        mut buffer_id: u32,
6952    ) -> fidl::client::QueryResponseFut<
6953        ScreenCaptureReleaseFrameResult,
6954        fidl::encoding::DefaultFuchsiaResourceDialect,
6955    > {
6956        ScreenCaptureProxyInterface::r#release_frame(self, buffer_id)
6957    }
6958}
6959
6960impl ScreenCaptureProxyInterface for ScreenCaptureProxy {
6961    type ConfigureResponseFut = fidl::client::QueryResponseFut<
6962        ScreenCaptureConfigureResult,
6963        fidl::encoding::DefaultFuchsiaResourceDialect,
6964    >;
6965    fn r#configure(&self, mut payload: ScreenCaptureConfig) -> Self::ConfigureResponseFut {
6966        fn _decode(
6967            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6968        ) -> Result<ScreenCaptureConfigureResult, fidl::Error> {
6969            let _response = fidl::client::decode_transaction_body::<
6970                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, ScreenCaptureError>,
6971                fidl::encoding::DefaultFuchsiaResourceDialect,
6972                0x3b6e5af1d294afd9,
6973            >(_buf?)?;
6974            Ok(_response.map(|x| x))
6975        }
6976        self.client.send_query_and_decode::<ScreenCaptureConfig, ScreenCaptureConfigureResult>(
6977            &mut payload,
6978            0x3b6e5af1d294afd9,
6979            fidl::encoding::DynamicFlags::empty(),
6980            _decode,
6981        )
6982    }
6983
6984    type GetNextFrameResponseFut = fidl::client::QueryResponseFut<
6985        ScreenCaptureGetNextFrameResult,
6986        fidl::encoding::DefaultFuchsiaResourceDialect,
6987    >;
6988    fn r#get_next_frame(&self, mut payload: GetNextFrameArgs) -> Self::GetNextFrameResponseFut {
6989        fn _decode(
6990            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6991        ) -> Result<ScreenCaptureGetNextFrameResult, fidl::Error> {
6992            let _response = fidl::client::decode_transaction_body::<
6993                fidl::encoding::ResultType<FrameInfo, ScreenCaptureError>,
6994                fidl::encoding::DefaultFuchsiaResourceDialect,
6995                0x552c1580aab8c4a7,
6996            >(_buf?)?;
6997            Ok(_response.map(|x| x))
6998        }
6999        self.client.send_query_and_decode::<GetNextFrameArgs, ScreenCaptureGetNextFrameResult>(
7000            &mut payload,
7001            0x552c1580aab8c4a7,
7002            fidl::encoding::DynamicFlags::empty(),
7003            _decode,
7004        )
7005    }
7006
7007    type ReleaseFrameResponseFut = fidl::client::QueryResponseFut<
7008        ScreenCaptureReleaseFrameResult,
7009        fidl::encoding::DefaultFuchsiaResourceDialect,
7010    >;
7011    fn r#release_frame(&self, mut buffer_id: u32) -> Self::ReleaseFrameResponseFut {
7012        fn _decode(
7013            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7014        ) -> Result<ScreenCaptureReleaseFrameResult, fidl::Error> {
7015            let _response = fidl::client::decode_transaction_body::<
7016                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, ScreenCaptureError>,
7017                fidl::encoding::DefaultFuchsiaResourceDialect,
7018                0x46704dce24e35950,
7019            >(_buf?)?;
7020            Ok(_response.map(|x| x))
7021        }
7022        self.client.send_query_and_decode::<
7023            ScreenCaptureReleaseFrameRequest,
7024            ScreenCaptureReleaseFrameResult,
7025        >(
7026            (buffer_id,),
7027            0x46704dce24e35950,
7028            fidl::encoding::DynamicFlags::empty(),
7029            _decode,
7030        )
7031    }
7032}
7033
7034pub struct ScreenCaptureEventStream {
7035    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
7036}
7037
7038impl std::marker::Unpin for ScreenCaptureEventStream {}
7039
7040impl futures::stream::FusedStream for ScreenCaptureEventStream {
7041    fn is_terminated(&self) -> bool {
7042        self.event_receiver.is_terminated()
7043    }
7044}
7045
7046impl futures::Stream for ScreenCaptureEventStream {
7047    type Item = Result<ScreenCaptureEvent, fidl::Error>;
7048
7049    fn poll_next(
7050        mut self: std::pin::Pin<&mut Self>,
7051        cx: &mut std::task::Context<'_>,
7052    ) -> std::task::Poll<Option<Self::Item>> {
7053        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
7054            &mut self.event_receiver,
7055            cx
7056        )?) {
7057            Some(buf) => std::task::Poll::Ready(Some(ScreenCaptureEvent::decode(buf))),
7058            None => std::task::Poll::Ready(None),
7059        }
7060    }
7061}
7062
7063#[derive(Debug)]
7064pub enum ScreenCaptureEvent {}
7065
7066impl ScreenCaptureEvent {
7067    /// Decodes a message buffer as a [`ScreenCaptureEvent`].
7068    fn decode(
7069        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
7070    ) -> Result<ScreenCaptureEvent, fidl::Error> {
7071        let (bytes, _handles) = buf.split_mut();
7072        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7073        debug_assert_eq!(tx_header.tx_id, 0);
7074        match tx_header.ordinal {
7075            _ => Err(fidl::Error::UnknownOrdinal {
7076                ordinal: tx_header.ordinal,
7077                protocol_name: <ScreenCaptureMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
7078            }),
7079        }
7080    }
7081}
7082
7083/// A Stream of incoming requests for fuchsia.ui.composition/ScreenCapture.
7084pub struct ScreenCaptureRequestStream {
7085    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7086    is_terminated: bool,
7087}
7088
7089impl std::marker::Unpin for ScreenCaptureRequestStream {}
7090
7091impl futures::stream::FusedStream for ScreenCaptureRequestStream {
7092    fn is_terminated(&self) -> bool {
7093        self.is_terminated
7094    }
7095}
7096
7097impl fidl::endpoints::RequestStream for ScreenCaptureRequestStream {
7098    type Protocol = ScreenCaptureMarker;
7099    type ControlHandle = ScreenCaptureControlHandle;
7100
7101    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
7102        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
7103    }
7104
7105    fn control_handle(&self) -> Self::ControlHandle {
7106        ScreenCaptureControlHandle { inner: self.inner.clone() }
7107    }
7108
7109    fn into_inner(
7110        self,
7111    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
7112    {
7113        (self.inner, self.is_terminated)
7114    }
7115
7116    fn from_inner(
7117        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7118        is_terminated: bool,
7119    ) -> Self {
7120        Self { inner, is_terminated }
7121    }
7122}
7123
7124impl futures::Stream for ScreenCaptureRequestStream {
7125    type Item = Result<ScreenCaptureRequest, fidl::Error>;
7126
7127    fn poll_next(
7128        mut self: std::pin::Pin<&mut Self>,
7129        cx: &mut std::task::Context<'_>,
7130    ) -> std::task::Poll<Option<Self::Item>> {
7131        let this = &mut *self;
7132        if this.inner.check_shutdown(cx) {
7133            this.is_terminated = true;
7134            return std::task::Poll::Ready(None);
7135        }
7136        if this.is_terminated {
7137            panic!("polled ScreenCaptureRequestStream after completion");
7138        }
7139        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
7140            |bytes, handles| {
7141                match this.inner.channel().read_etc(cx, bytes, handles) {
7142                    std::task::Poll::Ready(Ok(())) => {}
7143                    std::task::Poll::Pending => return std::task::Poll::Pending,
7144                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
7145                        this.is_terminated = true;
7146                        return std::task::Poll::Ready(None);
7147                    }
7148                    std::task::Poll::Ready(Err(e)) => {
7149                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
7150                            e.into(),
7151                        ))));
7152                    }
7153                }
7154
7155                // A message has been received from the channel
7156                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7157
7158                std::task::Poll::Ready(Some(match header.ordinal {
7159                    0x3b6e5af1d294afd9 => {
7160                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7161                        let mut req = fidl::new_empty!(
7162                            ScreenCaptureConfig,
7163                            fidl::encoding::DefaultFuchsiaResourceDialect
7164                        );
7165                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ScreenCaptureConfig>(&header, _body_bytes, handles, &mut req)?;
7166                        let control_handle =
7167                            ScreenCaptureControlHandle { inner: this.inner.clone() };
7168                        Ok(ScreenCaptureRequest::Configure {
7169                            payload: req,
7170                            responder: ScreenCaptureConfigureResponder {
7171                                control_handle: std::mem::ManuallyDrop::new(control_handle),
7172                                tx_id: header.tx_id,
7173                            },
7174                        })
7175                    }
7176                    0x552c1580aab8c4a7 => {
7177                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7178                        let mut req = fidl::new_empty!(
7179                            GetNextFrameArgs,
7180                            fidl::encoding::DefaultFuchsiaResourceDialect
7181                        );
7182                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<GetNextFrameArgs>(&header, _body_bytes, handles, &mut req)?;
7183                        let control_handle =
7184                            ScreenCaptureControlHandle { inner: this.inner.clone() };
7185                        Ok(ScreenCaptureRequest::GetNextFrame {
7186                            payload: req,
7187                            responder: ScreenCaptureGetNextFrameResponder {
7188                                control_handle: std::mem::ManuallyDrop::new(control_handle),
7189                                tx_id: header.tx_id,
7190                            },
7191                        })
7192                    }
7193                    0x46704dce24e35950 => {
7194                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7195                        let mut req = fidl::new_empty!(
7196                            ScreenCaptureReleaseFrameRequest,
7197                            fidl::encoding::DefaultFuchsiaResourceDialect
7198                        );
7199                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ScreenCaptureReleaseFrameRequest>(&header, _body_bytes, handles, &mut req)?;
7200                        let control_handle =
7201                            ScreenCaptureControlHandle { inner: this.inner.clone() };
7202                        Ok(ScreenCaptureRequest::ReleaseFrame {
7203                            buffer_id: req.buffer_id,
7204
7205                            responder: ScreenCaptureReleaseFrameResponder {
7206                                control_handle: std::mem::ManuallyDrop::new(control_handle),
7207                                tx_id: header.tx_id,
7208                            },
7209                        })
7210                    }
7211                    _ => Err(fidl::Error::UnknownOrdinal {
7212                        ordinal: header.ordinal,
7213                        protocol_name:
7214                            <ScreenCaptureMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
7215                    }),
7216                }))
7217            },
7218        )
7219    }
7220}
7221
7222/// This protocol provides a low-level ScreenCapture API for clients to use.
7223/// ScreenCapture clients should familiarize themselves with the
7224/// [`fuchsia.sysmem/BufferCollection`] and [`fuchsia.ui.composition/Allocator`] protocols
7225/// as those are necessary to create the BufferCollections and images ScreenCapture uses.
7226#[derive(Debug)]
7227pub enum ScreenCaptureRequest {
7228    /// Clients should first use the Allocator protocol to register a
7229    /// BufferCollection. This function will fail with BAD_OPERATION unless all clients of the
7230    /// BufferCollection have set their constraints.
7231    ///
7232    /// Afterwards, clients should create and configure the images that will
7233    /// eventually be rendered to using this method. All the buffers in the
7234    /// collection from 0 to (buffer_count-1) may be used for screen capture.
7235    ///
7236    /// Clients are responsible for determining the rotation of the display,
7237    /// and applying the corrective rotation. For instance, if the display is
7238    /// mounted 90 degrees clockwise (the "top" is on the right, when looking
7239    /// at the display), then the client should specify a 270 degree rotation
7240    /// to account for it.
7241    ///
7242    /// Similarly, the clients are responsible for specifying a buffer big
7243    /// enough for the rotated image. If the buffer is too small, a best effort
7244    /// attempt will be made to render the image.
7245    ///
7246    /// Finally, clients request the server to render the current screen to the
7247    /// shared buffers using [`GetNextFrame`].
7248    ///
7249    /// [`Configure`] can be called again with a new BufferCollectionImportToken
7250    /// if the client wishes to change any of the configuration settings. In
7251    /// this case all the buffers from the previous call to [`Configure`] will
7252    /// be released.
7253    Configure { payload: ScreenCaptureConfig, responder: ScreenCaptureConfigureResponder },
7254    /// Following a successful call to [`Configure`], clients can call
7255    /// GetNextFrame. This will populate a buffer with the most recent frame.
7256    ///
7257    /// Clients should wait on the zx::event they pass for successful
7258    /// completion of the screenshot. It is not guaranteed that the screenshot
7259    /// will be completed by the time this function returns.
7260    ///
7261    /// The requested image will be in the BufferCollection that the client set
7262    /// up in the VMO at the index specified by buffer_id.
7263    ///
7264    /// When ScreenCapture is used to provide a stream, the rate that the
7265    /// client calls GetNextFrame will drive the frame rate.
7266    ///
7267    /// Errors:
7268    /// BAD_OPERATION if Configure was not called, or not called successfully
7269    /// MISSING_ARGS if a required argument is not present
7270    /// BUFFER_FULL if all buffers in the BufferCollection are in use. In this case, ReleaseFrame
7271    /// must be called to make a buffer available before this function can be called successfully.
7272    GetNextFrame { payload: GetNextFrameArgs, responder: ScreenCaptureGetNextFrameResponder },
7273    /// Once the client no longer needs an image, they can call ReleaseFrame on
7274    /// the VMO index of the buffer so that the server can reuse it in the future.
7275    ReleaseFrame { buffer_id: u32, responder: ScreenCaptureReleaseFrameResponder },
7276}
7277
7278impl ScreenCaptureRequest {
7279    #[allow(irrefutable_let_patterns)]
7280    pub fn into_configure(self) -> Option<(ScreenCaptureConfig, ScreenCaptureConfigureResponder)> {
7281        if let ScreenCaptureRequest::Configure { payload, responder } = self {
7282            Some((payload, responder))
7283        } else {
7284            None
7285        }
7286    }
7287
7288    #[allow(irrefutable_let_patterns)]
7289    pub fn into_get_next_frame(
7290        self,
7291    ) -> Option<(GetNextFrameArgs, ScreenCaptureGetNextFrameResponder)> {
7292        if let ScreenCaptureRequest::GetNextFrame { payload, responder } = self {
7293            Some((payload, responder))
7294        } else {
7295            None
7296        }
7297    }
7298
7299    #[allow(irrefutable_let_patterns)]
7300    pub fn into_release_frame(self) -> Option<(u32, ScreenCaptureReleaseFrameResponder)> {
7301        if let ScreenCaptureRequest::ReleaseFrame { buffer_id, responder } = self {
7302            Some((buffer_id, responder))
7303        } else {
7304            None
7305        }
7306    }
7307
7308    /// Name of the method defined in FIDL
7309    pub fn method_name(&self) -> &'static str {
7310        match *self {
7311            ScreenCaptureRequest::Configure { .. } => "configure",
7312            ScreenCaptureRequest::GetNextFrame { .. } => "get_next_frame",
7313            ScreenCaptureRequest::ReleaseFrame { .. } => "release_frame",
7314        }
7315    }
7316}
7317
7318#[derive(Debug, Clone)]
7319pub struct ScreenCaptureControlHandle {
7320    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7321}
7322
7323impl ScreenCaptureControlHandle {
7324    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
7325        self.inner.shutdown_with_epitaph(status.into())
7326    }
7327}
7328
7329impl fidl::endpoints::ControlHandle for ScreenCaptureControlHandle {
7330    fn shutdown(&self) {
7331        self.inner.shutdown()
7332    }
7333
7334    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
7335        self.inner.shutdown_with_epitaph(status)
7336    }
7337
7338    fn is_closed(&self) -> bool {
7339        self.inner.channel().is_closed()
7340    }
7341    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
7342        self.inner.channel().on_closed()
7343    }
7344
7345    #[cfg(target_os = "fuchsia")]
7346    fn signal_peer(
7347        &self,
7348        clear_mask: zx::Signals,
7349        set_mask: zx::Signals,
7350    ) -> Result<(), zx_status::Status> {
7351        use fidl::Peered;
7352        self.inner.channel().signal_peer(clear_mask, set_mask)
7353    }
7354}
7355
7356impl ScreenCaptureControlHandle {}
7357
7358#[must_use = "FIDL methods require a response to be sent"]
7359#[derive(Debug)]
7360pub struct ScreenCaptureConfigureResponder {
7361    control_handle: std::mem::ManuallyDrop<ScreenCaptureControlHandle>,
7362    tx_id: u32,
7363}
7364
7365/// Set the the channel to be shutdown (see [`ScreenCaptureControlHandle::shutdown`])
7366/// if the responder is dropped without sending a response, so that the client
7367/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7368impl std::ops::Drop for ScreenCaptureConfigureResponder {
7369    fn drop(&mut self) {
7370        self.control_handle.shutdown();
7371        // Safety: drops once, never accessed again
7372        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7373    }
7374}
7375
7376impl fidl::endpoints::Responder for ScreenCaptureConfigureResponder {
7377    type ControlHandle = ScreenCaptureControlHandle;
7378
7379    fn control_handle(&self) -> &ScreenCaptureControlHandle {
7380        &self.control_handle
7381    }
7382
7383    fn drop_without_shutdown(mut self) {
7384        // Safety: drops once, never accessed again due to mem::forget
7385        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7386        // Prevent Drop from running (which would shut down the channel)
7387        std::mem::forget(self);
7388    }
7389}
7390
7391impl ScreenCaptureConfigureResponder {
7392    /// Sends a response to the FIDL transaction.
7393    ///
7394    /// Sets the channel to shutdown if an error occurs.
7395    pub fn send(self, mut result: Result<(), ScreenCaptureError>) -> Result<(), fidl::Error> {
7396        let _result = self.send_raw(result);
7397        if _result.is_err() {
7398            self.control_handle.shutdown();
7399        }
7400        self.drop_without_shutdown();
7401        _result
7402    }
7403
7404    /// Similar to "send" but does not shutdown the channel if an error occurs.
7405    pub fn send_no_shutdown_on_err(
7406        self,
7407        mut result: Result<(), ScreenCaptureError>,
7408    ) -> Result<(), fidl::Error> {
7409        let _result = self.send_raw(result);
7410        self.drop_without_shutdown();
7411        _result
7412    }
7413
7414    fn send_raw(&self, mut result: Result<(), ScreenCaptureError>) -> Result<(), fidl::Error> {
7415        self.control_handle.inner.send::<fidl::encoding::ResultType<
7416            fidl::encoding::EmptyStruct,
7417            ScreenCaptureError,
7418        >>(
7419            result,
7420            self.tx_id,
7421            0x3b6e5af1d294afd9,
7422            fidl::encoding::DynamicFlags::empty(),
7423        )
7424    }
7425}
7426
7427#[must_use = "FIDL methods require a response to be sent"]
7428#[derive(Debug)]
7429pub struct ScreenCaptureGetNextFrameResponder {
7430    control_handle: std::mem::ManuallyDrop<ScreenCaptureControlHandle>,
7431    tx_id: u32,
7432}
7433
7434/// Set the the channel to be shutdown (see [`ScreenCaptureControlHandle::shutdown`])
7435/// if the responder is dropped without sending a response, so that the client
7436/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7437impl std::ops::Drop for ScreenCaptureGetNextFrameResponder {
7438    fn drop(&mut self) {
7439        self.control_handle.shutdown();
7440        // Safety: drops once, never accessed again
7441        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7442    }
7443}
7444
7445impl fidl::endpoints::Responder for ScreenCaptureGetNextFrameResponder {
7446    type ControlHandle = ScreenCaptureControlHandle;
7447
7448    fn control_handle(&self) -> &ScreenCaptureControlHandle {
7449        &self.control_handle
7450    }
7451
7452    fn drop_without_shutdown(mut self) {
7453        // Safety: drops once, never accessed again due to mem::forget
7454        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7455        // Prevent Drop from running (which would shut down the channel)
7456        std::mem::forget(self);
7457    }
7458}
7459
7460impl ScreenCaptureGetNextFrameResponder {
7461    /// Sends a response to the FIDL transaction.
7462    ///
7463    /// Sets the channel to shutdown if an error occurs.
7464    pub fn send(
7465        self,
7466        mut result: Result<FrameInfo, ScreenCaptureError>,
7467    ) -> Result<(), fidl::Error> {
7468        let _result = self.send_raw(result);
7469        if _result.is_err() {
7470            self.control_handle.shutdown();
7471        }
7472        self.drop_without_shutdown();
7473        _result
7474    }
7475
7476    /// Similar to "send" but does not shutdown the channel if an error occurs.
7477    pub fn send_no_shutdown_on_err(
7478        self,
7479        mut result: Result<FrameInfo, ScreenCaptureError>,
7480    ) -> Result<(), fidl::Error> {
7481        let _result = self.send_raw(result);
7482        self.drop_without_shutdown();
7483        _result
7484    }
7485
7486    fn send_raw(
7487        &self,
7488        mut result: Result<FrameInfo, ScreenCaptureError>,
7489    ) -> Result<(), fidl::Error> {
7490        self.control_handle.inner.send::<fidl::encoding::ResultType<FrameInfo, ScreenCaptureError>>(
7491            result.as_mut().map_err(|e| *e),
7492            self.tx_id,
7493            0x552c1580aab8c4a7,
7494            fidl::encoding::DynamicFlags::empty(),
7495        )
7496    }
7497}
7498
7499#[must_use = "FIDL methods require a response to be sent"]
7500#[derive(Debug)]
7501pub struct ScreenCaptureReleaseFrameResponder {
7502    control_handle: std::mem::ManuallyDrop<ScreenCaptureControlHandle>,
7503    tx_id: u32,
7504}
7505
7506/// Set the the channel to be shutdown (see [`ScreenCaptureControlHandle::shutdown`])
7507/// if the responder is dropped without sending a response, so that the client
7508/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7509impl std::ops::Drop for ScreenCaptureReleaseFrameResponder {
7510    fn drop(&mut self) {
7511        self.control_handle.shutdown();
7512        // Safety: drops once, never accessed again
7513        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7514    }
7515}
7516
7517impl fidl::endpoints::Responder for ScreenCaptureReleaseFrameResponder {
7518    type ControlHandle = ScreenCaptureControlHandle;
7519
7520    fn control_handle(&self) -> &ScreenCaptureControlHandle {
7521        &self.control_handle
7522    }
7523
7524    fn drop_without_shutdown(mut self) {
7525        // Safety: drops once, never accessed again due to mem::forget
7526        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7527        // Prevent Drop from running (which would shut down the channel)
7528        std::mem::forget(self);
7529    }
7530}
7531
7532impl ScreenCaptureReleaseFrameResponder {
7533    /// Sends a response to the FIDL transaction.
7534    ///
7535    /// Sets the channel to shutdown if an error occurs.
7536    pub fn send(self, mut result: Result<(), ScreenCaptureError>) -> Result<(), fidl::Error> {
7537        let _result = self.send_raw(result);
7538        if _result.is_err() {
7539            self.control_handle.shutdown();
7540        }
7541        self.drop_without_shutdown();
7542        _result
7543    }
7544
7545    /// Similar to "send" but does not shutdown the channel if an error occurs.
7546    pub fn send_no_shutdown_on_err(
7547        self,
7548        mut result: Result<(), ScreenCaptureError>,
7549    ) -> Result<(), fidl::Error> {
7550        let _result = self.send_raw(result);
7551        self.drop_without_shutdown();
7552        _result
7553    }
7554
7555    fn send_raw(&self, mut result: Result<(), ScreenCaptureError>) -> Result<(), fidl::Error> {
7556        self.control_handle.inner.send::<fidl::encoding::ResultType<
7557            fidl::encoding::EmptyStruct,
7558            ScreenCaptureError,
7559        >>(
7560            result,
7561            self.tx_id,
7562            0x46704dce24e35950,
7563            fidl::encoding::DynamicFlags::empty(),
7564        )
7565    }
7566}
7567
7568#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
7569pub struct ScreenshotMarker;
7570
7571impl fidl::endpoints::ProtocolMarker for ScreenshotMarker {
7572    type Proxy = ScreenshotProxy;
7573    type RequestStream = ScreenshotRequestStream;
7574    #[cfg(target_os = "fuchsia")]
7575    type SynchronousProxy = ScreenshotSynchronousProxy;
7576
7577    const DEBUG_NAME: &'static str = "fuchsia.ui.composition.Screenshot";
7578}
7579impl fidl::endpoints::DiscoverableProtocolMarker for ScreenshotMarker {}
7580
7581pub trait ScreenshotProxyInterface: Send + Sync {
7582    type TakeResponseFut: std::future::Future<Output = Result<ScreenshotTakeResponse, fidl::Error>>
7583        + Send;
7584    fn r#take(&self, payload: ScreenshotTakeRequest) -> Self::TakeResponseFut;
7585    type TakeFileResponseFut: std::future::Future<Output = Result<ScreenshotTakeFileResponse, fidl::Error>>
7586        + Send;
7587    fn r#take_file(&self, payload: ScreenshotTakeFileRequest) -> Self::TakeFileResponseFut;
7588}
7589#[derive(Debug)]
7590#[cfg(target_os = "fuchsia")]
7591pub struct ScreenshotSynchronousProxy {
7592    client: fidl::client::sync::Client,
7593}
7594
7595#[cfg(target_os = "fuchsia")]
7596impl fidl::endpoints::SynchronousProxy for ScreenshotSynchronousProxy {
7597    type Proxy = ScreenshotProxy;
7598    type Protocol = ScreenshotMarker;
7599
7600    fn from_channel(inner: fidl::Channel) -> Self {
7601        Self::new(inner)
7602    }
7603
7604    fn into_channel(self) -> fidl::Channel {
7605        self.client.into_channel()
7606    }
7607
7608    fn as_channel(&self) -> &fidl::Channel {
7609        self.client.as_channel()
7610    }
7611}
7612
7613#[cfg(target_os = "fuchsia")]
7614impl ScreenshotSynchronousProxy {
7615    pub fn new(channel: fidl::Channel) -> Self {
7616        Self { client: fidl::client::sync::Client::new(channel) }
7617    }
7618
7619    pub fn into_channel(self) -> fidl::Channel {
7620        self.client.into_channel()
7621    }
7622
7623    /// Waits until an event arrives and returns it. It is safe for other
7624    /// threads to make concurrent requests while waiting for an event.
7625    pub fn wait_for_event(
7626        &self,
7627        deadline: zx::MonotonicInstant,
7628    ) -> Result<ScreenshotEvent, fidl::Error> {
7629        ScreenshotEvent::decode(self.client.wait_for_event::<ScreenshotMarker>(deadline)?)
7630    }
7631
7632    /// Collects the current graphical content of a display in a specified buffer `format` in the
7633    /// sRGB color space. Note that the sRGB color space is non-linear, meaning that unit tests
7634    /// doing pixel equality checks making use of non-fully saturated colors should convert to a
7635    /// linear color space.
7636    ///
7637    /// See https://fuchsia.dev/fuchsia-src/concepts/ui/scenic/color_spaces for more information.
7638    ///
7639    /// Screenshot is taken immediately, populated with the display's content from the most recent
7640    /// VSYNC.
7641    ///
7642    /// If the client calls [`Take`] a second time before a first [`Take`] call returns, the server
7643    /// will close the Screenshot connection with a ZX_ERR_SHOULD_WAIT epitaph.
7644    ///
7645    /// If capture fails due to an internal error, the server will close the Screenshot connection
7646    /// with a ZX_ERR_INTERNAL epitaph.
7647    pub fn r#take(
7648        &self,
7649        mut payload: ScreenshotTakeRequest,
7650        ___deadline: zx::MonotonicInstant,
7651    ) -> Result<ScreenshotTakeResponse, fidl::Error> {
7652        let _response = self
7653            .client
7654            .send_query::<ScreenshotTakeRequest, ScreenshotTakeResponse, ScreenshotMarker>(
7655                &mut payload,
7656                0x51341396e9fd2fd0,
7657                fidl::encoding::DynamicFlags::empty(),
7658                ___deadline,
7659            )?;
7660        Ok(_response)
7661    }
7662
7663    /// Collects the current graphical content of a display in a specified buffer `format` in the
7664    /// sRGB color space. Note that the sRGB color space is non-linear, meaning that unit tests
7665    /// doing pixel equality checks making use of non-fully saturated colors should convert to a
7666    /// linear color space.
7667    ///
7668    /// TODO(https://fxbug.dev/42065844): Link to fuchsia.dev documentation when it's up.
7669    ///
7670    /// Screenshot is taken immediately, populated with the display's content from the most recent
7671    /// VSYNC.
7672    ///
7673    /// If the client calls [`TakeFile`] a second time before a first [`TakeFile`] call returns,
7674    /// the server will close the Screenshot connection with a ZX_ERR_SHOULD_WAIT epitaph.
7675    ///
7676    /// If capture fails due to an internal error, the server will close the Screenshot connection
7677    /// with a ZX_ERR_INTERNAL epitaph.
7678    ///
7679    /// This call should be used if the client is on the host and does not support VMOs,
7680    /// as is the case for ffx tools.
7681    pub fn r#take_file(
7682        &self,
7683        mut payload: ScreenshotTakeFileRequest,
7684        ___deadline: zx::MonotonicInstant,
7685    ) -> Result<ScreenshotTakeFileResponse, fidl::Error> {
7686        let _response = self
7687            .client
7688            .send_query::<ScreenshotTakeFileRequest, ScreenshotTakeFileResponse, ScreenshotMarker>(
7689                &mut payload,
7690                0x470aeea0a4d32903,
7691                fidl::encoding::DynamicFlags::empty(),
7692                ___deadline,
7693            )?;
7694        Ok(_response)
7695    }
7696}
7697
7698#[cfg(target_os = "fuchsia")]
7699impl From<ScreenshotSynchronousProxy> for zx::NullableHandle {
7700    fn from(value: ScreenshotSynchronousProxy) -> Self {
7701        value.into_channel().into()
7702    }
7703}
7704
7705#[cfg(target_os = "fuchsia")]
7706impl From<fidl::Channel> for ScreenshotSynchronousProxy {
7707    fn from(value: fidl::Channel) -> Self {
7708        Self::new(value)
7709    }
7710}
7711
7712#[cfg(target_os = "fuchsia")]
7713impl fidl::endpoints::FromClient for ScreenshotSynchronousProxy {
7714    type Protocol = ScreenshotMarker;
7715
7716    fn from_client(value: fidl::endpoints::ClientEnd<ScreenshotMarker>) -> Self {
7717        Self::new(value.into_channel())
7718    }
7719}
7720
7721#[derive(Debug, Clone)]
7722pub struct ScreenshotProxy {
7723    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
7724}
7725
7726impl fidl::endpoints::Proxy for ScreenshotProxy {
7727    type Protocol = ScreenshotMarker;
7728
7729    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
7730        Self::new(inner)
7731    }
7732
7733    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
7734        self.client.into_channel().map_err(|client| Self { client })
7735    }
7736
7737    fn as_channel(&self) -> &::fidl::AsyncChannel {
7738        self.client.as_channel()
7739    }
7740}
7741
7742impl ScreenshotProxy {
7743    /// Create a new Proxy for fuchsia.ui.composition/Screenshot.
7744    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
7745        let protocol_name = <ScreenshotMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
7746        Self { client: fidl::client::Client::new(channel, protocol_name) }
7747    }
7748
7749    /// Get a Stream of events from the remote end of the protocol.
7750    ///
7751    /// # Panics
7752    ///
7753    /// Panics if the event stream was already taken.
7754    pub fn take_event_stream(&self) -> ScreenshotEventStream {
7755        ScreenshotEventStream { event_receiver: self.client.take_event_receiver() }
7756    }
7757
7758    /// Collects the current graphical content of a display in a specified buffer `format` in the
7759    /// sRGB color space. Note that the sRGB color space is non-linear, meaning that unit tests
7760    /// doing pixel equality checks making use of non-fully saturated colors should convert to a
7761    /// linear color space.
7762    ///
7763    /// See https://fuchsia.dev/fuchsia-src/concepts/ui/scenic/color_spaces for more information.
7764    ///
7765    /// Screenshot is taken immediately, populated with the display's content from the most recent
7766    /// VSYNC.
7767    ///
7768    /// If the client calls [`Take`] a second time before a first [`Take`] call returns, the server
7769    /// will close the Screenshot connection with a ZX_ERR_SHOULD_WAIT epitaph.
7770    ///
7771    /// If capture fails due to an internal error, the server will close the Screenshot connection
7772    /// with a ZX_ERR_INTERNAL epitaph.
7773    pub fn r#take(
7774        &self,
7775        mut payload: ScreenshotTakeRequest,
7776    ) -> fidl::client::QueryResponseFut<
7777        ScreenshotTakeResponse,
7778        fidl::encoding::DefaultFuchsiaResourceDialect,
7779    > {
7780        ScreenshotProxyInterface::r#take(self, payload)
7781    }
7782
7783    /// Collects the current graphical content of a display in a specified buffer `format` in the
7784    /// sRGB color space. Note that the sRGB color space is non-linear, meaning that unit tests
7785    /// doing pixel equality checks making use of non-fully saturated colors should convert to a
7786    /// linear color space.
7787    ///
7788    /// TODO(https://fxbug.dev/42065844): Link to fuchsia.dev documentation when it's up.
7789    ///
7790    /// Screenshot is taken immediately, populated with the display's content from the most recent
7791    /// VSYNC.
7792    ///
7793    /// If the client calls [`TakeFile`] a second time before a first [`TakeFile`] call returns,
7794    /// the server will close the Screenshot connection with a ZX_ERR_SHOULD_WAIT epitaph.
7795    ///
7796    /// If capture fails due to an internal error, the server will close the Screenshot connection
7797    /// with a ZX_ERR_INTERNAL epitaph.
7798    ///
7799    /// This call should be used if the client is on the host and does not support VMOs,
7800    /// as is the case for ffx tools.
7801    pub fn r#take_file(
7802        &self,
7803        mut payload: ScreenshotTakeFileRequest,
7804    ) -> fidl::client::QueryResponseFut<
7805        ScreenshotTakeFileResponse,
7806        fidl::encoding::DefaultFuchsiaResourceDialect,
7807    > {
7808        ScreenshotProxyInterface::r#take_file(self, payload)
7809    }
7810}
7811
7812impl ScreenshotProxyInterface for ScreenshotProxy {
7813    type TakeResponseFut = fidl::client::QueryResponseFut<
7814        ScreenshotTakeResponse,
7815        fidl::encoding::DefaultFuchsiaResourceDialect,
7816    >;
7817    fn r#take(&self, mut payload: ScreenshotTakeRequest) -> Self::TakeResponseFut {
7818        fn _decode(
7819            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7820        ) -> Result<ScreenshotTakeResponse, fidl::Error> {
7821            let _response = fidl::client::decode_transaction_body::<
7822                ScreenshotTakeResponse,
7823                fidl::encoding::DefaultFuchsiaResourceDialect,
7824                0x51341396e9fd2fd0,
7825            >(_buf?)?;
7826            Ok(_response)
7827        }
7828        self.client.send_query_and_decode::<ScreenshotTakeRequest, ScreenshotTakeResponse>(
7829            &mut payload,
7830            0x51341396e9fd2fd0,
7831            fidl::encoding::DynamicFlags::empty(),
7832            _decode,
7833        )
7834    }
7835
7836    type TakeFileResponseFut = fidl::client::QueryResponseFut<
7837        ScreenshotTakeFileResponse,
7838        fidl::encoding::DefaultFuchsiaResourceDialect,
7839    >;
7840    fn r#take_file(&self, mut payload: ScreenshotTakeFileRequest) -> Self::TakeFileResponseFut {
7841        fn _decode(
7842            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7843        ) -> Result<ScreenshotTakeFileResponse, fidl::Error> {
7844            let _response = fidl::client::decode_transaction_body::<
7845                ScreenshotTakeFileResponse,
7846                fidl::encoding::DefaultFuchsiaResourceDialect,
7847                0x470aeea0a4d32903,
7848            >(_buf?)?;
7849            Ok(_response)
7850        }
7851        self.client.send_query_and_decode::<ScreenshotTakeFileRequest, ScreenshotTakeFileResponse>(
7852            &mut payload,
7853            0x470aeea0a4d32903,
7854            fidl::encoding::DynamicFlags::empty(),
7855            _decode,
7856        )
7857    }
7858}
7859
7860pub struct ScreenshotEventStream {
7861    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
7862}
7863
7864impl std::marker::Unpin for ScreenshotEventStream {}
7865
7866impl futures::stream::FusedStream for ScreenshotEventStream {
7867    fn is_terminated(&self) -> bool {
7868        self.event_receiver.is_terminated()
7869    }
7870}
7871
7872impl futures::Stream for ScreenshotEventStream {
7873    type Item = Result<ScreenshotEvent, fidl::Error>;
7874
7875    fn poll_next(
7876        mut self: std::pin::Pin<&mut Self>,
7877        cx: &mut std::task::Context<'_>,
7878    ) -> std::task::Poll<Option<Self::Item>> {
7879        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
7880            &mut self.event_receiver,
7881            cx
7882        )?) {
7883            Some(buf) => std::task::Poll::Ready(Some(ScreenshotEvent::decode(buf))),
7884            None => std::task::Poll::Ready(None),
7885        }
7886    }
7887}
7888
7889#[derive(Debug)]
7890pub enum ScreenshotEvent {}
7891
7892impl ScreenshotEvent {
7893    /// Decodes a message buffer as a [`ScreenshotEvent`].
7894    fn decode(
7895        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
7896    ) -> Result<ScreenshotEvent, fidl::Error> {
7897        let (bytes, _handles) = buf.split_mut();
7898        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7899        debug_assert_eq!(tx_header.tx_id, 0);
7900        match tx_header.ordinal {
7901            _ => Err(fidl::Error::UnknownOrdinal {
7902                ordinal: tx_header.ordinal,
7903                protocol_name: <ScreenshotMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
7904            }),
7905        }
7906    }
7907}
7908
7909/// A Stream of incoming requests for fuchsia.ui.composition/Screenshot.
7910pub struct ScreenshotRequestStream {
7911    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7912    is_terminated: bool,
7913}
7914
7915impl std::marker::Unpin for ScreenshotRequestStream {}
7916
7917impl futures::stream::FusedStream for ScreenshotRequestStream {
7918    fn is_terminated(&self) -> bool {
7919        self.is_terminated
7920    }
7921}
7922
7923impl fidl::endpoints::RequestStream for ScreenshotRequestStream {
7924    type Protocol = ScreenshotMarker;
7925    type ControlHandle = ScreenshotControlHandle;
7926
7927    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
7928        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
7929    }
7930
7931    fn control_handle(&self) -> Self::ControlHandle {
7932        ScreenshotControlHandle { inner: self.inner.clone() }
7933    }
7934
7935    fn into_inner(
7936        self,
7937    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
7938    {
7939        (self.inner, self.is_terminated)
7940    }
7941
7942    fn from_inner(
7943        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7944        is_terminated: bool,
7945    ) -> Self {
7946        Self { inner, is_terminated }
7947    }
7948}
7949
7950impl futures::Stream for ScreenshotRequestStream {
7951    type Item = Result<ScreenshotRequest, fidl::Error>;
7952
7953    fn poll_next(
7954        mut self: std::pin::Pin<&mut Self>,
7955        cx: &mut std::task::Context<'_>,
7956    ) -> std::task::Poll<Option<Self::Item>> {
7957        let this = &mut *self;
7958        if this.inner.check_shutdown(cx) {
7959            this.is_terminated = true;
7960            return std::task::Poll::Ready(None);
7961        }
7962        if this.is_terminated {
7963            panic!("polled ScreenshotRequestStream after completion");
7964        }
7965        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
7966            |bytes, handles| {
7967                match this.inner.channel().read_etc(cx, bytes, handles) {
7968                    std::task::Poll::Ready(Ok(())) => {}
7969                    std::task::Poll::Pending => return std::task::Poll::Pending,
7970                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
7971                        this.is_terminated = true;
7972                        return std::task::Poll::Ready(None);
7973                    }
7974                    std::task::Poll::Ready(Err(e)) => {
7975                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
7976                            e.into(),
7977                        ))));
7978                    }
7979                }
7980
7981                // A message has been received from the channel
7982                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7983
7984                std::task::Poll::Ready(Some(match header.ordinal {
7985                    0x51341396e9fd2fd0 => {
7986                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7987                        let mut req = fidl::new_empty!(
7988                            ScreenshotTakeRequest,
7989                            fidl::encoding::DefaultFuchsiaResourceDialect
7990                        );
7991                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ScreenshotTakeRequest>(&header, _body_bytes, handles, &mut req)?;
7992                        let control_handle = ScreenshotControlHandle { inner: this.inner.clone() };
7993                        Ok(ScreenshotRequest::Take {
7994                            payload: req,
7995                            responder: ScreenshotTakeResponder {
7996                                control_handle: std::mem::ManuallyDrop::new(control_handle),
7997                                tx_id: header.tx_id,
7998                            },
7999                        })
8000                    }
8001                    0x470aeea0a4d32903 => {
8002                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
8003                        let mut req = fidl::new_empty!(
8004                            ScreenshotTakeFileRequest,
8005                            fidl::encoding::DefaultFuchsiaResourceDialect
8006                        );
8007                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ScreenshotTakeFileRequest>(&header, _body_bytes, handles, &mut req)?;
8008                        let control_handle = ScreenshotControlHandle { inner: this.inner.clone() };
8009                        Ok(ScreenshotRequest::TakeFile {
8010                            payload: req,
8011                            responder: ScreenshotTakeFileResponder {
8012                                control_handle: std::mem::ManuallyDrop::new(control_handle),
8013                                tx_id: header.tx_id,
8014                            },
8015                        })
8016                    }
8017                    _ => Err(fidl::Error::UnknownOrdinal {
8018                        ordinal: header.ordinal,
8019                        protocol_name:
8020                            <ScreenshotMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
8021                    }),
8022                }))
8023            },
8024        )
8025    }
8026}
8027
8028/// Collects the current graphical content of a display.
8029#[derive(Debug)]
8030pub enum ScreenshotRequest {
8031    /// Collects the current graphical content of a display in a specified buffer `format` in the
8032    /// sRGB color space. Note that the sRGB color space is non-linear, meaning that unit tests
8033    /// doing pixel equality checks making use of non-fully saturated colors should convert to a
8034    /// linear color space.
8035    ///
8036    /// See https://fuchsia.dev/fuchsia-src/concepts/ui/scenic/color_spaces for more information.
8037    ///
8038    /// Screenshot is taken immediately, populated with the display's content from the most recent
8039    /// VSYNC.
8040    ///
8041    /// If the client calls [`Take`] a second time before a first [`Take`] call returns, the server
8042    /// will close the Screenshot connection with a ZX_ERR_SHOULD_WAIT epitaph.
8043    ///
8044    /// If capture fails due to an internal error, the server will close the Screenshot connection
8045    /// with a ZX_ERR_INTERNAL epitaph.
8046    Take { payload: ScreenshotTakeRequest, responder: ScreenshotTakeResponder },
8047    /// Collects the current graphical content of a display in a specified buffer `format` in the
8048    /// sRGB color space. Note that the sRGB color space is non-linear, meaning that unit tests
8049    /// doing pixel equality checks making use of non-fully saturated colors should convert to a
8050    /// linear color space.
8051    ///
8052    /// TODO(https://fxbug.dev/42065844): Link to fuchsia.dev documentation when it's up.
8053    ///
8054    /// Screenshot is taken immediately, populated with the display's content from the most recent
8055    /// VSYNC.
8056    ///
8057    /// If the client calls [`TakeFile`] a second time before a first [`TakeFile`] call returns,
8058    /// the server will close the Screenshot connection with a ZX_ERR_SHOULD_WAIT epitaph.
8059    ///
8060    /// If capture fails due to an internal error, the server will close the Screenshot connection
8061    /// with a ZX_ERR_INTERNAL epitaph.
8062    ///
8063    /// This call should be used if the client is on the host and does not support VMOs,
8064    /// as is the case for ffx tools.
8065    TakeFile { payload: ScreenshotTakeFileRequest, responder: ScreenshotTakeFileResponder },
8066}
8067
8068impl ScreenshotRequest {
8069    #[allow(irrefutable_let_patterns)]
8070    pub fn into_take(self) -> Option<(ScreenshotTakeRequest, ScreenshotTakeResponder)> {
8071        if let ScreenshotRequest::Take { payload, responder } = self {
8072            Some((payload, responder))
8073        } else {
8074            None
8075        }
8076    }
8077
8078    #[allow(irrefutable_let_patterns)]
8079    pub fn into_take_file(
8080        self,
8081    ) -> Option<(ScreenshotTakeFileRequest, ScreenshotTakeFileResponder)> {
8082        if let ScreenshotRequest::TakeFile { payload, responder } = self {
8083            Some((payload, responder))
8084        } else {
8085            None
8086        }
8087    }
8088
8089    /// Name of the method defined in FIDL
8090    pub fn method_name(&self) -> &'static str {
8091        match *self {
8092            ScreenshotRequest::Take { .. } => "take",
8093            ScreenshotRequest::TakeFile { .. } => "take_file",
8094        }
8095    }
8096}
8097
8098#[derive(Debug, Clone)]
8099pub struct ScreenshotControlHandle {
8100    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8101}
8102
8103impl ScreenshotControlHandle {
8104    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
8105        self.inner.shutdown_with_epitaph(status.into())
8106    }
8107}
8108
8109impl fidl::endpoints::ControlHandle for ScreenshotControlHandle {
8110    fn shutdown(&self) {
8111        self.inner.shutdown()
8112    }
8113
8114    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
8115        self.inner.shutdown_with_epitaph(status)
8116    }
8117
8118    fn is_closed(&self) -> bool {
8119        self.inner.channel().is_closed()
8120    }
8121    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
8122        self.inner.channel().on_closed()
8123    }
8124
8125    #[cfg(target_os = "fuchsia")]
8126    fn signal_peer(
8127        &self,
8128        clear_mask: zx::Signals,
8129        set_mask: zx::Signals,
8130    ) -> Result<(), zx_status::Status> {
8131        use fidl::Peered;
8132        self.inner.channel().signal_peer(clear_mask, set_mask)
8133    }
8134}
8135
8136impl ScreenshotControlHandle {}
8137
8138#[must_use = "FIDL methods require a response to be sent"]
8139#[derive(Debug)]
8140pub struct ScreenshotTakeResponder {
8141    control_handle: std::mem::ManuallyDrop<ScreenshotControlHandle>,
8142    tx_id: u32,
8143}
8144
8145/// Set the the channel to be shutdown (see [`ScreenshotControlHandle::shutdown`])
8146/// if the responder is dropped without sending a response, so that the client
8147/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
8148impl std::ops::Drop for ScreenshotTakeResponder {
8149    fn drop(&mut self) {
8150        self.control_handle.shutdown();
8151        // Safety: drops once, never accessed again
8152        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8153    }
8154}
8155
8156impl fidl::endpoints::Responder for ScreenshotTakeResponder {
8157    type ControlHandle = ScreenshotControlHandle;
8158
8159    fn control_handle(&self) -> &ScreenshotControlHandle {
8160        &self.control_handle
8161    }
8162
8163    fn drop_without_shutdown(mut self) {
8164        // Safety: drops once, never accessed again due to mem::forget
8165        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8166        // Prevent Drop from running (which would shut down the channel)
8167        std::mem::forget(self);
8168    }
8169}
8170
8171impl ScreenshotTakeResponder {
8172    /// Sends a response to the FIDL transaction.
8173    ///
8174    /// Sets the channel to shutdown if an error occurs.
8175    pub fn send(self, mut payload: ScreenshotTakeResponse) -> Result<(), fidl::Error> {
8176        let _result = self.send_raw(payload);
8177        if _result.is_err() {
8178            self.control_handle.shutdown();
8179        }
8180        self.drop_without_shutdown();
8181        _result
8182    }
8183
8184    /// Similar to "send" but does not shutdown the channel if an error occurs.
8185    pub fn send_no_shutdown_on_err(
8186        self,
8187        mut payload: ScreenshotTakeResponse,
8188    ) -> Result<(), fidl::Error> {
8189        let _result = self.send_raw(payload);
8190        self.drop_without_shutdown();
8191        _result
8192    }
8193
8194    fn send_raw(&self, mut payload: ScreenshotTakeResponse) -> Result<(), fidl::Error> {
8195        self.control_handle.inner.send::<ScreenshotTakeResponse>(
8196            &mut payload,
8197            self.tx_id,
8198            0x51341396e9fd2fd0,
8199            fidl::encoding::DynamicFlags::empty(),
8200        )
8201    }
8202}
8203
8204#[must_use = "FIDL methods require a response to be sent"]
8205#[derive(Debug)]
8206pub struct ScreenshotTakeFileResponder {
8207    control_handle: std::mem::ManuallyDrop<ScreenshotControlHandle>,
8208    tx_id: u32,
8209}
8210
8211/// Set the the channel to be shutdown (see [`ScreenshotControlHandle::shutdown`])
8212/// if the responder is dropped without sending a response, so that the client
8213/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
8214impl std::ops::Drop for ScreenshotTakeFileResponder {
8215    fn drop(&mut self) {
8216        self.control_handle.shutdown();
8217        // Safety: drops once, never accessed again
8218        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8219    }
8220}
8221
8222impl fidl::endpoints::Responder for ScreenshotTakeFileResponder {
8223    type ControlHandle = ScreenshotControlHandle;
8224
8225    fn control_handle(&self) -> &ScreenshotControlHandle {
8226        &self.control_handle
8227    }
8228
8229    fn drop_without_shutdown(mut self) {
8230        // Safety: drops once, never accessed again due to mem::forget
8231        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8232        // Prevent Drop from running (which would shut down the channel)
8233        std::mem::forget(self);
8234    }
8235}
8236
8237impl ScreenshotTakeFileResponder {
8238    /// Sends a response to the FIDL transaction.
8239    ///
8240    /// Sets the channel to shutdown if an error occurs.
8241    pub fn send(self, mut payload: ScreenshotTakeFileResponse) -> Result<(), fidl::Error> {
8242        let _result = self.send_raw(payload);
8243        if _result.is_err() {
8244            self.control_handle.shutdown();
8245        }
8246        self.drop_without_shutdown();
8247        _result
8248    }
8249
8250    /// Similar to "send" but does not shutdown the channel if an error occurs.
8251    pub fn send_no_shutdown_on_err(
8252        self,
8253        mut payload: ScreenshotTakeFileResponse,
8254    ) -> Result<(), fidl::Error> {
8255        let _result = self.send_raw(payload);
8256        self.drop_without_shutdown();
8257        _result
8258    }
8259
8260    fn send_raw(&self, mut payload: ScreenshotTakeFileResponse) -> Result<(), fidl::Error> {
8261        self.control_handle.inner.send::<ScreenshotTakeFileResponse>(
8262            &mut payload,
8263            self.tx_id,
8264            0x470aeea0a4d32903,
8265            fidl::encoding::DynamicFlags::empty(),
8266        )
8267    }
8268}
8269
8270#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
8271pub struct TrustedFlatlandMarker;
8272
8273impl fidl::endpoints::ProtocolMarker for TrustedFlatlandMarker {
8274    type Proxy = TrustedFlatlandProxy;
8275    type RequestStream = TrustedFlatlandRequestStream;
8276    #[cfg(target_os = "fuchsia")]
8277    type SynchronousProxy = TrustedFlatlandSynchronousProxy;
8278
8279    const DEBUG_NAME: &'static str = "(anonymous) TrustedFlatland";
8280}
8281
8282pub trait TrustedFlatlandProxyInterface: Send + Sync {
8283    fn r#release_image_immediately(&self, image_id: &ContentId) -> Result<(), fidl::Error>;
8284}
8285#[derive(Debug)]
8286#[cfg(target_os = "fuchsia")]
8287pub struct TrustedFlatlandSynchronousProxy {
8288    client: fidl::client::sync::Client,
8289}
8290
8291#[cfg(target_os = "fuchsia")]
8292impl fidl::endpoints::SynchronousProxy for TrustedFlatlandSynchronousProxy {
8293    type Proxy = TrustedFlatlandProxy;
8294    type Protocol = TrustedFlatlandMarker;
8295
8296    fn from_channel(inner: fidl::Channel) -> Self {
8297        Self::new(inner)
8298    }
8299
8300    fn into_channel(self) -> fidl::Channel {
8301        self.client.into_channel()
8302    }
8303
8304    fn as_channel(&self) -> &fidl::Channel {
8305        self.client.as_channel()
8306    }
8307}
8308
8309#[cfg(target_os = "fuchsia")]
8310impl TrustedFlatlandSynchronousProxy {
8311    pub fn new(channel: fidl::Channel) -> Self {
8312        Self { client: fidl::client::sync::Client::new(channel) }
8313    }
8314
8315    pub fn into_channel(self) -> fidl::Channel {
8316        self.client.into_channel()
8317    }
8318
8319    /// Waits until an event arrives and returns it. It is safe for other
8320    /// threads to make concurrent requests while waiting for an event.
8321    pub fn wait_for_event(
8322        &self,
8323        deadline: zx::MonotonicInstant,
8324    ) -> Result<TrustedFlatlandEvent, fidl::Error> {
8325        TrustedFlatlandEvent::decode(self.client.wait_for_event::<TrustedFlatlandMarker>(deadline)?)
8326    }
8327
8328    /// Releases an image immediately, without waiting for the next present.
8329    pub fn r#release_image_immediately(&self, mut image_id: &ContentId) -> Result<(), fidl::Error> {
8330        self.client.send::<TrustedFlatlandReleaseImageImmediatelyRequest>(
8331            (image_id,),
8332            0x245e1ac080772c8,
8333            fidl::encoding::DynamicFlags::empty(),
8334        )
8335    }
8336}
8337
8338#[cfg(target_os = "fuchsia")]
8339impl From<TrustedFlatlandSynchronousProxy> for zx::NullableHandle {
8340    fn from(value: TrustedFlatlandSynchronousProxy) -> Self {
8341        value.into_channel().into()
8342    }
8343}
8344
8345#[cfg(target_os = "fuchsia")]
8346impl From<fidl::Channel> for TrustedFlatlandSynchronousProxy {
8347    fn from(value: fidl::Channel) -> Self {
8348        Self::new(value)
8349    }
8350}
8351
8352#[cfg(target_os = "fuchsia")]
8353impl fidl::endpoints::FromClient for TrustedFlatlandSynchronousProxy {
8354    type Protocol = TrustedFlatlandMarker;
8355
8356    fn from_client(value: fidl::endpoints::ClientEnd<TrustedFlatlandMarker>) -> Self {
8357        Self::new(value.into_channel())
8358    }
8359}
8360
8361#[derive(Debug, Clone)]
8362pub struct TrustedFlatlandProxy {
8363    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
8364}
8365
8366impl fidl::endpoints::Proxy for TrustedFlatlandProxy {
8367    type Protocol = TrustedFlatlandMarker;
8368
8369    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
8370        Self::new(inner)
8371    }
8372
8373    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
8374        self.client.into_channel().map_err(|client| Self { client })
8375    }
8376
8377    fn as_channel(&self) -> &::fidl::AsyncChannel {
8378        self.client.as_channel()
8379    }
8380}
8381
8382impl TrustedFlatlandProxy {
8383    /// Create a new Proxy for fuchsia.ui.composition/TrustedFlatland.
8384    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
8385        let protocol_name = <TrustedFlatlandMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
8386        Self { client: fidl::client::Client::new(channel, protocol_name) }
8387    }
8388
8389    /// Get a Stream of events from the remote end of the protocol.
8390    ///
8391    /// # Panics
8392    ///
8393    /// Panics if the event stream was already taken.
8394    pub fn take_event_stream(&self) -> TrustedFlatlandEventStream {
8395        TrustedFlatlandEventStream { event_receiver: self.client.take_event_receiver() }
8396    }
8397
8398    /// Releases an image immediately, without waiting for the next present.
8399    pub fn r#release_image_immediately(&self, mut image_id: &ContentId) -> Result<(), fidl::Error> {
8400        TrustedFlatlandProxyInterface::r#release_image_immediately(self, image_id)
8401    }
8402}
8403
8404impl TrustedFlatlandProxyInterface for TrustedFlatlandProxy {
8405    fn r#release_image_immediately(&self, mut image_id: &ContentId) -> Result<(), fidl::Error> {
8406        self.client.send::<TrustedFlatlandReleaseImageImmediatelyRequest>(
8407            (image_id,),
8408            0x245e1ac080772c8,
8409            fidl::encoding::DynamicFlags::empty(),
8410        )
8411    }
8412}
8413
8414pub struct TrustedFlatlandEventStream {
8415    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
8416}
8417
8418impl std::marker::Unpin for TrustedFlatlandEventStream {}
8419
8420impl futures::stream::FusedStream for TrustedFlatlandEventStream {
8421    fn is_terminated(&self) -> bool {
8422        self.event_receiver.is_terminated()
8423    }
8424}
8425
8426impl futures::Stream for TrustedFlatlandEventStream {
8427    type Item = Result<TrustedFlatlandEvent, fidl::Error>;
8428
8429    fn poll_next(
8430        mut self: std::pin::Pin<&mut Self>,
8431        cx: &mut std::task::Context<'_>,
8432    ) -> std::task::Poll<Option<Self::Item>> {
8433        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
8434            &mut self.event_receiver,
8435            cx
8436        )?) {
8437            Some(buf) => std::task::Poll::Ready(Some(TrustedFlatlandEvent::decode(buf))),
8438            None => std::task::Poll::Ready(None),
8439        }
8440    }
8441}
8442
8443#[derive(Debug)]
8444pub enum TrustedFlatlandEvent {}
8445
8446impl TrustedFlatlandEvent {
8447    /// Decodes a message buffer as a [`TrustedFlatlandEvent`].
8448    fn decode(
8449        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
8450    ) -> Result<TrustedFlatlandEvent, fidl::Error> {
8451        let (bytes, _handles) = buf.split_mut();
8452        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
8453        debug_assert_eq!(tx_header.tx_id, 0);
8454        match tx_header.ordinal {
8455            _ => Err(fidl::Error::UnknownOrdinal {
8456                ordinal: tx_header.ordinal,
8457                protocol_name:
8458                    <TrustedFlatlandMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
8459            }),
8460        }
8461    }
8462}
8463
8464/// A Stream of incoming requests for fuchsia.ui.composition/TrustedFlatland.
8465pub struct TrustedFlatlandRequestStream {
8466    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8467    is_terminated: bool,
8468}
8469
8470impl std::marker::Unpin for TrustedFlatlandRequestStream {}
8471
8472impl futures::stream::FusedStream for TrustedFlatlandRequestStream {
8473    fn is_terminated(&self) -> bool {
8474        self.is_terminated
8475    }
8476}
8477
8478impl fidl::endpoints::RequestStream for TrustedFlatlandRequestStream {
8479    type Protocol = TrustedFlatlandMarker;
8480    type ControlHandle = TrustedFlatlandControlHandle;
8481
8482    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
8483        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
8484    }
8485
8486    fn control_handle(&self) -> Self::ControlHandle {
8487        TrustedFlatlandControlHandle { inner: self.inner.clone() }
8488    }
8489
8490    fn into_inner(
8491        self,
8492    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
8493    {
8494        (self.inner, self.is_terminated)
8495    }
8496
8497    fn from_inner(
8498        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8499        is_terminated: bool,
8500    ) -> Self {
8501        Self { inner, is_terminated }
8502    }
8503}
8504
8505impl futures::Stream for TrustedFlatlandRequestStream {
8506    type Item = Result<TrustedFlatlandRequest, fidl::Error>;
8507
8508    fn poll_next(
8509        mut self: std::pin::Pin<&mut Self>,
8510        cx: &mut std::task::Context<'_>,
8511    ) -> std::task::Poll<Option<Self::Item>> {
8512        let this = &mut *self;
8513        if this.inner.check_shutdown(cx) {
8514            this.is_terminated = true;
8515            return std::task::Poll::Ready(None);
8516        }
8517        if this.is_terminated {
8518            panic!("polled TrustedFlatlandRequestStream after completion");
8519        }
8520        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
8521            |bytes, handles| {
8522                match this.inner.channel().read_etc(cx, bytes, handles) {
8523                    std::task::Poll::Ready(Ok(())) => {}
8524                    std::task::Poll::Pending => return std::task::Poll::Pending,
8525                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
8526                        this.is_terminated = true;
8527                        return std::task::Poll::Ready(None);
8528                    }
8529                    std::task::Poll::Ready(Err(e)) => {
8530                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
8531                            e.into(),
8532                        ))));
8533                    }
8534                }
8535
8536                // A message has been received from the channel
8537                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
8538
8539                std::task::Poll::Ready(Some(match header.ordinal {
8540                    0x245e1ac080772c8 => {
8541                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
8542                        let mut req = fidl::new_empty!(
8543                            TrustedFlatlandReleaseImageImmediatelyRequest,
8544                            fidl::encoding::DefaultFuchsiaResourceDialect
8545                        );
8546                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<TrustedFlatlandReleaseImageImmediatelyRequest>(&header, _body_bytes, handles, &mut req)?;
8547                        let control_handle =
8548                            TrustedFlatlandControlHandle { inner: this.inner.clone() };
8549                        Ok(TrustedFlatlandRequest::ReleaseImageImmediately {
8550                            image_id: req.image_id,
8551
8552                            control_handle,
8553                        })
8554                    }
8555                    _ => Err(fidl::Error::UnknownOrdinal {
8556                        ordinal: header.ordinal,
8557                        protocol_name:
8558                            <TrustedFlatlandMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
8559                    }),
8560                }))
8561            },
8562        )
8563    }
8564}
8565
8566/// A privileged protocol for trusted Flatland sessions that require special capabilities.
8567///
8568/// This protocol is composed into the [Flatland] protocol. Methods in this protocol
8569/// are only available if the Flatland session was created via [TrustedFlatlandFactory].
8570#[derive(Debug)]
8571pub enum TrustedFlatlandRequest {
8572    /// Releases an image immediately, without waiting for the next present.
8573    ReleaseImageImmediately { image_id: ContentId, control_handle: TrustedFlatlandControlHandle },
8574}
8575
8576impl TrustedFlatlandRequest {
8577    #[allow(irrefutable_let_patterns)]
8578    pub fn into_release_image_immediately(
8579        self,
8580    ) -> Option<(ContentId, TrustedFlatlandControlHandle)> {
8581        if let TrustedFlatlandRequest::ReleaseImageImmediately { image_id, control_handle } = self {
8582            Some((image_id, control_handle))
8583        } else {
8584            None
8585        }
8586    }
8587
8588    /// Name of the method defined in FIDL
8589    pub fn method_name(&self) -> &'static str {
8590        match *self {
8591            TrustedFlatlandRequest::ReleaseImageImmediately { .. } => "release_image_immediately",
8592        }
8593    }
8594}
8595
8596#[derive(Debug, Clone)]
8597pub struct TrustedFlatlandControlHandle {
8598    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8599}
8600
8601impl TrustedFlatlandControlHandle {
8602    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
8603        self.inner.shutdown_with_epitaph(status.into())
8604    }
8605}
8606
8607impl fidl::endpoints::ControlHandle for TrustedFlatlandControlHandle {
8608    fn shutdown(&self) {
8609        self.inner.shutdown()
8610    }
8611
8612    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
8613        self.inner.shutdown_with_epitaph(status)
8614    }
8615
8616    fn is_closed(&self) -> bool {
8617        self.inner.channel().is_closed()
8618    }
8619    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
8620        self.inner.channel().on_closed()
8621    }
8622
8623    #[cfg(target_os = "fuchsia")]
8624    fn signal_peer(
8625        &self,
8626        clear_mask: zx::Signals,
8627        set_mask: zx::Signals,
8628    ) -> Result<(), zx_status::Status> {
8629        use fidl::Peered;
8630        self.inner.channel().signal_peer(clear_mask, set_mask)
8631    }
8632}
8633
8634impl TrustedFlatlandControlHandle {}
8635
8636#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
8637pub struct TrustedFlatlandFactoryMarker;
8638
8639impl fidl::endpoints::ProtocolMarker for TrustedFlatlandFactoryMarker {
8640    type Proxy = TrustedFlatlandFactoryProxy;
8641    type RequestStream = TrustedFlatlandFactoryRequestStream;
8642    #[cfg(target_os = "fuchsia")]
8643    type SynchronousProxy = TrustedFlatlandFactorySynchronousProxy;
8644
8645    const DEBUG_NAME: &'static str = "fuchsia.ui.composition.TrustedFlatlandFactory";
8646}
8647impl fidl::endpoints::DiscoverableProtocolMarker for TrustedFlatlandFactoryMarker {}
8648pub type TrustedFlatlandFactoryCreateFlatlandResult = Result<(), TrustedFlatlandFactoryError>;
8649
8650pub trait TrustedFlatlandFactoryProxyInterface: Send + Sync {
8651    type CreateFlatlandResponseFut: std::future::Future<
8652            Output = Result<TrustedFlatlandFactoryCreateFlatlandResult, fidl::Error>,
8653        > + Send;
8654    fn r#create_flatland(
8655        &self,
8656        server_end: fidl::endpoints::ServerEnd<FlatlandMarker>,
8657        config: TrustedFlatlandConfig,
8658    ) -> Self::CreateFlatlandResponseFut;
8659}
8660#[derive(Debug)]
8661#[cfg(target_os = "fuchsia")]
8662pub struct TrustedFlatlandFactorySynchronousProxy {
8663    client: fidl::client::sync::Client,
8664}
8665
8666#[cfg(target_os = "fuchsia")]
8667impl fidl::endpoints::SynchronousProxy for TrustedFlatlandFactorySynchronousProxy {
8668    type Proxy = TrustedFlatlandFactoryProxy;
8669    type Protocol = TrustedFlatlandFactoryMarker;
8670
8671    fn from_channel(inner: fidl::Channel) -> Self {
8672        Self::new(inner)
8673    }
8674
8675    fn into_channel(self) -> fidl::Channel {
8676        self.client.into_channel()
8677    }
8678
8679    fn as_channel(&self) -> &fidl::Channel {
8680        self.client.as_channel()
8681    }
8682}
8683
8684#[cfg(target_os = "fuchsia")]
8685impl TrustedFlatlandFactorySynchronousProxy {
8686    pub fn new(channel: fidl::Channel) -> Self {
8687        Self { client: fidl::client::sync::Client::new(channel) }
8688    }
8689
8690    pub fn into_channel(self) -> fidl::Channel {
8691        self.client.into_channel()
8692    }
8693
8694    /// Waits until an event arrives and returns it. It is safe for other
8695    /// threads to make concurrent requests while waiting for an event.
8696    pub fn wait_for_event(
8697        &self,
8698        deadline: zx::MonotonicInstant,
8699    ) -> Result<TrustedFlatlandFactoryEvent, fidl::Error> {
8700        TrustedFlatlandFactoryEvent::decode(
8701            self.client.wait_for_event::<TrustedFlatlandFactoryMarker>(deadline)?,
8702        )
8703    }
8704
8705    /// Creates a new Flatland session with the specified configuration.
8706    ///
8707    /// ## Error
8708    ///
8709    /// Returns a [TrustedFlatlandFactoryError] error if the operation fails.
8710    pub fn r#create_flatland(
8711        &self,
8712        mut server_end: fidl::endpoints::ServerEnd<FlatlandMarker>,
8713        mut config: TrustedFlatlandConfig,
8714        ___deadline: zx::MonotonicInstant,
8715    ) -> Result<TrustedFlatlandFactoryCreateFlatlandResult, fidl::Error> {
8716        let _response = self.client.send_query::<
8717            TrustedFlatlandFactoryCreateFlatlandRequest,
8718            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, TrustedFlatlandFactoryError>,
8719            TrustedFlatlandFactoryMarker,
8720        >(
8721            (server_end, &mut config,),
8722            0x48e89c53f00561dc,
8723            fidl::encoding::DynamicFlags::empty(),
8724            ___deadline,
8725        )?;
8726        Ok(_response.map(|x| x))
8727    }
8728}
8729
8730#[cfg(target_os = "fuchsia")]
8731impl From<TrustedFlatlandFactorySynchronousProxy> for zx::NullableHandle {
8732    fn from(value: TrustedFlatlandFactorySynchronousProxy) -> Self {
8733        value.into_channel().into()
8734    }
8735}
8736
8737#[cfg(target_os = "fuchsia")]
8738impl From<fidl::Channel> for TrustedFlatlandFactorySynchronousProxy {
8739    fn from(value: fidl::Channel) -> Self {
8740        Self::new(value)
8741    }
8742}
8743
8744#[cfg(target_os = "fuchsia")]
8745impl fidl::endpoints::FromClient for TrustedFlatlandFactorySynchronousProxy {
8746    type Protocol = TrustedFlatlandFactoryMarker;
8747
8748    fn from_client(value: fidl::endpoints::ClientEnd<TrustedFlatlandFactoryMarker>) -> Self {
8749        Self::new(value.into_channel())
8750    }
8751}
8752
8753#[derive(Debug, Clone)]
8754pub struct TrustedFlatlandFactoryProxy {
8755    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
8756}
8757
8758impl fidl::endpoints::Proxy for TrustedFlatlandFactoryProxy {
8759    type Protocol = TrustedFlatlandFactoryMarker;
8760
8761    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
8762        Self::new(inner)
8763    }
8764
8765    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
8766        self.client.into_channel().map_err(|client| Self { client })
8767    }
8768
8769    fn as_channel(&self) -> &::fidl::AsyncChannel {
8770        self.client.as_channel()
8771    }
8772}
8773
8774impl TrustedFlatlandFactoryProxy {
8775    /// Create a new Proxy for fuchsia.ui.composition/TrustedFlatlandFactory.
8776    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
8777        let protocol_name =
8778            <TrustedFlatlandFactoryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
8779        Self { client: fidl::client::Client::new(channel, protocol_name) }
8780    }
8781
8782    /// Get a Stream of events from the remote end of the protocol.
8783    ///
8784    /// # Panics
8785    ///
8786    /// Panics if the event stream was already taken.
8787    pub fn take_event_stream(&self) -> TrustedFlatlandFactoryEventStream {
8788        TrustedFlatlandFactoryEventStream { event_receiver: self.client.take_event_receiver() }
8789    }
8790
8791    /// Creates a new Flatland session with the specified configuration.
8792    ///
8793    /// ## Error
8794    ///
8795    /// Returns a [TrustedFlatlandFactoryError] error if the operation fails.
8796    pub fn r#create_flatland(
8797        &self,
8798        mut server_end: fidl::endpoints::ServerEnd<FlatlandMarker>,
8799        mut config: TrustedFlatlandConfig,
8800    ) -> fidl::client::QueryResponseFut<
8801        TrustedFlatlandFactoryCreateFlatlandResult,
8802        fidl::encoding::DefaultFuchsiaResourceDialect,
8803    > {
8804        TrustedFlatlandFactoryProxyInterface::r#create_flatland(self, server_end, config)
8805    }
8806}
8807
8808impl TrustedFlatlandFactoryProxyInterface for TrustedFlatlandFactoryProxy {
8809    type CreateFlatlandResponseFut = fidl::client::QueryResponseFut<
8810        TrustedFlatlandFactoryCreateFlatlandResult,
8811        fidl::encoding::DefaultFuchsiaResourceDialect,
8812    >;
8813    fn r#create_flatland(
8814        &self,
8815        mut server_end: fidl::endpoints::ServerEnd<FlatlandMarker>,
8816        mut config: TrustedFlatlandConfig,
8817    ) -> Self::CreateFlatlandResponseFut {
8818        fn _decode(
8819            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
8820        ) -> Result<TrustedFlatlandFactoryCreateFlatlandResult, fidl::Error> {
8821            let _response = fidl::client::decode_transaction_body::<
8822                fidl::encoding::ResultType<
8823                    fidl::encoding::EmptyStruct,
8824                    TrustedFlatlandFactoryError,
8825                >,
8826                fidl::encoding::DefaultFuchsiaResourceDialect,
8827                0x48e89c53f00561dc,
8828            >(_buf?)?;
8829            Ok(_response.map(|x| x))
8830        }
8831        self.client.send_query_and_decode::<
8832            TrustedFlatlandFactoryCreateFlatlandRequest,
8833            TrustedFlatlandFactoryCreateFlatlandResult,
8834        >(
8835            (server_end, &mut config,),
8836            0x48e89c53f00561dc,
8837            fidl::encoding::DynamicFlags::empty(),
8838            _decode,
8839        )
8840    }
8841}
8842
8843pub struct TrustedFlatlandFactoryEventStream {
8844    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
8845}
8846
8847impl std::marker::Unpin for TrustedFlatlandFactoryEventStream {}
8848
8849impl futures::stream::FusedStream for TrustedFlatlandFactoryEventStream {
8850    fn is_terminated(&self) -> bool {
8851        self.event_receiver.is_terminated()
8852    }
8853}
8854
8855impl futures::Stream for TrustedFlatlandFactoryEventStream {
8856    type Item = Result<TrustedFlatlandFactoryEvent, fidl::Error>;
8857
8858    fn poll_next(
8859        mut self: std::pin::Pin<&mut Self>,
8860        cx: &mut std::task::Context<'_>,
8861    ) -> std::task::Poll<Option<Self::Item>> {
8862        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
8863            &mut self.event_receiver,
8864            cx
8865        )?) {
8866            Some(buf) => std::task::Poll::Ready(Some(TrustedFlatlandFactoryEvent::decode(buf))),
8867            None => std::task::Poll::Ready(None),
8868        }
8869    }
8870}
8871
8872#[derive(Debug)]
8873pub enum TrustedFlatlandFactoryEvent {}
8874
8875impl TrustedFlatlandFactoryEvent {
8876    /// Decodes a message buffer as a [`TrustedFlatlandFactoryEvent`].
8877    fn decode(
8878        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
8879    ) -> Result<TrustedFlatlandFactoryEvent, fidl::Error> {
8880        let (bytes, _handles) = buf.split_mut();
8881        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
8882        debug_assert_eq!(tx_header.tx_id, 0);
8883        match tx_header.ordinal {
8884            _ => Err(fidl::Error::UnknownOrdinal {
8885                ordinal: tx_header.ordinal,
8886                protocol_name:
8887                    <TrustedFlatlandFactoryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
8888            }),
8889        }
8890    }
8891}
8892
8893/// A Stream of incoming requests for fuchsia.ui.composition/TrustedFlatlandFactory.
8894pub struct TrustedFlatlandFactoryRequestStream {
8895    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8896    is_terminated: bool,
8897}
8898
8899impl std::marker::Unpin for TrustedFlatlandFactoryRequestStream {}
8900
8901impl futures::stream::FusedStream for TrustedFlatlandFactoryRequestStream {
8902    fn is_terminated(&self) -> bool {
8903        self.is_terminated
8904    }
8905}
8906
8907impl fidl::endpoints::RequestStream for TrustedFlatlandFactoryRequestStream {
8908    type Protocol = TrustedFlatlandFactoryMarker;
8909    type ControlHandle = TrustedFlatlandFactoryControlHandle;
8910
8911    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
8912        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
8913    }
8914
8915    fn control_handle(&self) -> Self::ControlHandle {
8916        TrustedFlatlandFactoryControlHandle { inner: self.inner.clone() }
8917    }
8918
8919    fn into_inner(
8920        self,
8921    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
8922    {
8923        (self.inner, self.is_terminated)
8924    }
8925
8926    fn from_inner(
8927        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8928        is_terminated: bool,
8929    ) -> Self {
8930        Self { inner, is_terminated }
8931    }
8932}
8933
8934impl futures::Stream for TrustedFlatlandFactoryRequestStream {
8935    type Item = Result<TrustedFlatlandFactoryRequest, fidl::Error>;
8936
8937    fn poll_next(
8938        mut self: std::pin::Pin<&mut Self>,
8939        cx: &mut std::task::Context<'_>,
8940    ) -> std::task::Poll<Option<Self::Item>> {
8941        let this = &mut *self;
8942        if this.inner.check_shutdown(cx) {
8943            this.is_terminated = true;
8944            return std::task::Poll::Ready(None);
8945        }
8946        if this.is_terminated {
8947            panic!("polled TrustedFlatlandFactoryRequestStream after completion");
8948        }
8949        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
8950            |bytes, handles| {
8951                match this.inner.channel().read_etc(cx, bytes, handles) {
8952                    std::task::Poll::Ready(Ok(())) => {}
8953                    std::task::Poll::Pending => return std::task::Poll::Pending,
8954                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
8955                        this.is_terminated = true;
8956                        return std::task::Poll::Ready(None);
8957                    }
8958                    std::task::Poll::Ready(Err(e)) => {
8959                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
8960                            e.into(),
8961                        ))));
8962                    }
8963                }
8964
8965                // A message has been received from the channel
8966                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
8967
8968                std::task::Poll::Ready(Some(match header.ordinal {
8969                0x48e89c53f00561dc => {
8970                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
8971                    let mut req = fidl::new_empty!(TrustedFlatlandFactoryCreateFlatlandRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
8972                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<TrustedFlatlandFactoryCreateFlatlandRequest>(&header, _body_bytes, handles, &mut req)?;
8973                    let control_handle = TrustedFlatlandFactoryControlHandle {
8974                        inner: this.inner.clone(),
8975                    };
8976                    Ok(TrustedFlatlandFactoryRequest::CreateFlatland {server_end: req.server_end,
8977config: req.config,
8978
8979                        responder: TrustedFlatlandFactoryCreateFlatlandResponder {
8980                            control_handle: std::mem::ManuallyDrop::new(control_handle),
8981                            tx_id: header.tx_id,
8982                        },
8983                    })
8984                }
8985                _ => Err(fidl::Error::UnknownOrdinal {
8986                    ordinal: header.ordinal,
8987                    protocol_name: <TrustedFlatlandFactoryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
8988                }),
8989            }))
8990            },
8991        )
8992    }
8993}
8994
8995/// A privileged factory for creating Flatland sessions with special configurations.
8996///
8997/// This protocol is intended for trusted clients that require fine-grained control over
8998/// Flatland's behavior for performance-critical applications. It is not intended for
8999/// general use. Misuse of this API can negatively impact system performance and stability.
9000#[derive(Debug)]
9001pub enum TrustedFlatlandFactoryRequest {
9002    /// Creates a new Flatland session with the specified configuration.
9003    ///
9004    /// ## Error
9005    ///
9006    /// Returns a [TrustedFlatlandFactoryError] error if the operation fails.
9007    CreateFlatland {
9008        server_end: fidl::endpoints::ServerEnd<FlatlandMarker>,
9009        config: TrustedFlatlandConfig,
9010        responder: TrustedFlatlandFactoryCreateFlatlandResponder,
9011    },
9012}
9013
9014impl TrustedFlatlandFactoryRequest {
9015    #[allow(irrefutable_let_patterns)]
9016    pub fn into_create_flatland(
9017        self,
9018    ) -> Option<(
9019        fidl::endpoints::ServerEnd<FlatlandMarker>,
9020        TrustedFlatlandConfig,
9021        TrustedFlatlandFactoryCreateFlatlandResponder,
9022    )> {
9023        if let TrustedFlatlandFactoryRequest::CreateFlatland { server_end, config, responder } =
9024            self
9025        {
9026            Some((server_end, config, responder))
9027        } else {
9028            None
9029        }
9030    }
9031
9032    /// Name of the method defined in FIDL
9033    pub fn method_name(&self) -> &'static str {
9034        match *self {
9035            TrustedFlatlandFactoryRequest::CreateFlatland { .. } => "create_flatland",
9036        }
9037    }
9038}
9039
9040#[derive(Debug, Clone)]
9041pub struct TrustedFlatlandFactoryControlHandle {
9042    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
9043}
9044
9045impl TrustedFlatlandFactoryControlHandle {
9046    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
9047        self.inner.shutdown_with_epitaph(status.into())
9048    }
9049}
9050
9051impl fidl::endpoints::ControlHandle for TrustedFlatlandFactoryControlHandle {
9052    fn shutdown(&self) {
9053        self.inner.shutdown()
9054    }
9055
9056    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
9057        self.inner.shutdown_with_epitaph(status)
9058    }
9059
9060    fn is_closed(&self) -> bool {
9061        self.inner.channel().is_closed()
9062    }
9063    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
9064        self.inner.channel().on_closed()
9065    }
9066
9067    #[cfg(target_os = "fuchsia")]
9068    fn signal_peer(
9069        &self,
9070        clear_mask: zx::Signals,
9071        set_mask: zx::Signals,
9072    ) -> Result<(), zx_status::Status> {
9073        use fidl::Peered;
9074        self.inner.channel().signal_peer(clear_mask, set_mask)
9075    }
9076}
9077
9078impl TrustedFlatlandFactoryControlHandle {}
9079
9080#[must_use = "FIDL methods require a response to be sent"]
9081#[derive(Debug)]
9082pub struct TrustedFlatlandFactoryCreateFlatlandResponder {
9083    control_handle: std::mem::ManuallyDrop<TrustedFlatlandFactoryControlHandle>,
9084    tx_id: u32,
9085}
9086
9087/// Set the the channel to be shutdown (see [`TrustedFlatlandFactoryControlHandle::shutdown`])
9088/// if the responder is dropped without sending a response, so that the client
9089/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
9090impl std::ops::Drop for TrustedFlatlandFactoryCreateFlatlandResponder {
9091    fn drop(&mut self) {
9092        self.control_handle.shutdown();
9093        // Safety: drops once, never accessed again
9094        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9095    }
9096}
9097
9098impl fidl::endpoints::Responder for TrustedFlatlandFactoryCreateFlatlandResponder {
9099    type ControlHandle = TrustedFlatlandFactoryControlHandle;
9100
9101    fn control_handle(&self) -> &TrustedFlatlandFactoryControlHandle {
9102        &self.control_handle
9103    }
9104
9105    fn drop_without_shutdown(mut self) {
9106        // Safety: drops once, never accessed again due to mem::forget
9107        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9108        // Prevent Drop from running (which would shut down the channel)
9109        std::mem::forget(self);
9110    }
9111}
9112
9113impl TrustedFlatlandFactoryCreateFlatlandResponder {
9114    /// Sends a response to the FIDL transaction.
9115    ///
9116    /// Sets the channel to shutdown if an error occurs.
9117    pub fn send(
9118        self,
9119        mut result: Result<(), TrustedFlatlandFactoryError>,
9120    ) -> Result<(), fidl::Error> {
9121        let _result = self.send_raw(result);
9122        if _result.is_err() {
9123            self.control_handle.shutdown();
9124        }
9125        self.drop_without_shutdown();
9126        _result
9127    }
9128
9129    /// Similar to "send" but does not shutdown the channel if an error occurs.
9130    pub fn send_no_shutdown_on_err(
9131        self,
9132        mut result: Result<(), TrustedFlatlandFactoryError>,
9133    ) -> Result<(), fidl::Error> {
9134        let _result = self.send_raw(result);
9135        self.drop_without_shutdown();
9136        _result
9137    }
9138
9139    fn send_raw(
9140        &self,
9141        mut result: Result<(), TrustedFlatlandFactoryError>,
9142    ) -> Result<(), fidl::Error> {
9143        self.control_handle.inner.send::<fidl::encoding::ResultType<
9144            fidl::encoding::EmptyStruct,
9145            TrustedFlatlandFactoryError,
9146        >>(
9147            result,
9148            self.tx_id,
9149            0x48e89c53f00561dc,
9150            fidl::encoding::DynamicFlags::empty(),
9151        )
9152    }
9153}
9154
9155mod internal {
9156    use super::*;
9157
9158    impl fidl::encoding::ResourceTypeMarker for AllocatorRegisterBufferCollectionRequest {
9159        type Borrowed<'a> = &'a mut Self;
9160        fn take_or_borrow<'a>(
9161            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9162        ) -> Self::Borrowed<'a> {
9163            value
9164        }
9165    }
9166
9167    unsafe impl fidl::encoding::TypeMarker for AllocatorRegisterBufferCollectionRequest {
9168        type Owned = Self;
9169
9170        #[inline(always)]
9171        fn inline_align(_context: fidl::encoding::Context) -> usize {
9172            8
9173        }
9174
9175        #[inline(always)]
9176        fn inline_size(_context: fidl::encoding::Context) -> usize {
9177            16
9178        }
9179    }
9180
9181    unsafe impl
9182        fidl::encoding::Encode<
9183            AllocatorRegisterBufferCollectionRequest,
9184            fidl::encoding::DefaultFuchsiaResourceDialect,
9185        > for &mut AllocatorRegisterBufferCollectionRequest
9186    {
9187        #[inline]
9188        unsafe fn encode(
9189            self,
9190            encoder: &mut fidl::encoding::Encoder<
9191                '_,
9192                fidl::encoding::DefaultFuchsiaResourceDialect,
9193            >,
9194            offset: usize,
9195            _depth: fidl::encoding::Depth,
9196        ) -> fidl::Result<()> {
9197            encoder.debug_check_bounds::<AllocatorRegisterBufferCollectionRequest>(offset);
9198            // Delegate to tuple encoding.
9199            fidl::encoding::Encode::<AllocatorRegisterBufferCollectionRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
9200                (
9201                    <RegisterBufferCollectionArgs as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.args),
9202                ),
9203                encoder, offset, _depth
9204            )
9205        }
9206    }
9207    unsafe impl<
9208        T0: fidl::encoding::Encode<
9209                RegisterBufferCollectionArgs,
9210                fidl::encoding::DefaultFuchsiaResourceDialect,
9211            >,
9212    >
9213        fidl::encoding::Encode<
9214            AllocatorRegisterBufferCollectionRequest,
9215            fidl::encoding::DefaultFuchsiaResourceDialect,
9216        > for (T0,)
9217    {
9218        #[inline]
9219        unsafe fn encode(
9220            self,
9221            encoder: &mut fidl::encoding::Encoder<
9222                '_,
9223                fidl::encoding::DefaultFuchsiaResourceDialect,
9224            >,
9225            offset: usize,
9226            depth: fidl::encoding::Depth,
9227        ) -> fidl::Result<()> {
9228            encoder.debug_check_bounds::<AllocatorRegisterBufferCollectionRequest>(offset);
9229            // Zero out padding regions. There's no need to apply masks
9230            // because the unmasked parts will be overwritten by fields.
9231            // Write the fields.
9232            self.0.encode(encoder, offset + 0, depth)?;
9233            Ok(())
9234        }
9235    }
9236
9237    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
9238        for AllocatorRegisterBufferCollectionRequest
9239    {
9240        #[inline(always)]
9241        fn new_empty() -> Self {
9242            Self {
9243                args: fidl::new_empty!(
9244                    RegisterBufferCollectionArgs,
9245                    fidl::encoding::DefaultFuchsiaResourceDialect
9246                ),
9247            }
9248        }
9249
9250        #[inline]
9251        unsafe fn decode(
9252            &mut self,
9253            decoder: &mut fidl::encoding::Decoder<
9254                '_,
9255                fidl::encoding::DefaultFuchsiaResourceDialect,
9256            >,
9257            offset: usize,
9258            _depth: fidl::encoding::Depth,
9259        ) -> fidl::Result<()> {
9260            decoder.debug_check_bounds::<Self>(offset);
9261            // Verify that padding bytes are zero.
9262            fidl::decode!(
9263                RegisterBufferCollectionArgs,
9264                fidl::encoding::DefaultFuchsiaResourceDialect,
9265                &mut self.args,
9266                decoder,
9267                offset + 0,
9268                _depth
9269            )?;
9270            Ok(())
9271        }
9272    }
9273
9274    impl fidl::encoding::ResourceTypeMarker for BufferCollectionExportToken {
9275        type Borrowed<'a> = &'a mut Self;
9276        fn take_or_borrow<'a>(
9277            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9278        ) -> Self::Borrowed<'a> {
9279            value
9280        }
9281    }
9282
9283    unsafe impl fidl::encoding::TypeMarker for BufferCollectionExportToken {
9284        type Owned = Self;
9285
9286        #[inline(always)]
9287        fn inline_align(_context: fidl::encoding::Context) -> usize {
9288            4
9289        }
9290
9291        #[inline(always)]
9292        fn inline_size(_context: fidl::encoding::Context) -> usize {
9293            4
9294        }
9295    }
9296
9297    unsafe impl
9298        fidl::encoding::Encode<
9299            BufferCollectionExportToken,
9300            fidl::encoding::DefaultFuchsiaResourceDialect,
9301        > for &mut BufferCollectionExportToken
9302    {
9303        #[inline]
9304        unsafe fn encode(
9305            self,
9306            encoder: &mut fidl::encoding::Encoder<
9307                '_,
9308                fidl::encoding::DefaultFuchsiaResourceDialect,
9309            >,
9310            offset: usize,
9311            _depth: fidl::encoding::Depth,
9312        ) -> fidl::Result<()> {
9313            encoder.debug_check_bounds::<BufferCollectionExportToken>(offset);
9314            // Delegate to tuple encoding.
9315            fidl::encoding::Encode::<
9316                BufferCollectionExportToken,
9317                fidl::encoding::DefaultFuchsiaResourceDialect,
9318            >::encode(
9319                (<fidl::encoding::HandleType<
9320                    fidl::EventPair,
9321                    { fidl::ObjectType::EVENTPAIR.into_raw() },
9322                    2147483648,
9323                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
9324                    &mut self.value
9325                ),),
9326                encoder,
9327                offset,
9328                _depth,
9329            )
9330        }
9331    }
9332    unsafe impl<
9333        T0: fidl::encoding::Encode<
9334                fidl::encoding::HandleType<
9335                    fidl::EventPair,
9336                    { fidl::ObjectType::EVENTPAIR.into_raw() },
9337                    2147483648,
9338                >,
9339                fidl::encoding::DefaultFuchsiaResourceDialect,
9340            >,
9341    >
9342        fidl::encoding::Encode<
9343            BufferCollectionExportToken,
9344            fidl::encoding::DefaultFuchsiaResourceDialect,
9345        > for (T0,)
9346    {
9347        #[inline]
9348        unsafe fn encode(
9349            self,
9350            encoder: &mut fidl::encoding::Encoder<
9351                '_,
9352                fidl::encoding::DefaultFuchsiaResourceDialect,
9353            >,
9354            offset: usize,
9355            depth: fidl::encoding::Depth,
9356        ) -> fidl::Result<()> {
9357            encoder.debug_check_bounds::<BufferCollectionExportToken>(offset);
9358            // Zero out padding regions. There's no need to apply masks
9359            // because the unmasked parts will be overwritten by fields.
9360            // Write the fields.
9361            self.0.encode(encoder, offset + 0, depth)?;
9362            Ok(())
9363        }
9364    }
9365
9366    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
9367        for BufferCollectionExportToken
9368    {
9369        #[inline(always)]
9370        fn new_empty() -> Self {
9371            Self {
9372                value: fidl::new_empty!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
9373            }
9374        }
9375
9376        #[inline]
9377        unsafe fn decode(
9378            &mut self,
9379            decoder: &mut fidl::encoding::Decoder<
9380                '_,
9381                fidl::encoding::DefaultFuchsiaResourceDialect,
9382            >,
9383            offset: usize,
9384            _depth: fidl::encoding::Depth,
9385        ) -> fidl::Result<()> {
9386            decoder.debug_check_bounds::<Self>(offset);
9387            // Verify that padding bytes are zero.
9388            fidl::decode!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.value, decoder, offset + 0, _depth)?;
9389            Ok(())
9390        }
9391    }
9392
9393    impl fidl::encoding::ResourceTypeMarker for BufferCollectionImportToken {
9394        type Borrowed<'a> = &'a mut Self;
9395        fn take_or_borrow<'a>(
9396            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9397        ) -> Self::Borrowed<'a> {
9398            value
9399        }
9400    }
9401
9402    unsafe impl fidl::encoding::TypeMarker for BufferCollectionImportToken {
9403        type Owned = Self;
9404
9405        #[inline(always)]
9406        fn inline_align(_context: fidl::encoding::Context) -> usize {
9407            4
9408        }
9409
9410        #[inline(always)]
9411        fn inline_size(_context: fidl::encoding::Context) -> usize {
9412            4
9413        }
9414    }
9415
9416    unsafe impl
9417        fidl::encoding::Encode<
9418            BufferCollectionImportToken,
9419            fidl::encoding::DefaultFuchsiaResourceDialect,
9420        > for &mut BufferCollectionImportToken
9421    {
9422        #[inline]
9423        unsafe fn encode(
9424            self,
9425            encoder: &mut fidl::encoding::Encoder<
9426                '_,
9427                fidl::encoding::DefaultFuchsiaResourceDialect,
9428            >,
9429            offset: usize,
9430            _depth: fidl::encoding::Depth,
9431        ) -> fidl::Result<()> {
9432            encoder.debug_check_bounds::<BufferCollectionImportToken>(offset);
9433            // Delegate to tuple encoding.
9434            fidl::encoding::Encode::<
9435                BufferCollectionImportToken,
9436                fidl::encoding::DefaultFuchsiaResourceDialect,
9437            >::encode(
9438                (<fidl::encoding::HandleType<
9439                    fidl::EventPair,
9440                    { fidl::ObjectType::EVENTPAIR.into_raw() },
9441                    2147483648,
9442                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
9443                    &mut self.value
9444                ),),
9445                encoder,
9446                offset,
9447                _depth,
9448            )
9449        }
9450    }
9451    unsafe impl<
9452        T0: fidl::encoding::Encode<
9453                fidl::encoding::HandleType<
9454                    fidl::EventPair,
9455                    { fidl::ObjectType::EVENTPAIR.into_raw() },
9456                    2147483648,
9457                >,
9458                fidl::encoding::DefaultFuchsiaResourceDialect,
9459            >,
9460    >
9461        fidl::encoding::Encode<
9462            BufferCollectionImportToken,
9463            fidl::encoding::DefaultFuchsiaResourceDialect,
9464        > for (T0,)
9465    {
9466        #[inline]
9467        unsafe fn encode(
9468            self,
9469            encoder: &mut fidl::encoding::Encoder<
9470                '_,
9471                fidl::encoding::DefaultFuchsiaResourceDialect,
9472            >,
9473            offset: usize,
9474            depth: fidl::encoding::Depth,
9475        ) -> fidl::Result<()> {
9476            encoder.debug_check_bounds::<BufferCollectionImportToken>(offset);
9477            // Zero out padding regions. There's no need to apply masks
9478            // because the unmasked parts will be overwritten by fields.
9479            // Write the fields.
9480            self.0.encode(encoder, offset + 0, depth)?;
9481            Ok(())
9482        }
9483    }
9484
9485    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
9486        for BufferCollectionImportToken
9487    {
9488        #[inline(always)]
9489        fn new_empty() -> Self {
9490            Self {
9491                value: fidl::new_empty!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
9492            }
9493        }
9494
9495        #[inline]
9496        unsafe fn decode(
9497            &mut self,
9498            decoder: &mut fidl::encoding::Decoder<
9499                '_,
9500                fidl::encoding::DefaultFuchsiaResourceDialect,
9501            >,
9502            offset: usize,
9503            _depth: fidl::encoding::Depth,
9504        ) -> fidl::Result<()> {
9505            decoder.debug_check_bounds::<Self>(offset);
9506            // Verify that padding bytes are zero.
9507            fidl::decode!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.value, decoder, offset + 0, _depth)?;
9508            Ok(())
9509        }
9510    }
9511
9512    impl fidl::encoding::ResourceTypeMarker for ChildViewWatcherGetViewRefResponse {
9513        type Borrowed<'a> = &'a mut Self;
9514        fn take_or_borrow<'a>(
9515            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9516        ) -> Self::Borrowed<'a> {
9517            value
9518        }
9519    }
9520
9521    unsafe impl fidl::encoding::TypeMarker for ChildViewWatcherGetViewRefResponse {
9522        type Owned = Self;
9523
9524        #[inline(always)]
9525        fn inline_align(_context: fidl::encoding::Context) -> usize {
9526            4
9527        }
9528
9529        #[inline(always)]
9530        fn inline_size(_context: fidl::encoding::Context) -> usize {
9531            4
9532        }
9533    }
9534
9535    unsafe impl
9536        fidl::encoding::Encode<
9537            ChildViewWatcherGetViewRefResponse,
9538            fidl::encoding::DefaultFuchsiaResourceDialect,
9539        > for &mut ChildViewWatcherGetViewRefResponse
9540    {
9541        #[inline]
9542        unsafe fn encode(
9543            self,
9544            encoder: &mut fidl::encoding::Encoder<
9545                '_,
9546                fidl::encoding::DefaultFuchsiaResourceDialect,
9547            >,
9548            offset: usize,
9549            _depth: fidl::encoding::Depth,
9550        ) -> fidl::Result<()> {
9551            encoder.debug_check_bounds::<ChildViewWatcherGetViewRefResponse>(offset);
9552            // Delegate to tuple encoding.
9553            fidl::encoding::Encode::<ChildViewWatcherGetViewRefResponse, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
9554                (
9555                    <fidl_fuchsia_ui_views::ViewRef as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.view_ref),
9556                ),
9557                encoder, offset, _depth
9558            )
9559        }
9560    }
9561    unsafe impl<
9562        T0: fidl::encoding::Encode<
9563                fidl_fuchsia_ui_views::ViewRef,
9564                fidl::encoding::DefaultFuchsiaResourceDialect,
9565            >,
9566    >
9567        fidl::encoding::Encode<
9568            ChildViewWatcherGetViewRefResponse,
9569            fidl::encoding::DefaultFuchsiaResourceDialect,
9570        > for (T0,)
9571    {
9572        #[inline]
9573        unsafe fn encode(
9574            self,
9575            encoder: &mut fidl::encoding::Encoder<
9576                '_,
9577                fidl::encoding::DefaultFuchsiaResourceDialect,
9578            >,
9579            offset: usize,
9580            depth: fidl::encoding::Depth,
9581        ) -> fidl::Result<()> {
9582            encoder.debug_check_bounds::<ChildViewWatcherGetViewRefResponse>(offset);
9583            // Zero out padding regions. There's no need to apply masks
9584            // because the unmasked parts will be overwritten by fields.
9585            // Write the fields.
9586            self.0.encode(encoder, offset + 0, depth)?;
9587            Ok(())
9588        }
9589    }
9590
9591    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
9592        for ChildViewWatcherGetViewRefResponse
9593    {
9594        #[inline(always)]
9595        fn new_empty() -> Self {
9596            Self {
9597                view_ref: fidl::new_empty!(
9598                    fidl_fuchsia_ui_views::ViewRef,
9599                    fidl::encoding::DefaultFuchsiaResourceDialect
9600                ),
9601            }
9602        }
9603
9604        #[inline]
9605        unsafe fn decode(
9606            &mut self,
9607            decoder: &mut fidl::encoding::Decoder<
9608                '_,
9609                fidl::encoding::DefaultFuchsiaResourceDialect,
9610            >,
9611            offset: usize,
9612            _depth: fidl::encoding::Depth,
9613        ) -> fidl::Result<()> {
9614            decoder.debug_check_bounds::<Self>(offset);
9615            // Verify that padding bytes are zero.
9616            fidl::decode!(
9617                fidl_fuchsia_ui_views::ViewRef,
9618                fidl::encoding::DefaultFuchsiaResourceDialect,
9619                &mut self.view_ref,
9620                decoder,
9621                offset + 0,
9622                _depth
9623            )?;
9624            Ok(())
9625        }
9626    }
9627
9628    impl fidl::encoding::ResourceTypeMarker for FlatlandCreateFilledRectRequest {
9629        type Borrowed<'a> = &'a mut Self;
9630        fn take_or_borrow<'a>(
9631            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9632        ) -> Self::Borrowed<'a> {
9633            value
9634        }
9635    }
9636
9637    unsafe impl fidl::encoding::TypeMarker for FlatlandCreateFilledRectRequest {
9638        type Owned = Self;
9639
9640        #[inline(always)]
9641        fn inline_align(_context: fidl::encoding::Context) -> usize {
9642            8
9643        }
9644
9645        #[inline(always)]
9646        fn inline_size(_context: fidl::encoding::Context) -> usize {
9647            8
9648        }
9649        #[inline(always)]
9650        fn encode_is_copy() -> bool {
9651            true
9652        }
9653
9654        #[inline(always)]
9655        fn decode_is_copy() -> bool {
9656            true
9657        }
9658    }
9659
9660    unsafe impl
9661        fidl::encoding::Encode<
9662            FlatlandCreateFilledRectRequest,
9663            fidl::encoding::DefaultFuchsiaResourceDialect,
9664        > for &mut FlatlandCreateFilledRectRequest
9665    {
9666        #[inline]
9667        unsafe fn encode(
9668            self,
9669            encoder: &mut fidl::encoding::Encoder<
9670                '_,
9671                fidl::encoding::DefaultFuchsiaResourceDialect,
9672            >,
9673            offset: usize,
9674            _depth: fidl::encoding::Depth,
9675        ) -> fidl::Result<()> {
9676            encoder.debug_check_bounds::<FlatlandCreateFilledRectRequest>(offset);
9677            unsafe {
9678                // Copy the object into the buffer.
9679                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
9680                (buf_ptr as *mut FlatlandCreateFilledRectRequest)
9681                    .write_unaligned((self as *const FlatlandCreateFilledRectRequest).read());
9682                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
9683                // done second because the memcpy will write garbage to these bytes.
9684            }
9685            Ok(())
9686        }
9687    }
9688    unsafe impl<
9689        T0: fidl::encoding::Encode<ContentId, fidl::encoding::DefaultFuchsiaResourceDialect>,
9690    >
9691        fidl::encoding::Encode<
9692            FlatlandCreateFilledRectRequest,
9693            fidl::encoding::DefaultFuchsiaResourceDialect,
9694        > for (T0,)
9695    {
9696        #[inline]
9697        unsafe fn encode(
9698            self,
9699            encoder: &mut fidl::encoding::Encoder<
9700                '_,
9701                fidl::encoding::DefaultFuchsiaResourceDialect,
9702            >,
9703            offset: usize,
9704            depth: fidl::encoding::Depth,
9705        ) -> fidl::Result<()> {
9706            encoder.debug_check_bounds::<FlatlandCreateFilledRectRequest>(offset);
9707            // Zero out padding regions. There's no need to apply masks
9708            // because the unmasked parts will be overwritten by fields.
9709            // Write the fields.
9710            self.0.encode(encoder, offset + 0, depth)?;
9711            Ok(())
9712        }
9713    }
9714
9715    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
9716        for FlatlandCreateFilledRectRequest
9717    {
9718        #[inline(always)]
9719        fn new_empty() -> Self {
9720            Self {
9721                rect_id: fidl::new_empty!(ContentId, fidl::encoding::DefaultFuchsiaResourceDialect),
9722            }
9723        }
9724
9725        #[inline]
9726        unsafe fn decode(
9727            &mut self,
9728            decoder: &mut fidl::encoding::Decoder<
9729                '_,
9730                fidl::encoding::DefaultFuchsiaResourceDialect,
9731            >,
9732            offset: usize,
9733            _depth: fidl::encoding::Depth,
9734        ) -> fidl::Result<()> {
9735            decoder.debug_check_bounds::<Self>(offset);
9736            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
9737            // Verify that padding bytes are zero.
9738            // Copy from the buffer into the object.
9739            unsafe {
9740                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
9741            }
9742            Ok(())
9743        }
9744    }
9745
9746    impl fidl::encoding::ResourceTypeMarker for FlatlandCreateImageRequest {
9747        type Borrowed<'a> = &'a mut Self;
9748        fn take_or_borrow<'a>(
9749            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9750        ) -> Self::Borrowed<'a> {
9751            value
9752        }
9753    }
9754
9755    unsafe impl fidl::encoding::TypeMarker for FlatlandCreateImageRequest {
9756        type Owned = Self;
9757
9758        #[inline(always)]
9759        fn inline_align(_context: fidl::encoding::Context) -> usize {
9760            8
9761        }
9762
9763        #[inline(always)]
9764        fn inline_size(_context: fidl::encoding::Context) -> usize {
9765            32
9766        }
9767    }
9768
9769    unsafe impl
9770        fidl::encoding::Encode<
9771            FlatlandCreateImageRequest,
9772            fidl::encoding::DefaultFuchsiaResourceDialect,
9773        > for &mut FlatlandCreateImageRequest
9774    {
9775        #[inline]
9776        unsafe fn encode(
9777            self,
9778            encoder: &mut fidl::encoding::Encoder<
9779                '_,
9780                fidl::encoding::DefaultFuchsiaResourceDialect,
9781            >,
9782            offset: usize,
9783            _depth: fidl::encoding::Depth,
9784        ) -> fidl::Result<()> {
9785            encoder.debug_check_bounds::<FlatlandCreateImageRequest>(offset);
9786            // Delegate to tuple encoding.
9787            fidl::encoding::Encode::<FlatlandCreateImageRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
9788                (
9789                    <ContentId as fidl::encoding::ValueTypeMarker>::borrow(&self.image_id),
9790                    <BufferCollectionImportToken as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.import_token),
9791                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.vmo_index),
9792                    <ImageProperties as fidl::encoding::ValueTypeMarker>::borrow(&self.properties),
9793                ),
9794                encoder, offset, _depth
9795            )
9796        }
9797    }
9798    unsafe impl<
9799        T0: fidl::encoding::Encode<ContentId, fidl::encoding::DefaultFuchsiaResourceDialect>,
9800        T1: fidl::encoding::Encode<
9801                BufferCollectionImportToken,
9802                fidl::encoding::DefaultFuchsiaResourceDialect,
9803            >,
9804        T2: fidl::encoding::Encode<u32, fidl::encoding::DefaultFuchsiaResourceDialect>,
9805        T3: fidl::encoding::Encode<ImageProperties, fidl::encoding::DefaultFuchsiaResourceDialect>,
9806    >
9807        fidl::encoding::Encode<
9808            FlatlandCreateImageRequest,
9809            fidl::encoding::DefaultFuchsiaResourceDialect,
9810        > for (T0, T1, T2, T3)
9811    {
9812        #[inline]
9813        unsafe fn encode(
9814            self,
9815            encoder: &mut fidl::encoding::Encoder<
9816                '_,
9817                fidl::encoding::DefaultFuchsiaResourceDialect,
9818            >,
9819            offset: usize,
9820            depth: fidl::encoding::Depth,
9821        ) -> fidl::Result<()> {
9822            encoder.debug_check_bounds::<FlatlandCreateImageRequest>(offset);
9823            // Zero out padding regions. There's no need to apply masks
9824            // because the unmasked parts will be overwritten by fields.
9825            // Write the fields.
9826            self.0.encode(encoder, offset + 0, depth)?;
9827            self.1.encode(encoder, offset + 8, depth)?;
9828            self.2.encode(encoder, offset + 12, depth)?;
9829            self.3.encode(encoder, offset + 16, depth)?;
9830            Ok(())
9831        }
9832    }
9833
9834    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
9835        for FlatlandCreateImageRequest
9836    {
9837        #[inline(always)]
9838        fn new_empty() -> Self {
9839            Self {
9840                image_id: fidl::new_empty!(
9841                    ContentId,
9842                    fidl::encoding::DefaultFuchsiaResourceDialect
9843                ),
9844                import_token: fidl::new_empty!(
9845                    BufferCollectionImportToken,
9846                    fidl::encoding::DefaultFuchsiaResourceDialect
9847                ),
9848                vmo_index: fidl::new_empty!(u32, fidl::encoding::DefaultFuchsiaResourceDialect),
9849                properties: fidl::new_empty!(
9850                    ImageProperties,
9851                    fidl::encoding::DefaultFuchsiaResourceDialect
9852                ),
9853            }
9854        }
9855
9856        #[inline]
9857        unsafe fn decode(
9858            &mut self,
9859            decoder: &mut fidl::encoding::Decoder<
9860                '_,
9861                fidl::encoding::DefaultFuchsiaResourceDialect,
9862            >,
9863            offset: usize,
9864            _depth: fidl::encoding::Depth,
9865        ) -> fidl::Result<()> {
9866            decoder.debug_check_bounds::<Self>(offset);
9867            // Verify that padding bytes are zero.
9868            fidl::decode!(
9869                ContentId,
9870                fidl::encoding::DefaultFuchsiaResourceDialect,
9871                &mut self.image_id,
9872                decoder,
9873                offset + 0,
9874                _depth
9875            )?;
9876            fidl::decode!(
9877                BufferCollectionImportToken,
9878                fidl::encoding::DefaultFuchsiaResourceDialect,
9879                &mut self.import_token,
9880                decoder,
9881                offset + 8,
9882                _depth
9883            )?;
9884            fidl::decode!(
9885                u32,
9886                fidl::encoding::DefaultFuchsiaResourceDialect,
9887                &mut self.vmo_index,
9888                decoder,
9889                offset + 12,
9890                _depth
9891            )?;
9892            fidl::decode!(
9893                ImageProperties,
9894                fidl::encoding::DefaultFuchsiaResourceDialect,
9895                &mut self.properties,
9896                decoder,
9897                offset + 16,
9898                _depth
9899            )?;
9900            Ok(())
9901        }
9902    }
9903
9904    impl fidl::encoding::ResourceTypeMarker for FlatlandCreateView2Request {
9905        type Borrowed<'a> = &'a mut Self;
9906        fn take_or_borrow<'a>(
9907            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9908        ) -> Self::Borrowed<'a> {
9909            value
9910        }
9911    }
9912
9913    unsafe impl fidl::encoding::TypeMarker for FlatlandCreateView2Request {
9914        type Owned = Self;
9915
9916        #[inline(always)]
9917        fn inline_align(_context: fidl::encoding::Context) -> usize {
9918            8
9919        }
9920
9921        #[inline(always)]
9922        fn inline_size(_context: fidl::encoding::Context) -> usize {
9923            40
9924        }
9925    }
9926
9927    unsafe impl
9928        fidl::encoding::Encode<
9929            FlatlandCreateView2Request,
9930            fidl::encoding::DefaultFuchsiaResourceDialect,
9931        > for &mut FlatlandCreateView2Request
9932    {
9933        #[inline]
9934        unsafe fn encode(
9935            self,
9936            encoder: &mut fidl::encoding::Encoder<
9937                '_,
9938                fidl::encoding::DefaultFuchsiaResourceDialect,
9939            >,
9940            offset: usize,
9941            _depth: fidl::encoding::Depth,
9942        ) -> fidl::Result<()> {
9943            encoder.debug_check_bounds::<FlatlandCreateView2Request>(offset);
9944            // Delegate to tuple encoding.
9945            fidl::encoding::Encode::<FlatlandCreateView2Request, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
9946                (
9947                    <fidl_fuchsia_ui_views::ViewCreationToken as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.token),
9948                    <fidl_fuchsia_ui_views::ViewIdentityOnCreation as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.view_identity),
9949                    <ViewBoundProtocols as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.protocols),
9950                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.parent_viewport_watcher),
9951                ),
9952                encoder, offset, _depth
9953            )
9954        }
9955    }
9956    unsafe impl<
9957        T0: fidl::encoding::Encode<
9958                fidl_fuchsia_ui_views::ViewCreationToken,
9959                fidl::encoding::DefaultFuchsiaResourceDialect,
9960            >,
9961        T1: fidl::encoding::Encode<
9962                fidl_fuchsia_ui_views::ViewIdentityOnCreation,
9963                fidl::encoding::DefaultFuchsiaResourceDialect,
9964            >,
9965        T2: fidl::encoding::Encode<ViewBoundProtocols, fidl::encoding::DefaultFuchsiaResourceDialect>,
9966        T3: fidl::encoding::Encode<
9967                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>>,
9968                fidl::encoding::DefaultFuchsiaResourceDialect,
9969            >,
9970    >
9971        fidl::encoding::Encode<
9972            FlatlandCreateView2Request,
9973            fidl::encoding::DefaultFuchsiaResourceDialect,
9974        > for (T0, T1, T2, T3)
9975    {
9976        #[inline]
9977        unsafe fn encode(
9978            self,
9979            encoder: &mut fidl::encoding::Encoder<
9980                '_,
9981                fidl::encoding::DefaultFuchsiaResourceDialect,
9982            >,
9983            offset: usize,
9984            depth: fidl::encoding::Depth,
9985        ) -> fidl::Result<()> {
9986            encoder.debug_check_bounds::<FlatlandCreateView2Request>(offset);
9987            // Zero out padding regions. There's no need to apply masks
9988            // because the unmasked parts will be overwritten by fields.
9989            unsafe {
9990                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
9991                (ptr as *mut u64).write_unaligned(0);
9992            }
9993            unsafe {
9994                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(32);
9995                (ptr as *mut u64).write_unaligned(0);
9996            }
9997            // Write the fields.
9998            self.0.encode(encoder, offset + 0, depth)?;
9999            self.1.encode(encoder, offset + 4, depth)?;
10000            self.2.encode(encoder, offset + 16, depth)?;
10001            self.3.encode(encoder, offset + 32, depth)?;
10002            Ok(())
10003        }
10004    }
10005
10006    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10007        for FlatlandCreateView2Request
10008    {
10009        #[inline(always)]
10010        fn new_empty() -> Self {
10011            Self {
10012                token: fidl::new_empty!(
10013                    fidl_fuchsia_ui_views::ViewCreationToken,
10014                    fidl::encoding::DefaultFuchsiaResourceDialect
10015                ),
10016                view_identity: fidl::new_empty!(
10017                    fidl_fuchsia_ui_views::ViewIdentityOnCreation,
10018                    fidl::encoding::DefaultFuchsiaResourceDialect
10019                ),
10020                protocols: fidl::new_empty!(
10021                    ViewBoundProtocols,
10022                    fidl::encoding::DefaultFuchsiaResourceDialect
10023                ),
10024                parent_viewport_watcher: fidl::new_empty!(
10025                    fidl::encoding::Endpoint<
10026                        fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>,
10027                    >,
10028                    fidl::encoding::DefaultFuchsiaResourceDialect
10029                ),
10030            }
10031        }
10032
10033        #[inline]
10034        unsafe fn decode(
10035            &mut self,
10036            decoder: &mut fidl::encoding::Decoder<
10037                '_,
10038                fidl::encoding::DefaultFuchsiaResourceDialect,
10039            >,
10040            offset: usize,
10041            _depth: fidl::encoding::Depth,
10042        ) -> fidl::Result<()> {
10043            decoder.debug_check_bounds::<Self>(offset);
10044            // Verify that padding bytes are zero.
10045            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(8) };
10046            let padval = unsafe { (ptr as *const u64).read_unaligned() };
10047            let mask = 0xffffffff00000000u64;
10048            let maskedval = padval & mask;
10049            if maskedval != 0 {
10050                return Err(fidl::Error::NonZeroPadding {
10051                    padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
10052                });
10053            }
10054            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(32) };
10055            let padval = unsafe { (ptr as *const u64).read_unaligned() };
10056            let mask = 0xffffffff00000000u64;
10057            let maskedval = padval & mask;
10058            if maskedval != 0 {
10059                return Err(fidl::Error::NonZeroPadding {
10060                    padding_start: offset + 32 + ((mask as u64).trailing_zeros() / 8) as usize,
10061                });
10062            }
10063            fidl::decode!(
10064                fidl_fuchsia_ui_views::ViewCreationToken,
10065                fidl::encoding::DefaultFuchsiaResourceDialect,
10066                &mut self.token,
10067                decoder,
10068                offset + 0,
10069                _depth
10070            )?;
10071            fidl::decode!(
10072                fidl_fuchsia_ui_views::ViewIdentityOnCreation,
10073                fidl::encoding::DefaultFuchsiaResourceDialect,
10074                &mut self.view_identity,
10075                decoder,
10076                offset + 4,
10077                _depth
10078            )?;
10079            fidl::decode!(
10080                ViewBoundProtocols,
10081                fidl::encoding::DefaultFuchsiaResourceDialect,
10082                &mut self.protocols,
10083                decoder,
10084                offset + 16,
10085                _depth
10086            )?;
10087            fidl::decode!(
10088                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>>,
10089                fidl::encoding::DefaultFuchsiaResourceDialect,
10090                &mut self.parent_viewport_watcher,
10091                decoder,
10092                offset + 32,
10093                _depth
10094            )?;
10095            Ok(())
10096        }
10097    }
10098
10099    impl fidl::encoding::ResourceTypeMarker for FlatlandCreateViewRequest {
10100        type Borrowed<'a> = &'a mut Self;
10101        fn take_or_borrow<'a>(
10102            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10103        ) -> Self::Borrowed<'a> {
10104            value
10105        }
10106    }
10107
10108    unsafe impl fidl::encoding::TypeMarker for FlatlandCreateViewRequest {
10109        type Owned = Self;
10110
10111        #[inline(always)]
10112        fn inline_align(_context: fidl::encoding::Context) -> usize {
10113            4
10114        }
10115
10116        #[inline(always)]
10117        fn inline_size(_context: fidl::encoding::Context) -> usize {
10118            8
10119        }
10120    }
10121
10122    unsafe impl
10123        fidl::encoding::Encode<
10124            FlatlandCreateViewRequest,
10125            fidl::encoding::DefaultFuchsiaResourceDialect,
10126        > for &mut FlatlandCreateViewRequest
10127    {
10128        #[inline]
10129        unsafe fn encode(
10130            self,
10131            encoder: &mut fidl::encoding::Encoder<
10132                '_,
10133                fidl::encoding::DefaultFuchsiaResourceDialect,
10134            >,
10135            offset: usize,
10136            _depth: fidl::encoding::Depth,
10137        ) -> fidl::Result<()> {
10138            encoder.debug_check_bounds::<FlatlandCreateViewRequest>(offset);
10139            // Delegate to tuple encoding.
10140            fidl::encoding::Encode::<FlatlandCreateViewRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
10141                (
10142                    <fidl_fuchsia_ui_views::ViewCreationToken as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.token),
10143                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.parent_viewport_watcher),
10144                ),
10145                encoder, offset, _depth
10146            )
10147        }
10148    }
10149    unsafe impl<
10150        T0: fidl::encoding::Encode<
10151                fidl_fuchsia_ui_views::ViewCreationToken,
10152                fidl::encoding::DefaultFuchsiaResourceDialect,
10153            >,
10154        T1: fidl::encoding::Encode<
10155                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>>,
10156                fidl::encoding::DefaultFuchsiaResourceDialect,
10157            >,
10158    >
10159        fidl::encoding::Encode<
10160            FlatlandCreateViewRequest,
10161            fidl::encoding::DefaultFuchsiaResourceDialect,
10162        > for (T0, T1)
10163    {
10164        #[inline]
10165        unsafe fn encode(
10166            self,
10167            encoder: &mut fidl::encoding::Encoder<
10168                '_,
10169                fidl::encoding::DefaultFuchsiaResourceDialect,
10170            >,
10171            offset: usize,
10172            depth: fidl::encoding::Depth,
10173        ) -> fidl::Result<()> {
10174            encoder.debug_check_bounds::<FlatlandCreateViewRequest>(offset);
10175            // Zero out padding regions. There's no need to apply masks
10176            // because the unmasked parts will be overwritten by fields.
10177            // Write the fields.
10178            self.0.encode(encoder, offset + 0, depth)?;
10179            self.1.encode(encoder, offset + 4, depth)?;
10180            Ok(())
10181        }
10182    }
10183
10184    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10185        for FlatlandCreateViewRequest
10186    {
10187        #[inline(always)]
10188        fn new_empty() -> Self {
10189            Self {
10190                token: fidl::new_empty!(
10191                    fidl_fuchsia_ui_views::ViewCreationToken,
10192                    fidl::encoding::DefaultFuchsiaResourceDialect
10193                ),
10194                parent_viewport_watcher: fidl::new_empty!(
10195                    fidl::encoding::Endpoint<
10196                        fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>,
10197                    >,
10198                    fidl::encoding::DefaultFuchsiaResourceDialect
10199                ),
10200            }
10201        }
10202
10203        #[inline]
10204        unsafe fn decode(
10205            &mut self,
10206            decoder: &mut fidl::encoding::Decoder<
10207                '_,
10208                fidl::encoding::DefaultFuchsiaResourceDialect,
10209            >,
10210            offset: usize,
10211            _depth: fidl::encoding::Depth,
10212        ) -> fidl::Result<()> {
10213            decoder.debug_check_bounds::<Self>(offset);
10214            // Verify that padding bytes are zero.
10215            fidl::decode!(
10216                fidl_fuchsia_ui_views::ViewCreationToken,
10217                fidl::encoding::DefaultFuchsiaResourceDialect,
10218                &mut self.token,
10219                decoder,
10220                offset + 0,
10221                _depth
10222            )?;
10223            fidl::decode!(
10224                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>>,
10225                fidl::encoding::DefaultFuchsiaResourceDialect,
10226                &mut self.parent_viewport_watcher,
10227                decoder,
10228                offset + 4,
10229                _depth
10230            )?;
10231            Ok(())
10232        }
10233    }
10234
10235    impl fidl::encoding::ResourceTypeMarker for FlatlandCreateViewportRequest {
10236        type Borrowed<'a> = &'a mut Self;
10237        fn take_or_borrow<'a>(
10238            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10239        ) -> Self::Borrowed<'a> {
10240            value
10241        }
10242    }
10243
10244    unsafe impl fidl::encoding::TypeMarker for FlatlandCreateViewportRequest {
10245        type Owned = Self;
10246
10247        #[inline(always)]
10248        fn inline_align(_context: fidl::encoding::Context) -> usize {
10249            8
10250        }
10251
10252        #[inline(always)]
10253        fn inline_size(_context: fidl::encoding::Context) -> usize {
10254            40
10255        }
10256    }
10257
10258    unsafe impl
10259        fidl::encoding::Encode<
10260            FlatlandCreateViewportRequest,
10261            fidl::encoding::DefaultFuchsiaResourceDialect,
10262        > for &mut FlatlandCreateViewportRequest
10263    {
10264        #[inline]
10265        unsafe fn encode(
10266            self,
10267            encoder: &mut fidl::encoding::Encoder<
10268                '_,
10269                fidl::encoding::DefaultFuchsiaResourceDialect,
10270            >,
10271            offset: usize,
10272            _depth: fidl::encoding::Depth,
10273        ) -> fidl::Result<()> {
10274            encoder.debug_check_bounds::<FlatlandCreateViewportRequest>(offset);
10275            // Delegate to tuple encoding.
10276            fidl::encoding::Encode::<FlatlandCreateViewportRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
10277                (
10278                    <ContentId as fidl::encoding::ValueTypeMarker>::borrow(&self.viewport_id),
10279                    <fidl_fuchsia_ui_views::ViewportCreationToken as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.token),
10280                    <ViewportProperties as fidl::encoding::ValueTypeMarker>::borrow(&self.properties),
10281                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ChildViewWatcherMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.child_view_watcher),
10282                ),
10283                encoder, offset, _depth
10284            )
10285        }
10286    }
10287    unsafe impl<
10288        T0: fidl::encoding::Encode<ContentId, fidl::encoding::DefaultFuchsiaResourceDialect>,
10289        T1: fidl::encoding::Encode<
10290                fidl_fuchsia_ui_views::ViewportCreationToken,
10291                fidl::encoding::DefaultFuchsiaResourceDialect,
10292            >,
10293        T2: fidl::encoding::Encode<ViewportProperties, fidl::encoding::DefaultFuchsiaResourceDialect>,
10294        T3: fidl::encoding::Encode<
10295                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ChildViewWatcherMarker>>,
10296                fidl::encoding::DefaultFuchsiaResourceDialect,
10297            >,
10298    >
10299        fidl::encoding::Encode<
10300            FlatlandCreateViewportRequest,
10301            fidl::encoding::DefaultFuchsiaResourceDialect,
10302        > for (T0, T1, T2, T3)
10303    {
10304        #[inline]
10305        unsafe fn encode(
10306            self,
10307            encoder: &mut fidl::encoding::Encoder<
10308                '_,
10309                fidl::encoding::DefaultFuchsiaResourceDialect,
10310            >,
10311            offset: usize,
10312            depth: fidl::encoding::Depth,
10313        ) -> fidl::Result<()> {
10314            encoder.debug_check_bounds::<FlatlandCreateViewportRequest>(offset);
10315            // Zero out padding regions. There's no need to apply masks
10316            // because the unmasked parts will be overwritten by fields.
10317            unsafe {
10318                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
10319                (ptr as *mut u64).write_unaligned(0);
10320            }
10321            unsafe {
10322                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(32);
10323                (ptr as *mut u64).write_unaligned(0);
10324            }
10325            // Write the fields.
10326            self.0.encode(encoder, offset + 0, depth)?;
10327            self.1.encode(encoder, offset + 8, depth)?;
10328            self.2.encode(encoder, offset + 16, depth)?;
10329            self.3.encode(encoder, offset + 32, depth)?;
10330            Ok(())
10331        }
10332    }
10333
10334    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10335        for FlatlandCreateViewportRequest
10336    {
10337        #[inline(always)]
10338        fn new_empty() -> Self {
10339            Self {
10340                viewport_id: fidl::new_empty!(
10341                    ContentId,
10342                    fidl::encoding::DefaultFuchsiaResourceDialect
10343                ),
10344                token: fidl::new_empty!(
10345                    fidl_fuchsia_ui_views::ViewportCreationToken,
10346                    fidl::encoding::DefaultFuchsiaResourceDialect
10347                ),
10348                properties: fidl::new_empty!(
10349                    ViewportProperties,
10350                    fidl::encoding::DefaultFuchsiaResourceDialect
10351                ),
10352                child_view_watcher: fidl::new_empty!(
10353                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ChildViewWatcherMarker>>,
10354                    fidl::encoding::DefaultFuchsiaResourceDialect
10355                ),
10356            }
10357        }
10358
10359        #[inline]
10360        unsafe fn decode(
10361            &mut self,
10362            decoder: &mut fidl::encoding::Decoder<
10363                '_,
10364                fidl::encoding::DefaultFuchsiaResourceDialect,
10365            >,
10366            offset: usize,
10367            _depth: fidl::encoding::Depth,
10368        ) -> fidl::Result<()> {
10369            decoder.debug_check_bounds::<Self>(offset);
10370            // Verify that padding bytes are zero.
10371            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(8) };
10372            let padval = unsafe { (ptr as *const u64).read_unaligned() };
10373            let mask = 0xffffffff00000000u64;
10374            let maskedval = padval & mask;
10375            if maskedval != 0 {
10376                return Err(fidl::Error::NonZeroPadding {
10377                    padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
10378                });
10379            }
10380            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(32) };
10381            let padval = unsafe { (ptr as *const u64).read_unaligned() };
10382            let mask = 0xffffffff00000000u64;
10383            let maskedval = padval & mask;
10384            if maskedval != 0 {
10385                return Err(fidl::Error::NonZeroPadding {
10386                    padding_start: offset + 32 + ((mask as u64).trailing_zeros() / 8) as usize,
10387                });
10388            }
10389            fidl::decode!(
10390                ContentId,
10391                fidl::encoding::DefaultFuchsiaResourceDialect,
10392                &mut self.viewport_id,
10393                decoder,
10394                offset + 0,
10395                _depth
10396            )?;
10397            fidl::decode!(
10398                fidl_fuchsia_ui_views::ViewportCreationToken,
10399                fidl::encoding::DefaultFuchsiaResourceDialect,
10400                &mut self.token,
10401                decoder,
10402                offset + 8,
10403                _depth
10404            )?;
10405            fidl::decode!(
10406                ViewportProperties,
10407                fidl::encoding::DefaultFuchsiaResourceDialect,
10408                &mut self.properties,
10409                decoder,
10410                offset + 16,
10411                _depth
10412            )?;
10413            fidl::decode!(
10414                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ChildViewWatcherMarker>>,
10415                fidl::encoding::DefaultFuchsiaResourceDialect,
10416                &mut self.child_view_watcher,
10417                decoder,
10418                offset + 32,
10419                _depth
10420            )?;
10421            Ok(())
10422        }
10423    }
10424
10425    impl fidl::encoding::ResourceTypeMarker for FlatlandDisplaySetContentRequest {
10426        type Borrowed<'a> = &'a mut Self;
10427        fn take_or_borrow<'a>(
10428            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10429        ) -> Self::Borrowed<'a> {
10430            value
10431        }
10432    }
10433
10434    unsafe impl fidl::encoding::TypeMarker for FlatlandDisplaySetContentRequest {
10435        type Owned = Self;
10436
10437        #[inline(always)]
10438        fn inline_align(_context: fidl::encoding::Context) -> usize {
10439            4
10440        }
10441
10442        #[inline(always)]
10443        fn inline_size(_context: fidl::encoding::Context) -> usize {
10444            8
10445        }
10446    }
10447
10448    unsafe impl
10449        fidl::encoding::Encode<
10450            FlatlandDisplaySetContentRequest,
10451            fidl::encoding::DefaultFuchsiaResourceDialect,
10452        > for &mut FlatlandDisplaySetContentRequest
10453    {
10454        #[inline]
10455        unsafe fn encode(
10456            self,
10457            encoder: &mut fidl::encoding::Encoder<
10458                '_,
10459                fidl::encoding::DefaultFuchsiaResourceDialect,
10460            >,
10461            offset: usize,
10462            _depth: fidl::encoding::Depth,
10463        ) -> fidl::Result<()> {
10464            encoder.debug_check_bounds::<FlatlandDisplaySetContentRequest>(offset);
10465            // Delegate to tuple encoding.
10466            fidl::encoding::Encode::<FlatlandDisplaySetContentRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
10467                (
10468                    <fidl_fuchsia_ui_views::ViewportCreationToken as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.token),
10469                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ChildViewWatcherMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.child_view_watcher),
10470                ),
10471                encoder, offset, _depth
10472            )
10473        }
10474    }
10475    unsafe impl<
10476        T0: fidl::encoding::Encode<
10477                fidl_fuchsia_ui_views::ViewportCreationToken,
10478                fidl::encoding::DefaultFuchsiaResourceDialect,
10479            >,
10480        T1: fidl::encoding::Encode<
10481                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ChildViewWatcherMarker>>,
10482                fidl::encoding::DefaultFuchsiaResourceDialect,
10483            >,
10484    >
10485        fidl::encoding::Encode<
10486            FlatlandDisplaySetContentRequest,
10487            fidl::encoding::DefaultFuchsiaResourceDialect,
10488        > for (T0, T1)
10489    {
10490        #[inline]
10491        unsafe fn encode(
10492            self,
10493            encoder: &mut fidl::encoding::Encoder<
10494                '_,
10495                fidl::encoding::DefaultFuchsiaResourceDialect,
10496            >,
10497            offset: usize,
10498            depth: fidl::encoding::Depth,
10499        ) -> fidl::Result<()> {
10500            encoder.debug_check_bounds::<FlatlandDisplaySetContentRequest>(offset);
10501            // Zero out padding regions. There's no need to apply masks
10502            // because the unmasked parts will be overwritten by fields.
10503            // Write the fields.
10504            self.0.encode(encoder, offset + 0, depth)?;
10505            self.1.encode(encoder, offset + 4, depth)?;
10506            Ok(())
10507        }
10508    }
10509
10510    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10511        for FlatlandDisplaySetContentRequest
10512    {
10513        #[inline(always)]
10514        fn new_empty() -> Self {
10515            Self {
10516                token: fidl::new_empty!(
10517                    fidl_fuchsia_ui_views::ViewportCreationToken,
10518                    fidl::encoding::DefaultFuchsiaResourceDialect
10519                ),
10520                child_view_watcher: fidl::new_empty!(
10521                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ChildViewWatcherMarker>>,
10522                    fidl::encoding::DefaultFuchsiaResourceDialect
10523                ),
10524            }
10525        }
10526
10527        #[inline]
10528        unsafe fn decode(
10529            &mut self,
10530            decoder: &mut fidl::encoding::Decoder<
10531                '_,
10532                fidl::encoding::DefaultFuchsiaResourceDialect,
10533            >,
10534            offset: usize,
10535            _depth: fidl::encoding::Depth,
10536        ) -> fidl::Result<()> {
10537            decoder.debug_check_bounds::<Self>(offset);
10538            // Verify that padding bytes are zero.
10539            fidl::decode!(
10540                fidl_fuchsia_ui_views::ViewportCreationToken,
10541                fidl::encoding::DefaultFuchsiaResourceDialect,
10542                &mut self.token,
10543                decoder,
10544                offset + 0,
10545                _depth
10546            )?;
10547            fidl::decode!(
10548                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ChildViewWatcherMarker>>,
10549                fidl::encoding::DefaultFuchsiaResourceDialect,
10550                &mut self.child_view_watcher,
10551                decoder,
10552                offset + 4,
10553                _depth
10554            )?;
10555            Ok(())
10556        }
10557    }
10558
10559    impl fidl::encoding::ResourceTypeMarker for FlatlandPresentRequest {
10560        type Borrowed<'a> = &'a mut Self;
10561        fn take_or_borrow<'a>(
10562            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10563        ) -> Self::Borrowed<'a> {
10564            value
10565        }
10566    }
10567
10568    unsafe impl fidl::encoding::TypeMarker for FlatlandPresentRequest {
10569        type Owned = Self;
10570
10571        #[inline(always)]
10572        fn inline_align(_context: fidl::encoding::Context) -> usize {
10573            8
10574        }
10575
10576        #[inline(always)]
10577        fn inline_size(_context: fidl::encoding::Context) -> usize {
10578            16
10579        }
10580    }
10581
10582    unsafe impl
10583        fidl::encoding::Encode<
10584            FlatlandPresentRequest,
10585            fidl::encoding::DefaultFuchsiaResourceDialect,
10586        > for &mut FlatlandPresentRequest
10587    {
10588        #[inline]
10589        unsafe fn encode(
10590            self,
10591            encoder: &mut fidl::encoding::Encoder<
10592                '_,
10593                fidl::encoding::DefaultFuchsiaResourceDialect,
10594            >,
10595            offset: usize,
10596            _depth: fidl::encoding::Depth,
10597        ) -> fidl::Result<()> {
10598            encoder.debug_check_bounds::<FlatlandPresentRequest>(offset);
10599            // Delegate to tuple encoding.
10600            fidl::encoding::Encode::<
10601                FlatlandPresentRequest,
10602                fidl::encoding::DefaultFuchsiaResourceDialect,
10603            >::encode(
10604                (<PresentArgs as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
10605                    &mut self.args,
10606                ),),
10607                encoder,
10608                offset,
10609                _depth,
10610            )
10611        }
10612    }
10613    unsafe impl<
10614        T0: fidl::encoding::Encode<PresentArgs, fidl::encoding::DefaultFuchsiaResourceDialect>,
10615    >
10616        fidl::encoding::Encode<
10617            FlatlandPresentRequest,
10618            fidl::encoding::DefaultFuchsiaResourceDialect,
10619        > for (T0,)
10620    {
10621        #[inline]
10622        unsafe fn encode(
10623            self,
10624            encoder: &mut fidl::encoding::Encoder<
10625                '_,
10626                fidl::encoding::DefaultFuchsiaResourceDialect,
10627            >,
10628            offset: usize,
10629            depth: fidl::encoding::Depth,
10630        ) -> fidl::Result<()> {
10631            encoder.debug_check_bounds::<FlatlandPresentRequest>(offset);
10632            // Zero out padding regions. There's no need to apply masks
10633            // because the unmasked parts will be overwritten by fields.
10634            // Write the fields.
10635            self.0.encode(encoder, offset + 0, depth)?;
10636            Ok(())
10637        }
10638    }
10639
10640    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10641        for FlatlandPresentRequest
10642    {
10643        #[inline(always)]
10644        fn new_empty() -> Self {
10645            Self {
10646                args: fidl::new_empty!(PresentArgs, fidl::encoding::DefaultFuchsiaResourceDialect),
10647            }
10648        }
10649
10650        #[inline]
10651        unsafe fn decode(
10652            &mut self,
10653            decoder: &mut fidl::encoding::Decoder<
10654                '_,
10655                fidl::encoding::DefaultFuchsiaResourceDialect,
10656            >,
10657            offset: usize,
10658            _depth: fidl::encoding::Depth,
10659        ) -> fidl::Result<()> {
10660            decoder.debug_check_bounds::<Self>(offset);
10661            // Verify that padding bytes are zero.
10662            fidl::decode!(
10663                PresentArgs,
10664                fidl::encoding::DefaultFuchsiaResourceDialect,
10665                &mut self.args,
10666                decoder,
10667                offset + 0,
10668                _depth
10669            )?;
10670            Ok(())
10671        }
10672    }
10673
10674    impl fidl::encoding::ResourceTypeMarker for FlatlandReleaseViewportResponse {
10675        type Borrowed<'a> = &'a mut Self;
10676        fn take_or_borrow<'a>(
10677            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10678        ) -> Self::Borrowed<'a> {
10679            value
10680        }
10681    }
10682
10683    unsafe impl fidl::encoding::TypeMarker for FlatlandReleaseViewportResponse {
10684        type Owned = Self;
10685
10686        #[inline(always)]
10687        fn inline_align(_context: fidl::encoding::Context) -> usize {
10688            4
10689        }
10690
10691        #[inline(always)]
10692        fn inline_size(_context: fidl::encoding::Context) -> usize {
10693            4
10694        }
10695    }
10696
10697    unsafe impl
10698        fidl::encoding::Encode<
10699            FlatlandReleaseViewportResponse,
10700            fidl::encoding::DefaultFuchsiaResourceDialect,
10701        > for &mut FlatlandReleaseViewportResponse
10702    {
10703        #[inline]
10704        unsafe fn encode(
10705            self,
10706            encoder: &mut fidl::encoding::Encoder<
10707                '_,
10708                fidl::encoding::DefaultFuchsiaResourceDialect,
10709            >,
10710            offset: usize,
10711            _depth: fidl::encoding::Depth,
10712        ) -> fidl::Result<()> {
10713            encoder.debug_check_bounds::<FlatlandReleaseViewportResponse>(offset);
10714            // Delegate to tuple encoding.
10715            fidl::encoding::Encode::<FlatlandReleaseViewportResponse, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
10716                (
10717                    <fidl_fuchsia_ui_views::ViewportCreationToken as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.token),
10718                ),
10719                encoder, offset, _depth
10720            )
10721        }
10722    }
10723    unsafe impl<
10724        T0: fidl::encoding::Encode<
10725                fidl_fuchsia_ui_views::ViewportCreationToken,
10726                fidl::encoding::DefaultFuchsiaResourceDialect,
10727            >,
10728    >
10729        fidl::encoding::Encode<
10730            FlatlandReleaseViewportResponse,
10731            fidl::encoding::DefaultFuchsiaResourceDialect,
10732        > for (T0,)
10733    {
10734        #[inline]
10735        unsafe fn encode(
10736            self,
10737            encoder: &mut fidl::encoding::Encoder<
10738                '_,
10739                fidl::encoding::DefaultFuchsiaResourceDialect,
10740            >,
10741            offset: usize,
10742            depth: fidl::encoding::Depth,
10743        ) -> fidl::Result<()> {
10744            encoder.debug_check_bounds::<FlatlandReleaseViewportResponse>(offset);
10745            // Zero out padding regions. There's no need to apply masks
10746            // because the unmasked parts will be overwritten by fields.
10747            // Write the fields.
10748            self.0.encode(encoder, offset + 0, depth)?;
10749            Ok(())
10750        }
10751    }
10752
10753    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10754        for FlatlandReleaseViewportResponse
10755    {
10756        #[inline(always)]
10757        fn new_empty() -> Self {
10758            Self {
10759                token: fidl::new_empty!(
10760                    fidl_fuchsia_ui_views::ViewportCreationToken,
10761                    fidl::encoding::DefaultFuchsiaResourceDialect
10762                ),
10763            }
10764        }
10765
10766        #[inline]
10767        unsafe fn decode(
10768            &mut self,
10769            decoder: &mut fidl::encoding::Decoder<
10770                '_,
10771                fidl::encoding::DefaultFuchsiaResourceDialect,
10772            >,
10773            offset: usize,
10774            _depth: fidl::encoding::Depth,
10775        ) -> fidl::Result<()> {
10776            decoder.debug_check_bounds::<Self>(offset);
10777            // Verify that padding bytes are zero.
10778            fidl::decode!(
10779                fidl_fuchsia_ui_views::ViewportCreationToken,
10780                fidl::encoding::DefaultFuchsiaResourceDialect,
10781                &mut self.token,
10782                decoder,
10783                offset + 0,
10784                _depth
10785            )?;
10786            Ok(())
10787        }
10788    }
10789
10790    impl fidl::encoding::ResourceTypeMarker for FlatlandSetSolidFillRequest {
10791        type Borrowed<'a> = &'a mut Self;
10792        fn take_or_borrow<'a>(
10793            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10794        ) -> Self::Borrowed<'a> {
10795            value
10796        }
10797    }
10798
10799    unsafe impl fidl::encoding::TypeMarker for FlatlandSetSolidFillRequest {
10800        type Owned = Self;
10801
10802        #[inline(always)]
10803        fn inline_align(_context: fidl::encoding::Context) -> usize {
10804            8
10805        }
10806
10807        #[inline(always)]
10808        fn inline_size(_context: fidl::encoding::Context) -> usize {
10809            32
10810        }
10811    }
10812
10813    unsafe impl
10814        fidl::encoding::Encode<
10815            FlatlandSetSolidFillRequest,
10816            fidl::encoding::DefaultFuchsiaResourceDialect,
10817        > for &mut FlatlandSetSolidFillRequest
10818    {
10819        #[inline]
10820        unsafe fn encode(
10821            self,
10822            encoder: &mut fidl::encoding::Encoder<
10823                '_,
10824                fidl::encoding::DefaultFuchsiaResourceDialect,
10825            >,
10826            offset: usize,
10827            _depth: fidl::encoding::Depth,
10828        ) -> fidl::Result<()> {
10829            encoder.debug_check_bounds::<FlatlandSetSolidFillRequest>(offset);
10830            // Delegate to tuple encoding.
10831            fidl::encoding::Encode::<
10832                FlatlandSetSolidFillRequest,
10833                fidl::encoding::DefaultFuchsiaResourceDialect,
10834            >::encode(
10835                (
10836                    <ContentId as fidl::encoding::ValueTypeMarker>::borrow(&self.rect_id),
10837                    <ColorRgba as fidl::encoding::ValueTypeMarker>::borrow(&self.color),
10838                    <fidl_fuchsia_math::SizeU as fidl::encoding::ValueTypeMarker>::borrow(
10839                        &self.size,
10840                    ),
10841                ),
10842                encoder,
10843                offset,
10844                _depth,
10845            )
10846        }
10847    }
10848    unsafe impl<
10849        T0: fidl::encoding::Encode<ContentId, fidl::encoding::DefaultFuchsiaResourceDialect>,
10850        T1: fidl::encoding::Encode<ColorRgba, fidl::encoding::DefaultFuchsiaResourceDialect>,
10851        T2: fidl::encoding::Encode<
10852                fidl_fuchsia_math::SizeU,
10853                fidl::encoding::DefaultFuchsiaResourceDialect,
10854            >,
10855    >
10856        fidl::encoding::Encode<
10857            FlatlandSetSolidFillRequest,
10858            fidl::encoding::DefaultFuchsiaResourceDialect,
10859        > for (T0, T1, T2)
10860    {
10861        #[inline]
10862        unsafe fn encode(
10863            self,
10864            encoder: &mut fidl::encoding::Encoder<
10865                '_,
10866                fidl::encoding::DefaultFuchsiaResourceDialect,
10867            >,
10868            offset: usize,
10869            depth: fidl::encoding::Depth,
10870        ) -> fidl::Result<()> {
10871            encoder.debug_check_bounds::<FlatlandSetSolidFillRequest>(offset);
10872            // Zero out padding regions. There's no need to apply masks
10873            // because the unmasked parts will be overwritten by fields.
10874            // Write the fields.
10875            self.0.encode(encoder, offset + 0, depth)?;
10876            self.1.encode(encoder, offset + 8, depth)?;
10877            self.2.encode(encoder, offset + 24, depth)?;
10878            Ok(())
10879        }
10880    }
10881
10882    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10883        for FlatlandSetSolidFillRequest
10884    {
10885        #[inline(always)]
10886        fn new_empty() -> Self {
10887            Self {
10888                rect_id: fidl::new_empty!(ContentId, fidl::encoding::DefaultFuchsiaResourceDialect),
10889                color: fidl::new_empty!(ColorRgba, fidl::encoding::DefaultFuchsiaResourceDialect),
10890                size: fidl::new_empty!(
10891                    fidl_fuchsia_math::SizeU,
10892                    fidl::encoding::DefaultFuchsiaResourceDialect
10893                ),
10894            }
10895        }
10896
10897        #[inline]
10898        unsafe fn decode(
10899            &mut self,
10900            decoder: &mut fidl::encoding::Decoder<
10901                '_,
10902                fidl::encoding::DefaultFuchsiaResourceDialect,
10903            >,
10904            offset: usize,
10905            _depth: fidl::encoding::Depth,
10906        ) -> fidl::Result<()> {
10907            decoder.debug_check_bounds::<Self>(offset);
10908            // Verify that padding bytes are zero.
10909            fidl::decode!(
10910                ContentId,
10911                fidl::encoding::DefaultFuchsiaResourceDialect,
10912                &mut self.rect_id,
10913                decoder,
10914                offset + 0,
10915                _depth
10916            )?;
10917            fidl::decode!(
10918                ColorRgba,
10919                fidl::encoding::DefaultFuchsiaResourceDialect,
10920                &mut self.color,
10921                decoder,
10922                offset + 8,
10923                _depth
10924            )?;
10925            fidl::decode!(
10926                fidl_fuchsia_math::SizeU,
10927                fidl::encoding::DefaultFuchsiaResourceDialect,
10928                &mut self.size,
10929                decoder,
10930                offset + 24,
10931                _depth
10932            )?;
10933            Ok(())
10934        }
10935    }
10936
10937    impl fidl::encoding::ResourceTypeMarker for TrustedFlatlandFactoryCreateFlatlandRequest {
10938        type Borrowed<'a> = &'a mut Self;
10939        fn take_or_borrow<'a>(
10940            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10941        ) -> Self::Borrowed<'a> {
10942            value
10943        }
10944    }
10945
10946    unsafe impl fidl::encoding::TypeMarker for TrustedFlatlandFactoryCreateFlatlandRequest {
10947        type Owned = Self;
10948
10949        #[inline(always)]
10950        fn inline_align(_context: fidl::encoding::Context) -> usize {
10951            8
10952        }
10953
10954        #[inline(always)]
10955        fn inline_size(_context: fidl::encoding::Context) -> usize {
10956            24
10957        }
10958    }
10959
10960    unsafe impl
10961        fidl::encoding::Encode<
10962            TrustedFlatlandFactoryCreateFlatlandRequest,
10963            fidl::encoding::DefaultFuchsiaResourceDialect,
10964        > for &mut TrustedFlatlandFactoryCreateFlatlandRequest
10965    {
10966        #[inline]
10967        unsafe fn encode(
10968            self,
10969            encoder: &mut fidl::encoding::Encoder<
10970                '_,
10971                fidl::encoding::DefaultFuchsiaResourceDialect,
10972            >,
10973            offset: usize,
10974            _depth: fidl::encoding::Depth,
10975        ) -> fidl::Result<()> {
10976            encoder.debug_check_bounds::<TrustedFlatlandFactoryCreateFlatlandRequest>(offset);
10977            // Delegate to tuple encoding.
10978            fidl::encoding::Encode::<TrustedFlatlandFactoryCreateFlatlandRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
10979                (
10980                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<FlatlandMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.server_end),
10981                    <TrustedFlatlandConfig as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.config),
10982                ),
10983                encoder, offset, _depth
10984            )
10985        }
10986    }
10987    unsafe impl<
10988        T0: fidl::encoding::Encode<
10989                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<FlatlandMarker>>,
10990                fidl::encoding::DefaultFuchsiaResourceDialect,
10991            >,
10992        T1: fidl::encoding::Encode<
10993                TrustedFlatlandConfig,
10994                fidl::encoding::DefaultFuchsiaResourceDialect,
10995            >,
10996    >
10997        fidl::encoding::Encode<
10998            TrustedFlatlandFactoryCreateFlatlandRequest,
10999            fidl::encoding::DefaultFuchsiaResourceDialect,
11000        > for (T0, T1)
11001    {
11002        #[inline]
11003        unsafe fn encode(
11004            self,
11005            encoder: &mut fidl::encoding::Encoder<
11006                '_,
11007                fidl::encoding::DefaultFuchsiaResourceDialect,
11008            >,
11009            offset: usize,
11010            depth: fidl::encoding::Depth,
11011        ) -> fidl::Result<()> {
11012            encoder.debug_check_bounds::<TrustedFlatlandFactoryCreateFlatlandRequest>(offset);
11013            // Zero out padding regions. There's no need to apply masks
11014            // because the unmasked parts will be overwritten by fields.
11015            unsafe {
11016                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
11017                (ptr as *mut u64).write_unaligned(0);
11018            }
11019            // Write the fields.
11020            self.0.encode(encoder, offset + 0, depth)?;
11021            self.1.encode(encoder, offset + 8, depth)?;
11022            Ok(())
11023        }
11024    }
11025
11026    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11027        for TrustedFlatlandFactoryCreateFlatlandRequest
11028    {
11029        #[inline(always)]
11030        fn new_empty() -> Self {
11031            Self {
11032                server_end: fidl::new_empty!(
11033                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<FlatlandMarker>>,
11034                    fidl::encoding::DefaultFuchsiaResourceDialect
11035                ),
11036                config: fidl::new_empty!(
11037                    TrustedFlatlandConfig,
11038                    fidl::encoding::DefaultFuchsiaResourceDialect
11039                ),
11040            }
11041        }
11042
11043        #[inline]
11044        unsafe fn decode(
11045            &mut self,
11046            decoder: &mut fidl::encoding::Decoder<
11047                '_,
11048                fidl::encoding::DefaultFuchsiaResourceDialect,
11049            >,
11050            offset: usize,
11051            _depth: fidl::encoding::Depth,
11052        ) -> fidl::Result<()> {
11053            decoder.debug_check_bounds::<Self>(offset);
11054            // Verify that padding bytes are zero.
11055            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
11056            let padval = unsafe { (ptr as *const u64).read_unaligned() };
11057            let mask = 0xffffffff00000000u64;
11058            let maskedval = padval & mask;
11059            if maskedval != 0 {
11060                return Err(fidl::Error::NonZeroPadding {
11061                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
11062                });
11063            }
11064            fidl::decode!(
11065                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<FlatlandMarker>>,
11066                fidl::encoding::DefaultFuchsiaResourceDialect,
11067                &mut self.server_end,
11068                decoder,
11069                offset + 0,
11070                _depth
11071            )?;
11072            fidl::decode!(
11073                TrustedFlatlandConfig,
11074                fidl::encoding::DefaultFuchsiaResourceDialect,
11075                &mut self.config,
11076                decoder,
11077                offset + 8,
11078                _depth
11079            )?;
11080            Ok(())
11081        }
11082    }
11083
11084    impl FrameInfo {
11085        #[inline(always)]
11086        fn max_ordinal_present(&self) -> u64 {
11087            if let Some(_) = self.buffer_id {
11088                return 1;
11089            }
11090            0
11091        }
11092    }
11093
11094    impl fidl::encoding::ResourceTypeMarker for FrameInfo {
11095        type Borrowed<'a> = &'a mut Self;
11096        fn take_or_borrow<'a>(
11097            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11098        ) -> Self::Borrowed<'a> {
11099            value
11100        }
11101    }
11102
11103    unsafe impl fidl::encoding::TypeMarker for FrameInfo {
11104        type Owned = Self;
11105
11106        #[inline(always)]
11107        fn inline_align(_context: fidl::encoding::Context) -> usize {
11108            8
11109        }
11110
11111        #[inline(always)]
11112        fn inline_size(_context: fidl::encoding::Context) -> usize {
11113            16
11114        }
11115    }
11116
11117    unsafe impl fidl::encoding::Encode<FrameInfo, fidl::encoding::DefaultFuchsiaResourceDialect>
11118        for &mut FrameInfo
11119    {
11120        unsafe fn encode(
11121            self,
11122            encoder: &mut fidl::encoding::Encoder<
11123                '_,
11124                fidl::encoding::DefaultFuchsiaResourceDialect,
11125            >,
11126            offset: usize,
11127            mut depth: fidl::encoding::Depth,
11128        ) -> fidl::Result<()> {
11129            encoder.debug_check_bounds::<FrameInfo>(offset);
11130            // Vector header
11131            let max_ordinal: u64 = self.max_ordinal_present();
11132            encoder.write_num(max_ordinal, offset);
11133            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
11134            // Calling encoder.out_of_line_offset(0) is not allowed.
11135            if max_ordinal == 0 {
11136                return Ok(());
11137            }
11138            depth.increment()?;
11139            let envelope_size = 8;
11140            let bytes_len = max_ordinal as usize * envelope_size;
11141            #[allow(unused_variables)]
11142            let offset = encoder.out_of_line_offset(bytes_len);
11143            let mut _prev_end_offset: usize = 0;
11144            if 1 > max_ordinal {
11145                return Ok(());
11146            }
11147
11148            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11149            // are envelope_size bytes.
11150            let cur_offset: usize = (1 - 1) * envelope_size;
11151
11152            // Zero reserved fields.
11153            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11154
11155            // Safety:
11156            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11157            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11158            //   envelope_size bytes, there is always sufficient room.
11159            fidl::encoding::encode_in_envelope_optional::<
11160                u32,
11161                fidl::encoding::DefaultFuchsiaResourceDialect,
11162            >(
11163                self.buffer_id.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
11164                encoder,
11165                offset + cur_offset,
11166                depth,
11167            )?;
11168
11169            _prev_end_offset = cur_offset + envelope_size;
11170
11171            Ok(())
11172        }
11173    }
11174
11175    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for FrameInfo {
11176        #[inline(always)]
11177        fn new_empty() -> Self {
11178            Self::default()
11179        }
11180
11181        unsafe fn decode(
11182            &mut self,
11183            decoder: &mut fidl::encoding::Decoder<
11184                '_,
11185                fidl::encoding::DefaultFuchsiaResourceDialect,
11186            >,
11187            offset: usize,
11188            mut depth: fidl::encoding::Depth,
11189        ) -> fidl::Result<()> {
11190            decoder.debug_check_bounds::<Self>(offset);
11191            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
11192                None => return Err(fidl::Error::NotNullable),
11193                Some(len) => len,
11194            };
11195            // Calling decoder.out_of_line_offset(0) is not allowed.
11196            if len == 0 {
11197                return Ok(());
11198            };
11199            depth.increment()?;
11200            let envelope_size = 8;
11201            let bytes_len = len * envelope_size;
11202            let offset = decoder.out_of_line_offset(bytes_len)?;
11203            // Decode the envelope for each type.
11204            let mut _next_ordinal_to_read = 0;
11205            let mut next_offset = offset;
11206            let end_offset = offset + bytes_len;
11207            _next_ordinal_to_read += 1;
11208            if next_offset >= end_offset {
11209                return Ok(());
11210            }
11211
11212            // Decode unknown envelopes for gaps in ordinals.
11213            while _next_ordinal_to_read < 1 {
11214                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11215                _next_ordinal_to_read += 1;
11216                next_offset += envelope_size;
11217            }
11218
11219            let next_out_of_line = decoder.next_out_of_line();
11220            let handles_before = decoder.remaining_handles();
11221            if let Some((inlined, num_bytes, num_handles)) =
11222                fidl::encoding::decode_envelope_header(decoder, next_offset)?
11223            {
11224                let member_inline_size =
11225                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
11226                if inlined != (member_inline_size <= 4) {
11227                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
11228                }
11229                let inner_offset;
11230                let mut inner_depth = depth.clone();
11231                if inlined {
11232                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11233                    inner_offset = next_offset;
11234                } else {
11235                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11236                    inner_depth.increment()?;
11237                }
11238                let val_ref = self.buffer_id.get_or_insert_with(|| {
11239                    fidl::new_empty!(u32, fidl::encoding::DefaultFuchsiaResourceDialect)
11240                });
11241                fidl::decode!(
11242                    u32,
11243                    fidl::encoding::DefaultFuchsiaResourceDialect,
11244                    val_ref,
11245                    decoder,
11246                    inner_offset,
11247                    inner_depth
11248                )?;
11249                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11250                {
11251                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
11252                }
11253                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11254                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11255                }
11256            }
11257
11258            next_offset += envelope_size;
11259
11260            // Decode the remaining unknown envelopes.
11261            while next_offset < end_offset {
11262                _next_ordinal_to_read += 1;
11263                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11264                next_offset += envelope_size;
11265            }
11266
11267            Ok(())
11268        }
11269    }
11270
11271    impl GetNextFrameArgs {
11272        #[inline(always)]
11273        fn max_ordinal_present(&self) -> u64 {
11274            if let Some(_) = self.event {
11275                return 1;
11276            }
11277            0
11278        }
11279    }
11280
11281    impl fidl::encoding::ResourceTypeMarker for GetNextFrameArgs {
11282        type Borrowed<'a> = &'a mut Self;
11283        fn take_or_borrow<'a>(
11284            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11285        ) -> Self::Borrowed<'a> {
11286            value
11287        }
11288    }
11289
11290    unsafe impl fidl::encoding::TypeMarker for GetNextFrameArgs {
11291        type Owned = Self;
11292
11293        #[inline(always)]
11294        fn inline_align(_context: fidl::encoding::Context) -> usize {
11295            8
11296        }
11297
11298        #[inline(always)]
11299        fn inline_size(_context: fidl::encoding::Context) -> usize {
11300            16
11301        }
11302    }
11303
11304    unsafe impl
11305        fidl::encoding::Encode<GetNextFrameArgs, fidl::encoding::DefaultFuchsiaResourceDialect>
11306        for &mut GetNextFrameArgs
11307    {
11308        unsafe fn encode(
11309            self,
11310            encoder: &mut fidl::encoding::Encoder<
11311                '_,
11312                fidl::encoding::DefaultFuchsiaResourceDialect,
11313            >,
11314            offset: usize,
11315            mut depth: fidl::encoding::Depth,
11316        ) -> fidl::Result<()> {
11317            encoder.debug_check_bounds::<GetNextFrameArgs>(offset);
11318            // Vector header
11319            let max_ordinal: u64 = self.max_ordinal_present();
11320            encoder.write_num(max_ordinal, offset);
11321            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
11322            // Calling encoder.out_of_line_offset(0) is not allowed.
11323            if max_ordinal == 0 {
11324                return Ok(());
11325            }
11326            depth.increment()?;
11327            let envelope_size = 8;
11328            let bytes_len = max_ordinal as usize * envelope_size;
11329            #[allow(unused_variables)]
11330            let offset = encoder.out_of_line_offset(bytes_len);
11331            let mut _prev_end_offset: usize = 0;
11332            if 1 > max_ordinal {
11333                return Ok(());
11334            }
11335
11336            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11337            // are envelope_size bytes.
11338            let cur_offset: usize = (1 - 1) * envelope_size;
11339
11340            // Zero reserved fields.
11341            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11342
11343            // Safety:
11344            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11345            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11346            //   envelope_size bytes, there is always sufficient room.
11347            fidl::encoding::encode_in_envelope_optional::<
11348                fidl::encoding::HandleType<
11349                    fidl::Event,
11350                    { fidl::ObjectType::EVENT.into_raw() },
11351                    2147483648,
11352                >,
11353                fidl::encoding::DefaultFuchsiaResourceDialect,
11354            >(
11355                self.event.as_mut().map(
11356                    <fidl::encoding::HandleType<
11357                        fidl::Event,
11358                        { fidl::ObjectType::EVENT.into_raw() },
11359                        2147483648,
11360                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
11361                ),
11362                encoder,
11363                offset + cur_offset,
11364                depth,
11365            )?;
11366
11367            _prev_end_offset = cur_offset + envelope_size;
11368
11369            Ok(())
11370        }
11371    }
11372
11373    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11374        for GetNextFrameArgs
11375    {
11376        #[inline(always)]
11377        fn new_empty() -> Self {
11378            Self::default()
11379        }
11380
11381        unsafe fn decode(
11382            &mut self,
11383            decoder: &mut fidl::encoding::Decoder<
11384                '_,
11385                fidl::encoding::DefaultFuchsiaResourceDialect,
11386            >,
11387            offset: usize,
11388            mut depth: fidl::encoding::Depth,
11389        ) -> fidl::Result<()> {
11390            decoder.debug_check_bounds::<Self>(offset);
11391            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
11392                None => return Err(fidl::Error::NotNullable),
11393                Some(len) => len,
11394            };
11395            // Calling decoder.out_of_line_offset(0) is not allowed.
11396            if len == 0 {
11397                return Ok(());
11398            };
11399            depth.increment()?;
11400            let envelope_size = 8;
11401            let bytes_len = len * envelope_size;
11402            let offset = decoder.out_of_line_offset(bytes_len)?;
11403            // Decode the envelope for each type.
11404            let mut _next_ordinal_to_read = 0;
11405            let mut next_offset = offset;
11406            let end_offset = offset + bytes_len;
11407            _next_ordinal_to_read += 1;
11408            if next_offset >= end_offset {
11409                return Ok(());
11410            }
11411
11412            // Decode unknown envelopes for gaps in ordinals.
11413            while _next_ordinal_to_read < 1 {
11414                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11415                _next_ordinal_to_read += 1;
11416                next_offset += envelope_size;
11417            }
11418
11419            let next_out_of_line = decoder.next_out_of_line();
11420            let handles_before = decoder.remaining_handles();
11421            if let Some((inlined, num_bytes, num_handles)) =
11422                fidl::encoding::decode_envelope_header(decoder, next_offset)?
11423            {
11424                let member_inline_size = <fidl::encoding::HandleType<
11425                    fidl::Event,
11426                    { fidl::ObjectType::EVENT.into_raw() },
11427                    2147483648,
11428                > as fidl::encoding::TypeMarker>::inline_size(
11429                    decoder.context
11430                );
11431                if inlined != (member_inline_size <= 4) {
11432                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
11433                }
11434                let inner_offset;
11435                let mut inner_depth = depth.clone();
11436                if inlined {
11437                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11438                    inner_offset = next_offset;
11439                } else {
11440                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11441                    inner_depth.increment()?;
11442                }
11443                let val_ref =
11444                self.event.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
11445                fidl::decode!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
11446                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11447                {
11448                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
11449                }
11450                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11451                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11452                }
11453            }
11454
11455            next_offset += envelope_size;
11456
11457            // Decode the remaining unknown envelopes.
11458            while next_offset < end_offset {
11459                _next_ordinal_to_read += 1;
11460                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11461                next_offset += envelope_size;
11462            }
11463
11464            Ok(())
11465        }
11466    }
11467
11468    impl PresentArgs {
11469        #[inline(always)]
11470        fn max_ordinal_present(&self) -> u64 {
11471            if let Some(_) = self.release_counters {
11472                return 8;
11473            }
11474            if let Some(_) = self.present_fences {
11475                return 7;
11476            }
11477            if let Some(_) = self.unsquashable {
11478                return 4;
11479            }
11480            if let Some(_) = self.release_fences {
11481                return 3;
11482            }
11483            if let Some(_) = self.acquire_fences {
11484                return 2;
11485            }
11486            if let Some(_) = self.requested_presentation_time {
11487                return 1;
11488            }
11489            0
11490        }
11491    }
11492
11493    impl fidl::encoding::ResourceTypeMarker for PresentArgs {
11494        type Borrowed<'a> = &'a mut Self;
11495        fn take_or_borrow<'a>(
11496            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11497        ) -> Self::Borrowed<'a> {
11498            value
11499        }
11500    }
11501
11502    unsafe impl fidl::encoding::TypeMarker for PresentArgs {
11503        type Owned = Self;
11504
11505        #[inline(always)]
11506        fn inline_align(_context: fidl::encoding::Context) -> usize {
11507            8
11508        }
11509
11510        #[inline(always)]
11511        fn inline_size(_context: fidl::encoding::Context) -> usize {
11512            16
11513        }
11514    }
11515
11516    unsafe impl fidl::encoding::Encode<PresentArgs, fidl::encoding::DefaultFuchsiaResourceDialect>
11517        for &mut PresentArgs
11518    {
11519        unsafe fn encode(
11520            self,
11521            encoder: &mut fidl::encoding::Encoder<
11522                '_,
11523                fidl::encoding::DefaultFuchsiaResourceDialect,
11524            >,
11525            offset: usize,
11526            mut depth: fidl::encoding::Depth,
11527        ) -> fidl::Result<()> {
11528            encoder.debug_check_bounds::<PresentArgs>(offset);
11529            // Vector header
11530            let max_ordinal: u64 = self.max_ordinal_present();
11531            encoder.write_num(max_ordinal, offset);
11532            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
11533            // Calling encoder.out_of_line_offset(0) is not allowed.
11534            if max_ordinal == 0 {
11535                return Ok(());
11536            }
11537            depth.increment()?;
11538            let envelope_size = 8;
11539            let bytes_len = max_ordinal as usize * envelope_size;
11540            #[allow(unused_variables)]
11541            let offset = encoder.out_of_line_offset(bytes_len);
11542            let mut _prev_end_offset: usize = 0;
11543            if 1 > max_ordinal {
11544                return Ok(());
11545            }
11546
11547            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11548            // are envelope_size bytes.
11549            let cur_offset: usize = (1 - 1) * envelope_size;
11550
11551            // Zero reserved fields.
11552            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11553
11554            // Safety:
11555            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11556            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11557            //   envelope_size bytes, there is always sufficient room.
11558            fidl::encoding::encode_in_envelope_optional::<
11559                i64,
11560                fidl::encoding::DefaultFuchsiaResourceDialect,
11561            >(
11562                self.requested_presentation_time
11563                    .as_ref()
11564                    .map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
11565                encoder,
11566                offset + cur_offset,
11567                depth,
11568            )?;
11569
11570            _prev_end_offset = cur_offset + envelope_size;
11571            if 2 > max_ordinal {
11572                return Ok(());
11573            }
11574
11575            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11576            // are envelope_size bytes.
11577            let cur_offset: usize = (2 - 1) * envelope_size;
11578
11579            // Zero reserved fields.
11580            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11581
11582            // Safety:
11583            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11584            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11585            //   envelope_size bytes, there is always sufficient room.
11586            fidl::encoding::encode_in_envelope_optional::<
11587                fidl::encoding::Vector<
11588                    fidl::encoding::HandleType<
11589                        fidl::Event,
11590                        { fidl::ObjectType::EVENT.into_raw() },
11591                        2147483648,
11592                    >,
11593                    16,
11594                >,
11595                fidl::encoding::DefaultFuchsiaResourceDialect,
11596            >(
11597                self.acquire_fences.as_mut().map(
11598                    <fidl::encoding::Vector<
11599                        fidl::encoding::HandleType<
11600                            fidl::Event,
11601                            { fidl::ObjectType::EVENT.into_raw() },
11602                            2147483648,
11603                        >,
11604                        16,
11605                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
11606                ),
11607                encoder,
11608                offset + cur_offset,
11609                depth,
11610            )?;
11611
11612            _prev_end_offset = cur_offset + envelope_size;
11613            if 3 > max_ordinal {
11614                return Ok(());
11615            }
11616
11617            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11618            // are envelope_size bytes.
11619            let cur_offset: usize = (3 - 1) * envelope_size;
11620
11621            // Zero reserved fields.
11622            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11623
11624            // Safety:
11625            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11626            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11627            //   envelope_size bytes, there is always sufficient room.
11628            fidl::encoding::encode_in_envelope_optional::<
11629                fidl::encoding::Vector<
11630                    fidl::encoding::HandleType<
11631                        fidl::Event,
11632                        { fidl::ObjectType::EVENT.into_raw() },
11633                        2147483648,
11634                    >,
11635                    16,
11636                >,
11637                fidl::encoding::DefaultFuchsiaResourceDialect,
11638            >(
11639                self.release_fences.as_mut().map(
11640                    <fidl::encoding::Vector<
11641                        fidl::encoding::HandleType<
11642                            fidl::Event,
11643                            { fidl::ObjectType::EVENT.into_raw() },
11644                            2147483648,
11645                        >,
11646                        16,
11647                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
11648                ),
11649                encoder,
11650                offset + cur_offset,
11651                depth,
11652            )?;
11653
11654            _prev_end_offset = cur_offset + envelope_size;
11655            if 4 > max_ordinal {
11656                return Ok(());
11657            }
11658
11659            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11660            // are envelope_size bytes.
11661            let cur_offset: usize = (4 - 1) * envelope_size;
11662
11663            // Zero reserved fields.
11664            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11665
11666            // Safety:
11667            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11668            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11669            //   envelope_size bytes, there is always sufficient room.
11670            fidl::encoding::encode_in_envelope_optional::<
11671                bool,
11672                fidl::encoding::DefaultFuchsiaResourceDialect,
11673            >(
11674                self.unsquashable.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
11675                encoder,
11676                offset + cur_offset,
11677                depth,
11678            )?;
11679
11680            _prev_end_offset = cur_offset + envelope_size;
11681            if 7 > max_ordinal {
11682                return Ok(());
11683            }
11684
11685            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11686            // are envelope_size bytes.
11687            let cur_offset: usize = (7 - 1) * envelope_size;
11688
11689            // Zero reserved fields.
11690            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11691
11692            // Safety:
11693            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11694            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11695            //   envelope_size bytes, there is always sufficient room.
11696            fidl::encoding::encode_in_envelope_optional::<
11697                fidl::encoding::Vector<
11698                    fidl::encoding::HandleType<
11699                        fidl::Counter,
11700                        { fidl::ObjectType::COUNTER.into_raw() },
11701                        2147483648,
11702                    >,
11703                    16,
11704                >,
11705                fidl::encoding::DefaultFuchsiaResourceDialect,
11706            >(
11707                self.present_fences.as_mut().map(
11708                    <fidl::encoding::Vector<
11709                        fidl::encoding::HandleType<
11710                            fidl::Counter,
11711                            { fidl::ObjectType::COUNTER.into_raw() },
11712                            2147483648,
11713                        >,
11714                        16,
11715                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
11716                ),
11717                encoder,
11718                offset + cur_offset,
11719                depth,
11720            )?;
11721
11722            _prev_end_offset = cur_offset + envelope_size;
11723            if 8 > max_ordinal {
11724                return Ok(());
11725            }
11726
11727            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11728            // are envelope_size bytes.
11729            let cur_offset: usize = (8 - 1) * envelope_size;
11730
11731            // Zero reserved fields.
11732            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11733
11734            // Safety:
11735            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11736            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11737            //   envelope_size bytes, there is always sufficient room.
11738            fidl::encoding::encode_in_envelope_optional::<
11739                fidl::encoding::Vector<
11740                    fidl::encoding::HandleType<
11741                        fidl::Counter,
11742                        { fidl::ObjectType::COUNTER.into_raw() },
11743                        2147483648,
11744                    >,
11745                    16,
11746                >,
11747                fidl::encoding::DefaultFuchsiaResourceDialect,
11748            >(
11749                self.release_counters.as_mut().map(
11750                    <fidl::encoding::Vector<
11751                        fidl::encoding::HandleType<
11752                            fidl::Counter,
11753                            { fidl::ObjectType::COUNTER.into_raw() },
11754                            2147483648,
11755                        >,
11756                        16,
11757                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
11758                ),
11759                encoder,
11760                offset + cur_offset,
11761                depth,
11762            )?;
11763
11764            _prev_end_offset = cur_offset + envelope_size;
11765
11766            Ok(())
11767        }
11768    }
11769
11770    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for PresentArgs {
11771        #[inline(always)]
11772        fn new_empty() -> Self {
11773            Self::default()
11774        }
11775
11776        unsafe fn decode(
11777            &mut self,
11778            decoder: &mut fidl::encoding::Decoder<
11779                '_,
11780                fidl::encoding::DefaultFuchsiaResourceDialect,
11781            >,
11782            offset: usize,
11783            mut depth: fidl::encoding::Depth,
11784        ) -> fidl::Result<()> {
11785            decoder.debug_check_bounds::<Self>(offset);
11786            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
11787                None => return Err(fidl::Error::NotNullable),
11788                Some(len) => len,
11789            };
11790            // Calling decoder.out_of_line_offset(0) is not allowed.
11791            if len == 0 {
11792                return Ok(());
11793            };
11794            depth.increment()?;
11795            let envelope_size = 8;
11796            let bytes_len = len * envelope_size;
11797            let offset = decoder.out_of_line_offset(bytes_len)?;
11798            // Decode the envelope for each type.
11799            let mut _next_ordinal_to_read = 0;
11800            let mut next_offset = offset;
11801            let end_offset = offset + bytes_len;
11802            _next_ordinal_to_read += 1;
11803            if next_offset >= end_offset {
11804                return Ok(());
11805            }
11806
11807            // Decode unknown envelopes for gaps in ordinals.
11808            while _next_ordinal_to_read < 1 {
11809                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11810                _next_ordinal_to_read += 1;
11811                next_offset += envelope_size;
11812            }
11813
11814            let next_out_of_line = decoder.next_out_of_line();
11815            let handles_before = decoder.remaining_handles();
11816            if let Some((inlined, num_bytes, num_handles)) =
11817                fidl::encoding::decode_envelope_header(decoder, next_offset)?
11818            {
11819                let member_inline_size =
11820                    <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
11821                if inlined != (member_inline_size <= 4) {
11822                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
11823                }
11824                let inner_offset;
11825                let mut inner_depth = depth.clone();
11826                if inlined {
11827                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11828                    inner_offset = next_offset;
11829                } else {
11830                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11831                    inner_depth.increment()?;
11832                }
11833                let val_ref = self.requested_presentation_time.get_or_insert_with(|| {
11834                    fidl::new_empty!(i64, fidl::encoding::DefaultFuchsiaResourceDialect)
11835                });
11836                fidl::decode!(
11837                    i64,
11838                    fidl::encoding::DefaultFuchsiaResourceDialect,
11839                    val_ref,
11840                    decoder,
11841                    inner_offset,
11842                    inner_depth
11843                )?;
11844                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11845                {
11846                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
11847                }
11848                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11849                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11850                }
11851            }
11852
11853            next_offset += envelope_size;
11854            _next_ordinal_to_read += 1;
11855            if next_offset >= end_offset {
11856                return Ok(());
11857            }
11858
11859            // Decode unknown envelopes for gaps in ordinals.
11860            while _next_ordinal_to_read < 2 {
11861                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11862                _next_ordinal_to_read += 1;
11863                next_offset += envelope_size;
11864            }
11865
11866            let next_out_of_line = decoder.next_out_of_line();
11867            let handles_before = decoder.remaining_handles();
11868            if let Some((inlined, num_bytes, num_handles)) =
11869                fidl::encoding::decode_envelope_header(decoder, next_offset)?
11870            {
11871                let member_inline_size = <fidl::encoding::Vector<
11872                    fidl::encoding::HandleType<
11873                        fidl::Event,
11874                        { fidl::ObjectType::EVENT.into_raw() },
11875                        2147483648,
11876                    >,
11877                    16,
11878                > as fidl::encoding::TypeMarker>::inline_size(
11879                    decoder.context
11880                );
11881                if inlined != (member_inline_size <= 4) {
11882                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
11883                }
11884                let inner_offset;
11885                let mut inner_depth = depth.clone();
11886                if inlined {
11887                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11888                    inner_offset = next_offset;
11889                } else {
11890                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11891                    inner_depth.increment()?;
11892                }
11893                let val_ref = self.acquire_fences.get_or_insert_with(|| {
11894                    fidl::new_empty!(
11895                        fidl::encoding::Vector<
11896                            fidl::encoding::HandleType<
11897                                fidl::Event,
11898                                { fidl::ObjectType::EVENT.into_raw() },
11899                                2147483648,
11900                            >,
11901                            16,
11902                        >,
11903                        fidl::encoding::DefaultFuchsiaResourceDialect
11904                    )
11905                });
11906                fidl::decode!(
11907                    fidl::encoding::Vector<
11908                        fidl::encoding::HandleType<
11909                            fidl::Event,
11910                            { fidl::ObjectType::EVENT.into_raw() },
11911                            2147483648,
11912                        >,
11913                        16,
11914                    >,
11915                    fidl::encoding::DefaultFuchsiaResourceDialect,
11916                    val_ref,
11917                    decoder,
11918                    inner_offset,
11919                    inner_depth
11920                )?;
11921                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11922                {
11923                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
11924                }
11925                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11926                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11927                }
11928            }
11929
11930            next_offset += envelope_size;
11931            _next_ordinal_to_read += 1;
11932            if next_offset >= end_offset {
11933                return Ok(());
11934            }
11935
11936            // Decode unknown envelopes for gaps in ordinals.
11937            while _next_ordinal_to_read < 3 {
11938                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11939                _next_ordinal_to_read += 1;
11940                next_offset += envelope_size;
11941            }
11942
11943            let next_out_of_line = decoder.next_out_of_line();
11944            let handles_before = decoder.remaining_handles();
11945            if let Some((inlined, num_bytes, num_handles)) =
11946                fidl::encoding::decode_envelope_header(decoder, next_offset)?
11947            {
11948                let member_inline_size = <fidl::encoding::Vector<
11949                    fidl::encoding::HandleType<
11950                        fidl::Event,
11951                        { fidl::ObjectType::EVENT.into_raw() },
11952                        2147483648,
11953                    >,
11954                    16,
11955                > as fidl::encoding::TypeMarker>::inline_size(
11956                    decoder.context
11957                );
11958                if inlined != (member_inline_size <= 4) {
11959                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
11960                }
11961                let inner_offset;
11962                let mut inner_depth = depth.clone();
11963                if inlined {
11964                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11965                    inner_offset = next_offset;
11966                } else {
11967                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11968                    inner_depth.increment()?;
11969                }
11970                let val_ref = self.release_fences.get_or_insert_with(|| {
11971                    fidl::new_empty!(
11972                        fidl::encoding::Vector<
11973                            fidl::encoding::HandleType<
11974                                fidl::Event,
11975                                { fidl::ObjectType::EVENT.into_raw() },
11976                                2147483648,
11977                            >,
11978                            16,
11979                        >,
11980                        fidl::encoding::DefaultFuchsiaResourceDialect
11981                    )
11982                });
11983                fidl::decode!(
11984                    fidl::encoding::Vector<
11985                        fidl::encoding::HandleType<
11986                            fidl::Event,
11987                            { fidl::ObjectType::EVENT.into_raw() },
11988                            2147483648,
11989                        >,
11990                        16,
11991                    >,
11992                    fidl::encoding::DefaultFuchsiaResourceDialect,
11993                    val_ref,
11994                    decoder,
11995                    inner_offset,
11996                    inner_depth
11997                )?;
11998                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11999                {
12000                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12001                }
12002                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12003                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12004                }
12005            }
12006
12007            next_offset += envelope_size;
12008            _next_ordinal_to_read += 1;
12009            if next_offset >= end_offset {
12010                return Ok(());
12011            }
12012
12013            // Decode unknown envelopes for gaps in ordinals.
12014            while _next_ordinal_to_read < 4 {
12015                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12016                _next_ordinal_to_read += 1;
12017                next_offset += envelope_size;
12018            }
12019
12020            let next_out_of_line = decoder.next_out_of_line();
12021            let handles_before = decoder.remaining_handles();
12022            if let Some((inlined, num_bytes, num_handles)) =
12023                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12024            {
12025                let member_inline_size =
12026                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
12027                if inlined != (member_inline_size <= 4) {
12028                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12029                }
12030                let inner_offset;
12031                let mut inner_depth = depth.clone();
12032                if inlined {
12033                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12034                    inner_offset = next_offset;
12035                } else {
12036                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12037                    inner_depth.increment()?;
12038                }
12039                let val_ref = self.unsquashable.get_or_insert_with(|| {
12040                    fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
12041                });
12042                fidl::decode!(
12043                    bool,
12044                    fidl::encoding::DefaultFuchsiaResourceDialect,
12045                    val_ref,
12046                    decoder,
12047                    inner_offset,
12048                    inner_depth
12049                )?;
12050                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12051                {
12052                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12053                }
12054                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12055                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12056                }
12057            }
12058
12059            next_offset += envelope_size;
12060            _next_ordinal_to_read += 1;
12061            if next_offset >= end_offset {
12062                return Ok(());
12063            }
12064
12065            // Decode unknown envelopes for gaps in ordinals.
12066            while _next_ordinal_to_read < 7 {
12067                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12068                _next_ordinal_to_read += 1;
12069                next_offset += envelope_size;
12070            }
12071
12072            let next_out_of_line = decoder.next_out_of_line();
12073            let handles_before = decoder.remaining_handles();
12074            if let Some((inlined, num_bytes, num_handles)) =
12075                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12076            {
12077                let member_inline_size = <fidl::encoding::Vector<
12078                    fidl::encoding::HandleType<
12079                        fidl::Counter,
12080                        { fidl::ObjectType::COUNTER.into_raw() },
12081                        2147483648,
12082                    >,
12083                    16,
12084                > as fidl::encoding::TypeMarker>::inline_size(
12085                    decoder.context
12086                );
12087                if inlined != (member_inline_size <= 4) {
12088                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12089                }
12090                let inner_offset;
12091                let mut inner_depth = depth.clone();
12092                if inlined {
12093                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12094                    inner_offset = next_offset;
12095                } else {
12096                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12097                    inner_depth.increment()?;
12098                }
12099                let val_ref = self.present_fences.get_or_insert_with(|| {
12100                    fidl::new_empty!(
12101                        fidl::encoding::Vector<
12102                            fidl::encoding::HandleType<
12103                                fidl::Counter,
12104                                { fidl::ObjectType::COUNTER.into_raw() },
12105                                2147483648,
12106                            >,
12107                            16,
12108                        >,
12109                        fidl::encoding::DefaultFuchsiaResourceDialect
12110                    )
12111                });
12112                fidl::decode!(
12113                    fidl::encoding::Vector<
12114                        fidl::encoding::HandleType<
12115                            fidl::Counter,
12116                            { fidl::ObjectType::COUNTER.into_raw() },
12117                            2147483648,
12118                        >,
12119                        16,
12120                    >,
12121                    fidl::encoding::DefaultFuchsiaResourceDialect,
12122                    val_ref,
12123                    decoder,
12124                    inner_offset,
12125                    inner_depth
12126                )?;
12127                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12128                {
12129                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12130                }
12131                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12132                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12133                }
12134            }
12135
12136            next_offset += envelope_size;
12137            _next_ordinal_to_read += 1;
12138            if next_offset >= end_offset {
12139                return Ok(());
12140            }
12141
12142            // Decode unknown envelopes for gaps in ordinals.
12143            while _next_ordinal_to_read < 8 {
12144                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12145                _next_ordinal_to_read += 1;
12146                next_offset += envelope_size;
12147            }
12148
12149            let next_out_of_line = decoder.next_out_of_line();
12150            let handles_before = decoder.remaining_handles();
12151            if let Some((inlined, num_bytes, num_handles)) =
12152                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12153            {
12154                let member_inline_size = <fidl::encoding::Vector<
12155                    fidl::encoding::HandleType<
12156                        fidl::Counter,
12157                        { fidl::ObjectType::COUNTER.into_raw() },
12158                        2147483648,
12159                    >,
12160                    16,
12161                > as fidl::encoding::TypeMarker>::inline_size(
12162                    decoder.context
12163                );
12164                if inlined != (member_inline_size <= 4) {
12165                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12166                }
12167                let inner_offset;
12168                let mut inner_depth = depth.clone();
12169                if inlined {
12170                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12171                    inner_offset = next_offset;
12172                } else {
12173                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12174                    inner_depth.increment()?;
12175                }
12176                let val_ref = self.release_counters.get_or_insert_with(|| {
12177                    fidl::new_empty!(
12178                        fidl::encoding::Vector<
12179                            fidl::encoding::HandleType<
12180                                fidl::Counter,
12181                                { fidl::ObjectType::COUNTER.into_raw() },
12182                                2147483648,
12183                            >,
12184                            16,
12185                        >,
12186                        fidl::encoding::DefaultFuchsiaResourceDialect
12187                    )
12188                });
12189                fidl::decode!(
12190                    fidl::encoding::Vector<
12191                        fidl::encoding::HandleType<
12192                            fidl::Counter,
12193                            { fidl::ObjectType::COUNTER.into_raw() },
12194                            2147483648,
12195                        >,
12196                        16,
12197                    >,
12198                    fidl::encoding::DefaultFuchsiaResourceDialect,
12199                    val_ref,
12200                    decoder,
12201                    inner_offset,
12202                    inner_depth
12203                )?;
12204                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12205                {
12206                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12207                }
12208                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12209                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12210                }
12211            }
12212
12213            next_offset += envelope_size;
12214
12215            // Decode the remaining unknown envelopes.
12216            while next_offset < end_offset {
12217                _next_ordinal_to_read += 1;
12218                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12219                next_offset += envelope_size;
12220            }
12221
12222            Ok(())
12223        }
12224    }
12225
12226    impl RegisterBufferCollectionArgs {
12227        #[inline(always)]
12228        fn max_ordinal_present(&self) -> u64 {
12229            if let Some(_) = self.buffer_collection_token2 {
12230                return 5;
12231            }
12232            if let Some(_) = self.usages {
12233                return 4;
12234            }
12235            if let Some(_) = self.usage {
12236                return 3;
12237            }
12238            if let Some(_) = self.buffer_collection_token {
12239                return 2;
12240            }
12241            if let Some(_) = self.export_token {
12242                return 1;
12243            }
12244            0
12245        }
12246    }
12247
12248    impl fidl::encoding::ResourceTypeMarker for RegisterBufferCollectionArgs {
12249        type Borrowed<'a> = &'a mut Self;
12250        fn take_or_borrow<'a>(
12251            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12252        ) -> Self::Borrowed<'a> {
12253            value
12254        }
12255    }
12256
12257    unsafe impl fidl::encoding::TypeMarker for RegisterBufferCollectionArgs {
12258        type Owned = Self;
12259
12260        #[inline(always)]
12261        fn inline_align(_context: fidl::encoding::Context) -> usize {
12262            8
12263        }
12264
12265        #[inline(always)]
12266        fn inline_size(_context: fidl::encoding::Context) -> usize {
12267            16
12268        }
12269    }
12270
12271    unsafe impl
12272        fidl::encoding::Encode<
12273            RegisterBufferCollectionArgs,
12274            fidl::encoding::DefaultFuchsiaResourceDialect,
12275        > for &mut RegisterBufferCollectionArgs
12276    {
12277        unsafe fn encode(
12278            self,
12279            encoder: &mut fidl::encoding::Encoder<
12280                '_,
12281                fidl::encoding::DefaultFuchsiaResourceDialect,
12282            >,
12283            offset: usize,
12284            mut depth: fidl::encoding::Depth,
12285        ) -> fidl::Result<()> {
12286            encoder.debug_check_bounds::<RegisterBufferCollectionArgs>(offset);
12287            // Vector header
12288            let max_ordinal: u64 = self.max_ordinal_present();
12289            encoder.write_num(max_ordinal, offset);
12290            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
12291            // Calling encoder.out_of_line_offset(0) is not allowed.
12292            if max_ordinal == 0 {
12293                return Ok(());
12294            }
12295            depth.increment()?;
12296            let envelope_size = 8;
12297            let bytes_len = max_ordinal as usize * envelope_size;
12298            #[allow(unused_variables)]
12299            let offset = encoder.out_of_line_offset(bytes_len);
12300            let mut _prev_end_offset: usize = 0;
12301            if 1 > max_ordinal {
12302                return Ok(());
12303            }
12304
12305            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12306            // are envelope_size bytes.
12307            let cur_offset: usize = (1 - 1) * envelope_size;
12308
12309            // Zero reserved fields.
12310            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12311
12312            // Safety:
12313            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12314            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12315            //   envelope_size bytes, there is always sufficient room.
12316            fidl::encoding::encode_in_envelope_optional::<BufferCollectionExportToken, fidl::encoding::DefaultFuchsiaResourceDialect>(
12317            self.export_token.as_mut().map(<BufferCollectionExportToken as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
12318            encoder, offset + cur_offset, depth
12319        )?;
12320
12321            _prev_end_offset = cur_offset + envelope_size;
12322            if 2 > max_ordinal {
12323                return Ok(());
12324            }
12325
12326            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12327            // are envelope_size bytes.
12328            let cur_offset: usize = (2 - 1) * envelope_size;
12329
12330            // Zero reserved fields.
12331            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12332
12333            // Safety:
12334            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12335            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12336            //   envelope_size bytes, there is always sufficient room.
12337            fidl::encoding::encode_in_envelope_optional::<
12338                fidl::encoding::Endpoint<
12339                    fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem::BufferCollectionTokenMarker>,
12340                >,
12341                fidl::encoding::DefaultFuchsiaResourceDialect,
12342            >(
12343                self.buffer_collection_token.as_mut().map(
12344                    <fidl::encoding::Endpoint<
12345                        fidl::endpoints::ClientEnd<
12346                            fidl_fuchsia_sysmem::BufferCollectionTokenMarker,
12347                        >,
12348                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
12349                ),
12350                encoder,
12351                offset + cur_offset,
12352                depth,
12353            )?;
12354
12355            _prev_end_offset = cur_offset + envelope_size;
12356            if 3 > max_ordinal {
12357                return Ok(());
12358            }
12359
12360            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12361            // are envelope_size bytes.
12362            let cur_offset: usize = (3 - 1) * envelope_size;
12363
12364            // Zero reserved fields.
12365            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12366
12367            // Safety:
12368            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12369            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12370            //   envelope_size bytes, there is always sufficient room.
12371            fidl::encoding::encode_in_envelope_optional::<
12372                RegisterBufferCollectionUsage,
12373                fidl::encoding::DefaultFuchsiaResourceDialect,
12374            >(
12375                self.usage.as_ref().map(
12376                    <RegisterBufferCollectionUsage as fidl::encoding::ValueTypeMarker>::borrow,
12377                ),
12378                encoder,
12379                offset + cur_offset,
12380                depth,
12381            )?;
12382
12383            _prev_end_offset = cur_offset + envelope_size;
12384            if 4 > max_ordinal {
12385                return Ok(());
12386            }
12387
12388            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12389            // are envelope_size bytes.
12390            let cur_offset: usize = (4 - 1) * envelope_size;
12391
12392            // Zero reserved fields.
12393            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12394
12395            // Safety:
12396            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12397            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12398            //   envelope_size bytes, there is always sufficient room.
12399            fidl::encoding::encode_in_envelope_optional::<
12400                RegisterBufferCollectionUsages,
12401                fidl::encoding::DefaultFuchsiaResourceDialect,
12402            >(
12403                self.usages.as_ref().map(
12404                    <RegisterBufferCollectionUsages as fidl::encoding::ValueTypeMarker>::borrow,
12405                ),
12406                encoder,
12407                offset + cur_offset,
12408                depth,
12409            )?;
12410
12411            _prev_end_offset = cur_offset + envelope_size;
12412            if 5 > max_ordinal {
12413                return Ok(());
12414            }
12415
12416            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12417            // are envelope_size bytes.
12418            let cur_offset: usize = (5 - 1) * envelope_size;
12419
12420            // Zero reserved fields.
12421            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12422
12423            // Safety:
12424            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12425            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12426            //   envelope_size bytes, there is always sufficient room.
12427            fidl::encoding::encode_in_envelope_optional::<
12428                fidl::encoding::Endpoint<
12429                    fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem2::BufferCollectionTokenMarker>,
12430                >,
12431                fidl::encoding::DefaultFuchsiaResourceDialect,
12432            >(
12433                self.buffer_collection_token2.as_mut().map(
12434                    <fidl::encoding::Endpoint<
12435                        fidl::endpoints::ClientEnd<
12436                            fidl_fuchsia_sysmem2::BufferCollectionTokenMarker,
12437                        >,
12438                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
12439                ),
12440                encoder,
12441                offset + cur_offset,
12442                depth,
12443            )?;
12444
12445            _prev_end_offset = cur_offset + envelope_size;
12446
12447            Ok(())
12448        }
12449    }
12450
12451    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
12452        for RegisterBufferCollectionArgs
12453    {
12454        #[inline(always)]
12455        fn new_empty() -> Self {
12456            Self::default()
12457        }
12458
12459        unsafe fn decode(
12460            &mut self,
12461            decoder: &mut fidl::encoding::Decoder<
12462                '_,
12463                fidl::encoding::DefaultFuchsiaResourceDialect,
12464            >,
12465            offset: usize,
12466            mut depth: fidl::encoding::Depth,
12467        ) -> fidl::Result<()> {
12468            decoder.debug_check_bounds::<Self>(offset);
12469            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
12470                None => return Err(fidl::Error::NotNullable),
12471                Some(len) => len,
12472            };
12473            // Calling decoder.out_of_line_offset(0) is not allowed.
12474            if len == 0 {
12475                return Ok(());
12476            };
12477            depth.increment()?;
12478            let envelope_size = 8;
12479            let bytes_len = len * envelope_size;
12480            let offset = decoder.out_of_line_offset(bytes_len)?;
12481            // Decode the envelope for each type.
12482            let mut _next_ordinal_to_read = 0;
12483            let mut next_offset = offset;
12484            let end_offset = offset + bytes_len;
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 < 1 {
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 =
12503                    <BufferCollectionExportToken as fidl::encoding::TypeMarker>::inline_size(
12504                        decoder.context,
12505                    );
12506                if inlined != (member_inline_size <= 4) {
12507                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12508                }
12509                let inner_offset;
12510                let mut inner_depth = depth.clone();
12511                if inlined {
12512                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12513                    inner_offset = next_offset;
12514                } else {
12515                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12516                    inner_depth.increment()?;
12517                }
12518                let val_ref = self.export_token.get_or_insert_with(|| {
12519                    fidl::new_empty!(
12520                        BufferCollectionExportToken,
12521                        fidl::encoding::DefaultFuchsiaResourceDialect
12522                    )
12523                });
12524                fidl::decode!(
12525                    BufferCollectionExportToken,
12526                    fidl::encoding::DefaultFuchsiaResourceDialect,
12527                    val_ref,
12528                    decoder,
12529                    inner_offset,
12530                    inner_depth
12531                )?;
12532                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12533                {
12534                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12535                }
12536                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12537                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12538                }
12539            }
12540
12541            next_offset += envelope_size;
12542            _next_ordinal_to_read += 1;
12543            if next_offset >= end_offset {
12544                return Ok(());
12545            }
12546
12547            // Decode unknown envelopes for gaps in ordinals.
12548            while _next_ordinal_to_read < 2 {
12549                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12550                _next_ordinal_to_read += 1;
12551                next_offset += envelope_size;
12552            }
12553
12554            let next_out_of_line = decoder.next_out_of_line();
12555            let handles_before = decoder.remaining_handles();
12556            if let Some((inlined, num_bytes, num_handles)) =
12557                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12558            {
12559                let member_inline_size = <fidl::encoding::Endpoint<
12560                    fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem::BufferCollectionTokenMarker>,
12561                > as fidl::encoding::TypeMarker>::inline_size(
12562                    decoder.context
12563                );
12564                if inlined != (member_inline_size <= 4) {
12565                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12566                }
12567                let inner_offset;
12568                let mut inner_depth = depth.clone();
12569                if inlined {
12570                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12571                    inner_offset = next_offset;
12572                } else {
12573                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12574                    inner_depth.increment()?;
12575                }
12576                let val_ref = self.buffer_collection_token.get_or_insert_with(|| {
12577                    fidl::new_empty!(
12578                        fidl::encoding::Endpoint<
12579                            fidl::endpoints::ClientEnd<
12580                                fidl_fuchsia_sysmem::BufferCollectionTokenMarker,
12581                            >,
12582                        >,
12583                        fidl::encoding::DefaultFuchsiaResourceDialect
12584                    )
12585                });
12586                fidl::decode!(
12587                    fidl::encoding::Endpoint<
12588                        fidl::endpoints::ClientEnd<
12589                            fidl_fuchsia_sysmem::BufferCollectionTokenMarker,
12590                        >,
12591                    >,
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 < 3 {
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                    <RegisterBufferCollectionUsage 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.usage.get_or_insert_with(|| {
12642                    fidl::new_empty!(
12643                        RegisterBufferCollectionUsage,
12644                        fidl::encoding::DefaultFuchsiaResourceDialect
12645                    )
12646                });
12647                fidl::decode!(
12648                    RegisterBufferCollectionUsage,
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 < 4 {
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 =
12683                    <RegisterBufferCollectionUsages as fidl::encoding::TypeMarker>::inline_size(
12684                        decoder.context,
12685                    );
12686                if inlined != (member_inline_size <= 4) {
12687                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12688                }
12689                let inner_offset;
12690                let mut inner_depth = depth.clone();
12691                if inlined {
12692                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12693                    inner_offset = next_offset;
12694                } else {
12695                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12696                    inner_depth.increment()?;
12697                }
12698                let val_ref = self.usages.get_or_insert_with(|| {
12699                    fidl::new_empty!(
12700                        RegisterBufferCollectionUsages,
12701                        fidl::encoding::DefaultFuchsiaResourceDialect
12702                    )
12703                });
12704                fidl::decode!(
12705                    RegisterBufferCollectionUsages,
12706                    fidl::encoding::DefaultFuchsiaResourceDialect,
12707                    val_ref,
12708                    decoder,
12709                    inner_offset,
12710                    inner_depth
12711                )?;
12712                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12713                {
12714                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12715                }
12716                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12717                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12718                }
12719            }
12720
12721            next_offset += envelope_size;
12722            _next_ordinal_to_read += 1;
12723            if next_offset >= end_offset {
12724                return Ok(());
12725            }
12726
12727            // Decode unknown envelopes for gaps in ordinals.
12728            while _next_ordinal_to_read < 5 {
12729                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12730                _next_ordinal_to_read += 1;
12731                next_offset += envelope_size;
12732            }
12733
12734            let next_out_of_line = decoder.next_out_of_line();
12735            let handles_before = decoder.remaining_handles();
12736            if let Some((inlined, num_bytes, num_handles)) =
12737                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12738            {
12739                let member_inline_size = <fidl::encoding::Endpoint<
12740                    fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem2::BufferCollectionTokenMarker>,
12741                > as fidl::encoding::TypeMarker>::inline_size(
12742                    decoder.context
12743                );
12744                if inlined != (member_inline_size <= 4) {
12745                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12746                }
12747                let inner_offset;
12748                let mut inner_depth = depth.clone();
12749                if inlined {
12750                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12751                    inner_offset = next_offset;
12752                } else {
12753                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12754                    inner_depth.increment()?;
12755                }
12756                let val_ref = self.buffer_collection_token2.get_or_insert_with(|| {
12757                    fidl::new_empty!(
12758                        fidl::encoding::Endpoint<
12759                            fidl::endpoints::ClientEnd<
12760                                fidl_fuchsia_sysmem2::BufferCollectionTokenMarker,
12761                            >,
12762                        >,
12763                        fidl::encoding::DefaultFuchsiaResourceDialect
12764                    )
12765                });
12766                fidl::decode!(
12767                    fidl::encoding::Endpoint<
12768                        fidl::endpoints::ClientEnd<
12769                            fidl_fuchsia_sysmem2::BufferCollectionTokenMarker,
12770                        >,
12771                    >,
12772                    fidl::encoding::DefaultFuchsiaResourceDialect,
12773                    val_ref,
12774                    decoder,
12775                    inner_offset,
12776                    inner_depth
12777                )?;
12778                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12779                {
12780                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12781                }
12782                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12783                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12784                }
12785            }
12786
12787            next_offset += envelope_size;
12788
12789            // Decode the remaining unknown envelopes.
12790            while next_offset < end_offset {
12791                _next_ordinal_to_read += 1;
12792                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12793                next_offset += envelope_size;
12794            }
12795
12796            Ok(())
12797        }
12798    }
12799
12800    impl ScreenCaptureConfig {
12801        #[inline(always)]
12802        fn max_ordinal_present(&self) -> u64 {
12803            if let Some(_) = self.rotation {
12804                return 4;
12805            }
12806            if let Some(_) = self.buffer_count {
12807                return 3;
12808            }
12809            if let Some(_) = self.size {
12810                return 2;
12811            }
12812            if let Some(_) = self.import_token {
12813                return 1;
12814            }
12815            0
12816        }
12817    }
12818
12819    impl fidl::encoding::ResourceTypeMarker for ScreenCaptureConfig {
12820        type Borrowed<'a> = &'a mut Self;
12821        fn take_or_borrow<'a>(
12822            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12823        ) -> Self::Borrowed<'a> {
12824            value
12825        }
12826    }
12827
12828    unsafe impl fidl::encoding::TypeMarker for ScreenCaptureConfig {
12829        type Owned = Self;
12830
12831        #[inline(always)]
12832        fn inline_align(_context: fidl::encoding::Context) -> usize {
12833            8
12834        }
12835
12836        #[inline(always)]
12837        fn inline_size(_context: fidl::encoding::Context) -> usize {
12838            16
12839        }
12840    }
12841
12842    unsafe impl
12843        fidl::encoding::Encode<ScreenCaptureConfig, fidl::encoding::DefaultFuchsiaResourceDialect>
12844        for &mut ScreenCaptureConfig
12845    {
12846        unsafe fn encode(
12847            self,
12848            encoder: &mut fidl::encoding::Encoder<
12849                '_,
12850                fidl::encoding::DefaultFuchsiaResourceDialect,
12851            >,
12852            offset: usize,
12853            mut depth: fidl::encoding::Depth,
12854        ) -> fidl::Result<()> {
12855            encoder.debug_check_bounds::<ScreenCaptureConfig>(offset);
12856            // Vector header
12857            let max_ordinal: u64 = self.max_ordinal_present();
12858            encoder.write_num(max_ordinal, offset);
12859            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
12860            // Calling encoder.out_of_line_offset(0) is not allowed.
12861            if max_ordinal == 0 {
12862                return Ok(());
12863            }
12864            depth.increment()?;
12865            let envelope_size = 8;
12866            let bytes_len = max_ordinal as usize * envelope_size;
12867            #[allow(unused_variables)]
12868            let offset = encoder.out_of_line_offset(bytes_len);
12869            let mut _prev_end_offset: usize = 0;
12870            if 1 > max_ordinal {
12871                return Ok(());
12872            }
12873
12874            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12875            // are envelope_size bytes.
12876            let cur_offset: usize = (1 - 1) * envelope_size;
12877
12878            // Zero reserved fields.
12879            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12880
12881            // Safety:
12882            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12883            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12884            //   envelope_size bytes, there is always sufficient room.
12885            fidl::encoding::encode_in_envelope_optional::<BufferCollectionImportToken, fidl::encoding::DefaultFuchsiaResourceDialect>(
12886            self.import_token.as_mut().map(<BufferCollectionImportToken as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
12887            encoder, offset + cur_offset, depth
12888        )?;
12889
12890            _prev_end_offset = cur_offset + envelope_size;
12891            if 2 > max_ordinal {
12892                return Ok(());
12893            }
12894
12895            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12896            // are envelope_size bytes.
12897            let cur_offset: usize = (2 - 1) * envelope_size;
12898
12899            // Zero reserved fields.
12900            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12901
12902            // Safety:
12903            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12904            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12905            //   envelope_size bytes, there is always sufficient room.
12906            fidl::encoding::encode_in_envelope_optional::<
12907                fidl_fuchsia_math::SizeU,
12908                fidl::encoding::DefaultFuchsiaResourceDialect,
12909            >(
12910                self.size
12911                    .as_ref()
12912                    .map(<fidl_fuchsia_math::SizeU as fidl::encoding::ValueTypeMarker>::borrow),
12913                encoder,
12914                offset + cur_offset,
12915                depth,
12916            )?;
12917
12918            _prev_end_offset = cur_offset + envelope_size;
12919            if 3 > max_ordinal {
12920                return Ok(());
12921            }
12922
12923            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12924            // are envelope_size bytes.
12925            let cur_offset: usize = (3 - 1) * envelope_size;
12926
12927            // Zero reserved fields.
12928            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12929
12930            // Safety:
12931            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12932            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12933            //   envelope_size bytes, there is always sufficient room.
12934            fidl::encoding::encode_in_envelope_optional::<
12935                u32,
12936                fidl::encoding::DefaultFuchsiaResourceDialect,
12937            >(
12938                self.buffer_count.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
12939                encoder,
12940                offset + cur_offset,
12941                depth,
12942            )?;
12943
12944            _prev_end_offset = cur_offset + envelope_size;
12945            if 4 > max_ordinal {
12946                return Ok(());
12947            }
12948
12949            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12950            // are envelope_size bytes.
12951            let cur_offset: usize = (4 - 1) * envelope_size;
12952
12953            // Zero reserved fields.
12954            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12955
12956            // Safety:
12957            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12958            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12959            //   envelope_size bytes, there is always sufficient room.
12960            fidl::encoding::encode_in_envelope_optional::<
12961                Rotation,
12962                fidl::encoding::DefaultFuchsiaResourceDialect,
12963            >(
12964                self.rotation.as_ref().map(<Rotation as fidl::encoding::ValueTypeMarker>::borrow),
12965                encoder,
12966                offset + cur_offset,
12967                depth,
12968            )?;
12969
12970            _prev_end_offset = cur_offset + envelope_size;
12971
12972            Ok(())
12973        }
12974    }
12975
12976    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
12977        for ScreenCaptureConfig
12978    {
12979        #[inline(always)]
12980        fn new_empty() -> Self {
12981            Self::default()
12982        }
12983
12984        unsafe fn decode(
12985            &mut self,
12986            decoder: &mut fidl::encoding::Decoder<
12987                '_,
12988                fidl::encoding::DefaultFuchsiaResourceDialect,
12989            >,
12990            offset: usize,
12991            mut depth: fidl::encoding::Depth,
12992        ) -> fidl::Result<()> {
12993            decoder.debug_check_bounds::<Self>(offset);
12994            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
12995                None => return Err(fidl::Error::NotNullable),
12996                Some(len) => len,
12997            };
12998            // Calling decoder.out_of_line_offset(0) is not allowed.
12999            if len == 0 {
13000                return Ok(());
13001            };
13002            depth.increment()?;
13003            let envelope_size = 8;
13004            let bytes_len = len * envelope_size;
13005            let offset = decoder.out_of_line_offset(bytes_len)?;
13006            // Decode the envelope for each type.
13007            let mut _next_ordinal_to_read = 0;
13008            let mut next_offset = offset;
13009            let end_offset = offset + bytes_len;
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 < 1 {
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                    <BufferCollectionImportToken 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.import_token.get_or_insert_with(|| {
13044                    fidl::new_empty!(
13045                        BufferCollectionImportToken,
13046                        fidl::encoding::DefaultFuchsiaResourceDialect
13047                    )
13048                });
13049                fidl::decode!(
13050                    BufferCollectionImportToken,
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 < 2 {
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                    <fidl_fuchsia_math::SizeU as fidl::encoding::TypeMarker>::inline_size(
13086                        decoder.context,
13087                    );
13088                if inlined != (member_inline_size <= 4) {
13089                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
13090                }
13091                let inner_offset;
13092                let mut inner_depth = depth.clone();
13093                if inlined {
13094                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
13095                    inner_offset = next_offset;
13096                } else {
13097                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
13098                    inner_depth.increment()?;
13099                }
13100                let val_ref = self.size.get_or_insert_with(|| {
13101                    fidl::new_empty!(
13102                        fidl_fuchsia_math::SizeU,
13103                        fidl::encoding::DefaultFuchsiaResourceDialect
13104                    )
13105                });
13106                fidl::decode!(
13107                    fidl_fuchsia_math::SizeU,
13108                    fidl::encoding::DefaultFuchsiaResourceDialect,
13109                    val_ref,
13110                    decoder,
13111                    inner_offset,
13112                    inner_depth
13113                )?;
13114                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
13115                {
13116                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
13117                }
13118                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
13119                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
13120                }
13121            }
13122
13123            next_offset += envelope_size;
13124            _next_ordinal_to_read += 1;
13125            if next_offset >= end_offset {
13126                return Ok(());
13127            }
13128
13129            // Decode unknown envelopes for gaps in ordinals.
13130            while _next_ordinal_to_read < 3 {
13131                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13132                _next_ordinal_to_read += 1;
13133                next_offset += envelope_size;
13134            }
13135
13136            let next_out_of_line = decoder.next_out_of_line();
13137            let handles_before = decoder.remaining_handles();
13138            if let Some((inlined, num_bytes, num_handles)) =
13139                fidl::encoding::decode_envelope_header(decoder, next_offset)?
13140            {
13141                let member_inline_size =
13142                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
13143                if inlined != (member_inline_size <= 4) {
13144                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
13145                }
13146                let inner_offset;
13147                let mut inner_depth = depth.clone();
13148                if inlined {
13149                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
13150                    inner_offset = next_offset;
13151                } else {
13152                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
13153                    inner_depth.increment()?;
13154                }
13155                let val_ref = self.buffer_count.get_or_insert_with(|| {
13156                    fidl::new_empty!(u32, fidl::encoding::DefaultFuchsiaResourceDialect)
13157                });
13158                fidl::decode!(
13159                    u32,
13160                    fidl::encoding::DefaultFuchsiaResourceDialect,
13161                    val_ref,
13162                    decoder,
13163                    inner_offset,
13164                    inner_depth
13165                )?;
13166                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
13167                {
13168                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
13169                }
13170                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
13171                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
13172                }
13173            }
13174
13175            next_offset += envelope_size;
13176            _next_ordinal_to_read += 1;
13177            if next_offset >= end_offset {
13178                return Ok(());
13179            }
13180
13181            // Decode unknown envelopes for gaps in ordinals.
13182            while _next_ordinal_to_read < 4 {
13183                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13184                _next_ordinal_to_read += 1;
13185                next_offset += envelope_size;
13186            }
13187
13188            let next_out_of_line = decoder.next_out_of_line();
13189            let handles_before = decoder.remaining_handles();
13190            if let Some((inlined, num_bytes, num_handles)) =
13191                fidl::encoding::decode_envelope_header(decoder, next_offset)?
13192            {
13193                let member_inline_size =
13194                    <Rotation as fidl::encoding::TypeMarker>::inline_size(decoder.context);
13195                if inlined != (member_inline_size <= 4) {
13196                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
13197                }
13198                let inner_offset;
13199                let mut inner_depth = depth.clone();
13200                if inlined {
13201                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
13202                    inner_offset = next_offset;
13203                } else {
13204                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
13205                    inner_depth.increment()?;
13206                }
13207                let val_ref = self.rotation.get_or_insert_with(|| {
13208                    fidl::new_empty!(Rotation, fidl::encoding::DefaultFuchsiaResourceDialect)
13209                });
13210                fidl::decode!(
13211                    Rotation,
13212                    fidl::encoding::DefaultFuchsiaResourceDialect,
13213                    val_ref,
13214                    decoder,
13215                    inner_offset,
13216                    inner_depth
13217                )?;
13218                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
13219                {
13220                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
13221                }
13222                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
13223                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
13224                }
13225            }
13226
13227            next_offset += envelope_size;
13228
13229            // Decode the remaining unknown envelopes.
13230            while next_offset < end_offset {
13231                _next_ordinal_to_read += 1;
13232                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13233                next_offset += envelope_size;
13234            }
13235
13236            Ok(())
13237        }
13238    }
13239
13240    impl ScreenshotTakeFileRequest {
13241        #[inline(always)]
13242        fn max_ordinal_present(&self) -> u64 {
13243            if let Some(_) = self.format {
13244                return 1;
13245            }
13246            0
13247        }
13248    }
13249
13250    impl fidl::encoding::ResourceTypeMarker for ScreenshotTakeFileRequest {
13251        type Borrowed<'a> = &'a mut Self;
13252        fn take_or_borrow<'a>(
13253            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
13254        ) -> Self::Borrowed<'a> {
13255            value
13256        }
13257    }
13258
13259    unsafe impl fidl::encoding::TypeMarker for ScreenshotTakeFileRequest {
13260        type Owned = Self;
13261
13262        #[inline(always)]
13263        fn inline_align(_context: fidl::encoding::Context) -> usize {
13264            8
13265        }
13266
13267        #[inline(always)]
13268        fn inline_size(_context: fidl::encoding::Context) -> usize {
13269            16
13270        }
13271    }
13272
13273    unsafe impl
13274        fidl::encoding::Encode<
13275            ScreenshotTakeFileRequest,
13276            fidl::encoding::DefaultFuchsiaResourceDialect,
13277        > for &mut ScreenshotTakeFileRequest
13278    {
13279        unsafe fn encode(
13280            self,
13281            encoder: &mut fidl::encoding::Encoder<
13282                '_,
13283                fidl::encoding::DefaultFuchsiaResourceDialect,
13284            >,
13285            offset: usize,
13286            mut depth: fidl::encoding::Depth,
13287        ) -> fidl::Result<()> {
13288            encoder.debug_check_bounds::<ScreenshotTakeFileRequest>(offset);
13289            // Vector header
13290            let max_ordinal: u64 = self.max_ordinal_present();
13291            encoder.write_num(max_ordinal, offset);
13292            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
13293            // Calling encoder.out_of_line_offset(0) is not allowed.
13294            if max_ordinal == 0 {
13295                return Ok(());
13296            }
13297            depth.increment()?;
13298            let envelope_size = 8;
13299            let bytes_len = max_ordinal as usize * envelope_size;
13300            #[allow(unused_variables)]
13301            let offset = encoder.out_of_line_offset(bytes_len);
13302            let mut _prev_end_offset: usize = 0;
13303            if 1 > max_ordinal {
13304                return Ok(());
13305            }
13306
13307            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
13308            // are envelope_size bytes.
13309            let cur_offset: usize = (1 - 1) * envelope_size;
13310
13311            // Zero reserved fields.
13312            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
13313
13314            // Safety:
13315            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
13316            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
13317            //   envelope_size bytes, there is always sufficient room.
13318            fidl::encoding::encode_in_envelope_optional::<
13319                ScreenshotFormat,
13320                fidl::encoding::DefaultFuchsiaResourceDialect,
13321            >(
13322                self.format
13323                    .as_ref()
13324                    .map(<ScreenshotFormat as fidl::encoding::ValueTypeMarker>::borrow),
13325                encoder,
13326                offset + cur_offset,
13327                depth,
13328            )?;
13329
13330            _prev_end_offset = cur_offset + envelope_size;
13331
13332            Ok(())
13333        }
13334    }
13335
13336    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
13337        for ScreenshotTakeFileRequest
13338    {
13339        #[inline(always)]
13340        fn new_empty() -> Self {
13341            Self::default()
13342        }
13343
13344        unsafe fn decode(
13345            &mut self,
13346            decoder: &mut fidl::encoding::Decoder<
13347                '_,
13348                fidl::encoding::DefaultFuchsiaResourceDialect,
13349            >,
13350            offset: usize,
13351            mut depth: fidl::encoding::Depth,
13352        ) -> fidl::Result<()> {
13353            decoder.debug_check_bounds::<Self>(offset);
13354            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
13355                None => return Err(fidl::Error::NotNullable),
13356                Some(len) => len,
13357            };
13358            // Calling decoder.out_of_line_offset(0) is not allowed.
13359            if len == 0 {
13360                return Ok(());
13361            };
13362            depth.increment()?;
13363            let envelope_size = 8;
13364            let bytes_len = len * envelope_size;
13365            let offset = decoder.out_of_line_offset(bytes_len)?;
13366            // Decode the envelope for each type.
13367            let mut _next_ordinal_to_read = 0;
13368            let mut next_offset = offset;
13369            let end_offset = offset + bytes_len;
13370            _next_ordinal_to_read += 1;
13371            if next_offset >= end_offset {
13372                return Ok(());
13373            }
13374
13375            // Decode unknown envelopes for gaps in ordinals.
13376            while _next_ordinal_to_read < 1 {
13377                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13378                _next_ordinal_to_read += 1;
13379                next_offset += envelope_size;
13380            }
13381
13382            let next_out_of_line = decoder.next_out_of_line();
13383            let handles_before = decoder.remaining_handles();
13384            if let Some((inlined, num_bytes, num_handles)) =
13385                fidl::encoding::decode_envelope_header(decoder, next_offset)?
13386            {
13387                let member_inline_size =
13388                    <ScreenshotFormat as fidl::encoding::TypeMarker>::inline_size(decoder.context);
13389                if inlined != (member_inline_size <= 4) {
13390                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
13391                }
13392                let inner_offset;
13393                let mut inner_depth = depth.clone();
13394                if inlined {
13395                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
13396                    inner_offset = next_offset;
13397                } else {
13398                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
13399                    inner_depth.increment()?;
13400                }
13401                let val_ref = self.format.get_or_insert_with(|| {
13402                    fidl::new_empty!(
13403                        ScreenshotFormat,
13404                        fidl::encoding::DefaultFuchsiaResourceDialect
13405                    )
13406                });
13407                fidl::decode!(
13408                    ScreenshotFormat,
13409                    fidl::encoding::DefaultFuchsiaResourceDialect,
13410                    val_ref,
13411                    decoder,
13412                    inner_offset,
13413                    inner_depth
13414                )?;
13415                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
13416                {
13417                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
13418                }
13419                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
13420                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
13421                }
13422            }
13423
13424            next_offset += envelope_size;
13425
13426            // Decode the remaining unknown envelopes.
13427            while next_offset < end_offset {
13428                _next_ordinal_to_read += 1;
13429                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13430                next_offset += envelope_size;
13431            }
13432
13433            Ok(())
13434        }
13435    }
13436
13437    impl ScreenshotTakeFileResponse {
13438        #[inline(always)]
13439        fn max_ordinal_present(&self) -> u64 {
13440            if let Some(_) = self.size {
13441                return 2;
13442            }
13443            if let Some(_) = self.file {
13444                return 1;
13445            }
13446            0
13447        }
13448    }
13449
13450    impl fidl::encoding::ResourceTypeMarker for ScreenshotTakeFileResponse {
13451        type Borrowed<'a> = &'a mut Self;
13452        fn take_or_borrow<'a>(
13453            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
13454        ) -> Self::Borrowed<'a> {
13455            value
13456        }
13457    }
13458
13459    unsafe impl fidl::encoding::TypeMarker for ScreenshotTakeFileResponse {
13460        type Owned = Self;
13461
13462        #[inline(always)]
13463        fn inline_align(_context: fidl::encoding::Context) -> usize {
13464            8
13465        }
13466
13467        #[inline(always)]
13468        fn inline_size(_context: fidl::encoding::Context) -> usize {
13469            16
13470        }
13471    }
13472
13473    unsafe impl
13474        fidl::encoding::Encode<
13475            ScreenshotTakeFileResponse,
13476            fidl::encoding::DefaultFuchsiaResourceDialect,
13477        > for &mut ScreenshotTakeFileResponse
13478    {
13479        unsafe fn encode(
13480            self,
13481            encoder: &mut fidl::encoding::Encoder<
13482                '_,
13483                fidl::encoding::DefaultFuchsiaResourceDialect,
13484            >,
13485            offset: usize,
13486            mut depth: fidl::encoding::Depth,
13487        ) -> fidl::Result<()> {
13488            encoder.debug_check_bounds::<ScreenshotTakeFileResponse>(offset);
13489            // Vector header
13490            let max_ordinal: u64 = self.max_ordinal_present();
13491            encoder.write_num(max_ordinal, offset);
13492            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
13493            // Calling encoder.out_of_line_offset(0) is not allowed.
13494            if max_ordinal == 0 {
13495                return Ok(());
13496            }
13497            depth.increment()?;
13498            let envelope_size = 8;
13499            let bytes_len = max_ordinal as usize * envelope_size;
13500            #[allow(unused_variables)]
13501            let offset = encoder.out_of_line_offset(bytes_len);
13502            let mut _prev_end_offset: usize = 0;
13503            if 1 > max_ordinal {
13504                return Ok(());
13505            }
13506
13507            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
13508            // are envelope_size bytes.
13509            let cur_offset: usize = (1 - 1) * envelope_size;
13510
13511            // Zero reserved fields.
13512            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
13513
13514            // Safety:
13515            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
13516            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
13517            //   envelope_size bytes, there is always sufficient room.
13518            fidl::encoding::encode_in_envelope_optional::<
13519                fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>>,
13520                fidl::encoding::DefaultFuchsiaResourceDialect,
13521            >(
13522                self.file.as_mut().map(
13523                    <fidl::encoding::Endpoint<
13524                        fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
13525                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
13526                ),
13527                encoder,
13528                offset + cur_offset,
13529                depth,
13530            )?;
13531
13532            _prev_end_offset = cur_offset + envelope_size;
13533            if 2 > max_ordinal {
13534                return Ok(());
13535            }
13536
13537            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
13538            // are envelope_size bytes.
13539            let cur_offset: usize = (2 - 1) * envelope_size;
13540
13541            // Zero reserved fields.
13542            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
13543
13544            // Safety:
13545            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
13546            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
13547            //   envelope_size bytes, there is always sufficient room.
13548            fidl::encoding::encode_in_envelope_optional::<
13549                fidl_fuchsia_math::SizeU,
13550                fidl::encoding::DefaultFuchsiaResourceDialect,
13551            >(
13552                self.size
13553                    .as_ref()
13554                    .map(<fidl_fuchsia_math::SizeU as fidl::encoding::ValueTypeMarker>::borrow),
13555                encoder,
13556                offset + cur_offset,
13557                depth,
13558            )?;
13559
13560            _prev_end_offset = cur_offset + envelope_size;
13561
13562            Ok(())
13563        }
13564    }
13565
13566    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
13567        for ScreenshotTakeFileResponse
13568    {
13569        #[inline(always)]
13570        fn new_empty() -> Self {
13571            Self::default()
13572        }
13573
13574        unsafe fn decode(
13575            &mut self,
13576            decoder: &mut fidl::encoding::Decoder<
13577                '_,
13578                fidl::encoding::DefaultFuchsiaResourceDialect,
13579            >,
13580            offset: usize,
13581            mut depth: fidl::encoding::Depth,
13582        ) -> fidl::Result<()> {
13583            decoder.debug_check_bounds::<Self>(offset);
13584            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
13585                None => return Err(fidl::Error::NotNullable),
13586                Some(len) => len,
13587            };
13588            // Calling decoder.out_of_line_offset(0) is not allowed.
13589            if len == 0 {
13590                return Ok(());
13591            };
13592            depth.increment()?;
13593            let envelope_size = 8;
13594            let bytes_len = len * envelope_size;
13595            let offset = decoder.out_of_line_offset(bytes_len)?;
13596            // Decode the envelope for each type.
13597            let mut _next_ordinal_to_read = 0;
13598            let mut next_offset = offset;
13599            let end_offset = offset + bytes_len;
13600            _next_ordinal_to_read += 1;
13601            if next_offset >= end_offset {
13602                return Ok(());
13603            }
13604
13605            // Decode unknown envelopes for gaps in ordinals.
13606            while _next_ordinal_to_read < 1 {
13607                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13608                _next_ordinal_to_read += 1;
13609                next_offset += envelope_size;
13610            }
13611
13612            let next_out_of_line = decoder.next_out_of_line();
13613            let handles_before = decoder.remaining_handles();
13614            if let Some((inlined, num_bytes, num_handles)) =
13615                fidl::encoding::decode_envelope_header(decoder, next_offset)?
13616            {
13617                let member_inline_size = <fidl::encoding::Endpoint<
13618                    fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
13619                > as fidl::encoding::TypeMarker>::inline_size(
13620                    decoder.context
13621                );
13622                if inlined != (member_inline_size <= 4) {
13623                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
13624                }
13625                let inner_offset;
13626                let mut inner_depth = depth.clone();
13627                if inlined {
13628                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
13629                    inner_offset = next_offset;
13630                } else {
13631                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
13632                    inner_depth.increment()?;
13633                }
13634                let val_ref = self.file.get_or_insert_with(|| {
13635                    fidl::new_empty!(
13636                        fidl::encoding::Endpoint<
13637                            fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
13638                        >,
13639                        fidl::encoding::DefaultFuchsiaResourceDialect
13640                    )
13641                });
13642                fidl::decode!(
13643                    fidl::encoding::Endpoint<
13644                        fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
13645                    >,
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            _next_ordinal_to_read += 1;
13663            if next_offset >= end_offset {
13664                return Ok(());
13665            }
13666
13667            // Decode unknown envelopes for gaps in ordinals.
13668            while _next_ordinal_to_read < 2 {
13669                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13670                _next_ordinal_to_read += 1;
13671                next_offset += envelope_size;
13672            }
13673
13674            let next_out_of_line = decoder.next_out_of_line();
13675            let handles_before = decoder.remaining_handles();
13676            if let Some((inlined, num_bytes, num_handles)) =
13677                fidl::encoding::decode_envelope_header(decoder, next_offset)?
13678            {
13679                let member_inline_size =
13680                    <fidl_fuchsia_math::SizeU as fidl::encoding::TypeMarker>::inline_size(
13681                        decoder.context,
13682                    );
13683                if inlined != (member_inline_size <= 4) {
13684                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
13685                }
13686                let inner_offset;
13687                let mut inner_depth = depth.clone();
13688                if inlined {
13689                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
13690                    inner_offset = next_offset;
13691                } else {
13692                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
13693                    inner_depth.increment()?;
13694                }
13695                let val_ref = self.size.get_or_insert_with(|| {
13696                    fidl::new_empty!(
13697                        fidl_fuchsia_math::SizeU,
13698                        fidl::encoding::DefaultFuchsiaResourceDialect
13699                    )
13700                });
13701                fidl::decode!(
13702                    fidl_fuchsia_math::SizeU,
13703                    fidl::encoding::DefaultFuchsiaResourceDialect,
13704                    val_ref,
13705                    decoder,
13706                    inner_offset,
13707                    inner_depth
13708                )?;
13709                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
13710                {
13711                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
13712                }
13713                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
13714                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
13715                }
13716            }
13717
13718            next_offset += envelope_size;
13719
13720            // Decode the remaining unknown envelopes.
13721            while next_offset < end_offset {
13722                _next_ordinal_to_read += 1;
13723                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13724                next_offset += envelope_size;
13725            }
13726
13727            Ok(())
13728        }
13729    }
13730
13731    impl ScreenshotTakeRequest {
13732        #[inline(always)]
13733        fn max_ordinal_present(&self) -> u64 {
13734            if let Some(_) = self.format {
13735                return 1;
13736            }
13737            0
13738        }
13739    }
13740
13741    impl fidl::encoding::ResourceTypeMarker for ScreenshotTakeRequest {
13742        type Borrowed<'a> = &'a mut Self;
13743        fn take_or_borrow<'a>(
13744            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
13745        ) -> Self::Borrowed<'a> {
13746            value
13747        }
13748    }
13749
13750    unsafe impl fidl::encoding::TypeMarker for ScreenshotTakeRequest {
13751        type Owned = Self;
13752
13753        #[inline(always)]
13754        fn inline_align(_context: fidl::encoding::Context) -> usize {
13755            8
13756        }
13757
13758        #[inline(always)]
13759        fn inline_size(_context: fidl::encoding::Context) -> usize {
13760            16
13761        }
13762    }
13763
13764    unsafe impl
13765        fidl::encoding::Encode<ScreenshotTakeRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
13766        for &mut ScreenshotTakeRequest
13767    {
13768        unsafe fn encode(
13769            self,
13770            encoder: &mut fidl::encoding::Encoder<
13771                '_,
13772                fidl::encoding::DefaultFuchsiaResourceDialect,
13773            >,
13774            offset: usize,
13775            mut depth: fidl::encoding::Depth,
13776        ) -> fidl::Result<()> {
13777            encoder.debug_check_bounds::<ScreenshotTakeRequest>(offset);
13778            // Vector header
13779            let max_ordinal: u64 = self.max_ordinal_present();
13780            encoder.write_num(max_ordinal, offset);
13781            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
13782            // Calling encoder.out_of_line_offset(0) is not allowed.
13783            if max_ordinal == 0 {
13784                return Ok(());
13785            }
13786            depth.increment()?;
13787            let envelope_size = 8;
13788            let bytes_len = max_ordinal as usize * envelope_size;
13789            #[allow(unused_variables)]
13790            let offset = encoder.out_of_line_offset(bytes_len);
13791            let mut _prev_end_offset: usize = 0;
13792            if 1 > max_ordinal {
13793                return Ok(());
13794            }
13795
13796            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
13797            // are envelope_size bytes.
13798            let cur_offset: usize = (1 - 1) * envelope_size;
13799
13800            // Zero reserved fields.
13801            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
13802
13803            // Safety:
13804            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
13805            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
13806            //   envelope_size bytes, there is always sufficient room.
13807            fidl::encoding::encode_in_envelope_optional::<
13808                ScreenshotFormat,
13809                fidl::encoding::DefaultFuchsiaResourceDialect,
13810            >(
13811                self.format
13812                    .as_ref()
13813                    .map(<ScreenshotFormat as fidl::encoding::ValueTypeMarker>::borrow),
13814                encoder,
13815                offset + cur_offset,
13816                depth,
13817            )?;
13818
13819            _prev_end_offset = cur_offset + envelope_size;
13820
13821            Ok(())
13822        }
13823    }
13824
13825    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
13826        for ScreenshotTakeRequest
13827    {
13828        #[inline(always)]
13829        fn new_empty() -> Self {
13830            Self::default()
13831        }
13832
13833        unsafe fn decode(
13834            &mut self,
13835            decoder: &mut fidl::encoding::Decoder<
13836                '_,
13837                fidl::encoding::DefaultFuchsiaResourceDialect,
13838            >,
13839            offset: usize,
13840            mut depth: fidl::encoding::Depth,
13841        ) -> fidl::Result<()> {
13842            decoder.debug_check_bounds::<Self>(offset);
13843            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
13844                None => return Err(fidl::Error::NotNullable),
13845                Some(len) => len,
13846            };
13847            // Calling decoder.out_of_line_offset(0) is not allowed.
13848            if len == 0 {
13849                return Ok(());
13850            };
13851            depth.increment()?;
13852            let envelope_size = 8;
13853            let bytes_len = len * envelope_size;
13854            let offset = decoder.out_of_line_offset(bytes_len)?;
13855            // Decode the envelope for each type.
13856            let mut _next_ordinal_to_read = 0;
13857            let mut next_offset = offset;
13858            let end_offset = offset + bytes_len;
13859            _next_ordinal_to_read += 1;
13860            if next_offset >= end_offset {
13861                return Ok(());
13862            }
13863
13864            // Decode unknown envelopes for gaps in ordinals.
13865            while _next_ordinal_to_read < 1 {
13866                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13867                _next_ordinal_to_read += 1;
13868                next_offset += envelope_size;
13869            }
13870
13871            let next_out_of_line = decoder.next_out_of_line();
13872            let handles_before = decoder.remaining_handles();
13873            if let Some((inlined, num_bytes, num_handles)) =
13874                fidl::encoding::decode_envelope_header(decoder, next_offset)?
13875            {
13876                let member_inline_size =
13877                    <ScreenshotFormat as fidl::encoding::TypeMarker>::inline_size(decoder.context);
13878                if inlined != (member_inline_size <= 4) {
13879                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
13880                }
13881                let inner_offset;
13882                let mut inner_depth = depth.clone();
13883                if inlined {
13884                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
13885                    inner_offset = next_offset;
13886                } else {
13887                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
13888                    inner_depth.increment()?;
13889                }
13890                let val_ref = self.format.get_or_insert_with(|| {
13891                    fidl::new_empty!(
13892                        ScreenshotFormat,
13893                        fidl::encoding::DefaultFuchsiaResourceDialect
13894                    )
13895                });
13896                fidl::decode!(
13897                    ScreenshotFormat,
13898                    fidl::encoding::DefaultFuchsiaResourceDialect,
13899                    val_ref,
13900                    decoder,
13901                    inner_offset,
13902                    inner_depth
13903                )?;
13904                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
13905                {
13906                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
13907                }
13908                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
13909                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
13910                }
13911            }
13912
13913            next_offset += envelope_size;
13914
13915            // Decode the remaining unknown envelopes.
13916            while next_offset < end_offset {
13917                _next_ordinal_to_read += 1;
13918                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13919                next_offset += envelope_size;
13920            }
13921
13922            Ok(())
13923        }
13924    }
13925
13926    impl ScreenshotTakeResponse {
13927        #[inline(always)]
13928        fn max_ordinal_present(&self) -> u64 {
13929            if let Some(_) = self.size {
13930                return 2;
13931            }
13932            if let Some(_) = self.vmo {
13933                return 1;
13934            }
13935            0
13936        }
13937    }
13938
13939    impl fidl::encoding::ResourceTypeMarker for ScreenshotTakeResponse {
13940        type Borrowed<'a> = &'a mut Self;
13941        fn take_or_borrow<'a>(
13942            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
13943        ) -> Self::Borrowed<'a> {
13944            value
13945        }
13946    }
13947
13948    unsafe impl fidl::encoding::TypeMarker for ScreenshotTakeResponse {
13949        type Owned = Self;
13950
13951        #[inline(always)]
13952        fn inline_align(_context: fidl::encoding::Context) -> usize {
13953            8
13954        }
13955
13956        #[inline(always)]
13957        fn inline_size(_context: fidl::encoding::Context) -> usize {
13958            16
13959        }
13960    }
13961
13962    unsafe impl
13963        fidl::encoding::Encode<
13964            ScreenshotTakeResponse,
13965            fidl::encoding::DefaultFuchsiaResourceDialect,
13966        > for &mut ScreenshotTakeResponse
13967    {
13968        unsafe fn encode(
13969            self,
13970            encoder: &mut fidl::encoding::Encoder<
13971                '_,
13972                fidl::encoding::DefaultFuchsiaResourceDialect,
13973            >,
13974            offset: usize,
13975            mut depth: fidl::encoding::Depth,
13976        ) -> fidl::Result<()> {
13977            encoder.debug_check_bounds::<ScreenshotTakeResponse>(offset);
13978            // Vector header
13979            let max_ordinal: u64 = self.max_ordinal_present();
13980            encoder.write_num(max_ordinal, offset);
13981            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
13982            // Calling encoder.out_of_line_offset(0) is not allowed.
13983            if max_ordinal == 0 {
13984                return Ok(());
13985            }
13986            depth.increment()?;
13987            let envelope_size = 8;
13988            let bytes_len = max_ordinal as usize * envelope_size;
13989            #[allow(unused_variables)]
13990            let offset = encoder.out_of_line_offset(bytes_len);
13991            let mut _prev_end_offset: usize = 0;
13992            if 1 > max_ordinal {
13993                return Ok(());
13994            }
13995
13996            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
13997            // are envelope_size bytes.
13998            let cur_offset: usize = (1 - 1) * envelope_size;
13999
14000            // Zero reserved fields.
14001            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
14002
14003            // Safety:
14004            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
14005            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
14006            //   envelope_size bytes, there is always sufficient room.
14007            fidl::encoding::encode_in_envelope_optional::<
14008                fidl::encoding::HandleType<
14009                    fidl::Vmo,
14010                    { fidl::ObjectType::VMO.into_raw() },
14011                    2147483648,
14012                >,
14013                fidl::encoding::DefaultFuchsiaResourceDialect,
14014            >(
14015                self.vmo.as_mut().map(
14016                    <fidl::encoding::HandleType<
14017                        fidl::Vmo,
14018                        { fidl::ObjectType::VMO.into_raw() },
14019                        2147483648,
14020                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
14021                ),
14022                encoder,
14023                offset + cur_offset,
14024                depth,
14025            )?;
14026
14027            _prev_end_offset = cur_offset + envelope_size;
14028            if 2 > max_ordinal {
14029                return Ok(());
14030            }
14031
14032            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
14033            // are envelope_size bytes.
14034            let cur_offset: usize = (2 - 1) * envelope_size;
14035
14036            // Zero reserved fields.
14037            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
14038
14039            // Safety:
14040            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
14041            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
14042            //   envelope_size bytes, there is always sufficient room.
14043            fidl::encoding::encode_in_envelope_optional::<
14044                fidl_fuchsia_math::SizeU,
14045                fidl::encoding::DefaultFuchsiaResourceDialect,
14046            >(
14047                self.size
14048                    .as_ref()
14049                    .map(<fidl_fuchsia_math::SizeU as fidl::encoding::ValueTypeMarker>::borrow),
14050                encoder,
14051                offset + cur_offset,
14052                depth,
14053            )?;
14054
14055            _prev_end_offset = cur_offset + envelope_size;
14056
14057            Ok(())
14058        }
14059    }
14060
14061    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
14062        for ScreenshotTakeResponse
14063    {
14064        #[inline(always)]
14065        fn new_empty() -> Self {
14066            Self::default()
14067        }
14068
14069        unsafe fn decode(
14070            &mut self,
14071            decoder: &mut fidl::encoding::Decoder<
14072                '_,
14073                fidl::encoding::DefaultFuchsiaResourceDialect,
14074            >,
14075            offset: usize,
14076            mut depth: fidl::encoding::Depth,
14077        ) -> fidl::Result<()> {
14078            decoder.debug_check_bounds::<Self>(offset);
14079            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
14080                None => return Err(fidl::Error::NotNullable),
14081                Some(len) => len,
14082            };
14083            // Calling decoder.out_of_line_offset(0) is not allowed.
14084            if len == 0 {
14085                return Ok(());
14086            };
14087            depth.increment()?;
14088            let envelope_size = 8;
14089            let bytes_len = len * envelope_size;
14090            let offset = decoder.out_of_line_offset(bytes_len)?;
14091            // Decode the envelope for each type.
14092            let mut _next_ordinal_to_read = 0;
14093            let mut next_offset = offset;
14094            let end_offset = offset + bytes_len;
14095            _next_ordinal_to_read += 1;
14096            if next_offset >= end_offset {
14097                return Ok(());
14098            }
14099
14100            // Decode unknown envelopes for gaps in ordinals.
14101            while _next_ordinal_to_read < 1 {
14102                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
14103                _next_ordinal_to_read += 1;
14104                next_offset += envelope_size;
14105            }
14106
14107            let next_out_of_line = decoder.next_out_of_line();
14108            let handles_before = decoder.remaining_handles();
14109            if let Some((inlined, num_bytes, num_handles)) =
14110                fidl::encoding::decode_envelope_header(decoder, next_offset)?
14111            {
14112                let member_inline_size = <fidl::encoding::HandleType<
14113                    fidl::Vmo,
14114                    { fidl::ObjectType::VMO.into_raw() },
14115                    2147483648,
14116                > as fidl::encoding::TypeMarker>::inline_size(
14117                    decoder.context
14118                );
14119                if inlined != (member_inline_size <= 4) {
14120                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
14121                }
14122                let inner_offset;
14123                let mut inner_depth = depth.clone();
14124                if inlined {
14125                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
14126                    inner_offset = next_offset;
14127                } else {
14128                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
14129                    inner_depth.increment()?;
14130                }
14131                let val_ref =
14132                self.vmo.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
14133                fidl::decode!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
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            _next_ordinal_to_read += 1;
14145            if next_offset >= end_offset {
14146                return Ok(());
14147            }
14148
14149            // Decode unknown envelopes for gaps in ordinals.
14150            while _next_ordinal_to_read < 2 {
14151                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
14152                _next_ordinal_to_read += 1;
14153                next_offset += envelope_size;
14154            }
14155
14156            let next_out_of_line = decoder.next_out_of_line();
14157            let handles_before = decoder.remaining_handles();
14158            if let Some((inlined, num_bytes, num_handles)) =
14159                fidl::encoding::decode_envelope_header(decoder, next_offset)?
14160            {
14161                let member_inline_size =
14162                    <fidl_fuchsia_math::SizeU as fidl::encoding::TypeMarker>::inline_size(
14163                        decoder.context,
14164                    );
14165                if inlined != (member_inline_size <= 4) {
14166                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
14167                }
14168                let inner_offset;
14169                let mut inner_depth = depth.clone();
14170                if inlined {
14171                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
14172                    inner_offset = next_offset;
14173                } else {
14174                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
14175                    inner_depth.increment()?;
14176                }
14177                let val_ref = self.size.get_or_insert_with(|| {
14178                    fidl::new_empty!(
14179                        fidl_fuchsia_math::SizeU,
14180                        fidl::encoding::DefaultFuchsiaResourceDialect
14181                    )
14182                });
14183                fidl::decode!(
14184                    fidl_fuchsia_math::SizeU,
14185                    fidl::encoding::DefaultFuchsiaResourceDialect,
14186                    val_ref,
14187                    decoder,
14188                    inner_offset,
14189                    inner_depth
14190                )?;
14191                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
14192                {
14193                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
14194                }
14195                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
14196                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
14197                }
14198            }
14199
14200            next_offset += envelope_size;
14201
14202            // Decode the remaining unknown envelopes.
14203            while next_offset < end_offset {
14204                _next_ordinal_to_read += 1;
14205                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
14206                next_offset += envelope_size;
14207            }
14208
14209            Ok(())
14210        }
14211    }
14212
14213    impl TrustedFlatlandConfig {
14214        #[inline(always)]
14215        fn max_ordinal_present(&self) -> u64 {
14216            if let Some(_) = self.skips_on_frame_presented {
14217                return 4;
14218            }
14219            if let Some(_) = self.skips_present_credits {
14220                return 3;
14221            }
14222            if let Some(_) = self.pass_acquire_fences {
14223                return 2;
14224            }
14225            if let Some(_) = self.schedule_asap {
14226                return 1;
14227            }
14228            0
14229        }
14230    }
14231
14232    impl fidl::encoding::ResourceTypeMarker for TrustedFlatlandConfig {
14233        type Borrowed<'a> = &'a mut Self;
14234        fn take_or_borrow<'a>(
14235            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
14236        ) -> Self::Borrowed<'a> {
14237            value
14238        }
14239    }
14240
14241    unsafe impl fidl::encoding::TypeMarker for TrustedFlatlandConfig {
14242        type Owned = Self;
14243
14244        #[inline(always)]
14245        fn inline_align(_context: fidl::encoding::Context) -> usize {
14246            8
14247        }
14248
14249        #[inline(always)]
14250        fn inline_size(_context: fidl::encoding::Context) -> usize {
14251            16
14252        }
14253    }
14254
14255    unsafe impl
14256        fidl::encoding::Encode<TrustedFlatlandConfig, fidl::encoding::DefaultFuchsiaResourceDialect>
14257        for &mut TrustedFlatlandConfig
14258    {
14259        unsafe fn encode(
14260            self,
14261            encoder: &mut fidl::encoding::Encoder<
14262                '_,
14263                fidl::encoding::DefaultFuchsiaResourceDialect,
14264            >,
14265            offset: usize,
14266            mut depth: fidl::encoding::Depth,
14267        ) -> fidl::Result<()> {
14268            encoder.debug_check_bounds::<TrustedFlatlandConfig>(offset);
14269            // Vector header
14270            let max_ordinal: u64 = self.max_ordinal_present();
14271            encoder.write_num(max_ordinal, offset);
14272            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
14273            // Calling encoder.out_of_line_offset(0) is not allowed.
14274            if max_ordinal == 0 {
14275                return Ok(());
14276            }
14277            depth.increment()?;
14278            let envelope_size = 8;
14279            let bytes_len = max_ordinal as usize * envelope_size;
14280            #[allow(unused_variables)]
14281            let offset = encoder.out_of_line_offset(bytes_len);
14282            let mut _prev_end_offset: usize = 0;
14283            if 1 > max_ordinal {
14284                return Ok(());
14285            }
14286
14287            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
14288            // are envelope_size bytes.
14289            let cur_offset: usize = (1 - 1) * envelope_size;
14290
14291            // Zero reserved fields.
14292            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
14293
14294            // Safety:
14295            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
14296            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
14297            //   envelope_size bytes, there is always sufficient room.
14298            fidl::encoding::encode_in_envelope_optional::<
14299                bool,
14300                fidl::encoding::DefaultFuchsiaResourceDialect,
14301            >(
14302                self.schedule_asap.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
14303                encoder,
14304                offset + cur_offset,
14305                depth,
14306            )?;
14307
14308            _prev_end_offset = cur_offset + envelope_size;
14309            if 2 > max_ordinal {
14310                return Ok(());
14311            }
14312
14313            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
14314            // are envelope_size bytes.
14315            let cur_offset: usize = (2 - 1) * envelope_size;
14316
14317            // Zero reserved fields.
14318            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
14319
14320            // Safety:
14321            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
14322            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
14323            //   envelope_size bytes, there is always sufficient room.
14324            fidl::encoding::encode_in_envelope_optional::<
14325                bool,
14326                fidl::encoding::DefaultFuchsiaResourceDialect,
14327            >(
14328                self.pass_acquire_fences
14329                    .as_ref()
14330                    .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
14331                encoder,
14332                offset + cur_offset,
14333                depth,
14334            )?;
14335
14336            _prev_end_offset = cur_offset + envelope_size;
14337            if 3 > max_ordinal {
14338                return Ok(());
14339            }
14340
14341            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
14342            // are envelope_size bytes.
14343            let cur_offset: usize = (3 - 1) * envelope_size;
14344
14345            // Zero reserved fields.
14346            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
14347
14348            // Safety:
14349            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
14350            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
14351            //   envelope_size bytes, there is always sufficient room.
14352            fidl::encoding::encode_in_envelope_optional::<
14353                bool,
14354                fidl::encoding::DefaultFuchsiaResourceDialect,
14355            >(
14356                self.skips_present_credits
14357                    .as_ref()
14358                    .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
14359                encoder,
14360                offset + cur_offset,
14361                depth,
14362            )?;
14363
14364            _prev_end_offset = cur_offset + envelope_size;
14365            if 4 > max_ordinal {
14366                return Ok(());
14367            }
14368
14369            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
14370            // are envelope_size bytes.
14371            let cur_offset: usize = (4 - 1) * envelope_size;
14372
14373            // Zero reserved fields.
14374            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
14375
14376            // Safety:
14377            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
14378            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
14379            //   envelope_size bytes, there is always sufficient room.
14380            fidl::encoding::encode_in_envelope_optional::<
14381                bool,
14382                fidl::encoding::DefaultFuchsiaResourceDialect,
14383            >(
14384                self.skips_on_frame_presented
14385                    .as_ref()
14386                    .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
14387                encoder,
14388                offset + cur_offset,
14389                depth,
14390            )?;
14391
14392            _prev_end_offset = cur_offset + envelope_size;
14393
14394            Ok(())
14395        }
14396    }
14397
14398    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
14399        for TrustedFlatlandConfig
14400    {
14401        #[inline(always)]
14402        fn new_empty() -> Self {
14403            Self::default()
14404        }
14405
14406        unsafe fn decode(
14407            &mut self,
14408            decoder: &mut fidl::encoding::Decoder<
14409                '_,
14410                fidl::encoding::DefaultFuchsiaResourceDialect,
14411            >,
14412            offset: usize,
14413            mut depth: fidl::encoding::Depth,
14414        ) -> fidl::Result<()> {
14415            decoder.debug_check_bounds::<Self>(offset);
14416            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
14417                None => return Err(fidl::Error::NotNullable),
14418                Some(len) => len,
14419            };
14420            // Calling decoder.out_of_line_offset(0) is not allowed.
14421            if len == 0 {
14422                return Ok(());
14423            };
14424            depth.increment()?;
14425            let envelope_size = 8;
14426            let bytes_len = len * envelope_size;
14427            let offset = decoder.out_of_line_offset(bytes_len)?;
14428            // Decode the envelope for each type.
14429            let mut _next_ordinal_to_read = 0;
14430            let mut next_offset = offset;
14431            let end_offset = offset + bytes_len;
14432            _next_ordinal_to_read += 1;
14433            if next_offset >= end_offset {
14434                return Ok(());
14435            }
14436
14437            // Decode unknown envelopes for gaps in ordinals.
14438            while _next_ordinal_to_read < 1 {
14439                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
14440                _next_ordinal_to_read += 1;
14441                next_offset += envelope_size;
14442            }
14443
14444            let next_out_of_line = decoder.next_out_of_line();
14445            let handles_before = decoder.remaining_handles();
14446            if let Some((inlined, num_bytes, num_handles)) =
14447                fidl::encoding::decode_envelope_header(decoder, next_offset)?
14448            {
14449                let member_inline_size =
14450                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
14451                if inlined != (member_inline_size <= 4) {
14452                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
14453                }
14454                let inner_offset;
14455                let mut inner_depth = depth.clone();
14456                if inlined {
14457                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
14458                    inner_offset = next_offset;
14459                } else {
14460                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
14461                    inner_depth.increment()?;
14462                }
14463                let val_ref = self.schedule_asap.get_or_insert_with(|| {
14464                    fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
14465                });
14466                fidl::decode!(
14467                    bool,
14468                    fidl::encoding::DefaultFuchsiaResourceDialect,
14469                    val_ref,
14470                    decoder,
14471                    inner_offset,
14472                    inner_depth
14473                )?;
14474                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
14475                {
14476                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
14477                }
14478                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
14479                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
14480                }
14481            }
14482
14483            next_offset += envelope_size;
14484            _next_ordinal_to_read += 1;
14485            if next_offset >= end_offset {
14486                return Ok(());
14487            }
14488
14489            // Decode unknown envelopes for gaps in ordinals.
14490            while _next_ordinal_to_read < 2 {
14491                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
14492                _next_ordinal_to_read += 1;
14493                next_offset += envelope_size;
14494            }
14495
14496            let next_out_of_line = decoder.next_out_of_line();
14497            let handles_before = decoder.remaining_handles();
14498            if let Some((inlined, num_bytes, num_handles)) =
14499                fidl::encoding::decode_envelope_header(decoder, next_offset)?
14500            {
14501                let member_inline_size =
14502                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
14503                if inlined != (member_inline_size <= 4) {
14504                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
14505                }
14506                let inner_offset;
14507                let mut inner_depth = depth.clone();
14508                if inlined {
14509                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
14510                    inner_offset = next_offset;
14511                } else {
14512                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
14513                    inner_depth.increment()?;
14514                }
14515                let val_ref = self.pass_acquire_fences.get_or_insert_with(|| {
14516                    fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
14517                });
14518                fidl::decode!(
14519                    bool,
14520                    fidl::encoding::DefaultFuchsiaResourceDialect,
14521                    val_ref,
14522                    decoder,
14523                    inner_offset,
14524                    inner_depth
14525                )?;
14526                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
14527                {
14528                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
14529                }
14530                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
14531                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
14532                }
14533            }
14534
14535            next_offset += envelope_size;
14536            _next_ordinal_to_read += 1;
14537            if next_offset >= end_offset {
14538                return Ok(());
14539            }
14540
14541            // Decode unknown envelopes for gaps in ordinals.
14542            while _next_ordinal_to_read < 3 {
14543                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
14544                _next_ordinal_to_read += 1;
14545                next_offset += envelope_size;
14546            }
14547
14548            let next_out_of_line = decoder.next_out_of_line();
14549            let handles_before = decoder.remaining_handles();
14550            if let Some((inlined, num_bytes, num_handles)) =
14551                fidl::encoding::decode_envelope_header(decoder, next_offset)?
14552            {
14553                let member_inline_size =
14554                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
14555                if inlined != (member_inline_size <= 4) {
14556                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
14557                }
14558                let inner_offset;
14559                let mut inner_depth = depth.clone();
14560                if inlined {
14561                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
14562                    inner_offset = next_offset;
14563                } else {
14564                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
14565                    inner_depth.increment()?;
14566                }
14567                let val_ref = self.skips_present_credits.get_or_insert_with(|| {
14568                    fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
14569                });
14570                fidl::decode!(
14571                    bool,
14572                    fidl::encoding::DefaultFuchsiaResourceDialect,
14573                    val_ref,
14574                    decoder,
14575                    inner_offset,
14576                    inner_depth
14577                )?;
14578                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
14579                {
14580                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
14581                }
14582                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
14583                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
14584                }
14585            }
14586
14587            next_offset += envelope_size;
14588            _next_ordinal_to_read += 1;
14589            if next_offset >= end_offset {
14590                return Ok(());
14591            }
14592
14593            // Decode unknown envelopes for gaps in ordinals.
14594            while _next_ordinal_to_read < 4 {
14595                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
14596                _next_ordinal_to_read += 1;
14597                next_offset += envelope_size;
14598            }
14599
14600            let next_out_of_line = decoder.next_out_of_line();
14601            let handles_before = decoder.remaining_handles();
14602            if let Some((inlined, num_bytes, num_handles)) =
14603                fidl::encoding::decode_envelope_header(decoder, next_offset)?
14604            {
14605                let member_inline_size =
14606                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
14607                if inlined != (member_inline_size <= 4) {
14608                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
14609                }
14610                let inner_offset;
14611                let mut inner_depth = depth.clone();
14612                if inlined {
14613                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
14614                    inner_offset = next_offset;
14615                } else {
14616                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
14617                    inner_depth.increment()?;
14618                }
14619                let val_ref = self.skips_on_frame_presented.get_or_insert_with(|| {
14620                    fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
14621                });
14622                fidl::decode!(
14623                    bool,
14624                    fidl::encoding::DefaultFuchsiaResourceDialect,
14625                    val_ref,
14626                    decoder,
14627                    inner_offset,
14628                    inner_depth
14629                )?;
14630                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
14631                {
14632                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
14633                }
14634                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
14635                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
14636                }
14637            }
14638
14639            next_offset += envelope_size;
14640
14641            // Decode the remaining unknown envelopes.
14642            while next_offset < end_offset {
14643                _next_ordinal_to_read += 1;
14644                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
14645                next_offset += envelope_size;
14646            }
14647
14648            Ok(())
14649        }
14650    }
14651
14652    impl ViewBoundProtocols {
14653        #[inline(always)]
14654        fn max_ordinal_present(&self) -> u64 {
14655            if let Some(_) = self.mouse_source {
14656                return 4;
14657            }
14658            if let Some(_) = self.touch_source {
14659                return 3;
14660            }
14661            if let Some(_) = self.view_focuser {
14662                return 2;
14663            }
14664            if let Some(_) = self.view_ref_focused {
14665                return 1;
14666            }
14667            0
14668        }
14669    }
14670
14671    impl fidl::encoding::ResourceTypeMarker for ViewBoundProtocols {
14672        type Borrowed<'a> = &'a mut Self;
14673        fn take_or_borrow<'a>(
14674            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
14675        ) -> Self::Borrowed<'a> {
14676            value
14677        }
14678    }
14679
14680    unsafe impl fidl::encoding::TypeMarker for ViewBoundProtocols {
14681        type Owned = Self;
14682
14683        #[inline(always)]
14684        fn inline_align(_context: fidl::encoding::Context) -> usize {
14685            8
14686        }
14687
14688        #[inline(always)]
14689        fn inline_size(_context: fidl::encoding::Context) -> usize {
14690            16
14691        }
14692    }
14693
14694    unsafe impl
14695        fidl::encoding::Encode<ViewBoundProtocols, fidl::encoding::DefaultFuchsiaResourceDialect>
14696        for &mut ViewBoundProtocols
14697    {
14698        unsafe fn encode(
14699            self,
14700            encoder: &mut fidl::encoding::Encoder<
14701                '_,
14702                fidl::encoding::DefaultFuchsiaResourceDialect,
14703            >,
14704            offset: usize,
14705            mut depth: fidl::encoding::Depth,
14706        ) -> fidl::Result<()> {
14707            encoder.debug_check_bounds::<ViewBoundProtocols>(offset);
14708            // Vector header
14709            let max_ordinal: u64 = self.max_ordinal_present();
14710            encoder.write_num(max_ordinal, offset);
14711            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
14712            // Calling encoder.out_of_line_offset(0) is not allowed.
14713            if max_ordinal == 0 {
14714                return Ok(());
14715            }
14716            depth.increment()?;
14717            let envelope_size = 8;
14718            let bytes_len = max_ordinal as usize * envelope_size;
14719            #[allow(unused_variables)]
14720            let offset = encoder.out_of_line_offset(bytes_len);
14721            let mut _prev_end_offset: usize = 0;
14722            if 1 > max_ordinal {
14723                return Ok(());
14724            }
14725
14726            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
14727            // are envelope_size bytes.
14728            let cur_offset: usize = (1 - 1) * envelope_size;
14729
14730            // Zero reserved fields.
14731            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
14732
14733            // Safety:
14734            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
14735            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
14736            //   envelope_size bytes, there is always sufficient room.
14737            fidl::encoding::encode_in_envelope_optional::<
14738                fidl::encoding::Endpoint<
14739                    fidl::endpoints::ServerEnd<fidl_fuchsia_ui_views::ViewRefFocusedMarker>,
14740                >,
14741                fidl::encoding::DefaultFuchsiaResourceDialect,
14742            >(
14743                self.view_ref_focused.as_mut().map(
14744                    <fidl::encoding::Endpoint<
14745                        fidl::endpoints::ServerEnd<fidl_fuchsia_ui_views::ViewRefFocusedMarker>,
14746                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
14747                ),
14748                encoder,
14749                offset + cur_offset,
14750                depth,
14751            )?;
14752
14753            _prev_end_offset = cur_offset + envelope_size;
14754            if 2 > max_ordinal {
14755                return Ok(());
14756            }
14757
14758            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
14759            // are envelope_size bytes.
14760            let cur_offset: usize = (2 - 1) * envelope_size;
14761
14762            // Zero reserved fields.
14763            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
14764
14765            // Safety:
14766            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
14767            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
14768            //   envelope_size bytes, there is always sufficient room.
14769            fidl::encoding::encode_in_envelope_optional::<
14770                fidl::encoding::Endpoint<
14771                    fidl::endpoints::ServerEnd<fidl_fuchsia_ui_views::FocuserMarker>,
14772                >,
14773                fidl::encoding::DefaultFuchsiaResourceDialect,
14774            >(
14775                self.view_focuser.as_mut().map(
14776                    <fidl::encoding::Endpoint<
14777                        fidl::endpoints::ServerEnd<fidl_fuchsia_ui_views::FocuserMarker>,
14778                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
14779                ),
14780                encoder,
14781                offset + cur_offset,
14782                depth,
14783            )?;
14784
14785            _prev_end_offset = cur_offset + envelope_size;
14786            if 3 > max_ordinal {
14787                return Ok(());
14788            }
14789
14790            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
14791            // are envelope_size bytes.
14792            let cur_offset: usize = (3 - 1) * envelope_size;
14793
14794            // Zero reserved fields.
14795            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
14796
14797            // Safety:
14798            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
14799            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
14800            //   envelope_size bytes, there is always sufficient room.
14801            fidl::encoding::encode_in_envelope_optional::<
14802                fidl::encoding::Endpoint<
14803                    fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::TouchSourceMarker>,
14804                >,
14805                fidl::encoding::DefaultFuchsiaResourceDialect,
14806            >(
14807                self.touch_source.as_mut().map(
14808                    <fidl::encoding::Endpoint<
14809                        fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::TouchSourceMarker>,
14810                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
14811                ),
14812                encoder,
14813                offset + cur_offset,
14814                depth,
14815            )?;
14816
14817            _prev_end_offset = cur_offset + envelope_size;
14818            if 4 > max_ordinal {
14819                return Ok(());
14820            }
14821
14822            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
14823            // are envelope_size bytes.
14824            let cur_offset: usize = (4 - 1) * envelope_size;
14825
14826            // Zero reserved fields.
14827            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
14828
14829            // Safety:
14830            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
14831            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
14832            //   envelope_size bytes, there is always sufficient room.
14833            fidl::encoding::encode_in_envelope_optional::<
14834                fidl::encoding::Endpoint<
14835                    fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::MouseSourceMarker>,
14836                >,
14837                fidl::encoding::DefaultFuchsiaResourceDialect,
14838            >(
14839                self.mouse_source.as_mut().map(
14840                    <fidl::encoding::Endpoint<
14841                        fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::MouseSourceMarker>,
14842                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
14843                ),
14844                encoder,
14845                offset + cur_offset,
14846                depth,
14847            )?;
14848
14849            _prev_end_offset = cur_offset + envelope_size;
14850
14851            Ok(())
14852        }
14853    }
14854
14855    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
14856        for ViewBoundProtocols
14857    {
14858        #[inline(always)]
14859        fn new_empty() -> Self {
14860            Self::default()
14861        }
14862
14863        unsafe fn decode(
14864            &mut self,
14865            decoder: &mut fidl::encoding::Decoder<
14866                '_,
14867                fidl::encoding::DefaultFuchsiaResourceDialect,
14868            >,
14869            offset: usize,
14870            mut depth: fidl::encoding::Depth,
14871        ) -> fidl::Result<()> {
14872            decoder.debug_check_bounds::<Self>(offset);
14873            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
14874                None => return Err(fidl::Error::NotNullable),
14875                Some(len) => len,
14876            };
14877            // Calling decoder.out_of_line_offset(0) is not allowed.
14878            if len == 0 {
14879                return Ok(());
14880            };
14881            depth.increment()?;
14882            let envelope_size = 8;
14883            let bytes_len = len * envelope_size;
14884            let offset = decoder.out_of_line_offset(bytes_len)?;
14885            // Decode the envelope for each type.
14886            let mut _next_ordinal_to_read = 0;
14887            let mut next_offset = offset;
14888            let end_offset = offset + bytes_len;
14889            _next_ordinal_to_read += 1;
14890            if next_offset >= end_offset {
14891                return Ok(());
14892            }
14893
14894            // Decode unknown envelopes for gaps in ordinals.
14895            while _next_ordinal_to_read < 1 {
14896                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
14897                _next_ordinal_to_read += 1;
14898                next_offset += envelope_size;
14899            }
14900
14901            let next_out_of_line = decoder.next_out_of_line();
14902            let handles_before = decoder.remaining_handles();
14903            if let Some((inlined, num_bytes, num_handles)) =
14904                fidl::encoding::decode_envelope_header(decoder, next_offset)?
14905            {
14906                let member_inline_size = <fidl::encoding::Endpoint<
14907                    fidl::endpoints::ServerEnd<fidl_fuchsia_ui_views::ViewRefFocusedMarker>,
14908                > as fidl::encoding::TypeMarker>::inline_size(
14909                    decoder.context
14910                );
14911                if inlined != (member_inline_size <= 4) {
14912                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
14913                }
14914                let inner_offset;
14915                let mut inner_depth = depth.clone();
14916                if inlined {
14917                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
14918                    inner_offset = next_offset;
14919                } else {
14920                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
14921                    inner_depth.increment()?;
14922                }
14923                let val_ref = self.view_ref_focused.get_or_insert_with(|| {
14924                    fidl::new_empty!(
14925                        fidl::encoding::Endpoint<
14926                            fidl::endpoints::ServerEnd<fidl_fuchsia_ui_views::ViewRefFocusedMarker>,
14927                        >,
14928                        fidl::encoding::DefaultFuchsiaResourceDialect
14929                    )
14930                });
14931                fidl::decode!(
14932                    fidl::encoding::Endpoint<
14933                        fidl::endpoints::ServerEnd<fidl_fuchsia_ui_views::ViewRefFocusedMarker>,
14934                    >,
14935                    fidl::encoding::DefaultFuchsiaResourceDialect,
14936                    val_ref,
14937                    decoder,
14938                    inner_offset,
14939                    inner_depth
14940                )?;
14941                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
14942                {
14943                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
14944                }
14945                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
14946                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
14947                }
14948            }
14949
14950            next_offset += envelope_size;
14951            _next_ordinal_to_read += 1;
14952            if next_offset >= end_offset {
14953                return Ok(());
14954            }
14955
14956            // Decode unknown envelopes for gaps in ordinals.
14957            while _next_ordinal_to_read < 2 {
14958                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
14959                _next_ordinal_to_read += 1;
14960                next_offset += envelope_size;
14961            }
14962
14963            let next_out_of_line = decoder.next_out_of_line();
14964            let handles_before = decoder.remaining_handles();
14965            if let Some((inlined, num_bytes, num_handles)) =
14966                fidl::encoding::decode_envelope_header(decoder, next_offset)?
14967            {
14968                let member_inline_size = <fidl::encoding::Endpoint<
14969                    fidl::endpoints::ServerEnd<fidl_fuchsia_ui_views::FocuserMarker>,
14970                > as fidl::encoding::TypeMarker>::inline_size(
14971                    decoder.context
14972                );
14973                if inlined != (member_inline_size <= 4) {
14974                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
14975                }
14976                let inner_offset;
14977                let mut inner_depth = depth.clone();
14978                if inlined {
14979                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
14980                    inner_offset = next_offset;
14981                } else {
14982                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
14983                    inner_depth.increment()?;
14984                }
14985                let val_ref = self.view_focuser.get_or_insert_with(|| {
14986                    fidl::new_empty!(
14987                        fidl::encoding::Endpoint<
14988                            fidl::endpoints::ServerEnd<fidl_fuchsia_ui_views::FocuserMarker>,
14989                        >,
14990                        fidl::encoding::DefaultFuchsiaResourceDialect
14991                    )
14992                });
14993                fidl::decode!(
14994                    fidl::encoding::Endpoint<
14995                        fidl::endpoints::ServerEnd<fidl_fuchsia_ui_views::FocuserMarker>,
14996                    >,
14997                    fidl::encoding::DefaultFuchsiaResourceDialect,
14998                    val_ref,
14999                    decoder,
15000                    inner_offset,
15001                    inner_depth
15002                )?;
15003                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
15004                {
15005                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
15006                }
15007                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
15008                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
15009                }
15010            }
15011
15012            next_offset += envelope_size;
15013            _next_ordinal_to_read += 1;
15014            if next_offset >= end_offset {
15015                return Ok(());
15016            }
15017
15018            // Decode unknown envelopes for gaps in ordinals.
15019            while _next_ordinal_to_read < 3 {
15020                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
15021                _next_ordinal_to_read += 1;
15022                next_offset += envelope_size;
15023            }
15024
15025            let next_out_of_line = decoder.next_out_of_line();
15026            let handles_before = decoder.remaining_handles();
15027            if let Some((inlined, num_bytes, num_handles)) =
15028                fidl::encoding::decode_envelope_header(decoder, next_offset)?
15029            {
15030                let member_inline_size = <fidl::encoding::Endpoint<
15031                    fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::TouchSourceMarker>,
15032                > as fidl::encoding::TypeMarker>::inline_size(
15033                    decoder.context
15034                );
15035                if inlined != (member_inline_size <= 4) {
15036                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
15037                }
15038                let inner_offset;
15039                let mut inner_depth = depth.clone();
15040                if inlined {
15041                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
15042                    inner_offset = next_offset;
15043                } else {
15044                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
15045                    inner_depth.increment()?;
15046                }
15047                let val_ref = self.touch_source.get_or_insert_with(|| {
15048                    fidl::new_empty!(
15049                        fidl::encoding::Endpoint<
15050                            fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::TouchSourceMarker>,
15051                        >,
15052                        fidl::encoding::DefaultFuchsiaResourceDialect
15053                    )
15054                });
15055                fidl::decode!(
15056                    fidl::encoding::Endpoint<
15057                        fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::TouchSourceMarker>,
15058                    >,
15059                    fidl::encoding::DefaultFuchsiaResourceDialect,
15060                    val_ref,
15061                    decoder,
15062                    inner_offset,
15063                    inner_depth
15064                )?;
15065                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
15066                {
15067                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
15068                }
15069                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
15070                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
15071                }
15072            }
15073
15074            next_offset += envelope_size;
15075            _next_ordinal_to_read += 1;
15076            if next_offset >= end_offset {
15077                return Ok(());
15078            }
15079
15080            // Decode unknown envelopes for gaps in ordinals.
15081            while _next_ordinal_to_read < 4 {
15082                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
15083                _next_ordinal_to_read += 1;
15084                next_offset += envelope_size;
15085            }
15086
15087            let next_out_of_line = decoder.next_out_of_line();
15088            let handles_before = decoder.remaining_handles();
15089            if let Some((inlined, num_bytes, num_handles)) =
15090                fidl::encoding::decode_envelope_header(decoder, next_offset)?
15091            {
15092                let member_inline_size = <fidl::encoding::Endpoint<
15093                    fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::MouseSourceMarker>,
15094                > as fidl::encoding::TypeMarker>::inline_size(
15095                    decoder.context
15096                );
15097                if inlined != (member_inline_size <= 4) {
15098                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
15099                }
15100                let inner_offset;
15101                let mut inner_depth = depth.clone();
15102                if inlined {
15103                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
15104                    inner_offset = next_offset;
15105                } else {
15106                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
15107                    inner_depth.increment()?;
15108                }
15109                let val_ref = self.mouse_source.get_or_insert_with(|| {
15110                    fidl::new_empty!(
15111                        fidl::encoding::Endpoint<
15112                            fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::MouseSourceMarker>,
15113                        >,
15114                        fidl::encoding::DefaultFuchsiaResourceDialect
15115                    )
15116                });
15117                fidl::decode!(
15118                    fidl::encoding::Endpoint<
15119                        fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::MouseSourceMarker>,
15120                    >,
15121                    fidl::encoding::DefaultFuchsiaResourceDialect,
15122                    val_ref,
15123                    decoder,
15124                    inner_offset,
15125                    inner_depth
15126                )?;
15127                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
15128                {
15129                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
15130                }
15131                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
15132                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
15133                }
15134            }
15135
15136            next_offset += envelope_size;
15137
15138            // Decode the remaining unknown envelopes.
15139            while next_offset < end_offset {
15140                _next_ordinal_to_read += 1;
15141                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
15142                next_offset += envelope_size;
15143            }
15144
15145            Ok(())
15146        }
15147    }
15148}