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 fidl::endpoints::ControlHandle for AllocatorControlHandle {
882    fn shutdown(&self) {
883        self.inner.shutdown()
884    }
885
886    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
887        self.inner.shutdown_with_epitaph(status)
888    }
889
890    fn is_closed(&self) -> bool {
891        self.inner.channel().is_closed()
892    }
893    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
894        self.inner.channel().on_closed()
895    }
896
897    #[cfg(target_os = "fuchsia")]
898    fn signal_peer(
899        &self,
900        clear_mask: zx::Signals,
901        set_mask: zx::Signals,
902    ) -> Result<(), zx_status::Status> {
903        use fidl::Peered;
904        self.inner.channel().signal_peer(clear_mask, set_mask)
905    }
906}
907
908impl AllocatorControlHandle {}
909
910#[must_use = "FIDL methods require a response to be sent"]
911#[derive(Debug)]
912pub struct AllocatorRegisterBufferCollectionResponder {
913    control_handle: std::mem::ManuallyDrop<AllocatorControlHandle>,
914    tx_id: u32,
915}
916
917/// Set the the channel to be shutdown (see [`AllocatorControlHandle::shutdown`])
918/// if the responder is dropped without sending a response, so that the client
919/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
920impl std::ops::Drop for AllocatorRegisterBufferCollectionResponder {
921    fn drop(&mut self) {
922        self.control_handle.shutdown();
923        // Safety: drops once, never accessed again
924        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
925    }
926}
927
928impl fidl::endpoints::Responder for AllocatorRegisterBufferCollectionResponder {
929    type ControlHandle = AllocatorControlHandle;
930
931    fn control_handle(&self) -> &AllocatorControlHandle {
932        &self.control_handle
933    }
934
935    fn drop_without_shutdown(mut self) {
936        // Safety: drops once, never accessed again due to mem::forget
937        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
938        // Prevent Drop from running (which would shut down the channel)
939        std::mem::forget(self);
940    }
941}
942
943impl AllocatorRegisterBufferCollectionResponder {
944    /// Sends a response to the FIDL transaction.
945    ///
946    /// Sets the channel to shutdown if an error occurs.
947    pub fn send(
948        self,
949        mut result: Result<(), RegisterBufferCollectionError>,
950    ) -> Result<(), fidl::Error> {
951        let _result = self.send_raw(result);
952        if _result.is_err() {
953            self.control_handle.shutdown();
954        }
955        self.drop_without_shutdown();
956        _result
957    }
958
959    /// Similar to "send" but does not shutdown the channel if an error occurs.
960    pub fn send_no_shutdown_on_err(
961        self,
962        mut result: Result<(), RegisterBufferCollectionError>,
963    ) -> Result<(), fidl::Error> {
964        let _result = self.send_raw(result);
965        self.drop_without_shutdown();
966        _result
967    }
968
969    fn send_raw(
970        &self,
971        mut result: Result<(), RegisterBufferCollectionError>,
972    ) -> Result<(), fidl::Error> {
973        self.control_handle.inner.send::<fidl::encoding::ResultType<
974            fidl::encoding::EmptyStruct,
975            RegisterBufferCollectionError,
976        >>(
977            result,
978            self.tx_id,
979            0x494b7ea578d1061e,
980            fidl::encoding::DynamicFlags::empty(),
981        )
982    }
983}
984
985#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
986pub struct ChildViewWatcherMarker;
987
988impl fidl::endpoints::ProtocolMarker for ChildViewWatcherMarker {
989    type Proxy = ChildViewWatcherProxy;
990    type RequestStream = ChildViewWatcherRequestStream;
991    #[cfg(target_os = "fuchsia")]
992    type SynchronousProxy = ChildViewWatcherSynchronousProxy;
993
994    const DEBUG_NAME: &'static str = "(anonymous) ChildViewWatcher";
995}
996
997pub trait ChildViewWatcherProxyInterface: Send + Sync {
998    type GetStatusResponseFut: std::future::Future<Output = Result<ChildViewStatus, fidl::Error>>
999        + Send;
1000    fn r#get_status(&self) -> Self::GetStatusResponseFut;
1001    type GetViewRefResponseFut: std::future::Future<Output = Result<fidl_fuchsia_ui_views::ViewRef, fidl::Error>>
1002        + Send;
1003    fn r#get_view_ref(&self) -> Self::GetViewRefResponseFut;
1004}
1005#[derive(Debug)]
1006#[cfg(target_os = "fuchsia")]
1007pub struct ChildViewWatcherSynchronousProxy {
1008    client: fidl::client::sync::Client,
1009}
1010
1011#[cfg(target_os = "fuchsia")]
1012impl fidl::endpoints::SynchronousProxy for ChildViewWatcherSynchronousProxy {
1013    type Proxy = ChildViewWatcherProxy;
1014    type Protocol = ChildViewWatcherMarker;
1015
1016    fn from_channel(inner: fidl::Channel) -> Self {
1017        Self::new(inner)
1018    }
1019
1020    fn into_channel(self) -> fidl::Channel {
1021        self.client.into_channel()
1022    }
1023
1024    fn as_channel(&self) -> &fidl::Channel {
1025        self.client.as_channel()
1026    }
1027}
1028
1029#[cfg(target_os = "fuchsia")]
1030impl ChildViewWatcherSynchronousProxy {
1031    pub fn new(channel: fidl::Channel) -> Self {
1032        Self { client: fidl::client::sync::Client::new(channel) }
1033    }
1034
1035    pub fn into_channel(self) -> fidl::Channel {
1036        self.client.into_channel()
1037    }
1038
1039    /// Waits until an event arrives and returns it. It is safe for other
1040    /// threads to make concurrent requests while waiting for an event.
1041    pub fn wait_for_event(
1042        &self,
1043        deadline: zx::MonotonicInstant,
1044    ) -> Result<ChildViewWatcherEvent, fidl::Error> {
1045        ChildViewWatcherEvent::decode(
1046            self.client.wait_for_event::<ChildViewWatcherMarker>(deadline)?,
1047        )
1048    }
1049
1050    /// A hanging get for receiving the status of a View. This provides information to the parent,
1051    /// such as whether or not the child has successfully presented content through this View.
1052    ///
1053    /// This hanging get will only fire when the ChildViewStatus is different than the previously
1054    /// returned ChildViewStatus.  This can happen immediately, and even if the creator of the
1055    /// Viewport hasn't yet called Present() after calling CreateViewport().  This allows the parent
1056    /// to know that the child has content ready to display before the parent modifies their own
1057    /// local scene graph to incorporate the child content.
1058    ///
1059    /// It is invalid to call `GetStatus` while a previous call is still pending. Doing so will
1060    /// cause both this channel and the Flatland channel that handed out ChildViewWatcher to be
1061    /// closed.
1062    pub fn r#get_status(
1063        &self,
1064        ___deadline: zx::MonotonicInstant,
1065    ) -> Result<ChildViewStatus, fidl::Error> {
1066        let _response = self.client.send_query::<
1067            fidl::encoding::EmptyPayload,
1068            ChildViewWatcherGetStatusResponse,
1069            ChildViewWatcherMarker,
1070        >(
1071            (),
1072            0x1d622075f4fc8243,
1073            fidl::encoding::DynamicFlags::empty(),
1074            ___deadline,
1075        )?;
1076        Ok(_response.status)
1077    }
1078
1079    /// Hanging get to receive the ViewRef of the child View. This will only fire when the View ref
1080    /// is different from the previously-returned View ref. Note: currently the View ref will not
1081    /// change after it is first received, but this will change if/when the API changes to allow
1082    /// relinking of views.
1083    ///
1084    /// The ViewRef is not returned until the View is included in the View tree, in other words when
1085    /// there is a chain of ancestor transforms all the way back up to the root of the scene graph,
1086    /// i.e. the display.
1087    ///
1088    /// It is invalid to call `GetViewRef` while a previous call is still pending. Doing so will
1089    /// cause both this channel and the Flatland channel that handed out ChildViewWatcher to be
1090    /// closed.
1091    ///
1092    /// A `GetViewRef` call will hang if the View was created using `CreateView`, but returns the
1093    /// View if the View was created using CreateView2. This is because `CreateView` does not mint
1094    /// a ViewRef for that View.
1095    pub fn r#get_view_ref(
1096        &self,
1097        ___deadline: zx::MonotonicInstant,
1098    ) -> Result<fidl_fuchsia_ui_views::ViewRef, fidl::Error> {
1099        let _response = self.client.send_query::<
1100            fidl::encoding::EmptyPayload,
1101            ChildViewWatcherGetViewRefResponse,
1102            ChildViewWatcherMarker,
1103        >(
1104            (),
1105            0x3b2f3ca31e8908b4,
1106            fidl::encoding::DynamicFlags::empty(),
1107            ___deadline,
1108        )?;
1109        Ok(_response.view_ref)
1110    }
1111}
1112
1113#[cfg(target_os = "fuchsia")]
1114impl From<ChildViewWatcherSynchronousProxy> for zx::NullableHandle {
1115    fn from(value: ChildViewWatcherSynchronousProxy) -> Self {
1116        value.into_channel().into()
1117    }
1118}
1119
1120#[cfg(target_os = "fuchsia")]
1121impl From<fidl::Channel> for ChildViewWatcherSynchronousProxy {
1122    fn from(value: fidl::Channel) -> Self {
1123        Self::new(value)
1124    }
1125}
1126
1127#[cfg(target_os = "fuchsia")]
1128impl fidl::endpoints::FromClient for ChildViewWatcherSynchronousProxy {
1129    type Protocol = ChildViewWatcherMarker;
1130
1131    fn from_client(value: fidl::endpoints::ClientEnd<ChildViewWatcherMarker>) -> Self {
1132        Self::new(value.into_channel())
1133    }
1134}
1135
1136#[derive(Debug, Clone)]
1137pub struct ChildViewWatcherProxy {
1138    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1139}
1140
1141impl fidl::endpoints::Proxy for ChildViewWatcherProxy {
1142    type Protocol = ChildViewWatcherMarker;
1143
1144    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1145        Self::new(inner)
1146    }
1147
1148    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1149        self.client.into_channel().map_err(|client| Self { client })
1150    }
1151
1152    fn as_channel(&self) -> &::fidl::AsyncChannel {
1153        self.client.as_channel()
1154    }
1155}
1156
1157impl ChildViewWatcherProxy {
1158    /// Create a new Proxy for fuchsia.ui.composition/ChildViewWatcher.
1159    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1160        let protocol_name = <ChildViewWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1161        Self { client: fidl::client::Client::new(channel, protocol_name) }
1162    }
1163
1164    /// Get a Stream of events from the remote end of the protocol.
1165    ///
1166    /// # Panics
1167    ///
1168    /// Panics if the event stream was already taken.
1169    pub fn take_event_stream(&self) -> ChildViewWatcherEventStream {
1170        ChildViewWatcherEventStream { event_receiver: self.client.take_event_receiver() }
1171    }
1172
1173    /// A hanging get for receiving the status of a View. This provides information to the parent,
1174    /// such as whether or not the child has successfully presented content through this View.
1175    ///
1176    /// This hanging get will only fire when the ChildViewStatus is different than the previously
1177    /// returned ChildViewStatus.  This can happen immediately, and even if the creator of the
1178    /// Viewport hasn't yet called Present() after calling CreateViewport().  This allows the parent
1179    /// to know that the child has content ready to display before the parent modifies their own
1180    /// local scene graph to incorporate the child content.
1181    ///
1182    /// It is invalid to call `GetStatus` while a previous call is still pending. Doing so will
1183    /// cause both this channel and the Flatland channel that handed out ChildViewWatcher to be
1184    /// closed.
1185    pub fn r#get_status(
1186        &self,
1187    ) -> fidl::client::QueryResponseFut<
1188        ChildViewStatus,
1189        fidl::encoding::DefaultFuchsiaResourceDialect,
1190    > {
1191        ChildViewWatcherProxyInterface::r#get_status(self)
1192    }
1193
1194    /// Hanging get to receive the ViewRef of the child View. This will only fire when the View ref
1195    /// is different from the previously-returned View ref. Note: currently the View ref will not
1196    /// change after it is first received, but this will change if/when the API changes to allow
1197    /// relinking of views.
1198    ///
1199    /// The ViewRef is not returned until the View is included in the View tree, in other words when
1200    /// there is a chain of ancestor transforms all the way back up to the root of the scene graph,
1201    /// i.e. the display.
1202    ///
1203    /// It is invalid to call `GetViewRef` while a previous call is still pending. Doing so will
1204    /// cause both this channel and the Flatland channel that handed out ChildViewWatcher to be
1205    /// closed.
1206    ///
1207    /// A `GetViewRef` call will hang if the View was created using `CreateView`, but returns the
1208    /// View if the View was created using CreateView2. This is because `CreateView` does not mint
1209    /// a ViewRef for that View.
1210    pub fn r#get_view_ref(
1211        &self,
1212    ) -> fidl::client::QueryResponseFut<
1213        fidl_fuchsia_ui_views::ViewRef,
1214        fidl::encoding::DefaultFuchsiaResourceDialect,
1215    > {
1216        ChildViewWatcherProxyInterface::r#get_view_ref(self)
1217    }
1218}
1219
1220impl ChildViewWatcherProxyInterface for ChildViewWatcherProxy {
1221    type GetStatusResponseFut = fidl::client::QueryResponseFut<
1222        ChildViewStatus,
1223        fidl::encoding::DefaultFuchsiaResourceDialect,
1224    >;
1225    fn r#get_status(&self) -> Self::GetStatusResponseFut {
1226        fn _decode(
1227            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1228        ) -> Result<ChildViewStatus, fidl::Error> {
1229            let _response = fidl::client::decode_transaction_body::<
1230                ChildViewWatcherGetStatusResponse,
1231                fidl::encoding::DefaultFuchsiaResourceDialect,
1232                0x1d622075f4fc8243,
1233            >(_buf?)?;
1234            Ok(_response.status)
1235        }
1236        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ChildViewStatus>(
1237            (),
1238            0x1d622075f4fc8243,
1239            fidl::encoding::DynamicFlags::empty(),
1240            _decode,
1241        )
1242    }
1243
1244    type GetViewRefResponseFut = fidl::client::QueryResponseFut<
1245        fidl_fuchsia_ui_views::ViewRef,
1246        fidl::encoding::DefaultFuchsiaResourceDialect,
1247    >;
1248    fn r#get_view_ref(&self) -> Self::GetViewRefResponseFut {
1249        fn _decode(
1250            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1251        ) -> Result<fidl_fuchsia_ui_views::ViewRef, fidl::Error> {
1252            let _response = fidl::client::decode_transaction_body::<
1253                ChildViewWatcherGetViewRefResponse,
1254                fidl::encoding::DefaultFuchsiaResourceDialect,
1255                0x3b2f3ca31e8908b4,
1256            >(_buf?)?;
1257            Ok(_response.view_ref)
1258        }
1259        self.client
1260            .send_query_and_decode::<fidl::encoding::EmptyPayload, fidl_fuchsia_ui_views::ViewRef>(
1261                (),
1262                0x3b2f3ca31e8908b4,
1263                fidl::encoding::DynamicFlags::empty(),
1264                _decode,
1265            )
1266    }
1267}
1268
1269pub struct ChildViewWatcherEventStream {
1270    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1271}
1272
1273impl std::marker::Unpin for ChildViewWatcherEventStream {}
1274
1275impl futures::stream::FusedStream for ChildViewWatcherEventStream {
1276    fn is_terminated(&self) -> bool {
1277        self.event_receiver.is_terminated()
1278    }
1279}
1280
1281impl futures::Stream for ChildViewWatcherEventStream {
1282    type Item = Result<ChildViewWatcherEvent, fidl::Error>;
1283
1284    fn poll_next(
1285        mut self: std::pin::Pin<&mut Self>,
1286        cx: &mut std::task::Context<'_>,
1287    ) -> std::task::Poll<Option<Self::Item>> {
1288        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1289            &mut self.event_receiver,
1290            cx
1291        )?) {
1292            Some(buf) => std::task::Poll::Ready(Some(ChildViewWatcherEvent::decode(buf))),
1293            None => std::task::Poll::Ready(None),
1294        }
1295    }
1296}
1297
1298#[derive(Debug)]
1299pub enum ChildViewWatcherEvent {}
1300
1301impl ChildViewWatcherEvent {
1302    /// Decodes a message buffer as a [`ChildViewWatcherEvent`].
1303    fn decode(
1304        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1305    ) -> Result<ChildViewWatcherEvent, fidl::Error> {
1306        let (bytes, _handles) = buf.split_mut();
1307        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1308        debug_assert_eq!(tx_header.tx_id, 0);
1309        match tx_header.ordinal {
1310            _ => Err(fidl::Error::UnknownOrdinal {
1311                ordinal: tx_header.ordinal,
1312                protocol_name:
1313                    <ChildViewWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1314            }),
1315        }
1316    }
1317}
1318
1319/// A Stream of incoming requests for fuchsia.ui.composition/ChildViewWatcher.
1320pub struct ChildViewWatcherRequestStream {
1321    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1322    is_terminated: bool,
1323}
1324
1325impl std::marker::Unpin for ChildViewWatcherRequestStream {}
1326
1327impl futures::stream::FusedStream for ChildViewWatcherRequestStream {
1328    fn is_terminated(&self) -> bool {
1329        self.is_terminated
1330    }
1331}
1332
1333impl fidl::endpoints::RequestStream for ChildViewWatcherRequestStream {
1334    type Protocol = ChildViewWatcherMarker;
1335    type ControlHandle = ChildViewWatcherControlHandle;
1336
1337    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1338        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1339    }
1340
1341    fn control_handle(&self) -> Self::ControlHandle {
1342        ChildViewWatcherControlHandle { inner: self.inner.clone() }
1343    }
1344
1345    fn into_inner(
1346        self,
1347    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1348    {
1349        (self.inner, self.is_terminated)
1350    }
1351
1352    fn from_inner(
1353        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1354        is_terminated: bool,
1355    ) -> Self {
1356        Self { inner, is_terminated }
1357    }
1358}
1359
1360impl futures::Stream for ChildViewWatcherRequestStream {
1361    type Item = Result<ChildViewWatcherRequest, fidl::Error>;
1362
1363    fn poll_next(
1364        mut self: std::pin::Pin<&mut Self>,
1365        cx: &mut std::task::Context<'_>,
1366    ) -> std::task::Poll<Option<Self::Item>> {
1367        let this = &mut *self;
1368        if this.inner.check_shutdown(cx) {
1369            this.is_terminated = true;
1370            return std::task::Poll::Ready(None);
1371        }
1372        if this.is_terminated {
1373            panic!("polled ChildViewWatcherRequestStream after completion");
1374        }
1375        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1376            |bytes, handles| {
1377                match this.inner.channel().read_etc(cx, bytes, handles) {
1378                    std::task::Poll::Ready(Ok(())) => {}
1379                    std::task::Poll::Pending => return std::task::Poll::Pending,
1380                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1381                        this.is_terminated = true;
1382                        return std::task::Poll::Ready(None);
1383                    }
1384                    std::task::Poll::Ready(Err(e)) => {
1385                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1386                            e.into(),
1387                        ))));
1388                    }
1389                }
1390
1391                // A message has been received from the channel
1392                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1393
1394                std::task::Poll::Ready(Some(match header.ordinal {
1395                    0x1d622075f4fc8243 => {
1396                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1397                        let mut req = fidl::new_empty!(
1398                            fidl::encoding::EmptyPayload,
1399                            fidl::encoding::DefaultFuchsiaResourceDialect
1400                        );
1401                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1402                        let control_handle =
1403                            ChildViewWatcherControlHandle { inner: this.inner.clone() };
1404                        Ok(ChildViewWatcherRequest::GetStatus {
1405                            responder: ChildViewWatcherGetStatusResponder {
1406                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1407                                tx_id: header.tx_id,
1408                            },
1409                        })
1410                    }
1411                    0x3b2f3ca31e8908b4 => {
1412                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1413                        let mut req = fidl::new_empty!(
1414                            fidl::encoding::EmptyPayload,
1415                            fidl::encoding::DefaultFuchsiaResourceDialect
1416                        );
1417                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1418                        let control_handle =
1419                            ChildViewWatcherControlHandle { inner: this.inner.clone() };
1420                        Ok(ChildViewWatcherRequest::GetViewRef {
1421                            responder: ChildViewWatcherGetViewRefResponder {
1422                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1423                                tx_id: header.tx_id,
1424                            },
1425                        })
1426                    }
1427                    _ => Err(fidl::Error::UnknownOrdinal {
1428                        ordinal: header.ordinal,
1429                        protocol_name:
1430                            <ChildViewWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1431                    }),
1432                }))
1433            },
1434        )
1435    }
1436}
1437
1438/// A protocol that provides information about a particular child View which is attached to the
1439/// Viewport owned by the parent client; connections to this protocol are estabished in
1440/// [`CreateViewport`].  Since a Flatland instance may contain any number of Viewports, each of
1441/// which may or may not be attached to a transform, the client can maintain connections to an
1442/// equal number of ChildViewWatcher instances.
1443///
1444/// Each ChildViewWatcher instance will remain connected as long as the corresponding child View
1445/// exists; the connection will also be closed if the child's ViewCreationToken is dropped without
1446/// using it to create a View.
1447#[derive(Debug)]
1448pub enum ChildViewWatcherRequest {
1449    /// A hanging get for receiving the status of a View. This provides information to the parent,
1450    /// such as whether or not the child has successfully presented content through this View.
1451    ///
1452    /// This hanging get will only fire when the ChildViewStatus is different than the previously
1453    /// returned ChildViewStatus.  This can happen immediately, and even if the creator of the
1454    /// Viewport hasn't yet called Present() after calling CreateViewport().  This allows the parent
1455    /// to know that the child has content ready to display before the parent modifies their own
1456    /// local scene graph to incorporate the child content.
1457    ///
1458    /// It is invalid to call `GetStatus` while a previous call is still pending. Doing so will
1459    /// cause both this channel and the Flatland channel that handed out ChildViewWatcher to be
1460    /// closed.
1461    GetStatus { responder: ChildViewWatcherGetStatusResponder },
1462    /// Hanging get to receive the ViewRef of the child View. This will only fire when the View ref
1463    /// is different from the previously-returned View ref. Note: currently the View ref will not
1464    /// change after it is first received, but this will change if/when the API changes to allow
1465    /// relinking of views.
1466    ///
1467    /// The ViewRef is not returned until the View is included in the View tree, in other words when
1468    /// there is a chain of ancestor transforms all the way back up to the root of the scene graph,
1469    /// i.e. the display.
1470    ///
1471    /// It is invalid to call `GetViewRef` while a previous call is still pending. Doing so will
1472    /// cause both this channel and the Flatland channel that handed out ChildViewWatcher to be
1473    /// closed.
1474    ///
1475    /// A `GetViewRef` call will hang if the View was created using `CreateView`, but returns the
1476    /// View if the View was created using CreateView2. This is because `CreateView` does not mint
1477    /// a ViewRef for that View.
1478    GetViewRef { responder: ChildViewWatcherGetViewRefResponder },
1479}
1480
1481impl ChildViewWatcherRequest {
1482    #[allow(irrefutable_let_patterns)]
1483    pub fn into_get_status(self) -> Option<(ChildViewWatcherGetStatusResponder)> {
1484        if let ChildViewWatcherRequest::GetStatus { responder } = self {
1485            Some((responder))
1486        } else {
1487            None
1488        }
1489    }
1490
1491    #[allow(irrefutable_let_patterns)]
1492    pub fn into_get_view_ref(self) -> Option<(ChildViewWatcherGetViewRefResponder)> {
1493        if let ChildViewWatcherRequest::GetViewRef { responder } = self {
1494            Some((responder))
1495        } else {
1496            None
1497        }
1498    }
1499
1500    /// Name of the method defined in FIDL
1501    pub fn method_name(&self) -> &'static str {
1502        match *self {
1503            ChildViewWatcherRequest::GetStatus { .. } => "get_status",
1504            ChildViewWatcherRequest::GetViewRef { .. } => "get_view_ref",
1505        }
1506    }
1507}
1508
1509#[derive(Debug, Clone)]
1510pub struct ChildViewWatcherControlHandle {
1511    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1512}
1513
1514impl fidl::endpoints::ControlHandle for ChildViewWatcherControlHandle {
1515    fn shutdown(&self) {
1516        self.inner.shutdown()
1517    }
1518
1519    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1520        self.inner.shutdown_with_epitaph(status)
1521    }
1522
1523    fn is_closed(&self) -> bool {
1524        self.inner.channel().is_closed()
1525    }
1526    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1527        self.inner.channel().on_closed()
1528    }
1529
1530    #[cfg(target_os = "fuchsia")]
1531    fn signal_peer(
1532        &self,
1533        clear_mask: zx::Signals,
1534        set_mask: zx::Signals,
1535    ) -> Result<(), zx_status::Status> {
1536        use fidl::Peered;
1537        self.inner.channel().signal_peer(clear_mask, set_mask)
1538    }
1539}
1540
1541impl ChildViewWatcherControlHandle {}
1542
1543#[must_use = "FIDL methods require a response to be sent"]
1544#[derive(Debug)]
1545pub struct ChildViewWatcherGetStatusResponder {
1546    control_handle: std::mem::ManuallyDrop<ChildViewWatcherControlHandle>,
1547    tx_id: u32,
1548}
1549
1550/// Set the the channel to be shutdown (see [`ChildViewWatcherControlHandle::shutdown`])
1551/// if the responder is dropped without sending a response, so that the client
1552/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1553impl std::ops::Drop for ChildViewWatcherGetStatusResponder {
1554    fn drop(&mut self) {
1555        self.control_handle.shutdown();
1556        // Safety: drops once, never accessed again
1557        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1558    }
1559}
1560
1561impl fidl::endpoints::Responder for ChildViewWatcherGetStatusResponder {
1562    type ControlHandle = ChildViewWatcherControlHandle;
1563
1564    fn control_handle(&self) -> &ChildViewWatcherControlHandle {
1565        &self.control_handle
1566    }
1567
1568    fn drop_without_shutdown(mut self) {
1569        // Safety: drops once, never accessed again due to mem::forget
1570        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1571        // Prevent Drop from running (which would shut down the channel)
1572        std::mem::forget(self);
1573    }
1574}
1575
1576impl ChildViewWatcherGetStatusResponder {
1577    /// Sends a response to the FIDL transaction.
1578    ///
1579    /// Sets the channel to shutdown if an error occurs.
1580    pub fn send(self, mut status: ChildViewStatus) -> Result<(), fidl::Error> {
1581        let _result = self.send_raw(status);
1582        if _result.is_err() {
1583            self.control_handle.shutdown();
1584        }
1585        self.drop_without_shutdown();
1586        _result
1587    }
1588
1589    /// Similar to "send" but does not shutdown the channel if an error occurs.
1590    pub fn send_no_shutdown_on_err(self, mut status: ChildViewStatus) -> Result<(), fidl::Error> {
1591        let _result = self.send_raw(status);
1592        self.drop_without_shutdown();
1593        _result
1594    }
1595
1596    fn send_raw(&self, mut status: ChildViewStatus) -> Result<(), fidl::Error> {
1597        self.control_handle.inner.send::<ChildViewWatcherGetStatusResponse>(
1598            (status,),
1599            self.tx_id,
1600            0x1d622075f4fc8243,
1601            fidl::encoding::DynamicFlags::empty(),
1602        )
1603    }
1604}
1605
1606#[must_use = "FIDL methods require a response to be sent"]
1607#[derive(Debug)]
1608pub struct ChildViewWatcherGetViewRefResponder {
1609    control_handle: std::mem::ManuallyDrop<ChildViewWatcherControlHandle>,
1610    tx_id: u32,
1611}
1612
1613/// Set the the channel to be shutdown (see [`ChildViewWatcherControlHandle::shutdown`])
1614/// if the responder is dropped without sending a response, so that the client
1615/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1616impl std::ops::Drop for ChildViewWatcherGetViewRefResponder {
1617    fn drop(&mut self) {
1618        self.control_handle.shutdown();
1619        // Safety: drops once, never accessed again
1620        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1621    }
1622}
1623
1624impl fidl::endpoints::Responder for ChildViewWatcherGetViewRefResponder {
1625    type ControlHandle = ChildViewWatcherControlHandle;
1626
1627    fn control_handle(&self) -> &ChildViewWatcherControlHandle {
1628        &self.control_handle
1629    }
1630
1631    fn drop_without_shutdown(mut self) {
1632        // Safety: drops once, never accessed again due to mem::forget
1633        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1634        // Prevent Drop from running (which would shut down the channel)
1635        std::mem::forget(self);
1636    }
1637}
1638
1639impl ChildViewWatcherGetViewRefResponder {
1640    /// Sends a response to the FIDL transaction.
1641    ///
1642    /// Sets the channel to shutdown if an error occurs.
1643    pub fn send(self, mut view_ref: fidl_fuchsia_ui_views::ViewRef) -> Result<(), fidl::Error> {
1644        let _result = self.send_raw(view_ref);
1645        if _result.is_err() {
1646            self.control_handle.shutdown();
1647        }
1648        self.drop_without_shutdown();
1649        _result
1650    }
1651
1652    /// Similar to "send" but does not shutdown the channel if an error occurs.
1653    pub fn send_no_shutdown_on_err(
1654        self,
1655        mut view_ref: fidl_fuchsia_ui_views::ViewRef,
1656    ) -> Result<(), fidl::Error> {
1657        let _result = self.send_raw(view_ref);
1658        self.drop_without_shutdown();
1659        _result
1660    }
1661
1662    fn send_raw(&self, mut view_ref: fidl_fuchsia_ui_views::ViewRef) -> Result<(), fidl::Error> {
1663        self.control_handle.inner.send::<ChildViewWatcherGetViewRefResponse>(
1664            (&mut view_ref,),
1665            self.tx_id,
1666            0x3b2f3ca31e8908b4,
1667            fidl::encoding::DynamicFlags::empty(),
1668        )
1669    }
1670}
1671
1672#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1673pub struct FlatlandMarker;
1674
1675impl fidl::endpoints::ProtocolMarker for FlatlandMarker {
1676    type Proxy = FlatlandProxy;
1677    type RequestStream = FlatlandRequestStream;
1678    #[cfg(target_os = "fuchsia")]
1679    type SynchronousProxy = FlatlandSynchronousProxy;
1680
1681    const DEBUG_NAME: &'static str = "fuchsia.ui.composition.Flatland";
1682}
1683impl fidl::endpoints::DiscoverableProtocolMarker for FlatlandMarker {}
1684
1685pub trait FlatlandProxyInterface: Send + Sync {
1686    fn r#release_image_immediately(&self, image_id: &ContentId) -> Result<(), fidl::Error>;
1687    fn r#present(&self, args: PresentArgs) -> Result<(), fidl::Error>;
1688    fn r#create_view(
1689        &self,
1690        token: fidl_fuchsia_ui_views::ViewCreationToken,
1691        parent_viewport_watcher: fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>,
1692    ) -> Result<(), fidl::Error>;
1693    fn r#create_view2(
1694        &self,
1695        token: fidl_fuchsia_ui_views::ViewCreationToken,
1696        view_identity: fidl_fuchsia_ui_views::ViewIdentityOnCreation,
1697        protocols: ViewBoundProtocols,
1698        parent_viewport_watcher: fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>,
1699    ) -> Result<(), fidl::Error>;
1700    fn r#create_transform(&self, transform_id: &TransformId) -> Result<(), fidl::Error>;
1701    fn r#set_translation(
1702        &self,
1703        transform_id: &TransformId,
1704        translation: &fidl_fuchsia_math::Vec_,
1705    ) -> Result<(), fidl::Error>;
1706    fn r#set_orientation(
1707        &self,
1708        transform_id: &TransformId,
1709        orientation: Orientation,
1710    ) -> Result<(), fidl::Error>;
1711    fn r#set_scale(
1712        &self,
1713        transform_id: &TransformId,
1714        scale: &fidl_fuchsia_math::VecF,
1715    ) -> Result<(), fidl::Error>;
1716    fn r#set_opacity(&self, transform_id: &TransformId, value: f32) -> Result<(), fidl::Error>;
1717    fn r#set_clip_boundary(
1718        &self,
1719        transform_id: &TransformId,
1720        rect: Option<&fidl_fuchsia_math::Rect>,
1721    ) -> Result<(), fidl::Error>;
1722    fn r#add_child(
1723        &self,
1724        parent_transform_id: &TransformId,
1725        child_transform_id: &TransformId,
1726    ) -> Result<(), fidl::Error>;
1727    fn r#remove_child(
1728        &self,
1729        parent_transform_id: &TransformId,
1730        child_transform_id: &TransformId,
1731    ) -> Result<(), fidl::Error>;
1732    fn r#replace_children(
1733        &self,
1734        parent_transform_id: &TransformId,
1735        new_child_transform_ids: &[TransformId],
1736    ) -> Result<(), fidl::Error>;
1737    fn r#set_root_transform(&self, transform_id: &TransformId) -> Result<(), fidl::Error>;
1738    fn r#set_hit_regions(
1739        &self,
1740        transform_id: &TransformId,
1741        regions: &[HitRegion],
1742    ) -> Result<(), fidl::Error>;
1743    fn r#set_infinite_hit_region(
1744        &self,
1745        transform_id: &TransformId,
1746        hit_test: HitTestInteraction,
1747    ) -> Result<(), fidl::Error>;
1748    fn r#create_viewport(
1749        &self,
1750        viewport_id: &ContentId,
1751        token: fidl_fuchsia_ui_views::ViewportCreationToken,
1752        properties: &ViewportProperties,
1753        child_view_watcher: fidl::endpoints::ServerEnd<ChildViewWatcherMarker>,
1754    ) -> Result<(), fidl::Error>;
1755    fn r#create_image(
1756        &self,
1757        image_id: &ContentId,
1758        import_token: BufferCollectionImportToken,
1759        vmo_index: u32,
1760        properties: &ImageProperties,
1761    ) -> Result<(), fidl::Error>;
1762    fn r#set_image_sample_region(
1763        &self,
1764        image_id: &ContentId,
1765        rect: &fidl_fuchsia_math::RectF,
1766    ) -> Result<(), fidl::Error>;
1767    fn r#set_image_destination_size(
1768        &self,
1769        image_id: &ContentId,
1770        size: &fidl_fuchsia_math::SizeU,
1771    ) -> Result<(), fidl::Error>;
1772    fn r#set_image_blending_function(
1773        &self,
1774        image_id: &ContentId,
1775        blend_mode: BlendMode,
1776    ) -> Result<(), fidl::Error>;
1777    fn r#set_image_blend_mode(
1778        &self,
1779        image_id: &ContentId,
1780        blend_mode: BlendMode2,
1781    ) -> Result<(), fidl::Error>;
1782    fn r#set_image_opacity(&self, image_id: &ContentId, val: f32) -> Result<(), fidl::Error>;
1783    fn r#set_image_flip(&self, image_id: &ContentId, flip: ImageFlip) -> Result<(), fidl::Error>;
1784    fn r#create_filled_rect(&self, rect_id: &ContentId) -> Result<(), fidl::Error>;
1785    fn r#set_solid_fill(
1786        &self,
1787        rect_id: &ContentId,
1788        color: &ColorRgba,
1789        size: &fidl_fuchsia_math::SizeU,
1790    ) -> Result<(), fidl::Error>;
1791    fn r#release_filled_rect(&self, rect_id: &ContentId) -> Result<(), fidl::Error>;
1792    fn r#set_content(
1793        &self,
1794        transform_id: &TransformId,
1795        content_id: &ContentId,
1796    ) -> Result<(), fidl::Error>;
1797    fn r#set_viewport_properties(
1798        &self,
1799        viewport_id: &ContentId,
1800        properties: &ViewportProperties,
1801    ) -> Result<(), fidl::Error>;
1802    fn r#release_transform(&self, transform_id: &TransformId) -> Result<(), fidl::Error>;
1803    fn r#release_view(&self) -> Result<(), fidl::Error>;
1804    type ReleaseViewportResponseFut: std::future::Future<
1805            Output = Result<fidl_fuchsia_ui_views::ViewportCreationToken, fidl::Error>,
1806        > + Send;
1807    fn r#release_viewport(&self, viewport_id: &ContentId) -> Self::ReleaseViewportResponseFut;
1808    fn r#release_image(&self, image_id: &ContentId) -> Result<(), fidl::Error>;
1809    fn r#clear(&self) -> Result<(), fidl::Error>;
1810    fn r#set_debug_name(&self, name: &str) -> Result<(), fidl::Error>;
1811}
1812#[derive(Debug)]
1813#[cfg(target_os = "fuchsia")]
1814pub struct FlatlandSynchronousProxy {
1815    client: fidl::client::sync::Client,
1816}
1817
1818#[cfg(target_os = "fuchsia")]
1819impl fidl::endpoints::SynchronousProxy for FlatlandSynchronousProxy {
1820    type Proxy = FlatlandProxy;
1821    type Protocol = FlatlandMarker;
1822
1823    fn from_channel(inner: fidl::Channel) -> Self {
1824        Self::new(inner)
1825    }
1826
1827    fn into_channel(self) -> fidl::Channel {
1828        self.client.into_channel()
1829    }
1830
1831    fn as_channel(&self) -> &fidl::Channel {
1832        self.client.as_channel()
1833    }
1834}
1835
1836#[cfg(target_os = "fuchsia")]
1837impl FlatlandSynchronousProxy {
1838    pub fn new(channel: fidl::Channel) -> Self {
1839        Self { client: fidl::client::sync::Client::new(channel) }
1840    }
1841
1842    pub fn into_channel(self) -> fidl::Channel {
1843        self.client.into_channel()
1844    }
1845
1846    /// Waits until an event arrives and returns it. It is safe for other
1847    /// threads to make concurrent requests while waiting for an event.
1848    pub fn wait_for_event(
1849        &self,
1850        deadline: zx::MonotonicInstant,
1851    ) -> Result<FlatlandEvent, fidl::Error> {
1852        FlatlandEvent::decode(self.client.wait_for_event::<FlatlandMarker>(deadline)?)
1853    }
1854
1855    /// Releases an image immediately, without waiting for the next present.
1856    pub fn r#release_image_immediately(&self, mut image_id: &ContentId) -> Result<(), fidl::Error> {
1857        self.client.send::<TrustedFlatlandReleaseImageImmediatelyRequest>(
1858            (image_id,),
1859            0x245e1ac080772c8,
1860            fidl::encoding::DynamicFlags::empty(),
1861        )
1862    }
1863
1864    /// Complete execution of all feed-forward operations.
1865    ///
1866    /// If executing an operation produces an error (e.g., CreateTransform(0)), an [`OnError`] event
1867    /// is emitted. Operations that produce errors are ignored and the channel is closed.
1868    ///
1869    /// If the execution is completed successfully, [`OnNextFrameBegin`] emits NO_ERROR along
1870    /// with other valid fields.
1871    ///
1872    /// The client may only call [`Present`] when they have a non-zero number of present credits,
1873    /// which are tracked by the server. The server may increment the number of credits when it
1874    /// fires the [`OnNextFrameBegin`] event, which informs the client when it receives additional
1875    /// present credits. Each [`Present`] call uses one present credit and decrements the server
1876    /// count by one. If the client calls [`Present`] with no present credits, the server will
1877    /// return a `NO_PRESENTS_REMAINING` error.
1878    ///
1879    /// The client should assume that prior to receiving any [`OnNextFrameBegin`] events, they have
1880    /// one present credit.
1881    ///
1882    /// Every [`Present`] call results in one [`OnNextFrameBegin`] event, and one
1883    /// [`OnFramePresented`] event, typically in that order.
1884    ///
1885    /// When the commands flushed by [`Present`] make it to display, an [`OnFramePresented`] event
1886    /// is fired. This event includes information pertaining to all [`Present`]s that had content
1887    /// that were part of that frame.
1888    ///
1889    /// See [`fuchsia.ui.composition/PresentArgs`] documentation above for more detailed information
1890    /// on what arguments are passed in and their role.
1891    pub fn r#present(&self, mut args: PresentArgs) -> Result<(), fidl::Error> {
1892        self.client.send::<FlatlandPresentRequest>(
1893            (&mut args,),
1894            0x50acc2aa1f0acec7,
1895            fidl::encoding::DynamicFlags::empty(),
1896        )
1897    }
1898
1899    /// Two Flatland instances may be connected in a parent-child relationship. The parent endpoint
1900    /// is held in a Viewport, and the child endpoint is held in a View. The parent Flatland
1901    /// instance that creates a Viewport has control over how the child's View is integrated into
1902    /// its own View.
1903    ///
1904    /// The lifecycle of a parent-child connection starts with two endpoints of a channel object:
1905    /// a ViewportCreationToken and a ViewCreationToken. Out-of-band protocols pass the
1906    /// ViewportCreationToken to the parent, which calls [`CreateViewport`], and the
1907    /// ViewCreationToken to the child, which calls [`CreateView`].
1908    ///
1909    /// Only nodes connected to the Root Transform in this Flatland instance will be rendered into
1910    /// the parent's Viewport.
1911    ///
1912    /// Calling [`CreateView`] a second time will disconnect the Root Transform from the existing
1913    /// parent's Viewport, and attach it to a new parent's Viewport. In other words, each View can
1914    /// only have one parent.
1915    ///
1916    /// This function is queued, meaning that the Root Transform will not be attached to the
1917    /// parent Viewport until [`Present`] is called. However, clients will receive information
1918    /// through their ParentViewportWatcher (e.g., LayoutInfo) immediately after calling this
1919    /// function, even if they have not called [`Present`] or [`SetRootTransform`]. This allows
1920    /// clients to wait for layout information from their parent before calling [`Present`].
1921    ///
1922    /// Any illegal operations on ParentViewportWatcher will cause both ParentViewportWatcher
1923    /// channel and this Flatland channel to be torn down.
1924    ///
1925    /// Lifecycle note. The lifetime of the ParentViewportWatcher channel is bound by the peer
1926    /// ViewportCreationToken. When the ViewportCreationToken dies, this ParentViewportWatcher
1927    /// channel is destroyed.
1928    ///
1929    /// Views and subgraphs of Views created using `CreateView` will not be represented in the
1930    /// ViewTree, and hence will not be able to participate in any ViewTree-dependent interactions
1931    /// such as touch, mouse or focus.
1932    /// The Flatland protocol provides no way for Views in the subgraph of a View created with
1933    /// `CreateView` to know that they are excluded from the ViewTree.
1934    pub fn r#create_view(
1935        &self,
1936        mut token: fidl_fuchsia_ui_views::ViewCreationToken,
1937        mut parent_viewport_watcher: fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>,
1938    ) -> Result<(), fidl::Error> {
1939        self.client.send::<FlatlandCreateViewRequest>(
1940            (&mut token, parent_viewport_watcher),
1941            0x504686eb25864780,
1942            fidl::encoding::DynamicFlags::empty(),
1943        )
1944    }
1945
1946    /// Identical to [`CreateView`], except it allows association of View identity (ViewRef) and
1947    /// view-bound protocols.
1948    pub fn r#create_view2(
1949        &self,
1950        mut token: fidl_fuchsia_ui_views::ViewCreationToken,
1951        mut view_identity: fidl_fuchsia_ui_views::ViewIdentityOnCreation,
1952        mut protocols: ViewBoundProtocols,
1953        mut parent_viewport_watcher: fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>,
1954    ) -> Result<(), fidl::Error> {
1955        self.client.send::<FlatlandCreateView2Request>(
1956            (&mut token, &mut view_identity, &mut protocols, parent_viewport_watcher),
1957            0x340a3a40c2fdbd5e,
1958            fidl::encoding::DynamicFlags::empty(),
1959        )
1960    }
1961
1962    /// Creates a new Transform node. Transforms are a hierarchical piece of a Flatland graph. They
1963    /// can have children, and can reference Content. A sub-graph represented by a Transform and its
1964    /// descendants can be rendered to a display.
1965    ///
1966    /// Transforms are kept alive, even when released, as long as they are children of either an
1967    /// unreleased Transform, or the Root Transform.
1968    ///
1969    /// Each Transform can have a single piece of attached Content. Common types of Content include
1970    /// bitmaps, asynchronous streams of images, and Viewports to Views hosted in other Flatland
1971    /// instances.
1972    ///
1973    /// Transforms have attributes. Child Transforms inherit the combined attributes of their
1974    /// parents. Content attached to a Transform is also affected by that Transform's attributes.
1975    ///
1976    /// When a sub-graph of Transforms is rendered, Content will be rendered back-to-front, starting
1977    /// with the Content on the root transform, and continuing recursively through all of its child
1978    /// Transforms in the order the children were added. See [`AddChild`] for more information.
1979    ///
1980    /// Zero is not a valid transform id. All other values are valid, assuming they are not already
1981    /// in use (see [`ReleaseTransform`] for more details).
1982    pub fn r#create_transform(&self, mut transform_id: &TransformId) -> Result<(), fidl::Error> {
1983        self.client.send::<FlatlandCreateTransformRequest>(
1984            (transform_id,),
1985            0x5e042a4d3de3efb0,
1986            fidl::encoding::DynamicFlags::empty(),
1987        )
1988    }
1989
1990    /// All Transform objects support all attributes.
1991    ///
1992    /// Geometric attributes are applied in the following order:
1993    /// 1. Scale (relative to the parent transform's coordinate space)
1994    /// 2. Orientation (relative to the parent transform's coordinate space)
1995    /// 3. Translation (relative to the parent transforms's coordinate space,
1996    ///    unaffected by scale applied to the current transform).
1997    /// 4. Clipping (relative to the current transform's coordinate space)
1998    ///
1999    /// The effects of each of these attributes are cumulative. This means the transform's position
2000    /// in the view space, and its clip boundary, will be calculated based on that chain of
2001    /// geometric attributes going up to the root transform.
2002    ///
2003    /// For instance, in a nested hierarchy such as the following:
2004    ///     [Root-Transform -> Transform1 -> Transform2 -> CurrentTransform]
2005    /// If Transform1 is translated by [2,0] and Transform2 is translated by [0,1] then the
2006    /// view-space position of CurrentTransform will be [2,1].
2007    ///
2008    /// Sets the translation on a Transform. The order of geometric attribute application is
2009    /// addressed above.
2010    pub fn r#set_translation(
2011        &self,
2012        mut transform_id: &TransformId,
2013        mut translation: &fidl_fuchsia_math::Vec_,
2014    ) -> Result<(), fidl::Error> {
2015        self.client.send::<FlatlandSetTranslationRequest>(
2016            (transform_id, translation),
2017            0x7863398291fba346,
2018            fidl::encoding::DynamicFlags::empty(),
2019        )
2020    }
2021
2022    /// Sets the orientation on a Transform. The order of geometric attribute application is
2023    /// addressed in the documentation for [`SetTranslation`]. In Flatland, the +X axis is
2024    /// to the right and the +Y axis is down. There is no notion of a Z axis. CCW is defined
2025    /// from the POV of the user, as if a skeuomorphoic clock is displayed on the screen.
2026    pub fn r#set_orientation(
2027        &self,
2028        mut transform_id: &TransformId,
2029        mut orientation: Orientation,
2030    ) -> Result<(), fidl::Error> {
2031        self.client.send::<FlatlandSetOrientationRequest>(
2032            (transform_id, orientation),
2033            0x4915310bc4928edc,
2034            fidl::encoding::DynamicFlags::empty(),
2035        )
2036    }
2037
2038    /// Sets the scale on a transform. The order of geometric attribute application is
2039    /// addressed above. The (x,y) values in the VecF |scale| refer to the scale factor in the
2040    /// x-axis (width) and y-axis (height) respectively. Scale values must be normal 32-bit
2041    /// floating point values: https://en.wikipedia.org/wiki/Normal_number_%28computing%29
2042    pub fn r#set_scale(
2043        &self,
2044        mut transform_id: &TransformId,
2045        mut scale: &fidl_fuchsia_math::VecF,
2046    ) -> Result<(), fidl::Error> {
2047        self.client.send::<FlatlandSetScaleRequest>(
2048            (transform_id, scale),
2049            0x1ea1766fd8996bb4,
2050            fidl::encoding::DynamicFlags::empty(),
2051        )
2052    }
2053
2054    /// Sets an opacity in linear space to be applied to a transform and its descendents,
2055    /// which include other transforms and content. Opacity values must be in the range
2056    /// of [0.0, 1.0], where 0.0 is completely transparent and 1.0 is completely opaque.
2057    /// Attempting to call this function with values outside that range will result in
2058    /// an error. A transform's opacity value is multiplied with that of its parent. This
2059    /// effect works differently from group opacity. Using group opacity, child nodes are
2060    /// rendered together first, and then have the parent's opacity applied as a post-effect.
2061    /// Here, opacity is applied to each child individually. This may result in a very
2062    /// different effect.
2063    pub fn r#set_opacity(
2064        &self,
2065        mut transform_id: &TransformId,
2066        mut value: f32,
2067    ) -> Result<(), fidl::Error> {
2068        self.client.send::<FlatlandSetOpacityRequest>(
2069            (transform_id, value),
2070            0x3775fc2c00b432fa,
2071            fidl::encoding::DynamicFlags::empty(),
2072        )
2073    }
2074
2075    /// Sets the bounds, expressed in the local coordinate space of the transform, that
2076    /// constrains the region that content attached to this transform can be rendered to.
2077    /// If the content's area exceeds the clip bounds, the area outside the bounds will
2078    /// not be rendered. These bounds are valid for all children of this transform node as
2079    /// well, which includes nested Flatland instances and their node hierarchies.
2080    /// If a child transform attempts to set clip bounds larger than that of its parent,
2081    /// it will be clipped to the parent's clip bounds. The default state is for a transform
2082    /// to be unclipped, meaning it will not have any bounds placed on its render region.
2083    /// The clip width/height must be positive. Negative values will result in an error.
2084    /// Passing in an empty box to the |rect| parameter will remove the clip bounds.
2085    pub fn r#set_clip_boundary(
2086        &self,
2087        mut transform_id: &TransformId,
2088        mut rect: Option<&fidl_fuchsia_math::Rect>,
2089    ) -> Result<(), fidl::Error> {
2090        self.client.send::<FlatlandSetClipBoundaryRequest>(
2091            (transform_id, rect),
2092            0x6507843df12222d2,
2093            fidl::encoding::DynamicFlags::empty(),
2094        )
2095    }
2096
2097    /// Adds a child Transform to a parent Transform. The new child Transform,
2098    /// and any Content attached to it or its children, will be rendered on top
2099    /// of the parent's Content, as well as any previously added children.
2100    ///
2101    /// The caller must ensure that `child_transform_id` is valid and that there
2102    /// are no repetitions.  Sending a repeated `child_transform_id` over
2103    /// multiple calls will result in session closure.
2104    pub fn r#add_child(
2105        &self,
2106        mut parent_transform_id: &TransformId,
2107        mut child_transform_id: &TransformId,
2108    ) -> Result<(), fidl::Error> {
2109        self.client.send::<FlatlandAddChildRequest>(
2110            (parent_transform_id, child_transform_id),
2111            0x67a8abd2f19b1a74,
2112            fidl::encoding::DynamicFlags::empty(),
2113        )
2114    }
2115
2116    /// Removes a child Transform from a parent Transform.
2117    pub fn r#remove_child(
2118        &self,
2119        mut parent_transform_id: &TransformId,
2120        mut child_transform_id: &TransformId,
2121    ) -> Result<(), fidl::Error> {
2122        self.client.send::<FlatlandRemoveChildRequest>(
2123            (parent_transform_id, child_transform_id),
2124            0x41d6cd90b298b67a,
2125            fidl::encoding::DynamicFlags::empty(),
2126        )
2127    }
2128
2129    /// Removes all child Transforms from a parent Transform and replaces them
2130    /// with the new child transforms in `new_child_transform_ids`.  The caller
2131    /// must ensure that all `TransformId` values in `new_child_transform_ids`
2132    /// are valid and that there are no repetitions.  Sending a repeated
2133    /// `TransformId` in `new_child_transform_ids` will result in session
2134    /// closure.
2135    pub fn r#replace_children(
2136        &self,
2137        mut parent_transform_id: &TransformId,
2138        mut new_child_transform_ids: &[TransformId],
2139    ) -> Result<(), fidl::Error> {
2140        self.client.send::<FlatlandReplaceChildrenRequest>(
2141            (parent_transform_id, new_child_transform_ids),
2142            0x5b6d86cbbff81316,
2143            fidl::encoding::DynamicFlags::empty(),
2144        )
2145    }
2146
2147    /// Sets the Root Transform for the graph.
2148    ///
2149    /// The sub-graph defined by the Root Transform and its children will be rendered as View
2150    /// in the connected parent's Viewport (see [`CreateView`]). Any parents of the Root Transform
2151    /// in this Graph will be ignored.
2152    ///
2153    /// The Root Transform, and all children of the Root Transform, are kept alive if they are
2154    /// released (see [`ReleaseTransform`] for more details).
2155    ///
2156    /// There is only ever one Root. Since 0 is not a valid transform id (see [`CreateTransform`]),
2157    /// calling SetRootTransform(0) clears the current Root, destroying any previously released
2158    /// objects that are not referenced by the new root.
2159    ///
2160    /// Note that every View has a clip boundary equivalent to its logical size. Anything outside
2161    /// that clip boundary will not be rendered. Hence, the Root Transform has a useful coordinate
2162    /// space of (0, 0) to (logical_size.width, logical_size.height), where (0, 0) is the upper left
2163    /// corner.
2164    ///
2165    /// Setting the root transform installs a full screen hit region on the root transform. Clients
2166    /// may remove this hit region if they don't want users to be able to interact with the root
2167    /// transform's content. For additional details on hit regions, see the [`SetHitRegions`]
2168    /// documentation.
2169    ///
2170    /// Default hit region rules
2171    ///
2172    ///   A default hit region follows these rules:
2173    ///   - When [`SetRootTransform`](T) is called, T receives a maximal hit region, covering the
2174    ///   entire view.
2175    ///   - If [`SetHitRegions`] is called on T, either before or after [`SetRootTransform`](T),
2176    ///   then no default hit region is active and the client specified hit regions are used.
2177    ///   - If a transform is no longer the root transform, i.e., [`SetRootTransform`](U) is
2178    ///   called, then the original transform no longer has its default hit region.
2179    ///   - Clients can remove or modify the root transform's hit regions the same way they would
2180    ///   reset any other transform's hit regions, by calling [`SetHitRegions`] with the appropriate
2181    ///   vector.
2182    pub fn r#set_root_transform(&self, mut transform_id: &TransformId) -> Result<(), fidl::Error> {
2183        self.client.send::<FlatlandSetRootTransformRequest>(
2184            (transform_id,),
2185            0x6e80ca5bcc566cd8,
2186            fidl::encoding::DynamicFlags::empty(),
2187        )
2188    }
2189
2190    /// Sets the interactive areas for a Transform. By default, Content is not interactive; hit
2191    /// regions must be placed for a user to interact with the Content in a View. Because hit
2192    /// regions are described in the Flatland protocol, a Flatland instance can synchronize Content
2193    /// and hit regions.
2194    ///
2195    /// Each hit region is placed in the coordinate space of the owning Transform, and may or may
2196    /// not interact with different types of hit testing, depending on its [`HitTestInteraction`]
2197    /// type. When there are multiple hit regions that intersect with a hit test, the precedence
2198    /// rules given below dictate which hit region has interacted with the hit test. Only Transforms
2199    /// that transitively connect to the root Transform have their hit regions interact with a hit
2200    /// test.
2201    ///
2202    /// Calling this function replaces any previous values set on this Transform. To reset a
2203    /// Transform to "no hit testing": send an empty vector with [`SetHitRegions`].
2204    ///
2205    /// Note that root transforms get a default hit region installed by Flatland. For more details,
2206    /// see the [`SetRootTransform`] documentation.
2207    ///
2208    /// Precedence rules
2209    ///   Within a Transform, if multiple hit regions overlap, the hit test examines each
2210    ///   intersecting hit region for a possible interaction. Thus, for a regular hit test R and an
2211    ///   accessibility hit test A, where R and A both intersect two hit regions D ([`DEFAULT`]) and
2212    ///   S ([`SEMANTICALLY_INVISIBLE`]) on the same Transform, (1) R interacts with both D and S,
2213    ///   and (2) A only interacts with D. Generally, hit regions that overlap in a single Transform
2214    ///   can cause confusing behavior.
2215    ///
2216    ///   Within a View, for a given hit test, the front-most Transform's hit regions take
2217    ///   precedence over those behind. This follows the expected reverse "render order" of
2218    ///   Transforms (described in [`CreateTransform`]), where a user expects to interact with
2219    ///   Content that is visible, or front-most.
2220    ///
2221    ///   Across Flatland instances, for a given hit test, the front-most instance's front-most
2222    ///   Transform's hit regions take precedence over those behind. This follows the expected
2223    ///   reverse "render order" of views, where a user expects to interact with the View that is
2224    ///   visible, or front-most. For example, if a child View owns Content that is rendered over
2225    ///   the parent View, the user expects to interact with the child's Content.
2226    pub fn r#set_hit_regions(
2227        &self,
2228        mut transform_id: &TransformId,
2229        mut regions: &[HitRegion],
2230    ) -> Result<(), fidl::Error> {
2231        self.client.send::<FlatlandSetHitRegionsRequest>(
2232            (transform_id, regions),
2233            0x31c9d17b07c37ce4,
2234            fidl::encoding::DynamicFlags::empty(),
2235        )
2236    }
2237
2238    /// Identical to [`SetHitRegions`], except the hit region associated with [`transform_id`]
2239    /// covers an infinite region. The hit region is invariant against translation, scaling, and
2240    /// orientation of the Transform.
2241    ///
2242    /// An infinite hit region is still limited in extent by the View's clip boundary, just like a
2243    /// finite hit region.
2244    ///
2245    /// Calling this function replaces any previous values set on this Transform. To reset a
2246    /// Transform to "no hit testing": send an empty vector with [`SetHitRegions`].
2247    pub fn r#set_infinite_hit_region(
2248        &self,
2249        mut transform_id: &TransformId,
2250        mut hit_test: HitTestInteraction,
2251    ) -> Result<(), fidl::Error> {
2252        self.client.send::<FlatlandSetInfiniteHitRegionRequest>(
2253            (transform_id, hit_test),
2254            0x26d81af852d29562,
2255            fidl::encoding::DynamicFlags::empty(),
2256        )
2257    }
2258
2259    /// The Viewport and View pair, together, represent the connection between two Flatland
2260    /// instances. The Viewport is created in the parent, and the View is created in the child. The
2261    /// parent has control over how the child's View is integrated into its own View.
2262    ///
2263    /// Any illegal operations on ChildViewWatcher will cause both ChildViewWatcher channel and this
2264    /// Flatland channel to be torn down.
2265    ///
2266    /// `ViewportProperties` must have logical_size set. This is the initial size that will drive
2267    /// the layout of the child. The logical_size is also used as the default Content size, but
2268    /// subsequent changes to the logical_size will have no effect on the Content size.
2269    ///
2270    /// `ViewportProperties` may have inset field not set. In that case, the default value of
2271    /// (0, 0, 0, 0) is used.
2272    ///
2273    /// The logical_size must have positive X and Y components.
2274    ///
2275    /// Zero is not a valid ContentId. All other values are valid, assuming they are not already
2276    /// in use for another piece of Content (see [`ReleaseViewport`] for more details).
2277    ///
2278    /// Lifecycle note. The lifetime of the ChildViewWatcher channel is bound by the peer
2279    /// ViewCreationToken. When the ViewCreationToken dies, this ChildViewWatcher channel is
2280    /// destroyed.
2281    pub fn r#create_viewport(
2282        &self,
2283        mut viewport_id: &ContentId,
2284        mut token: fidl_fuchsia_ui_views::ViewportCreationToken,
2285        mut properties: &ViewportProperties,
2286        mut child_view_watcher: fidl::endpoints::ServerEnd<ChildViewWatcherMarker>,
2287    ) -> Result<(), fidl::Error> {
2288        self.client.send::<FlatlandCreateViewportRequest>(
2289            (viewport_id, &mut token, properties, child_view_watcher),
2290            0x2485fbcab7f943c,
2291            fidl::encoding::DynamicFlags::empty(),
2292        )
2293    }
2294
2295    /// An Image is a bitmap backed by a specific VMO in a BufferCollection.
2296    ///
2297    /// Image creation requires an allocated BufferCollection registered with Allocator. This
2298    /// function will fail unless all clients of the specified BufferCollection have set their
2299    /// constraints.
2300    ///
2301    /// The Image must reference a valid VMO index and must have ImageProperties that fall within
2302    /// the constraints specified by the backing BufferCollection (i.e. width and height within a
2303    /// valid range, etc.)
2304    ///
2305    /// Zero is not a valid Image id. All other values are valid, assuming they are not already in
2306    /// use for another piece of Content (see [`ReleaseImage`] for more details).
2307    pub fn r#create_image(
2308        &self,
2309        mut image_id: &ContentId,
2310        mut import_token: BufferCollectionImportToken,
2311        mut vmo_index: u32,
2312        mut properties: &ImageProperties,
2313    ) -> Result<(), fidl::Error> {
2314        self.client.send::<FlatlandCreateImageRequest>(
2315            (image_id, &mut import_token, vmo_index, properties),
2316            0x26fae823c4ebedad,
2317            fidl::encoding::DynamicFlags::empty(),
2318        )
2319    }
2320
2321    /// This function is used to determine the region (in texel space) of an image that will be used
2322    /// by Flatland when rendering. The image to be sampled is referenced by [`image_id`] and the
2323    /// sample region is specified by [`rect`] which itself is comprised of an origin point (x,y) as
2324    /// well as a width and height, in unnormalized coordinates. It is illegal to call this function
2325    /// on non-image content, or to sample a region outside of the texel space of the image. In
2326    /// other words, the region specifed by [`rect`] must not exceed the ranges (0, image_width) and
2327    /// (0, image_height). If (rect.x + rect.width > image_width) or (rect.y + rect.height >
2328    /// image_height) or if any of the values are negative, this will result in an error.
2329    ///
2330    /// If this method is not called, the default sample region is the rectangle with origin at
2331    /// (0, 0) and width and height set at ImageProperties from [`CreateImage`].
2332    pub fn r#set_image_sample_region(
2333        &self,
2334        mut image_id: &ContentId,
2335        mut rect: &fidl_fuchsia_math::RectF,
2336    ) -> Result<(), fidl::Error> {
2337        self.client.send::<FlatlandSetImageSampleRegionRequest>(
2338            (image_id, rect),
2339            0x8039391d715eb28,
2340            fidl::encoding::DynamicFlags::empty(),
2341        )
2342    }
2343
2344    /// The content size for an Image is the size of the rectangle in the parent's logical
2345    /// coordinate space that the image occupies. This combined with the global translation of the
2346    /// transform it is attached to determines the size and location of where the content is
2347    /// rendered on the display.
2348    ///
2349    /// If this method is not called, the default image destination size is the width and height set
2350    /// at ImageProperties from [`CreateImage`]. The destination size will be affected by scaling if
2351    /// [`SetScale`] is used on the attached Transform or its parents.
2352    pub fn r#set_image_destination_size(
2353        &self,
2354        mut image_id: &ContentId,
2355        mut size: &fidl_fuchsia_math::SizeU,
2356    ) -> Result<(), fidl::Error> {
2357        self.client.send::<FlatlandSetImageDestinationSizeRequest>(
2358            (image_id, size),
2359            0x766cf99a2ec58446,
2360            fidl::encoding::DynamicFlags::empty(),
2361        )
2362    }
2363
2364    /// Determines the blend function to use when rendering the content specified by
2365    /// |image_id|. |image_id| must be a valid ContentId associated to a transform through
2366    /// a call to |CreateImage| or |CreateFilledRect|. For details on the different blend functions
2367    /// that are available, please refer to the BlendMode enum. If this function is not called, then
2368    /// the default blendmode is BlendMode::SRC.
2369    pub fn r#set_image_blending_function(
2370        &self,
2371        mut image_id: &ContentId,
2372        mut blend_mode: BlendMode,
2373    ) -> Result<(), fidl::Error> {
2374        self.client.send::<FlatlandSetImageBlendingFunctionRequest>(
2375            (image_id, blend_mode),
2376            0x10f5da1356275b7b,
2377            fidl::encoding::DynamicFlags::empty(),
2378        )
2379    }
2380
2381    /// Determines the blend function to use when rendering the content specified by
2382    /// |image_id|. |image_id| must be a valid ContentId associated to a transform through
2383    /// a call to |CreateImage| or |CreateFilledRect|. For details on the different blend functions
2384    /// that are available, please refer to the BlendMode2 enum. If this function is not called,
2385    /// the default blendmode is BlendMode2::REPLACE.
2386    pub fn r#set_image_blend_mode(
2387        &self,
2388        mut image_id: &ContentId,
2389        mut blend_mode: BlendMode2,
2390    ) -> Result<(), fidl::Error> {
2391        self.client.send::<FlatlandSetImageBlendModeRequest>(
2392            (image_id, blend_mode),
2393            0x5b1667f130c3de67,
2394            fidl::encoding::DynamicFlags::empty(),
2395        )
2396    }
2397
2398    /// Sets an opacity in linear space to be applied to a flatland image. Opacity values must
2399    /// be in the range [0.0, 1.0].
2400    pub fn r#set_image_opacity(
2401        &self,
2402        mut image_id: &ContentId,
2403        mut val: f32,
2404    ) -> Result<(), fidl::Error> {
2405        self.client.send::<FlatlandSetImageOpacityRequest>(
2406            (image_id, val),
2407            0x2da9e4ef4c2cff6f,
2408            fidl::encoding::DynamicFlags::empty(),
2409        )
2410    }
2411
2412    /// Sets the image flip to be applied to a flatland image. This call must be performed after a
2413    /// successful |CreateImage| call. If an invalid |image_id| is supplied, the channel will be
2414    /// closed due to FlatlandError::BAD_OPERATION. This flip will be applied to the Image before
2415    /// parent Transform Orientations. If this function is not called, then the default flip value
2416    /// is ImageFlip::NONE.
2417    pub fn r#set_image_flip(
2418        &self,
2419        mut image_id: &ContentId,
2420        mut flip: ImageFlip,
2421    ) -> Result<(), fidl::Error> {
2422        self.client.send::<FlatlandSetImageFlipRequest>(
2423            (image_id, flip),
2424            0x21b20f2c14aae6bc,
2425            fidl::encoding::DynamicFlags::empty(),
2426        )
2427    }
2428
2429    /// Creates a solid-color rectangle. By default a filled-rect does not have a defined
2430    /// color or size. It is necessary to call |SetSolidFill| to specify a color and size
2431    /// before a filled rect can be used for rendering. Not doing so will result the
2432    pub fn r#create_filled_rect(&self, mut rect_id: &ContentId) -> Result<(), fidl::Error> {
2433        self.client.send::<FlatlandCreateFilledRectRequest>(
2434            (rect_id,),
2435            0x5e62355abc1c4c5d,
2436            fidl::encoding::DynamicFlags::empty(),
2437        )
2438    }
2439
2440    /// Defines the color and size of a filled rect. |rect_id| must refer to content that
2441    /// was created via a call to CreateFilledRect. The color is not premultiplied. Color values
2442    /// must be within the range [0,1] inclusive, and normal 32-bit
2443    /// floating point values: https://en.wikipedia.org/wiki/Normal_number_%28computing%29. Values
2444    /// that do not conform to these specifications will cause the channel to close.
2445    /// The rectangle's top left corner will be at (0, 0) in its transform's coordinate space.
2446    /// Hence, its bottom right corner will be at (size.width, size.height).
2447    pub fn r#set_solid_fill(
2448        &self,
2449        mut rect_id: &ContentId,
2450        mut color: &ColorRgba,
2451        mut size: &fidl_fuchsia_math::SizeU,
2452    ) -> Result<(), fidl::Error> {
2453        self.client.send::<FlatlandSetSolidFillRequest>(
2454            (rect_id, color, size),
2455            0x32d6ef41e182dfa5,
2456            fidl::encoding::DynamicFlags::empty(),
2457        )
2458    }
2459
2460    /// Automatically garbage collects the rectangle when it is no longer needed for
2461    /// rendering. |rect_id| must have been instantiated with a call to
2462    /// |CreateFilledRect|. Once released, the ID immediately goes out of scope and is free
2463    /// to be used again.
2464    pub fn r#release_filled_rect(&self, mut rect_id: &ContentId) -> Result<(), fidl::Error> {
2465        self.client.send::<FlatlandReleaseFilledRectRequest>(
2466            (rect_id,),
2467            0x7392cabe45618f9b,
2468            fidl::encoding::DynamicFlags::empty(),
2469        )
2470    }
2471
2472    /// Setting a piece of Content on a Transform makes that Content visible in the render tree as
2473    /// long as the Transform is visible from the root Transform. The Content will be rendered
2474    /// before, and therefore "behind", any Content attached to the descendants of the Transform.
2475    ///
2476    /// Because each Transform can have, at most, a single piece of Content on it, calling this
2477    /// function on a Transform that already has Content will replace that Content.
2478    ///
2479    /// A Content may be set on more than one Transform.
2480    ///
2481    /// Calling this function with a Content id of 0 will remove any Content currently on the
2482    /// Transform.
2483    pub fn r#set_content(
2484        &self,
2485        mut transform_id: &TransformId,
2486        mut content_id: &ContentId,
2487    ) -> Result<(), fidl::Error> {
2488        self.client.send::<FlatlandSetContentRequest>(
2489            (transform_id, content_id),
2490            0x4ed2cfc0ce130862,
2491            fidl::encoding::DynamicFlags::empty(),
2492        )
2493    }
2494
2495    /// Transforms are usually sufficient to change how Content is presented. Viewports, however,
2496    /// have special properties that are not part of the Transform hierarchy. Those properties can
2497    /// be set using this function.
2498    pub fn r#set_viewport_properties(
2499        &self,
2500        mut viewport_id: &ContentId,
2501        mut properties: &ViewportProperties,
2502    ) -> Result<(), fidl::Error> {
2503        self.client.send::<FlatlandSetViewportPropertiesRequest>(
2504            (viewport_id, properties),
2505            0x66ab67e9608ddb9f,
2506            fidl::encoding::DynamicFlags::empty(),
2507        )
2508    }
2509
2510    /// Released Transforms will be garbage collected by the system once they are no longer
2511    /// necessary for rendering. For Transforms, this means there is no path from any unreleased
2512    /// Transform to the newly-released Transform.
2513    ///
2514    /// Once released, the id immediately goes out of scope for future function calls and can be
2515    /// reused when creating new Transforms.
2516    ///
2517    /// It is an error to call functions with a released id (unless that id has been reused to
2518    /// construct a new Transform).
2519    pub fn r#release_transform(&self, mut transform_id: &TransformId) -> Result<(), fidl::Error> {
2520        self.client.send::<FlatlandReleaseTransformRequest>(
2521            (transform_id,),
2522            0xab9328419451c22,
2523            fidl::encoding::DynamicFlags::empty(),
2524        )
2525    }
2526
2527    pub fn r#release_view(&self) -> Result<(), fidl::Error> {
2528        self.client.send::<fidl::encoding::EmptyPayload>(
2529            (),
2530            0x5b35aab9baffecae,
2531            fidl::encoding::DynamicFlags::empty(),
2532        )
2533    }
2534
2535    /// Releases a Viewport from the scene, even if the Viewport is still connected to a Transform.
2536    /// Unlike other resources, Viewports are garbage collected by the system during the next
2537    /// [`Present`] because a removed Viewport is guaranteed to provide no renderable content.
2538    ///
2539    /// Use SetContent(transform_id, 0) to clean up references to released Viewports.
2540    ///
2541    /// Despite having a return type, this function is still feed-forward like [`CreateView`] and
2542    /// requires a call to [`Present`] to be executed. The ViewportCreationToken will be returned
2543    /// after the presented operations have been executed.
2544    pub fn r#release_viewport(
2545        &self,
2546        mut viewport_id: &ContentId,
2547        ___deadline: zx::MonotonicInstant,
2548    ) -> Result<fidl_fuchsia_ui_views::ViewportCreationToken, fidl::Error> {
2549        let _response = self.client.send_query::<
2550            FlatlandReleaseViewportRequest,
2551            FlatlandReleaseViewportResponse,
2552            FlatlandMarker,
2553        >(
2554            (viewport_id,),
2555            0xbad474aeb5293f9,
2556            fidl::encoding::DynamicFlags::empty(),
2557            ___deadline,
2558        )?;
2559        Ok(_response.token)
2560    }
2561
2562    /// Released Images will be garbage collected by the system once they are no longer necessary
2563    /// for rendering. For Images, this means the Image is no longer attached to any Transform and
2564    /// any pending rendering that references the Image is complete.
2565    ///
2566    /// Use SetContent(transform_id, 0) to clean up references to released Images.
2567    ///
2568    /// Once released, the id immediately goes out of scope for future function calls and can be
2569    /// reused when creating new Images.
2570    ///
2571    /// It is an error to call functions with a released id (unless that id has been reused to
2572    /// construct a new Image).
2573    pub fn r#release_image(&self, mut image_id: &ContentId) -> Result<(), fidl::Error> {
2574        self.client.send::<FlatlandReleaseImageRequest>(
2575            (image_id,),
2576            0xb884ffdbc72c111,
2577            fidl::encoding::DynamicFlags::empty(),
2578        )
2579    }
2580
2581    /// This function will reset all state on this interface. This includes destroying all existing
2582    /// View and Viewports without returning the associated Token to the caller.
2583    pub fn r#clear(&self) -> Result<(), fidl::Error> {
2584        self.client.send::<fidl::encoding::EmptyPayload>(
2585            (),
2586            0x4ec8817c02828c3e,
2587            fidl::encoding::DynamicFlags::empty(),
2588        )
2589    }
2590
2591    /// Set debug name of the current client that can be used by Flatland to print as a prefix to
2592    /// logs to help client distinguish what is theirs. [`name`] can be an arbitrary string, but the
2593    /// current process name (see fsl::GetCurrentProcessName()) is a good default.
2594    pub fn r#set_debug_name(&self, mut name: &str) -> Result<(), fidl::Error> {
2595        self.client.send::<FlatlandSetDebugNameRequest>(
2596            (name,),
2597            0x46a8b397e68a8888,
2598            fidl::encoding::DynamicFlags::empty(),
2599        )
2600    }
2601}
2602
2603#[cfg(target_os = "fuchsia")]
2604impl From<FlatlandSynchronousProxy> for zx::NullableHandle {
2605    fn from(value: FlatlandSynchronousProxy) -> Self {
2606        value.into_channel().into()
2607    }
2608}
2609
2610#[cfg(target_os = "fuchsia")]
2611impl From<fidl::Channel> for FlatlandSynchronousProxy {
2612    fn from(value: fidl::Channel) -> Self {
2613        Self::new(value)
2614    }
2615}
2616
2617#[cfg(target_os = "fuchsia")]
2618impl fidl::endpoints::FromClient for FlatlandSynchronousProxy {
2619    type Protocol = FlatlandMarker;
2620
2621    fn from_client(value: fidl::endpoints::ClientEnd<FlatlandMarker>) -> Self {
2622        Self::new(value.into_channel())
2623    }
2624}
2625
2626#[derive(Debug, Clone)]
2627pub struct FlatlandProxy {
2628    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2629}
2630
2631impl fidl::endpoints::Proxy for FlatlandProxy {
2632    type Protocol = FlatlandMarker;
2633
2634    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2635        Self::new(inner)
2636    }
2637
2638    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2639        self.client.into_channel().map_err(|client| Self { client })
2640    }
2641
2642    fn as_channel(&self) -> &::fidl::AsyncChannel {
2643        self.client.as_channel()
2644    }
2645}
2646
2647impl FlatlandProxy {
2648    /// Create a new Proxy for fuchsia.ui.composition/Flatland.
2649    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2650        let protocol_name = <FlatlandMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2651        Self { client: fidl::client::Client::new(channel, protocol_name) }
2652    }
2653
2654    /// Get a Stream of events from the remote end of the protocol.
2655    ///
2656    /// # Panics
2657    ///
2658    /// Panics if the event stream was already taken.
2659    pub fn take_event_stream(&self) -> FlatlandEventStream {
2660        FlatlandEventStream { event_receiver: self.client.take_event_receiver() }
2661    }
2662
2663    /// Releases an image immediately, without waiting for the next present.
2664    pub fn r#release_image_immediately(&self, mut image_id: &ContentId) -> Result<(), fidl::Error> {
2665        FlatlandProxyInterface::r#release_image_immediately(self, image_id)
2666    }
2667
2668    /// Complete execution of all feed-forward operations.
2669    ///
2670    /// If executing an operation produces an error (e.g., CreateTransform(0)), an [`OnError`] event
2671    /// is emitted. Operations that produce errors are ignored and the channel is closed.
2672    ///
2673    /// If the execution is completed successfully, [`OnNextFrameBegin`] emits NO_ERROR along
2674    /// with other valid fields.
2675    ///
2676    /// The client may only call [`Present`] when they have a non-zero number of present credits,
2677    /// which are tracked by the server. The server may increment the number of credits when it
2678    /// fires the [`OnNextFrameBegin`] event, which informs the client when it receives additional
2679    /// present credits. Each [`Present`] call uses one present credit and decrements the server
2680    /// count by one. If the client calls [`Present`] with no present credits, the server will
2681    /// return a `NO_PRESENTS_REMAINING` error.
2682    ///
2683    /// The client should assume that prior to receiving any [`OnNextFrameBegin`] events, they have
2684    /// one present credit.
2685    ///
2686    /// Every [`Present`] call results in one [`OnNextFrameBegin`] event, and one
2687    /// [`OnFramePresented`] event, typically in that order.
2688    ///
2689    /// When the commands flushed by [`Present`] make it to display, an [`OnFramePresented`] event
2690    /// is fired. This event includes information pertaining to all [`Present`]s that had content
2691    /// that were part of that frame.
2692    ///
2693    /// See [`fuchsia.ui.composition/PresentArgs`] documentation above for more detailed information
2694    /// on what arguments are passed in and their role.
2695    pub fn r#present(&self, mut args: PresentArgs) -> Result<(), fidl::Error> {
2696        FlatlandProxyInterface::r#present(self, args)
2697    }
2698
2699    /// Two Flatland instances may be connected in a parent-child relationship. The parent endpoint
2700    /// is held in a Viewport, and the child endpoint is held in a View. The parent Flatland
2701    /// instance that creates a Viewport has control over how the child's View is integrated into
2702    /// its own View.
2703    ///
2704    /// The lifecycle of a parent-child connection starts with two endpoints of a channel object:
2705    /// a ViewportCreationToken and a ViewCreationToken. Out-of-band protocols pass the
2706    /// ViewportCreationToken to the parent, which calls [`CreateViewport`], and the
2707    /// ViewCreationToken to the child, which calls [`CreateView`].
2708    ///
2709    /// Only nodes connected to the Root Transform in this Flatland instance will be rendered into
2710    /// the parent's Viewport.
2711    ///
2712    /// Calling [`CreateView`] a second time will disconnect the Root Transform from the existing
2713    /// parent's Viewport, and attach it to a new parent's Viewport. In other words, each View can
2714    /// only have one parent.
2715    ///
2716    /// This function is queued, meaning that the Root Transform will not be attached to the
2717    /// parent Viewport until [`Present`] is called. However, clients will receive information
2718    /// through their ParentViewportWatcher (e.g., LayoutInfo) immediately after calling this
2719    /// function, even if they have not called [`Present`] or [`SetRootTransform`]. This allows
2720    /// clients to wait for layout information from their parent before calling [`Present`].
2721    ///
2722    /// Any illegal operations on ParentViewportWatcher will cause both ParentViewportWatcher
2723    /// channel and this Flatland channel to be torn down.
2724    ///
2725    /// Lifecycle note. The lifetime of the ParentViewportWatcher channel is bound by the peer
2726    /// ViewportCreationToken. When the ViewportCreationToken dies, this ParentViewportWatcher
2727    /// channel is destroyed.
2728    ///
2729    /// Views and subgraphs of Views created using `CreateView` will not be represented in the
2730    /// ViewTree, and hence will not be able to participate in any ViewTree-dependent interactions
2731    /// such as touch, mouse or focus.
2732    /// The Flatland protocol provides no way for Views in the subgraph of a View created with
2733    /// `CreateView` to know that they are excluded from the ViewTree.
2734    pub fn r#create_view(
2735        &self,
2736        mut token: fidl_fuchsia_ui_views::ViewCreationToken,
2737        mut parent_viewport_watcher: fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>,
2738    ) -> Result<(), fidl::Error> {
2739        FlatlandProxyInterface::r#create_view(self, token, parent_viewport_watcher)
2740    }
2741
2742    /// Identical to [`CreateView`], except it allows association of View identity (ViewRef) and
2743    /// view-bound protocols.
2744    pub fn r#create_view2(
2745        &self,
2746        mut token: fidl_fuchsia_ui_views::ViewCreationToken,
2747        mut view_identity: fidl_fuchsia_ui_views::ViewIdentityOnCreation,
2748        mut protocols: ViewBoundProtocols,
2749        mut parent_viewport_watcher: fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>,
2750    ) -> Result<(), fidl::Error> {
2751        FlatlandProxyInterface::r#create_view2(
2752            self,
2753            token,
2754            view_identity,
2755            protocols,
2756            parent_viewport_watcher,
2757        )
2758    }
2759
2760    /// Creates a new Transform node. Transforms are a hierarchical piece of a Flatland graph. They
2761    /// can have children, and can reference Content. A sub-graph represented by a Transform and its
2762    /// descendants can be rendered to a display.
2763    ///
2764    /// Transforms are kept alive, even when released, as long as they are children of either an
2765    /// unreleased Transform, or the Root Transform.
2766    ///
2767    /// Each Transform can have a single piece of attached Content. Common types of Content include
2768    /// bitmaps, asynchronous streams of images, and Viewports to Views hosted in other Flatland
2769    /// instances.
2770    ///
2771    /// Transforms have attributes. Child Transforms inherit the combined attributes of their
2772    /// parents. Content attached to a Transform is also affected by that Transform's attributes.
2773    ///
2774    /// When a sub-graph of Transforms is rendered, Content will be rendered back-to-front, starting
2775    /// with the Content on the root transform, and continuing recursively through all of its child
2776    /// Transforms in the order the children were added. See [`AddChild`] for more information.
2777    ///
2778    /// Zero is not a valid transform id. All other values are valid, assuming they are not already
2779    /// in use (see [`ReleaseTransform`] for more details).
2780    pub fn r#create_transform(&self, mut transform_id: &TransformId) -> Result<(), fidl::Error> {
2781        FlatlandProxyInterface::r#create_transform(self, transform_id)
2782    }
2783
2784    /// All Transform objects support all attributes.
2785    ///
2786    /// Geometric attributes are applied in the following order:
2787    /// 1. Scale (relative to the parent transform's coordinate space)
2788    /// 2. Orientation (relative to the parent transform's coordinate space)
2789    /// 3. Translation (relative to the parent transforms's coordinate space,
2790    ///    unaffected by scale applied to the current transform).
2791    /// 4. Clipping (relative to the current transform's coordinate space)
2792    ///
2793    /// The effects of each of these attributes are cumulative. This means the transform's position
2794    /// in the view space, and its clip boundary, will be calculated based on that chain of
2795    /// geometric attributes going up to the root transform.
2796    ///
2797    /// For instance, in a nested hierarchy such as the following:
2798    ///     [Root-Transform -> Transform1 -> Transform2 -> CurrentTransform]
2799    /// If Transform1 is translated by [2,0] and Transform2 is translated by [0,1] then the
2800    /// view-space position of CurrentTransform will be [2,1].
2801    ///
2802    /// Sets the translation on a Transform. The order of geometric attribute application is
2803    /// addressed above.
2804    pub fn r#set_translation(
2805        &self,
2806        mut transform_id: &TransformId,
2807        mut translation: &fidl_fuchsia_math::Vec_,
2808    ) -> Result<(), fidl::Error> {
2809        FlatlandProxyInterface::r#set_translation(self, transform_id, translation)
2810    }
2811
2812    /// Sets the orientation on a Transform. The order of geometric attribute application is
2813    /// addressed in the documentation for [`SetTranslation`]. In Flatland, the +X axis is
2814    /// to the right and the +Y axis is down. There is no notion of a Z axis. CCW is defined
2815    /// from the POV of the user, as if a skeuomorphoic clock is displayed on the screen.
2816    pub fn r#set_orientation(
2817        &self,
2818        mut transform_id: &TransformId,
2819        mut orientation: Orientation,
2820    ) -> Result<(), fidl::Error> {
2821        FlatlandProxyInterface::r#set_orientation(self, transform_id, orientation)
2822    }
2823
2824    /// Sets the scale on a transform. The order of geometric attribute application is
2825    /// addressed above. The (x,y) values in the VecF |scale| refer to the scale factor in the
2826    /// x-axis (width) and y-axis (height) respectively. Scale values must be normal 32-bit
2827    /// floating point values: https://en.wikipedia.org/wiki/Normal_number_%28computing%29
2828    pub fn r#set_scale(
2829        &self,
2830        mut transform_id: &TransformId,
2831        mut scale: &fidl_fuchsia_math::VecF,
2832    ) -> Result<(), fidl::Error> {
2833        FlatlandProxyInterface::r#set_scale(self, transform_id, scale)
2834    }
2835
2836    /// Sets an opacity in linear space to be applied to a transform and its descendents,
2837    /// which include other transforms and content. Opacity values must be in the range
2838    /// of [0.0, 1.0], where 0.0 is completely transparent and 1.0 is completely opaque.
2839    /// Attempting to call this function with values outside that range will result in
2840    /// an error. A transform's opacity value is multiplied with that of its parent. This
2841    /// effect works differently from group opacity. Using group opacity, child nodes are
2842    /// rendered together first, and then have the parent's opacity applied as a post-effect.
2843    /// Here, opacity is applied to each child individually. This may result in a very
2844    /// different effect.
2845    pub fn r#set_opacity(
2846        &self,
2847        mut transform_id: &TransformId,
2848        mut value: f32,
2849    ) -> Result<(), fidl::Error> {
2850        FlatlandProxyInterface::r#set_opacity(self, transform_id, value)
2851    }
2852
2853    /// Sets the bounds, expressed in the local coordinate space of the transform, that
2854    /// constrains the region that content attached to this transform can be rendered to.
2855    /// If the content's area exceeds the clip bounds, the area outside the bounds will
2856    /// not be rendered. These bounds are valid for all children of this transform node as
2857    /// well, which includes nested Flatland instances and their node hierarchies.
2858    /// If a child transform attempts to set clip bounds larger than that of its parent,
2859    /// it will be clipped to the parent's clip bounds. The default state is for a transform
2860    /// to be unclipped, meaning it will not have any bounds placed on its render region.
2861    /// The clip width/height must be positive. Negative values will result in an error.
2862    /// Passing in an empty box to the |rect| parameter will remove the clip bounds.
2863    pub fn r#set_clip_boundary(
2864        &self,
2865        mut transform_id: &TransformId,
2866        mut rect: Option<&fidl_fuchsia_math::Rect>,
2867    ) -> Result<(), fidl::Error> {
2868        FlatlandProxyInterface::r#set_clip_boundary(self, transform_id, rect)
2869    }
2870
2871    /// Adds a child Transform to a parent Transform. The new child Transform,
2872    /// and any Content attached to it or its children, will be rendered on top
2873    /// of the parent's Content, as well as any previously added children.
2874    ///
2875    /// The caller must ensure that `child_transform_id` is valid and that there
2876    /// are no repetitions.  Sending a repeated `child_transform_id` over
2877    /// multiple calls will result in session closure.
2878    pub fn r#add_child(
2879        &self,
2880        mut parent_transform_id: &TransformId,
2881        mut child_transform_id: &TransformId,
2882    ) -> Result<(), fidl::Error> {
2883        FlatlandProxyInterface::r#add_child(self, parent_transform_id, child_transform_id)
2884    }
2885
2886    /// Removes a child Transform from a parent Transform.
2887    pub fn r#remove_child(
2888        &self,
2889        mut parent_transform_id: &TransformId,
2890        mut child_transform_id: &TransformId,
2891    ) -> Result<(), fidl::Error> {
2892        FlatlandProxyInterface::r#remove_child(self, parent_transform_id, child_transform_id)
2893    }
2894
2895    /// Removes all child Transforms from a parent Transform and replaces them
2896    /// with the new child transforms in `new_child_transform_ids`.  The caller
2897    /// must ensure that all `TransformId` values in `new_child_transform_ids`
2898    /// are valid and that there are no repetitions.  Sending a repeated
2899    /// `TransformId` in `new_child_transform_ids` will result in session
2900    /// closure.
2901    pub fn r#replace_children(
2902        &self,
2903        mut parent_transform_id: &TransformId,
2904        mut new_child_transform_ids: &[TransformId],
2905    ) -> Result<(), fidl::Error> {
2906        FlatlandProxyInterface::r#replace_children(
2907            self,
2908            parent_transform_id,
2909            new_child_transform_ids,
2910        )
2911    }
2912
2913    /// Sets the Root Transform for the graph.
2914    ///
2915    /// The sub-graph defined by the Root Transform and its children will be rendered as View
2916    /// in the connected parent's Viewport (see [`CreateView`]). Any parents of the Root Transform
2917    /// in this Graph will be ignored.
2918    ///
2919    /// The Root Transform, and all children of the Root Transform, are kept alive if they are
2920    /// released (see [`ReleaseTransform`] for more details).
2921    ///
2922    /// There is only ever one Root. Since 0 is not a valid transform id (see [`CreateTransform`]),
2923    /// calling SetRootTransform(0) clears the current Root, destroying any previously released
2924    /// objects that are not referenced by the new root.
2925    ///
2926    /// Note that every View has a clip boundary equivalent to its logical size. Anything outside
2927    /// that clip boundary will not be rendered. Hence, the Root Transform has a useful coordinate
2928    /// space of (0, 0) to (logical_size.width, logical_size.height), where (0, 0) is the upper left
2929    /// corner.
2930    ///
2931    /// Setting the root transform installs a full screen hit region on the root transform. Clients
2932    /// may remove this hit region if they don't want users to be able to interact with the root
2933    /// transform's content. For additional details on hit regions, see the [`SetHitRegions`]
2934    /// documentation.
2935    ///
2936    /// Default hit region rules
2937    ///
2938    ///   A default hit region follows these rules:
2939    ///   - When [`SetRootTransform`](T) is called, T receives a maximal hit region, covering the
2940    ///   entire view.
2941    ///   - If [`SetHitRegions`] is called on T, either before or after [`SetRootTransform`](T),
2942    ///   then no default hit region is active and the client specified hit regions are used.
2943    ///   - If a transform is no longer the root transform, i.e., [`SetRootTransform`](U) is
2944    ///   called, then the original transform no longer has its default hit region.
2945    ///   - Clients can remove or modify the root transform's hit regions the same way they would
2946    ///   reset any other transform's hit regions, by calling [`SetHitRegions`] with the appropriate
2947    ///   vector.
2948    pub fn r#set_root_transform(&self, mut transform_id: &TransformId) -> Result<(), fidl::Error> {
2949        FlatlandProxyInterface::r#set_root_transform(self, transform_id)
2950    }
2951
2952    /// Sets the interactive areas for a Transform. By default, Content is not interactive; hit
2953    /// regions must be placed for a user to interact with the Content in a View. Because hit
2954    /// regions are described in the Flatland protocol, a Flatland instance can synchronize Content
2955    /// and hit regions.
2956    ///
2957    /// Each hit region is placed in the coordinate space of the owning Transform, and may or may
2958    /// not interact with different types of hit testing, depending on its [`HitTestInteraction`]
2959    /// type. When there are multiple hit regions that intersect with a hit test, the precedence
2960    /// rules given below dictate which hit region has interacted with the hit test. Only Transforms
2961    /// that transitively connect to the root Transform have their hit regions interact with a hit
2962    /// test.
2963    ///
2964    /// Calling this function replaces any previous values set on this Transform. To reset a
2965    /// Transform to "no hit testing": send an empty vector with [`SetHitRegions`].
2966    ///
2967    /// Note that root transforms get a default hit region installed by Flatland. For more details,
2968    /// see the [`SetRootTransform`] documentation.
2969    ///
2970    /// Precedence rules
2971    ///   Within a Transform, if multiple hit regions overlap, the hit test examines each
2972    ///   intersecting hit region for a possible interaction. Thus, for a regular hit test R and an
2973    ///   accessibility hit test A, where R and A both intersect two hit regions D ([`DEFAULT`]) and
2974    ///   S ([`SEMANTICALLY_INVISIBLE`]) on the same Transform, (1) R interacts with both D and S,
2975    ///   and (2) A only interacts with D. Generally, hit regions that overlap in a single Transform
2976    ///   can cause confusing behavior.
2977    ///
2978    ///   Within a View, for a given hit test, the front-most Transform's hit regions take
2979    ///   precedence over those behind. This follows the expected reverse "render order" of
2980    ///   Transforms (described in [`CreateTransform`]), where a user expects to interact with
2981    ///   Content that is visible, or front-most.
2982    ///
2983    ///   Across Flatland instances, for a given hit test, the front-most instance's front-most
2984    ///   Transform's hit regions take precedence over those behind. This follows the expected
2985    ///   reverse "render order" of views, where a user expects to interact with the View that is
2986    ///   visible, or front-most. For example, if a child View owns Content that is rendered over
2987    ///   the parent View, the user expects to interact with the child's Content.
2988    pub fn r#set_hit_regions(
2989        &self,
2990        mut transform_id: &TransformId,
2991        mut regions: &[HitRegion],
2992    ) -> Result<(), fidl::Error> {
2993        FlatlandProxyInterface::r#set_hit_regions(self, transform_id, regions)
2994    }
2995
2996    /// Identical to [`SetHitRegions`], except the hit region associated with [`transform_id`]
2997    /// covers an infinite region. The hit region is invariant against translation, scaling, and
2998    /// orientation of the Transform.
2999    ///
3000    /// An infinite hit region is still limited in extent by the View's clip boundary, just like a
3001    /// finite hit region.
3002    ///
3003    /// Calling this function replaces any previous values set on this Transform. To reset a
3004    /// Transform to "no hit testing": send an empty vector with [`SetHitRegions`].
3005    pub fn r#set_infinite_hit_region(
3006        &self,
3007        mut transform_id: &TransformId,
3008        mut hit_test: HitTestInteraction,
3009    ) -> Result<(), fidl::Error> {
3010        FlatlandProxyInterface::r#set_infinite_hit_region(self, transform_id, hit_test)
3011    }
3012
3013    /// The Viewport and View pair, together, represent the connection between two Flatland
3014    /// instances. The Viewport is created in the parent, and the View is created in the child. The
3015    /// parent has control over how the child's View is integrated into its own View.
3016    ///
3017    /// Any illegal operations on ChildViewWatcher will cause both ChildViewWatcher channel and this
3018    /// Flatland channel to be torn down.
3019    ///
3020    /// `ViewportProperties` must have logical_size set. This is the initial size that will drive
3021    /// the layout of the child. The logical_size is also used as the default Content size, but
3022    /// subsequent changes to the logical_size will have no effect on the Content size.
3023    ///
3024    /// `ViewportProperties` may have inset field not set. In that case, the default value of
3025    /// (0, 0, 0, 0) is used.
3026    ///
3027    /// The logical_size must have positive X and Y components.
3028    ///
3029    /// Zero is not a valid ContentId. All other values are valid, assuming they are not already
3030    /// in use for another piece of Content (see [`ReleaseViewport`] for more details).
3031    ///
3032    /// Lifecycle note. The lifetime of the ChildViewWatcher channel is bound by the peer
3033    /// ViewCreationToken. When the ViewCreationToken dies, this ChildViewWatcher channel is
3034    /// destroyed.
3035    pub fn r#create_viewport(
3036        &self,
3037        mut viewport_id: &ContentId,
3038        mut token: fidl_fuchsia_ui_views::ViewportCreationToken,
3039        mut properties: &ViewportProperties,
3040        mut child_view_watcher: fidl::endpoints::ServerEnd<ChildViewWatcherMarker>,
3041    ) -> Result<(), fidl::Error> {
3042        FlatlandProxyInterface::r#create_viewport(
3043            self,
3044            viewport_id,
3045            token,
3046            properties,
3047            child_view_watcher,
3048        )
3049    }
3050
3051    /// An Image is a bitmap backed by a specific VMO in a BufferCollection.
3052    ///
3053    /// Image creation requires an allocated BufferCollection registered with Allocator. This
3054    /// function will fail unless all clients of the specified BufferCollection have set their
3055    /// constraints.
3056    ///
3057    /// The Image must reference a valid VMO index and must have ImageProperties that fall within
3058    /// the constraints specified by the backing BufferCollection (i.e. width and height within a
3059    /// valid range, etc.)
3060    ///
3061    /// Zero is not a valid Image id. All other values are valid, assuming they are not already in
3062    /// use for another piece of Content (see [`ReleaseImage`] for more details).
3063    pub fn r#create_image(
3064        &self,
3065        mut image_id: &ContentId,
3066        mut import_token: BufferCollectionImportToken,
3067        mut vmo_index: u32,
3068        mut properties: &ImageProperties,
3069    ) -> Result<(), fidl::Error> {
3070        FlatlandProxyInterface::r#create_image(self, image_id, import_token, vmo_index, properties)
3071    }
3072
3073    /// This function is used to determine the region (in texel space) of an image that will be used
3074    /// by Flatland when rendering. The image to be sampled is referenced by [`image_id`] and the
3075    /// sample region is specified by [`rect`] which itself is comprised of an origin point (x,y) as
3076    /// well as a width and height, in unnormalized coordinates. It is illegal to call this function
3077    /// on non-image content, or to sample a region outside of the texel space of the image. In
3078    /// other words, the region specifed by [`rect`] must not exceed the ranges (0, image_width) and
3079    /// (0, image_height). If (rect.x + rect.width > image_width) or (rect.y + rect.height >
3080    /// image_height) or if any of the values are negative, this will result in an error.
3081    ///
3082    /// If this method is not called, the default sample region is the rectangle with origin at
3083    /// (0, 0) and width and height set at ImageProperties from [`CreateImage`].
3084    pub fn r#set_image_sample_region(
3085        &self,
3086        mut image_id: &ContentId,
3087        mut rect: &fidl_fuchsia_math::RectF,
3088    ) -> Result<(), fidl::Error> {
3089        FlatlandProxyInterface::r#set_image_sample_region(self, image_id, rect)
3090    }
3091
3092    /// The content size for an Image is the size of the rectangle in the parent's logical
3093    /// coordinate space that the image occupies. This combined with the global translation of the
3094    /// transform it is attached to determines the size and location of where the content is
3095    /// rendered on the display.
3096    ///
3097    /// If this method is not called, the default image destination size is the width and height set
3098    /// at ImageProperties from [`CreateImage`]. The destination size will be affected by scaling if
3099    /// [`SetScale`] is used on the attached Transform or its parents.
3100    pub fn r#set_image_destination_size(
3101        &self,
3102        mut image_id: &ContentId,
3103        mut size: &fidl_fuchsia_math::SizeU,
3104    ) -> Result<(), fidl::Error> {
3105        FlatlandProxyInterface::r#set_image_destination_size(self, image_id, size)
3106    }
3107
3108    /// Determines the blend function to use when rendering the content specified by
3109    /// |image_id|. |image_id| must be a valid ContentId associated to a transform through
3110    /// a call to |CreateImage| or |CreateFilledRect|. For details on the different blend functions
3111    /// that are available, please refer to the BlendMode enum. If this function is not called, then
3112    /// the default blendmode is BlendMode::SRC.
3113    pub fn r#set_image_blending_function(
3114        &self,
3115        mut image_id: &ContentId,
3116        mut blend_mode: BlendMode,
3117    ) -> Result<(), fidl::Error> {
3118        FlatlandProxyInterface::r#set_image_blending_function(self, image_id, blend_mode)
3119    }
3120
3121    /// Determines the blend function to use when rendering the content specified by
3122    /// |image_id|. |image_id| must be a valid ContentId associated to a transform through
3123    /// a call to |CreateImage| or |CreateFilledRect|. For details on the different blend functions
3124    /// that are available, please refer to the BlendMode2 enum. If this function is not called,
3125    /// the default blendmode is BlendMode2::REPLACE.
3126    pub fn r#set_image_blend_mode(
3127        &self,
3128        mut image_id: &ContentId,
3129        mut blend_mode: BlendMode2,
3130    ) -> Result<(), fidl::Error> {
3131        FlatlandProxyInterface::r#set_image_blend_mode(self, image_id, blend_mode)
3132    }
3133
3134    /// Sets an opacity in linear space to be applied to a flatland image. Opacity values must
3135    /// be in the range [0.0, 1.0].
3136    pub fn r#set_image_opacity(
3137        &self,
3138        mut image_id: &ContentId,
3139        mut val: f32,
3140    ) -> Result<(), fidl::Error> {
3141        FlatlandProxyInterface::r#set_image_opacity(self, image_id, val)
3142    }
3143
3144    /// Sets the image flip to be applied to a flatland image. This call must be performed after a
3145    /// successful |CreateImage| call. If an invalid |image_id| is supplied, the channel will be
3146    /// closed due to FlatlandError::BAD_OPERATION. This flip will be applied to the Image before
3147    /// parent Transform Orientations. If this function is not called, then the default flip value
3148    /// is ImageFlip::NONE.
3149    pub fn r#set_image_flip(
3150        &self,
3151        mut image_id: &ContentId,
3152        mut flip: ImageFlip,
3153    ) -> Result<(), fidl::Error> {
3154        FlatlandProxyInterface::r#set_image_flip(self, image_id, flip)
3155    }
3156
3157    /// Creates a solid-color rectangle. By default a filled-rect does not have a defined
3158    /// color or size. It is necessary to call |SetSolidFill| to specify a color and size
3159    /// before a filled rect can be used for rendering. Not doing so will result the
3160    pub fn r#create_filled_rect(&self, mut rect_id: &ContentId) -> Result<(), fidl::Error> {
3161        FlatlandProxyInterface::r#create_filled_rect(self, rect_id)
3162    }
3163
3164    /// Defines the color and size of a filled rect. |rect_id| must refer to content that
3165    /// was created via a call to CreateFilledRect. The color is not premultiplied. Color values
3166    /// must be within the range [0,1] inclusive, and normal 32-bit
3167    /// floating point values: https://en.wikipedia.org/wiki/Normal_number_%28computing%29. Values
3168    /// that do not conform to these specifications will cause the channel to close.
3169    /// The rectangle's top left corner will be at (0, 0) in its transform's coordinate space.
3170    /// Hence, its bottom right corner will be at (size.width, size.height).
3171    pub fn r#set_solid_fill(
3172        &self,
3173        mut rect_id: &ContentId,
3174        mut color: &ColorRgba,
3175        mut size: &fidl_fuchsia_math::SizeU,
3176    ) -> Result<(), fidl::Error> {
3177        FlatlandProxyInterface::r#set_solid_fill(self, rect_id, color, size)
3178    }
3179
3180    /// Automatically garbage collects the rectangle when it is no longer needed for
3181    /// rendering. |rect_id| must have been instantiated with a call to
3182    /// |CreateFilledRect|. Once released, the ID immediately goes out of scope and is free
3183    /// to be used again.
3184    pub fn r#release_filled_rect(&self, mut rect_id: &ContentId) -> Result<(), fidl::Error> {
3185        FlatlandProxyInterface::r#release_filled_rect(self, rect_id)
3186    }
3187
3188    /// Setting a piece of Content on a Transform makes that Content visible in the render tree as
3189    /// long as the Transform is visible from the root Transform. The Content will be rendered
3190    /// before, and therefore "behind", any Content attached to the descendants of the Transform.
3191    ///
3192    /// Because each Transform can have, at most, a single piece of Content on it, calling this
3193    /// function on a Transform that already has Content will replace that Content.
3194    ///
3195    /// A Content may be set on more than one Transform.
3196    ///
3197    /// Calling this function with a Content id of 0 will remove any Content currently on the
3198    /// Transform.
3199    pub fn r#set_content(
3200        &self,
3201        mut transform_id: &TransformId,
3202        mut content_id: &ContentId,
3203    ) -> Result<(), fidl::Error> {
3204        FlatlandProxyInterface::r#set_content(self, transform_id, content_id)
3205    }
3206
3207    /// Transforms are usually sufficient to change how Content is presented. Viewports, however,
3208    /// have special properties that are not part of the Transform hierarchy. Those properties can
3209    /// be set using this function.
3210    pub fn r#set_viewport_properties(
3211        &self,
3212        mut viewport_id: &ContentId,
3213        mut properties: &ViewportProperties,
3214    ) -> Result<(), fidl::Error> {
3215        FlatlandProxyInterface::r#set_viewport_properties(self, viewport_id, properties)
3216    }
3217
3218    /// Released Transforms will be garbage collected by the system once they are no longer
3219    /// necessary for rendering. For Transforms, this means there is no path from any unreleased
3220    /// Transform to the newly-released Transform.
3221    ///
3222    /// Once released, the id immediately goes out of scope for future function calls and can be
3223    /// reused when creating new Transforms.
3224    ///
3225    /// It is an error to call functions with a released id (unless that id has been reused to
3226    /// construct a new Transform).
3227    pub fn r#release_transform(&self, mut transform_id: &TransformId) -> Result<(), fidl::Error> {
3228        FlatlandProxyInterface::r#release_transform(self, transform_id)
3229    }
3230
3231    pub fn r#release_view(&self) -> Result<(), fidl::Error> {
3232        FlatlandProxyInterface::r#release_view(self)
3233    }
3234
3235    /// Releases a Viewport from the scene, even if the Viewport is still connected to a Transform.
3236    /// Unlike other resources, Viewports are garbage collected by the system during the next
3237    /// [`Present`] because a removed Viewport is guaranteed to provide no renderable content.
3238    ///
3239    /// Use SetContent(transform_id, 0) to clean up references to released Viewports.
3240    ///
3241    /// Despite having a return type, this function is still feed-forward like [`CreateView`] and
3242    /// requires a call to [`Present`] to be executed. The ViewportCreationToken will be returned
3243    /// after the presented operations have been executed.
3244    pub fn r#release_viewport(
3245        &self,
3246        mut viewport_id: &ContentId,
3247    ) -> fidl::client::QueryResponseFut<
3248        fidl_fuchsia_ui_views::ViewportCreationToken,
3249        fidl::encoding::DefaultFuchsiaResourceDialect,
3250    > {
3251        FlatlandProxyInterface::r#release_viewport(self, viewport_id)
3252    }
3253
3254    /// Released Images will be garbage collected by the system once they are no longer necessary
3255    /// for rendering. For Images, this means the Image is no longer attached to any Transform and
3256    /// any pending rendering that references the Image is complete.
3257    ///
3258    /// Use SetContent(transform_id, 0) to clean up references to released Images.
3259    ///
3260    /// Once released, the id immediately goes out of scope for future function calls and can be
3261    /// reused when creating new Images.
3262    ///
3263    /// It is an error to call functions with a released id (unless that id has been reused to
3264    /// construct a new Image).
3265    pub fn r#release_image(&self, mut image_id: &ContentId) -> Result<(), fidl::Error> {
3266        FlatlandProxyInterface::r#release_image(self, image_id)
3267    }
3268
3269    /// This function will reset all state on this interface. This includes destroying all existing
3270    /// View and Viewports without returning the associated Token to the caller.
3271    pub fn r#clear(&self) -> Result<(), fidl::Error> {
3272        FlatlandProxyInterface::r#clear(self)
3273    }
3274
3275    /// Set debug name of the current client that can be used by Flatland to print as a prefix to
3276    /// logs to help client distinguish what is theirs. [`name`] can be an arbitrary string, but the
3277    /// current process name (see fsl::GetCurrentProcessName()) is a good default.
3278    pub fn r#set_debug_name(&self, mut name: &str) -> Result<(), fidl::Error> {
3279        FlatlandProxyInterface::r#set_debug_name(self, name)
3280    }
3281}
3282
3283impl FlatlandProxyInterface for FlatlandProxy {
3284    fn r#release_image_immediately(&self, mut image_id: &ContentId) -> Result<(), fidl::Error> {
3285        self.client.send::<TrustedFlatlandReleaseImageImmediatelyRequest>(
3286            (image_id,),
3287            0x245e1ac080772c8,
3288            fidl::encoding::DynamicFlags::empty(),
3289        )
3290    }
3291
3292    fn r#present(&self, mut args: PresentArgs) -> Result<(), fidl::Error> {
3293        self.client.send::<FlatlandPresentRequest>(
3294            (&mut args,),
3295            0x50acc2aa1f0acec7,
3296            fidl::encoding::DynamicFlags::empty(),
3297        )
3298    }
3299
3300    fn r#create_view(
3301        &self,
3302        mut token: fidl_fuchsia_ui_views::ViewCreationToken,
3303        mut parent_viewport_watcher: fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>,
3304    ) -> Result<(), fidl::Error> {
3305        self.client.send::<FlatlandCreateViewRequest>(
3306            (&mut token, parent_viewport_watcher),
3307            0x504686eb25864780,
3308            fidl::encoding::DynamicFlags::empty(),
3309        )
3310    }
3311
3312    fn r#create_view2(
3313        &self,
3314        mut token: fidl_fuchsia_ui_views::ViewCreationToken,
3315        mut view_identity: fidl_fuchsia_ui_views::ViewIdentityOnCreation,
3316        mut protocols: ViewBoundProtocols,
3317        mut parent_viewport_watcher: fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>,
3318    ) -> Result<(), fidl::Error> {
3319        self.client.send::<FlatlandCreateView2Request>(
3320            (&mut token, &mut view_identity, &mut protocols, parent_viewport_watcher),
3321            0x340a3a40c2fdbd5e,
3322            fidl::encoding::DynamicFlags::empty(),
3323        )
3324    }
3325
3326    fn r#create_transform(&self, mut transform_id: &TransformId) -> Result<(), fidl::Error> {
3327        self.client.send::<FlatlandCreateTransformRequest>(
3328            (transform_id,),
3329            0x5e042a4d3de3efb0,
3330            fidl::encoding::DynamicFlags::empty(),
3331        )
3332    }
3333
3334    fn r#set_translation(
3335        &self,
3336        mut transform_id: &TransformId,
3337        mut translation: &fidl_fuchsia_math::Vec_,
3338    ) -> Result<(), fidl::Error> {
3339        self.client.send::<FlatlandSetTranslationRequest>(
3340            (transform_id, translation),
3341            0x7863398291fba346,
3342            fidl::encoding::DynamicFlags::empty(),
3343        )
3344    }
3345
3346    fn r#set_orientation(
3347        &self,
3348        mut transform_id: &TransformId,
3349        mut orientation: Orientation,
3350    ) -> Result<(), fidl::Error> {
3351        self.client.send::<FlatlandSetOrientationRequest>(
3352            (transform_id, orientation),
3353            0x4915310bc4928edc,
3354            fidl::encoding::DynamicFlags::empty(),
3355        )
3356    }
3357
3358    fn r#set_scale(
3359        &self,
3360        mut transform_id: &TransformId,
3361        mut scale: &fidl_fuchsia_math::VecF,
3362    ) -> Result<(), fidl::Error> {
3363        self.client.send::<FlatlandSetScaleRequest>(
3364            (transform_id, scale),
3365            0x1ea1766fd8996bb4,
3366            fidl::encoding::DynamicFlags::empty(),
3367        )
3368    }
3369
3370    fn r#set_opacity(
3371        &self,
3372        mut transform_id: &TransformId,
3373        mut value: f32,
3374    ) -> Result<(), fidl::Error> {
3375        self.client.send::<FlatlandSetOpacityRequest>(
3376            (transform_id, value),
3377            0x3775fc2c00b432fa,
3378            fidl::encoding::DynamicFlags::empty(),
3379        )
3380    }
3381
3382    fn r#set_clip_boundary(
3383        &self,
3384        mut transform_id: &TransformId,
3385        mut rect: Option<&fidl_fuchsia_math::Rect>,
3386    ) -> Result<(), fidl::Error> {
3387        self.client.send::<FlatlandSetClipBoundaryRequest>(
3388            (transform_id, rect),
3389            0x6507843df12222d2,
3390            fidl::encoding::DynamicFlags::empty(),
3391        )
3392    }
3393
3394    fn r#add_child(
3395        &self,
3396        mut parent_transform_id: &TransformId,
3397        mut child_transform_id: &TransformId,
3398    ) -> Result<(), fidl::Error> {
3399        self.client.send::<FlatlandAddChildRequest>(
3400            (parent_transform_id, child_transform_id),
3401            0x67a8abd2f19b1a74,
3402            fidl::encoding::DynamicFlags::empty(),
3403        )
3404    }
3405
3406    fn r#remove_child(
3407        &self,
3408        mut parent_transform_id: &TransformId,
3409        mut child_transform_id: &TransformId,
3410    ) -> Result<(), fidl::Error> {
3411        self.client.send::<FlatlandRemoveChildRequest>(
3412            (parent_transform_id, child_transform_id),
3413            0x41d6cd90b298b67a,
3414            fidl::encoding::DynamicFlags::empty(),
3415        )
3416    }
3417
3418    fn r#replace_children(
3419        &self,
3420        mut parent_transform_id: &TransformId,
3421        mut new_child_transform_ids: &[TransformId],
3422    ) -> Result<(), fidl::Error> {
3423        self.client.send::<FlatlandReplaceChildrenRequest>(
3424            (parent_transform_id, new_child_transform_ids),
3425            0x5b6d86cbbff81316,
3426            fidl::encoding::DynamicFlags::empty(),
3427        )
3428    }
3429
3430    fn r#set_root_transform(&self, mut transform_id: &TransformId) -> Result<(), fidl::Error> {
3431        self.client.send::<FlatlandSetRootTransformRequest>(
3432            (transform_id,),
3433            0x6e80ca5bcc566cd8,
3434            fidl::encoding::DynamicFlags::empty(),
3435        )
3436    }
3437
3438    fn r#set_hit_regions(
3439        &self,
3440        mut transform_id: &TransformId,
3441        mut regions: &[HitRegion],
3442    ) -> Result<(), fidl::Error> {
3443        self.client.send::<FlatlandSetHitRegionsRequest>(
3444            (transform_id, regions),
3445            0x31c9d17b07c37ce4,
3446            fidl::encoding::DynamicFlags::empty(),
3447        )
3448    }
3449
3450    fn r#set_infinite_hit_region(
3451        &self,
3452        mut transform_id: &TransformId,
3453        mut hit_test: HitTestInteraction,
3454    ) -> Result<(), fidl::Error> {
3455        self.client.send::<FlatlandSetInfiniteHitRegionRequest>(
3456            (transform_id, hit_test),
3457            0x26d81af852d29562,
3458            fidl::encoding::DynamicFlags::empty(),
3459        )
3460    }
3461
3462    fn r#create_viewport(
3463        &self,
3464        mut viewport_id: &ContentId,
3465        mut token: fidl_fuchsia_ui_views::ViewportCreationToken,
3466        mut properties: &ViewportProperties,
3467        mut child_view_watcher: fidl::endpoints::ServerEnd<ChildViewWatcherMarker>,
3468    ) -> Result<(), fidl::Error> {
3469        self.client.send::<FlatlandCreateViewportRequest>(
3470            (viewport_id, &mut token, properties, child_view_watcher),
3471            0x2485fbcab7f943c,
3472            fidl::encoding::DynamicFlags::empty(),
3473        )
3474    }
3475
3476    fn r#create_image(
3477        &self,
3478        mut image_id: &ContentId,
3479        mut import_token: BufferCollectionImportToken,
3480        mut vmo_index: u32,
3481        mut properties: &ImageProperties,
3482    ) -> Result<(), fidl::Error> {
3483        self.client.send::<FlatlandCreateImageRequest>(
3484            (image_id, &mut import_token, vmo_index, properties),
3485            0x26fae823c4ebedad,
3486            fidl::encoding::DynamicFlags::empty(),
3487        )
3488    }
3489
3490    fn r#set_image_sample_region(
3491        &self,
3492        mut image_id: &ContentId,
3493        mut rect: &fidl_fuchsia_math::RectF,
3494    ) -> Result<(), fidl::Error> {
3495        self.client.send::<FlatlandSetImageSampleRegionRequest>(
3496            (image_id, rect),
3497            0x8039391d715eb28,
3498            fidl::encoding::DynamicFlags::empty(),
3499        )
3500    }
3501
3502    fn r#set_image_destination_size(
3503        &self,
3504        mut image_id: &ContentId,
3505        mut size: &fidl_fuchsia_math::SizeU,
3506    ) -> Result<(), fidl::Error> {
3507        self.client.send::<FlatlandSetImageDestinationSizeRequest>(
3508            (image_id, size),
3509            0x766cf99a2ec58446,
3510            fidl::encoding::DynamicFlags::empty(),
3511        )
3512    }
3513
3514    fn r#set_image_blending_function(
3515        &self,
3516        mut image_id: &ContentId,
3517        mut blend_mode: BlendMode,
3518    ) -> Result<(), fidl::Error> {
3519        self.client.send::<FlatlandSetImageBlendingFunctionRequest>(
3520            (image_id, blend_mode),
3521            0x10f5da1356275b7b,
3522            fidl::encoding::DynamicFlags::empty(),
3523        )
3524    }
3525
3526    fn r#set_image_blend_mode(
3527        &self,
3528        mut image_id: &ContentId,
3529        mut blend_mode: BlendMode2,
3530    ) -> Result<(), fidl::Error> {
3531        self.client.send::<FlatlandSetImageBlendModeRequest>(
3532            (image_id, blend_mode),
3533            0x5b1667f130c3de67,
3534            fidl::encoding::DynamicFlags::empty(),
3535        )
3536    }
3537
3538    fn r#set_image_opacity(
3539        &self,
3540        mut image_id: &ContentId,
3541        mut val: f32,
3542    ) -> Result<(), fidl::Error> {
3543        self.client.send::<FlatlandSetImageOpacityRequest>(
3544            (image_id, val),
3545            0x2da9e4ef4c2cff6f,
3546            fidl::encoding::DynamicFlags::empty(),
3547        )
3548    }
3549
3550    fn r#set_image_flip(
3551        &self,
3552        mut image_id: &ContentId,
3553        mut flip: ImageFlip,
3554    ) -> Result<(), fidl::Error> {
3555        self.client.send::<FlatlandSetImageFlipRequest>(
3556            (image_id, flip),
3557            0x21b20f2c14aae6bc,
3558            fidl::encoding::DynamicFlags::empty(),
3559        )
3560    }
3561
3562    fn r#create_filled_rect(&self, mut rect_id: &ContentId) -> Result<(), fidl::Error> {
3563        self.client.send::<FlatlandCreateFilledRectRequest>(
3564            (rect_id,),
3565            0x5e62355abc1c4c5d,
3566            fidl::encoding::DynamicFlags::empty(),
3567        )
3568    }
3569
3570    fn r#set_solid_fill(
3571        &self,
3572        mut rect_id: &ContentId,
3573        mut color: &ColorRgba,
3574        mut size: &fidl_fuchsia_math::SizeU,
3575    ) -> Result<(), fidl::Error> {
3576        self.client.send::<FlatlandSetSolidFillRequest>(
3577            (rect_id, color, size),
3578            0x32d6ef41e182dfa5,
3579            fidl::encoding::DynamicFlags::empty(),
3580        )
3581    }
3582
3583    fn r#release_filled_rect(&self, mut rect_id: &ContentId) -> Result<(), fidl::Error> {
3584        self.client.send::<FlatlandReleaseFilledRectRequest>(
3585            (rect_id,),
3586            0x7392cabe45618f9b,
3587            fidl::encoding::DynamicFlags::empty(),
3588        )
3589    }
3590
3591    fn r#set_content(
3592        &self,
3593        mut transform_id: &TransformId,
3594        mut content_id: &ContentId,
3595    ) -> Result<(), fidl::Error> {
3596        self.client.send::<FlatlandSetContentRequest>(
3597            (transform_id, content_id),
3598            0x4ed2cfc0ce130862,
3599            fidl::encoding::DynamicFlags::empty(),
3600        )
3601    }
3602
3603    fn r#set_viewport_properties(
3604        &self,
3605        mut viewport_id: &ContentId,
3606        mut properties: &ViewportProperties,
3607    ) -> Result<(), fidl::Error> {
3608        self.client.send::<FlatlandSetViewportPropertiesRequest>(
3609            (viewport_id, properties),
3610            0x66ab67e9608ddb9f,
3611            fidl::encoding::DynamicFlags::empty(),
3612        )
3613    }
3614
3615    fn r#release_transform(&self, mut transform_id: &TransformId) -> Result<(), fidl::Error> {
3616        self.client.send::<FlatlandReleaseTransformRequest>(
3617            (transform_id,),
3618            0xab9328419451c22,
3619            fidl::encoding::DynamicFlags::empty(),
3620        )
3621    }
3622
3623    fn r#release_view(&self) -> Result<(), fidl::Error> {
3624        self.client.send::<fidl::encoding::EmptyPayload>(
3625            (),
3626            0x5b35aab9baffecae,
3627            fidl::encoding::DynamicFlags::empty(),
3628        )
3629    }
3630
3631    type ReleaseViewportResponseFut = fidl::client::QueryResponseFut<
3632        fidl_fuchsia_ui_views::ViewportCreationToken,
3633        fidl::encoding::DefaultFuchsiaResourceDialect,
3634    >;
3635    fn r#release_viewport(&self, mut viewport_id: &ContentId) -> Self::ReleaseViewportResponseFut {
3636        fn _decode(
3637            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3638        ) -> Result<fidl_fuchsia_ui_views::ViewportCreationToken, fidl::Error> {
3639            let _response = fidl::client::decode_transaction_body::<
3640                FlatlandReleaseViewportResponse,
3641                fidl::encoding::DefaultFuchsiaResourceDialect,
3642                0xbad474aeb5293f9,
3643            >(_buf?)?;
3644            Ok(_response.token)
3645        }
3646        self.client.send_query_and_decode::<
3647            FlatlandReleaseViewportRequest,
3648            fidl_fuchsia_ui_views::ViewportCreationToken,
3649        >(
3650            (viewport_id,),
3651            0xbad474aeb5293f9,
3652            fidl::encoding::DynamicFlags::empty(),
3653            _decode,
3654        )
3655    }
3656
3657    fn r#release_image(&self, mut image_id: &ContentId) -> Result<(), fidl::Error> {
3658        self.client.send::<FlatlandReleaseImageRequest>(
3659            (image_id,),
3660            0xb884ffdbc72c111,
3661            fidl::encoding::DynamicFlags::empty(),
3662        )
3663    }
3664
3665    fn r#clear(&self) -> Result<(), fidl::Error> {
3666        self.client.send::<fidl::encoding::EmptyPayload>(
3667            (),
3668            0x4ec8817c02828c3e,
3669            fidl::encoding::DynamicFlags::empty(),
3670        )
3671    }
3672
3673    fn r#set_debug_name(&self, mut name: &str) -> Result<(), fidl::Error> {
3674        self.client.send::<FlatlandSetDebugNameRequest>(
3675            (name,),
3676            0x46a8b397e68a8888,
3677            fidl::encoding::DynamicFlags::empty(),
3678        )
3679    }
3680}
3681
3682pub struct FlatlandEventStream {
3683    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
3684}
3685
3686impl std::marker::Unpin for FlatlandEventStream {}
3687
3688impl futures::stream::FusedStream for FlatlandEventStream {
3689    fn is_terminated(&self) -> bool {
3690        self.event_receiver.is_terminated()
3691    }
3692}
3693
3694impl futures::Stream for FlatlandEventStream {
3695    type Item = Result<FlatlandEvent, fidl::Error>;
3696
3697    fn poll_next(
3698        mut self: std::pin::Pin<&mut Self>,
3699        cx: &mut std::task::Context<'_>,
3700    ) -> std::task::Poll<Option<Self::Item>> {
3701        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
3702            &mut self.event_receiver,
3703            cx
3704        )?) {
3705            Some(buf) => std::task::Poll::Ready(Some(FlatlandEvent::decode(buf))),
3706            None => std::task::Poll::Ready(None),
3707        }
3708    }
3709}
3710
3711#[derive(Debug)]
3712pub enum FlatlandEvent {
3713    OnNextFrameBegin { values: OnNextFrameBeginValues },
3714    OnFramePresented { frame_presented_info: fidl_fuchsia_scenic_scheduling::FramePresentedInfo },
3715    OnError { error: FlatlandError },
3716}
3717
3718impl FlatlandEvent {
3719    #[allow(irrefutable_let_patterns)]
3720    pub fn into_on_next_frame_begin(self) -> Option<OnNextFrameBeginValues> {
3721        if let FlatlandEvent::OnNextFrameBegin { values } = self { Some((values)) } else { None }
3722    }
3723    #[allow(irrefutable_let_patterns)]
3724    pub fn into_on_frame_presented(
3725        self,
3726    ) -> Option<fidl_fuchsia_scenic_scheduling::FramePresentedInfo> {
3727        if let FlatlandEvent::OnFramePresented { frame_presented_info } = self {
3728            Some((frame_presented_info))
3729        } else {
3730            None
3731        }
3732    }
3733    #[allow(irrefutable_let_patterns)]
3734    pub fn into_on_error(self) -> Option<FlatlandError> {
3735        if let FlatlandEvent::OnError { error } = self { Some((error)) } else { None }
3736    }
3737
3738    /// Decodes a message buffer as a [`FlatlandEvent`].
3739    fn decode(
3740        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3741    ) -> Result<FlatlandEvent, fidl::Error> {
3742        let (bytes, _handles) = buf.split_mut();
3743        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3744        debug_assert_eq!(tx_header.tx_id, 0);
3745        match tx_header.ordinal {
3746            0x10f69a5cdeece84a => {
3747                let mut out = fidl::new_empty!(
3748                    FlatlandOnNextFrameBeginRequest,
3749                    fidl::encoding::DefaultFuchsiaResourceDialect
3750                );
3751                fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandOnNextFrameBeginRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
3752                Ok((FlatlandEvent::OnNextFrameBegin { values: out.values }))
3753            }
3754            0x56e43e1a5f30216d => {
3755                let mut out = fidl::new_empty!(
3756                    FlatlandOnFramePresentedRequest,
3757                    fidl::encoding::DefaultFuchsiaResourceDialect
3758                );
3759                fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandOnFramePresentedRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
3760                Ok((FlatlandEvent::OnFramePresented {
3761                    frame_presented_info: out.frame_presented_info,
3762                }))
3763            }
3764            0x1ebf39e90cd8b8d => {
3765                let mut out = fidl::new_empty!(
3766                    FlatlandOnErrorRequest,
3767                    fidl::encoding::DefaultFuchsiaResourceDialect
3768                );
3769                fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandOnErrorRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
3770                Ok((FlatlandEvent::OnError { error: out.error }))
3771            }
3772            _ => Err(fidl::Error::UnknownOrdinal {
3773                ordinal: tx_header.ordinal,
3774                protocol_name: <FlatlandMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3775            }),
3776        }
3777    }
3778}
3779
3780/// A Stream of incoming requests for fuchsia.ui.composition/Flatland.
3781pub struct FlatlandRequestStream {
3782    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3783    is_terminated: bool,
3784}
3785
3786impl std::marker::Unpin for FlatlandRequestStream {}
3787
3788impl futures::stream::FusedStream for FlatlandRequestStream {
3789    fn is_terminated(&self) -> bool {
3790        self.is_terminated
3791    }
3792}
3793
3794impl fidl::endpoints::RequestStream for FlatlandRequestStream {
3795    type Protocol = FlatlandMarker;
3796    type ControlHandle = FlatlandControlHandle;
3797
3798    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
3799        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3800    }
3801
3802    fn control_handle(&self) -> Self::ControlHandle {
3803        FlatlandControlHandle { inner: self.inner.clone() }
3804    }
3805
3806    fn into_inner(
3807        self,
3808    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3809    {
3810        (self.inner, self.is_terminated)
3811    }
3812
3813    fn from_inner(
3814        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3815        is_terminated: bool,
3816    ) -> Self {
3817        Self { inner, is_terminated }
3818    }
3819}
3820
3821impl futures::Stream for FlatlandRequestStream {
3822    type Item = Result<FlatlandRequest, fidl::Error>;
3823
3824    fn poll_next(
3825        mut self: std::pin::Pin<&mut Self>,
3826        cx: &mut std::task::Context<'_>,
3827    ) -> std::task::Poll<Option<Self::Item>> {
3828        let this = &mut *self;
3829        if this.inner.check_shutdown(cx) {
3830            this.is_terminated = true;
3831            return std::task::Poll::Ready(None);
3832        }
3833        if this.is_terminated {
3834            panic!("polled FlatlandRequestStream after completion");
3835        }
3836        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3837            |bytes, handles| {
3838                match this.inner.channel().read_etc(cx, bytes, handles) {
3839                    std::task::Poll::Ready(Ok(())) => {}
3840                    std::task::Poll::Pending => return std::task::Poll::Pending,
3841                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3842                        this.is_terminated = true;
3843                        return std::task::Poll::Ready(None);
3844                    }
3845                    std::task::Poll::Ready(Err(e)) => {
3846                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3847                            e.into(),
3848                        ))));
3849                    }
3850                }
3851
3852                // A message has been received from the channel
3853                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3854
3855                std::task::Poll::Ready(Some(match header.ordinal {
3856                    0x245e1ac080772c8 => {
3857                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3858                        let mut req = fidl::new_empty!(
3859                            TrustedFlatlandReleaseImageImmediatelyRequest,
3860                            fidl::encoding::DefaultFuchsiaResourceDialect
3861                        );
3862                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<TrustedFlatlandReleaseImageImmediatelyRequest>(&header, _body_bytes, handles, &mut req)?;
3863                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
3864                        Ok(FlatlandRequest::ReleaseImageImmediately {
3865                            image_id: req.image_id,
3866
3867                            control_handle,
3868                        })
3869                    }
3870                    0x50acc2aa1f0acec7 => {
3871                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3872                        let mut req = fidl::new_empty!(
3873                            FlatlandPresentRequest,
3874                            fidl::encoding::DefaultFuchsiaResourceDialect
3875                        );
3876                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandPresentRequest>(&header, _body_bytes, handles, &mut req)?;
3877                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
3878                        Ok(FlatlandRequest::Present { args: req.args, control_handle })
3879                    }
3880                    0x504686eb25864780 => {
3881                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3882                        let mut req = fidl::new_empty!(
3883                            FlatlandCreateViewRequest,
3884                            fidl::encoding::DefaultFuchsiaResourceDialect
3885                        );
3886                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandCreateViewRequest>(&header, _body_bytes, handles, &mut req)?;
3887                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
3888                        Ok(FlatlandRequest::CreateView {
3889                            token: req.token,
3890                            parent_viewport_watcher: req.parent_viewport_watcher,
3891
3892                            control_handle,
3893                        })
3894                    }
3895                    0x340a3a40c2fdbd5e => {
3896                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3897                        let mut req = fidl::new_empty!(
3898                            FlatlandCreateView2Request,
3899                            fidl::encoding::DefaultFuchsiaResourceDialect
3900                        );
3901                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandCreateView2Request>(&header, _body_bytes, handles, &mut req)?;
3902                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
3903                        Ok(FlatlandRequest::CreateView2 {
3904                            token: req.token,
3905                            view_identity: req.view_identity,
3906                            protocols: req.protocols,
3907                            parent_viewport_watcher: req.parent_viewport_watcher,
3908
3909                            control_handle,
3910                        })
3911                    }
3912                    0x5e042a4d3de3efb0 => {
3913                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3914                        let mut req = fidl::new_empty!(
3915                            FlatlandCreateTransformRequest,
3916                            fidl::encoding::DefaultFuchsiaResourceDialect
3917                        );
3918                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandCreateTransformRequest>(&header, _body_bytes, handles, &mut req)?;
3919                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
3920                        Ok(FlatlandRequest::CreateTransform {
3921                            transform_id: req.transform_id,
3922
3923                            control_handle,
3924                        })
3925                    }
3926                    0x7863398291fba346 => {
3927                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3928                        let mut req = fidl::new_empty!(
3929                            FlatlandSetTranslationRequest,
3930                            fidl::encoding::DefaultFuchsiaResourceDialect
3931                        );
3932                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetTranslationRequest>(&header, _body_bytes, handles, &mut req)?;
3933                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
3934                        Ok(FlatlandRequest::SetTranslation {
3935                            transform_id: req.transform_id,
3936                            translation: req.translation,
3937
3938                            control_handle,
3939                        })
3940                    }
3941                    0x4915310bc4928edc => {
3942                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3943                        let mut req = fidl::new_empty!(
3944                            FlatlandSetOrientationRequest,
3945                            fidl::encoding::DefaultFuchsiaResourceDialect
3946                        );
3947                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetOrientationRequest>(&header, _body_bytes, handles, &mut req)?;
3948                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
3949                        Ok(FlatlandRequest::SetOrientation {
3950                            transform_id: req.transform_id,
3951                            orientation: req.orientation,
3952
3953                            control_handle,
3954                        })
3955                    }
3956                    0x1ea1766fd8996bb4 => {
3957                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3958                        let mut req = fidl::new_empty!(
3959                            FlatlandSetScaleRequest,
3960                            fidl::encoding::DefaultFuchsiaResourceDialect
3961                        );
3962                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetScaleRequest>(&header, _body_bytes, handles, &mut req)?;
3963                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
3964                        Ok(FlatlandRequest::SetScale {
3965                            transform_id: req.transform_id,
3966                            scale: req.scale,
3967
3968                            control_handle,
3969                        })
3970                    }
3971                    0x3775fc2c00b432fa => {
3972                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3973                        let mut req = fidl::new_empty!(
3974                            FlatlandSetOpacityRequest,
3975                            fidl::encoding::DefaultFuchsiaResourceDialect
3976                        );
3977                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetOpacityRequest>(&header, _body_bytes, handles, &mut req)?;
3978                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
3979                        Ok(FlatlandRequest::SetOpacity {
3980                            transform_id: req.transform_id,
3981                            value: req.value,
3982
3983                            control_handle,
3984                        })
3985                    }
3986                    0x6507843df12222d2 => {
3987                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3988                        let mut req = fidl::new_empty!(
3989                            FlatlandSetClipBoundaryRequest,
3990                            fidl::encoding::DefaultFuchsiaResourceDialect
3991                        );
3992                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetClipBoundaryRequest>(&header, _body_bytes, handles, &mut req)?;
3993                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
3994                        Ok(FlatlandRequest::SetClipBoundary {
3995                            transform_id: req.transform_id,
3996                            rect: req.rect,
3997
3998                            control_handle,
3999                        })
4000                    }
4001                    0x67a8abd2f19b1a74 => {
4002                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4003                        let mut req = fidl::new_empty!(
4004                            FlatlandAddChildRequest,
4005                            fidl::encoding::DefaultFuchsiaResourceDialect
4006                        );
4007                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandAddChildRequest>(&header, _body_bytes, handles, &mut req)?;
4008                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4009                        Ok(FlatlandRequest::AddChild {
4010                            parent_transform_id: req.parent_transform_id,
4011                            child_transform_id: req.child_transform_id,
4012
4013                            control_handle,
4014                        })
4015                    }
4016                    0x41d6cd90b298b67a => {
4017                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4018                        let mut req = fidl::new_empty!(
4019                            FlatlandRemoveChildRequest,
4020                            fidl::encoding::DefaultFuchsiaResourceDialect
4021                        );
4022                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandRemoveChildRequest>(&header, _body_bytes, handles, &mut req)?;
4023                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4024                        Ok(FlatlandRequest::RemoveChild {
4025                            parent_transform_id: req.parent_transform_id,
4026                            child_transform_id: req.child_transform_id,
4027
4028                            control_handle,
4029                        })
4030                    }
4031                    0x5b6d86cbbff81316 => {
4032                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4033                        let mut req = fidl::new_empty!(
4034                            FlatlandReplaceChildrenRequest,
4035                            fidl::encoding::DefaultFuchsiaResourceDialect
4036                        );
4037                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandReplaceChildrenRequest>(&header, _body_bytes, handles, &mut req)?;
4038                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4039                        Ok(FlatlandRequest::ReplaceChildren {
4040                            parent_transform_id: req.parent_transform_id,
4041                            new_child_transform_ids: req.new_child_transform_ids,
4042
4043                            control_handle,
4044                        })
4045                    }
4046                    0x6e80ca5bcc566cd8 => {
4047                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4048                        let mut req = fidl::new_empty!(
4049                            FlatlandSetRootTransformRequest,
4050                            fidl::encoding::DefaultFuchsiaResourceDialect
4051                        );
4052                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetRootTransformRequest>(&header, _body_bytes, handles, &mut req)?;
4053                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4054                        Ok(FlatlandRequest::SetRootTransform {
4055                            transform_id: req.transform_id,
4056
4057                            control_handle,
4058                        })
4059                    }
4060                    0x31c9d17b07c37ce4 => {
4061                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4062                        let mut req = fidl::new_empty!(
4063                            FlatlandSetHitRegionsRequest,
4064                            fidl::encoding::DefaultFuchsiaResourceDialect
4065                        );
4066                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetHitRegionsRequest>(&header, _body_bytes, handles, &mut req)?;
4067                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4068                        Ok(FlatlandRequest::SetHitRegions {
4069                            transform_id: req.transform_id,
4070                            regions: req.regions,
4071
4072                            control_handle,
4073                        })
4074                    }
4075                    0x26d81af852d29562 => {
4076                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4077                        let mut req = fidl::new_empty!(
4078                            FlatlandSetInfiniteHitRegionRequest,
4079                            fidl::encoding::DefaultFuchsiaResourceDialect
4080                        );
4081                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetInfiniteHitRegionRequest>(&header, _body_bytes, handles, &mut req)?;
4082                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4083                        Ok(FlatlandRequest::SetInfiniteHitRegion {
4084                            transform_id: req.transform_id,
4085                            hit_test: req.hit_test,
4086
4087                            control_handle,
4088                        })
4089                    }
4090                    0x2485fbcab7f943c => {
4091                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4092                        let mut req = fidl::new_empty!(
4093                            FlatlandCreateViewportRequest,
4094                            fidl::encoding::DefaultFuchsiaResourceDialect
4095                        );
4096                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandCreateViewportRequest>(&header, _body_bytes, handles, &mut req)?;
4097                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4098                        Ok(FlatlandRequest::CreateViewport {
4099                            viewport_id: req.viewport_id,
4100                            token: req.token,
4101                            properties: req.properties,
4102                            child_view_watcher: req.child_view_watcher,
4103
4104                            control_handle,
4105                        })
4106                    }
4107                    0x26fae823c4ebedad => {
4108                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4109                        let mut req = fidl::new_empty!(
4110                            FlatlandCreateImageRequest,
4111                            fidl::encoding::DefaultFuchsiaResourceDialect
4112                        );
4113                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandCreateImageRequest>(&header, _body_bytes, handles, &mut req)?;
4114                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4115                        Ok(FlatlandRequest::CreateImage {
4116                            image_id: req.image_id,
4117                            import_token: req.import_token,
4118                            vmo_index: req.vmo_index,
4119                            properties: req.properties,
4120
4121                            control_handle,
4122                        })
4123                    }
4124                    0x8039391d715eb28 => {
4125                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4126                        let mut req = fidl::new_empty!(
4127                            FlatlandSetImageSampleRegionRequest,
4128                            fidl::encoding::DefaultFuchsiaResourceDialect
4129                        );
4130                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetImageSampleRegionRequest>(&header, _body_bytes, handles, &mut req)?;
4131                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4132                        Ok(FlatlandRequest::SetImageSampleRegion {
4133                            image_id: req.image_id,
4134                            rect: req.rect,
4135
4136                            control_handle,
4137                        })
4138                    }
4139                    0x766cf99a2ec58446 => {
4140                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4141                        let mut req = fidl::new_empty!(
4142                            FlatlandSetImageDestinationSizeRequest,
4143                            fidl::encoding::DefaultFuchsiaResourceDialect
4144                        );
4145                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetImageDestinationSizeRequest>(&header, _body_bytes, handles, &mut req)?;
4146                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4147                        Ok(FlatlandRequest::SetImageDestinationSize {
4148                            image_id: req.image_id,
4149                            size: req.size,
4150
4151                            control_handle,
4152                        })
4153                    }
4154                    0x10f5da1356275b7b => {
4155                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4156                        let mut req = fidl::new_empty!(
4157                            FlatlandSetImageBlendingFunctionRequest,
4158                            fidl::encoding::DefaultFuchsiaResourceDialect
4159                        );
4160                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetImageBlendingFunctionRequest>(&header, _body_bytes, handles, &mut req)?;
4161                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4162                        Ok(FlatlandRequest::SetImageBlendingFunction {
4163                            image_id: req.image_id,
4164                            blend_mode: req.blend_mode,
4165
4166                            control_handle,
4167                        })
4168                    }
4169                    0x5b1667f130c3de67 => {
4170                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4171                        let mut req = fidl::new_empty!(
4172                            FlatlandSetImageBlendModeRequest,
4173                            fidl::encoding::DefaultFuchsiaResourceDialect
4174                        );
4175                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetImageBlendModeRequest>(&header, _body_bytes, handles, &mut req)?;
4176                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4177                        Ok(FlatlandRequest::SetImageBlendMode {
4178                            image_id: req.image_id,
4179                            blend_mode: req.blend_mode,
4180
4181                            control_handle,
4182                        })
4183                    }
4184                    0x2da9e4ef4c2cff6f => {
4185                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4186                        let mut req = fidl::new_empty!(
4187                            FlatlandSetImageOpacityRequest,
4188                            fidl::encoding::DefaultFuchsiaResourceDialect
4189                        );
4190                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetImageOpacityRequest>(&header, _body_bytes, handles, &mut req)?;
4191                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4192                        Ok(FlatlandRequest::SetImageOpacity {
4193                            image_id: req.image_id,
4194                            val: req.val,
4195
4196                            control_handle,
4197                        })
4198                    }
4199                    0x21b20f2c14aae6bc => {
4200                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4201                        let mut req = fidl::new_empty!(
4202                            FlatlandSetImageFlipRequest,
4203                            fidl::encoding::DefaultFuchsiaResourceDialect
4204                        );
4205                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetImageFlipRequest>(&header, _body_bytes, handles, &mut req)?;
4206                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4207                        Ok(FlatlandRequest::SetImageFlip {
4208                            image_id: req.image_id,
4209                            flip: req.flip,
4210
4211                            control_handle,
4212                        })
4213                    }
4214                    0x5e62355abc1c4c5d => {
4215                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4216                        let mut req = fidl::new_empty!(
4217                            FlatlandCreateFilledRectRequest,
4218                            fidl::encoding::DefaultFuchsiaResourceDialect
4219                        );
4220                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandCreateFilledRectRequest>(&header, _body_bytes, handles, &mut req)?;
4221                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4222                        Ok(FlatlandRequest::CreateFilledRect {
4223                            rect_id: req.rect_id,
4224
4225                            control_handle,
4226                        })
4227                    }
4228                    0x32d6ef41e182dfa5 => {
4229                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4230                        let mut req = fidl::new_empty!(
4231                            FlatlandSetSolidFillRequest,
4232                            fidl::encoding::DefaultFuchsiaResourceDialect
4233                        );
4234                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetSolidFillRequest>(&header, _body_bytes, handles, &mut req)?;
4235                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4236                        Ok(FlatlandRequest::SetSolidFill {
4237                            rect_id: req.rect_id,
4238                            color: req.color,
4239                            size: req.size,
4240
4241                            control_handle,
4242                        })
4243                    }
4244                    0x7392cabe45618f9b => {
4245                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4246                        let mut req = fidl::new_empty!(
4247                            FlatlandReleaseFilledRectRequest,
4248                            fidl::encoding::DefaultFuchsiaResourceDialect
4249                        );
4250                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandReleaseFilledRectRequest>(&header, _body_bytes, handles, &mut req)?;
4251                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4252                        Ok(FlatlandRequest::ReleaseFilledRect {
4253                            rect_id: req.rect_id,
4254
4255                            control_handle,
4256                        })
4257                    }
4258                    0x4ed2cfc0ce130862 => {
4259                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4260                        let mut req = fidl::new_empty!(
4261                            FlatlandSetContentRequest,
4262                            fidl::encoding::DefaultFuchsiaResourceDialect
4263                        );
4264                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetContentRequest>(&header, _body_bytes, handles, &mut req)?;
4265                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4266                        Ok(FlatlandRequest::SetContent {
4267                            transform_id: req.transform_id,
4268                            content_id: req.content_id,
4269
4270                            control_handle,
4271                        })
4272                    }
4273                    0x66ab67e9608ddb9f => {
4274                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4275                        let mut req = fidl::new_empty!(
4276                            FlatlandSetViewportPropertiesRequest,
4277                            fidl::encoding::DefaultFuchsiaResourceDialect
4278                        );
4279                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetViewportPropertiesRequest>(&header, _body_bytes, handles, &mut req)?;
4280                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4281                        Ok(FlatlandRequest::SetViewportProperties {
4282                            viewport_id: req.viewport_id,
4283                            properties: req.properties,
4284
4285                            control_handle,
4286                        })
4287                    }
4288                    0xab9328419451c22 => {
4289                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4290                        let mut req = fidl::new_empty!(
4291                            FlatlandReleaseTransformRequest,
4292                            fidl::encoding::DefaultFuchsiaResourceDialect
4293                        );
4294                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandReleaseTransformRequest>(&header, _body_bytes, handles, &mut req)?;
4295                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4296                        Ok(FlatlandRequest::ReleaseTransform {
4297                            transform_id: req.transform_id,
4298
4299                            control_handle,
4300                        })
4301                    }
4302                    0x5b35aab9baffecae => {
4303                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4304                        let mut req = fidl::new_empty!(
4305                            fidl::encoding::EmptyPayload,
4306                            fidl::encoding::DefaultFuchsiaResourceDialect
4307                        );
4308                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
4309                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4310                        Ok(FlatlandRequest::ReleaseView { control_handle })
4311                    }
4312                    0xbad474aeb5293f9 => {
4313                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4314                        let mut req = fidl::new_empty!(
4315                            FlatlandReleaseViewportRequest,
4316                            fidl::encoding::DefaultFuchsiaResourceDialect
4317                        );
4318                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandReleaseViewportRequest>(&header, _body_bytes, handles, &mut req)?;
4319                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4320                        Ok(FlatlandRequest::ReleaseViewport {
4321                            viewport_id: req.viewport_id,
4322
4323                            responder: FlatlandReleaseViewportResponder {
4324                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4325                                tx_id: header.tx_id,
4326                            },
4327                        })
4328                    }
4329                    0xb884ffdbc72c111 => {
4330                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4331                        let mut req = fidl::new_empty!(
4332                            FlatlandReleaseImageRequest,
4333                            fidl::encoding::DefaultFuchsiaResourceDialect
4334                        );
4335                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandReleaseImageRequest>(&header, _body_bytes, handles, &mut req)?;
4336                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4337                        Ok(FlatlandRequest::ReleaseImage { image_id: req.image_id, control_handle })
4338                    }
4339                    0x4ec8817c02828c3e => {
4340                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4341                        let mut req = fidl::new_empty!(
4342                            fidl::encoding::EmptyPayload,
4343                            fidl::encoding::DefaultFuchsiaResourceDialect
4344                        );
4345                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
4346                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4347                        Ok(FlatlandRequest::Clear { control_handle })
4348                    }
4349                    0x46a8b397e68a8888 => {
4350                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4351                        let mut req = fidl::new_empty!(
4352                            FlatlandSetDebugNameRequest,
4353                            fidl::encoding::DefaultFuchsiaResourceDialect
4354                        );
4355                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetDebugNameRequest>(&header, _body_bytes, handles, &mut req)?;
4356                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4357                        Ok(FlatlandRequest::SetDebugName { name: req.name, control_handle })
4358                    }
4359                    _ => Err(fidl::Error::UnknownOrdinal {
4360                        ordinal: header.ordinal,
4361                        protocol_name:
4362                            <FlatlandMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4363                    }),
4364                }))
4365            },
4366        )
4367    }
4368}
4369
4370/// Each Flatland instance contains a Graph, which consists of a set of objects, and the
4371/// relationships between those objects. The client can specify a subset of those objects
4372/// (specifically, the directed acyclic graph starting at the root transform) to be presented as
4373/// content to some kind of output -- usually, a display.
4374///
4375/// Flatland Graphs are both hierarchical, and distributed. Graphs from different Flatland instances
4376/// may be connected together, allowing multiple processes to be involved in authoring content for a
4377/// particular output.
4378///
4379/// All functions in this protocol are feed-forward. The operations they represent are not fully
4380/// executed until [`Present`] is called.
4381#[derive(Debug)]
4382pub enum FlatlandRequest {
4383    /// Releases an image immediately, without waiting for the next present.
4384    ReleaseImageImmediately {
4385        image_id: ContentId,
4386        control_handle: FlatlandControlHandle,
4387    },
4388    /// Complete execution of all feed-forward operations.
4389    ///
4390    /// If executing an operation produces an error (e.g., CreateTransform(0)), an [`OnError`] event
4391    /// is emitted. Operations that produce errors are ignored and the channel is closed.
4392    ///
4393    /// If the execution is completed successfully, [`OnNextFrameBegin`] emits NO_ERROR along
4394    /// with other valid fields.
4395    ///
4396    /// The client may only call [`Present`] when they have a non-zero number of present credits,
4397    /// which are tracked by the server. The server may increment the number of credits when it
4398    /// fires the [`OnNextFrameBegin`] event, which informs the client when it receives additional
4399    /// present credits. Each [`Present`] call uses one present credit and decrements the server
4400    /// count by one. If the client calls [`Present`] with no present credits, the server will
4401    /// return a `NO_PRESENTS_REMAINING` error.
4402    ///
4403    /// The client should assume that prior to receiving any [`OnNextFrameBegin`] events, they have
4404    /// one present credit.
4405    ///
4406    /// Every [`Present`] call results in one [`OnNextFrameBegin`] event, and one
4407    /// [`OnFramePresented`] event, typically in that order.
4408    ///
4409    /// When the commands flushed by [`Present`] make it to display, an [`OnFramePresented`] event
4410    /// is fired. This event includes information pertaining to all [`Present`]s that had content
4411    /// that were part of that frame.
4412    ///
4413    /// See [`fuchsia.ui.composition/PresentArgs`] documentation above for more detailed information
4414    /// on what arguments are passed in and their role.
4415    Present {
4416        args: PresentArgs,
4417        control_handle: FlatlandControlHandle,
4418    },
4419    /// Two Flatland instances may be connected in a parent-child relationship. The parent endpoint
4420    /// is held in a Viewport, and the child endpoint is held in a View. The parent Flatland
4421    /// instance that creates a Viewport has control over how the child's View is integrated into
4422    /// its own View.
4423    ///
4424    /// The lifecycle of a parent-child connection starts with two endpoints of a channel object:
4425    /// a ViewportCreationToken and a ViewCreationToken. Out-of-band protocols pass the
4426    /// ViewportCreationToken to the parent, which calls [`CreateViewport`], and the
4427    /// ViewCreationToken to the child, which calls [`CreateView`].
4428    ///
4429    /// Only nodes connected to the Root Transform in this Flatland instance will be rendered into
4430    /// the parent's Viewport.
4431    ///
4432    /// Calling [`CreateView`] a second time will disconnect the Root Transform from the existing
4433    /// parent's Viewport, and attach it to a new parent's Viewport. In other words, each View can
4434    /// only have one parent.
4435    ///
4436    /// This function is queued, meaning that the Root Transform will not be attached to the
4437    /// parent Viewport until [`Present`] is called. However, clients will receive information
4438    /// through their ParentViewportWatcher (e.g., LayoutInfo) immediately after calling this
4439    /// function, even if they have not called [`Present`] or [`SetRootTransform`]. This allows
4440    /// clients to wait for layout information from their parent before calling [`Present`].
4441    ///
4442    /// Any illegal operations on ParentViewportWatcher will cause both ParentViewportWatcher
4443    /// channel and this Flatland channel to be torn down.
4444    ///
4445    /// Lifecycle note. The lifetime of the ParentViewportWatcher channel is bound by the peer
4446    /// ViewportCreationToken. When the ViewportCreationToken dies, this ParentViewportWatcher
4447    /// channel is destroyed.
4448    ///
4449    /// Views and subgraphs of Views created using `CreateView` will not be represented in the
4450    /// ViewTree, and hence will not be able to participate in any ViewTree-dependent interactions
4451    /// such as touch, mouse or focus.
4452    /// The Flatland protocol provides no way for Views in the subgraph of a View created with
4453    /// `CreateView` to know that they are excluded from the ViewTree.
4454    CreateView {
4455        token: fidl_fuchsia_ui_views::ViewCreationToken,
4456        parent_viewport_watcher: fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>,
4457        control_handle: FlatlandControlHandle,
4458    },
4459    /// Identical to [`CreateView`], except it allows association of View identity (ViewRef) and
4460    /// view-bound protocols.
4461    CreateView2 {
4462        token: fidl_fuchsia_ui_views::ViewCreationToken,
4463        view_identity: fidl_fuchsia_ui_views::ViewIdentityOnCreation,
4464        protocols: ViewBoundProtocols,
4465        parent_viewport_watcher: fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>,
4466        control_handle: FlatlandControlHandle,
4467    },
4468    /// Creates a new Transform node. Transforms are a hierarchical piece of a Flatland graph. They
4469    /// can have children, and can reference Content. A sub-graph represented by a Transform and its
4470    /// descendants can be rendered to a display.
4471    ///
4472    /// Transforms are kept alive, even when released, as long as they are children of either an
4473    /// unreleased Transform, or the Root Transform.
4474    ///
4475    /// Each Transform can have a single piece of attached Content. Common types of Content include
4476    /// bitmaps, asynchronous streams of images, and Viewports to Views hosted in other Flatland
4477    /// instances.
4478    ///
4479    /// Transforms have attributes. Child Transforms inherit the combined attributes of their
4480    /// parents. Content attached to a Transform is also affected by that Transform's attributes.
4481    ///
4482    /// When a sub-graph of Transforms is rendered, Content will be rendered back-to-front, starting
4483    /// with the Content on the root transform, and continuing recursively through all of its child
4484    /// Transforms in the order the children were added. See [`AddChild`] for more information.
4485    ///
4486    /// Zero is not a valid transform id. All other values are valid, assuming they are not already
4487    /// in use (see [`ReleaseTransform`] for more details).
4488    CreateTransform {
4489        transform_id: TransformId,
4490        control_handle: FlatlandControlHandle,
4491    },
4492    /// All Transform objects support all attributes.
4493    ///
4494    /// Geometric attributes are applied in the following order:
4495    /// 1. Scale (relative to the parent transform's coordinate space)
4496    /// 2. Orientation (relative to the parent transform's coordinate space)
4497    /// 3. Translation (relative to the parent transforms's coordinate space,
4498    ///    unaffected by scale applied to the current transform).
4499    /// 4. Clipping (relative to the current transform's coordinate space)
4500    ///
4501    /// The effects of each of these attributes are cumulative. This means the transform's position
4502    /// in the view space, and its clip boundary, will be calculated based on that chain of
4503    /// geometric attributes going up to the root transform.
4504    ///
4505    /// For instance, in a nested hierarchy such as the following:
4506    ///     [Root-Transform -> Transform1 -> Transform2 -> CurrentTransform]
4507    /// If Transform1 is translated by [2,0] and Transform2 is translated by [0,1] then the
4508    /// view-space position of CurrentTransform will be [2,1].
4509    ///
4510    /// Sets the translation on a Transform. The order of geometric attribute application is
4511    /// addressed above.
4512    SetTranslation {
4513        transform_id: TransformId,
4514        translation: fidl_fuchsia_math::Vec_,
4515        control_handle: FlatlandControlHandle,
4516    },
4517    /// Sets the orientation on a Transform. The order of geometric attribute application is
4518    /// addressed in the documentation for [`SetTranslation`]. In Flatland, the +X axis is
4519    /// to the right and the +Y axis is down. There is no notion of a Z axis. CCW is defined
4520    /// from the POV of the user, as if a skeuomorphoic clock is displayed on the screen.
4521    SetOrientation {
4522        transform_id: TransformId,
4523        orientation: Orientation,
4524        control_handle: FlatlandControlHandle,
4525    },
4526    /// Sets the scale on a transform. The order of geometric attribute application is
4527    /// addressed above. The (x,y) values in the VecF |scale| refer to the scale factor in the
4528    /// x-axis (width) and y-axis (height) respectively. Scale values must be normal 32-bit
4529    /// floating point values: https://en.wikipedia.org/wiki/Normal_number_%28computing%29
4530    SetScale {
4531        transform_id: TransformId,
4532        scale: fidl_fuchsia_math::VecF,
4533        control_handle: FlatlandControlHandle,
4534    },
4535    /// Sets an opacity in linear space to be applied to a transform and its descendents,
4536    /// which include other transforms and content. Opacity values must be in the range
4537    /// of [0.0, 1.0], where 0.0 is completely transparent and 1.0 is completely opaque.
4538    /// Attempting to call this function with values outside that range will result in
4539    /// an error. A transform's opacity value is multiplied with that of its parent. This
4540    /// effect works differently from group opacity. Using group opacity, child nodes are
4541    /// rendered together first, and then have the parent's opacity applied as a post-effect.
4542    /// Here, opacity is applied to each child individually. This may result in a very
4543    /// different effect.
4544    SetOpacity {
4545        transform_id: TransformId,
4546        value: f32,
4547        control_handle: FlatlandControlHandle,
4548    },
4549    /// Sets the bounds, expressed in the local coordinate space of the transform, that
4550    /// constrains the region that content attached to this transform can be rendered to.
4551    /// If the content's area exceeds the clip bounds, the area outside the bounds will
4552    /// not be rendered. These bounds are valid for all children of this transform node as
4553    /// well, which includes nested Flatland instances and their node hierarchies.
4554    /// If a child transform attempts to set clip bounds larger than that of its parent,
4555    /// it will be clipped to the parent's clip bounds. The default state is for a transform
4556    /// to be unclipped, meaning it will not have any bounds placed on its render region.
4557    /// The clip width/height must be positive. Negative values will result in an error.
4558    /// Passing in an empty box to the |rect| parameter will remove the clip bounds.
4559    SetClipBoundary {
4560        transform_id: TransformId,
4561        rect: Option<Box<fidl_fuchsia_math::Rect>>,
4562        control_handle: FlatlandControlHandle,
4563    },
4564    /// Adds a child Transform to a parent Transform. The new child Transform,
4565    /// and any Content attached to it or its children, will be rendered on top
4566    /// of the parent's Content, as well as any previously added children.
4567    ///
4568    /// The caller must ensure that `child_transform_id` is valid and that there
4569    /// are no repetitions.  Sending a repeated `child_transform_id` over
4570    /// multiple calls will result in session closure.
4571    AddChild {
4572        parent_transform_id: TransformId,
4573        child_transform_id: TransformId,
4574        control_handle: FlatlandControlHandle,
4575    },
4576    /// Removes a child Transform from a parent Transform.
4577    RemoveChild {
4578        parent_transform_id: TransformId,
4579        child_transform_id: TransformId,
4580        control_handle: FlatlandControlHandle,
4581    },
4582    /// Removes all child Transforms from a parent Transform and replaces them
4583    /// with the new child transforms in `new_child_transform_ids`.  The caller
4584    /// must ensure that all `TransformId` values in `new_child_transform_ids`
4585    /// are valid and that there are no repetitions.  Sending a repeated
4586    /// `TransformId` in `new_child_transform_ids` will result in session
4587    /// closure.
4588    ReplaceChildren {
4589        parent_transform_id: TransformId,
4590        new_child_transform_ids: Vec<TransformId>,
4591        control_handle: FlatlandControlHandle,
4592    },
4593    /// Sets the Root Transform for the graph.
4594    ///
4595    /// The sub-graph defined by the Root Transform and its children will be rendered as View
4596    /// in the connected parent's Viewport (see [`CreateView`]). Any parents of the Root Transform
4597    /// in this Graph will be ignored.
4598    ///
4599    /// The Root Transform, and all children of the Root Transform, are kept alive if they are
4600    /// released (see [`ReleaseTransform`] for more details).
4601    ///
4602    /// There is only ever one Root. Since 0 is not a valid transform id (see [`CreateTransform`]),
4603    /// calling SetRootTransform(0) clears the current Root, destroying any previously released
4604    /// objects that are not referenced by the new root.
4605    ///
4606    /// Note that every View has a clip boundary equivalent to its logical size. Anything outside
4607    /// that clip boundary will not be rendered. Hence, the Root Transform has a useful coordinate
4608    /// space of (0, 0) to (logical_size.width, logical_size.height), where (0, 0) is the upper left
4609    /// corner.
4610    ///
4611    /// Setting the root transform installs a full screen hit region on the root transform. Clients
4612    /// may remove this hit region if they don't want users to be able to interact with the root
4613    /// transform's content. For additional details on hit regions, see the [`SetHitRegions`]
4614    /// documentation.
4615    ///
4616    /// Default hit region rules
4617    ///
4618    ///   A default hit region follows these rules:
4619    ///   - When [`SetRootTransform`](T) is called, T receives a maximal hit region, covering the
4620    ///   entire view.
4621    ///   - If [`SetHitRegions`] is called on T, either before or after [`SetRootTransform`](T),
4622    ///   then no default hit region is active and the client specified hit regions are used.
4623    ///   - If a transform is no longer the root transform, i.e., [`SetRootTransform`](U) is
4624    ///   called, then the original transform no longer has its default hit region.
4625    ///   - Clients can remove or modify the root transform's hit regions the same way they would
4626    ///   reset any other transform's hit regions, by calling [`SetHitRegions`] with the appropriate
4627    ///   vector.
4628    SetRootTransform {
4629        transform_id: TransformId,
4630        control_handle: FlatlandControlHandle,
4631    },
4632    /// Sets the interactive areas for a Transform. By default, Content is not interactive; hit
4633    /// regions must be placed for a user to interact with the Content in a View. Because hit
4634    /// regions are described in the Flatland protocol, a Flatland instance can synchronize Content
4635    /// and hit regions.
4636    ///
4637    /// Each hit region is placed in the coordinate space of the owning Transform, and may or may
4638    /// not interact with different types of hit testing, depending on its [`HitTestInteraction`]
4639    /// type. When there are multiple hit regions that intersect with a hit test, the precedence
4640    /// rules given below dictate which hit region has interacted with the hit test. Only Transforms
4641    /// that transitively connect to the root Transform have their hit regions interact with a hit
4642    /// test.
4643    ///
4644    /// Calling this function replaces any previous values set on this Transform. To reset a
4645    /// Transform to "no hit testing": send an empty vector with [`SetHitRegions`].
4646    ///
4647    /// Note that root transforms get a default hit region installed by Flatland. For more details,
4648    /// see the [`SetRootTransform`] documentation.
4649    ///
4650    /// Precedence rules
4651    ///   Within a Transform, if multiple hit regions overlap, the hit test examines each
4652    ///   intersecting hit region for a possible interaction. Thus, for a regular hit test R and an
4653    ///   accessibility hit test A, where R and A both intersect two hit regions D ([`DEFAULT`]) and
4654    ///   S ([`SEMANTICALLY_INVISIBLE`]) on the same Transform, (1) R interacts with both D and S,
4655    ///   and (2) A only interacts with D. Generally, hit regions that overlap in a single Transform
4656    ///   can cause confusing behavior.
4657    ///
4658    ///   Within a View, for a given hit test, the front-most Transform's hit regions take
4659    ///   precedence over those behind. This follows the expected reverse "render order" of
4660    ///   Transforms (described in [`CreateTransform`]), where a user expects to interact with
4661    ///   Content that is visible, or front-most.
4662    ///
4663    ///   Across Flatland instances, for a given hit test, the front-most instance's front-most
4664    ///   Transform's hit regions take precedence over those behind. This follows the expected
4665    ///   reverse "render order" of views, where a user expects to interact with the View that is
4666    ///   visible, or front-most. For example, if a child View owns Content that is rendered over
4667    ///   the parent View, the user expects to interact with the child's Content.
4668    SetHitRegions {
4669        transform_id: TransformId,
4670        regions: Vec<HitRegion>,
4671        control_handle: FlatlandControlHandle,
4672    },
4673    /// Identical to [`SetHitRegions`], except the hit region associated with [`transform_id`]
4674    /// covers an infinite region. The hit region is invariant against translation, scaling, and
4675    /// orientation of the Transform.
4676    ///
4677    /// An infinite hit region is still limited in extent by the View's clip boundary, just like a
4678    /// finite hit region.
4679    ///
4680    /// Calling this function replaces any previous values set on this Transform. To reset a
4681    /// Transform to "no hit testing": send an empty vector with [`SetHitRegions`].
4682    SetInfiniteHitRegion {
4683        transform_id: TransformId,
4684        hit_test: HitTestInteraction,
4685        control_handle: FlatlandControlHandle,
4686    },
4687    /// The Viewport and View pair, together, represent the connection between two Flatland
4688    /// instances. The Viewport is created in the parent, and the View is created in the child. The
4689    /// parent has control over how the child's View is integrated into its own View.
4690    ///
4691    /// Any illegal operations on ChildViewWatcher will cause both ChildViewWatcher channel and this
4692    /// Flatland channel to be torn down.
4693    ///
4694    /// `ViewportProperties` must have logical_size set. This is the initial size that will drive
4695    /// the layout of the child. The logical_size is also used as the default Content size, but
4696    /// subsequent changes to the logical_size will have no effect on the Content size.
4697    ///
4698    /// `ViewportProperties` may have inset field not set. In that case, the default value of
4699    /// (0, 0, 0, 0) is used.
4700    ///
4701    /// The logical_size must have positive X and Y components.
4702    ///
4703    /// Zero is not a valid ContentId. All other values are valid, assuming they are not already
4704    /// in use for another piece of Content (see [`ReleaseViewport`] for more details).
4705    ///
4706    /// Lifecycle note. The lifetime of the ChildViewWatcher channel is bound by the peer
4707    /// ViewCreationToken. When the ViewCreationToken dies, this ChildViewWatcher channel is
4708    /// destroyed.
4709    CreateViewport {
4710        viewport_id: ContentId,
4711        token: fidl_fuchsia_ui_views::ViewportCreationToken,
4712        properties: ViewportProperties,
4713        child_view_watcher: fidl::endpoints::ServerEnd<ChildViewWatcherMarker>,
4714        control_handle: FlatlandControlHandle,
4715    },
4716    /// An Image is a bitmap backed by a specific VMO in a BufferCollection.
4717    ///
4718    /// Image creation requires an allocated BufferCollection registered with Allocator. This
4719    /// function will fail unless all clients of the specified BufferCollection have set their
4720    /// constraints.
4721    ///
4722    /// The Image must reference a valid VMO index and must have ImageProperties that fall within
4723    /// the constraints specified by the backing BufferCollection (i.e. width and height within a
4724    /// valid range, etc.)
4725    ///
4726    /// Zero is not a valid Image id. All other values are valid, assuming they are not already in
4727    /// use for another piece of Content (see [`ReleaseImage`] for more details).
4728    CreateImage {
4729        image_id: ContentId,
4730        import_token: BufferCollectionImportToken,
4731        vmo_index: u32,
4732        properties: ImageProperties,
4733        control_handle: FlatlandControlHandle,
4734    },
4735    /// This function is used to determine the region (in texel space) of an image that will be used
4736    /// by Flatland when rendering. The image to be sampled is referenced by [`image_id`] and the
4737    /// sample region is specified by [`rect`] which itself is comprised of an origin point (x,y) as
4738    /// well as a width and height, in unnormalized coordinates. It is illegal to call this function
4739    /// on non-image content, or to sample a region outside of the texel space of the image. In
4740    /// other words, the region specifed by [`rect`] must not exceed the ranges (0, image_width) and
4741    /// (0, image_height). If (rect.x + rect.width > image_width) or (rect.y + rect.height >
4742    /// image_height) or if any of the values are negative, this will result in an error.
4743    ///
4744    /// If this method is not called, the default sample region is the rectangle with origin at
4745    /// (0, 0) and width and height set at ImageProperties from [`CreateImage`].
4746    SetImageSampleRegion {
4747        image_id: ContentId,
4748        rect: fidl_fuchsia_math::RectF,
4749        control_handle: FlatlandControlHandle,
4750    },
4751    /// The content size for an Image is the size of the rectangle in the parent's logical
4752    /// coordinate space that the image occupies. This combined with the global translation of the
4753    /// transform it is attached to determines the size and location of where the content is
4754    /// rendered on the display.
4755    ///
4756    /// If this method is not called, the default image destination size is the width and height set
4757    /// at ImageProperties from [`CreateImage`]. The destination size will be affected by scaling if
4758    /// [`SetScale`] is used on the attached Transform or its parents.
4759    SetImageDestinationSize {
4760        image_id: ContentId,
4761        size: fidl_fuchsia_math::SizeU,
4762        control_handle: FlatlandControlHandle,
4763    },
4764    /// Determines the blend function to use when rendering the content specified by
4765    /// |image_id|. |image_id| must be a valid ContentId associated to a transform through
4766    /// a call to |CreateImage| or |CreateFilledRect|. For details on the different blend functions
4767    /// that are available, please refer to the BlendMode enum. If this function is not called, then
4768    /// the default blendmode is BlendMode::SRC.
4769    SetImageBlendingFunction {
4770        image_id: ContentId,
4771        blend_mode: BlendMode,
4772        control_handle: FlatlandControlHandle,
4773    },
4774    /// Determines the blend function to use when rendering the content specified by
4775    /// |image_id|. |image_id| must be a valid ContentId associated to a transform through
4776    /// a call to |CreateImage| or |CreateFilledRect|. For details on the different blend functions
4777    /// that are available, please refer to the BlendMode2 enum. If this function is not called,
4778    /// the default blendmode is BlendMode2::REPLACE.
4779    SetImageBlendMode {
4780        image_id: ContentId,
4781        blend_mode: BlendMode2,
4782        control_handle: FlatlandControlHandle,
4783    },
4784    /// Sets an opacity in linear space to be applied to a flatland image. Opacity values must
4785    /// be in the range [0.0, 1.0].
4786    SetImageOpacity {
4787        image_id: ContentId,
4788        val: f32,
4789        control_handle: FlatlandControlHandle,
4790    },
4791    /// Sets the image flip to be applied to a flatland image. This call must be performed after a
4792    /// successful |CreateImage| call. If an invalid |image_id| is supplied, the channel will be
4793    /// closed due to FlatlandError::BAD_OPERATION. This flip will be applied to the Image before
4794    /// parent Transform Orientations. If this function is not called, then the default flip value
4795    /// is ImageFlip::NONE.
4796    SetImageFlip {
4797        image_id: ContentId,
4798        flip: ImageFlip,
4799        control_handle: FlatlandControlHandle,
4800    },
4801    /// Creates a solid-color rectangle. By default a filled-rect does not have a defined
4802    /// color or size. It is necessary to call |SetSolidFill| to specify a color and size
4803    /// before a filled rect can be used for rendering. Not doing so will result the
4804    CreateFilledRect {
4805        rect_id: ContentId,
4806        control_handle: FlatlandControlHandle,
4807    },
4808    /// Defines the color and size of a filled rect. |rect_id| must refer to content that
4809    /// was created via a call to CreateFilledRect. The color is not premultiplied. Color values
4810    /// must be within the range [0,1] inclusive, and normal 32-bit
4811    /// floating point values: https://en.wikipedia.org/wiki/Normal_number_%28computing%29. Values
4812    /// that do not conform to these specifications will cause the channel to close.
4813    /// The rectangle's top left corner will be at (0, 0) in its transform's coordinate space.
4814    /// Hence, its bottom right corner will be at (size.width, size.height).
4815    SetSolidFill {
4816        rect_id: ContentId,
4817        color: ColorRgba,
4818        size: fidl_fuchsia_math::SizeU,
4819        control_handle: FlatlandControlHandle,
4820    },
4821    /// Automatically garbage collects the rectangle when it is no longer needed for
4822    /// rendering. |rect_id| must have been instantiated with a call to
4823    /// |CreateFilledRect|. Once released, the ID immediately goes out of scope and is free
4824    /// to be used again.
4825    ReleaseFilledRect {
4826        rect_id: ContentId,
4827        control_handle: FlatlandControlHandle,
4828    },
4829    /// Setting a piece of Content on a Transform makes that Content visible in the render tree as
4830    /// long as the Transform is visible from the root Transform. The Content will be rendered
4831    /// before, and therefore "behind", any Content attached to the descendants of the Transform.
4832    ///
4833    /// Because each Transform can have, at most, a single piece of Content on it, calling this
4834    /// function on a Transform that already has Content will replace that Content.
4835    ///
4836    /// A Content may be set on more than one Transform.
4837    ///
4838    /// Calling this function with a Content id of 0 will remove any Content currently on the
4839    /// Transform.
4840    SetContent {
4841        transform_id: TransformId,
4842        content_id: ContentId,
4843        control_handle: FlatlandControlHandle,
4844    },
4845    /// Transforms are usually sufficient to change how Content is presented. Viewports, however,
4846    /// have special properties that are not part of the Transform hierarchy. Those properties can
4847    /// be set using this function.
4848    SetViewportProperties {
4849        viewport_id: ContentId,
4850        properties: ViewportProperties,
4851        control_handle: FlatlandControlHandle,
4852    },
4853    /// Released Transforms will be garbage collected by the system once they are no longer
4854    /// necessary for rendering. For Transforms, this means there is no path from any unreleased
4855    /// Transform to the newly-released Transform.
4856    ///
4857    /// Once released, the id immediately goes out of scope for future function calls and can be
4858    /// reused when creating new Transforms.
4859    ///
4860    /// It is an error to call functions with a released id (unless that id has been reused to
4861    /// construct a new Transform).
4862    ReleaseTransform {
4863        transform_id: TransformId,
4864        control_handle: FlatlandControlHandle,
4865    },
4866    ReleaseView {
4867        control_handle: FlatlandControlHandle,
4868    },
4869    /// Releases a Viewport from the scene, even if the Viewport is still connected to a Transform.
4870    /// Unlike other resources, Viewports are garbage collected by the system during the next
4871    /// [`Present`] because a removed Viewport is guaranteed to provide no renderable content.
4872    ///
4873    /// Use SetContent(transform_id, 0) to clean up references to released Viewports.
4874    ///
4875    /// Despite having a return type, this function is still feed-forward like [`CreateView`] and
4876    /// requires a call to [`Present`] to be executed. The ViewportCreationToken will be returned
4877    /// after the presented operations have been executed.
4878    ReleaseViewport {
4879        viewport_id: ContentId,
4880        responder: FlatlandReleaseViewportResponder,
4881    },
4882    /// Released Images will be garbage collected by the system once they are no longer necessary
4883    /// for rendering. For Images, this means the Image is no longer attached to any Transform and
4884    /// any pending rendering that references the Image is complete.
4885    ///
4886    /// Use SetContent(transform_id, 0) to clean up references to released Images.
4887    ///
4888    /// Once released, the id immediately goes out of scope for future function calls and can be
4889    /// reused when creating new Images.
4890    ///
4891    /// It is an error to call functions with a released id (unless that id has been reused to
4892    /// construct a new Image).
4893    ReleaseImage {
4894        image_id: ContentId,
4895        control_handle: FlatlandControlHandle,
4896    },
4897    /// This function will reset all state on this interface. This includes destroying all existing
4898    /// View and Viewports without returning the associated Token to the caller.
4899    Clear {
4900        control_handle: FlatlandControlHandle,
4901    },
4902    /// Set debug name of the current client that can be used by Flatland to print as a prefix to
4903    /// logs to help client distinguish what is theirs. [`name`] can be an arbitrary string, but the
4904    /// current process name (see fsl::GetCurrentProcessName()) is a good default.
4905    SetDebugName {
4906        name: String,
4907        control_handle: FlatlandControlHandle,
4908    },
4909}
4910
4911impl FlatlandRequest {
4912    #[allow(irrefutable_let_patterns)]
4913    pub fn into_release_image_immediately(self) -> Option<(ContentId, FlatlandControlHandle)> {
4914        if let FlatlandRequest::ReleaseImageImmediately { image_id, control_handle } = self {
4915            Some((image_id, control_handle))
4916        } else {
4917            None
4918        }
4919    }
4920
4921    #[allow(irrefutable_let_patterns)]
4922    pub fn into_present(self) -> Option<(PresentArgs, FlatlandControlHandle)> {
4923        if let FlatlandRequest::Present { args, control_handle } = self {
4924            Some((args, control_handle))
4925        } else {
4926            None
4927        }
4928    }
4929
4930    #[allow(irrefutable_let_patterns)]
4931    pub fn into_create_view(
4932        self,
4933    ) -> Option<(
4934        fidl_fuchsia_ui_views::ViewCreationToken,
4935        fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>,
4936        FlatlandControlHandle,
4937    )> {
4938        if let FlatlandRequest::CreateView { token, parent_viewport_watcher, control_handle } = self
4939        {
4940            Some((token, parent_viewport_watcher, control_handle))
4941        } else {
4942            None
4943        }
4944    }
4945
4946    #[allow(irrefutable_let_patterns)]
4947    pub fn into_create_view2(
4948        self,
4949    ) -> Option<(
4950        fidl_fuchsia_ui_views::ViewCreationToken,
4951        fidl_fuchsia_ui_views::ViewIdentityOnCreation,
4952        ViewBoundProtocols,
4953        fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>,
4954        FlatlandControlHandle,
4955    )> {
4956        if let FlatlandRequest::CreateView2 {
4957            token,
4958            view_identity,
4959            protocols,
4960            parent_viewport_watcher,
4961            control_handle,
4962        } = self
4963        {
4964            Some((token, view_identity, protocols, parent_viewport_watcher, control_handle))
4965        } else {
4966            None
4967        }
4968    }
4969
4970    #[allow(irrefutable_let_patterns)]
4971    pub fn into_create_transform(self) -> Option<(TransformId, FlatlandControlHandle)> {
4972        if let FlatlandRequest::CreateTransform { transform_id, control_handle } = self {
4973            Some((transform_id, control_handle))
4974        } else {
4975            None
4976        }
4977    }
4978
4979    #[allow(irrefutable_let_patterns)]
4980    pub fn into_set_translation(
4981        self,
4982    ) -> Option<(TransformId, fidl_fuchsia_math::Vec_, FlatlandControlHandle)> {
4983        if let FlatlandRequest::SetTranslation { transform_id, translation, control_handle } = self
4984        {
4985            Some((transform_id, translation, control_handle))
4986        } else {
4987            None
4988        }
4989    }
4990
4991    #[allow(irrefutable_let_patterns)]
4992    pub fn into_set_orientation(self) -> Option<(TransformId, Orientation, FlatlandControlHandle)> {
4993        if let FlatlandRequest::SetOrientation { transform_id, orientation, control_handle } = self
4994        {
4995            Some((transform_id, orientation, control_handle))
4996        } else {
4997            None
4998        }
4999    }
5000
5001    #[allow(irrefutable_let_patterns)]
5002    pub fn into_set_scale(
5003        self,
5004    ) -> Option<(TransformId, fidl_fuchsia_math::VecF, FlatlandControlHandle)> {
5005        if let FlatlandRequest::SetScale { transform_id, scale, control_handle } = self {
5006            Some((transform_id, scale, control_handle))
5007        } else {
5008            None
5009        }
5010    }
5011
5012    #[allow(irrefutable_let_patterns)]
5013    pub fn into_set_opacity(self) -> Option<(TransformId, f32, FlatlandControlHandle)> {
5014        if let FlatlandRequest::SetOpacity { transform_id, value, control_handle } = self {
5015            Some((transform_id, value, control_handle))
5016        } else {
5017            None
5018        }
5019    }
5020
5021    #[allow(irrefutable_let_patterns)]
5022    pub fn into_set_clip_boundary(
5023        self,
5024    ) -> Option<(TransformId, Option<Box<fidl_fuchsia_math::Rect>>, FlatlandControlHandle)> {
5025        if let FlatlandRequest::SetClipBoundary { transform_id, rect, control_handle } = self {
5026            Some((transform_id, rect, control_handle))
5027        } else {
5028            None
5029        }
5030    }
5031
5032    #[allow(irrefutable_let_patterns)]
5033    pub fn into_add_child(self) -> Option<(TransformId, TransformId, FlatlandControlHandle)> {
5034        if let FlatlandRequest::AddChild {
5035            parent_transform_id,
5036            child_transform_id,
5037            control_handle,
5038        } = self
5039        {
5040            Some((parent_transform_id, child_transform_id, control_handle))
5041        } else {
5042            None
5043        }
5044    }
5045
5046    #[allow(irrefutable_let_patterns)]
5047    pub fn into_remove_child(self) -> Option<(TransformId, TransformId, FlatlandControlHandle)> {
5048        if let FlatlandRequest::RemoveChild {
5049            parent_transform_id,
5050            child_transform_id,
5051            control_handle,
5052        } = self
5053        {
5054            Some((parent_transform_id, child_transform_id, control_handle))
5055        } else {
5056            None
5057        }
5058    }
5059
5060    #[allow(irrefutable_let_patterns)]
5061    pub fn into_replace_children(
5062        self,
5063    ) -> Option<(TransformId, Vec<TransformId>, FlatlandControlHandle)> {
5064        if let FlatlandRequest::ReplaceChildren {
5065            parent_transform_id,
5066            new_child_transform_ids,
5067            control_handle,
5068        } = self
5069        {
5070            Some((parent_transform_id, new_child_transform_ids, control_handle))
5071        } else {
5072            None
5073        }
5074    }
5075
5076    #[allow(irrefutable_let_patterns)]
5077    pub fn into_set_root_transform(self) -> Option<(TransformId, FlatlandControlHandle)> {
5078        if let FlatlandRequest::SetRootTransform { transform_id, control_handle } = self {
5079            Some((transform_id, control_handle))
5080        } else {
5081            None
5082        }
5083    }
5084
5085    #[allow(irrefutable_let_patterns)]
5086    pub fn into_set_hit_regions(
5087        self,
5088    ) -> Option<(TransformId, Vec<HitRegion>, FlatlandControlHandle)> {
5089        if let FlatlandRequest::SetHitRegions { transform_id, regions, control_handle } = self {
5090            Some((transform_id, regions, control_handle))
5091        } else {
5092            None
5093        }
5094    }
5095
5096    #[allow(irrefutable_let_patterns)]
5097    pub fn into_set_infinite_hit_region(
5098        self,
5099    ) -> Option<(TransformId, HitTestInteraction, FlatlandControlHandle)> {
5100        if let FlatlandRequest::SetInfiniteHitRegion { transform_id, hit_test, control_handle } =
5101            self
5102        {
5103            Some((transform_id, hit_test, control_handle))
5104        } else {
5105            None
5106        }
5107    }
5108
5109    #[allow(irrefutable_let_patterns)]
5110    pub fn into_create_viewport(
5111        self,
5112    ) -> Option<(
5113        ContentId,
5114        fidl_fuchsia_ui_views::ViewportCreationToken,
5115        ViewportProperties,
5116        fidl::endpoints::ServerEnd<ChildViewWatcherMarker>,
5117        FlatlandControlHandle,
5118    )> {
5119        if let FlatlandRequest::CreateViewport {
5120            viewport_id,
5121            token,
5122            properties,
5123            child_view_watcher,
5124            control_handle,
5125        } = self
5126        {
5127            Some((viewport_id, token, properties, child_view_watcher, control_handle))
5128        } else {
5129            None
5130        }
5131    }
5132
5133    #[allow(irrefutable_let_patterns)]
5134    pub fn into_create_image(
5135        self,
5136    ) -> Option<(ContentId, BufferCollectionImportToken, u32, ImageProperties, FlatlandControlHandle)>
5137    {
5138        if let FlatlandRequest::CreateImage {
5139            image_id,
5140            import_token,
5141            vmo_index,
5142            properties,
5143            control_handle,
5144        } = self
5145        {
5146            Some((image_id, import_token, vmo_index, properties, control_handle))
5147        } else {
5148            None
5149        }
5150    }
5151
5152    #[allow(irrefutable_let_patterns)]
5153    pub fn into_set_image_sample_region(
5154        self,
5155    ) -> Option<(ContentId, fidl_fuchsia_math::RectF, FlatlandControlHandle)> {
5156        if let FlatlandRequest::SetImageSampleRegion { image_id, rect, control_handle } = self {
5157            Some((image_id, rect, control_handle))
5158        } else {
5159            None
5160        }
5161    }
5162
5163    #[allow(irrefutable_let_patterns)]
5164    pub fn into_set_image_destination_size(
5165        self,
5166    ) -> Option<(ContentId, fidl_fuchsia_math::SizeU, FlatlandControlHandle)> {
5167        if let FlatlandRequest::SetImageDestinationSize { image_id, size, control_handle } = self {
5168            Some((image_id, size, control_handle))
5169        } else {
5170            None
5171        }
5172    }
5173
5174    #[allow(irrefutable_let_patterns)]
5175    pub fn into_set_image_blending_function(
5176        self,
5177    ) -> Option<(ContentId, BlendMode, FlatlandControlHandle)> {
5178        if let FlatlandRequest::SetImageBlendingFunction { image_id, blend_mode, control_handle } =
5179            self
5180        {
5181            Some((image_id, blend_mode, control_handle))
5182        } else {
5183            None
5184        }
5185    }
5186
5187    #[allow(irrefutable_let_patterns)]
5188    pub fn into_set_image_blend_mode(
5189        self,
5190    ) -> Option<(ContentId, BlendMode2, FlatlandControlHandle)> {
5191        if let FlatlandRequest::SetImageBlendMode { image_id, blend_mode, control_handle } = self {
5192            Some((image_id, blend_mode, control_handle))
5193        } else {
5194            None
5195        }
5196    }
5197
5198    #[allow(irrefutable_let_patterns)]
5199    pub fn into_set_image_opacity(self) -> Option<(ContentId, f32, FlatlandControlHandle)> {
5200        if let FlatlandRequest::SetImageOpacity { image_id, val, control_handle } = self {
5201            Some((image_id, val, control_handle))
5202        } else {
5203            None
5204        }
5205    }
5206
5207    #[allow(irrefutable_let_patterns)]
5208    pub fn into_set_image_flip(self) -> Option<(ContentId, ImageFlip, FlatlandControlHandle)> {
5209        if let FlatlandRequest::SetImageFlip { image_id, flip, control_handle } = self {
5210            Some((image_id, flip, control_handle))
5211        } else {
5212            None
5213        }
5214    }
5215
5216    #[allow(irrefutable_let_patterns)]
5217    pub fn into_create_filled_rect(self) -> Option<(ContentId, FlatlandControlHandle)> {
5218        if let FlatlandRequest::CreateFilledRect { rect_id, control_handle } = self {
5219            Some((rect_id, control_handle))
5220        } else {
5221            None
5222        }
5223    }
5224
5225    #[allow(irrefutable_let_patterns)]
5226    pub fn into_set_solid_fill(
5227        self,
5228    ) -> Option<(ContentId, ColorRgba, fidl_fuchsia_math::SizeU, FlatlandControlHandle)> {
5229        if let FlatlandRequest::SetSolidFill { rect_id, color, size, control_handle } = self {
5230            Some((rect_id, color, size, control_handle))
5231        } else {
5232            None
5233        }
5234    }
5235
5236    #[allow(irrefutable_let_patterns)]
5237    pub fn into_release_filled_rect(self) -> Option<(ContentId, FlatlandControlHandle)> {
5238        if let FlatlandRequest::ReleaseFilledRect { rect_id, control_handle } = self {
5239            Some((rect_id, control_handle))
5240        } else {
5241            None
5242        }
5243    }
5244
5245    #[allow(irrefutable_let_patterns)]
5246    pub fn into_set_content(self) -> Option<(TransformId, ContentId, FlatlandControlHandle)> {
5247        if let FlatlandRequest::SetContent { transform_id, content_id, control_handle } = self {
5248            Some((transform_id, content_id, control_handle))
5249        } else {
5250            None
5251        }
5252    }
5253
5254    #[allow(irrefutable_let_patterns)]
5255    pub fn into_set_viewport_properties(
5256        self,
5257    ) -> Option<(ContentId, ViewportProperties, FlatlandControlHandle)> {
5258        if let FlatlandRequest::SetViewportProperties { viewport_id, properties, control_handle } =
5259            self
5260        {
5261            Some((viewport_id, properties, control_handle))
5262        } else {
5263            None
5264        }
5265    }
5266
5267    #[allow(irrefutable_let_patterns)]
5268    pub fn into_release_transform(self) -> Option<(TransformId, FlatlandControlHandle)> {
5269        if let FlatlandRequest::ReleaseTransform { transform_id, control_handle } = self {
5270            Some((transform_id, control_handle))
5271        } else {
5272            None
5273        }
5274    }
5275
5276    #[allow(irrefutable_let_patterns)]
5277    pub fn into_release_view(self) -> Option<(FlatlandControlHandle)> {
5278        if let FlatlandRequest::ReleaseView { control_handle } = self {
5279            Some((control_handle))
5280        } else {
5281            None
5282        }
5283    }
5284
5285    #[allow(irrefutable_let_patterns)]
5286    pub fn into_release_viewport(self) -> Option<(ContentId, FlatlandReleaseViewportResponder)> {
5287        if let FlatlandRequest::ReleaseViewport { viewport_id, responder } = self {
5288            Some((viewport_id, responder))
5289        } else {
5290            None
5291        }
5292    }
5293
5294    #[allow(irrefutable_let_patterns)]
5295    pub fn into_release_image(self) -> Option<(ContentId, FlatlandControlHandle)> {
5296        if let FlatlandRequest::ReleaseImage { image_id, control_handle } = self {
5297            Some((image_id, control_handle))
5298        } else {
5299            None
5300        }
5301    }
5302
5303    #[allow(irrefutable_let_patterns)]
5304    pub fn into_clear(self) -> Option<(FlatlandControlHandle)> {
5305        if let FlatlandRequest::Clear { control_handle } = self {
5306            Some((control_handle))
5307        } else {
5308            None
5309        }
5310    }
5311
5312    #[allow(irrefutable_let_patterns)]
5313    pub fn into_set_debug_name(self) -> Option<(String, FlatlandControlHandle)> {
5314        if let FlatlandRequest::SetDebugName { name, control_handle } = self {
5315            Some((name, control_handle))
5316        } else {
5317            None
5318        }
5319    }
5320
5321    /// Name of the method defined in FIDL
5322    pub fn method_name(&self) -> &'static str {
5323        match *self {
5324            FlatlandRequest::ReleaseImageImmediately { .. } => "release_image_immediately",
5325            FlatlandRequest::Present { .. } => "present",
5326            FlatlandRequest::CreateView { .. } => "create_view",
5327            FlatlandRequest::CreateView2 { .. } => "create_view2",
5328            FlatlandRequest::CreateTransform { .. } => "create_transform",
5329            FlatlandRequest::SetTranslation { .. } => "set_translation",
5330            FlatlandRequest::SetOrientation { .. } => "set_orientation",
5331            FlatlandRequest::SetScale { .. } => "set_scale",
5332            FlatlandRequest::SetOpacity { .. } => "set_opacity",
5333            FlatlandRequest::SetClipBoundary { .. } => "set_clip_boundary",
5334            FlatlandRequest::AddChild { .. } => "add_child",
5335            FlatlandRequest::RemoveChild { .. } => "remove_child",
5336            FlatlandRequest::ReplaceChildren { .. } => "replace_children",
5337            FlatlandRequest::SetRootTransform { .. } => "set_root_transform",
5338            FlatlandRequest::SetHitRegions { .. } => "set_hit_regions",
5339            FlatlandRequest::SetInfiniteHitRegion { .. } => "set_infinite_hit_region",
5340            FlatlandRequest::CreateViewport { .. } => "create_viewport",
5341            FlatlandRequest::CreateImage { .. } => "create_image",
5342            FlatlandRequest::SetImageSampleRegion { .. } => "set_image_sample_region",
5343            FlatlandRequest::SetImageDestinationSize { .. } => "set_image_destination_size",
5344            FlatlandRequest::SetImageBlendingFunction { .. } => "set_image_blending_function",
5345            FlatlandRequest::SetImageBlendMode { .. } => "set_image_blend_mode",
5346            FlatlandRequest::SetImageOpacity { .. } => "set_image_opacity",
5347            FlatlandRequest::SetImageFlip { .. } => "set_image_flip",
5348            FlatlandRequest::CreateFilledRect { .. } => "create_filled_rect",
5349            FlatlandRequest::SetSolidFill { .. } => "set_solid_fill",
5350            FlatlandRequest::ReleaseFilledRect { .. } => "release_filled_rect",
5351            FlatlandRequest::SetContent { .. } => "set_content",
5352            FlatlandRequest::SetViewportProperties { .. } => "set_viewport_properties",
5353            FlatlandRequest::ReleaseTransform { .. } => "release_transform",
5354            FlatlandRequest::ReleaseView { .. } => "release_view",
5355            FlatlandRequest::ReleaseViewport { .. } => "release_viewport",
5356            FlatlandRequest::ReleaseImage { .. } => "release_image",
5357            FlatlandRequest::Clear { .. } => "clear",
5358            FlatlandRequest::SetDebugName { .. } => "set_debug_name",
5359        }
5360    }
5361}
5362
5363#[derive(Debug, Clone)]
5364pub struct FlatlandControlHandle {
5365    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5366}
5367
5368impl fidl::endpoints::ControlHandle for FlatlandControlHandle {
5369    fn shutdown(&self) {
5370        self.inner.shutdown()
5371    }
5372
5373    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
5374        self.inner.shutdown_with_epitaph(status)
5375    }
5376
5377    fn is_closed(&self) -> bool {
5378        self.inner.channel().is_closed()
5379    }
5380    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
5381        self.inner.channel().on_closed()
5382    }
5383
5384    #[cfg(target_os = "fuchsia")]
5385    fn signal_peer(
5386        &self,
5387        clear_mask: zx::Signals,
5388        set_mask: zx::Signals,
5389    ) -> Result<(), zx_status::Status> {
5390        use fidl::Peered;
5391        self.inner.channel().signal_peer(clear_mask, set_mask)
5392    }
5393}
5394
5395impl FlatlandControlHandle {
5396    pub fn send_on_next_frame_begin(
5397        &self,
5398        mut values: &OnNextFrameBeginValues,
5399    ) -> Result<(), fidl::Error> {
5400        self.inner.send::<FlatlandOnNextFrameBeginRequest>(
5401            (values,),
5402            0,
5403            0x10f69a5cdeece84a,
5404            fidl::encoding::DynamicFlags::empty(),
5405        )
5406    }
5407
5408    pub fn send_on_frame_presented(
5409        &self,
5410        mut frame_presented_info: &fidl_fuchsia_scenic_scheduling::FramePresentedInfo,
5411    ) -> Result<(), fidl::Error> {
5412        self.inner.send::<FlatlandOnFramePresentedRequest>(
5413            (frame_presented_info,),
5414            0,
5415            0x56e43e1a5f30216d,
5416            fidl::encoding::DynamicFlags::empty(),
5417        )
5418    }
5419
5420    pub fn send_on_error(&self, mut error: FlatlandError) -> Result<(), fidl::Error> {
5421        self.inner.send::<FlatlandOnErrorRequest>(
5422            (error,),
5423            0,
5424            0x1ebf39e90cd8b8d,
5425            fidl::encoding::DynamicFlags::empty(),
5426        )
5427    }
5428}
5429
5430#[must_use = "FIDL methods require a response to be sent"]
5431#[derive(Debug)]
5432pub struct FlatlandReleaseViewportResponder {
5433    control_handle: std::mem::ManuallyDrop<FlatlandControlHandle>,
5434    tx_id: u32,
5435}
5436
5437/// Set the the channel to be shutdown (see [`FlatlandControlHandle::shutdown`])
5438/// if the responder is dropped without sending a response, so that the client
5439/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5440impl std::ops::Drop for FlatlandReleaseViewportResponder {
5441    fn drop(&mut self) {
5442        self.control_handle.shutdown();
5443        // Safety: drops once, never accessed again
5444        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5445    }
5446}
5447
5448impl fidl::endpoints::Responder for FlatlandReleaseViewportResponder {
5449    type ControlHandle = FlatlandControlHandle;
5450
5451    fn control_handle(&self) -> &FlatlandControlHandle {
5452        &self.control_handle
5453    }
5454
5455    fn drop_without_shutdown(mut self) {
5456        // Safety: drops once, never accessed again due to mem::forget
5457        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5458        // Prevent Drop from running (which would shut down the channel)
5459        std::mem::forget(self);
5460    }
5461}
5462
5463impl FlatlandReleaseViewportResponder {
5464    /// Sends a response to the FIDL transaction.
5465    ///
5466    /// Sets the channel to shutdown if an error occurs.
5467    pub fn send(
5468        self,
5469        mut token: fidl_fuchsia_ui_views::ViewportCreationToken,
5470    ) -> Result<(), fidl::Error> {
5471        let _result = self.send_raw(token);
5472        if _result.is_err() {
5473            self.control_handle.shutdown();
5474        }
5475        self.drop_without_shutdown();
5476        _result
5477    }
5478
5479    /// Similar to "send" but does not shutdown the channel if an error occurs.
5480    pub fn send_no_shutdown_on_err(
5481        self,
5482        mut token: fidl_fuchsia_ui_views::ViewportCreationToken,
5483    ) -> Result<(), fidl::Error> {
5484        let _result = self.send_raw(token);
5485        self.drop_without_shutdown();
5486        _result
5487    }
5488
5489    fn send_raw(
5490        &self,
5491        mut token: fidl_fuchsia_ui_views::ViewportCreationToken,
5492    ) -> Result<(), fidl::Error> {
5493        self.control_handle.inner.send::<FlatlandReleaseViewportResponse>(
5494            (&mut token,),
5495            self.tx_id,
5496            0xbad474aeb5293f9,
5497            fidl::encoding::DynamicFlags::empty(),
5498        )
5499    }
5500}
5501
5502#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
5503pub struct FlatlandDisplayMarker;
5504
5505impl fidl::endpoints::ProtocolMarker for FlatlandDisplayMarker {
5506    type Proxy = FlatlandDisplayProxy;
5507    type RequestStream = FlatlandDisplayRequestStream;
5508    #[cfg(target_os = "fuchsia")]
5509    type SynchronousProxy = FlatlandDisplaySynchronousProxy;
5510
5511    const DEBUG_NAME: &'static str = "fuchsia.ui.composition.FlatlandDisplay";
5512}
5513impl fidl::endpoints::DiscoverableProtocolMarker for FlatlandDisplayMarker {}
5514
5515pub trait FlatlandDisplayProxyInterface: Send + Sync {
5516    fn r#set_content(
5517        &self,
5518        token: fidl_fuchsia_ui_views::ViewportCreationToken,
5519        child_view_watcher: fidl::endpoints::ServerEnd<ChildViewWatcherMarker>,
5520    ) -> Result<(), fidl::Error>;
5521    fn r#set_device_pixel_ratio(
5522        &self,
5523        device_pixel_ratio: &fidl_fuchsia_math::VecF,
5524    ) -> Result<(), fidl::Error>;
5525}
5526#[derive(Debug)]
5527#[cfg(target_os = "fuchsia")]
5528pub struct FlatlandDisplaySynchronousProxy {
5529    client: fidl::client::sync::Client,
5530}
5531
5532#[cfg(target_os = "fuchsia")]
5533impl fidl::endpoints::SynchronousProxy for FlatlandDisplaySynchronousProxy {
5534    type Proxy = FlatlandDisplayProxy;
5535    type Protocol = FlatlandDisplayMarker;
5536
5537    fn from_channel(inner: fidl::Channel) -> Self {
5538        Self::new(inner)
5539    }
5540
5541    fn into_channel(self) -> fidl::Channel {
5542        self.client.into_channel()
5543    }
5544
5545    fn as_channel(&self) -> &fidl::Channel {
5546        self.client.as_channel()
5547    }
5548}
5549
5550#[cfg(target_os = "fuchsia")]
5551impl FlatlandDisplaySynchronousProxy {
5552    pub fn new(channel: fidl::Channel) -> Self {
5553        Self { client: fidl::client::sync::Client::new(channel) }
5554    }
5555
5556    pub fn into_channel(self) -> fidl::Channel {
5557        self.client.into_channel()
5558    }
5559
5560    /// Waits until an event arrives and returns it. It is safe for other
5561    /// threads to make concurrent requests while waiting for an event.
5562    pub fn wait_for_event(
5563        &self,
5564        deadline: zx::MonotonicInstant,
5565    ) -> Result<FlatlandDisplayEvent, fidl::Error> {
5566        FlatlandDisplayEvent::decode(self.client.wait_for_event::<FlatlandDisplayMarker>(deadline)?)
5567    }
5568
5569    pub fn r#set_content(
5570        &self,
5571        mut token: fidl_fuchsia_ui_views::ViewportCreationToken,
5572        mut child_view_watcher: fidl::endpoints::ServerEnd<ChildViewWatcherMarker>,
5573    ) -> Result<(), fidl::Error> {
5574        self.client.send::<FlatlandDisplaySetContentRequest>(
5575            (&mut token, child_view_watcher),
5576            0x6748193a39918298,
5577            fidl::encoding::DynamicFlags::empty(),
5578        )
5579    }
5580
5581    /// Sets the ratio of display's physical pixels to device independent pixels that should be used
5582    /// for the tree of Flatland content that are attached to this display. See
5583    /// [`LayoutInfo.device_pixel_ratio`] for details.
5584    ///
5585    /// The default value is (1.0, 1.0). The valid values are 1.0 and above.
5586    pub fn r#set_device_pixel_ratio(
5587        &self,
5588        mut device_pixel_ratio: &fidl_fuchsia_math::VecF,
5589    ) -> Result<(), fidl::Error> {
5590        self.client.send::<FlatlandDisplaySetDevicePixelRatioRequest>(
5591            (device_pixel_ratio,),
5592            0x392c3e70cc0a81a4,
5593            fidl::encoding::DynamicFlags::empty(),
5594        )
5595    }
5596}
5597
5598#[cfg(target_os = "fuchsia")]
5599impl From<FlatlandDisplaySynchronousProxy> for zx::NullableHandle {
5600    fn from(value: FlatlandDisplaySynchronousProxy) -> Self {
5601        value.into_channel().into()
5602    }
5603}
5604
5605#[cfg(target_os = "fuchsia")]
5606impl From<fidl::Channel> for FlatlandDisplaySynchronousProxy {
5607    fn from(value: fidl::Channel) -> Self {
5608        Self::new(value)
5609    }
5610}
5611
5612#[cfg(target_os = "fuchsia")]
5613impl fidl::endpoints::FromClient for FlatlandDisplaySynchronousProxy {
5614    type Protocol = FlatlandDisplayMarker;
5615
5616    fn from_client(value: fidl::endpoints::ClientEnd<FlatlandDisplayMarker>) -> Self {
5617        Self::new(value.into_channel())
5618    }
5619}
5620
5621#[derive(Debug, Clone)]
5622pub struct FlatlandDisplayProxy {
5623    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
5624}
5625
5626impl fidl::endpoints::Proxy for FlatlandDisplayProxy {
5627    type Protocol = FlatlandDisplayMarker;
5628
5629    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
5630        Self::new(inner)
5631    }
5632
5633    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
5634        self.client.into_channel().map_err(|client| Self { client })
5635    }
5636
5637    fn as_channel(&self) -> &::fidl::AsyncChannel {
5638        self.client.as_channel()
5639    }
5640}
5641
5642impl FlatlandDisplayProxy {
5643    /// Create a new Proxy for fuchsia.ui.composition/FlatlandDisplay.
5644    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
5645        let protocol_name = <FlatlandDisplayMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
5646        Self { client: fidl::client::Client::new(channel, protocol_name) }
5647    }
5648
5649    /// Get a Stream of events from the remote end of the protocol.
5650    ///
5651    /// # Panics
5652    ///
5653    /// Panics if the event stream was already taken.
5654    pub fn take_event_stream(&self) -> FlatlandDisplayEventStream {
5655        FlatlandDisplayEventStream { event_receiver: self.client.take_event_receiver() }
5656    }
5657
5658    pub fn r#set_content(
5659        &self,
5660        mut token: fidl_fuchsia_ui_views::ViewportCreationToken,
5661        mut child_view_watcher: fidl::endpoints::ServerEnd<ChildViewWatcherMarker>,
5662    ) -> Result<(), fidl::Error> {
5663        FlatlandDisplayProxyInterface::r#set_content(self, token, child_view_watcher)
5664    }
5665
5666    /// Sets the ratio of display's physical pixels to device independent pixels that should be used
5667    /// for the tree of Flatland content that are attached to this display. See
5668    /// [`LayoutInfo.device_pixel_ratio`] for details.
5669    ///
5670    /// The default value is (1.0, 1.0). The valid values are 1.0 and above.
5671    pub fn r#set_device_pixel_ratio(
5672        &self,
5673        mut device_pixel_ratio: &fidl_fuchsia_math::VecF,
5674    ) -> Result<(), fidl::Error> {
5675        FlatlandDisplayProxyInterface::r#set_device_pixel_ratio(self, device_pixel_ratio)
5676    }
5677}
5678
5679impl FlatlandDisplayProxyInterface for FlatlandDisplayProxy {
5680    fn r#set_content(
5681        &self,
5682        mut token: fidl_fuchsia_ui_views::ViewportCreationToken,
5683        mut child_view_watcher: fidl::endpoints::ServerEnd<ChildViewWatcherMarker>,
5684    ) -> Result<(), fidl::Error> {
5685        self.client.send::<FlatlandDisplaySetContentRequest>(
5686            (&mut token, child_view_watcher),
5687            0x6748193a39918298,
5688            fidl::encoding::DynamicFlags::empty(),
5689        )
5690    }
5691
5692    fn r#set_device_pixel_ratio(
5693        &self,
5694        mut device_pixel_ratio: &fidl_fuchsia_math::VecF,
5695    ) -> Result<(), fidl::Error> {
5696        self.client.send::<FlatlandDisplaySetDevicePixelRatioRequest>(
5697            (device_pixel_ratio,),
5698            0x392c3e70cc0a81a4,
5699            fidl::encoding::DynamicFlags::empty(),
5700        )
5701    }
5702}
5703
5704pub struct FlatlandDisplayEventStream {
5705    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
5706}
5707
5708impl std::marker::Unpin for FlatlandDisplayEventStream {}
5709
5710impl futures::stream::FusedStream for FlatlandDisplayEventStream {
5711    fn is_terminated(&self) -> bool {
5712        self.event_receiver.is_terminated()
5713    }
5714}
5715
5716impl futures::Stream for FlatlandDisplayEventStream {
5717    type Item = Result<FlatlandDisplayEvent, fidl::Error>;
5718
5719    fn poll_next(
5720        mut self: std::pin::Pin<&mut Self>,
5721        cx: &mut std::task::Context<'_>,
5722    ) -> std::task::Poll<Option<Self::Item>> {
5723        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
5724            &mut self.event_receiver,
5725            cx
5726        )?) {
5727            Some(buf) => std::task::Poll::Ready(Some(FlatlandDisplayEvent::decode(buf))),
5728            None => std::task::Poll::Ready(None),
5729        }
5730    }
5731}
5732
5733#[derive(Debug)]
5734pub enum FlatlandDisplayEvent {}
5735
5736impl FlatlandDisplayEvent {
5737    /// Decodes a message buffer as a [`FlatlandDisplayEvent`].
5738    fn decode(
5739        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
5740    ) -> Result<FlatlandDisplayEvent, fidl::Error> {
5741        let (bytes, _handles) = buf.split_mut();
5742        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5743        debug_assert_eq!(tx_header.tx_id, 0);
5744        match tx_header.ordinal {
5745            _ => Err(fidl::Error::UnknownOrdinal {
5746                ordinal: tx_header.ordinal,
5747                protocol_name:
5748                    <FlatlandDisplayMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5749            }),
5750        }
5751    }
5752}
5753
5754/// A Stream of incoming requests for fuchsia.ui.composition/FlatlandDisplay.
5755pub struct FlatlandDisplayRequestStream {
5756    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5757    is_terminated: bool,
5758}
5759
5760impl std::marker::Unpin for FlatlandDisplayRequestStream {}
5761
5762impl futures::stream::FusedStream for FlatlandDisplayRequestStream {
5763    fn is_terminated(&self) -> bool {
5764        self.is_terminated
5765    }
5766}
5767
5768impl fidl::endpoints::RequestStream for FlatlandDisplayRequestStream {
5769    type Protocol = FlatlandDisplayMarker;
5770    type ControlHandle = FlatlandDisplayControlHandle;
5771
5772    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
5773        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
5774    }
5775
5776    fn control_handle(&self) -> Self::ControlHandle {
5777        FlatlandDisplayControlHandle { inner: self.inner.clone() }
5778    }
5779
5780    fn into_inner(
5781        self,
5782    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
5783    {
5784        (self.inner, self.is_terminated)
5785    }
5786
5787    fn from_inner(
5788        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5789        is_terminated: bool,
5790    ) -> Self {
5791        Self { inner, is_terminated }
5792    }
5793}
5794
5795impl futures::Stream for FlatlandDisplayRequestStream {
5796    type Item = Result<FlatlandDisplayRequest, fidl::Error>;
5797
5798    fn poll_next(
5799        mut self: std::pin::Pin<&mut Self>,
5800        cx: &mut std::task::Context<'_>,
5801    ) -> std::task::Poll<Option<Self::Item>> {
5802        let this = &mut *self;
5803        if this.inner.check_shutdown(cx) {
5804            this.is_terminated = true;
5805            return std::task::Poll::Ready(None);
5806        }
5807        if this.is_terminated {
5808            panic!("polled FlatlandDisplayRequestStream after completion");
5809        }
5810        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
5811            |bytes, handles| {
5812                match this.inner.channel().read_etc(cx, bytes, handles) {
5813                    std::task::Poll::Ready(Ok(())) => {}
5814                    std::task::Poll::Pending => return std::task::Poll::Pending,
5815                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
5816                        this.is_terminated = true;
5817                        return std::task::Poll::Ready(None);
5818                    }
5819                    std::task::Poll::Ready(Err(e)) => {
5820                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
5821                            e.into(),
5822                        ))));
5823                    }
5824                }
5825
5826                // A message has been received from the channel
5827                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5828
5829                std::task::Poll::Ready(Some(match header.ordinal {
5830                    0x6748193a39918298 => {
5831                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5832                        let mut req = fidl::new_empty!(
5833                            FlatlandDisplaySetContentRequest,
5834                            fidl::encoding::DefaultFuchsiaResourceDialect
5835                        );
5836                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandDisplaySetContentRequest>(&header, _body_bytes, handles, &mut req)?;
5837                        let control_handle =
5838                            FlatlandDisplayControlHandle { inner: this.inner.clone() };
5839                        Ok(FlatlandDisplayRequest::SetContent {
5840                            token: req.token,
5841                            child_view_watcher: req.child_view_watcher,
5842
5843                            control_handle,
5844                        })
5845                    }
5846                    0x392c3e70cc0a81a4 => {
5847                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5848                        let mut req = fidl::new_empty!(
5849                            FlatlandDisplaySetDevicePixelRatioRequest,
5850                            fidl::encoding::DefaultFuchsiaResourceDialect
5851                        );
5852                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandDisplaySetDevicePixelRatioRequest>(&header, _body_bytes, handles, &mut req)?;
5853                        let control_handle =
5854                            FlatlandDisplayControlHandle { inner: this.inner.clone() };
5855                        Ok(FlatlandDisplayRequest::SetDevicePixelRatio {
5856                            device_pixel_ratio: req.device_pixel_ratio,
5857
5858                            control_handle,
5859                        })
5860                    }
5861                    _ => Err(fidl::Error::UnknownOrdinal {
5862                        ordinal: header.ordinal,
5863                        protocol_name:
5864                            <FlatlandDisplayMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5865                    }),
5866                }))
5867            },
5868        )
5869    }
5870}
5871
5872/// This API connects to the singleton "primary display", and allows a tree of Flatland content to
5873/// be attached underneath.  Only one FlatlandDisplay client connection is allowed at one time.
5874#[derive(Debug)]
5875pub enum FlatlandDisplayRequest {
5876    SetContent {
5877        token: fidl_fuchsia_ui_views::ViewportCreationToken,
5878        child_view_watcher: fidl::endpoints::ServerEnd<ChildViewWatcherMarker>,
5879        control_handle: FlatlandDisplayControlHandle,
5880    },
5881    /// Sets the ratio of display's physical pixels to device independent pixels that should be used
5882    /// for the tree of Flatland content that are attached to this display. See
5883    /// [`LayoutInfo.device_pixel_ratio`] for details.
5884    ///
5885    /// The default value is (1.0, 1.0). The valid values are 1.0 and above.
5886    SetDevicePixelRatio {
5887        device_pixel_ratio: fidl_fuchsia_math::VecF,
5888        control_handle: FlatlandDisplayControlHandle,
5889    },
5890}
5891
5892impl FlatlandDisplayRequest {
5893    #[allow(irrefutable_let_patterns)]
5894    pub fn into_set_content(
5895        self,
5896    ) -> Option<(
5897        fidl_fuchsia_ui_views::ViewportCreationToken,
5898        fidl::endpoints::ServerEnd<ChildViewWatcherMarker>,
5899        FlatlandDisplayControlHandle,
5900    )> {
5901        if let FlatlandDisplayRequest::SetContent { token, child_view_watcher, control_handle } =
5902            self
5903        {
5904            Some((token, child_view_watcher, control_handle))
5905        } else {
5906            None
5907        }
5908    }
5909
5910    #[allow(irrefutable_let_patterns)]
5911    pub fn into_set_device_pixel_ratio(
5912        self,
5913    ) -> Option<(fidl_fuchsia_math::VecF, FlatlandDisplayControlHandle)> {
5914        if let FlatlandDisplayRequest::SetDevicePixelRatio { device_pixel_ratio, control_handle } =
5915            self
5916        {
5917            Some((device_pixel_ratio, control_handle))
5918        } else {
5919            None
5920        }
5921    }
5922
5923    /// Name of the method defined in FIDL
5924    pub fn method_name(&self) -> &'static str {
5925        match *self {
5926            FlatlandDisplayRequest::SetContent { .. } => "set_content",
5927            FlatlandDisplayRequest::SetDevicePixelRatio { .. } => "set_device_pixel_ratio",
5928        }
5929    }
5930}
5931
5932#[derive(Debug, Clone)]
5933pub struct FlatlandDisplayControlHandle {
5934    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5935}
5936
5937impl fidl::endpoints::ControlHandle for FlatlandDisplayControlHandle {
5938    fn shutdown(&self) {
5939        self.inner.shutdown()
5940    }
5941
5942    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
5943        self.inner.shutdown_with_epitaph(status)
5944    }
5945
5946    fn is_closed(&self) -> bool {
5947        self.inner.channel().is_closed()
5948    }
5949    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
5950        self.inner.channel().on_closed()
5951    }
5952
5953    #[cfg(target_os = "fuchsia")]
5954    fn signal_peer(
5955        &self,
5956        clear_mask: zx::Signals,
5957        set_mask: zx::Signals,
5958    ) -> Result<(), zx_status::Status> {
5959        use fidl::Peered;
5960        self.inner.channel().signal_peer(clear_mask, set_mask)
5961    }
5962}
5963
5964impl FlatlandDisplayControlHandle {}
5965
5966#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
5967pub struct ParentViewportWatcherMarker;
5968
5969impl fidl::endpoints::ProtocolMarker for ParentViewportWatcherMarker {
5970    type Proxy = ParentViewportWatcherProxy;
5971    type RequestStream = ParentViewportWatcherRequestStream;
5972    #[cfg(target_os = "fuchsia")]
5973    type SynchronousProxy = ParentViewportWatcherSynchronousProxy;
5974
5975    const DEBUG_NAME: &'static str = "(anonymous) ParentViewportWatcher";
5976}
5977
5978pub trait ParentViewportWatcherProxyInterface: Send + Sync {
5979    type GetLayoutResponseFut: std::future::Future<Output = Result<LayoutInfo, fidl::Error>> + Send;
5980    fn r#get_layout(&self) -> Self::GetLayoutResponseFut;
5981    type GetStatusResponseFut: std::future::Future<Output = Result<ParentViewportStatus, fidl::Error>>
5982        + Send;
5983    fn r#get_status(&self) -> Self::GetStatusResponseFut;
5984}
5985#[derive(Debug)]
5986#[cfg(target_os = "fuchsia")]
5987pub struct ParentViewportWatcherSynchronousProxy {
5988    client: fidl::client::sync::Client,
5989}
5990
5991#[cfg(target_os = "fuchsia")]
5992impl fidl::endpoints::SynchronousProxy for ParentViewportWatcherSynchronousProxy {
5993    type Proxy = ParentViewportWatcherProxy;
5994    type Protocol = ParentViewportWatcherMarker;
5995
5996    fn from_channel(inner: fidl::Channel) -> Self {
5997        Self::new(inner)
5998    }
5999
6000    fn into_channel(self) -> fidl::Channel {
6001        self.client.into_channel()
6002    }
6003
6004    fn as_channel(&self) -> &fidl::Channel {
6005        self.client.as_channel()
6006    }
6007}
6008
6009#[cfg(target_os = "fuchsia")]
6010impl ParentViewportWatcherSynchronousProxy {
6011    pub fn new(channel: fidl::Channel) -> Self {
6012        Self { client: fidl::client::sync::Client::new(channel) }
6013    }
6014
6015    pub fn into_channel(self) -> fidl::Channel {
6016        self.client.into_channel()
6017    }
6018
6019    /// Waits until an event arrives and returns it. It is safe for other
6020    /// threads to make concurrent requests while waiting for an event.
6021    pub fn wait_for_event(
6022        &self,
6023        deadline: zx::MonotonicInstant,
6024    ) -> Result<ParentViewportWatcherEvent, fidl::Error> {
6025        ParentViewportWatcherEvent::decode(
6026            self.client.wait_for_event::<ParentViewportWatcherMarker>(deadline)?,
6027        )
6028    }
6029
6030    /// A hanging get for receiving layout information. Clients may receive layout information
6031    /// before the ParentViewportWatcher operation has been presented. This allows children to
6032    /// layout their content before their first call to [`Present`]. In transition cases where two
6033    /// ParentViewportWatcher channels exist at the same time, both protocol instances will be
6034    /// receiving different layout information.
6035    ///
6036    /// This hanging get will only fire when the LayoutInfo is different than the previously
6037    /// returned LayoutInfo. Note that, since LayoutInfo is a table, only some fields may have
6038    /// changed.
6039    ///
6040    /// It is invalid to call `GetLayout` while a previous call is still pending. Doing so will
6041    /// cause both this channel and the Flatland channel that handed out ParentViewportWatcher to be
6042    /// closed.
6043    pub fn r#get_layout(
6044        &self,
6045        ___deadline: zx::MonotonicInstant,
6046    ) -> Result<LayoutInfo, fidl::Error> {
6047        let _response = self.client.send_query::<
6048            fidl::encoding::EmptyPayload,
6049            ParentViewportWatcherGetLayoutResponse,
6050            ParentViewportWatcherMarker,
6051        >(
6052            (),
6053            0x3cbe5d9638e032,
6054            fidl::encoding::DynamicFlags::empty(),
6055            ___deadline,
6056        )?;
6057        Ok(_response.info)
6058    }
6059
6060    /// A hanging get for receiving the status of the parent Viewport. This provides global
6061    /// connectivity information to the child.
6062    ///
6063    /// This hanging get will only fire when the ParentViewportStatus is different than the
6064    /// previously returned ParentViewportStatus.
6065    ///
6066    /// It is invalid to call `GetStatus` while a previous call is still pending. Doing so will
6067    /// cause both this channel and the Flatland channel that handed out ParentViewportWatcher to be
6068    /// closed.
6069    pub fn r#get_status(
6070        &self,
6071        ___deadline: zx::MonotonicInstant,
6072    ) -> Result<ParentViewportStatus, fidl::Error> {
6073        let _response = self.client.send_query::<
6074            fidl::encoding::EmptyPayload,
6075            ParentViewportWatcherGetStatusResponse,
6076            ParentViewportWatcherMarker,
6077        >(
6078            (),
6079            0x7caa022f050d9ea6,
6080            fidl::encoding::DynamicFlags::empty(),
6081            ___deadline,
6082        )?;
6083        Ok(_response.status)
6084    }
6085}
6086
6087#[cfg(target_os = "fuchsia")]
6088impl From<ParentViewportWatcherSynchronousProxy> for zx::NullableHandle {
6089    fn from(value: ParentViewportWatcherSynchronousProxy) -> Self {
6090        value.into_channel().into()
6091    }
6092}
6093
6094#[cfg(target_os = "fuchsia")]
6095impl From<fidl::Channel> for ParentViewportWatcherSynchronousProxy {
6096    fn from(value: fidl::Channel) -> Self {
6097        Self::new(value)
6098    }
6099}
6100
6101#[cfg(target_os = "fuchsia")]
6102impl fidl::endpoints::FromClient for ParentViewportWatcherSynchronousProxy {
6103    type Protocol = ParentViewportWatcherMarker;
6104
6105    fn from_client(value: fidl::endpoints::ClientEnd<ParentViewportWatcherMarker>) -> Self {
6106        Self::new(value.into_channel())
6107    }
6108}
6109
6110#[derive(Debug, Clone)]
6111pub struct ParentViewportWatcherProxy {
6112    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
6113}
6114
6115impl fidl::endpoints::Proxy for ParentViewportWatcherProxy {
6116    type Protocol = ParentViewportWatcherMarker;
6117
6118    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
6119        Self::new(inner)
6120    }
6121
6122    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
6123        self.client.into_channel().map_err(|client| Self { client })
6124    }
6125
6126    fn as_channel(&self) -> &::fidl::AsyncChannel {
6127        self.client.as_channel()
6128    }
6129}
6130
6131impl ParentViewportWatcherProxy {
6132    /// Create a new Proxy for fuchsia.ui.composition/ParentViewportWatcher.
6133    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
6134        let protocol_name =
6135            <ParentViewportWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
6136        Self { client: fidl::client::Client::new(channel, protocol_name) }
6137    }
6138
6139    /// Get a Stream of events from the remote end of the protocol.
6140    ///
6141    /// # Panics
6142    ///
6143    /// Panics if the event stream was already taken.
6144    pub fn take_event_stream(&self) -> ParentViewportWatcherEventStream {
6145        ParentViewportWatcherEventStream { event_receiver: self.client.take_event_receiver() }
6146    }
6147
6148    /// A hanging get for receiving layout information. Clients may receive layout information
6149    /// before the ParentViewportWatcher operation has been presented. This allows children to
6150    /// layout their content before their first call to [`Present`]. In transition cases where two
6151    /// ParentViewportWatcher channels exist at the same time, both protocol instances will be
6152    /// receiving different layout information.
6153    ///
6154    /// This hanging get will only fire when the LayoutInfo is different than the previously
6155    /// returned LayoutInfo. Note that, since LayoutInfo is a table, only some fields may have
6156    /// changed.
6157    ///
6158    /// It is invalid to call `GetLayout` while a previous call is still pending. Doing so will
6159    /// cause both this channel and the Flatland channel that handed out ParentViewportWatcher to be
6160    /// closed.
6161    pub fn r#get_layout(
6162        &self,
6163    ) -> fidl::client::QueryResponseFut<LayoutInfo, fidl::encoding::DefaultFuchsiaResourceDialect>
6164    {
6165        ParentViewportWatcherProxyInterface::r#get_layout(self)
6166    }
6167
6168    /// A hanging get for receiving the status of the parent Viewport. This provides global
6169    /// connectivity information to the child.
6170    ///
6171    /// This hanging get will only fire when the ParentViewportStatus is different than the
6172    /// previously returned ParentViewportStatus.
6173    ///
6174    /// It is invalid to call `GetStatus` while a previous call is still pending. Doing so will
6175    /// cause both this channel and the Flatland channel that handed out ParentViewportWatcher to be
6176    /// closed.
6177    pub fn r#get_status(
6178        &self,
6179    ) -> fidl::client::QueryResponseFut<
6180        ParentViewportStatus,
6181        fidl::encoding::DefaultFuchsiaResourceDialect,
6182    > {
6183        ParentViewportWatcherProxyInterface::r#get_status(self)
6184    }
6185}
6186
6187impl ParentViewportWatcherProxyInterface for ParentViewportWatcherProxy {
6188    type GetLayoutResponseFut =
6189        fidl::client::QueryResponseFut<LayoutInfo, fidl::encoding::DefaultFuchsiaResourceDialect>;
6190    fn r#get_layout(&self) -> Self::GetLayoutResponseFut {
6191        fn _decode(
6192            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6193        ) -> Result<LayoutInfo, fidl::Error> {
6194            let _response = fidl::client::decode_transaction_body::<
6195                ParentViewportWatcherGetLayoutResponse,
6196                fidl::encoding::DefaultFuchsiaResourceDialect,
6197                0x3cbe5d9638e032,
6198            >(_buf?)?;
6199            Ok(_response.info)
6200        }
6201        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, LayoutInfo>(
6202            (),
6203            0x3cbe5d9638e032,
6204            fidl::encoding::DynamicFlags::empty(),
6205            _decode,
6206        )
6207    }
6208
6209    type GetStatusResponseFut = fidl::client::QueryResponseFut<
6210        ParentViewportStatus,
6211        fidl::encoding::DefaultFuchsiaResourceDialect,
6212    >;
6213    fn r#get_status(&self) -> Self::GetStatusResponseFut {
6214        fn _decode(
6215            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6216        ) -> Result<ParentViewportStatus, fidl::Error> {
6217            let _response = fidl::client::decode_transaction_body::<
6218                ParentViewportWatcherGetStatusResponse,
6219                fidl::encoding::DefaultFuchsiaResourceDialect,
6220                0x7caa022f050d9ea6,
6221            >(_buf?)?;
6222            Ok(_response.status)
6223        }
6224        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ParentViewportStatus>(
6225            (),
6226            0x7caa022f050d9ea6,
6227            fidl::encoding::DynamicFlags::empty(),
6228            _decode,
6229        )
6230    }
6231}
6232
6233pub struct ParentViewportWatcherEventStream {
6234    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
6235}
6236
6237impl std::marker::Unpin for ParentViewportWatcherEventStream {}
6238
6239impl futures::stream::FusedStream for ParentViewportWatcherEventStream {
6240    fn is_terminated(&self) -> bool {
6241        self.event_receiver.is_terminated()
6242    }
6243}
6244
6245impl futures::Stream for ParentViewportWatcherEventStream {
6246    type Item = Result<ParentViewportWatcherEvent, fidl::Error>;
6247
6248    fn poll_next(
6249        mut self: std::pin::Pin<&mut Self>,
6250        cx: &mut std::task::Context<'_>,
6251    ) -> std::task::Poll<Option<Self::Item>> {
6252        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
6253            &mut self.event_receiver,
6254            cx
6255        )?) {
6256            Some(buf) => std::task::Poll::Ready(Some(ParentViewportWatcherEvent::decode(buf))),
6257            None => std::task::Poll::Ready(None),
6258        }
6259    }
6260}
6261
6262#[derive(Debug)]
6263pub enum ParentViewportWatcherEvent {}
6264
6265impl ParentViewportWatcherEvent {
6266    /// Decodes a message buffer as a [`ParentViewportWatcherEvent`].
6267    fn decode(
6268        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
6269    ) -> Result<ParentViewportWatcherEvent, fidl::Error> {
6270        let (bytes, _handles) = buf.split_mut();
6271        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6272        debug_assert_eq!(tx_header.tx_id, 0);
6273        match tx_header.ordinal {
6274            _ => Err(fidl::Error::UnknownOrdinal {
6275                ordinal: tx_header.ordinal,
6276                protocol_name:
6277                    <ParentViewportWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6278            }),
6279        }
6280    }
6281}
6282
6283/// A Stream of incoming requests for fuchsia.ui.composition/ParentViewportWatcher.
6284pub struct ParentViewportWatcherRequestStream {
6285    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6286    is_terminated: bool,
6287}
6288
6289impl std::marker::Unpin for ParentViewportWatcherRequestStream {}
6290
6291impl futures::stream::FusedStream for ParentViewportWatcherRequestStream {
6292    fn is_terminated(&self) -> bool {
6293        self.is_terminated
6294    }
6295}
6296
6297impl fidl::endpoints::RequestStream for ParentViewportWatcherRequestStream {
6298    type Protocol = ParentViewportWatcherMarker;
6299    type ControlHandle = ParentViewportWatcherControlHandle;
6300
6301    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
6302        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
6303    }
6304
6305    fn control_handle(&self) -> Self::ControlHandle {
6306        ParentViewportWatcherControlHandle { inner: self.inner.clone() }
6307    }
6308
6309    fn into_inner(
6310        self,
6311    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
6312    {
6313        (self.inner, self.is_terminated)
6314    }
6315
6316    fn from_inner(
6317        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6318        is_terminated: bool,
6319    ) -> Self {
6320        Self { inner, is_terminated }
6321    }
6322}
6323
6324impl futures::Stream for ParentViewportWatcherRequestStream {
6325    type Item = Result<ParentViewportWatcherRequest, fidl::Error>;
6326
6327    fn poll_next(
6328        mut self: std::pin::Pin<&mut Self>,
6329        cx: &mut std::task::Context<'_>,
6330    ) -> std::task::Poll<Option<Self::Item>> {
6331        let this = &mut *self;
6332        if this.inner.check_shutdown(cx) {
6333            this.is_terminated = true;
6334            return std::task::Poll::Ready(None);
6335        }
6336        if this.is_terminated {
6337            panic!("polled ParentViewportWatcherRequestStream after completion");
6338        }
6339        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
6340            |bytes, handles| {
6341                match this.inner.channel().read_etc(cx, bytes, handles) {
6342                    std::task::Poll::Ready(Ok(())) => {}
6343                    std::task::Poll::Pending => return std::task::Poll::Pending,
6344                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
6345                        this.is_terminated = true;
6346                        return std::task::Poll::Ready(None);
6347                    }
6348                    std::task::Poll::Ready(Err(e)) => {
6349                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
6350                            e.into(),
6351                        ))));
6352                    }
6353                }
6354
6355                // A message has been received from the channel
6356                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6357
6358                std::task::Poll::Ready(Some(match header.ordinal {
6359                0x3cbe5d9638e032 => {
6360                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6361                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
6362                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
6363                    let control_handle = ParentViewportWatcherControlHandle {
6364                        inner: this.inner.clone(),
6365                    };
6366                    Ok(ParentViewportWatcherRequest::GetLayout {
6367                        responder: ParentViewportWatcherGetLayoutResponder {
6368                            control_handle: std::mem::ManuallyDrop::new(control_handle),
6369                            tx_id: header.tx_id,
6370                        },
6371                    })
6372                }
6373                0x7caa022f050d9ea6 => {
6374                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6375                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
6376                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
6377                    let control_handle = ParentViewportWatcherControlHandle {
6378                        inner: this.inner.clone(),
6379                    };
6380                    Ok(ParentViewportWatcherRequest::GetStatus {
6381                        responder: ParentViewportWatcherGetStatusResponder {
6382                            control_handle: std::mem::ManuallyDrop::new(control_handle),
6383                            tx_id: header.tx_id,
6384                        },
6385                    })
6386                }
6387                _ => Err(fidl::Error::UnknownOrdinal {
6388                    ordinal: header.ordinal,
6389                    protocol_name: <ParentViewportWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6390                }),
6391            }))
6392            },
6393        )
6394    }
6395}
6396
6397/// A protocol that provides information about the parent Viewport attached to a Flatland instance's
6398/// sole View.  Although Flatland instances can have at most one view, it is possible to have
6399/// multiple ParentViewportWatchers during the brief transition period when replacing the instance's
6400/// View with another, e.g. via [`CreateView`].  During this period, certain updates may be
6401/// duplicated and sent to each ParentViewportWatcher connection.
6402///
6403/// A ParentViewportWatcher will remain connected as long as the corresponding parent Viewport
6404/// exists; the connection will also be closed if the parents's ViewportCreationToken is dropped
6405/// without using it to create a Viewport.
6406#[derive(Debug)]
6407pub enum ParentViewportWatcherRequest {
6408    /// A hanging get for receiving layout information. Clients may receive layout information
6409    /// before the ParentViewportWatcher operation has been presented. This allows children to
6410    /// layout their content before their first call to [`Present`]. In transition cases where two
6411    /// ParentViewportWatcher channels exist at the same time, both protocol instances will be
6412    /// receiving different layout information.
6413    ///
6414    /// This hanging get will only fire when the LayoutInfo is different than the previously
6415    /// returned LayoutInfo. Note that, since LayoutInfo is a table, only some fields may have
6416    /// changed.
6417    ///
6418    /// It is invalid to call `GetLayout` while a previous call is still pending. Doing so will
6419    /// cause both this channel and the Flatland channel that handed out ParentViewportWatcher to be
6420    /// closed.
6421    GetLayout { responder: ParentViewportWatcherGetLayoutResponder },
6422    /// A hanging get for receiving the status of the parent Viewport. This provides global
6423    /// connectivity information to the child.
6424    ///
6425    /// This hanging get will only fire when the ParentViewportStatus is different than the
6426    /// previously returned ParentViewportStatus.
6427    ///
6428    /// It is invalid to call `GetStatus` while a previous call is still pending. Doing so will
6429    /// cause both this channel and the Flatland channel that handed out ParentViewportWatcher to be
6430    /// closed.
6431    GetStatus { responder: ParentViewportWatcherGetStatusResponder },
6432}
6433
6434impl ParentViewportWatcherRequest {
6435    #[allow(irrefutable_let_patterns)]
6436    pub fn into_get_layout(self) -> Option<(ParentViewportWatcherGetLayoutResponder)> {
6437        if let ParentViewportWatcherRequest::GetLayout { responder } = self {
6438            Some((responder))
6439        } else {
6440            None
6441        }
6442    }
6443
6444    #[allow(irrefutable_let_patterns)]
6445    pub fn into_get_status(self) -> Option<(ParentViewportWatcherGetStatusResponder)> {
6446        if let ParentViewportWatcherRequest::GetStatus { responder } = self {
6447            Some((responder))
6448        } else {
6449            None
6450        }
6451    }
6452
6453    /// Name of the method defined in FIDL
6454    pub fn method_name(&self) -> &'static str {
6455        match *self {
6456            ParentViewportWatcherRequest::GetLayout { .. } => "get_layout",
6457            ParentViewportWatcherRequest::GetStatus { .. } => "get_status",
6458        }
6459    }
6460}
6461
6462#[derive(Debug, Clone)]
6463pub struct ParentViewportWatcherControlHandle {
6464    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6465}
6466
6467impl fidl::endpoints::ControlHandle for ParentViewportWatcherControlHandle {
6468    fn shutdown(&self) {
6469        self.inner.shutdown()
6470    }
6471
6472    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
6473        self.inner.shutdown_with_epitaph(status)
6474    }
6475
6476    fn is_closed(&self) -> bool {
6477        self.inner.channel().is_closed()
6478    }
6479    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
6480        self.inner.channel().on_closed()
6481    }
6482
6483    #[cfg(target_os = "fuchsia")]
6484    fn signal_peer(
6485        &self,
6486        clear_mask: zx::Signals,
6487        set_mask: zx::Signals,
6488    ) -> Result<(), zx_status::Status> {
6489        use fidl::Peered;
6490        self.inner.channel().signal_peer(clear_mask, set_mask)
6491    }
6492}
6493
6494impl ParentViewportWatcherControlHandle {}
6495
6496#[must_use = "FIDL methods require a response to be sent"]
6497#[derive(Debug)]
6498pub struct ParentViewportWatcherGetLayoutResponder {
6499    control_handle: std::mem::ManuallyDrop<ParentViewportWatcherControlHandle>,
6500    tx_id: u32,
6501}
6502
6503/// Set the the channel to be shutdown (see [`ParentViewportWatcherControlHandle::shutdown`])
6504/// if the responder is dropped without sending a response, so that the client
6505/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6506impl std::ops::Drop for ParentViewportWatcherGetLayoutResponder {
6507    fn drop(&mut self) {
6508        self.control_handle.shutdown();
6509        // Safety: drops once, never accessed again
6510        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6511    }
6512}
6513
6514impl fidl::endpoints::Responder for ParentViewportWatcherGetLayoutResponder {
6515    type ControlHandle = ParentViewportWatcherControlHandle;
6516
6517    fn control_handle(&self) -> &ParentViewportWatcherControlHandle {
6518        &self.control_handle
6519    }
6520
6521    fn drop_without_shutdown(mut self) {
6522        // Safety: drops once, never accessed again due to mem::forget
6523        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6524        // Prevent Drop from running (which would shut down the channel)
6525        std::mem::forget(self);
6526    }
6527}
6528
6529impl ParentViewportWatcherGetLayoutResponder {
6530    /// Sends a response to the FIDL transaction.
6531    ///
6532    /// Sets the channel to shutdown if an error occurs.
6533    pub fn send(self, mut info: &LayoutInfo) -> Result<(), fidl::Error> {
6534        let _result = self.send_raw(info);
6535        if _result.is_err() {
6536            self.control_handle.shutdown();
6537        }
6538        self.drop_without_shutdown();
6539        _result
6540    }
6541
6542    /// Similar to "send" but does not shutdown the channel if an error occurs.
6543    pub fn send_no_shutdown_on_err(self, mut info: &LayoutInfo) -> Result<(), fidl::Error> {
6544        let _result = self.send_raw(info);
6545        self.drop_without_shutdown();
6546        _result
6547    }
6548
6549    fn send_raw(&self, mut info: &LayoutInfo) -> Result<(), fidl::Error> {
6550        self.control_handle.inner.send::<ParentViewportWatcherGetLayoutResponse>(
6551            (info,),
6552            self.tx_id,
6553            0x3cbe5d9638e032,
6554            fidl::encoding::DynamicFlags::empty(),
6555        )
6556    }
6557}
6558
6559#[must_use = "FIDL methods require a response to be sent"]
6560#[derive(Debug)]
6561pub struct ParentViewportWatcherGetStatusResponder {
6562    control_handle: std::mem::ManuallyDrop<ParentViewportWatcherControlHandle>,
6563    tx_id: u32,
6564}
6565
6566/// Set the the channel to be shutdown (see [`ParentViewportWatcherControlHandle::shutdown`])
6567/// if the responder is dropped without sending a response, so that the client
6568/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6569impl std::ops::Drop for ParentViewportWatcherGetStatusResponder {
6570    fn drop(&mut self) {
6571        self.control_handle.shutdown();
6572        // Safety: drops once, never accessed again
6573        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6574    }
6575}
6576
6577impl fidl::endpoints::Responder for ParentViewportWatcherGetStatusResponder {
6578    type ControlHandle = ParentViewportWatcherControlHandle;
6579
6580    fn control_handle(&self) -> &ParentViewportWatcherControlHandle {
6581        &self.control_handle
6582    }
6583
6584    fn drop_without_shutdown(mut self) {
6585        // Safety: drops once, never accessed again due to mem::forget
6586        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6587        // Prevent Drop from running (which would shut down the channel)
6588        std::mem::forget(self);
6589    }
6590}
6591
6592impl ParentViewportWatcherGetStatusResponder {
6593    /// Sends a response to the FIDL transaction.
6594    ///
6595    /// Sets the channel to shutdown if an error occurs.
6596    pub fn send(self, mut status: ParentViewportStatus) -> Result<(), fidl::Error> {
6597        let _result = self.send_raw(status);
6598        if _result.is_err() {
6599            self.control_handle.shutdown();
6600        }
6601        self.drop_without_shutdown();
6602        _result
6603    }
6604
6605    /// Similar to "send" but does not shutdown the channel if an error occurs.
6606    pub fn send_no_shutdown_on_err(
6607        self,
6608        mut status: ParentViewportStatus,
6609    ) -> Result<(), fidl::Error> {
6610        let _result = self.send_raw(status);
6611        self.drop_without_shutdown();
6612        _result
6613    }
6614
6615    fn send_raw(&self, mut status: ParentViewportStatus) -> Result<(), fidl::Error> {
6616        self.control_handle.inner.send::<ParentViewportWatcherGetStatusResponse>(
6617            (status,),
6618            self.tx_id,
6619            0x7caa022f050d9ea6,
6620            fidl::encoding::DynamicFlags::empty(),
6621        )
6622    }
6623}
6624
6625#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
6626pub struct ScreenCaptureMarker;
6627
6628impl fidl::endpoints::ProtocolMarker for ScreenCaptureMarker {
6629    type Proxy = ScreenCaptureProxy;
6630    type RequestStream = ScreenCaptureRequestStream;
6631    #[cfg(target_os = "fuchsia")]
6632    type SynchronousProxy = ScreenCaptureSynchronousProxy;
6633
6634    const DEBUG_NAME: &'static str = "fuchsia.ui.composition.ScreenCapture";
6635}
6636impl fidl::endpoints::DiscoverableProtocolMarker for ScreenCaptureMarker {}
6637pub type ScreenCaptureConfigureResult = Result<(), ScreenCaptureError>;
6638pub type ScreenCaptureGetNextFrameResult = Result<FrameInfo, ScreenCaptureError>;
6639pub type ScreenCaptureReleaseFrameResult = Result<(), ScreenCaptureError>;
6640
6641pub trait ScreenCaptureProxyInterface: Send + Sync {
6642    type ConfigureResponseFut: std::future::Future<Output = Result<ScreenCaptureConfigureResult, fidl::Error>>
6643        + Send;
6644    fn r#configure(&self, payload: ScreenCaptureConfig) -> Self::ConfigureResponseFut;
6645    type GetNextFrameResponseFut: std::future::Future<Output = Result<ScreenCaptureGetNextFrameResult, fidl::Error>>
6646        + Send;
6647    fn r#get_next_frame(&self, payload: GetNextFrameArgs) -> Self::GetNextFrameResponseFut;
6648    type ReleaseFrameResponseFut: std::future::Future<Output = Result<ScreenCaptureReleaseFrameResult, fidl::Error>>
6649        + Send;
6650    fn r#release_frame(&self, buffer_id: u32) -> Self::ReleaseFrameResponseFut;
6651}
6652#[derive(Debug)]
6653#[cfg(target_os = "fuchsia")]
6654pub struct ScreenCaptureSynchronousProxy {
6655    client: fidl::client::sync::Client,
6656}
6657
6658#[cfg(target_os = "fuchsia")]
6659impl fidl::endpoints::SynchronousProxy for ScreenCaptureSynchronousProxy {
6660    type Proxy = ScreenCaptureProxy;
6661    type Protocol = ScreenCaptureMarker;
6662
6663    fn from_channel(inner: fidl::Channel) -> Self {
6664        Self::new(inner)
6665    }
6666
6667    fn into_channel(self) -> fidl::Channel {
6668        self.client.into_channel()
6669    }
6670
6671    fn as_channel(&self) -> &fidl::Channel {
6672        self.client.as_channel()
6673    }
6674}
6675
6676#[cfg(target_os = "fuchsia")]
6677impl ScreenCaptureSynchronousProxy {
6678    pub fn new(channel: fidl::Channel) -> Self {
6679        Self { client: fidl::client::sync::Client::new(channel) }
6680    }
6681
6682    pub fn into_channel(self) -> fidl::Channel {
6683        self.client.into_channel()
6684    }
6685
6686    /// Waits until an event arrives and returns it. It is safe for other
6687    /// threads to make concurrent requests while waiting for an event.
6688    pub fn wait_for_event(
6689        &self,
6690        deadline: zx::MonotonicInstant,
6691    ) -> Result<ScreenCaptureEvent, fidl::Error> {
6692        ScreenCaptureEvent::decode(self.client.wait_for_event::<ScreenCaptureMarker>(deadline)?)
6693    }
6694
6695    /// Clients should first use the Allocator protocol to register a
6696    /// BufferCollection. This function will fail with BAD_OPERATION unless all clients of the
6697    /// BufferCollection have set their constraints.
6698    ///
6699    /// Afterwards, clients should create and configure the images that will
6700    /// eventually be rendered to using this method. All the buffers in the
6701    /// collection from 0 to (buffer_count-1) may be used for screen capture.
6702    ///
6703    /// Clients are responsible for determining the rotation of the display,
6704    /// and applying the corrective rotation. For instance, if the display is
6705    /// mounted 90 degrees clockwise (the "top" is on the right, when looking
6706    /// at the display), then the client should specify a 270 degree rotation
6707    /// to account for it.
6708    ///
6709    /// Similarly, the clients are responsible for specifying a buffer big
6710    /// enough for the rotated image. If the buffer is too small, a best effort
6711    /// attempt will be made to render the image.
6712    ///
6713    /// Finally, clients request the server to render the current screen to the
6714    /// shared buffers using [`GetNextFrame`].
6715    ///
6716    /// [`Configure`] can be called again with a new BufferCollectionImportToken
6717    /// if the client wishes to change any of the configuration settings. In
6718    /// this case all the buffers from the previous call to [`Configure`] will
6719    /// be released.
6720    pub fn r#configure(
6721        &self,
6722        mut payload: ScreenCaptureConfig,
6723        ___deadline: zx::MonotonicInstant,
6724    ) -> Result<ScreenCaptureConfigureResult, fidl::Error> {
6725        let _response = self.client.send_query::<ScreenCaptureConfig, fidl::encoding::ResultType<
6726            fidl::encoding::EmptyStruct,
6727            ScreenCaptureError,
6728        >, ScreenCaptureMarker>(
6729            &mut payload,
6730            0x3b6e5af1d294afd9,
6731            fidl::encoding::DynamicFlags::empty(),
6732            ___deadline,
6733        )?;
6734        Ok(_response.map(|x| x))
6735    }
6736
6737    /// Following a successful call to [`Configure`], clients can call
6738    /// GetNextFrame. This will populate a buffer with the most recent frame.
6739    ///
6740    /// Clients should wait on the zx::event they pass for successful
6741    /// completion of the screenshot. It is not guaranteed that the screenshot
6742    /// will be completed by the time this function returns.
6743    ///
6744    /// The requested image will be in the BufferCollection that the client set
6745    /// up in the VMO at the index specified by buffer_id.
6746    ///
6747    /// When ScreenCapture is used to provide a stream, the rate that the
6748    /// client calls GetNextFrame will drive the frame rate.
6749    ///
6750    /// Errors:
6751    /// BAD_OPERATION if Configure was not called, or not called successfully
6752    /// MISSING_ARGS if a required argument is not present
6753    /// BUFFER_FULL if all buffers in the BufferCollection are in use. In this case, ReleaseFrame
6754    /// must be called to make a buffer available before this function can be called successfully.
6755    pub fn r#get_next_frame(
6756        &self,
6757        mut payload: GetNextFrameArgs,
6758        ___deadline: zx::MonotonicInstant,
6759    ) -> Result<ScreenCaptureGetNextFrameResult, fidl::Error> {
6760        let _response = self.client.send_query::<
6761            GetNextFrameArgs,
6762            fidl::encoding::ResultType<FrameInfo, ScreenCaptureError>,
6763            ScreenCaptureMarker,
6764        >(
6765            &mut payload,
6766            0x552c1580aab8c4a7,
6767            fidl::encoding::DynamicFlags::empty(),
6768            ___deadline,
6769        )?;
6770        Ok(_response.map(|x| x))
6771    }
6772
6773    /// Once the client no longer needs an image, they can call ReleaseFrame on
6774    /// the VMO index of the buffer so that the server can reuse it in the future.
6775    pub fn r#release_frame(
6776        &self,
6777        mut buffer_id: u32,
6778        ___deadline: zx::MonotonicInstant,
6779    ) -> Result<ScreenCaptureReleaseFrameResult, fidl::Error> {
6780        let _response =
6781            self.client.send_query::<ScreenCaptureReleaseFrameRequest, fidl::encoding::ResultType<
6782                fidl::encoding::EmptyStruct,
6783                ScreenCaptureError,
6784            >, ScreenCaptureMarker>(
6785                (buffer_id,),
6786                0x46704dce24e35950,
6787                fidl::encoding::DynamicFlags::empty(),
6788                ___deadline,
6789            )?;
6790        Ok(_response.map(|x| x))
6791    }
6792}
6793
6794#[cfg(target_os = "fuchsia")]
6795impl From<ScreenCaptureSynchronousProxy> for zx::NullableHandle {
6796    fn from(value: ScreenCaptureSynchronousProxy) -> Self {
6797        value.into_channel().into()
6798    }
6799}
6800
6801#[cfg(target_os = "fuchsia")]
6802impl From<fidl::Channel> for ScreenCaptureSynchronousProxy {
6803    fn from(value: fidl::Channel) -> Self {
6804        Self::new(value)
6805    }
6806}
6807
6808#[cfg(target_os = "fuchsia")]
6809impl fidl::endpoints::FromClient for ScreenCaptureSynchronousProxy {
6810    type Protocol = ScreenCaptureMarker;
6811
6812    fn from_client(value: fidl::endpoints::ClientEnd<ScreenCaptureMarker>) -> Self {
6813        Self::new(value.into_channel())
6814    }
6815}
6816
6817#[derive(Debug, Clone)]
6818pub struct ScreenCaptureProxy {
6819    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
6820}
6821
6822impl fidl::endpoints::Proxy for ScreenCaptureProxy {
6823    type Protocol = ScreenCaptureMarker;
6824
6825    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
6826        Self::new(inner)
6827    }
6828
6829    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
6830        self.client.into_channel().map_err(|client| Self { client })
6831    }
6832
6833    fn as_channel(&self) -> &::fidl::AsyncChannel {
6834        self.client.as_channel()
6835    }
6836}
6837
6838impl ScreenCaptureProxy {
6839    /// Create a new Proxy for fuchsia.ui.composition/ScreenCapture.
6840    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
6841        let protocol_name = <ScreenCaptureMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
6842        Self { client: fidl::client::Client::new(channel, protocol_name) }
6843    }
6844
6845    /// Get a Stream of events from the remote end of the protocol.
6846    ///
6847    /// # Panics
6848    ///
6849    /// Panics if the event stream was already taken.
6850    pub fn take_event_stream(&self) -> ScreenCaptureEventStream {
6851        ScreenCaptureEventStream { event_receiver: self.client.take_event_receiver() }
6852    }
6853
6854    /// Clients should first use the Allocator protocol to register a
6855    /// BufferCollection. This function will fail with BAD_OPERATION unless all clients of the
6856    /// BufferCollection have set their constraints.
6857    ///
6858    /// Afterwards, clients should create and configure the images that will
6859    /// eventually be rendered to using this method. All the buffers in the
6860    /// collection from 0 to (buffer_count-1) may be used for screen capture.
6861    ///
6862    /// Clients are responsible for determining the rotation of the display,
6863    /// and applying the corrective rotation. For instance, if the display is
6864    /// mounted 90 degrees clockwise (the "top" is on the right, when looking
6865    /// at the display), then the client should specify a 270 degree rotation
6866    /// to account for it.
6867    ///
6868    /// Similarly, the clients are responsible for specifying a buffer big
6869    /// enough for the rotated image. If the buffer is too small, a best effort
6870    /// attempt will be made to render the image.
6871    ///
6872    /// Finally, clients request the server to render the current screen to the
6873    /// shared buffers using [`GetNextFrame`].
6874    ///
6875    /// [`Configure`] can be called again with a new BufferCollectionImportToken
6876    /// if the client wishes to change any of the configuration settings. In
6877    /// this case all the buffers from the previous call to [`Configure`] will
6878    /// be released.
6879    pub fn r#configure(
6880        &self,
6881        mut payload: ScreenCaptureConfig,
6882    ) -> fidl::client::QueryResponseFut<
6883        ScreenCaptureConfigureResult,
6884        fidl::encoding::DefaultFuchsiaResourceDialect,
6885    > {
6886        ScreenCaptureProxyInterface::r#configure(self, payload)
6887    }
6888
6889    /// Following a successful call to [`Configure`], clients can call
6890    /// GetNextFrame. This will populate a buffer with the most recent frame.
6891    ///
6892    /// Clients should wait on the zx::event they pass for successful
6893    /// completion of the screenshot. It is not guaranteed that the screenshot
6894    /// will be completed by the time this function returns.
6895    ///
6896    /// The requested image will be in the BufferCollection that the client set
6897    /// up in the VMO at the index specified by buffer_id.
6898    ///
6899    /// When ScreenCapture is used to provide a stream, the rate that the
6900    /// client calls GetNextFrame will drive the frame rate.
6901    ///
6902    /// Errors:
6903    /// BAD_OPERATION if Configure was not called, or not called successfully
6904    /// MISSING_ARGS if a required argument is not present
6905    /// BUFFER_FULL if all buffers in the BufferCollection are in use. In this case, ReleaseFrame
6906    /// must be called to make a buffer available before this function can be called successfully.
6907    pub fn r#get_next_frame(
6908        &self,
6909        mut payload: GetNextFrameArgs,
6910    ) -> fidl::client::QueryResponseFut<
6911        ScreenCaptureGetNextFrameResult,
6912        fidl::encoding::DefaultFuchsiaResourceDialect,
6913    > {
6914        ScreenCaptureProxyInterface::r#get_next_frame(self, payload)
6915    }
6916
6917    /// Once the client no longer needs an image, they can call ReleaseFrame on
6918    /// the VMO index of the buffer so that the server can reuse it in the future.
6919    pub fn r#release_frame(
6920        &self,
6921        mut buffer_id: u32,
6922    ) -> fidl::client::QueryResponseFut<
6923        ScreenCaptureReleaseFrameResult,
6924        fidl::encoding::DefaultFuchsiaResourceDialect,
6925    > {
6926        ScreenCaptureProxyInterface::r#release_frame(self, buffer_id)
6927    }
6928}
6929
6930impl ScreenCaptureProxyInterface for ScreenCaptureProxy {
6931    type ConfigureResponseFut = fidl::client::QueryResponseFut<
6932        ScreenCaptureConfigureResult,
6933        fidl::encoding::DefaultFuchsiaResourceDialect,
6934    >;
6935    fn r#configure(&self, mut payload: ScreenCaptureConfig) -> Self::ConfigureResponseFut {
6936        fn _decode(
6937            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6938        ) -> Result<ScreenCaptureConfigureResult, fidl::Error> {
6939            let _response = fidl::client::decode_transaction_body::<
6940                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, ScreenCaptureError>,
6941                fidl::encoding::DefaultFuchsiaResourceDialect,
6942                0x3b6e5af1d294afd9,
6943            >(_buf?)?;
6944            Ok(_response.map(|x| x))
6945        }
6946        self.client.send_query_and_decode::<ScreenCaptureConfig, ScreenCaptureConfigureResult>(
6947            &mut payload,
6948            0x3b6e5af1d294afd9,
6949            fidl::encoding::DynamicFlags::empty(),
6950            _decode,
6951        )
6952    }
6953
6954    type GetNextFrameResponseFut = fidl::client::QueryResponseFut<
6955        ScreenCaptureGetNextFrameResult,
6956        fidl::encoding::DefaultFuchsiaResourceDialect,
6957    >;
6958    fn r#get_next_frame(&self, mut payload: GetNextFrameArgs) -> Self::GetNextFrameResponseFut {
6959        fn _decode(
6960            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6961        ) -> Result<ScreenCaptureGetNextFrameResult, fidl::Error> {
6962            let _response = fidl::client::decode_transaction_body::<
6963                fidl::encoding::ResultType<FrameInfo, ScreenCaptureError>,
6964                fidl::encoding::DefaultFuchsiaResourceDialect,
6965                0x552c1580aab8c4a7,
6966            >(_buf?)?;
6967            Ok(_response.map(|x| x))
6968        }
6969        self.client.send_query_and_decode::<GetNextFrameArgs, ScreenCaptureGetNextFrameResult>(
6970            &mut payload,
6971            0x552c1580aab8c4a7,
6972            fidl::encoding::DynamicFlags::empty(),
6973            _decode,
6974        )
6975    }
6976
6977    type ReleaseFrameResponseFut = fidl::client::QueryResponseFut<
6978        ScreenCaptureReleaseFrameResult,
6979        fidl::encoding::DefaultFuchsiaResourceDialect,
6980    >;
6981    fn r#release_frame(&self, mut buffer_id: u32) -> Self::ReleaseFrameResponseFut {
6982        fn _decode(
6983            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6984        ) -> Result<ScreenCaptureReleaseFrameResult, fidl::Error> {
6985            let _response = fidl::client::decode_transaction_body::<
6986                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, ScreenCaptureError>,
6987                fidl::encoding::DefaultFuchsiaResourceDialect,
6988                0x46704dce24e35950,
6989            >(_buf?)?;
6990            Ok(_response.map(|x| x))
6991        }
6992        self.client.send_query_and_decode::<
6993            ScreenCaptureReleaseFrameRequest,
6994            ScreenCaptureReleaseFrameResult,
6995        >(
6996            (buffer_id,),
6997            0x46704dce24e35950,
6998            fidl::encoding::DynamicFlags::empty(),
6999            _decode,
7000        )
7001    }
7002}
7003
7004pub struct ScreenCaptureEventStream {
7005    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
7006}
7007
7008impl std::marker::Unpin for ScreenCaptureEventStream {}
7009
7010impl futures::stream::FusedStream for ScreenCaptureEventStream {
7011    fn is_terminated(&self) -> bool {
7012        self.event_receiver.is_terminated()
7013    }
7014}
7015
7016impl futures::Stream for ScreenCaptureEventStream {
7017    type Item = Result<ScreenCaptureEvent, fidl::Error>;
7018
7019    fn poll_next(
7020        mut self: std::pin::Pin<&mut Self>,
7021        cx: &mut std::task::Context<'_>,
7022    ) -> std::task::Poll<Option<Self::Item>> {
7023        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
7024            &mut self.event_receiver,
7025            cx
7026        )?) {
7027            Some(buf) => std::task::Poll::Ready(Some(ScreenCaptureEvent::decode(buf))),
7028            None => std::task::Poll::Ready(None),
7029        }
7030    }
7031}
7032
7033#[derive(Debug)]
7034pub enum ScreenCaptureEvent {}
7035
7036impl ScreenCaptureEvent {
7037    /// Decodes a message buffer as a [`ScreenCaptureEvent`].
7038    fn decode(
7039        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
7040    ) -> Result<ScreenCaptureEvent, fidl::Error> {
7041        let (bytes, _handles) = buf.split_mut();
7042        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7043        debug_assert_eq!(tx_header.tx_id, 0);
7044        match tx_header.ordinal {
7045            _ => Err(fidl::Error::UnknownOrdinal {
7046                ordinal: tx_header.ordinal,
7047                protocol_name: <ScreenCaptureMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
7048            }),
7049        }
7050    }
7051}
7052
7053/// A Stream of incoming requests for fuchsia.ui.composition/ScreenCapture.
7054pub struct ScreenCaptureRequestStream {
7055    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7056    is_terminated: bool,
7057}
7058
7059impl std::marker::Unpin for ScreenCaptureRequestStream {}
7060
7061impl futures::stream::FusedStream for ScreenCaptureRequestStream {
7062    fn is_terminated(&self) -> bool {
7063        self.is_terminated
7064    }
7065}
7066
7067impl fidl::endpoints::RequestStream for ScreenCaptureRequestStream {
7068    type Protocol = ScreenCaptureMarker;
7069    type ControlHandle = ScreenCaptureControlHandle;
7070
7071    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
7072        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
7073    }
7074
7075    fn control_handle(&self) -> Self::ControlHandle {
7076        ScreenCaptureControlHandle { inner: self.inner.clone() }
7077    }
7078
7079    fn into_inner(
7080        self,
7081    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
7082    {
7083        (self.inner, self.is_terminated)
7084    }
7085
7086    fn from_inner(
7087        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7088        is_terminated: bool,
7089    ) -> Self {
7090        Self { inner, is_terminated }
7091    }
7092}
7093
7094impl futures::Stream for ScreenCaptureRequestStream {
7095    type Item = Result<ScreenCaptureRequest, fidl::Error>;
7096
7097    fn poll_next(
7098        mut self: std::pin::Pin<&mut Self>,
7099        cx: &mut std::task::Context<'_>,
7100    ) -> std::task::Poll<Option<Self::Item>> {
7101        let this = &mut *self;
7102        if this.inner.check_shutdown(cx) {
7103            this.is_terminated = true;
7104            return std::task::Poll::Ready(None);
7105        }
7106        if this.is_terminated {
7107            panic!("polled ScreenCaptureRequestStream after completion");
7108        }
7109        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
7110            |bytes, handles| {
7111                match this.inner.channel().read_etc(cx, bytes, handles) {
7112                    std::task::Poll::Ready(Ok(())) => {}
7113                    std::task::Poll::Pending => return std::task::Poll::Pending,
7114                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
7115                        this.is_terminated = true;
7116                        return std::task::Poll::Ready(None);
7117                    }
7118                    std::task::Poll::Ready(Err(e)) => {
7119                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
7120                            e.into(),
7121                        ))));
7122                    }
7123                }
7124
7125                // A message has been received from the channel
7126                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7127
7128                std::task::Poll::Ready(Some(match header.ordinal {
7129                    0x3b6e5af1d294afd9 => {
7130                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7131                        let mut req = fidl::new_empty!(
7132                            ScreenCaptureConfig,
7133                            fidl::encoding::DefaultFuchsiaResourceDialect
7134                        );
7135                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ScreenCaptureConfig>(&header, _body_bytes, handles, &mut req)?;
7136                        let control_handle =
7137                            ScreenCaptureControlHandle { inner: this.inner.clone() };
7138                        Ok(ScreenCaptureRequest::Configure {
7139                            payload: req,
7140                            responder: ScreenCaptureConfigureResponder {
7141                                control_handle: std::mem::ManuallyDrop::new(control_handle),
7142                                tx_id: header.tx_id,
7143                            },
7144                        })
7145                    }
7146                    0x552c1580aab8c4a7 => {
7147                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7148                        let mut req = fidl::new_empty!(
7149                            GetNextFrameArgs,
7150                            fidl::encoding::DefaultFuchsiaResourceDialect
7151                        );
7152                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<GetNextFrameArgs>(&header, _body_bytes, handles, &mut req)?;
7153                        let control_handle =
7154                            ScreenCaptureControlHandle { inner: this.inner.clone() };
7155                        Ok(ScreenCaptureRequest::GetNextFrame {
7156                            payload: req,
7157                            responder: ScreenCaptureGetNextFrameResponder {
7158                                control_handle: std::mem::ManuallyDrop::new(control_handle),
7159                                tx_id: header.tx_id,
7160                            },
7161                        })
7162                    }
7163                    0x46704dce24e35950 => {
7164                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7165                        let mut req = fidl::new_empty!(
7166                            ScreenCaptureReleaseFrameRequest,
7167                            fidl::encoding::DefaultFuchsiaResourceDialect
7168                        );
7169                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ScreenCaptureReleaseFrameRequest>(&header, _body_bytes, handles, &mut req)?;
7170                        let control_handle =
7171                            ScreenCaptureControlHandle { inner: this.inner.clone() };
7172                        Ok(ScreenCaptureRequest::ReleaseFrame {
7173                            buffer_id: req.buffer_id,
7174
7175                            responder: ScreenCaptureReleaseFrameResponder {
7176                                control_handle: std::mem::ManuallyDrop::new(control_handle),
7177                                tx_id: header.tx_id,
7178                            },
7179                        })
7180                    }
7181                    _ => Err(fidl::Error::UnknownOrdinal {
7182                        ordinal: header.ordinal,
7183                        protocol_name:
7184                            <ScreenCaptureMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
7185                    }),
7186                }))
7187            },
7188        )
7189    }
7190}
7191
7192/// This protocol provides a low-level ScreenCapture API for clients to use.
7193/// ScreenCapture clients should familiarize themselves with the
7194/// [`fuchsia.sysmem/BufferCollection`] and [`fuchsia.ui.composition/Allocator`] protocols
7195/// as those are necessary to create the BufferCollections and images ScreenCapture uses.
7196#[derive(Debug)]
7197pub enum ScreenCaptureRequest {
7198    /// Clients should first use the Allocator protocol to register a
7199    /// BufferCollection. This function will fail with BAD_OPERATION unless all clients of the
7200    /// BufferCollection have set their constraints.
7201    ///
7202    /// Afterwards, clients should create and configure the images that will
7203    /// eventually be rendered to using this method. All the buffers in the
7204    /// collection from 0 to (buffer_count-1) may be used for screen capture.
7205    ///
7206    /// Clients are responsible for determining the rotation of the display,
7207    /// and applying the corrective rotation. For instance, if the display is
7208    /// mounted 90 degrees clockwise (the "top" is on the right, when looking
7209    /// at the display), then the client should specify a 270 degree rotation
7210    /// to account for it.
7211    ///
7212    /// Similarly, the clients are responsible for specifying a buffer big
7213    /// enough for the rotated image. If the buffer is too small, a best effort
7214    /// attempt will be made to render the image.
7215    ///
7216    /// Finally, clients request the server to render the current screen to the
7217    /// shared buffers using [`GetNextFrame`].
7218    ///
7219    /// [`Configure`] can be called again with a new BufferCollectionImportToken
7220    /// if the client wishes to change any of the configuration settings. In
7221    /// this case all the buffers from the previous call to [`Configure`] will
7222    /// be released.
7223    Configure { payload: ScreenCaptureConfig, responder: ScreenCaptureConfigureResponder },
7224    /// Following a successful call to [`Configure`], clients can call
7225    /// GetNextFrame. This will populate a buffer with the most recent frame.
7226    ///
7227    /// Clients should wait on the zx::event they pass for successful
7228    /// completion of the screenshot. It is not guaranteed that the screenshot
7229    /// will be completed by the time this function returns.
7230    ///
7231    /// The requested image will be in the BufferCollection that the client set
7232    /// up in the VMO at the index specified by buffer_id.
7233    ///
7234    /// When ScreenCapture is used to provide a stream, the rate that the
7235    /// client calls GetNextFrame will drive the frame rate.
7236    ///
7237    /// Errors:
7238    /// BAD_OPERATION if Configure was not called, or not called successfully
7239    /// MISSING_ARGS if a required argument is not present
7240    /// BUFFER_FULL if all buffers in the BufferCollection are in use. In this case, ReleaseFrame
7241    /// must be called to make a buffer available before this function can be called successfully.
7242    GetNextFrame { payload: GetNextFrameArgs, responder: ScreenCaptureGetNextFrameResponder },
7243    /// Once the client no longer needs an image, they can call ReleaseFrame on
7244    /// the VMO index of the buffer so that the server can reuse it in the future.
7245    ReleaseFrame { buffer_id: u32, responder: ScreenCaptureReleaseFrameResponder },
7246}
7247
7248impl ScreenCaptureRequest {
7249    #[allow(irrefutable_let_patterns)]
7250    pub fn into_configure(self) -> Option<(ScreenCaptureConfig, ScreenCaptureConfigureResponder)> {
7251        if let ScreenCaptureRequest::Configure { payload, responder } = self {
7252            Some((payload, responder))
7253        } else {
7254            None
7255        }
7256    }
7257
7258    #[allow(irrefutable_let_patterns)]
7259    pub fn into_get_next_frame(
7260        self,
7261    ) -> Option<(GetNextFrameArgs, ScreenCaptureGetNextFrameResponder)> {
7262        if let ScreenCaptureRequest::GetNextFrame { payload, responder } = self {
7263            Some((payload, responder))
7264        } else {
7265            None
7266        }
7267    }
7268
7269    #[allow(irrefutable_let_patterns)]
7270    pub fn into_release_frame(self) -> Option<(u32, ScreenCaptureReleaseFrameResponder)> {
7271        if let ScreenCaptureRequest::ReleaseFrame { buffer_id, responder } = self {
7272            Some((buffer_id, responder))
7273        } else {
7274            None
7275        }
7276    }
7277
7278    /// Name of the method defined in FIDL
7279    pub fn method_name(&self) -> &'static str {
7280        match *self {
7281            ScreenCaptureRequest::Configure { .. } => "configure",
7282            ScreenCaptureRequest::GetNextFrame { .. } => "get_next_frame",
7283            ScreenCaptureRequest::ReleaseFrame { .. } => "release_frame",
7284        }
7285    }
7286}
7287
7288#[derive(Debug, Clone)]
7289pub struct ScreenCaptureControlHandle {
7290    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7291}
7292
7293impl fidl::endpoints::ControlHandle for ScreenCaptureControlHandle {
7294    fn shutdown(&self) {
7295        self.inner.shutdown()
7296    }
7297
7298    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
7299        self.inner.shutdown_with_epitaph(status)
7300    }
7301
7302    fn is_closed(&self) -> bool {
7303        self.inner.channel().is_closed()
7304    }
7305    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
7306        self.inner.channel().on_closed()
7307    }
7308
7309    #[cfg(target_os = "fuchsia")]
7310    fn signal_peer(
7311        &self,
7312        clear_mask: zx::Signals,
7313        set_mask: zx::Signals,
7314    ) -> Result<(), zx_status::Status> {
7315        use fidl::Peered;
7316        self.inner.channel().signal_peer(clear_mask, set_mask)
7317    }
7318}
7319
7320impl ScreenCaptureControlHandle {}
7321
7322#[must_use = "FIDL methods require a response to be sent"]
7323#[derive(Debug)]
7324pub struct ScreenCaptureConfigureResponder {
7325    control_handle: std::mem::ManuallyDrop<ScreenCaptureControlHandle>,
7326    tx_id: u32,
7327}
7328
7329/// Set the the channel to be shutdown (see [`ScreenCaptureControlHandle::shutdown`])
7330/// if the responder is dropped without sending a response, so that the client
7331/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7332impl std::ops::Drop for ScreenCaptureConfigureResponder {
7333    fn drop(&mut self) {
7334        self.control_handle.shutdown();
7335        // Safety: drops once, never accessed again
7336        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7337    }
7338}
7339
7340impl fidl::endpoints::Responder for ScreenCaptureConfigureResponder {
7341    type ControlHandle = ScreenCaptureControlHandle;
7342
7343    fn control_handle(&self) -> &ScreenCaptureControlHandle {
7344        &self.control_handle
7345    }
7346
7347    fn drop_without_shutdown(mut self) {
7348        // Safety: drops once, never accessed again due to mem::forget
7349        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7350        // Prevent Drop from running (which would shut down the channel)
7351        std::mem::forget(self);
7352    }
7353}
7354
7355impl ScreenCaptureConfigureResponder {
7356    /// Sends a response to the FIDL transaction.
7357    ///
7358    /// Sets the channel to shutdown if an error occurs.
7359    pub fn send(self, mut result: Result<(), ScreenCaptureError>) -> Result<(), fidl::Error> {
7360        let _result = self.send_raw(result);
7361        if _result.is_err() {
7362            self.control_handle.shutdown();
7363        }
7364        self.drop_without_shutdown();
7365        _result
7366    }
7367
7368    /// Similar to "send" but does not shutdown the channel if an error occurs.
7369    pub fn send_no_shutdown_on_err(
7370        self,
7371        mut result: Result<(), ScreenCaptureError>,
7372    ) -> Result<(), fidl::Error> {
7373        let _result = self.send_raw(result);
7374        self.drop_without_shutdown();
7375        _result
7376    }
7377
7378    fn send_raw(&self, mut result: Result<(), ScreenCaptureError>) -> Result<(), fidl::Error> {
7379        self.control_handle.inner.send::<fidl::encoding::ResultType<
7380            fidl::encoding::EmptyStruct,
7381            ScreenCaptureError,
7382        >>(
7383            result,
7384            self.tx_id,
7385            0x3b6e5af1d294afd9,
7386            fidl::encoding::DynamicFlags::empty(),
7387        )
7388    }
7389}
7390
7391#[must_use = "FIDL methods require a response to be sent"]
7392#[derive(Debug)]
7393pub struct ScreenCaptureGetNextFrameResponder {
7394    control_handle: std::mem::ManuallyDrop<ScreenCaptureControlHandle>,
7395    tx_id: u32,
7396}
7397
7398/// Set the the channel to be shutdown (see [`ScreenCaptureControlHandle::shutdown`])
7399/// if the responder is dropped without sending a response, so that the client
7400/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7401impl std::ops::Drop for ScreenCaptureGetNextFrameResponder {
7402    fn drop(&mut self) {
7403        self.control_handle.shutdown();
7404        // Safety: drops once, never accessed again
7405        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7406    }
7407}
7408
7409impl fidl::endpoints::Responder for ScreenCaptureGetNextFrameResponder {
7410    type ControlHandle = ScreenCaptureControlHandle;
7411
7412    fn control_handle(&self) -> &ScreenCaptureControlHandle {
7413        &self.control_handle
7414    }
7415
7416    fn drop_without_shutdown(mut self) {
7417        // Safety: drops once, never accessed again due to mem::forget
7418        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7419        // Prevent Drop from running (which would shut down the channel)
7420        std::mem::forget(self);
7421    }
7422}
7423
7424impl ScreenCaptureGetNextFrameResponder {
7425    /// Sends a response to the FIDL transaction.
7426    ///
7427    /// Sets the channel to shutdown if an error occurs.
7428    pub fn send(
7429        self,
7430        mut result: Result<FrameInfo, ScreenCaptureError>,
7431    ) -> Result<(), fidl::Error> {
7432        let _result = self.send_raw(result);
7433        if _result.is_err() {
7434            self.control_handle.shutdown();
7435        }
7436        self.drop_without_shutdown();
7437        _result
7438    }
7439
7440    /// Similar to "send" but does not shutdown the channel if an error occurs.
7441    pub fn send_no_shutdown_on_err(
7442        self,
7443        mut result: Result<FrameInfo, ScreenCaptureError>,
7444    ) -> Result<(), fidl::Error> {
7445        let _result = self.send_raw(result);
7446        self.drop_without_shutdown();
7447        _result
7448    }
7449
7450    fn send_raw(
7451        &self,
7452        mut result: Result<FrameInfo, ScreenCaptureError>,
7453    ) -> Result<(), fidl::Error> {
7454        self.control_handle.inner.send::<fidl::encoding::ResultType<FrameInfo, ScreenCaptureError>>(
7455            result.as_mut().map_err(|e| *e),
7456            self.tx_id,
7457            0x552c1580aab8c4a7,
7458            fidl::encoding::DynamicFlags::empty(),
7459        )
7460    }
7461}
7462
7463#[must_use = "FIDL methods require a response to be sent"]
7464#[derive(Debug)]
7465pub struct ScreenCaptureReleaseFrameResponder {
7466    control_handle: std::mem::ManuallyDrop<ScreenCaptureControlHandle>,
7467    tx_id: u32,
7468}
7469
7470/// Set the the channel to be shutdown (see [`ScreenCaptureControlHandle::shutdown`])
7471/// if the responder is dropped without sending a response, so that the client
7472/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7473impl std::ops::Drop for ScreenCaptureReleaseFrameResponder {
7474    fn drop(&mut self) {
7475        self.control_handle.shutdown();
7476        // Safety: drops once, never accessed again
7477        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7478    }
7479}
7480
7481impl fidl::endpoints::Responder for ScreenCaptureReleaseFrameResponder {
7482    type ControlHandle = ScreenCaptureControlHandle;
7483
7484    fn control_handle(&self) -> &ScreenCaptureControlHandle {
7485        &self.control_handle
7486    }
7487
7488    fn drop_without_shutdown(mut self) {
7489        // Safety: drops once, never accessed again due to mem::forget
7490        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7491        // Prevent Drop from running (which would shut down the channel)
7492        std::mem::forget(self);
7493    }
7494}
7495
7496impl ScreenCaptureReleaseFrameResponder {
7497    /// Sends a response to the FIDL transaction.
7498    ///
7499    /// Sets the channel to shutdown if an error occurs.
7500    pub fn send(self, mut result: Result<(), ScreenCaptureError>) -> Result<(), fidl::Error> {
7501        let _result = self.send_raw(result);
7502        if _result.is_err() {
7503            self.control_handle.shutdown();
7504        }
7505        self.drop_without_shutdown();
7506        _result
7507    }
7508
7509    /// Similar to "send" but does not shutdown the channel if an error occurs.
7510    pub fn send_no_shutdown_on_err(
7511        self,
7512        mut result: Result<(), ScreenCaptureError>,
7513    ) -> Result<(), fidl::Error> {
7514        let _result = self.send_raw(result);
7515        self.drop_without_shutdown();
7516        _result
7517    }
7518
7519    fn send_raw(&self, mut result: Result<(), ScreenCaptureError>) -> Result<(), fidl::Error> {
7520        self.control_handle.inner.send::<fidl::encoding::ResultType<
7521            fidl::encoding::EmptyStruct,
7522            ScreenCaptureError,
7523        >>(
7524            result,
7525            self.tx_id,
7526            0x46704dce24e35950,
7527            fidl::encoding::DynamicFlags::empty(),
7528        )
7529    }
7530}
7531
7532#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
7533pub struct ScreenshotMarker;
7534
7535impl fidl::endpoints::ProtocolMarker for ScreenshotMarker {
7536    type Proxy = ScreenshotProxy;
7537    type RequestStream = ScreenshotRequestStream;
7538    #[cfg(target_os = "fuchsia")]
7539    type SynchronousProxy = ScreenshotSynchronousProxy;
7540
7541    const DEBUG_NAME: &'static str = "fuchsia.ui.composition.Screenshot";
7542}
7543impl fidl::endpoints::DiscoverableProtocolMarker for ScreenshotMarker {}
7544
7545pub trait ScreenshotProxyInterface: Send + Sync {
7546    type TakeResponseFut: std::future::Future<Output = Result<ScreenshotTakeResponse, fidl::Error>>
7547        + Send;
7548    fn r#take(&self, payload: ScreenshotTakeRequest) -> Self::TakeResponseFut;
7549    type TakeFileResponseFut: std::future::Future<Output = Result<ScreenshotTakeFileResponse, fidl::Error>>
7550        + Send;
7551    fn r#take_file(&self, payload: ScreenshotTakeFileRequest) -> Self::TakeFileResponseFut;
7552}
7553#[derive(Debug)]
7554#[cfg(target_os = "fuchsia")]
7555pub struct ScreenshotSynchronousProxy {
7556    client: fidl::client::sync::Client,
7557}
7558
7559#[cfg(target_os = "fuchsia")]
7560impl fidl::endpoints::SynchronousProxy for ScreenshotSynchronousProxy {
7561    type Proxy = ScreenshotProxy;
7562    type Protocol = ScreenshotMarker;
7563
7564    fn from_channel(inner: fidl::Channel) -> Self {
7565        Self::new(inner)
7566    }
7567
7568    fn into_channel(self) -> fidl::Channel {
7569        self.client.into_channel()
7570    }
7571
7572    fn as_channel(&self) -> &fidl::Channel {
7573        self.client.as_channel()
7574    }
7575}
7576
7577#[cfg(target_os = "fuchsia")]
7578impl ScreenshotSynchronousProxy {
7579    pub fn new(channel: fidl::Channel) -> Self {
7580        Self { client: fidl::client::sync::Client::new(channel) }
7581    }
7582
7583    pub fn into_channel(self) -> fidl::Channel {
7584        self.client.into_channel()
7585    }
7586
7587    /// Waits until an event arrives and returns it. It is safe for other
7588    /// threads to make concurrent requests while waiting for an event.
7589    pub fn wait_for_event(
7590        &self,
7591        deadline: zx::MonotonicInstant,
7592    ) -> Result<ScreenshotEvent, fidl::Error> {
7593        ScreenshotEvent::decode(self.client.wait_for_event::<ScreenshotMarker>(deadline)?)
7594    }
7595
7596    /// Collects the current graphical content of a display in a specified buffer `format` in the
7597    /// sRGB color space. Note that the sRGB color space is non-linear, meaning that unit tests
7598    /// doing pixel equality checks making use of non-fully saturated colors should convert to a
7599    /// linear color space.
7600    ///
7601    /// See https://fuchsia.dev/fuchsia-src/concepts/ui/scenic/color_spaces for more information.
7602    ///
7603    /// Screenshot is taken immediately, populated with the display's content from the most recent
7604    /// VSYNC.
7605    ///
7606    /// If the client calls [`Take`] a second time before a first [`Take`] call returns, the server
7607    /// will close the Screenshot connection with a ZX_ERR_SHOULD_WAIT epitaph.
7608    ///
7609    /// If capture fails due to an internal error, the server will close the Screenshot connection
7610    /// with a ZX_ERR_INTERNAL epitaph.
7611    pub fn r#take(
7612        &self,
7613        mut payload: ScreenshotTakeRequest,
7614        ___deadline: zx::MonotonicInstant,
7615    ) -> Result<ScreenshotTakeResponse, fidl::Error> {
7616        let _response = self
7617            .client
7618            .send_query::<ScreenshotTakeRequest, ScreenshotTakeResponse, ScreenshotMarker>(
7619                &mut payload,
7620                0x51341396e9fd2fd0,
7621                fidl::encoding::DynamicFlags::empty(),
7622                ___deadline,
7623            )?;
7624        Ok(_response)
7625    }
7626
7627    /// Collects the current graphical content of a display in a specified buffer `format` in the
7628    /// sRGB color space. Note that the sRGB color space is non-linear, meaning that unit tests
7629    /// doing pixel equality checks making use of non-fully saturated colors should convert to a
7630    /// linear color space.
7631    ///
7632    /// TODO(https://fxbug.dev/42065844): Link to fuchsia.dev documentation when it's up.
7633    ///
7634    /// Screenshot is taken immediately, populated with the display's content from the most recent
7635    /// VSYNC.
7636    ///
7637    /// If the client calls [`TakeFile`] a second time before a first [`TakeFile`] call returns,
7638    /// the server will close the Screenshot connection with a ZX_ERR_SHOULD_WAIT epitaph.
7639    ///
7640    /// If capture fails due to an internal error, the server will close the Screenshot connection
7641    /// with a ZX_ERR_INTERNAL epitaph.
7642    ///
7643    /// This call should be used if the client is on the host and does not support VMOs,
7644    /// as is the case for ffx tools.
7645    pub fn r#take_file(
7646        &self,
7647        mut payload: ScreenshotTakeFileRequest,
7648        ___deadline: zx::MonotonicInstant,
7649    ) -> Result<ScreenshotTakeFileResponse, fidl::Error> {
7650        let _response = self
7651            .client
7652            .send_query::<ScreenshotTakeFileRequest, ScreenshotTakeFileResponse, ScreenshotMarker>(
7653                &mut payload,
7654                0x470aeea0a4d32903,
7655                fidl::encoding::DynamicFlags::empty(),
7656                ___deadline,
7657            )?;
7658        Ok(_response)
7659    }
7660}
7661
7662#[cfg(target_os = "fuchsia")]
7663impl From<ScreenshotSynchronousProxy> for zx::NullableHandle {
7664    fn from(value: ScreenshotSynchronousProxy) -> Self {
7665        value.into_channel().into()
7666    }
7667}
7668
7669#[cfg(target_os = "fuchsia")]
7670impl From<fidl::Channel> for ScreenshotSynchronousProxy {
7671    fn from(value: fidl::Channel) -> Self {
7672        Self::new(value)
7673    }
7674}
7675
7676#[cfg(target_os = "fuchsia")]
7677impl fidl::endpoints::FromClient for ScreenshotSynchronousProxy {
7678    type Protocol = ScreenshotMarker;
7679
7680    fn from_client(value: fidl::endpoints::ClientEnd<ScreenshotMarker>) -> Self {
7681        Self::new(value.into_channel())
7682    }
7683}
7684
7685#[derive(Debug, Clone)]
7686pub struct ScreenshotProxy {
7687    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
7688}
7689
7690impl fidl::endpoints::Proxy for ScreenshotProxy {
7691    type Protocol = ScreenshotMarker;
7692
7693    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
7694        Self::new(inner)
7695    }
7696
7697    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
7698        self.client.into_channel().map_err(|client| Self { client })
7699    }
7700
7701    fn as_channel(&self) -> &::fidl::AsyncChannel {
7702        self.client.as_channel()
7703    }
7704}
7705
7706impl ScreenshotProxy {
7707    /// Create a new Proxy for fuchsia.ui.composition/Screenshot.
7708    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
7709        let protocol_name = <ScreenshotMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
7710        Self { client: fidl::client::Client::new(channel, protocol_name) }
7711    }
7712
7713    /// Get a Stream of events from the remote end of the protocol.
7714    ///
7715    /// # Panics
7716    ///
7717    /// Panics if the event stream was already taken.
7718    pub fn take_event_stream(&self) -> ScreenshotEventStream {
7719        ScreenshotEventStream { event_receiver: self.client.take_event_receiver() }
7720    }
7721
7722    /// Collects the current graphical content of a display in a specified buffer `format` in the
7723    /// sRGB color space. Note that the sRGB color space is non-linear, meaning that unit tests
7724    /// doing pixel equality checks making use of non-fully saturated colors should convert to a
7725    /// linear color space.
7726    ///
7727    /// See https://fuchsia.dev/fuchsia-src/concepts/ui/scenic/color_spaces for more information.
7728    ///
7729    /// Screenshot is taken immediately, populated with the display's content from the most recent
7730    /// VSYNC.
7731    ///
7732    /// If the client calls [`Take`] a second time before a first [`Take`] call returns, the server
7733    /// will close the Screenshot connection with a ZX_ERR_SHOULD_WAIT epitaph.
7734    ///
7735    /// If capture fails due to an internal error, the server will close the Screenshot connection
7736    /// with a ZX_ERR_INTERNAL epitaph.
7737    pub fn r#take(
7738        &self,
7739        mut payload: ScreenshotTakeRequest,
7740    ) -> fidl::client::QueryResponseFut<
7741        ScreenshotTakeResponse,
7742        fidl::encoding::DefaultFuchsiaResourceDialect,
7743    > {
7744        ScreenshotProxyInterface::r#take(self, payload)
7745    }
7746
7747    /// Collects the current graphical content of a display in a specified buffer `format` in the
7748    /// sRGB color space. Note that the sRGB color space is non-linear, meaning that unit tests
7749    /// doing pixel equality checks making use of non-fully saturated colors should convert to a
7750    /// linear color space.
7751    ///
7752    /// TODO(https://fxbug.dev/42065844): Link to fuchsia.dev documentation when it's up.
7753    ///
7754    /// Screenshot is taken immediately, populated with the display's content from the most recent
7755    /// VSYNC.
7756    ///
7757    /// If the client calls [`TakeFile`] a second time before a first [`TakeFile`] call returns,
7758    /// the server will close the Screenshot connection with a ZX_ERR_SHOULD_WAIT epitaph.
7759    ///
7760    /// If capture fails due to an internal error, the server will close the Screenshot connection
7761    /// with a ZX_ERR_INTERNAL epitaph.
7762    ///
7763    /// This call should be used if the client is on the host and does not support VMOs,
7764    /// as is the case for ffx tools.
7765    pub fn r#take_file(
7766        &self,
7767        mut payload: ScreenshotTakeFileRequest,
7768    ) -> fidl::client::QueryResponseFut<
7769        ScreenshotTakeFileResponse,
7770        fidl::encoding::DefaultFuchsiaResourceDialect,
7771    > {
7772        ScreenshotProxyInterface::r#take_file(self, payload)
7773    }
7774}
7775
7776impl ScreenshotProxyInterface for ScreenshotProxy {
7777    type TakeResponseFut = fidl::client::QueryResponseFut<
7778        ScreenshotTakeResponse,
7779        fidl::encoding::DefaultFuchsiaResourceDialect,
7780    >;
7781    fn r#take(&self, mut payload: ScreenshotTakeRequest) -> Self::TakeResponseFut {
7782        fn _decode(
7783            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7784        ) -> Result<ScreenshotTakeResponse, fidl::Error> {
7785            let _response = fidl::client::decode_transaction_body::<
7786                ScreenshotTakeResponse,
7787                fidl::encoding::DefaultFuchsiaResourceDialect,
7788                0x51341396e9fd2fd0,
7789            >(_buf?)?;
7790            Ok(_response)
7791        }
7792        self.client.send_query_and_decode::<ScreenshotTakeRequest, ScreenshotTakeResponse>(
7793            &mut payload,
7794            0x51341396e9fd2fd0,
7795            fidl::encoding::DynamicFlags::empty(),
7796            _decode,
7797        )
7798    }
7799
7800    type TakeFileResponseFut = fidl::client::QueryResponseFut<
7801        ScreenshotTakeFileResponse,
7802        fidl::encoding::DefaultFuchsiaResourceDialect,
7803    >;
7804    fn r#take_file(&self, mut payload: ScreenshotTakeFileRequest) -> Self::TakeFileResponseFut {
7805        fn _decode(
7806            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7807        ) -> Result<ScreenshotTakeFileResponse, fidl::Error> {
7808            let _response = fidl::client::decode_transaction_body::<
7809                ScreenshotTakeFileResponse,
7810                fidl::encoding::DefaultFuchsiaResourceDialect,
7811                0x470aeea0a4d32903,
7812            >(_buf?)?;
7813            Ok(_response)
7814        }
7815        self.client.send_query_and_decode::<ScreenshotTakeFileRequest, ScreenshotTakeFileResponse>(
7816            &mut payload,
7817            0x470aeea0a4d32903,
7818            fidl::encoding::DynamicFlags::empty(),
7819            _decode,
7820        )
7821    }
7822}
7823
7824pub struct ScreenshotEventStream {
7825    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
7826}
7827
7828impl std::marker::Unpin for ScreenshotEventStream {}
7829
7830impl futures::stream::FusedStream for ScreenshotEventStream {
7831    fn is_terminated(&self) -> bool {
7832        self.event_receiver.is_terminated()
7833    }
7834}
7835
7836impl futures::Stream for ScreenshotEventStream {
7837    type Item = Result<ScreenshotEvent, fidl::Error>;
7838
7839    fn poll_next(
7840        mut self: std::pin::Pin<&mut Self>,
7841        cx: &mut std::task::Context<'_>,
7842    ) -> std::task::Poll<Option<Self::Item>> {
7843        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
7844            &mut self.event_receiver,
7845            cx
7846        )?) {
7847            Some(buf) => std::task::Poll::Ready(Some(ScreenshotEvent::decode(buf))),
7848            None => std::task::Poll::Ready(None),
7849        }
7850    }
7851}
7852
7853#[derive(Debug)]
7854pub enum ScreenshotEvent {}
7855
7856impl ScreenshotEvent {
7857    /// Decodes a message buffer as a [`ScreenshotEvent`].
7858    fn decode(
7859        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
7860    ) -> Result<ScreenshotEvent, fidl::Error> {
7861        let (bytes, _handles) = buf.split_mut();
7862        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7863        debug_assert_eq!(tx_header.tx_id, 0);
7864        match tx_header.ordinal {
7865            _ => Err(fidl::Error::UnknownOrdinal {
7866                ordinal: tx_header.ordinal,
7867                protocol_name: <ScreenshotMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
7868            }),
7869        }
7870    }
7871}
7872
7873/// A Stream of incoming requests for fuchsia.ui.composition/Screenshot.
7874pub struct ScreenshotRequestStream {
7875    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7876    is_terminated: bool,
7877}
7878
7879impl std::marker::Unpin for ScreenshotRequestStream {}
7880
7881impl futures::stream::FusedStream for ScreenshotRequestStream {
7882    fn is_terminated(&self) -> bool {
7883        self.is_terminated
7884    }
7885}
7886
7887impl fidl::endpoints::RequestStream for ScreenshotRequestStream {
7888    type Protocol = ScreenshotMarker;
7889    type ControlHandle = ScreenshotControlHandle;
7890
7891    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
7892        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
7893    }
7894
7895    fn control_handle(&self) -> Self::ControlHandle {
7896        ScreenshotControlHandle { inner: self.inner.clone() }
7897    }
7898
7899    fn into_inner(
7900        self,
7901    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
7902    {
7903        (self.inner, self.is_terminated)
7904    }
7905
7906    fn from_inner(
7907        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7908        is_terminated: bool,
7909    ) -> Self {
7910        Self { inner, is_terminated }
7911    }
7912}
7913
7914impl futures::Stream for ScreenshotRequestStream {
7915    type Item = Result<ScreenshotRequest, fidl::Error>;
7916
7917    fn poll_next(
7918        mut self: std::pin::Pin<&mut Self>,
7919        cx: &mut std::task::Context<'_>,
7920    ) -> std::task::Poll<Option<Self::Item>> {
7921        let this = &mut *self;
7922        if this.inner.check_shutdown(cx) {
7923            this.is_terminated = true;
7924            return std::task::Poll::Ready(None);
7925        }
7926        if this.is_terminated {
7927            panic!("polled ScreenshotRequestStream after completion");
7928        }
7929        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
7930            |bytes, handles| {
7931                match this.inner.channel().read_etc(cx, bytes, handles) {
7932                    std::task::Poll::Ready(Ok(())) => {}
7933                    std::task::Poll::Pending => return std::task::Poll::Pending,
7934                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
7935                        this.is_terminated = true;
7936                        return std::task::Poll::Ready(None);
7937                    }
7938                    std::task::Poll::Ready(Err(e)) => {
7939                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
7940                            e.into(),
7941                        ))));
7942                    }
7943                }
7944
7945                // A message has been received from the channel
7946                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7947
7948                std::task::Poll::Ready(Some(match header.ordinal {
7949                    0x51341396e9fd2fd0 => {
7950                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7951                        let mut req = fidl::new_empty!(
7952                            ScreenshotTakeRequest,
7953                            fidl::encoding::DefaultFuchsiaResourceDialect
7954                        );
7955                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ScreenshotTakeRequest>(&header, _body_bytes, handles, &mut req)?;
7956                        let control_handle = ScreenshotControlHandle { inner: this.inner.clone() };
7957                        Ok(ScreenshotRequest::Take {
7958                            payload: req,
7959                            responder: ScreenshotTakeResponder {
7960                                control_handle: std::mem::ManuallyDrop::new(control_handle),
7961                                tx_id: header.tx_id,
7962                            },
7963                        })
7964                    }
7965                    0x470aeea0a4d32903 => {
7966                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7967                        let mut req = fidl::new_empty!(
7968                            ScreenshotTakeFileRequest,
7969                            fidl::encoding::DefaultFuchsiaResourceDialect
7970                        );
7971                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ScreenshotTakeFileRequest>(&header, _body_bytes, handles, &mut req)?;
7972                        let control_handle = ScreenshotControlHandle { inner: this.inner.clone() };
7973                        Ok(ScreenshotRequest::TakeFile {
7974                            payload: req,
7975                            responder: ScreenshotTakeFileResponder {
7976                                control_handle: std::mem::ManuallyDrop::new(control_handle),
7977                                tx_id: header.tx_id,
7978                            },
7979                        })
7980                    }
7981                    _ => Err(fidl::Error::UnknownOrdinal {
7982                        ordinal: header.ordinal,
7983                        protocol_name:
7984                            <ScreenshotMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
7985                    }),
7986                }))
7987            },
7988        )
7989    }
7990}
7991
7992/// Collects the current graphical content of a display.
7993#[derive(Debug)]
7994pub enum ScreenshotRequest {
7995    /// Collects the current graphical content of a display in a specified buffer `format` in the
7996    /// sRGB color space. Note that the sRGB color space is non-linear, meaning that unit tests
7997    /// doing pixel equality checks making use of non-fully saturated colors should convert to a
7998    /// linear color space.
7999    ///
8000    /// See https://fuchsia.dev/fuchsia-src/concepts/ui/scenic/color_spaces for more information.
8001    ///
8002    /// Screenshot is taken immediately, populated with the display's content from the most recent
8003    /// VSYNC.
8004    ///
8005    /// If the client calls [`Take`] a second time before a first [`Take`] call returns, the server
8006    /// will close the Screenshot connection with a ZX_ERR_SHOULD_WAIT epitaph.
8007    ///
8008    /// If capture fails due to an internal error, the server will close the Screenshot connection
8009    /// with a ZX_ERR_INTERNAL epitaph.
8010    Take { payload: ScreenshotTakeRequest, responder: ScreenshotTakeResponder },
8011    /// Collects the current graphical content of a display in a specified buffer `format` in the
8012    /// sRGB color space. Note that the sRGB color space is non-linear, meaning that unit tests
8013    /// doing pixel equality checks making use of non-fully saturated colors should convert to a
8014    /// linear color space.
8015    ///
8016    /// TODO(https://fxbug.dev/42065844): Link to fuchsia.dev documentation when it's up.
8017    ///
8018    /// Screenshot is taken immediately, populated with the display's content from the most recent
8019    /// VSYNC.
8020    ///
8021    /// If the client calls [`TakeFile`] a second time before a first [`TakeFile`] call returns,
8022    /// the server will close the Screenshot connection with a ZX_ERR_SHOULD_WAIT epitaph.
8023    ///
8024    /// If capture fails due to an internal error, the server will close the Screenshot connection
8025    /// with a ZX_ERR_INTERNAL epitaph.
8026    ///
8027    /// This call should be used if the client is on the host and does not support VMOs,
8028    /// as is the case for ffx tools.
8029    TakeFile { payload: ScreenshotTakeFileRequest, responder: ScreenshotTakeFileResponder },
8030}
8031
8032impl ScreenshotRequest {
8033    #[allow(irrefutable_let_patterns)]
8034    pub fn into_take(self) -> Option<(ScreenshotTakeRequest, ScreenshotTakeResponder)> {
8035        if let ScreenshotRequest::Take { payload, responder } = self {
8036            Some((payload, responder))
8037        } else {
8038            None
8039        }
8040    }
8041
8042    #[allow(irrefutable_let_patterns)]
8043    pub fn into_take_file(
8044        self,
8045    ) -> Option<(ScreenshotTakeFileRequest, ScreenshotTakeFileResponder)> {
8046        if let ScreenshotRequest::TakeFile { payload, responder } = self {
8047            Some((payload, responder))
8048        } else {
8049            None
8050        }
8051    }
8052
8053    /// Name of the method defined in FIDL
8054    pub fn method_name(&self) -> &'static str {
8055        match *self {
8056            ScreenshotRequest::Take { .. } => "take",
8057            ScreenshotRequest::TakeFile { .. } => "take_file",
8058        }
8059    }
8060}
8061
8062#[derive(Debug, Clone)]
8063pub struct ScreenshotControlHandle {
8064    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8065}
8066
8067impl fidl::endpoints::ControlHandle for ScreenshotControlHandle {
8068    fn shutdown(&self) {
8069        self.inner.shutdown()
8070    }
8071
8072    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
8073        self.inner.shutdown_with_epitaph(status)
8074    }
8075
8076    fn is_closed(&self) -> bool {
8077        self.inner.channel().is_closed()
8078    }
8079    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
8080        self.inner.channel().on_closed()
8081    }
8082
8083    #[cfg(target_os = "fuchsia")]
8084    fn signal_peer(
8085        &self,
8086        clear_mask: zx::Signals,
8087        set_mask: zx::Signals,
8088    ) -> Result<(), zx_status::Status> {
8089        use fidl::Peered;
8090        self.inner.channel().signal_peer(clear_mask, set_mask)
8091    }
8092}
8093
8094impl ScreenshotControlHandle {}
8095
8096#[must_use = "FIDL methods require a response to be sent"]
8097#[derive(Debug)]
8098pub struct ScreenshotTakeResponder {
8099    control_handle: std::mem::ManuallyDrop<ScreenshotControlHandle>,
8100    tx_id: u32,
8101}
8102
8103/// Set the the channel to be shutdown (see [`ScreenshotControlHandle::shutdown`])
8104/// if the responder is dropped without sending a response, so that the client
8105/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
8106impl std::ops::Drop for ScreenshotTakeResponder {
8107    fn drop(&mut self) {
8108        self.control_handle.shutdown();
8109        // Safety: drops once, never accessed again
8110        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8111    }
8112}
8113
8114impl fidl::endpoints::Responder for ScreenshotTakeResponder {
8115    type ControlHandle = ScreenshotControlHandle;
8116
8117    fn control_handle(&self) -> &ScreenshotControlHandle {
8118        &self.control_handle
8119    }
8120
8121    fn drop_without_shutdown(mut self) {
8122        // Safety: drops once, never accessed again due to mem::forget
8123        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8124        // Prevent Drop from running (which would shut down the channel)
8125        std::mem::forget(self);
8126    }
8127}
8128
8129impl ScreenshotTakeResponder {
8130    /// Sends a response to the FIDL transaction.
8131    ///
8132    /// Sets the channel to shutdown if an error occurs.
8133    pub fn send(self, mut payload: ScreenshotTakeResponse) -> Result<(), fidl::Error> {
8134        let _result = self.send_raw(payload);
8135        if _result.is_err() {
8136            self.control_handle.shutdown();
8137        }
8138        self.drop_without_shutdown();
8139        _result
8140    }
8141
8142    /// Similar to "send" but does not shutdown the channel if an error occurs.
8143    pub fn send_no_shutdown_on_err(
8144        self,
8145        mut payload: ScreenshotTakeResponse,
8146    ) -> Result<(), fidl::Error> {
8147        let _result = self.send_raw(payload);
8148        self.drop_without_shutdown();
8149        _result
8150    }
8151
8152    fn send_raw(&self, mut payload: ScreenshotTakeResponse) -> Result<(), fidl::Error> {
8153        self.control_handle.inner.send::<ScreenshotTakeResponse>(
8154            &mut payload,
8155            self.tx_id,
8156            0x51341396e9fd2fd0,
8157            fidl::encoding::DynamicFlags::empty(),
8158        )
8159    }
8160}
8161
8162#[must_use = "FIDL methods require a response to be sent"]
8163#[derive(Debug)]
8164pub struct ScreenshotTakeFileResponder {
8165    control_handle: std::mem::ManuallyDrop<ScreenshotControlHandle>,
8166    tx_id: u32,
8167}
8168
8169/// Set the the channel to be shutdown (see [`ScreenshotControlHandle::shutdown`])
8170/// if the responder is dropped without sending a response, so that the client
8171/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
8172impl std::ops::Drop for ScreenshotTakeFileResponder {
8173    fn drop(&mut self) {
8174        self.control_handle.shutdown();
8175        // Safety: drops once, never accessed again
8176        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8177    }
8178}
8179
8180impl fidl::endpoints::Responder for ScreenshotTakeFileResponder {
8181    type ControlHandle = ScreenshotControlHandle;
8182
8183    fn control_handle(&self) -> &ScreenshotControlHandle {
8184        &self.control_handle
8185    }
8186
8187    fn drop_without_shutdown(mut self) {
8188        // Safety: drops once, never accessed again due to mem::forget
8189        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8190        // Prevent Drop from running (which would shut down the channel)
8191        std::mem::forget(self);
8192    }
8193}
8194
8195impl ScreenshotTakeFileResponder {
8196    /// Sends a response to the FIDL transaction.
8197    ///
8198    /// Sets the channel to shutdown if an error occurs.
8199    pub fn send(self, mut payload: ScreenshotTakeFileResponse) -> Result<(), fidl::Error> {
8200        let _result = self.send_raw(payload);
8201        if _result.is_err() {
8202            self.control_handle.shutdown();
8203        }
8204        self.drop_without_shutdown();
8205        _result
8206    }
8207
8208    /// Similar to "send" but does not shutdown the channel if an error occurs.
8209    pub fn send_no_shutdown_on_err(
8210        self,
8211        mut payload: ScreenshotTakeFileResponse,
8212    ) -> Result<(), fidl::Error> {
8213        let _result = self.send_raw(payload);
8214        self.drop_without_shutdown();
8215        _result
8216    }
8217
8218    fn send_raw(&self, mut payload: ScreenshotTakeFileResponse) -> Result<(), fidl::Error> {
8219        self.control_handle.inner.send::<ScreenshotTakeFileResponse>(
8220            &mut payload,
8221            self.tx_id,
8222            0x470aeea0a4d32903,
8223            fidl::encoding::DynamicFlags::empty(),
8224        )
8225    }
8226}
8227
8228#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
8229pub struct TrustedFlatlandMarker;
8230
8231impl fidl::endpoints::ProtocolMarker for TrustedFlatlandMarker {
8232    type Proxy = TrustedFlatlandProxy;
8233    type RequestStream = TrustedFlatlandRequestStream;
8234    #[cfg(target_os = "fuchsia")]
8235    type SynchronousProxy = TrustedFlatlandSynchronousProxy;
8236
8237    const DEBUG_NAME: &'static str = "(anonymous) TrustedFlatland";
8238}
8239
8240pub trait TrustedFlatlandProxyInterface: Send + Sync {
8241    fn r#release_image_immediately(&self, image_id: &ContentId) -> Result<(), fidl::Error>;
8242}
8243#[derive(Debug)]
8244#[cfg(target_os = "fuchsia")]
8245pub struct TrustedFlatlandSynchronousProxy {
8246    client: fidl::client::sync::Client,
8247}
8248
8249#[cfg(target_os = "fuchsia")]
8250impl fidl::endpoints::SynchronousProxy for TrustedFlatlandSynchronousProxy {
8251    type Proxy = TrustedFlatlandProxy;
8252    type Protocol = TrustedFlatlandMarker;
8253
8254    fn from_channel(inner: fidl::Channel) -> Self {
8255        Self::new(inner)
8256    }
8257
8258    fn into_channel(self) -> fidl::Channel {
8259        self.client.into_channel()
8260    }
8261
8262    fn as_channel(&self) -> &fidl::Channel {
8263        self.client.as_channel()
8264    }
8265}
8266
8267#[cfg(target_os = "fuchsia")]
8268impl TrustedFlatlandSynchronousProxy {
8269    pub fn new(channel: fidl::Channel) -> Self {
8270        Self { client: fidl::client::sync::Client::new(channel) }
8271    }
8272
8273    pub fn into_channel(self) -> fidl::Channel {
8274        self.client.into_channel()
8275    }
8276
8277    /// Waits until an event arrives and returns it. It is safe for other
8278    /// threads to make concurrent requests while waiting for an event.
8279    pub fn wait_for_event(
8280        &self,
8281        deadline: zx::MonotonicInstant,
8282    ) -> Result<TrustedFlatlandEvent, fidl::Error> {
8283        TrustedFlatlandEvent::decode(self.client.wait_for_event::<TrustedFlatlandMarker>(deadline)?)
8284    }
8285
8286    /// Releases an image immediately, without waiting for the next present.
8287    pub fn r#release_image_immediately(&self, mut image_id: &ContentId) -> Result<(), fidl::Error> {
8288        self.client.send::<TrustedFlatlandReleaseImageImmediatelyRequest>(
8289            (image_id,),
8290            0x245e1ac080772c8,
8291            fidl::encoding::DynamicFlags::empty(),
8292        )
8293    }
8294}
8295
8296#[cfg(target_os = "fuchsia")]
8297impl From<TrustedFlatlandSynchronousProxy> for zx::NullableHandle {
8298    fn from(value: TrustedFlatlandSynchronousProxy) -> Self {
8299        value.into_channel().into()
8300    }
8301}
8302
8303#[cfg(target_os = "fuchsia")]
8304impl From<fidl::Channel> for TrustedFlatlandSynchronousProxy {
8305    fn from(value: fidl::Channel) -> Self {
8306        Self::new(value)
8307    }
8308}
8309
8310#[cfg(target_os = "fuchsia")]
8311impl fidl::endpoints::FromClient for TrustedFlatlandSynchronousProxy {
8312    type Protocol = TrustedFlatlandMarker;
8313
8314    fn from_client(value: fidl::endpoints::ClientEnd<TrustedFlatlandMarker>) -> Self {
8315        Self::new(value.into_channel())
8316    }
8317}
8318
8319#[derive(Debug, Clone)]
8320pub struct TrustedFlatlandProxy {
8321    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
8322}
8323
8324impl fidl::endpoints::Proxy for TrustedFlatlandProxy {
8325    type Protocol = TrustedFlatlandMarker;
8326
8327    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
8328        Self::new(inner)
8329    }
8330
8331    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
8332        self.client.into_channel().map_err(|client| Self { client })
8333    }
8334
8335    fn as_channel(&self) -> &::fidl::AsyncChannel {
8336        self.client.as_channel()
8337    }
8338}
8339
8340impl TrustedFlatlandProxy {
8341    /// Create a new Proxy for fuchsia.ui.composition/TrustedFlatland.
8342    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
8343        let protocol_name = <TrustedFlatlandMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
8344        Self { client: fidl::client::Client::new(channel, protocol_name) }
8345    }
8346
8347    /// Get a Stream of events from the remote end of the protocol.
8348    ///
8349    /// # Panics
8350    ///
8351    /// Panics if the event stream was already taken.
8352    pub fn take_event_stream(&self) -> TrustedFlatlandEventStream {
8353        TrustedFlatlandEventStream { event_receiver: self.client.take_event_receiver() }
8354    }
8355
8356    /// Releases an image immediately, without waiting for the next present.
8357    pub fn r#release_image_immediately(&self, mut image_id: &ContentId) -> Result<(), fidl::Error> {
8358        TrustedFlatlandProxyInterface::r#release_image_immediately(self, image_id)
8359    }
8360}
8361
8362impl TrustedFlatlandProxyInterface for TrustedFlatlandProxy {
8363    fn r#release_image_immediately(&self, mut image_id: &ContentId) -> Result<(), fidl::Error> {
8364        self.client.send::<TrustedFlatlandReleaseImageImmediatelyRequest>(
8365            (image_id,),
8366            0x245e1ac080772c8,
8367            fidl::encoding::DynamicFlags::empty(),
8368        )
8369    }
8370}
8371
8372pub struct TrustedFlatlandEventStream {
8373    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
8374}
8375
8376impl std::marker::Unpin for TrustedFlatlandEventStream {}
8377
8378impl futures::stream::FusedStream for TrustedFlatlandEventStream {
8379    fn is_terminated(&self) -> bool {
8380        self.event_receiver.is_terminated()
8381    }
8382}
8383
8384impl futures::Stream for TrustedFlatlandEventStream {
8385    type Item = Result<TrustedFlatlandEvent, fidl::Error>;
8386
8387    fn poll_next(
8388        mut self: std::pin::Pin<&mut Self>,
8389        cx: &mut std::task::Context<'_>,
8390    ) -> std::task::Poll<Option<Self::Item>> {
8391        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
8392            &mut self.event_receiver,
8393            cx
8394        )?) {
8395            Some(buf) => std::task::Poll::Ready(Some(TrustedFlatlandEvent::decode(buf))),
8396            None => std::task::Poll::Ready(None),
8397        }
8398    }
8399}
8400
8401#[derive(Debug)]
8402pub enum TrustedFlatlandEvent {}
8403
8404impl TrustedFlatlandEvent {
8405    /// Decodes a message buffer as a [`TrustedFlatlandEvent`].
8406    fn decode(
8407        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
8408    ) -> Result<TrustedFlatlandEvent, fidl::Error> {
8409        let (bytes, _handles) = buf.split_mut();
8410        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
8411        debug_assert_eq!(tx_header.tx_id, 0);
8412        match tx_header.ordinal {
8413            _ => Err(fidl::Error::UnknownOrdinal {
8414                ordinal: tx_header.ordinal,
8415                protocol_name:
8416                    <TrustedFlatlandMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
8417            }),
8418        }
8419    }
8420}
8421
8422/// A Stream of incoming requests for fuchsia.ui.composition/TrustedFlatland.
8423pub struct TrustedFlatlandRequestStream {
8424    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8425    is_terminated: bool,
8426}
8427
8428impl std::marker::Unpin for TrustedFlatlandRequestStream {}
8429
8430impl futures::stream::FusedStream for TrustedFlatlandRequestStream {
8431    fn is_terminated(&self) -> bool {
8432        self.is_terminated
8433    }
8434}
8435
8436impl fidl::endpoints::RequestStream for TrustedFlatlandRequestStream {
8437    type Protocol = TrustedFlatlandMarker;
8438    type ControlHandle = TrustedFlatlandControlHandle;
8439
8440    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
8441        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
8442    }
8443
8444    fn control_handle(&self) -> Self::ControlHandle {
8445        TrustedFlatlandControlHandle { inner: self.inner.clone() }
8446    }
8447
8448    fn into_inner(
8449        self,
8450    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
8451    {
8452        (self.inner, self.is_terminated)
8453    }
8454
8455    fn from_inner(
8456        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8457        is_terminated: bool,
8458    ) -> Self {
8459        Self { inner, is_terminated }
8460    }
8461}
8462
8463impl futures::Stream for TrustedFlatlandRequestStream {
8464    type Item = Result<TrustedFlatlandRequest, fidl::Error>;
8465
8466    fn poll_next(
8467        mut self: std::pin::Pin<&mut Self>,
8468        cx: &mut std::task::Context<'_>,
8469    ) -> std::task::Poll<Option<Self::Item>> {
8470        let this = &mut *self;
8471        if this.inner.check_shutdown(cx) {
8472            this.is_terminated = true;
8473            return std::task::Poll::Ready(None);
8474        }
8475        if this.is_terminated {
8476            panic!("polled TrustedFlatlandRequestStream after completion");
8477        }
8478        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
8479            |bytes, handles| {
8480                match this.inner.channel().read_etc(cx, bytes, handles) {
8481                    std::task::Poll::Ready(Ok(())) => {}
8482                    std::task::Poll::Pending => return std::task::Poll::Pending,
8483                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
8484                        this.is_terminated = true;
8485                        return std::task::Poll::Ready(None);
8486                    }
8487                    std::task::Poll::Ready(Err(e)) => {
8488                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
8489                            e.into(),
8490                        ))));
8491                    }
8492                }
8493
8494                // A message has been received from the channel
8495                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
8496
8497                std::task::Poll::Ready(Some(match header.ordinal {
8498                    0x245e1ac080772c8 => {
8499                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
8500                        let mut req = fidl::new_empty!(
8501                            TrustedFlatlandReleaseImageImmediatelyRequest,
8502                            fidl::encoding::DefaultFuchsiaResourceDialect
8503                        );
8504                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<TrustedFlatlandReleaseImageImmediatelyRequest>(&header, _body_bytes, handles, &mut req)?;
8505                        let control_handle =
8506                            TrustedFlatlandControlHandle { inner: this.inner.clone() };
8507                        Ok(TrustedFlatlandRequest::ReleaseImageImmediately {
8508                            image_id: req.image_id,
8509
8510                            control_handle,
8511                        })
8512                    }
8513                    _ => Err(fidl::Error::UnknownOrdinal {
8514                        ordinal: header.ordinal,
8515                        protocol_name:
8516                            <TrustedFlatlandMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
8517                    }),
8518                }))
8519            },
8520        )
8521    }
8522}
8523
8524/// A privileged protocol for trusted Flatland sessions that require special capabilities.
8525///
8526/// This protocol is composed into the [Flatland] protocol. Methods in this protocol
8527/// are only available if the Flatland session was created via [TrustedFlatlandFactory].
8528#[derive(Debug)]
8529pub enum TrustedFlatlandRequest {
8530    /// Releases an image immediately, without waiting for the next present.
8531    ReleaseImageImmediately { image_id: ContentId, control_handle: TrustedFlatlandControlHandle },
8532}
8533
8534impl TrustedFlatlandRequest {
8535    #[allow(irrefutable_let_patterns)]
8536    pub fn into_release_image_immediately(
8537        self,
8538    ) -> Option<(ContentId, TrustedFlatlandControlHandle)> {
8539        if let TrustedFlatlandRequest::ReleaseImageImmediately { image_id, control_handle } = self {
8540            Some((image_id, control_handle))
8541        } else {
8542            None
8543        }
8544    }
8545
8546    /// Name of the method defined in FIDL
8547    pub fn method_name(&self) -> &'static str {
8548        match *self {
8549            TrustedFlatlandRequest::ReleaseImageImmediately { .. } => "release_image_immediately",
8550        }
8551    }
8552}
8553
8554#[derive(Debug, Clone)]
8555pub struct TrustedFlatlandControlHandle {
8556    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8557}
8558
8559impl fidl::endpoints::ControlHandle for TrustedFlatlandControlHandle {
8560    fn shutdown(&self) {
8561        self.inner.shutdown()
8562    }
8563
8564    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
8565        self.inner.shutdown_with_epitaph(status)
8566    }
8567
8568    fn is_closed(&self) -> bool {
8569        self.inner.channel().is_closed()
8570    }
8571    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
8572        self.inner.channel().on_closed()
8573    }
8574
8575    #[cfg(target_os = "fuchsia")]
8576    fn signal_peer(
8577        &self,
8578        clear_mask: zx::Signals,
8579        set_mask: zx::Signals,
8580    ) -> Result<(), zx_status::Status> {
8581        use fidl::Peered;
8582        self.inner.channel().signal_peer(clear_mask, set_mask)
8583    }
8584}
8585
8586impl TrustedFlatlandControlHandle {}
8587
8588#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
8589pub struct TrustedFlatlandFactoryMarker;
8590
8591impl fidl::endpoints::ProtocolMarker for TrustedFlatlandFactoryMarker {
8592    type Proxy = TrustedFlatlandFactoryProxy;
8593    type RequestStream = TrustedFlatlandFactoryRequestStream;
8594    #[cfg(target_os = "fuchsia")]
8595    type SynchronousProxy = TrustedFlatlandFactorySynchronousProxy;
8596
8597    const DEBUG_NAME: &'static str = "fuchsia.ui.composition.TrustedFlatlandFactory";
8598}
8599impl fidl::endpoints::DiscoverableProtocolMarker for TrustedFlatlandFactoryMarker {}
8600pub type TrustedFlatlandFactoryCreateFlatlandResult = Result<(), TrustedFlatlandFactoryError>;
8601
8602pub trait TrustedFlatlandFactoryProxyInterface: Send + Sync {
8603    type CreateFlatlandResponseFut: std::future::Future<
8604            Output = Result<TrustedFlatlandFactoryCreateFlatlandResult, fidl::Error>,
8605        > + Send;
8606    fn r#create_flatland(
8607        &self,
8608        server_end: fidl::endpoints::ServerEnd<FlatlandMarker>,
8609        config: TrustedFlatlandConfig,
8610    ) -> Self::CreateFlatlandResponseFut;
8611}
8612#[derive(Debug)]
8613#[cfg(target_os = "fuchsia")]
8614pub struct TrustedFlatlandFactorySynchronousProxy {
8615    client: fidl::client::sync::Client,
8616}
8617
8618#[cfg(target_os = "fuchsia")]
8619impl fidl::endpoints::SynchronousProxy for TrustedFlatlandFactorySynchronousProxy {
8620    type Proxy = TrustedFlatlandFactoryProxy;
8621    type Protocol = TrustedFlatlandFactoryMarker;
8622
8623    fn from_channel(inner: fidl::Channel) -> Self {
8624        Self::new(inner)
8625    }
8626
8627    fn into_channel(self) -> fidl::Channel {
8628        self.client.into_channel()
8629    }
8630
8631    fn as_channel(&self) -> &fidl::Channel {
8632        self.client.as_channel()
8633    }
8634}
8635
8636#[cfg(target_os = "fuchsia")]
8637impl TrustedFlatlandFactorySynchronousProxy {
8638    pub fn new(channel: fidl::Channel) -> Self {
8639        Self { client: fidl::client::sync::Client::new(channel) }
8640    }
8641
8642    pub fn into_channel(self) -> fidl::Channel {
8643        self.client.into_channel()
8644    }
8645
8646    /// Waits until an event arrives and returns it. It is safe for other
8647    /// threads to make concurrent requests while waiting for an event.
8648    pub fn wait_for_event(
8649        &self,
8650        deadline: zx::MonotonicInstant,
8651    ) -> Result<TrustedFlatlandFactoryEvent, fidl::Error> {
8652        TrustedFlatlandFactoryEvent::decode(
8653            self.client.wait_for_event::<TrustedFlatlandFactoryMarker>(deadline)?,
8654        )
8655    }
8656
8657    /// Creates a new Flatland session with the specified configuration.
8658    ///
8659    /// ## Error
8660    ///
8661    /// Returns a [TrustedFlatlandFactoryError] error if the operation fails.
8662    pub fn r#create_flatland(
8663        &self,
8664        mut server_end: fidl::endpoints::ServerEnd<FlatlandMarker>,
8665        mut config: TrustedFlatlandConfig,
8666        ___deadline: zx::MonotonicInstant,
8667    ) -> Result<TrustedFlatlandFactoryCreateFlatlandResult, fidl::Error> {
8668        let _response = self.client.send_query::<
8669            TrustedFlatlandFactoryCreateFlatlandRequest,
8670            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, TrustedFlatlandFactoryError>,
8671            TrustedFlatlandFactoryMarker,
8672        >(
8673            (server_end, &mut config,),
8674            0x48e89c53f00561dc,
8675            fidl::encoding::DynamicFlags::empty(),
8676            ___deadline,
8677        )?;
8678        Ok(_response.map(|x| x))
8679    }
8680}
8681
8682#[cfg(target_os = "fuchsia")]
8683impl From<TrustedFlatlandFactorySynchronousProxy> for zx::NullableHandle {
8684    fn from(value: TrustedFlatlandFactorySynchronousProxy) -> Self {
8685        value.into_channel().into()
8686    }
8687}
8688
8689#[cfg(target_os = "fuchsia")]
8690impl From<fidl::Channel> for TrustedFlatlandFactorySynchronousProxy {
8691    fn from(value: fidl::Channel) -> Self {
8692        Self::new(value)
8693    }
8694}
8695
8696#[cfg(target_os = "fuchsia")]
8697impl fidl::endpoints::FromClient for TrustedFlatlandFactorySynchronousProxy {
8698    type Protocol = TrustedFlatlandFactoryMarker;
8699
8700    fn from_client(value: fidl::endpoints::ClientEnd<TrustedFlatlandFactoryMarker>) -> Self {
8701        Self::new(value.into_channel())
8702    }
8703}
8704
8705#[derive(Debug, Clone)]
8706pub struct TrustedFlatlandFactoryProxy {
8707    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
8708}
8709
8710impl fidl::endpoints::Proxy for TrustedFlatlandFactoryProxy {
8711    type Protocol = TrustedFlatlandFactoryMarker;
8712
8713    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
8714        Self::new(inner)
8715    }
8716
8717    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
8718        self.client.into_channel().map_err(|client| Self { client })
8719    }
8720
8721    fn as_channel(&self) -> &::fidl::AsyncChannel {
8722        self.client.as_channel()
8723    }
8724}
8725
8726impl TrustedFlatlandFactoryProxy {
8727    /// Create a new Proxy for fuchsia.ui.composition/TrustedFlatlandFactory.
8728    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
8729        let protocol_name =
8730            <TrustedFlatlandFactoryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
8731        Self { client: fidl::client::Client::new(channel, protocol_name) }
8732    }
8733
8734    /// Get a Stream of events from the remote end of the protocol.
8735    ///
8736    /// # Panics
8737    ///
8738    /// Panics if the event stream was already taken.
8739    pub fn take_event_stream(&self) -> TrustedFlatlandFactoryEventStream {
8740        TrustedFlatlandFactoryEventStream { event_receiver: self.client.take_event_receiver() }
8741    }
8742
8743    /// Creates a new Flatland session with the specified configuration.
8744    ///
8745    /// ## Error
8746    ///
8747    /// Returns a [TrustedFlatlandFactoryError] error if the operation fails.
8748    pub fn r#create_flatland(
8749        &self,
8750        mut server_end: fidl::endpoints::ServerEnd<FlatlandMarker>,
8751        mut config: TrustedFlatlandConfig,
8752    ) -> fidl::client::QueryResponseFut<
8753        TrustedFlatlandFactoryCreateFlatlandResult,
8754        fidl::encoding::DefaultFuchsiaResourceDialect,
8755    > {
8756        TrustedFlatlandFactoryProxyInterface::r#create_flatland(self, server_end, config)
8757    }
8758}
8759
8760impl TrustedFlatlandFactoryProxyInterface for TrustedFlatlandFactoryProxy {
8761    type CreateFlatlandResponseFut = fidl::client::QueryResponseFut<
8762        TrustedFlatlandFactoryCreateFlatlandResult,
8763        fidl::encoding::DefaultFuchsiaResourceDialect,
8764    >;
8765    fn r#create_flatland(
8766        &self,
8767        mut server_end: fidl::endpoints::ServerEnd<FlatlandMarker>,
8768        mut config: TrustedFlatlandConfig,
8769    ) -> Self::CreateFlatlandResponseFut {
8770        fn _decode(
8771            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
8772        ) -> Result<TrustedFlatlandFactoryCreateFlatlandResult, fidl::Error> {
8773            let _response = fidl::client::decode_transaction_body::<
8774                fidl::encoding::ResultType<
8775                    fidl::encoding::EmptyStruct,
8776                    TrustedFlatlandFactoryError,
8777                >,
8778                fidl::encoding::DefaultFuchsiaResourceDialect,
8779                0x48e89c53f00561dc,
8780            >(_buf?)?;
8781            Ok(_response.map(|x| x))
8782        }
8783        self.client.send_query_and_decode::<
8784            TrustedFlatlandFactoryCreateFlatlandRequest,
8785            TrustedFlatlandFactoryCreateFlatlandResult,
8786        >(
8787            (server_end, &mut config,),
8788            0x48e89c53f00561dc,
8789            fidl::encoding::DynamicFlags::empty(),
8790            _decode,
8791        )
8792    }
8793}
8794
8795pub struct TrustedFlatlandFactoryEventStream {
8796    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
8797}
8798
8799impl std::marker::Unpin for TrustedFlatlandFactoryEventStream {}
8800
8801impl futures::stream::FusedStream for TrustedFlatlandFactoryEventStream {
8802    fn is_terminated(&self) -> bool {
8803        self.event_receiver.is_terminated()
8804    }
8805}
8806
8807impl futures::Stream for TrustedFlatlandFactoryEventStream {
8808    type Item = Result<TrustedFlatlandFactoryEvent, fidl::Error>;
8809
8810    fn poll_next(
8811        mut self: std::pin::Pin<&mut Self>,
8812        cx: &mut std::task::Context<'_>,
8813    ) -> std::task::Poll<Option<Self::Item>> {
8814        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
8815            &mut self.event_receiver,
8816            cx
8817        )?) {
8818            Some(buf) => std::task::Poll::Ready(Some(TrustedFlatlandFactoryEvent::decode(buf))),
8819            None => std::task::Poll::Ready(None),
8820        }
8821    }
8822}
8823
8824#[derive(Debug)]
8825pub enum TrustedFlatlandFactoryEvent {}
8826
8827impl TrustedFlatlandFactoryEvent {
8828    /// Decodes a message buffer as a [`TrustedFlatlandFactoryEvent`].
8829    fn decode(
8830        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
8831    ) -> Result<TrustedFlatlandFactoryEvent, fidl::Error> {
8832        let (bytes, _handles) = buf.split_mut();
8833        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
8834        debug_assert_eq!(tx_header.tx_id, 0);
8835        match tx_header.ordinal {
8836            _ => Err(fidl::Error::UnknownOrdinal {
8837                ordinal: tx_header.ordinal,
8838                protocol_name:
8839                    <TrustedFlatlandFactoryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
8840            }),
8841        }
8842    }
8843}
8844
8845/// A Stream of incoming requests for fuchsia.ui.composition/TrustedFlatlandFactory.
8846pub struct TrustedFlatlandFactoryRequestStream {
8847    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8848    is_terminated: bool,
8849}
8850
8851impl std::marker::Unpin for TrustedFlatlandFactoryRequestStream {}
8852
8853impl futures::stream::FusedStream for TrustedFlatlandFactoryRequestStream {
8854    fn is_terminated(&self) -> bool {
8855        self.is_terminated
8856    }
8857}
8858
8859impl fidl::endpoints::RequestStream for TrustedFlatlandFactoryRequestStream {
8860    type Protocol = TrustedFlatlandFactoryMarker;
8861    type ControlHandle = TrustedFlatlandFactoryControlHandle;
8862
8863    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
8864        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
8865    }
8866
8867    fn control_handle(&self) -> Self::ControlHandle {
8868        TrustedFlatlandFactoryControlHandle { inner: self.inner.clone() }
8869    }
8870
8871    fn into_inner(
8872        self,
8873    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
8874    {
8875        (self.inner, self.is_terminated)
8876    }
8877
8878    fn from_inner(
8879        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8880        is_terminated: bool,
8881    ) -> Self {
8882        Self { inner, is_terminated }
8883    }
8884}
8885
8886impl futures::Stream for TrustedFlatlandFactoryRequestStream {
8887    type Item = Result<TrustedFlatlandFactoryRequest, fidl::Error>;
8888
8889    fn poll_next(
8890        mut self: std::pin::Pin<&mut Self>,
8891        cx: &mut std::task::Context<'_>,
8892    ) -> std::task::Poll<Option<Self::Item>> {
8893        let this = &mut *self;
8894        if this.inner.check_shutdown(cx) {
8895            this.is_terminated = true;
8896            return std::task::Poll::Ready(None);
8897        }
8898        if this.is_terminated {
8899            panic!("polled TrustedFlatlandFactoryRequestStream after completion");
8900        }
8901        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
8902            |bytes, handles| {
8903                match this.inner.channel().read_etc(cx, bytes, handles) {
8904                    std::task::Poll::Ready(Ok(())) => {}
8905                    std::task::Poll::Pending => return std::task::Poll::Pending,
8906                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
8907                        this.is_terminated = true;
8908                        return std::task::Poll::Ready(None);
8909                    }
8910                    std::task::Poll::Ready(Err(e)) => {
8911                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
8912                            e.into(),
8913                        ))));
8914                    }
8915                }
8916
8917                // A message has been received from the channel
8918                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
8919
8920                std::task::Poll::Ready(Some(match header.ordinal {
8921                0x48e89c53f00561dc => {
8922                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
8923                    let mut req = fidl::new_empty!(TrustedFlatlandFactoryCreateFlatlandRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
8924                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<TrustedFlatlandFactoryCreateFlatlandRequest>(&header, _body_bytes, handles, &mut req)?;
8925                    let control_handle = TrustedFlatlandFactoryControlHandle {
8926                        inner: this.inner.clone(),
8927                    };
8928                    Ok(TrustedFlatlandFactoryRequest::CreateFlatland {server_end: req.server_end,
8929config: req.config,
8930
8931                        responder: TrustedFlatlandFactoryCreateFlatlandResponder {
8932                            control_handle: std::mem::ManuallyDrop::new(control_handle),
8933                            tx_id: header.tx_id,
8934                        },
8935                    })
8936                }
8937                _ => Err(fidl::Error::UnknownOrdinal {
8938                    ordinal: header.ordinal,
8939                    protocol_name: <TrustedFlatlandFactoryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
8940                }),
8941            }))
8942            },
8943        )
8944    }
8945}
8946
8947/// A privileged factory for creating Flatland sessions with special configurations.
8948///
8949/// This protocol is intended for trusted clients that require fine-grained control over
8950/// Flatland's behavior for performance-critical applications. It is not intended for
8951/// general use. Misuse of this API can negatively impact system performance and stability.
8952#[derive(Debug)]
8953pub enum TrustedFlatlandFactoryRequest {
8954    /// Creates a new Flatland session with the specified configuration.
8955    ///
8956    /// ## Error
8957    ///
8958    /// Returns a [TrustedFlatlandFactoryError] error if the operation fails.
8959    CreateFlatland {
8960        server_end: fidl::endpoints::ServerEnd<FlatlandMarker>,
8961        config: TrustedFlatlandConfig,
8962        responder: TrustedFlatlandFactoryCreateFlatlandResponder,
8963    },
8964}
8965
8966impl TrustedFlatlandFactoryRequest {
8967    #[allow(irrefutable_let_patterns)]
8968    pub fn into_create_flatland(
8969        self,
8970    ) -> Option<(
8971        fidl::endpoints::ServerEnd<FlatlandMarker>,
8972        TrustedFlatlandConfig,
8973        TrustedFlatlandFactoryCreateFlatlandResponder,
8974    )> {
8975        if let TrustedFlatlandFactoryRequest::CreateFlatland { server_end, config, responder } =
8976            self
8977        {
8978            Some((server_end, config, responder))
8979        } else {
8980            None
8981        }
8982    }
8983
8984    /// Name of the method defined in FIDL
8985    pub fn method_name(&self) -> &'static str {
8986        match *self {
8987            TrustedFlatlandFactoryRequest::CreateFlatland { .. } => "create_flatland",
8988        }
8989    }
8990}
8991
8992#[derive(Debug, Clone)]
8993pub struct TrustedFlatlandFactoryControlHandle {
8994    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8995}
8996
8997impl fidl::endpoints::ControlHandle for TrustedFlatlandFactoryControlHandle {
8998    fn shutdown(&self) {
8999        self.inner.shutdown()
9000    }
9001
9002    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
9003        self.inner.shutdown_with_epitaph(status)
9004    }
9005
9006    fn is_closed(&self) -> bool {
9007        self.inner.channel().is_closed()
9008    }
9009    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
9010        self.inner.channel().on_closed()
9011    }
9012
9013    #[cfg(target_os = "fuchsia")]
9014    fn signal_peer(
9015        &self,
9016        clear_mask: zx::Signals,
9017        set_mask: zx::Signals,
9018    ) -> Result<(), zx_status::Status> {
9019        use fidl::Peered;
9020        self.inner.channel().signal_peer(clear_mask, set_mask)
9021    }
9022}
9023
9024impl TrustedFlatlandFactoryControlHandle {}
9025
9026#[must_use = "FIDL methods require a response to be sent"]
9027#[derive(Debug)]
9028pub struct TrustedFlatlandFactoryCreateFlatlandResponder {
9029    control_handle: std::mem::ManuallyDrop<TrustedFlatlandFactoryControlHandle>,
9030    tx_id: u32,
9031}
9032
9033/// Set the the channel to be shutdown (see [`TrustedFlatlandFactoryControlHandle::shutdown`])
9034/// if the responder is dropped without sending a response, so that the client
9035/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
9036impl std::ops::Drop for TrustedFlatlandFactoryCreateFlatlandResponder {
9037    fn drop(&mut self) {
9038        self.control_handle.shutdown();
9039        // Safety: drops once, never accessed again
9040        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9041    }
9042}
9043
9044impl fidl::endpoints::Responder for TrustedFlatlandFactoryCreateFlatlandResponder {
9045    type ControlHandle = TrustedFlatlandFactoryControlHandle;
9046
9047    fn control_handle(&self) -> &TrustedFlatlandFactoryControlHandle {
9048        &self.control_handle
9049    }
9050
9051    fn drop_without_shutdown(mut self) {
9052        // Safety: drops once, never accessed again due to mem::forget
9053        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9054        // Prevent Drop from running (which would shut down the channel)
9055        std::mem::forget(self);
9056    }
9057}
9058
9059impl TrustedFlatlandFactoryCreateFlatlandResponder {
9060    /// Sends a response to the FIDL transaction.
9061    ///
9062    /// Sets the channel to shutdown if an error occurs.
9063    pub fn send(
9064        self,
9065        mut result: Result<(), TrustedFlatlandFactoryError>,
9066    ) -> Result<(), fidl::Error> {
9067        let _result = self.send_raw(result);
9068        if _result.is_err() {
9069            self.control_handle.shutdown();
9070        }
9071        self.drop_without_shutdown();
9072        _result
9073    }
9074
9075    /// Similar to "send" but does not shutdown the channel if an error occurs.
9076    pub fn send_no_shutdown_on_err(
9077        self,
9078        mut result: Result<(), TrustedFlatlandFactoryError>,
9079    ) -> Result<(), fidl::Error> {
9080        let _result = self.send_raw(result);
9081        self.drop_without_shutdown();
9082        _result
9083    }
9084
9085    fn send_raw(
9086        &self,
9087        mut result: Result<(), TrustedFlatlandFactoryError>,
9088    ) -> Result<(), fidl::Error> {
9089        self.control_handle.inner.send::<fidl::encoding::ResultType<
9090            fidl::encoding::EmptyStruct,
9091            TrustedFlatlandFactoryError,
9092        >>(
9093            result,
9094            self.tx_id,
9095            0x48e89c53f00561dc,
9096            fidl::encoding::DynamicFlags::empty(),
9097        )
9098    }
9099}
9100
9101mod internal {
9102    use super::*;
9103
9104    impl fidl::encoding::ResourceTypeMarker for AllocatorRegisterBufferCollectionRequest {
9105        type Borrowed<'a> = &'a mut Self;
9106        fn take_or_borrow<'a>(
9107            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9108        ) -> Self::Borrowed<'a> {
9109            value
9110        }
9111    }
9112
9113    unsafe impl fidl::encoding::TypeMarker for AllocatorRegisterBufferCollectionRequest {
9114        type Owned = Self;
9115
9116        #[inline(always)]
9117        fn inline_align(_context: fidl::encoding::Context) -> usize {
9118            8
9119        }
9120
9121        #[inline(always)]
9122        fn inline_size(_context: fidl::encoding::Context) -> usize {
9123            16
9124        }
9125    }
9126
9127    unsafe impl
9128        fidl::encoding::Encode<
9129            AllocatorRegisterBufferCollectionRequest,
9130            fidl::encoding::DefaultFuchsiaResourceDialect,
9131        > for &mut AllocatorRegisterBufferCollectionRequest
9132    {
9133        #[inline]
9134        unsafe fn encode(
9135            self,
9136            encoder: &mut fidl::encoding::Encoder<
9137                '_,
9138                fidl::encoding::DefaultFuchsiaResourceDialect,
9139            >,
9140            offset: usize,
9141            _depth: fidl::encoding::Depth,
9142        ) -> fidl::Result<()> {
9143            encoder.debug_check_bounds::<AllocatorRegisterBufferCollectionRequest>(offset);
9144            // Delegate to tuple encoding.
9145            fidl::encoding::Encode::<AllocatorRegisterBufferCollectionRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
9146                (
9147                    <RegisterBufferCollectionArgs as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.args),
9148                ),
9149                encoder, offset, _depth
9150            )
9151        }
9152    }
9153    unsafe impl<
9154        T0: fidl::encoding::Encode<
9155                RegisterBufferCollectionArgs,
9156                fidl::encoding::DefaultFuchsiaResourceDialect,
9157            >,
9158    >
9159        fidl::encoding::Encode<
9160            AllocatorRegisterBufferCollectionRequest,
9161            fidl::encoding::DefaultFuchsiaResourceDialect,
9162        > for (T0,)
9163    {
9164        #[inline]
9165        unsafe fn encode(
9166            self,
9167            encoder: &mut fidl::encoding::Encoder<
9168                '_,
9169                fidl::encoding::DefaultFuchsiaResourceDialect,
9170            >,
9171            offset: usize,
9172            depth: fidl::encoding::Depth,
9173        ) -> fidl::Result<()> {
9174            encoder.debug_check_bounds::<AllocatorRegisterBufferCollectionRequest>(offset);
9175            // Zero out padding regions. There's no need to apply masks
9176            // because the unmasked parts will be overwritten by fields.
9177            // Write the fields.
9178            self.0.encode(encoder, offset + 0, depth)?;
9179            Ok(())
9180        }
9181    }
9182
9183    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
9184        for AllocatorRegisterBufferCollectionRequest
9185    {
9186        #[inline(always)]
9187        fn new_empty() -> Self {
9188            Self {
9189                args: fidl::new_empty!(
9190                    RegisterBufferCollectionArgs,
9191                    fidl::encoding::DefaultFuchsiaResourceDialect
9192                ),
9193            }
9194        }
9195
9196        #[inline]
9197        unsafe fn decode(
9198            &mut self,
9199            decoder: &mut fidl::encoding::Decoder<
9200                '_,
9201                fidl::encoding::DefaultFuchsiaResourceDialect,
9202            >,
9203            offset: usize,
9204            _depth: fidl::encoding::Depth,
9205        ) -> fidl::Result<()> {
9206            decoder.debug_check_bounds::<Self>(offset);
9207            // Verify that padding bytes are zero.
9208            fidl::decode!(
9209                RegisterBufferCollectionArgs,
9210                fidl::encoding::DefaultFuchsiaResourceDialect,
9211                &mut self.args,
9212                decoder,
9213                offset + 0,
9214                _depth
9215            )?;
9216            Ok(())
9217        }
9218    }
9219
9220    impl fidl::encoding::ResourceTypeMarker for BufferCollectionExportToken {
9221        type Borrowed<'a> = &'a mut Self;
9222        fn take_or_borrow<'a>(
9223            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9224        ) -> Self::Borrowed<'a> {
9225            value
9226        }
9227    }
9228
9229    unsafe impl fidl::encoding::TypeMarker for BufferCollectionExportToken {
9230        type Owned = Self;
9231
9232        #[inline(always)]
9233        fn inline_align(_context: fidl::encoding::Context) -> usize {
9234            4
9235        }
9236
9237        #[inline(always)]
9238        fn inline_size(_context: fidl::encoding::Context) -> usize {
9239            4
9240        }
9241    }
9242
9243    unsafe impl
9244        fidl::encoding::Encode<
9245            BufferCollectionExportToken,
9246            fidl::encoding::DefaultFuchsiaResourceDialect,
9247        > for &mut BufferCollectionExportToken
9248    {
9249        #[inline]
9250        unsafe fn encode(
9251            self,
9252            encoder: &mut fidl::encoding::Encoder<
9253                '_,
9254                fidl::encoding::DefaultFuchsiaResourceDialect,
9255            >,
9256            offset: usize,
9257            _depth: fidl::encoding::Depth,
9258        ) -> fidl::Result<()> {
9259            encoder.debug_check_bounds::<BufferCollectionExportToken>(offset);
9260            // Delegate to tuple encoding.
9261            fidl::encoding::Encode::<
9262                BufferCollectionExportToken,
9263                fidl::encoding::DefaultFuchsiaResourceDialect,
9264            >::encode(
9265                (<fidl::encoding::HandleType<
9266                    fidl::EventPair,
9267                    { fidl::ObjectType::EVENTPAIR.into_raw() },
9268                    2147483648,
9269                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
9270                    &mut self.value
9271                ),),
9272                encoder,
9273                offset,
9274                _depth,
9275            )
9276        }
9277    }
9278    unsafe impl<
9279        T0: fidl::encoding::Encode<
9280                fidl::encoding::HandleType<
9281                    fidl::EventPair,
9282                    { fidl::ObjectType::EVENTPAIR.into_raw() },
9283                    2147483648,
9284                >,
9285                fidl::encoding::DefaultFuchsiaResourceDialect,
9286            >,
9287    >
9288        fidl::encoding::Encode<
9289            BufferCollectionExportToken,
9290            fidl::encoding::DefaultFuchsiaResourceDialect,
9291        > for (T0,)
9292    {
9293        #[inline]
9294        unsafe fn encode(
9295            self,
9296            encoder: &mut fidl::encoding::Encoder<
9297                '_,
9298                fidl::encoding::DefaultFuchsiaResourceDialect,
9299            >,
9300            offset: usize,
9301            depth: fidl::encoding::Depth,
9302        ) -> fidl::Result<()> {
9303            encoder.debug_check_bounds::<BufferCollectionExportToken>(offset);
9304            // Zero out padding regions. There's no need to apply masks
9305            // because the unmasked parts will be overwritten by fields.
9306            // Write the fields.
9307            self.0.encode(encoder, offset + 0, depth)?;
9308            Ok(())
9309        }
9310    }
9311
9312    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
9313        for BufferCollectionExportToken
9314    {
9315        #[inline(always)]
9316        fn new_empty() -> Self {
9317            Self {
9318                value: fidl::new_empty!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
9319            }
9320        }
9321
9322        #[inline]
9323        unsafe fn decode(
9324            &mut self,
9325            decoder: &mut fidl::encoding::Decoder<
9326                '_,
9327                fidl::encoding::DefaultFuchsiaResourceDialect,
9328            >,
9329            offset: usize,
9330            _depth: fidl::encoding::Depth,
9331        ) -> fidl::Result<()> {
9332            decoder.debug_check_bounds::<Self>(offset);
9333            // Verify that padding bytes are zero.
9334            fidl::decode!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.value, decoder, offset + 0, _depth)?;
9335            Ok(())
9336        }
9337    }
9338
9339    impl fidl::encoding::ResourceTypeMarker for BufferCollectionImportToken {
9340        type Borrowed<'a> = &'a mut Self;
9341        fn take_or_borrow<'a>(
9342            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9343        ) -> Self::Borrowed<'a> {
9344            value
9345        }
9346    }
9347
9348    unsafe impl fidl::encoding::TypeMarker for BufferCollectionImportToken {
9349        type Owned = Self;
9350
9351        #[inline(always)]
9352        fn inline_align(_context: fidl::encoding::Context) -> usize {
9353            4
9354        }
9355
9356        #[inline(always)]
9357        fn inline_size(_context: fidl::encoding::Context) -> usize {
9358            4
9359        }
9360    }
9361
9362    unsafe impl
9363        fidl::encoding::Encode<
9364            BufferCollectionImportToken,
9365            fidl::encoding::DefaultFuchsiaResourceDialect,
9366        > for &mut BufferCollectionImportToken
9367    {
9368        #[inline]
9369        unsafe fn encode(
9370            self,
9371            encoder: &mut fidl::encoding::Encoder<
9372                '_,
9373                fidl::encoding::DefaultFuchsiaResourceDialect,
9374            >,
9375            offset: usize,
9376            _depth: fidl::encoding::Depth,
9377        ) -> fidl::Result<()> {
9378            encoder.debug_check_bounds::<BufferCollectionImportToken>(offset);
9379            // Delegate to tuple encoding.
9380            fidl::encoding::Encode::<
9381                BufferCollectionImportToken,
9382                fidl::encoding::DefaultFuchsiaResourceDialect,
9383            >::encode(
9384                (<fidl::encoding::HandleType<
9385                    fidl::EventPair,
9386                    { fidl::ObjectType::EVENTPAIR.into_raw() },
9387                    2147483648,
9388                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
9389                    &mut self.value
9390                ),),
9391                encoder,
9392                offset,
9393                _depth,
9394            )
9395        }
9396    }
9397    unsafe impl<
9398        T0: fidl::encoding::Encode<
9399                fidl::encoding::HandleType<
9400                    fidl::EventPair,
9401                    { fidl::ObjectType::EVENTPAIR.into_raw() },
9402                    2147483648,
9403                >,
9404                fidl::encoding::DefaultFuchsiaResourceDialect,
9405            >,
9406    >
9407        fidl::encoding::Encode<
9408            BufferCollectionImportToken,
9409            fidl::encoding::DefaultFuchsiaResourceDialect,
9410        > for (T0,)
9411    {
9412        #[inline]
9413        unsafe fn encode(
9414            self,
9415            encoder: &mut fidl::encoding::Encoder<
9416                '_,
9417                fidl::encoding::DefaultFuchsiaResourceDialect,
9418            >,
9419            offset: usize,
9420            depth: fidl::encoding::Depth,
9421        ) -> fidl::Result<()> {
9422            encoder.debug_check_bounds::<BufferCollectionImportToken>(offset);
9423            // Zero out padding regions. There's no need to apply masks
9424            // because the unmasked parts will be overwritten by fields.
9425            // Write the fields.
9426            self.0.encode(encoder, offset + 0, depth)?;
9427            Ok(())
9428        }
9429    }
9430
9431    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
9432        for BufferCollectionImportToken
9433    {
9434        #[inline(always)]
9435        fn new_empty() -> Self {
9436            Self {
9437                value: fidl::new_empty!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
9438            }
9439        }
9440
9441        #[inline]
9442        unsafe fn decode(
9443            &mut self,
9444            decoder: &mut fidl::encoding::Decoder<
9445                '_,
9446                fidl::encoding::DefaultFuchsiaResourceDialect,
9447            >,
9448            offset: usize,
9449            _depth: fidl::encoding::Depth,
9450        ) -> fidl::Result<()> {
9451            decoder.debug_check_bounds::<Self>(offset);
9452            // Verify that padding bytes are zero.
9453            fidl::decode!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.value, decoder, offset + 0, _depth)?;
9454            Ok(())
9455        }
9456    }
9457
9458    impl fidl::encoding::ResourceTypeMarker for ChildViewWatcherGetViewRefResponse {
9459        type Borrowed<'a> = &'a mut Self;
9460        fn take_or_borrow<'a>(
9461            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9462        ) -> Self::Borrowed<'a> {
9463            value
9464        }
9465    }
9466
9467    unsafe impl fidl::encoding::TypeMarker for ChildViewWatcherGetViewRefResponse {
9468        type Owned = Self;
9469
9470        #[inline(always)]
9471        fn inline_align(_context: fidl::encoding::Context) -> usize {
9472            4
9473        }
9474
9475        #[inline(always)]
9476        fn inline_size(_context: fidl::encoding::Context) -> usize {
9477            4
9478        }
9479    }
9480
9481    unsafe impl
9482        fidl::encoding::Encode<
9483            ChildViewWatcherGetViewRefResponse,
9484            fidl::encoding::DefaultFuchsiaResourceDialect,
9485        > for &mut ChildViewWatcherGetViewRefResponse
9486    {
9487        #[inline]
9488        unsafe fn encode(
9489            self,
9490            encoder: &mut fidl::encoding::Encoder<
9491                '_,
9492                fidl::encoding::DefaultFuchsiaResourceDialect,
9493            >,
9494            offset: usize,
9495            _depth: fidl::encoding::Depth,
9496        ) -> fidl::Result<()> {
9497            encoder.debug_check_bounds::<ChildViewWatcherGetViewRefResponse>(offset);
9498            // Delegate to tuple encoding.
9499            fidl::encoding::Encode::<ChildViewWatcherGetViewRefResponse, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
9500                (
9501                    <fidl_fuchsia_ui_views::ViewRef as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.view_ref),
9502                ),
9503                encoder, offset, _depth
9504            )
9505        }
9506    }
9507    unsafe impl<
9508        T0: fidl::encoding::Encode<
9509                fidl_fuchsia_ui_views::ViewRef,
9510                fidl::encoding::DefaultFuchsiaResourceDialect,
9511            >,
9512    >
9513        fidl::encoding::Encode<
9514            ChildViewWatcherGetViewRefResponse,
9515            fidl::encoding::DefaultFuchsiaResourceDialect,
9516        > for (T0,)
9517    {
9518        #[inline]
9519        unsafe fn encode(
9520            self,
9521            encoder: &mut fidl::encoding::Encoder<
9522                '_,
9523                fidl::encoding::DefaultFuchsiaResourceDialect,
9524            >,
9525            offset: usize,
9526            depth: fidl::encoding::Depth,
9527        ) -> fidl::Result<()> {
9528            encoder.debug_check_bounds::<ChildViewWatcherGetViewRefResponse>(offset);
9529            // Zero out padding regions. There's no need to apply masks
9530            // because the unmasked parts will be overwritten by fields.
9531            // Write the fields.
9532            self.0.encode(encoder, offset + 0, depth)?;
9533            Ok(())
9534        }
9535    }
9536
9537    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
9538        for ChildViewWatcherGetViewRefResponse
9539    {
9540        #[inline(always)]
9541        fn new_empty() -> Self {
9542            Self {
9543                view_ref: fidl::new_empty!(
9544                    fidl_fuchsia_ui_views::ViewRef,
9545                    fidl::encoding::DefaultFuchsiaResourceDialect
9546                ),
9547            }
9548        }
9549
9550        #[inline]
9551        unsafe fn decode(
9552            &mut self,
9553            decoder: &mut fidl::encoding::Decoder<
9554                '_,
9555                fidl::encoding::DefaultFuchsiaResourceDialect,
9556            >,
9557            offset: usize,
9558            _depth: fidl::encoding::Depth,
9559        ) -> fidl::Result<()> {
9560            decoder.debug_check_bounds::<Self>(offset);
9561            // Verify that padding bytes are zero.
9562            fidl::decode!(
9563                fidl_fuchsia_ui_views::ViewRef,
9564                fidl::encoding::DefaultFuchsiaResourceDialect,
9565                &mut self.view_ref,
9566                decoder,
9567                offset + 0,
9568                _depth
9569            )?;
9570            Ok(())
9571        }
9572    }
9573
9574    impl fidl::encoding::ResourceTypeMarker for FlatlandCreateFilledRectRequest {
9575        type Borrowed<'a> = &'a mut Self;
9576        fn take_or_borrow<'a>(
9577            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9578        ) -> Self::Borrowed<'a> {
9579            value
9580        }
9581    }
9582
9583    unsafe impl fidl::encoding::TypeMarker for FlatlandCreateFilledRectRequest {
9584        type Owned = Self;
9585
9586        #[inline(always)]
9587        fn inline_align(_context: fidl::encoding::Context) -> usize {
9588            8
9589        }
9590
9591        #[inline(always)]
9592        fn inline_size(_context: fidl::encoding::Context) -> usize {
9593            8
9594        }
9595        #[inline(always)]
9596        fn encode_is_copy() -> bool {
9597            true
9598        }
9599
9600        #[inline(always)]
9601        fn decode_is_copy() -> bool {
9602            true
9603        }
9604    }
9605
9606    unsafe impl
9607        fidl::encoding::Encode<
9608            FlatlandCreateFilledRectRequest,
9609            fidl::encoding::DefaultFuchsiaResourceDialect,
9610        > for &mut FlatlandCreateFilledRectRequest
9611    {
9612        #[inline]
9613        unsafe fn encode(
9614            self,
9615            encoder: &mut fidl::encoding::Encoder<
9616                '_,
9617                fidl::encoding::DefaultFuchsiaResourceDialect,
9618            >,
9619            offset: usize,
9620            _depth: fidl::encoding::Depth,
9621        ) -> fidl::Result<()> {
9622            encoder.debug_check_bounds::<FlatlandCreateFilledRectRequest>(offset);
9623            unsafe {
9624                // Copy the object into the buffer.
9625                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
9626                (buf_ptr as *mut FlatlandCreateFilledRectRequest)
9627                    .write_unaligned((self as *const FlatlandCreateFilledRectRequest).read());
9628                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
9629                // done second because the memcpy will write garbage to these bytes.
9630            }
9631            Ok(())
9632        }
9633    }
9634    unsafe impl<
9635        T0: fidl::encoding::Encode<ContentId, fidl::encoding::DefaultFuchsiaResourceDialect>,
9636    >
9637        fidl::encoding::Encode<
9638            FlatlandCreateFilledRectRequest,
9639            fidl::encoding::DefaultFuchsiaResourceDialect,
9640        > for (T0,)
9641    {
9642        #[inline]
9643        unsafe fn encode(
9644            self,
9645            encoder: &mut fidl::encoding::Encoder<
9646                '_,
9647                fidl::encoding::DefaultFuchsiaResourceDialect,
9648            >,
9649            offset: usize,
9650            depth: fidl::encoding::Depth,
9651        ) -> fidl::Result<()> {
9652            encoder.debug_check_bounds::<FlatlandCreateFilledRectRequest>(offset);
9653            // Zero out padding regions. There's no need to apply masks
9654            // because the unmasked parts will be overwritten by fields.
9655            // Write the fields.
9656            self.0.encode(encoder, offset + 0, depth)?;
9657            Ok(())
9658        }
9659    }
9660
9661    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
9662        for FlatlandCreateFilledRectRequest
9663    {
9664        #[inline(always)]
9665        fn new_empty() -> Self {
9666            Self {
9667                rect_id: fidl::new_empty!(ContentId, fidl::encoding::DefaultFuchsiaResourceDialect),
9668            }
9669        }
9670
9671        #[inline]
9672        unsafe fn decode(
9673            &mut self,
9674            decoder: &mut fidl::encoding::Decoder<
9675                '_,
9676                fidl::encoding::DefaultFuchsiaResourceDialect,
9677            >,
9678            offset: usize,
9679            _depth: fidl::encoding::Depth,
9680        ) -> fidl::Result<()> {
9681            decoder.debug_check_bounds::<Self>(offset);
9682            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
9683            // Verify that padding bytes are zero.
9684            // Copy from the buffer into the object.
9685            unsafe {
9686                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
9687            }
9688            Ok(())
9689        }
9690    }
9691
9692    impl fidl::encoding::ResourceTypeMarker for FlatlandCreateImageRequest {
9693        type Borrowed<'a> = &'a mut Self;
9694        fn take_or_borrow<'a>(
9695            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9696        ) -> Self::Borrowed<'a> {
9697            value
9698        }
9699    }
9700
9701    unsafe impl fidl::encoding::TypeMarker for FlatlandCreateImageRequest {
9702        type Owned = Self;
9703
9704        #[inline(always)]
9705        fn inline_align(_context: fidl::encoding::Context) -> usize {
9706            8
9707        }
9708
9709        #[inline(always)]
9710        fn inline_size(_context: fidl::encoding::Context) -> usize {
9711            32
9712        }
9713    }
9714
9715    unsafe impl
9716        fidl::encoding::Encode<
9717            FlatlandCreateImageRequest,
9718            fidl::encoding::DefaultFuchsiaResourceDialect,
9719        > for &mut FlatlandCreateImageRequest
9720    {
9721        #[inline]
9722        unsafe fn encode(
9723            self,
9724            encoder: &mut fidl::encoding::Encoder<
9725                '_,
9726                fidl::encoding::DefaultFuchsiaResourceDialect,
9727            >,
9728            offset: usize,
9729            _depth: fidl::encoding::Depth,
9730        ) -> fidl::Result<()> {
9731            encoder.debug_check_bounds::<FlatlandCreateImageRequest>(offset);
9732            // Delegate to tuple encoding.
9733            fidl::encoding::Encode::<FlatlandCreateImageRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
9734                (
9735                    <ContentId as fidl::encoding::ValueTypeMarker>::borrow(&self.image_id),
9736                    <BufferCollectionImportToken as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.import_token),
9737                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.vmo_index),
9738                    <ImageProperties as fidl::encoding::ValueTypeMarker>::borrow(&self.properties),
9739                ),
9740                encoder, offset, _depth
9741            )
9742        }
9743    }
9744    unsafe impl<
9745        T0: fidl::encoding::Encode<ContentId, fidl::encoding::DefaultFuchsiaResourceDialect>,
9746        T1: fidl::encoding::Encode<
9747                BufferCollectionImportToken,
9748                fidl::encoding::DefaultFuchsiaResourceDialect,
9749            >,
9750        T2: fidl::encoding::Encode<u32, fidl::encoding::DefaultFuchsiaResourceDialect>,
9751        T3: fidl::encoding::Encode<ImageProperties, fidl::encoding::DefaultFuchsiaResourceDialect>,
9752    >
9753        fidl::encoding::Encode<
9754            FlatlandCreateImageRequest,
9755            fidl::encoding::DefaultFuchsiaResourceDialect,
9756        > for (T0, T1, T2, T3)
9757    {
9758        #[inline]
9759        unsafe fn encode(
9760            self,
9761            encoder: &mut fidl::encoding::Encoder<
9762                '_,
9763                fidl::encoding::DefaultFuchsiaResourceDialect,
9764            >,
9765            offset: usize,
9766            depth: fidl::encoding::Depth,
9767        ) -> fidl::Result<()> {
9768            encoder.debug_check_bounds::<FlatlandCreateImageRequest>(offset);
9769            // Zero out padding regions. There's no need to apply masks
9770            // because the unmasked parts will be overwritten by fields.
9771            // Write the fields.
9772            self.0.encode(encoder, offset + 0, depth)?;
9773            self.1.encode(encoder, offset + 8, depth)?;
9774            self.2.encode(encoder, offset + 12, depth)?;
9775            self.3.encode(encoder, offset + 16, depth)?;
9776            Ok(())
9777        }
9778    }
9779
9780    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
9781        for FlatlandCreateImageRequest
9782    {
9783        #[inline(always)]
9784        fn new_empty() -> Self {
9785            Self {
9786                image_id: fidl::new_empty!(
9787                    ContentId,
9788                    fidl::encoding::DefaultFuchsiaResourceDialect
9789                ),
9790                import_token: fidl::new_empty!(
9791                    BufferCollectionImportToken,
9792                    fidl::encoding::DefaultFuchsiaResourceDialect
9793                ),
9794                vmo_index: fidl::new_empty!(u32, fidl::encoding::DefaultFuchsiaResourceDialect),
9795                properties: fidl::new_empty!(
9796                    ImageProperties,
9797                    fidl::encoding::DefaultFuchsiaResourceDialect
9798                ),
9799            }
9800        }
9801
9802        #[inline]
9803        unsafe fn decode(
9804            &mut self,
9805            decoder: &mut fidl::encoding::Decoder<
9806                '_,
9807                fidl::encoding::DefaultFuchsiaResourceDialect,
9808            >,
9809            offset: usize,
9810            _depth: fidl::encoding::Depth,
9811        ) -> fidl::Result<()> {
9812            decoder.debug_check_bounds::<Self>(offset);
9813            // Verify that padding bytes are zero.
9814            fidl::decode!(
9815                ContentId,
9816                fidl::encoding::DefaultFuchsiaResourceDialect,
9817                &mut self.image_id,
9818                decoder,
9819                offset + 0,
9820                _depth
9821            )?;
9822            fidl::decode!(
9823                BufferCollectionImportToken,
9824                fidl::encoding::DefaultFuchsiaResourceDialect,
9825                &mut self.import_token,
9826                decoder,
9827                offset + 8,
9828                _depth
9829            )?;
9830            fidl::decode!(
9831                u32,
9832                fidl::encoding::DefaultFuchsiaResourceDialect,
9833                &mut self.vmo_index,
9834                decoder,
9835                offset + 12,
9836                _depth
9837            )?;
9838            fidl::decode!(
9839                ImageProperties,
9840                fidl::encoding::DefaultFuchsiaResourceDialect,
9841                &mut self.properties,
9842                decoder,
9843                offset + 16,
9844                _depth
9845            )?;
9846            Ok(())
9847        }
9848    }
9849
9850    impl fidl::encoding::ResourceTypeMarker for FlatlandCreateView2Request {
9851        type Borrowed<'a> = &'a mut Self;
9852        fn take_or_borrow<'a>(
9853            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9854        ) -> Self::Borrowed<'a> {
9855            value
9856        }
9857    }
9858
9859    unsafe impl fidl::encoding::TypeMarker for FlatlandCreateView2Request {
9860        type Owned = Self;
9861
9862        #[inline(always)]
9863        fn inline_align(_context: fidl::encoding::Context) -> usize {
9864            8
9865        }
9866
9867        #[inline(always)]
9868        fn inline_size(_context: fidl::encoding::Context) -> usize {
9869            40
9870        }
9871    }
9872
9873    unsafe impl
9874        fidl::encoding::Encode<
9875            FlatlandCreateView2Request,
9876            fidl::encoding::DefaultFuchsiaResourceDialect,
9877        > for &mut FlatlandCreateView2Request
9878    {
9879        #[inline]
9880        unsafe fn encode(
9881            self,
9882            encoder: &mut fidl::encoding::Encoder<
9883                '_,
9884                fidl::encoding::DefaultFuchsiaResourceDialect,
9885            >,
9886            offset: usize,
9887            _depth: fidl::encoding::Depth,
9888        ) -> fidl::Result<()> {
9889            encoder.debug_check_bounds::<FlatlandCreateView2Request>(offset);
9890            // Delegate to tuple encoding.
9891            fidl::encoding::Encode::<FlatlandCreateView2Request, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
9892                (
9893                    <fidl_fuchsia_ui_views::ViewCreationToken as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.token),
9894                    <fidl_fuchsia_ui_views::ViewIdentityOnCreation as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.view_identity),
9895                    <ViewBoundProtocols as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.protocols),
9896                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.parent_viewport_watcher),
9897                ),
9898                encoder, offset, _depth
9899            )
9900        }
9901    }
9902    unsafe impl<
9903        T0: fidl::encoding::Encode<
9904                fidl_fuchsia_ui_views::ViewCreationToken,
9905                fidl::encoding::DefaultFuchsiaResourceDialect,
9906            >,
9907        T1: fidl::encoding::Encode<
9908                fidl_fuchsia_ui_views::ViewIdentityOnCreation,
9909                fidl::encoding::DefaultFuchsiaResourceDialect,
9910            >,
9911        T2: fidl::encoding::Encode<ViewBoundProtocols, fidl::encoding::DefaultFuchsiaResourceDialect>,
9912        T3: fidl::encoding::Encode<
9913                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>>,
9914                fidl::encoding::DefaultFuchsiaResourceDialect,
9915            >,
9916    >
9917        fidl::encoding::Encode<
9918            FlatlandCreateView2Request,
9919            fidl::encoding::DefaultFuchsiaResourceDialect,
9920        > for (T0, T1, T2, T3)
9921    {
9922        #[inline]
9923        unsafe fn encode(
9924            self,
9925            encoder: &mut fidl::encoding::Encoder<
9926                '_,
9927                fidl::encoding::DefaultFuchsiaResourceDialect,
9928            >,
9929            offset: usize,
9930            depth: fidl::encoding::Depth,
9931        ) -> fidl::Result<()> {
9932            encoder.debug_check_bounds::<FlatlandCreateView2Request>(offset);
9933            // Zero out padding regions. There's no need to apply masks
9934            // because the unmasked parts will be overwritten by fields.
9935            unsafe {
9936                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
9937                (ptr as *mut u64).write_unaligned(0);
9938            }
9939            unsafe {
9940                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(32);
9941                (ptr as *mut u64).write_unaligned(0);
9942            }
9943            // Write the fields.
9944            self.0.encode(encoder, offset + 0, depth)?;
9945            self.1.encode(encoder, offset + 4, depth)?;
9946            self.2.encode(encoder, offset + 16, depth)?;
9947            self.3.encode(encoder, offset + 32, depth)?;
9948            Ok(())
9949        }
9950    }
9951
9952    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
9953        for FlatlandCreateView2Request
9954    {
9955        #[inline(always)]
9956        fn new_empty() -> Self {
9957            Self {
9958                token: fidl::new_empty!(
9959                    fidl_fuchsia_ui_views::ViewCreationToken,
9960                    fidl::encoding::DefaultFuchsiaResourceDialect
9961                ),
9962                view_identity: fidl::new_empty!(
9963                    fidl_fuchsia_ui_views::ViewIdentityOnCreation,
9964                    fidl::encoding::DefaultFuchsiaResourceDialect
9965                ),
9966                protocols: fidl::new_empty!(
9967                    ViewBoundProtocols,
9968                    fidl::encoding::DefaultFuchsiaResourceDialect
9969                ),
9970                parent_viewport_watcher: fidl::new_empty!(
9971                    fidl::encoding::Endpoint<
9972                        fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>,
9973                    >,
9974                    fidl::encoding::DefaultFuchsiaResourceDialect
9975                ),
9976            }
9977        }
9978
9979        #[inline]
9980        unsafe fn decode(
9981            &mut self,
9982            decoder: &mut fidl::encoding::Decoder<
9983                '_,
9984                fidl::encoding::DefaultFuchsiaResourceDialect,
9985            >,
9986            offset: usize,
9987            _depth: fidl::encoding::Depth,
9988        ) -> fidl::Result<()> {
9989            decoder.debug_check_bounds::<Self>(offset);
9990            // Verify that padding bytes are zero.
9991            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(8) };
9992            let padval = unsafe { (ptr as *const u64).read_unaligned() };
9993            let mask = 0xffffffff00000000u64;
9994            let maskedval = padval & mask;
9995            if maskedval != 0 {
9996                return Err(fidl::Error::NonZeroPadding {
9997                    padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
9998                });
9999            }
10000            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(32) };
10001            let padval = unsafe { (ptr as *const u64).read_unaligned() };
10002            let mask = 0xffffffff00000000u64;
10003            let maskedval = padval & mask;
10004            if maskedval != 0 {
10005                return Err(fidl::Error::NonZeroPadding {
10006                    padding_start: offset + 32 + ((mask as u64).trailing_zeros() / 8) as usize,
10007                });
10008            }
10009            fidl::decode!(
10010                fidl_fuchsia_ui_views::ViewCreationToken,
10011                fidl::encoding::DefaultFuchsiaResourceDialect,
10012                &mut self.token,
10013                decoder,
10014                offset + 0,
10015                _depth
10016            )?;
10017            fidl::decode!(
10018                fidl_fuchsia_ui_views::ViewIdentityOnCreation,
10019                fidl::encoding::DefaultFuchsiaResourceDialect,
10020                &mut self.view_identity,
10021                decoder,
10022                offset + 4,
10023                _depth
10024            )?;
10025            fidl::decode!(
10026                ViewBoundProtocols,
10027                fidl::encoding::DefaultFuchsiaResourceDialect,
10028                &mut self.protocols,
10029                decoder,
10030                offset + 16,
10031                _depth
10032            )?;
10033            fidl::decode!(
10034                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>>,
10035                fidl::encoding::DefaultFuchsiaResourceDialect,
10036                &mut self.parent_viewport_watcher,
10037                decoder,
10038                offset + 32,
10039                _depth
10040            )?;
10041            Ok(())
10042        }
10043    }
10044
10045    impl fidl::encoding::ResourceTypeMarker for FlatlandCreateViewRequest {
10046        type Borrowed<'a> = &'a mut Self;
10047        fn take_or_borrow<'a>(
10048            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10049        ) -> Self::Borrowed<'a> {
10050            value
10051        }
10052    }
10053
10054    unsafe impl fidl::encoding::TypeMarker for FlatlandCreateViewRequest {
10055        type Owned = Self;
10056
10057        #[inline(always)]
10058        fn inline_align(_context: fidl::encoding::Context) -> usize {
10059            4
10060        }
10061
10062        #[inline(always)]
10063        fn inline_size(_context: fidl::encoding::Context) -> usize {
10064            8
10065        }
10066    }
10067
10068    unsafe impl
10069        fidl::encoding::Encode<
10070            FlatlandCreateViewRequest,
10071            fidl::encoding::DefaultFuchsiaResourceDialect,
10072        > for &mut FlatlandCreateViewRequest
10073    {
10074        #[inline]
10075        unsafe fn encode(
10076            self,
10077            encoder: &mut fidl::encoding::Encoder<
10078                '_,
10079                fidl::encoding::DefaultFuchsiaResourceDialect,
10080            >,
10081            offset: usize,
10082            _depth: fidl::encoding::Depth,
10083        ) -> fidl::Result<()> {
10084            encoder.debug_check_bounds::<FlatlandCreateViewRequest>(offset);
10085            // Delegate to tuple encoding.
10086            fidl::encoding::Encode::<FlatlandCreateViewRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
10087                (
10088                    <fidl_fuchsia_ui_views::ViewCreationToken as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.token),
10089                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.parent_viewport_watcher),
10090                ),
10091                encoder, offset, _depth
10092            )
10093        }
10094    }
10095    unsafe impl<
10096        T0: fidl::encoding::Encode<
10097                fidl_fuchsia_ui_views::ViewCreationToken,
10098                fidl::encoding::DefaultFuchsiaResourceDialect,
10099            >,
10100        T1: fidl::encoding::Encode<
10101                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>>,
10102                fidl::encoding::DefaultFuchsiaResourceDialect,
10103            >,
10104    >
10105        fidl::encoding::Encode<
10106            FlatlandCreateViewRequest,
10107            fidl::encoding::DefaultFuchsiaResourceDialect,
10108        > for (T0, T1)
10109    {
10110        #[inline]
10111        unsafe fn encode(
10112            self,
10113            encoder: &mut fidl::encoding::Encoder<
10114                '_,
10115                fidl::encoding::DefaultFuchsiaResourceDialect,
10116            >,
10117            offset: usize,
10118            depth: fidl::encoding::Depth,
10119        ) -> fidl::Result<()> {
10120            encoder.debug_check_bounds::<FlatlandCreateViewRequest>(offset);
10121            // Zero out padding regions. There's no need to apply masks
10122            // because the unmasked parts will be overwritten by fields.
10123            // Write the fields.
10124            self.0.encode(encoder, offset + 0, depth)?;
10125            self.1.encode(encoder, offset + 4, depth)?;
10126            Ok(())
10127        }
10128    }
10129
10130    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10131        for FlatlandCreateViewRequest
10132    {
10133        #[inline(always)]
10134        fn new_empty() -> Self {
10135            Self {
10136                token: fidl::new_empty!(
10137                    fidl_fuchsia_ui_views::ViewCreationToken,
10138                    fidl::encoding::DefaultFuchsiaResourceDialect
10139                ),
10140                parent_viewport_watcher: fidl::new_empty!(
10141                    fidl::encoding::Endpoint<
10142                        fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>,
10143                    >,
10144                    fidl::encoding::DefaultFuchsiaResourceDialect
10145                ),
10146            }
10147        }
10148
10149        #[inline]
10150        unsafe fn decode(
10151            &mut self,
10152            decoder: &mut fidl::encoding::Decoder<
10153                '_,
10154                fidl::encoding::DefaultFuchsiaResourceDialect,
10155            >,
10156            offset: usize,
10157            _depth: fidl::encoding::Depth,
10158        ) -> fidl::Result<()> {
10159            decoder.debug_check_bounds::<Self>(offset);
10160            // Verify that padding bytes are zero.
10161            fidl::decode!(
10162                fidl_fuchsia_ui_views::ViewCreationToken,
10163                fidl::encoding::DefaultFuchsiaResourceDialect,
10164                &mut self.token,
10165                decoder,
10166                offset + 0,
10167                _depth
10168            )?;
10169            fidl::decode!(
10170                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>>,
10171                fidl::encoding::DefaultFuchsiaResourceDialect,
10172                &mut self.parent_viewport_watcher,
10173                decoder,
10174                offset + 4,
10175                _depth
10176            )?;
10177            Ok(())
10178        }
10179    }
10180
10181    impl fidl::encoding::ResourceTypeMarker for FlatlandCreateViewportRequest {
10182        type Borrowed<'a> = &'a mut Self;
10183        fn take_or_borrow<'a>(
10184            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10185        ) -> Self::Borrowed<'a> {
10186            value
10187        }
10188    }
10189
10190    unsafe impl fidl::encoding::TypeMarker for FlatlandCreateViewportRequest {
10191        type Owned = Self;
10192
10193        #[inline(always)]
10194        fn inline_align(_context: fidl::encoding::Context) -> usize {
10195            8
10196        }
10197
10198        #[inline(always)]
10199        fn inline_size(_context: fidl::encoding::Context) -> usize {
10200            40
10201        }
10202    }
10203
10204    unsafe impl
10205        fidl::encoding::Encode<
10206            FlatlandCreateViewportRequest,
10207            fidl::encoding::DefaultFuchsiaResourceDialect,
10208        > for &mut FlatlandCreateViewportRequest
10209    {
10210        #[inline]
10211        unsafe fn encode(
10212            self,
10213            encoder: &mut fidl::encoding::Encoder<
10214                '_,
10215                fidl::encoding::DefaultFuchsiaResourceDialect,
10216            >,
10217            offset: usize,
10218            _depth: fidl::encoding::Depth,
10219        ) -> fidl::Result<()> {
10220            encoder.debug_check_bounds::<FlatlandCreateViewportRequest>(offset);
10221            // Delegate to tuple encoding.
10222            fidl::encoding::Encode::<FlatlandCreateViewportRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
10223                (
10224                    <ContentId as fidl::encoding::ValueTypeMarker>::borrow(&self.viewport_id),
10225                    <fidl_fuchsia_ui_views::ViewportCreationToken as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.token),
10226                    <ViewportProperties as fidl::encoding::ValueTypeMarker>::borrow(&self.properties),
10227                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ChildViewWatcherMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.child_view_watcher),
10228                ),
10229                encoder, offset, _depth
10230            )
10231        }
10232    }
10233    unsafe impl<
10234        T0: fidl::encoding::Encode<ContentId, fidl::encoding::DefaultFuchsiaResourceDialect>,
10235        T1: fidl::encoding::Encode<
10236                fidl_fuchsia_ui_views::ViewportCreationToken,
10237                fidl::encoding::DefaultFuchsiaResourceDialect,
10238            >,
10239        T2: fidl::encoding::Encode<ViewportProperties, fidl::encoding::DefaultFuchsiaResourceDialect>,
10240        T3: fidl::encoding::Encode<
10241                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ChildViewWatcherMarker>>,
10242                fidl::encoding::DefaultFuchsiaResourceDialect,
10243            >,
10244    >
10245        fidl::encoding::Encode<
10246            FlatlandCreateViewportRequest,
10247            fidl::encoding::DefaultFuchsiaResourceDialect,
10248        > for (T0, T1, T2, T3)
10249    {
10250        #[inline]
10251        unsafe fn encode(
10252            self,
10253            encoder: &mut fidl::encoding::Encoder<
10254                '_,
10255                fidl::encoding::DefaultFuchsiaResourceDialect,
10256            >,
10257            offset: usize,
10258            depth: fidl::encoding::Depth,
10259        ) -> fidl::Result<()> {
10260            encoder.debug_check_bounds::<FlatlandCreateViewportRequest>(offset);
10261            // Zero out padding regions. There's no need to apply masks
10262            // because the unmasked parts will be overwritten by fields.
10263            unsafe {
10264                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
10265                (ptr as *mut u64).write_unaligned(0);
10266            }
10267            unsafe {
10268                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(32);
10269                (ptr as *mut u64).write_unaligned(0);
10270            }
10271            // Write the fields.
10272            self.0.encode(encoder, offset + 0, depth)?;
10273            self.1.encode(encoder, offset + 8, depth)?;
10274            self.2.encode(encoder, offset + 16, depth)?;
10275            self.3.encode(encoder, offset + 32, depth)?;
10276            Ok(())
10277        }
10278    }
10279
10280    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10281        for FlatlandCreateViewportRequest
10282    {
10283        #[inline(always)]
10284        fn new_empty() -> Self {
10285            Self {
10286                viewport_id: fidl::new_empty!(
10287                    ContentId,
10288                    fidl::encoding::DefaultFuchsiaResourceDialect
10289                ),
10290                token: fidl::new_empty!(
10291                    fidl_fuchsia_ui_views::ViewportCreationToken,
10292                    fidl::encoding::DefaultFuchsiaResourceDialect
10293                ),
10294                properties: fidl::new_empty!(
10295                    ViewportProperties,
10296                    fidl::encoding::DefaultFuchsiaResourceDialect
10297                ),
10298                child_view_watcher: fidl::new_empty!(
10299                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ChildViewWatcherMarker>>,
10300                    fidl::encoding::DefaultFuchsiaResourceDialect
10301                ),
10302            }
10303        }
10304
10305        #[inline]
10306        unsafe fn decode(
10307            &mut self,
10308            decoder: &mut fidl::encoding::Decoder<
10309                '_,
10310                fidl::encoding::DefaultFuchsiaResourceDialect,
10311            >,
10312            offset: usize,
10313            _depth: fidl::encoding::Depth,
10314        ) -> fidl::Result<()> {
10315            decoder.debug_check_bounds::<Self>(offset);
10316            // Verify that padding bytes are zero.
10317            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(8) };
10318            let padval = unsafe { (ptr as *const u64).read_unaligned() };
10319            let mask = 0xffffffff00000000u64;
10320            let maskedval = padval & mask;
10321            if maskedval != 0 {
10322                return Err(fidl::Error::NonZeroPadding {
10323                    padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
10324                });
10325            }
10326            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(32) };
10327            let padval = unsafe { (ptr as *const u64).read_unaligned() };
10328            let mask = 0xffffffff00000000u64;
10329            let maskedval = padval & mask;
10330            if maskedval != 0 {
10331                return Err(fidl::Error::NonZeroPadding {
10332                    padding_start: offset + 32 + ((mask as u64).trailing_zeros() / 8) as usize,
10333                });
10334            }
10335            fidl::decode!(
10336                ContentId,
10337                fidl::encoding::DefaultFuchsiaResourceDialect,
10338                &mut self.viewport_id,
10339                decoder,
10340                offset + 0,
10341                _depth
10342            )?;
10343            fidl::decode!(
10344                fidl_fuchsia_ui_views::ViewportCreationToken,
10345                fidl::encoding::DefaultFuchsiaResourceDialect,
10346                &mut self.token,
10347                decoder,
10348                offset + 8,
10349                _depth
10350            )?;
10351            fidl::decode!(
10352                ViewportProperties,
10353                fidl::encoding::DefaultFuchsiaResourceDialect,
10354                &mut self.properties,
10355                decoder,
10356                offset + 16,
10357                _depth
10358            )?;
10359            fidl::decode!(
10360                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ChildViewWatcherMarker>>,
10361                fidl::encoding::DefaultFuchsiaResourceDialect,
10362                &mut self.child_view_watcher,
10363                decoder,
10364                offset + 32,
10365                _depth
10366            )?;
10367            Ok(())
10368        }
10369    }
10370
10371    impl fidl::encoding::ResourceTypeMarker for FlatlandDisplaySetContentRequest {
10372        type Borrowed<'a> = &'a mut Self;
10373        fn take_or_borrow<'a>(
10374            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10375        ) -> Self::Borrowed<'a> {
10376            value
10377        }
10378    }
10379
10380    unsafe impl fidl::encoding::TypeMarker for FlatlandDisplaySetContentRequest {
10381        type Owned = Self;
10382
10383        #[inline(always)]
10384        fn inline_align(_context: fidl::encoding::Context) -> usize {
10385            4
10386        }
10387
10388        #[inline(always)]
10389        fn inline_size(_context: fidl::encoding::Context) -> usize {
10390            8
10391        }
10392    }
10393
10394    unsafe impl
10395        fidl::encoding::Encode<
10396            FlatlandDisplaySetContentRequest,
10397            fidl::encoding::DefaultFuchsiaResourceDialect,
10398        > for &mut FlatlandDisplaySetContentRequest
10399    {
10400        #[inline]
10401        unsafe fn encode(
10402            self,
10403            encoder: &mut fidl::encoding::Encoder<
10404                '_,
10405                fidl::encoding::DefaultFuchsiaResourceDialect,
10406            >,
10407            offset: usize,
10408            _depth: fidl::encoding::Depth,
10409        ) -> fidl::Result<()> {
10410            encoder.debug_check_bounds::<FlatlandDisplaySetContentRequest>(offset);
10411            // Delegate to tuple encoding.
10412            fidl::encoding::Encode::<FlatlandDisplaySetContentRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
10413                (
10414                    <fidl_fuchsia_ui_views::ViewportCreationToken as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.token),
10415                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ChildViewWatcherMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.child_view_watcher),
10416                ),
10417                encoder, offset, _depth
10418            )
10419        }
10420    }
10421    unsafe impl<
10422        T0: fidl::encoding::Encode<
10423                fidl_fuchsia_ui_views::ViewportCreationToken,
10424                fidl::encoding::DefaultFuchsiaResourceDialect,
10425            >,
10426        T1: fidl::encoding::Encode<
10427                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ChildViewWatcherMarker>>,
10428                fidl::encoding::DefaultFuchsiaResourceDialect,
10429            >,
10430    >
10431        fidl::encoding::Encode<
10432            FlatlandDisplaySetContentRequest,
10433            fidl::encoding::DefaultFuchsiaResourceDialect,
10434        > for (T0, T1)
10435    {
10436        #[inline]
10437        unsafe fn encode(
10438            self,
10439            encoder: &mut fidl::encoding::Encoder<
10440                '_,
10441                fidl::encoding::DefaultFuchsiaResourceDialect,
10442            >,
10443            offset: usize,
10444            depth: fidl::encoding::Depth,
10445        ) -> fidl::Result<()> {
10446            encoder.debug_check_bounds::<FlatlandDisplaySetContentRequest>(offset);
10447            // Zero out padding regions. There's no need to apply masks
10448            // because the unmasked parts will be overwritten by fields.
10449            // Write the fields.
10450            self.0.encode(encoder, offset + 0, depth)?;
10451            self.1.encode(encoder, offset + 4, depth)?;
10452            Ok(())
10453        }
10454    }
10455
10456    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10457        for FlatlandDisplaySetContentRequest
10458    {
10459        #[inline(always)]
10460        fn new_empty() -> Self {
10461            Self {
10462                token: fidl::new_empty!(
10463                    fidl_fuchsia_ui_views::ViewportCreationToken,
10464                    fidl::encoding::DefaultFuchsiaResourceDialect
10465                ),
10466                child_view_watcher: fidl::new_empty!(
10467                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ChildViewWatcherMarker>>,
10468                    fidl::encoding::DefaultFuchsiaResourceDialect
10469                ),
10470            }
10471        }
10472
10473        #[inline]
10474        unsafe fn decode(
10475            &mut self,
10476            decoder: &mut fidl::encoding::Decoder<
10477                '_,
10478                fidl::encoding::DefaultFuchsiaResourceDialect,
10479            >,
10480            offset: usize,
10481            _depth: fidl::encoding::Depth,
10482        ) -> fidl::Result<()> {
10483            decoder.debug_check_bounds::<Self>(offset);
10484            // Verify that padding bytes are zero.
10485            fidl::decode!(
10486                fidl_fuchsia_ui_views::ViewportCreationToken,
10487                fidl::encoding::DefaultFuchsiaResourceDialect,
10488                &mut self.token,
10489                decoder,
10490                offset + 0,
10491                _depth
10492            )?;
10493            fidl::decode!(
10494                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ChildViewWatcherMarker>>,
10495                fidl::encoding::DefaultFuchsiaResourceDialect,
10496                &mut self.child_view_watcher,
10497                decoder,
10498                offset + 4,
10499                _depth
10500            )?;
10501            Ok(())
10502        }
10503    }
10504
10505    impl fidl::encoding::ResourceTypeMarker for FlatlandPresentRequest {
10506        type Borrowed<'a> = &'a mut Self;
10507        fn take_or_borrow<'a>(
10508            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10509        ) -> Self::Borrowed<'a> {
10510            value
10511        }
10512    }
10513
10514    unsafe impl fidl::encoding::TypeMarker for FlatlandPresentRequest {
10515        type Owned = Self;
10516
10517        #[inline(always)]
10518        fn inline_align(_context: fidl::encoding::Context) -> usize {
10519            8
10520        }
10521
10522        #[inline(always)]
10523        fn inline_size(_context: fidl::encoding::Context) -> usize {
10524            16
10525        }
10526    }
10527
10528    unsafe impl
10529        fidl::encoding::Encode<
10530            FlatlandPresentRequest,
10531            fidl::encoding::DefaultFuchsiaResourceDialect,
10532        > for &mut FlatlandPresentRequest
10533    {
10534        #[inline]
10535        unsafe fn encode(
10536            self,
10537            encoder: &mut fidl::encoding::Encoder<
10538                '_,
10539                fidl::encoding::DefaultFuchsiaResourceDialect,
10540            >,
10541            offset: usize,
10542            _depth: fidl::encoding::Depth,
10543        ) -> fidl::Result<()> {
10544            encoder.debug_check_bounds::<FlatlandPresentRequest>(offset);
10545            // Delegate to tuple encoding.
10546            fidl::encoding::Encode::<
10547                FlatlandPresentRequest,
10548                fidl::encoding::DefaultFuchsiaResourceDialect,
10549            >::encode(
10550                (<PresentArgs as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
10551                    &mut self.args,
10552                ),),
10553                encoder,
10554                offset,
10555                _depth,
10556            )
10557        }
10558    }
10559    unsafe impl<
10560        T0: fidl::encoding::Encode<PresentArgs, fidl::encoding::DefaultFuchsiaResourceDialect>,
10561    >
10562        fidl::encoding::Encode<
10563            FlatlandPresentRequest,
10564            fidl::encoding::DefaultFuchsiaResourceDialect,
10565        > for (T0,)
10566    {
10567        #[inline]
10568        unsafe fn encode(
10569            self,
10570            encoder: &mut fidl::encoding::Encoder<
10571                '_,
10572                fidl::encoding::DefaultFuchsiaResourceDialect,
10573            >,
10574            offset: usize,
10575            depth: fidl::encoding::Depth,
10576        ) -> fidl::Result<()> {
10577            encoder.debug_check_bounds::<FlatlandPresentRequest>(offset);
10578            // Zero out padding regions. There's no need to apply masks
10579            // because the unmasked parts will be overwritten by fields.
10580            // Write the fields.
10581            self.0.encode(encoder, offset + 0, depth)?;
10582            Ok(())
10583        }
10584    }
10585
10586    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10587        for FlatlandPresentRequest
10588    {
10589        #[inline(always)]
10590        fn new_empty() -> Self {
10591            Self {
10592                args: fidl::new_empty!(PresentArgs, fidl::encoding::DefaultFuchsiaResourceDialect),
10593            }
10594        }
10595
10596        #[inline]
10597        unsafe fn decode(
10598            &mut self,
10599            decoder: &mut fidl::encoding::Decoder<
10600                '_,
10601                fidl::encoding::DefaultFuchsiaResourceDialect,
10602            >,
10603            offset: usize,
10604            _depth: fidl::encoding::Depth,
10605        ) -> fidl::Result<()> {
10606            decoder.debug_check_bounds::<Self>(offset);
10607            // Verify that padding bytes are zero.
10608            fidl::decode!(
10609                PresentArgs,
10610                fidl::encoding::DefaultFuchsiaResourceDialect,
10611                &mut self.args,
10612                decoder,
10613                offset + 0,
10614                _depth
10615            )?;
10616            Ok(())
10617        }
10618    }
10619
10620    impl fidl::encoding::ResourceTypeMarker for FlatlandReleaseViewportResponse {
10621        type Borrowed<'a> = &'a mut Self;
10622        fn take_or_borrow<'a>(
10623            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10624        ) -> Self::Borrowed<'a> {
10625            value
10626        }
10627    }
10628
10629    unsafe impl fidl::encoding::TypeMarker for FlatlandReleaseViewportResponse {
10630        type Owned = Self;
10631
10632        #[inline(always)]
10633        fn inline_align(_context: fidl::encoding::Context) -> usize {
10634            4
10635        }
10636
10637        #[inline(always)]
10638        fn inline_size(_context: fidl::encoding::Context) -> usize {
10639            4
10640        }
10641    }
10642
10643    unsafe impl
10644        fidl::encoding::Encode<
10645            FlatlandReleaseViewportResponse,
10646            fidl::encoding::DefaultFuchsiaResourceDialect,
10647        > for &mut FlatlandReleaseViewportResponse
10648    {
10649        #[inline]
10650        unsafe fn encode(
10651            self,
10652            encoder: &mut fidl::encoding::Encoder<
10653                '_,
10654                fidl::encoding::DefaultFuchsiaResourceDialect,
10655            >,
10656            offset: usize,
10657            _depth: fidl::encoding::Depth,
10658        ) -> fidl::Result<()> {
10659            encoder.debug_check_bounds::<FlatlandReleaseViewportResponse>(offset);
10660            // Delegate to tuple encoding.
10661            fidl::encoding::Encode::<FlatlandReleaseViewportResponse, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
10662                (
10663                    <fidl_fuchsia_ui_views::ViewportCreationToken as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.token),
10664                ),
10665                encoder, offset, _depth
10666            )
10667        }
10668    }
10669    unsafe impl<
10670        T0: fidl::encoding::Encode<
10671                fidl_fuchsia_ui_views::ViewportCreationToken,
10672                fidl::encoding::DefaultFuchsiaResourceDialect,
10673            >,
10674    >
10675        fidl::encoding::Encode<
10676            FlatlandReleaseViewportResponse,
10677            fidl::encoding::DefaultFuchsiaResourceDialect,
10678        > for (T0,)
10679    {
10680        #[inline]
10681        unsafe fn encode(
10682            self,
10683            encoder: &mut fidl::encoding::Encoder<
10684                '_,
10685                fidl::encoding::DefaultFuchsiaResourceDialect,
10686            >,
10687            offset: usize,
10688            depth: fidl::encoding::Depth,
10689        ) -> fidl::Result<()> {
10690            encoder.debug_check_bounds::<FlatlandReleaseViewportResponse>(offset);
10691            // Zero out padding regions. There's no need to apply masks
10692            // because the unmasked parts will be overwritten by fields.
10693            // Write the fields.
10694            self.0.encode(encoder, offset + 0, depth)?;
10695            Ok(())
10696        }
10697    }
10698
10699    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10700        for FlatlandReleaseViewportResponse
10701    {
10702        #[inline(always)]
10703        fn new_empty() -> Self {
10704            Self {
10705                token: fidl::new_empty!(
10706                    fidl_fuchsia_ui_views::ViewportCreationToken,
10707                    fidl::encoding::DefaultFuchsiaResourceDialect
10708                ),
10709            }
10710        }
10711
10712        #[inline]
10713        unsafe fn decode(
10714            &mut self,
10715            decoder: &mut fidl::encoding::Decoder<
10716                '_,
10717                fidl::encoding::DefaultFuchsiaResourceDialect,
10718            >,
10719            offset: usize,
10720            _depth: fidl::encoding::Depth,
10721        ) -> fidl::Result<()> {
10722            decoder.debug_check_bounds::<Self>(offset);
10723            // Verify that padding bytes are zero.
10724            fidl::decode!(
10725                fidl_fuchsia_ui_views::ViewportCreationToken,
10726                fidl::encoding::DefaultFuchsiaResourceDialect,
10727                &mut self.token,
10728                decoder,
10729                offset + 0,
10730                _depth
10731            )?;
10732            Ok(())
10733        }
10734    }
10735
10736    impl fidl::encoding::ResourceTypeMarker for FlatlandSetSolidFillRequest {
10737        type Borrowed<'a> = &'a mut Self;
10738        fn take_or_borrow<'a>(
10739            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10740        ) -> Self::Borrowed<'a> {
10741            value
10742        }
10743    }
10744
10745    unsafe impl fidl::encoding::TypeMarker for FlatlandSetSolidFillRequest {
10746        type Owned = Self;
10747
10748        #[inline(always)]
10749        fn inline_align(_context: fidl::encoding::Context) -> usize {
10750            8
10751        }
10752
10753        #[inline(always)]
10754        fn inline_size(_context: fidl::encoding::Context) -> usize {
10755            32
10756        }
10757    }
10758
10759    unsafe impl
10760        fidl::encoding::Encode<
10761            FlatlandSetSolidFillRequest,
10762            fidl::encoding::DefaultFuchsiaResourceDialect,
10763        > for &mut FlatlandSetSolidFillRequest
10764    {
10765        #[inline]
10766        unsafe fn encode(
10767            self,
10768            encoder: &mut fidl::encoding::Encoder<
10769                '_,
10770                fidl::encoding::DefaultFuchsiaResourceDialect,
10771            >,
10772            offset: usize,
10773            _depth: fidl::encoding::Depth,
10774        ) -> fidl::Result<()> {
10775            encoder.debug_check_bounds::<FlatlandSetSolidFillRequest>(offset);
10776            // Delegate to tuple encoding.
10777            fidl::encoding::Encode::<
10778                FlatlandSetSolidFillRequest,
10779                fidl::encoding::DefaultFuchsiaResourceDialect,
10780            >::encode(
10781                (
10782                    <ContentId as fidl::encoding::ValueTypeMarker>::borrow(&self.rect_id),
10783                    <ColorRgba as fidl::encoding::ValueTypeMarker>::borrow(&self.color),
10784                    <fidl_fuchsia_math::SizeU as fidl::encoding::ValueTypeMarker>::borrow(
10785                        &self.size,
10786                    ),
10787                ),
10788                encoder,
10789                offset,
10790                _depth,
10791            )
10792        }
10793    }
10794    unsafe impl<
10795        T0: fidl::encoding::Encode<ContentId, fidl::encoding::DefaultFuchsiaResourceDialect>,
10796        T1: fidl::encoding::Encode<ColorRgba, fidl::encoding::DefaultFuchsiaResourceDialect>,
10797        T2: fidl::encoding::Encode<
10798                fidl_fuchsia_math::SizeU,
10799                fidl::encoding::DefaultFuchsiaResourceDialect,
10800            >,
10801    >
10802        fidl::encoding::Encode<
10803            FlatlandSetSolidFillRequest,
10804            fidl::encoding::DefaultFuchsiaResourceDialect,
10805        > for (T0, T1, T2)
10806    {
10807        #[inline]
10808        unsafe fn encode(
10809            self,
10810            encoder: &mut fidl::encoding::Encoder<
10811                '_,
10812                fidl::encoding::DefaultFuchsiaResourceDialect,
10813            >,
10814            offset: usize,
10815            depth: fidl::encoding::Depth,
10816        ) -> fidl::Result<()> {
10817            encoder.debug_check_bounds::<FlatlandSetSolidFillRequest>(offset);
10818            // Zero out padding regions. There's no need to apply masks
10819            // because the unmasked parts will be overwritten by fields.
10820            // Write the fields.
10821            self.0.encode(encoder, offset + 0, depth)?;
10822            self.1.encode(encoder, offset + 8, depth)?;
10823            self.2.encode(encoder, offset + 24, depth)?;
10824            Ok(())
10825        }
10826    }
10827
10828    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10829        for FlatlandSetSolidFillRequest
10830    {
10831        #[inline(always)]
10832        fn new_empty() -> Self {
10833            Self {
10834                rect_id: fidl::new_empty!(ContentId, fidl::encoding::DefaultFuchsiaResourceDialect),
10835                color: fidl::new_empty!(ColorRgba, fidl::encoding::DefaultFuchsiaResourceDialect),
10836                size: fidl::new_empty!(
10837                    fidl_fuchsia_math::SizeU,
10838                    fidl::encoding::DefaultFuchsiaResourceDialect
10839                ),
10840            }
10841        }
10842
10843        #[inline]
10844        unsafe fn decode(
10845            &mut self,
10846            decoder: &mut fidl::encoding::Decoder<
10847                '_,
10848                fidl::encoding::DefaultFuchsiaResourceDialect,
10849            >,
10850            offset: usize,
10851            _depth: fidl::encoding::Depth,
10852        ) -> fidl::Result<()> {
10853            decoder.debug_check_bounds::<Self>(offset);
10854            // Verify that padding bytes are zero.
10855            fidl::decode!(
10856                ContentId,
10857                fidl::encoding::DefaultFuchsiaResourceDialect,
10858                &mut self.rect_id,
10859                decoder,
10860                offset + 0,
10861                _depth
10862            )?;
10863            fidl::decode!(
10864                ColorRgba,
10865                fidl::encoding::DefaultFuchsiaResourceDialect,
10866                &mut self.color,
10867                decoder,
10868                offset + 8,
10869                _depth
10870            )?;
10871            fidl::decode!(
10872                fidl_fuchsia_math::SizeU,
10873                fidl::encoding::DefaultFuchsiaResourceDialect,
10874                &mut self.size,
10875                decoder,
10876                offset + 24,
10877                _depth
10878            )?;
10879            Ok(())
10880        }
10881    }
10882
10883    impl fidl::encoding::ResourceTypeMarker for TrustedFlatlandFactoryCreateFlatlandRequest {
10884        type Borrowed<'a> = &'a mut Self;
10885        fn take_or_borrow<'a>(
10886            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10887        ) -> Self::Borrowed<'a> {
10888            value
10889        }
10890    }
10891
10892    unsafe impl fidl::encoding::TypeMarker for TrustedFlatlandFactoryCreateFlatlandRequest {
10893        type Owned = Self;
10894
10895        #[inline(always)]
10896        fn inline_align(_context: fidl::encoding::Context) -> usize {
10897            8
10898        }
10899
10900        #[inline(always)]
10901        fn inline_size(_context: fidl::encoding::Context) -> usize {
10902            24
10903        }
10904    }
10905
10906    unsafe impl
10907        fidl::encoding::Encode<
10908            TrustedFlatlandFactoryCreateFlatlandRequest,
10909            fidl::encoding::DefaultFuchsiaResourceDialect,
10910        > for &mut TrustedFlatlandFactoryCreateFlatlandRequest
10911    {
10912        #[inline]
10913        unsafe fn encode(
10914            self,
10915            encoder: &mut fidl::encoding::Encoder<
10916                '_,
10917                fidl::encoding::DefaultFuchsiaResourceDialect,
10918            >,
10919            offset: usize,
10920            _depth: fidl::encoding::Depth,
10921        ) -> fidl::Result<()> {
10922            encoder.debug_check_bounds::<TrustedFlatlandFactoryCreateFlatlandRequest>(offset);
10923            // Delegate to tuple encoding.
10924            fidl::encoding::Encode::<TrustedFlatlandFactoryCreateFlatlandRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
10925                (
10926                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<FlatlandMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.server_end),
10927                    <TrustedFlatlandConfig as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.config),
10928                ),
10929                encoder, offset, _depth
10930            )
10931        }
10932    }
10933    unsafe impl<
10934        T0: fidl::encoding::Encode<
10935                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<FlatlandMarker>>,
10936                fidl::encoding::DefaultFuchsiaResourceDialect,
10937            >,
10938        T1: fidl::encoding::Encode<
10939                TrustedFlatlandConfig,
10940                fidl::encoding::DefaultFuchsiaResourceDialect,
10941            >,
10942    >
10943        fidl::encoding::Encode<
10944            TrustedFlatlandFactoryCreateFlatlandRequest,
10945            fidl::encoding::DefaultFuchsiaResourceDialect,
10946        > for (T0, T1)
10947    {
10948        #[inline]
10949        unsafe fn encode(
10950            self,
10951            encoder: &mut fidl::encoding::Encoder<
10952                '_,
10953                fidl::encoding::DefaultFuchsiaResourceDialect,
10954            >,
10955            offset: usize,
10956            depth: fidl::encoding::Depth,
10957        ) -> fidl::Result<()> {
10958            encoder.debug_check_bounds::<TrustedFlatlandFactoryCreateFlatlandRequest>(offset);
10959            // Zero out padding regions. There's no need to apply masks
10960            // because the unmasked parts will be overwritten by fields.
10961            unsafe {
10962                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
10963                (ptr as *mut u64).write_unaligned(0);
10964            }
10965            // Write the fields.
10966            self.0.encode(encoder, offset + 0, depth)?;
10967            self.1.encode(encoder, offset + 8, depth)?;
10968            Ok(())
10969        }
10970    }
10971
10972    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10973        for TrustedFlatlandFactoryCreateFlatlandRequest
10974    {
10975        #[inline(always)]
10976        fn new_empty() -> Self {
10977            Self {
10978                server_end: fidl::new_empty!(
10979                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<FlatlandMarker>>,
10980                    fidl::encoding::DefaultFuchsiaResourceDialect
10981                ),
10982                config: fidl::new_empty!(
10983                    TrustedFlatlandConfig,
10984                    fidl::encoding::DefaultFuchsiaResourceDialect
10985                ),
10986            }
10987        }
10988
10989        #[inline]
10990        unsafe fn decode(
10991            &mut self,
10992            decoder: &mut fidl::encoding::Decoder<
10993                '_,
10994                fidl::encoding::DefaultFuchsiaResourceDialect,
10995            >,
10996            offset: usize,
10997            _depth: fidl::encoding::Depth,
10998        ) -> fidl::Result<()> {
10999            decoder.debug_check_bounds::<Self>(offset);
11000            // Verify that padding bytes are zero.
11001            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
11002            let padval = unsafe { (ptr as *const u64).read_unaligned() };
11003            let mask = 0xffffffff00000000u64;
11004            let maskedval = padval & mask;
11005            if maskedval != 0 {
11006                return Err(fidl::Error::NonZeroPadding {
11007                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
11008                });
11009            }
11010            fidl::decode!(
11011                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<FlatlandMarker>>,
11012                fidl::encoding::DefaultFuchsiaResourceDialect,
11013                &mut self.server_end,
11014                decoder,
11015                offset + 0,
11016                _depth
11017            )?;
11018            fidl::decode!(
11019                TrustedFlatlandConfig,
11020                fidl::encoding::DefaultFuchsiaResourceDialect,
11021                &mut self.config,
11022                decoder,
11023                offset + 8,
11024                _depth
11025            )?;
11026            Ok(())
11027        }
11028    }
11029
11030    impl FrameInfo {
11031        #[inline(always)]
11032        fn max_ordinal_present(&self) -> u64 {
11033            if let Some(_) = self.buffer_id {
11034                return 1;
11035            }
11036            0
11037        }
11038    }
11039
11040    impl fidl::encoding::ResourceTypeMarker for FrameInfo {
11041        type Borrowed<'a> = &'a mut Self;
11042        fn take_or_borrow<'a>(
11043            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11044        ) -> Self::Borrowed<'a> {
11045            value
11046        }
11047    }
11048
11049    unsafe impl fidl::encoding::TypeMarker for FrameInfo {
11050        type Owned = Self;
11051
11052        #[inline(always)]
11053        fn inline_align(_context: fidl::encoding::Context) -> usize {
11054            8
11055        }
11056
11057        #[inline(always)]
11058        fn inline_size(_context: fidl::encoding::Context) -> usize {
11059            16
11060        }
11061    }
11062
11063    unsafe impl fidl::encoding::Encode<FrameInfo, fidl::encoding::DefaultFuchsiaResourceDialect>
11064        for &mut FrameInfo
11065    {
11066        unsafe fn encode(
11067            self,
11068            encoder: &mut fidl::encoding::Encoder<
11069                '_,
11070                fidl::encoding::DefaultFuchsiaResourceDialect,
11071            >,
11072            offset: usize,
11073            mut depth: fidl::encoding::Depth,
11074        ) -> fidl::Result<()> {
11075            encoder.debug_check_bounds::<FrameInfo>(offset);
11076            // Vector header
11077            let max_ordinal: u64 = self.max_ordinal_present();
11078            encoder.write_num(max_ordinal, offset);
11079            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
11080            // Calling encoder.out_of_line_offset(0) is not allowed.
11081            if max_ordinal == 0 {
11082                return Ok(());
11083            }
11084            depth.increment()?;
11085            let envelope_size = 8;
11086            let bytes_len = max_ordinal as usize * envelope_size;
11087            #[allow(unused_variables)]
11088            let offset = encoder.out_of_line_offset(bytes_len);
11089            let mut _prev_end_offset: usize = 0;
11090            if 1 > max_ordinal {
11091                return Ok(());
11092            }
11093
11094            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11095            // are envelope_size bytes.
11096            let cur_offset: usize = (1 - 1) * envelope_size;
11097
11098            // Zero reserved fields.
11099            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11100
11101            // Safety:
11102            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11103            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11104            //   envelope_size bytes, there is always sufficient room.
11105            fidl::encoding::encode_in_envelope_optional::<
11106                u32,
11107                fidl::encoding::DefaultFuchsiaResourceDialect,
11108            >(
11109                self.buffer_id.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
11110                encoder,
11111                offset + cur_offset,
11112                depth,
11113            )?;
11114
11115            _prev_end_offset = cur_offset + envelope_size;
11116
11117            Ok(())
11118        }
11119    }
11120
11121    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for FrameInfo {
11122        #[inline(always)]
11123        fn new_empty() -> Self {
11124            Self::default()
11125        }
11126
11127        unsafe fn decode(
11128            &mut self,
11129            decoder: &mut fidl::encoding::Decoder<
11130                '_,
11131                fidl::encoding::DefaultFuchsiaResourceDialect,
11132            >,
11133            offset: usize,
11134            mut depth: fidl::encoding::Depth,
11135        ) -> fidl::Result<()> {
11136            decoder.debug_check_bounds::<Self>(offset);
11137            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
11138                None => return Err(fidl::Error::NotNullable),
11139                Some(len) => len,
11140            };
11141            // Calling decoder.out_of_line_offset(0) is not allowed.
11142            if len == 0 {
11143                return Ok(());
11144            };
11145            depth.increment()?;
11146            let envelope_size = 8;
11147            let bytes_len = len * envelope_size;
11148            let offset = decoder.out_of_line_offset(bytes_len)?;
11149            // Decode the envelope for each type.
11150            let mut _next_ordinal_to_read = 0;
11151            let mut next_offset = offset;
11152            let end_offset = offset + bytes_len;
11153            _next_ordinal_to_read += 1;
11154            if next_offset >= end_offset {
11155                return Ok(());
11156            }
11157
11158            // Decode unknown envelopes for gaps in ordinals.
11159            while _next_ordinal_to_read < 1 {
11160                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11161                _next_ordinal_to_read += 1;
11162                next_offset += envelope_size;
11163            }
11164
11165            let next_out_of_line = decoder.next_out_of_line();
11166            let handles_before = decoder.remaining_handles();
11167            if let Some((inlined, num_bytes, num_handles)) =
11168                fidl::encoding::decode_envelope_header(decoder, next_offset)?
11169            {
11170                let member_inline_size =
11171                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
11172                if inlined != (member_inline_size <= 4) {
11173                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
11174                }
11175                let inner_offset;
11176                let mut inner_depth = depth.clone();
11177                if inlined {
11178                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11179                    inner_offset = next_offset;
11180                } else {
11181                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11182                    inner_depth.increment()?;
11183                }
11184                let val_ref = self.buffer_id.get_or_insert_with(|| {
11185                    fidl::new_empty!(u32, fidl::encoding::DefaultFuchsiaResourceDialect)
11186                });
11187                fidl::decode!(
11188                    u32,
11189                    fidl::encoding::DefaultFuchsiaResourceDialect,
11190                    val_ref,
11191                    decoder,
11192                    inner_offset,
11193                    inner_depth
11194                )?;
11195                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11196                {
11197                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
11198                }
11199                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11200                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11201                }
11202            }
11203
11204            next_offset += envelope_size;
11205
11206            // Decode the remaining unknown envelopes.
11207            while next_offset < end_offset {
11208                _next_ordinal_to_read += 1;
11209                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11210                next_offset += envelope_size;
11211            }
11212
11213            Ok(())
11214        }
11215    }
11216
11217    impl GetNextFrameArgs {
11218        #[inline(always)]
11219        fn max_ordinal_present(&self) -> u64 {
11220            if let Some(_) = self.event {
11221                return 1;
11222            }
11223            0
11224        }
11225    }
11226
11227    impl fidl::encoding::ResourceTypeMarker for GetNextFrameArgs {
11228        type Borrowed<'a> = &'a mut Self;
11229        fn take_or_borrow<'a>(
11230            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11231        ) -> Self::Borrowed<'a> {
11232            value
11233        }
11234    }
11235
11236    unsafe impl fidl::encoding::TypeMarker for GetNextFrameArgs {
11237        type Owned = Self;
11238
11239        #[inline(always)]
11240        fn inline_align(_context: fidl::encoding::Context) -> usize {
11241            8
11242        }
11243
11244        #[inline(always)]
11245        fn inline_size(_context: fidl::encoding::Context) -> usize {
11246            16
11247        }
11248    }
11249
11250    unsafe impl
11251        fidl::encoding::Encode<GetNextFrameArgs, fidl::encoding::DefaultFuchsiaResourceDialect>
11252        for &mut GetNextFrameArgs
11253    {
11254        unsafe fn encode(
11255            self,
11256            encoder: &mut fidl::encoding::Encoder<
11257                '_,
11258                fidl::encoding::DefaultFuchsiaResourceDialect,
11259            >,
11260            offset: usize,
11261            mut depth: fidl::encoding::Depth,
11262        ) -> fidl::Result<()> {
11263            encoder.debug_check_bounds::<GetNextFrameArgs>(offset);
11264            // Vector header
11265            let max_ordinal: u64 = self.max_ordinal_present();
11266            encoder.write_num(max_ordinal, offset);
11267            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
11268            // Calling encoder.out_of_line_offset(0) is not allowed.
11269            if max_ordinal == 0 {
11270                return Ok(());
11271            }
11272            depth.increment()?;
11273            let envelope_size = 8;
11274            let bytes_len = max_ordinal as usize * envelope_size;
11275            #[allow(unused_variables)]
11276            let offset = encoder.out_of_line_offset(bytes_len);
11277            let mut _prev_end_offset: usize = 0;
11278            if 1 > max_ordinal {
11279                return Ok(());
11280            }
11281
11282            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11283            // are envelope_size bytes.
11284            let cur_offset: usize = (1 - 1) * envelope_size;
11285
11286            // Zero reserved fields.
11287            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11288
11289            // Safety:
11290            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11291            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11292            //   envelope_size bytes, there is always sufficient room.
11293            fidl::encoding::encode_in_envelope_optional::<
11294                fidl::encoding::HandleType<
11295                    fidl::Event,
11296                    { fidl::ObjectType::EVENT.into_raw() },
11297                    2147483648,
11298                >,
11299                fidl::encoding::DefaultFuchsiaResourceDialect,
11300            >(
11301                self.event.as_mut().map(
11302                    <fidl::encoding::HandleType<
11303                        fidl::Event,
11304                        { fidl::ObjectType::EVENT.into_raw() },
11305                        2147483648,
11306                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
11307                ),
11308                encoder,
11309                offset + cur_offset,
11310                depth,
11311            )?;
11312
11313            _prev_end_offset = cur_offset + envelope_size;
11314
11315            Ok(())
11316        }
11317    }
11318
11319    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11320        for GetNextFrameArgs
11321    {
11322        #[inline(always)]
11323        fn new_empty() -> Self {
11324            Self::default()
11325        }
11326
11327        unsafe fn decode(
11328            &mut self,
11329            decoder: &mut fidl::encoding::Decoder<
11330                '_,
11331                fidl::encoding::DefaultFuchsiaResourceDialect,
11332            >,
11333            offset: usize,
11334            mut depth: fidl::encoding::Depth,
11335        ) -> fidl::Result<()> {
11336            decoder.debug_check_bounds::<Self>(offset);
11337            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
11338                None => return Err(fidl::Error::NotNullable),
11339                Some(len) => len,
11340            };
11341            // Calling decoder.out_of_line_offset(0) is not allowed.
11342            if len == 0 {
11343                return Ok(());
11344            };
11345            depth.increment()?;
11346            let envelope_size = 8;
11347            let bytes_len = len * envelope_size;
11348            let offset = decoder.out_of_line_offset(bytes_len)?;
11349            // Decode the envelope for each type.
11350            let mut _next_ordinal_to_read = 0;
11351            let mut next_offset = offset;
11352            let end_offset = offset + bytes_len;
11353            _next_ordinal_to_read += 1;
11354            if next_offset >= end_offset {
11355                return Ok(());
11356            }
11357
11358            // Decode unknown envelopes for gaps in ordinals.
11359            while _next_ordinal_to_read < 1 {
11360                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11361                _next_ordinal_to_read += 1;
11362                next_offset += envelope_size;
11363            }
11364
11365            let next_out_of_line = decoder.next_out_of_line();
11366            let handles_before = decoder.remaining_handles();
11367            if let Some((inlined, num_bytes, num_handles)) =
11368                fidl::encoding::decode_envelope_header(decoder, next_offset)?
11369            {
11370                let member_inline_size = <fidl::encoding::HandleType<
11371                    fidl::Event,
11372                    { fidl::ObjectType::EVENT.into_raw() },
11373                    2147483648,
11374                > as fidl::encoding::TypeMarker>::inline_size(
11375                    decoder.context
11376                );
11377                if inlined != (member_inline_size <= 4) {
11378                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
11379                }
11380                let inner_offset;
11381                let mut inner_depth = depth.clone();
11382                if inlined {
11383                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11384                    inner_offset = next_offset;
11385                } else {
11386                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11387                    inner_depth.increment()?;
11388                }
11389                let val_ref =
11390                self.event.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
11391                fidl::decode!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
11392                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11393                {
11394                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
11395                }
11396                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11397                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11398                }
11399            }
11400
11401            next_offset += envelope_size;
11402
11403            // Decode the remaining unknown envelopes.
11404            while next_offset < end_offset {
11405                _next_ordinal_to_read += 1;
11406                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11407                next_offset += envelope_size;
11408            }
11409
11410            Ok(())
11411        }
11412    }
11413
11414    impl PresentArgs {
11415        #[inline(always)]
11416        fn max_ordinal_present(&self) -> u64 {
11417            if let Some(_) = self.release_counters {
11418                return 8;
11419            }
11420            if let Some(_) = self.present_fences {
11421                return 7;
11422            }
11423            if let Some(_) = self.unsquashable {
11424                return 4;
11425            }
11426            if let Some(_) = self.release_fences {
11427                return 3;
11428            }
11429            if let Some(_) = self.acquire_fences {
11430                return 2;
11431            }
11432            if let Some(_) = self.requested_presentation_time {
11433                return 1;
11434            }
11435            0
11436        }
11437    }
11438
11439    impl fidl::encoding::ResourceTypeMarker for PresentArgs {
11440        type Borrowed<'a> = &'a mut Self;
11441        fn take_or_borrow<'a>(
11442            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11443        ) -> Self::Borrowed<'a> {
11444            value
11445        }
11446    }
11447
11448    unsafe impl fidl::encoding::TypeMarker for PresentArgs {
11449        type Owned = Self;
11450
11451        #[inline(always)]
11452        fn inline_align(_context: fidl::encoding::Context) -> usize {
11453            8
11454        }
11455
11456        #[inline(always)]
11457        fn inline_size(_context: fidl::encoding::Context) -> usize {
11458            16
11459        }
11460    }
11461
11462    unsafe impl fidl::encoding::Encode<PresentArgs, fidl::encoding::DefaultFuchsiaResourceDialect>
11463        for &mut PresentArgs
11464    {
11465        unsafe fn encode(
11466            self,
11467            encoder: &mut fidl::encoding::Encoder<
11468                '_,
11469                fidl::encoding::DefaultFuchsiaResourceDialect,
11470            >,
11471            offset: usize,
11472            mut depth: fidl::encoding::Depth,
11473        ) -> fidl::Result<()> {
11474            encoder.debug_check_bounds::<PresentArgs>(offset);
11475            // Vector header
11476            let max_ordinal: u64 = self.max_ordinal_present();
11477            encoder.write_num(max_ordinal, offset);
11478            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
11479            // Calling encoder.out_of_line_offset(0) is not allowed.
11480            if max_ordinal == 0 {
11481                return Ok(());
11482            }
11483            depth.increment()?;
11484            let envelope_size = 8;
11485            let bytes_len = max_ordinal as usize * envelope_size;
11486            #[allow(unused_variables)]
11487            let offset = encoder.out_of_line_offset(bytes_len);
11488            let mut _prev_end_offset: usize = 0;
11489            if 1 > max_ordinal {
11490                return Ok(());
11491            }
11492
11493            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11494            // are envelope_size bytes.
11495            let cur_offset: usize = (1 - 1) * envelope_size;
11496
11497            // Zero reserved fields.
11498            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11499
11500            // Safety:
11501            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11502            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11503            //   envelope_size bytes, there is always sufficient room.
11504            fidl::encoding::encode_in_envelope_optional::<
11505                i64,
11506                fidl::encoding::DefaultFuchsiaResourceDialect,
11507            >(
11508                self.requested_presentation_time
11509                    .as_ref()
11510                    .map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
11511                encoder,
11512                offset + cur_offset,
11513                depth,
11514            )?;
11515
11516            _prev_end_offset = cur_offset + envelope_size;
11517            if 2 > max_ordinal {
11518                return Ok(());
11519            }
11520
11521            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11522            // are envelope_size bytes.
11523            let cur_offset: usize = (2 - 1) * envelope_size;
11524
11525            // Zero reserved fields.
11526            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11527
11528            // Safety:
11529            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11530            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11531            //   envelope_size bytes, there is always sufficient room.
11532            fidl::encoding::encode_in_envelope_optional::<
11533                fidl::encoding::Vector<
11534                    fidl::encoding::HandleType<
11535                        fidl::Event,
11536                        { fidl::ObjectType::EVENT.into_raw() },
11537                        2147483648,
11538                    >,
11539                    16,
11540                >,
11541                fidl::encoding::DefaultFuchsiaResourceDialect,
11542            >(
11543                self.acquire_fences.as_mut().map(
11544                    <fidl::encoding::Vector<
11545                        fidl::encoding::HandleType<
11546                            fidl::Event,
11547                            { fidl::ObjectType::EVENT.into_raw() },
11548                            2147483648,
11549                        >,
11550                        16,
11551                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
11552                ),
11553                encoder,
11554                offset + cur_offset,
11555                depth,
11556            )?;
11557
11558            _prev_end_offset = cur_offset + envelope_size;
11559            if 3 > max_ordinal {
11560                return Ok(());
11561            }
11562
11563            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11564            // are envelope_size bytes.
11565            let cur_offset: usize = (3 - 1) * envelope_size;
11566
11567            // Zero reserved fields.
11568            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11569
11570            // Safety:
11571            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11572            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11573            //   envelope_size bytes, there is always sufficient room.
11574            fidl::encoding::encode_in_envelope_optional::<
11575                fidl::encoding::Vector<
11576                    fidl::encoding::HandleType<
11577                        fidl::Event,
11578                        { fidl::ObjectType::EVENT.into_raw() },
11579                        2147483648,
11580                    >,
11581                    16,
11582                >,
11583                fidl::encoding::DefaultFuchsiaResourceDialect,
11584            >(
11585                self.release_fences.as_mut().map(
11586                    <fidl::encoding::Vector<
11587                        fidl::encoding::HandleType<
11588                            fidl::Event,
11589                            { fidl::ObjectType::EVENT.into_raw() },
11590                            2147483648,
11591                        >,
11592                        16,
11593                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
11594                ),
11595                encoder,
11596                offset + cur_offset,
11597                depth,
11598            )?;
11599
11600            _prev_end_offset = cur_offset + envelope_size;
11601            if 4 > max_ordinal {
11602                return Ok(());
11603            }
11604
11605            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11606            // are envelope_size bytes.
11607            let cur_offset: usize = (4 - 1) * envelope_size;
11608
11609            // Zero reserved fields.
11610            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11611
11612            // Safety:
11613            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11614            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11615            //   envelope_size bytes, there is always sufficient room.
11616            fidl::encoding::encode_in_envelope_optional::<
11617                bool,
11618                fidl::encoding::DefaultFuchsiaResourceDialect,
11619            >(
11620                self.unsquashable.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
11621                encoder,
11622                offset + cur_offset,
11623                depth,
11624            )?;
11625
11626            _prev_end_offset = cur_offset + envelope_size;
11627            if 7 > max_ordinal {
11628                return Ok(());
11629            }
11630
11631            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11632            // are envelope_size bytes.
11633            let cur_offset: usize = (7 - 1) * envelope_size;
11634
11635            // Zero reserved fields.
11636            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11637
11638            // Safety:
11639            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11640            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11641            //   envelope_size bytes, there is always sufficient room.
11642            fidl::encoding::encode_in_envelope_optional::<
11643                fidl::encoding::Vector<
11644                    fidl::encoding::HandleType<
11645                        fidl::Counter,
11646                        { fidl::ObjectType::COUNTER.into_raw() },
11647                        2147483648,
11648                    >,
11649                    16,
11650                >,
11651                fidl::encoding::DefaultFuchsiaResourceDialect,
11652            >(
11653                self.present_fences.as_mut().map(
11654                    <fidl::encoding::Vector<
11655                        fidl::encoding::HandleType<
11656                            fidl::Counter,
11657                            { fidl::ObjectType::COUNTER.into_raw() },
11658                            2147483648,
11659                        >,
11660                        16,
11661                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
11662                ),
11663                encoder,
11664                offset + cur_offset,
11665                depth,
11666            )?;
11667
11668            _prev_end_offset = cur_offset + envelope_size;
11669            if 8 > max_ordinal {
11670                return Ok(());
11671            }
11672
11673            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11674            // are envelope_size bytes.
11675            let cur_offset: usize = (8 - 1) * envelope_size;
11676
11677            // Zero reserved fields.
11678            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11679
11680            // Safety:
11681            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11682            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11683            //   envelope_size bytes, there is always sufficient room.
11684            fidl::encoding::encode_in_envelope_optional::<
11685                fidl::encoding::Vector<
11686                    fidl::encoding::HandleType<
11687                        fidl::Counter,
11688                        { fidl::ObjectType::COUNTER.into_raw() },
11689                        2147483648,
11690                    >,
11691                    16,
11692                >,
11693                fidl::encoding::DefaultFuchsiaResourceDialect,
11694            >(
11695                self.release_counters.as_mut().map(
11696                    <fidl::encoding::Vector<
11697                        fidl::encoding::HandleType<
11698                            fidl::Counter,
11699                            { fidl::ObjectType::COUNTER.into_raw() },
11700                            2147483648,
11701                        >,
11702                        16,
11703                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
11704                ),
11705                encoder,
11706                offset + cur_offset,
11707                depth,
11708            )?;
11709
11710            _prev_end_offset = cur_offset + envelope_size;
11711
11712            Ok(())
11713        }
11714    }
11715
11716    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for PresentArgs {
11717        #[inline(always)]
11718        fn new_empty() -> Self {
11719            Self::default()
11720        }
11721
11722        unsafe fn decode(
11723            &mut self,
11724            decoder: &mut fidl::encoding::Decoder<
11725                '_,
11726                fidl::encoding::DefaultFuchsiaResourceDialect,
11727            >,
11728            offset: usize,
11729            mut depth: fidl::encoding::Depth,
11730        ) -> fidl::Result<()> {
11731            decoder.debug_check_bounds::<Self>(offset);
11732            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
11733                None => return Err(fidl::Error::NotNullable),
11734                Some(len) => len,
11735            };
11736            // Calling decoder.out_of_line_offset(0) is not allowed.
11737            if len == 0 {
11738                return Ok(());
11739            };
11740            depth.increment()?;
11741            let envelope_size = 8;
11742            let bytes_len = len * envelope_size;
11743            let offset = decoder.out_of_line_offset(bytes_len)?;
11744            // Decode the envelope for each type.
11745            let mut _next_ordinal_to_read = 0;
11746            let mut next_offset = offset;
11747            let end_offset = offset + bytes_len;
11748            _next_ordinal_to_read += 1;
11749            if next_offset >= end_offset {
11750                return Ok(());
11751            }
11752
11753            // Decode unknown envelopes for gaps in ordinals.
11754            while _next_ordinal_to_read < 1 {
11755                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11756                _next_ordinal_to_read += 1;
11757                next_offset += envelope_size;
11758            }
11759
11760            let next_out_of_line = decoder.next_out_of_line();
11761            let handles_before = decoder.remaining_handles();
11762            if let Some((inlined, num_bytes, num_handles)) =
11763                fidl::encoding::decode_envelope_header(decoder, next_offset)?
11764            {
11765                let member_inline_size =
11766                    <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
11767                if inlined != (member_inline_size <= 4) {
11768                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
11769                }
11770                let inner_offset;
11771                let mut inner_depth = depth.clone();
11772                if inlined {
11773                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11774                    inner_offset = next_offset;
11775                } else {
11776                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11777                    inner_depth.increment()?;
11778                }
11779                let val_ref = self.requested_presentation_time.get_or_insert_with(|| {
11780                    fidl::new_empty!(i64, fidl::encoding::DefaultFuchsiaResourceDialect)
11781                });
11782                fidl::decode!(
11783                    i64,
11784                    fidl::encoding::DefaultFuchsiaResourceDialect,
11785                    val_ref,
11786                    decoder,
11787                    inner_offset,
11788                    inner_depth
11789                )?;
11790                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11791                {
11792                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
11793                }
11794                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11795                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11796                }
11797            }
11798
11799            next_offset += envelope_size;
11800            _next_ordinal_to_read += 1;
11801            if next_offset >= end_offset {
11802                return Ok(());
11803            }
11804
11805            // Decode unknown envelopes for gaps in ordinals.
11806            while _next_ordinal_to_read < 2 {
11807                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11808                _next_ordinal_to_read += 1;
11809                next_offset += envelope_size;
11810            }
11811
11812            let next_out_of_line = decoder.next_out_of_line();
11813            let handles_before = decoder.remaining_handles();
11814            if let Some((inlined, num_bytes, num_handles)) =
11815                fidl::encoding::decode_envelope_header(decoder, next_offset)?
11816            {
11817                let member_inline_size = <fidl::encoding::Vector<
11818                    fidl::encoding::HandleType<
11819                        fidl::Event,
11820                        { fidl::ObjectType::EVENT.into_raw() },
11821                        2147483648,
11822                    >,
11823                    16,
11824                > as fidl::encoding::TypeMarker>::inline_size(
11825                    decoder.context
11826                );
11827                if inlined != (member_inline_size <= 4) {
11828                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
11829                }
11830                let inner_offset;
11831                let mut inner_depth = depth.clone();
11832                if inlined {
11833                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11834                    inner_offset = next_offset;
11835                } else {
11836                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11837                    inner_depth.increment()?;
11838                }
11839                let val_ref = self.acquire_fences.get_or_insert_with(|| {
11840                    fidl::new_empty!(
11841                        fidl::encoding::Vector<
11842                            fidl::encoding::HandleType<
11843                                fidl::Event,
11844                                { fidl::ObjectType::EVENT.into_raw() },
11845                                2147483648,
11846                            >,
11847                            16,
11848                        >,
11849                        fidl::encoding::DefaultFuchsiaResourceDialect
11850                    )
11851                });
11852                fidl::decode!(
11853                    fidl::encoding::Vector<
11854                        fidl::encoding::HandleType<
11855                            fidl::Event,
11856                            { fidl::ObjectType::EVENT.into_raw() },
11857                            2147483648,
11858                        >,
11859                        16,
11860                    >,
11861                    fidl::encoding::DefaultFuchsiaResourceDialect,
11862                    val_ref,
11863                    decoder,
11864                    inner_offset,
11865                    inner_depth
11866                )?;
11867                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11868                {
11869                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
11870                }
11871                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11872                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11873                }
11874            }
11875
11876            next_offset += envelope_size;
11877            _next_ordinal_to_read += 1;
11878            if next_offset >= end_offset {
11879                return Ok(());
11880            }
11881
11882            // Decode unknown envelopes for gaps in ordinals.
11883            while _next_ordinal_to_read < 3 {
11884                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11885                _next_ordinal_to_read += 1;
11886                next_offset += envelope_size;
11887            }
11888
11889            let next_out_of_line = decoder.next_out_of_line();
11890            let handles_before = decoder.remaining_handles();
11891            if let Some((inlined, num_bytes, num_handles)) =
11892                fidl::encoding::decode_envelope_header(decoder, next_offset)?
11893            {
11894                let member_inline_size = <fidl::encoding::Vector<
11895                    fidl::encoding::HandleType<
11896                        fidl::Event,
11897                        { fidl::ObjectType::EVENT.into_raw() },
11898                        2147483648,
11899                    >,
11900                    16,
11901                > as fidl::encoding::TypeMarker>::inline_size(
11902                    decoder.context
11903                );
11904                if inlined != (member_inline_size <= 4) {
11905                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
11906                }
11907                let inner_offset;
11908                let mut inner_depth = depth.clone();
11909                if inlined {
11910                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11911                    inner_offset = next_offset;
11912                } else {
11913                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11914                    inner_depth.increment()?;
11915                }
11916                let val_ref = self.release_fences.get_or_insert_with(|| {
11917                    fidl::new_empty!(
11918                        fidl::encoding::Vector<
11919                            fidl::encoding::HandleType<
11920                                fidl::Event,
11921                                { fidl::ObjectType::EVENT.into_raw() },
11922                                2147483648,
11923                            >,
11924                            16,
11925                        >,
11926                        fidl::encoding::DefaultFuchsiaResourceDialect
11927                    )
11928                });
11929                fidl::decode!(
11930                    fidl::encoding::Vector<
11931                        fidl::encoding::HandleType<
11932                            fidl::Event,
11933                            { fidl::ObjectType::EVENT.into_raw() },
11934                            2147483648,
11935                        >,
11936                        16,
11937                    >,
11938                    fidl::encoding::DefaultFuchsiaResourceDialect,
11939                    val_ref,
11940                    decoder,
11941                    inner_offset,
11942                    inner_depth
11943                )?;
11944                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11945                {
11946                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
11947                }
11948                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11949                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11950                }
11951            }
11952
11953            next_offset += envelope_size;
11954            _next_ordinal_to_read += 1;
11955            if next_offset >= end_offset {
11956                return Ok(());
11957            }
11958
11959            // Decode unknown envelopes for gaps in ordinals.
11960            while _next_ordinal_to_read < 4 {
11961                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11962                _next_ordinal_to_read += 1;
11963                next_offset += envelope_size;
11964            }
11965
11966            let next_out_of_line = decoder.next_out_of_line();
11967            let handles_before = decoder.remaining_handles();
11968            if let Some((inlined, num_bytes, num_handles)) =
11969                fidl::encoding::decode_envelope_header(decoder, next_offset)?
11970            {
11971                let member_inline_size =
11972                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
11973                if inlined != (member_inline_size <= 4) {
11974                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
11975                }
11976                let inner_offset;
11977                let mut inner_depth = depth.clone();
11978                if inlined {
11979                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11980                    inner_offset = next_offset;
11981                } else {
11982                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11983                    inner_depth.increment()?;
11984                }
11985                let val_ref = self.unsquashable.get_or_insert_with(|| {
11986                    fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
11987                });
11988                fidl::decode!(
11989                    bool,
11990                    fidl::encoding::DefaultFuchsiaResourceDialect,
11991                    val_ref,
11992                    decoder,
11993                    inner_offset,
11994                    inner_depth
11995                )?;
11996                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11997                {
11998                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
11999                }
12000                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12001                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12002                }
12003            }
12004
12005            next_offset += envelope_size;
12006            _next_ordinal_to_read += 1;
12007            if next_offset >= end_offset {
12008                return Ok(());
12009            }
12010
12011            // Decode unknown envelopes for gaps in ordinals.
12012            while _next_ordinal_to_read < 7 {
12013                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12014                _next_ordinal_to_read += 1;
12015                next_offset += envelope_size;
12016            }
12017
12018            let next_out_of_line = decoder.next_out_of_line();
12019            let handles_before = decoder.remaining_handles();
12020            if let Some((inlined, num_bytes, num_handles)) =
12021                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12022            {
12023                let member_inline_size = <fidl::encoding::Vector<
12024                    fidl::encoding::HandleType<
12025                        fidl::Counter,
12026                        { fidl::ObjectType::COUNTER.into_raw() },
12027                        2147483648,
12028                    >,
12029                    16,
12030                > as fidl::encoding::TypeMarker>::inline_size(
12031                    decoder.context
12032                );
12033                if inlined != (member_inline_size <= 4) {
12034                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12035                }
12036                let inner_offset;
12037                let mut inner_depth = depth.clone();
12038                if inlined {
12039                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12040                    inner_offset = next_offset;
12041                } else {
12042                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12043                    inner_depth.increment()?;
12044                }
12045                let val_ref = self.present_fences.get_or_insert_with(|| {
12046                    fidl::new_empty!(
12047                        fidl::encoding::Vector<
12048                            fidl::encoding::HandleType<
12049                                fidl::Counter,
12050                                { fidl::ObjectType::COUNTER.into_raw() },
12051                                2147483648,
12052                            >,
12053                            16,
12054                        >,
12055                        fidl::encoding::DefaultFuchsiaResourceDialect
12056                    )
12057                });
12058                fidl::decode!(
12059                    fidl::encoding::Vector<
12060                        fidl::encoding::HandleType<
12061                            fidl::Counter,
12062                            { fidl::ObjectType::COUNTER.into_raw() },
12063                            2147483648,
12064                        >,
12065                        16,
12066                    >,
12067                    fidl::encoding::DefaultFuchsiaResourceDialect,
12068                    val_ref,
12069                    decoder,
12070                    inner_offset,
12071                    inner_depth
12072                )?;
12073                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12074                {
12075                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12076                }
12077                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12078                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12079                }
12080            }
12081
12082            next_offset += envelope_size;
12083            _next_ordinal_to_read += 1;
12084            if next_offset >= end_offset {
12085                return Ok(());
12086            }
12087
12088            // Decode unknown envelopes for gaps in ordinals.
12089            while _next_ordinal_to_read < 8 {
12090                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12091                _next_ordinal_to_read += 1;
12092                next_offset += envelope_size;
12093            }
12094
12095            let next_out_of_line = decoder.next_out_of_line();
12096            let handles_before = decoder.remaining_handles();
12097            if let Some((inlined, num_bytes, num_handles)) =
12098                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12099            {
12100                let member_inline_size = <fidl::encoding::Vector<
12101                    fidl::encoding::HandleType<
12102                        fidl::Counter,
12103                        { fidl::ObjectType::COUNTER.into_raw() },
12104                        2147483648,
12105                    >,
12106                    16,
12107                > as fidl::encoding::TypeMarker>::inline_size(
12108                    decoder.context
12109                );
12110                if inlined != (member_inline_size <= 4) {
12111                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12112                }
12113                let inner_offset;
12114                let mut inner_depth = depth.clone();
12115                if inlined {
12116                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12117                    inner_offset = next_offset;
12118                } else {
12119                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12120                    inner_depth.increment()?;
12121                }
12122                let val_ref = self.release_counters.get_or_insert_with(|| {
12123                    fidl::new_empty!(
12124                        fidl::encoding::Vector<
12125                            fidl::encoding::HandleType<
12126                                fidl::Counter,
12127                                { fidl::ObjectType::COUNTER.into_raw() },
12128                                2147483648,
12129                            >,
12130                            16,
12131                        >,
12132                        fidl::encoding::DefaultFuchsiaResourceDialect
12133                    )
12134                });
12135                fidl::decode!(
12136                    fidl::encoding::Vector<
12137                        fidl::encoding::HandleType<
12138                            fidl::Counter,
12139                            { fidl::ObjectType::COUNTER.into_raw() },
12140                            2147483648,
12141                        >,
12142                        16,
12143                    >,
12144                    fidl::encoding::DefaultFuchsiaResourceDialect,
12145                    val_ref,
12146                    decoder,
12147                    inner_offset,
12148                    inner_depth
12149                )?;
12150                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12151                {
12152                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12153                }
12154                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12155                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12156                }
12157            }
12158
12159            next_offset += envelope_size;
12160
12161            // Decode the remaining unknown envelopes.
12162            while next_offset < end_offset {
12163                _next_ordinal_to_read += 1;
12164                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12165                next_offset += envelope_size;
12166            }
12167
12168            Ok(())
12169        }
12170    }
12171
12172    impl RegisterBufferCollectionArgs {
12173        #[inline(always)]
12174        fn max_ordinal_present(&self) -> u64 {
12175            if let Some(_) = self.buffer_collection_token2 {
12176                return 5;
12177            }
12178            if let Some(_) = self.usages {
12179                return 4;
12180            }
12181            if let Some(_) = self.usage {
12182                return 3;
12183            }
12184            if let Some(_) = self.buffer_collection_token {
12185                return 2;
12186            }
12187            if let Some(_) = self.export_token {
12188                return 1;
12189            }
12190            0
12191        }
12192    }
12193
12194    impl fidl::encoding::ResourceTypeMarker for RegisterBufferCollectionArgs {
12195        type Borrowed<'a> = &'a mut Self;
12196        fn take_or_borrow<'a>(
12197            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12198        ) -> Self::Borrowed<'a> {
12199            value
12200        }
12201    }
12202
12203    unsafe impl fidl::encoding::TypeMarker for RegisterBufferCollectionArgs {
12204        type Owned = Self;
12205
12206        #[inline(always)]
12207        fn inline_align(_context: fidl::encoding::Context) -> usize {
12208            8
12209        }
12210
12211        #[inline(always)]
12212        fn inline_size(_context: fidl::encoding::Context) -> usize {
12213            16
12214        }
12215    }
12216
12217    unsafe impl
12218        fidl::encoding::Encode<
12219            RegisterBufferCollectionArgs,
12220            fidl::encoding::DefaultFuchsiaResourceDialect,
12221        > for &mut RegisterBufferCollectionArgs
12222    {
12223        unsafe fn encode(
12224            self,
12225            encoder: &mut fidl::encoding::Encoder<
12226                '_,
12227                fidl::encoding::DefaultFuchsiaResourceDialect,
12228            >,
12229            offset: usize,
12230            mut depth: fidl::encoding::Depth,
12231        ) -> fidl::Result<()> {
12232            encoder.debug_check_bounds::<RegisterBufferCollectionArgs>(offset);
12233            // Vector header
12234            let max_ordinal: u64 = self.max_ordinal_present();
12235            encoder.write_num(max_ordinal, offset);
12236            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
12237            // Calling encoder.out_of_line_offset(0) is not allowed.
12238            if max_ordinal == 0 {
12239                return Ok(());
12240            }
12241            depth.increment()?;
12242            let envelope_size = 8;
12243            let bytes_len = max_ordinal as usize * envelope_size;
12244            #[allow(unused_variables)]
12245            let offset = encoder.out_of_line_offset(bytes_len);
12246            let mut _prev_end_offset: usize = 0;
12247            if 1 > max_ordinal {
12248                return Ok(());
12249            }
12250
12251            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12252            // are envelope_size bytes.
12253            let cur_offset: usize = (1 - 1) * envelope_size;
12254
12255            // Zero reserved fields.
12256            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12257
12258            // Safety:
12259            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12260            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12261            //   envelope_size bytes, there is always sufficient room.
12262            fidl::encoding::encode_in_envelope_optional::<BufferCollectionExportToken, fidl::encoding::DefaultFuchsiaResourceDialect>(
12263            self.export_token.as_mut().map(<BufferCollectionExportToken as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
12264            encoder, offset + cur_offset, depth
12265        )?;
12266
12267            _prev_end_offset = cur_offset + envelope_size;
12268            if 2 > max_ordinal {
12269                return Ok(());
12270            }
12271
12272            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12273            // are envelope_size bytes.
12274            let cur_offset: usize = (2 - 1) * envelope_size;
12275
12276            // Zero reserved fields.
12277            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12278
12279            // Safety:
12280            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12281            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12282            //   envelope_size bytes, there is always sufficient room.
12283            fidl::encoding::encode_in_envelope_optional::<
12284                fidl::encoding::Endpoint<
12285                    fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem::BufferCollectionTokenMarker>,
12286                >,
12287                fidl::encoding::DefaultFuchsiaResourceDialect,
12288            >(
12289                self.buffer_collection_token.as_mut().map(
12290                    <fidl::encoding::Endpoint<
12291                        fidl::endpoints::ClientEnd<
12292                            fidl_fuchsia_sysmem::BufferCollectionTokenMarker,
12293                        >,
12294                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
12295                ),
12296                encoder,
12297                offset + cur_offset,
12298                depth,
12299            )?;
12300
12301            _prev_end_offset = cur_offset + envelope_size;
12302            if 3 > max_ordinal {
12303                return Ok(());
12304            }
12305
12306            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12307            // are envelope_size bytes.
12308            let cur_offset: usize = (3 - 1) * envelope_size;
12309
12310            // Zero reserved fields.
12311            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12312
12313            // Safety:
12314            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12315            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12316            //   envelope_size bytes, there is always sufficient room.
12317            fidl::encoding::encode_in_envelope_optional::<
12318                RegisterBufferCollectionUsage,
12319                fidl::encoding::DefaultFuchsiaResourceDialect,
12320            >(
12321                self.usage.as_ref().map(
12322                    <RegisterBufferCollectionUsage as fidl::encoding::ValueTypeMarker>::borrow,
12323                ),
12324                encoder,
12325                offset + cur_offset,
12326                depth,
12327            )?;
12328
12329            _prev_end_offset = cur_offset + envelope_size;
12330            if 4 > max_ordinal {
12331                return Ok(());
12332            }
12333
12334            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12335            // are envelope_size bytes.
12336            let cur_offset: usize = (4 - 1) * envelope_size;
12337
12338            // Zero reserved fields.
12339            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12340
12341            // Safety:
12342            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12343            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12344            //   envelope_size bytes, there is always sufficient room.
12345            fidl::encoding::encode_in_envelope_optional::<
12346                RegisterBufferCollectionUsages,
12347                fidl::encoding::DefaultFuchsiaResourceDialect,
12348            >(
12349                self.usages.as_ref().map(
12350                    <RegisterBufferCollectionUsages as fidl::encoding::ValueTypeMarker>::borrow,
12351                ),
12352                encoder,
12353                offset + cur_offset,
12354                depth,
12355            )?;
12356
12357            _prev_end_offset = cur_offset + envelope_size;
12358            if 5 > max_ordinal {
12359                return Ok(());
12360            }
12361
12362            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12363            // are envelope_size bytes.
12364            let cur_offset: usize = (5 - 1) * envelope_size;
12365
12366            // Zero reserved fields.
12367            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12368
12369            // Safety:
12370            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12371            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12372            //   envelope_size bytes, there is always sufficient room.
12373            fidl::encoding::encode_in_envelope_optional::<
12374                fidl::encoding::Endpoint<
12375                    fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem2::BufferCollectionTokenMarker>,
12376                >,
12377                fidl::encoding::DefaultFuchsiaResourceDialect,
12378            >(
12379                self.buffer_collection_token2.as_mut().map(
12380                    <fidl::encoding::Endpoint<
12381                        fidl::endpoints::ClientEnd<
12382                            fidl_fuchsia_sysmem2::BufferCollectionTokenMarker,
12383                        >,
12384                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
12385                ),
12386                encoder,
12387                offset + cur_offset,
12388                depth,
12389            )?;
12390
12391            _prev_end_offset = cur_offset + envelope_size;
12392
12393            Ok(())
12394        }
12395    }
12396
12397    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
12398        for RegisterBufferCollectionArgs
12399    {
12400        #[inline(always)]
12401        fn new_empty() -> Self {
12402            Self::default()
12403        }
12404
12405        unsafe fn decode(
12406            &mut self,
12407            decoder: &mut fidl::encoding::Decoder<
12408                '_,
12409                fidl::encoding::DefaultFuchsiaResourceDialect,
12410            >,
12411            offset: usize,
12412            mut depth: fidl::encoding::Depth,
12413        ) -> fidl::Result<()> {
12414            decoder.debug_check_bounds::<Self>(offset);
12415            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
12416                None => return Err(fidl::Error::NotNullable),
12417                Some(len) => len,
12418            };
12419            // Calling decoder.out_of_line_offset(0) is not allowed.
12420            if len == 0 {
12421                return Ok(());
12422            };
12423            depth.increment()?;
12424            let envelope_size = 8;
12425            let bytes_len = len * envelope_size;
12426            let offset = decoder.out_of_line_offset(bytes_len)?;
12427            // Decode the envelope for each type.
12428            let mut _next_ordinal_to_read = 0;
12429            let mut next_offset = offset;
12430            let end_offset = offset + bytes_len;
12431            _next_ordinal_to_read += 1;
12432            if next_offset >= end_offset {
12433                return Ok(());
12434            }
12435
12436            // Decode unknown envelopes for gaps in ordinals.
12437            while _next_ordinal_to_read < 1 {
12438                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12439                _next_ordinal_to_read += 1;
12440                next_offset += envelope_size;
12441            }
12442
12443            let next_out_of_line = decoder.next_out_of_line();
12444            let handles_before = decoder.remaining_handles();
12445            if let Some((inlined, num_bytes, num_handles)) =
12446                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12447            {
12448                let member_inline_size =
12449                    <BufferCollectionExportToken as fidl::encoding::TypeMarker>::inline_size(
12450                        decoder.context,
12451                    );
12452                if inlined != (member_inline_size <= 4) {
12453                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12454                }
12455                let inner_offset;
12456                let mut inner_depth = depth.clone();
12457                if inlined {
12458                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12459                    inner_offset = next_offset;
12460                } else {
12461                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12462                    inner_depth.increment()?;
12463                }
12464                let val_ref = self.export_token.get_or_insert_with(|| {
12465                    fidl::new_empty!(
12466                        BufferCollectionExportToken,
12467                        fidl::encoding::DefaultFuchsiaResourceDialect
12468                    )
12469                });
12470                fidl::decode!(
12471                    BufferCollectionExportToken,
12472                    fidl::encoding::DefaultFuchsiaResourceDialect,
12473                    val_ref,
12474                    decoder,
12475                    inner_offset,
12476                    inner_depth
12477                )?;
12478                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12479                {
12480                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12481                }
12482                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12483                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12484                }
12485            }
12486
12487            next_offset += envelope_size;
12488            _next_ordinal_to_read += 1;
12489            if next_offset >= end_offset {
12490                return Ok(());
12491            }
12492
12493            // Decode unknown envelopes for gaps in ordinals.
12494            while _next_ordinal_to_read < 2 {
12495                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12496                _next_ordinal_to_read += 1;
12497                next_offset += envelope_size;
12498            }
12499
12500            let next_out_of_line = decoder.next_out_of_line();
12501            let handles_before = decoder.remaining_handles();
12502            if let Some((inlined, num_bytes, num_handles)) =
12503                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12504            {
12505                let member_inline_size = <fidl::encoding::Endpoint<
12506                    fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem::BufferCollectionTokenMarker>,
12507                > as fidl::encoding::TypeMarker>::inline_size(
12508                    decoder.context
12509                );
12510                if inlined != (member_inline_size <= 4) {
12511                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12512                }
12513                let inner_offset;
12514                let mut inner_depth = depth.clone();
12515                if inlined {
12516                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12517                    inner_offset = next_offset;
12518                } else {
12519                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12520                    inner_depth.increment()?;
12521                }
12522                let val_ref = self.buffer_collection_token.get_or_insert_with(|| {
12523                    fidl::new_empty!(
12524                        fidl::encoding::Endpoint<
12525                            fidl::endpoints::ClientEnd<
12526                                fidl_fuchsia_sysmem::BufferCollectionTokenMarker,
12527                            >,
12528                        >,
12529                        fidl::encoding::DefaultFuchsiaResourceDialect
12530                    )
12531                });
12532                fidl::decode!(
12533                    fidl::encoding::Endpoint<
12534                        fidl::endpoints::ClientEnd<
12535                            fidl_fuchsia_sysmem::BufferCollectionTokenMarker,
12536                        >,
12537                    >,
12538                    fidl::encoding::DefaultFuchsiaResourceDialect,
12539                    val_ref,
12540                    decoder,
12541                    inner_offset,
12542                    inner_depth
12543                )?;
12544                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12545                {
12546                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12547                }
12548                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12549                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12550                }
12551            }
12552
12553            next_offset += envelope_size;
12554            _next_ordinal_to_read += 1;
12555            if next_offset >= end_offset {
12556                return Ok(());
12557            }
12558
12559            // Decode unknown envelopes for gaps in ordinals.
12560            while _next_ordinal_to_read < 3 {
12561                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12562                _next_ordinal_to_read += 1;
12563                next_offset += envelope_size;
12564            }
12565
12566            let next_out_of_line = decoder.next_out_of_line();
12567            let handles_before = decoder.remaining_handles();
12568            if let Some((inlined, num_bytes, num_handles)) =
12569                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12570            {
12571                let member_inline_size =
12572                    <RegisterBufferCollectionUsage as fidl::encoding::TypeMarker>::inline_size(
12573                        decoder.context,
12574                    );
12575                if inlined != (member_inline_size <= 4) {
12576                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12577                }
12578                let inner_offset;
12579                let mut inner_depth = depth.clone();
12580                if inlined {
12581                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12582                    inner_offset = next_offset;
12583                } else {
12584                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12585                    inner_depth.increment()?;
12586                }
12587                let val_ref = self.usage.get_or_insert_with(|| {
12588                    fidl::new_empty!(
12589                        RegisterBufferCollectionUsage,
12590                        fidl::encoding::DefaultFuchsiaResourceDialect
12591                    )
12592                });
12593                fidl::decode!(
12594                    RegisterBufferCollectionUsage,
12595                    fidl::encoding::DefaultFuchsiaResourceDialect,
12596                    val_ref,
12597                    decoder,
12598                    inner_offset,
12599                    inner_depth
12600                )?;
12601                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12602                {
12603                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12604                }
12605                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12606                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12607                }
12608            }
12609
12610            next_offset += envelope_size;
12611            _next_ordinal_to_read += 1;
12612            if next_offset >= end_offset {
12613                return Ok(());
12614            }
12615
12616            // Decode unknown envelopes for gaps in ordinals.
12617            while _next_ordinal_to_read < 4 {
12618                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12619                _next_ordinal_to_read += 1;
12620                next_offset += envelope_size;
12621            }
12622
12623            let next_out_of_line = decoder.next_out_of_line();
12624            let handles_before = decoder.remaining_handles();
12625            if let Some((inlined, num_bytes, num_handles)) =
12626                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12627            {
12628                let member_inline_size =
12629                    <RegisterBufferCollectionUsages as fidl::encoding::TypeMarker>::inline_size(
12630                        decoder.context,
12631                    );
12632                if inlined != (member_inline_size <= 4) {
12633                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12634                }
12635                let inner_offset;
12636                let mut inner_depth = depth.clone();
12637                if inlined {
12638                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12639                    inner_offset = next_offset;
12640                } else {
12641                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12642                    inner_depth.increment()?;
12643                }
12644                let val_ref = self.usages.get_or_insert_with(|| {
12645                    fidl::new_empty!(
12646                        RegisterBufferCollectionUsages,
12647                        fidl::encoding::DefaultFuchsiaResourceDialect
12648                    )
12649                });
12650                fidl::decode!(
12651                    RegisterBufferCollectionUsages,
12652                    fidl::encoding::DefaultFuchsiaResourceDialect,
12653                    val_ref,
12654                    decoder,
12655                    inner_offset,
12656                    inner_depth
12657                )?;
12658                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12659                {
12660                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12661                }
12662                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12663                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12664                }
12665            }
12666
12667            next_offset += envelope_size;
12668            _next_ordinal_to_read += 1;
12669            if next_offset >= end_offset {
12670                return Ok(());
12671            }
12672
12673            // Decode unknown envelopes for gaps in ordinals.
12674            while _next_ordinal_to_read < 5 {
12675                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12676                _next_ordinal_to_read += 1;
12677                next_offset += envelope_size;
12678            }
12679
12680            let next_out_of_line = decoder.next_out_of_line();
12681            let handles_before = decoder.remaining_handles();
12682            if let Some((inlined, num_bytes, num_handles)) =
12683                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12684            {
12685                let member_inline_size = <fidl::encoding::Endpoint<
12686                    fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem2::BufferCollectionTokenMarker>,
12687                > as fidl::encoding::TypeMarker>::inline_size(
12688                    decoder.context
12689                );
12690                if inlined != (member_inline_size <= 4) {
12691                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12692                }
12693                let inner_offset;
12694                let mut inner_depth = depth.clone();
12695                if inlined {
12696                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12697                    inner_offset = next_offset;
12698                } else {
12699                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12700                    inner_depth.increment()?;
12701                }
12702                let val_ref = self.buffer_collection_token2.get_or_insert_with(|| {
12703                    fidl::new_empty!(
12704                        fidl::encoding::Endpoint<
12705                            fidl::endpoints::ClientEnd<
12706                                fidl_fuchsia_sysmem2::BufferCollectionTokenMarker,
12707                            >,
12708                        >,
12709                        fidl::encoding::DefaultFuchsiaResourceDialect
12710                    )
12711                });
12712                fidl::decode!(
12713                    fidl::encoding::Endpoint<
12714                        fidl::endpoints::ClientEnd<
12715                            fidl_fuchsia_sysmem2::BufferCollectionTokenMarker,
12716                        >,
12717                    >,
12718                    fidl::encoding::DefaultFuchsiaResourceDialect,
12719                    val_ref,
12720                    decoder,
12721                    inner_offset,
12722                    inner_depth
12723                )?;
12724                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12725                {
12726                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12727                }
12728                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12729                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12730                }
12731            }
12732
12733            next_offset += envelope_size;
12734
12735            // Decode the remaining unknown envelopes.
12736            while next_offset < end_offset {
12737                _next_ordinal_to_read += 1;
12738                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12739                next_offset += envelope_size;
12740            }
12741
12742            Ok(())
12743        }
12744    }
12745
12746    impl ScreenCaptureConfig {
12747        #[inline(always)]
12748        fn max_ordinal_present(&self) -> u64 {
12749            if let Some(_) = self.rotation {
12750                return 4;
12751            }
12752            if let Some(_) = self.buffer_count {
12753                return 3;
12754            }
12755            if let Some(_) = self.size {
12756                return 2;
12757            }
12758            if let Some(_) = self.import_token {
12759                return 1;
12760            }
12761            0
12762        }
12763    }
12764
12765    impl fidl::encoding::ResourceTypeMarker for ScreenCaptureConfig {
12766        type Borrowed<'a> = &'a mut Self;
12767        fn take_or_borrow<'a>(
12768            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12769        ) -> Self::Borrowed<'a> {
12770            value
12771        }
12772    }
12773
12774    unsafe impl fidl::encoding::TypeMarker for ScreenCaptureConfig {
12775        type Owned = Self;
12776
12777        #[inline(always)]
12778        fn inline_align(_context: fidl::encoding::Context) -> usize {
12779            8
12780        }
12781
12782        #[inline(always)]
12783        fn inline_size(_context: fidl::encoding::Context) -> usize {
12784            16
12785        }
12786    }
12787
12788    unsafe impl
12789        fidl::encoding::Encode<ScreenCaptureConfig, fidl::encoding::DefaultFuchsiaResourceDialect>
12790        for &mut ScreenCaptureConfig
12791    {
12792        unsafe fn encode(
12793            self,
12794            encoder: &mut fidl::encoding::Encoder<
12795                '_,
12796                fidl::encoding::DefaultFuchsiaResourceDialect,
12797            >,
12798            offset: usize,
12799            mut depth: fidl::encoding::Depth,
12800        ) -> fidl::Result<()> {
12801            encoder.debug_check_bounds::<ScreenCaptureConfig>(offset);
12802            // Vector header
12803            let max_ordinal: u64 = self.max_ordinal_present();
12804            encoder.write_num(max_ordinal, offset);
12805            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
12806            // Calling encoder.out_of_line_offset(0) is not allowed.
12807            if max_ordinal == 0 {
12808                return Ok(());
12809            }
12810            depth.increment()?;
12811            let envelope_size = 8;
12812            let bytes_len = max_ordinal as usize * envelope_size;
12813            #[allow(unused_variables)]
12814            let offset = encoder.out_of_line_offset(bytes_len);
12815            let mut _prev_end_offset: usize = 0;
12816            if 1 > max_ordinal {
12817                return Ok(());
12818            }
12819
12820            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12821            // are envelope_size bytes.
12822            let cur_offset: usize = (1 - 1) * envelope_size;
12823
12824            // Zero reserved fields.
12825            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12826
12827            // Safety:
12828            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12829            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12830            //   envelope_size bytes, there is always sufficient room.
12831            fidl::encoding::encode_in_envelope_optional::<BufferCollectionImportToken, fidl::encoding::DefaultFuchsiaResourceDialect>(
12832            self.import_token.as_mut().map(<BufferCollectionImportToken as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
12833            encoder, offset + cur_offset, depth
12834        )?;
12835
12836            _prev_end_offset = cur_offset + envelope_size;
12837            if 2 > max_ordinal {
12838                return Ok(());
12839            }
12840
12841            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12842            // are envelope_size bytes.
12843            let cur_offset: usize = (2 - 1) * envelope_size;
12844
12845            // Zero reserved fields.
12846            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12847
12848            // Safety:
12849            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12850            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12851            //   envelope_size bytes, there is always sufficient room.
12852            fidl::encoding::encode_in_envelope_optional::<
12853                fidl_fuchsia_math::SizeU,
12854                fidl::encoding::DefaultFuchsiaResourceDialect,
12855            >(
12856                self.size
12857                    .as_ref()
12858                    .map(<fidl_fuchsia_math::SizeU as fidl::encoding::ValueTypeMarker>::borrow),
12859                encoder,
12860                offset + cur_offset,
12861                depth,
12862            )?;
12863
12864            _prev_end_offset = cur_offset + envelope_size;
12865            if 3 > max_ordinal {
12866                return Ok(());
12867            }
12868
12869            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12870            // are envelope_size bytes.
12871            let cur_offset: usize = (3 - 1) * envelope_size;
12872
12873            // Zero reserved fields.
12874            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12875
12876            // Safety:
12877            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12878            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12879            //   envelope_size bytes, there is always sufficient room.
12880            fidl::encoding::encode_in_envelope_optional::<
12881                u32,
12882                fidl::encoding::DefaultFuchsiaResourceDialect,
12883            >(
12884                self.buffer_count.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
12885                encoder,
12886                offset + cur_offset,
12887                depth,
12888            )?;
12889
12890            _prev_end_offset = cur_offset + envelope_size;
12891            if 4 > 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 = (4 - 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                Rotation,
12908                fidl::encoding::DefaultFuchsiaResourceDialect,
12909            >(
12910                self.rotation.as_ref().map(<Rotation as fidl::encoding::ValueTypeMarker>::borrow),
12911                encoder,
12912                offset + cur_offset,
12913                depth,
12914            )?;
12915
12916            _prev_end_offset = cur_offset + envelope_size;
12917
12918            Ok(())
12919        }
12920    }
12921
12922    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
12923        for ScreenCaptureConfig
12924    {
12925        #[inline(always)]
12926        fn new_empty() -> Self {
12927            Self::default()
12928        }
12929
12930        unsafe fn decode(
12931            &mut self,
12932            decoder: &mut fidl::encoding::Decoder<
12933                '_,
12934                fidl::encoding::DefaultFuchsiaResourceDialect,
12935            >,
12936            offset: usize,
12937            mut depth: fidl::encoding::Depth,
12938        ) -> fidl::Result<()> {
12939            decoder.debug_check_bounds::<Self>(offset);
12940            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
12941                None => return Err(fidl::Error::NotNullable),
12942                Some(len) => len,
12943            };
12944            // Calling decoder.out_of_line_offset(0) is not allowed.
12945            if len == 0 {
12946                return Ok(());
12947            };
12948            depth.increment()?;
12949            let envelope_size = 8;
12950            let bytes_len = len * envelope_size;
12951            let offset = decoder.out_of_line_offset(bytes_len)?;
12952            // Decode the envelope for each type.
12953            let mut _next_ordinal_to_read = 0;
12954            let mut next_offset = offset;
12955            let end_offset = offset + bytes_len;
12956            _next_ordinal_to_read += 1;
12957            if next_offset >= end_offset {
12958                return Ok(());
12959            }
12960
12961            // Decode unknown envelopes for gaps in ordinals.
12962            while _next_ordinal_to_read < 1 {
12963                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12964                _next_ordinal_to_read += 1;
12965                next_offset += envelope_size;
12966            }
12967
12968            let next_out_of_line = decoder.next_out_of_line();
12969            let handles_before = decoder.remaining_handles();
12970            if let Some((inlined, num_bytes, num_handles)) =
12971                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12972            {
12973                let member_inline_size =
12974                    <BufferCollectionImportToken as fidl::encoding::TypeMarker>::inline_size(
12975                        decoder.context,
12976                    );
12977                if inlined != (member_inline_size <= 4) {
12978                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12979                }
12980                let inner_offset;
12981                let mut inner_depth = depth.clone();
12982                if inlined {
12983                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12984                    inner_offset = next_offset;
12985                } else {
12986                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12987                    inner_depth.increment()?;
12988                }
12989                let val_ref = self.import_token.get_or_insert_with(|| {
12990                    fidl::new_empty!(
12991                        BufferCollectionImportToken,
12992                        fidl::encoding::DefaultFuchsiaResourceDialect
12993                    )
12994                });
12995                fidl::decode!(
12996                    BufferCollectionImportToken,
12997                    fidl::encoding::DefaultFuchsiaResourceDialect,
12998                    val_ref,
12999                    decoder,
13000                    inner_offset,
13001                    inner_depth
13002                )?;
13003                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
13004                {
13005                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
13006                }
13007                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
13008                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
13009                }
13010            }
13011
13012            next_offset += envelope_size;
13013            _next_ordinal_to_read += 1;
13014            if next_offset >= end_offset {
13015                return Ok(());
13016            }
13017
13018            // Decode unknown envelopes for gaps in ordinals.
13019            while _next_ordinal_to_read < 2 {
13020                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13021                _next_ordinal_to_read += 1;
13022                next_offset += envelope_size;
13023            }
13024
13025            let next_out_of_line = decoder.next_out_of_line();
13026            let handles_before = decoder.remaining_handles();
13027            if let Some((inlined, num_bytes, num_handles)) =
13028                fidl::encoding::decode_envelope_header(decoder, next_offset)?
13029            {
13030                let member_inline_size =
13031                    <fidl_fuchsia_math::SizeU as fidl::encoding::TypeMarker>::inline_size(
13032                        decoder.context,
13033                    );
13034                if inlined != (member_inline_size <= 4) {
13035                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
13036                }
13037                let inner_offset;
13038                let mut inner_depth = depth.clone();
13039                if inlined {
13040                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
13041                    inner_offset = next_offset;
13042                } else {
13043                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
13044                    inner_depth.increment()?;
13045                }
13046                let val_ref = self.size.get_or_insert_with(|| {
13047                    fidl::new_empty!(
13048                        fidl_fuchsia_math::SizeU,
13049                        fidl::encoding::DefaultFuchsiaResourceDialect
13050                    )
13051                });
13052                fidl::decode!(
13053                    fidl_fuchsia_math::SizeU,
13054                    fidl::encoding::DefaultFuchsiaResourceDialect,
13055                    val_ref,
13056                    decoder,
13057                    inner_offset,
13058                    inner_depth
13059                )?;
13060                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
13061                {
13062                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
13063                }
13064                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
13065                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
13066                }
13067            }
13068
13069            next_offset += envelope_size;
13070            _next_ordinal_to_read += 1;
13071            if next_offset >= end_offset {
13072                return Ok(());
13073            }
13074
13075            // Decode unknown envelopes for gaps in ordinals.
13076            while _next_ordinal_to_read < 3 {
13077                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13078                _next_ordinal_to_read += 1;
13079                next_offset += envelope_size;
13080            }
13081
13082            let next_out_of_line = decoder.next_out_of_line();
13083            let handles_before = decoder.remaining_handles();
13084            if let Some((inlined, num_bytes, num_handles)) =
13085                fidl::encoding::decode_envelope_header(decoder, next_offset)?
13086            {
13087                let member_inline_size =
13088                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
13089                if inlined != (member_inline_size <= 4) {
13090                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
13091                }
13092                let inner_offset;
13093                let mut inner_depth = depth.clone();
13094                if inlined {
13095                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
13096                    inner_offset = next_offset;
13097                } else {
13098                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
13099                    inner_depth.increment()?;
13100                }
13101                let val_ref = self.buffer_count.get_or_insert_with(|| {
13102                    fidl::new_empty!(u32, fidl::encoding::DefaultFuchsiaResourceDialect)
13103                });
13104                fidl::decode!(
13105                    u32,
13106                    fidl::encoding::DefaultFuchsiaResourceDialect,
13107                    val_ref,
13108                    decoder,
13109                    inner_offset,
13110                    inner_depth
13111                )?;
13112                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
13113                {
13114                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
13115                }
13116                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
13117                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
13118                }
13119            }
13120
13121            next_offset += envelope_size;
13122            _next_ordinal_to_read += 1;
13123            if next_offset >= end_offset {
13124                return Ok(());
13125            }
13126
13127            // Decode unknown envelopes for gaps in ordinals.
13128            while _next_ordinal_to_read < 4 {
13129                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13130                _next_ordinal_to_read += 1;
13131                next_offset += envelope_size;
13132            }
13133
13134            let next_out_of_line = decoder.next_out_of_line();
13135            let handles_before = decoder.remaining_handles();
13136            if let Some((inlined, num_bytes, num_handles)) =
13137                fidl::encoding::decode_envelope_header(decoder, next_offset)?
13138            {
13139                let member_inline_size =
13140                    <Rotation as fidl::encoding::TypeMarker>::inline_size(decoder.context);
13141                if inlined != (member_inline_size <= 4) {
13142                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
13143                }
13144                let inner_offset;
13145                let mut inner_depth = depth.clone();
13146                if inlined {
13147                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
13148                    inner_offset = next_offset;
13149                } else {
13150                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
13151                    inner_depth.increment()?;
13152                }
13153                let val_ref = self.rotation.get_or_insert_with(|| {
13154                    fidl::new_empty!(Rotation, fidl::encoding::DefaultFuchsiaResourceDialect)
13155                });
13156                fidl::decode!(
13157                    Rotation,
13158                    fidl::encoding::DefaultFuchsiaResourceDialect,
13159                    val_ref,
13160                    decoder,
13161                    inner_offset,
13162                    inner_depth
13163                )?;
13164                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
13165                {
13166                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
13167                }
13168                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
13169                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
13170                }
13171            }
13172
13173            next_offset += envelope_size;
13174
13175            // Decode the remaining unknown envelopes.
13176            while next_offset < end_offset {
13177                _next_ordinal_to_read += 1;
13178                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13179                next_offset += envelope_size;
13180            }
13181
13182            Ok(())
13183        }
13184    }
13185
13186    impl ScreenshotTakeFileRequest {
13187        #[inline(always)]
13188        fn max_ordinal_present(&self) -> u64 {
13189            if let Some(_) = self.format {
13190                return 1;
13191            }
13192            0
13193        }
13194    }
13195
13196    impl fidl::encoding::ResourceTypeMarker for ScreenshotTakeFileRequest {
13197        type Borrowed<'a> = &'a mut Self;
13198        fn take_or_borrow<'a>(
13199            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
13200        ) -> Self::Borrowed<'a> {
13201            value
13202        }
13203    }
13204
13205    unsafe impl fidl::encoding::TypeMarker for ScreenshotTakeFileRequest {
13206        type Owned = Self;
13207
13208        #[inline(always)]
13209        fn inline_align(_context: fidl::encoding::Context) -> usize {
13210            8
13211        }
13212
13213        #[inline(always)]
13214        fn inline_size(_context: fidl::encoding::Context) -> usize {
13215            16
13216        }
13217    }
13218
13219    unsafe impl
13220        fidl::encoding::Encode<
13221            ScreenshotTakeFileRequest,
13222            fidl::encoding::DefaultFuchsiaResourceDialect,
13223        > for &mut ScreenshotTakeFileRequest
13224    {
13225        unsafe fn encode(
13226            self,
13227            encoder: &mut fidl::encoding::Encoder<
13228                '_,
13229                fidl::encoding::DefaultFuchsiaResourceDialect,
13230            >,
13231            offset: usize,
13232            mut depth: fidl::encoding::Depth,
13233        ) -> fidl::Result<()> {
13234            encoder.debug_check_bounds::<ScreenshotTakeFileRequest>(offset);
13235            // Vector header
13236            let max_ordinal: u64 = self.max_ordinal_present();
13237            encoder.write_num(max_ordinal, offset);
13238            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
13239            // Calling encoder.out_of_line_offset(0) is not allowed.
13240            if max_ordinal == 0 {
13241                return Ok(());
13242            }
13243            depth.increment()?;
13244            let envelope_size = 8;
13245            let bytes_len = max_ordinal as usize * envelope_size;
13246            #[allow(unused_variables)]
13247            let offset = encoder.out_of_line_offset(bytes_len);
13248            let mut _prev_end_offset: usize = 0;
13249            if 1 > max_ordinal {
13250                return Ok(());
13251            }
13252
13253            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
13254            // are envelope_size bytes.
13255            let cur_offset: usize = (1 - 1) * envelope_size;
13256
13257            // Zero reserved fields.
13258            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
13259
13260            // Safety:
13261            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
13262            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
13263            //   envelope_size bytes, there is always sufficient room.
13264            fidl::encoding::encode_in_envelope_optional::<
13265                ScreenshotFormat,
13266                fidl::encoding::DefaultFuchsiaResourceDialect,
13267            >(
13268                self.format
13269                    .as_ref()
13270                    .map(<ScreenshotFormat as fidl::encoding::ValueTypeMarker>::borrow),
13271                encoder,
13272                offset + cur_offset,
13273                depth,
13274            )?;
13275
13276            _prev_end_offset = cur_offset + envelope_size;
13277
13278            Ok(())
13279        }
13280    }
13281
13282    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
13283        for ScreenshotTakeFileRequest
13284    {
13285        #[inline(always)]
13286        fn new_empty() -> Self {
13287            Self::default()
13288        }
13289
13290        unsafe fn decode(
13291            &mut self,
13292            decoder: &mut fidl::encoding::Decoder<
13293                '_,
13294                fidl::encoding::DefaultFuchsiaResourceDialect,
13295            >,
13296            offset: usize,
13297            mut depth: fidl::encoding::Depth,
13298        ) -> fidl::Result<()> {
13299            decoder.debug_check_bounds::<Self>(offset);
13300            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
13301                None => return Err(fidl::Error::NotNullable),
13302                Some(len) => len,
13303            };
13304            // Calling decoder.out_of_line_offset(0) is not allowed.
13305            if len == 0 {
13306                return Ok(());
13307            };
13308            depth.increment()?;
13309            let envelope_size = 8;
13310            let bytes_len = len * envelope_size;
13311            let offset = decoder.out_of_line_offset(bytes_len)?;
13312            // Decode the envelope for each type.
13313            let mut _next_ordinal_to_read = 0;
13314            let mut next_offset = offset;
13315            let end_offset = offset + bytes_len;
13316            _next_ordinal_to_read += 1;
13317            if next_offset >= end_offset {
13318                return Ok(());
13319            }
13320
13321            // Decode unknown envelopes for gaps in ordinals.
13322            while _next_ordinal_to_read < 1 {
13323                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13324                _next_ordinal_to_read += 1;
13325                next_offset += envelope_size;
13326            }
13327
13328            let next_out_of_line = decoder.next_out_of_line();
13329            let handles_before = decoder.remaining_handles();
13330            if let Some((inlined, num_bytes, num_handles)) =
13331                fidl::encoding::decode_envelope_header(decoder, next_offset)?
13332            {
13333                let member_inline_size =
13334                    <ScreenshotFormat as fidl::encoding::TypeMarker>::inline_size(decoder.context);
13335                if inlined != (member_inline_size <= 4) {
13336                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
13337                }
13338                let inner_offset;
13339                let mut inner_depth = depth.clone();
13340                if inlined {
13341                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
13342                    inner_offset = next_offset;
13343                } else {
13344                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
13345                    inner_depth.increment()?;
13346                }
13347                let val_ref = self.format.get_or_insert_with(|| {
13348                    fidl::new_empty!(
13349                        ScreenshotFormat,
13350                        fidl::encoding::DefaultFuchsiaResourceDialect
13351                    )
13352                });
13353                fidl::decode!(
13354                    ScreenshotFormat,
13355                    fidl::encoding::DefaultFuchsiaResourceDialect,
13356                    val_ref,
13357                    decoder,
13358                    inner_offset,
13359                    inner_depth
13360                )?;
13361                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
13362                {
13363                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
13364                }
13365                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
13366                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
13367                }
13368            }
13369
13370            next_offset += envelope_size;
13371
13372            // Decode the remaining unknown envelopes.
13373            while next_offset < end_offset {
13374                _next_ordinal_to_read += 1;
13375                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13376                next_offset += envelope_size;
13377            }
13378
13379            Ok(())
13380        }
13381    }
13382
13383    impl ScreenshotTakeFileResponse {
13384        #[inline(always)]
13385        fn max_ordinal_present(&self) -> u64 {
13386            if let Some(_) = self.size {
13387                return 2;
13388            }
13389            if let Some(_) = self.file {
13390                return 1;
13391            }
13392            0
13393        }
13394    }
13395
13396    impl fidl::encoding::ResourceTypeMarker for ScreenshotTakeFileResponse {
13397        type Borrowed<'a> = &'a mut Self;
13398        fn take_or_borrow<'a>(
13399            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
13400        ) -> Self::Borrowed<'a> {
13401            value
13402        }
13403    }
13404
13405    unsafe impl fidl::encoding::TypeMarker for ScreenshotTakeFileResponse {
13406        type Owned = Self;
13407
13408        #[inline(always)]
13409        fn inline_align(_context: fidl::encoding::Context) -> usize {
13410            8
13411        }
13412
13413        #[inline(always)]
13414        fn inline_size(_context: fidl::encoding::Context) -> usize {
13415            16
13416        }
13417    }
13418
13419    unsafe impl
13420        fidl::encoding::Encode<
13421            ScreenshotTakeFileResponse,
13422            fidl::encoding::DefaultFuchsiaResourceDialect,
13423        > for &mut ScreenshotTakeFileResponse
13424    {
13425        unsafe fn encode(
13426            self,
13427            encoder: &mut fidl::encoding::Encoder<
13428                '_,
13429                fidl::encoding::DefaultFuchsiaResourceDialect,
13430            >,
13431            offset: usize,
13432            mut depth: fidl::encoding::Depth,
13433        ) -> fidl::Result<()> {
13434            encoder.debug_check_bounds::<ScreenshotTakeFileResponse>(offset);
13435            // Vector header
13436            let max_ordinal: u64 = self.max_ordinal_present();
13437            encoder.write_num(max_ordinal, offset);
13438            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
13439            // Calling encoder.out_of_line_offset(0) is not allowed.
13440            if max_ordinal == 0 {
13441                return Ok(());
13442            }
13443            depth.increment()?;
13444            let envelope_size = 8;
13445            let bytes_len = max_ordinal as usize * envelope_size;
13446            #[allow(unused_variables)]
13447            let offset = encoder.out_of_line_offset(bytes_len);
13448            let mut _prev_end_offset: usize = 0;
13449            if 1 > max_ordinal {
13450                return Ok(());
13451            }
13452
13453            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
13454            // are envelope_size bytes.
13455            let cur_offset: usize = (1 - 1) * envelope_size;
13456
13457            // Zero reserved fields.
13458            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
13459
13460            // Safety:
13461            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
13462            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
13463            //   envelope_size bytes, there is always sufficient room.
13464            fidl::encoding::encode_in_envelope_optional::<
13465                fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>>,
13466                fidl::encoding::DefaultFuchsiaResourceDialect,
13467            >(
13468                self.file.as_mut().map(
13469                    <fidl::encoding::Endpoint<
13470                        fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
13471                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
13472                ),
13473                encoder,
13474                offset + cur_offset,
13475                depth,
13476            )?;
13477
13478            _prev_end_offset = cur_offset + envelope_size;
13479            if 2 > max_ordinal {
13480                return Ok(());
13481            }
13482
13483            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
13484            // are envelope_size bytes.
13485            let cur_offset: usize = (2 - 1) * envelope_size;
13486
13487            // Zero reserved fields.
13488            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
13489
13490            // Safety:
13491            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
13492            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
13493            //   envelope_size bytes, there is always sufficient room.
13494            fidl::encoding::encode_in_envelope_optional::<
13495                fidl_fuchsia_math::SizeU,
13496                fidl::encoding::DefaultFuchsiaResourceDialect,
13497            >(
13498                self.size
13499                    .as_ref()
13500                    .map(<fidl_fuchsia_math::SizeU as fidl::encoding::ValueTypeMarker>::borrow),
13501                encoder,
13502                offset + cur_offset,
13503                depth,
13504            )?;
13505
13506            _prev_end_offset = cur_offset + envelope_size;
13507
13508            Ok(())
13509        }
13510    }
13511
13512    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
13513        for ScreenshotTakeFileResponse
13514    {
13515        #[inline(always)]
13516        fn new_empty() -> Self {
13517            Self::default()
13518        }
13519
13520        unsafe fn decode(
13521            &mut self,
13522            decoder: &mut fidl::encoding::Decoder<
13523                '_,
13524                fidl::encoding::DefaultFuchsiaResourceDialect,
13525            >,
13526            offset: usize,
13527            mut depth: fidl::encoding::Depth,
13528        ) -> fidl::Result<()> {
13529            decoder.debug_check_bounds::<Self>(offset);
13530            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
13531                None => return Err(fidl::Error::NotNullable),
13532                Some(len) => len,
13533            };
13534            // Calling decoder.out_of_line_offset(0) is not allowed.
13535            if len == 0 {
13536                return Ok(());
13537            };
13538            depth.increment()?;
13539            let envelope_size = 8;
13540            let bytes_len = len * envelope_size;
13541            let offset = decoder.out_of_line_offset(bytes_len)?;
13542            // Decode the envelope for each type.
13543            let mut _next_ordinal_to_read = 0;
13544            let mut next_offset = offset;
13545            let end_offset = offset + bytes_len;
13546            _next_ordinal_to_read += 1;
13547            if next_offset >= end_offset {
13548                return Ok(());
13549            }
13550
13551            // Decode unknown envelopes for gaps in ordinals.
13552            while _next_ordinal_to_read < 1 {
13553                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13554                _next_ordinal_to_read += 1;
13555                next_offset += envelope_size;
13556            }
13557
13558            let next_out_of_line = decoder.next_out_of_line();
13559            let handles_before = decoder.remaining_handles();
13560            if let Some((inlined, num_bytes, num_handles)) =
13561                fidl::encoding::decode_envelope_header(decoder, next_offset)?
13562            {
13563                let member_inline_size = <fidl::encoding::Endpoint<
13564                    fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
13565                > as fidl::encoding::TypeMarker>::inline_size(
13566                    decoder.context
13567                );
13568                if inlined != (member_inline_size <= 4) {
13569                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
13570                }
13571                let inner_offset;
13572                let mut inner_depth = depth.clone();
13573                if inlined {
13574                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
13575                    inner_offset = next_offset;
13576                } else {
13577                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
13578                    inner_depth.increment()?;
13579                }
13580                let val_ref = self.file.get_or_insert_with(|| {
13581                    fidl::new_empty!(
13582                        fidl::encoding::Endpoint<
13583                            fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
13584                        >,
13585                        fidl::encoding::DefaultFuchsiaResourceDialect
13586                    )
13587                });
13588                fidl::decode!(
13589                    fidl::encoding::Endpoint<
13590                        fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
13591                    >,
13592                    fidl::encoding::DefaultFuchsiaResourceDialect,
13593                    val_ref,
13594                    decoder,
13595                    inner_offset,
13596                    inner_depth
13597                )?;
13598                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
13599                {
13600                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
13601                }
13602                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
13603                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
13604                }
13605            }
13606
13607            next_offset += envelope_size;
13608            _next_ordinal_to_read += 1;
13609            if next_offset >= end_offset {
13610                return Ok(());
13611            }
13612
13613            // Decode unknown envelopes for gaps in ordinals.
13614            while _next_ordinal_to_read < 2 {
13615                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13616                _next_ordinal_to_read += 1;
13617                next_offset += envelope_size;
13618            }
13619
13620            let next_out_of_line = decoder.next_out_of_line();
13621            let handles_before = decoder.remaining_handles();
13622            if let Some((inlined, num_bytes, num_handles)) =
13623                fidl::encoding::decode_envelope_header(decoder, next_offset)?
13624            {
13625                let member_inline_size =
13626                    <fidl_fuchsia_math::SizeU as fidl::encoding::TypeMarker>::inline_size(
13627                        decoder.context,
13628                    );
13629                if inlined != (member_inline_size <= 4) {
13630                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
13631                }
13632                let inner_offset;
13633                let mut inner_depth = depth.clone();
13634                if inlined {
13635                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
13636                    inner_offset = next_offset;
13637                } else {
13638                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
13639                    inner_depth.increment()?;
13640                }
13641                let val_ref = self.size.get_or_insert_with(|| {
13642                    fidl::new_empty!(
13643                        fidl_fuchsia_math::SizeU,
13644                        fidl::encoding::DefaultFuchsiaResourceDialect
13645                    )
13646                });
13647                fidl::decode!(
13648                    fidl_fuchsia_math::SizeU,
13649                    fidl::encoding::DefaultFuchsiaResourceDialect,
13650                    val_ref,
13651                    decoder,
13652                    inner_offset,
13653                    inner_depth
13654                )?;
13655                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
13656                {
13657                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
13658                }
13659                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
13660                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
13661                }
13662            }
13663
13664            next_offset += envelope_size;
13665
13666            // Decode the remaining unknown envelopes.
13667            while next_offset < end_offset {
13668                _next_ordinal_to_read += 1;
13669                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13670                next_offset += envelope_size;
13671            }
13672
13673            Ok(())
13674        }
13675    }
13676
13677    impl ScreenshotTakeRequest {
13678        #[inline(always)]
13679        fn max_ordinal_present(&self) -> u64 {
13680            if let Some(_) = self.format {
13681                return 1;
13682            }
13683            0
13684        }
13685    }
13686
13687    impl fidl::encoding::ResourceTypeMarker for ScreenshotTakeRequest {
13688        type Borrowed<'a> = &'a mut Self;
13689        fn take_or_borrow<'a>(
13690            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
13691        ) -> Self::Borrowed<'a> {
13692            value
13693        }
13694    }
13695
13696    unsafe impl fidl::encoding::TypeMarker for ScreenshotTakeRequest {
13697        type Owned = Self;
13698
13699        #[inline(always)]
13700        fn inline_align(_context: fidl::encoding::Context) -> usize {
13701            8
13702        }
13703
13704        #[inline(always)]
13705        fn inline_size(_context: fidl::encoding::Context) -> usize {
13706            16
13707        }
13708    }
13709
13710    unsafe impl
13711        fidl::encoding::Encode<ScreenshotTakeRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
13712        for &mut ScreenshotTakeRequest
13713    {
13714        unsafe fn encode(
13715            self,
13716            encoder: &mut fidl::encoding::Encoder<
13717                '_,
13718                fidl::encoding::DefaultFuchsiaResourceDialect,
13719            >,
13720            offset: usize,
13721            mut depth: fidl::encoding::Depth,
13722        ) -> fidl::Result<()> {
13723            encoder.debug_check_bounds::<ScreenshotTakeRequest>(offset);
13724            // Vector header
13725            let max_ordinal: u64 = self.max_ordinal_present();
13726            encoder.write_num(max_ordinal, offset);
13727            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
13728            // Calling encoder.out_of_line_offset(0) is not allowed.
13729            if max_ordinal == 0 {
13730                return Ok(());
13731            }
13732            depth.increment()?;
13733            let envelope_size = 8;
13734            let bytes_len = max_ordinal as usize * envelope_size;
13735            #[allow(unused_variables)]
13736            let offset = encoder.out_of_line_offset(bytes_len);
13737            let mut _prev_end_offset: usize = 0;
13738            if 1 > max_ordinal {
13739                return Ok(());
13740            }
13741
13742            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
13743            // are envelope_size bytes.
13744            let cur_offset: usize = (1 - 1) * envelope_size;
13745
13746            // Zero reserved fields.
13747            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
13748
13749            // Safety:
13750            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
13751            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
13752            //   envelope_size bytes, there is always sufficient room.
13753            fidl::encoding::encode_in_envelope_optional::<
13754                ScreenshotFormat,
13755                fidl::encoding::DefaultFuchsiaResourceDialect,
13756            >(
13757                self.format
13758                    .as_ref()
13759                    .map(<ScreenshotFormat as fidl::encoding::ValueTypeMarker>::borrow),
13760                encoder,
13761                offset + cur_offset,
13762                depth,
13763            )?;
13764
13765            _prev_end_offset = cur_offset + envelope_size;
13766
13767            Ok(())
13768        }
13769    }
13770
13771    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
13772        for ScreenshotTakeRequest
13773    {
13774        #[inline(always)]
13775        fn new_empty() -> Self {
13776            Self::default()
13777        }
13778
13779        unsafe fn decode(
13780            &mut self,
13781            decoder: &mut fidl::encoding::Decoder<
13782                '_,
13783                fidl::encoding::DefaultFuchsiaResourceDialect,
13784            >,
13785            offset: usize,
13786            mut depth: fidl::encoding::Depth,
13787        ) -> fidl::Result<()> {
13788            decoder.debug_check_bounds::<Self>(offset);
13789            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
13790                None => return Err(fidl::Error::NotNullable),
13791                Some(len) => len,
13792            };
13793            // Calling decoder.out_of_line_offset(0) is not allowed.
13794            if len == 0 {
13795                return Ok(());
13796            };
13797            depth.increment()?;
13798            let envelope_size = 8;
13799            let bytes_len = len * envelope_size;
13800            let offset = decoder.out_of_line_offset(bytes_len)?;
13801            // Decode the envelope for each type.
13802            let mut _next_ordinal_to_read = 0;
13803            let mut next_offset = offset;
13804            let end_offset = offset + bytes_len;
13805            _next_ordinal_to_read += 1;
13806            if next_offset >= end_offset {
13807                return Ok(());
13808            }
13809
13810            // Decode unknown envelopes for gaps in ordinals.
13811            while _next_ordinal_to_read < 1 {
13812                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13813                _next_ordinal_to_read += 1;
13814                next_offset += envelope_size;
13815            }
13816
13817            let next_out_of_line = decoder.next_out_of_line();
13818            let handles_before = decoder.remaining_handles();
13819            if let Some((inlined, num_bytes, num_handles)) =
13820                fidl::encoding::decode_envelope_header(decoder, next_offset)?
13821            {
13822                let member_inline_size =
13823                    <ScreenshotFormat as fidl::encoding::TypeMarker>::inline_size(decoder.context);
13824                if inlined != (member_inline_size <= 4) {
13825                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
13826                }
13827                let inner_offset;
13828                let mut inner_depth = depth.clone();
13829                if inlined {
13830                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
13831                    inner_offset = next_offset;
13832                } else {
13833                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
13834                    inner_depth.increment()?;
13835                }
13836                let val_ref = self.format.get_or_insert_with(|| {
13837                    fidl::new_empty!(
13838                        ScreenshotFormat,
13839                        fidl::encoding::DefaultFuchsiaResourceDialect
13840                    )
13841                });
13842                fidl::decode!(
13843                    ScreenshotFormat,
13844                    fidl::encoding::DefaultFuchsiaResourceDialect,
13845                    val_ref,
13846                    decoder,
13847                    inner_offset,
13848                    inner_depth
13849                )?;
13850                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
13851                {
13852                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
13853                }
13854                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
13855                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
13856                }
13857            }
13858
13859            next_offset += envelope_size;
13860
13861            // Decode the remaining unknown envelopes.
13862            while next_offset < end_offset {
13863                _next_ordinal_to_read += 1;
13864                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13865                next_offset += envelope_size;
13866            }
13867
13868            Ok(())
13869        }
13870    }
13871
13872    impl ScreenshotTakeResponse {
13873        #[inline(always)]
13874        fn max_ordinal_present(&self) -> u64 {
13875            if let Some(_) = self.size {
13876                return 2;
13877            }
13878            if let Some(_) = self.vmo {
13879                return 1;
13880            }
13881            0
13882        }
13883    }
13884
13885    impl fidl::encoding::ResourceTypeMarker for ScreenshotTakeResponse {
13886        type Borrowed<'a> = &'a mut Self;
13887        fn take_or_borrow<'a>(
13888            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
13889        ) -> Self::Borrowed<'a> {
13890            value
13891        }
13892    }
13893
13894    unsafe impl fidl::encoding::TypeMarker for ScreenshotTakeResponse {
13895        type Owned = Self;
13896
13897        #[inline(always)]
13898        fn inline_align(_context: fidl::encoding::Context) -> usize {
13899            8
13900        }
13901
13902        #[inline(always)]
13903        fn inline_size(_context: fidl::encoding::Context) -> usize {
13904            16
13905        }
13906    }
13907
13908    unsafe impl
13909        fidl::encoding::Encode<
13910            ScreenshotTakeResponse,
13911            fidl::encoding::DefaultFuchsiaResourceDialect,
13912        > for &mut ScreenshotTakeResponse
13913    {
13914        unsafe fn encode(
13915            self,
13916            encoder: &mut fidl::encoding::Encoder<
13917                '_,
13918                fidl::encoding::DefaultFuchsiaResourceDialect,
13919            >,
13920            offset: usize,
13921            mut depth: fidl::encoding::Depth,
13922        ) -> fidl::Result<()> {
13923            encoder.debug_check_bounds::<ScreenshotTakeResponse>(offset);
13924            // Vector header
13925            let max_ordinal: u64 = self.max_ordinal_present();
13926            encoder.write_num(max_ordinal, offset);
13927            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
13928            // Calling encoder.out_of_line_offset(0) is not allowed.
13929            if max_ordinal == 0 {
13930                return Ok(());
13931            }
13932            depth.increment()?;
13933            let envelope_size = 8;
13934            let bytes_len = max_ordinal as usize * envelope_size;
13935            #[allow(unused_variables)]
13936            let offset = encoder.out_of_line_offset(bytes_len);
13937            let mut _prev_end_offset: usize = 0;
13938            if 1 > max_ordinal {
13939                return Ok(());
13940            }
13941
13942            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
13943            // are envelope_size bytes.
13944            let cur_offset: usize = (1 - 1) * envelope_size;
13945
13946            // Zero reserved fields.
13947            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
13948
13949            // Safety:
13950            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
13951            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
13952            //   envelope_size bytes, there is always sufficient room.
13953            fidl::encoding::encode_in_envelope_optional::<
13954                fidl::encoding::HandleType<
13955                    fidl::Vmo,
13956                    { fidl::ObjectType::VMO.into_raw() },
13957                    2147483648,
13958                >,
13959                fidl::encoding::DefaultFuchsiaResourceDialect,
13960            >(
13961                self.vmo.as_mut().map(
13962                    <fidl::encoding::HandleType<
13963                        fidl::Vmo,
13964                        { fidl::ObjectType::VMO.into_raw() },
13965                        2147483648,
13966                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
13967                ),
13968                encoder,
13969                offset + cur_offset,
13970                depth,
13971            )?;
13972
13973            _prev_end_offset = cur_offset + envelope_size;
13974            if 2 > max_ordinal {
13975                return Ok(());
13976            }
13977
13978            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
13979            // are envelope_size bytes.
13980            let cur_offset: usize = (2 - 1) * envelope_size;
13981
13982            // Zero reserved fields.
13983            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
13984
13985            // Safety:
13986            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
13987            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
13988            //   envelope_size bytes, there is always sufficient room.
13989            fidl::encoding::encode_in_envelope_optional::<
13990                fidl_fuchsia_math::SizeU,
13991                fidl::encoding::DefaultFuchsiaResourceDialect,
13992            >(
13993                self.size
13994                    .as_ref()
13995                    .map(<fidl_fuchsia_math::SizeU as fidl::encoding::ValueTypeMarker>::borrow),
13996                encoder,
13997                offset + cur_offset,
13998                depth,
13999            )?;
14000
14001            _prev_end_offset = cur_offset + envelope_size;
14002
14003            Ok(())
14004        }
14005    }
14006
14007    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
14008        for ScreenshotTakeResponse
14009    {
14010        #[inline(always)]
14011        fn new_empty() -> Self {
14012            Self::default()
14013        }
14014
14015        unsafe fn decode(
14016            &mut self,
14017            decoder: &mut fidl::encoding::Decoder<
14018                '_,
14019                fidl::encoding::DefaultFuchsiaResourceDialect,
14020            >,
14021            offset: usize,
14022            mut depth: fidl::encoding::Depth,
14023        ) -> fidl::Result<()> {
14024            decoder.debug_check_bounds::<Self>(offset);
14025            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
14026                None => return Err(fidl::Error::NotNullable),
14027                Some(len) => len,
14028            };
14029            // Calling decoder.out_of_line_offset(0) is not allowed.
14030            if len == 0 {
14031                return Ok(());
14032            };
14033            depth.increment()?;
14034            let envelope_size = 8;
14035            let bytes_len = len * envelope_size;
14036            let offset = decoder.out_of_line_offset(bytes_len)?;
14037            // Decode the envelope for each type.
14038            let mut _next_ordinal_to_read = 0;
14039            let mut next_offset = offset;
14040            let end_offset = offset + bytes_len;
14041            _next_ordinal_to_read += 1;
14042            if next_offset >= end_offset {
14043                return Ok(());
14044            }
14045
14046            // Decode unknown envelopes for gaps in ordinals.
14047            while _next_ordinal_to_read < 1 {
14048                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
14049                _next_ordinal_to_read += 1;
14050                next_offset += envelope_size;
14051            }
14052
14053            let next_out_of_line = decoder.next_out_of_line();
14054            let handles_before = decoder.remaining_handles();
14055            if let Some((inlined, num_bytes, num_handles)) =
14056                fidl::encoding::decode_envelope_header(decoder, next_offset)?
14057            {
14058                let member_inline_size = <fidl::encoding::HandleType<
14059                    fidl::Vmo,
14060                    { fidl::ObjectType::VMO.into_raw() },
14061                    2147483648,
14062                > as fidl::encoding::TypeMarker>::inline_size(
14063                    decoder.context
14064                );
14065                if inlined != (member_inline_size <= 4) {
14066                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
14067                }
14068                let inner_offset;
14069                let mut inner_depth = depth.clone();
14070                if inlined {
14071                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
14072                    inner_offset = next_offset;
14073                } else {
14074                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
14075                    inner_depth.increment()?;
14076                }
14077                let val_ref =
14078                self.vmo.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
14079                fidl::decode!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
14080                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
14081                {
14082                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
14083                }
14084                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
14085                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
14086                }
14087            }
14088
14089            next_offset += envelope_size;
14090            _next_ordinal_to_read += 1;
14091            if next_offset >= end_offset {
14092                return Ok(());
14093            }
14094
14095            // Decode unknown envelopes for gaps in ordinals.
14096            while _next_ordinal_to_read < 2 {
14097                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
14098                _next_ordinal_to_read += 1;
14099                next_offset += envelope_size;
14100            }
14101
14102            let next_out_of_line = decoder.next_out_of_line();
14103            let handles_before = decoder.remaining_handles();
14104            if let Some((inlined, num_bytes, num_handles)) =
14105                fidl::encoding::decode_envelope_header(decoder, next_offset)?
14106            {
14107                let member_inline_size =
14108                    <fidl_fuchsia_math::SizeU as fidl::encoding::TypeMarker>::inline_size(
14109                        decoder.context,
14110                    );
14111                if inlined != (member_inline_size <= 4) {
14112                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
14113                }
14114                let inner_offset;
14115                let mut inner_depth = depth.clone();
14116                if inlined {
14117                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
14118                    inner_offset = next_offset;
14119                } else {
14120                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
14121                    inner_depth.increment()?;
14122                }
14123                let val_ref = self.size.get_or_insert_with(|| {
14124                    fidl::new_empty!(
14125                        fidl_fuchsia_math::SizeU,
14126                        fidl::encoding::DefaultFuchsiaResourceDialect
14127                    )
14128                });
14129                fidl::decode!(
14130                    fidl_fuchsia_math::SizeU,
14131                    fidl::encoding::DefaultFuchsiaResourceDialect,
14132                    val_ref,
14133                    decoder,
14134                    inner_offset,
14135                    inner_depth
14136                )?;
14137                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
14138                {
14139                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
14140                }
14141                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
14142                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
14143                }
14144            }
14145
14146            next_offset += envelope_size;
14147
14148            // Decode the remaining unknown envelopes.
14149            while next_offset < end_offset {
14150                _next_ordinal_to_read += 1;
14151                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
14152                next_offset += envelope_size;
14153            }
14154
14155            Ok(())
14156        }
14157    }
14158
14159    impl TrustedFlatlandConfig {
14160        #[inline(always)]
14161        fn max_ordinal_present(&self) -> u64 {
14162            if let Some(_) = self.skips_on_frame_presented {
14163                return 4;
14164            }
14165            if let Some(_) = self.skips_present_credits {
14166                return 3;
14167            }
14168            if let Some(_) = self.pass_acquire_fences {
14169                return 2;
14170            }
14171            if let Some(_) = self.schedule_asap {
14172                return 1;
14173            }
14174            0
14175        }
14176    }
14177
14178    impl fidl::encoding::ResourceTypeMarker for TrustedFlatlandConfig {
14179        type Borrowed<'a> = &'a mut Self;
14180        fn take_or_borrow<'a>(
14181            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
14182        ) -> Self::Borrowed<'a> {
14183            value
14184        }
14185    }
14186
14187    unsafe impl fidl::encoding::TypeMarker for TrustedFlatlandConfig {
14188        type Owned = Self;
14189
14190        #[inline(always)]
14191        fn inline_align(_context: fidl::encoding::Context) -> usize {
14192            8
14193        }
14194
14195        #[inline(always)]
14196        fn inline_size(_context: fidl::encoding::Context) -> usize {
14197            16
14198        }
14199    }
14200
14201    unsafe impl
14202        fidl::encoding::Encode<TrustedFlatlandConfig, fidl::encoding::DefaultFuchsiaResourceDialect>
14203        for &mut TrustedFlatlandConfig
14204    {
14205        unsafe fn encode(
14206            self,
14207            encoder: &mut fidl::encoding::Encoder<
14208                '_,
14209                fidl::encoding::DefaultFuchsiaResourceDialect,
14210            >,
14211            offset: usize,
14212            mut depth: fidl::encoding::Depth,
14213        ) -> fidl::Result<()> {
14214            encoder.debug_check_bounds::<TrustedFlatlandConfig>(offset);
14215            // Vector header
14216            let max_ordinal: u64 = self.max_ordinal_present();
14217            encoder.write_num(max_ordinal, offset);
14218            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
14219            // Calling encoder.out_of_line_offset(0) is not allowed.
14220            if max_ordinal == 0 {
14221                return Ok(());
14222            }
14223            depth.increment()?;
14224            let envelope_size = 8;
14225            let bytes_len = max_ordinal as usize * envelope_size;
14226            #[allow(unused_variables)]
14227            let offset = encoder.out_of_line_offset(bytes_len);
14228            let mut _prev_end_offset: usize = 0;
14229            if 1 > max_ordinal {
14230                return Ok(());
14231            }
14232
14233            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
14234            // are envelope_size bytes.
14235            let cur_offset: usize = (1 - 1) * envelope_size;
14236
14237            // Zero reserved fields.
14238            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
14239
14240            // Safety:
14241            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
14242            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
14243            //   envelope_size bytes, there is always sufficient room.
14244            fidl::encoding::encode_in_envelope_optional::<
14245                bool,
14246                fidl::encoding::DefaultFuchsiaResourceDialect,
14247            >(
14248                self.schedule_asap.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
14249                encoder,
14250                offset + cur_offset,
14251                depth,
14252            )?;
14253
14254            _prev_end_offset = cur_offset + envelope_size;
14255            if 2 > max_ordinal {
14256                return Ok(());
14257            }
14258
14259            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
14260            // are envelope_size bytes.
14261            let cur_offset: usize = (2 - 1) * envelope_size;
14262
14263            // Zero reserved fields.
14264            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
14265
14266            // Safety:
14267            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
14268            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
14269            //   envelope_size bytes, there is always sufficient room.
14270            fidl::encoding::encode_in_envelope_optional::<
14271                bool,
14272                fidl::encoding::DefaultFuchsiaResourceDialect,
14273            >(
14274                self.pass_acquire_fences
14275                    .as_ref()
14276                    .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
14277                encoder,
14278                offset + cur_offset,
14279                depth,
14280            )?;
14281
14282            _prev_end_offset = cur_offset + envelope_size;
14283            if 3 > 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 = (3 - 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.skips_present_credits
14303                    .as_ref()
14304                    .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
14305                encoder,
14306                offset + cur_offset,
14307                depth,
14308            )?;
14309
14310            _prev_end_offset = cur_offset + envelope_size;
14311            if 4 > max_ordinal {
14312                return Ok(());
14313            }
14314
14315            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
14316            // are envelope_size bytes.
14317            let cur_offset: usize = (4 - 1) * envelope_size;
14318
14319            // Zero reserved fields.
14320            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
14321
14322            // Safety:
14323            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
14324            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
14325            //   envelope_size bytes, there is always sufficient room.
14326            fidl::encoding::encode_in_envelope_optional::<
14327                bool,
14328                fidl::encoding::DefaultFuchsiaResourceDialect,
14329            >(
14330                self.skips_on_frame_presented
14331                    .as_ref()
14332                    .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
14333                encoder,
14334                offset + cur_offset,
14335                depth,
14336            )?;
14337
14338            _prev_end_offset = cur_offset + envelope_size;
14339
14340            Ok(())
14341        }
14342    }
14343
14344    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
14345        for TrustedFlatlandConfig
14346    {
14347        #[inline(always)]
14348        fn new_empty() -> Self {
14349            Self::default()
14350        }
14351
14352        unsafe fn decode(
14353            &mut self,
14354            decoder: &mut fidl::encoding::Decoder<
14355                '_,
14356                fidl::encoding::DefaultFuchsiaResourceDialect,
14357            >,
14358            offset: usize,
14359            mut depth: fidl::encoding::Depth,
14360        ) -> fidl::Result<()> {
14361            decoder.debug_check_bounds::<Self>(offset);
14362            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
14363                None => return Err(fidl::Error::NotNullable),
14364                Some(len) => len,
14365            };
14366            // Calling decoder.out_of_line_offset(0) is not allowed.
14367            if len == 0 {
14368                return Ok(());
14369            };
14370            depth.increment()?;
14371            let envelope_size = 8;
14372            let bytes_len = len * envelope_size;
14373            let offset = decoder.out_of_line_offset(bytes_len)?;
14374            // Decode the envelope for each type.
14375            let mut _next_ordinal_to_read = 0;
14376            let mut next_offset = offset;
14377            let end_offset = offset + bytes_len;
14378            _next_ordinal_to_read += 1;
14379            if next_offset >= end_offset {
14380                return Ok(());
14381            }
14382
14383            // Decode unknown envelopes for gaps in ordinals.
14384            while _next_ordinal_to_read < 1 {
14385                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
14386                _next_ordinal_to_read += 1;
14387                next_offset += envelope_size;
14388            }
14389
14390            let next_out_of_line = decoder.next_out_of_line();
14391            let handles_before = decoder.remaining_handles();
14392            if let Some((inlined, num_bytes, num_handles)) =
14393                fidl::encoding::decode_envelope_header(decoder, next_offset)?
14394            {
14395                let member_inline_size =
14396                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
14397                if inlined != (member_inline_size <= 4) {
14398                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
14399                }
14400                let inner_offset;
14401                let mut inner_depth = depth.clone();
14402                if inlined {
14403                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
14404                    inner_offset = next_offset;
14405                } else {
14406                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
14407                    inner_depth.increment()?;
14408                }
14409                let val_ref = self.schedule_asap.get_or_insert_with(|| {
14410                    fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
14411                });
14412                fidl::decode!(
14413                    bool,
14414                    fidl::encoding::DefaultFuchsiaResourceDialect,
14415                    val_ref,
14416                    decoder,
14417                    inner_offset,
14418                    inner_depth
14419                )?;
14420                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
14421                {
14422                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
14423                }
14424                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
14425                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
14426                }
14427            }
14428
14429            next_offset += envelope_size;
14430            _next_ordinal_to_read += 1;
14431            if next_offset >= end_offset {
14432                return Ok(());
14433            }
14434
14435            // Decode unknown envelopes for gaps in ordinals.
14436            while _next_ordinal_to_read < 2 {
14437                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
14438                _next_ordinal_to_read += 1;
14439                next_offset += envelope_size;
14440            }
14441
14442            let next_out_of_line = decoder.next_out_of_line();
14443            let handles_before = decoder.remaining_handles();
14444            if let Some((inlined, num_bytes, num_handles)) =
14445                fidl::encoding::decode_envelope_header(decoder, next_offset)?
14446            {
14447                let member_inline_size =
14448                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
14449                if inlined != (member_inline_size <= 4) {
14450                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
14451                }
14452                let inner_offset;
14453                let mut inner_depth = depth.clone();
14454                if inlined {
14455                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
14456                    inner_offset = next_offset;
14457                } else {
14458                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
14459                    inner_depth.increment()?;
14460                }
14461                let val_ref = self.pass_acquire_fences.get_or_insert_with(|| {
14462                    fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
14463                });
14464                fidl::decode!(
14465                    bool,
14466                    fidl::encoding::DefaultFuchsiaResourceDialect,
14467                    val_ref,
14468                    decoder,
14469                    inner_offset,
14470                    inner_depth
14471                )?;
14472                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
14473                {
14474                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
14475                }
14476                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
14477                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
14478                }
14479            }
14480
14481            next_offset += envelope_size;
14482            _next_ordinal_to_read += 1;
14483            if next_offset >= end_offset {
14484                return Ok(());
14485            }
14486
14487            // Decode unknown envelopes for gaps in ordinals.
14488            while _next_ordinal_to_read < 3 {
14489                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
14490                _next_ordinal_to_read += 1;
14491                next_offset += envelope_size;
14492            }
14493
14494            let next_out_of_line = decoder.next_out_of_line();
14495            let handles_before = decoder.remaining_handles();
14496            if let Some((inlined, num_bytes, num_handles)) =
14497                fidl::encoding::decode_envelope_header(decoder, next_offset)?
14498            {
14499                let member_inline_size =
14500                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
14501                if inlined != (member_inline_size <= 4) {
14502                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
14503                }
14504                let inner_offset;
14505                let mut inner_depth = depth.clone();
14506                if inlined {
14507                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
14508                    inner_offset = next_offset;
14509                } else {
14510                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
14511                    inner_depth.increment()?;
14512                }
14513                let val_ref = self.skips_present_credits.get_or_insert_with(|| {
14514                    fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
14515                });
14516                fidl::decode!(
14517                    bool,
14518                    fidl::encoding::DefaultFuchsiaResourceDialect,
14519                    val_ref,
14520                    decoder,
14521                    inner_offset,
14522                    inner_depth
14523                )?;
14524                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
14525                {
14526                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
14527                }
14528                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
14529                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
14530                }
14531            }
14532
14533            next_offset += envelope_size;
14534            _next_ordinal_to_read += 1;
14535            if next_offset >= end_offset {
14536                return Ok(());
14537            }
14538
14539            // Decode unknown envelopes for gaps in ordinals.
14540            while _next_ordinal_to_read < 4 {
14541                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
14542                _next_ordinal_to_read += 1;
14543                next_offset += envelope_size;
14544            }
14545
14546            let next_out_of_line = decoder.next_out_of_line();
14547            let handles_before = decoder.remaining_handles();
14548            if let Some((inlined, num_bytes, num_handles)) =
14549                fidl::encoding::decode_envelope_header(decoder, next_offset)?
14550            {
14551                let member_inline_size =
14552                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
14553                if inlined != (member_inline_size <= 4) {
14554                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
14555                }
14556                let inner_offset;
14557                let mut inner_depth = depth.clone();
14558                if inlined {
14559                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
14560                    inner_offset = next_offset;
14561                } else {
14562                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
14563                    inner_depth.increment()?;
14564                }
14565                let val_ref = self.skips_on_frame_presented.get_or_insert_with(|| {
14566                    fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
14567                });
14568                fidl::decode!(
14569                    bool,
14570                    fidl::encoding::DefaultFuchsiaResourceDialect,
14571                    val_ref,
14572                    decoder,
14573                    inner_offset,
14574                    inner_depth
14575                )?;
14576                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
14577                {
14578                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
14579                }
14580                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
14581                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
14582                }
14583            }
14584
14585            next_offset += envelope_size;
14586
14587            // Decode the remaining unknown envelopes.
14588            while next_offset < end_offset {
14589                _next_ordinal_to_read += 1;
14590                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
14591                next_offset += envelope_size;
14592            }
14593
14594            Ok(())
14595        }
14596    }
14597
14598    impl ViewBoundProtocols {
14599        #[inline(always)]
14600        fn max_ordinal_present(&self) -> u64 {
14601            if let Some(_) = self.mouse_source {
14602                return 4;
14603            }
14604            if let Some(_) = self.touch_source {
14605                return 3;
14606            }
14607            if let Some(_) = self.view_focuser {
14608                return 2;
14609            }
14610            if let Some(_) = self.view_ref_focused {
14611                return 1;
14612            }
14613            0
14614        }
14615    }
14616
14617    impl fidl::encoding::ResourceTypeMarker for ViewBoundProtocols {
14618        type Borrowed<'a> = &'a mut Self;
14619        fn take_or_borrow<'a>(
14620            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
14621        ) -> Self::Borrowed<'a> {
14622            value
14623        }
14624    }
14625
14626    unsafe impl fidl::encoding::TypeMarker for ViewBoundProtocols {
14627        type Owned = Self;
14628
14629        #[inline(always)]
14630        fn inline_align(_context: fidl::encoding::Context) -> usize {
14631            8
14632        }
14633
14634        #[inline(always)]
14635        fn inline_size(_context: fidl::encoding::Context) -> usize {
14636            16
14637        }
14638    }
14639
14640    unsafe impl
14641        fidl::encoding::Encode<ViewBoundProtocols, fidl::encoding::DefaultFuchsiaResourceDialect>
14642        for &mut ViewBoundProtocols
14643    {
14644        unsafe fn encode(
14645            self,
14646            encoder: &mut fidl::encoding::Encoder<
14647                '_,
14648                fidl::encoding::DefaultFuchsiaResourceDialect,
14649            >,
14650            offset: usize,
14651            mut depth: fidl::encoding::Depth,
14652        ) -> fidl::Result<()> {
14653            encoder.debug_check_bounds::<ViewBoundProtocols>(offset);
14654            // Vector header
14655            let max_ordinal: u64 = self.max_ordinal_present();
14656            encoder.write_num(max_ordinal, offset);
14657            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
14658            // Calling encoder.out_of_line_offset(0) is not allowed.
14659            if max_ordinal == 0 {
14660                return Ok(());
14661            }
14662            depth.increment()?;
14663            let envelope_size = 8;
14664            let bytes_len = max_ordinal as usize * envelope_size;
14665            #[allow(unused_variables)]
14666            let offset = encoder.out_of_line_offset(bytes_len);
14667            let mut _prev_end_offset: usize = 0;
14668            if 1 > max_ordinal {
14669                return Ok(());
14670            }
14671
14672            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
14673            // are envelope_size bytes.
14674            let cur_offset: usize = (1 - 1) * envelope_size;
14675
14676            // Zero reserved fields.
14677            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
14678
14679            // Safety:
14680            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
14681            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
14682            //   envelope_size bytes, there is always sufficient room.
14683            fidl::encoding::encode_in_envelope_optional::<
14684                fidl::encoding::Endpoint<
14685                    fidl::endpoints::ServerEnd<fidl_fuchsia_ui_views::ViewRefFocusedMarker>,
14686                >,
14687                fidl::encoding::DefaultFuchsiaResourceDialect,
14688            >(
14689                self.view_ref_focused.as_mut().map(
14690                    <fidl::encoding::Endpoint<
14691                        fidl::endpoints::ServerEnd<fidl_fuchsia_ui_views::ViewRefFocusedMarker>,
14692                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
14693                ),
14694                encoder,
14695                offset + cur_offset,
14696                depth,
14697            )?;
14698
14699            _prev_end_offset = cur_offset + envelope_size;
14700            if 2 > max_ordinal {
14701                return Ok(());
14702            }
14703
14704            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
14705            // are envelope_size bytes.
14706            let cur_offset: usize = (2 - 1) * envelope_size;
14707
14708            // Zero reserved fields.
14709            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
14710
14711            // Safety:
14712            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
14713            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
14714            //   envelope_size bytes, there is always sufficient room.
14715            fidl::encoding::encode_in_envelope_optional::<
14716                fidl::encoding::Endpoint<
14717                    fidl::endpoints::ServerEnd<fidl_fuchsia_ui_views::FocuserMarker>,
14718                >,
14719                fidl::encoding::DefaultFuchsiaResourceDialect,
14720            >(
14721                self.view_focuser.as_mut().map(
14722                    <fidl::encoding::Endpoint<
14723                        fidl::endpoints::ServerEnd<fidl_fuchsia_ui_views::FocuserMarker>,
14724                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
14725                ),
14726                encoder,
14727                offset + cur_offset,
14728                depth,
14729            )?;
14730
14731            _prev_end_offset = cur_offset + envelope_size;
14732            if 3 > max_ordinal {
14733                return Ok(());
14734            }
14735
14736            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
14737            // are envelope_size bytes.
14738            let cur_offset: usize = (3 - 1) * envelope_size;
14739
14740            // Zero reserved fields.
14741            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
14742
14743            // Safety:
14744            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
14745            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
14746            //   envelope_size bytes, there is always sufficient room.
14747            fidl::encoding::encode_in_envelope_optional::<
14748                fidl::encoding::Endpoint<
14749                    fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::TouchSourceMarker>,
14750                >,
14751                fidl::encoding::DefaultFuchsiaResourceDialect,
14752            >(
14753                self.touch_source.as_mut().map(
14754                    <fidl::encoding::Endpoint<
14755                        fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::TouchSourceMarker>,
14756                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
14757                ),
14758                encoder,
14759                offset + cur_offset,
14760                depth,
14761            )?;
14762
14763            _prev_end_offset = cur_offset + envelope_size;
14764            if 4 > max_ordinal {
14765                return Ok(());
14766            }
14767
14768            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
14769            // are envelope_size bytes.
14770            let cur_offset: usize = (4 - 1) * envelope_size;
14771
14772            // Zero reserved fields.
14773            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
14774
14775            // Safety:
14776            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
14777            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
14778            //   envelope_size bytes, there is always sufficient room.
14779            fidl::encoding::encode_in_envelope_optional::<
14780                fidl::encoding::Endpoint<
14781                    fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::MouseSourceMarker>,
14782                >,
14783                fidl::encoding::DefaultFuchsiaResourceDialect,
14784            >(
14785                self.mouse_source.as_mut().map(
14786                    <fidl::encoding::Endpoint<
14787                        fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::MouseSourceMarker>,
14788                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
14789                ),
14790                encoder,
14791                offset + cur_offset,
14792                depth,
14793            )?;
14794
14795            _prev_end_offset = cur_offset + envelope_size;
14796
14797            Ok(())
14798        }
14799    }
14800
14801    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
14802        for ViewBoundProtocols
14803    {
14804        #[inline(always)]
14805        fn new_empty() -> Self {
14806            Self::default()
14807        }
14808
14809        unsafe fn decode(
14810            &mut self,
14811            decoder: &mut fidl::encoding::Decoder<
14812                '_,
14813                fidl::encoding::DefaultFuchsiaResourceDialect,
14814            >,
14815            offset: usize,
14816            mut depth: fidl::encoding::Depth,
14817        ) -> fidl::Result<()> {
14818            decoder.debug_check_bounds::<Self>(offset);
14819            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
14820                None => return Err(fidl::Error::NotNullable),
14821                Some(len) => len,
14822            };
14823            // Calling decoder.out_of_line_offset(0) is not allowed.
14824            if len == 0 {
14825                return Ok(());
14826            };
14827            depth.increment()?;
14828            let envelope_size = 8;
14829            let bytes_len = len * envelope_size;
14830            let offset = decoder.out_of_line_offset(bytes_len)?;
14831            // Decode the envelope for each type.
14832            let mut _next_ordinal_to_read = 0;
14833            let mut next_offset = offset;
14834            let end_offset = offset + bytes_len;
14835            _next_ordinal_to_read += 1;
14836            if next_offset >= end_offset {
14837                return Ok(());
14838            }
14839
14840            // Decode unknown envelopes for gaps in ordinals.
14841            while _next_ordinal_to_read < 1 {
14842                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
14843                _next_ordinal_to_read += 1;
14844                next_offset += envelope_size;
14845            }
14846
14847            let next_out_of_line = decoder.next_out_of_line();
14848            let handles_before = decoder.remaining_handles();
14849            if let Some((inlined, num_bytes, num_handles)) =
14850                fidl::encoding::decode_envelope_header(decoder, next_offset)?
14851            {
14852                let member_inline_size = <fidl::encoding::Endpoint<
14853                    fidl::endpoints::ServerEnd<fidl_fuchsia_ui_views::ViewRefFocusedMarker>,
14854                > as fidl::encoding::TypeMarker>::inline_size(
14855                    decoder.context
14856                );
14857                if inlined != (member_inline_size <= 4) {
14858                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
14859                }
14860                let inner_offset;
14861                let mut inner_depth = depth.clone();
14862                if inlined {
14863                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
14864                    inner_offset = next_offset;
14865                } else {
14866                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
14867                    inner_depth.increment()?;
14868                }
14869                let val_ref = self.view_ref_focused.get_or_insert_with(|| {
14870                    fidl::new_empty!(
14871                        fidl::encoding::Endpoint<
14872                            fidl::endpoints::ServerEnd<fidl_fuchsia_ui_views::ViewRefFocusedMarker>,
14873                        >,
14874                        fidl::encoding::DefaultFuchsiaResourceDialect
14875                    )
14876                });
14877                fidl::decode!(
14878                    fidl::encoding::Endpoint<
14879                        fidl::endpoints::ServerEnd<fidl_fuchsia_ui_views::ViewRefFocusedMarker>,
14880                    >,
14881                    fidl::encoding::DefaultFuchsiaResourceDialect,
14882                    val_ref,
14883                    decoder,
14884                    inner_offset,
14885                    inner_depth
14886                )?;
14887                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
14888                {
14889                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
14890                }
14891                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
14892                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
14893                }
14894            }
14895
14896            next_offset += envelope_size;
14897            _next_ordinal_to_read += 1;
14898            if next_offset >= end_offset {
14899                return Ok(());
14900            }
14901
14902            // Decode unknown envelopes for gaps in ordinals.
14903            while _next_ordinal_to_read < 2 {
14904                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
14905                _next_ordinal_to_read += 1;
14906                next_offset += envelope_size;
14907            }
14908
14909            let next_out_of_line = decoder.next_out_of_line();
14910            let handles_before = decoder.remaining_handles();
14911            if let Some((inlined, num_bytes, num_handles)) =
14912                fidl::encoding::decode_envelope_header(decoder, next_offset)?
14913            {
14914                let member_inline_size = <fidl::encoding::Endpoint<
14915                    fidl::endpoints::ServerEnd<fidl_fuchsia_ui_views::FocuserMarker>,
14916                > as fidl::encoding::TypeMarker>::inline_size(
14917                    decoder.context
14918                );
14919                if inlined != (member_inline_size <= 4) {
14920                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
14921                }
14922                let inner_offset;
14923                let mut inner_depth = depth.clone();
14924                if inlined {
14925                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
14926                    inner_offset = next_offset;
14927                } else {
14928                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
14929                    inner_depth.increment()?;
14930                }
14931                let val_ref = self.view_focuser.get_or_insert_with(|| {
14932                    fidl::new_empty!(
14933                        fidl::encoding::Endpoint<
14934                            fidl::endpoints::ServerEnd<fidl_fuchsia_ui_views::FocuserMarker>,
14935                        >,
14936                        fidl::encoding::DefaultFuchsiaResourceDialect
14937                    )
14938                });
14939                fidl::decode!(
14940                    fidl::encoding::Endpoint<
14941                        fidl::endpoints::ServerEnd<fidl_fuchsia_ui_views::FocuserMarker>,
14942                    >,
14943                    fidl::encoding::DefaultFuchsiaResourceDialect,
14944                    val_ref,
14945                    decoder,
14946                    inner_offset,
14947                    inner_depth
14948                )?;
14949                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
14950                {
14951                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
14952                }
14953                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
14954                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
14955                }
14956            }
14957
14958            next_offset += envelope_size;
14959            _next_ordinal_to_read += 1;
14960            if next_offset >= end_offset {
14961                return Ok(());
14962            }
14963
14964            // Decode unknown envelopes for gaps in ordinals.
14965            while _next_ordinal_to_read < 3 {
14966                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
14967                _next_ordinal_to_read += 1;
14968                next_offset += envelope_size;
14969            }
14970
14971            let next_out_of_line = decoder.next_out_of_line();
14972            let handles_before = decoder.remaining_handles();
14973            if let Some((inlined, num_bytes, num_handles)) =
14974                fidl::encoding::decode_envelope_header(decoder, next_offset)?
14975            {
14976                let member_inline_size = <fidl::encoding::Endpoint<
14977                    fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::TouchSourceMarker>,
14978                > as fidl::encoding::TypeMarker>::inline_size(
14979                    decoder.context
14980                );
14981                if inlined != (member_inline_size <= 4) {
14982                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
14983                }
14984                let inner_offset;
14985                let mut inner_depth = depth.clone();
14986                if inlined {
14987                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
14988                    inner_offset = next_offset;
14989                } else {
14990                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
14991                    inner_depth.increment()?;
14992                }
14993                let val_ref = self.touch_source.get_or_insert_with(|| {
14994                    fidl::new_empty!(
14995                        fidl::encoding::Endpoint<
14996                            fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::TouchSourceMarker>,
14997                        >,
14998                        fidl::encoding::DefaultFuchsiaResourceDialect
14999                    )
15000                });
15001                fidl::decode!(
15002                    fidl::encoding::Endpoint<
15003                        fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::TouchSourceMarker>,
15004                    >,
15005                    fidl::encoding::DefaultFuchsiaResourceDialect,
15006                    val_ref,
15007                    decoder,
15008                    inner_offset,
15009                    inner_depth
15010                )?;
15011                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
15012                {
15013                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
15014                }
15015                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
15016                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
15017                }
15018            }
15019
15020            next_offset += envelope_size;
15021            _next_ordinal_to_read += 1;
15022            if next_offset >= end_offset {
15023                return Ok(());
15024            }
15025
15026            // Decode unknown envelopes for gaps in ordinals.
15027            while _next_ordinal_to_read < 4 {
15028                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
15029                _next_ordinal_to_read += 1;
15030                next_offset += envelope_size;
15031            }
15032
15033            let next_out_of_line = decoder.next_out_of_line();
15034            let handles_before = decoder.remaining_handles();
15035            if let Some((inlined, num_bytes, num_handles)) =
15036                fidl::encoding::decode_envelope_header(decoder, next_offset)?
15037            {
15038                let member_inline_size = <fidl::encoding::Endpoint<
15039                    fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::MouseSourceMarker>,
15040                > as fidl::encoding::TypeMarker>::inline_size(
15041                    decoder.context
15042                );
15043                if inlined != (member_inline_size <= 4) {
15044                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
15045                }
15046                let inner_offset;
15047                let mut inner_depth = depth.clone();
15048                if inlined {
15049                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
15050                    inner_offset = next_offset;
15051                } else {
15052                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
15053                    inner_depth.increment()?;
15054                }
15055                let val_ref = self.mouse_source.get_or_insert_with(|| {
15056                    fidl::new_empty!(
15057                        fidl::encoding::Endpoint<
15058                            fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::MouseSourceMarker>,
15059                        >,
15060                        fidl::encoding::DefaultFuchsiaResourceDialect
15061                    )
15062                });
15063                fidl::decode!(
15064                    fidl::encoding::Endpoint<
15065                        fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::MouseSourceMarker>,
15066                    >,
15067                    fidl::encoding::DefaultFuchsiaResourceDialect,
15068                    val_ref,
15069                    decoder,
15070                    inner_offset,
15071                    inner_depth
15072                )?;
15073                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
15074                {
15075                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
15076                }
15077                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
15078                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
15079                }
15080            }
15081
15082            next_offset += envelope_size;
15083
15084            // Decode the remaining unknown envelopes.
15085            while next_offset < end_offset {
15086                _next_ordinal_to_read += 1;
15087                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
15088                next_offset += envelope_size;
15089            }
15090
15091            Ok(())
15092        }
15093    }
15094}