Skip to main content

fidl_fuchsia_ui_composition/
fidl_fuchsia_ui_composition.rs

1// WARNING: This file is machine generated by fidlgen.
2
3#![warn(clippy::all)]
4#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
5
6use bitflags::bitflags;
7use fidl::client::QueryResponseFut;
8use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
9use fidl::endpoints::{ControlHandle as _, Responder as _};
10pub use fidl_fuchsia_ui_composition__common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, PartialEq)]
15pub struct AllocatorRegisterBufferCollectionRequest {
16    pub args: RegisterBufferCollectionArgs,
17}
18
19impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
20    for AllocatorRegisterBufferCollectionRequest
21{
22}
23
24/// A typed wrapper for an eventpair, representing the registry endpoint of a buffer collection.
25#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
26pub struct BufferCollectionExportToken {
27    pub value: fidl::EventPair,
28}
29
30impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
31    for BufferCollectionExportToken
32{
33}
34
35/// A typed wrapper for an eventpair, representing the Image import endpoint of a buffer
36/// collection.
37#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
38pub struct BufferCollectionImportToken {
39    pub value: fidl::EventPair,
40}
41
42impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
43    for BufferCollectionImportToken
44{
45}
46
47#[derive(Debug, PartialEq)]
48pub struct ChildViewWatcherGetViewRefResponse {
49    pub view_ref: fidl_fuchsia_ui_views::ViewRef,
50}
51
52impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
53    for ChildViewWatcherGetViewRefResponse
54{
55}
56
57#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
58#[repr(C)]
59pub struct FlatlandCreateFilledRectRequest {
60    pub rect_id: ContentId,
61}
62
63impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
64    for FlatlandCreateFilledRectRequest
65{
66}
67
68#[derive(Debug, PartialEq)]
69pub struct FlatlandCreateImageRequest {
70    pub image_id: ContentId,
71    pub import_token: BufferCollectionImportToken,
72    pub vmo_index: u32,
73    pub properties: ImageProperties,
74}
75
76impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
77    for FlatlandCreateImageRequest
78{
79}
80
81#[derive(Debug, PartialEq)]
82pub struct FlatlandCreateView2Request {
83    /// A typed wrapper for a channel, representing the child endpoint of the connection
84    /// between two Flatland instances.
85    pub token: fidl_fuchsia_ui_views::ViewCreationToken,
86    /// The ViewRef to strongly associate with [`token`].
87    pub view_identity: fidl_fuchsia_ui_views::ViewIdentityOnCreation,
88    /// The protocol endpoints that are strongly bound to the ViewRef in [`view_identity`].
89    /// The protocols are bound when the view is created and installed in the view tree.
90    pub protocols: ViewBoundProtocols,
91    pub parent_viewport_watcher: fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>,
92}
93
94impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
95    for FlatlandCreateView2Request
96{
97}
98
99#[derive(Debug, PartialEq)]
100pub struct FlatlandCreateViewRequest {
101    pub token: fidl_fuchsia_ui_views::ViewCreationToken,
102    pub parent_viewport_watcher: fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>,
103}
104
105impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for FlatlandCreateViewRequest {}
106
107#[derive(Debug, PartialEq)]
108pub struct FlatlandCreateViewportRequest {
109    pub viewport_id: ContentId,
110    /// A typed wrapper for a channel, representing the parent endpoint of the connection
111    /// between two Flatland instances.
112    pub token: fidl_fuchsia_ui_views::ViewportCreationToken,
113    pub properties: ViewportProperties,
114    pub child_view_watcher: fidl::endpoints::ServerEnd<ChildViewWatcherMarker>,
115}
116
117impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
118    for FlatlandCreateViewportRequest
119{
120}
121
122#[derive(Debug, PartialEq)]
123pub struct FlatlandDisplaySetContentRequest {
124    pub token: fidl_fuchsia_ui_views::ViewportCreationToken,
125    pub child_view_watcher: fidl::endpoints::ServerEnd<ChildViewWatcherMarker>,
126}
127
128impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
129    for FlatlandDisplaySetContentRequest
130{
131}
132
133#[derive(Debug, PartialEq)]
134pub struct FlatlandPresentRequest {
135    pub args: PresentArgs,
136}
137
138impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for FlatlandPresentRequest {}
139
140#[derive(Debug, PartialEq)]
141pub struct FlatlandReleaseViewportResponse {
142    pub token: fidl_fuchsia_ui_views::ViewportCreationToken,
143}
144
145impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
146    for FlatlandReleaseViewportResponse
147{
148}
149
150#[derive(Debug, PartialEq)]
151pub struct FlatlandSetSolidFillRequest {
152    pub rect_id: ContentId,
153    pub color: ColorRgba,
154    pub size: fidl_fuchsia_math::SizeU,
155}
156
157impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
158    for FlatlandSetSolidFillRequest
159{
160}
161
162#[derive(Debug, PartialEq)]
163pub struct TrustedFlatlandFactoryCreateFlatlandRequest {
164    /// The server end of the `fuchsia.ui.composition.Flatland` protocol to be created.
165    pub server_end: fidl::endpoints::ServerEnd<FlatlandMarker>,
166    /// The configuration for the new Flatland instance. See `TrustedFlatlandConfig` for
167    /// details on available options.
168    pub config: TrustedFlatlandConfig,
169}
170
171impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
172    for TrustedFlatlandFactoryCreateFlatlandRequest
173{
174}
175
176/// Metadata about the frame rendered by [`GetNextFrame`].
177#[derive(Debug, Default, PartialEq)]
178pub struct FrameInfo {
179    /// The index of the VMO where the requested frame has been rendered. Required.
180    pub buffer_id: Option<u32>,
181    #[doc(hidden)]
182    pub __source_breaking: fidl::marker::SourceBreaking,
183}
184
185impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for FrameInfo {}
186
187/// The arguments passed into the [`GetNextFrame`] call. All fields are necessary.
188#[derive(Debug, Default, PartialEq)]
189pub struct GetNextFrameArgs {
190    /// The event that will signal when the requested frame has been rendered. Required.
191    pub event: Option<fidl::Event>,
192    #[doc(hidden)]
193    pub __source_breaking: fidl::marker::SourceBreaking,
194}
195
196impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for GetNextFrameArgs {}
197
198/// Arguments passed into [`Present`]. All arguments are optional, and if an
199/// argument is omitted Flatland will use a reasonable default, specified below.
200#[derive(Debug, Default, PartialEq)]
201pub struct PresentArgs {
202    /// `requested_presentation_time` specifies the time on or after which the client would like the
203    /// enqueued operations to take visible effect (light up pixels on the screen), expressed in
204    /// nanoseconds in the `CLOCK_MONOTONIC` timebase.
205    ///
206    /// The default `requested_presentation_time` is 0.
207    ///
208    /// Using a `requested_presentation_time` in the present or past (such as 0) schedules enqueued
209    /// operations to take visible effect as soon as possible, during the next frame to be prepared.
210    ///
211    /// Using a `requested_presentation_time` in the future schedules the enqueued operations to
212    /// take visible effect on or as closely as possible after the stated time, but no earlier.
213    ///
214    /// Each rendered frame has a target presentation time. This is when Flatland aims to have the
215    /// frame presented to the user. Before rendering a frame, Flatland applies all
216    /// enqueued operations associated with all squashable calls to [`Present`] whose
217    /// `requested_presentation_time` is on or before the frame's target presentation time.
218    pub requested_presentation_time: Option<i64>,
219    /// Flatland will wait until all of a Flatland instance's `acquire_fences` are ready before it
220    /// will execute the presented commands. Not signaling `acquire_fences` will block the current
221    /// [`Present`] as well as the following ones even if their `acquire_fences` are signaled.
222    ///
223    /// The default `acquire_fences` value is the empty vector.
224    pub acquire_fences: Option<Vec<fidl::Event>>,
225    /// Flatland will signal all `release_fences` when it is safe to reuse resources which no longer
226    /// appear in the local scene graph at the time of the current [`Present`].  At the latest, this
227    /// will happen when the local scene graph (checkpointed at this [`Present`]) has been
228    /// integrated into the global scene graph, and the global scene has been displayed on screen.
229    ///
230    /// (Under some circumstances, the fences may be signaled earlier, but clients do not need to
231    /// worry about this: the fences will only be signaled when it is safe to reuse the associated
232    /// resources).
233    ///
234    /// These fences are intended to manage the reuse of shared memory resources such as sysmem
235    /// buffers.  For example, it is undesirable for the client to render into an image which is
236    /// currently displayed on screen, because this may result in graphical artifacts such as
237    /// tearing.
238    ///
239    /// It is up to the client to maintain the mapping between each fence and the resources which
240    /// will become reusable when the fence is signaled.  A common strategy is to keep track of
241    /// resources which were used by the previous [`Present`] but are no longer used by the current
242    /// [`Present`].  For example, if an image is removed from the scene by the current [`Present`],
243    /// the client would insert a fence here.  When the fence is later signaled, the client knows
244    /// that it is safe to render into the image and insert it into the local scene graph in a
245    /// subsequent [`Present`].
246    ///
247    /// If an error occurs, Flatland may close the channel without signaling these fences.  Clients
248    /// may immediately release shared buffers, but they should not immediately modify such buffers,
249    /// because they may still be displayed on screen.  There is currently no good signal available
250    /// to the client about when it is safe to reuse shared buffers.
251    ///
252    /// The default `release_fences` value is the empty vector.
253    pub release_fences: Option<Vec<fidl::Event>>,
254    /// If `unsquashable` is true, then the update is guaranteed to be uniquely shown for at
255    /// least one vsync interval.
256    ///
257    /// If `unsquashable` is false, then the update can be combined with those that come after
258    /// it.
259    ///
260    /// If absent, `unsquashable` is false.
261    pub unsquashable: Option<bool>,
262    /// Flatland will signal all `present_fences` when the frame corresponding to this `Present`
263    /// is reported as displayed by the display hardware.  Additionally, each fence will have the
264    /// 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    #[doc(hidden)]
269    pub __source_breaking: fidl::marker::SourceBreaking,
270}
271
272impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for PresentArgs {}
273
274/// The table of arguments for [`RegisterBufferCollection`]. Note that some
275/// fields below are REQUIRED.
276#[derive(Debug, Default, PartialEq)]
277pub struct RegisterBufferCollectionArgs {
278    /// Clients can send [`export_token`] to register buffer collections with Allocator to be used
279    /// later in [`fuchsia.ui.composition/Flatland`] instances or other Scenic APIs, such as
280    /// Screenshot.
281    ///
282    /// For example, by passing a [`BufferCollectionImportToken`] containing the matching peer of
283    /// [`BufferCollectionExportToken`], they can create image resources via
284    /// [`fuchsia.ui.composition/Flatland.CreateImage`].
285    ///
286    /// Clients should wait for the response before using `import_token`.
287    ///
288    /// This field is REQUIRED.
289    pub export_token: Option<BufferCollectionExportToken>,
290    pub buffer_collection_token:
291        Option<fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem::BufferCollectionTokenMarker>>,
292    /// The client can register a buffer collection for various uses, each
293    /// coming with their own unique constraints.
294    ///
295    /// This field is OPTIONAL. If `usage` is omitted it will be treated as if
296    /// it has the DEFAULT option.
297    ///
298    /// # Deprecation
299    ///
300    /// This arg is deprecated at API version 9 with addition of |usages|.
301    ///
302    /// If both the `usages` and `usage` fields are set, `usages` takes precedence and `usage` is
303    /// ignored.
304    pub usage: Option<RegisterBufferCollectionUsage>,
305    /// The client can register a buffer collection for various uses and has the ability to
306    /// combine usages if multiple are needed.
307    ///
308    /// This field is OPTIONAL. If `usages` is omitted it will be treated as if
309    /// it has only the DEFAULT option.
310    pub usages: Option<RegisterBufferCollectionUsages>,
311    /// Flatland participates in the allocation of buffers by setting constraints on the
312    /// BufferCollection referenced by `buffer_collection_token`. It will not block on buffers
313    /// being allocated until the client creates content using the BufferCollection.
314    ///
315    /// The buffer collection registered with `export_token` is available and kept alive as long
316    /// as the client holds a valid [`BufferCollectionImportToken`]. They will be garbage collected
317    /// when all [`BufferCollectionImportToken`]s are closed and all the associated Image resources
318    /// are released.
319    ///
320    /// Exactly one of `buffer_collection_token2` / `buffer_collection_token` must be set.
321    pub buffer_collection_token2:
322        Option<fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem2::BufferCollectionTokenMarker>>,
323    #[doc(hidden)]
324    pub __source_breaking: fidl::marker::SourceBreaking,
325}
326
327impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
328    for RegisterBufferCollectionArgs
329{
330}
331
332/// The arguments passed into the [`Configure`] call. Note that not all fields are necessary.
333#[derive(Debug, Default, PartialEq)]
334pub struct ScreenCaptureConfig {
335    /// The import token referencing a BufferCollection registered with
336    /// Allocator. Required.
337    pub import_token: Option<BufferCollectionImportToken>,
338    /// The size of the image in pixels. Required.
339    pub size: Option<fidl_fuchsia_math::SizeU>,
340    /// The number of buffers in the BufferCollection. Required.
341    pub buffer_count: Option<u32>,
342    /// The rotation to be applied to the stream of images. Optional; if absent no rotation is
343    /// applied.
344    pub rotation: Option<Rotation>,
345    #[doc(hidden)]
346    pub __source_breaking: fidl::marker::SourceBreaking,
347}
348
349impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for ScreenCaptureConfig {}
350
351#[derive(Debug, Default, PartialEq)]
352pub struct ScreenshotTakeFileRequest {
353    /// Format of the requested screenshot.
354    pub format: Option<ScreenshotFormat>,
355    #[doc(hidden)]
356    pub __source_breaking: fidl::marker::SourceBreaking,
357}
358
359impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for ScreenshotTakeFileRequest {}
360
361#[derive(Debug, Default, PartialEq)]
362pub struct ScreenshotTakeFileResponse {
363    /// |fuchsia.io.File| channel used to read the generated screenshot file data.
364    /// The server side of the channel is stored on the device until ZX_CHANNEL_PEER_CLOSED
365    /// is detected.
366    ///
367    /// Basic usage: After the client recieves the client end of the file channel,
368    /// to avoid memory pile-ups, it should finish reading the data
369    /// before calling [`TakeFile`] again. When finished reading,
370    /// the client should call [`Close`] on the |fuchsia.io.File| channel, this will release
371    /// the memory allocated on the server side.
372    pub file: Option<fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>>,
373    /// Size of the screenshot in pixels.
374    pub size: Option<fidl_fuchsia_math::SizeU>,
375    #[doc(hidden)]
376    pub __source_breaking: fidl::marker::SourceBreaking,
377}
378
379impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
380    for ScreenshotTakeFileResponse
381{
382}
383
384#[derive(Debug, Default, PartialEq)]
385pub struct ScreenshotTakeRequest {
386    /// Format of the requested screenshot.
387    pub format: Option<ScreenshotFormat>,
388    #[doc(hidden)]
389    pub __source_breaking: fidl::marker::SourceBreaking,
390}
391
392impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for ScreenshotTakeRequest {}
393
394#[derive(Debug, Default, PartialEq)]
395pub struct ScreenshotTakeResponse {
396    /// CPU mappable read-only VMO that contains screenshot data. The server owns the VMO and
397    /// may reuse for the next [`Take`]. The VMO is guaranteed to be accessible after mapping.
398    /// In some allocations, VMO::read() might not be available, i.e. on emulator.
399    ///
400    /// Basic usage: After the client receives a VMO handle, to ensure data stability, it should
401    /// finish reading the VMO before calling [`Take`] again. When finished reading, the client
402    /// should drop the VMO handle.
403    ///
404    /// Advanced usage: To edit the data, or to persist it beyond the next [`Take`] call, the
405    /// client should copy the data to a private VMO.
406    pub vmo: Option<fidl::Vmo>,
407    /// Size of the screenshot in pixels.
408    pub size: Option<fidl_fuchsia_math::SizeU>,
409    #[doc(hidden)]
410    pub __source_breaking: fidl::marker::SourceBreaking,
411}
412
413impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for ScreenshotTakeResponse {}
414
415/// All arguments are optional; default values will be provided if they are absent.
416/// By default, the resulting Flatland will behave identically to connecting
417/// to the `fuchsia.ui.composition.Flatland` service instead of connecting via the factory.
418#[derive(Debug, Default, PartialEq)]
419pub struct TrustedFlatlandConfig {
420    /// If true and `requested_presentation_time` in [`fuchsia.ui.composition/Flatland.Present`] is
421    /// set to 0 or less than or equal to the nearest presentation time, a frame will be scheduled
422    /// to be presented as soon as all acquire fences are signaled, instead of waiting for other
423    /// clients to present within the same vsync. This allows the caller to decide when to wake up
424    /// for preparing a frame.
425    ///
426    /// If `requested_presentation_time` is set to a value greater than the nearest presentation
427    /// time, this flag will have no effect and the wakeup time decision will be made by the
428    /// scheduler.
429    ///
430    /// If absent, `schedule_asap` is false.
431    pub schedule_asap: Option<bool>,
432    /// If true, Scenic should pass acquire fences to the drivers for composition HW, instead of
433    /// waiting for them on CPU. This can improve performance by reducing CPU overhead.
434    ///
435    /// If absent, `pass_acquire_fences` is false.
436    pub pass_acquire_fences: Option<bool>,
437    /// If true, the client will not utilize Flatland's built in frame-scheduling mechanism and
438    /// will ignore present credits, instead relying on their own flow control system.
439    ///
440    /// If absent, `skips_present_credits` is false.
441    pub skips_present_credits: Option<bool>,
442    #[doc(hidden)]
443    pub __source_breaking: fidl::marker::SourceBreaking,
444}
445
446impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for TrustedFlatlandConfig {}
447
448/// The protocol endpoints bound to a Flatland ViewCreationToken. These protocols operate on the
449/// View that ViewCreationToken created in the Flatland session.
450#[derive(Debug, Default, PartialEq)]
451pub struct ViewBoundProtocols {
452    /// Learn when a View gains focus.
453    ///
454    /// Server-bound ViewRef. The [`view_ref_focused`] client does not specify the ViewRef
455    /// explicitly; instead, the server implementation uses the ViewRef used in View creation for
456    /// reporting focus movement on/off this View.
457    pub view_ref_focused:
458        Option<fidl::endpoints::ServerEnd<fidl_fuchsia_ui_views::ViewRefFocusedMarker>>,
459    /// Enable a View to request focus transfer to a child (target) View.
460    ///
461    /// Server-bound ViewRef. The [`view_focuser`] client does not specify the "requestor" ViewRef
462    /// explicitly, only the "target" ViewRef. Instead, the server implementation uses the ViewRef
463    /// used in View creation as the "requestor" ViewRef.
464    pub view_focuser: Option<fidl::endpoints::ServerEnd<fidl_fuchsia_ui_views::FocuserMarker>>,
465    /// Receive touch events that are associated with a View.
466    pub touch_source:
467        Option<fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::TouchSourceMarker>>,
468    /// Receive mouse events that are associated with a View.
469    pub mouse_source:
470        Option<fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::MouseSourceMarker>>,
471    #[doc(hidden)]
472    pub __source_breaking: fidl::marker::SourceBreaking,
473}
474
475impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for ViewBoundProtocols {}
476
477#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
478pub struct AllocatorMarker;
479
480impl fidl::endpoints::ProtocolMarker for AllocatorMarker {
481    type Proxy = AllocatorProxy;
482    type RequestStream = AllocatorRequestStream;
483    #[cfg(target_os = "fuchsia")]
484    type SynchronousProxy = AllocatorSynchronousProxy;
485
486    const DEBUG_NAME: &'static str = "fuchsia.ui.composition.Allocator";
487}
488impl fidl::endpoints::DiscoverableProtocolMarker for AllocatorMarker {}
489pub type AllocatorRegisterBufferCollectionResult = Result<(), RegisterBufferCollectionError>;
490
491pub trait AllocatorProxyInterface: Send + Sync {
492    type RegisterBufferCollectionResponseFut: std::future::Future<Output = Result<AllocatorRegisterBufferCollectionResult, fidl::Error>>
493        + Send;
494    fn r#register_buffer_collection(
495        &self,
496        args: RegisterBufferCollectionArgs,
497    ) -> Self::RegisterBufferCollectionResponseFut;
498}
499#[derive(Debug)]
500#[cfg(target_os = "fuchsia")]
501pub struct AllocatorSynchronousProxy {
502    client: fidl::client::sync::Client,
503}
504
505#[cfg(target_os = "fuchsia")]
506impl fidl::endpoints::SynchronousProxy for AllocatorSynchronousProxy {
507    type Proxy = AllocatorProxy;
508    type Protocol = AllocatorMarker;
509
510    fn from_channel(inner: fidl::Channel) -> Self {
511        Self::new(inner)
512    }
513
514    fn into_channel(self) -> fidl::Channel {
515        self.client.into_channel()
516    }
517
518    fn as_channel(&self) -> &fidl::Channel {
519        self.client.as_channel()
520    }
521}
522
523#[cfg(target_os = "fuchsia")]
524impl AllocatorSynchronousProxy {
525    pub fn new(channel: fidl::Channel) -> Self {
526        Self { client: fidl::client::sync::Client::new(channel) }
527    }
528
529    pub fn into_channel(self) -> fidl::Channel {
530        self.client.into_channel()
531    }
532
533    /// Waits until an event arrives and returns it. It is safe for other
534    /// threads to make concurrent requests while waiting for an event.
535    pub fn wait_for_event(
536        &self,
537        deadline: zx::MonotonicInstant,
538    ) -> Result<AllocatorEvent, fidl::Error> {
539        AllocatorEvent::decode(self.client.wait_for_event::<AllocatorMarker>(deadline)?)
540    }
541
542    /// A BufferCollection is a set of VMOs created by Sysmem and shared by a number of
543    /// participants, one of which is the Flatland Renderer. Some content, such as Images, use a
544    /// BufferCollection as their backing memory.
545    ///
546    /// See [`RegisterBufferCollectionArgs`] for information on each argument.
547    pub fn r#register_buffer_collection(
548        &self,
549        mut args: RegisterBufferCollectionArgs,
550        ___deadline: zx::MonotonicInstant,
551    ) -> Result<AllocatorRegisterBufferCollectionResult, fidl::Error> {
552        let _response = self
553            .client
554            .send_query::<AllocatorRegisterBufferCollectionRequest, fidl::encoding::ResultType<
555                fidl::encoding::EmptyStruct,
556                RegisterBufferCollectionError,
557            >, AllocatorMarker>(
558                (&mut args,),
559                0x494b7ea578d1061e,
560                fidl::encoding::DynamicFlags::empty(),
561                ___deadline,
562            )?;
563        Ok(_response.map(|x| x))
564    }
565}
566
567#[cfg(target_os = "fuchsia")]
568impl From<AllocatorSynchronousProxy> for zx::NullableHandle {
569    fn from(value: AllocatorSynchronousProxy) -> Self {
570        value.into_channel().into()
571    }
572}
573
574#[cfg(target_os = "fuchsia")]
575impl From<fidl::Channel> for AllocatorSynchronousProxy {
576    fn from(value: fidl::Channel) -> Self {
577        Self::new(value)
578    }
579}
580
581#[cfg(target_os = "fuchsia")]
582impl fidl::endpoints::FromClient for AllocatorSynchronousProxy {
583    type Protocol = AllocatorMarker;
584
585    fn from_client(value: fidl::endpoints::ClientEnd<AllocatorMarker>) -> Self {
586        Self::new(value.into_channel())
587    }
588}
589
590#[derive(Debug, Clone)]
591pub struct AllocatorProxy {
592    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
593}
594
595impl fidl::endpoints::Proxy for AllocatorProxy {
596    type Protocol = AllocatorMarker;
597
598    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
599        Self::new(inner)
600    }
601
602    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
603        self.client.into_channel().map_err(|client| Self { client })
604    }
605
606    fn as_channel(&self) -> &::fidl::AsyncChannel {
607        self.client.as_channel()
608    }
609}
610
611impl AllocatorProxy {
612    /// Create a new Proxy for fuchsia.ui.composition/Allocator.
613    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
614        let protocol_name = <AllocatorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
615        Self { client: fidl::client::Client::new(channel, protocol_name) }
616    }
617
618    /// Get a Stream of events from the remote end of the protocol.
619    ///
620    /// # Panics
621    ///
622    /// Panics if the event stream was already taken.
623    pub fn take_event_stream(&self) -> AllocatorEventStream {
624        AllocatorEventStream { event_receiver: self.client.take_event_receiver() }
625    }
626
627    /// A BufferCollection is a set of VMOs created by Sysmem and shared by a number of
628    /// participants, one of which is the Flatland Renderer. Some content, such as Images, use a
629    /// BufferCollection as their backing memory.
630    ///
631    /// See [`RegisterBufferCollectionArgs`] for information on each argument.
632    pub fn r#register_buffer_collection(
633        &self,
634        mut args: RegisterBufferCollectionArgs,
635    ) -> fidl::client::QueryResponseFut<
636        AllocatorRegisterBufferCollectionResult,
637        fidl::encoding::DefaultFuchsiaResourceDialect,
638    > {
639        AllocatorProxyInterface::r#register_buffer_collection(self, args)
640    }
641}
642
643impl AllocatorProxyInterface for AllocatorProxy {
644    type RegisterBufferCollectionResponseFut = fidl::client::QueryResponseFut<
645        AllocatorRegisterBufferCollectionResult,
646        fidl::encoding::DefaultFuchsiaResourceDialect,
647    >;
648    fn r#register_buffer_collection(
649        &self,
650        mut args: RegisterBufferCollectionArgs,
651    ) -> Self::RegisterBufferCollectionResponseFut {
652        fn _decode(
653            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
654        ) -> Result<AllocatorRegisterBufferCollectionResult, fidl::Error> {
655            let _response = fidl::client::decode_transaction_body::<
656                fidl::encoding::ResultType<
657                    fidl::encoding::EmptyStruct,
658                    RegisterBufferCollectionError,
659                >,
660                fidl::encoding::DefaultFuchsiaResourceDialect,
661                0x494b7ea578d1061e,
662            >(_buf?)?;
663            Ok(_response.map(|x| x))
664        }
665        self.client.send_query_and_decode::<
666            AllocatorRegisterBufferCollectionRequest,
667            AllocatorRegisterBufferCollectionResult,
668        >(
669            (&mut args,),
670            0x494b7ea578d1061e,
671            fidl::encoding::DynamicFlags::empty(),
672            _decode,
673        )
674    }
675}
676
677pub struct AllocatorEventStream {
678    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
679}
680
681impl std::marker::Unpin for AllocatorEventStream {}
682
683impl futures::stream::FusedStream for AllocatorEventStream {
684    fn is_terminated(&self) -> bool {
685        self.event_receiver.is_terminated()
686    }
687}
688
689impl futures::Stream for AllocatorEventStream {
690    type Item = Result<AllocatorEvent, fidl::Error>;
691
692    fn poll_next(
693        mut self: std::pin::Pin<&mut Self>,
694        cx: &mut std::task::Context<'_>,
695    ) -> std::task::Poll<Option<Self::Item>> {
696        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
697            &mut self.event_receiver,
698            cx
699        )?) {
700            Some(buf) => std::task::Poll::Ready(Some(AllocatorEvent::decode(buf))),
701            None => std::task::Poll::Ready(None),
702        }
703    }
704}
705
706#[derive(Debug)]
707pub enum AllocatorEvent {}
708
709impl AllocatorEvent {
710    /// Decodes a message buffer as a [`AllocatorEvent`].
711    fn decode(
712        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
713    ) -> Result<AllocatorEvent, fidl::Error> {
714        let (bytes, _handles) = buf.split_mut();
715        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
716        debug_assert_eq!(tx_header.tx_id, 0);
717        match tx_header.ordinal {
718            _ => Err(fidl::Error::UnknownOrdinal {
719                ordinal: tx_header.ordinal,
720                protocol_name: <AllocatorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
721            }),
722        }
723    }
724}
725
726/// A Stream of incoming requests for fuchsia.ui.composition/Allocator.
727pub struct AllocatorRequestStream {
728    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
729    is_terminated: bool,
730}
731
732impl std::marker::Unpin for AllocatorRequestStream {}
733
734impl futures::stream::FusedStream for AllocatorRequestStream {
735    fn is_terminated(&self) -> bool {
736        self.is_terminated
737    }
738}
739
740impl fidl::endpoints::RequestStream for AllocatorRequestStream {
741    type Protocol = AllocatorMarker;
742    type ControlHandle = AllocatorControlHandle;
743
744    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
745        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
746    }
747
748    fn control_handle(&self) -> Self::ControlHandle {
749        AllocatorControlHandle { inner: self.inner.clone() }
750    }
751
752    fn into_inner(
753        self,
754    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
755    {
756        (self.inner, self.is_terminated)
757    }
758
759    fn from_inner(
760        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
761        is_terminated: bool,
762    ) -> Self {
763        Self { inner, is_terminated }
764    }
765}
766
767impl futures::Stream for AllocatorRequestStream {
768    type Item = Result<AllocatorRequest, fidl::Error>;
769
770    fn poll_next(
771        mut self: std::pin::Pin<&mut Self>,
772        cx: &mut std::task::Context<'_>,
773    ) -> std::task::Poll<Option<Self::Item>> {
774        let this = &mut *self;
775        if this.inner.check_shutdown(cx) {
776            this.is_terminated = true;
777            return std::task::Poll::Ready(None);
778        }
779        if this.is_terminated {
780            panic!("polled AllocatorRequestStream after completion");
781        }
782        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
783            |bytes, handles| {
784                match this.inner.channel().read_etc(cx, bytes, handles) {
785                    std::task::Poll::Ready(Ok(())) => {}
786                    std::task::Poll::Pending => return std::task::Poll::Pending,
787                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
788                        this.is_terminated = true;
789                        return std::task::Poll::Ready(None);
790                    }
791                    std::task::Poll::Ready(Err(e)) => {
792                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
793                            e.into(),
794                        ))));
795                    }
796                }
797
798                // A message has been received from the channel
799                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
800
801                std::task::Poll::Ready(Some(match header.ordinal {
802                    0x494b7ea578d1061e => {
803                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
804                        let mut req = fidl::new_empty!(
805                            AllocatorRegisterBufferCollectionRequest,
806                            fidl::encoding::DefaultFuchsiaResourceDialect
807                        );
808                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AllocatorRegisterBufferCollectionRequest>(&header, _body_bytes, handles, &mut req)?;
809                        let control_handle = AllocatorControlHandle { inner: this.inner.clone() };
810                        Ok(AllocatorRequest::RegisterBufferCollection {
811                            args: req.args,
812
813                            responder: AllocatorRegisterBufferCollectionResponder {
814                                control_handle: std::mem::ManuallyDrop::new(control_handle),
815                                tx_id: header.tx_id,
816                            },
817                        })
818                    }
819                    _ => Err(fidl::Error::UnknownOrdinal {
820                        ordinal: header.ordinal,
821                        protocol_name:
822                            <AllocatorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
823                    }),
824                }))
825            },
826        )
827    }
828}
829
830#[derive(Debug)]
831pub enum AllocatorRequest {
832    /// A BufferCollection is a set of VMOs created by Sysmem and shared by a number of
833    /// participants, one of which is the Flatland Renderer. Some content, such as Images, use a
834    /// BufferCollection as their backing memory.
835    ///
836    /// See [`RegisterBufferCollectionArgs`] for information on each argument.
837    RegisterBufferCollection {
838        args: RegisterBufferCollectionArgs,
839        responder: AllocatorRegisterBufferCollectionResponder,
840    },
841}
842
843impl AllocatorRequest {
844    #[allow(irrefutable_let_patterns)]
845    pub fn into_register_buffer_collection(
846        self,
847    ) -> Option<(RegisterBufferCollectionArgs, AllocatorRegisterBufferCollectionResponder)> {
848        if let AllocatorRequest::RegisterBufferCollection { args, responder } = self {
849            Some((args, responder))
850        } else {
851            None
852        }
853    }
854
855    /// Name of the method defined in FIDL
856    pub fn method_name(&self) -> &'static str {
857        match *self {
858            AllocatorRequest::RegisterBufferCollection { .. } => "register_buffer_collection",
859        }
860    }
861}
862
863#[derive(Debug, Clone)]
864pub struct AllocatorControlHandle {
865    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
866}
867
868impl fidl::endpoints::ControlHandle for AllocatorControlHandle {
869    fn shutdown(&self) {
870        self.inner.shutdown()
871    }
872
873    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
874        self.inner.shutdown_with_epitaph(status)
875    }
876
877    fn is_closed(&self) -> bool {
878        self.inner.channel().is_closed()
879    }
880    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
881        self.inner.channel().on_closed()
882    }
883
884    #[cfg(target_os = "fuchsia")]
885    fn signal_peer(
886        &self,
887        clear_mask: zx::Signals,
888        set_mask: zx::Signals,
889    ) -> Result<(), zx_status::Status> {
890        use fidl::Peered;
891        self.inner.channel().signal_peer(clear_mask, set_mask)
892    }
893}
894
895impl AllocatorControlHandle {}
896
897#[must_use = "FIDL methods require a response to be sent"]
898#[derive(Debug)]
899pub struct AllocatorRegisterBufferCollectionResponder {
900    control_handle: std::mem::ManuallyDrop<AllocatorControlHandle>,
901    tx_id: u32,
902}
903
904/// Set the the channel to be shutdown (see [`AllocatorControlHandle::shutdown`])
905/// if the responder is dropped without sending a response, so that the client
906/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
907impl std::ops::Drop for AllocatorRegisterBufferCollectionResponder {
908    fn drop(&mut self) {
909        self.control_handle.shutdown();
910        // Safety: drops once, never accessed again
911        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
912    }
913}
914
915impl fidl::endpoints::Responder for AllocatorRegisterBufferCollectionResponder {
916    type ControlHandle = AllocatorControlHandle;
917
918    fn control_handle(&self) -> &AllocatorControlHandle {
919        &self.control_handle
920    }
921
922    fn drop_without_shutdown(mut self) {
923        // Safety: drops once, never accessed again due to mem::forget
924        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
925        // Prevent Drop from running (which would shut down the channel)
926        std::mem::forget(self);
927    }
928}
929
930impl AllocatorRegisterBufferCollectionResponder {
931    /// Sends a response to the FIDL transaction.
932    ///
933    /// Sets the channel to shutdown if an error occurs.
934    pub fn send(
935        self,
936        mut result: Result<(), RegisterBufferCollectionError>,
937    ) -> Result<(), fidl::Error> {
938        let _result = self.send_raw(result);
939        if _result.is_err() {
940            self.control_handle.shutdown();
941        }
942        self.drop_without_shutdown();
943        _result
944    }
945
946    /// Similar to "send" but does not shutdown the channel if an error occurs.
947    pub fn send_no_shutdown_on_err(
948        self,
949        mut result: Result<(), RegisterBufferCollectionError>,
950    ) -> Result<(), fidl::Error> {
951        let _result = self.send_raw(result);
952        self.drop_without_shutdown();
953        _result
954    }
955
956    fn send_raw(
957        &self,
958        mut result: Result<(), RegisterBufferCollectionError>,
959    ) -> Result<(), fidl::Error> {
960        self.control_handle.inner.send::<fidl::encoding::ResultType<
961            fidl::encoding::EmptyStruct,
962            RegisterBufferCollectionError,
963        >>(
964            result,
965            self.tx_id,
966            0x494b7ea578d1061e,
967            fidl::encoding::DynamicFlags::empty(),
968        )
969    }
970}
971
972#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
973pub struct ChildViewWatcherMarker;
974
975impl fidl::endpoints::ProtocolMarker for ChildViewWatcherMarker {
976    type Proxy = ChildViewWatcherProxy;
977    type RequestStream = ChildViewWatcherRequestStream;
978    #[cfg(target_os = "fuchsia")]
979    type SynchronousProxy = ChildViewWatcherSynchronousProxy;
980
981    const DEBUG_NAME: &'static str = "(anonymous) ChildViewWatcher";
982}
983
984pub trait ChildViewWatcherProxyInterface: Send + Sync {
985    type GetStatusResponseFut: std::future::Future<Output = Result<ChildViewStatus, fidl::Error>>
986        + Send;
987    fn r#get_status(&self) -> Self::GetStatusResponseFut;
988    type GetViewRefResponseFut: std::future::Future<Output = Result<fidl_fuchsia_ui_views::ViewRef, fidl::Error>>
989        + Send;
990    fn r#get_view_ref(&self) -> Self::GetViewRefResponseFut;
991}
992#[derive(Debug)]
993#[cfg(target_os = "fuchsia")]
994pub struct ChildViewWatcherSynchronousProxy {
995    client: fidl::client::sync::Client,
996}
997
998#[cfg(target_os = "fuchsia")]
999impl fidl::endpoints::SynchronousProxy for ChildViewWatcherSynchronousProxy {
1000    type Proxy = ChildViewWatcherProxy;
1001    type Protocol = ChildViewWatcherMarker;
1002
1003    fn from_channel(inner: fidl::Channel) -> Self {
1004        Self::new(inner)
1005    }
1006
1007    fn into_channel(self) -> fidl::Channel {
1008        self.client.into_channel()
1009    }
1010
1011    fn as_channel(&self) -> &fidl::Channel {
1012        self.client.as_channel()
1013    }
1014}
1015
1016#[cfg(target_os = "fuchsia")]
1017impl ChildViewWatcherSynchronousProxy {
1018    pub fn new(channel: fidl::Channel) -> Self {
1019        Self { client: fidl::client::sync::Client::new(channel) }
1020    }
1021
1022    pub fn into_channel(self) -> fidl::Channel {
1023        self.client.into_channel()
1024    }
1025
1026    /// Waits until an event arrives and returns it. It is safe for other
1027    /// threads to make concurrent requests while waiting for an event.
1028    pub fn wait_for_event(
1029        &self,
1030        deadline: zx::MonotonicInstant,
1031    ) -> Result<ChildViewWatcherEvent, fidl::Error> {
1032        ChildViewWatcherEvent::decode(
1033            self.client.wait_for_event::<ChildViewWatcherMarker>(deadline)?,
1034        )
1035    }
1036
1037    /// A hanging get for receiving the status of a View. This provides information to the parent,
1038    /// such as whether or not the child has successfully presented content through this View.
1039    ///
1040    /// This hanging get will only fire when the ChildViewStatus is different than the previously
1041    /// returned ChildViewStatus.  This can happen immediately, and even if the creator of the
1042    /// Viewport hasn't yet called Present() after calling CreateViewport().  This allows the parent
1043    /// to know that the child has content ready to display before the parent modifies their own
1044    /// local scene graph to incorporate the child content.
1045    ///
1046    /// It is invalid to call `GetStatus` while a previous call is still pending. Doing so will
1047    /// cause both this channel and the Flatland channel that handed out ChildViewWatcher to be
1048    /// closed.
1049    pub fn r#get_status(
1050        &self,
1051        ___deadline: zx::MonotonicInstant,
1052    ) -> Result<ChildViewStatus, fidl::Error> {
1053        let _response = self.client.send_query::<
1054            fidl::encoding::EmptyPayload,
1055            ChildViewWatcherGetStatusResponse,
1056            ChildViewWatcherMarker,
1057        >(
1058            (),
1059            0x1d622075f4fc8243,
1060            fidl::encoding::DynamicFlags::empty(),
1061            ___deadline,
1062        )?;
1063        Ok(_response.status)
1064    }
1065
1066    /// Hanging get to receive the ViewRef of the child View. This will only fire when the View ref
1067    /// is different from the previously-returned View ref. Note: currently the View ref will not
1068    /// change after it is first received, but this will change if/when the API changes to allow
1069    /// relinking of views.
1070    ///
1071    /// The ViewRef is not returned until the View is included in the View tree, in other words when
1072    /// there is a chain of ancestor transforms all the way back up to the root of the scene graph,
1073    /// i.e. the display.
1074    ///
1075    /// It is invalid to call `GetViewRef` while a previous call is still pending. Doing so will
1076    /// cause both this channel and the Flatland channel that handed out ChildViewWatcher to be
1077    /// closed.
1078    ///
1079    /// A `GetViewRef` call will hang if the View was created using `CreateView`, but returns the
1080    /// View if the View was created using CreateView2. This is because `CreateView` does not mint
1081    /// a ViewRef for that View.
1082    pub fn r#get_view_ref(
1083        &self,
1084        ___deadline: zx::MonotonicInstant,
1085    ) -> Result<fidl_fuchsia_ui_views::ViewRef, fidl::Error> {
1086        let _response = self.client.send_query::<
1087            fidl::encoding::EmptyPayload,
1088            ChildViewWatcherGetViewRefResponse,
1089            ChildViewWatcherMarker,
1090        >(
1091            (),
1092            0x3b2f3ca31e8908b4,
1093            fidl::encoding::DynamicFlags::empty(),
1094            ___deadline,
1095        )?;
1096        Ok(_response.view_ref)
1097    }
1098}
1099
1100#[cfg(target_os = "fuchsia")]
1101impl From<ChildViewWatcherSynchronousProxy> for zx::NullableHandle {
1102    fn from(value: ChildViewWatcherSynchronousProxy) -> Self {
1103        value.into_channel().into()
1104    }
1105}
1106
1107#[cfg(target_os = "fuchsia")]
1108impl From<fidl::Channel> for ChildViewWatcherSynchronousProxy {
1109    fn from(value: fidl::Channel) -> Self {
1110        Self::new(value)
1111    }
1112}
1113
1114#[cfg(target_os = "fuchsia")]
1115impl fidl::endpoints::FromClient for ChildViewWatcherSynchronousProxy {
1116    type Protocol = ChildViewWatcherMarker;
1117
1118    fn from_client(value: fidl::endpoints::ClientEnd<ChildViewWatcherMarker>) -> Self {
1119        Self::new(value.into_channel())
1120    }
1121}
1122
1123#[derive(Debug, Clone)]
1124pub struct ChildViewWatcherProxy {
1125    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1126}
1127
1128impl fidl::endpoints::Proxy for ChildViewWatcherProxy {
1129    type Protocol = ChildViewWatcherMarker;
1130
1131    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1132        Self::new(inner)
1133    }
1134
1135    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1136        self.client.into_channel().map_err(|client| Self { client })
1137    }
1138
1139    fn as_channel(&self) -> &::fidl::AsyncChannel {
1140        self.client.as_channel()
1141    }
1142}
1143
1144impl ChildViewWatcherProxy {
1145    /// Create a new Proxy for fuchsia.ui.composition/ChildViewWatcher.
1146    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1147        let protocol_name = <ChildViewWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1148        Self { client: fidl::client::Client::new(channel, protocol_name) }
1149    }
1150
1151    /// Get a Stream of events from the remote end of the protocol.
1152    ///
1153    /// # Panics
1154    ///
1155    /// Panics if the event stream was already taken.
1156    pub fn take_event_stream(&self) -> ChildViewWatcherEventStream {
1157        ChildViewWatcherEventStream { event_receiver: self.client.take_event_receiver() }
1158    }
1159
1160    /// A hanging get for receiving the status of a View. This provides information to the parent,
1161    /// such as whether or not the child has successfully presented content through this View.
1162    ///
1163    /// This hanging get will only fire when the ChildViewStatus is different than the previously
1164    /// returned ChildViewStatus.  This can happen immediately, and even if the creator of the
1165    /// Viewport hasn't yet called Present() after calling CreateViewport().  This allows the parent
1166    /// to know that the child has content ready to display before the parent modifies their own
1167    /// local scene graph to incorporate the child content.
1168    ///
1169    /// It is invalid to call `GetStatus` while a previous call is still pending. Doing so will
1170    /// cause both this channel and the Flatland channel that handed out ChildViewWatcher to be
1171    /// closed.
1172    pub fn r#get_status(
1173        &self,
1174    ) -> fidl::client::QueryResponseFut<
1175        ChildViewStatus,
1176        fidl::encoding::DefaultFuchsiaResourceDialect,
1177    > {
1178        ChildViewWatcherProxyInterface::r#get_status(self)
1179    }
1180
1181    /// Hanging get to receive the ViewRef of the child View. This will only fire when the View ref
1182    /// is different from the previously-returned View ref. Note: currently the View ref will not
1183    /// change after it is first received, but this will change if/when the API changes to allow
1184    /// relinking of views.
1185    ///
1186    /// The ViewRef is not returned until the View is included in the View tree, in other words when
1187    /// there is a chain of ancestor transforms all the way back up to the root of the scene graph,
1188    /// i.e. the display.
1189    ///
1190    /// It is invalid to call `GetViewRef` while a previous call is still pending. Doing so will
1191    /// cause both this channel and the Flatland channel that handed out ChildViewWatcher to be
1192    /// closed.
1193    ///
1194    /// A `GetViewRef` call will hang if the View was created using `CreateView`, but returns the
1195    /// View if the View was created using CreateView2. This is because `CreateView` does not mint
1196    /// a ViewRef for that View.
1197    pub fn r#get_view_ref(
1198        &self,
1199    ) -> fidl::client::QueryResponseFut<
1200        fidl_fuchsia_ui_views::ViewRef,
1201        fidl::encoding::DefaultFuchsiaResourceDialect,
1202    > {
1203        ChildViewWatcherProxyInterface::r#get_view_ref(self)
1204    }
1205}
1206
1207impl ChildViewWatcherProxyInterface for ChildViewWatcherProxy {
1208    type GetStatusResponseFut = fidl::client::QueryResponseFut<
1209        ChildViewStatus,
1210        fidl::encoding::DefaultFuchsiaResourceDialect,
1211    >;
1212    fn r#get_status(&self) -> Self::GetStatusResponseFut {
1213        fn _decode(
1214            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1215        ) -> Result<ChildViewStatus, fidl::Error> {
1216            let _response = fidl::client::decode_transaction_body::<
1217                ChildViewWatcherGetStatusResponse,
1218                fidl::encoding::DefaultFuchsiaResourceDialect,
1219                0x1d622075f4fc8243,
1220            >(_buf?)?;
1221            Ok(_response.status)
1222        }
1223        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ChildViewStatus>(
1224            (),
1225            0x1d622075f4fc8243,
1226            fidl::encoding::DynamicFlags::empty(),
1227            _decode,
1228        )
1229    }
1230
1231    type GetViewRefResponseFut = fidl::client::QueryResponseFut<
1232        fidl_fuchsia_ui_views::ViewRef,
1233        fidl::encoding::DefaultFuchsiaResourceDialect,
1234    >;
1235    fn r#get_view_ref(&self) -> Self::GetViewRefResponseFut {
1236        fn _decode(
1237            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1238        ) -> Result<fidl_fuchsia_ui_views::ViewRef, fidl::Error> {
1239            let _response = fidl::client::decode_transaction_body::<
1240                ChildViewWatcherGetViewRefResponse,
1241                fidl::encoding::DefaultFuchsiaResourceDialect,
1242                0x3b2f3ca31e8908b4,
1243            >(_buf?)?;
1244            Ok(_response.view_ref)
1245        }
1246        self.client
1247            .send_query_and_decode::<fidl::encoding::EmptyPayload, fidl_fuchsia_ui_views::ViewRef>(
1248                (),
1249                0x3b2f3ca31e8908b4,
1250                fidl::encoding::DynamicFlags::empty(),
1251                _decode,
1252            )
1253    }
1254}
1255
1256pub struct ChildViewWatcherEventStream {
1257    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1258}
1259
1260impl std::marker::Unpin for ChildViewWatcherEventStream {}
1261
1262impl futures::stream::FusedStream for ChildViewWatcherEventStream {
1263    fn is_terminated(&self) -> bool {
1264        self.event_receiver.is_terminated()
1265    }
1266}
1267
1268impl futures::Stream for ChildViewWatcherEventStream {
1269    type Item = Result<ChildViewWatcherEvent, fidl::Error>;
1270
1271    fn poll_next(
1272        mut self: std::pin::Pin<&mut Self>,
1273        cx: &mut std::task::Context<'_>,
1274    ) -> std::task::Poll<Option<Self::Item>> {
1275        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1276            &mut self.event_receiver,
1277            cx
1278        )?) {
1279            Some(buf) => std::task::Poll::Ready(Some(ChildViewWatcherEvent::decode(buf))),
1280            None => std::task::Poll::Ready(None),
1281        }
1282    }
1283}
1284
1285#[derive(Debug)]
1286pub enum ChildViewWatcherEvent {}
1287
1288impl ChildViewWatcherEvent {
1289    /// Decodes a message buffer as a [`ChildViewWatcherEvent`].
1290    fn decode(
1291        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1292    ) -> Result<ChildViewWatcherEvent, fidl::Error> {
1293        let (bytes, _handles) = buf.split_mut();
1294        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1295        debug_assert_eq!(tx_header.tx_id, 0);
1296        match tx_header.ordinal {
1297            _ => Err(fidl::Error::UnknownOrdinal {
1298                ordinal: tx_header.ordinal,
1299                protocol_name:
1300                    <ChildViewWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1301            }),
1302        }
1303    }
1304}
1305
1306/// A Stream of incoming requests for fuchsia.ui.composition/ChildViewWatcher.
1307pub struct ChildViewWatcherRequestStream {
1308    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1309    is_terminated: bool,
1310}
1311
1312impl std::marker::Unpin for ChildViewWatcherRequestStream {}
1313
1314impl futures::stream::FusedStream for ChildViewWatcherRequestStream {
1315    fn is_terminated(&self) -> bool {
1316        self.is_terminated
1317    }
1318}
1319
1320impl fidl::endpoints::RequestStream for ChildViewWatcherRequestStream {
1321    type Protocol = ChildViewWatcherMarker;
1322    type ControlHandle = ChildViewWatcherControlHandle;
1323
1324    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1325        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1326    }
1327
1328    fn control_handle(&self) -> Self::ControlHandle {
1329        ChildViewWatcherControlHandle { inner: self.inner.clone() }
1330    }
1331
1332    fn into_inner(
1333        self,
1334    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1335    {
1336        (self.inner, self.is_terminated)
1337    }
1338
1339    fn from_inner(
1340        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1341        is_terminated: bool,
1342    ) -> Self {
1343        Self { inner, is_terminated }
1344    }
1345}
1346
1347impl futures::Stream for ChildViewWatcherRequestStream {
1348    type Item = Result<ChildViewWatcherRequest, fidl::Error>;
1349
1350    fn poll_next(
1351        mut self: std::pin::Pin<&mut Self>,
1352        cx: &mut std::task::Context<'_>,
1353    ) -> std::task::Poll<Option<Self::Item>> {
1354        let this = &mut *self;
1355        if this.inner.check_shutdown(cx) {
1356            this.is_terminated = true;
1357            return std::task::Poll::Ready(None);
1358        }
1359        if this.is_terminated {
1360            panic!("polled ChildViewWatcherRequestStream after completion");
1361        }
1362        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1363            |bytes, handles| {
1364                match this.inner.channel().read_etc(cx, bytes, handles) {
1365                    std::task::Poll::Ready(Ok(())) => {}
1366                    std::task::Poll::Pending => return std::task::Poll::Pending,
1367                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1368                        this.is_terminated = true;
1369                        return std::task::Poll::Ready(None);
1370                    }
1371                    std::task::Poll::Ready(Err(e)) => {
1372                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1373                            e.into(),
1374                        ))));
1375                    }
1376                }
1377
1378                // A message has been received from the channel
1379                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1380
1381                std::task::Poll::Ready(Some(match header.ordinal {
1382                    0x1d622075f4fc8243 => {
1383                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1384                        let mut req = fidl::new_empty!(
1385                            fidl::encoding::EmptyPayload,
1386                            fidl::encoding::DefaultFuchsiaResourceDialect
1387                        );
1388                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1389                        let control_handle =
1390                            ChildViewWatcherControlHandle { inner: this.inner.clone() };
1391                        Ok(ChildViewWatcherRequest::GetStatus {
1392                            responder: ChildViewWatcherGetStatusResponder {
1393                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1394                                tx_id: header.tx_id,
1395                            },
1396                        })
1397                    }
1398                    0x3b2f3ca31e8908b4 => {
1399                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1400                        let mut req = fidl::new_empty!(
1401                            fidl::encoding::EmptyPayload,
1402                            fidl::encoding::DefaultFuchsiaResourceDialect
1403                        );
1404                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1405                        let control_handle =
1406                            ChildViewWatcherControlHandle { inner: this.inner.clone() };
1407                        Ok(ChildViewWatcherRequest::GetViewRef {
1408                            responder: ChildViewWatcherGetViewRefResponder {
1409                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1410                                tx_id: header.tx_id,
1411                            },
1412                        })
1413                    }
1414                    _ => Err(fidl::Error::UnknownOrdinal {
1415                        ordinal: header.ordinal,
1416                        protocol_name:
1417                            <ChildViewWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1418                    }),
1419                }))
1420            },
1421        )
1422    }
1423}
1424
1425/// A protocol that provides information about a particular child View which is attached to the
1426/// Viewport owned by the parent client; connections to this protocol are estabished in
1427/// [`CreateViewport`].  Since a Flatland instance may contain any number of Viewports, each of
1428/// which may or may not be attached to a transform, the client can maintain connections to an
1429/// equal number of ChildViewWatcher instances.
1430///
1431/// Each ChildViewWatcher instance will remain connected as long as the corresponding child View
1432/// exists; the connection will also be closed if the child's ViewCreationToken is dropped without
1433/// using it to create a View.
1434#[derive(Debug)]
1435pub enum ChildViewWatcherRequest {
1436    /// A hanging get for receiving the status of a View. This provides information to the parent,
1437    /// such as whether or not the child has successfully presented content through this View.
1438    ///
1439    /// This hanging get will only fire when the ChildViewStatus is different than the previously
1440    /// returned ChildViewStatus.  This can happen immediately, and even if the creator of the
1441    /// Viewport hasn't yet called Present() after calling CreateViewport().  This allows the parent
1442    /// to know that the child has content ready to display before the parent modifies their own
1443    /// local scene graph to incorporate the child content.
1444    ///
1445    /// It is invalid to call `GetStatus` while a previous call is still pending. Doing so will
1446    /// cause both this channel and the Flatland channel that handed out ChildViewWatcher to be
1447    /// closed.
1448    GetStatus { responder: ChildViewWatcherGetStatusResponder },
1449    /// Hanging get to receive the ViewRef of the child View. This will only fire when the View ref
1450    /// is different from the previously-returned View ref. Note: currently the View ref will not
1451    /// change after it is first received, but this will change if/when the API changes to allow
1452    /// relinking of views.
1453    ///
1454    /// The ViewRef is not returned until the View is included in the View tree, in other words when
1455    /// there is a chain of ancestor transforms all the way back up to the root of the scene graph,
1456    /// i.e. the display.
1457    ///
1458    /// It is invalid to call `GetViewRef` 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    ///
1462    /// A `GetViewRef` call will hang if the View was created using `CreateView`, but returns the
1463    /// View if the View was created using CreateView2. This is because `CreateView` does not mint
1464    /// a ViewRef for that View.
1465    GetViewRef { responder: ChildViewWatcherGetViewRefResponder },
1466}
1467
1468impl ChildViewWatcherRequest {
1469    #[allow(irrefutable_let_patterns)]
1470    pub fn into_get_status(self) -> Option<(ChildViewWatcherGetStatusResponder)> {
1471        if let ChildViewWatcherRequest::GetStatus { responder } = self {
1472            Some((responder))
1473        } else {
1474            None
1475        }
1476    }
1477
1478    #[allow(irrefutable_let_patterns)]
1479    pub fn into_get_view_ref(self) -> Option<(ChildViewWatcherGetViewRefResponder)> {
1480        if let ChildViewWatcherRequest::GetViewRef { responder } = self {
1481            Some((responder))
1482        } else {
1483            None
1484        }
1485    }
1486
1487    /// Name of the method defined in FIDL
1488    pub fn method_name(&self) -> &'static str {
1489        match *self {
1490            ChildViewWatcherRequest::GetStatus { .. } => "get_status",
1491            ChildViewWatcherRequest::GetViewRef { .. } => "get_view_ref",
1492        }
1493    }
1494}
1495
1496#[derive(Debug, Clone)]
1497pub struct ChildViewWatcherControlHandle {
1498    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1499}
1500
1501impl fidl::endpoints::ControlHandle for ChildViewWatcherControlHandle {
1502    fn shutdown(&self) {
1503        self.inner.shutdown()
1504    }
1505
1506    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1507        self.inner.shutdown_with_epitaph(status)
1508    }
1509
1510    fn is_closed(&self) -> bool {
1511        self.inner.channel().is_closed()
1512    }
1513    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1514        self.inner.channel().on_closed()
1515    }
1516
1517    #[cfg(target_os = "fuchsia")]
1518    fn signal_peer(
1519        &self,
1520        clear_mask: zx::Signals,
1521        set_mask: zx::Signals,
1522    ) -> Result<(), zx_status::Status> {
1523        use fidl::Peered;
1524        self.inner.channel().signal_peer(clear_mask, set_mask)
1525    }
1526}
1527
1528impl ChildViewWatcherControlHandle {}
1529
1530#[must_use = "FIDL methods require a response to be sent"]
1531#[derive(Debug)]
1532pub struct ChildViewWatcherGetStatusResponder {
1533    control_handle: std::mem::ManuallyDrop<ChildViewWatcherControlHandle>,
1534    tx_id: u32,
1535}
1536
1537/// Set the the channel to be shutdown (see [`ChildViewWatcherControlHandle::shutdown`])
1538/// if the responder is dropped without sending a response, so that the client
1539/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1540impl std::ops::Drop for ChildViewWatcherGetStatusResponder {
1541    fn drop(&mut self) {
1542        self.control_handle.shutdown();
1543        // Safety: drops once, never accessed again
1544        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1545    }
1546}
1547
1548impl fidl::endpoints::Responder for ChildViewWatcherGetStatusResponder {
1549    type ControlHandle = ChildViewWatcherControlHandle;
1550
1551    fn control_handle(&self) -> &ChildViewWatcherControlHandle {
1552        &self.control_handle
1553    }
1554
1555    fn drop_without_shutdown(mut self) {
1556        // Safety: drops once, never accessed again due to mem::forget
1557        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1558        // Prevent Drop from running (which would shut down the channel)
1559        std::mem::forget(self);
1560    }
1561}
1562
1563impl ChildViewWatcherGetStatusResponder {
1564    /// Sends a response to the FIDL transaction.
1565    ///
1566    /// Sets the channel to shutdown if an error occurs.
1567    pub fn send(self, mut status: ChildViewStatus) -> Result<(), fidl::Error> {
1568        let _result = self.send_raw(status);
1569        if _result.is_err() {
1570            self.control_handle.shutdown();
1571        }
1572        self.drop_without_shutdown();
1573        _result
1574    }
1575
1576    /// Similar to "send" but does not shutdown the channel if an error occurs.
1577    pub fn send_no_shutdown_on_err(self, mut status: ChildViewStatus) -> Result<(), fidl::Error> {
1578        let _result = self.send_raw(status);
1579        self.drop_without_shutdown();
1580        _result
1581    }
1582
1583    fn send_raw(&self, mut status: ChildViewStatus) -> Result<(), fidl::Error> {
1584        self.control_handle.inner.send::<ChildViewWatcherGetStatusResponse>(
1585            (status,),
1586            self.tx_id,
1587            0x1d622075f4fc8243,
1588            fidl::encoding::DynamicFlags::empty(),
1589        )
1590    }
1591}
1592
1593#[must_use = "FIDL methods require a response to be sent"]
1594#[derive(Debug)]
1595pub struct ChildViewWatcherGetViewRefResponder {
1596    control_handle: std::mem::ManuallyDrop<ChildViewWatcherControlHandle>,
1597    tx_id: u32,
1598}
1599
1600/// Set the the channel to be shutdown (see [`ChildViewWatcherControlHandle::shutdown`])
1601/// if the responder is dropped without sending a response, so that the client
1602/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1603impl std::ops::Drop for ChildViewWatcherGetViewRefResponder {
1604    fn drop(&mut self) {
1605        self.control_handle.shutdown();
1606        // Safety: drops once, never accessed again
1607        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1608    }
1609}
1610
1611impl fidl::endpoints::Responder for ChildViewWatcherGetViewRefResponder {
1612    type ControlHandle = ChildViewWatcherControlHandle;
1613
1614    fn control_handle(&self) -> &ChildViewWatcherControlHandle {
1615        &self.control_handle
1616    }
1617
1618    fn drop_without_shutdown(mut self) {
1619        // Safety: drops once, never accessed again due to mem::forget
1620        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1621        // Prevent Drop from running (which would shut down the channel)
1622        std::mem::forget(self);
1623    }
1624}
1625
1626impl ChildViewWatcherGetViewRefResponder {
1627    /// Sends a response to the FIDL transaction.
1628    ///
1629    /// Sets the channel to shutdown if an error occurs.
1630    pub fn send(self, mut view_ref: fidl_fuchsia_ui_views::ViewRef) -> Result<(), fidl::Error> {
1631        let _result = self.send_raw(view_ref);
1632        if _result.is_err() {
1633            self.control_handle.shutdown();
1634        }
1635        self.drop_without_shutdown();
1636        _result
1637    }
1638
1639    /// Similar to "send" but does not shutdown the channel if an error occurs.
1640    pub fn send_no_shutdown_on_err(
1641        self,
1642        mut view_ref: fidl_fuchsia_ui_views::ViewRef,
1643    ) -> Result<(), fidl::Error> {
1644        let _result = self.send_raw(view_ref);
1645        self.drop_without_shutdown();
1646        _result
1647    }
1648
1649    fn send_raw(&self, mut view_ref: fidl_fuchsia_ui_views::ViewRef) -> Result<(), fidl::Error> {
1650        self.control_handle.inner.send::<ChildViewWatcherGetViewRefResponse>(
1651            (&mut view_ref,),
1652            self.tx_id,
1653            0x3b2f3ca31e8908b4,
1654            fidl::encoding::DynamicFlags::empty(),
1655        )
1656    }
1657}
1658
1659#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1660pub struct FlatlandMarker;
1661
1662impl fidl::endpoints::ProtocolMarker for FlatlandMarker {
1663    type Proxy = FlatlandProxy;
1664    type RequestStream = FlatlandRequestStream;
1665    #[cfg(target_os = "fuchsia")]
1666    type SynchronousProxy = FlatlandSynchronousProxy;
1667
1668    const DEBUG_NAME: &'static str = "fuchsia.ui.composition.Flatland";
1669}
1670impl fidl::endpoints::DiscoverableProtocolMarker for FlatlandMarker {}
1671
1672pub trait FlatlandProxyInterface: Send + Sync {
1673    fn r#release_image_immediately(&self, image_id: &ContentId) -> Result<(), fidl::Error>;
1674    fn r#present(&self, args: PresentArgs) -> Result<(), fidl::Error>;
1675    fn r#create_view(
1676        &self,
1677        token: fidl_fuchsia_ui_views::ViewCreationToken,
1678        parent_viewport_watcher: fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>,
1679    ) -> Result<(), fidl::Error>;
1680    fn r#create_view2(
1681        &self,
1682        token: fidl_fuchsia_ui_views::ViewCreationToken,
1683        view_identity: fidl_fuchsia_ui_views::ViewIdentityOnCreation,
1684        protocols: ViewBoundProtocols,
1685        parent_viewport_watcher: fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>,
1686    ) -> Result<(), fidl::Error>;
1687    fn r#create_transform(&self, transform_id: &TransformId) -> Result<(), fidl::Error>;
1688    fn r#set_translation(
1689        &self,
1690        transform_id: &TransformId,
1691        translation: &fidl_fuchsia_math::Vec_,
1692    ) -> Result<(), fidl::Error>;
1693    fn r#set_orientation(
1694        &self,
1695        transform_id: &TransformId,
1696        orientation: Orientation,
1697    ) -> Result<(), fidl::Error>;
1698    fn r#set_scale(
1699        &self,
1700        transform_id: &TransformId,
1701        scale: &fidl_fuchsia_math::VecF,
1702    ) -> Result<(), fidl::Error>;
1703    fn r#set_opacity(&self, transform_id: &TransformId, value: f32) -> Result<(), fidl::Error>;
1704    fn r#set_clip_boundary(
1705        &self,
1706        transform_id: &TransformId,
1707        rect: Option<&fidl_fuchsia_math::Rect>,
1708    ) -> Result<(), fidl::Error>;
1709    fn r#add_child(
1710        &self,
1711        parent_transform_id: &TransformId,
1712        child_transform_id: &TransformId,
1713    ) -> Result<(), fidl::Error>;
1714    fn r#remove_child(
1715        &self,
1716        parent_transform_id: &TransformId,
1717        child_transform_id: &TransformId,
1718    ) -> Result<(), fidl::Error>;
1719    fn r#replace_children(
1720        &self,
1721        parent_transform_id: &TransformId,
1722        new_child_transform_ids: &[TransformId],
1723    ) -> Result<(), fidl::Error>;
1724    fn r#set_root_transform(&self, transform_id: &TransformId) -> Result<(), fidl::Error>;
1725    fn r#set_hit_regions(
1726        &self,
1727        transform_id: &TransformId,
1728        regions: &[HitRegion],
1729    ) -> Result<(), fidl::Error>;
1730    fn r#set_infinite_hit_region(
1731        &self,
1732        transform_id: &TransformId,
1733        hit_test: HitTestInteraction,
1734    ) -> Result<(), fidl::Error>;
1735    fn r#create_viewport(
1736        &self,
1737        viewport_id: &ContentId,
1738        token: fidl_fuchsia_ui_views::ViewportCreationToken,
1739        properties: &ViewportProperties,
1740        child_view_watcher: fidl::endpoints::ServerEnd<ChildViewWatcherMarker>,
1741    ) -> Result<(), fidl::Error>;
1742    fn r#create_image(
1743        &self,
1744        image_id: &ContentId,
1745        import_token: BufferCollectionImportToken,
1746        vmo_index: u32,
1747        properties: &ImageProperties,
1748    ) -> Result<(), fidl::Error>;
1749    fn r#set_image_sample_region(
1750        &self,
1751        image_id: &ContentId,
1752        rect: &fidl_fuchsia_math::RectF,
1753    ) -> Result<(), fidl::Error>;
1754    fn r#set_image_destination_size(
1755        &self,
1756        image_id: &ContentId,
1757        size: &fidl_fuchsia_math::SizeU,
1758    ) -> Result<(), fidl::Error>;
1759    fn r#set_image_blending_function(
1760        &self,
1761        image_id: &ContentId,
1762        blend_mode: BlendMode,
1763    ) -> Result<(), fidl::Error>;
1764    fn r#set_image_blend_mode(
1765        &self,
1766        image_id: &ContentId,
1767        blend_mode: BlendMode2,
1768    ) -> Result<(), fidl::Error>;
1769    fn r#set_image_opacity(&self, image_id: &ContentId, val: f32) -> Result<(), fidl::Error>;
1770    fn r#set_image_flip(&self, image_id: &ContentId, flip: ImageFlip) -> Result<(), fidl::Error>;
1771    fn r#create_filled_rect(&self, rect_id: &ContentId) -> Result<(), fidl::Error>;
1772    fn r#set_solid_fill(
1773        &self,
1774        rect_id: &ContentId,
1775        color: &ColorRgba,
1776        size: &fidl_fuchsia_math::SizeU,
1777    ) -> Result<(), fidl::Error>;
1778    fn r#release_filled_rect(&self, rect_id: &ContentId) -> Result<(), fidl::Error>;
1779    fn r#set_content(
1780        &self,
1781        transform_id: &TransformId,
1782        content_id: &ContentId,
1783    ) -> Result<(), fidl::Error>;
1784    fn r#set_viewport_properties(
1785        &self,
1786        viewport_id: &ContentId,
1787        properties: &ViewportProperties,
1788    ) -> Result<(), fidl::Error>;
1789    fn r#release_transform(&self, transform_id: &TransformId) -> Result<(), fidl::Error>;
1790    fn r#release_view(&self) -> Result<(), fidl::Error>;
1791    type ReleaseViewportResponseFut: std::future::Future<
1792            Output = Result<fidl_fuchsia_ui_views::ViewportCreationToken, fidl::Error>,
1793        > + Send;
1794    fn r#release_viewport(&self, viewport_id: &ContentId) -> Self::ReleaseViewportResponseFut;
1795    fn r#release_image(&self, image_id: &ContentId) -> Result<(), fidl::Error>;
1796    fn r#clear(&self) -> Result<(), fidl::Error>;
1797    fn r#set_debug_name(&self, name: &str) -> Result<(), fidl::Error>;
1798}
1799#[derive(Debug)]
1800#[cfg(target_os = "fuchsia")]
1801pub struct FlatlandSynchronousProxy {
1802    client: fidl::client::sync::Client,
1803}
1804
1805#[cfg(target_os = "fuchsia")]
1806impl fidl::endpoints::SynchronousProxy for FlatlandSynchronousProxy {
1807    type Proxy = FlatlandProxy;
1808    type Protocol = FlatlandMarker;
1809
1810    fn from_channel(inner: fidl::Channel) -> Self {
1811        Self::new(inner)
1812    }
1813
1814    fn into_channel(self) -> fidl::Channel {
1815        self.client.into_channel()
1816    }
1817
1818    fn as_channel(&self) -> &fidl::Channel {
1819        self.client.as_channel()
1820    }
1821}
1822
1823#[cfg(target_os = "fuchsia")]
1824impl FlatlandSynchronousProxy {
1825    pub fn new(channel: fidl::Channel) -> Self {
1826        Self { client: fidl::client::sync::Client::new(channel) }
1827    }
1828
1829    pub fn into_channel(self) -> fidl::Channel {
1830        self.client.into_channel()
1831    }
1832
1833    /// Waits until an event arrives and returns it. It is safe for other
1834    /// threads to make concurrent requests while waiting for an event.
1835    pub fn wait_for_event(
1836        &self,
1837        deadline: zx::MonotonicInstant,
1838    ) -> Result<FlatlandEvent, fidl::Error> {
1839        FlatlandEvent::decode(self.client.wait_for_event::<FlatlandMarker>(deadline)?)
1840    }
1841
1842    /// Releases an image immediately, without waiting for the next present.
1843    pub fn r#release_image_immediately(&self, mut image_id: &ContentId) -> Result<(), fidl::Error> {
1844        self.client.send::<TrustedFlatlandReleaseImageImmediatelyRequest>(
1845            (image_id,),
1846            0x245e1ac080772c8,
1847            fidl::encoding::DynamicFlags::empty(),
1848        )
1849    }
1850
1851    /// Complete execution of all feed-forward operations.
1852    ///
1853    /// If executing an operation produces an error (e.g., CreateTransform(0)), an [`OnError`] event
1854    /// is emitted. Operations that produce errors are ignored and the channel is closed.
1855    ///
1856    /// If the execution is completed successfully, [`OnNextFrameBegin`] emits NO_ERROR along
1857    /// with other valid fields.
1858    ///
1859    /// The client may only call [`Present`] when they have a non-zero number of present credits,
1860    /// which are tracked by the server. The server may increment the number of credits when it
1861    /// fires the [`OnNextFrameBegin`] event, which informs the client when it receives additional
1862    /// present credits. Each [`Present`] call uses one present credit and decrements the server
1863    /// count by one. If the client calls [`Present`] with no present credits, the server will
1864    /// return a `NO_PRESENTS_REMAINING` error.
1865    ///
1866    /// The client should assume that prior to receiving any [`OnNextFrameBegin`] events, they have
1867    /// one present credit.
1868    ///
1869    /// Every [`Present`] call results in one [`OnNextFrameBegin`] event, and one
1870    /// [`OnFramePresented`] event, typically in that order.
1871    ///
1872    /// When the commands flushed by [`Present`] make it to display, an [`OnFramePresented`] event
1873    /// is fired. This event includes information pertaining to all [`Present`]s that had content
1874    /// that were part of that frame.
1875    ///
1876    /// See [`fuchsia.ui.composition/PresentArgs`] documentation above for more detailed information
1877    /// on what arguments are passed in and their role.
1878    pub fn r#present(&self, mut args: PresentArgs) -> Result<(), fidl::Error> {
1879        self.client.send::<FlatlandPresentRequest>(
1880            (&mut args,),
1881            0x50acc2aa1f0acec7,
1882            fidl::encoding::DynamicFlags::empty(),
1883        )
1884    }
1885
1886    /// Two Flatland instances may be connected in a parent-child relationship. The parent endpoint
1887    /// is held in a Viewport, and the child endpoint is held in a View. The parent Flatland
1888    /// instance that creates a Viewport has control over how the child's View is integrated into
1889    /// its own View.
1890    ///
1891    /// The lifecycle of a parent-child connection starts with two endpoints of a channel object:
1892    /// a ViewportCreationToken and a ViewCreationToken. Out-of-band protocols pass the
1893    /// ViewportCreationToken to the parent, which calls [`CreateViewport`], and the
1894    /// ViewCreationToken to the child, which calls [`CreateView`].
1895    ///
1896    /// Only nodes connected to the Root Transform in this Flatland instance will be rendered into
1897    /// the parent's Viewport.
1898    ///
1899    /// Calling [`CreateView`] a second time will disconnect the Root Transform from the existing
1900    /// parent's Viewport, and attach it to a new parent's Viewport. In other words, each View can
1901    /// only have one parent.
1902    ///
1903    /// This function is queued, meaning that the Root Transform will not be attached to the
1904    /// parent Viewport until [`Present`] is called. However, clients will receive information
1905    /// through their ParentViewportWatcher (e.g., LayoutInfo) immediately after calling this
1906    /// function, even if they have not called [`Present`] or [`SetRootTransform`]. This allows
1907    /// clients to wait for layout information from their parent before calling [`Present`].
1908    ///
1909    /// Any illegal operations on ParentViewportWatcher will cause both ParentViewportWatcher
1910    /// channel and this Flatland channel to be torn down.
1911    ///
1912    /// Lifecycle note. The lifetime of the ParentViewportWatcher channel is bound by the peer
1913    /// ViewportCreationToken. When the ViewportCreationToken dies, this ParentViewportWatcher
1914    /// channel is destroyed.
1915    ///
1916    /// Views and subgraphs of Views created using `CreateView` will not be represented in the
1917    /// ViewTree, and hence will not be able to participate in any ViewTree-dependent interactions
1918    /// such as touch, mouse or focus.
1919    /// The Flatland protocol provides no way for Views in the subgraph of a View created with
1920    /// `CreateView` to know that they are excluded from the ViewTree.
1921    pub fn r#create_view(
1922        &self,
1923        mut token: fidl_fuchsia_ui_views::ViewCreationToken,
1924        mut parent_viewport_watcher: fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>,
1925    ) -> Result<(), fidl::Error> {
1926        self.client.send::<FlatlandCreateViewRequest>(
1927            (&mut token, parent_viewport_watcher),
1928            0x504686eb25864780,
1929            fidl::encoding::DynamicFlags::empty(),
1930        )
1931    }
1932
1933    /// Identical to [`CreateView`], except it allows association of View identity (ViewRef) and
1934    /// view-bound protocols.
1935    pub fn r#create_view2(
1936        &self,
1937        mut token: fidl_fuchsia_ui_views::ViewCreationToken,
1938        mut view_identity: fidl_fuchsia_ui_views::ViewIdentityOnCreation,
1939        mut protocols: ViewBoundProtocols,
1940        mut parent_viewport_watcher: fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>,
1941    ) -> Result<(), fidl::Error> {
1942        self.client.send::<FlatlandCreateView2Request>(
1943            (&mut token, &mut view_identity, &mut protocols, parent_viewport_watcher),
1944            0x340a3a40c2fdbd5e,
1945            fidl::encoding::DynamicFlags::empty(),
1946        )
1947    }
1948
1949    /// Creates a new Transform node. Transforms are a hierarchical piece of a Flatland graph. They
1950    /// can have children, and can reference Content. A sub-graph represented by a Transform and its
1951    /// descendants can be rendered to a display.
1952    ///
1953    /// Transforms are kept alive, even when released, as long as they are children of either an
1954    /// unreleased Transform, or the Root Transform.
1955    ///
1956    /// Each Transform can have a single piece of attached Content. Common types of Content include
1957    /// bitmaps, asynchronous streams of images, and Viewports to Views hosted in other Flatland
1958    /// instances.
1959    ///
1960    /// Transforms have attributes. Child Transforms inherit the combined attributes of their
1961    /// parents. Content attached to a Transform is also affected by that Transform's attributes.
1962    ///
1963    /// When a sub-graph of Transforms is rendered, Content will be rendered back-to-front, starting
1964    /// with the Content on the root transform, and continuing recursively through all of its child
1965    /// Transforms in the order the children were added. See [`AddChild`] for more information.
1966    ///
1967    /// Zero is not a valid transform id. All other values are valid, assuming they are not already
1968    /// in use (see [`ReleaseTransform`] for more details).
1969    pub fn r#create_transform(&self, mut transform_id: &TransformId) -> Result<(), fidl::Error> {
1970        self.client.send::<FlatlandCreateTransformRequest>(
1971            (transform_id,),
1972            0x5e042a4d3de3efb0,
1973            fidl::encoding::DynamicFlags::empty(),
1974        )
1975    }
1976
1977    /// All Transform objects support all attributes.
1978    ///
1979    /// Geometric attributes are applied in the following order:
1980    /// 1. Scale (relative to the parent transform's coordinate space)
1981    /// 2. Orientation (relative to the parent transform's coordinate space)
1982    /// 3. Translation (relative to the parent transforms's coordinate space,
1983    ///    unaffected by scale applied to the current transform).
1984    /// 4. Clipping (relative to the current transform's coordinate space)
1985    ///
1986    /// The effects of each of these attributes are cumulative. This means the transform's position
1987    /// in the view space, and its clip boundary, will be calculated based on that chain of
1988    /// geometric attributes going up to the root transform.
1989    ///
1990    /// For instance, in a nested hierarchy such as the following:
1991    ///     [Root-Transform -> Transform1 -> Transform2 -> CurrentTransform]
1992    /// If Transform1 is translated by [2,0] and Transform2 is translated by [0,1] then the
1993    /// view-space position of CurrentTransform will be [2,1].
1994    ///
1995    /// Sets the translation on a Transform. The order of geometric attribute application is
1996    /// addressed above.
1997    pub fn r#set_translation(
1998        &self,
1999        mut transform_id: &TransformId,
2000        mut translation: &fidl_fuchsia_math::Vec_,
2001    ) -> Result<(), fidl::Error> {
2002        self.client.send::<FlatlandSetTranslationRequest>(
2003            (transform_id, translation),
2004            0x7863398291fba346,
2005            fidl::encoding::DynamicFlags::empty(),
2006        )
2007    }
2008
2009    /// Sets the orientation on a Transform. The order of geometric attribute application is
2010    /// addressed in the documentation for [`SetTranslation`]. In Flatland, the +X axis is
2011    /// to the right and the +Y axis is down. There is no notion of a Z axis. CCW is defined
2012    /// from the POV of the user, as if a skeuomorphoic clock is displayed on the screen.
2013    pub fn r#set_orientation(
2014        &self,
2015        mut transform_id: &TransformId,
2016        mut orientation: Orientation,
2017    ) -> Result<(), fidl::Error> {
2018        self.client.send::<FlatlandSetOrientationRequest>(
2019            (transform_id, orientation),
2020            0x4915310bc4928edc,
2021            fidl::encoding::DynamicFlags::empty(),
2022        )
2023    }
2024
2025    /// Sets the scale on a transform. The order of geometric attribute application is
2026    /// addressed above. The (x,y) values in the VecF |scale| refer to the scale factor in the
2027    /// x-axis (width) and y-axis (height) respectively. Scale values must be normal 32-bit
2028    /// floating point values: https://en.wikipedia.org/wiki/Normal_number_%28computing%29
2029    pub fn r#set_scale(
2030        &self,
2031        mut transform_id: &TransformId,
2032        mut scale: &fidl_fuchsia_math::VecF,
2033    ) -> Result<(), fidl::Error> {
2034        self.client.send::<FlatlandSetScaleRequest>(
2035            (transform_id, scale),
2036            0x1ea1766fd8996bb4,
2037            fidl::encoding::DynamicFlags::empty(),
2038        )
2039    }
2040
2041    /// Sets an opacity in linear space to be applied to a transform and its descendents,
2042    /// which include other transforms and content. Opacity values must be in the range
2043    /// of [0.0, 1.0], where 0.0 is completely transparent and 1.0 is completely opaque.
2044    /// Attempting to call this function with values outside that range will result in
2045    /// an error. A transform's opacity value is multiplied with that of its parent. This
2046    /// effect works differently from group opacity. Using group opacity, child nodes are
2047    /// rendered together first, and then have the parent's opacity applied as a post-effect.
2048    /// Here, opacity is applied to each child individually. This may result in a very
2049    /// different effect.
2050    pub fn r#set_opacity(
2051        &self,
2052        mut transform_id: &TransformId,
2053        mut value: f32,
2054    ) -> Result<(), fidl::Error> {
2055        self.client.send::<FlatlandSetOpacityRequest>(
2056            (transform_id, value),
2057            0x3775fc2c00b432fa,
2058            fidl::encoding::DynamicFlags::empty(),
2059        )
2060    }
2061
2062    /// Sets the bounds, expressed in the local coordinate space of the transform, that
2063    /// constrains the region that content attached to this transform can be rendered to.
2064    /// If the content's area exceeds the clip bounds, the area outside the bounds will
2065    /// not be rendered. These bounds are valid for all children of this transform node as
2066    /// well, which includes nested Flatland instances and their node hierarchies.
2067    /// If a child transform attempts to set clip bounds larger than that of its parent,
2068    /// it will be clipped to the parent's clip bounds. The default state is for a transform
2069    /// to be unclipped, meaning it will not have any bounds placed on its render region.
2070    /// The clip width/height must be positive. Negative values will result in an error.
2071    /// Passing in an empty box to the |rect| parameter will remove the clip bounds.
2072    pub fn r#set_clip_boundary(
2073        &self,
2074        mut transform_id: &TransformId,
2075        mut rect: Option<&fidl_fuchsia_math::Rect>,
2076    ) -> Result<(), fidl::Error> {
2077        self.client.send::<FlatlandSetClipBoundaryRequest>(
2078            (transform_id, rect),
2079            0x6507843df12222d2,
2080            fidl::encoding::DynamicFlags::empty(),
2081        )
2082    }
2083
2084    /// Adds a child Transform to a parent Transform. The new child Transform,
2085    /// and any Content attached to it or its children, will be rendered on top
2086    /// of the parent's Content, as well as any previously added children.
2087    ///
2088    /// The caller must ensure that `child_transform_id` is valid and that there
2089    /// are no repetitions.  Sending a repeated `child_transform_id` over
2090    /// multiple calls will result in session closure.
2091    pub fn r#add_child(
2092        &self,
2093        mut parent_transform_id: &TransformId,
2094        mut child_transform_id: &TransformId,
2095    ) -> Result<(), fidl::Error> {
2096        self.client.send::<FlatlandAddChildRequest>(
2097            (parent_transform_id, child_transform_id),
2098            0x67a8abd2f19b1a74,
2099            fidl::encoding::DynamicFlags::empty(),
2100        )
2101    }
2102
2103    /// Removes a child Transform from a parent Transform.
2104    pub fn r#remove_child(
2105        &self,
2106        mut parent_transform_id: &TransformId,
2107        mut child_transform_id: &TransformId,
2108    ) -> Result<(), fidl::Error> {
2109        self.client.send::<FlatlandRemoveChildRequest>(
2110            (parent_transform_id, child_transform_id),
2111            0x41d6cd90b298b67a,
2112            fidl::encoding::DynamicFlags::empty(),
2113        )
2114    }
2115
2116    /// Removes all child Transforms from a parent Transform and replaces them
2117    /// with the new child transforms in `new_child_transform_ids`.  The caller
2118    /// must ensure that all `TransformId` values in `new_child_transform_ids`
2119    /// are valid and that there are no repetitions.  Sending a repeated
2120    /// `TransformId` in `new_child_transform_ids` will result in session
2121    /// closure.
2122    pub fn r#replace_children(
2123        &self,
2124        mut parent_transform_id: &TransformId,
2125        mut new_child_transform_ids: &[TransformId],
2126    ) -> Result<(), fidl::Error> {
2127        self.client.send::<FlatlandReplaceChildrenRequest>(
2128            (parent_transform_id, new_child_transform_ids),
2129            0x5b6d86cbbff81316,
2130            fidl::encoding::DynamicFlags::empty(),
2131        )
2132    }
2133
2134    /// Sets the Root Transform for the graph.
2135    ///
2136    /// The sub-graph defined by the Root Transform and its children will be rendered as View
2137    /// in the connected parent's Viewport (see [`CreateView`]). Any parents of the Root Transform
2138    /// in this Graph will be ignored.
2139    ///
2140    /// The Root Transform, and all children of the Root Transform, are kept alive if they are
2141    /// released (see [`ReleaseTransform`] for more details).
2142    ///
2143    /// There is only ever one Root. Since 0 is not a valid transform id (see [`CreateTransform`]),
2144    /// calling SetRootTransform(0) clears the current Root, destroying any previously released
2145    /// objects that are not referenced by the new root.
2146    ///
2147    /// Note that every View has a clip boundary equivalent to its logical size. Anything outside
2148    /// that clip boundary will not be rendered. Hence, the Root Transform has a useful coordinate
2149    /// space of (0, 0) to (logical_size.width, logical_size.height), where (0, 0) is the upper left
2150    /// corner.
2151    ///
2152    /// Setting the root transform installs a full screen hit region on the root transform. Clients
2153    /// may remove this hit region if they don't want users to be able to interact with the root
2154    /// transform's content. For additional details on hit regions, see the [`SetHitRegions`]
2155    /// documentation.
2156    ///
2157    /// Default hit region rules
2158    ///
2159    ///   A default hit region follows these rules:
2160    ///   - When [`SetRootTransform`](T) is called, T receives a maximal hit region, covering the
2161    ///   entire view.
2162    ///   - If [`SetHitRegions`] is called on T, either before or after [`SetRootTransform`](T),
2163    ///   then no default hit region is active and the client specified hit regions are used.
2164    ///   - If a transform is no longer the root transform, i.e., [`SetRootTransform`](U) is
2165    ///   called, then the original transform no longer has its default hit region.
2166    ///   - Clients can remove or modify the root transform's hit regions the same way they would
2167    ///   reset any other transform's hit regions, by calling [`SetHitRegions`] with the appropriate
2168    ///   vector.
2169    pub fn r#set_root_transform(&self, mut transform_id: &TransformId) -> Result<(), fidl::Error> {
2170        self.client.send::<FlatlandSetRootTransformRequest>(
2171            (transform_id,),
2172            0x6e80ca5bcc566cd8,
2173            fidl::encoding::DynamicFlags::empty(),
2174        )
2175    }
2176
2177    /// Sets the interactive areas for a Transform. By default, Content is not interactive; hit
2178    /// regions must be placed for a user to interact with the Content in a View. Because hit
2179    /// regions are described in the Flatland protocol, a Flatland instance can synchronize Content
2180    /// and hit regions.
2181    ///
2182    /// Each hit region is placed in the coordinate space of the owning Transform, and may or may
2183    /// not interact with different types of hit testing, depending on its [`HitTestInteraction`]
2184    /// type. When there are multiple hit regions that intersect with a hit test, the precedence
2185    /// rules given below dictate which hit region has interacted with the hit test. Only Transforms
2186    /// that transitively connect to the root Transform have their hit regions interact with a hit
2187    /// test.
2188    ///
2189    /// Calling this function replaces any previous values set on this Transform. To reset a
2190    /// Transform to "no hit testing": send an empty vector with [`SetHitRegions`].
2191    ///
2192    /// Note that root transforms get a default hit region installed by Flatland. For more details,
2193    /// see the [`SetRootTransform`] documentation.
2194    ///
2195    /// Precedence rules
2196    ///   Within a Transform, if multiple hit regions overlap, the hit test examines each
2197    ///   intersecting hit region for a possible interaction. Thus, for a regular hit test R and an
2198    ///   accessibility hit test A, where R and A both intersect two hit regions D ([`DEFAULT`]) and
2199    ///   S ([`SEMANTICALLY_INVISIBLE`]) on the same Transform, (1) R interacts with both D and S,
2200    ///   and (2) A only interacts with D. Generally, hit regions that overlap in a single Transform
2201    ///   can cause confusing behavior.
2202    ///
2203    ///   Within a View, for a given hit test, the front-most Transform's hit regions take
2204    ///   precedence over those behind. This follows the expected reverse "render order" of
2205    ///   Transforms (described in [`CreateTransform`]), where a user expects to interact with
2206    ///   Content that is visible, or front-most.
2207    ///
2208    ///   Across Flatland instances, for a given hit test, the front-most instance's front-most
2209    ///   Transform's hit regions take precedence over those behind. This follows the expected
2210    ///   reverse "render order" of views, where a user expects to interact with the View that is
2211    ///   visible, or front-most. For example, if a child View owns Content that is rendered over
2212    ///   the parent View, the user expects to interact with the child's Content.
2213    pub fn r#set_hit_regions(
2214        &self,
2215        mut transform_id: &TransformId,
2216        mut regions: &[HitRegion],
2217    ) -> Result<(), fidl::Error> {
2218        self.client.send::<FlatlandSetHitRegionsRequest>(
2219            (transform_id, regions),
2220            0x31c9d17b07c37ce4,
2221            fidl::encoding::DynamicFlags::empty(),
2222        )
2223    }
2224
2225    /// Identical to [`SetHitRegions`], except the hit region associated with [`transform_id`]
2226    /// covers an infinite region. The hit region is invariant against translation, scaling, and
2227    /// orientation of the Transform.
2228    ///
2229    /// An infinite hit region is still limited in extent by the View's clip boundary, just like a
2230    /// finite hit region.
2231    ///
2232    /// Calling this function replaces any previous values set on this Transform. To reset a
2233    /// Transform to "no hit testing": send an empty vector with [`SetHitRegions`].
2234    pub fn r#set_infinite_hit_region(
2235        &self,
2236        mut transform_id: &TransformId,
2237        mut hit_test: HitTestInteraction,
2238    ) -> Result<(), fidl::Error> {
2239        self.client.send::<FlatlandSetInfiniteHitRegionRequest>(
2240            (transform_id, hit_test),
2241            0x26d81af852d29562,
2242            fidl::encoding::DynamicFlags::empty(),
2243        )
2244    }
2245
2246    /// The Viewport and View pair, together, represent the connection between two Flatland
2247    /// instances. The Viewport is created in the parent, and the View is created in the child. The
2248    /// parent has control over how the child's View is integrated into its own View.
2249    ///
2250    /// Any illegal operations on ChildViewWatcher will cause both ChildViewWatcher channel and this
2251    /// Flatland channel to be torn down.
2252    ///
2253    /// `ViewportProperties` must have logical_size set. This is the initial size that will drive
2254    /// the layout of the child. The logical_size is also used as the default Content size, but
2255    /// subsequent changes to the logical_size will have no effect on the Content size.
2256    ///
2257    /// `ViewportProperties` may have inset field not set. In that case, the default value of
2258    /// (0, 0, 0, 0) is used.
2259    ///
2260    /// The logical_size must have positive X and Y components.
2261    ///
2262    /// Zero is not a valid ContentId. All other values are valid, assuming they are not already
2263    /// in use for another piece of Content (see [`ReleaseViewport`] for more details).
2264    ///
2265    /// Lifecycle note. The lifetime of the ChildViewWatcher channel is bound by the peer
2266    /// ViewCreationToken. When the ViewCreationToken dies, this ChildViewWatcher channel is
2267    /// destroyed.
2268    pub fn r#create_viewport(
2269        &self,
2270        mut viewport_id: &ContentId,
2271        mut token: fidl_fuchsia_ui_views::ViewportCreationToken,
2272        mut properties: &ViewportProperties,
2273        mut child_view_watcher: fidl::endpoints::ServerEnd<ChildViewWatcherMarker>,
2274    ) -> Result<(), fidl::Error> {
2275        self.client.send::<FlatlandCreateViewportRequest>(
2276            (viewport_id, &mut token, properties, child_view_watcher),
2277            0x2485fbcab7f943c,
2278            fidl::encoding::DynamicFlags::empty(),
2279        )
2280    }
2281
2282    /// An Image is a bitmap backed by a specific VMO in a BufferCollection.
2283    ///
2284    /// Image creation requires an allocated BufferCollection registered with Allocator. This
2285    /// function will fail unless all clients of the specified BufferCollection have set their
2286    /// constraints.
2287    ///
2288    /// The Image must reference a valid VMO index and must have ImageProperties that fall within
2289    /// the constraints specified by the backing BufferCollection (i.e. width and height within a
2290    /// valid range, etc.)
2291    ///
2292    /// Zero is not a valid Image id. All other values are valid, assuming they are not already in
2293    /// use for another piece of Content (see [`ReleaseImage`] for more details).
2294    pub fn r#create_image(
2295        &self,
2296        mut image_id: &ContentId,
2297        mut import_token: BufferCollectionImportToken,
2298        mut vmo_index: u32,
2299        mut properties: &ImageProperties,
2300    ) -> Result<(), fidl::Error> {
2301        self.client.send::<FlatlandCreateImageRequest>(
2302            (image_id, &mut import_token, vmo_index, properties),
2303            0x26fae823c4ebedad,
2304            fidl::encoding::DynamicFlags::empty(),
2305        )
2306    }
2307
2308    /// This function is used to determine the region (in texel space) of an image that will be used
2309    /// by Flatland when rendering. The image to be sampled is referenced by [`image_id`] and the
2310    /// sample region is specified by [`rect`] which itself is comprised of an origin point (x,y) as
2311    /// well as a width and height, in unnormalized coordinates. It is illegal to call this function
2312    /// on non-image content, or to sample a region outside of the texel space of the image. In
2313    /// other words, the region specifed by [`rect`] must not exceed the ranges (0, image_width) and
2314    /// (0, image_height). If (rect.x + rect.width > image_width) or (rect.y + rect.height >
2315    /// image_height) or if any of the values are negative, this will result in an error.
2316    ///
2317    /// If this method is not called, the default sample region is the rectangle with origin at
2318    /// (0, 0) and width and height set at ImageProperties from [`CreateImage`].
2319    pub fn r#set_image_sample_region(
2320        &self,
2321        mut image_id: &ContentId,
2322        mut rect: &fidl_fuchsia_math::RectF,
2323    ) -> Result<(), fidl::Error> {
2324        self.client.send::<FlatlandSetImageSampleRegionRequest>(
2325            (image_id, rect),
2326            0x8039391d715eb28,
2327            fidl::encoding::DynamicFlags::empty(),
2328        )
2329    }
2330
2331    /// The content size for an Image is the size of the rectangle in the parent's logical
2332    /// coordinate space that the image occupies. This combined with the global translation of the
2333    /// transform it is attached to determines the size and location of where the content is
2334    /// rendered on the display.
2335    ///
2336    /// If this method is not called, the default image destination size is the width and height set
2337    /// at ImageProperties from [`CreateImage`]. The destination size will be affected by scaling if
2338    /// [`SetScale`] is used on the attached Transform or its parents.
2339    pub fn r#set_image_destination_size(
2340        &self,
2341        mut image_id: &ContentId,
2342        mut size: &fidl_fuchsia_math::SizeU,
2343    ) -> Result<(), fidl::Error> {
2344        self.client.send::<FlatlandSetImageDestinationSizeRequest>(
2345            (image_id, size),
2346            0x766cf99a2ec58446,
2347            fidl::encoding::DynamicFlags::empty(),
2348        )
2349    }
2350
2351    /// Determines the blend function to use when rendering the content specified by
2352    /// |image_id|. |image_id| must be a valid ContentId associated to a transform through
2353    /// a call to |CreateImage| or |CreateFilledRect|. For details on the different blend functions
2354    /// that are available, please refer to the BlendMode enum. If this function is not called, then
2355    /// the default blendmode is BlendMode::SRC.
2356    pub fn r#set_image_blending_function(
2357        &self,
2358        mut image_id: &ContentId,
2359        mut blend_mode: BlendMode,
2360    ) -> Result<(), fidl::Error> {
2361        self.client.send::<FlatlandSetImageBlendingFunctionRequest>(
2362            (image_id, blend_mode),
2363            0x10f5da1356275b7b,
2364            fidl::encoding::DynamicFlags::empty(),
2365        )
2366    }
2367
2368    /// Determines the blend function to use when rendering the content specified by
2369    /// |image_id|. |image_id| must be a valid ContentId associated to a transform through
2370    /// a call to |CreateImage| or |CreateFilledRect|. For details on the different blend functions
2371    /// that are available, please refer to the BlendMode2 enum. If this function is not called,
2372    /// the default blendmode is BlendMode2::REPLACE.
2373    pub fn r#set_image_blend_mode(
2374        &self,
2375        mut image_id: &ContentId,
2376        mut blend_mode: BlendMode2,
2377    ) -> Result<(), fidl::Error> {
2378        self.client.send::<FlatlandSetImageBlendModeRequest>(
2379            (image_id, blend_mode),
2380            0x5b1667f130c3de67,
2381            fidl::encoding::DynamicFlags::empty(),
2382        )
2383    }
2384
2385    /// Sets an opacity in linear space to be applied to a flatland image. Opacity values must
2386    /// be in the range [0.0, 1.0].
2387    pub fn r#set_image_opacity(
2388        &self,
2389        mut image_id: &ContentId,
2390        mut val: f32,
2391    ) -> Result<(), fidl::Error> {
2392        self.client.send::<FlatlandSetImageOpacityRequest>(
2393            (image_id, val),
2394            0x2da9e4ef4c2cff6f,
2395            fidl::encoding::DynamicFlags::empty(),
2396        )
2397    }
2398
2399    /// Sets the image flip to be applied to a flatland image. This call must be performed after a
2400    /// successful |CreateImage| call. If an invalid |image_id| is supplied, the channel will be
2401    /// closed due to FlatlandError::BAD_OPERATION. This flip will be applied to the Image before
2402    /// parent Transform Orientations. If this function is not called, then the default flip value
2403    /// is ImageFlip::NONE.
2404    pub fn r#set_image_flip(
2405        &self,
2406        mut image_id: &ContentId,
2407        mut flip: ImageFlip,
2408    ) -> Result<(), fidl::Error> {
2409        self.client.send::<FlatlandSetImageFlipRequest>(
2410            (image_id, flip),
2411            0x21b20f2c14aae6bc,
2412            fidl::encoding::DynamicFlags::empty(),
2413        )
2414    }
2415
2416    /// Creates a solid-color rectangle. By default a filled-rect does not have a defined
2417    /// color or size. It is necessary to call |SetSolidFill| to specify a color and size
2418    /// before a filled rect can be used for rendering. Not doing so will result the
2419    pub fn r#create_filled_rect(&self, mut rect_id: &ContentId) -> Result<(), fidl::Error> {
2420        self.client.send::<FlatlandCreateFilledRectRequest>(
2421            (rect_id,),
2422            0x5e62355abc1c4c5d,
2423            fidl::encoding::DynamicFlags::empty(),
2424        )
2425    }
2426
2427    /// Defines the color and size of a filled rect. |rect_id| must refer to content that
2428    /// was created via a call to CreateFilledRect. The color is not premultiplied. Color values
2429    /// must be within the range [0,1] inclusive, and normal 32-bit
2430    /// floating point values: https://en.wikipedia.org/wiki/Normal_number_%28computing%29. Values
2431    /// that do not conform to these specifications will cause the channel to close.
2432    /// The rectangle's top left corner will be at (0, 0) in its transform's coordinate space.
2433    /// Hence, its bottom right corner will be at (size.width, size.height).
2434    pub fn r#set_solid_fill(
2435        &self,
2436        mut rect_id: &ContentId,
2437        mut color: &ColorRgba,
2438        mut size: &fidl_fuchsia_math::SizeU,
2439    ) -> Result<(), fidl::Error> {
2440        self.client.send::<FlatlandSetSolidFillRequest>(
2441            (rect_id, color, size),
2442            0x32d6ef41e182dfa5,
2443            fidl::encoding::DynamicFlags::empty(),
2444        )
2445    }
2446
2447    /// Automatically garbage collects the rectangle when it is no longer needed for
2448    /// rendering. |rect_id| must have been instantiated with a call to
2449    /// |CreateFilledRect|. Once released, the ID immediately goes out of scope and is free
2450    /// to be used again.
2451    pub fn r#release_filled_rect(&self, mut rect_id: &ContentId) -> Result<(), fidl::Error> {
2452        self.client.send::<FlatlandReleaseFilledRectRequest>(
2453            (rect_id,),
2454            0x7392cabe45618f9b,
2455            fidl::encoding::DynamicFlags::empty(),
2456        )
2457    }
2458
2459    /// Setting a piece of Content on a Transform makes that Content visible in the render tree as
2460    /// long as the Transform is visible from the root Transform. The Content will be rendered
2461    /// before, and therefore "behind", any Content attached to the descendants of the Transform.
2462    ///
2463    /// Because each Transform can have, at most, a single piece of Content on it, calling this
2464    /// function on a Transform that already has Content will replace that Content.
2465    ///
2466    /// A Content may be set on more than one Transform.
2467    ///
2468    /// Calling this function with a Content id of 0 will remove any Content currently on the
2469    /// Transform.
2470    pub fn r#set_content(
2471        &self,
2472        mut transform_id: &TransformId,
2473        mut content_id: &ContentId,
2474    ) -> Result<(), fidl::Error> {
2475        self.client.send::<FlatlandSetContentRequest>(
2476            (transform_id, content_id),
2477            0x4ed2cfc0ce130862,
2478            fidl::encoding::DynamicFlags::empty(),
2479        )
2480    }
2481
2482    /// Transforms are usually sufficient to change how Content is presented. Viewports, however,
2483    /// have special properties that are not part of the Transform hierarchy. Those properties can
2484    /// be set using this function.
2485    pub fn r#set_viewport_properties(
2486        &self,
2487        mut viewport_id: &ContentId,
2488        mut properties: &ViewportProperties,
2489    ) -> Result<(), fidl::Error> {
2490        self.client.send::<FlatlandSetViewportPropertiesRequest>(
2491            (viewport_id, properties),
2492            0x66ab67e9608ddb9f,
2493            fidl::encoding::DynamicFlags::empty(),
2494        )
2495    }
2496
2497    /// Released Transforms will be garbage collected by the system once they are no longer
2498    /// necessary for rendering. For Transforms, this means there is no path from any unreleased
2499    /// Transform to the newly-released Transform.
2500    ///
2501    /// Once released, the id immediately goes out of scope for future function calls and can be
2502    /// reused when creating new Transforms.
2503    ///
2504    /// It is an error to call functions with a released id (unless that id has been reused to
2505    /// construct a new Transform).
2506    pub fn r#release_transform(&self, mut transform_id: &TransformId) -> Result<(), fidl::Error> {
2507        self.client.send::<FlatlandReleaseTransformRequest>(
2508            (transform_id,),
2509            0xab9328419451c22,
2510            fidl::encoding::DynamicFlags::empty(),
2511        )
2512    }
2513
2514    pub fn r#release_view(&self) -> Result<(), fidl::Error> {
2515        self.client.send::<fidl::encoding::EmptyPayload>(
2516            (),
2517            0x5b35aab9baffecae,
2518            fidl::encoding::DynamicFlags::empty(),
2519        )
2520    }
2521
2522    /// Releases a Viewport from the scene, even if the Viewport is still connected to a Transform.
2523    /// Unlike other resources, Viewports are garbage collected by the system during the next
2524    /// [`Present`] because a removed Viewport is guaranteed to provide no renderable content.
2525    ///
2526    /// Use SetContent(transform_id, 0) to clean up references to released Viewports.
2527    ///
2528    /// Despite having a return type, this function is still feed-forward like [`CreateView`] and
2529    /// requires a call to [`Present`] to be executed. The ViewportCreationToken will be returned
2530    /// after the presented operations have been executed.
2531    pub fn r#release_viewport(
2532        &self,
2533        mut viewport_id: &ContentId,
2534        ___deadline: zx::MonotonicInstant,
2535    ) -> Result<fidl_fuchsia_ui_views::ViewportCreationToken, fidl::Error> {
2536        let _response = self.client.send_query::<
2537            FlatlandReleaseViewportRequest,
2538            FlatlandReleaseViewportResponse,
2539            FlatlandMarker,
2540        >(
2541            (viewport_id,),
2542            0xbad474aeb5293f9,
2543            fidl::encoding::DynamicFlags::empty(),
2544            ___deadline,
2545        )?;
2546        Ok(_response.token)
2547    }
2548
2549    /// Released Images will be garbage collected by the system once they are no longer necessary
2550    /// for rendering. For Images, this means the Image is no longer attached to any Transform and
2551    /// any pending rendering that references the Image is complete.
2552    ///
2553    /// Use SetContent(transform_id, 0) to clean up references to released Images.
2554    ///
2555    /// Once released, the id immediately goes out of scope for future function calls and can be
2556    /// reused when creating new Images.
2557    ///
2558    /// It is an error to call functions with a released id (unless that id has been reused to
2559    /// construct a new Image).
2560    pub fn r#release_image(&self, mut image_id: &ContentId) -> Result<(), fidl::Error> {
2561        self.client.send::<FlatlandReleaseImageRequest>(
2562            (image_id,),
2563            0xb884ffdbc72c111,
2564            fidl::encoding::DynamicFlags::empty(),
2565        )
2566    }
2567
2568    /// This function will reset all state on this interface. This includes destroying all existing
2569    /// View and Viewports without returning the associated Token to the caller.
2570    pub fn r#clear(&self) -> Result<(), fidl::Error> {
2571        self.client.send::<fidl::encoding::EmptyPayload>(
2572            (),
2573            0x4ec8817c02828c3e,
2574            fidl::encoding::DynamicFlags::empty(),
2575        )
2576    }
2577
2578    /// Set debug name of the current client that can be used by Flatland to print as a prefix to
2579    /// logs to help client distinguish what is theirs. [`name`] can be an arbitrary string, but the
2580    /// current process name (see fsl::GetCurrentProcessName()) is a good default.
2581    pub fn r#set_debug_name(&self, mut name: &str) -> Result<(), fidl::Error> {
2582        self.client.send::<FlatlandSetDebugNameRequest>(
2583            (name,),
2584            0x46a8b397e68a8888,
2585            fidl::encoding::DynamicFlags::empty(),
2586        )
2587    }
2588}
2589
2590#[cfg(target_os = "fuchsia")]
2591impl From<FlatlandSynchronousProxy> for zx::NullableHandle {
2592    fn from(value: FlatlandSynchronousProxy) -> Self {
2593        value.into_channel().into()
2594    }
2595}
2596
2597#[cfg(target_os = "fuchsia")]
2598impl From<fidl::Channel> for FlatlandSynchronousProxy {
2599    fn from(value: fidl::Channel) -> Self {
2600        Self::new(value)
2601    }
2602}
2603
2604#[cfg(target_os = "fuchsia")]
2605impl fidl::endpoints::FromClient for FlatlandSynchronousProxy {
2606    type Protocol = FlatlandMarker;
2607
2608    fn from_client(value: fidl::endpoints::ClientEnd<FlatlandMarker>) -> Self {
2609        Self::new(value.into_channel())
2610    }
2611}
2612
2613#[derive(Debug, Clone)]
2614pub struct FlatlandProxy {
2615    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2616}
2617
2618impl fidl::endpoints::Proxy for FlatlandProxy {
2619    type Protocol = FlatlandMarker;
2620
2621    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2622        Self::new(inner)
2623    }
2624
2625    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2626        self.client.into_channel().map_err(|client| Self { client })
2627    }
2628
2629    fn as_channel(&self) -> &::fidl::AsyncChannel {
2630        self.client.as_channel()
2631    }
2632}
2633
2634impl FlatlandProxy {
2635    /// Create a new Proxy for fuchsia.ui.composition/Flatland.
2636    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2637        let protocol_name = <FlatlandMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2638        Self { client: fidl::client::Client::new(channel, protocol_name) }
2639    }
2640
2641    /// Get a Stream of events from the remote end of the protocol.
2642    ///
2643    /// # Panics
2644    ///
2645    /// Panics if the event stream was already taken.
2646    pub fn take_event_stream(&self) -> FlatlandEventStream {
2647        FlatlandEventStream { event_receiver: self.client.take_event_receiver() }
2648    }
2649
2650    /// Releases an image immediately, without waiting for the next present.
2651    pub fn r#release_image_immediately(&self, mut image_id: &ContentId) -> Result<(), fidl::Error> {
2652        FlatlandProxyInterface::r#release_image_immediately(self, image_id)
2653    }
2654
2655    /// Complete execution of all feed-forward operations.
2656    ///
2657    /// If executing an operation produces an error (e.g., CreateTransform(0)), an [`OnError`] event
2658    /// is emitted. Operations that produce errors are ignored and the channel is closed.
2659    ///
2660    /// If the execution is completed successfully, [`OnNextFrameBegin`] emits NO_ERROR along
2661    /// with other valid fields.
2662    ///
2663    /// The client may only call [`Present`] when they have a non-zero number of present credits,
2664    /// which are tracked by the server. The server may increment the number of credits when it
2665    /// fires the [`OnNextFrameBegin`] event, which informs the client when it receives additional
2666    /// present credits. Each [`Present`] call uses one present credit and decrements the server
2667    /// count by one. If the client calls [`Present`] with no present credits, the server will
2668    /// return a `NO_PRESENTS_REMAINING` error.
2669    ///
2670    /// The client should assume that prior to receiving any [`OnNextFrameBegin`] events, they have
2671    /// one present credit.
2672    ///
2673    /// Every [`Present`] call results in one [`OnNextFrameBegin`] event, and one
2674    /// [`OnFramePresented`] event, typically in that order.
2675    ///
2676    /// When the commands flushed by [`Present`] make it to display, an [`OnFramePresented`] event
2677    /// is fired. This event includes information pertaining to all [`Present`]s that had content
2678    /// that were part of that frame.
2679    ///
2680    /// See [`fuchsia.ui.composition/PresentArgs`] documentation above for more detailed information
2681    /// on what arguments are passed in and their role.
2682    pub fn r#present(&self, mut args: PresentArgs) -> Result<(), fidl::Error> {
2683        FlatlandProxyInterface::r#present(self, args)
2684    }
2685
2686    /// Two Flatland instances may be connected in a parent-child relationship. The parent endpoint
2687    /// is held in a Viewport, and the child endpoint is held in a View. The parent Flatland
2688    /// instance that creates a Viewport has control over how the child's View is integrated into
2689    /// its own View.
2690    ///
2691    /// The lifecycle of a parent-child connection starts with two endpoints of a channel object:
2692    /// a ViewportCreationToken and a ViewCreationToken. Out-of-band protocols pass the
2693    /// ViewportCreationToken to the parent, which calls [`CreateViewport`], and the
2694    /// ViewCreationToken to the child, which calls [`CreateView`].
2695    ///
2696    /// Only nodes connected to the Root Transform in this Flatland instance will be rendered into
2697    /// the parent's Viewport.
2698    ///
2699    /// Calling [`CreateView`] a second time will disconnect the Root Transform from the existing
2700    /// parent's Viewport, and attach it to a new parent's Viewport. In other words, each View can
2701    /// only have one parent.
2702    ///
2703    /// This function is queued, meaning that the Root Transform will not be attached to the
2704    /// parent Viewport until [`Present`] is called. However, clients will receive information
2705    /// through their ParentViewportWatcher (e.g., LayoutInfo) immediately after calling this
2706    /// function, even if they have not called [`Present`] or [`SetRootTransform`]. This allows
2707    /// clients to wait for layout information from their parent before calling [`Present`].
2708    ///
2709    /// Any illegal operations on ParentViewportWatcher will cause both ParentViewportWatcher
2710    /// channel and this Flatland channel to be torn down.
2711    ///
2712    /// Lifecycle note. The lifetime of the ParentViewportWatcher channel is bound by the peer
2713    /// ViewportCreationToken. When the ViewportCreationToken dies, this ParentViewportWatcher
2714    /// channel is destroyed.
2715    ///
2716    /// Views and subgraphs of Views created using `CreateView` will not be represented in the
2717    /// ViewTree, and hence will not be able to participate in any ViewTree-dependent interactions
2718    /// such as touch, mouse or focus.
2719    /// The Flatland protocol provides no way for Views in the subgraph of a View created with
2720    /// `CreateView` to know that they are excluded from the ViewTree.
2721    pub fn r#create_view(
2722        &self,
2723        mut token: fidl_fuchsia_ui_views::ViewCreationToken,
2724        mut parent_viewport_watcher: fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>,
2725    ) -> Result<(), fidl::Error> {
2726        FlatlandProxyInterface::r#create_view(self, token, parent_viewport_watcher)
2727    }
2728
2729    /// Identical to [`CreateView`], except it allows association of View identity (ViewRef) and
2730    /// view-bound protocols.
2731    pub fn r#create_view2(
2732        &self,
2733        mut token: fidl_fuchsia_ui_views::ViewCreationToken,
2734        mut view_identity: fidl_fuchsia_ui_views::ViewIdentityOnCreation,
2735        mut protocols: ViewBoundProtocols,
2736        mut parent_viewport_watcher: fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>,
2737    ) -> Result<(), fidl::Error> {
2738        FlatlandProxyInterface::r#create_view2(
2739            self,
2740            token,
2741            view_identity,
2742            protocols,
2743            parent_viewport_watcher,
2744        )
2745    }
2746
2747    /// Creates a new Transform node. Transforms are a hierarchical piece of a Flatland graph. They
2748    /// can have children, and can reference Content. A sub-graph represented by a Transform and its
2749    /// descendants can be rendered to a display.
2750    ///
2751    /// Transforms are kept alive, even when released, as long as they are children of either an
2752    /// unreleased Transform, or the Root Transform.
2753    ///
2754    /// Each Transform can have a single piece of attached Content. Common types of Content include
2755    /// bitmaps, asynchronous streams of images, and Viewports to Views hosted in other Flatland
2756    /// instances.
2757    ///
2758    /// Transforms have attributes. Child Transforms inherit the combined attributes of their
2759    /// parents. Content attached to a Transform is also affected by that Transform's attributes.
2760    ///
2761    /// When a sub-graph of Transforms is rendered, Content will be rendered back-to-front, starting
2762    /// with the Content on the root transform, and continuing recursively through all of its child
2763    /// Transforms in the order the children were added. See [`AddChild`] for more information.
2764    ///
2765    /// Zero is not a valid transform id. All other values are valid, assuming they are not already
2766    /// in use (see [`ReleaseTransform`] for more details).
2767    pub fn r#create_transform(&self, mut transform_id: &TransformId) -> Result<(), fidl::Error> {
2768        FlatlandProxyInterface::r#create_transform(self, transform_id)
2769    }
2770
2771    /// All Transform objects support all attributes.
2772    ///
2773    /// Geometric attributes are applied in the following order:
2774    /// 1. Scale (relative to the parent transform's coordinate space)
2775    /// 2. Orientation (relative to the parent transform's coordinate space)
2776    /// 3. Translation (relative to the parent transforms's coordinate space,
2777    ///    unaffected by scale applied to the current transform).
2778    /// 4. Clipping (relative to the current transform's coordinate space)
2779    ///
2780    /// The effects of each of these attributes are cumulative. This means the transform's position
2781    /// in the view space, and its clip boundary, will be calculated based on that chain of
2782    /// geometric attributes going up to the root transform.
2783    ///
2784    /// For instance, in a nested hierarchy such as the following:
2785    ///     [Root-Transform -> Transform1 -> Transform2 -> CurrentTransform]
2786    /// If Transform1 is translated by [2,0] and Transform2 is translated by [0,1] then the
2787    /// view-space position of CurrentTransform will be [2,1].
2788    ///
2789    /// Sets the translation on a Transform. The order of geometric attribute application is
2790    /// addressed above.
2791    pub fn r#set_translation(
2792        &self,
2793        mut transform_id: &TransformId,
2794        mut translation: &fidl_fuchsia_math::Vec_,
2795    ) -> Result<(), fidl::Error> {
2796        FlatlandProxyInterface::r#set_translation(self, transform_id, translation)
2797    }
2798
2799    /// Sets the orientation on a Transform. The order of geometric attribute application is
2800    /// addressed in the documentation for [`SetTranslation`]. In Flatland, the +X axis is
2801    /// to the right and the +Y axis is down. There is no notion of a Z axis. CCW is defined
2802    /// from the POV of the user, as if a skeuomorphoic clock is displayed on the screen.
2803    pub fn r#set_orientation(
2804        &self,
2805        mut transform_id: &TransformId,
2806        mut orientation: Orientation,
2807    ) -> Result<(), fidl::Error> {
2808        FlatlandProxyInterface::r#set_orientation(self, transform_id, orientation)
2809    }
2810
2811    /// Sets the scale on a transform. The order of geometric attribute application is
2812    /// addressed above. The (x,y) values in the VecF |scale| refer to the scale factor in the
2813    /// x-axis (width) and y-axis (height) respectively. Scale values must be normal 32-bit
2814    /// floating point values: https://en.wikipedia.org/wiki/Normal_number_%28computing%29
2815    pub fn r#set_scale(
2816        &self,
2817        mut transform_id: &TransformId,
2818        mut scale: &fidl_fuchsia_math::VecF,
2819    ) -> Result<(), fidl::Error> {
2820        FlatlandProxyInterface::r#set_scale(self, transform_id, scale)
2821    }
2822
2823    /// Sets an opacity in linear space to be applied to a transform and its descendents,
2824    /// which include other transforms and content. Opacity values must be in the range
2825    /// of [0.0, 1.0], where 0.0 is completely transparent and 1.0 is completely opaque.
2826    /// Attempting to call this function with values outside that range will result in
2827    /// an error. A transform's opacity value is multiplied with that of its parent. This
2828    /// effect works differently from group opacity. Using group opacity, child nodes are
2829    /// rendered together first, and then have the parent's opacity applied as a post-effect.
2830    /// Here, opacity is applied to each child individually. This may result in a very
2831    /// different effect.
2832    pub fn r#set_opacity(
2833        &self,
2834        mut transform_id: &TransformId,
2835        mut value: f32,
2836    ) -> Result<(), fidl::Error> {
2837        FlatlandProxyInterface::r#set_opacity(self, transform_id, value)
2838    }
2839
2840    /// Sets the bounds, expressed in the local coordinate space of the transform, that
2841    /// constrains the region that content attached to this transform can be rendered to.
2842    /// If the content's area exceeds the clip bounds, the area outside the bounds will
2843    /// not be rendered. These bounds are valid for all children of this transform node as
2844    /// well, which includes nested Flatland instances and their node hierarchies.
2845    /// If a child transform attempts to set clip bounds larger than that of its parent,
2846    /// it will be clipped to the parent's clip bounds. The default state is for a transform
2847    /// to be unclipped, meaning it will not have any bounds placed on its render region.
2848    /// The clip width/height must be positive. Negative values will result in an error.
2849    /// Passing in an empty box to the |rect| parameter will remove the clip bounds.
2850    pub fn r#set_clip_boundary(
2851        &self,
2852        mut transform_id: &TransformId,
2853        mut rect: Option<&fidl_fuchsia_math::Rect>,
2854    ) -> Result<(), fidl::Error> {
2855        FlatlandProxyInterface::r#set_clip_boundary(self, transform_id, rect)
2856    }
2857
2858    /// Adds a child Transform to a parent Transform. The new child Transform,
2859    /// and any Content attached to it or its children, will be rendered on top
2860    /// of the parent's Content, as well as any previously added children.
2861    ///
2862    /// The caller must ensure that `child_transform_id` is valid and that there
2863    /// are no repetitions.  Sending a repeated `child_transform_id` over
2864    /// multiple calls will result in session closure.
2865    pub fn r#add_child(
2866        &self,
2867        mut parent_transform_id: &TransformId,
2868        mut child_transform_id: &TransformId,
2869    ) -> Result<(), fidl::Error> {
2870        FlatlandProxyInterface::r#add_child(self, parent_transform_id, child_transform_id)
2871    }
2872
2873    /// Removes a child Transform from a parent Transform.
2874    pub fn r#remove_child(
2875        &self,
2876        mut parent_transform_id: &TransformId,
2877        mut child_transform_id: &TransformId,
2878    ) -> Result<(), fidl::Error> {
2879        FlatlandProxyInterface::r#remove_child(self, parent_transform_id, child_transform_id)
2880    }
2881
2882    /// Removes all child Transforms from a parent Transform and replaces them
2883    /// with the new child transforms in `new_child_transform_ids`.  The caller
2884    /// must ensure that all `TransformId` values in `new_child_transform_ids`
2885    /// are valid and that there are no repetitions.  Sending a repeated
2886    /// `TransformId` in `new_child_transform_ids` will result in session
2887    /// closure.
2888    pub fn r#replace_children(
2889        &self,
2890        mut parent_transform_id: &TransformId,
2891        mut new_child_transform_ids: &[TransformId],
2892    ) -> Result<(), fidl::Error> {
2893        FlatlandProxyInterface::r#replace_children(
2894            self,
2895            parent_transform_id,
2896            new_child_transform_ids,
2897        )
2898    }
2899
2900    /// Sets the Root Transform for the graph.
2901    ///
2902    /// The sub-graph defined by the Root Transform and its children will be rendered as View
2903    /// in the connected parent's Viewport (see [`CreateView`]). Any parents of the Root Transform
2904    /// in this Graph will be ignored.
2905    ///
2906    /// The Root Transform, and all children of the Root Transform, are kept alive if they are
2907    /// released (see [`ReleaseTransform`] for more details).
2908    ///
2909    /// There is only ever one Root. Since 0 is not a valid transform id (see [`CreateTransform`]),
2910    /// calling SetRootTransform(0) clears the current Root, destroying any previously released
2911    /// objects that are not referenced by the new root.
2912    ///
2913    /// Note that every View has a clip boundary equivalent to its logical size. Anything outside
2914    /// that clip boundary will not be rendered. Hence, the Root Transform has a useful coordinate
2915    /// space of (0, 0) to (logical_size.width, logical_size.height), where (0, 0) is the upper left
2916    /// corner.
2917    ///
2918    /// Setting the root transform installs a full screen hit region on the root transform. Clients
2919    /// may remove this hit region if they don't want users to be able to interact with the root
2920    /// transform's content. For additional details on hit regions, see the [`SetHitRegions`]
2921    /// documentation.
2922    ///
2923    /// Default hit region rules
2924    ///
2925    ///   A default hit region follows these rules:
2926    ///   - When [`SetRootTransform`](T) is called, T receives a maximal hit region, covering the
2927    ///   entire view.
2928    ///   - If [`SetHitRegions`] is called on T, either before or after [`SetRootTransform`](T),
2929    ///   then no default hit region is active and the client specified hit regions are used.
2930    ///   - If a transform is no longer the root transform, i.e., [`SetRootTransform`](U) is
2931    ///   called, then the original transform no longer has its default hit region.
2932    ///   - Clients can remove or modify the root transform's hit regions the same way they would
2933    ///   reset any other transform's hit regions, by calling [`SetHitRegions`] with the appropriate
2934    ///   vector.
2935    pub fn r#set_root_transform(&self, mut transform_id: &TransformId) -> Result<(), fidl::Error> {
2936        FlatlandProxyInterface::r#set_root_transform(self, transform_id)
2937    }
2938
2939    /// Sets the interactive areas for a Transform. By default, Content is not interactive; hit
2940    /// regions must be placed for a user to interact with the Content in a View. Because hit
2941    /// regions are described in the Flatland protocol, a Flatland instance can synchronize Content
2942    /// and hit regions.
2943    ///
2944    /// Each hit region is placed in the coordinate space of the owning Transform, and may or may
2945    /// not interact with different types of hit testing, depending on its [`HitTestInteraction`]
2946    /// type. When there are multiple hit regions that intersect with a hit test, the precedence
2947    /// rules given below dictate which hit region has interacted with the hit test. Only Transforms
2948    /// that transitively connect to the root Transform have their hit regions interact with a hit
2949    /// test.
2950    ///
2951    /// Calling this function replaces any previous values set on this Transform. To reset a
2952    /// Transform to "no hit testing": send an empty vector with [`SetHitRegions`].
2953    ///
2954    /// Note that root transforms get a default hit region installed by Flatland. For more details,
2955    /// see the [`SetRootTransform`] documentation.
2956    ///
2957    /// Precedence rules
2958    ///   Within a Transform, if multiple hit regions overlap, the hit test examines each
2959    ///   intersecting hit region for a possible interaction. Thus, for a regular hit test R and an
2960    ///   accessibility hit test A, where R and A both intersect two hit regions D ([`DEFAULT`]) and
2961    ///   S ([`SEMANTICALLY_INVISIBLE`]) on the same Transform, (1) R interacts with both D and S,
2962    ///   and (2) A only interacts with D. Generally, hit regions that overlap in a single Transform
2963    ///   can cause confusing behavior.
2964    ///
2965    ///   Within a View, for a given hit test, the front-most Transform's hit regions take
2966    ///   precedence over those behind. This follows the expected reverse "render order" of
2967    ///   Transforms (described in [`CreateTransform`]), where a user expects to interact with
2968    ///   Content that is visible, or front-most.
2969    ///
2970    ///   Across Flatland instances, for a given hit test, the front-most instance's front-most
2971    ///   Transform's hit regions take precedence over those behind. This follows the expected
2972    ///   reverse "render order" of views, where a user expects to interact with the View that is
2973    ///   visible, or front-most. For example, if a child View owns Content that is rendered over
2974    ///   the parent View, the user expects to interact with the child's Content.
2975    pub fn r#set_hit_regions(
2976        &self,
2977        mut transform_id: &TransformId,
2978        mut regions: &[HitRegion],
2979    ) -> Result<(), fidl::Error> {
2980        FlatlandProxyInterface::r#set_hit_regions(self, transform_id, regions)
2981    }
2982
2983    /// Identical to [`SetHitRegions`], except the hit region associated with [`transform_id`]
2984    /// covers an infinite region. The hit region is invariant against translation, scaling, and
2985    /// orientation of the Transform.
2986    ///
2987    /// An infinite hit region is still limited in extent by the View's clip boundary, just like a
2988    /// finite hit region.
2989    ///
2990    /// Calling this function replaces any previous values set on this Transform. To reset a
2991    /// Transform to "no hit testing": send an empty vector with [`SetHitRegions`].
2992    pub fn r#set_infinite_hit_region(
2993        &self,
2994        mut transform_id: &TransformId,
2995        mut hit_test: HitTestInteraction,
2996    ) -> Result<(), fidl::Error> {
2997        FlatlandProxyInterface::r#set_infinite_hit_region(self, transform_id, hit_test)
2998    }
2999
3000    /// The Viewport and View pair, together, represent the connection between two Flatland
3001    /// instances. The Viewport is created in the parent, and the View is created in the child. The
3002    /// parent has control over how the child's View is integrated into its own View.
3003    ///
3004    /// Any illegal operations on ChildViewWatcher will cause both ChildViewWatcher channel and this
3005    /// Flatland channel to be torn down.
3006    ///
3007    /// `ViewportProperties` must have logical_size set. This is the initial size that will drive
3008    /// the layout of the child. The logical_size is also used as the default Content size, but
3009    /// subsequent changes to the logical_size will have no effect on the Content size.
3010    ///
3011    /// `ViewportProperties` may have inset field not set. In that case, the default value of
3012    /// (0, 0, 0, 0) is used.
3013    ///
3014    /// The logical_size must have positive X and Y components.
3015    ///
3016    /// Zero is not a valid ContentId. All other values are valid, assuming they are not already
3017    /// in use for another piece of Content (see [`ReleaseViewport`] for more details).
3018    ///
3019    /// Lifecycle note. The lifetime of the ChildViewWatcher channel is bound by the peer
3020    /// ViewCreationToken. When the ViewCreationToken dies, this ChildViewWatcher channel is
3021    /// destroyed.
3022    pub fn r#create_viewport(
3023        &self,
3024        mut viewport_id: &ContentId,
3025        mut token: fidl_fuchsia_ui_views::ViewportCreationToken,
3026        mut properties: &ViewportProperties,
3027        mut child_view_watcher: fidl::endpoints::ServerEnd<ChildViewWatcherMarker>,
3028    ) -> Result<(), fidl::Error> {
3029        FlatlandProxyInterface::r#create_viewport(
3030            self,
3031            viewport_id,
3032            token,
3033            properties,
3034            child_view_watcher,
3035        )
3036    }
3037
3038    /// An Image is a bitmap backed by a specific VMO in a BufferCollection.
3039    ///
3040    /// Image creation requires an allocated BufferCollection registered with Allocator. This
3041    /// function will fail unless all clients of the specified BufferCollection have set their
3042    /// constraints.
3043    ///
3044    /// The Image must reference a valid VMO index and must have ImageProperties that fall within
3045    /// the constraints specified by the backing BufferCollection (i.e. width and height within a
3046    /// valid range, etc.)
3047    ///
3048    /// Zero is not a valid Image id. All other values are valid, assuming they are not already in
3049    /// use for another piece of Content (see [`ReleaseImage`] for more details).
3050    pub fn r#create_image(
3051        &self,
3052        mut image_id: &ContentId,
3053        mut import_token: BufferCollectionImportToken,
3054        mut vmo_index: u32,
3055        mut properties: &ImageProperties,
3056    ) -> Result<(), fidl::Error> {
3057        FlatlandProxyInterface::r#create_image(self, image_id, import_token, vmo_index, properties)
3058    }
3059
3060    /// This function is used to determine the region (in texel space) of an image that will be used
3061    /// by Flatland when rendering. The image to be sampled is referenced by [`image_id`] and the
3062    /// sample region is specified by [`rect`] which itself is comprised of an origin point (x,y) as
3063    /// well as a width and height, in unnormalized coordinates. It is illegal to call this function
3064    /// on non-image content, or to sample a region outside of the texel space of the image. In
3065    /// other words, the region specifed by [`rect`] must not exceed the ranges (0, image_width) and
3066    /// (0, image_height). If (rect.x + rect.width > image_width) or (rect.y + rect.height >
3067    /// image_height) or if any of the values are negative, this will result in an error.
3068    ///
3069    /// If this method is not called, the default sample region is the rectangle with origin at
3070    /// (0, 0) and width and height set at ImageProperties from [`CreateImage`].
3071    pub fn r#set_image_sample_region(
3072        &self,
3073        mut image_id: &ContentId,
3074        mut rect: &fidl_fuchsia_math::RectF,
3075    ) -> Result<(), fidl::Error> {
3076        FlatlandProxyInterface::r#set_image_sample_region(self, image_id, rect)
3077    }
3078
3079    /// The content size for an Image is the size of the rectangle in the parent's logical
3080    /// coordinate space that the image occupies. This combined with the global translation of the
3081    /// transform it is attached to determines the size and location of where the content is
3082    /// rendered on the display.
3083    ///
3084    /// If this method is not called, the default image destination size is the width and height set
3085    /// at ImageProperties from [`CreateImage`]. The destination size will be affected by scaling if
3086    /// [`SetScale`] is used on the attached Transform or its parents.
3087    pub fn r#set_image_destination_size(
3088        &self,
3089        mut image_id: &ContentId,
3090        mut size: &fidl_fuchsia_math::SizeU,
3091    ) -> Result<(), fidl::Error> {
3092        FlatlandProxyInterface::r#set_image_destination_size(self, image_id, size)
3093    }
3094
3095    /// Determines the blend function to use when rendering the content specified by
3096    /// |image_id|. |image_id| must be a valid ContentId associated to a transform through
3097    /// a call to |CreateImage| or |CreateFilledRect|. For details on the different blend functions
3098    /// that are available, please refer to the BlendMode enum. If this function is not called, then
3099    /// the default blendmode is BlendMode::SRC.
3100    pub fn r#set_image_blending_function(
3101        &self,
3102        mut image_id: &ContentId,
3103        mut blend_mode: BlendMode,
3104    ) -> Result<(), fidl::Error> {
3105        FlatlandProxyInterface::r#set_image_blending_function(self, image_id, blend_mode)
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 BlendMode2 enum. If this function is not called,
3112    /// the default blendmode is BlendMode2::REPLACE.
3113    pub fn r#set_image_blend_mode(
3114        &self,
3115        mut image_id: &ContentId,
3116        mut blend_mode: BlendMode2,
3117    ) -> Result<(), fidl::Error> {
3118        FlatlandProxyInterface::r#set_image_blend_mode(self, image_id, blend_mode)
3119    }
3120
3121    /// Sets an opacity in linear space to be applied to a flatland image. Opacity values must
3122    /// be in the range [0.0, 1.0].
3123    pub fn r#set_image_opacity(
3124        &self,
3125        mut image_id: &ContentId,
3126        mut val: f32,
3127    ) -> Result<(), fidl::Error> {
3128        FlatlandProxyInterface::r#set_image_opacity(self, image_id, val)
3129    }
3130
3131    /// Sets the image flip to be applied to a flatland image. This call must be performed after a
3132    /// successful |CreateImage| call. If an invalid |image_id| is supplied, the channel will be
3133    /// closed due to FlatlandError::BAD_OPERATION. This flip will be applied to the Image before
3134    /// parent Transform Orientations. If this function is not called, then the default flip value
3135    /// is ImageFlip::NONE.
3136    pub fn r#set_image_flip(
3137        &self,
3138        mut image_id: &ContentId,
3139        mut flip: ImageFlip,
3140    ) -> Result<(), fidl::Error> {
3141        FlatlandProxyInterface::r#set_image_flip(self, image_id, flip)
3142    }
3143
3144    /// Creates a solid-color rectangle. By default a filled-rect does not have a defined
3145    /// color or size. It is necessary to call |SetSolidFill| to specify a color and size
3146    /// before a filled rect can be used for rendering. Not doing so will result the
3147    pub fn r#create_filled_rect(&self, mut rect_id: &ContentId) -> Result<(), fidl::Error> {
3148        FlatlandProxyInterface::r#create_filled_rect(self, rect_id)
3149    }
3150
3151    /// Defines the color and size of a filled rect. |rect_id| must refer to content that
3152    /// was created via a call to CreateFilledRect. The color is not premultiplied. Color values
3153    /// must be within the range [0,1] inclusive, and normal 32-bit
3154    /// floating point values: https://en.wikipedia.org/wiki/Normal_number_%28computing%29. Values
3155    /// that do not conform to these specifications will cause the channel to close.
3156    /// The rectangle's top left corner will be at (0, 0) in its transform's coordinate space.
3157    /// Hence, its bottom right corner will be at (size.width, size.height).
3158    pub fn r#set_solid_fill(
3159        &self,
3160        mut rect_id: &ContentId,
3161        mut color: &ColorRgba,
3162        mut size: &fidl_fuchsia_math::SizeU,
3163    ) -> Result<(), fidl::Error> {
3164        FlatlandProxyInterface::r#set_solid_fill(self, rect_id, color, size)
3165    }
3166
3167    /// Automatically garbage collects the rectangle when it is no longer needed for
3168    /// rendering. |rect_id| must have been instantiated with a call to
3169    /// |CreateFilledRect|. Once released, the ID immediately goes out of scope and is free
3170    /// to be used again.
3171    pub fn r#release_filled_rect(&self, mut rect_id: &ContentId) -> Result<(), fidl::Error> {
3172        FlatlandProxyInterface::r#release_filled_rect(self, rect_id)
3173    }
3174
3175    /// Setting a piece of Content on a Transform makes that Content visible in the render tree as
3176    /// long as the Transform is visible from the root Transform. The Content will be rendered
3177    /// before, and therefore "behind", any Content attached to the descendants of the Transform.
3178    ///
3179    /// Because each Transform can have, at most, a single piece of Content on it, calling this
3180    /// function on a Transform that already has Content will replace that Content.
3181    ///
3182    /// A Content may be set on more than one Transform.
3183    ///
3184    /// Calling this function with a Content id of 0 will remove any Content currently on the
3185    /// Transform.
3186    pub fn r#set_content(
3187        &self,
3188        mut transform_id: &TransformId,
3189        mut content_id: &ContentId,
3190    ) -> Result<(), fidl::Error> {
3191        FlatlandProxyInterface::r#set_content(self, transform_id, content_id)
3192    }
3193
3194    /// Transforms are usually sufficient to change how Content is presented. Viewports, however,
3195    /// have special properties that are not part of the Transform hierarchy. Those properties can
3196    /// be set using this function.
3197    pub fn r#set_viewport_properties(
3198        &self,
3199        mut viewport_id: &ContentId,
3200        mut properties: &ViewportProperties,
3201    ) -> Result<(), fidl::Error> {
3202        FlatlandProxyInterface::r#set_viewport_properties(self, viewport_id, properties)
3203    }
3204
3205    /// Released Transforms will be garbage collected by the system once they are no longer
3206    /// necessary for rendering. For Transforms, this means there is no path from any unreleased
3207    /// Transform to the newly-released Transform.
3208    ///
3209    /// Once released, the id immediately goes out of scope for future function calls and can be
3210    /// reused when creating new Transforms.
3211    ///
3212    /// It is an error to call functions with a released id (unless that id has been reused to
3213    /// construct a new Transform).
3214    pub fn r#release_transform(&self, mut transform_id: &TransformId) -> Result<(), fidl::Error> {
3215        FlatlandProxyInterface::r#release_transform(self, transform_id)
3216    }
3217
3218    pub fn r#release_view(&self) -> Result<(), fidl::Error> {
3219        FlatlandProxyInterface::r#release_view(self)
3220    }
3221
3222    /// Releases a Viewport from the scene, even if the Viewport is still connected to a Transform.
3223    /// Unlike other resources, Viewports are garbage collected by the system during the next
3224    /// [`Present`] because a removed Viewport is guaranteed to provide no renderable content.
3225    ///
3226    /// Use SetContent(transform_id, 0) to clean up references to released Viewports.
3227    ///
3228    /// Despite having a return type, this function is still feed-forward like [`CreateView`] and
3229    /// requires a call to [`Present`] to be executed. The ViewportCreationToken will be returned
3230    /// after the presented operations have been executed.
3231    pub fn r#release_viewport(
3232        &self,
3233        mut viewport_id: &ContentId,
3234    ) -> fidl::client::QueryResponseFut<
3235        fidl_fuchsia_ui_views::ViewportCreationToken,
3236        fidl::encoding::DefaultFuchsiaResourceDialect,
3237    > {
3238        FlatlandProxyInterface::r#release_viewport(self, viewport_id)
3239    }
3240
3241    /// Released Images will be garbage collected by the system once they are no longer necessary
3242    /// for rendering. For Images, this means the Image is no longer attached to any Transform and
3243    /// any pending rendering that references the Image is complete.
3244    ///
3245    /// Use SetContent(transform_id, 0) to clean up references to released Images.
3246    ///
3247    /// Once released, the id immediately goes out of scope for future function calls and can be
3248    /// reused when creating new Images.
3249    ///
3250    /// It is an error to call functions with a released id (unless that id has been reused to
3251    /// construct a new Image).
3252    pub fn r#release_image(&self, mut image_id: &ContentId) -> Result<(), fidl::Error> {
3253        FlatlandProxyInterface::r#release_image(self, image_id)
3254    }
3255
3256    /// This function will reset all state on this interface. This includes destroying all existing
3257    /// View and Viewports without returning the associated Token to the caller.
3258    pub fn r#clear(&self) -> Result<(), fidl::Error> {
3259        FlatlandProxyInterface::r#clear(self)
3260    }
3261
3262    /// Set debug name of the current client that can be used by Flatland to print as a prefix to
3263    /// logs to help client distinguish what is theirs. [`name`] can be an arbitrary string, but the
3264    /// current process name (see fsl::GetCurrentProcessName()) is a good default.
3265    pub fn r#set_debug_name(&self, mut name: &str) -> Result<(), fidl::Error> {
3266        FlatlandProxyInterface::r#set_debug_name(self, name)
3267    }
3268}
3269
3270impl FlatlandProxyInterface for FlatlandProxy {
3271    fn r#release_image_immediately(&self, mut image_id: &ContentId) -> Result<(), fidl::Error> {
3272        self.client.send::<TrustedFlatlandReleaseImageImmediatelyRequest>(
3273            (image_id,),
3274            0x245e1ac080772c8,
3275            fidl::encoding::DynamicFlags::empty(),
3276        )
3277    }
3278
3279    fn r#present(&self, mut args: PresentArgs) -> Result<(), fidl::Error> {
3280        self.client.send::<FlatlandPresentRequest>(
3281            (&mut args,),
3282            0x50acc2aa1f0acec7,
3283            fidl::encoding::DynamicFlags::empty(),
3284        )
3285    }
3286
3287    fn r#create_view(
3288        &self,
3289        mut token: fidl_fuchsia_ui_views::ViewCreationToken,
3290        mut parent_viewport_watcher: fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>,
3291    ) -> Result<(), fidl::Error> {
3292        self.client.send::<FlatlandCreateViewRequest>(
3293            (&mut token, parent_viewport_watcher),
3294            0x504686eb25864780,
3295            fidl::encoding::DynamicFlags::empty(),
3296        )
3297    }
3298
3299    fn r#create_view2(
3300        &self,
3301        mut token: fidl_fuchsia_ui_views::ViewCreationToken,
3302        mut view_identity: fidl_fuchsia_ui_views::ViewIdentityOnCreation,
3303        mut protocols: ViewBoundProtocols,
3304        mut parent_viewport_watcher: fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>,
3305    ) -> Result<(), fidl::Error> {
3306        self.client.send::<FlatlandCreateView2Request>(
3307            (&mut token, &mut view_identity, &mut protocols, parent_viewport_watcher),
3308            0x340a3a40c2fdbd5e,
3309            fidl::encoding::DynamicFlags::empty(),
3310        )
3311    }
3312
3313    fn r#create_transform(&self, mut transform_id: &TransformId) -> Result<(), fidl::Error> {
3314        self.client.send::<FlatlandCreateTransformRequest>(
3315            (transform_id,),
3316            0x5e042a4d3de3efb0,
3317            fidl::encoding::DynamicFlags::empty(),
3318        )
3319    }
3320
3321    fn r#set_translation(
3322        &self,
3323        mut transform_id: &TransformId,
3324        mut translation: &fidl_fuchsia_math::Vec_,
3325    ) -> Result<(), fidl::Error> {
3326        self.client.send::<FlatlandSetTranslationRequest>(
3327            (transform_id, translation),
3328            0x7863398291fba346,
3329            fidl::encoding::DynamicFlags::empty(),
3330        )
3331    }
3332
3333    fn r#set_orientation(
3334        &self,
3335        mut transform_id: &TransformId,
3336        mut orientation: Orientation,
3337    ) -> Result<(), fidl::Error> {
3338        self.client.send::<FlatlandSetOrientationRequest>(
3339            (transform_id, orientation),
3340            0x4915310bc4928edc,
3341            fidl::encoding::DynamicFlags::empty(),
3342        )
3343    }
3344
3345    fn r#set_scale(
3346        &self,
3347        mut transform_id: &TransformId,
3348        mut scale: &fidl_fuchsia_math::VecF,
3349    ) -> Result<(), fidl::Error> {
3350        self.client.send::<FlatlandSetScaleRequest>(
3351            (transform_id, scale),
3352            0x1ea1766fd8996bb4,
3353            fidl::encoding::DynamicFlags::empty(),
3354        )
3355    }
3356
3357    fn r#set_opacity(
3358        &self,
3359        mut transform_id: &TransformId,
3360        mut value: f32,
3361    ) -> Result<(), fidl::Error> {
3362        self.client.send::<FlatlandSetOpacityRequest>(
3363            (transform_id, value),
3364            0x3775fc2c00b432fa,
3365            fidl::encoding::DynamicFlags::empty(),
3366        )
3367    }
3368
3369    fn r#set_clip_boundary(
3370        &self,
3371        mut transform_id: &TransformId,
3372        mut rect: Option<&fidl_fuchsia_math::Rect>,
3373    ) -> Result<(), fidl::Error> {
3374        self.client.send::<FlatlandSetClipBoundaryRequest>(
3375            (transform_id, rect),
3376            0x6507843df12222d2,
3377            fidl::encoding::DynamicFlags::empty(),
3378        )
3379    }
3380
3381    fn r#add_child(
3382        &self,
3383        mut parent_transform_id: &TransformId,
3384        mut child_transform_id: &TransformId,
3385    ) -> Result<(), fidl::Error> {
3386        self.client.send::<FlatlandAddChildRequest>(
3387            (parent_transform_id, child_transform_id),
3388            0x67a8abd2f19b1a74,
3389            fidl::encoding::DynamicFlags::empty(),
3390        )
3391    }
3392
3393    fn r#remove_child(
3394        &self,
3395        mut parent_transform_id: &TransformId,
3396        mut child_transform_id: &TransformId,
3397    ) -> Result<(), fidl::Error> {
3398        self.client.send::<FlatlandRemoveChildRequest>(
3399            (parent_transform_id, child_transform_id),
3400            0x41d6cd90b298b67a,
3401            fidl::encoding::DynamicFlags::empty(),
3402        )
3403    }
3404
3405    fn r#replace_children(
3406        &self,
3407        mut parent_transform_id: &TransformId,
3408        mut new_child_transform_ids: &[TransformId],
3409    ) -> Result<(), fidl::Error> {
3410        self.client.send::<FlatlandReplaceChildrenRequest>(
3411            (parent_transform_id, new_child_transform_ids),
3412            0x5b6d86cbbff81316,
3413            fidl::encoding::DynamicFlags::empty(),
3414        )
3415    }
3416
3417    fn r#set_root_transform(&self, mut transform_id: &TransformId) -> Result<(), fidl::Error> {
3418        self.client.send::<FlatlandSetRootTransformRequest>(
3419            (transform_id,),
3420            0x6e80ca5bcc566cd8,
3421            fidl::encoding::DynamicFlags::empty(),
3422        )
3423    }
3424
3425    fn r#set_hit_regions(
3426        &self,
3427        mut transform_id: &TransformId,
3428        mut regions: &[HitRegion],
3429    ) -> Result<(), fidl::Error> {
3430        self.client.send::<FlatlandSetHitRegionsRequest>(
3431            (transform_id, regions),
3432            0x31c9d17b07c37ce4,
3433            fidl::encoding::DynamicFlags::empty(),
3434        )
3435    }
3436
3437    fn r#set_infinite_hit_region(
3438        &self,
3439        mut transform_id: &TransformId,
3440        mut hit_test: HitTestInteraction,
3441    ) -> Result<(), fidl::Error> {
3442        self.client.send::<FlatlandSetInfiniteHitRegionRequest>(
3443            (transform_id, hit_test),
3444            0x26d81af852d29562,
3445            fidl::encoding::DynamicFlags::empty(),
3446        )
3447    }
3448
3449    fn r#create_viewport(
3450        &self,
3451        mut viewport_id: &ContentId,
3452        mut token: fidl_fuchsia_ui_views::ViewportCreationToken,
3453        mut properties: &ViewportProperties,
3454        mut child_view_watcher: fidl::endpoints::ServerEnd<ChildViewWatcherMarker>,
3455    ) -> Result<(), fidl::Error> {
3456        self.client.send::<FlatlandCreateViewportRequest>(
3457            (viewport_id, &mut token, properties, child_view_watcher),
3458            0x2485fbcab7f943c,
3459            fidl::encoding::DynamicFlags::empty(),
3460        )
3461    }
3462
3463    fn r#create_image(
3464        &self,
3465        mut image_id: &ContentId,
3466        mut import_token: BufferCollectionImportToken,
3467        mut vmo_index: u32,
3468        mut properties: &ImageProperties,
3469    ) -> Result<(), fidl::Error> {
3470        self.client.send::<FlatlandCreateImageRequest>(
3471            (image_id, &mut import_token, vmo_index, properties),
3472            0x26fae823c4ebedad,
3473            fidl::encoding::DynamicFlags::empty(),
3474        )
3475    }
3476
3477    fn r#set_image_sample_region(
3478        &self,
3479        mut image_id: &ContentId,
3480        mut rect: &fidl_fuchsia_math::RectF,
3481    ) -> Result<(), fidl::Error> {
3482        self.client.send::<FlatlandSetImageSampleRegionRequest>(
3483            (image_id, rect),
3484            0x8039391d715eb28,
3485            fidl::encoding::DynamicFlags::empty(),
3486        )
3487    }
3488
3489    fn r#set_image_destination_size(
3490        &self,
3491        mut image_id: &ContentId,
3492        mut size: &fidl_fuchsia_math::SizeU,
3493    ) -> Result<(), fidl::Error> {
3494        self.client.send::<FlatlandSetImageDestinationSizeRequest>(
3495            (image_id, size),
3496            0x766cf99a2ec58446,
3497            fidl::encoding::DynamicFlags::empty(),
3498        )
3499    }
3500
3501    fn r#set_image_blending_function(
3502        &self,
3503        mut image_id: &ContentId,
3504        mut blend_mode: BlendMode,
3505    ) -> Result<(), fidl::Error> {
3506        self.client.send::<FlatlandSetImageBlendingFunctionRequest>(
3507            (image_id, blend_mode),
3508            0x10f5da1356275b7b,
3509            fidl::encoding::DynamicFlags::empty(),
3510        )
3511    }
3512
3513    fn r#set_image_blend_mode(
3514        &self,
3515        mut image_id: &ContentId,
3516        mut blend_mode: BlendMode2,
3517    ) -> Result<(), fidl::Error> {
3518        self.client.send::<FlatlandSetImageBlendModeRequest>(
3519            (image_id, blend_mode),
3520            0x5b1667f130c3de67,
3521            fidl::encoding::DynamicFlags::empty(),
3522        )
3523    }
3524
3525    fn r#set_image_opacity(
3526        &self,
3527        mut image_id: &ContentId,
3528        mut val: f32,
3529    ) -> Result<(), fidl::Error> {
3530        self.client.send::<FlatlandSetImageOpacityRequest>(
3531            (image_id, val),
3532            0x2da9e4ef4c2cff6f,
3533            fidl::encoding::DynamicFlags::empty(),
3534        )
3535    }
3536
3537    fn r#set_image_flip(
3538        &self,
3539        mut image_id: &ContentId,
3540        mut flip: ImageFlip,
3541    ) -> Result<(), fidl::Error> {
3542        self.client.send::<FlatlandSetImageFlipRequest>(
3543            (image_id, flip),
3544            0x21b20f2c14aae6bc,
3545            fidl::encoding::DynamicFlags::empty(),
3546        )
3547    }
3548
3549    fn r#create_filled_rect(&self, mut rect_id: &ContentId) -> Result<(), fidl::Error> {
3550        self.client.send::<FlatlandCreateFilledRectRequest>(
3551            (rect_id,),
3552            0x5e62355abc1c4c5d,
3553            fidl::encoding::DynamicFlags::empty(),
3554        )
3555    }
3556
3557    fn r#set_solid_fill(
3558        &self,
3559        mut rect_id: &ContentId,
3560        mut color: &ColorRgba,
3561        mut size: &fidl_fuchsia_math::SizeU,
3562    ) -> Result<(), fidl::Error> {
3563        self.client.send::<FlatlandSetSolidFillRequest>(
3564            (rect_id, color, size),
3565            0x32d6ef41e182dfa5,
3566            fidl::encoding::DynamicFlags::empty(),
3567        )
3568    }
3569
3570    fn r#release_filled_rect(&self, mut rect_id: &ContentId) -> Result<(), fidl::Error> {
3571        self.client.send::<FlatlandReleaseFilledRectRequest>(
3572            (rect_id,),
3573            0x7392cabe45618f9b,
3574            fidl::encoding::DynamicFlags::empty(),
3575        )
3576    }
3577
3578    fn r#set_content(
3579        &self,
3580        mut transform_id: &TransformId,
3581        mut content_id: &ContentId,
3582    ) -> Result<(), fidl::Error> {
3583        self.client.send::<FlatlandSetContentRequest>(
3584            (transform_id, content_id),
3585            0x4ed2cfc0ce130862,
3586            fidl::encoding::DynamicFlags::empty(),
3587        )
3588    }
3589
3590    fn r#set_viewport_properties(
3591        &self,
3592        mut viewport_id: &ContentId,
3593        mut properties: &ViewportProperties,
3594    ) -> Result<(), fidl::Error> {
3595        self.client.send::<FlatlandSetViewportPropertiesRequest>(
3596            (viewport_id, properties),
3597            0x66ab67e9608ddb9f,
3598            fidl::encoding::DynamicFlags::empty(),
3599        )
3600    }
3601
3602    fn r#release_transform(&self, mut transform_id: &TransformId) -> Result<(), fidl::Error> {
3603        self.client.send::<FlatlandReleaseTransformRequest>(
3604            (transform_id,),
3605            0xab9328419451c22,
3606            fidl::encoding::DynamicFlags::empty(),
3607        )
3608    }
3609
3610    fn r#release_view(&self) -> Result<(), fidl::Error> {
3611        self.client.send::<fidl::encoding::EmptyPayload>(
3612            (),
3613            0x5b35aab9baffecae,
3614            fidl::encoding::DynamicFlags::empty(),
3615        )
3616    }
3617
3618    type ReleaseViewportResponseFut = fidl::client::QueryResponseFut<
3619        fidl_fuchsia_ui_views::ViewportCreationToken,
3620        fidl::encoding::DefaultFuchsiaResourceDialect,
3621    >;
3622    fn r#release_viewport(&self, mut viewport_id: &ContentId) -> Self::ReleaseViewportResponseFut {
3623        fn _decode(
3624            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3625        ) -> Result<fidl_fuchsia_ui_views::ViewportCreationToken, fidl::Error> {
3626            let _response = fidl::client::decode_transaction_body::<
3627                FlatlandReleaseViewportResponse,
3628                fidl::encoding::DefaultFuchsiaResourceDialect,
3629                0xbad474aeb5293f9,
3630            >(_buf?)?;
3631            Ok(_response.token)
3632        }
3633        self.client.send_query_and_decode::<
3634            FlatlandReleaseViewportRequest,
3635            fidl_fuchsia_ui_views::ViewportCreationToken,
3636        >(
3637            (viewport_id,),
3638            0xbad474aeb5293f9,
3639            fidl::encoding::DynamicFlags::empty(),
3640            _decode,
3641        )
3642    }
3643
3644    fn r#release_image(&self, mut image_id: &ContentId) -> Result<(), fidl::Error> {
3645        self.client.send::<FlatlandReleaseImageRequest>(
3646            (image_id,),
3647            0xb884ffdbc72c111,
3648            fidl::encoding::DynamicFlags::empty(),
3649        )
3650    }
3651
3652    fn r#clear(&self) -> Result<(), fidl::Error> {
3653        self.client.send::<fidl::encoding::EmptyPayload>(
3654            (),
3655            0x4ec8817c02828c3e,
3656            fidl::encoding::DynamicFlags::empty(),
3657        )
3658    }
3659
3660    fn r#set_debug_name(&self, mut name: &str) -> Result<(), fidl::Error> {
3661        self.client.send::<FlatlandSetDebugNameRequest>(
3662            (name,),
3663            0x46a8b397e68a8888,
3664            fidl::encoding::DynamicFlags::empty(),
3665        )
3666    }
3667}
3668
3669pub struct FlatlandEventStream {
3670    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
3671}
3672
3673impl std::marker::Unpin for FlatlandEventStream {}
3674
3675impl futures::stream::FusedStream for FlatlandEventStream {
3676    fn is_terminated(&self) -> bool {
3677        self.event_receiver.is_terminated()
3678    }
3679}
3680
3681impl futures::Stream for FlatlandEventStream {
3682    type Item = Result<FlatlandEvent, fidl::Error>;
3683
3684    fn poll_next(
3685        mut self: std::pin::Pin<&mut Self>,
3686        cx: &mut std::task::Context<'_>,
3687    ) -> std::task::Poll<Option<Self::Item>> {
3688        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
3689            &mut self.event_receiver,
3690            cx
3691        )?) {
3692            Some(buf) => std::task::Poll::Ready(Some(FlatlandEvent::decode(buf))),
3693            None => std::task::Poll::Ready(None),
3694        }
3695    }
3696}
3697
3698#[derive(Debug)]
3699pub enum FlatlandEvent {
3700    OnNextFrameBegin { values: OnNextFrameBeginValues },
3701    OnFramePresented { frame_presented_info: fidl_fuchsia_scenic_scheduling::FramePresentedInfo },
3702    OnError { error: FlatlandError },
3703}
3704
3705impl FlatlandEvent {
3706    #[allow(irrefutable_let_patterns)]
3707    pub fn into_on_next_frame_begin(self) -> Option<OnNextFrameBeginValues> {
3708        if let FlatlandEvent::OnNextFrameBegin { values } = self { Some((values)) } else { None }
3709    }
3710    #[allow(irrefutable_let_patterns)]
3711    pub fn into_on_frame_presented(
3712        self,
3713    ) -> Option<fidl_fuchsia_scenic_scheduling::FramePresentedInfo> {
3714        if let FlatlandEvent::OnFramePresented { frame_presented_info } = self {
3715            Some((frame_presented_info))
3716        } else {
3717            None
3718        }
3719    }
3720    #[allow(irrefutable_let_patterns)]
3721    pub fn into_on_error(self) -> Option<FlatlandError> {
3722        if let FlatlandEvent::OnError { error } = self { Some((error)) } else { None }
3723    }
3724
3725    /// Decodes a message buffer as a [`FlatlandEvent`].
3726    fn decode(
3727        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3728    ) -> Result<FlatlandEvent, fidl::Error> {
3729        let (bytes, _handles) = buf.split_mut();
3730        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3731        debug_assert_eq!(tx_header.tx_id, 0);
3732        match tx_header.ordinal {
3733            0x10f69a5cdeece84a => {
3734                let mut out = fidl::new_empty!(
3735                    FlatlandOnNextFrameBeginRequest,
3736                    fidl::encoding::DefaultFuchsiaResourceDialect
3737                );
3738                fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandOnNextFrameBeginRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
3739                Ok((FlatlandEvent::OnNextFrameBegin { values: out.values }))
3740            }
3741            0x56e43e1a5f30216d => {
3742                let mut out = fidl::new_empty!(
3743                    FlatlandOnFramePresentedRequest,
3744                    fidl::encoding::DefaultFuchsiaResourceDialect
3745                );
3746                fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandOnFramePresentedRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
3747                Ok((FlatlandEvent::OnFramePresented {
3748                    frame_presented_info: out.frame_presented_info,
3749                }))
3750            }
3751            0x1ebf39e90cd8b8d => {
3752                let mut out = fidl::new_empty!(
3753                    FlatlandOnErrorRequest,
3754                    fidl::encoding::DefaultFuchsiaResourceDialect
3755                );
3756                fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandOnErrorRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
3757                Ok((FlatlandEvent::OnError { error: out.error }))
3758            }
3759            _ => Err(fidl::Error::UnknownOrdinal {
3760                ordinal: tx_header.ordinal,
3761                protocol_name: <FlatlandMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3762            }),
3763        }
3764    }
3765}
3766
3767/// A Stream of incoming requests for fuchsia.ui.composition/Flatland.
3768pub struct FlatlandRequestStream {
3769    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3770    is_terminated: bool,
3771}
3772
3773impl std::marker::Unpin for FlatlandRequestStream {}
3774
3775impl futures::stream::FusedStream for FlatlandRequestStream {
3776    fn is_terminated(&self) -> bool {
3777        self.is_terminated
3778    }
3779}
3780
3781impl fidl::endpoints::RequestStream for FlatlandRequestStream {
3782    type Protocol = FlatlandMarker;
3783    type ControlHandle = FlatlandControlHandle;
3784
3785    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
3786        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3787    }
3788
3789    fn control_handle(&self) -> Self::ControlHandle {
3790        FlatlandControlHandle { inner: self.inner.clone() }
3791    }
3792
3793    fn into_inner(
3794        self,
3795    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3796    {
3797        (self.inner, self.is_terminated)
3798    }
3799
3800    fn from_inner(
3801        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3802        is_terminated: bool,
3803    ) -> Self {
3804        Self { inner, is_terminated }
3805    }
3806}
3807
3808impl futures::Stream for FlatlandRequestStream {
3809    type Item = Result<FlatlandRequest, fidl::Error>;
3810
3811    fn poll_next(
3812        mut self: std::pin::Pin<&mut Self>,
3813        cx: &mut std::task::Context<'_>,
3814    ) -> std::task::Poll<Option<Self::Item>> {
3815        let this = &mut *self;
3816        if this.inner.check_shutdown(cx) {
3817            this.is_terminated = true;
3818            return std::task::Poll::Ready(None);
3819        }
3820        if this.is_terminated {
3821            panic!("polled FlatlandRequestStream after completion");
3822        }
3823        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3824            |bytes, handles| {
3825                match this.inner.channel().read_etc(cx, bytes, handles) {
3826                    std::task::Poll::Ready(Ok(())) => {}
3827                    std::task::Poll::Pending => return std::task::Poll::Pending,
3828                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3829                        this.is_terminated = true;
3830                        return std::task::Poll::Ready(None);
3831                    }
3832                    std::task::Poll::Ready(Err(e)) => {
3833                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3834                            e.into(),
3835                        ))));
3836                    }
3837                }
3838
3839                // A message has been received from the channel
3840                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3841
3842                std::task::Poll::Ready(Some(match header.ordinal {
3843                    0x245e1ac080772c8 => {
3844                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3845                        let mut req = fidl::new_empty!(
3846                            TrustedFlatlandReleaseImageImmediatelyRequest,
3847                            fidl::encoding::DefaultFuchsiaResourceDialect
3848                        );
3849                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<TrustedFlatlandReleaseImageImmediatelyRequest>(&header, _body_bytes, handles, &mut req)?;
3850                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
3851                        Ok(FlatlandRequest::ReleaseImageImmediately {
3852                            image_id: req.image_id,
3853
3854                            control_handle,
3855                        })
3856                    }
3857                    0x50acc2aa1f0acec7 => {
3858                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3859                        let mut req = fidl::new_empty!(
3860                            FlatlandPresentRequest,
3861                            fidl::encoding::DefaultFuchsiaResourceDialect
3862                        );
3863                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandPresentRequest>(&header, _body_bytes, handles, &mut req)?;
3864                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
3865                        Ok(FlatlandRequest::Present { args: req.args, control_handle })
3866                    }
3867                    0x504686eb25864780 => {
3868                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3869                        let mut req = fidl::new_empty!(
3870                            FlatlandCreateViewRequest,
3871                            fidl::encoding::DefaultFuchsiaResourceDialect
3872                        );
3873                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandCreateViewRequest>(&header, _body_bytes, handles, &mut req)?;
3874                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
3875                        Ok(FlatlandRequest::CreateView {
3876                            token: req.token,
3877                            parent_viewport_watcher: req.parent_viewport_watcher,
3878
3879                            control_handle,
3880                        })
3881                    }
3882                    0x340a3a40c2fdbd5e => {
3883                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3884                        let mut req = fidl::new_empty!(
3885                            FlatlandCreateView2Request,
3886                            fidl::encoding::DefaultFuchsiaResourceDialect
3887                        );
3888                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandCreateView2Request>(&header, _body_bytes, handles, &mut req)?;
3889                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
3890                        Ok(FlatlandRequest::CreateView2 {
3891                            token: req.token,
3892                            view_identity: req.view_identity,
3893                            protocols: req.protocols,
3894                            parent_viewport_watcher: req.parent_viewport_watcher,
3895
3896                            control_handle,
3897                        })
3898                    }
3899                    0x5e042a4d3de3efb0 => {
3900                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3901                        let mut req = fidl::new_empty!(
3902                            FlatlandCreateTransformRequest,
3903                            fidl::encoding::DefaultFuchsiaResourceDialect
3904                        );
3905                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandCreateTransformRequest>(&header, _body_bytes, handles, &mut req)?;
3906                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
3907                        Ok(FlatlandRequest::CreateTransform {
3908                            transform_id: req.transform_id,
3909
3910                            control_handle,
3911                        })
3912                    }
3913                    0x7863398291fba346 => {
3914                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3915                        let mut req = fidl::new_empty!(
3916                            FlatlandSetTranslationRequest,
3917                            fidl::encoding::DefaultFuchsiaResourceDialect
3918                        );
3919                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetTranslationRequest>(&header, _body_bytes, handles, &mut req)?;
3920                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
3921                        Ok(FlatlandRequest::SetTranslation {
3922                            transform_id: req.transform_id,
3923                            translation: req.translation,
3924
3925                            control_handle,
3926                        })
3927                    }
3928                    0x4915310bc4928edc => {
3929                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3930                        let mut req = fidl::new_empty!(
3931                            FlatlandSetOrientationRequest,
3932                            fidl::encoding::DefaultFuchsiaResourceDialect
3933                        );
3934                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetOrientationRequest>(&header, _body_bytes, handles, &mut req)?;
3935                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
3936                        Ok(FlatlandRequest::SetOrientation {
3937                            transform_id: req.transform_id,
3938                            orientation: req.orientation,
3939
3940                            control_handle,
3941                        })
3942                    }
3943                    0x1ea1766fd8996bb4 => {
3944                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3945                        let mut req = fidl::new_empty!(
3946                            FlatlandSetScaleRequest,
3947                            fidl::encoding::DefaultFuchsiaResourceDialect
3948                        );
3949                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetScaleRequest>(&header, _body_bytes, handles, &mut req)?;
3950                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
3951                        Ok(FlatlandRequest::SetScale {
3952                            transform_id: req.transform_id,
3953                            scale: req.scale,
3954
3955                            control_handle,
3956                        })
3957                    }
3958                    0x3775fc2c00b432fa => {
3959                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3960                        let mut req = fidl::new_empty!(
3961                            FlatlandSetOpacityRequest,
3962                            fidl::encoding::DefaultFuchsiaResourceDialect
3963                        );
3964                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetOpacityRequest>(&header, _body_bytes, handles, &mut req)?;
3965                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
3966                        Ok(FlatlandRequest::SetOpacity {
3967                            transform_id: req.transform_id,
3968                            value: req.value,
3969
3970                            control_handle,
3971                        })
3972                    }
3973                    0x6507843df12222d2 => {
3974                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3975                        let mut req = fidl::new_empty!(
3976                            FlatlandSetClipBoundaryRequest,
3977                            fidl::encoding::DefaultFuchsiaResourceDialect
3978                        );
3979                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetClipBoundaryRequest>(&header, _body_bytes, handles, &mut req)?;
3980                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
3981                        Ok(FlatlandRequest::SetClipBoundary {
3982                            transform_id: req.transform_id,
3983                            rect: req.rect,
3984
3985                            control_handle,
3986                        })
3987                    }
3988                    0x67a8abd2f19b1a74 => {
3989                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3990                        let mut req = fidl::new_empty!(
3991                            FlatlandAddChildRequest,
3992                            fidl::encoding::DefaultFuchsiaResourceDialect
3993                        );
3994                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandAddChildRequest>(&header, _body_bytes, handles, &mut req)?;
3995                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
3996                        Ok(FlatlandRequest::AddChild {
3997                            parent_transform_id: req.parent_transform_id,
3998                            child_transform_id: req.child_transform_id,
3999
4000                            control_handle,
4001                        })
4002                    }
4003                    0x41d6cd90b298b67a => {
4004                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4005                        let mut req = fidl::new_empty!(
4006                            FlatlandRemoveChildRequest,
4007                            fidl::encoding::DefaultFuchsiaResourceDialect
4008                        );
4009                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandRemoveChildRequest>(&header, _body_bytes, handles, &mut req)?;
4010                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4011                        Ok(FlatlandRequest::RemoveChild {
4012                            parent_transform_id: req.parent_transform_id,
4013                            child_transform_id: req.child_transform_id,
4014
4015                            control_handle,
4016                        })
4017                    }
4018                    0x5b6d86cbbff81316 => {
4019                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4020                        let mut req = fidl::new_empty!(
4021                            FlatlandReplaceChildrenRequest,
4022                            fidl::encoding::DefaultFuchsiaResourceDialect
4023                        );
4024                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandReplaceChildrenRequest>(&header, _body_bytes, handles, &mut req)?;
4025                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4026                        Ok(FlatlandRequest::ReplaceChildren {
4027                            parent_transform_id: req.parent_transform_id,
4028                            new_child_transform_ids: req.new_child_transform_ids,
4029
4030                            control_handle,
4031                        })
4032                    }
4033                    0x6e80ca5bcc566cd8 => {
4034                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4035                        let mut req = fidl::new_empty!(
4036                            FlatlandSetRootTransformRequest,
4037                            fidl::encoding::DefaultFuchsiaResourceDialect
4038                        );
4039                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetRootTransformRequest>(&header, _body_bytes, handles, &mut req)?;
4040                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4041                        Ok(FlatlandRequest::SetRootTransform {
4042                            transform_id: req.transform_id,
4043
4044                            control_handle,
4045                        })
4046                    }
4047                    0x31c9d17b07c37ce4 => {
4048                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4049                        let mut req = fidl::new_empty!(
4050                            FlatlandSetHitRegionsRequest,
4051                            fidl::encoding::DefaultFuchsiaResourceDialect
4052                        );
4053                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetHitRegionsRequest>(&header, _body_bytes, handles, &mut req)?;
4054                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4055                        Ok(FlatlandRequest::SetHitRegions {
4056                            transform_id: req.transform_id,
4057                            regions: req.regions,
4058
4059                            control_handle,
4060                        })
4061                    }
4062                    0x26d81af852d29562 => {
4063                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4064                        let mut req = fidl::new_empty!(
4065                            FlatlandSetInfiniteHitRegionRequest,
4066                            fidl::encoding::DefaultFuchsiaResourceDialect
4067                        );
4068                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetInfiniteHitRegionRequest>(&header, _body_bytes, handles, &mut req)?;
4069                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4070                        Ok(FlatlandRequest::SetInfiniteHitRegion {
4071                            transform_id: req.transform_id,
4072                            hit_test: req.hit_test,
4073
4074                            control_handle,
4075                        })
4076                    }
4077                    0x2485fbcab7f943c => {
4078                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4079                        let mut req = fidl::new_empty!(
4080                            FlatlandCreateViewportRequest,
4081                            fidl::encoding::DefaultFuchsiaResourceDialect
4082                        );
4083                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandCreateViewportRequest>(&header, _body_bytes, handles, &mut req)?;
4084                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4085                        Ok(FlatlandRequest::CreateViewport {
4086                            viewport_id: req.viewport_id,
4087                            token: req.token,
4088                            properties: req.properties,
4089                            child_view_watcher: req.child_view_watcher,
4090
4091                            control_handle,
4092                        })
4093                    }
4094                    0x26fae823c4ebedad => {
4095                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4096                        let mut req = fidl::new_empty!(
4097                            FlatlandCreateImageRequest,
4098                            fidl::encoding::DefaultFuchsiaResourceDialect
4099                        );
4100                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandCreateImageRequest>(&header, _body_bytes, handles, &mut req)?;
4101                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4102                        Ok(FlatlandRequest::CreateImage {
4103                            image_id: req.image_id,
4104                            import_token: req.import_token,
4105                            vmo_index: req.vmo_index,
4106                            properties: req.properties,
4107
4108                            control_handle,
4109                        })
4110                    }
4111                    0x8039391d715eb28 => {
4112                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4113                        let mut req = fidl::new_empty!(
4114                            FlatlandSetImageSampleRegionRequest,
4115                            fidl::encoding::DefaultFuchsiaResourceDialect
4116                        );
4117                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetImageSampleRegionRequest>(&header, _body_bytes, handles, &mut req)?;
4118                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4119                        Ok(FlatlandRequest::SetImageSampleRegion {
4120                            image_id: req.image_id,
4121                            rect: req.rect,
4122
4123                            control_handle,
4124                        })
4125                    }
4126                    0x766cf99a2ec58446 => {
4127                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4128                        let mut req = fidl::new_empty!(
4129                            FlatlandSetImageDestinationSizeRequest,
4130                            fidl::encoding::DefaultFuchsiaResourceDialect
4131                        );
4132                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetImageDestinationSizeRequest>(&header, _body_bytes, handles, &mut req)?;
4133                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4134                        Ok(FlatlandRequest::SetImageDestinationSize {
4135                            image_id: req.image_id,
4136                            size: req.size,
4137
4138                            control_handle,
4139                        })
4140                    }
4141                    0x10f5da1356275b7b => {
4142                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4143                        let mut req = fidl::new_empty!(
4144                            FlatlandSetImageBlendingFunctionRequest,
4145                            fidl::encoding::DefaultFuchsiaResourceDialect
4146                        );
4147                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetImageBlendingFunctionRequest>(&header, _body_bytes, handles, &mut req)?;
4148                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4149                        Ok(FlatlandRequest::SetImageBlendingFunction {
4150                            image_id: req.image_id,
4151                            blend_mode: req.blend_mode,
4152
4153                            control_handle,
4154                        })
4155                    }
4156                    0x5b1667f130c3de67 => {
4157                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4158                        let mut req = fidl::new_empty!(
4159                            FlatlandSetImageBlendModeRequest,
4160                            fidl::encoding::DefaultFuchsiaResourceDialect
4161                        );
4162                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetImageBlendModeRequest>(&header, _body_bytes, handles, &mut req)?;
4163                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4164                        Ok(FlatlandRequest::SetImageBlendMode {
4165                            image_id: req.image_id,
4166                            blend_mode: req.blend_mode,
4167
4168                            control_handle,
4169                        })
4170                    }
4171                    0x2da9e4ef4c2cff6f => {
4172                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4173                        let mut req = fidl::new_empty!(
4174                            FlatlandSetImageOpacityRequest,
4175                            fidl::encoding::DefaultFuchsiaResourceDialect
4176                        );
4177                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetImageOpacityRequest>(&header, _body_bytes, handles, &mut req)?;
4178                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4179                        Ok(FlatlandRequest::SetImageOpacity {
4180                            image_id: req.image_id,
4181                            val: req.val,
4182
4183                            control_handle,
4184                        })
4185                    }
4186                    0x21b20f2c14aae6bc => {
4187                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4188                        let mut req = fidl::new_empty!(
4189                            FlatlandSetImageFlipRequest,
4190                            fidl::encoding::DefaultFuchsiaResourceDialect
4191                        );
4192                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetImageFlipRequest>(&header, _body_bytes, handles, &mut req)?;
4193                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4194                        Ok(FlatlandRequest::SetImageFlip {
4195                            image_id: req.image_id,
4196                            flip: req.flip,
4197
4198                            control_handle,
4199                        })
4200                    }
4201                    0x5e62355abc1c4c5d => {
4202                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4203                        let mut req = fidl::new_empty!(
4204                            FlatlandCreateFilledRectRequest,
4205                            fidl::encoding::DefaultFuchsiaResourceDialect
4206                        );
4207                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandCreateFilledRectRequest>(&header, _body_bytes, handles, &mut req)?;
4208                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4209                        Ok(FlatlandRequest::CreateFilledRect {
4210                            rect_id: req.rect_id,
4211
4212                            control_handle,
4213                        })
4214                    }
4215                    0x32d6ef41e182dfa5 => {
4216                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4217                        let mut req = fidl::new_empty!(
4218                            FlatlandSetSolidFillRequest,
4219                            fidl::encoding::DefaultFuchsiaResourceDialect
4220                        );
4221                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetSolidFillRequest>(&header, _body_bytes, handles, &mut req)?;
4222                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4223                        Ok(FlatlandRequest::SetSolidFill {
4224                            rect_id: req.rect_id,
4225                            color: req.color,
4226                            size: req.size,
4227
4228                            control_handle,
4229                        })
4230                    }
4231                    0x7392cabe45618f9b => {
4232                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4233                        let mut req = fidl::new_empty!(
4234                            FlatlandReleaseFilledRectRequest,
4235                            fidl::encoding::DefaultFuchsiaResourceDialect
4236                        );
4237                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandReleaseFilledRectRequest>(&header, _body_bytes, handles, &mut req)?;
4238                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4239                        Ok(FlatlandRequest::ReleaseFilledRect {
4240                            rect_id: req.rect_id,
4241
4242                            control_handle,
4243                        })
4244                    }
4245                    0x4ed2cfc0ce130862 => {
4246                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4247                        let mut req = fidl::new_empty!(
4248                            FlatlandSetContentRequest,
4249                            fidl::encoding::DefaultFuchsiaResourceDialect
4250                        );
4251                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetContentRequest>(&header, _body_bytes, handles, &mut req)?;
4252                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4253                        Ok(FlatlandRequest::SetContent {
4254                            transform_id: req.transform_id,
4255                            content_id: req.content_id,
4256
4257                            control_handle,
4258                        })
4259                    }
4260                    0x66ab67e9608ddb9f => {
4261                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4262                        let mut req = fidl::new_empty!(
4263                            FlatlandSetViewportPropertiesRequest,
4264                            fidl::encoding::DefaultFuchsiaResourceDialect
4265                        );
4266                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetViewportPropertiesRequest>(&header, _body_bytes, handles, &mut req)?;
4267                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4268                        Ok(FlatlandRequest::SetViewportProperties {
4269                            viewport_id: req.viewport_id,
4270                            properties: req.properties,
4271
4272                            control_handle,
4273                        })
4274                    }
4275                    0xab9328419451c22 => {
4276                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4277                        let mut req = fidl::new_empty!(
4278                            FlatlandReleaseTransformRequest,
4279                            fidl::encoding::DefaultFuchsiaResourceDialect
4280                        );
4281                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandReleaseTransformRequest>(&header, _body_bytes, handles, &mut req)?;
4282                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4283                        Ok(FlatlandRequest::ReleaseTransform {
4284                            transform_id: req.transform_id,
4285
4286                            control_handle,
4287                        })
4288                    }
4289                    0x5b35aab9baffecae => {
4290                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4291                        let mut req = fidl::new_empty!(
4292                            fidl::encoding::EmptyPayload,
4293                            fidl::encoding::DefaultFuchsiaResourceDialect
4294                        );
4295                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
4296                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4297                        Ok(FlatlandRequest::ReleaseView { control_handle })
4298                    }
4299                    0xbad474aeb5293f9 => {
4300                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4301                        let mut req = fidl::new_empty!(
4302                            FlatlandReleaseViewportRequest,
4303                            fidl::encoding::DefaultFuchsiaResourceDialect
4304                        );
4305                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandReleaseViewportRequest>(&header, _body_bytes, handles, &mut req)?;
4306                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4307                        Ok(FlatlandRequest::ReleaseViewport {
4308                            viewport_id: req.viewport_id,
4309
4310                            responder: FlatlandReleaseViewportResponder {
4311                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4312                                tx_id: header.tx_id,
4313                            },
4314                        })
4315                    }
4316                    0xb884ffdbc72c111 => {
4317                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4318                        let mut req = fidl::new_empty!(
4319                            FlatlandReleaseImageRequest,
4320                            fidl::encoding::DefaultFuchsiaResourceDialect
4321                        );
4322                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandReleaseImageRequest>(&header, _body_bytes, handles, &mut req)?;
4323                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4324                        Ok(FlatlandRequest::ReleaseImage { image_id: req.image_id, control_handle })
4325                    }
4326                    0x4ec8817c02828c3e => {
4327                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4328                        let mut req = fidl::new_empty!(
4329                            fidl::encoding::EmptyPayload,
4330                            fidl::encoding::DefaultFuchsiaResourceDialect
4331                        );
4332                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
4333                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4334                        Ok(FlatlandRequest::Clear { control_handle })
4335                    }
4336                    0x46a8b397e68a8888 => {
4337                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4338                        let mut req = fidl::new_empty!(
4339                            FlatlandSetDebugNameRequest,
4340                            fidl::encoding::DefaultFuchsiaResourceDialect
4341                        );
4342                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetDebugNameRequest>(&header, _body_bytes, handles, &mut req)?;
4343                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4344                        Ok(FlatlandRequest::SetDebugName { name: req.name, control_handle })
4345                    }
4346                    _ => Err(fidl::Error::UnknownOrdinal {
4347                        ordinal: header.ordinal,
4348                        protocol_name:
4349                            <FlatlandMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4350                    }),
4351                }))
4352            },
4353        )
4354    }
4355}
4356
4357/// Each Flatland instance contains a Graph, which consists of a set of objects, and the
4358/// relationships between those objects. The client can specify a subset of those objects
4359/// (specifically, the directed acyclic graph starting at the root transform) to be presented as
4360/// content to some kind of output -- usually, a display.
4361///
4362/// Flatland Graphs are both hierarchical, and distributed. Graphs from different Flatland instances
4363/// may be connected together, allowing multiple processes to be involved in authoring content for a
4364/// particular output.
4365///
4366/// All functions in this protocol are feed-forward. The operations they represent are not fully
4367/// executed until [`Present`] is called.
4368#[derive(Debug)]
4369pub enum FlatlandRequest {
4370    /// Releases an image immediately, without waiting for the next present.
4371    ReleaseImageImmediately {
4372        image_id: ContentId,
4373        control_handle: FlatlandControlHandle,
4374    },
4375    /// Complete execution of all feed-forward operations.
4376    ///
4377    /// If executing an operation produces an error (e.g., CreateTransform(0)), an [`OnError`] event
4378    /// is emitted. Operations that produce errors are ignored and the channel is closed.
4379    ///
4380    /// If the execution is completed successfully, [`OnNextFrameBegin`] emits NO_ERROR along
4381    /// with other valid fields.
4382    ///
4383    /// The client may only call [`Present`] when they have a non-zero number of present credits,
4384    /// which are tracked by the server. The server may increment the number of credits when it
4385    /// fires the [`OnNextFrameBegin`] event, which informs the client when it receives additional
4386    /// present credits. Each [`Present`] call uses one present credit and decrements the server
4387    /// count by one. If the client calls [`Present`] with no present credits, the server will
4388    /// return a `NO_PRESENTS_REMAINING` error.
4389    ///
4390    /// The client should assume that prior to receiving any [`OnNextFrameBegin`] events, they have
4391    /// one present credit.
4392    ///
4393    /// Every [`Present`] call results in one [`OnNextFrameBegin`] event, and one
4394    /// [`OnFramePresented`] event, typically in that order.
4395    ///
4396    /// When the commands flushed by [`Present`] make it to display, an [`OnFramePresented`] event
4397    /// is fired. This event includes information pertaining to all [`Present`]s that had content
4398    /// that were part of that frame.
4399    ///
4400    /// See [`fuchsia.ui.composition/PresentArgs`] documentation above for more detailed information
4401    /// on what arguments are passed in and their role.
4402    Present {
4403        args: PresentArgs,
4404        control_handle: FlatlandControlHandle,
4405    },
4406    /// Two Flatland instances may be connected in a parent-child relationship. The parent endpoint
4407    /// is held in a Viewport, and the child endpoint is held in a View. The parent Flatland
4408    /// instance that creates a Viewport has control over how the child's View is integrated into
4409    /// its own View.
4410    ///
4411    /// The lifecycle of a parent-child connection starts with two endpoints of a channel object:
4412    /// a ViewportCreationToken and a ViewCreationToken. Out-of-band protocols pass the
4413    /// ViewportCreationToken to the parent, which calls [`CreateViewport`], and the
4414    /// ViewCreationToken to the child, which calls [`CreateView`].
4415    ///
4416    /// Only nodes connected to the Root Transform in this Flatland instance will be rendered into
4417    /// the parent's Viewport.
4418    ///
4419    /// Calling [`CreateView`] a second time will disconnect the Root Transform from the existing
4420    /// parent's Viewport, and attach it to a new parent's Viewport. In other words, each View can
4421    /// only have one parent.
4422    ///
4423    /// This function is queued, meaning that the Root Transform will not be attached to the
4424    /// parent Viewport until [`Present`] is called. However, clients will receive information
4425    /// through their ParentViewportWatcher (e.g., LayoutInfo) immediately after calling this
4426    /// function, even if they have not called [`Present`] or [`SetRootTransform`]. This allows
4427    /// clients to wait for layout information from their parent before calling [`Present`].
4428    ///
4429    /// Any illegal operations on ParentViewportWatcher will cause both ParentViewportWatcher
4430    /// channel and this Flatland channel to be torn down.
4431    ///
4432    /// Lifecycle note. The lifetime of the ParentViewportWatcher channel is bound by the peer
4433    /// ViewportCreationToken. When the ViewportCreationToken dies, this ParentViewportWatcher
4434    /// channel is destroyed.
4435    ///
4436    /// Views and subgraphs of Views created using `CreateView` will not be represented in the
4437    /// ViewTree, and hence will not be able to participate in any ViewTree-dependent interactions
4438    /// such as touch, mouse or focus.
4439    /// The Flatland protocol provides no way for Views in the subgraph of a View created with
4440    /// `CreateView` to know that they are excluded from the ViewTree.
4441    CreateView {
4442        token: fidl_fuchsia_ui_views::ViewCreationToken,
4443        parent_viewport_watcher: fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>,
4444        control_handle: FlatlandControlHandle,
4445    },
4446    /// Identical to [`CreateView`], except it allows association of View identity (ViewRef) and
4447    /// view-bound protocols.
4448    CreateView2 {
4449        token: fidl_fuchsia_ui_views::ViewCreationToken,
4450        view_identity: fidl_fuchsia_ui_views::ViewIdentityOnCreation,
4451        protocols: ViewBoundProtocols,
4452        parent_viewport_watcher: fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>,
4453        control_handle: FlatlandControlHandle,
4454    },
4455    /// Creates a new Transform node. Transforms are a hierarchical piece of a Flatland graph. They
4456    /// can have children, and can reference Content. A sub-graph represented by a Transform and its
4457    /// descendants can be rendered to a display.
4458    ///
4459    /// Transforms are kept alive, even when released, as long as they are children of either an
4460    /// unreleased Transform, or the Root Transform.
4461    ///
4462    /// Each Transform can have a single piece of attached Content. Common types of Content include
4463    /// bitmaps, asynchronous streams of images, and Viewports to Views hosted in other Flatland
4464    /// instances.
4465    ///
4466    /// Transforms have attributes. Child Transforms inherit the combined attributes of their
4467    /// parents. Content attached to a Transform is also affected by that Transform's attributes.
4468    ///
4469    /// When a sub-graph of Transforms is rendered, Content will be rendered back-to-front, starting
4470    /// with the Content on the root transform, and continuing recursively through all of its child
4471    /// Transforms in the order the children were added. See [`AddChild`] for more information.
4472    ///
4473    /// Zero is not a valid transform id. All other values are valid, assuming they are not already
4474    /// in use (see [`ReleaseTransform`] for more details).
4475    CreateTransform {
4476        transform_id: TransformId,
4477        control_handle: FlatlandControlHandle,
4478    },
4479    /// All Transform objects support all attributes.
4480    ///
4481    /// Geometric attributes are applied in the following order:
4482    /// 1. Scale (relative to the parent transform's coordinate space)
4483    /// 2. Orientation (relative to the parent transform's coordinate space)
4484    /// 3. Translation (relative to the parent transforms's coordinate space,
4485    ///    unaffected by scale applied to the current transform).
4486    /// 4. Clipping (relative to the current transform's coordinate space)
4487    ///
4488    /// The effects of each of these attributes are cumulative. This means the transform's position
4489    /// in the view space, and its clip boundary, will be calculated based on that chain of
4490    /// geometric attributes going up to the root transform.
4491    ///
4492    /// For instance, in a nested hierarchy such as the following:
4493    ///     [Root-Transform -> Transform1 -> Transform2 -> CurrentTransform]
4494    /// If Transform1 is translated by [2,0] and Transform2 is translated by [0,1] then the
4495    /// view-space position of CurrentTransform will be [2,1].
4496    ///
4497    /// Sets the translation on a Transform. The order of geometric attribute application is
4498    /// addressed above.
4499    SetTranslation {
4500        transform_id: TransformId,
4501        translation: fidl_fuchsia_math::Vec_,
4502        control_handle: FlatlandControlHandle,
4503    },
4504    /// Sets the orientation on a Transform. The order of geometric attribute application is
4505    /// addressed in the documentation for [`SetTranslation`]. In Flatland, the +X axis is
4506    /// to the right and the +Y axis is down. There is no notion of a Z axis. CCW is defined
4507    /// from the POV of the user, as if a skeuomorphoic clock is displayed on the screen.
4508    SetOrientation {
4509        transform_id: TransformId,
4510        orientation: Orientation,
4511        control_handle: FlatlandControlHandle,
4512    },
4513    /// Sets the scale on a transform. The order of geometric attribute application is
4514    /// addressed above. The (x,y) values in the VecF |scale| refer to the scale factor in the
4515    /// x-axis (width) and y-axis (height) respectively. Scale values must be normal 32-bit
4516    /// floating point values: https://en.wikipedia.org/wiki/Normal_number_%28computing%29
4517    SetScale {
4518        transform_id: TransformId,
4519        scale: fidl_fuchsia_math::VecF,
4520        control_handle: FlatlandControlHandle,
4521    },
4522    /// Sets an opacity in linear space to be applied to a transform and its descendents,
4523    /// which include other transforms and content. Opacity values must be in the range
4524    /// of [0.0, 1.0], where 0.0 is completely transparent and 1.0 is completely opaque.
4525    /// Attempting to call this function with values outside that range will result in
4526    /// an error. A transform's opacity value is multiplied with that of its parent. This
4527    /// effect works differently from group opacity. Using group opacity, child nodes are
4528    /// rendered together first, and then have the parent's opacity applied as a post-effect.
4529    /// Here, opacity is applied to each child individually. This may result in a very
4530    /// different effect.
4531    SetOpacity {
4532        transform_id: TransformId,
4533        value: f32,
4534        control_handle: FlatlandControlHandle,
4535    },
4536    /// Sets the bounds, expressed in the local coordinate space of the transform, that
4537    /// constrains the region that content attached to this transform can be rendered to.
4538    /// If the content's area exceeds the clip bounds, the area outside the bounds will
4539    /// not be rendered. These bounds are valid for all children of this transform node as
4540    /// well, which includes nested Flatland instances and their node hierarchies.
4541    /// If a child transform attempts to set clip bounds larger than that of its parent,
4542    /// it will be clipped to the parent's clip bounds. The default state is for a transform
4543    /// to be unclipped, meaning it will not have any bounds placed on its render region.
4544    /// The clip width/height must be positive. Negative values will result in an error.
4545    /// Passing in an empty box to the |rect| parameter will remove the clip bounds.
4546    SetClipBoundary {
4547        transform_id: TransformId,
4548        rect: Option<Box<fidl_fuchsia_math::Rect>>,
4549        control_handle: FlatlandControlHandle,
4550    },
4551    /// Adds a child Transform to a parent Transform. The new child Transform,
4552    /// and any Content attached to it or its children, will be rendered on top
4553    /// of the parent's Content, as well as any previously added children.
4554    ///
4555    /// The caller must ensure that `child_transform_id` is valid and that there
4556    /// are no repetitions.  Sending a repeated `child_transform_id` over
4557    /// multiple calls will result in session closure.
4558    AddChild {
4559        parent_transform_id: TransformId,
4560        child_transform_id: TransformId,
4561        control_handle: FlatlandControlHandle,
4562    },
4563    /// Removes a child Transform from a parent Transform.
4564    RemoveChild {
4565        parent_transform_id: TransformId,
4566        child_transform_id: TransformId,
4567        control_handle: FlatlandControlHandle,
4568    },
4569    /// Removes all child Transforms from a parent Transform and replaces them
4570    /// with the new child transforms in `new_child_transform_ids`.  The caller
4571    /// must ensure that all `TransformId` values in `new_child_transform_ids`
4572    /// are valid and that there are no repetitions.  Sending a repeated
4573    /// `TransformId` in `new_child_transform_ids` will result in session
4574    /// closure.
4575    ReplaceChildren {
4576        parent_transform_id: TransformId,
4577        new_child_transform_ids: Vec<TransformId>,
4578        control_handle: FlatlandControlHandle,
4579    },
4580    /// Sets the Root Transform for the graph.
4581    ///
4582    /// The sub-graph defined by the Root Transform and its children will be rendered as View
4583    /// in the connected parent's Viewport (see [`CreateView`]). Any parents of the Root Transform
4584    /// in this Graph will be ignored.
4585    ///
4586    /// The Root Transform, and all children of the Root Transform, are kept alive if they are
4587    /// released (see [`ReleaseTransform`] for more details).
4588    ///
4589    /// There is only ever one Root. Since 0 is not a valid transform id (see [`CreateTransform`]),
4590    /// calling SetRootTransform(0) clears the current Root, destroying any previously released
4591    /// objects that are not referenced by the new root.
4592    ///
4593    /// Note that every View has a clip boundary equivalent to its logical size. Anything outside
4594    /// that clip boundary will not be rendered. Hence, the Root Transform has a useful coordinate
4595    /// space of (0, 0) to (logical_size.width, logical_size.height), where (0, 0) is the upper left
4596    /// corner.
4597    ///
4598    /// Setting the root transform installs a full screen hit region on the root transform. Clients
4599    /// may remove this hit region if they don't want users to be able to interact with the root
4600    /// transform's content. For additional details on hit regions, see the [`SetHitRegions`]
4601    /// documentation.
4602    ///
4603    /// Default hit region rules
4604    ///
4605    ///   A default hit region follows these rules:
4606    ///   - When [`SetRootTransform`](T) is called, T receives a maximal hit region, covering the
4607    ///   entire view.
4608    ///   - If [`SetHitRegions`] is called on T, either before or after [`SetRootTransform`](T),
4609    ///   then no default hit region is active and the client specified hit regions are used.
4610    ///   - If a transform is no longer the root transform, i.e., [`SetRootTransform`](U) is
4611    ///   called, then the original transform no longer has its default hit region.
4612    ///   - Clients can remove or modify the root transform's hit regions the same way they would
4613    ///   reset any other transform's hit regions, by calling [`SetHitRegions`] with the appropriate
4614    ///   vector.
4615    SetRootTransform {
4616        transform_id: TransformId,
4617        control_handle: FlatlandControlHandle,
4618    },
4619    /// Sets the interactive areas for a Transform. By default, Content is not interactive; hit
4620    /// regions must be placed for a user to interact with the Content in a View. Because hit
4621    /// regions are described in the Flatland protocol, a Flatland instance can synchronize Content
4622    /// and hit regions.
4623    ///
4624    /// Each hit region is placed in the coordinate space of the owning Transform, and may or may
4625    /// not interact with different types of hit testing, depending on its [`HitTestInteraction`]
4626    /// type. When there are multiple hit regions that intersect with a hit test, the precedence
4627    /// rules given below dictate which hit region has interacted with the hit test. Only Transforms
4628    /// that transitively connect to the root Transform have their hit regions interact with a hit
4629    /// test.
4630    ///
4631    /// Calling this function replaces any previous values set on this Transform. To reset a
4632    /// Transform to "no hit testing": send an empty vector with [`SetHitRegions`].
4633    ///
4634    /// Note that root transforms get a default hit region installed by Flatland. For more details,
4635    /// see the [`SetRootTransform`] documentation.
4636    ///
4637    /// Precedence rules
4638    ///   Within a Transform, if multiple hit regions overlap, the hit test examines each
4639    ///   intersecting hit region for a possible interaction. Thus, for a regular hit test R and an
4640    ///   accessibility hit test A, where R and A both intersect two hit regions D ([`DEFAULT`]) and
4641    ///   S ([`SEMANTICALLY_INVISIBLE`]) on the same Transform, (1) R interacts with both D and S,
4642    ///   and (2) A only interacts with D. Generally, hit regions that overlap in a single Transform
4643    ///   can cause confusing behavior.
4644    ///
4645    ///   Within a View, for a given hit test, the front-most Transform's hit regions take
4646    ///   precedence over those behind. This follows the expected reverse "render order" of
4647    ///   Transforms (described in [`CreateTransform`]), where a user expects to interact with
4648    ///   Content that is visible, or front-most.
4649    ///
4650    ///   Across Flatland instances, for a given hit test, the front-most instance's front-most
4651    ///   Transform's hit regions take precedence over those behind. This follows the expected
4652    ///   reverse "render order" of views, where a user expects to interact with the View that is
4653    ///   visible, or front-most. For example, if a child View owns Content that is rendered over
4654    ///   the parent View, the user expects to interact with the child's Content.
4655    SetHitRegions {
4656        transform_id: TransformId,
4657        regions: Vec<HitRegion>,
4658        control_handle: FlatlandControlHandle,
4659    },
4660    /// Identical to [`SetHitRegions`], except the hit region associated with [`transform_id`]
4661    /// covers an infinite region. The hit region is invariant against translation, scaling, and
4662    /// orientation of the Transform.
4663    ///
4664    /// An infinite hit region is still limited in extent by the View's clip boundary, just like a
4665    /// finite hit region.
4666    ///
4667    /// Calling this function replaces any previous values set on this Transform. To reset a
4668    /// Transform to "no hit testing": send an empty vector with [`SetHitRegions`].
4669    SetInfiniteHitRegion {
4670        transform_id: TransformId,
4671        hit_test: HitTestInteraction,
4672        control_handle: FlatlandControlHandle,
4673    },
4674    /// The Viewport and View pair, together, represent the connection between two Flatland
4675    /// instances. The Viewport is created in the parent, and the View is created in the child. The
4676    /// parent has control over how the child's View is integrated into its own View.
4677    ///
4678    /// Any illegal operations on ChildViewWatcher will cause both ChildViewWatcher channel and this
4679    /// Flatland channel to be torn down.
4680    ///
4681    /// `ViewportProperties` must have logical_size set. This is the initial size that will drive
4682    /// the layout of the child. The logical_size is also used as the default Content size, but
4683    /// subsequent changes to the logical_size will have no effect on the Content size.
4684    ///
4685    /// `ViewportProperties` may have inset field not set. In that case, the default value of
4686    /// (0, 0, 0, 0) is used.
4687    ///
4688    /// The logical_size must have positive X and Y components.
4689    ///
4690    /// Zero is not a valid ContentId. All other values are valid, assuming they are not already
4691    /// in use for another piece of Content (see [`ReleaseViewport`] for more details).
4692    ///
4693    /// Lifecycle note. The lifetime of the ChildViewWatcher channel is bound by the peer
4694    /// ViewCreationToken. When the ViewCreationToken dies, this ChildViewWatcher channel is
4695    /// destroyed.
4696    CreateViewport {
4697        viewport_id: ContentId,
4698        token: fidl_fuchsia_ui_views::ViewportCreationToken,
4699        properties: ViewportProperties,
4700        child_view_watcher: fidl::endpoints::ServerEnd<ChildViewWatcherMarker>,
4701        control_handle: FlatlandControlHandle,
4702    },
4703    /// An Image is a bitmap backed by a specific VMO in a BufferCollection.
4704    ///
4705    /// Image creation requires an allocated BufferCollection registered with Allocator. This
4706    /// function will fail unless all clients of the specified BufferCollection have set their
4707    /// constraints.
4708    ///
4709    /// The Image must reference a valid VMO index and must have ImageProperties that fall within
4710    /// the constraints specified by the backing BufferCollection (i.e. width and height within a
4711    /// valid range, etc.)
4712    ///
4713    /// Zero is not a valid Image id. All other values are valid, assuming they are not already in
4714    /// use for another piece of Content (see [`ReleaseImage`] for more details).
4715    CreateImage {
4716        image_id: ContentId,
4717        import_token: BufferCollectionImportToken,
4718        vmo_index: u32,
4719        properties: ImageProperties,
4720        control_handle: FlatlandControlHandle,
4721    },
4722    /// This function is used to determine the region (in texel space) of an image that will be used
4723    /// by Flatland when rendering. The image to be sampled is referenced by [`image_id`] and the
4724    /// sample region is specified by [`rect`] which itself is comprised of an origin point (x,y) as
4725    /// well as a width and height, in unnormalized coordinates. It is illegal to call this function
4726    /// on non-image content, or to sample a region outside of the texel space of the image. In
4727    /// other words, the region specifed by [`rect`] must not exceed the ranges (0, image_width) and
4728    /// (0, image_height). If (rect.x + rect.width > image_width) or (rect.y + rect.height >
4729    /// image_height) or if any of the values are negative, this will result in an error.
4730    ///
4731    /// If this method is not called, the default sample region is the rectangle with origin at
4732    /// (0, 0) and width and height set at ImageProperties from [`CreateImage`].
4733    SetImageSampleRegion {
4734        image_id: ContentId,
4735        rect: fidl_fuchsia_math::RectF,
4736        control_handle: FlatlandControlHandle,
4737    },
4738    /// The content size for an Image is the size of the rectangle in the parent's logical
4739    /// coordinate space that the image occupies. This combined with the global translation of the
4740    /// transform it is attached to determines the size and location of where the content is
4741    /// rendered on the display.
4742    ///
4743    /// If this method is not called, the default image destination size is the width and height set
4744    /// at ImageProperties from [`CreateImage`]. The destination size will be affected by scaling if
4745    /// [`SetScale`] is used on the attached Transform or its parents.
4746    SetImageDestinationSize {
4747        image_id: ContentId,
4748        size: fidl_fuchsia_math::SizeU,
4749        control_handle: FlatlandControlHandle,
4750    },
4751    /// Determines the blend function to use when rendering the content specified by
4752    /// |image_id|. |image_id| must be a valid ContentId associated to a transform through
4753    /// a call to |CreateImage| or |CreateFilledRect|. For details on the different blend functions
4754    /// that are available, please refer to the BlendMode enum. If this function is not called, then
4755    /// the default blendmode is BlendMode::SRC.
4756    SetImageBlendingFunction {
4757        image_id: ContentId,
4758        blend_mode: BlendMode,
4759        control_handle: FlatlandControlHandle,
4760    },
4761    /// Determines the blend function to use when rendering the content specified by
4762    /// |image_id|. |image_id| must be a valid ContentId associated to a transform through
4763    /// a call to |CreateImage| or |CreateFilledRect|. For details on the different blend functions
4764    /// that are available, please refer to the BlendMode2 enum. If this function is not called,
4765    /// the default blendmode is BlendMode2::REPLACE.
4766    SetImageBlendMode {
4767        image_id: ContentId,
4768        blend_mode: BlendMode2,
4769        control_handle: FlatlandControlHandle,
4770    },
4771    /// Sets an opacity in linear space to be applied to a flatland image. Opacity values must
4772    /// be in the range [0.0, 1.0].
4773    SetImageOpacity {
4774        image_id: ContentId,
4775        val: f32,
4776        control_handle: FlatlandControlHandle,
4777    },
4778    /// Sets the image flip to be applied to a flatland image. This call must be performed after a
4779    /// successful |CreateImage| call. If an invalid |image_id| is supplied, the channel will be
4780    /// closed due to FlatlandError::BAD_OPERATION. This flip will be applied to the Image before
4781    /// parent Transform Orientations. If this function is not called, then the default flip value
4782    /// is ImageFlip::NONE.
4783    SetImageFlip {
4784        image_id: ContentId,
4785        flip: ImageFlip,
4786        control_handle: FlatlandControlHandle,
4787    },
4788    /// Creates a solid-color rectangle. By default a filled-rect does not have a defined
4789    /// color or size. It is necessary to call |SetSolidFill| to specify a color and size
4790    /// before a filled rect can be used for rendering. Not doing so will result the
4791    CreateFilledRect {
4792        rect_id: ContentId,
4793        control_handle: FlatlandControlHandle,
4794    },
4795    /// Defines the color and size of a filled rect. |rect_id| must refer to content that
4796    /// was created via a call to CreateFilledRect. The color is not premultiplied. Color values
4797    /// must be within the range [0,1] inclusive, and normal 32-bit
4798    /// floating point values: https://en.wikipedia.org/wiki/Normal_number_%28computing%29. Values
4799    /// that do not conform to these specifications will cause the channel to close.
4800    /// The rectangle's top left corner will be at (0, 0) in its transform's coordinate space.
4801    /// Hence, its bottom right corner will be at (size.width, size.height).
4802    SetSolidFill {
4803        rect_id: ContentId,
4804        color: ColorRgba,
4805        size: fidl_fuchsia_math::SizeU,
4806        control_handle: FlatlandControlHandle,
4807    },
4808    /// Automatically garbage collects the rectangle when it is no longer needed for
4809    /// rendering. |rect_id| must have been instantiated with a call to
4810    /// |CreateFilledRect|. Once released, the ID immediately goes out of scope and is free
4811    /// to be used again.
4812    ReleaseFilledRect {
4813        rect_id: ContentId,
4814        control_handle: FlatlandControlHandle,
4815    },
4816    /// Setting a piece of Content on a Transform makes that Content visible in the render tree as
4817    /// long as the Transform is visible from the root Transform. The Content will be rendered
4818    /// before, and therefore "behind", any Content attached to the descendants of the Transform.
4819    ///
4820    /// Because each Transform can have, at most, a single piece of Content on it, calling this
4821    /// function on a Transform that already has Content will replace that Content.
4822    ///
4823    /// A Content may be set on more than one Transform.
4824    ///
4825    /// Calling this function with a Content id of 0 will remove any Content currently on the
4826    /// Transform.
4827    SetContent {
4828        transform_id: TransformId,
4829        content_id: ContentId,
4830        control_handle: FlatlandControlHandle,
4831    },
4832    /// Transforms are usually sufficient to change how Content is presented. Viewports, however,
4833    /// have special properties that are not part of the Transform hierarchy. Those properties can
4834    /// be set using this function.
4835    SetViewportProperties {
4836        viewport_id: ContentId,
4837        properties: ViewportProperties,
4838        control_handle: FlatlandControlHandle,
4839    },
4840    /// Released Transforms will be garbage collected by the system once they are no longer
4841    /// necessary for rendering. For Transforms, this means there is no path from any unreleased
4842    /// Transform to the newly-released Transform.
4843    ///
4844    /// Once released, the id immediately goes out of scope for future function calls and can be
4845    /// reused when creating new Transforms.
4846    ///
4847    /// It is an error to call functions with a released id (unless that id has been reused to
4848    /// construct a new Transform).
4849    ReleaseTransform {
4850        transform_id: TransformId,
4851        control_handle: FlatlandControlHandle,
4852    },
4853    ReleaseView {
4854        control_handle: FlatlandControlHandle,
4855    },
4856    /// Releases a Viewport from the scene, even if the Viewport is still connected to a Transform.
4857    /// Unlike other resources, Viewports are garbage collected by the system during the next
4858    /// [`Present`] because a removed Viewport is guaranteed to provide no renderable content.
4859    ///
4860    /// Use SetContent(transform_id, 0) to clean up references to released Viewports.
4861    ///
4862    /// Despite having a return type, this function is still feed-forward like [`CreateView`] and
4863    /// requires a call to [`Present`] to be executed. The ViewportCreationToken will be returned
4864    /// after the presented operations have been executed.
4865    ReleaseViewport {
4866        viewport_id: ContentId,
4867        responder: FlatlandReleaseViewportResponder,
4868    },
4869    /// Released Images will be garbage collected by the system once they are no longer necessary
4870    /// for rendering. For Images, this means the Image is no longer attached to any Transform and
4871    /// any pending rendering that references the Image is complete.
4872    ///
4873    /// Use SetContent(transform_id, 0) to clean up references to released Images.
4874    ///
4875    /// Once released, the id immediately goes out of scope for future function calls and can be
4876    /// reused when creating new Images.
4877    ///
4878    /// It is an error to call functions with a released id (unless that id has been reused to
4879    /// construct a new Image).
4880    ReleaseImage {
4881        image_id: ContentId,
4882        control_handle: FlatlandControlHandle,
4883    },
4884    /// This function will reset all state on this interface. This includes destroying all existing
4885    /// View and Viewports without returning the associated Token to the caller.
4886    Clear {
4887        control_handle: FlatlandControlHandle,
4888    },
4889    /// Set debug name of the current client that can be used by Flatland to print as a prefix to
4890    /// logs to help client distinguish what is theirs. [`name`] can be an arbitrary string, but the
4891    /// current process name (see fsl::GetCurrentProcessName()) is a good default.
4892    SetDebugName {
4893        name: String,
4894        control_handle: FlatlandControlHandle,
4895    },
4896}
4897
4898impl FlatlandRequest {
4899    #[allow(irrefutable_let_patterns)]
4900    pub fn into_release_image_immediately(self) -> Option<(ContentId, FlatlandControlHandle)> {
4901        if let FlatlandRequest::ReleaseImageImmediately { image_id, control_handle } = self {
4902            Some((image_id, control_handle))
4903        } else {
4904            None
4905        }
4906    }
4907
4908    #[allow(irrefutable_let_patterns)]
4909    pub fn into_present(self) -> Option<(PresentArgs, FlatlandControlHandle)> {
4910        if let FlatlandRequest::Present { args, control_handle } = self {
4911            Some((args, control_handle))
4912        } else {
4913            None
4914        }
4915    }
4916
4917    #[allow(irrefutable_let_patterns)]
4918    pub fn into_create_view(
4919        self,
4920    ) -> Option<(
4921        fidl_fuchsia_ui_views::ViewCreationToken,
4922        fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>,
4923        FlatlandControlHandle,
4924    )> {
4925        if let FlatlandRequest::CreateView { token, parent_viewport_watcher, control_handle } = self
4926        {
4927            Some((token, parent_viewport_watcher, control_handle))
4928        } else {
4929            None
4930        }
4931    }
4932
4933    #[allow(irrefutable_let_patterns)]
4934    pub fn into_create_view2(
4935        self,
4936    ) -> Option<(
4937        fidl_fuchsia_ui_views::ViewCreationToken,
4938        fidl_fuchsia_ui_views::ViewIdentityOnCreation,
4939        ViewBoundProtocols,
4940        fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>,
4941        FlatlandControlHandle,
4942    )> {
4943        if let FlatlandRequest::CreateView2 {
4944            token,
4945            view_identity,
4946            protocols,
4947            parent_viewport_watcher,
4948            control_handle,
4949        } = self
4950        {
4951            Some((token, view_identity, protocols, parent_viewport_watcher, control_handle))
4952        } else {
4953            None
4954        }
4955    }
4956
4957    #[allow(irrefutable_let_patterns)]
4958    pub fn into_create_transform(self) -> Option<(TransformId, FlatlandControlHandle)> {
4959        if let FlatlandRequest::CreateTransform { transform_id, control_handle } = self {
4960            Some((transform_id, control_handle))
4961        } else {
4962            None
4963        }
4964    }
4965
4966    #[allow(irrefutable_let_patterns)]
4967    pub fn into_set_translation(
4968        self,
4969    ) -> Option<(TransformId, fidl_fuchsia_math::Vec_, FlatlandControlHandle)> {
4970        if let FlatlandRequest::SetTranslation { transform_id, translation, control_handle } = self
4971        {
4972            Some((transform_id, translation, control_handle))
4973        } else {
4974            None
4975        }
4976    }
4977
4978    #[allow(irrefutable_let_patterns)]
4979    pub fn into_set_orientation(self) -> Option<(TransformId, Orientation, FlatlandControlHandle)> {
4980        if let FlatlandRequest::SetOrientation { transform_id, orientation, control_handle } = self
4981        {
4982            Some((transform_id, orientation, control_handle))
4983        } else {
4984            None
4985        }
4986    }
4987
4988    #[allow(irrefutable_let_patterns)]
4989    pub fn into_set_scale(
4990        self,
4991    ) -> Option<(TransformId, fidl_fuchsia_math::VecF, FlatlandControlHandle)> {
4992        if let FlatlandRequest::SetScale { transform_id, scale, control_handle } = self {
4993            Some((transform_id, scale, control_handle))
4994        } else {
4995            None
4996        }
4997    }
4998
4999    #[allow(irrefutable_let_patterns)]
5000    pub fn into_set_opacity(self) -> Option<(TransformId, f32, FlatlandControlHandle)> {
5001        if let FlatlandRequest::SetOpacity { transform_id, value, control_handle } = self {
5002            Some((transform_id, value, control_handle))
5003        } else {
5004            None
5005        }
5006    }
5007
5008    #[allow(irrefutable_let_patterns)]
5009    pub fn into_set_clip_boundary(
5010        self,
5011    ) -> Option<(TransformId, Option<Box<fidl_fuchsia_math::Rect>>, FlatlandControlHandle)> {
5012        if let FlatlandRequest::SetClipBoundary { transform_id, rect, control_handle } = self {
5013            Some((transform_id, rect, control_handle))
5014        } else {
5015            None
5016        }
5017    }
5018
5019    #[allow(irrefutable_let_patterns)]
5020    pub fn into_add_child(self) -> Option<(TransformId, TransformId, FlatlandControlHandle)> {
5021        if let FlatlandRequest::AddChild {
5022            parent_transform_id,
5023            child_transform_id,
5024            control_handle,
5025        } = self
5026        {
5027            Some((parent_transform_id, child_transform_id, control_handle))
5028        } else {
5029            None
5030        }
5031    }
5032
5033    #[allow(irrefutable_let_patterns)]
5034    pub fn into_remove_child(self) -> Option<(TransformId, TransformId, FlatlandControlHandle)> {
5035        if let FlatlandRequest::RemoveChild {
5036            parent_transform_id,
5037            child_transform_id,
5038            control_handle,
5039        } = self
5040        {
5041            Some((parent_transform_id, child_transform_id, control_handle))
5042        } else {
5043            None
5044        }
5045    }
5046
5047    #[allow(irrefutable_let_patterns)]
5048    pub fn into_replace_children(
5049        self,
5050    ) -> Option<(TransformId, Vec<TransformId>, FlatlandControlHandle)> {
5051        if let FlatlandRequest::ReplaceChildren {
5052            parent_transform_id,
5053            new_child_transform_ids,
5054            control_handle,
5055        } = self
5056        {
5057            Some((parent_transform_id, new_child_transform_ids, control_handle))
5058        } else {
5059            None
5060        }
5061    }
5062
5063    #[allow(irrefutable_let_patterns)]
5064    pub fn into_set_root_transform(self) -> Option<(TransformId, FlatlandControlHandle)> {
5065        if let FlatlandRequest::SetRootTransform { transform_id, control_handle } = self {
5066            Some((transform_id, control_handle))
5067        } else {
5068            None
5069        }
5070    }
5071
5072    #[allow(irrefutable_let_patterns)]
5073    pub fn into_set_hit_regions(
5074        self,
5075    ) -> Option<(TransformId, Vec<HitRegion>, FlatlandControlHandle)> {
5076        if let FlatlandRequest::SetHitRegions { transform_id, regions, control_handle } = self {
5077            Some((transform_id, regions, control_handle))
5078        } else {
5079            None
5080        }
5081    }
5082
5083    #[allow(irrefutable_let_patterns)]
5084    pub fn into_set_infinite_hit_region(
5085        self,
5086    ) -> Option<(TransformId, HitTestInteraction, FlatlandControlHandle)> {
5087        if let FlatlandRequest::SetInfiniteHitRegion { transform_id, hit_test, control_handle } =
5088            self
5089        {
5090            Some((transform_id, hit_test, control_handle))
5091        } else {
5092            None
5093        }
5094    }
5095
5096    #[allow(irrefutable_let_patterns)]
5097    pub fn into_create_viewport(
5098        self,
5099    ) -> Option<(
5100        ContentId,
5101        fidl_fuchsia_ui_views::ViewportCreationToken,
5102        ViewportProperties,
5103        fidl::endpoints::ServerEnd<ChildViewWatcherMarker>,
5104        FlatlandControlHandle,
5105    )> {
5106        if let FlatlandRequest::CreateViewport {
5107            viewport_id,
5108            token,
5109            properties,
5110            child_view_watcher,
5111            control_handle,
5112        } = self
5113        {
5114            Some((viewport_id, token, properties, child_view_watcher, control_handle))
5115        } else {
5116            None
5117        }
5118    }
5119
5120    #[allow(irrefutable_let_patterns)]
5121    pub fn into_create_image(
5122        self,
5123    ) -> Option<(ContentId, BufferCollectionImportToken, u32, ImageProperties, FlatlandControlHandle)>
5124    {
5125        if let FlatlandRequest::CreateImage {
5126            image_id,
5127            import_token,
5128            vmo_index,
5129            properties,
5130            control_handle,
5131        } = self
5132        {
5133            Some((image_id, import_token, vmo_index, properties, control_handle))
5134        } else {
5135            None
5136        }
5137    }
5138
5139    #[allow(irrefutable_let_patterns)]
5140    pub fn into_set_image_sample_region(
5141        self,
5142    ) -> Option<(ContentId, fidl_fuchsia_math::RectF, FlatlandControlHandle)> {
5143        if let FlatlandRequest::SetImageSampleRegion { image_id, rect, control_handle } = self {
5144            Some((image_id, rect, control_handle))
5145        } else {
5146            None
5147        }
5148    }
5149
5150    #[allow(irrefutable_let_patterns)]
5151    pub fn into_set_image_destination_size(
5152        self,
5153    ) -> Option<(ContentId, fidl_fuchsia_math::SizeU, FlatlandControlHandle)> {
5154        if let FlatlandRequest::SetImageDestinationSize { image_id, size, control_handle } = self {
5155            Some((image_id, size, control_handle))
5156        } else {
5157            None
5158        }
5159    }
5160
5161    #[allow(irrefutable_let_patterns)]
5162    pub fn into_set_image_blending_function(
5163        self,
5164    ) -> Option<(ContentId, BlendMode, FlatlandControlHandle)> {
5165        if let FlatlandRequest::SetImageBlendingFunction { image_id, blend_mode, control_handle } =
5166            self
5167        {
5168            Some((image_id, blend_mode, control_handle))
5169        } else {
5170            None
5171        }
5172    }
5173
5174    #[allow(irrefutable_let_patterns)]
5175    pub fn into_set_image_blend_mode(
5176        self,
5177    ) -> Option<(ContentId, BlendMode2, FlatlandControlHandle)> {
5178        if let FlatlandRequest::SetImageBlendMode { image_id, blend_mode, control_handle } = self {
5179            Some((image_id, blend_mode, control_handle))
5180        } else {
5181            None
5182        }
5183    }
5184
5185    #[allow(irrefutable_let_patterns)]
5186    pub fn into_set_image_opacity(self) -> Option<(ContentId, f32, FlatlandControlHandle)> {
5187        if let FlatlandRequest::SetImageOpacity { image_id, val, control_handle } = self {
5188            Some((image_id, val, control_handle))
5189        } else {
5190            None
5191        }
5192    }
5193
5194    #[allow(irrefutable_let_patterns)]
5195    pub fn into_set_image_flip(self) -> Option<(ContentId, ImageFlip, FlatlandControlHandle)> {
5196        if let FlatlandRequest::SetImageFlip { image_id, flip, control_handle } = self {
5197            Some((image_id, flip, control_handle))
5198        } else {
5199            None
5200        }
5201    }
5202
5203    #[allow(irrefutable_let_patterns)]
5204    pub fn into_create_filled_rect(self) -> Option<(ContentId, FlatlandControlHandle)> {
5205        if let FlatlandRequest::CreateFilledRect { rect_id, control_handle } = self {
5206            Some((rect_id, control_handle))
5207        } else {
5208            None
5209        }
5210    }
5211
5212    #[allow(irrefutable_let_patterns)]
5213    pub fn into_set_solid_fill(
5214        self,
5215    ) -> Option<(ContentId, ColorRgba, fidl_fuchsia_math::SizeU, FlatlandControlHandle)> {
5216        if let FlatlandRequest::SetSolidFill { rect_id, color, size, control_handle } = self {
5217            Some((rect_id, color, size, control_handle))
5218        } else {
5219            None
5220        }
5221    }
5222
5223    #[allow(irrefutable_let_patterns)]
5224    pub fn into_release_filled_rect(self) -> Option<(ContentId, FlatlandControlHandle)> {
5225        if let FlatlandRequest::ReleaseFilledRect { rect_id, control_handle } = self {
5226            Some((rect_id, control_handle))
5227        } else {
5228            None
5229        }
5230    }
5231
5232    #[allow(irrefutable_let_patterns)]
5233    pub fn into_set_content(self) -> Option<(TransformId, ContentId, FlatlandControlHandle)> {
5234        if let FlatlandRequest::SetContent { transform_id, content_id, control_handle } = self {
5235            Some((transform_id, content_id, control_handle))
5236        } else {
5237            None
5238        }
5239    }
5240
5241    #[allow(irrefutable_let_patterns)]
5242    pub fn into_set_viewport_properties(
5243        self,
5244    ) -> Option<(ContentId, ViewportProperties, FlatlandControlHandle)> {
5245        if let FlatlandRequest::SetViewportProperties { viewport_id, properties, control_handle } =
5246            self
5247        {
5248            Some((viewport_id, properties, control_handle))
5249        } else {
5250            None
5251        }
5252    }
5253
5254    #[allow(irrefutable_let_patterns)]
5255    pub fn into_release_transform(self) -> Option<(TransformId, FlatlandControlHandle)> {
5256        if let FlatlandRequest::ReleaseTransform { transform_id, control_handle } = self {
5257            Some((transform_id, control_handle))
5258        } else {
5259            None
5260        }
5261    }
5262
5263    #[allow(irrefutable_let_patterns)]
5264    pub fn into_release_view(self) -> Option<(FlatlandControlHandle)> {
5265        if let FlatlandRequest::ReleaseView { control_handle } = self {
5266            Some((control_handle))
5267        } else {
5268            None
5269        }
5270    }
5271
5272    #[allow(irrefutable_let_patterns)]
5273    pub fn into_release_viewport(self) -> Option<(ContentId, FlatlandReleaseViewportResponder)> {
5274        if let FlatlandRequest::ReleaseViewport { viewport_id, responder } = self {
5275            Some((viewport_id, responder))
5276        } else {
5277            None
5278        }
5279    }
5280
5281    #[allow(irrefutable_let_patterns)]
5282    pub fn into_release_image(self) -> Option<(ContentId, FlatlandControlHandle)> {
5283        if let FlatlandRequest::ReleaseImage { image_id, control_handle } = self {
5284            Some((image_id, control_handle))
5285        } else {
5286            None
5287        }
5288    }
5289
5290    #[allow(irrefutable_let_patterns)]
5291    pub fn into_clear(self) -> Option<(FlatlandControlHandle)> {
5292        if let FlatlandRequest::Clear { control_handle } = self {
5293            Some((control_handle))
5294        } else {
5295            None
5296        }
5297    }
5298
5299    #[allow(irrefutable_let_patterns)]
5300    pub fn into_set_debug_name(self) -> Option<(String, FlatlandControlHandle)> {
5301        if let FlatlandRequest::SetDebugName { name, control_handle } = self {
5302            Some((name, control_handle))
5303        } else {
5304            None
5305        }
5306    }
5307
5308    /// Name of the method defined in FIDL
5309    pub fn method_name(&self) -> &'static str {
5310        match *self {
5311            FlatlandRequest::ReleaseImageImmediately { .. } => "release_image_immediately",
5312            FlatlandRequest::Present { .. } => "present",
5313            FlatlandRequest::CreateView { .. } => "create_view",
5314            FlatlandRequest::CreateView2 { .. } => "create_view2",
5315            FlatlandRequest::CreateTransform { .. } => "create_transform",
5316            FlatlandRequest::SetTranslation { .. } => "set_translation",
5317            FlatlandRequest::SetOrientation { .. } => "set_orientation",
5318            FlatlandRequest::SetScale { .. } => "set_scale",
5319            FlatlandRequest::SetOpacity { .. } => "set_opacity",
5320            FlatlandRequest::SetClipBoundary { .. } => "set_clip_boundary",
5321            FlatlandRequest::AddChild { .. } => "add_child",
5322            FlatlandRequest::RemoveChild { .. } => "remove_child",
5323            FlatlandRequest::ReplaceChildren { .. } => "replace_children",
5324            FlatlandRequest::SetRootTransform { .. } => "set_root_transform",
5325            FlatlandRequest::SetHitRegions { .. } => "set_hit_regions",
5326            FlatlandRequest::SetInfiniteHitRegion { .. } => "set_infinite_hit_region",
5327            FlatlandRequest::CreateViewport { .. } => "create_viewport",
5328            FlatlandRequest::CreateImage { .. } => "create_image",
5329            FlatlandRequest::SetImageSampleRegion { .. } => "set_image_sample_region",
5330            FlatlandRequest::SetImageDestinationSize { .. } => "set_image_destination_size",
5331            FlatlandRequest::SetImageBlendingFunction { .. } => "set_image_blending_function",
5332            FlatlandRequest::SetImageBlendMode { .. } => "set_image_blend_mode",
5333            FlatlandRequest::SetImageOpacity { .. } => "set_image_opacity",
5334            FlatlandRequest::SetImageFlip { .. } => "set_image_flip",
5335            FlatlandRequest::CreateFilledRect { .. } => "create_filled_rect",
5336            FlatlandRequest::SetSolidFill { .. } => "set_solid_fill",
5337            FlatlandRequest::ReleaseFilledRect { .. } => "release_filled_rect",
5338            FlatlandRequest::SetContent { .. } => "set_content",
5339            FlatlandRequest::SetViewportProperties { .. } => "set_viewport_properties",
5340            FlatlandRequest::ReleaseTransform { .. } => "release_transform",
5341            FlatlandRequest::ReleaseView { .. } => "release_view",
5342            FlatlandRequest::ReleaseViewport { .. } => "release_viewport",
5343            FlatlandRequest::ReleaseImage { .. } => "release_image",
5344            FlatlandRequest::Clear { .. } => "clear",
5345            FlatlandRequest::SetDebugName { .. } => "set_debug_name",
5346        }
5347    }
5348}
5349
5350#[derive(Debug, Clone)]
5351pub struct FlatlandControlHandle {
5352    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5353}
5354
5355impl fidl::endpoints::ControlHandle for FlatlandControlHandle {
5356    fn shutdown(&self) {
5357        self.inner.shutdown()
5358    }
5359
5360    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
5361        self.inner.shutdown_with_epitaph(status)
5362    }
5363
5364    fn is_closed(&self) -> bool {
5365        self.inner.channel().is_closed()
5366    }
5367    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
5368        self.inner.channel().on_closed()
5369    }
5370
5371    #[cfg(target_os = "fuchsia")]
5372    fn signal_peer(
5373        &self,
5374        clear_mask: zx::Signals,
5375        set_mask: zx::Signals,
5376    ) -> Result<(), zx_status::Status> {
5377        use fidl::Peered;
5378        self.inner.channel().signal_peer(clear_mask, set_mask)
5379    }
5380}
5381
5382impl FlatlandControlHandle {
5383    pub fn send_on_next_frame_begin(
5384        &self,
5385        mut values: &OnNextFrameBeginValues,
5386    ) -> Result<(), fidl::Error> {
5387        self.inner.send::<FlatlandOnNextFrameBeginRequest>(
5388            (values,),
5389            0,
5390            0x10f69a5cdeece84a,
5391            fidl::encoding::DynamicFlags::empty(),
5392        )
5393    }
5394
5395    pub fn send_on_frame_presented(
5396        &self,
5397        mut frame_presented_info: &fidl_fuchsia_scenic_scheduling::FramePresentedInfo,
5398    ) -> Result<(), fidl::Error> {
5399        self.inner.send::<FlatlandOnFramePresentedRequest>(
5400            (frame_presented_info,),
5401            0,
5402            0x56e43e1a5f30216d,
5403            fidl::encoding::DynamicFlags::empty(),
5404        )
5405    }
5406
5407    pub fn send_on_error(&self, mut error: FlatlandError) -> Result<(), fidl::Error> {
5408        self.inner.send::<FlatlandOnErrorRequest>(
5409            (error,),
5410            0,
5411            0x1ebf39e90cd8b8d,
5412            fidl::encoding::DynamicFlags::empty(),
5413        )
5414    }
5415}
5416
5417#[must_use = "FIDL methods require a response to be sent"]
5418#[derive(Debug)]
5419pub struct FlatlandReleaseViewportResponder {
5420    control_handle: std::mem::ManuallyDrop<FlatlandControlHandle>,
5421    tx_id: u32,
5422}
5423
5424/// Set the the channel to be shutdown (see [`FlatlandControlHandle::shutdown`])
5425/// if the responder is dropped without sending a response, so that the client
5426/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5427impl std::ops::Drop for FlatlandReleaseViewportResponder {
5428    fn drop(&mut self) {
5429        self.control_handle.shutdown();
5430        // Safety: drops once, never accessed again
5431        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5432    }
5433}
5434
5435impl fidl::endpoints::Responder for FlatlandReleaseViewportResponder {
5436    type ControlHandle = FlatlandControlHandle;
5437
5438    fn control_handle(&self) -> &FlatlandControlHandle {
5439        &self.control_handle
5440    }
5441
5442    fn drop_without_shutdown(mut self) {
5443        // Safety: drops once, never accessed again due to mem::forget
5444        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5445        // Prevent Drop from running (which would shut down the channel)
5446        std::mem::forget(self);
5447    }
5448}
5449
5450impl FlatlandReleaseViewportResponder {
5451    /// Sends a response to the FIDL transaction.
5452    ///
5453    /// Sets the channel to shutdown if an error occurs.
5454    pub fn send(
5455        self,
5456        mut token: fidl_fuchsia_ui_views::ViewportCreationToken,
5457    ) -> Result<(), fidl::Error> {
5458        let _result = self.send_raw(token);
5459        if _result.is_err() {
5460            self.control_handle.shutdown();
5461        }
5462        self.drop_without_shutdown();
5463        _result
5464    }
5465
5466    /// Similar to "send" but does not shutdown the channel if an error occurs.
5467    pub fn send_no_shutdown_on_err(
5468        self,
5469        mut token: fidl_fuchsia_ui_views::ViewportCreationToken,
5470    ) -> Result<(), fidl::Error> {
5471        let _result = self.send_raw(token);
5472        self.drop_without_shutdown();
5473        _result
5474    }
5475
5476    fn send_raw(
5477        &self,
5478        mut token: fidl_fuchsia_ui_views::ViewportCreationToken,
5479    ) -> Result<(), fidl::Error> {
5480        self.control_handle.inner.send::<FlatlandReleaseViewportResponse>(
5481            (&mut token,),
5482            self.tx_id,
5483            0xbad474aeb5293f9,
5484            fidl::encoding::DynamicFlags::empty(),
5485        )
5486    }
5487}
5488
5489#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
5490pub struct FlatlandDisplayMarker;
5491
5492impl fidl::endpoints::ProtocolMarker for FlatlandDisplayMarker {
5493    type Proxy = FlatlandDisplayProxy;
5494    type RequestStream = FlatlandDisplayRequestStream;
5495    #[cfg(target_os = "fuchsia")]
5496    type SynchronousProxy = FlatlandDisplaySynchronousProxy;
5497
5498    const DEBUG_NAME: &'static str = "fuchsia.ui.composition.FlatlandDisplay";
5499}
5500impl fidl::endpoints::DiscoverableProtocolMarker for FlatlandDisplayMarker {}
5501
5502pub trait FlatlandDisplayProxyInterface: Send + Sync {
5503    fn r#set_content(
5504        &self,
5505        token: fidl_fuchsia_ui_views::ViewportCreationToken,
5506        child_view_watcher: fidl::endpoints::ServerEnd<ChildViewWatcherMarker>,
5507    ) -> Result<(), fidl::Error>;
5508    fn r#set_device_pixel_ratio(
5509        &self,
5510        device_pixel_ratio: &fidl_fuchsia_math::VecF,
5511    ) -> Result<(), fidl::Error>;
5512}
5513#[derive(Debug)]
5514#[cfg(target_os = "fuchsia")]
5515pub struct FlatlandDisplaySynchronousProxy {
5516    client: fidl::client::sync::Client,
5517}
5518
5519#[cfg(target_os = "fuchsia")]
5520impl fidl::endpoints::SynchronousProxy for FlatlandDisplaySynchronousProxy {
5521    type Proxy = FlatlandDisplayProxy;
5522    type Protocol = FlatlandDisplayMarker;
5523
5524    fn from_channel(inner: fidl::Channel) -> Self {
5525        Self::new(inner)
5526    }
5527
5528    fn into_channel(self) -> fidl::Channel {
5529        self.client.into_channel()
5530    }
5531
5532    fn as_channel(&self) -> &fidl::Channel {
5533        self.client.as_channel()
5534    }
5535}
5536
5537#[cfg(target_os = "fuchsia")]
5538impl FlatlandDisplaySynchronousProxy {
5539    pub fn new(channel: fidl::Channel) -> Self {
5540        Self { client: fidl::client::sync::Client::new(channel) }
5541    }
5542
5543    pub fn into_channel(self) -> fidl::Channel {
5544        self.client.into_channel()
5545    }
5546
5547    /// Waits until an event arrives and returns it. It is safe for other
5548    /// threads to make concurrent requests while waiting for an event.
5549    pub fn wait_for_event(
5550        &self,
5551        deadline: zx::MonotonicInstant,
5552    ) -> Result<FlatlandDisplayEvent, fidl::Error> {
5553        FlatlandDisplayEvent::decode(self.client.wait_for_event::<FlatlandDisplayMarker>(deadline)?)
5554    }
5555
5556    pub fn r#set_content(
5557        &self,
5558        mut token: fidl_fuchsia_ui_views::ViewportCreationToken,
5559        mut child_view_watcher: fidl::endpoints::ServerEnd<ChildViewWatcherMarker>,
5560    ) -> Result<(), fidl::Error> {
5561        self.client.send::<FlatlandDisplaySetContentRequest>(
5562            (&mut token, child_view_watcher),
5563            0x6748193a39918298,
5564            fidl::encoding::DynamicFlags::empty(),
5565        )
5566    }
5567
5568    /// Sets the ratio of display's physical pixels to device independent pixels that should be used
5569    /// for the tree of Flatland content that are attached to this display. See
5570    /// [`LayoutInfo.device_pixel_ratio`] for details.
5571    ///
5572    /// The default value is (1.0, 1.0). The valid values are 1.0 and above.
5573    pub fn r#set_device_pixel_ratio(
5574        &self,
5575        mut device_pixel_ratio: &fidl_fuchsia_math::VecF,
5576    ) -> Result<(), fidl::Error> {
5577        self.client.send::<FlatlandDisplaySetDevicePixelRatioRequest>(
5578            (device_pixel_ratio,),
5579            0x392c3e70cc0a81a4,
5580            fidl::encoding::DynamicFlags::empty(),
5581        )
5582    }
5583}
5584
5585#[cfg(target_os = "fuchsia")]
5586impl From<FlatlandDisplaySynchronousProxy> for zx::NullableHandle {
5587    fn from(value: FlatlandDisplaySynchronousProxy) -> Self {
5588        value.into_channel().into()
5589    }
5590}
5591
5592#[cfg(target_os = "fuchsia")]
5593impl From<fidl::Channel> for FlatlandDisplaySynchronousProxy {
5594    fn from(value: fidl::Channel) -> Self {
5595        Self::new(value)
5596    }
5597}
5598
5599#[cfg(target_os = "fuchsia")]
5600impl fidl::endpoints::FromClient for FlatlandDisplaySynchronousProxy {
5601    type Protocol = FlatlandDisplayMarker;
5602
5603    fn from_client(value: fidl::endpoints::ClientEnd<FlatlandDisplayMarker>) -> Self {
5604        Self::new(value.into_channel())
5605    }
5606}
5607
5608#[derive(Debug, Clone)]
5609pub struct FlatlandDisplayProxy {
5610    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
5611}
5612
5613impl fidl::endpoints::Proxy for FlatlandDisplayProxy {
5614    type Protocol = FlatlandDisplayMarker;
5615
5616    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
5617        Self::new(inner)
5618    }
5619
5620    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
5621        self.client.into_channel().map_err(|client| Self { client })
5622    }
5623
5624    fn as_channel(&self) -> &::fidl::AsyncChannel {
5625        self.client.as_channel()
5626    }
5627}
5628
5629impl FlatlandDisplayProxy {
5630    /// Create a new Proxy for fuchsia.ui.composition/FlatlandDisplay.
5631    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
5632        let protocol_name = <FlatlandDisplayMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
5633        Self { client: fidl::client::Client::new(channel, protocol_name) }
5634    }
5635
5636    /// Get a Stream of events from the remote end of the protocol.
5637    ///
5638    /// # Panics
5639    ///
5640    /// Panics if the event stream was already taken.
5641    pub fn take_event_stream(&self) -> FlatlandDisplayEventStream {
5642        FlatlandDisplayEventStream { event_receiver: self.client.take_event_receiver() }
5643    }
5644
5645    pub fn r#set_content(
5646        &self,
5647        mut token: fidl_fuchsia_ui_views::ViewportCreationToken,
5648        mut child_view_watcher: fidl::endpoints::ServerEnd<ChildViewWatcherMarker>,
5649    ) -> Result<(), fidl::Error> {
5650        FlatlandDisplayProxyInterface::r#set_content(self, token, child_view_watcher)
5651    }
5652
5653    /// Sets the ratio of display's physical pixels to device independent pixels that should be used
5654    /// for the tree of Flatland content that are attached to this display. See
5655    /// [`LayoutInfo.device_pixel_ratio`] for details.
5656    ///
5657    /// The default value is (1.0, 1.0). The valid values are 1.0 and above.
5658    pub fn r#set_device_pixel_ratio(
5659        &self,
5660        mut device_pixel_ratio: &fidl_fuchsia_math::VecF,
5661    ) -> Result<(), fidl::Error> {
5662        FlatlandDisplayProxyInterface::r#set_device_pixel_ratio(self, device_pixel_ratio)
5663    }
5664}
5665
5666impl FlatlandDisplayProxyInterface for FlatlandDisplayProxy {
5667    fn r#set_content(
5668        &self,
5669        mut token: fidl_fuchsia_ui_views::ViewportCreationToken,
5670        mut child_view_watcher: fidl::endpoints::ServerEnd<ChildViewWatcherMarker>,
5671    ) -> Result<(), fidl::Error> {
5672        self.client.send::<FlatlandDisplaySetContentRequest>(
5673            (&mut token, child_view_watcher),
5674            0x6748193a39918298,
5675            fidl::encoding::DynamicFlags::empty(),
5676        )
5677    }
5678
5679    fn r#set_device_pixel_ratio(
5680        &self,
5681        mut device_pixel_ratio: &fidl_fuchsia_math::VecF,
5682    ) -> Result<(), fidl::Error> {
5683        self.client.send::<FlatlandDisplaySetDevicePixelRatioRequest>(
5684            (device_pixel_ratio,),
5685            0x392c3e70cc0a81a4,
5686            fidl::encoding::DynamicFlags::empty(),
5687        )
5688    }
5689}
5690
5691pub struct FlatlandDisplayEventStream {
5692    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
5693}
5694
5695impl std::marker::Unpin for FlatlandDisplayEventStream {}
5696
5697impl futures::stream::FusedStream for FlatlandDisplayEventStream {
5698    fn is_terminated(&self) -> bool {
5699        self.event_receiver.is_terminated()
5700    }
5701}
5702
5703impl futures::Stream for FlatlandDisplayEventStream {
5704    type Item = Result<FlatlandDisplayEvent, fidl::Error>;
5705
5706    fn poll_next(
5707        mut self: std::pin::Pin<&mut Self>,
5708        cx: &mut std::task::Context<'_>,
5709    ) -> std::task::Poll<Option<Self::Item>> {
5710        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
5711            &mut self.event_receiver,
5712            cx
5713        )?) {
5714            Some(buf) => std::task::Poll::Ready(Some(FlatlandDisplayEvent::decode(buf))),
5715            None => std::task::Poll::Ready(None),
5716        }
5717    }
5718}
5719
5720#[derive(Debug)]
5721pub enum FlatlandDisplayEvent {}
5722
5723impl FlatlandDisplayEvent {
5724    /// Decodes a message buffer as a [`FlatlandDisplayEvent`].
5725    fn decode(
5726        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
5727    ) -> Result<FlatlandDisplayEvent, fidl::Error> {
5728        let (bytes, _handles) = buf.split_mut();
5729        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5730        debug_assert_eq!(tx_header.tx_id, 0);
5731        match tx_header.ordinal {
5732            _ => Err(fidl::Error::UnknownOrdinal {
5733                ordinal: tx_header.ordinal,
5734                protocol_name:
5735                    <FlatlandDisplayMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5736            }),
5737        }
5738    }
5739}
5740
5741/// A Stream of incoming requests for fuchsia.ui.composition/FlatlandDisplay.
5742pub struct FlatlandDisplayRequestStream {
5743    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5744    is_terminated: bool,
5745}
5746
5747impl std::marker::Unpin for FlatlandDisplayRequestStream {}
5748
5749impl futures::stream::FusedStream for FlatlandDisplayRequestStream {
5750    fn is_terminated(&self) -> bool {
5751        self.is_terminated
5752    }
5753}
5754
5755impl fidl::endpoints::RequestStream for FlatlandDisplayRequestStream {
5756    type Protocol = FlatlandDisplayMarker;
5757    type ControlHandle = FlatlandDisplayControlHandle;
5758
5759    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
5760        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
5761    }
5762
5763    fn control_handle(&self) -> Self::ControlHandle {
5764        FlatlandDisplayControlHandle { inner: self.inner.clone() }
5765    }
5766
5767    fn into_inner(
5768        self,
5769    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
5770    {
5771        (self.inner, self.is_terminated)
5772    }
5773
5774    fn from_inner(
5775        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5776        is_terminated: bool,
5777    ) -> Self {
5778        Self { inner, is_terminated }
5779    }
5780}
5781
5782impl futures::Stream for FlatlandDisplayRequestStream {
5783    type Item = Result<FlatlandDisplayRequest, fidl::Error>;
5784
5785    fn poll_next(
5786        mut self: std::pin::Pin<&mut Self>,
5787        cx: &mut std::task::Context<'_>,
5788    ) -> std::task::Poll<Option<Self::Item>> {
5789        let this = &mut *self;
5790        if this.inner.check_shutdown(cx) {
5791            this.is_terminated = true;
5792            return std::task::Poll::Ready(None);
5793        }
5794        if this.is_terminated {
5795            panic!("polled FlatlandDisplayRequestStream after completion");
5796        }
5797        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
5798            |bytes, handles| {
5799                match this.inner.channel().read_etc(cx, bytes, handles) {
5800                    std::task::Poll::Ready(Ok(())) => {}
5801                    std::task::Poll::Pending => return std::task::Poll::Pending,
5802                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
5803                        this.is_terminated = true;
5804                        return std::task::Poll::Ready(None);
5805                    }
5806                    std::task::Poll::Ready(Err(e)) => {
5807                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
5808                            e.into(),
5809                        ))));
5810                    }
5811                }
5812
5813                // A message has been received from the channel
5814                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5815
5816                std::task::Poll::Ready(Some(match header.ordinal {
5817                    0x6748193a39918298 => {
5818                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5819                        let mut req = fidl::new_empty!(
5820                            FlatlandDisplaySetContentRequest,
5821                            fidl::encoding::DefaultFuchsiaResourceDialect
5822                        );
5823                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandDisplaySetContentRequest>(&header, _body_bytes, handles, &mut req)?;
5824                        let control_handle =
5825                            FlatlandDisplayControlHandle { inner: this.inner.clone() };
5826                        Ok(FlatlandDisplayRequest::SetContent {
5827                            token: req.token,
5828                            child_view_watcher: req.child_view_watcher,
5829
5830                            control_handle,
5831                        })
5832                    }
5833                    0x392c3e70cc0a81a4 => {
5834                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5835                        let mut req = fidl::new_empty!(
5836                            FlatlandDisplaySetDevicePixelRatioRequest,
5837                            fidl::encoding::DefaultFuchsiaResourceDialect
5838                        );
5839                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandDisplaySetDevicePixelRatioRequest>(&header, _body_bytes, handles, &mut req)?;
5840                        let control_handle =
5841                            FlatlandDisplayControlHandle { inner: this.inner.clone() };
5842                        Ok(FlatlandDisplayRequest::SetDevicePixelRatio {
5843                            device_pixel_ratio: req.device_pixel_ratio,
5844
5845                            control_handle,
5846                        })
5847                    }
5848                    _ => Err(fidl::Error::UnknownOrdinal {
5849                        ordinal: header.ordinal,
5850                        protocol_name:
5851                            <FlatlandDisplayMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5852                    }),
5853                }))
5854            },
5855        )
5856    }
5857}
5858
5859/// This API connects to the singleton "primary display", and allows a tree of Flatland content to
5860/// be attached underneath.  Only one FlatlandDisplay client connection is allowed at one time.
5861#[derive(Debug)]
5862pub enum FlatlandDisplayRequest {
5863    SetContent {
5864        token: fidl_fuchsia_ui_views::ViewportCreationToken,
5865        child_view_watcher: fidl::endpoints::ServerEnd<ChildViewWatcherMarker>,
5866        control_handle: FlatlandDisplayControlHandle,
5867    },
5868    /// Sets the ratio of display's physical pixels to device independent pixels that should be used
5869    /// for the tree of Flatland content that are attached to this display. See
5870    /// [`LayoutInfo.device_pixel_ratio`] for details.
5871    ///
5872    /// The default value is (1.0, 1.0). The valid values are 1.0 and above.
5873    SetDevicePixelRatio {
5874        device_pixel_ratio: fidl_fuchsia_math::VecF,
5875        control_handle: FlatlandDisplayControlHandle,
5876    },
5877}
5878
5879impl FlatlandDisplayRequest {
5880    #[allow(irrefutable_let_patterns)]
5881    pub fn into_set_content(
5882        self,
5883    ) -> Option<(
5884        fidl_fuchsia_ui_views::ViewportCreationToken,
5885        fidl::endpoints::ServerEnd<ChildViewWatcherMarker>,
5886        FlatlandDisplayControlHandle,
5887    )> {
5888        if let FlatlandDisplayRequest::SetContent { token, child_view_watcher, control_handle } =
5889            self
5890        {
5891            Some((token, child_view_watcher, control_handle))
5892        } else {
5893            None
5894        }
5895    }
5896
5897    #[allow(irrefutable_let_patterns)]
5898    pub fn into_set_device_pixel_ratio(
5899        self,
5900    ) -> Option<(fidl_fuchsia_math::VecF, FlatlandDisplayControlHandle)> {
5901        if let FlatlandDisplayRequest::SetDevicePixelRatio { device_pixel_ratio, control_handle } =
5902            self
5903        {
5904            Some((device_pixel_ratio, control_handle))
5905        } else {
5906            None
5907        }
5908    }
5909
5910    /// Name of the method defined in FIDL
5911    pub fn method_name(&self) -> &'static str {
5912        match *self {
5913            FlatlandDisplayRequest::SetContent { .. } => "set_content",
5914            FlatlandDisplayRequest::SetDevicePixelRatio { .. } => "set_device_pixel_ratio",
5915        }
5916    }
5917}
5918
5919#[derive(Debug, Clone)]
5920pub struct FlatlandDisplayControlHandle {
5921    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5922}
5923
5924impl fidl::endpoints::ControlHandle for FlatlandDisplayControlHandle {
5925    fn shutdown(&self) {
5926        self.inner.shutdown()
5927    }
5928
5929    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
5930        self.inner.shutdown_with_epitaph(status)
5931    }
5932
5933    fn is_closed(&self) -> bool {
5934        self.inner.channel().is_closed()
5935    }
5936    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
5937        self.inner.channel().on_closed()
5938    }
5939
5940    #[cfg(target_os = "fuchsia")]
5941    fn signal_peer(
5942        &self,
5943        clear_mask: zx::Signals,
5944        set_mask: zx::Signals,
5945    ) -> Result<(), zx_status::Status> {
5946        use fidl::Peered;
5947        self.inner.channel().signal_peer(clear_mask, set_mask)
5948    }
5949}
5950
5951impl FlatlandDisplayControlHandle {}
5952
5953#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
5954pub struct ParentViewportWatcherMarker;
5955
5956impl fidl::endpoints::ProtocolMarker for ParentViewportWatcherMarker {
5957    type Proxy = ParentViewportWatcherProxy;
5958    type RequestStream = ParentViewportWatcherRequestStream;
5959    #[cfg(target_os = "fuchsia")]
5960    type SynchronousProxy = ParentViewportWatcherSynchronousProxy;
5961
5962    const DEBUG_NAME: &'static str = "(anonymous) ParentViewportWatcher";
5963}
5964
5965pub trait ParentViewportWatcherProxyInterface: Send + Sync {
5966    type GetLayoutResponseFut: std::future::Future<Output = Result<LayoutInfo, fidl::Error>> + Send;
5967    fn r#get_layout(&self) -> Self::GetLayoutResponseFut;
5968    type GetStatusResponseFut: std::future::Future<Output = Result<ParentViewportStatus, fidl::Error>>
5969        + Send;
5970    fn r#get_status(&self) -> Self::GetStatusResponseFut;
5971}
5972#[derive(Debug)]
5973#[cfg(target_os = "fuchsia")]
5974pub struct ParentViewportWatcherSynchronousProxy {
5975    client: fidl::client::sync::Client,
5976}
5977
5978#[cfg(target_os = "fuchsia")]
5979impl fidl::endpoints::SynchronousProxy for ParentViewportWatcherSynchronousProxy {
5980    type Proxy = ParentViewportWatcherProxy;
5981    type Protocol = ParentViewportWatcherMarker;
5982
5983    fn from_channel(inner: fidl::Channel) -> Self {
5984        Self::new(inner)
5985    }
5986
5987    fn into_channel(self) -> fidl::Channel {
5988        self.client.into_channel()
5989    }
5990
5991    fn as_channel(&self) -> &fidl::Channel {
5992        self.client.as_channel()
5993    }
5994}
5995
5996#[cfg(target_os = "fuchsia")]
5997impl ParentViewportWatcherSynchronousProxy {
5998    pub fn new(channel: fidl::Channel) -> Self {
5999        Self { client: fidl::client::sync::Client::new(channel) }
6000    }
6001
6002    pub fn into_channel(self) -> fidl::Channel {
6003        self.client.into_channel()
6004    }
6005
6006    /// Waits until an event arrives and returns it. It is safe for other
6007    /// threads to make concurrent requests while waiting for an event.
6008    pub fn wait_for_event(
6009        &self,
6010        deadline: zx::MonotonicInstant,
6011    ) -> Result<ParentViewportWatcherEvent, fidl::Error> {
6012        ParentViewportWatcherEvent::decode(
6013            self.client.wait_for_event::<ParentViewportWatcherMarker>(deadline)?,
6014        )
6015    }
6016
6017    /// A hanging get for receiving layout information. Clients may receive layout information
6018    /// before the ParentViewportWatcher operation has been presented. This allows children to
6019    /// layout their content before their first call to [`Present`]. In transition cases where two
6020    /// ParentViewportWatcher channels exist at the same time, both protocol instances will be
6021    /// receiving different layout information.
6022    ///
6023    /// This hanging get will only fire when the LayoutInfo is different than the previously
6024    /// returned LayoutInfo. Note that, since LayoutInfo is a table, only some fields may have
6025    /// changed.
6026    ///
6027    /// It is invalid to call `GetLayout` while a previous call is still pending. Doing so will
6028    /// cause both this channel and the Flatland channel that handed out ParentViewportWatcher to be
6029    /// closed.
6030    pub fn r#get_layout(
6031        &self,
6032        ___deadline: zx::MonotonicInstant,
6033    ) -> Result<LayoutInfo, fidl::Error> {
6034        let _response = self.client.send_query::<
6035            fidl::encoding::EmptyPayload,
6036            ParentViewportWatcherGetLayoutResponse,
6037            ParentViewportWatcherMarker,
6038        >(
6039            (),
6040            0x3cbe5d9638e032,
6041            fidl::encoding::DynamicFlags::empty(),
6042            ___deadline,
6043        )?;
6044        Ok(_response.info)
6045    }
6046
6047    /// A hanging get for receiving the status of the parent Viewport. This provides global
6048    /// connectivity information to the child.
6049    ///
6050    /// This hanging get will only fire when the ParentViewportStatus is different than the
6051    /// previously returned ParentViewportStatus.
6052    ///
6053    /// It is invalid to call `GetStatus` while a previous call is still pending. Doing so will
6054    /// cause both this channel and the Flatland channel that handed out ParentViewportWatcher to be
6055    /// closed.
6056    pub fn r#get_status(
6057        &self,
6058        ___deadline: zx::MonotonicInstant,
6059    ) -> Result<ParentViewportStatus, fidl::Error> {
6060        let _response = self.client.send_query::<
6061            fidl::encoding::EmptyPayload,
6062            ParentViewportWatcherGetStatusResponse,
6063            ParentViewportWatcherMarker,
6064        >(
6065            (),
6066            0x7caa022f050d9ea6,
6067            fidl::encoding::DynamicFlags::empty(),
6068            ___deadline,
6069        )?;
6070        Ok(_response.status)
6071    }
6072}
6073
6074#[cfg(target_os = "fuchsia")]
6075impl From<ParentViewportWatcherSynchronousProxy> for zx::NullableHandle {
6076    fn from(value: ParentViewportWatcherSynchronousProxy) -> Self {
6077        value.into_channel().into()
6078    }
6079}
6080
6081#[cfg(target_os = "fuchsia")]
6082impl From<fidl::Channel> for ParentViewportWatcherSynchronousProxy {
6083    fn from(value: fidl::Channel) -> Self {
6084        Self::new(value)
6085    }
6086}
6087
6088#[cfg(target_os = "fuchsia")]
6089impl fidl::endpoints::FromClient for ParentViewportWatcherSynchronousProxy {
6090    type Protocol = ParentViewportWatcherMarker;
6091
6092    fn from_client(value: fidl::endpoints::ClientEnd<ParentViewportWatcherMarker>) -> Self {
6093        Self::new(value.into_channel())
6094    }
6095}
6096
6097#[derive(Debug, Clone)]
6098pub struct ParentViewportWatcherProxy {
6099    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
6100}
6101
6102impl fidl::endpoints::Proxy for ParentViewportWatcherProxy {
6103    type Protocol = ParentViewportWatcherMarker;
6104
6105    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
6106        Self::new(inner)
6107    }
6108
6109    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
6110        self.client.into_channel().map_err(|client| Self { client })
6111    }
6112
6113    fn as_channel(&self) -> &::fidl::AsyncChannel {
6114        self.client.as_channel()
6115    }
6116}
6117
6118impl ParentViewportWatcherProxy {
6119    /// Create a new Proxy for fuchsia.ui.composition/ParentViewportWatcher.
6120    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
6121        let protocol_name =
6122            <ParentViewportWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
6123        Self { client: fidl::client::Client::new(channel, protocol_name) }
6124    }
6125
6126    /// Get a Stream of events from the remote end of the protocol.
6127    ///
6128    /// # Panics
6129    ///
6130    /// Panics if the event stream was already taken.
6131    pub fn take_event_stream(&self) -> ParentViewportWatcherEventStream {
6132        ParentViewportWatcherEventStream { event_receiver: self.client.take_event_receiver() }
6133    }
6134
6135    /// A hanging get for receiving layout information. Clients may receive layout information
6136    /// before the ParentViewportWatcher operation has been presented. This allows children to
6137    /// layout their content before their first call to [`Present`]. In transition cases where two
6138    /// ParentViewportWatcher channels exist at the same time, both protocol instances will be
6139    /// receiving different layout information.
6140    ///
6141    /// This hanging get will only fire when the LayoutInfo is different than the previously
6142    /// returned LayoutInfo. Note that, since LayoutInfo is a table, only some fields may have
6143    /// changed.
6144    ///
6145    /// It is invalid to call `GetLayout` while a previous call is still pending. Doing so will
6146    /// cause both this channel and the Flatland channel that handed out ParentViewportWatcher to be
6147    /// closed.
6148    pub fn r#get_layout(
6149        &self,
6150    ) -> fidl::client::QueryResponseFut<LayoutInfo, fidl::encoding::DefaultFuchsiaResourceDialect>
6151    {
6152        ParentViewportWatcherProxyInterface::r#get_layout(self)
6153    }
6154
6155    /// A hanging get for receiving the status of the parent Viewport. This provides global
6156    /// connectivity information to the child.
6157    ///
6158    /// This hanging get will only fire when the ParentViewportStatus is different than the
6159    /// previously returned ParentViewportStatus.
6160    ///
6161    /// It is invalid to call `GetStatus` while a previous call is still pending. Doing so will
6162    /// cause both this channel and the Flatland channel that handed out ParentViewportWatcher to be
6163    /// closed.
6164    pub fn r#get_status(
6165        &self,
6166    ) -> fidl::client::QueryResponseFut<
6167        ParentViewportStatus,
6168        fidl::encoding::DefaultFuchsiaResourceDialect,
6169    > {
6170        ParentViewportWatcherProxyInterface::r#get_status(self)
6171    }
6172}
6173
6174impl ParentViewportWatcherProxyInterface for ParentViewportWatcherProxy {
6175    type GetLayoutResponseFut =
6176        fidl::client::QueryResponseFut<LayoutInfo, fidl::encoding::DefaultFuchsiaResourceDialect>;
6177    fn r#get_layout(&self) -> Self::GetLayoutResponseFut {
6178        fn _decode(
6179            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6180        ) -> Result<LayoutInfo, fidl::Error> {
6181            let _response = fidl::client::decode_transaction_body::<
6182                ParentViewportWatcherGetLayoutResponse,
6183                fidl::encoding::DefaultFuchsiaResourceDialect,
6184                0x3cbe5d9638e032,
6185            >(_buf?)?;
6186            Ok(_response.info)
6187        }
6188        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, LayoutInfo>(
6189            (),
6190            0x3cbe5d9638e032,
6191            fidl::encoding::DynamicFlags::empty(),
6192            _decode,
6193        )
6194    }
6195
6196    type GetStatusResponseFut = fidl::client::QueryResponseFut<
6197        ParentViewportStatus,
6198        fidl::encoding::DefaultFuchsiaResourceDialect,
6199    >;
6200    fn r#get_status(&self) -> Self::GetStatusResponseFut {
6201        fn _decode(
6202            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6203        ) -> Result<ParentViewportStatus, fidl::Error> {
6204            let _response = fidl::client::decode_transaction_body::<
6205                ParentViewportWatcherGetStatusResponse,
6206                fidl::encoding::DefaultFuchsiaResourceDialect,
6207                0x7caa022f050d9ea6,
6208            >(_buf?)?;
6209            Ok(_response.status)
6210        }
6211        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ParentViewportStatus>(
6212            (),
6213            0x7caa022f050d9ea6,
6214            fidl::encoding::DynamicFlags::empty(),
6215            _decode,
6216        )
6217    }
6218}
6219
6220pub struct ParentViewportWatcherEventStream {
6221    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
6222}
6223
6224impl std::marker::Unpin for ParentViewportWatcherEventStream {}
6225
6226impl futures::stream::FusedStream for ParentViewportWatcherEventStream {
6227    fn is_terminated(&self) -> bool {
6228        self.event_receiver.is_terminated()
6229    }
6230}
6231
6232impl futures::Stream for ParentViewportWatcherEventStream {
6233    type Item = Result<ParentViewportWatcherEvent, fidl::Error>;
6234
6235    fn poll_next(
6236        mut self: std::pin::Pin<&mut Self>,
6237        cx: &mut std::task::Context<'_>,
6238    ) -> std::task::Poll<Option<Self::Item>> {
6239        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
6240            &mut self.event_receiver,
6241            cx
6242        )?) {
6243            Some(buf) => std::task::Poll::Ready(Some(ParentViewportWatcherEvent::decode(buf))),
6244            None => std::task::Poll::Ready(None),
6245        }
6246    }
6247}
6248
6249#[derive(Debug)]
6250pub enum ParentViewportWatcherEvent {}
6251
6252impl ParentViewportWatcherEvent {
6253    /// Decodes a message buffer as a [`ParentViewportWatcherEvent`].
6254    fn decode(
6255        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
6256    ) -> Result<ParentViewportWatcherEvent, fidl::Error> {
6257        let (bytes, _handles) = buf.split_mut();
6258        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6259        debug_assert_eq!(tx_header.tx_id, 0);
6260        match tx_header.ordinal {
6261            _ => Err(fidl::Error::UnknownOrdinal {
6262                ordinal: tx_header.ordinal,
6263                protocol_name:
6264                    <ParentViewportWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6265            }),
6266        }
6267    }
6268}
6269
6270/// A Stream of incoming requests for fuchsia.ui.composition/ParentViewportWatcher.
6271pub struct ParentViewportWatcherRequestStream {
6272    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6273    is_terminated: bool,
6274}
6275
6276impl std::marker::Unpin for ParentViewportWatcherRequestStream {}
6277
6278impl futures::stream::FusedStream for ParentViewportWatcherRequestStream {
6279    fn is_terminated(&self) -> bool {
6280        self.is_terminated
6281    }
6282}
6283
6284impl fidl::endpoints::RequestStream for ParentViewportWatcherRequestStream {
6285    type Protocol = ParentViewportWatcherMarker;
6286    type ControlHandle = ParentViewportWatcherControlHandle;
6287
6288    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
6289        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
6290    }
6291
6292    fn control_handle(&self) -> Self::ControlHandle {
6293        ParentViewportWatcherControlHandle { inner: self.inner.clone() }
6294    }
6295
6296    fn into_inner(
6297        self,
6298    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
6299    {
6300        (self.inner, self.is_terminated)
6301    }
6302
6303    fn from_inner(
6304        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6305        is_terminated: bool,
6306    ) -> Self {
6307        Self { inner, is_terminated }
6308    }
6309}
6310
6311impl futures::Stream for ParentViewportWatcherRequestStream {
6312    type Item = Result<ParentViewportWatcherRequest, fidl::Error>;
6313
6314    fn poll_next(
6315        mut self: std::pin::Pin<&mut Self>,
6316        cx: &mut std::task::Context<'_>,
6317    ) -> std::task::Poll<Option<Self::Item>> {
6318        let this = &mut *self;
6319        if this.inner.check_shutdown(cx) {
6320            this.is_terminated = true;
6321            return std::task::Poll::Ready(None);
6322        }
6323        if this.is_terminated {
6324            panic!("polled ParentViewportWatcherRequestStream after completion");
6325        }
6326        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
6327            |bytes, handles| {
6328                match this.inner.channel().read_etc(cx, bytes, handles) {
6329                    std::task::Poll::Ready(Ok(())) => {}
6330                    std::task::Poll::Pending => return std::task::Poll::Pending,
6331                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
6332                        this.is_terminated = true;
6333                        return std::task::Poll::Ready(None);
6334                    }
6335                    std::task::Poll::Ready(Err(e)) => {
6336                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
6337                            e.into(),
6338                        ))));
6339                    }
6340                }
6341
6342                // A message has been received from the channel
6343                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6344
6345                std::task::Poll::Ready(Some(match header.ordinal {
6346                0x3cbe5d9638e032 => {
6347                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6348                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
6349                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
6350                    let control_handle = ParentViewportWatcherControlHandle {
6351                        inner: this.inner.clone(),
6352                    };
6353                    Ok(ParentViewportWatcherRequest::GetLayout {
6354                        responder: ParentViewportWatcherGetLayoutResponder {
6355                            control_handle: std::mem::ManuallyDrop::new(control_handle),
6356                            tx_id: header.tx_id,
6357                        },
6358                    })
6359                }
6360                0x7caa022f050d9ea6 => {
6361                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6362                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
6363                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
6364                    let control_handle = ParentViewportWatcherControlHandle {
6365                        inner: this.inner.clone(),
6366                    };
6367                    Ok(ParentViewportWatcherRequest::GetStatus {
6368                        responder: ParentViewportWatcherGetStatusResponder {
6369                            control_handle: std::mem::ManuallyDrop::new(control_handle),
6370                            tx_id: header.tx_id,
6371                        },
6372                    })
6373                }
6374                _ => Err(fidl::Error::UnknownOrdinal {
6375                    ordinal: header.ordinal,
6376                    protocol_name: <ParentViewportWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6377                }),
6378            }))
6379            },
6380        )
6381    }
6382}
6383
6384/// A protocol that provides information about the parent Viewport attached to a Flatland instance's
6385/// sole View.  Although Flatland instances can have at most one view, it is possible to have
6386/// multiple ParentViewportWatchers during the brief transition period when replacing the instance's
6387/// View with another, e.g. via [`CreateView`].  During this period, certain updates may be
6388/// duplicated and sent to each ParentViewportWatcher connection.
6389///
6390/// A ParentViewportWatcher will remain connected as long as the corresponding parent Viewport
6391/// exists; the connection will also be closed if the parents's ViewportCreationToken is dropped
6392/// without using it to create a Viewport.
6393#[derive(Debug)]
6394pub enum ParentViewportWatcherRequest {
6395    /// A hanging get for receiving layout information. Clients may receive layout information
6396    /// before the ParentViewportWatcher operation has been presented. This allows children to
6397    /// layout their content before their first call to [`Present`]. In transition cases where two
6398    /// ParentViewportWatcher channels exist at the same time, both protocol instances will be
6399    /// receiving different layout information.
6400    ///
6401    /// This hanging get will only fire when the LayoutInfo is different than the previously
6402    /// returned LayoutInfo. Note that, since LayoutInfo is a table, only some fields may have
6403    /// changed.
6404    ///
6405    /// It is invalid to call `GetLayout` while a previous call is still pending. Doing so will
6406    /// cause both this channel and the Flatland channel that handed out ParentViewportWatcher to be
6407    /// closed.
6408    GetLayout { responder: ParentViewportWatcherGetLayoutResponder },
6409    /// A hanging get for receiving the status of the parent Viewport. This provides global
6410    /// connectivity information to the child.
6411    ///
6412    /// This hanging get will only fire when the ParentViewportStatus is different than the
6413    /// previously returned ParentViewportStatus.
6414    ///
6415    /// It is invalid to call `GetStatus` while a previous call is still pending. Doing so will
6416    /// cause both this channel and the Flatland channel that handed out ParentViewportWatcher to be
6417    /// closed.
6418    GetStatus { responder: ParentViewportWatcherGetStatusResponder },
6419}
6420
6421impl ParentViewportWatcherRequest {
6422    #[allow(irrefutable_let_patterns)]
6423    pub fn into_get_layout(self) -> Option<(ParentViewportWatcherGetLayoutResponder)> {
6424        if let ParentViewportWatcherRequest::GetLayout { responder } = self {
6425            Some((responder))
6426        } else {
6427            None
6428        }
6429    }
6430
6431    #[allow(irrefutable_let_patterns)]
6432    pub fn into_get_status(self) -> Option<(ParentViewportWatcherGetStatusResponder)> {
6433        if let ParentViewportWatcherRequest::GetStatus { responder } = self {
6434            Some((responder))
6435        } else {
6436            None
6437        }
6438    }
6439
6440    /// Name of the method defined in FIDL
6441    pub fn method_name(&self) -> &'static str {
6442        match *self {
6443            ParentViewportWatcherRequest::GetLayout { .. } => "get_layout",
6444            ParentViewportWatcherRequest::GetStatus { .. } => "get_status",
6445        }
6446    }
6447}
6448
6449#[derive(Debug, Clone)]
6450pub struct ParentViewportWatcherControlHandle {
6451    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6452}
6453
6454impl fidl::endpoints::ControlHandle for ParentViewportWatcherControlHandle {
6455    fn shutdown(&self) {
6456        self.inner.shutdown()
6457    }
6458
6459    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
6460        self.inner.shutdown_with_epitaph(status)
6461    }
6462
6463    fn is_closed(&self) -> bool {
6464        self.inner.channel().is_closed()
6465    }
6466    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
6467        self.inner.channel().on_closed()
6468    }
6469
6470    #[cfg(target_os = "fuchsia")]
6471    fn signal_peer(
6472        &self,
6473        clear_mask: zx::Signals,
6474        set_mask: zx::Signals,
6475    ) -> Result<(), zx_status::Status> {
6476        use fidl::Peered;
6477        self.inner.channel().signal_peer(clear_mask, set_mask)
6478    }
6479}
6480
6481impl ParentViewportWatcherControlHandle {}
6482
6483#[must_use = "FIDL methods require a response to be sent"]
6484#[derive(Debug)]
6485pub struct ParentViewportWatcherGetLayoutResponder {
6486    control_handle: std::mem::ManuallyDrop<ParentViewportWatcherControlHandle>,
6487    tx_id: u32,
6488}
6489
6490/// Set the the channel to be shutdown (see [`ParentViewportWatcherControlHandle::shutdown`])
6491/// if the responder is dropped without sending a response, so that the client
6492/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6493impl std::ops::Drop for ParentViewportWatcherGetLayoutResponder {
6494    fn drop(&mut self) {
6495        self.control_handle.shutdown();
6496        // Safety: drops once, never accessed again
6497        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6498    }
6499}
6500
6501impl fidl::endpoints::Responder for ParentViewportWatcherGetLayoutResponder {
6502    type ControlHandle = ParentViewportWatcherControlHandle;
6503
6504    fn control_handle(&self) -> &ParentViewportWatcherControlHandle {
6505        &self.control_handle
6506    }
6507
6508    fn drop_without_shutdown(mut self) {
6509        // Safety: drops once, never accessed again due to mem::forget
6510        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6511        // Prevent Drop from running (which would shut down the channel)
6512        std::mem::forget(self);
6513    }
6514}
6515
6516impl ParentViewportWatcherGetLayoutResponder {
6517    /// Sends a response to the FIDL transaction.
6518    ///
6519    /// Sets the channel to shutdown if an error occurs.
6520    pub fn send(self, mut info: &LayoutInfo) -> Result<(), fidl::Error> {
6521        let _result = self.send_raw(info);
6522        if _result.is_err() {
6523            self.control_handle.shutdown();
6524        }
6525        self.drop_without_shutdown();
6526        _result
6527    }
6528
6529    /// Similar to "send" but does not shutdown the channel if an error occurs.
6530    pub fn send_no_shutdown_on_err(self, mut info: &LayoutInfo) -> Result<(), fidl::Error> {
6531        let _result = self.send_raw(info);
6532        self.drop_without_shutdown();
6533        _result
6534    }
6535
6536    fn send_raw(&self, mut info: &LayoutInfo) -> Result<(), fidl::Error> {
6537        self.control_handle.inner.send::<ParentViewportWatcherGetLayoutResponse>(
6538            (info,),
6539            self.tx_id,
6540            0x3cbe5d9638e032,
6541            fidl::encoding::DynamicFlags::empty(),
6542        )
6543    }
6544}
6545
6546#[must_use = "FIDL methods require a response to be sent"]
6547#[derive(Debug)]
6548pub struct ParentViewportWatcherGetStatusResponder {
6549    control_handle: std::mem::ManuallyDrop<ParentViewportWatcherControlHandle>,
6550    tx_id: u32,
6551}
6552
6553/// Set the the channel to be shutdown (see [`ParentViewportWatcherControlHandle::shutdown`])
6554/// if the responder is dropped without sending a response, so that the client
6555/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6556impl std::ops::Drop for ParentViewportWatcherGetStatusResponder {
6557    fn drop(&mut self) {
6558        self.control_handle.shutdown();
6559        // Safety: drops once, never accessed again
6560        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6561    }
6562}
6563
6564impl fidl::endpoints::Responder for ParentViewportWatcherGetStatusResponder {
6565    type ControlHandle = ParentViewportWatcherControlHandle;
6566
6567    fn control_handle(&self) -> &ParentViewportWatcherControlHandle {
6568        &self.control_handle
6569    }
6570
6571    fn drop_without_shutdown(mut self) {
6572        // Safety: drops once, never accessed again due to mem::forget
6573        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6574        // Prevent Drop from running (which would shut down the channel)
6575        std::mem::forget(self);
6576    }
6577}
6578
6579impl ParentViewportWatcherGetStatusResponder {
6580    /// Sends a response to the FIDL transaction.
6581    ///
6582    /// Sets the channel to shutdown if an error occurs.
6583    pub fn send(self, mut status: ParentViewportStatus) -> Result<(), fidl::Error> {
6584        let _result = self.send_raw(status);
6585        if _result.is_err() {
6586            self.control_handle.shutdown();
6587        }
6588        self.drop_without_shutdown();
6589        _result
6590    }
6591
6592    /// Similar to "send" but does not shutdown the channel if an error occurs.
6593    pub fn send_no_shutdown_on_err(
6594        self,
6595        mut status: ParentViewportStatus,
6596    ) -> Result<(), fidl::Error> {
6597        let _result = self.send_raw(status);
6598        self.drop_without_shutdown();
6599        _result
6600    }
6601
6602    fn send_raw(&self, mut status: ParentViewportStatus) -> Result<(), fidl::Error> {
6603        self.control_handle.inner.send::<ParentViewportWatcherGetStatusResponse>(
6604            (status,),
6605            self.tx_id,
6606            0x7caa022f050d9ea6,
6607            fidl::encoding::DynamicFlags::empty(),
6608        )
6609    }
6610}
6611
6612#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
6613pub struct ScreenCaptureMarker;
6614
6615impl fidl::endpoints::ProtocolMarker for ScreenCaptureMarker {
6616    type Proxy = ScreenCaptureProxy;
6617    type RequestStream = ScreenCaptureRequestStream;
6618    #[cfg(target_os = "fuchsia")]
6619    type SynchronousProxy = ScreenCaptureSynchronousProxy;
6620
6621    const DEBUG_NAME: &'static str = "fuchsia.ui.composition.ScreenCapture";
6622}
6623impl fidl::endpoints::DiscoverableProtocolMarker for ScreenCaptureMarker {}
6624pub type ScreenCaptureConfigureResult = Result<(), ScreenCaptureError>;
6625pub type ScreenCaptureGetNextFrameResult = Result<FrameInfo, ScreenCaptureError>;
6626pub type ScreenCaptureReleaseFrameResult = Result<(), ScreenCaptureError>;
6627
6628pub trait ScreenCaptureProxyInterface: Send + Sync {
6629    type ConfigureResponseFut: std::future::Future<Output = Result<ScreenCaptureConfigureResult, fidl::Error>>
6630        + Send;
6631    fn r#configure(&self, payload: ScreenCaptureConfig) -> Self::ConfigureResponseFut;
6632    type GetNextFrameResponseFut: std::future::Future<Output = Result<ScreenCaptureGetNextFrameResult, fidl::Error>>
6633        + Send;
6634    fn r#get_next_frame(&self, payload: GetNextFrameArgs) -> Self::GetNextFrameResponseFut;
6635    type ReleaseFrameResponseFut: std::future::Future<Output = Result<ScreenCaptureReleaseFrameResult, fidl::Error>>
6636        + Send;
6637    fn r#release_frame(&self, buffer_id: u32) -> Self::ReleaseFrameResponseFut;
6638}
6639#[derive(Debug)]
6640#[cfg(target_os = "fuchsia")]
6641pub struct ScreenCaptureSynchronousProxy {
6642    client: fidl::client::sync::Client,
6643}
6644
6645#[cfg(target_os = "fuchsia")]
6646impl fidl::endpoints::SynchronousProxy for ScreenCaptureSynchronousProxy {
6647    type Proxy = ScreenCaptureProxy;
6648    type Protocol = ScreenCaptureMarker;
6649
6650    fn from_channel(inner: fidl::Channel) -> Self {
6651        Self::new(inner)
6652    }
6653
6654    fn into_channel(self) -> fidl::Channel {
6655        self.client.into_channel()
6656    }
6657
6658    fn as_channel(&self) -> &fidl::Channel {
6659        self.client.as_channel()
6660    }
6661}
6662
6663#[cfg(target_os = "fuchsia")]
6664impl ScreenCaptureSynchronousProxy {
6665    pub fn new(channel: fidl::Channel) -> Self {
6666        Self { client: fidl::client::sync::Client::new(channel) }
6667    }
6668
6669    pub fn into_channel(self) -> fidl::Channel {
6670        self.client.into_channel()
6671    }
6672
6673    /// Waits until an event arrives and returns it. It is safe for other
6674    /// threads to make concurrent requests while waiting for an event.
6675    pub fn wait_for_event(
6676        &self,
6677        deadline: zx::MonotonicInstant,
6678    ) -> Result<ScreenCaptureEvent, fidl::Error> {
6679        ScreenCaptureEvent::decode(self.client.wait_for_event::<ScreenCaptureMarker>(deadline)?)
6680    }
6681
6682    /// Clients should first use the Allocator protocol to register a
6683    /// BufferCollection. This function will fail with BAD_OPERATION unless all clients of the
6684    /// BufferCollection have set their constraints.
6685    ///
6686    /// Afterwards, clients should create and configure the images that will
6687    /// eventually be rendered to using this method. All the buffers in the
6688    /// collection from 0 to (buffer_count-1) may be used for screen capture.
6689    ///
6690    /// Clients are responsible for determining the rotation of the display,
6691    /// and applying the corrective rotation. For instance, if the display is
6692    /// mounted 90 degrees clockwise (the "top" is on the right, when looking
6693    /// at the display), then the client should specify a 270 degree rotation
6694    /// to account for it.
6695    ///
6696    /// Similarly, the clients are responsible for specifying a buffer big
6697    /// enough for the rotated image. If the buffer is too small, a best effort
6698    /// attempt will be made to render the image.
6699    ///
6700    /// Finally, clients request the server to render the current screen to the
6701    /// shared buffers using [`GetNextFrame`].
6702    ///
6703    /// [`Configure`] can be called again with a new BufferCollectionImportToken
6704    /// if the client wishes to change any of the configuration settings. In
6705    /// this case all the buffers from the previous call to [`Configure`] will
6706    /// be released.
6707    pub fn r#configure(
6708        &self,
6709        mut payload: ScreenCaptureConfig,
6710        ___deadline: zx::MonotonicInstant,
6711    ) -> Result<ScreenCaptureConfigureResult, fidl::Error> {
6712        let _response = self.client.send_query::<ScreenCaptureConfig, fidl::encoding::ResultType<
6713            fidl::encoding::EmptyStruct,
6714            ScreenCaptureError,
6715        >, ScreenCaptureMarker>(
6716            &mut payload,
6717            0x3b6e5af1d294afd9,
6718            fidl::encoding::DynamicFlags::empty(),
6719            ___deadline,
6720        )?;
6721        Ok(_response.map(|x| x))
6722    }
6723
6724    /// Following a successful call to [`Configure`], clients can call
6725    /// GetNextFrame. This will populate a buffer with the most recent frame.
6726    ///
6727    /// Clients should wait on the zx::event they pass for successful
6728    /// completion of the screenshot. It is not guaranteed that the screenshot
6729    /// will be completed by the time this function returns.
6730    ///
6731    /// The requested image will be in the BufferCollection that the client set
6732    /// up in the VMO at the index specified by buffer_id.
6733    ///
6734    /// When ScreenCapture is used to provide a stream, the rate that the
6735    /// client calls GetNextFrame will drive the frame rate.
6736    ///
6737    /// Errors:
6738    /// BAD_OPERATION if Configure was not called, or not called successfully
6739    /// MISSING_ARGS if a required argument is not present
6740    /// BUFFER_FULL if all buffers in the BufferCollection are in use. In this case, ReleaseFrame
6741    /// must be called to make a buffer available before this function can be called successfully.
6742    pub fn r#get_next_frame(
6743        &self,
6744        mut payload: GetNextFrameArgs,
6745        ___deadline: zx::MonotonicInstant,
6746    ) -> Result<ScreenCaptureGetNextFrameResult, fidl::Error> {
6747        let _response = self.client.send_query::<
6748            GetNextFrameArgs,
6749            fidl::encoding::ResultType<FrameInfo, ScreenCaptureError>,
6750            ScreenCaptureMarker,
6751        >(
6752            &mut payload,
6753            0x552c1580aab8c4a7,
6754            fidl::encoding::DynamicFlags::empty(),
6755            ___deadline,
6756        )?;
6757        Ok(_response.map(|x| x))
6758    }
6759
6760    /// Once the client no longer needs an image, they can call ReleaseFrame on
6761    /// the VMO index of the buffer so that the server can reuse it in the future.
6762    pub fn r#release_frame(
6763        &self,
6764        mut buffer_id: u32,
6765        ___deadline: zx::MonotonicInstant,
6766    ) -> Result<ScreenCaptureReleaseFrameResult, fidl::Error> {
6767        let _response =
6768            self.client.send_query::<ScreenCaptureReleaseFrameRequest, fidl::encoding::ResultType<
6769                fidl::encoding::EmptyStruct,
6770                ScreenCaptureError,
6771            >, ScreenCaptureMarker>(
6772                (buffer_id,),
6773                0x46704dce24e35950,
6774                fidl::encoding::DynamicFlags::empty(),
6775                ___deadline,
6776            )?;
6777        Ok(_response.map(|x| x))
6778    }
6779}
6780
6781#[cfg(target_os = "fuchsia")]
6782impl From<ScreenCaptureSynchronousProxy> for zx::NullableHandle {
6783    fn from(value: ScreenCaptureSynchronousProxy) -> Self {
6784        value.into_channel().into()
6785    }
6786}
6787
6788#[cfg(target_os = "fuchsia")]
6789impl From<fidl::Channel> for ScreenCaptureSynchronousProxy {
6790    fn from(value: fidl::Channel) -> Self {
6791        Self::new(value)
6792    }
6793}
6794
6795#[cfg(target_os = "fuchsia")]
6796impl fidl::endpoints::FromClient for ScreenCaptureSynchronousProxy {
6797    type Protocol = ScreenCaptureMarker;
6798
6799    fn from_client(value: fidl::endpoints::ClientEnd<ScreenCaptureMarker>) -> Self {
6800        Self::new(value.into_channel())
6801    }
6802}
6803
6804#[derive(Debug, Clone)]
6805pub struct ScreenCaptureProxy {
6806    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
6807}
6808
6809impl fidl::endpoints::Proxy for ScreenCaptureProxy {
6810    type Protocol = ScreenCaptureMarker;
6811
6812    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
6813        Self::new(inner)
6814    }
6815
6816    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
6817        self.client.into_channel().map_err(|client| Self { client })
6818    }
6819
6820    fn as_channel(&self) -> &::fidl::AsyncChannel {
6821        self.client.as_channel()
6822    }
6823}
6824
6825impl ScreenCaptureProxy {
6826    /// Create a new Proxy for fuchsia.ui.composition/ScreenCapture.
6827    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
6828        let protocol_name = <ScreenCaptureMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
6829        Self { client: fidl::client::Client::new(channel, protocol_name) }
6830    }
6831
6832    /// Get a Stream of events from the remote end of the protocol.
6833    ///
6834    /// # Panics
6835    ///
6836    /// Panics if the event stream was already taken.
6837    pub fn take_event_stream(&self) -> ScreenCaptureEventStream {
6838        ScreenCaptureEventStream { event_receiver: self.client.take_event_receiver() }
6839    }
6840
6841    /// Clients should first use the Allocator protocol to register a
6842    /// BufferCollection. This function will fail with BAD_OPERATION unless all clients of the
6843    /// BufferCollection have set their constraints.
6844    ///
6845    /// Afterwards, clients should create and configure the images that will
6846    /// eventually be rendered to using this method. All the buffers in the
6847    /// collection from 0 to (buffer_count-1) may be used for screen capture.
6848    ///
6849    /// Clients are responsible for determining the rotation of the display,
6850    /// and applying the corrective rotation. For instance, if the display is
6851    /// mounted 90 degrees clockwise (the "top" is on the right, when looking
6852    /// at the display), then the client should specify a 270 degree rotation
6853    /// to account for it.
6854    ///
6855    /// Similarly, the clients are responsible for specifying a buffer big
6856    /// enough for the rotated image. If the buffer is too small, a best effort
6857    /// attempt will be made to render the image.
6858    ///
6859    /// Finally, clients request the server to render the current screen to the
6860    /// shared buffers using [`GetNextFrame`].
6861    ///
6862    /// [`Configure`] can be called again with a new BufferCollectionImportToken
6863    /// if the client wishes to change any of the configuration settings. In
6864    /// this case all the buffers from the previous call to [`Configure`] will
6865    /// be released.
6866    pub fn r#configure(
6867        &self,
6868        mut payload: ScreenCaptureConfig,
6869    ) -> fidl::client::QueryResponseFut<
6870        ScreenCaptureConfigureResult,
6871        fidl::encoding::DefaultFuchsiaResourceDialect,
6872    > {
6873        ScreenCaptureProxyInterface::r#configure(self, payload)
6874    }
6875
6876    /// Following a successful call to [`Configure`], clients can call
6877    /// GetNextFrame. This will populate a buffer with the most recent frame.
6878    ///
6879    /// Clients should wait on the zx::event they pass for successful
6880    /// completion of the screenshot. It is not guaranteed that the screenshot
6881    /// will be completed by the time this function returns.
6882    ///
6883    /// The requested image will be in the BufferCollection that the client set
6884    /// up in the VMO at the index specified by buffer_id.
6885    ///
6886    /// When ScreenCapture is used to provide a stream, the rate that the
6887    /// client calls GetNextFrame will drive the frame rate.
6888    ///
6889    /// Errors:
6890    /// BAD_OPERATION if Configure was not called, or not called successfully
6891    /// MISSING_ARGS if a required argument is not present
6892    /// BUFFER_FULL if all buffers in the BufferCollection are in use. In this case, ReleaseFrame
6893    /// must be called to make a buffer available before this function can be called successfully.
6894    pub fn r#get_next_frame(
6895        &self,
6896        mut payload: GetNextFrameArgs,
6897    ) -> fidl::client::QueryResponseFut<
6898        ScreenCaptureGetNextFrameResult,
6899        fidl::encoding::DefaultFuchsiaResourceDialect,
6900    > {
6901        ScreenCaptureProxyInterface::r#get_next_frame(self, payload)
6902    }
6903
6904    /// Once the client no longer needs an image, they can call ReleaseFrame on
6905    /// the VMO index of the buffer so that the server can reuse it in the future.
6906    pub fn r#release_frame(
6907        &self,
6908        mut buffer_id: u32,
6909    ) -> fidl::client::QueryResponseFut<
6910        ScreenCaptureReleaseFrameResult,
6911        fidl::encoding::DefaultFuchsiaResourceDialect,
6912    > {
6913        ScreenCaptureProxyInterface::r#release_frame(self, buffer_id)
6914    }
6915}
6916
6917impl ScreenCaptureProxyInterface for ScreenCaptureProxy {
6918    type ConfigureResponseFut = fidl::client::QueryResponseFut<
6919        ScreenCaptureConfigureResult,
6920        fidl::encoding::DefaultFuchsiaResourceDialect,
6921    >;
6922    fn r#configure(&self, mut payload: ScreenCaptureConfig) -> Self::ConfigureResponseFut {
6923        fn _decode(
6924            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6925        ) -> Result<ScreenCaptureConfigureResult, fidl::Error> {
6926            let _response = fidl::client::decode_transaction_body::<
6927                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, ScreenCaptureError>,
6928                fidl::encoding::DefaultFuchsiaResourceDialect,
6929                0x3b6e5af1d294afd9,
6930            >(_buf?)?;
6931            Ok(_response.map(|x| x))
6932        }
6933        self.client.send_query_and_decode::<ScreenCaptureConfig, ScreenCaptureConfigureResult>(
6934            &mut payload,
6935            0x3b6e5af1d294afd9,
6936            fidl::encoding::DynamicFlags::empty(),
6937            _decode,
6938        )
6939    }
6940
6941    type GetNextFrameResponseFut = fidl::client::QueryResponseFut<
6942        ScreenCaptureGetNextFrameResult,
6943        fidl::encoding::DefaultFuchsiaResourceDialect,
6944    >;
6945    fn r#get_next_frame(&self, mut payload: GetNextFrameArgs) -> Self::GetNextFrameResponseFut {
6946        fn _decode(
6947            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6948        ) -> Result<ScreenCaptureGetNextFrameResult, fidl::Error> {
6949            let _response = fidl::client::decode_transaction_body::<
6950                fidl::encoding::ResultType<FrameInfo, ScreenCaptureError>,
6951                fidl::encoding::DefaultFuchsiaResourceDialect,
6952                0x552c1580aab8c4a7,
6953            >(_buf?)?;
6954            Ok(_response.map(|x| x))
6955        }
6956        self.client.send_query_and_decode::<GetNextFrameArgs, ScreenCaptureGetNextFrameResult>(
6957            &mut payload,
6958            0x552c1580aab8c4a7,
6959            fidl::encoding::DynamicFlags::empty(),
6960            _decode,
6961        )
6962    }
6963
6964    type ReleaseFrameResponseFut = fidl::client::QueryResponseFut<
6965        ScreenCaptureReleaseFrameResult,
6966        fidl::encoding::DefaultFuchsiaResourceDialect,
6967    >;
6968    fn r#release_frame(&self, mut buffer_id: u32) -> Self::ReleaseFrameResponseFut {
6969        fn _decode(
6970            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6971        ) -> Result<ScreenCaptureReleaseFrameResult, fidl::Error> {
6972            let _response = fidl::client::decode_transaction_body::<
6973                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, ScreenCaptureError>,
6974                fidl::encoding::DefaultFuchsiaResourceDialect,
6975                0x46704dce24e35950,
6976            >(_buf?)?;
6977            Ok(_response.map(|x| x))
6978        }
6979        self.client.send_query_and_decode::<
6980            ScreenCaptureReleaseFrameRequest,
6981            ScreenCaptureReleaseFrameResult,
6982        >(
6983            (buffer_id,),
6984            0x46704dce24e35950,
6985            fidl::encoding::DynamicFlags::empty(),
6986            _decode,
6987        )
6988    }
6989}
6990
6991pub struct ScreenCaptureEventStream {
6992    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
6993}
6994
6995impl std::marker::Unpin for ScreenCaptureEventStream {}
6996
6997impl futures::stream::FusedStream for ScreenCaptureEventStream {
6998    fn is_terminated(&self) -> bool {
6999        self.event_receiver.is_terminated()
7000    }
7001}
7002
7003impl futures::Stream for ScreenCaptureEventStream {
7004    type Item = Result<ScreenCaptureEvent, fidl::Error>;
7005
7006    fn poll_next(
7007        mut self: std::pin::Pin<&mut Self>,
7008        cx: &mut std::task::Context<'_>,
7009    ) -> std::task::Poll<Option<Self::Item>> {
7010        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
7011            &mut self.event_receiver,
7012            cx
7013        )?) {
7014            Some(buf) => std::task::Poll::Ready(Some(ScreenCaptureEvent::decode(buf))),
7015            None => std::task::Poll::Ready(None),
7016        }
7017    }
7018}
7019
7020#[derive(Debug)]
7021pub enum ScreenCaptureEvent {}
7022
7023impl ScreenCaptureEvent {
7024    /// Decodes a message buffer as a [`ScreenCaptureEvent`].
7025    fn decode(
7026        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
7027    ) -> Result<ScreenCaptureEvent, fidl::Error> {
7028        let (bytes, _handles) = buf.split_mut();
7029        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7030        debug_assert_eq!(tx_header.tx_id, 0);
7031        match tx_header.ordinal {
7032            _ => Err(fidl::Error::UnknownOrdinal {
7033                ordinal: tx_header.ordinal,
7034                protocol_name: <ScreenCaptureMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
7035            }),
7036        }
7037    }
7038}
7039
7040/// A Stream of incoming requests for fuchsia.ui.composition/ScreenCapture.
7041pub struct ScreenCaptureRequestStream {
7042    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7043    is_terminated: bool,
7044}
7045
7046impl std::marker::Unpin for ScreenCaptureRequestStream {}
7047
7048impl futures::stream::FusedStream for ScreenCaptureRequestStream {
7049    fn is_terminated(&self) -> bool {
7050        self.is_terminated
7051    }
7052}
7053
7054impl fidl::endpoints::RequestStream for ScreenCaptureRequestStream {
7055    type Protocol = ScreenCaptureMarker;
7056    type ControlHandle = ScreenCaptureControlHandle;
7057
7058    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
7059        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
7060    }
7061
7062    fn control_handle(&self) -> Self::ControlHandle {
7063        ScreenCaptureControlHandle { inner: self.inner.clone() }
7064    }
7065
7066    fn into_inner(
7067        self,
7068    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
7069    {
7070        (self.inner, self.is_terminated)
7071    }
7072
7073    fn from_inner(
7074        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7075        is_terminated: bool,
7076    ) -> Self {
7077        Self { inner, is_terminated }
7078    }
7079}
7080
7081impl futures::Stream for ScreenCaptureRequestStream {
7082    type Item = Result<ScreenCaptureRequest, fidl::Error>;
7083
7084    fn poll_next(
7085        mut self: std::pin::Pin<&mut Self>,
7086        cx: &mut std::task::Context<'_>,
7087    ) -> std::task::Poll<Option<Self::Item>> {
7088        let this = &mut *self;
7089        if this.inner.check_shutdown(cx) {
7090            this.is_terminated = true;
7091            return std::task::Poll::Ready(None);
7092        }
7093        if this.is_terminated {
7094            panic!("polled ScreenCaptureRequestStream after completion");
7095        }
7096        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
7097            |bytes, handles| {
7098                match this.inner.channel().read_etc(cx, bytes, handles) {
7099                    std::task::Poll::Ready(Ok(())) => {}
7100                    std::task::Poll::Pending => return std::task::Poll::Pending,
7101                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
7102                        this.is_terminated = true;
7103                        return std::task::Poll::Ready(None);
7104                    }
7105                    std::task::Poll::Ready(Err(e)) => {
7106                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
7107                            e.into(),
7108                        ))));
7109                    }
7110                }
7111
7112                // A message has been received from the channel
7113                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7114
7115                std::task::Poll::Ready(Some(match header.ordinal {
7116                    0x3b6e5af1d294afd9 => {
7117                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7118                        let mut req = fidl::new_empty!(
7119                            ScreenCaptureConfig,
7120                            fidl::encoding::DefaultFuchsiaResourceDialect
7121                        );
7122                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ScreenCaptureConfig>(&header, _body_bytes, handles, &mut req)?;
7123                        let control_handle =
7124                            ScreenCaptureControlHandle { inner: this.inner.clone() };
7125                        Ok(ScreenCaptureRequest::Configure {
7126                            payload: req,
7127                            responder: ScreenCaptureConfigureResponder {
7128                                control_handle: std::mem::ManuallyDrop::new(control_handle),
7129                                tx_id: header.tx_id,
7130                            },
7131                        })
7132                    }
7133                    0x552c1580aab8c4a7 => {
7134                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7135                        let mut req = fidl::new_empty!(
7136                            GetNextFrameArgs,
7137                            fidl::encoding::DefaultFuchsiaResourceDialect
7138                        );
7139                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<GetNextFrameArgs>(&header, _body_bytes, handles, &mut req)?;
7140                        let control_handle =
7141                            ScreenCaptureControlHandle { inner: this.inner.clone() };
7142                        Ok(ScreenCaptureRequest::GetNextFrame {
7143                            payload: req,
7144                            responder: ScreenCaptureGetNextFrameResponder {
7145                                control_handle: std::mem::ManuallyDrop::new(control_handle),
7146                                tx_id: header.tx_id,
7147                            },
7148                        })
7149                    }
7150                    0x46704dce24e35950 => {
7151                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7152                        let mut req = fidl::new_empty!(
7153                            ScreenCaptureReleaseFrameRequest,
7154                            fidl::encoding::DefaultFuchsiaResourceDialect
7155                        );
7156                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ScreenCaptureReleaseFrameRequest>(&header, _body_bytes, handles, &mut req)?;
7157                        let control_handle =
7158                            ScreenCaptureControlHandle { inner: this.inner.clone() };
7159                        Ok(ScreenCaptureRequest::ReleaseFrame {
7160                            buffer_id: req.buffer_id,
7161
7162                            responder: ScreenCaptureReleaseFrameResponder {
7163                                control_handle: std::mem::ManuallyDrop::new(control_handle),
7164                                tx_id: header.tx_id,
7165                            },
7166                        })
7167                    }
7168                    _ => Err(fidl::Error::UnknownOrdinal {
7169                        ordinal: header.ordinal,
7170                        protocol_name:
7171                            <ScreenCaptureMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
7172                    }),
7173                }))
7174            },
7175        )
7176    }
7177}
7178
7179/// This protocol provides a low-level ScreenCapture API for clients to use.
7180/// ScreenCapture clients should familiarize themselves with the
7181/// [`fuchsia.sysmem/BufferCollection`] and [`fuchsia.ui.composition/Allocator`] protocols
7182/// as those are necessary to create the BufferCollections and images ScreenCapture uses.
7183#[derive(Debug)]
7184pub enum ScreenCaptureRequest {
7185    /// Clients should first use the Allocator protocol to register a
7186    /// BufferCollection. This function will fail with BAD_OPERATION unless all clients of the
7187    /// BufferCollection have set their constraints.
7188    ///
7189    /// Afterwards, clients should create and configure the images that will
7190    /// eventually be rendered to using this method. All the buffers in the
7191    /// collection from 0 to (buffer_count-1) may be used for screen capture.
7192    ///
7193    /// Clients are responsible for determining the rotation of the display,
7194    /// and applying the corrective rotation. For instance, if the display is
7195    /// mounted 90 degrees clockwise (the "top" is on the right, when looking
7196    /// at the display), then the client should specify a 270 degree rotation
7197    /// to account for it.
7198    ///
7199    /// Similarly, the clients are responsible for specifying a buffer big
7200    /// enough for the rotated image. If the buffer is too small, a best effort
7201    /// attempt will be made to render the image.
7202    ///
7203    /// Finally, clients request the server to render the current screen to the
7204    /// shared buffers using [`GetNextFrame`].
7205    ///
7206    /// [`Configure`] can be called again with a new BufferCollectionImportToken
7207    /// if the client wishes to change any of the configuration settings. In
7208    /// this case all the buffers from the previous call to [`Configure`] will
7209    /// be released.
7210    Configure { payload: ScreenCaptureConfig, responder: ScreenCaptureConfigureResponder },
7211    /// Following a successful call to [`Configure`], clients can call
7212    /// GetNextFrame. This will populate a buffer with the most recent frame.
7213    ///
7214    /// Clients should wait on the zx::event they pass for successful
7215    /// completion of the screenshot. It is not guaranteed that the screenshot
7216    /// will be completed by the time this function returns.
7217    ///
7218    /// The requested image will be in the BufferCollection that the client set
7219    /// up in the VMO at the index specified by buffer_id.
7220    ///
7221    /// When ScreenCapture is used to provide a stream, the rate that the
7222    /// client calls GetNextFrame will drive the frame rate.
7223    ///
7224    /// Errors:
7225    /// BAD_OPERATION if Configure was not called, or not called successfully
7226    /// MISSING_ARGS if a required argument is not present
7227    /// BUFFER_FULL if all buffers in the BufferCollection are in use. In this case, ReleaseFrame
7228    /// must be called to make a buffer available before this function can be called successfully.
7229    GetNextFrame { payload: GetNextFrameArgs, responder: ScreenCaptureGetNextFrameResponder },
7230    /// Once the client no longer needs an image, they can call ReleaseFrame on
7231    /// the VMO index of the buffer so that the server can reuse it in the future.
7232    ReleaseFrame { buffer_id: u32, responder: ScreenCaptureReleaseFrameResponder },
7233}
7234
7235impl ScreenCaptureRequest {
7236    #[allow(irrefutable_let_patterns)]
7237    pub fn into_configure(self) -> Option<(ScreenCaptureConfig, ScreenCaptureConfigureResponder)> {
7238        if let ScreenCaptureRequest::Configure { payload, responder } = self {
7239            Some((payload, responder))
7240        } else {
7241            None
7242        }
7243    }
7244
7245    #[allow(irrefutable_let_patterns)]
7246    pub fn into_get_next_frame(
7247        self,
7248    ) -> Option<(GetNextFrameArgs, ScreenCaptureGetNextFrameResponder)> {
7249        if let ScreenCaptureRequest::GetNextFrame { payload, responder } = self {
7250            Some((payload, responder))
7251        } else {
7252            None
7253        }
7254    }
7255
7256    #[allow(irrefutable_let_patterns)]
7257    pub fn into_release_frame(self) -> Option<(u32, ScreenCaptureReleaseFrameResponder)> {
7258        if let ScreenCaptureRequest::ReleaseFrame { buffer_id, responder } = self {
7259            Some((buffer_id, responder))
7260        } else {
7261            None
7262        }
7263    }
7264
7265    /// Name of the method defined in FIDL
7266    pub fn method_name(&self) -> &'static str {
7267        match *self {
7268            ScreenCaptureRequest::Configure { .. } => "configure",
7269            ScreenCaptureRequest::GetNextFrame { .. } => "get_next_frame",
7270            ScreenCaptureRequest::ReleaseFrame { .. } => "release_frame",
7271        }
7272    }
7273}
7274
7275#[derive(Debug, Clone)]
7276pub struct ScreenCaptureControlHandle {
7277    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7278}
7279
7280impl fidl::endpoints::ControlHandle for ScreenCaptureControlHandle {
7281    fn shutdown(&self) {
7282        self.inner.shutdown()
7283    }
7284
7285    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
7286        self.inner.shutdown_with_epitaph(status)
7287    }
7288
7289    fn is_closed(&self) -> bool {
7290        self.inner.channel().is_closed()
7291    }
7292    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
7293        self.inner.channel().on_closed()
7294    }
7295
7296    #[cfg(target_os = "fuchsia")]
7297    fn signal_peer(
7298        &self,
7299        clear_mask: zx::Signals,
7300        set_mask: zx::Signals,
7301    ) -> Result<(), zx_status::Status> {
7302        use fidl::Peered;
7303        self.inner.channel().signal_peer(clear_mask, set_mask)
7304    }
7305}
7306
7307impl ScreenCaptureControlHandle {}
7308
7309#[must_use = "FIDL methods require a response to be sent"]
7310#[derive(Debug)]
7311pub struct ScreenCaptureConfigureResponder {
7312    control_handle: std::mem::ManuallyDrop<ScreenCaptureControlHandle>,
7313    tx_id: u32,
7314}
7315
7316/// Set the the channel to be shutdown (see [`ScreenCaptureControlHandle::shutdown`])
7317/// if the responder is dropped without sending a response, so that the client
7318/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7319impl std::ops::Drop for ScreenCaptureConfigureResponder {
7320    fn drop(&mut self) {
7321        self.control_handle.shutdown();
7322        // Safety: drops once, never accessed again
7323        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7324    }
7325}
7326
7327impl fidl::endpoints::Responder for ScreenCaptureConfigureResponder {
7328    type ControlHandle = ScreenCaptureControlHandle;
7329
7330    fn control_handle(&self) -> &ScreenCaptureControlHandle {
7331        &self.control_handle
7332    }
7333
7334    fn drop_without_shutdown(mut self) {
7335        // Safety: drops once, never accessed again due to mem::forget
7336        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7337        // Prevent Drop from running (which would shut down the channel)
7338        std::mem::forget(self);
7339    }
7340}
7341
7342impl ScreenCaptureConfigureResponder {
7343    /// Sends a response to the FIDL transaction.
7344    ///
7345    /// Sets the channel to shutdown if an error occurs.
7346    pub fn send(self, mut result: Result<(), ScreenCaptureError>) -> Result<(), fidl::Error> {
7347        let _result = self.send_raw(result);
7348        if _result.is_err() {
7349            self.control_handle.shutdown();
7350        }
7351        self.drop_without_shutdown();
7352        _result
7353    }
7354
7355    /// Similar to "send" but does not shutdown the channel if an error occurs.
7356    pub fn send_no_shutdown_on_err(
7357        self,
7358        mut result: Result<(), ScreenCaptureError>,
7359    ) -> Result<(), fidl::Error> {
7360        let _result = self.send_raw(result);
7361        self.drop_without_shutdown();
7362        _result
7363    }
7364
7365    fn send_raw(&self, mut result: Result<(), ScreenCaptureError>) -> Result<(), fidl::Error> {
7366        self.control_handle.inner.send::<fidl::encoding::ResultType<
7367            fidl::encoding::EmptyStruct,
7368            ScreenCaptureError,
7369        >>(
7370            result,
7371            self.tx_id,
7372            0x3b6e5af1d294afd9,
7373            fidl::encoding::DynamicFlags::empty(),
7374        )
7375    }
7376}
7377
7378#[must_use = "FIDL methods require a response to be sent"]
7379#[derive(Debug)]
7380pub struct ScreenCaptureGetNextFrameResponder {
7381    control_handle: std::mem::ManuallyDrop<ScreenCaptureControlHandle>,
7382    tx_id: u32,
7383}
7384
7385/// Set the the channel to be shutdown (see [`ScreenCaptureControlHandle::shutdown`])
7386/// if the responder is dropped without sending a response, so that the client
7387/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7388impl std::ops::Drop for ScreenCaptureGetNextFrameResponder {
7389    fn drop(&mut self) {
7390        self.control_handle.shutdown();
7391        // Safety: drops once, never accessed again
7392        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7393    }
7394}
7395
7396impl fidl::endpoints::Responder for ScreenCaptureGetNextFrameResponder {
7397    type ControlHandle = ScreenCaptureControlHandle;
7398
7399    fn control_handle(&self) -> &ScreenCaptureControlHandle {
7400        &self.control_handle
7401    }
7402
7403    fn drop_without_shutdown(mut self) {
7404        // Safety: drops once, never accessed again due to mem::forget
7405        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7406        // Prevent Drop from running (which would shut down the channel)
7407        std::mem::forget(self);
7408    }
7409}
7410
7411impl ScreenCaptureGetNextFrameResponder {
7412    /// Sends a response to the FIDL transaction.
7413    ///
7414    /// Sets the channel to shutdown if an error occurs.
7415    pub fn send(
7416        self,
7417        mut result: Result<FrameInfo, ScreenCaptureError>,
7418    ) -> Result<(), fidl::Error> {
7419        let _result = self.send_raw(result);
7420        if _result.is_err() {
7421            self.control_handle.shutdown();
7422        }
7423        self.drop_without_shutdown();
7424        _result
7425    }
7426
7427    /// Similar to "send" but does not shutdown the channel if an error occurs.
7428    pub fn send_no_shutdown_on_err(
7429        self,
7430        mut result: Result<FrameInfo, ScreenCaptureError>,
7431    ) -> Result<(), fidl::Error> {
7432        let _result = self.send_raw(result);
7433        self.drop_without_shutdown();
7434        _result
7435    }
7436
7437    fn send_raw(
7438        &self,
7439        mut result: Result<FrameInfo, ScreenCaptureError>,
7440    ) -> Result<(), fidl::Error> {
7441        self.control_handle.inner.send::<fidl::encoding::ResultType<FrameInfo, ScreenCaptureError>>(
7442            result.as_mut().map_err(|e| *e),
7443            self.tx_id,
7444            0x552c1580aab8c4a7,
7445            fidl::encoding::DynamicFlags::empty(),
7446        )
7447    }
7448}
7449
7450#[must_use = "FIDL methods require a response to be sent"]
7451#[derive(Debug)]
7452pub struct ScreenCaptureReleaseFrameResponder {
7453    control_handle: std::mem::ManuallyDrop<ScreenCaptureControlHandle>,
7454    tx_id: u32,
7455}
7456
7457/// Set the the channel to be shutdown (see [`ScreenCaptureControlHandle::shutdown`])
7458/// if the responder is dropped without sending a response, so that the client
7459/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7460impl std::ops::Drop for ScreenCaptureReleaseFrameResponder {
7461    fn drop(&mut self) {
7462        self.control_handle.shutdown();
7463        // Safety: drops once, never accessed again
7464        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7465    }
7466}
7467
7468impl fidl::endpoints::Responder for ScreenCaptureReleaseFrameResponder {
7469    type ControlHandle = ScreenCaptureControlHandle;
7470
7471    fn control_handle(&self) -> &ScreenCaptureControlHandle {
7472        &self.control_handle
7473    }
7474
7475    fn drop_without_shutdown(mut self) {
7476        // Safety: drops once, never accessed again due to mem::forget
7477        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7478        // Prevent Drop from running (which would shut down the channel)
7479        std::mem::forget(self);
7480    }
7481}
7482
7483impl ScreenCaptureReleaseFrameResponder {
7484    /// Sends a response to the FIDL transaction.
7485    ///
7486    /// Sets the channel to shutdown if an error occurs.
7487    pub fn send(self, mut result: Result<(), ScreenCaptureError>) -> Result<(), fidl::Error> {
7488        let _result = self.send_raw(result);
7489        if _result.is_err() {
7490            self.control_handle.shutdown();
7491        }
7492        self.drop_without_shutdown();
7493        _result
7494    }
7495
7496    /// Similar to "send" but does not shutdown the channel if an error occurs.
7497    pub fn send_no_shutdown_on_err(
7498        self,
7499        mut result: Result<(), ScreenCaptureError>,
7500    ) -> Result<(), fidl::Error> {
7501        let _result = self.send_raw(result);
7502        self.drop_without_shutdown();
7503        _result
7504    }
7505
7506    fn send_raw(&self, mut result: Result<(), ScreenCaptureError>) -> Result<(), fidl::Error> {
7507        self.control_handle.inner.send::<fidl::encoding::ResultType<
7508            fidl::encoding::EmptyStruct,
7509            ScreenCaptureError,
7510        >>(
7511            result,
7512            self.tx_id,
7513            0x46704dce24e35950,
7514            fidl::encoding::DynamicFlags::empty(),
7515        )
7516    }
7517}
7518
7519#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
7520pub struct ScreenshotMarker;
7521
7522impl fidl::endpoints::ProtocolMarker for ScreenshotMarker {
7523    type Proxy = ScreenshotProxy;
7524    type RequestStream = ScreenshotRequestStream;
7525    #[cfg(target_os = "fuchsia")]
7526    type SynchronousProxy = ScreenshotSynchronousProxy;
7527
7528    const DEBUG_NAME: &'static str = "fuchsia.ui.composition.Screenshot";
7529}
7530impl fidl::endpoints::DiscoverableProtocolMarker for ScreenshotMarker {}
7531
7532pub trait ScreenshotProxyInterface: Send + Sync {
7533    type TakeResponseFut: std::future::Future<Output = Result<ScreenshotTakeResponse, fidl::Error>>
7534        + Send;
7535    fn r#take(&self, payload: ScreenshotTakeRequest) -> Self::TakeResponseFut;
7536    type TakeFileResponseFut: std::future::Future<Output = Result<ScreenshotTakeFileResponse, fidl::Error>>
7537        + Send;
7538    fn r#take_file(&self, payload: ScreenshotTakeFileRequest) -> Self::TakeFileResponseFut;
7539}
7540#[derive(Debug)]
7541#[cfg(target_os = "fuchsia")]
7542pub struct ScreenshotSynchronousProxy {
7543    client: fidl::client::sync::Client,
7544}
7545
7546#[cfg(target_os = "fuchsia")]
7547impl fidl::endpoints::SynchronousProxy for ScreenshotSynchronousProxy {
7548    type Proxy = ScreenshotProxy;
7549    type Protocol = ScreenshotMarker;
7550
7551    fn from_channel(inner: fidl::Channel) -> Self {
7552        Self::new(inner)
7553    }
7554
7555    fn into_channel(self) -> fidl::Channel {
7556        self.client.into_channel()
7557    }
7558
7559    fn as_channel(&self) -> &fidl::Channel {
7560        self.client.as_channel()
7561    }
7562}
7563
7564#[cfg(target_os = "fuchsia")]
7565impl ScreenshotSynchronousProxy {
7566    pub fn new(channel: fidl::Channel) -> Self {
7567        Self { client: fidl::client::sync::Client::new(channel) }
7568    }
7569
7570    pub fn into_channel(self) -> fidl::Channel {
7571        self.client.into_channel()
7572    }
7573
7574    /// Waits until an event arrives and returns it. It is safe for other
7575    /// threads to make concurrent requests while waiting for an event.
7576    pub fn wait_for_event(
7577        &self,
7578        deadline: zx::MonotonicInstant,
7579    ) -> Result<ScreenshotEvent, fidl::Error> {
7580        ScreenshotEvent::decode(self.client.wait_for_event::<ScreenshotMarker>(deadline)?)
7581    }
7582
7583    /// Collects the current graphical content of a display in a specified buffer `format` in the
7584    /// sRGB color space. Note that the sRGB color space is non-linear, meaning that unit tests
7585    /// doing pixel equality checks making use of non-fully saturated colors should convert to a
7586    /// linear color space.
7587    ///
7588    /// See https://fuchsia.dev/fuchsia-src/concepts/ui/scenic/color_spaces for more information.
7589    ///
7590    /// Screenshot is taken immediately, populated with the display's content from the most recent
7591    /// VSYNC.
7592    ///
7593    /// If the client calls [`Take`] a second time before a first [`Take`] call returns, the server
7594    /// will close the Screenshot connection with a ZX_ERR_SHOULD_WAIT epitaph.
7595    ///
7596    /// If capture fails due to an internal error, the server will close the Screenshot connection
7597    /// with a ZX_ERR_INTERNAL epitaph.
7598    pub fn r#take(
7599        &self,
7600        mut payload: ScreenshotTakeRequest,
7601        ___deadline: zx::MonotonicInstant,
7602    ) -> Result<ScreenshotTakeResponse, fidl::Error> {
7603        let _response = self
7604            .client
7605            .send_query::<ScreenshotTakeRequest, ScreenshotTakeResponse, ScreenshotMarker>(
7606                &mut payload,
7607                0x51341396e9fd2fd0,
7608                fidl::encoding::DynamicFlags::empty(),
7609                ___deadline,
7610            )?;
7611        Ok(_response)
7612    }
7613
7614    /// Collects the current graphical content of a display in a specified buffer `format` in the
7615    /// sRGB color space. Note that the sRGB color space is non-linear, meaning that unit tests
7616    /// doing pixel equality checks making use of non-fully saturated colors should convert to a
7617    /// linear color space.
7618    ///
7619    /// TODO(https://fxbug.dev/42065844): Link to fuchsia.dev documentation when it's up.
7620    ///
7621    /// Screenshot is taken immediately, populated with the display's content from the most recent
7622    /// VSYNC.
7623    ///
7624    /// If the client calls [`TakeFile`] a second time before a first [`TakeFile`] call returns,
7625    /// the server will close the Screenshot connection with a ZX_ERR_SHOULD_WAIT epitaph.
7626    ///
7627    /// If capture fails due to an internal error, the server will close the Screenshot connection
7628    /// with a ZX_ERR_INTERNAL epitaph.
7629    ///
7630    /// This call should be used if the client is on the host and does not support VMOs,
7631    /// as is the case for ffx tools.
7632    pub fn r#take_file(
7633        &self,
7634        mut payload: ScreenshotTakeFileRequest,
7635        ___deadline: zx::MonotonicInstant,
7636    ) -> Result<ScreenshotTakeFileResponse, fidl::Error> {
7637        let _response = self
7638            .client
7639            .send_query::<ScreenshotTakeFileRequest, ScreenshotTakeFileResponse, ScreenshotMarker>(
7640                &mut payload,
7641                0x470aeea0a4d32903,
7642                fidl::encoding::DynamicFlags::empty(),
7643                ___deadline,
7644            )?;
7645        Ok(_response)
7646    }
7647}
7648
7649#[cfg(target_os = "fuchsia")]
7650impl From<ScreenshotSynchronousProxy> for zx::NullableHandle {
7651    fn from(value: ScreenshotSynchronousProxy) -> Self {
7652        value.into_channel().into()
7653    }
7654}
7655
7656#[cfg(target_os = "fuchsia")]
7657impl From<fidl::Channel> for ScreenshotSynchronousProxy {
7658    fn from(value: fidl::Channel) -> Self {
7659        Self::new(value)
7660    }
7661}
7662
7663#[cfg(target_os = "fuchsia")]
7664impl fidl::endpoints::FromClient for ScreenshotSynchronousProxy {
7665    type Protocol = ScreenshotMarker;
7666
7667    fn from_client(value: fidl::endpoints::ClientEnd<ScreenshotMarker>) -> Self {
7668        Self::new(value.into_channel())
7669    }
7670}
7671
7672#[derive(Debug, Clone)]
7673pub struct ScreenshotProxy {
7674    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
7675}
7676
7677impl fidl::endpoints::Proxy for ScreenshotProxy {
7678    type Protocol = ScreenshotMarker;
7679
7680    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
7681        Self::new(inner)
7682    }
7683
7684    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
7685        self.client.into_channel().map_err(|client| Self { client })
7686    }
7687
7688    fn as_channel(&self) -> &::fidl::AsyncChannel {
7689        self.client.as_channel()
7690    }
7691}
7692
7693impl ScreenshotProxy {
7694    /// Create a new Proxy for fuchsia.ui.composition/Screenshot.
7695    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
7696        let protocol_name = <ScreenshotMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
7697        Self { client: fidl::client::Client::new(channel, protocol_name) }
7698    }
7699
7700    /// Get a Stream of events from the remote end of the protocol.
7701    ///
7702    /// # Panics
7703    ///
7704    /// Panics if the event stream was already taken.
7705    pub fn take_event_stream(&self) -> ScreenshotEventStream {
7706        ScreenshotEventStream { event_receiver: self.client.take_event_receiver() }
7707    }
7708
7709    /// Collects the current graphical content of a display in a specified buffer `format` in the
7710    /// sRGB color space. Note that the sRGB color space is non-linear, meaning that unit tests
7711    /// doing pixel equality checks making use of non-fully saturated colors should convert to a
7712    /// linear color space.
7713    ///
7714    /// See https://fuchsia.dev/fuchsia-src/concepts/ui/scenic/color_spaces for more information.
7715    ///
7716    /// Screenshot is taken immediately, populated with the display's content from the most recent
7717    /// VSYNC.
7718    ///
7719    /// If the client calls [`Take`] a second time before a first [`Take`] call returns, the server
7720    /// will close the Screenshot connection with a ZX_ERR_SHOULD_WAIT epitaph.
7721    ///
7722    /// If capture fails due to an internal error, the server will close the Screenshot connection
7723    /// with a ZX_ERR_INTERNAL epitaph.
7724    pub fn r#take(
7725        &self,
7726        mut payload: ScreenshotTakeRequest,
7727    ) -> fidl::client::QueryResponseFut<
7728        ScreenshotTakeResponse,
7729        fidl::encoding::DefaultFuchsiaResourceDialect,
7730    > {
7731        ScreenshotProxyInterface::r#take(self, payload)
7732    }
7733
7734    /// Collects the current graphical content of a display in a specified buffer `format` in the
7735    /// sRGB color space. Note that the sRGB color space is non-linear, meaning that unit tests
7736    /// doing pixel equality checks making use of non-fully saturated colors should convert to a
7737    /// linear color space.
7738    ///
7739    /// TODO(https://fxbug.dev/42065844): Link to fuchsia.dev documentation when it's up.
7740    ///
7741    /// Screenshot is taken immediately, populated with the display's content from the most recent
7742    /// VSYNC.
7743    ///
7744    /// If the client calls [`TakeFile`] a second time before a first [`TakeFile`] call returns,
7745    /// the server will close the Screenshot connection with a ZX_ERR_SHOULD_WAIT epitaph.
7746    ///
7747    /// If capture fails due to an internal error, the server will close the Screenshot connection
7748    /// with a ZX_ERR_INTERNAL epitaph.
7749    ///
7750    /// This call should be used if the client is on the host and does not support VMOs,
7751    /// as is the case for ffx tools.
7752    pub fn r#take_file(
7753        &self,
7754        mut payload: ScreenshotTakeFileRequest,
7755    ) -> fidl::client::QueryResponseFut<
7756        ScreenshotTakeFileResponse,
7757        fidl::encoding::DefaultFuchsiaResourceDialect,
7758    > {
7759        ScreenshotProxyInterface::r#take_file(self, payload)
7760    }
7761}
7762
7763impl ScreenshotProxyInterface for ScreenshotProxy {
7764    type TakeResponseFut = fidl::client::QueryResponseFut<
7765        ScreenshotTakeResponse,
7766        fidl::encoding::DefaultFuchsiaResourceDialect,
7767    >;
7768    fn r#take(&self, mut payload: ScreenshotTakeRequest) -> Self::TakeResponseFut {
7769        fn _decode(
7770            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7771        ) -> Result<ScreenshotTakeResponse, fidl::Error> {
7772            let _response = fidl::client::decode_transaction_body::<
7773                ScreenshotTakeResponse,
7774                fidl::encoding::DefaultFuchsiaResourceDialect,
7775                0x51341396e9fd2fd0,
7776            >(_buf?)?;
7777            Ok(_response)
7778        }
7779        self.client.send_query_and_decode::<ScreenshotTakeRequest, ScreenshotTakeResponse>(
7780            &mut payload,
7781            0x51341396e9fd2fd0,
7782            fidl::encoding::DynamicFlags::empty(),
7783            _decode,
7784        )
7785    }
7786
7787    type TakeFileResponseFut = fidl::client::QueryResponseFut<
7788        ScreenshotTakeFileResponse,
7789        fidl::encoding::DefaultFuchsiaResourceDialect,
7790    >;
7791    fn r#take_file(&self, mut payload: ScreenshotTakeFileRequest) -> Self::TakeFileResponseFut {
7792        fn _decode(
7793            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7794        ) -> Result<ScreenshotTakeFileResponse, fidl::Error> {
7795            let _response = fidl::client::decode_transaction_body::<
7796                ScreenshotTakeFileResponse,
7797                fidl::encoding::DefaultFuchsiaResourceDialect,
7798                0x470aeea0a4d32903,
7799            >(_buf?)?;
7800            Ok(_response)
7801        }
7802        self.client.send_query_and_decode::<ScreenshotTakeFileRequest, ScreenshotTakeFileResponse>(
7803            &mut payload,
7804            0x470aeea0a4d32903,
7805            fidl::encoding::DynamicFlags::empty(),
7806            _decode,
7807        )
7808    }
7809}
7810
7811pub struct ScreenshotEventStream {
7812    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
7813}
7814
7815impl std::marker::Unpin for ScreenshotEventStream {}
7816
7817impl futures::stream::FusedStream for ScreenshotEventStream {
7818    fn is_terminated(&self) -> bool {
7819        self.event_receiver.is_terminated()
7820    }
7821}
7822
7823impl futures::Stream for ScreenshotEventStream {
7824    type Item = Result<ScreenshotEvent, fidl::Error>;
7825
7826    fn poll_next(
7827        mut self: std::pin::Pin<&mut Self>,
7828        cx: &mut std::task::Context<'_>,
7829    ) -> std::task::Poll<Option<Self::Item>> {
7830        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
7831            &mut self.event_receiver,
7832            cx
7833        )?) {
7834            Some(buf) => std::task::Poll::Ready(Some(ScreenshotEvent::decode(buf))),
7835            None => std::task::Poll::Ready(None),
7836        }
7837    }
7838}
7839
7840#[derive(Debug)]
7841pub enum ScreenshotEvent {}
7842
7843impl ScreenshotEvent {
7844    /// Decodes a message buffer as a [`ScreenshotEvent`].
7845    fn decode(
7846        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
7847    ) -> Result<ScreenshotEvent, fidl::Error> {
7848        let (bytes, _handles) = buf.split_mut();
7849        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7850        debug_assert_eq!(tx_header.tx_id, 0);
7851        match tx_header.ordinal {
7852            _ => Err(fidl::Error::UnknownOrdinal {
7853                ordinal: tx_header.ordinal,
7854                protocol_name: <ScreenshotMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
7855            }),
7856        }
7857    }
7858}
7859
7860/// A Stream of incoming requests for fuchsia.ui.composition/Screenshot.
7861pub struct ScreenshotRequestStream {
7862    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7863    is_terminated: bool,
7864}
7865
7866impl std::marker::Unpin for ScreenshotRequestStream {}
7867
7868impl futures::stream::FusedStream for ScreenshotRequestStream {
7869    fn is_terminated(&self) -> bool {
7870        self.is_terminated
7871    }
7872}
7873
7874impl fidl::endpoints::RequestStream for ScreenshotRequestStream {
7875    type Protocol = ScreenshotMarker;
7876    type ControlHandle = ScreenshotControlHandle;
7877
7878    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
7879        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
7880    }
7881
7882    fn control_handle(&self) -> Self::ControlHandle {
7883        ScreenshotControlHandle { inner: self.inner.clone() }
7884    }
7885
7886    fn into_inner(
7887        self,
7888    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
7889    {
7890        (self.inner, self.is_terminated)
7891    }
7892
7893    fn from_inner(
7894        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7895        is_terminated: bool,
7896    ) -> Self {
7897        Self { inner, is_terminated }
7898    }
7899}
7900
7901impl futures::Stream for ScreenshotRequestStream {
7902    type Item = Result<ScreenshotRequest, fidl::Error>;
7903
7904    fn poll_next(
7905        mut self: std::pin::Pin<&mut Self>,
7906        cx: &mut std::task::Context<'_>,
7907    ) -> std::task::Poll<Option<Self::Item>> {
7908        let this = &mut *self;
7909        if this.inner.check_shutdown(cx) {
7910            this.is_terminated = true;
7911            return std::task::Poll::Ready(None);
7912        }
7913        if this.is_terminated {
7914            panic!("polled ScreenshotRequestStream after completion");
7915        }
7916        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
7917            |bytes, handles| {
7918                match this.inner.channel().read_etc(cx, bytes, handles) {
7919                    std::task::Poll::Ready(Ok(())) => {}
7920                    std::task::Poll::Pending => return std::task::Poll::Pending,
7921                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
7922                        this.is_terminated = true;
7923                        return std::task::Poll::Ready(None);
7924                    }
7925                    std::task::Poll::Ready(Err(e)) => {
7926                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
7927                            e.into(),
7928                        ))));
7929                    }
7930                }
7931
7932                // A message has been received from the channel
7933                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7934
7935                std::task::Poll::Ready(Some(match header.ordinal {
7936                    0x51341396e9fd2fd0 => {
7937                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7938                        let mut req = fidl::new_empty!(
7939                            ScreenshotTakeRequest,
7940                            fidl::encoding::DefaultFuchsiaResourceDialect
7941                        );
7942                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ScreenshotTakeRequest>(&header, _body_bytes, handles, &mut req)?;
7943                        let control_handle = ScreenshotControlHandle { inner: this.inner.clone() };
7944                        Ok(ScreenshotRequest::Take {
7945                            payload: req,
7946                            responder: ScreenshotTakeResponder {
7947                                control_handle: std::mem::ManuallyDrop::new(control_handle),
7948                                tx_id: header.tx_id,
7949                            },
7950                        })
7951                    }
7952                    0x470aeea0a4d32903 => {
7953                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7954                        let mut req = fidl::new_empty!(
7955                            ScreenshotTakeFileRequest,
7956                            fidl::encoding::DefaultFuchsiaResourceDialect
7957                        );
7958                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ScreenshotTakeFileRequest>(&header, _body_bytes, handles, &mut req)?;
7959                        let control_handle = ScreenshotControlHandle { inner: this.inner.clone() };
7960                        Ok(ScreenshotRequest::TakeFile {
7961                            payload: req,
7962                            responder: ScreenshotTakeFileResponder {
7963                                control_handle: std::mem::ManuallyDrop::new(control_handle),
7964                                tx_id: header.tx_id,
7965                            },
7966                        })
7967                    }
7968                    _ => Err(fidl::Error::UnknownOrdinal {
7969                        ordinal: header.ordinal,
7970                        protocol_name:
7971                            <ScreenshotMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
7972                    }),
7973                }))
7974            },
7975        )
7976    }
7977}
7978
7979/// Collects the current graphical content of a display.
7980#[derive(Debug)]
7981pub enum ScreenshotRequest {
7982    /// Collects the current graphical content of a display in a specified buffer `format` in the
7983    /// sRGB color space. Note that the sRGB color space is non-linear, meaning that unit tests
7984    /// doing pixel equality checks making use of non-fully saturated colors should convert to a
7985    /// linear color space.
7986    ///
7987    /// See https://fuchsia.dev/fuchsia-src/concepts/ui/scenic/color_spaces for more information.
7988    ///
7989    /// Screenshot is taken immediately, populated with the display's content from the most recent
7990    /// VSYNC.
7991    ///
7992    /// If the client calls [`Take`] a second time before a first [`Take`] call returns, the server
7993    /// will close the Screenshot connection with a ZX_ERR_SHOULD_WAIT epitaph.
7994    ///
7995    /// If capture fails due to an internal error, the server will close the Screenshot connection
7996    /// with a ZX_ERR_INTERNAL epitaph.
7997    Take { payload: ScreenshotTakeRequest, responder: ScreenshotTakeResponder },
7998    /// Collects the current graphical content of a display in a specified buffer `format` in the
7999    /// sRGB color space. Note that the sRGB color space is non-linear, meaning that unit tests
8000    /// doing pixel equality checks making use of non-fully saturated colors should convert to a
8001    /// linear color space.
8002    ///
8003    /// TODO(https://fxbug.dev/42065844): Link to fuchsia.dev documentation when it's up.
8004    ///
8005    /// Screenshot is taken immediately, populated with the display's content from the most recent
8006    /// VSYNC.
8007    ///
8008    /// If the client calls [`TakeFile`] a second time before a first [`TakeFile`] call returns,
8009    /// the server will close the Screenshot connection with a ZX_ERR_SHOULD_WAIT epitaph.
8010    ///
8011    /// If capture fails due to an internal error, the server will close the Screenshot connection
8012    /// with a ZX_ERR_INTERNAL epitaph.
8013    ///
8014    /// This call should be used if the client is on the host and does not support VMOs,
8015    /// as is the case for ffx tools.
8016    TakeFile { payload: ScreenshotTakeFileRequest, responder: ScreenshotTakeFileResponder },
8017}
8018
8019impl ScreenshotRequest {
8020    #[allow(irrefutable_let_patterns)]
8021    pub fn into_take(self) -> Option<(ScreenshotTakeRequest, ScreenshotTakeResponder)> {
8022        if let ScreenshotRequest::Take { payload, responder } = self {
8023            Some((payload, responder))
8024        } else {
8025            None
8026        }
8027    }
8028
8029    #[allow(irrefutable_let_patterns)]
8030    pub fn into_take_file(
8031        self,
8032    ) -> Option<(ScreenshotTakeFileRequest, ScreenshotTakeFileResponder)> {
8033        if let ScreenshotRequest::TakeFile { payload, responder } = self {
8034            Some((payload, responder))
8035        } else {
8036            None
8037        }
8038    }
8039
8040    /// Name of the method defined in FIDL
8041    pub fn method_name(&self) -> &'static str {
8042        match *self {
8043            ScreenshotRequest::Take { .. } => "take",
8044            ScreenshotRequest::TakeFile { .. } => "take_file",
8045        }
8046    }
8047}
8048
8049#[derive(Debug, Clone)]
8050pub struct ScreenshotControlHandle {
8051    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8052}
8053
8054impl fidl::endpoints::ControlHandle for ScreenshotControlHandle {
8055    fn shutdown(&self) {
8056        self.inner.shutdown()
8057    }
8058
8059    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
8060        self.inner.shutdown_with_epitaph(status)
8061    }
8062
8063    fn is_closed(&self) -> bool {
8064        self.inner.channel().is_closed()
8065    }
8066    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
8067        self.inner.channel().on_closed()
8068    }
8069
8070    #[cfg(target_os = "fuchsia")]
8071    fn signal_peer(
8072        &self,
8073        clear_mask: zx::Signals,
8074        set_mask: zx::Signals,
8075    ) -> Result<(), zx_status::Status> {
8076        use fidl::Peered;
8077        self.inner.channel().signal_peer(clear_mask, set_mask)
8078    }
8079}
8080
8081impl ScreenshotControlHandle {}
8082
8083#[must_use = "FIDL methods require a response to be sent"]
8084#[derive(Debug)]
8085pub struct ScreenshotTakeResponder {
8086    control_handle: std::mem::ManuallyDrop<ScreenshotControlHandle>,
8087    tx_id: u32,
8088}
8089
8090/// Set the the channel to be shutdown (see [`ScreenshotControlHandle::shutdown`])
8091/// if the responder is dropped without sending a response, so that the client
8092/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
8093impl std::ops::Drop for ScreenshotTakeResponder {
8094    fn drop(&mut self) {
8095        self.control_handle.shutdown();
8096        // Safety: drops once, never accessed again
8097        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8098    }
8099}
8100
8101impl fidl::endpoints::Responder for ScreenshotTakeResponder {
8102    type ControlHandle = ScreenshotControlHandle;
8103
8104    fn control_handle(&self) -> &ScreenshotControlHandle {
8105        &self.control_handle
8106    }
8107
8108    fn drop_without_shutdown(mut self) {
8109        // Safety: drops once, never accessed again due to mem::forget
8110        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8111        // Prevent Drop from running (which would shut down the channel)
8112        std::mem::forget(self);
8113    }
8114}
8115
8116impl ScreenshotTakeResponder {
8117    /// Sends a response to the FIDL transaction.
8118    ///
8119    /// Sets the channel to shutdown if an error occurs.
8120    pub fn send(self, mut payload: ScreenshotTakeResponse) -> Result<(), fidl::Error> {
8121        let _result = self.send_raw(payload);
8122        if _result.is_err() {
8123            self.control_handle.shutdown();
8124        }
8125        self.drop_without_shutdown();
8126        _result
8127    }
8128
8129    /// Similar to "send" but does not shutdown the channel if an error occurs.
8130    pub fn send_no_shutdown_on_err(
8131        self,
8132        mut payload: ScreenshotTakeResponse,
8133    ) -> Result<(), fidl::Error> {
8134        let _result = self.send_raw(payload);
8135        self.drop_without_shutdown();
8136        _result
8137    }
8138
8139    fn send_raw(&self, mut payload: ScreenshotTakeResponse) -> Result<(), fidl::Error> {
8140        self.control_handle.inner.send::<ScreenshotTakeResponse>(
8141            &mut payload,
8142            self.tx_id,
8143            0x51341396e9fd2fd0,
8144            fidl::encoding::DynamicFlags::empty(),
8145        )
8146    }
8147}
8148
8149#[must_use = "FIDL methods require a response to be sent"]
8150#[derive(Debug)]
8151pub struct ScreenshotTakeFileResponder {
8152    control_handle: std::mem::ManuallyDrop<ScreenshotControlHandle>,
8153    tx_id: u32,
8154}
8155
8156/// Set the the channel to be shutdown (see [`ScreenshotControlHandle::shutdown`])
8157/// if the responder is dropped without sending a response, so that the client
8158/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
8159impl std::ops::Drop for ScreenshotTakeFileResponder {
8160    fn drop(&mut self) {
8161        self.control_handle.shutdown();
8162        // Safety: drops once, never accessed again
8163        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8164    }
8165}
8166
8167impl fidl::endpoints::Responder for ScreenshotTakeFileResponder {
8168    type ControlHandle = ScreenshotControlHandle;
8169
8170    fn control_handle(&self) -> &ScreenshotControlHandle {
8171        &self.control_handle
8172    }
8173
8174    fn drop_without_shutdown(mut self) {
8175        // Safety: drops once, never accessed again due to mem::forget
8176        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8177        // Prevent Drop from running (which would shut down the channel)
8178        std::mem::forget(self);
8179    }
8180}
8181
8182impl ScreenshotTakeFileResponder {
8183    /// Sends a response to the FIDL transaction.
8184    ///
8185    /// Sets the channel to shutdown if an error occurs.
8186    pub fn send(self, mut payload: ScreenshotTakeFileResponse) -> Result<(), fidl::Error> {
8187        let _result = self.send_raw(payload);
8188        if _result.is_err() {
8189            self.control_handle.shutdown();
8190        }
8191        self.drop_without_shutdown();
8192        _result
8193    }
8194
8195    /// Similar to "send" but does not shutdown the channel if an error occurs.
8196    pub fn send_no_shutdown_on_err(
8197        self,
8198        mut payload: ScreenshotTakeFileResponse,
8199    ) -> Result<(), fidl::Error> {
8200        let _result = self.send_raw(payload);
8201        self.drop_without_shutdown();
8202        _result
8203    }
8204
8205    fn send_raw(&self, mut payload: ScreenshotTakeFileResponse) -> Result<(), fidl::Error> {
8206        self.control_handle.inner.send::<ScreenshotTakeFileResponse>(
8207            &mut payload,
8208            self.tx_id,
8209            0x470aeea0a4d32903,
8210            fidl::encoding::DynamicFlags::empty(),
8211        )
8212    }
8213}
8214
8215#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
8216pub struct TrustedFlatlandMarker;
8217
8218impl fidl::endpoints::ProtocolMarker for TrustedFlatlandMarker {
8219    type Proxy = TrustedFlatlandProxy;
8220    type RequestStream = TrustedFlatlandRequestStream;
8221    #[cfg(target_os = "fuchsia")]
8222    type SynchronousProxy = TrustedFlatlandSynchronousProxy;
8223
8224    const DEBUG_NAME: &'static str = "(anonymous) TrustedFlatland";
8225}
8226
8227pub trait TrustedFlatlandProxyInterface: Send + Sync {
8228    fn r#release_image_immediately(&self, image_id: &ContentId) -> Result<(), fidl::Error>;
8229}
8230#[derive(Debug)]
8231#[cfg(target_os = "fuchsia")]
8232pub struct TrustedFlatlandSynchronousProxy {
8233    client: fidl::client::sync::Client,
8234}
8235
8236#[cfg(target_os = "fuchsia")]
8237impl fidl::endpoints::SynchronousProxy for TrustedFlatlandSynchronousProxy {
8238    type Proxy = TrustedFlatlandProxy;
8239    type Protocol = TrustedFlatlandMarker;
8240
8241    fn from_channel(inner: fidl::Channel) -> Self {
8242        Self::new(inner)
8243    }
8244
8245    fn into_channel(self) -> fidl::Channel {
8246        self.client.into_channel()
8247    }
8248
8249    fn as_channel(&self) -> &fidl::Channel {
8250        self.client.as_channel()
8251    }
8252}
8253
8254#[cfg(target_os = "fuchsia")]
8255impl TrustedFlatlandSynchronousProxy {
8256    pub fn new(channel: fidl::Channel) -> Self {
8257        Self { client: fidl::client::sync::Client::new(channel) }
8258    }
8259
8260    pub fn into_channel(self) -> fidl::Channel {
8261        self.client.into_channel()
8262    }
8263
8264    /// Waits until an event arrives and returns it. It is safe for other
8265    /// threads to make concurrent requests while waiting for an event.
8266    pub fn wait_for_event(
8267        &self,
8268        deadline: zx::MonotonicInstant,
8269    ) -> Result<TrustedFlatlandEvent, fidl::Error> {
8270        TrustedFlatlandEvent::decode(self.client.wait_for_event::<TrustedFlatlandMarker>(deadline)?)
8271    }
8272
8273    /// Releases an image immediately, without waiting for the next present.
8274    pub fn r#release_image_immediately(&self, mut image_id: &ContentId) -> Result<(), fidl::Error> {
8275        self.client.send::<TrustedFlatlandReleaseImageImmediatelyRequest>(
8276            (image_id,),
8277            0x245e1ac080772c8,
8278            fidl::encoding::DynamicFlags::empty(),
8279        )
8280    }
8281}
8282
8283#[cfg(target_os = "fuchsia")]
8284impl From<TrustedFlatlandSynchronousProxy> for zx::NullableHandle {
8285    fn from(value: TrustedFlatlandSynchronousProxy) -> Self {
8286        value.into_channel().into()
8287    }
8288}
8289
8290#[cfg(target_os = "fuchsia")]
8291impl From<fidl::Channel> for TrustedFlatlandSynchronousProxy {
8292    fn from(value: fidl::Channel) -> Self {
8293        Self::new(value)
8294    }
8295}
8296
8297#[cfg(target_os = "fuchsia")]
8298impl fidl::endpoints::FromClient for TrustedFlatlandSynchronousProxy {
8299    type Protocol = TrustedFlatlandMarker;
8300
8301    fn from_client(value: fidl::endpoints::ClientEnd<TrustedFlatlandMarker>) -> Self {
8302        Self::new(value.into_channel())
8303    }
8304}
8305
8306#[derive(Debug, Clone)]
8307pub struct TrustedFlatlandProxy {
8308    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
8309}
8310
8311impl fidl::endpoints::Proxy for TrustedFlatlandProxy {
8312    type Protocol = TrustedFlatlandMarker;
8313
8314    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
8315        Self::new(inner)
8316    }
8317
8318    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
8319        self.client.into_channel().map_err(|client| Self { client })
8320    }
8321
8322    fn as_channel(&self) -> &::fidl::AsyncChannel {
8323        self.client.as_channel()
8324    }
8325}
8326
8327impl TrustedFlatlandProxy {
8328    /// Create a new Proxy for fuchsia.ui.composition/TrustedFlatland.
8329    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
8330        let protocol_name = <TrustedFlatlandMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
8331        Self { client: fidl::client::Client::new(channel, protocol_name) }
8332    }
8333
8334    /// Get a Stream of events from the remote end of the protocol.
8335    ///
8336    /// # Panics
8337    ///
8338    /// Panics if the event stream was already taken.
8339    pub fn take_event_stream(&self) -> TrustedFlatlandEventStream {
8340        TrustedFlatlandEventStream { event_receiver: self.client.take_event_receiver() }
8341    }
8342
8343    /// Releases an image immediately, without waiting for the next present.
8344    pub fn r#release_image_immediately(&self, mut image_id: &ContentId) -> Result<(), fidl::Error> {
8345        TrustedFlatlandProxyInterface::r#release_image_immediately(self, image_id)
8346    }
8347}
8348
8349impl TrustedFlatlandProxyInterface for TrustedFlatlandProxy {
8350    fn r#release_image_immediately(&self, mut image_id: &ContentId) -> Result<(), fidl::Error> {
8351        self.client.send::<TrustedFlatlandReleaseImageImmediatelyRequest>(
8352            (image_id,),
8353            0x245e1ac080772c8,
8354            fidl::encoding::DynamicFlags::empty(),
8355        )
8356    }
8357}
8358
8359pub struct TrustedFlatlandEventStream {
8360    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
8361}
8362
8363impl std::marker::Unpin for TrustedFlatlandEventStream {}
8364
8365impl futures::stream::FusedStream for TrustedFlatlandEventStream {
8366    fn is_terminated(&self) -> bool {
8367        self.event_receiver.is_terminated()
8368    }
8369}
8370
8371impl futures::Stream for TrustedFlatlandEventStream {
8372    type Item = Result<TrustedFlatlandEvent, fidl::Error>;
8373
8374    fn poll_next(
8375        mut self: std::pin::Pin<&mut Self>,
8376        cx: &mut std::task::Context<'_>,
8377    ) -> std::task::Poll<Option<Self::Item>> {
8378        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
8379            &mut self.event_receiver,
8380            cx
8381        )?) {
8382            Some(buf) => std::task::Poll::Ready(Some(TrustedFlatlandEvent::decode(buf))),
8383            None => std::task::Poll::Ready(None),
8384        }
8385    }
8386}
8387
8388#[derive(Debug)]
8389pub enum TrustedFlatlandEvent {}
8390
8391impl TrustedFlatlandEvent {
8392    /// Decodes a message buffer as a [`TrustedFlatlandEvent`].
8393    fn decode(
8394        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
8395    ) -> Result<TrustedFlatlandEvent, fidl::Error> {
8396        let (bytes, _handles) = buf.split_mut();
8397        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
8398        debug_assert_eq!(tx_header.tx_id, 0);
8399        match tx_header.ordinal {
8400            _ => Err(fidl::Error::UnknownOrdinal {
8401                ordinal: tx_header.ordinal,
8402                protocol_name:
8403                    <TrustedFlatlandMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
8404            }),
8405        }
8406    }
8407}
8408
8409/// A Stream of incoming requests for fuchsia.ui.composition/TrustedFlatland.
8410pub struct TrustedFlatlandRequestStream {
8411    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8412    is_terminated: bool,
8413}
8414
8415impl std::marker::Unpin for TrustedFlatlandRequestStream {}
8416
8417impl futures::stream::FusedStream for TrustedFlatlandRequestStream {
8418    fn is_terminated(&self) -> bool {
8419        self.is_terminated
8420    }
8421}
8422
8423impl fidl::endpoints::RequestStream for TrustedFlatlandRequestStream {
8424    type Protocol = TrustedFlatlandMarker;
8425    type ControlHandle = TrustedFlatlandControlHandle;
8426
8427    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
8428        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
8429    }
8430
8431    fn control_handle(&self) -> Self::ControlHandle {
8432        TrustedFlatlandControlHandle { inner: self.inner.clone() }
8433    }
8434
8435    fn into_inner(
8436        self,
8437    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
8438    {
8439        (self.inner, self.is_terminated)
8440    }
8441
8442    fn from_inner(
8443        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8444        is_terminated: bool,
8445    ) -> Self {
8446        Self { inner, is_terminated }
8447    }
8448}
8449
8450impl futures::Stream for TrustedFlatlandRequestStream {
8451    type Item = Result<TrustedFlatlandRequest, fidl::Error>;
8452
8453    fn poll_next(
8454        mut self: std::pin::Pin<&mut Self>,
8455        cx: &mut std::task::Context<'_>,
8456    ) -> std::task::Poll<Option<Self::Item>> {
8457        let this = &mut *self;
8458        if this.inner.check_shutdown(cx) {
8459            this.is_terminated = true;
8460            return std::task::Poll::Ready(None);
8461        }
8462        if this.is_terminated {
8463            panic!("polled TrustedFlatlandRequestStream after completion");
8464        }
8465        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
8466            |bytes, handles| {
8467                match this.inner.channel().read_etc(cx, bytes, handles) {
8468                    std::task::Poll::Ready(Ok(())) => {}
8469                    std::task::Poll::Pending => return std::task::Poll::Pending,
8470                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
8471                        this.is_terminated = true;
8472                        return std::task::Poll::Ready(None);
8473                    }
8474                    std::task::Poll::Ready(Err(e)) => {
8475                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
8476                            e.into(),
8477                        ))));
8478                    }
8479                }
8480
8481                // A message has been received from the channel
8482                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
8483
8484                std::task::Poll::Ready(Some(match header.ordinal {
8485                    0x245e1ac080772c8 => {
8486                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
8487                        let mut req = fidl::new_empty!(
8488                            TrustedFlatlandReleaseImageImmediatelyRequest,
8489                            fidl::encoding::DefaultFuchsiaResourceDialect
8490                        );
8491                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<TrustedFlatlandReleaseImageImmediatelyRequest>(&header, _body_bytes, handles, &mut req)?;
8492                        let control_handle =
8493                            TrustedFlatlandControlHandle { inner: this.inner.clone() };
8494                        Ok(TrustedFlatlandRequest::ReleaseImageImmediately {
8495                            image_id: req.image_id,
8496
8497                            control_handle,
8498                        })
8499                    }
8500                    _ => Err(fidl::Error::UnknownOrdinal {
8501                        ordinal: header.ordinal,
8502                        protocol_name:
8503                            <TrustedFlatlandMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
8504                    }),
8505                }))
8506            },
8507        )
8508    }
8509}
8510
8511/// A privileged protocol for trusted Flatland instances that require special capabilities.
8512///
8513/// This protocol is composed into [`fuchsia.ui.composition/Flatland`]. Methods in this protocol
8514/// are only available if the `Flatland` instance was created through
8515/// [`fuchsia.ui.composition/TrustedFlatlandFactory`].
8516#[derive(Debug)]
8517pub enum TrustedFlatlandRequest {
8518    /// Releases an image immediately, without waiting for the next present.
8519    ReleaseImageImmediately { image_id: ContentId, control_handle: TrustedFlatlandControlHandle },
8520}
8521
8522impl TrustedFlatlandRequest {
8523    #[allow(irrefutable_let_patterns)]
8524    pub fn into_release_image_immediately(
8525        self,
8526    ) -> Option<(ContentId, TrustedFlatlandControlHandle)> {
8527        if let TrustedFlatlandRequest::ReleaseImageImmediately { image_id, control_handle } = self {
8528            Some((image_id, control_handle))
8529        } else {
8530            None
8531        }
8532    }
8533
8534    /// Name of the method defined in FIDL
8535    pub fn method_name(&self) -> &'static str {
8536        match *self {
8537            TrustedFlatlandRequest::ReleaseImageImmediately { .. } => "release_image_immediately",
8538        }
8539    }
8540}
8541
8542#[derive(Debug, Clone)]
8543pub struct TrustedFlatlandControlHandle {
8544    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8545}
8546
8547impl fidl::endpoints::ControlHandle for TrustedFlatlandControlHandle {
8548    fn shutdown(&self) {
8549        self.inner.shutdown()
8550    }
8551
8552    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
8553        self.inner.shutdown_with_epitaph(status)
8554    }
8555
8556    fn is_closed(&self) -> bool {
8557        self.inner.channel().is_closed()
8558    }
8559    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
8560        self.inner.channel().on_closed()
8561    }
8562
8563    #[cfg(target_os = "fuchsia")]
8564    fn signal_peer(
8565        &self,
8566        clear_mask: zx::Signals,
8567        set_mask: zx::Signals,
8568    ) -> Result<(), zx_status::Status> {
8569        use fidl::Peered;
8570        self.inner.channel().signal_peer(clear_mask, set_mask)
8571    }
8572}
8573
8574impl TrustedFlatlandControlHandle {}
8575
8576#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
8577pub struct TrustedFlatlandFactoryMarker;
8578
8579impl fidl::endpoints::ProtocolMarker for TrustedFlatlandFactoryMarker {
8580    type Proxy = TrustedFlatlandFactoryProxy;
8581    type RequestStream = TrustedFlatlandFactoryRequestStream;
8582    #[cfg(target_os = "fuchsia")]
8583    type SynchronousProxy = TrustedFlatlandFactorySynchronousProxy;
8584
8585    const DEBUG_NAME: &'static str = "fuchsia.ui.composition.TrustedFlatlandFactory";
8586}
8587impl fidl::endpoints::DiscoverableProtocolMarker for TrustedFlatlandFactoryMarker {}
8588pub type TrustedFlatlandFactoryCreateFlatlandResult = Result<(), TrustedFlatlandFactoryError>;
8589
8590pub trait TrustedFlatlandFactoryProxyInterface: Send + Sync {
8591    type CreateFlatlandResponseFut: std::future::Future<
8592            Output = Result<TrustedFlatlandFactoryCreateFlatlandResult, fidl::Error>,
8593        > + Send;
8594    fn r#create_flatland(
8595        &self,
8596        server_end: fidl::endpoints::ServerEnd<FlatlandMarker>,
8597        config: TrustedFlatlandConfig,
8598    ) -> Self::CreateFlatlandResponseFut;
8599}
8600#[derive(Debug)]
8601#[cfg(target_os = "fuchsia")]
8602pub struct TrustedFlatlandFactorySynchronousProxy {
8603    client: fidl::client::sync::Client,
8604}
8605
8606#[cfg(target_os = "fuchsia")]
8607impl fidl::endpoints::SynchronousProxy for TrustedFlatlandFactorySynchronousProxy {
8608    type Proxy = TrustedFlatlandFactoryProxy;
8609    type Protocol = TrustedFlatlandFactoryMarker;
8610
8611    fn from_channel(inner: fidl::Channel) -> Self {
8612        Self::new(inner)
8613    }
8614
8615    fn into_channel(self) -> fidl::Channel {
8616        self.client.into_channel()
8617    }
8618
8619    fn as_channel(&self) -> &fidl::Channel {
8620        self.client.as_channel()
8621    }
8622}
8623
8624#[cfg(target_os = "fuchsia")]
8625impl TrustedFlatlandFactorySynchronousProxy {
8626    pub fn new(channel: fidl::Channel) -> Self {
8627        Self { client: fidl::client::sync::Client::new(channel) }
8628    }
8629
8630    pub fn into_channel(self) -> fidl::Channel {
8631        self.client.into_channel()
8632    }
8633
8634    /// Waits until an event arrives and returns it. It is safe for other
8635    /// threads to make concurrent requests while waiting for an event.
8636    pub fn wait_for_event(
8637        &self,
8638        deadline: zx::MonotonicInstant,
8639    ) -> Result<TrustedFlatlandFactoryEvent, fidl::Error> {
8640        TrustedFlatlandFactoryEvent::decode(
8641            self.client.wait_for_event::<TrustedFlatlandFactoryMarker>(deadline)?,
8642        )
8643    }
8644
8645    /// Creates a new Flatland instance with the specified configuration.
8646    ///
8647    /// ## Error
8648    ///
8649    /// Returns a `TrustedFlatlandFactoryError` error if the operation fails.
8650    pub fn r#create_flatland(
8651        &self,
8652        mut server_end: fidl::endpoints::ServerEnd<FlatlandMarker>,
8653        mut config: TrustedFlatlandConfig,
8654        ___deadline: zx::MonotonicInstant,
8655    ) -> Result<TrustedFlatlandFactoryCreateFlatlandResult, fidl::Error> {
8656        let _response = self.client.send_query::<
8657            TrustedFlatlandFactoryCreateFlatlandRequest,
8658            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, TrustedFlatlandFactoryError>,
8659            TrustedFlatlandFactoryMarker,
8660        >(
8661            (server_end, &mut config,),
8662            0x48e89c53f00561dc,
8663            fidl::encoding::DynamicFlags::empty(),
8664            ___deadline,
8665        )?;
8666        Ok(_response.map(|x| x))
8667    }
8668}
8669
8670#[cfg(target_os = "fuchsia")]
8671impl From<TrustedFlatlandFactorySynchronousProxy> for zx::NullableHandle {
8672    fn from(value: TrustedFlatlandFactorySynchronousProxy) -> Self {
8673        value.into_channel().into()
8674    }
8675}
8676
8677#[cfg(target_os = "fuchsia")]
8678impl From<fidl::Channel> for TrustedFlatlandFactorySynchronousProxy {
8679    fn from(value: fidl::Channel) -> Self {
8680        Self::new(value)
8681    }
8682}
8683
8684#[cfg(target_os = "fuchsia")]
8685impl fidl::endpoints::FromClient for TrustedFlatlandFactorySynchronousProxy {
8686    type Protocol = TrustedFlatlandFactoryMarker;
8687
8688    fn from_client(value: fidl::endpoints::ClientEnd<TrustedFlatlandFactoryMarker>) -> Self {
8689        Self::new(value.into_channel())
8690    }
8691}
8692
8693#[derive(Debug, Clone)]
8694pub struct TrustedFlatlandFactoryProxy {
8695    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
8696}
8697
8698impl fidl::endpoints::Proxy for TrustedFlatlandFactoryProxy {
8699    type Protocol = TrustedFlatlandFactoryMarker;
8700
8701    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
8702        Self::new(inner)
8703    }
8704
8705    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
8706        self.client.into_channel().map_err(|client| Self { client })
8707    }
8708
8709    fn as_channel(&self) -> &::fidl::AsyncChannel {
8710        self.client.as_channel()
8711    }
8712}
8713
8714impl TrustedFlatlandFactoryProxy {
8715    /// Create a new Proxy for fuchsia.ui.composition/TrustedFlatlandFactory.
8716    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
8717        let protocol_name =
8718            <TrustedFlatlandFactoryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
8719        Self { client: fidl::client::Client::new(channel, protocol_name) }
8720    }
8721
8722    /// Get a Stream of events from the remote end of the protocol.
8723    ///
8724    /// # Panics
8725    ///
8726    /// Panics if the event stream was already taken.
8727    pub fn take_event_stream(&self) -> TrustedFlatlandFactoryEventStream {
8728        TrustedFlatlandFactoryEventStream { event_receiver: self.client.take_event_receiver() }
8729    }
8730
8731    /// Creates a new Flatland instance with the specified configuration.
8732    ///
8733    /// ## Error
8734    ///
8735    /// Returns a `TrustedFlatlandFactoryError` error if the operation fails.
8736    pub fn r#create_flatland(
8737        &self,
8738        mut server_end: fidl::endpoints::ServerEnd<FlatlandMarker>,
8739        mut config: TrustedFlatlandConfig,
8740    ) -> fidl::client::QueryResponseFut<
8741        TrustedFlatlandFactoryCreateFlatlandResult,
8742        fidl::encoding::DefaultFuchsiaResourceDialect,
8743    > {
8744        TrustedFlatlandFactoryProxyInterface::r#create_flatland(self, server_end, config)
8745    }
8746}
8747
8748impl TrustedFlatlandFactoryProxyInterface for TrustedFlatlandFactoryProxy {
8749    type CreateFlatlandResponseFut = fidl::client::QueryResponseFut<
8750        TrustedFlatlandFactoryCreateFlatlandResult,
8751        fidl::encoding::DefaultFuchsiaResourceDialect,
8752    >;
8753    fn r#create_flatland(
8754        &self,
8755        mut server_end: fidl::endpoints::ServerEnd<FlatlandMarker>,
8756        mut config: TrustedFlatlandConfig,
8757    ) -> Self::CreateFlatlandResponseFut {
8758        fn _decode(
8759            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
8760        ) -> Result<TrustedFlatlandFactoryCreateFlatlandResult, fidl::Error> {
8761            let _response = fidl::client::decode_transaction_body::<
8762                fidl::encoding::ResultType<
8763                    fidl::encoding::EmptyStruct,
8764                    TrustedFlatlandFactoryError,
8765                >,
8766                fidl::encoding::DefaultFuchsiaResourceDialect,
8767                0x48e89c53f00561dc,
8768            >(_buf?)?;
8769            Ok(_response.map(|x| x))
8770        }
8771        self.client.send_query_and_decode::<
8772            TrustedFlatlandFactoryCreateFlatlandRequest,
8773            TrustedFlatlandFactoryCreateFlatlandResult,
8774        >(
8775            (server_end, &mut config,),
8776            0x48e89c53f00561dc,
8777            fidl::encoding::DynamicFlags::empty(),
8778            _decode,
8779        )
8780    }
8781}
8782
8783pub struct TrustedFlatlandFactoryEventStream {
8784    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
8785}
8786
8787impl std::marker::Unpin for TrustedFlatlandFactoryEventStream {}
8788
8789impl futures::stream::FusedStream for TrustedFlatlandFactoryEventStream {
8790    fn is_terminated(&self) -> bool {
8791        self.event_receiver.is_terminated()
8792    }
8793}
8794
8795impl futures::Stream for TrustedFlatlandFactoryEventStream {
8796    type Item = Result<TrustedFlatlandFactoryEvent, fidl::Error>;
8797
8798    fn poll_next(
8799        mut self: std::pin::Pin<&mut Self>,
8800        cx: &mut std::task::Context<'_>,
8801    ) -> std::task::Poll<Option<Self::Item>> {
8802        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
8803            &mut self.event_receiver,
8804            cx
8805        )?) {
8806            Some(buf) => std::task::Poll::Ready(Some(TrustedFlatlandFactoryEvent::decode(buf))),
8807            None => std::task::Poll::Ready(None),
8808        }
8809    }
8810}
8811
8812#[derive(Debug)]
8813pub enum TrustedFlatlandFactoryEvent {}
8814
8815impl TrustedFlatlandFactoryEvent {
8816    /// Decodes a message buffer as a [`TrustedFlatlandFactoryEvent`].
8817    fn decode(
8818        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
8819    ) -> Result<TrustedFlatlandFactoryEvent, fidl::Error> {
8820        let (bytes, _handles) = buf.split_mut();
8821        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
8822        debug_assert_eq!(tx_header.tx_id, 0);
8823        match tx_header.ordinal {
8824            _ => Err(fidl::Error::UnknownOrdinal {
8825                ordinal: tx_header.ordinal,
8826                protocol_name:
8827                    <TrustedFlatlandFactoryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
8828            }),
8829        }
8830    }
8831}
8832
8833/// A Stream of incoming requests for fuchsia.ui.composition/TrustedFlatlandFactory.
8834pub struct TrustedFlatlandFactoryRequestStream {
8835    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8836    is_terminated: bool,
8837}
8838
8839impl std::marker::Unpin for TrustedFlatlandFactoryRequestStream {}
8840
8841impl futures::stream::FusedStream for TrustedFlatlandFactoryRequestStream {
8842    fn is_terminated(&self) -> bool {
8843        self.is_terminated
8844    }
8845}
8846
8847impl fidl::endpoints::RequestStream for TrustedFlatlandFactoryRequestStream {
8848    type Protocol = TrustedFlatlandFactoryMarker;
8849    type ControlHandle = TrustedFlatlandFactoryControlHandle;
8850
8851    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
8852        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
8853    }
8854
8855    fn control_handle(&self) -> Self::ControlHandle {
8856        TrustedFlatlandFactoryControlHandle { inner: self.inner.clone() }
8857    }
8858
8859    fn into_inner(
8860        self,
8861    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
8862    {
8863        (self.inner, self.is_terminated)
8864    }
8865
8866    fn from_inner(
8867        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8868        is_terminated: bool,
8869    ) -> Self {
8870        Self { inner, is_terminated }
8871    }
8872}
8873
8874impl futures::Stream for TrustedFlatlandFactoryRequestStream {
8875    type Item = Result<TrustedFlatlandFactoryRequest, fidl::Error>;
8876
8877    fn poll_next(
8878        mut self: std::pin::Pin<&mut Self>,
8879        cx: &mut std::task::Context<'_>,
8880    ) -> std::task::Poll<Option<Self::Item>> {
8881        let this = &mut *self;
8882        if this.inner.check_shutdown(cx) {
8883            this.is_terminated = true;
8884            return std::task::Poll::Ready(None);
8885        }
8886        if this.is_terminated {
8887            panic!("polled TrustedFlatlandFactoryRequestStream after completion");
8888        }
8889        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
8890            |bytes, handles| {
8891                match this.inner.channel().read_etc(cx, bytes, handles) {
8892                    std::task::Poll::Ready(Ok(())) => {}
8893                    std::task::Poll::Pending => return std::task::Poll::Pending,
8894                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
8895                        this.is_terminated = true;
8896                        return std::task::Poll::Ready(None);
8897                    }
8898                    std::task::Poll::Ready(Err(e)) => {
8899                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
8900                            e.into(),
8901                        ))));
8902                    }
8903                }
8904
8905                // A message has been received from the channel
8906                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
8907
8908                std::task::Poll::Ready(Some(match header.ordinal {
8909                0x48e89c53f00561dc => {
8910                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
8911                    let mut req = fidl::new_empty!(TrustedFlatlandFactoryCreateFlatlandRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
8912                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<TrustedFlatlandFactoryCreateFlatlandRequest>(&header, _body_bytes, handles, &mut req)?;
8913                    let control_handle = TrustedFlatlandFactoryControlHandle {
8914                        inner: this.inner.clone(),
8915                    };
8916                    Ok(TrustedFlatlandFactoryRequest::CreateFlatland {server_end: req.server_end,
8917config: req.config,
8918
8919                        responder: TrustedFlatlandFactoryCreateFlatlandResponder {
8920                            control_handle: std::mem::ManuallyDrop::new(control_handle),
8921                            tx_id: header.tx_id,
8922                        },
8923                    })
8924                }
8925                _ => Err(fidl::Error::UnknownOrdinal {
8926                    ordinal: header.ordinal,
8927                    protocol_name: <TrustedFlatlandFactoryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
8928                }),
8929            }))
8930            },
8931        )
8932    }
8933}
8934
8935/// A privileged factory for creating Flatland instances with special configurations.
8936///
8937/// This protocol is intended for trusted clients that require fine-grained control over
8938/// Flatland's behavior for performance-critical applications. It is not intended for
8939/// general use. Misuse of this API can negatively impact system performance and stability.
8940#[derive(Debug)]
8941pub enum TrustedFlatlandFactoryRequest {
8942    /// Creates a new Flatland instance with the specified configuration.
8943    ///
8944    /// ## Error
8945    ///
8946    /// Returns a `TrustedFlatlandFactoryError` error if the operation fails.
8947    CreateFlatland {
8948        server_end: fidl::endpoints::ServerEnd<FlatlandMarker>,
8949        config: TrustedFlatlandConfig,
8950        responder: TrustedFlatlandFactoryCreateFlatlandResponder,
8951    },
8952}
8953
8954impl TrustedFlatlandFactoryRequest {
8955    #[allow(irrefutable_let_patterns)]
8956    pub fn into_create_flatland(
8957        self,
8958    ) -> Option<(
8959        fidl::endpoints::ServerEnd<FlatlandMarker>,
8960        TrustedFlatlandConfig,
8961        TrustedFlatlandFactoryCreateFlatlandResponder,
8962    )> {
8963        if let TrustedFlatlandFactoryRequest::CreateFlatland { server_end, config, responder } =
8964            self
8965        {
8966            Some((server_end, config, responder))
8967        } else {
8968            None
8969        }
8970    }
8971
8972    /// Name of the method defined in FIDL
8973    pub fn method_name(&self) -> &'static str {
8974        match *self {
8975            TrustedFlatlandFactoryRequest::CreateFlatland { .. } => "create_flatland",
8976        }
8977    }
8978}
8979
8980#[derive(Debug, Clone)]
8981pub struct TrustedFlatlandFactoryControlHandle {
8982    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8983}
8984
8985impl fidl::endpoints::ControlHandle for TrustedFlatlandFactoryControlHandle {
8986    fn shutdown(&self) {
8987        self.inner.shutdown()
8988    }
8989
8990    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
8991        self.inner.shutdown_with_epitaph(status)
8992    }
8993
8994    fn is_closed(&self) -> bool {
8995        self.inner.channel().is_closed()
8996    }
8997    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
8998        self.inner.channel().on_closed()
8999    }
9000
9001    #[cfg(target_os = "fuchsia")]
9002    fn signal_peer(
9003        &self,
9004        clear_mask: zx::Signals,
9005        set_mask: zx::Signals,
9006    ) -> Result<(), zx_status::Status> {
9007        use fidl::Peered;
9008        self.inner.channel().signal_peer(clear_mask, set_mask)
9009    }
9010}
9011
9012impl TrustedFlatlandFactoryControlHandle {}
9013
9014#[must_use = "FIDL methods require a response to be sent"]
9015#[derive(Debug)]
9016pub struct TrustedFlatlandFactoryCreateFlatlandResponder {
9017    control_handle: std::mem::ManuallyDrop<TrustedFlatlandFactoryControlHandle>,
9018    tx_id: u32,
9019}
9020
9021/// Set the the channel to be shutdown (see [`TrustedFlatlandFactoryControlHandle::shutdown`])
9022/// if the responder is dropped without sending a response, so that the client
9023/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
9024impl std::ops::Drop for TrustedFlatlandFactoryCreateFlatlandResponder {
9025    fn drop(&mut self) {
9026        self.control_handle.shutdown();
9027        // Safety: drops once, never accessed again
9028        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9029    }
9030}
9031
9032impl fidl::endpoints::Responder for TrustedFlatlandFactoryCreateFlatlandResponder {
9033    type ControlHandle = TrustedFlatlandFactoryControlHandle;
9034
9035    fn control_handle(&self) -> &TrustedFlatlandFactoryControlHandle {
9036        &self.control_handle
9037    }
9038
9039    fn drop_without_shutdown(mut self) {
9040        // Safety: drops once, never accessed again due to mem::forget
9041        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9042        // Prevent Drop from running (which would shut down the channel)
9043        std::mem::forget(self);
9044    }
9045}
9046
9047impl TrustedFlatlandFactoryCreateFlatlandResponder {
9048    /// Sends a response to the FIDL transaction.
9049    ///
9050    /// Sets the channel to shutdown if an error occurs.
9051    pub fn send(
9052        self,
9053        mut result: Result<(), TrustedFlatlandFactoryError>,
9054    ) -> Result<(), fidl::Error> {
9055        let _result = self.send_raw(result);
9056        if _result.is_err() {
9057            self.control_handle.shutdown();
9058        }
9059        self.drop_without_shutdown();
9060        _result
9061    }
9062
9063    /// Similar to "send" but does not shutdown the channel if an error occurs.
9064    pub fn send_no_shutdown_on_err(
9065        self,
9066        mut result: Result<(), TrustedFlatlandFactoryError>,
9067    ) -> Result<(), fidl::Error> {
9068        let _result = self.send_raw(result);
9069        self.drop_without_shutdown();
9070        _result
9071    }
9072
9073    fn send_raw(
9074        &self,
9075        mut result: Result<(), TrustedFlatlandFactoryError>,
9076    ) -> Result<(), fidl::Error> {
9077        self.control_handle.inner.send::<fidl::encoding::ResultType<
9078            fidl::encoding::EmptyStruct,
9079            TrustedFlatlandFactoryError,
9080        >>(
9081            result,
9082            self.tx_id,
9083            0x48e89c53f00561dc,
9084            fidl::encoding::DynamicFlags::empty(),
9085        )
9086    }
9087}
9088
9089mod internal {
9090    use super::*;
9091
9092    impl fidl::encoding::ResourceTypeMarker for AllocatorRegisterBufferCollectionRequest {
9093        type Borrowed<'a> = &'a mut Self;
9094        fn take_or_borrow<'a>(
9095            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9096        ) -> Self::Borrowed<'a> {
9097            value
9098        }
9099    }
9100
9101    unsafe impl fidl::encoding::TypeMarker for AllocatorRegisterBufferCollectionRequest {
9102        type Owned = Self;
9103
9104        #[inline(always)]
9105        fn inline_align(_context: fidl::encoding::Context) -> usize {
9106            8
9107        }
9108
9109        #[inline(always)]
9110        fn inline_size(_context: fidl::encoding::Context) -> usize {
9111            16
9112        }
9113    }
9114
9115    unsafe impl
9116        fidl::encoding::Encode<
9117            AllocatorRegisterBufferCollectionRequest,
9118            fidl::encoding::DefaultFuchsiaResourceDialect,
9119        > for &mut AllocatorRegisterBufferCollectionRequest
9120    {
9121        #[inline]
9122        unsafe fn encode(
9123            self,
9124            encoder: &mut fidl::encoding::Encoder<
9125                '_,
9126                fidl::encoding::DefaultFuchsiaResourceDialect,
9127            >,
9128            offset: usize,
9129            _depth: fidl::encoding::Depth,
9130        ) -> fidl::Result<()> {
9131            encoder.debug_check_bounds::<AllocatorRegisterBufferCollectionRequest>(offset);
9132            // Delegate to tuple encoding.
9133            fidl::encoding::Encode::<AllocatorRegisterBufferCollectionRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
9134                (
9135                    <RegisterBufferCollectionArgs as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.args),
9136                ),
9137                encoder, offset, _depth
9138            )
9139        }
9140    }
9141    unsafe impl<
9142        T0: fidl::encoding::Encode<
9143                RegisterBufferCollectionArgs,
9144                fidl::encoding::DefaultFuchsiaResourceDialect,
9145            >,
9146    >
9147        fidl::encoding::Encode<
9148            AllocatorRegisterBufferCollectionRequest,
9149            fidl::encoding::DefaultFuchsiaResourceDialect,
9150        > for (T0,)
9151    {
9152        #[inline]
9153        unsafe fn encode(
9154            self,
9155            encoder: &mut fidl::encoding::Encoder<
9156                '_,
9157                fidl::encoding::DefaultFuchsiaResourceDialect,
9158            >,
9159            offset: usize,
9160            depth: fidl::encoding::Depth,
9161        ) -> fidl::Result<()> {
9162            encoder.debug_check_bounds::<AllocatorRegisterBufferCollectionRequest>(offset);
9163            // Zero out padding regions. There's no need to apply masks
9164            // because the unmasked parts will be overwritten by fields.
9165            // Write the fields.
9166            self.0.encode(encoder, offset + 0, depth)?;
9167            Ok(())
9168        }
9169    }
9170
9171    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
9172        for AllocatorRegisterBufferCollectionRequest
9173    {
9174        #[inline(always)]
9175        fn new_empty() -> Self {
9176            Self {
9177                args: fidl::new_empty!(
9178                    RegisterBufferCollectionArgs,
9179                    fidl::encoding::DefaultFuchsiaResourceDialect
9180                ),
9181            }
9182        }
9183
9184        #[inline]
9185        unsafe fn decode(
9186            &mut self,
9187            decoder: &mut fidl::encoding::Decoder<
9188                '_,
9189                fidl::encoding::DefaultFuchsiaResourceDialect,
9190            >,
9191            offset: usize,
9192            _depth: fidl::encoding::Depth,
9193        ) -> fidl::Result<()> {
9194            decoder.debug_check_bounds::<Self>(offset);
9195            // Verify that padding bytes are zero.
9196            fidl::decode!(
9197                RegisterBufferCollectionArgs,
9198                fidl::encoding::DefaultFuchsiaResourceDialect,
9199                &mut self.args,
9200                decoder,
9201                offset + 0,
9202                _depth
9203            )?;
9204            Ok(())
9205        }
9206    }
9207
9208    impl fidl::encoding::ResourceTypeMarker for BufferCollectionExportToken {
9209        type Borrowed<'a> = &'a mut Self;
9210        fn take_or_borrow<'a>(
9211            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9212        ) -> Self::Borrowed<'a> {
9213            value
9214        }
9215    }
9216
9217    unsafe impl fidl::encoding::TypeMarker for BufferCollectionExportToken {
9218        type Owned = Self;
9219
9220        #[inline(always)]
9221        fn inline_align(_context: fidl::encoding::Context) -> usize {
9222            4
9223        }
9224
9225        #[inline(always)]
9226        fn inline_size(_context: fidl::encoding::Context) -> usize {
9227            4
9228        }
9229    }
9230
9231    unsafe impl
9232        fidl::encoding::Encode<
9233            BufferCollectionExportToken,
9234            fidl::encoding::DefaultFuchsiaResourceDialect,
9235        > for &mut BufferCollectionExportToken
9236    {
9237        #[inline]
9238        unsafe fn encode(
9239            self,
9240            encoder: &mut fidl::encoding::Encoder<
9241                '_,
9242                fidl::encoding::DefaultFuchsiaResourceDialect,
9243            >,
9244            offset: usize,
9245            _depth: fidl::encoding::Depth,
9246        ) -> fidl::Result<()> {
9247            encoder.debug_check_bounds::<BufferCollectionExportToken>(offset);
9248            // Delegate to tuple encoding.
9249            fidl::encoding::Encode::<
9250                BufferCollectionExportToken,
9251                fidl::encoding::DefaultFuchsiaResourceDialect,
9252            >::encode(
9253                (<fidl::encoding::HandleType<
9254                    fidl::EventPair,
9255                    { fidl::ObjectType::EVENTPAIR.into_raw() },
9256                    2147483648,
9257                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
9258                    &mut self.value
9259                ),),
9260                encoder,
9261                offset,
9262                _depth,
9263            )
9264        }
9265    }
9266    unsafe impl<
9267        T0: fidl::encoding::Encode<
9268                fidl::encoding::HandleType<
9269                    fidl::EventPair,
9270                    { fidl::ObjectType::EVENTPAIR.into_raw() },
9271                    2147483648,
9272                >,
9273                fidl::encoding::DefaultFuchsiaResourceDialect,
9274            >,
9275    >
9276        fidl::encoding::Encode<
9277            BufferCollectionExportToken,
9278            fidl::encoding::DefaultFuchsiaResourceDialect,
9279        > for (T0,)
9280    {
9281        #[inline]
9282        unsafe fn encode(
9283            self,
9284            encoder: &mut fidl::encoding::Encoder<
9285                '_,
9286                fidl::encoding::DefaultFuchsiaResourceDialect,
9287            >,
9288            offset: usize,
9289            depth: fidl::encoding::Depth,
9290        ) -> fidl::Result<()> {
9291            encoder.debug_check_bounds::<BufferCollectionExportToken>(offset);
9292            // Zero out padding regions. There's no need to apply masks
9293            // because the unmasked parts will be overwritten by fields.
9294            // Write the fields.
9295            self.0.encode(encoder, offset + 0, depth)?;
9296            Ok(())
9297        }
9298    }
9299
9300    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
9301        for BufferCollectionExportToken
9302    {
9303        #[inline(always)]
9304        fn new_empty() -> Self {
9305            Self {
9306                value: fidl::new_empty!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
9307            }
9308        }
9309
9310        #[inline]
9311        unsafe fn decode(
9312            &mut self,
9313            decoder: &mut fidl::encoding::Decoder<
9314                '_,
9315                fidl::encoding::DefaultFuchsiaResourceDialect,
9316            >,
9317            offset: usize,
9318            _depth: fidl::encoding::Depth,
9319        ) -> fidl::Result<()> {
9320            decoder.debug_check_bounds::<Self>(offset);
9321            // Verify that padding bytes are zero.
9322            fidl::decode!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.value, decoder, offset + 0, _depth)?;
9323            Ok(())
9324        }
9325    }
9326
9327    impl fidl::encoding::ResourceTypeMarker for BufferCollectionImportToken {
9328        type Borrowed<'a> = &'a mut Self;
9329        fn take_or_borrow<'a>(
9330            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9331        ) -> Self::Borrowed<'a> {
9332            value
9333        }
9334    }
9335
9336    unsafe impl fidl::encoding::TypeMarker for BufferCollectionImportToken {
9337        type Owned = Self;
9338
9339        #[inline(always)]
9340        fn inline_align(_context: fidl::encoding::Context) -> usize {
9341            4
9342        }
9343
9344        #[inline(always)]
9345        fn inline_size(_context: fidl::encoding::Context) -> usize {
9346            4
9347        }
9348    }
9349
9350    unsafe impl
9351        fidl::encoding::Encode<
9352            BufferCollectionImportToken,
9353            fidl::encoding::DefaultFuchsiaResourceDialect,
9354        > for &mut BufferCollectionImportToken
9355    {
9356        #[inline]
9357        unsafe fn encode(
9358            self,
9359            encoder: &mut fidl::encoding::Encoder<
9360                '_,
9361                fidl::encoding::DefaultFuchsiaResourceDialect,
9362            >,
9363            offset: usize,
9364            _depth: fidl::encoding::Depth,
9365        ) -> fidl::Result<()> {
9366            encoder.debug_check_bounds::<BufferCollectionImportToken>(offset);
9367            // Delegate to tuple encoding.
9368            fidl::encoding::Encode::<
9369                BufferCollectionImportToken,
9370                fidl::encoding::DefaultFuchsiaResourceDialect,
9371            >::encode(
9372                (<fidl::encoding::HandleType<
9373                    fidl::EventPair,
9374                    { fidl::ObjectType::EVENTPAIR.into_raw() },
9375                    2147483648,
9376                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
9377                    &mut self.value
9378                ),),
9379                encoder,
9380                offset,
9381                _depth,
9382            )
9383        }
9384    }
9385    unsafe impl<
9386        T0: fidl::encoding::Encode<
9387                fidl::encoding::HandleType<
9388                    fidl::EventPair,
9389                    { fidl::ObjectType::EVENTPAIR.into_raw() },
9390                    2147483648,
9391                >,
9392                fidl::encoding::DefaultFuchsiaResourceDialect,
9393            >,
9394    >
9395        fidl::encoding::Encode<
9396            BufferCollectionImportToken,
9397            fidl::encoding::DefaultFuchsiaResourceDialect,
9398        > for (T0,)
9399    {
9400        #[inline]
9401        unsafe fn encode(
9402            self,
9403            encoder: &mut fidl::encoding::Encoder<
9404                '_,
9405                fidl::encoding::DefaultFuchsiaResourceDialect,
9406            >,
9407            offset: usize,
9408            depth: fidl::encoding::Depth,
9409        ) -> fidl::Result<()> {
9410            encoder.debug_check_bounds::<BufferCollectionImportToken>(offset);
9411            // Zero out padding regions. There's no need to apply masks
9412            // because the unmasked parts will be overwritten by fields.
9413            // Write the fields.
9414            self.0.encode(encoder, offset + 0, depth)?;
9415            Ok(())
9416        }
9417    }
9418
9419    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
9420        for BufferCollectionImportToken
9421    {
9422        #[inline(always)]
9423        fn new_empty() -> Self {
9424            Self {
9425                value: fidl::new_empty!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
9426            }
9427        }
9428
9429        #[inline]
9430        unsafe fn decode(
9431            &mut self,
9432            decoder: &mut fidl::encoding::Decoder<
9433                '_,
9434                fidl::encoding::DefaultFuchsiaResourceDialect,
9435            >,
9436            offset: usize,
9437            _depth: fidl::encoding::Depth,
9438        ) -> fidl::Result<()> {
9439            decoder.debug_check_bounds::<Self>(offset);
9440            // Verify that padding bytes are zero.
9441            fidl::decode!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.value, decoder, offset + 0, _depth)?;
9442            Ok(())
9443        }
9444    }
9445
9446    impl fidl::encoding::ResourceTypeMarker for ChildViewWatcherGetViewRefResponse {
9447        type Borrowed<'a> = &'a mut Self;
9448        fn take_or_borrow<'a>(
9449            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9450        ) -> Self::Borrowed<'a> {
9451            value
9452        }
9453    }
9454
9455    unsafe impl fidl::encoding::TypeMarker for ChildViewWatcherGetViewRefResponse {
9456        type Owned = Self;
9457
9458        #[inline(always)]
9459        fn inline_align(_context: fidl::encoding::Context) -> usize {
9460            4
9461        }
9462
9463        #[inline(always)]
9464        fn inline_size(_context: fidl::encoding::Context) -> usize {
9465            4
9466        }
9467    }
9468
9469    unsafe impl
9470        fidl::encoding::Encode<
9471            ChildViewWatcherGetViewRefResponse,
9472            fidl::encoding::DefaultFuchsiaResourceDialect,
9473        > for &mut ChildViewWatcherGetViewRefResponse
9474    {
9475        #[inline]
9476        unsafe fn encode(
9477            self,
9478            encoder: &mut fidl::encoding::Encoder<
9479                '_,
9480                fidl::encoding::DefaultFuchsiaResourceDialect,
9481            >,
9482            offset: usize,
9483            _depth: fidl::encoding::Depth,
9484        ) -> fidl::Result<()> {
9485            encoder.debug_check_bounds::<ChildViewWatcherGetViewRefResponse>(offset);
9486            // Delegate to tuple encoding.
9487            fidl::encoding::Encode::<ChildViewWatcherGetViewRefResponse, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
9488                (
9489                    <fidl_fuchsia_ui_views::ViewRef as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.view_ref),
9490                ),
9491                encoder, offset, _depth
9492            )
9493        }
9494    }
9495    unsafe impl<
9496        T0: fidl::encoding::Encode<
9497                fidl_fuchsia_ui_views::ViewRef,
9498                fidl::encoding::DefaultFuchsiaResourceDialect,
9499            >,
9500    >
9501        fidl::encoding::Encode<
9502            ChildViewWatcherGetViewRefResponse,
9503            fidl::encoding::DefaultFuchsiaResourceDialect,
9504        > for (T0,)
9505    {
9506        #[inline]
9507        unsafe fn encode(
9508            self,
9509            encoder: &mut fidl::encoding::Encoder<
9510                '_,
9511                fidl::encoding::DefaultFuchsiaResourceDialect,
9512            >,
9513            offset: usize,
9514            depth: fidl::encoding::Depth,
9515        ) -> fidl::Result<()> {
9516            encoder.debug_check_bounds::<ChildViewWatcherGetViewRefResponse>(offset);
9517            // Zero out padding regions. There's no need to apply masks
9518            // because the unmasked parts will be overwritten by fields.
9519            // Write the fields.
9520            self.0.encode(encoder, offset + 0, depth)?;
9521            Ok(())
9522        }
9523    }
9524
9525    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
9526        for ChildViewWatcherGetViewRefResponse
9527    {
9528        #[inline(always)]
9529        fn new_empty() -> Self {
9530            Self {
9531                view_ref: fidl::new_empty!(
9532                    fidl_fuchsia_ui_views::ViewRef,
9533                    fidl::encoding::DefaultFuchsiaResourceDialect
9534                ),
9535            }
9536        }
9537
9538        #[inline]
9539        unsafe fn decode(
9540            &mut self,
9541            decoder: &mut fidl::encoding::Decoder<
9542                '_,
9543                fidl::encoding::DefaultFuchsiaResourceDialect,
9544            >,
9545            offset: usize,
9546            _depth: fidl::encoding::Depth,
9547        ) -> fidl::Result<()> {
9548            decoder.debug_check_bounds::<Self>(offset);
9549            // Verify that padding bytes are zero.
9550            fidl::decode!(
9551                fidl_fuchsia_ui_views::ViewRef,
9552                fidl::encoding::DefaultFuchsiaResourceDialect,
9553                &mut self.view_ref,
9554                decoder,
9555                offset + 0,
9556                _depth
9557            )?;
9558            Ok(())
9559        }
9560    }
9561
9562    impl fidl::encoding::ResourceTypeMarker for FlatlandCreateFilledRectRequest {
9563        type Borrowed<'a> = &'a mut Self;
9564        fn take_or_borrow<'a>(
9565            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9566        ) -> Self::Borrowed<'a> {
9567            value
9568        }
9569    }
9570
9571    unsafe impl fidl::encoding::TypeMarker for FlatlandCreateFilledRectRequest {
9572        type Owned = Self;
9573
9574        #[inline(always)]
9575        fn inline_align(_context: fidl::encoding::Context) -> usize {
9576            8
9577        }
9578
9579        #[inline(always)]
9580        fn inline_size(_context: fidl::encoding::Context) -> usize {
9581            8
9582        }
9583        #[inline(always)]
9584        fn encode_is_copy() -> bool {
9585            true
9586        }
9587
9588        #[inline(always)]
9589        fn decode_is_copy() -> bool {
9590            true
9591        }
9592    }
9593
9594    unsafe impl
9595        fidl::encoding::Encode<
9596            FlatlandCreateFilledRectRequest,
9597            fidl::encoding::DefaultFuchsiaResourceDialect,
9598        > for &mut FlatlandCreateFilledRectRequest
9599    {
9600        #[inline]
9601        unsafe fn encode(
9602            self,
9603            encoder: &mut fidl::encoding::Encoder<
9604                '_,
9605                fidl::encoding::DefaultFuchsiaResourceDialect,
9606            >,
9607            offset: usize,
9608            _depth: fidl::encoding::Depth,
9609        ) -> fidl::Result<()> {
9610            encoder.debug_check_bounds::<FlatlandCreateFilledRectRequest>(offset);
9611            unsafe {
9612                // Copy the object into the buffer.
9613                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
9614                (buf_ptr as *mut FlatlandCreateFilledRectRequest)
9615                    .write_unaligned((self as *const FlatlandCreateFilledRectRequest).read());
9616                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
9617                // done second because the memcpy will write garbage to these bytes.
9618            }
9619            Ok(())
9620        }
9621    }
9622    unsafe impl<
9623        T0: fidl::encoding::Encode<ContentId, fidl::encoding::DefaultFuchsiaResourceDialect>,
9624    >
9625        fidl::encoding::Encode<
9626            FlatlandCreateFilledRectRequest,
9627            fidl::encoding::DefaultFuchsiaResourceDialect,
9628        > for (T0,)
9629    {
9630        #[inline]
9631        unsafe fn encode(
9632            self,
9633            encoder: &mut fidl::encoding::Encoder<
9634                '_,
9635                fidl::encoding::DefaultFuchsiaResourceDialect,
9636            >,
9637            offset: usize,
9638            depth: fidl::encoding::Depth,
9639        ) -> fidl::Result<()> {
9640            encoder.debug_check_bounds::<FlatlandCreateFilledRectRequest>(offset);
9641            // Zero out padding regions. There's no need to apply masks
9642            // because the unmasked parts will be overwritten by fields.
9643            // Write the fields.
9644            self.0.encode(encoder, offset + 0, depth)?;
9645            Ok(())
9646        }
9647    }
9648
9649    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
9650        for FlatlandCreateFilledRectRequest
9651    {
9652        #[inline(always)]
9653        fn new_empty() -> Self {
9654            Self {
9655                rect_id: fidl::new_empty!(ContentId, fidl::encoding::DefaultFuchsiaResourceDialect),
9656            }
9657        }
9658
9659        #[inline]
9660        unsafe fn decode(
9661            &mut self,
9662            decoder: &mut fidl::encoding::Decoder<
9663                '_,
9664                fidl::encoding::DefaultFuchsiaResourceDialect,
9665            >,
9666            offset: usize,
9667            _depth: fidl::encoding::Depth,
9668        ) -> fidl::Result<()> {
9669            decoder.debug_check_bounds::<Self>(offset);
9670            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
9671            // Verify that padding bytes are zero.
9672            // Copy from the buffer into the object.
9673            unsafe {
9674                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
9675            }
9676            Ok(())
9677        }
9678    }
9679
9680    impl fidl::encoding::ResourceTypeMarker for FlatlandCreateImageRequest {
9681        type Borrowed<'a> = &'a mut Self;
9682        fn take_or_borrow<'a>(
9683            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9684        ) -> Self::Borrowed<'a> {
9685            value
9686        }
9687    }
9688
9689    unsafe impl fidl::encoding::TypeMarker for FlatlandCreateImageRequest {
9690        type Owned = Self;
9691
9692        #[inline(always)]
9693        fn inline_align(_context: fidl::encoding::Context) -> usize {
9694            8
9695        }
9696
9697        #[inline(always)]
9698        fn inline_size(_context: fidl::encoding::Context) -> usize {
9699            32
9700        }
9701    }
9702
9703    unsafe impl
9704        fidl::encoding::Encode<
9705            FlatlandCreateImageRequest,
9706            fidl::encoding::DefaultFuchsiaResourceDialect,
9707        > for &mut FlatlandCreateImageRequest
9708    {
9709        #[inline]
9710        unsafe fn encode(
9711            self,
9712            encoder: &mut fidl::encoding::Encoder<
9713                '_,
9714                fidl::encoding::DefaultFuchsiaResourceDialect,
9715            >,
9716            offset: usize,
9717            _depth: fidl::encoding::Depth,
9718        ) -> fidl::Result<()> {
9719            encoder.debug_check_bounds::<FlatlandCreateImageRequest>(offset);
9720            // Delegate to tuple encoding.
9721            fidl::encoding::Encode::<FlatlandCreateImageRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
9722                (
9723                    <ContentId as fidl::encoding::ValueTypeMarker>::borrow(&self.image_id),
9724                    <BufferCollectionImportToken as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.import_token),
9725                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.vmo_index),
9726                    <ImageProperties as fidl::encoding::ValueTypeMarker>::borrow(&self.properties),
9727                ),
9728                encoder, offset, _depth
9729            )
9730        }
9731    }
9732    unsafe impl<
9733        T0: fidl::encoding::Encode<ContentId, fidl::encoding::DefaultFuchsiaResourceDialect>,
9734        T1: fidl::encoding::Encode<
9735                BufferCollectionImportToken,
9736                fidl::encoding::DefaultFuchsiaResourceDialect,
9737            >,
9738        T2: fidl::encoding::Encode<u32, fidl::encoding::DefaultFuchsiaResourceDialect>,
9739        T3: fidl::encoding::Encode<ImageProperties, fidl::encoding::DefaultFuchsiaResourceDialect>,
9740    >
9741        fidl::encoding::Encode<
9742            FlatlandCreateImageRequest,
9743            fidl::encoding::DefaultFuchsiaResourceDialect,
9744        > for (T0, T1, T2, T3)
9745    {
9746        #[inline]
9747        unsafe fn encode(
9748            self,
9749            encoder: &mut fidl::encoding::Encoder<
9750                '_,
9751                fidl::encoding::DefaultFuchsiaResourceDialect,
9752            >,
9753            offset: usize,
9754            depth: fidl::encoding::Depth,
9755        ) -> fidl::Result<()> {
9756            encoder.debug_check_bounds::<FlatlandCreateImageRequest>(offset);
9757            // Zero out padding regions. There's no need to apply masks
9758            // because the unmasked parts will be overwritten by fields.
9759            // Write the fields.
9760            self.0.encode(encoder, offset + 0, depth)?;
9761            self.1.encode(encoder, offset + 8, depth)?;
9762            self.2.encode(encoder, offset + 12, depth)?;
9763            self.3.encode(encoder, offset + 16, depth)?;
9764            Ok(())
9765        }
9766    }
9767
9768    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
9769        for FlatlandCreateImageRequest
9770    {
9771        #[inline(always)]
9772        fn new_empty() -> Self {
9773            Self {
9774                image_id: fidl::new_empty!(
9775                    ContentId,
9776                    fidl::encoding::DefaultFuchsiaResourceDialect
9777                ),
9778                import_token: fidl::new_empty!(
9779                    BufferCollectionImportToken,
9780                    fidl::encoding::DefaultFuchsiaResourceDialect
9781                ),
9782                vmo_index: fidl::new_empty!(u32, fidl::encoding::DefaultFuchsiaResourceDialect),
9783                properties: fidl::new_empty!(
9784                    ImageProperties,
9785                    fidl::encoding::DefaultFuchsiaResourceDialect
9786                ),
9787            }
9788        }
9789
9790        #[inline]
9791        unsafe fn decode(
9792            &mut self,
9793            decoder: &mut fidl::encoding::Decoder<
9794                '_,
9795                fidl::encoding::DefaultFuchsiaResourceDialect,
9796            >,
9797            offset: usize,
9798            _depth: fidl::encoding::Depth,
9799        ) -> fidl::Result<()> {
9800            decoder.debug_check_bounds::<Self>(offset);
9801            // Verify that padding bytes are zero.
9802            fidl::decode!(
9803                ContentId,
9804                fidl::encoding::DefaultFuchsiaResourceDialect,
9805                &mut self.image_id,
9806                decoder,
9807                offset + 0,
9808                _depth
9809            )?;
9810            fidl::decode!(
9811                BufferCollectionImportToken,
9812                fidl::encoding::DefaultFuchsiaResourceDialect,
9813                &mut self.import_token,
9814                decoder,
9815                offset + 8,
9816                _depth
9817            )?;
9818            fidl::decode!(
9819                u32,
9820                fidl::encoding::DefaultFuchsiaResourceDialect,
9821                &mut self.vmo_index,
9822                decoder,
9823                offset + 12,
9824                _depth
9825            )?;
9826            fidl::decode!(
9827                ImageProperties,
9828                fidl::encoding::DefaultFuchsiaResourceDialect,
9829                &mut self.properties,
9830                decoder,
9831                offset + 16,
9832                _depth
9833            )?;
9834            Ok(())
9835        }
9836    }
9837
9838    impl fidl::encoding::ResourceTypeMarker for FlatlandCreateView2Request {
9839        type Borrowed<'a> = &'a mut Self;
9840        fn take_or_borrow<'a>(
9841            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9842        ) -> Self::Borrowed<'a> {
9843            value
9844        }
9845    }
9846
9847    unsafe impl fidl::encoding::TypeMarker for FlatlandCreateView2Request {
9848        type Owned = Self;
9849
9850        #[inline(always)]
9851        fn inline_align(_context: fidl::encoding::Context) -> usize {
9852            8
9853        }
9854
9855        #[inline(always)]
9856        fn inline_size(_context: fidl::encoding::Context) -> usize {
9857            40
9858        }
9859    }
9860
9861    unsafe impl
9862        fidl::encoding::Encode<
9863            FlatlandCreateView2Request,
9864            fidl::encoding::DefaultFuchsiaResourceDialect,
9865        > for &mut FlatlandCreateView2Request
9866    {
9867        #[inline]
9868        unsafe fn encode(
9869            self,
9870            encoder: &mut fidl::encoding::Encoder<
9871                '_,
9872                fidl::encoding::DefaultFuchsiaResourceDialect,
9873            >,
9874            offset: usize,
9875            _depth: fidl::encoding::Depth,
9876        ) -> fidl::Result<()> {
9877            encoder.debug_check_bounds::<FlatlandCreateView2Request>(offset);
9878            // Delegate to tuple encoding.
9879            fidl::encoding::Encode::<FlatlandCreateView2Request, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
9880                (
9881                    <fidl_fuchsia_ui_views::ViewCreationToken as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.token),
9882                    <fidl_fuchsia_ui_views::ViewIdentityOnCreation as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.view_identity),
9883                    <ViewBoundProtocols as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.protocols),
9884                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.parent_viewport_watcher),
9885                ),
9886                encoder, offset, _depth
9887            )
9888        }
9889    }
9890    unsafe impl<
9891        T0: fidl::encoding::Encode<
9892                fidl_fuchsia_ui_views::ViewCreationToken,
9893                fidl::encoding::DefaultFuchsiaResourceDialect,
9894            >,
9895        T1: fidl::encoding::Encode<
9896                fidl_fuchsia_ui_views::ViewIdentityOnCreation,
9897                fidl::encoding::DefaultFuchsiaResourceDialect,
9898            >,
9899        T2: fidl::encoding::Encode<ViewBoundProtocols, fidl::encoding::DefaultFuchsiaResourceDialect>,
9900        T3: fidl::encoding::Encode<
9901                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>>,
9902                fidl::encoding::DefaultFuchsiaResourceDialect,
9903            >,
9904    >
9905        fidl::encoding::Encode<
9906            FlatlandCreateView2Request,
9907            fidl::encoding::DefaultFuchsiaResourceDialect,
9908        > for (T0, T1, T2, T3)
9909    {
9910        #[inline]
9911        unsafe fn encode(
9912            self,
9913            encoder: &mut fidl::encoding::Encoder<
9914                '_,
9915                fidl::encoding::DefaultFuchsiaResourceDialect,
9916            >,
9917            offset: usize,
9918            depth: fidl::encoding::Depth,
9919        ) -> fidl::Result<()> {
9920            encoder.debug_check_bounds::<FlatlandCreateView2Request>(offset);
9921            // Zero out padding regions. There's no need to apply masks
9922            // because the unmasked parts will be overwritten by fields.
9923            unsafe {
9924                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
9925                (ptr as *mut u64).write_unaligned(0);
9926            }
9927            unsafe {
9928                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(32);
9929                (ptr as *mut u64).write_unaligned(0);
9930            }
9931            // Write the fields.
9932            self.0.encode(encoder, offset + 0, depth)?;
9933            self.1.encode(encoder, offset + 4, depth)?;
9934            self.2.encode(encoder, offset + 16, depth)?;
9935            self.3.encode(encoder, offset + 32, depth)?;
9936            Ok(())
9937        }
9938    }
9939
9940    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
9941        for FlatlandCreateView2Request
9942    {
9943        #[inline(always)]
9944        fn new_empty() -> Self {
9945            Self {
9946                token: fidl::new_empty!(
9947                    fidl_fuchsia_ui_views::ViewCreationToken,
9948                    fidl::encoding::DefaultFuchsiaResourceDialect
9949                ),
9950                view_identity: fidl::new_empty!(
9951                    fidl_fuchsia_ui_views::ViewIdentityOnCreation,
9952                    fidl::encoding::DefaultFuchsiaResourceDialect
9953                ),
9954                protocols: fidl::new_empty!(
9955                    ViewBoundProtocols,
9956                    fidl::encoding::DefaultFuchsiaResourceDialect
9957                ),
9958                parent_viewport_watcher: fidl::new_empty!(
9959                    fidl::encoding::Endpoint<
9960                        fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>,
9961                    >,
9962                    fidl::encoding::DefaultFuchsiaResourceDialect
9963                ),
9964            }
9965        }
9966
9967        #[inline]
9968        unsafe fn decode(
9969            &mut self,
9970            decoder: &mut fidl::encoding::Decoder<
9971                '_,
9972                fidl::encoding::DefaultFuchsiaResourceDialect,
9973            >,
9974            offset: usize,
9975            _depth: fidl::encoding::Depth,
9976        ) -> fidl::Result<()> {
9977            decoder.debug_check_bounds::<Self>(offset);
9978            // Verify that padding bytes are zero.
9979            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(8) };
9980            let padval = unsafe { (ptr as *const u64).read_unaligned() };
9981            let mask = 0xffffffff00000000u64;
9982            let maskedval = padval & mask;
9983            if maskedval != 0 {
9984                return Err(fidl::Error::NonZeroPadding {
9985                    padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
9986                });
9987            }
9988            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(32) };
9989            let padval = unsafe { (ptr as *const u64).read_unaligned() };
9990            let mask = 0xffffffff00000000u64;
9991            let maskedval = padval & mask;
9992            if maskedval != 0 {
9993                return Err(fidl::Error::NonZeroPadding {
9994                    padding_start: offset + 32 + ((mask as u64).trailing_zeros() / 8) as usize,
9995                });
9996            }
9997            fidl::decode!(
9998                fidl_fuchsia_ui_views::ViewCreationToken,
9999                fidl::encoding::DefaultFuchsiaResourceDialect,
10000                &mut self.token,
10001                decoder,
10002                offset + 0,
10003                _depth
10004            )?;
10005            fidl::decode!(
10006                fidl_fuchsia_ui_views::ViewIdentityOnCreation,
10007                fidl::encoding::DefaultFuchsiaResourceDialect,
10008                &mut self.view_identity,
10009                decoder,
10010                offset + 4,
10011                _depth
10012            )?;
10013            fidl::decode!(
10014                ViewBoundProtocols,
10015                fidl::encoding::DefaultFuchsiaResourceDialect,
10016                &mut self.protocols,
10017                decoder,
10018                offset + 16,
10019                _depth
10020            )?;
10021            fidl::decode!(
10022                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>>,
10023                fidl::encoding::DefaultFuchsiaResourceDialect,
10024                &mut self.parent_viewport_watcher,
10025                decoder,
10026                offset + 32,
10027                _depth
10028            )?;
10029            Ok(())
10030        }
10031    }
10032
10033    impl fidl::encoding::ResourceTypeMarker for FlatlandCreateViewRequest {
10034        type Borrowed<'a> = &'a mut Self;
10035        fn take_or_borrow<'a>(
10036            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10037        ) -> Self::Borrowed<'a> {
10038            value
10039        }
10040    }
10041
10042    unsafe impl fidl::encoding::TypeMarker for FlatlandCreateViewRequest {
10043        type Owned = Self;
10044
10045        #[inline(always)]
10046        fn inline_align(_context: fidl::encoding::Context) -> usize {
10047            4
10048        }
10049
10050        #[inline(always)]
10051        fn inline_size(_context: fidl::encoding::Context) -> usize {
10052            8
10053        }
10054    }
10055
10056    unsafe impl
10057        fidl::encoding::Encode<
10058            FlatlandCreateViewRequest,
10059            fidl::encoding::DefaultFuchsiaResourceDialect,
10060        > for &mut FlatlandCreateViewRequest
10061    {
10062        #[inline]
10063        unsafe fn encode(
10064            self,
10065            encoder: &mut fidl::encoding::Encoder<
10066                '_,
10067                fidl::encoding::DefaultFuchsiaResourceDialect,
10068            >,
10069            offset: usize,
10070            _depth: fidl::encoding::Depth,
10071        ) -> fidl::Result<()> {
10072            encoder.debug_check_bounds::<FlatlandCreateViewRequest>(offset);
10073            // Delegate to tuple encoding.
10074            fidl::encoding::Encode::<FlatlandCreateViewRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
10075                (
10076                    <fidl_fuchsia_ui_views::ViewCreationToken as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.token),
10077                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.parent_viewport_watcher),
10078                ),
10079                encoder, offset, _depth
10080            )
10081        }
10082    }
10083    unsafe impl<
10084        T0: fidl::encoding::Encode<
10085                fidl_fuchsia_ui_views::ViewCreationToken,
10086                fidl::encoding::DefaultFuchsiaResourceDialect,
10087            >,
10088        T1: fidl::encoding::Encode<
10089                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>>,
10090                fidl::encoding::DefaultFuchsiaResourceDialect,
10091            >,
10092    >
10093        fidl::encoding::Encode<
10094            FlatlandCreateViewRequest,
10095            fidl::encoding::DefaultFuchsiaResourceDialect,
10096        > for (T0, T1)
10097    {
10098        #[inline]
10099        unsafe fn encode(
10100            self,
10101            encoder: &mut fidl::encoding::Encoder<
10102                '_,
10103                fidl::encoding::DefaultFuchsiaResourceDialect,
10104            >,
10105            offset: usize,
10106            depth: fidl::encoding::Depth,
10107        ) -> fidl::Result<()> {
10108            encoder.debug_check_bounds::<FlatlandCreateViewRequest>(offset);
10109            // Zero out padding regions. There's no need to apply masks
10110            // because the unmasked parts will be overwritten by fields.
10111            // Write the fields.
10112            self.0.encode(encoder, offset + 0, depth)?;
10113            self.1.encode(encoder, offset + 4, depth)?;
10114            Ok(())
10115        }
10116    }
10117
10118    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10119        for FlatlandCreateViewRequest
10120    {
10121        #[inline(always)]
10122        fn new_empty() -> Self {
10123            Self {
10124                token: fidl::new_empty!(
10125                    fidl_fuchsia_ui_views::ViewCreationToken,
10126                    fidl::encoding::DefaultFuchsiaResourceDialect
10127                ),
10128                parent_viewport_watcher: fidl::new_empty!(
10129                    fidl::encoding::Endpoint<
10130                        fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>,
10131                    >,
10132                    fidl::encoding::DefaultFuchsiaResourceDialect
10133                ),
10134            }
10135        }
10136
10137        #[inline]
10138        unsafe fn decode(
10139            &mut self,
10140            decoder: &mut fidl::encoding::Decoder<
10141                '_,
10142                fidl::encoding::DefaultFuchsiaResourceDialect,
10143            >,
10144            offset: usize,
10145            _depth: fidl::encoding::Depth,
10146        ) -> fidl::Result<()> {
10147            decoder.debug_check_bounds::<Self>(offset);
10148            // Verify that padding bytes are zero.
10149            fidl::decode!(
10150                fidl_fuchsia_ui_views::ViewCreationToken,
10151                fidl::encoding::DefaultFuchsiaResourceDialect,
10152                &mut self.token,
10153                decoder,
10154                offset + 0,
10155                _depth
10156            )?;
10157            fidl::decode!(
10158                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>>,
10159                fidl::encoding::DefaultFuchsiaResourceDialect,
10160                &mut self.parent_viewport_watcher,
10161                decoder,
10162                offset + 4,
10163                _depth
10164            )?;
10165            Ok(())
10166        }
10167    }
10168
10169    impl fidl::encoding::ResourceTypeMarker for FlatlandCreateViewportRequest {
10170        type Borrowed<'a> = &'a mut Self;
10171        fn take_or_borrow<'a>(
10172            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10173        ) -> Self::Borrowed<'a> {
10174            value
10175        }
10176    }
10177
10178    unsafe impl fidl::encoding::TypeMarker for FlatlandCreateViewportRequest {
10179        type Owned = Self;
10180
10181        #[inline(always)]
10182        fn inline_align(_context: fidl::encoding::Context) -> usize {
10183            8
10184        }
10185
10186        #[inline(always)]
10187        fn inline_size(_context: fidl::encoding::Context) -> usize {
10188            40
10189        }
10190    }
10191
10192    unsafe impl
10193        fidl::encoding::Encode<
10194            FlatlandCreateViewportRequest,
10195            fidl::encoding::DefaultFuchsiaResourceDialect,
10196        > for &mut FlatlandCreateViewportRequest
10197    {
10198        #[inline]
10199        unsafe fn encode(
10200            self,
10201            encoder: &mut fidl::encoding::Encoder<
10202                '_,
10203                fidl::encoding::DefaultFuchsiaResourceDialect,
10204            >,
10205            offset: usize,
10206            _depth: fidl::encoding::Depth,
10207        ) -> fidl::Result<()> {
10208            encoder.debug_check_bounds::<FlatlandCreateViewportRequest>(offset);
10209            // Delegate to tuple encoding.
10210            fidl::encoding::Encode::<FlatlandCreateViewportRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
10211                (
10212                    <ContentId as fidl::encoding::ValueTypeMarker>::borrow(&self.viewport_id),
10213                    <fidl_fuchsia_ui_views::ViewportCreationToken as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.token),
10214                    <ViewportProperties as fidl::encoding::ValueTypeMarker>::borrow(&self.properties),
10215                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ChildViewWatcherMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.child_view_watcher),
10216                ),
10217                encoder, offset, _depth
10218            )
10219        }
10220    }
10221    unsafe impl<
10222        T0: fidl::encoding::Encode<ContentId, fidl::encoding::DefaultFuchsiaResourceDialect>,
10223        T1: fidl::encoding::Encode<
10224                fidl_fuchsia_ui_views::ViewportCreationToken,
10225                fidl::encoding::DefaultFuchsiaResourceDialect,
10226            >,
10227        T2: fidl::encoding::Encode<ViewportProperties, fidl::encoding::DefaultFuchsiaResourceDialect>,
10228        T3: fidl::encoding::Encode<
10229                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ChildViewWatcherMarker>>,
10230                fidl::encoding::DefaultFuchsiaResourceDialect,
10231            >,
10232    >
10233        fidl::encoding::Encode<
10234            FlatlandCreateViewportRequest,
10235            fidl::encoding::DefaultFuchsiaResourceDialect,
10236        > for (T0, T1, T2, T3)
10237    {
10238        #[inline]
10239        unsafe fn encode(
10240            self,
10241            encoder: &mut fidl::encoding::Encoder<
10242                '_,
10243                fidl::encoding::DefaultFuchsiaResourceDialect,
10244            >,
10245            offset: usize,
10246            depth: fidl::encoding::Depth,
10247        ) -> fidl::Result<()> {
10248            encoder.debug_check_bounds::<FlatlandCreateViewportRequest>(offset);
10249            // Zero out padding regions. There's no need to apply masks
10250            // because the unmasked parts will be overwritten by fields.
10251            unsafe {
10252                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
10253                (ptr as *mut u64).write_unaligned(0);
10254            }
10255            unsafe {
10256                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(32);
10257                (ptr as *mut u64).write_unaligned(0);
10258            }
10259            // Write the fields.
10260            self.0.encode(encoder, offset + 0, depth)?;
10261            self.1.encode(encoder, offset + 8, depth)?;
10262            self.2.encode(encoder, offset + 16, depth)?;
10263            self.3.encode(encoder, offset + 32, depth)?;
10264            Ok(())
10265        }
10266    }
10267
10268    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10269        for FlatlandCreateViewportRequest
10270    {
10271        #[inline(always)]
10272        fn new_empty() -> Self {
10273            Self {
10274                viewport_id: fidl::new_empty!(
10275                    ContentId,
10276                    fidl::encoding::DefaultFuchsiaResourceDialect
10277                ),
10278                token: fidl::new_empty!(
10279                    fidl_fuchsia_ui_views::ViewportCreationToken,
10280                    fidl::encoding::DefaultFuchsiaResourceDialect
10281                ),
10282                properties: fidl::new_empty!(
10283                    ViewportProperties,
10284                    fidl::encoding::DefaultFuchsiaResourceDialect
10285                ),
10286                child_view_watcher: fidl::new_empty!(
10287                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ChildViewWatcherMarker>>,
10288                    fidl::encoding::DefaultFuchsiaResourceDialect
10289                ),
10290            }
10291        }
10292
10293        #[inline]
10294        unsafe fn decode(
10295            &mut self,
10296            decoder: &mut fidl::encoding::Decoder<
10297                '_,
10298                fidl::encoding::DefaultFuchsiaResourceDialect,
10299            >,
10300            offset: usize,
10301            _depth: fidl::encoding::Depth,
10302        ) -> fidl::Result<()> {
10303            decoder.debug_check_bounds::<Self>(offset);
10304            // Verify that padding bytes are zero.
10305            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(8) };
10306            let padval = unsafe { (ptr as *const u64).read_unaligned() };
10307            let mask = 0xffffffff00000000u64;
10308            let maskedval = padval & mask;
10309            if maskedval != 0 {
10310                return Err(fidl::Error::NonZeroPadding {
10311                    padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
10312                });
10313            }
10314            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(32) };
10315            let padval = unsafe { (ptr as *const u64).read_unaligned() };
10316            let mask = 0xffffffff00000000u64;
10317            let maskedval = padval & mask;
10318            if maskedval != 0 {
10319                return Err(fidl::Error::NonZeroPadding {
10320                    padding_start: offset + 32 + ((mask as u64).trailing_zeros() / 8) as usize,
10321                });
10322            }
10323            fidl::decode!(
10324                ContentId,
10325                fidl::encoding::DefaultFuchsiaResourceDialect,
10326                &mut self.viewport_id,
10327                decoder,
10328                offset + 0,
10329                _depth
10330            )?;
10331            fidl::decode!(
10332                fidl_fuchsia_ui_views::ViewportCreationToken,
10333                fidl::encoding::DefaultFuchsiaResourceDialect,
10334                &mut self.token,
10335                decoder,
10336                offset + 8,
10337                _depth
10338            )?;
10339            fidl::decode!(
10340                ViewportProperties,
10341                fidl::encoding::DefaultFuchsiaResourceDialect,
10342                &mut self.properties,
10343                decoder,
10344                offset + 16,
10345                _depth
10346            )?;
10347            fidl::decode!(
10348                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ChildViewWatcherMarker>>,
10349                fidl::encoding::DefaultFuchsiaResourceDialect,
10350                &mut self.child_view_watcher,
10351                decoder,
10352                offset + 32,
10353                _depth
10354            )?;
10355            Ok(())
10356        }
10357    }
10358
10359    impl fidl::encoding::ResourceTypeMarker for FlatlandDisplaySetContentRequest {
10360        type Borrowed<'a> = &'a mut Self;
10361        fn take_or_borrow<'a>(
10362            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10363        ) -> Self::Borrowed<'a> {
10364            value
10365        }
10366    }
10367
10368    unsafe impl fidl::encoding::TypeMarker for FlatlandDisplaySetContentRequest {
10369        type Owned = Self;
10370
10371        #[inline(always)]
10372        fn inline_align(_context: fidl::encoding::Context) -> usize {
10373            4
10374        }
10375
10376        #[inline(always)]
10377        fn inline_size(_context: fidl::encoding::Context) -> usize {
10378            8
10379        }
10380    }
10381
10382    unsafe impl
10383        fidl::encoding::Encode<
10384            FlatlandDisplaySetContentRequest,
10385            fidl::encoding::DefaultFuchsiaResourceDialect,
10386        > for &mut FlatlandDisplaySetContentRequest
10387    {
10388        #[inline]
10389        unsafe fn encode(
10390            self,
10391            encoder: &mut fidl::encoding::Encoder<
10392                '_,
10393                fidl::encoding::DefaultFuchsiaResourceDialect,
10394            >,
10395            offset: usize,
10396            _depth: fidl::encoding::Depth,
10397        ) -> fidl::Result<()> {
10398            encoder.debug_check_bounds::<FlatlandDisplaySetContentRequest>(offset);
10399            // Delegate to tuple encoding.
10400            fidl::encoding::Encode::<FlatlandDisplaySetContentRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
10401                (
10402                    <fidl_fuchsia_ui_views::ViewportCreationToken as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.token),
10403                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ChildViewWatcherMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.child_view_watcher),
10404                ),
10405                encoder, offset, _depth
10406            )
10407        }
10408    }
10409    unsafe impl<
10410        T0: fidl::encoding::Encode<
10411                fidl_fuchsia_ui_views::ViewportCreationToken,
10412                fidl::encoding::DefaultFuchsiaResourceDialect,
10413            >,
10414        T1: fidl::encoding::Encode<
10415                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ChildViewWatcherMarker>>,
10416                fidl::encoding::DefaultFuchsiaResourceDialect,
10417            >,
10418    >
10419        fidl::encoding::Encode<
10420            FlatlandDisplaySetContentRequest,
10421            fidl::encoding::DefaultFuchsiaResourceDialect,
10422        > for (T0, T1)
10423    {
10424        #[inline]
10425        unsafe fn encode(
10426            self,
10427            encoder: &mut fidl::encoding::Encoder<
10428                '_,
10429                fidl::encoding::DefaultFuchsiaResourceDialect,
10430            >,
10431            offset: usize,
10432            depth: fidl::encoding::Depth,
10433        ) -> fidl::Result<()> {
10434            encoder.debug_check_bounds::<FlatlandDisplaySetContentRequest>(offset);
10435            // Zero out padding regions. There's no need to apply masks
10436            // because the unmasked parts will be overwritten by fields.
10437            // Write the fields.
10438            self.0.encode(encoder, offset + 0, depth)?;
10439            self.1.encode(encoder, offset + 4, depth)?;
10440            Ok(())
10441        }
10442    }
10443
10444    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10445        for FlatlandDisplaySetContentRequest
10446    {
10447        #[inline(always)]
10448        fn new_empty() -> Self {
10449            Self {
10450                token: fidl::new_empty!(
10451                    fidl_fuchsia_ui_views::ViewportCreationToken,
10452                    fidl::encoding::DefaultFuchsiaResourceDialect
10453                ),
10454                child_view_watcher: fidl::new_empty!(
10455                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ChildViewWatcherMarker>>,
10456                    fidl::encoding::DefaultFuchsiaResourceDialect
10457                ),
10458            }
10459        }
10460
10461        #[inline]
10462        unsafe fn decode(
10463            &mut self,
10464            decoder: &mut fidl::encoding::Decoder<
10465                '_,
10466                fidl::encoding::DefaultFuchsiaResourceDialect,
10467            >,
10468            offset: usize,
10469            _depth: fidl::encoding::Depth,
10470        ) -> fidl::Result<()> {
10471            decoder.debug_check_bounds::<Self>(offset);
10472            // Verify that padding bytes are zero.
10473            fidl::decode!(
10474                fidl_fuchsia_ui_views::ViewportCreationToken,
10475                fidl::encoding::DefaultFuchsiaResourceDialect,
10476                &mut self.token,
10477                decoder,
10478                offset + 0,
10479                _depth
10480            )?;
10481            fidl::decode!(
10482                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ChildViewWatcherMarker>>,
10483                fidl::encoding::DefaultFuchsiaResourceDialect,
10484                &mut self.child_view_watcher,
10485                decoder,
10486                offset + 4,
10487                _depth
10488            )?;
10489            Ok(())
10490        }
10491    }
10492
10493    impl fidl::encoding::ResourceTypeMarker for FlatlandPresentRequest {
10494        type Borrowed<'a> = &'a mut Self;
10495        fn take_or_borrow<'a>(
10496            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10497        ) -> Self::Borrowed<'a> {
10498            value
10499        }
10500    }
10501
10502    unsafe impl fidl::encoding::TypeMarker for FlatlandPresentRequest {
10503        type Owned = Self;
10504
10505        #[inline(always)]
10506        fn inline_align(_context: fidl::encoding::Context) -> usize {
10507            8
10508        }
10509
10510        #[inline(always)]
10511        fn inline_size(_context: fidl::encoding::Context) -> usize {
10512            16
10513        }
10514    }
10515
10516    unsafe impl
10517        fidl::encoding::Encode<
10518            FlatlandPresentRequest,
10519            fidl::encoding::DefaultFuchsiaResourceDialect,
10520        > for &mut FlatlandPresentRequest
10521    {
10522        #[inline]
10523        unsafe fn encode(
10524            self,
10525            encoder: &mut fidl::encoding::Encoder<
10526                '_,
10527                fidl::encoding::DefaultFuchsiaResourceDialect,
10528            >,
10529            offset: usize,
10530            _depth: fidl::encoding::Depth,
10531        ) -> fidl::Result<()> {
10532            encoder.debug_check_bounds::<FlatlandPresentRequest>(offset);
10533            // Delegate to tuple encoding.
10534            fidl::encoding::Encode::<
10535                FlatlandPresentRequest,
10536                fidl::encoding::DefaultFuchsiaResourceDialect,
10537            >::encode(
10538                (<PresentArgs as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
10539                    &mut self.args,
10540                ),),
10541                encoder,
10542                offset,
10543                _depth,
10544            )
10545        }
10546    }
10547    unsafe impl<
10548        T0: fidl::encoding::Encode<PresentArgs, fidl::encoding::DefaultFuchsiaResourceDialect>,
10549    >
10550        fidl::encoding::Encode<
10551            FlatlandPresentRequest,
10552            fidl::encoding::DefaultFuchsiaResourceDialect,
10553        > for (T0,)
10554    {
10555        #[inline]
10556        unsafe fn encode(
10557            self,
10558            encoder: &mut fidl::encoding::Encoder<
10559                '_,
10560                fidl::encoding::DefaultFuchsiaResourceDialect,
10561            >,
10562            offset: usize,
10563            depth: fidl::encoding::Depth,
10564        ) -> fidl::Result<()> {
10565            encoder.debug_check_bounds::<FlatlandPresentRequest>(offset);
10566            // Zero out padding regions. There's no need to apply masks
10567            // because the unmasked parts will be overwritten by fields.
10568            // Write the fields.
10569            self.0.encode(encoder, offset + 0, depth)?;
10570            Ok(())
10571        }
10572    }
10573
10574    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10575        for FlatlandPresentRequest
10576    {
10577        #[inline(always)]
10578        fn new_empty() -> Self {
10579            Self {
10580                args: fidl::new_empty!(PresentArgs, fidl::encoding::DefaultFuchsiaResourceDialect),
10581            }
10582        }
10583
10584        #[inline]
10585        unsafe fn decode(
10586            &mut self,
10587            decoder: &mut fidl::encoding::Decoder<
10588                '_,
10589                fidl::encoding::DefaultFuchsiaResourceDialect,
10590            >,
10591            offset: usize,
10592            _depth: fidl::encoding::Depth,
10593        ) -> fidl::Result<()> {
10594            decoder.debug_check_bounds::<Self>(offset);
10595            // Verify that padding bytes are zero.
10596            fidl::decode!(
10597                PresentArgs,
10598                fidl::encoding::DefaultFuchsiaResourceDialect,
10599                &mut self.args,
10600                decoder,
10601                offset + 0,
10602                _depth
10603            )?;
10604            Ok(())
10605        }
10606    }
10607
10608    impl fidl::encoding::ResourceTypeMarker for FlatlandReleaseViewportResponse {
10609        type Borrowed<'a> = &'a mut Self;
10610        fn take_or_borrow<'a>(
10611            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10612        ) -> Self::Borrowed<'a> {
10613            value
10614        }
10615    }
10616
10617    unsafe impl fidl::encoding::TypeMarker for FlatlandReleaseViewportResponse {
10618        type Owned = Self;
10619
10620        #[inline(always)]
10621        fn inline_align(_context: fidl::encoding::Context) -> usize {
10622            4
10623        }
10624
10625        #[inline(always)]
10626        fn inline_size(_context: fidl::encoding::Context) -> usize {
10627            4
10628        }
10629    }
10630
10631    unsafe impl
10632        fidl::encoding::Encode<
10633            FlatlandReleaseViewportResponse,
10634            fidl::encoding::DefaultFuchsiaResourceDialect,
10635        > for &mut FlatlandReleaseViewportResponse
10636    {
10637        #[inline]
10638        unsafe fn encode(
10639            self,
10640            encoder: &mut fidl::encoding::Encoder<
10641                '_,
10642                fidl::encoding::DefaultFuchsiaResourceDialect,
10643            >,
10644            offset: usize,
10645            _depth: fidl::encoding::Depth,
10646        ) -> fidl::Result<()> {
10647            encoder.debug_check_bounds::<FlatlandReleaseViewportResponse>(offset);
10648            // Delegate to tuple encoding.
10649            fidl::encoding::Encode::<FlatlandReleaseViewportResponse, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
10650                (
10651                    <fidl_fuchsia_ui_views::ViewportCreationToken as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.token),
10652                ),
10653                encoder, offset, _depth
10654            )
10655        }
10656    }
10657    unsafe impl<
10658        T0: fidl::encoding::Encode<
10659                fidl_fuchsia_ui_views::ViewportCreationToken,
10660                fidl::encoding::DefaultFuchsiaResourceDialect,
10661            >,
10662    >
10663        fidl::encoding::Encode<
10664            FlatlandReleaseViewportResponse,
10665            fidl::encoding::DefaultFuchsiaResourceDialect,
10666        > for (T0,)
10667    {
10668        #[inline]
10669        unsafe fn encode(
10670            self,
10671            encoder: &mut fidl::encoding::Encoder<
10672                '_,
10673                fidl::encoding::DefaultFuchsiaResourceDialect,
10674            >,
10675            offset: usize,
10676            depth: fidl::encoding::Depth,
10677        ) -> fidl::Result<()> {
10678            encoder.debug_check_bounds::<FlatlandReleaseViewportResponse>(offset);
10679            // Zero out padding regions. There's no need to apply masks
10680            // because the unmasked parts will be overwritten by fields.
10681            // Write the fields.
10682            self.0.encode(encoder, offset + 0, depth)?;
10683            Ok(())
10684        }
10685    }
10686
10687    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10688        for FlatlandReleaseViewportResponse
10689    {
10690        #[inline(always)]
10691        fn new_empty() -> Self {
10692            Self {
10693                token: fidl::new_empty!(
10694                    fidl_fuchsia_ui_views::ViewportCreationToken,
10695                    fidl::encoding::DefaultFuchsiaResourceDialect
10696                ),
10697            }
10698        }
10699
10700        #[inline]
10701        unsafe fn decode(
10702            &mut self,
10703            decoder: &mut fidl::encoding::Decoder<
10704                '_,
10705                fidl::encoding::DefaultFuchsiaResourceDialect,
10706            >,
10707            offset: usize,
10708            _depth: fidl::encoding::Depth,
10709        ) -> fidl::Result<()> {
10710            decoder.debug_check_bounds::<Self>(offset);
10711            // Verify that padding bytes are zero.
10712            fidl::decode!(
10713                fidl_fuchsia_ui_views::ViewportCreationToken,
10714                fidl::encoding::DefaultFuchsiaResourceDialect,
10715                &mut self.token,
10716                decoder,
10717                offset + 0,
10718                _depth
10719            )?;
10720            Ok(())
10721        }
10722    }
10723
10724    impl fidl::encoding::ResourceTypeMarker for FlatlandSetSolidFillRequest {
10725        type Borrowed<'a> = &'a mut Self;
10726        fn take_or_borrow<'a>(
10727            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10728        ) -> Self::Borrowed<'a> {
10729            value
10730        }
10731    }
10732
10733    unsafe impl fidl::encoding::TypeMarker for FlatlandSetSolidFillRequest {
10734        type Owned = Self;
10735
10736        #[inline(always)]
10737        fn inline_align(_context: fidl::encoding::Context) -> usize {
10738            8
10739        }
10740
10741        #[inline(always)]
10742        fn inline_size(_context: fidl::encoding::Context) -> usize {
10743            32
10744        }
10745    }
10746
10747    unsafe impl
10748        fidl::encoding::Encode<
10749            FlatlandSetSolidFillRequest,
10750            fidl::encoding::DefaultFuchsiaResourceDialect,
10751        > for &mut FlatlandSetSolidFillRequest
10752    {
10753        #[inline]
10754        unsafe fn encode(
10755            self,
10756            encoder: &mut fidl::encoding::Encoder<
10757                '_,
10758                fidl::encoding::DefaultFuchsiaResourceDialect,
10759            >,
10760            offset: usize,
10761            _depth: fidl::encoding::Depth,
10762        ) -> fidl::Result<()> {
10763            encoder.debug_check_bounds::<FlatlandSetSolidFillRequest>(offset);
10764            // Delegate to tuple encoding.
10765            fidl::encoding::Encode::<
10766                FlatlandSetSolidFillRequest,
10767                fidl::encoding::DefaultFuchsiaResourceDialect,
10768            >::encode(
10769                (
10770                    <ContentId as fidl::encoding::ValueTypeMarker>::borrow(&self.rect_id),
10771                    <ColorRgba as fidl::encoding::ValueTypeMarker>::borrow(&self.color),
10772                    <fidl_fuchsia_math::SizeU as fidl::encoding::ValueTypeMarker>::borrow(
10773                        &self.size,
10774                    ),
10775                ),
10776                encoder,
10777                offset,
10778                _depth,
10779            )
10780        }
10781    }
10782    unsafe impl<
10783        T0: fidl::encoding::Encode<ContentId, fidl::encoding::DefaultFuchsiaResourceDialect>,
10784        T1: fidl::encoding::Encode<ColorRgba, fidl::encoding::DefaultFuchsiaResourceDialect>,
10785        T2: fidl::encoding::Encode<
10786                fidl_fuchsia_math::SizeU,
10787                fidl::encoding::DefaultFuchsiaResourceDialect,
10788            >,
10789    >
10790        fidl::encoding::Encode<
10791            FlatlandSetSolidFillRequest,
10792            fidl::encoding::DefaultFuchsiaResourceDialect,
10793        > for (T0, T1, T2)
10794    {
10795        #[inline]
10796        unsafe fn encode(
10797            self,
10798            encoder: &mut fidl::encoding::Encoder<
10799                '_,
10800                fidl::encoding::DefaultFuchsiaResourceDialect,
10801            >,
10802            offset: usize,
10803            depth: fidl::encoding::Depth,
10804        ) -> fidl::Result<()> {
10805            encoder.debug_check_bounds::<FlatlandSetSolidFillRequest>(offset);
10806            // Zero out padding regions. There's no need to apply masks
10807            // because the unmasked parts will be overwritten by fields.
10808            // Write the fields.
10809            self.0.encode(encoder, offset + 0, depth)?;
10810            self.1.encode(encoder, offset + 8, depth)?;
10811            self.2.encode(encoder, offset + 24, depth)?;
10812            Ok(())
10813        }
10814    }
10815
10816    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10817        for FlatlandSetSolidFillRequest
10818    {
10819        #[inline(always)]
10820        fn new_empty() -> Self {
10821            Self {
10822                rect_id: fidl::new_empty!(ContentId, fidl::encoding::DefaultFuchsiaResourceDialect),
10823                color: fidl::new_empty!(ColorRgba, fidl::encoding::DefaultFuchsiaResourceDialect),
10824                size: fidl::new_empty!(
10825                    fidl_fuchsia_math::SizeU,
10826                    fidl::encoding::DefaultFuchsiaResourceDialect
10827                ),
10828            }
10829        }
10830
10831        #[inline]
10832        unsafe fn decode(
10833            &mut self,
10834            decoder: &mut fidl::encoding::Decoder<
10835                '_,
10836                fidl::encoding::DefaultFuchsiaResourceDialect,
10837            >,
10838            offset: usize,
10839            _depth: fidl::encoding::Depth,
10840        ) -> fidl::Result<()> {
10841            decoder.debug_check_bounds::<Self>(offset);
10842            // Verify that padding bytes are zero.
10843            fidl::decode!(
10844                ContentId,
10845                fidl::encoding::DefaultFuchsiaResourceDialect,
10846                &mut self.rect_id,
10847                decoder,
10848                offset + 0,
10849                _depth
10850            )?;
10851            fidl::decode!(
10852                ColorRgba,
10853                fidl::encoding::DefaultFuchsiaResourceDialect,
10854                &mut self.color,
10855                decoder,
10856                offset + 8,
10857                _depth
10858            )?;
10859            fidl::decode!(
10860                fidl_fuchsia_math::SizeU,
10861                fidl::encoding::DefaultFuchsiaResourceDialect,
10862                &mut self.size,
10863                decoder,
10864                offset + 24,
10865                _depth
10866            )?;
10867            Ok(())
10868        }
10869    }
10870
10871    impl fidl::encoding::ResourceTypeMarker for TrustedFlatlandFactoryCreateFlatlandRequest {
10872        type Borrowed<'a> = &'a mut Self;
10873        fn take_or_borrow<'a>(
10874            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10875        ) -> Self::Borrowed<'a> {
10876            value
10877        }
10878    }
10879
10880    unsafe impl fidl::encoding::TypeMarker for TrustedFlatlandFactoryCreateFlatlandRequest {
10881        type Owned = Self;
10882
10883        #[inline(always)]
10884        fn inline_align(_context: fidl::encoding::Context) -> usize {
10885            8
10886        }
10887
10888        #[inline(always)]
10889        fn inline_size(_context: fidl::encoding::Context) -> usize {
10890            24
10891        }
10892    }
10893
10894    unsafe impl
10895        fidl::encoding::Encode<
10896            TrustedFlatlandFactoryCreateFlatlandRequest,
10897            fidl::encoding::DefaultFuchsiaResourceDialect,
10898        > for &mut TrustedFlatlandFactoryCreateFlatlandRequest
10899    {
10900        #[inline]
10901        unsafe fn encode(
10902            self,
10903            encoder: &mut fidl::encoding::Encoder<
10904                '_,
10905                fidl::encoding::DefaultFuchsiaResourceDialect,
10906            >,
10907            offset: usize,
10908            _depth: fidl::encoding::Depth,
10909        ) -> fidl::Result<()> {
10910            encoder.debug_check_bounds::<TrustedFlatlandFactoryCreateFlatlandRequest>(offset);
10911            // Delegate to tuple encoding.
10912            fidl::encoding::Encode::<TrustedFlatlandFactoryCreateFlatlandRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
10913                (
10914                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<FlatlandMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.server_end),
10915                    <TrustedFlatlandConfig as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.config),
10916                ),
10917                encoder, offset, _depth
10918            )
10919        }
10920    }
10921    unsafe impl<
10922        T0: fidl::encoding::Encode<
10923                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<FlatlandMarker>>,
10924                fidl::encoding::DefaultFuchsiaResourceDialect,
10925            >,
10926        T1: fidl::encoding::Encode<
10927                TrustedFlatlandConfig,
10928                fidl::encoding::DefaultFuchsiaResourceDialect,
10929            >,
10930    >
10931        fidl::encoding::Encode<
10932            TrustedFlatlandFactoryCreateFlatlandRequest,
10933            fidl::encoding::DefaultFuchsiaResourceDialect,
10934        > for (T0, T1)
10935    {
10936        #[inline]
10937        unsafe fn encode(
10938            self,
10939            encoder: &mut fidl::encoding::Encoder<
10940                '_,
10941                fidl::encoding::DefaultFuchsiaResourceDialect,
10942            >,
10943            offset: usize,
10944            depth: fidl::encoding::Depth,
10945        ) -> fidl::Result<()> {
10946            encoder.debug_check_bounds::<TrustedFlatlandFactoryCreateFlatlandRequest>(offset);
10947            // Zero out padding regions. There's no need to apply masks
10948            // because the unmasked parts will be overwritten by fields.
10949            unsafe {
10950                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
10951                (ptr as *mut u64).write_unaligned(0);
10952            }
10953            // Write the fields.
10954            self.0.encode(encoder, offset + 0, depth)?;
10955            self.1.encode(encoder, offset + 8, depth)?;
10956            Ok(())
10957        }
10958    }
10959
10960    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10961        for TrustedFlatlandFactoryCreateFlatlandRequest
10962    {
10963        #[inline(always)]
10964        fn new_empty() -> Self {
10965            Self {
10966                server_end: fidl::new_empty!(
10967                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<FlatlandMarker>>,
10968                    fidl::encoding::DefaultFuchsiaResourceDialect
10969                ),
10970                config: fidl::new_empty!(
10971                    TrustedFlatlandConfig,
10972                    fidl::encoding::DefaultFuchsiaResourceDialect
10973                ),
10974            }
10975        }
10976
10977        #[inline]
10978        unsafe fn decode(
10979            &mut self,
10980            decoder: &mut fidl::encoding::Decoder<
10981                '_,
10982                fidl::encoding::DefaultFuchsiaResourceDialect,
10983            >,
10984            offset: usize,
10985            _depth: fidl::encoding::Depth,
10986        ) -> fidl::Result<()> {
10987            decoder.debug_check_bounds::<Self>(offset);
10988            // Verify that padding bytes are zero.
10989            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
10990            let padval = unsafe { (ptr as *const u64).read_unaligned() };
10991            let mask = 0xffffffff00000000u64;
10992            let maskedval = padval & mask;
10993            if maskedval != 0 {
10994                return Err(fidl::Error::NonZeroPadding {
10995                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
10996                });
10997            }
10998            fidl::decode!(
10999                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<FlatlandMarker>>,
11000                fidl::encoding::DefaultFuchsiaResourceDialect,
11001                &mut self.server_end,
11002                decoder,
11003                offset + 0,
11004                _depth
11005            )?;
11006            fidl::decode!(
11007                TrustedFlatlandConfig,
11008                fidl::encoding::DefaultFuchsiaResourceDialect,
11009                &mut self.config,
11010                decoder,
11011                offset + 8,
11012                _depth
11013            )?;
11014            Ok(())
11015        }
11016    }
11017
11018    impl FrameInfo {
11019        #[inline(always)]
11020        fn max_ordinal_present(&self) -> u64 {
11021            if let Some(_) = self.buffer_id {
11022                return 1;
11023            }
11024            0
11025        }
11026    }
11027
11028    impl fidl::encoding::ResourceTypeMarker for FrameInfo {
11029        type Borrowed<'a> = &'a mut Self;
11030        fn take_or_borrow<'a>(
11031            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11032        ) -> Self::Borrowed<'a> {
11033            value
11034        }
11035    }
11036
11037    unsafe impl fidl::encoding::TypeMarker for FrameInfo {
11038        type Owned = Self;
11039
11040        #[inline(always)]
11041        fn inline_align(_context: fidl::encoding::Context) -> usize {
11042            8
11043        }
11044
11045        #[inline(always)]
11046        fn inline_size(_context: fidl::encoding::Context) -> usize {
11047            16
11048        }
11049    }
11050
11051    unsafe impl fidl::encoding::Encode<FrameInfo, fidl::encoding::DefaultFuchsiaResourceDialect>
11052        for &mut FrameInfo
11053    {
11054        unsafe fn encode(
11055            self,
11056            encoder: &mut fidl::encoding::Encoder<
11057                '_,
11058                fidl::encoding::DefaultFuchsiaResourceDialect,
11059            >,
11060            offset: usize,
11061            mut depth: fidl::encoding::Depth,
11062        ) -> fidl::Result<()> {
11063            encoder.debug_check_bounds::<FrameInfo>(offset);
11064            // Vector header
11065            let max_ordinal: u64 = self.max_ordinal_present();
11066            encoder.write_num(max_ordinal, offset);
11067            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
11068            // Calling encoder.out_of_line_offset(0) is not allowed.
11069            if max_ordinal == 0 {
11070                return Ok(());
11071            }
11072            depth.increment()?;
11073            let envelope_size = 8;
11074            let bytes_len = max_ordinal as usize * envelope_size;
11075            #[allow(unused_variables)]
11076            let offset = encoder.out_of_line_offset(bytes_len);
11077            let mut _prev_end_offset: usize = 0;
11078            if 1 > max_ordinal {
11079                return Ok(());
11080            }
11081
11082            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11083            // are envelope_size bytes.
11084            let cur_offset: usize = (1 - 1) * envelope_size;
11085
11086            // Zero reserved fields.
11087            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11088
11089            // Safety:
11090            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11091            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11092            //   envelope_size bytes, there is always sufficient room.
11093            fidl::encoding::encode_in_envelope_optional::<
11094                u32,
11095                fidl::encoding::DefaultFuchsiaResourceDialect,
11096            >(
11097                self.buffer_id.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
11098                encoder,
11099                offset + cur_offset,
11100                depth,
11101            )?;
11102
11103            _prev_end_offset = cur_offset + envelope_size;
11104
11105            Ok(())
11106        }
11107    }
11108
11109    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for FrameInfo {
11110        #[inline(always)]
11111        fn new_empty() -> Self {
11112            Self::default()
11113        }
11114
11115        unsafe fn decode(
11116            &mut self,
11117            decoder: &mut fidl::encoding::Decoder<
11118                '_,
11119                fidl::encoding::DefaultFuchsiaResourceDialect,
11120            >,
11121            offset: usize,
11122            mut depth: fidl::encoding::Depth,
11123        ) -> fidl::Result<()> {
11124            decoder.debug_check_bounds::<Self>(offset);
11125            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
11126                None => return Err(fidl::Error::NotNullable),
11127                Some(len) => len,
11128            };
11129            // Calling decoder.out_of_line_offset(0) is not allowed.
11130            if len == 0 {
11131                return Ok(());
11132            };
11133            depth.increment()?;
11134            let envelope_size = 8;
11135            let bytes_len = len * envelope_size;
11136            let offset = decoder.out_of_line_offset(bytes_len)?;
11137            // Decode the envelope for each type.
11138            let mut _next_ordinal_to_read = 0;
11139            let mut next_offset = offset;
11140            let end_offset = offset + bytes_len;
11141            _next_ordinal_to_read += 1;
11142            if next_offset >= end_offset {
11143                return Ok(());
11144            }
11145
11146            // Decode unknown envelopes for gaps in ordinals.
11147            while _next_ordinal_to_read < 1 {
11148                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11149                _next_ordinal_to_read += 1;
11150                next_offset += envelope_size;
11151            }
11152
11153            let next_out_of_line = decoder.next_out_of_line();
11154            let handles_before = decoder.remaining_handles();
11155            if let Some((inlined, num_bytes, num_handles)) =
11156                fidl::encoding::decode_envelope_header(decoder, next_offset)?
11157            {
11158                let member_inline_size =
11159                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
11160                if inlined != (member_inline_size <= 4) {
11161                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
11162                }
11163                let inner_offset;
11164                let mut inner_depth = depth.clone();
11165                if inlined {
11166                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11167                    inner_offset = next_offset;
11168                } else {
11169                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11170                    inner_depth.increment()?;
11171                }
11172                let val_ref = self.buffer_id.get_or_insert_with(|| {
11173                    fidl::new_empty!(u32, fidl::encoding::DefaultFuchsiaResourceDialect)
11174                });
11175                fidl::decode!(
11176                    u32,
11177                    fidl::encoding::DefaultFuchsiaResourceDialect,
11178                    val_ref,
11179                    decoder,
11180                    inner_offset,
11181                    inner_depth
11182                )?;
11183                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11184                {
11185                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
11186                }
11187                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11188                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11189                }
11190            }
11191
11192            next_offset += envelope_size;
11193
11194            // Decode the remaining unknown envelopes.
11195            while next_offset < end_offset {
11196                _next_ordinal_to_read += 1;
11197                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11198                next_offset += envelope_size;
11199            }
11200
11201            Ok(())
11202        }
11203    }
11204
11205    impl GetNextFrameArgs {
11206        #[inline(always)]
11207        fn max_ordinal_present(&self) -> u64 {
11208            if let Some(_) = self.event {
11209                return 1;
11210            }
11211            0
11212        }
11213    }
11214
11215    impl fidl::encoding::ResourceTypeMarker for GetNextFrameArgs {
11216        type Borrowed<'a> = &'a mut Self;
11217        fn take_or_borrow<'a>(
11218            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11219        ) -> Self::Borrowed<'a> {
11220            value
11221        }
11222    }
11223
11224    unsafe impl fidl::encoding::TypeMarker for GetNextFrameArgs {
11225        type Owned = Self;
11226
11227        #[inline(always)]
11228        fn inline_align(_context: fidl::encoding::Context) -> usize {
11229            8
11230        }
11231
11232        #[inline(always)]
11233        fn inline_size(_context: fidl::encoding::Context) -> usize {
11234            16
11235        }
11236    }
11237
11238    unsafe impl
11239        fidl::encoding::Encode<GetNextFrameArgs, fidl::encoding::DefaultFuchsiaResourceDialect>
11240        for &mut GetNextFrameArgs
11241    {
11242        unsafe fn encode(
11243            self,
11244            encoder: &mut fidl::encoding::Encoder<
11245                '_,
11246                fidl::encoding::DefaultFuchsiaResourceDialect,
11247            >,
11248            offset: usize,
11249            mut depth: fidl::encoding::Depth,
11250        ) -> fidl::Result<()> {
11251            encoder.debug_check_bounds::<GetNextFrameArgs>(offset);
11252            // Vector header
11253            let max_ordinal: u64 = self.max_ordinal_present();
11254            encoder.write_num(max_ordinal, offset);
11255            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
11256            // Calling encoder.out_of_line_offset(0) is not allowed.
11257            if max_ordinal == 0 {
11258                return Ok(());
11259            }
11260            depth.increment()?;
11261            let envelope_size = 8;
11262            let bytes_len = max_ordinal as usize * envelope_size;
11263            #[allow(unused_variables)]
11264            let offset = encoder.out_of_line_offset(bytes_len);
11265            let mut _prev_end_offset: usize = 0;
11266            if 1 > max_ordinal {
11267                return Ok(());
11268            }
11269
11270            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11271            // are envelope_size bytes.
11272            let cur_offset: usize = (1 - 1) * envelope_size;
11273
11274            // Zero reserved fields.
11275            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11276
11277            // Safety:
11278            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11279            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11280            //   envelope_size bytes, there is always sufficient room.
11281            fidl::encoding::encode_in_envelope_optional::<
11282                fidl::encoding::HandleType<
11283                    fidl::Event,
11284                    { fidl::ObjectType::EVENT.into_raw() },
11285                    2147483648,
11286                >,
11287                fidl::encoding::DefaultFuchsiaResourceDialect,
11288            >(
11289                self.event.as_mut().map(
11290                    <fidl::encoding::HandleType<
11291                        fidl::Event,
11292                        { fidl::ObjectType::EVENT.into_raw() },
11293                        2147483648,
11294                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
11295                ),
11296                encoder,
11297                offset + cur_offset,
11298                depth,
11299            )?;
11300
11301            _prev_end_offset = cur_offset + envelope_size;
11302
11303            Ok(())
11304        }
11305    }
11306
11307    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11308        for GetNextFrameArgs
11309    {
11310        #[inline(always)]
11311        fn new_empty() -> Self {
11312            Self::default()
11313        }
11314
11315        unsafe fn decode(
11316            &mut self,
11317            decoder: &mut fidl::encoding::Decoder<
11318                '_,
11319                fidl::encoding::DefaultFuchsiaResourceDialect,
11320            >,
11321            offset: usize,
11322            mut depth: fidl::encoding::Depth,
11323        ) -> fidl::Result<()> {
11324            decoder.debug_check_bounds::<Self>(offset);
11325            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
11326                None => return Err(fidl::Error::NotNullable),
11327                Some(len) => len,
11328            };
11329            // Calling decoder.out_of_line_offset(0) is not allowed.
11330            if len == 0 {
11331                return Ok(());
11332            };
11333            depth.increment()?;
11334            let envelope_size = 8;
11335            let bytes_len = len * envelope_size;
11336            let offset = decoder.out_of_line_offset(bytes_len)?;
11337            // Decode the envelope for each type.
11338            let mut _next_ordinal_to_read = 0;
11339            let mut next_offset = offset;
11340            let end_offset = offset + bytes_len;
11341            _next_ordinal_to_read += 1;
11342            if next_offset >= end_offset {
11343                return Ok(());
11344            }
11345
11346            // Decode unknown envelopes for gaps in ordinals.
11347            while _next_ordinal_to_read < 1 {
11348                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11349                _next_ordinal_to_read += 1;
11350                next_offset += envelope_size;
11351            }
11352
11353            let next_out_of_line = decoder.next_out_of_line();
11354            let handles_before = decoder.remaining_handles();
11355            if let Some((inlined, num_bytes, num_handles)) =
11356                fidl::encoding::decode_envelope_header(decoder, next_offset)?
11357            {
11358                let member_inline_size = <fidl::encoding::HandleType<
11359                    fidl::Event,
11360                    { fidl::ObjectType::EVENT.into_raw() },
11361                    2147483648,
11362                > as fidl::encoding::TypeMarker>::inline_size(
11363                    decoder.context
11364                );
11365                if inlined != (member_inline_size <= 4) {
11366                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
11367                }
11368                let inner_offset;
11369                let mut inner_depth = depth.clone();
11370                if inlined {
11371                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11372                    inner_offset = next_offset;
11373                } else {
11374                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11375                    inner_depth.increment()?;
11376                }
11377                let val_ref =
11378                self.event.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
11379                fidl::decode!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
11380                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11381                {
11382                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
11383                }
11384                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11385                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11386                }
11387            }
11388
11389            next_offset += envelope_size;
11390
11391            // Decode the remaining unknown envelopes.
11392            while next_offset < end_offset {
11393                _next_ordinal_to_read += 1;
11394                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11395                next_offset += envelope_size;
11396            }
11397
11398            Ok(())
11399        }
11400    }
11401
11402    impl PresentArgs {
11403        #[inline(always)]
11404        fn max_ordinal_present(&self) -> u64 {
11405            if let Some(_) = self.present_fences {
11406                return 7;
11407            }
11408            if let Some(_) = self.unsquashable {
11409                return 4;
11410            }
11411            if let Some(_) = self.release_fences {
11412                return 3;
11413            }
11414            if let Some(_) = self.acquire_fences {
11415                return 2;
11416            }
11417            if let Some(_) = self.requested_presentation_time {
11418                return 1;
11419            }
11420            0
11421        }
11422    }
11423
11424    impl fidl::encoding::ResourceTypeMarker for PresentArgs {
11425        type Borrowed<'a> = &'a mut Self;
11426        fn take_or_borrow<'a>(
11427            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11428        ) -> Self::Borrowed<'a> {
11429            value
11430        }
11431    }
11432
11433    unsafe impl fidl::encoding::TypeMarker for PresentArgs {
11434        type Owned = Self;
11435
11436        #[inline(always)]
11437        fn inline_align(_context: fidl::encoding::Context) -> usize {
11438            8
11439        }
11440
11441        #[inline(always)]
11442        fn inline_size(_context: fidl::encoding::Context) -> usize {
11443            16
11444        }
11445    }
11446
11447    unsafe impl fidl::encoding::Encode<PresentArgs, fidl::encoding::DefaultFuchsiaResourceDialect>
11448        for &mut PresentArgs
11449    {
11450        unsafe fn encode(
11451            self,
11452            encoder: &mut fidl::encoding::Encoder<
11453                '_,
11454                fidl::encoding::DefaultFuchsiaResourceDialect,
11455            >,
11456            offset: usize,
11457            mut depth: fidl::encoding::Depth,
11458        ) -> fidl::Result<()> {
11459            encoder.debug_check_bounds::<PresentArgs>(offset);
11460            // Vector header
11461            let max_ordinal: u64 = self.max_ordinal_present();
11462            encoder.write_num(max_ordinal, offset);
11463            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
11464            // Calling encoder.out_of_line_offset(0) is not allowed.
11465            if max_ordinal == 0 {
11466                return Ok(());
11467            }
11468            depth.increment()?;
11469            let envelope_size = 8;
11470            let bytes_len = max_ordinal as usize * envelope_size;
11471            #[allow(unused_variables)]
11472            let offset = encoder.out_of_line_offset(bytes_len);
11473            let mut _prev_end_offset: usize = 0;
11474            if 1 > max_ordinal {
11475                return Ok(());
11476            }
11477
11478            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11479            // are envelope_size bytes.
11480            let cur_offset: usize = (1 - 1) * envelope_size;
11481
11482            // Zero reserved fields.
11483            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11484
11485            // Safety:
11486            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11487            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11488            //   envelope_size bytes, there is always sufficient room.
11489            fidl::encoding::encode_in_envelope_optional::<
11490                i64,
11491                fidl::encoding::DefaultFuchsiaResourceDialect,
11492            >(
11493                self.requested_presentation_time
11494                    .as_ref()
11495                    .map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
11496                encoder,
11497                offset + cur_offset,
11498                depth,
11499            )?;
11500
11501            _prev_end_offset = cur_offset + envelope_size;
11502            if 2 > max_ordinal {
11503                return Ok(());
11504            }
11505
11506            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11507            // are envelope_size bytes.
11508            let cur_offset: usize = (2 - 1) * envelope_size;
11509
11510            // Zero reserved fields.
11511            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11512
11513            // Safety:
11514            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11515            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11516            //   envelope_size bytes, there is always sufficient room.
11517            fidl::encoding::encode_in_envelope_optional::<
11518                fidl::encoding::Vector<
11519                    fidl::encoding::HandleType<
11520                        fidl::Event,
11521                        { fidl::ObjectType::EVENT.into_raw() },
11522                        2147483648,
11523                    >,
11524                    16,
11525                >,
11526                fidl::encoding::DefaultFuchsiaResourceDialect,
11527            >(
11528                self.acquire_fences.as_mut().map(
11529                    <fidl::encoding::Vector<
11530                        fidl::encoding::HandleType<
11531                            fidl::Event,
11532                            { fidl::ObjectType::EVENT.into_raw() },
11533                            2147483648,
11534                        >,
11535                        16,
11536                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
11537                ),
11538                encoder,
11539                offset + cur_offset,
11540                depth,
11541            )?;
11542
11543            _prev_end_offset = cur_offset + envelope_size;
11544            if 3 > max_ordinal {
11545                return Ok(());
11546            }
11547
11548            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11549            // are envelope_size bytes.
11550            let cur_offset: usize = (3 - 1) * envelope_size;
11551
11552            // Zero reserved fields.
11553            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11554
11555            // Safety:
11556            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11557            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11558            //   envelope_size bytes, there is always sufficient room.
11559            fidl::encoding::encode_in_envelope_optional::<
11560                fidl::encoding::Vector<
11561                    fidl::encoding::HandleType<
11562                        fidl::Event,
11563                        { fidl::ObjectType::EVENT.into_raw() },
11564                        2147483648,
11565                    >,
11566                    16,
11567                >,
11568                fidl::encoding::DefaultFuchsiaResourceDialect,
11569            >(
11570                self.release_fences.as_mut().map(
11571                    <fidl::encoding::Vector<
11572                        fidl::encoding::HandleType<
11573                            fidl::Event,
11574                            { fidl::ObjectType::EVENT.into_raw() },
11575                            2147483648,
11576                        >,
11577                        16,
11578                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
11579                ),
11580                encoder,
11581                offset + cur_offset,
11582                depth,
11583            )?;
11584
11585            _prev_end_offset = cur_offset + envelope_size;
11586            if 4 > max_ordinal {
11587                return Ok(());
11588            }
11589
11590            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11591            // are envelope_size bytes.
11592            let cur_offset: usize = (4 - 1) * envelope_size;
11593
11594            // Zero reserved fields.
11595            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11596
11597            // Safety:
11598            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11599            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11600            //   envelope_size bytes, there is always sufficient room.
11601            fidl::encoding::encode_in_envelope_optional::<
11602                bool,
11603                fidl::encoding::DefaultFuchsiaResourceDialect,
11604            >(
11605                self.unsquashable.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
11606                encoder,
11607                offset + cur_offset,
11608                depth,
11609            )?;
11610
11611            _prev_end_offset = cur_offset + envelope_size;
11612            if 7 > max_ordinal {
11613                return Ok(());
11614            }
11615
11616            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11617            // are envelope_size bytes.
11618            let cur_offset: usize = (7 - 1) * envelope_size;
11619
11620            // Zero reserved fields.
11621            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11622
11623            // Safety:
11624            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11625            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11626            //   envelope_size bytes, there is always sufficient room.
11627            fidl::encoding::encode_in_envelope_optional::<
11628                fidl::encoding::Vector<
11629                    fidl::encoding::HandleType<
11630                        fidl::Counter,
11631                        { fidl::ObjectType::COUNTER.into_raw() },
11632                        2147483648,
11633                    >,
11634                    16,
11635                >,
11636                fidl::encoding::DefaultFuchsiaResourceDialect,
11637            >(
11638                self.present_fences.as_mut().map(
11639                    <fidl::encoding::Vector<
11640                        fidl::encoding::HandleType<
11641                            fidl::Counter,
11642                            { fidl::ObjectType::COUNTER.into_raw() },
11643                            2147483648,
11644                        >,
11645                        16,
11646                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
11647                ),
11648                encoder,
11649                offset + cur_offset,
11650                depth,
11651            )?;
11652
11653            _prev_end_offset = cur_offset + envelope_size;
11654
11655            Ok(())
11656        }
11657    }
11658
11659    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for PresentArgs {
11660        #[inline(always)]
11661        fn new_empty() -> Self {
11662            Self::default()
11663        }
11664
11665        unsafe fn decode(
11666            &mut self,
11667            decoder: &mut fidl::encoding::Decoder<
11668                '_,
11669                fidl::encoding::DefaultFuchsiaResourceDialect,
11670            >,
11671            offset: usize,
11672            mut depth: fidl::encoding::Depth,
11673        ) -> fidl::Result<()> {
11674            decoder.debug_check_bounds::<Self>(offset);
11675            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
11676                None => return Err(fidl::Error::NotNullable),
11677                Some(len) => len,
11678            };
11679            // Calling decoder.out_of_line_offset(0) is not allowed.
11680            if len == 0 {
11681                return Ok(());
11682            };
11683            depth.increment()?;
11684            let envelope_size = 8;
11685            let bytes_len = len * envelope_size;
11686            let offset = decoder.out_of_line_offset(bytes_len)?;
11687            // Decode the envelope for each type.
11688            let mut _next_ordinal_to_read = 0;
11689            let mut next_offset = offset;
11690            let end_offset = offset + bytes_len;
11691            _next_ordinal_to_read += 1;
11692            if next_offset >= end_offset {
11693                return Ok(());
11694            }
11695
11696            // Decode unknown envelopes for gaps in ordinals.
11697            while _next_ordinal_to_read < 1 {
11698                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11699                _next_ordinal_to_read += 1;
11700                next_offset += envelope_size;
11701            }
11702
11703            let next_out_of_line = decoder.next_out_of_line();
11704            let handles_before = decoder.remaining_handles();
11705            if let Some((inlined, num_bytes, num_handles)) =
11706                fidl::encoding::decode_envelope_header(decoder, next_offset)?
11707            {
11708                let member_inline_size =
11709                    <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
11710                if inlined != (member_inline_size <= 4) {
11711                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
11712                }
11713                let inner_offset;
11714                let mut inner_depth = depth.clone();
11715                if inlined {
11716                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11717                    inner_offset = next_offset;
11718                } else {
11719                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11720                    inner_depth.increment()?;
11721                }
11722                let val_ref = self.requested_presentation_time.get_or_insert_with(|| {
11723                    fidl::new_empty!(i64, fidl::encoding::DefaultFuchsiaResourceDialect)
11724                });
11725                fidl::decode!(
11726                    i64,
11727                    fidl::encoding::DefaultFuchsiaResourceDialect,
11728                    val_ref,
11729                    decoder,
11730                    inner_offset,
11731                    inner_depth
11732                )?;
11733                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11734                {
11735                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
11736                }
11737                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11738                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11739                }
11740            }
11741
11742            next_offset += envelope_size;
11743            _next_ordinal_to_read += 1;
11744            if next_offset >= end_offset {
11745                return Ok(());
11746            }
11747
11748            // Decode unknown envelopes for gaps in ordinals.
11749            while _next_ordinal_to_read < 2 {
11750                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11751                _next_ordinal_to_read += 1;
11752                next_offset += envelope_size;
11753            }
11754
11755            let next_out_of_line = decoder.next_out_of_line();
11756            let handles_before = decoder.remaining_handles();
11757            if let Some((inlined, num_bytes, num_handles)) =
11758                fidl::encoding::decode_envelope_header(decoder, next_offset)?
11759            {
11760                let member_inline_size = <fidl::encoding::Vector<
11761                    fidl::encoding::HandleType<
11762                        fidl::Event,
11763                        { fidl::ObjectType::EVENT.into_raw() },
11764                        2147483648,
11765                    >,
11766                    16,
11767                > as fidl::encoding::TypeMarker>::inline_size(
11768                    decoder.context
11769                );
11770                if inlined != (member_inline_size <= 4) {
11771                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
11772                }
11773                let inner_offset;
11774                let mut inner_depth = depth.clone();
11775                if inlined {
11776                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11777                    inner_offset = next_offset;
11778                } else {
11779                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11780                    inner_depth.increment()?;
11781                }
11782                let val_ref = self.acquire_fences.get_or_insert_with(|| {
11783                    fidl::new_empty!(
11784                        fidl::encoding::Vector<
11785                            fidl::encoding::HandleType<
11786                                fidl::Event,
11787                                { fidl::ObjectType::EVENT.into_raw() },
11788                                2147483648,
11789                            >,
11790                            16,
11791                        >,
11792                        fidl::encoding::DefaultFuchsiaResourceDialect
11793                    )
11794                });
11795                fidl::decode!(
11796                    fidl::encoding::Vector<
11797                        fidl::encoding::HandleType<
11798                            fidl::Event,
11799                            { fidl::ObjectType::EVENT.into_raw() },
11800                            2147483648,
11801                        >,
11802                        16,
11803                    >,
11804                    fidl::encoding::DefaultFuchsiaResourceDialect,
11805                    val_ref,
11806                    decoder,
11807                    inner_offset,
11808                    inner_depth
11809                )?;
11810                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11811                {
11812                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
11813                }
11814                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11815                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11816                }
11817            }
11818
11819            next_offset += envelope_size;
11820            _next_ordinal_to_read += 1;
11821            if next_offset >= end_offset {
11822                return Ok(());
11823            }
11824
11825            // Decode unknown envelopes for gaps in ordinals.
11826            while _next_ordinal_to_read < 3 {
11827                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11828                _next_ordinal_to_read += 1;
11829                next_offset += envelope_size;
11830            }
11831
11832            let next_out_of_line = decoder.next_out_of_line();
11833            let handles_before = decoder.remaining_handles();
11834            if let Some((inlined, num_bytes, num_handles)) =
11835                fidl::encoding::decode_envelope_header(decoder, next_offset)?
11836            {
11837                let member_inline_size = <fidl::encoding::Vector<
11838                    fidl::encoding::HandleType<
11839                        fidl::Event,
11840                        { fidl::ObjectType::EVENT.into_raw() },
11841                        2147483648,
11842                    >,
11843                    16,
11844                > as fidl::encoding::TypeMarker>::inline_size(
11845                    decoder.context
11846                );
11847                if inlined != (member_inline_size <= 4) {
11848                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
11849                }
11850                let inner_offset;
11851                let mut inner_depth = depth.clone();
11852                if inlined {
11853                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11854                    inner_offset = next_offset;
11855                } else {
11856                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11857                    inner_depth.increment()?;
11858                }
11859                let val_ref = self.release_fences.get_or_insert_with(|| {
11860                    fidl::new_empty!(
11861                        fidl::encoding::Vector<
11862                            fidl::encoding::HandleType<
11863                                fidl::Event,
11864                                { fidl::ObjectType::EVENT.into_raw() },
11865                                2147483648,
11866                            >,
11867                            16,
11868                        >,
11869                        fidl::encoding::DefaultFuchsiaResourceDialect
11870                    )
11871                });
11872                fidl::decode!(
11873                    fidl::encoding::Vector<
11874                        fidl::encoding::HandleType<
11875                            fidl::Event,
11876                            { fidl::ObjectType::EVENT.into_raw() },
11877                            2147483648,
11878                        >,
11879                        16,
11880                    >,
11881                    fidl::encoding::DefaultFuchsiaResourceDialect,
11882                    val_ref,
11883                    decoder,
11884                    inner_offset,
11885                    inner_depth
11886                )?;
11887                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11888                {
11889                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
11890                }
11891                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11892                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11893                }
11894            }
11895
11896            next_offset += envelope_size;
11897            _next_ordinal_to_read += 1;
11898            if next_offset >= end_offset {
11899                return Ok(());
11900            }
11901
11902            // Decode unknown envelopes for gaps in ordinals.
11903            while _next_ordinal_to_read < 4 {
11904                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11905                _next_ordinal_to_read += 1;
11906                next_offset += envelope_size;
11907            }
11908
11909            let next_out_of_line = decoder.next_out_of_line();
11910            let handles_before = decoder.remaining_handles();
11911            if let Some((inlined, num_bytes, num_handles)) =
11912                fidl::encoding::decode_envelope_header(decoder, next_offset)?
11913            {
11914                let member_inline_size =
11915                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
11916                if inlined != (member_inline_size <= 4) {
11917                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
11918                }
11919                let inner_offset;
11920                let mut inner_depth = depth.clone();
11921                if inlined {
11922                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11923                    inner_offset = next_offset;
11924                } else {
11925                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11926                    inner_depth.increment()?;
11927                }
11928                let val_ref = self.unsquashable.get_or_insert_with(|| {
11929                    fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
11930                });
11931                fidl::decode!(
11932                    bool,
11933                    fidl::encoding::DefaultFuchsiaResourceDialect,
11934                    val_ref,
11935                    decoder,
11936                    inner_offset,
11937                    inner_depth
11938                )?;
11939                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11940                {
11941                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
11942                }
11943                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11944                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11945                }
11946            }
11947
11948            next_offset += envelope_size;
11949            _next_ordinal_to_read += 1;
11950            if next_offset >= end_offset {
11951                return Ok(());
11952            }
11953
11954            // Decode unknown envelopes for gaps in ordinals.
11955            while _next_ordinal_to_read < 7 {
11956                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11957                _next_ordinal_to_read += 1;
11958                next_offset += envelope_size;
11959            }
11960
11961            let next_out_of_line = decoder.next_out_of_line();
11962            let handles_before = decoder.remaining_handles();
11963            if let Some((inlined, num_bytes, num_handles)) =
11964                fidl::encoding::decode_envelope_header(decoder, next_offset)?
11965            {
11966                let member_inline_size = <fidl::encoding::Vector<
11967                    fidl::encoding::HandleType<
11968                        fidl::Counter,
11969                        { fidl::ObjectType::COUNTER.into_raw() },
11970                        2147483648,
11971                    >,
11972                    16,
11973                > as fidl::encoding::TypeMarker>::inline_size(
11974                    decoder.context
11975                );
11976                if inlined != (member_inline_size <= 4) {
11977                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
11978                }
11979                let inner_offset;
11980                let mut inner_depth = depth.clone();
11981                if inlined {
11982                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11983                    inner_offset = next_offset;
11984                } else {
11985                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11986                    inner_depth.increment()?;
11987                }
11988                let val_ref = self.present_fences.get_or_insert_with(|| {
11989                    fidl::new_empty!(
11990                        fidl::encoding::Vector<
11991                            fidl::encoding::HandleType<
11992                                fidl::Counter,
11993                                { fidl::ObjectType::COUNTER.into_raw() },
11994                                2147483648,
11995                            >,
11996                            16,
11997                        >,
11998                        fidl::encoding::DefaultFuchsiaResourceDialect
11999                    )
12000                });
12001                fidl::decode!(
12002                    fidl::encoding::Vector<
12003                        fidl::encoding::HandleType<
12004                            fidl::Counter,
12005                            { fidl::ObjectType::COUNTER.into_raw() },
12006                            2147483648,
12007                        >,
12008                        16,
12009                    >,
12010                    fidl::encoding::DefaultFuchsiaResourceDialect,
12011                    val_ref,
12012                    decoder,
12013                    inner_offset,
12014                    inner_depth
12015                )?;
12016                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12017                {
12018                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12019                }
12020                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12021                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12022                }
12023            }
12024
12025            next_offset += envelope_size;
12026
12027            // Decode the remaining unknown envelopes.
12028            while next_offset < end_offset {
12029                _next_ordinal_to_read += 1;
12030                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12031                next_offset += envelope_size;
12032            }
12033
12034            Ok(())
12035        }
12036    }
12037
12038    impl RegisterBufferCollectionArgs {
12039        #[inline(always)]
12040        fn max_ordinal_present(&self) -> u64 {
12041            if let Some(_) = self.buffer_collection_token2 {
12042                return 5;
12043            }
12044            if let Some(_) = self.usages {
12045                return 4;
12046            }
12047            if let Some(_) = self.usage {
12048                return 3;
12049            }
12050            if let Some(_) = self.buffer_collection_token {
12051                return 2;
12052            }
12053            if let Some(_) = self.export_token {
12054                return 1;
12055            }
12056            0
12057        }
12058    }
12059
12060    impl fidl::encoding::ResourceTypeMarker for RegisterBufferCollectionArgs {
12061        type Borrowed<'a> = &'a mut Self;
12062        fn take_or_borrow<'a>(
12063            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12064        ) -> Self::Borrowed<'a> {
12065            value
12066        }
12067    }
12068
12069    unsafe impl fidl::encoding::TypeMarker for RegisterBufferCollectionArgs {
12070        type Owned = Self;
12071
12072        #[inline(always)]
12073        fn inline_align(_context: fidl::encoding::Context) -> usize {
12074            8
12075        }
12076
12077        #[inline(always)]
12078        fn inline_size(_context: fidl::encoding::Context) -> usize {
12079            16
12080        }
12081    }
12082
12083    unsafe impl
12084        fidl::encoding::Encode<
12085            RegisterBufferCollectionArgs,
12086            fidl::encoding::DefaultFuchsiaResourceDialect,
12087        > for &mut RegisterBufferCollectionArgs
12088    {
12089        unsafe fn encode(
12090            self,
12091            encoder: &mut fidl::encoding::Encoder<
12092                '_,
12093                fidl::encoding::DefaultFuchsiaResourceDialect,
12094            >,
12095            offset: usize,
12096            mut depth: fidl::encoding::Depth,
12097        ) -> fidl::Result<()> {
12098            encoder.debug_check_bounds::<RegisterBufferCollectionArgs>(offset);
12099            // Vector header
12100            let max_ordinal: u64 = self.max_ordinal_present();
12101            encoder.write_num(max_ordinal, offset);
12102            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
12103            // Calling encoder.out_of_line_offset(0) is not allowed.
12104            if max_ordinal == 0 {
12105                return Ok(());
12106            }
12107            depth.increment()?;
12108            let envelope_size = 8;
12109            let bytes_len = max_ordinal as usize * envelope_size;
12110            #[allow(unused_variables)]
12111            let offset = encoder.out_of_line_offset(bytes_len);
12112            let mut _prev_end_offset: usize = 0;
12113            if 1 > max_ordinal {
12114                return Ok(());
12115            }
12116
12117            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12118            // are envelope_size bytes.
12119            let cur_offset: usize = (1 - 1) * envelope_size;
12120
12121            // Zero reserved fields.
12122            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12123
12124            // Safety:
12125            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12126            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12127            //   envelope_size bytes, there is always sufficient room.
12128            fidl::encoding::encode_in_envelope_optional::<BufferCollectionExportToken, fidl::encoding::DefaultFuchsiaResourceDialect>(
12129            self.export_token.as_mut().map(<BufferCollectionExportToken as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
12130            encoder, offset + cur_offset, depth
12131        )?;
12132
12133            _prev_end_offset = cur_offset + envelope_size;
12134            if 2 > max_ordinal {
12135                return Ok(());
12136            }
12137
12138            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12139            // are envelope_size bytes.
12140            let cur_offset: usize = (2 - 1) * envelope_size;
12141
12142            // Zero reserved fields.
12143            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12144
12145            // Safety:
12146            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12147            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12148            //   envelope_size bytes, there is always sufficient room.
12149            fidl::encoding::encode_in_envelope_optional::<
12150                fidl::encoding::Endpoint<
12151                    fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem::BufferCollectionTokenMarker>,
12152                >,
12153                fidl::encoding::DefaultFuchsiaResourceDialect,
12154            >(
12155                self.buffer_collection_token.as_mut().map(
12156                    <fidl::encoding::Endpoint<
12157                        fidl::endpoints::ClientEnd<
12158                            fidl_fuchsia_sysmem::BufferCollectionTokenMarker,
12159                        >,
12160                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
12161                ),
12162                encoder,
12163                offset + cur_offset,
12164                depth,
12165            )?;
12166
12167            _prev_end_offset = cur_offset + envelope_size;
12168            if 3 > max_ordinal {
12169                return Ok(());
12170            }
12171
12172            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12173            // are envelope_size bytes.
12174            let cur_offset: usize = (3 - 1) * envelope_size;
12175
12176            // Zero reserved fields.
12177            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12178
12179            // Safety:
12180            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12181            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12182            //   envelope_size bytes, there is always sufficient room.
12183            fidl::encoding::encode_in_envelope_optional::<
12184                RegisterBufferCollectionUsage,
12185                fidl::encoding::DefaultFuchsiaResourceDialect,
12186            >(
12187                self.usage.as_ref().map(
12188                    <RegisterBufferCollectionUsage as fidl::encoding::ValueTypeMarker>::borrow,
12189                ),
12190                encoder,
12191                offset + cur_offset,
12192                depth,
12193            )?;
12194
12195            _prev_end_offset = cur_offset + envelope_size;
12196            if 4 > max_ordinal {
12197                return Ok(());
12198            }
12199
12200            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12201            // are envelope_size bytes.
12202            let cur_offset: usize = (4 - 1) * envelope_size;
12203
12204            // Zero reserved fields.
12205            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12206
12207            // Safety:
12208            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12209            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12210            //   envelope_size bytes, there is always sufficient room.
12211            fidl::encoding::encode_in_envelope_optional::<
12212                RegisterBufferCollectionUsages,
12213                fidl::encoding::DefaultFuchsiaResourceDialect,
12214            >(
12215                self.usages.as_ref().map(
12216                    <RegisterBufferCollectionUsages as fidl::encoding::ValueTypeMarker>::borrow,
12217                ),
12218                encoder,
12219                offset + cur_offset,
12220                depth,
12221            )?;
12222
12223            _prev_end_offset = cur_offset + envelope_size;
12224            if 5 > max_ordinal {
12225                return Ok(());
12226            }
12227
12228            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12229            // are envelope_size bytes.
12230            let cur_offset: usize = (5 - 1) * envelope_size;
12231
12232            // Zero reserved fields.
12233            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12234
12235            // Safety:
12236            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12237            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12238            //   envelope_size bytes, there is always sufficient room.
12239            fidl::encoding::encode_in_envelope_optional::<
12240                fidl::encoding::Endpoint<
12241                    fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem2::BufferCollectionTokenMarker>,
12242                >,
12243                fidl::encoding::DefaultFuchsiaResourceDialect,
12244            >(
12245                self.buffer_collection_token2.as_mut().map(
12246                    <fidl::encoding::Endpoint<
12247                        fidl::endpoints::ClientEnd<
12248                            fidl_fuchsia_sysmem2::BufferCollectionTokenMarker,
12249                        >,
12250                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
12251                ),
12252                encoder,
12253                offset + cur_offset,
12254                depth,
12255            )?;
12256
12257            _prev_end_offset = cur_offset + envelope_size;
12258
12259            Ok(())
12260        }
12261    }
12262
12263    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
12264        for RegisterBufferCollectionArgs
12265    {
12266        #[inline(always)]
12267        fn new_empty() -> Self {
12268            Self::default()
12269        }
12270
12271        unsafe fn decode(
12272            &mut self,
12273            decoder: &mut fidl::encoding::Decoder<
12274                '_,
12275                fidl::encoding::DefaultFuchsiaResourceDialect,
12276            >,
12277            offset: usize,
12278            mut depth: fidl::encoding::Depth,
12279        ) -> fidl::Result<()> {
12280            decoder.debug_check_bounds::<Self>(offset);
12281            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
12282                None => return Err(fidl::Error::NotNullable),
12283                Some(len) => len,
12284            };
12285            // Calling decoder.out_of_line_offset(0) is not allowed.
12286            if len == 0 {
12287                return Ok(());
12288            };
12289            depth.increment()?;
12290            let envelope_size = 8;
12291            let bytes_len = len * envelope_size;
12292            let offset = decoder.out_of_line_offset(bytes_len)?;
12293            // Decode the envelope for each type.
12294            let mut _next_ordinal_to_read = 0;
12295            let mut next_offset = offset;
12296            let end_offset = offset + bytes_len;
12297            _next_ordinal_to_read += 1;
12298            if next_offset >= end_offset {
12299                return Ok(());
12300            }
12301
12302            // Decode unknown envelopes for gaps in ordinals.
12303            while _next_ordinal_to_read < 1 {
12304                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12305                _next_ordinal_to_read += 1;
12306                next_offset += envelope_size;
12307            }
12308
12309            let next_out_of_line = decoder.next_out_of_line();
12310            let handles_before = decoder.remaining_handles();
12311            if let Some((inlined, num_bytes, num_handles)) =
12312                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12313            {
12314                let member_inline_size =
12315                    <BufferCollectionExportToken as fidl::encoding::TypeMarker>::inline_size(
12316                        decoder.context,
12317                    );
12318                if inlined != (member_inline_size <= 4) {
12319                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12320                }
12321                let inner_offset;
12322                let mut inner_depth = depth.clone();
12323                if inlined {
12324                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12325                    inner_offset = next_offset;
12326                } else {
12327                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12328                    inner_depth.increment()?;
12329                }
12330                let val_ref = self.export_token.get_or_insert_with(|| {
12331                    fidl::new_empty!(
12332                        BufferCollectionExportToken,
12333                        fidl::encoding::DefaultFuchsiaResourceDialect
12334                    )
12335                });
12336                fidl::decode!(
12337                    BufferCollectionExportToken,
12338                    fidl::encoding::DefaultFuchsiaResourceDialect,
12339                    val_ref,
12340                    decoder,
12341                    inner_offset,
12342                    inner_depth
12343                )?;
12344                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12345                {
12346                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12347                }
12348                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12349                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12350                }
12351            }
12352
12353            next_offset += envelope_size;
12354            _next_ordinal_to_read += 1;
12355            if next_offset >= end_offset {
12356                return Ok(());
12357            }
12358
12359            // Decode unknown envelopes for gaps in ordinals.
12360            while _next_ordinal_to_read < 2 {
12361                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12362                _next_ordinal_to_read += 1;
12363                next_offset += envelope_size;
12364            }
12365
12366            let next_out_of_line = decoder.next_out_of_line();
12367            let handles_before = decoder.remaining_handles();
12368            if let Some((inlined, num_bytes, num_handles)) =
12369                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12370            {
12371                let member_inline_size = <fidl::encoding::Endpoint<
12372                    fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem::BufferCollectionTokenMarker>,
12373                > as fidl::encoding::TypeMarker>::inline_size(
12374                    decoder.context
12375                );
12376                if inlined != (member_inline_size <= 4) {
12377                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12378                }
12379                let inner_offset;
12380                let mut inner_depth = depth.clone();
12381                if inlined {
12382                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12383                    inner_offset = next_offset;
12384                } else {
12385                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12386                    inner_depth.increment()?;
12387                }
12388                let val_ref = self.buffer_collection_token.get_or_insert_with(|| {
12389                    fidl::new_empty!(
12390                        fidl::encoding::Endpoint<
12391                            fidl::endpoints::ClientEnd<
12392                                fidl_fuchsia_sysmem::BufferCollectionTokenMarker,
12393                            >,
12394                        >,
12395                        fidl::encoding::DefaultFuchsiaResourceDialect
12396                    )
12397                });
12398                fidl::decode!(
12399                    fidl::encoding::Endpoint<
12400                        fidl::endpoints::ClientEnd<
12401                            fidl_fuchsia_sysmem::BufferCollectionTokenMarker,
12402                        >,
12403                    >,
12404                    fidl::encoding::DefaultFuchsiaResourceDialect,
12405                    val_ref,
12406                    decoder,
12407                    inner_offset,
12408                    inner_depth
12409                )?;
12410                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12411                {
12412                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12413                }
12414                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12415                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12416                }
12417            }
12418
12419            next_offset += envelope_size;
12420            _next_ordinal_to_read += 1;
12421            if next_offset >= end_offset {
12422                return Ok(());
12423            }
12424
12425            // Decode unknown envelopes for gaps in ordinals.
12426            while _next_ordinal_to_read < 3 {
12427                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12428                _next_ordinal_to_read += 1;
12429                next_offset += envelope_size;
12430            }
12431
12432            let next_out_of_line = decoder.next_out_of_line();
12433            let handles_before = decoder.remaining_handles();
12434            if let Some((inlined, num_bytes, num_handles)) =
12435                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12436            {
12437                let member_inline_size =
12438                    <RegisterBufferCollectionUsage as fidl::encoding::TypeMarker>::inline_size(
12439                        decoder.context,
12440                    );
12441                if inlined != (member_inline_size <= 4) {
12442                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12443                }
12444                let inner_offset;
12445                let mut inner_depth = depth.clone();
12446                if inlined {
12447                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12448                    inner_offset = next_offset;
12449                } else {
12450                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12451                    inner_depth.increment()?;
12452                }
12453                let val_ref = self.usage.get_or_insert_with(|| {
12454                    fidl::new_empty!(
12455                        RegisterBufferCollectionUsage,
12456                        fidl::encoding::DefaultFuchsiaResourceDialect
12457                    )
12458                });
12459                fidl::decode!(
12460                    RegisterBufferCollectionUsage,
12461                    fidl::encoding::DefaultFuchsiaResourceDialect,
12462                    val_ref,
12463                    decoder,
12464                    inner_offset,
12465                    inner_depth
12466                )?;
12467                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12468                {
12469                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12470                }
12471                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12472                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12473                }
12474            }
12475
12476            next_offset += envelope_size;
12477            _next_ordinal_to_read += 1;
12478            if next_offset >= end_offset {
12479                return Ok(());
12480            }
12481
12482            // Decode unknown envelopes for gaps in ordinals.
12483            while _next_ordinal_to_read < 4 {
12484                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12485                _next_ordinal_to_read += 1;
12486                next_offset += envelope_size;
12487            }
12488
12489            let next_out_of_line = decoder.next_out_of_line();
12490            let handles_before = decoder.remaining_handles();
12491            if let Some((inlined, num_bytes, num_handles)) =
12492                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12493            {
12494                let member_inline_size =
12495                    <RegisterBufferCollectionUsages as fidl::encoding::TypeMarker>::inline_size(
12496                        decoder.context,
12497                    );
12498                if inlined != (member_inline_size <= 4) {
12499                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12500                }
12501                let inner_offset;
12502                let mut inner_depth = depth.clone();
12503                if inlined {
12504                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12505                    inner_offset = next_offset;
12506                } else {
12507                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12508                    inner_depth.increment()?;
12509                }
12510                let val_ref = self.usages.get_or_insert_with(|| {
12511                    fidl::new_empty!(
12512                        RegisterBufferCollectionUsages,
12513                        fidl::encoding::DefaultFuchsiaResourceDialect
12514                    )
12515                });
12516                fidl::decode!(
12517                    RegisterBufferCollectionUsages,
12518                    fidl::encoding::DefaultFuchsiaResourceDialect,
12519                    val_ref,
12520                    decoder,
12521                    inner_offset,
12522                    inner_depth
12523                )?;
12524                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12525                {
12526                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12527                }
12528                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12529                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12530                }
12531            }
12532
12533            next_offset += envelope_size;
12534            _next_ordinal_to_read += 1;
12535            if next_offset >= end_offset {
12536                return Ok(());
12537            }
12538
12539            // Decode unknown envelopes for gaps in ordinals.
12540            while _next_ordinal_to_read < 5 {
12541                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12542                _next_ordinal_to_read += 1;
12543                next_offset += envelope_size;
12544            }
12545
12546            let next_out_of_line = decoder.next_out_of_line();
12547            let handles_before = decoder.remaining_handles();
12548            if let Some((inlined, num_bytes, num_handles)) =
12549                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12550            {
12551                let member_inline_size = <fidl::encoding::Endpoint<
12552                    fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem2::BufferCollectionTokenMarker>,
12553                > as fidl::encoding::TypeMarker>::inline_size(
12554                    decoder.context
12555                );
12556                if inlined != (member_inline_size <= 4) {
12557                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12558                }
12559                let inner_offset;
12560                let mut inner_depth = depth.clone();
12561                if inlined {
12562                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12563                    inner_offset = next_offset;
12564                } else {
12565                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12566                    inner_depth.increment()?;
12567                }
12568                let val_ref = self.buffer_collection_token2.get_or_insert_with(|| {
12569                    fidl::new_empty!(
12570                        fidl::encoding::Endpoint<
12571                            fidl::endpoints::ClientEnd<
12572                                fidl_fuchsia_sysmem2::BufferCollectionTokenMarker,
12573                            >,
12574                        >,
12575                        fidl::encoding::DefaultFuchsiaResourceDialect
12576                    )
12577                });
12578                fidl::decode!(
12579                    fidl::encoding::Endpoint<
12580                        fidl::endpoints::ClientEnd<
12581                            fidl_fuchsia_sysmem2::BufferCollectionTokenMarker,
12582                        >,
12583                    >,
12584                    fidl::encoding::DefaultFuchsiaResourceDialect,
12585                    val_ref,
12586                    decoder,
12587                    inner_offset,
12588                    inner_depth
12589                )?;
12590                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12591                {
12592                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12593                }
12594                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12595                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12596                }
12597            }
12598
12599            next_offset += envelope_size;
12600
12601            // Decode the remaining unknown envelopes.
12602            while next_offset < end_offset {
12603                _next_ordinal_to_read += 1;
12604                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12605                next_offset += envelope_size;
12606            }
12607
12608            Ok(())
12609        }
12610    }
12611
12612    impl ScreenCaptureConfig {
12613        #[inline(always)]
12614        fn max_ordinal_present(&self) -> u64 {
12615            if let Some(_) = self.rotation {
12616                return 4;
12617            }
12618            if let Some(_) = self.buffer_count {
12619                return 3;
12620            }
12621            if let Some(_) = self.size {
12622                return 2;
12623            }
12624            if let Some(_) = self.import_token {
12625                return 1;
12626            }
12627            0
12628        }
12629    }
12630
12631    impl fidl::encoding::ResourceTypeMarker for ScreenCaptureConfig {
12632        type Borrowed<'a> = &'a mut Self;
12633        fn take_or_borrow<'a>(
12634            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12635        ) -> Self::Borrowed<'a> {
12636            value
12637        }
12638    }
12639
12640    unsafe impl fidl::encoding::TypeMarker for ScreenCaptureConfig {
12641        type Owned = Self;
12642
12643        #[inline(always)]
12644        fn inline_align(_context: fidl::encoding::Context) -> usize {
12645            8
12646        }
12647
12648        #[inline(always)]
12649        fn inline_size(_context: fidl::encoding::Context) -> usize {
12650            16
12651        }
12652    }
12653
12654    unsafe impl
12655        fidl::encoding::Encode<ScreenCaptureConfig, fidl::encoding::DefaultFuchsiaResourceDialect>
12656        for &mut ScreenCaptureConfig
12657    {
12658        unsafe fn encode(
12659            self,
12660            encoder: &mut fidl::encoding::Encoder<
12661                '_,
12662                fidl::encoding::DefaultFuchsiaResourceDialect,
12663            >,
12664            offset: usize,
12665            mut depth: fidl::encoding::Depth,
12666        ) -> fidl::Result<()> {
12667            encoder.debug_check_bounds::<ScreenCaptureConfig>(offset);
12668            // Vector header
12669            let max_ordinal: u64 = self.max_ordinal_present();
12670            encoder.write_num(max_ordinal, offset);
12671            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
12672            // Calling encoder.out_of_line_offset(0) is not allowed.
12673            if max_ordinal == 0 {
12674                return Ok(());
12675            }
12676            depth.increment()?;
12677            let envelope_size = 8;
12678            let bytes_len = max_ordinal as usize * envelope_size;
12679            #[allow(unused_variables)]
12680            let offset = encoder.out_of_line_offset(bytes_len);
12681            let mut _prev_end_offset: usize = 0;
12682            if 1 > max_ordinal {
12683                return Ok(());
12684            }
12685
12686            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12687            // are envelope_size bytes.
12688            let cur_offset: usize = (1 - 1) * envelope_size;
12689
12690            // Zero reserved fields.
12691            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12692
12693            // Safety:
12694            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12695            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12696            //   envelope_size bytes, there is always sufficient room.
12697            fidl::encoding::encode_in_envelope_optional::<BufferCollectionImportToken, fidl::encoding::DefaultFuchsiaResourceDialect>(
12698            self.import_token.as_mut().map(<BufferCollectionImportToken as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
12699            encoder, offset + cur_offset, depth
12700        )?;
12701
12702            _prev_end_offset = cur_offset + envelope_size;
12703            if 2 > max_ordinal {
12704                return Ok(());
12705            }
12706
12707            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12708            // are envelope_size bytes.
12709            let cur_offset: usize = (2 - 1) * envelope_size;
12710
12711            // Zero reserved fields.
12712            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12713
12714            // Safety:
12715            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12716            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12717            //   envelope_size bytes, there is always sufficient room.
12718            fidl::encoding::encode_in_envelope_optional::<
12719                fidl_fuchsia_math::SizeU,
12720                fidl::encoding::DefaultFuchsiaResourceDialect,
12721            >(
12722                self.size
12723                    .as_ref()
12724                    .map(<fidl_fuchsia_math::SizeU as fidl::encoding::ValueTypeMarker>::borrow),
12725                encoder,
12726                offset + cur_offset,
12727                depth,
12728            )?;
12729
12730            _prev_end_offset = cur_offset + envelope_size;
12731            if 3 > max_ordinal {
12732                return Ok(());
12733            }
12734
12735            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12736            // are envelope_size bytes.
12737            let cur_offset: usize = (3 - 1) * envelope_size;
12738
12739            // Zero reserved fields.
12740            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12741
12742            // Safety:
12743            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12744            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12745            //   envelope_size bytes, there is always sufficient room.
12746            fidl::encoding::encode_in_envelope_optional::<
12747                u32,
12748                fidl::encoding::DefaultFuchsiaResourceDialect,
12749            >(
12750                self.buffer_count.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
12751                encoder,
12752                offset + cur_offset,
12753                depth,
12754            )?;
12755
12756            _prev_end_offset = cur_offset + envelope_size;
12757            if 4 > max_ordinal {
12758                return Ok(());
12759            }
12760
12761            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12762            // are envelope_size bytes.
12763            let cur_offset: usize = (4 - 1) * envelope_size;
12764
12765            // Zero reserved fields.
12766            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12767
12768            // Safety:
12769            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12770            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12771            //   envelope_size bytes, there is always sufficient room.
12772            fidl::encoding::encode_in_envelope_optional::<
12773                Rotation,
12774                fidl::encoding::DefaultFuchsiaResourceDialect,
12775            >(
12776                self.rotation.as_ref().map(<Rotation as fidl::encoding::ValueTypeMarker>::borrow),
12777                encoder,
12778                offset + cur_offset,
12779                depth,
12780            )?;
12781
12782            _prev_end_offset = cur_offset + envelope_size;
12783
12784            Ok(())
12785        }
12786    }
12787
12788    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
12789        for ScreenCaptureConfig
12790    {
12791        #[inline(always)]
12792        fn new_empty() -> Self {
12793            Self::default()
12794        }
12795
12796        unsafe fn decode(
12797            &mut self,
12798            decoder: &mut fidl::encoding::Decoder<
12799                '_,
12800                fidl::encoding::DefaultFuchsiaResourceDialect,
12801            >,
12802            offset: usize,
12803            mut depth: fidl::encoding::Depth,
12804        ) -> fidl::Result<()> {
12805            decoder.debug_check_bounds::<Self>(offset);
12806            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
12807                None => return Err(fidl::Error::NotNullable),
12808                Some(len) => len,
12809            };
12810            // Calling decoder.out_of_line_offset(0) is not allowed.
12811            if len == 0 {
12812                return Ok(());
12813            };
12814            depth.increment()?;
12815            let envelope_size = 8;
12816            let bytes_len = len * envelope_size;
12817            let offset = decoder.out_of_line_offset(bytes_len)?;
12818            // Decode the envelope for each type.
12819            let mut _next_ordinal_to_read = 0;
12820            let mut next_offset = offset;
12821            let end_offset = offset + bytes_len;
12822            _next_ordinal_to_read += 1;
12823            if next_offset >= end_offset {
12824                return Ok(());
12825            }
12826
12827            // Decode unknown envelopes for gaps in ordinals.
12828            while _next_ordinal_to_read < 1 {
12829                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12830                _next_ordinal_to_read += 1;
12831                next_offset += envelope_size;
12832            }
12833
12834            let next_out_of_line = decoder.next_out_of_line();
12835            let handles_before = decoder.remaining_handles();
12836            if let Some((inlined, num_bytes, num_handles)) =
12837                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12838            {
12839                let member_inline_size =
12840                    <BufferCollectionImportToken as fidl::encoding::TypeMarker>::inline_size(
12841                        decoder.context,
12842                    );
12843                if inlined != (member_inline_size <= 4) {
12844                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12845                }
12846                let inner_offset;
12847                let mut inner_depth = depth.clone();
12848                if inlined {
12849                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12850                    inner_offset = next_offset;
12851                } else {
12852                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12853                    inner_depth.increment()?;
12854                }
12855                let val_ref = self.import_token.get_or_insert_with(|| {
12856                    fidl::new_empty!(
12857                        BufferCollectionImportToken,
12858                        fidl::encoding::DefaultFuchsiaResourceDialect
12859                    )
12860                });
12861                fidl::decode!(
12862                    BufferCollectionImportToken,
12863                    fidl::encoding::DefaultFuchsiaResourceDialect,
12864                    val_ref,
12865                    decoder,
12866                    inner_offset,
12867                    inner_depth
12868                )?;
12869                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12870                {
12871                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12872                }
12873                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12874                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12875                }
12876            }
12877
12878            next_offset += envelope_size;
12879            _next_ordinal_to_read += 1;
12880            if next_offset >= end_offset {
12881                return Ok(());
12882            }
12883
12884            // Decode unknown envelopes for gaps in ordinals.
12885            while _next_ordinal_to_read < 2 {
12886                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12887                _next_ordinal_to_read += 1;
12888                next_offset += envelope_size;
12889            }
12890
12891            let next_out_of_line = decoder.next_out_of_line();
12892            let handles_before = decoder.remaining_handles();
12893            if let Some((inlined, num_bytes, num_handles)) =
12894                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12895            {
12896                let member_inline_size =
12897                    <fidl_fuchsia_math::SizeU as fidl::encoding::TypeMarker>::inline_size(
12898                        decoder.context,
12899                    );
12900                if inlined != (member_inline_size <= 4) {
12901                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12902                }
12903                let inner_offset;
12904                let mut inner_depth = depth.clone();
12905                if inlined {
12906                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12907                    inner_offset = next_offset;
12908                } else {
12909                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12910                    inner_depth.increment()?;
12911                }
12912                let val_ref = self.size.get_or_insert_with(|| {
12913                    fidl::new_empty!(
12914                        fidl_fuchsia_math::SizeU,
12915                        fidl::encoding::DefaultFuchsiaResourceDialect
12916                    )
12917                });
12918                fidl::decode!(
12919                    fidl_fuchsia_math::SizeU,
12920                    fidl::encoding::DefaultFuchsiaResourceDialect,
12921                    val_ref,
12922                    decoder,
12923                    inner_offset,
12924                    inner_depth
12925                )?;
12926                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12927                {
12928                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12929                }
12930                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12931                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12932                }
12933            }
12934
12935            next_offset += envelope_size;
12936            _next_ordinal_to_read += 1;
12937            if next_offset >= end_offset {
12938                return Ok(());
12939            }
12940
12941            // Decode unknown envelopes for gaps in ordinals.
12942            while _next_ordinal_to_read < 3 {
12943                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12944                _next_ordinal_to_read += 1;
12945                next_offset += envelope_size;
12946            }
12947
12948            let next_out_of_line = decoder.next_out_of_line();
12949            let handles_before = decoder.remaining_handles();
12950            if let Some((inlined, num_bytes, num_handles)) =
12951                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12952            {
12953                let member_inline_size =
12954                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
12955                if inlined != (member_inline_size <= 4) {
12956                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12957                }
12958                let inner_offset;
12959                let mut inner_depth = depth.clone();
12960                if inlined {
12961                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12962                    inner_offset = next_offset;
12963                } else {
12964                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12965                    inner_depth.increment()?;
12966                }
12967                let val_ref = self.buffer_count.get_or_insert_with(|| {
12968                    fidl::new_empty!(u32, fidl::encoding::DefaultFuchsiaResourceDialect)
12969                });
12970                fidl::decode!(
12971                    u32,
12972                    fidl::encoding::DefaultFuchsiaResourceDialect,
12973                    val_ref,
12974                    decoder,
12975                    inner_offset,
12976                    inner_depth
12977                )?;
12978                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12979                {
12980                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12981                }
12982                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12983                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12984                }
12985            }
12986
12987            next_offset += envelope_size;
12988            _next_ordinal_to_read += 1;
12989            if next_offset >= end_offset {
12990                return Ok(());
12991            }
12992
12993            // Decode unknown envelopes for gaps in ordinals.
12994            while _next_ordinal_to_read < 4 {
12995                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12996                _next_ordinal_to_read += 1;
12997                next_offset += envelope_size;
12998            }
12999
13000            let next_out_of_line = decoder.next_out_of_line();
13001            let handles_before = decoder.remaining_handles();
13002            if let Some((inlined, num_bytes, num_handles)) =
13003                fidl::encoding::decode_envelope_header(decoder, next_offset)?
13004            {
13005                let member_inline_size =
13006                    <Rotation as fidl::encoding::TypeMarker>::inline_size(decoder.context);
13007                if inlined != (member_inline_size <= 4) {
13008                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
13009                }
13010                let inner_offset;
13011                let mut inner_depth = depth.clone();
13012                if inlined {
13013                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
13014                    inner_offset = next_offset;
13015                } else {
13016                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
13017                    inner_depth.increment()?;
13018                }
13019                let val_ref = self.rotation.get_or_insert_with(|| {
13020                    fidl::new_empty!(Rotation, fidl::encoding::DefaultFuchsiaResourceDialect)
13021                });
13022                fidl::decode!(
13023                    Rotation,
13024                    fidl::encoding::DefaultFuchsiaResourceDialect,
13025                    val_ref,
13026                    decoder,
13027                    inner_offset,
13028                    inner_depth
13029                )?;
13030                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
13031                {
13032                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
13033                }
13034                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
13035                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
13036                }
13037            }
13038
13039            next_offset += envelope_size;
13040
13041            // Decode the remaining unknown envelopes.
13042            while next_offset < end_offset {
13043                _next_ordinal_to_read += 1;
13044                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13045                next_offset += envelope_size;
13046            }
13047
13048            Ok(())
13049        }
13050    }
13051
13052    impl ScreenshotTakeFileRequest {
13053        #[inline(always)]
13054        fn max_ordinal_present(&self) -> u64 {
13055            if let Some(_) = self.format {
13056                return 1;
13057            }
13058            0
13059        }
13060    }
13061
13062    impl fidl::encoding::ResourceTypeMarker for ScreenshotTakeFileRequest {
13063        type Borrowed<'a> = &'a mut Self;
13064        fn take_or_borrow<'a>(
13065            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
13066        ) -> Self::Borrowed<'a> {
13067            value
13068        }
13069    }
13070
13071    unsafe impl fidl::encoding::TypeMarker for ScreenshotTakeFileRequest {
13072        type Owned = Self;
13073
13074        #[inline(always)]
13075        fn inline_align(_context: fidl::encoding::Context) -> usize {
13076            8
13077        }
13078
13079        #[inline(always)]
13080        fn inline_size(_context: fidl::encoding::Context) -> usize {
13081            16
13082        }
13083    }
13084
13085    unsafe impl
13086        fidl::encoding::Encode<
13087            ScreenshotTakeFileRequest,
13088            fidl::encoding::DefaultFuchsiaResourceDialect,
13089        > for &mut ScreenshotTakeFileRequest
13090    {
13091        unsafe fn encode(
13092            self,
13093            encoder: &mut fidl::encoding::Encoder<
13094                '_,
13095                fidl::encoding::DefaultFuchsiaResourceDialect,
13096            >,
13097            offset: usize,
13098            mut depth: fidl::encoding::Depth,
13099        ) -> fidl::Result<()> {
13100            encoder.debug_check_bounds::<ScreenshotTakeFileRequest>(offset);
13101            // Vector header
13102            let max_ordinal: u64 = self.max_ordinal_present();
13103            encoder.write_num(max_ordinal, offset);
13104            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
13105            // Calling encoder.out_of_line_offset(0) is not allowed.
13106            if max_ordinal == 0 {
13107                return Ok(());
13108            }
13109            depth.increment()?;
13110            let envelope_size = 8;
13111            let bytes_len = max_ordinal as usize * envelope_size;
13112            #[allow(unused_variables)]
13113            let offset = encoder.out_of_line_offset(bytes_len);
13114            let mut _prev_end_offset: usize = 0;
13115            if 1 > max_ordinal {
13116                return Ok(());
13117            }
13118
13119            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
13120            // are envelope_size bytes.
13121            let cur_offset: usize = (1 - 1) * envelope_size;
13122
13123            // Zero reserved fields.
13124            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
13125
13126            // Safety:
13127            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
13128            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
13129            //   envelope_size bytes, there is always sufficient room.
13130            fidl::encoding::encode_in_envelope_optional::<
13131                ScreenshotFormat,
13132                fidl::encoding::DefaultFuchsiaResourceDialect,
13133            >(
13134                self.format
13135                    .as_ref()
13136                    .map(<ScreenshotFormat as fidl::encoding::ValueTypeMarker>::borrow),
13137                encoder,
13138                offset + cur_offset,
13139                depth,
13140            )?;
13141
13142            _prev_end_offset = cur_offset + envelope_size;
13143
13144            Ok(())
13145        }
13146    }
13147
13148    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
13149        for ScreenshotTakeFileRequest
13150    {
13151        #[inline(always)]
13152        fn new_empty() -> Self {
13153            Self::default()
13154        }
13155
13156        unsafe fn decode(
13157            &mut self,
13158            decoder: &mut fidl::encoding::Decoder<
13159                '_,
13160                fidl::encoding::DefaultFuchsiaResourceDialect,
13161            >,
13162            offset: usize,
13163            mut depth: fidl::encoding::Depth,
13164        ) -> fidl::Result<()> {
13165            decoder.debug_check_bounds::<Self>(offset);
13166            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
13167                None => return Err(fidl::Error::NotNullable),
13168                Some(len) => len,
13169            };
13170            // Calling decoder.out_of_line_offset(0) is not allowed.
13171            if len == 0 {
13172                return Ok(());
13173            };
13174            depth.increment()?;
13175            let envelope_size = 8;
13176            let bytes_len = len * envelope_size;
13177            let offset = decoder.out_of_line_offset(bytes_len)?;
13178            // Decode the envelope for each type.
13179            let mut _next_ordinal_to_read = 0;
13180            let mut next_offset = offset;
13181            let end_offset = offset + bytes_len;
13182            _next_ordinal_to_read += 1;
13183            if next_offset >= end_offset {
13184                return Ok(());
13185            }
13186
13187            // Decode unknown envelopes for gaps in ordinals.
13188            while _next_ordinal_to_read < 1 {
13189                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13190                _next_ordinal_to_read += 1;
13191                next_offset += envelope_size;
13192            }
13193
13194            let next_out_of_line = decoder.next_out_of_line();
13195            let handles_before = decoder.remaining_handles();
13196            if let Some((inlined, num_bytes, num_handles)) =
13197                fidl::encoding::decode_envelope_header(decoder, next_offset)?
13198            {
13199                let member_inline_size =
13200                    <ScreenshotFormat as fidl::encoding::TypeMarker>::inline_size(decoder.context);
13201                if inlined != (member_inline_size <= 4) {
13202                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
13203                }
13204                let inner_offset;
13205                let mut inner_depth = depth.clone();
13206                if inlined {
13207                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
13208                    inner_offset = next_offset;
13209                } else {
13210                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
13211                    inner_depth.increment()?;
13212                }
13213                let val_ref = self.format.get_or_insert_with(|| {
13214                    fidl::new_empty!(
13215                        ScreenshotFormat,
13216                        fidl::encoding::DefaultFuchsiaResourceDialect
13217                    )
13218                });
13219                fidl::decode!(
13220                    ScreenshotFormat,
13221                    fidl::encoding::DefaultFuchsiaResourceDialect,
13222                    val_ref,
13223                    decoder,
13224                    inner_offset,
13225                    inner_depth
13226                )?;
13227                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
13228                {
13229                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
13230                }
13231                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
13232                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
13233                }
13234            }
13235
13236            next_offset += envelope_size;
13237
13238            // Decode the remaining unknown envelopes.
13239            while next_offset < end_offset {
13240                _next_ordinal_to_read += 1;
13241                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13242                next_offset += envelope_size;
13243            }
13244
13245            Ok(())
13246        }
13247    }
13248
13249    impl ScreenshotTakeFileResponse {
13250        #[inline(always)]
13251        fn max_ordinal_present(&self) -> u64 {
13252            if let Some(_) = self.size {
13253                return 2;
13254            }
13255            if let Some(_) = self.file {
13256                return 1;
13257            }
13258            0
13259        }
13260    }
13261
13262    impl fidl::encoding::ResourceTypeMarker for ScreenshotTakeFileResponse {
13263        type Borrowed<'a> = &'a mut Self;
13264        fn take_or_borrow<'a>(
13265            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
13266        ) -> Self::Borrowed<'a> {
13267            value
13268        }
13269    }
13270
13271    unsafe impl fidl::encoding::TypeMarker for ScreenshotTakeFileResponse {
13272        type Owned = Self;
13273
13274        #[inline(always)]
13275        fn inline_align(_context: fidl::encoding::Context) -> usize {
13276            8
13277        }
13278
13279        #[inline(always)]
13280        fn inline_size(_context: fidl::encoding::Context) -> usize {
13281            16
13282        }
13283    }
13284
13285    unsafe impl
13286        fidl::encoding::Encode<
13287            ScreenshotTakeFileResponse,
13288            fidl::encoding::DefaultFuchsiaResourceDialect,
13289        > for &mut ScreenshotTakeFileResponse
13290    {
13291        unsafe fn encode(
13292            self,
13293            encoder: &mut fidl::encoding::Encoder<
13294                '_,
13295                fidl::encoding::DefaultFuchsiaResourceDialect,
13296            >,
13297            offset: usize,
13298            mut depth: fidl::encoding::Depth,
13299        ) -> fidl::Result<()> {
13300            encoder.debug_check_bounds::<ScreenshotTakeFileResponse>(offset);
13301            // Vector header
13302            let max_ordinal: u64 = self.max_ordinal_present();
13303            encoder.write_num(max_ordinal, offset);
13304            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
13305            // Calling encoder.out_of_line_offset(0) is not allowed.
13306            if max_ordinal == 0 {
13307                return Ok(());
13308            }
13309            depth.increment()?;
13310            let envelope_size = 8;
13311            let bytes_len = max_ordinal as usize * envelope_size;
13312            #[allow(unused_variables)]
13313            let offset = encoder.out_of_line_offset(bytes_len);
13314            let mut _prev_end_offset: usize = 0;
13315            if 1 > max_ordinal {
13316                return Ok(());
13317            }
13318
13319            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
13320            // are envelope_size bytes.
13321            let cur_offset: usize = (1 - 1) * envelope_size;
13322
13323            // Zero reserved fields.
13324            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
13325
13326            // Safety:
13327            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
13328            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
13329            //   envelope_size bytes, there is always sufficient room.
13330            fidl::encoding::encode_in_envelope_optional::<
13331                fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>>,
13332                fidl::encoding::DefaultFuchsiaResourceDialect,
13333            >(
13334                self.file.as_mut().map(
13335                    <fidl::encoding::Endpoint<
13336                        fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
13337                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
13338                ),
13339                encoder,
13340                offset + cur_offset,
13341                depth,
13342            )?;
13343
13344            _prev_end_offset = cur_offset + envelope_size;
13345            if 2 > max_ordinal {
13346                return Ok(());
13347            }
13348
13349            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
13350            // are envelope_size bytes.
13351            let cur_offset: usize = (2 - 1) * envelope_size;
13352
13353            // Zero reserved fields.
13354            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
13355
13356            // Safety:
13357            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
13358            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
13359            //   envelope_size bytes, there is always sufficient room.
13360            fidl::encoding::encode_in_envelope_optional::<
13361                fidl_fuchsia_math::SizeU,
13362                fidl::encoding::DefaultFuchsiaResourceDialect,
13363            >(
13364                self.size
13365                    .as_ref()
13366                    .map(<fidl_fuchsia_math::SizeU as fidl::encoding::ValueTypeMarker>::borrow),
13367                encoder,
13368                offset + cur_offset,
13369                depth,
13370            )?;
13371
13372            _prev_end_offset = cur_offset + envelope_size;
13373
13374            Ok(())
13375        }
13376    }
13377
13378    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
13379        for ScreenshotTakeFileResponse
13380    {
13381        #[inline(always)]
13382        fn new_empty() -> Self {
13383            Self::default()
13384        }
13385
13386        unsafe fn decode(
13387            &mut self,
13388            decoder: &mut fidl::encoding::Decoder<
13389                '_,
13390                fidl::encoding::DefaultFuchsiaResourceDialect,
13391            >,
13392            offset: usize,
13393            mut depth: fidl::encoding::Depth,
13394        ) -> fidl::Result<()> {
13395            decoder.debug_check_bounds::<Self>(offset);
13396            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
13397                None => return Err(fidl::Error::NotNullable),
13398                Some(len) => len,
13399            };
13400            // Calling decoder.out_of_line_offset(0) is not allowed.
13401            if len == 0 {
13402                return Ok(());
13403            };
13404            depth.increment()?;
13405            let envelope_size = 8;
13406            let bytes_len = len * envelope_size;
13407            let offset = decoder.out_of_line_offset(bytes_len)?;
13408            // Decode the envelope for each type.
13409            let mut _next_ordinal_to_read = 0;
13410            let mut next_offset = offset;
13411            let end_offset = offset + bytes_len;
13412            _next_ordinal_to_read += 1;
13413            if next_offset >= end_offset {
13414                return Ok(());
13415            }
13416
13417            // Decode unknown envelopes for gaps in ordinals.
13418            while _next_ordinal_to_read < 1 {
13419                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13420                _next_ordinal_to_read += 1;
13421                next_offset += envelope_size;
13422            }
13423
13424            let next_out_of_line = decoder.next_out_of_line();
13425            let handles_before = decoder.remaining_handles();
13426            if let Some((inlined, num_bytes, num_handles)) =
13427                fidl::encoding::decode_envelope_header(decoder, next_offset)?
13428            {
13429                let member_inline_size = <fidl::encoding::Endpoint<
13430                    fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
13431                > as fidl::encoding::TypeMarker>::inline_size(
13432                    decoder.context
13433                );
13434                if inlined != (member_inline_size <= 4) {
13435                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
13436                }
13437                let inner_offset;
13438                let mut inner_depth = depth.clone();
13439                if inlined {
13440                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
13441                    inner_offset = next_offset;
13442                } else {
13443                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
13444                    inner_depth.increment()?;
13445                }
13446                let val_ref = self.file.get_or_insert_with(|| {
13447                    fidl::new_empty!(
13448                        fidl::encoding::Endpoint<
13449                            fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
13450                        >,
13451                        fidl::encoding::DefaultFuchsiaResourceDialect
13452                    )
13453                });
13454                fidl::decode!(
13455                    fidl::encoding::Endpoint<
13456                        fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
13457                    >,
13458                    fidl::encoding::DefaultFuchsiaResourceDialect,
13459                    val_ref,
13460                    decoder,
13461                    inner_offset,
13462                    inner_depth
13463                )?;
13464                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
13465                {
13466                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
13467                }
13468                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
13469                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
13470                }
13471            }
13472
13473            next_offset += envelope_size;
13474            _next_ordinal_to_read += 1;
13475            if next_offset >= end_offset {
13476                return Ok(());
13477            }
13478
13479            // Decode unknown envelopes for gaps in ordinals.
13480            while _next_ordinal_to_read < 2 {
13481                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13482                _next_ordinal_to_read += 1;
13483                next_offset += envelope_size;
13484            }
13485
13486            let next_out_of_line = decoder.next_out_of_line();
13487            let handles_before = decoder.remaining_handles();
13488            if let Some((inlined, num_bytes, num_handles)) =
13489                fidl::encoding::decode_envelope_header(decoder, next_offset)?
13490            {
13491                let member_inline_size =
13492                    <fidl_fuchsia_math::SizeU as fidl::encoding::TypeMarker>::inline_size(
13493                        decoder.context,
13494                    );
13495                if inlined != (member_inline_size <= 4) {
13496                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
13497                }
13498                let inner_offset;
13499                let mut inner_depth = depth.clone();
13500                if inlined {
13501                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
13502                    inner_offset = next_offset;
13503                } else {
13504                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
13505                    inner_depth.increment()?;
13506                }
13507                let val_ref = self.size.get_or_insert_with(|| {
13508                    fidl::new_empty!(
13509                        fidl_fuchsia_math::SizeU,
13510                        fidl::encoding::DefaultFuchsiaResourceDialect
13511                    )
13512                });
13513                fidl::decode!(
13514                    fidl_fuchsia_math::SizeU,
13515                    fidl::encoding::DefaultFuchsiaResourceDialect,
13516                    val_ref,
13517                    decoder,
13518                    inner_offset,
13519                    inner_depth
13520                )?;
13521                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
13522                {
13523                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
13524                }
13525                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
13526                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
13527                }
13528            }
13529
13530            next_offset += envelope_size;
13531
13532            // Decode the remaining unknown envelopes.
13533            while next_offset < end_offset {
13534                _next_ordinal_to_read += 1;
13535                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13536                next_offset += envelope_size;
13537            }
13538
13539            Ok(())
13540        }
13541    }
13542
13543    impl ScreenshotTakeRequest {
13544        #[inline(always)]
13545        fn max_ordinal_present(&self) -> u64 {
13546            if let Some(_) = self.format {
13547                return 1;
13548            }
13549            0
13550        }
13551    }
13552
13553    impl fidl::encoding::ResourceTypeMarker for ScreenshotTakeRequest {
13554        type Borrowed<'a> = &'a mut Self;
13555        fn take_or_borrow<'a>(
13556            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
13557        ) -> Self::Borrowed<'a> {
13558            value
13559        }
13560    }
13561
13562    unsafe impl fidl::encoding::TypeMarker for ScreenshotTakeRequest {
13563        type Owned = Self;
13564
13565        #[inline(always)]
13566        fn inline_align(_context: fidl::encoding::Context) -> usize {
13567            8
13568        }
13569
13570        #[inline(always)]
13571        fn inline_size(_context: fidl::encoding::Context) -> usize {
13572            16
13573        }
13574    }
13575
13576    unsafe impl
13577        fidl::encoding::Encode<ScreenshotTakeRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
13578        for &mut ScreenshotTakeRequest
13579    {
13580        unsafe fn encode(
13581            self,
13582            encoder: &mut fidl::encoding::Encoder<
13583                '_,
13584                fidl::encoding::DefaultFuchsiaResourceDialect,
13585            >,
13586            offset: usize,
13587            mut depth: fidl::encoding::Depth,
13588        ) -> fidl::Result<()> {
13589            encoder.debug_check_bounds::<ScreenshotTakeRequest>(offset);
13590            // Vector header
13591            let max_ordinal: u64 = self.max_ordinal_present();
13592            encoder.write_num(max_ordinal, offset);
13593            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
13594            // Calling encoder.out_of_line_offset(0) is not allowed.
13595            if max_ordinal == 0 {
13596                return Ok(());
13597            }
13598            depth.increment()?;
13599            let envelope_size = 8;
13600            let bytes_len = max_ordinal as usize * envelope_size;
13601            #[allow(unused_variables)]
13602            let offset = encoder.out_of_line_offset(bytes_len);
13603            let mut _prev_end_offset: usize = 0;
13604            if 1 > max_ordinal {
13605                return Ok(());
13606            }
13607
13608            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
13609            // are envelope_size bytes.
13610            let cur_offset: usize = (1 - 1) * envelope_size;
13611
13612            // Zero reserved fields.
13613            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
13614
13615            // Safety:
13616            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
13617            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
13618            //   envelope_size bytes, there is always sufficient room.
13619            fidl::encoding::encode_in_envelope_optional::<
13620                ScreenshotFormat,
13621                fidl::encoding::DefaultFuchsiaResourceDialect,
13622            >(
13623                self.format
13624                    .as_ref()
13625                    .map(<ScreenshotFormat as fidl::encoding::ValueTypeMarker>::borrow),
13626                encoder,
13627                offset + cur_offset,
13628                depth,
13629            )?;
13630
13631            _prev_end_offset = cur_offset + envelope_size;
13632
13633            Ok(())
13634        }
13635    }
13636
13637    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
13638        for ScreenshotTakeRequest
13639    {
13640        #[inline(always)]
13641        fn new_empty() -> Self {
13642            Self::default()
13643        }
13644
13645        unsafe fn decode(
13646            &mut self,
13647            decoder: &mut fidl::encoding::Decoder<
13648                '_,
13649                fidl::encoding::DefaultFuchsiaResourceDialect,
13650            >,
13651            offset: usize,
13652            mut depth: fidl::encoding::Depth,
13653        ) -> fidl::Result<()> {
13654            decoder.debug_check_bounds::<Self>(offset);
13655            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
13656                None => return Err(fidl::Error::NotNullable),
13657                Some(len) => len,
13658            };
13659            // Calling decoder.out_of_line_offset(0) is not allowed.
13660            if len == 0 {
13661                return Ok(());
13662            };
13663            depth.increment()?;
13664            let envelope_size = 8;
13665            let bytes_len = len * envelope_size;
13666            let offset = decoder.out_of_line_offset(bytes_len)?;
13667            // Decode the envelope for each type.
13668            let mut _next_ordinal_to_read = 0;
13669            let mut next_offset = offset;
13670            let end_offset = offset + bytes_len;
13671            _next_ordinal_to_read += 1;
13672            if next_offset >= end_offset {
13673                return Ok(());
13674            }
13675
13676            // Decode unknown envelopes for gaps in ordinals.
13677            while _next_ordinal_to_read < 1 {
13678                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13679                _next_ordinal_to_read += 1;
13680                next_offset += envelope_size;
13681            }
13682
13683            let next_out_of_line = decoder.next_out_of_line();
13684            let handles_before = decoder.remaining_handles();
13685            if let Some((inlined, num_bytes, num_handles)) =
13686                fidl::encoding::decode_envelope_header(decoder, next_offset)?
13687            {
13688                let member_inline_size =
13689                    <ScreenshotFormat as fidl::encoding::TypeMarker>::inline_size(decoder.context);
13690                if inlined != (member_inline_size <= 4) {
13691                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
13692                }
13693                let inner_offset;
13694                let mut inner_depth = depth.clone();
13695                if inlined {
13696                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
13697                    inner_offset = next_offset;
13698                } else {
13699                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
13700                    inner_depth.increment()?;
13701                }
13702                let val_ref = self.format.get_or_insert_with(|| {
13703                    fidl::new_empty!(
13704                        ScreenshotFormat,
13705                        fidl::encoding::DefaultFuchsiaResourceDialect
13706                    )
13707                });
13708                fidl::decode!(
13709                    ScreenshotFormat,
13710                    fidl::encoding::DefaultFuchsiaResourceDialect,
13711                    val_ref,
13712                    decoder,
13713                    inner_offset,
13714                    inner_depth
13715                )?;
13716                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
13717                {
13718                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
13719                }
13720                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
13721                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
13722                }
13723            }
13724
13725            next_offset += envelope_size;
13726
13727            // Decode the remaining unknown envelopes.
13728            while next_offset < end_offset {
13729                _next_ordinal_to_read += 1;
13730                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13731                next_offset += envelope_size;
13732            }
13733
13734            Ok(())
13735        }
13736    }
13737
13738    impl ScreenshotTakeResponse {
13739        #[inline(always)]
13740        fn max_ordinal_present(&self) -> u64 {
13741            if let Some(_) = self.size {
13742                return 2;
13743            }
13744            if let Some(_) = self.vmo {
13745                return 1;
13746            }
13747            0
13748        }
13749    }
13750
13751    impl fidl::encoding::ResourceTypeMarker for ScreenshotTakeResponse {
13752        type Borrowed<'a> = &'a mut Self;
13753        fn take_or_borrow<'a>(
13754            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
13755        ) -> Self::Borrowed<'a> {
13756            value
13757        }
13758    }
13759
13760    unsafe impl fidl::encoding::TypeMarker for ScreenshotTakeResponse {
13761        type Owned = Self;
13762
13763        #[inline(always)]
13764        fn inline_align(_context: fidl::encoding::Context) -> usize {
13765            8
13766        }
13767
13768        #[inline(always)]
13769        fn inline_size(_context: fidl::encoding::Context) -> usize {
13770            16
13771        }
13772    }
13773
13774    unsafe impl
13775        fidl::encoding::Encode<
13776            ScreenshotTakeResponse,
13777            fidl::encoding::DefaultFuchsiaResourceDialect,
13778        > for &mut ScreenshotTakeResponse
13779    {
13780        unsafe fn encode(
13781            self,
13782            encoder: &mut fidl::encoding::Encoder<
13783                '_,
13784                fidl::encoding::DefaultFuchsiaResourceDialect,
13785            >,
13786            offset: usize,
13787            mut depth: fidl::encoding::Depth,
13788        ) -> fidl::Result<()> {
13789            encoder.debug_check_bounds::<ScreenshotTakeResponse>(offset);
13790            // Vector header
13791            let max_ordinal: u64 = self.max_ordinal_present();
13792            encoder.write_num(max_ordinal, offset);
13793            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
13794            // Calling encoder.out_of_line_offset(0) is not allowed.
13795            if max_ordinal == 0 {
13796                return Ok(());
13797            }
13798            depth.increment()?;
13799            let envelope_size = 8;
13800            let bytes_len = max_ordinal as usize * envelope_size;
13801            #[allow(unused_variables)]
13802            let offset = encoder.out_of_line_offset(bytes_len);
13803            let mut _prev_end_offset: usize = 0;
13804            if 1 > max_ordinal {
13805                return Ok(());
13806            }
13807
13808            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
13809            // are envelope_size bytes.
13810            let cur_offset: usize = (1 - 1) * envelope_size;
13811
13812            // Zero reserved fields.
13813            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
13814
13815            // Safety:
13816            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
13817            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
13818            //   envelope_size bytes, there is always sufficient room.
13819            fidl::encoding::encode_in_envelope_optional::<
13820                fidl::encoding::HandleType<
13821                    fidl::Vmo,
13822                    { fidl::ObjectType::VMO.into_raw() },
13823                    2147483648,
13824                >,
13825                fidl::encoding::DefaultFuchsiaResourceDialect,
13826            >(
13827                self.vmo.as_mut().map(
13828                    <fidl::encoding::HandleType<
13829                        fidl::Vmo,
13830                        { fidl::ObjectType::VMO.into_raw() },
13831                        2147483648,
13832                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
13833                ),
13834                encoder,
13835                offset + cur_offset,
13836                depth,
13837            )?;
13838
13839            _prev_end_offset = cur_offset + envelope_size;
13840            if 2 > max_ordinal {
13841                return Ok(());
13842            }
13843
13844            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
13845            // are envelope_size bytes.
13846            let cur_offset: usize = (2 - 1) * envelope_size;
13847
13848            // Zero reserved fields.
13849            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
13850
13851            // Safety:
13852            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
13853            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
13854            //   envelope_size bytes, there is always sufficient room.
13855            fidl::encoding::encode_in_envelope_optional::<
13856                fidl_fuchsia_math::SizeU,
13857                fidl::encoding::DefaultFuchsiaResourceDialect,
13858            >(
13859                self.size
13860                    .as_ref()
13861                    .map(<fidl_fuchsia_math::SizeU as fidl::encoding::ValueTypeMarker>::borrow),
13862                encoder,
13863                offset + cur_offset,
13864                depth,
13865            )?;
13866
13867            _prev_end_offset = cur_offset + envelope_size;
13868
13869            Ok(())
13870        }
13871    }
13872
13873    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
13874        for ScreenshotTakeResponse
13875    {
13876        #[inline(always)]
13877        fn new_empty() -> Self {
13878            Self::default()
13879        }
13880
13881        unsafe fn decode(
13882            &mut self,
13883            decoder: &mut fidl::encoding::Decoder<
13884                '_,
13885                fidl::encoding::DefaultFuchsiaResourceDialect,
13886            >,
13887            offset: usize,
13888            mut depth: fidl::encoding::Depth,
13889        ) -> fidl::Result<()> {
13890            decoder.debug_check_bounds::<Self>(offset);
13891            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
13892                None => return Err(fidl::Error::NotNullable),
13893                Some(len) => len,
13894            };
13895            // Calling decoder.out_of_line_offset(0) is not allowed.
13896            if len == 0 {
13897                return Ok(());
13898            };
13899            depth.increment()?;
13900            let envelope_size = 8;
13901            let bytes_len = len * envelope_size;
13902            let offset = decoder.out_of_line_offset(bytes_len)?;
13903            // Decode the envelope for each type.
13904            let mut _next_ordinal_to_read = 0;
13905            let mut next_offset = offset;
13906            let end_offset = offset + bytes_len;
13907            _next_ordinal_to_read += 1;
13908            if next_offset >= end_offset {
13909                return Ok(());
13910            }
13911
13912            // Decode unknown envelopes for gaps in ordinals.
13913            while _next_ordinal_to_read < 1 {
13914                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13915                _next_ordinal_to_read += 1;
13916                next_offset += envelope_size;
13917            }
13918
13919            let next_out_of_line = decoder.next_out_of_line();
13920            let handles_before = decoder.remaining_handles();
13921            if let Some((inlined, num_bytes, num_handles)) =
13922                fidl::encoding::decode_envelope_header(decoder, next_offset)?
13923            {
13924                let member_inline_size = <fidl::encoding::HandleType<
13925                    fidl::Vmo,
13926                    { fidl::ObjectType::VMO.into_raw() },
13927                    2147483648,
13928                > as fidl::encoding::TypeMarker>::inline_size(
13929                    decoder.context
13930                );
13931                if inlined != (member_inline_size <= 4) {
13932                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
13933                }
13934                let inner_offset;
13935                let mut inner_depth = depth.clone();
13936                if inlined {
13937                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
13938                    inner_offset = next_offset;
13939                } else {
13940                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
13941                    inner_depth.increment()?;
13942                }
13943                let val_ref =
13944                self.vmo.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
13945                fidl::decode!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
13946                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
13947                {
13948                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
13949                }
13950                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
13951                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
13952                }
13953            }
13954
13955            next_offset += envelope_size;
13956            _next_ordinal_to_read += 1;
13957            if next_offset >= end_offset {
13958                return Ok(());
13959            }
13960
13961            // Decode unknown envelopes for gaps in ordinals.
13962            while _next_ordinal_to_read < 2 {
13963                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13964                _next_ordinal_to_read += 1;
13965                next_offset += envelope_size;
13966            }
13967
13968            let next_out_of_line = decoder.next_out_of_line();
13969            let handles_before = decoder.remaining_handles();
13970            if let Some((inlined, num_bytes, num_handles)) =
13971                fidl::encoding::decode_envelope_header(decoder, next_offset)?
13972            {
13973                let member_inline_size =
13974                    <fidl_fuchsia_math::SizeU as fidl::encoding::TypeMarker>::inline_size(
13975                        decoder.context,
13976                    );
13977                if inlined != (member_inline_size <= 4) {
13978                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
13979                }
13980                let inner_offset;
13981                let mut inner_depth = depth.clone();
13982                if inlined {
13983                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
13984                    inner_offset = next_offset;
13985                } else {
13986                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
13987                    inner_depth.increment()?;
13988                }
13989                let val_ref = self.size.get_or_insert_with(|| {
13990                    fidl::new_empty!(
13991                        fidl_fuchsia_math::SizeU,
13992                        fidl::encoding::DefaultFuchsiaResourceDialect
13993                    )
13994                });
13995                fidl::decode!(
13996                    fidl_fuchsia_math::SizeU,
13997                    fidl::encoding::DefaultFuchsiaResourceDialect,
13998                    val_ref,
13999                    decoder,
14000                    inner_offset,
14001                    inner_depth
14002                )?;
14003                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
14004                {
14005                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
14006                }
14007                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
14008                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
14009                }
14010            }
14011
14012            next_offset += envelope_size;
14013
14014            // Decode the remaining unknown envelopes.
14015            while next_offset < end_offset {
14016                _next_ordinal_to_read += 1;
14017                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
14018                next_offset += envelope_size;
14019            }
14020
14021            Ok(())
14022        }
14023    }
14024
14025    impl TrustedFlatlandConfig {
14026        #[inline(always)]
14027        fn max_ordinal_present(&self) -> u64 {
14028            if let Some(_) = self.skips_present_credits {
14029                return 3;
14030            }
14031            if let Some(_) = self.pass_acquire_fences {
14032                return 2;
14033            }
14034            if let Some(_) = self.schedule_asap {
14035                return 1;
14036            }
14037            0
14038        }
14039    }
14040
14041    impl fidl::encoding::ResourceTypeMarker for TrustedFlatlandConfig {
14042        type Borrowed<'a> = &'a mut Self;
14043        fn take_or_borrow<'a>(
14044            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
14045        ) -> Self::Borrowed<'a> {
14046            value
14047        }
14048    }
14049
14050    unsafe impl fidl::encoding::TypeMarker for TrustedFlatlandConfig {
14051        type Owned = Self;
14052
14053        #[inline(always)]
14054        fn inline_align(_context: fidl::encoding::Context) -> usize {
14055            8
14056        }
14057
14058        #[inline(always)]
14059        fn inline_size(_context: fidl::encoding::Context) -> usize {
14060            16
14061        }
14062    }
14063
14064    unsafe impl
14065        fidl::encoding::Encode<TrustedFlatlandConfig, fidl::encoding::DefaultFuchsiaResourceDialect>
14066        for &mut TrustedFlatlandConfig
14067    {
14068        unsafe fn encode(
14069            self,
14070            encoder: &mut fidl::encoding::Encoder<
14071                '_,
14072                fidl::encoding::DefaultFuchsiaResourceDialect,
14073            >,
14074            offset: usize,
14075            mut depth: fidl::encoding::Depth,
14076        ) -> fidl::Result<()> {
14077            encoder.debug_check_bounds::<TrustedFlatlandConfig>(offset);
14078            // Vector header
14079            let max_ordinal: u64 = self.max_ordinal_present();
14080            encoder.write_num(max_ordinal, offset);
14081            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
14082            // Calling encoder.out_of_line_offset(0) is not allowed.
14083            if max_ordinal == 0 {
14084                return Ok(());
14085            }
14086            depth.increment()?;
14087            let envelope_size = 8;
14088            let bytes_len = max_ordinal as usize * envelope_size;
14089            #[allow(unused_variables)]
14090            let offset = encoder.out_of_line_offset(bytes_len);
14091            let mut _prev_end_offset: usize = 0;
14092            if 1 > max_ordinal {
14093                return Ok(());
14094            }
14095
14096            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
14097            // are envelope_size bytes.
14098            let cur_offset: usize = (1 - 1) * envelope_size;
14099
14100            // Zero reserved fields.
14101            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
14102
14103            // Safety:
14104            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
14105            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
14106            //   envelope_size bytes, there is always sufficient room.
14107            fidl::encoding::encode_in_envelope_optional::<
14108                bool,
14109                fidl::encoding::DefaultFuchsiaResourceDialect,
14110            >(
14111                self.schedule_asap.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
14112                encoder,
14113                offset + cur_offset,
14114                depth,
14115            )?;
14116
14117            _prev_end_offset = cur_offset + envelope_size;
14118            if 2 > max_ordinal {
14119                return Ok(());
14120            }
14121
14122            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
14123            // are envelope_size bytes.
14124            let cur_offset: usize = (2 - 1) * envelope_size;
14125
14126            // Zero reserved fields.
14127            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
14128
14129            // Safety:
14130            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
14131            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
14132            //   envelope_size bytes, there is always sufficient room.
14133            fidl::encoding::encode_in_envelope_optional::<
14134                bool,
14135                fidl::encoding::DefaultFuchsiaResourceDialect,
14136            >(
14137                self.pass_acquire_fences
14138                    .as_ref()
14139                    .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
14140                encoder,
14141                offset + cur_offset,
14142                depth,
14143            )?;
14144
14145            _prev_end_offset = cur_offset + envelope_size;
14146            if 3 > max_ordinal {
14147                return Ok(());
14148            }
14149
14150            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
14151            // are envelope_size bytes.
14152            let cur_offset: usize = (3 - 1) * envelope_size;
14153
14154            // Zero reserved fields.
14155            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
14156
14157            // Safety:
14158            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
14159            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
14160            //   envelope_size bytes, there is always sufficient room.
14161            fidl::encoding::encode_in_envelope_optional::<
14162                bool,
14163                fidl::encoding::DefaultFuchsiaResourceDialect,
14164            >(
14165                self.skips_present_credits
14166                    .as_ref()
14167                    .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
14168                encoder,
14169                offset + cur_offset,
14170                depth,
14171            )?;
14172
14173            _prev_end_offset = cur_offset + envelope_size;
14174
14175            Ok(())
14176        }
14177    }
14178
14179    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
14180        for TrustedFlatlandConfig
14181    {
14182        #[inline(always)]
14183        fn new_empty() -> Self {
14184            Self::default()
14185        }
14186
14187        unsafe fn decode(
14188            &mut self,
14189            decoder: &mut fidl::encoding::Decoder<
14190                '_,
14191                fidl::encoding::DefaultFuchsiaResourceDialect,
14192            >,
14193            offset: usize,
14194            mut depth: fidl::encoding::Depth,
14195        ) -> fidl::Result<()> {
14196            decoder.debug_check_bounds::<Self>(offset);
14197            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
14198                None => return Err(fidl::Error::NotNullable),
14199                Some(len) => len,
14200            };
14201            // Calling decoder.out_of_line_offset(0) is not allowed.
14202            if len == 0 {
14203                return Ok(());
14204            };
14205            depth.increment()?;
14206            let envelope_size = 8;
14207            let bytes_len = len * envelope_size;
14208            let offset = decoder.out_of_line_offset(bytes_len)?;
14209            // Decode the envelope for each type.
14210            let mut _next_ordinal_to_read = 0;
14211            let mut next_offset = offset;
14212            let end_offset = offset + bytes_len;
14213            _next_ordinal_to_read += 1;
14214            if next_offset >= end_offset {
14215                return Ok(());
14216            }
14217
14218            // Decode unknown envelopes for gaps in ordinals.
14219            while _next_ordinal_to_read < 1 {
14220                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
14221                _next_ordinal_to_read += 1;
14222                next_offset += envelope_size;
14223            }
14224
14225            let next_out_of_line = decoder.next_out_of_line();
14226            let handles_before = decoder.remaining_handles();
14227            if let Some((inlined, num_bytes, num_handles)) =
14228                fidl::encoding::decode_envelope_header(decoder, next_offset)?
14229            {
14230                let member_inline_size =
14231                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
14232                if inlined != (member_inline_size <= 4) {
14233                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
14234                }
14235                let inner_offset;
14236                let mut inner_depth = depth.clone();
14237                if inlined {
14238                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
14239                    inner_offset = next_offset;
14240                } else {
14241                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
14242                    inner_depth.increment()?;
14243                }
14244                let val_ref = self.schedule_asap.get_or_insert_with(|| {
14245                    fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
14246                });
14247                fidl::decode!(
14248                    bool,
14249                    fidl::encoding::DefaultFuchsiaResourceDialect,
14250                    val_ref,
14251                    decoder,
14252                    inner_offset,
14253                    inner_depth
14254                )?;
14255                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
14256                {
14257                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
14258                }
14259                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
14260                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
14261                }
14262            }
14263
14264            next_offset += envelope_size;
14265            _next_ordinal_to_read += 1;
14266            if next_offset >= end_offset {
14267                return Ok(());
14268            }
14269
14270            // Decode unknown envelopes for gaps in ordinals.
14271            while _next_ordinal_to_read < 2 {
14272                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
14273                _next_ordinal_to_read += 1;
14274                next_offset += envelope_size;
14275            }
14276
14277            let next_out_of_line = decoder.next_out_of_line();
14278            let handles_before = decoder.remaining_handles();
14279            if let Some((inlined, num_bytes, num_handles)) =
14280                fidl::encoding::decode_envelope_header(decoder, next_offset)?
14281            {
14282                let member_inline_size =
14283                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
14284                if inlined != (member_inline_size <= 4) {
14285                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
14286                }
14287                let inner_offset;
14288                let mut inner_depth = depth.clone();
14289                if inlined {
14290                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
14291                    inner_offset = next_offset;
14292                } else {
14293                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
14294                    inner_depth.increment()?;
14295                }
14296                let val_ref = self.pass_acquire_fences.get_or_insert_with(|| {
14297                    fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
14298                });
14299                fidl::decode!(
14300                    bool,
14301                    fidl::encoding::DefaultFuchsiaResourceDialect,
14302                    val_ref,
14303                    decoder,
14304                    inner_offset,
14305                    inner_depth
14306                )?;
14307                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
14308                {
14309                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
14310                }
14311                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
14312                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
14313                }
14314            }
14315
14316            next_offset += envelope_size;
14317            _next_ordinal_to_read += 1;
14318            if next_offset >= end_offset {
14319                return Ok(());
14320            }
14321
14322            // Decode unknown envelopes for gaps in ordinals.
14323            while _next_ordinal_to_read < 3 {
14324                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
14325                _next_ordinal_to_read += 1;
14326                next_offset += envelope_size;
14327            }
14328
14329            let next_out_of_line = decoder.next_out_of_line();
14330            let handles_before = decoder.remaining_handles();
14331            if let Some((inlined, num_bytes, num_handles)) =
14332                fidl::encoding::decode_envelope_header(decoder, next_offset)?
14333            {
14334                let member_inline_size =
14335                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
14336                if inlined != (member_inline_size <= 4) {
14337                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
14338                }
14339                let inner_offset;
14340                let mut inner_depth = depth.clone();
14341                if inlined {
14342                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
14343                    inner_offset = next_offset;
14344                } else {
14345                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
14346                    inner_depth.increment()?;
14347                }
14348                let val_ref = self.skips_present_credits.get_or_insert_with(|| {
14349                    fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
14350                });
14351                fidl::decode!(
14352                    bool,
14353                    fidl::encoding::DefaultFuchsiaResourceDialect,
14354                    val_ref,
14355                    decoder,
14356                    inner_offset,
14357                    inner_depth
14358                )?;
14359                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
14360                {
14361                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
14362                }
14363                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
14364                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
14365                }
14366            }
14367
14368            next_offset += envelope_size;
14369
14370            // Decode the remaining unknown envelopes.
14371            while next_offset < end_offset {
14372                _next_ordinal_to_read += 1;
14373                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
14374                next_offset += envelope_size;
14375            }
14376
14377            Ok(())
14378        }
14379    }
14380
14381    impl ViewBoundProtocols {
14382        #[inline(always)]
14383        fn max_ordinal_present(&self) -> u64 {
14384            if let Some(_) = self.mouse_source {
14385                return 4;
14386            }
14387            if let Some(_) = self.touch_source {
14388                return 3;
14389            }
14390            if let Some(_) = self.view_focuser {
14391                return 2;
14392            }
14393            if let Some(_) = self.view_ref_focused {
14394                return 1;
14395            }
14396            0
14397        }
14398    }
14399
14400    impl fidl::encoding::ResourceTypeMarker for ViewBoundProtocols {
14401        type Borrowed<'a> = &'a mut Self;
14402        fn take_or_borrow<'a>(
14403            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
14404        ) -> Self::Borrowed<'a> {
14405            value
14406        }
14407    }
14408
14409    unsafe impl fidl::encoding::TypeMarker for ViewBoundProtocols {
14410        type Owned = Self;
14411
14412        #[inline(always)]
14413        fn inline_align(_context: fidl::encoding::Context) -> usize {
14414            8
14415        }
14416
14417        #[inline(always)]
14418        fn inline_size(_context: fidl::encoding::Context) -> usize {
14419            16
14420        }
14421    }
14422
14423    unsafe impl
14424        fidl::encoding::Encode<ViewBoundProtocols, fidl::encoding::DefaultFuchsiaResourceDialect>
14425        for &mut ViewBoundProtocols
14426    {
14427        unsafe fn encode(
14428            self,
14429            encoder: &mut fidl::encoding::Encoder<
14430                '_,
14431                fidl::encoding::DefaultFuchsiaResourceDialect,
14432            >,
14433            offset: usize,
14434            mut depth: fidl::encoding::Depth,
14435        ) -> fidl::Result<()> {
14436            encoder.debug_check_bounds::<ViewBoundProtocols>(offset);
14437            // Vector header
14438            let max_ordinal: u64 = self.max_ordinal_present();
14439            encoder.write_num(max_ordinal, offset);
14440            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
14441            // Calling encoder.out_of_line_offset(0) is not allowed.
14442            if max_ordinal == 0 {
14443                return Ok(());
14444            }
14445            depth.increment()?;
14446            let envelope_size = 8;
14447            let bytes_len = max_ordinal as usize * envelope_size;
14448            #[allow(unused_variables)]
14449            let offset = encoder.out_of_line_offset(bytes_len);
14450            let mut _prev_end_offset: usize = 0;
14451            if 1 > max_ordinal {
14452                return Ok(());
14453            }
14454
14455            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
14456            // are envelope_size bytes.
14457            let cur_offset: usize = (1 - 1) * envelope_size;
14458
14459            // Zero reserved fields.
14460            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
14461
14462            // Safety:
14463            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
14464            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
14465            //   envelope_size bytes, there is always sufficient room.
14466            fidl::encoding::encode_in_envelope_optional::<
14467                fidl::encoding::Endpoint<
14468                    fidl::endpoints::ServerEnd<fidl_fuchsia_ui_views::ViewRefFocusedMarker>,
14469                >,
14470                fidl::encoding::DefaultFuchsiaResourceDialect,
14471            >(
14472                self.view_ref_focused.as_mut().map(
14473                    <fidl::encoding::Endpoint<
14474                        fidl::endpoints::ServerEnd<fidl_fuchsia_ui_views::ViewRefFocusedMarker>,
14475                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
14476                ),
14477                encoder,
14478                offset + cur_offset,
14479                depth,
14480            )?;
14481
14482            _prev_end_offset = cur_offset + envelope_size;
14483            if 2 > max_ordinal {
14484                return Ok(());
14485            }
14486
14487            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
14488            // are envelope_size bytes.
14489            let cur_offset: usize = (2 - 1) * envelope_size;
14490
14491            // Zero reserved fields.
14492            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
14493
14494            // Safety:
14495            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
14496            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
14497            //   envelope_size bytes, there is always sufficient room.
14498            fidl::encoding::encode_in_envelope_optional::<
14499                fidl::encoding::Endpoint<
14500                    fidl::endpoints::ServerEnd<fidl_fuchsia_ui_views::FocuserMarker>,
14501                >,
14502                fidl::encoding::DefaultFuchsiaResourceDialect,
14503            >(
14504                self.view_focuser.as_mut().map(
14505                    <fidl::encoding::Endpoint<
14506                        fidl::endpoints::ServerEnd<fidl_fuchsia_ui_views::FocuserMarker>,
14507                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
14508                ),
14509                encoder,
14510                offset + cur_offset,
14511                depth,
14512            )?;
14513
14514            _prev_end_offset = cur_offset + envelope_size;
14515            if 3 > max_ordinal {
14516                return Ok(());
14517            }
14518
14519            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
14520            // are envelope_size bytes.
14521            let cur_offset: usize = (3 - 1) * envelope_size;
14522
14523            // Zero reserved fields.
14524            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
14525
14526            // Safety:
14527            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
14528            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
14529            //   envelope_size bytes, there is always sufficient room.
14530            fidl::encoding::encode_in_envelope_optional::<
14531                fidl::encoding::Endpoint<
14532                    fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::TouchSourceMarker>,
14533                >,
14534                fidl::encoding::DefaultFuchsiaResourceDialect,
14535            >(
14536                self.touch_source.as_mut().map(
14537                    <fidl::encoding::Endpoint<
14538                        fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::TouchSourceMarker>,
14539                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
14540                ),
14541                encoder,
14542                offset + cur_offset,
14543                depth,
14544            )?;
14545
14546            _prev_end_offset = cur_offset + envelope_size;
14547            if 4 > max_ordinal {
14548                return Ok(());
14549            }
14550
14551            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
14552            // are envelope_size bytes.
14553            let cur_offset: usize = (4 - 1) * envelope_size;
14554
14555            // Zero reserved fields.
14556            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
14557
14558            // Safety:
14559            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
14560            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
14561            //   envelope_size bytes, there is always sufficient room.
14562            fidl::encoding::encode_in_envelope_optional::<
14563                fidl::encoding::Endpoint<
14564                    fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::MouseSourceMarker>,
14565                >,
14566                fidl::encoding::DefaultFuchsiaResourceDialect,
14567            >(
14568                self.mouse_source.as_mut().map(
14569                    <fidl::encoding::Endpoint<
14570                        fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::MouseSourceMarker>,
14571                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
14572                ),
14573                encoder,
14574                offset + cur_offset,
14575                depth,
14576            )?;
14577
14578            _prev_end_offset = cur_offset + envelope_size;
14579
14580            Ok(())
14581        }
14582    }
14583
14584    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
14585        for ViewBoundProtocols
14586    {
14587        #[inline(always)]
14588        fn new_empty() -> Self {
14589            Self::default()
14590        }
14591
14592        unsafe fn decode(
14593            &mut self,
14594            decoder: &mut fidl::encoding::Decoder<
14595                '_,
14596                fidl::encoding::DefaultFuchsiaResourceDialect,
14597            >,
14598            offset: usize,
14599            mut depth: fidl::encoding::Depth,
14600        ) -> fidl::Result<()> {
14601            decoder.debug_check_bounds::<Self>(offset);
14602            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
14603                None => return Err(fidl::Error::NotNullable),
14604                Some(len) => len,
14605            };
14606            // Calling decoder.out_of_line_offset(0) is not allowed.
14607            if len == 0 {
14608                return Ok(());
14609            };
14610            depth.increment()?;
14611            let envelope_size = 8;
14612            let bytes_len = len * envelope_size;
14613            let offset = decoder.out_of_line_offset(bytes_len)?;
14614            // Decode the envelope for each type.
14615            let mut _next_ordinal_to_read = 0;
14616            let mut next_offset = offset;
14617            let end_offset = offset + bytes_len;
14618            _next_ordinal_to_read += 1;
14619            if next_offset >= end_offset {
14620                return Ok(());
14621            }
14622
14623            // Decode unknown envelopes for gaps in ordinals.
14624            while _next_ordinal_to_read < 1 {
14625                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
14626                _next_ordinal_to_read += 1;
14627                next_offset += envelope_size;
14628            }
14629
14630            let next_out_of_line = decoder.next_out_of_line();
14631            let handles_before = decoder.remaining_handles();
14632            if let Some((inlined, num_bytes, num_handles)) =
14633                fidl::encoding::decode_envelope_header(decoder, next_offset)?
14634            {
14635                let member_inline_size = <fidl::encoding::Endpoint<
14636                    fidl::endpoints::ServerEnd<fidl_fuchsia_ui_views::ViewRefFocusedMarker>,
14637                > as fidl::encoding::TypeMarker>::inline_size(
14638                    decoder.context
14639                );
14640                if inlined != (member_inline_size <= 4) {
14641                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
14642                }
14643                let inner_offset;
14644                let mut inner_depth = depth.clone();
14645                if inlined {
14646                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
14647                    inner_offset = next_offset;
14648                } else {
14649                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
14650                    inner_depth.increment()?;
14651                }
14652                let val_ref = self.view_ref_focused.get_or_insert_with(|| {
14653                    fidl::new_empty!(
14654                        fidl::encoding::Endpoint<
14655                            fidl::endpoints::ServerEnd<fidl_fuchsia_ui_views::ViewRefFocusedMarker>,
14656                        >,
14657                        fidl::encoding::DefaultFuchsiaResourceDialect
14658                    )
14659                });
14660                fidl::decode!(
14661                    fidl::encoding::Endpoint<
14662                        fidl::endpoints::ServerEnd<fidl_fuchsia_ui_views::ViewRefFocusedMarker>,
14663                    >,
14664                    fidl::encoding::DefaultFuchsiaResourceDialect,
14665                    val_ref,
14666                    decoder,
14667                    inner_offset,
14668                    inner_depth
14669                )?;
14670                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
14671                {
14672                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
14673                }
14674                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
14675                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
14676                }
14677            }
14678
14679            next_offset += envelope_size;
14680            _next_ordinal_to_read += 1;
14681            if next_offset >= end_offset {
14682                return Ok(());
14683            }
14684
14685            // Decode unknown envelopes for gaps in ordinals.
14686            while _next_ordinal_to_read < 2 {
14687                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
14688                _next_ordinal_to_read += 1;
14689                next_offset += envelope_size;
14690            }
14691
14692            let next_out_of_line = decoder.next_out_of_line();
14693            let handles_before = decoder.remaining_handles();
14694            if let Some((inlined, num_bytes, num_handles)) =
14695                fidl::encoding::decode_envelope_header(decoder, next_offset)?
14696            {
14697                let member_inline_size = <fidl::encoding::Endpoint<
14698                    fidl::endpoints::ServerEnd<fidl_fuchsia_ui_views::FocuserMarker>,
14699                > as fidl::encoding::TypeMarker>::inline_size(
14700                    decoder.context
14701                );
14702                if inlined != (member_inline_size <= 4) {
14703                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
14704                }
14705                let inner_offset;
14706                let mut inner_depth = depth.clone();
14707                if inlined {
14708                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
14709                    inner_offset = next_offset;
14710                } else {
14711                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
14712                    inner_depth.increment()?;
14713                }
14714                let val_ref = self.view_focuser.get_or_insert_with(|| {
14715                    fidl::new_empty!(
14716                        fidl::encoding::Endpoint<
14717                            fidl::endpoints::ServerEnd<fidl_fuchsia_ui_views::FocuserMarker>,
14718                        >,
14719                        fidl::encoding::DefaultFuchsiaResourceDialect
14720                    )
14721                });
14722                fidl::decode!(
14723                    fidl::encoding::Endpoint<
14724                        fidl::endpoints::ServerEnd<fidl_fuchsia_ui_views::FocuserMarker>,
14725                    >,
14726                    fidl::encoding::DefaultFuchsiaResourceDialect,
14727                    val_ref,
14728                    decoder,
14729                    inner_offset,
14730                    inner_depth
14731                )?;
14732                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
14733                {
14734                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
14735                }
14736                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
14737                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
14738                }
14739            }
14740
14741            next_offset += envelope_size;
14742            _next_ordinal_to_read += 1;
14743            if next_offset >= end_offset {
14744                return Ok(());
14745            }
14746
14747            // Decode unknown envelopes for gaps in ordinals.
14748            while _next_ordinal_to_read < 3 {
14749                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
14750                _next_ordinal_to_read += 1;
14751                next_offset += envelope_size;
14752            }
14753
14754            let next_out_of_line = decoder.next_out_of_line();
14755            let handles_before = decoder.remaining_handles();
14756            if let Some((inlined, num_bytes, num_handles)) =
14757                fidl::encoding::decode_envelope_header(decoder, next_offset)?
14758            {
14759                let member_inline_size = <fidl::encoding::Endpoint<
14760                    fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::TouchSourceMarker>,
14761                > as fidl::encoding::TypeMarker>::inline_size(
14762                    decoder.context
14763                );
14764                if inlined != (member_inline_size <= 4) {
14765                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
14766                }
14767                let inner_offset;
14768                let mut inner_depth = depth.clone();
14769                if inlined {
14770                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
14771                    inner_offset = next_offset;
14772                } else {
14773                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
14774                    inner_depth.increment()?;
14775                }
14776                let val_ref = self.touch_source.get_or_insert_with(|| {
14777                    fidl::new_empty!(
14778                        fidl::encoding::Endpoint<
14779                            fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::TouchSourceMarker>,
14780                        >,
14781                        fidl::encoding::DefaultFuchsiaResourceDialect
14782                    )
14783                });
14784                fidl::decode!(
14785                    fidl::encoding::Endpoint<
14786                        fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::TouchSourceMarker>,
14787                    >,
14788                    fidl::encoding::DefaultFuchsiaResourceDialect,
14789                    val_ref,
14790                    decoder,
14791                    inner_offset,
14792                    inner_depth
14793                )?;
14794                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
14795                {
14796                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
14797                }
14798                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
14799                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
14800                }
14801            }
14802
14803            next_offset += envelope_size;
14804            _next_ordinal_to_read += 1;
14805            if next_offset >= end_offset {
14806                return Ok(());
14807            }
14808
14809            // Decode unknown envelopes for gaps in ordinals.
14810            while _next_ordinal_to_read < 4 {
14811                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
14812                _next_ordinal_to_read += 1;
14813                next_offset += envelope_size;
14814            }
14815
14816            let next_out_of_line = decoder.next_out_of_line();
14817            let handles_before = decoder.remaining_handles();
14818            if let Some((inlined, num_bytes, num_handles)) =
14819                fidl::encoding::decode_envelope_header(decoder, next_offset)?
14820            {
14821                let member_inline_size = <fidl::encoding::Endpoint<
14822                    fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::MouseSourceMarker>,
14823                > as fidl::encoding::TypeMarker>::inline_size(
14824                    decoder.context
14825                );
14826                if inlined != (member_inline_size <= 4) {
14827                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
14828                }
14829                let inner_offset;
14830                let mut inner_depth = depth.clone();
14831                if inlined {
14832                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
14833                    inner_offset = next_offset;
14834                } else {
14835                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
14836                    inner_depth.increment()?;
14837                }
14838                let val_ref = self.mouse_source.get_or_insert_with(|| {
14839                    fidl::new_empty!(
14840                        fidl::encoding::Endpoint<
14841                            fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::MouseSourceMarker>,
14842                        >,
14843                        fidl::encoding::DefaultFuchsiaResourceDialect
14844                    )
14845                });
14846                fidl::decode!(
14847                    fidl::encoding::Endpoint<
14848                        fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::MouseSourceMarker>,
14849                    >,
14850                    fidl::encoding::DefaultFuchsiaResourceDialect,
14851                    val_ref,
14852                    decoder,
14853                    inner_offset,
14854                    inner_depth
14855                )?;
14856                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
14857                {
14858                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
14859                }
14860                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
14861                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
14862                }
14863            }
14864
14865            next_offset += envelope_size;
14866
14867            // Decode the remaining unknown envelopes.
14868            while next_offset < end_offset {
14869                _next_ordinal_to_read += 1;
14870                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
14871                next_offset += envelope_size;
14872            }
14873
14874            Ok(())
14875        }
14876    }
14877}