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    #[doc(hidden)]
263    pub __source_breaking: fidl::marker::SourceBreaking,
264}
265
266impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for PresentArgs {}
267
268/// The table of arguments for [`RegisterBufferCollection`]. Note that some
269/// fields below are REQUIRED.
270#[derive(Debug, Default, PartialEq)]
271pub struct RegisterBufferCollectionArgs {
272    /// Clients can send [`export_token`] to register buffer collections with Allocator to be used
273    /// later in [`fuchsia.ui.composition/Flatland`] instances or other Scenic APIs, such as
274    /// Screenshot.
275    ///
276    /// For example, by passing a [`BufferCollectionImportToken`] containing the matching peer of
277    /// [`BufferCollectionExportToken`], they can create image resources via
278    /// [`fuchsia.ui.composition/Flatland.CreateImage`].
279    ///
280    /// Clients should wait for the response before using `import_token`.
281    ///
282    /// This field is REQUIRED.
283    pub export_token: Option<BufferCollectionExportToken>,
284    pub buffer_collection_token:
285        Option<fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem::BufferCollectionTokenMarker>>,
286    /// The client can register a buffer collection for various uses, each
287    /// coming with their own unique constraints.
288    ///
289    /// This field is OPTIONAL. If `usage` is omitted it will be treated as if
290    /// it has the DEFAULT option.
291    ///
292    /// # Deprecation
293    ///
294    /// This arg is deprecated at API version 9 with addition of |usages|.
295    ///
296    /// If both the `usages` and `usage` fields are set, `usages` takes precedence and `usage` is
297    /// ignored.
298    pub usage: Option<RegisterBufferCollectionUsage>,
299    /// The client can register a buffer collection for various uses and has the ability to
300    /// combine usages if multiple are needed.
301    ///
302    /// This field is OPTIONAL. If `usages` is omitted it will be treated as if
303    /// it has only the DEFAULT option.
304    pub usages: Option<RegisterBufferCollectionUsages>,
305    /// Flatland participates in the allocation of buffers by setting constraints on the
306    /// BufferCollection referenced by `buffer_collection_token`. It will not block on buffers
307    /// being allocated until the client creates content using the BufferCollection.
308    ///
309    /// The buffer collection registered with `export_token` is available and kept alive as long
310    /// as the client holds a valid [`BufferCollectionImportToken`]. They will be garbage collected
311    /// when all [`BufferCollectionImportToken`]s are closed and all the associated Image resources
312    /// are released.
313    ///
314    /// Exactly one of `buffer_collection_token2` / `buffer_collection_token` must be set.
315    pub buffer_collection_token2:
316        Option<fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem2::BufferCollectionTokenMarker>>,
317    #[doc(hidden)]
318    pub __source_breaking: fidl::marker::SourceBreaking,
319}
320
321impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
322    for RegisterBufferCollectionArgs
323{
324}
325
326/// The arguments passed into the [`Configure`] call. Note that not all fields are necessary.
327#[derive(Debug, Default, PartialEq)]
328pub struct ScreenCaptureConfig {
329    /// The import token referencing a BufferCollection registered with
330    /// Allocator. Required.
331    pub import_token: Option<BufferCollectionImportToken>,
332    /// The size of the image in pixels. Required.
333    pub size: Option<fidl_fuchsia_math::SizeU>,
334    /// The number of buffers in the BufferCollection. Required.
335    pub buffer_count: Option<u32>,
336    /// The rotation to be applied to the stream of images. Optional; if absent no rotation is
337    /// applied.
338    pub rotation: Option<Rotation>,
339    #[doc(hidden)]
340    pub __source_breaking: fidl::marker::SourceBreaking,
341}
342
343impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for ScreenCaptureConfig {}
344
345#[derive(Debug, Default, PartialEq)]
346pub struct ScreenshotTakeFileRequest {
347    /// Format of the requested screenshot.
348    pub format: Option<ScreenshotFormat>,
349    #[doc(hidden)]
350    pub __source_breaking: fidl::marker::SourceBreaking,
351}
352
353impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for ScreenshotTakeFileRequest {}
354
355#[derive(Debug, Default, PartialEq)]
356pub struct ScreenshotTakeFileResponse {
357    /// |fuchsia.io.File| channel used to read the generated screenshot file data.
358    /// The server side of the channel is stored on the device until ZX_CHANNEL_PEER_CLOSED
359    /// is detected.
360    ///
361    /// Basic usage: After the client recieves the client end of the file channel,
362    /// to avoid memory pile-ups, it should finish reading the data
363    /// before calling [`TakeFile`] again. When finished reading,
364    /// the client should call [`Close`] on the |fuchsia.io.File| channel, this will release
365    /// the memory allocated on the server side.
366    pub file: Option<fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>>,
367    /// Size of the screenshot in pixels.
368    pub size: Option<fidl_fuchsia_math::SizeU>,
369    #[doc(hidden)]
370    pub __source_breaking: fidl::marker::SourceBreaking,
371}
372
373impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
374    for ScreenshotTakeFileResponse
375{
376}
377
378#[derive(Debug, Default, PartialEq)]
379pub struct ScreenshotTakeRequest {
380    /// Format of the requested screenshot.
381    pub format: Option<ScreenshotFormat>,
382    #[doc(hidden)]
383    pub __source_breaking: fidl::marker::SourceBreaking,
384}
385
386impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for ScreenshotTakeRequest {}
387
388#[derive(Debug, Default, PartialEq)]
389pub struct ScreenshotTakeResponse {
390    /// CPU mappable read-only VMO that contains screenshot data. The server owns the VMO and
391    /// may reuse for the next [`Take`]. The VMO is guaranteed to be accessible after mapping.
392    /// In some allocations, VMO::read() might not be available, i.e. on emulator.
393    ///
394    /// Basic usage: After the client receives a VMO handle, to ensure data stability, it should
395    /// finish reading the VMO before calling [`Take`] again. When finished reading, the client
396    /// should drop the VMO handle.
397    ///
398    /// Advanced usage: To edit the data, or to persist it beyond the next [`Take`] call, the
399    /// client should copy the data to a private VMO.
400    pub vmo: Option<fidl::Vmo>,
401    /// Size of the screenshot in pixels.
402    pub size: Option<fidl_fuchsia_math::SizeU>,
403    #[doc(hidden)]
404    pub __source_breaking: fidl::marker::SourceBreaking,
405}
406
407impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for ScreenshotTakeResponse {}
408
409/// All arguments are optional; default values will be provided if they are absent.
410/// By default, the resulting Flatland will behave identically to connecting
411/// to the `fuchsia.ui.composition.Flatland` service instead of connecting via the factory.
412#[derive(Debug, Default, PartialEq)]
413pub struct TrustedFlatlandConfig {
414    /// If true, a frame will be scheduled to be presented as soon as all acquire fences are
415    /// signaled, instead of waiting for other clients to present in the same vsync. This can reduce
416    /// latency for this client, but may increase power consumption.
417    ///
418    /// If absent, `schedule_asap` is false.
419    pub schedule_asap: Option<bool>,
420    /// If true, Scenic should pass acquire fences to the drivers for composition HW, instead of
421    /// waiting for them on CPU. This can improve performance by reducing CPU overhead.
422    ///
423    /// If absent, `pass_acquire_fences` is false.
424    pub pass_acquire_fences: Option<bool>,
425    #[doc(hidden)]
426    pub __source_breaking: fidl::marker::SourceBreaking,
427}
428
429impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for TrustedFlatlandConfig {}
430
431/// The protocol endpoints bound to a Flatland ViewCreationToken. These protocols operate on the
432/// View that ViewCreationToken created in the Flatland session.
433#[derive(Debug, Default, PartialEq)]
434pub struct ViewBoundProtocols {
435    /// Learn when a View gains focus.
436    ///
437    /// Server-bound ViewRef. The [`view_ref_focused`] client does not specify the ViewRef
438    /// explicitly; instead, the server implementation uses the ViewRef used in View creation for
439    /// reporting focus movement on/off this View.
440    pub view_ref_focused:
441        Option<fidl::endpoints::ServerEnd<fidl_fuchsia_ui_views::ViewRefFocusedMarker>>,
442    /// Enable a View to request focus transfer to a child (target) View.
443    ///
444    /// Server-bound ViewRef. The [`view_focuser`] client does not specify the "requestor" ViewRef
445    /// explicitly, only the "target" ViewRef. Instead, the server implementation uses the ViewRef
446    /// used in View creation as the "requestor" ViewRef.
447    pub view_focuser: Option<fidl::endpoints::ServerEnd<fidl_fuchsia_ui_views::FocuserMarker>>,
448    /// Receive touch events that are associated with a View.
449    pub touch_source:
450        Option<fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::TouchSourceMarker>>,
451    /// Receive mouse events that are associated with a View.
452    pub mouse_source:
453        Option<fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::MouseSourceMarker>>,
454    #[doc(hidden)]
455    pub __source_breaking: fidl::marker::SourceBreaking,
456}
457
458impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for ViewBoundProtocols {}
459
460#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
461pub struct AllocatorMarker;
462
463impl fidl::endpoints::ProtocolMarker for AllocatorMarker {
464    type Proxy = AllocatorProxy;
465    type RequestStream = AllocatorRequestStream;
466    #[cfg(target_os = "fuchsia")]
467    type SynchronousProxy = AllocatorSynchronousProxy;
468
469    const DEBUG_NAME: &'static str = "fuchsia.ui.composition.Allocator";
470}
471impl fidl::endpoints::DiscoverableProtocolMarker for AllocatorMarker {}
472pub type AllocatorRegisterBufferCollectionResult = Result<(), RegisterBufferCollectionError>;
473
474pub trait AllocatorProxyInterface: Send + Sync {
475    type RegisterBufferCollectionResponseFut: std::future::Future<Output = Result<AllocatorRegisterBufferCollectionResult, fidl::Error>>
476        + Send;
477    fn r#register_buffer_collection(
478        &self,
479        args: RegisterBufferCollectionArgs,
480    ) -> Self::RegisterBufferCollectionResponseFut;
481}
482#[derive(Debug)]
483#[cfg(target_os = "fuchsia")]
484pub struct AllocatorSynchronousProxy {
485    client: fidl::client::sync::Client,
486}
487
488#[cfg(target_os = "fuchsia")]
489impl fidl::endpoints::SynchronousProxy for AllocatorSynchronousProxy {
490    type Proxy = AllocatorProxy;
491    type Protocol = AllocatorMarker;
492
493    fn from_channel(inner: fidl::Channel) -> Self {
494        Self::new(inner)
495    }
496
497    fn into_channel(self) -> fidl::Channel {
498        self.client.into_channel()
499    }
500
501    fn as_channel(&self) -> &fidl::Channel {
502        self.client.as_channel()
503    }
504}
505
506#[cfg(target_os = "fuchsia")]
507impl AllocatorSynchronousProxy {
508    pub fn new(channel: fidl::Channel) -> Self {
509        let protocol_name = <AllocatorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
510        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
511    }
512
513    pub fn into_channel(self) -> fidl::Channel {
514        self.client.into_channel()
515    }
516
517    /// Waits until an event arrives and returns it. It is safe for other
518    /// threads to make concurrent requests while waiting for an event.
519    pub fn wait_for_event(
520        &self,
521        deadline: zx::MonotonicInstant,
522    ) -> Result<AllocatorEvent, fidl::Error> {
523        AllocatorEvent::decode(self.client.wait_for_event(deadline)?)
524    }
525
526    /// A BufferCollection is a set of VMOs created by Sysmem and shared by a number of
527    /// participants, one of which is the Flatland Renderer. Some content, such as Images, use a
528    /// BufferCollection as their backing memory.
529    ///
530    /// See [`RegisterBufferCollectionArgs`] for information on each argument.
531    pub fn r#register_buffer_collection(
532        &self,
533        mut args: RegisterBufferCollectionArgs,
534        ___deadline: zx::MonotonicInstant,
535    ) -> Result<AllocatorRegisterBufferCollectionResult, fidl::Error> {
536        let _response = self
537            .client
538            .send_query::<AllocatorRegisterBufferCollectionRequest, fidl::encoding::ResultType<
539                fidl::encoding::EmptyStruct,
540                RegisterBufferCollectionError,
541            >>(
542                (&mut args,),
543                0x494b7ea578d1061e,
544                fidl::encoding::DynamicFlags::empty(),
545                ___deadline,
546            )?;
547        Ok(_response.map(|x| x))
548    }
549}
550
551#[cfg(target_os = "fuchsia")]
552impl From<AllocatorSynchronousProxy> for zx::Handle {
553    fn from(value: AllocatorSynchronousProxy) -> Self {
554        value.into_channel().into()
555    }
556}
557
558#[cfg(target_os = "fuchsia")]
559impl From<fidl::Channel> for AllocatorSynchronousProxy {
560    fn from(value: fidl::Channel) -> Self {
561        Self::new(value)
562    }
563}
564
565#[cfg(target_os = "fuchsia")]
566impl fidl::endpoints::FromClient for AllocatorSynchronousProxy {
567    type Protocol = AllocatorMarker;
568
569    fn from_client(value: fidl::endpoints::ClientEnd<AllocatorMarker>) -> Self {
570        Self::new(value.into_channel())
571    }
572}
573
574#[derive(Debug, Clone)]
575pub struct AllocatorProxy {
576    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
577}
578
579impl fidl::endpoints::Proxy for AllocatorProxy {
580    type Protocol = AllocatorMarker;
581
582    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
583        Self::new(inner)
584    }
585
586    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
587        self.client.into_channel().map_err(|client| Self { client })
588    }
589
590    fn as_channel(&self) -> &::fidl::AsyncChannel {
591        self.client.as_channel()
592    }
593}
594
595impl AllocatorProxy {
596    /// Create a new Proxy for fuchsia.ui.composition/Allocator.
597    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
598        let protocol_name = <AllocatorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
599        Self { client: fidl::client::Client::new(channel, protocol_name) }
600    }
601
602    /// Get a Stream of events from the remote end of the protocol.
603    ///
604    /// # Panics
605    ///
606    /// Panics if the event stream was already taken.
607    pub fn take_event_stream(&self) -> AllocatorEventStream {
608        AllocatorEventStream { event_receiver: self.client.take_event_receiver() }
609    }
610
611    /// A BufferCollection is a set of VMOs created by Sysmem and shared by a number of
612    /// participants, one of which is the Flatland Renderer. Some content, such as Images, use a
613    /// BufferCollection as their backing memory.
614    ///
615    /// See [`RegisterBufferCollectionArgs`] for information on each argument.
616    pub fn r#register_buffer_collection(
617        &self,
618        mut args: RegisterBufferCollectionArgs,
619    ) -> fidl::client::QueryResponseFut<
620        AllocatorRegisterBufferCollectionResult,
621        fidl::encoding::DefaultFuchsiaResourceDialect,
622    > {
623        AllocatorProxyInterface::r#register_buffer_collection(self, args)
624    }
625}
626
627impl AllocatorProxyInterface for AllocatorProxy {
628    type RegisterBufferCollectionResponseFut = fidl::client::QueryResponseFut<
629        AllocatorRegisterBufferCollectionResult,
630        fidl::encoding::DefaultFuchsiaResourceDialect,
631    >;
632    fn r#register_buffer_collection(
633        &self,
634        mut args: RegisterBufferCollectionArgs,
635    ) -> Self::RegisterBufferCollectionResponseFut {
636        fn _decode(
637            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
638        ) -> Result<AllocatorRegisterBufferCollectionResult, fidl::Error> {
639            let _response = fidl::client::decode_transaction_body::<
640                fidl::encoding::ResultType<
641                    fidl::encoding::EmptyStruct,
642                    RegisterBufferCollectionError,
643                >,
644                fidl::encoding::DefaultFuchsiaResourceDialect,
645                0x494b7ea578d1061e,
646            >(_buf?)?;
647            Ok(_response.map(|x| x))
648        }
649        self.client.send_query_and_decode::<
650            AllocatorRegisterBufferCollectionRequest,
651            AllocatorRegisterBufferCollectionResult,
652        >(
653            (&mut args,),
654            0x494b7ea578d1061e,
655            fidl::encoding::DynamicFlags::empty(),
656            _decode,
657        )
658    }
659}
660
661pub struct AllocatorEventStream {
662    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
663}
664
665impl std::marker::Unpin for AllocatorEventStream {}
666
667impl futures::stream::FusedStream for AllocatorEventStream {
668    fn is_terminated(&self) -> bool {
669        self.event_receiver.is_terminated()
670    }
671}
672
673impl futures::Stream for AllocatorEventStream {
674    type Item = Result<AllocatorEvent, fidl::Error>;
675
676    fn poll_next(
677        mut self: std::pin::Pin<&mut Self>,
678        cx: &mut std::task::Context<'_>,
679    ) -> std::task::Poll<Option<Self::Item>> {
680        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
681            &mut self.event_receiver,
682            cx
683        )?) {
684            Some(buf) => std::task::Poll::Ready(Some(AllocatorEvent::decode(buf))),
685            None => std::task::Poll::Ready(None),
686        }
687    }
688}
689
690#[derive(Debug)]
691pub enum AllocatorEvent {}
692
693impl AllocatorEvent {
694    /// Decodes a message buffer as a [`AllocatorEvent`].
695    fn decode(
696        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
697    ) -> Result<AllocatorEvent, fidl::Error> {
698        let (bytes, _handles) = buf.split_mut();
699        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
700        debug_assert_eq!(tx_header.tx_id, 0);
701        match tx_header.ordinal {
702            _ => Err(fidl::Error::UnknownOrdinal {
703                ordinal: tx_header.ordinal,
704                protocol_name: <AllocatorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
705            }),
706        }
707    }
708}
709
710/// A Stream of incoming requests for fuchsia.ui.composition/Allocator.
711pub struct AllocatorRequestStream {
712    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
713    is_terminated: bool,
714}
715
716impl std::marker::Unpin for AllocatorRequestStream {}
717
718impl futures::stream::FusedStream for AllocatorRequestStream {
719    fn is_terminated(&self) -> bool {
720        self.is_terminated
721    }
722}
723
724impl fidl::endpoints::RequestStream for AllocatorRequestStream {
725    type Protocol = AllocatorMarker;
726    type ControlHandle = AllocatorControlHandle;
727
728    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
729        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
730    }
731
732    fn control_handle(&self) -> Self::ControlHandle {
733        AllocatorControlHandle { inner: self.inner.clone() }
734    }
735
736    fn into_inner(
737        self,
738    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
739    {
740        (self.inner, self.is_terminated)
741    }
742
743    fn from_inner(
744        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
745        is_terminated: bool,
746    ) -> Self {
747        Self { inner, is_terminated }
748    }
749}
750
751impl futures::Stream for AllocatorRequestStream {
752    type Item = Result<AllocatorRequest, fidl::Error>;
753
754    fn poll_next(
755        mut self: std::pin::Pin<&mut Self>,
756        cx: &mut std::task::Context<'_>,
757    ) -> std::task::Poll<Option<Self::Item>> {
758        let this = &mut *self;
759        if this.inner.check_shutdown(cx) {
760            this.is_terminated = true;
761            return std::task::Poll::Ready(None);
762        }
763        if this.is_terminated {
764            panic!("polled AllocatorRequestStream after completion");
765        }
766        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
767            |bytes, handles| {
768                match this.inner.channel().read_etc(cx, bytes, handles) {
769                    std::task::Poll::Ready(Ok(())) => {}
770                    std::task::Poll::Pending => return std::task::Poll::Pending,
771                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
772                        this.is_terminated = true;
773                        return std::task::Poll::Ready(None);
774                    }
775                    std::task::Poll::Ready(Err(e)) => {
776                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
777                            e.into(),
778                        ))));
779                    }
780                }
781
782                // A message has been received from the channel
783                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
784
785                std::task::Poll::Ready(Some(match header.ordinal {
786                    0x494b7ea578d1061e => {
787                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
788                        let mut req = fidl::new_empty!(
789                            AllocatorRegisterBufferCollectionRequest,
790                            fidl::encoding::DefaultFuchsiaResourceDialect
791                        );
792                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AllocatorRegisterBufferCollectionRequest>(&header, _body_bytes, handles, &mut req)?;
793                        let control_handle = AllocatorControlHandle { inner: this.inner.clone() };
794                        Ok(AllocatorRequest::RegisterBufferCollection {
795                            args: req.args,
796
797                            responder: AllocatorRegisterBufferCollectionResponder {
798                                control_handle: std::mem::ManuallyDrop::new(control_handle),
799                                tx_id: header.tx_id,
800                            },
801                        })
802                    }
803                    _ => Err(fidl::Error::UnknownOrdinal {
804                        ordinal: header.ordinal,
805                        protocol_name:
806                            <AllocatorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
807                    }),
808                }))
809            },
810        )
811    }
812}
813
814#[derive(Debug)]
815pub enum AllocatorRequest {
816    /// A BufferCollection is a set of VMOs created by Sysmem and shared by a number of
817    /// participants, one of which is the Flatland Renderer. Some content, such as Images, use a
818    /// BufferCollection as their backing memory.
819    ///
820    /// See [`RegisterBufferCollectionArgs`] for information on each argument.
821    RegisterBufferCollection {
822        args: RegisterBufferCollectionArgs,
823        responder: AllocatorRegisterBufferCollectionResponder,
824    },
825}
826
827impl AllocatorRequest {
828    #[allow(irrefutable_let_patterns)]
829    pub fn into_register_buffer_collection(
830        self,
831    ) -> Option<(RegisterBufferCollectionArgs, AllocatorRegisterBufferCollectionResponder)> {
832        if let AllocatorRequest::RegisterBufferCollection { args, responder } = self {
833            Some((args, responder))
834        } else {
835            None
836        }
837    }
838
839    /// Name of the method defined in FIDL
840    pub fn method_name(&self) -> &'static str {
841        match *self {
842            AllocatorRequest::RegisterBufferCollection { .. } => "register_buffer_collection",
843        }
844    }
845}
846
847#[derive(Debug, Clone)]
848pub struct AllocatorControlHandle {
849    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
850}
851
852impl fidl::endpoints::ControlHandle for AllocatorControlHandle {
853    fn shutdown(&self) {
854        self.inner.shutdown()
855    }
856    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
857        self.inner.shutdown_with_epitaph(status)
858    }
859
860    fn is_closed(&self) -> bool {
861        self.inner.channel().is_closed()
862    }
863    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
864        self.inner.channel().on_closed()
865    }
866
867    #[cfg(target_os = "fuchsia")]
868    fn signal_peer(
869        &self,
870        clear_mask: zx::Signals,
871        set_mask: zx::Signals,
872    ) -> Result<(), zx_status::Status> {
873        use fidl::Peered;
874        self.inner.channel().signal_peer(clear_mask, set_mask)
875    }
876}
877
878impl AllocatorControlHandle {}
879
880#[must_use = "FIDL methods require a response to be sent"]
881#[derive(Debug)]
882pub struct AllocatorRegisterBufferCollectionResponder {
883    control_handle: std::mem::ManuallyDrop<AllocatorControlHandle>,
884    tx_id: u32,
885}
886
887/// Set the the channel to be shutdown (see [`AllocatorControlHandle::shutdown`])
888/// if the responder is dropped without sending a response, so that the client
889/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
890impl std::ops::Drop for AllocatorRegisterBufferCollectionResponder {
891    fn drop(&mut self) {
892        self.control_handle.shutdown();
893        // Safety: drops once, never accessed again
894        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
895    }
896}
897
898impl fidl::endpoints::Responder for AllocatorRegisterBufferCollectionResponder {
899    type ControlHandle = AllocatorControlHandle;
900
901    fn control_handle(&self) -> &AllocatorControlHandle {
902        &self.control_handle
903    }
904
905    fn drop_without_shutdown(mut self) {
906        // Safety: drops once, never accessed again due to mem::forget
907        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
908        // Prevent Drop from running (which would shut down the channel)
909        std::mem::forget(self);
910    }
911}
912
913impl AllocatorRegisterBufferCollectionResponder {
914    /// Sends a response to the FIDL transaction.
915    ///
916    /// Sets the channel to shutdown if an error occurs.
917    pub fn send(
918        self,
919        mut result: Result<(), RegisterBufferCollectionError>,
920    ) -> Result<(), fidl::Error> {
921        let _result = self.send_raw(result);
922        if _result.is_err() {
923            self.control_handle.shutdown();
924        }
925        self.drop_without_shutdown();
926        _result
927    }
928
929    /// Similar to "send" but does not shutdown the channel if an error occurs.
930    pub fn send_no_shutdown_on_err(
931        self,
932        mut result: Result<(), RegisterBufferCollectionError>,
933    ) -> Result<(), fidl::Error> {
934        let _result = self.send_raw(result);
935        self.drop_without_shutdown();
936        _result
937    }
938
939    fn send_raw(
940        &self,
941        mut result: Result<(), RegisterBufferCollectionError>,
942    ) -> Result<(), fidl::Error> {
943        self.control_handle.inner.send::<fidl::encoding::ResultType<
944            fidl::encoding::EmptyStruct,
945            RegisterBufferCollectionError,
946        >>(
947            result,
948            self.tx_id,
949            0x494b7ea578d1061e,
950            fidl::encoding::DynamicFlags::empty(),
951        )
952    }
953}
954
955#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
956pub struct ChildViewWatcherMarker;
957
958impl fidl::endpoints::ProtocolMarker for ChildViewWatcherMarker {
959    type Proxy = ChildViewWatcherProxy;
960    type RequestStream = ChildViewWatcherRequestStream;
961    #[cfg(target_os = "fuchsia")]
962    type SynchronousProxy = ChildViewWatcherSynchronousProxy;
963
964    const DEBUG_NAME: &'static str = "(anonymous) ChildViewWatcher";
965}
966
967pub trait ChildViewWatcherProxyInterface: Send + Sync {
968    type GetStatusResponseFut: std::future::Future<Output = Result<ChildViewStatus, fidl::Error>>
969        + Send;
970    fn r#get_status(&self) -> Self::GetStatusResponseFut;
971    type GetViewRefResponseFut: std::future::Future<Output = Result<fidl_fuchsia_ui_views::ViewRef, fidl::Error>>
972        + Send;
973    fn r#get_view_ref(&self) -> Self::GetViewRefResponseFut;
974}
975#[derive(Debug)]
976#[cfg(target_os = "fuchsia")]
977pub struct ChildViewWatcherSynchronousProxy {
978    client: fidl::client::sync::Client,
979}
980
981#[cfg(target_os = "fuchsia")]
982impl fidl::endpoints::SynchronousProxy for ChildViewWatcherSynchronousProxy {
983    type Proxy = ChildViewWatcherProxy;
984    type Protocol = ChildViewWatcherMarker;
985
986    fn from_channel(inner: fidl::Channel) -> Self {
987        Self::new(inner)
988    }
989
990    fn into_channel(self) -> fidl::Channel {
991        self.client.into_channel()
992    }
993
994    fn as_channel(&self) -> &fidl::Channel {
995        self.client.as_channel()
996    }
997}
998
999#[cfg(target_os = "fuchsia")]
1000impl ChildViewWatcherSynchronousProxy {
1001    pub fn new(channel: fidl::Channel) -> Self {
1002        let protocol_name = <ChildViewWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1003        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1004    }
1005
1006    pub fn into_channel(self) -> fidl::Channel {
1007        self.client.into_channel()
1008    }
1009
1010    /// Waits until an event arrives and returns it. It is safe for other
1011    /// threads to make concurrent requests while waiting for an event.
1012    pub fn wait_for_event(
1013        &self,
1014        deadline: zx::MonotonicInstant,
1015    ) -> Result<ChildViewWatcherEvent, fidl::Error> {
1016        ChildViewWatcherEvent::decode(self.client.wait_for_event(deadline)?)
1017    }
1018
1019    /// A hanging get for receiving the status of a View. This provides information to the parent,
1020    /// such as whether or not the child has successfully presented content through this View.
1021    ///
1022    /// This hanging get will only fire when the ChildViewStatus is different than the previously
1023    /// returned ChildViewStatus.  This can happen immediately, and even if the creator of the
1024    /// Viewport hasn't yet called Present() after calling CreateViewport().  This allows the parent
1025    /// to know that the child has content ready to display before the parent modifies their own
1026    /// local scene graph to incorporate the child content.
1027    ///
1028    /// It is invalid to call `GetStatus` while a previous call is still pending. Doing so will
1029    /// cause both this channel and the Flatland channel that handed out ChildViewWatcher to be
1030    /// closed.
1031    pub fn r#get_status(
1032        &self,
1033        ___deadline: zx::MonotonicInstant,
1034    ) -> Result<ChildViewStatus, fidl::Error> {
1035        let _response = self
1036            .client
1037            .send_query::<fidl::encoding::EmptyPayload, ChildViewWatcherGetStatusResponse>(
1038                (),
1039                0x1d622075f4fc8243,
1040                fidl::encoding::DynamicFlags::empty(),
1041                ___deadline,
1042            )?;
1043        Ok(_response.status)
1044    }
1045
1046    /// Hanging get to receive the ViewRef of the child View. This will only fire when the View ref
1047    /// is different from the previously-returned View ref. Note: currently the View ref will not
1048    /// change after it is first received, but this will change if/when the API changes to allow
1049    /// relinking of views.
1050    ///
1051    /// The ViewRef is not returned until the View is included in the View tree, in other words when
1052    /// there is a chain of ancestor transforms all the way back up to the root of the scene graph,
1053    /// i.e. the display.
1054    ///
1055    /// It is invalid to call `GetViewRef` while a previous call is still pending. Doing so will
1056    /// cause both this channel and the Flatland channel that handed out ChildViewWatcher to be
1057    /// closed.
1058    ///
1059    /// A `GetViewRef` call will hang if the View was created using `CreateView`, but returns the
1060    /// View if the View was created using CreateView2. This is because `CreateView` does not mint
1061    /// a ViewRef for that View.
1062    pub fn r#get_view_ref(
1063        &self,
1064        ___deadline: zx::MonotonicInstant,
1065    ) -> Result<fidl_fuchsia_ui_views::ViewRef, fidl::Error> {
1066        let _response = self
1067            .client
1068            .send_query::<fidl::encoding::EmptyPayload, ChildViewWatcherGetViewRefResponse>(
1069                (),
1070                0x3b2f3ca31e8908b4,
1071                fidl::encoding::DynamicFlags::empty(),
1072                ___deadline,
1073            )?;
1074        Ok(_response.view_ref)
1075    }
1076}
1077
1078#[cfg(target_os = "fuchsia")]
1079impl From<ChildViewWatcherSynchronousProxy> for zx::Handle {
1080    fn from(value: ChildViewWatcherSynchronousProxy) -> Self {
1081        value.into_channel().into()
1082    }
1083}
1084
1085#[cfg(target_os = "fuchsia")]
1086impl From<fidl::Channel> for ChildViewWatcherSynchronousProxy {
1087    fn from(value: fidl::Channel) -> Self {
1088        Self::new(value)
1089    }
1090}
1091
1092#[cfg(target_os = "fuchsia")]
1093impl fidl::endpoints::FromClient for ChildViewWatcherSynchronousProxy {
1094    type Protocol = ChildViewWatcherMarker;
1095
1096    fn from_client(value: fidl::endpoints::ClientEnd<ChildViewWatcherMarker>) -> Self {
1097        Self::new(value.into_channel())
1098    }
1099}
1100
1101#[derive(Debug, Clone)]
1102pub struct ChildViewWatcherProxy {
1103    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1104}
1105
1106impl fidl::endpoints::Proxy for ChildViewWatcherProxy {
1107    type Protocol = ChildViewWatcherMarker;
1108
1109    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1110        Self::new(inner)
1111    }
1112
1113    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1114        self.client.into_channel().map_err(|client| Self { client })
1115    }
1116
1117    fn as_channel(&self) -> &::fidl::AsyncChannel {
1118        self.client.as_channel()
1119    }
1120}
1121
1122impl ChildViewWatcherProxy {
1123    /// Create a new Proxy for fuchsia.ui.composition/ChildViewWatcher.
1124    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1125        let protocol_name = <ChildViewWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1126        Self { client: fidl::client::Client::new(channel, protocol_name) }
1127    }
1128
1129    /// Get a Stream of events from the remote end of the protocol.
1130    ///
1131    /// # Panics
1132    ///
1133    /// Panics if the event stream was already taken.
1134    pub fn take_event_stream(&self) -> ChildViewWatcherEventStream {
1135        ChildViewWatcherEventStream { event_receiver: self.client.take_event_receiver() }
1136    }
1137
1138    /// A hanging get for receiving the status of a View. This provides information to the parent,
1139    /// such as whether or not the child has successfully presented content through this View.
1140    ///
1141    /// This hanging get will only fire when the ChildViewStatus is different than the previously
1142    /// returned ChildViewStatus.  This can happen immediately, and even if the creator of the
1143    /// Viewport hasn't yet called Present() after calling CreateViewport().  This allows the parent
1144    /// to know that the child has content ready to display before the parent modifies their own
1145    /// local scene graph to incorporate the child content.
1146    ///
1147    /// It is invalid to call `GetStatus` while a previous call is still pending. Doing so will
1148    /// cause both this channel and the Flatland channel that handed out ChildViewWatcher to be
1149    /// closed.
1150    pub fn r#get_status(
1151        &self,
1152    ) -> fidl::client::QueryResponseFut<
1153        ChildViewStatus,
1154        fidl::encoding::DefaultFuchsiaResourceDialect,
1155    > {
1156        ChildViewWatcherProxyInterface::r#get_status(self)
1157    }
1158
1159    /// Hanging get to receive the ViewRef of the child View. This will only fire when the View ref
1160    /// is different from the previously-returned View ref. Note: currently the View ref will not
1161    /// change after it is first received, but this will change if/when the API changes to allow
1162    /// relinking of views.
1163    ///
1164    /// The ViewRef is not returned until the View is included in the View tree, in other words when
1165    /// there is a chain of ancestor transforms all the way back up to the root of the scene graph,
1166    /// i.e. the display.
1167    ///
1168    /// It is invalid to call `GetViewRef` while a previous call is still pending. Doing so will
1169    /// cause both this channel and the Flatland channel that handed out ChildViewWatcher to be
1170    /// closed.
1171    ///
1172    /// A `GetViewRef` call will hang if the View was created using `CreateView`, but returns the
1173    /// View if the View was created using CreateView2. This is because `CreateView` does not mint
1174    /// a ViewRef for that View.
1175    pub fn r#get_view_ref(
1176        &self,
1177    ) -> fidl::client::QueryResponseFut<
1178        fidl_fuchsia_ui_views::ViewRef,
1179        fidl::encoding::DefaultFuchsiaResourceDialect,
1180    > {
1181        ChildViewWatcherProxyInterface::r#get_view_ref(self)
1182    }
1183}
1184
1185impl ChildViewWatcherProxyInterface for ChildViewWatcherProxy {
1186    type GetStatusResponseFut = fidl::client::QueryResponseFut<
1187        ChildViewStatus,
1188        fidl::encoding::DefaultFuchsiaResourceDialect,
1189    >;
1190    fn r#get_status(&self) -> Self::GetStatusResponseFut {
1191        fn _decode(
1192            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1193        ) -> Result<ChildViewStatus, fidl::Error> {
1194            let _response = fidl::client::decode_transaction_body::<
1195                ChildViewWatcherGetStatusResponse,
1196                fidl::encoding::DefaultFuchsiaResourceDialect,
1197                0x1d622075f4fc8243,
1198            >(_buf?)?;
1199            Ok(_response.status)
1200        }
1201        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ChildViewStatus>(
1202            (),
1203            0x1d622075f4fc8243,
1204            fidl::encoding::DynamicFlags::empty(),
1205            _decode,
1206        )
1207    }
1208
1209    type GetViewRefResponseFut = fidl::client::QueryResponseFut<
1210        fidl_fuchsia_ui_views::ViewRef,
1211        fidl::encoding::DefaultFuchsiaResourceDialect,
1212    >;
1213    fn r#get_view_ref(&self) -> Self::GetViewRefResponseFut {
1214        fn _decode(
1215            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1216        ) -> Result<fidl_fuchsia_ui_views::ViewRef, fidl::Error> {
1217            let _response = fidl::client::decode_transaction_body::<
1218                ChildViewWatcherGetViewRefResponse,
1219                fidl::encoding::DefaultFuchsiaResourceDialect,
1220                0x3b2f3ca31e8908b4,
1221            >(_buf?)?;
1222            Ok(_response.view_ref)
1223        }
1224        self.client
1225            .send_query_and_decode::<fidl::encoding::EmptyPayload, fidl_fuchsia_ui_views::ViewRef>(
1226                (),
1227                0x3b2f3ca31e8908b4,
1228                fidl::encoding::DynamicFlags::empty(),
1229                _decode,
1230            )
1231    }
1232}
1233
1234pub struct ChildViewWatcherEventStream {
1235    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1236}
1237
1238impl std::marker::Unpin for ChildViewWatcherEventStream {}
1239
1240impl futures::stream::FusedStream for ChildViewWatcherEventStream {
1241    fn is_terminated(&self) -> bool {
1242        self.event_receiver.is_terminated()
1243    }
1244}
1245
1246impl futures::Stream for ChildViewWatcherEventStream {
1247    type Item = Result<ChildViewWatcherEvent, fidl::Error>;
1248
1249    fn poll_next(
1250        mut self: std::pin::Pin<&mut Self>,
1251        cx: &mut std::task::Context<'_>,
1252    ) -> std::task::Poll<Option<Self::Item>> {
1253        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1254            &mut self.event_receiver,
1255            cx
1256        )?) {
1257            Some(buf) => std::task::Poll::Ready(Some(ChildViewWatcherEvent::decode(buf))),
1258            None => std::task::Poll::Ready(None),
1259        }
1260    }
1261}
1262
1263#[derive(Debug)]
1264pub enum ChildViewWatcherEvent {}
1265
1266impl ChildViewWatcherEvent {
1267    /// Decodes a message buffer as a [`ChildViewWatcherEvent`].
1268    fn decode(
1269        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1270    ) -> Result<ChildViewWatcherEvent, fidl::Error> {
1271        let (bytes, _handles) = buf.split_mut();
1272        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1273        debug_assert_eq!(tx_header.tx_id, 0);
1274        match tx_header.ordinal {
1275            _ => Err(fidl::Error::UnknownOrdinal {
1276                ordinal: tx_header.ordinal,
1277                protocol_name:
1278                    <ChildViewWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1279            }),
1280        }
1281    }
1282}
1283
1284/// A Stream of incoming requests for fuchsia.ui.composition/ChildViewWatcher.
1285pub struct ChildViewWatcherRequestStream {
1286    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1287    is_terminated: bool,
1288}
1289
1290impl std::marker::Unpin for ChildViewWatcherRequestStream {}
1291
1292impl futures::stream::FusedStream for ChildViewWatcherRequestStream {
1293    fn is_terminated(&self) -> bool {
1294        self.is_terminated
1295    }
1296}
1297
1298impl fidl::endpoints::RequestStream for ChildViewWatcherRequestStream {
1299    type Protocol = ChildViewWatcherMarker;
1300    type ControlHandle = ChildViewWatcherControlHandle;
1301
1302    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1303        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1304    }
1305
1306    fn control_handle(&self) -> Self::ControlHandle {
1307        ChildViewWatcherControlHandle { inner: self.inner.clone() }
1308    }
1309
1310    fn into_inner(
1311        self,
1312    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1313    {
1314        (self.inner, self.is_terminated)
1315    }
1316
1317    fn from_inner(
1318        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1319        is_terminated: bool,
1320    ) -> Self {
1321        Self { inner, is_terminated }
1322    }
1323}
1324
1325impl futures::Stream for ChildViewWatcherRequestStream {
1326    type Item = Result<ChildViewWatcherRequest, fidl::Error>;
1327
1328    fn poll_next(
1329        mut self: std::pin::Pin<&mut Self>,
1330        cx: &mut std::task::Context<'_>,
1331    ) -> std::task::Poll<Option<Self::Item>> {
1332        let this = &mut *self;
1333        if this.inner.check_shutdown(cx) {
1334            this.is_terminated = true;
1335            return std::task::Poll::Ready(None);
1336        }
1337        if this.is_terminated {
1338            panic!("polled ChildViewWatcherRequestStream after completion");
1339        }
1340        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1341            |bytes, handles| {
1342                match this.inner.channel().read_etc(cx, bytes, handles) {
1343                    std::task::Poll::Ready(Ok(())) => {}
1344                    std::task::Poll::Pending => return std::task::Poll::Pending,
1345                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1346                        this.is_terminated = true;
1347                        return std::task::Poll::Ready(None);
1348                    }
1349                    std::task::Poll::Ready(Err(e)) => {
1350                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1351                            e.into(),
1352                        ))));
1353                    }
1354                }
1355
1356                // A message has been received from the channel
1357                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1358
1359                std::task::Poll::Ready(Some(match header.ordinal {
1360                    0x1d622075f4fc8243 => {
1361                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1362                        let mut req = fidl::new_empty!(
1363                            fidl::encoding::EmptyPayload,
1364                            fidl::encoding::DefaultFuchsiaResourceDialect
1365                        );
1366                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1367                        let control_handle =
1368                            ChildViewWatcherControlHandle { inner: this.inner.clone() };
1369                        Ok(ChildViewWatcherRequest::GetStatus {
1370                            responder: ChildViewWatcherGetStatusResponder {
1371                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1372                                tx_id: header.tx_id,
1373                            },
1374                        })
1375                    }
1376                    0x3b2f3ca31e8908b4 => {
1377                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1378                        let mut req = fidl::new_empty!(
1379                            fidl::encoding::EmptyPayload,
1380                            fidl::encoding::DefaultFuchsiaResourceDialect
1381                        );
1382                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1383                        let control_handle =
1384                            ChildViewWatcherControlHandle { inner: this.inner.clone() };
1385                        Ok(ChildViewWatcherRequest::GetViewRef {
1386                            responder: ChildViewWatcherGetViewRefResponder {
1387                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1388                                tx_id: header.tx_id,
1389                            },
1390                        })
1391                    }
1392                    _ => Err(fidl::Error::UnknownOrdinal {
1393                        ordinal: header.ordinal,
1394                        protocol_name:
1395                            <ChildViewWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1396                    }),
1397                }))
1398            },
1399        )
1400    }
1401}
1402
1403/// A protocol that provides information about a particular child View which is attached to the
1404/// Viewport owned by the parent client; connections to this protocol are estabished in
1405/// [`CreateViewport`].  Since a Flatland instance may contain any number of Viewports, each of
1406/// which may or may not be attached to a transform, the client can maintain connections to an
1407/// equal number of ChildViewWatcher instances.
1408///
1409/// Each ChildViewWatcher instance will remain connected as long as the corresponding child View
1410/// exists; the connection will also be closed if the child's ViewCreationToken is dropped without
1411/// using it to create a View.
1412#[derive(Debug)]
1413pub enum ChildViewWatcherRequest {
1414    /// A hanging get for receiving the status of a View. This provides information to the parent,
1415    /// such as whether or not the child has successfully presented content through this View.
1416    ///
1417    /// This hanging get will only fire when the ChildViewStatus is different than the previously
1418    /// returned ChildViewStatus.  This can happen immediately, and even if the creator of the
1419    /// Viewport hasn't yet called Present() after calling CreateViewport().  This allows the parent
1420    /// to know that the child has content ready to display before the parent modifies their own
1421    /// local scene graph to incorporate the child content.
1422    ///
1423    /// It is invalid to call `GetStatus` while a previous call is still pending. Doing so will
1424    /// cause both this channel and the Flatland channel that handed out ChildViewWatcher to be
1425    /// closed.
1426    GetStatus { responder: ChildViewWatcherGetStatusResponder },
1427    /// Hanging get to receive the ViewRef of the child View. This will only fire when the View ref
1428    /// is different from the previously-returned View ref. Note: currently the View ref will not
1429    /// change after it is first received, but this will change if/when the API changes to allow
1430    /// relinking of views.
1431    ///
1432    /// The ViewRef is not returned until the View is included in the View tree, in other words when
1433    /// there is a chain of ancestor transforms all the way back up to the root of the scene graph,
1434    /// i.e. the display.
1435    ///
1436    /// It is invalid to call `GetViewRef` while a previous call is still pending. Doing so will
1437    /// cause both this channel and the Flatland channel that handed out ChildViewWatcher to be
1438    /// closed.
1439    ///
1440    /// A `GetViewRef` call will hang if the View was created using `CreateView`, but returns the
1441    /// View if the View was created using CreateView2. This is because `CreateView` does not mint
1442    /// a ViewRef for that View.
1443    GetViewRef { responder: ChildViewWatcherGetViewRefResponder },
1444}
1445
1446impl ChildViewWatcherRequest {
1447    #[allow(irrefutable_let_patterns)]
1448    pub fn into_get_status(self) -> Option<(ChildViewWatcherGetStatusResponder)> {
1449        if let ChildViewWatcherRequest::GetStatus { responder } = self {
1450            Some((responder))
1451        } else {
1452            None
1453        }
1454    }
1455
1456    #[allow(irrefutable_let_patterns)]
1457    pub fn into_get_view_ref(self) -> Option<(ChildViewWatcherGetViewRefResponder)> {
1458        if let ChildViewWatcherRequest::GetViewRef { responder } = self {
1459            Some((responder))
1460        } else {
1461            None
1462        }
1463    }
1464
1465    /// Name of the method defined in FIDL
1466    pub fn method_name(&self) -> &'static str {
1467        match *self {
1468            ChildViewWatcherRequest::GetStatus { .. } => "get_status",
1469            ChildViewWatcherRequest::GetViewRef { .. } => "get_view_ref",
1470        }
1471    }
1472}
1473
1474#[derive(Debug, Clone)]
1475pub struct ChildViewWatcherControlHandle {
1476    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1477}
1478
1479impl fidl::endpoints::ControlHandle for ChildViewWatcherControlHandle {
1480    fn shutdown(&self) {
1481        self.inner.shutdown()
1482    }
1483    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1484        self.inner.shutdown_with_epitaph(status)
1485    }
1486
1487    fn is_closed(&self) -> bool {
1488        self.inner.channel().is_closed()
1489    }
1490    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1491        self.inner.channel().on_closed()
1492    }
1493
1494    #[cfg(target_os = "fuchsia")]
1495    fn signal_peer(
1496        &self,
1497        clear_mask: zx::Signals,
1498        set_mask: zx::Signals,
1499    ) -> Result<(), zx_status::Status> {
1500        use fidl::Peered;
1501        self.inner.channel().signal_peer(clear_mask, set_mask)
1502    }
1503}
1504
1505impl ChildViewWatcherControlHandle {}
1506
1507#[must_use = "FIDL methods require a response to be sent"]
1508#[derive(Debug)]
1509pub struct ChildViewWatcherGetStatusResponder {
1510    control_handle: std::mem::ManuallyDrop<ChildViewWatcherControlHandle>,
1511    tx_id: u32,
1512}
1513
1514/// Set the the channel to be shutdown (see [`ChildViewWatcherControlHandle::shutdown`])
1515/// if the responder is dropped without sending a response, so that the client
1516/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1517impl std::ops::Drop for ChildViewWatcherGetStatusResponder {
1518    fn drop(&mut self) {
1519        self.control_handle.shutdown();
1520        // Safety: drops once, never accessed again
1521        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1522    }
1523}
1524
1525impl fidl::endpoints::Responder for ChildViewWatcherGetStatusResponder {
1526    type ControlHandle = ChildViewWatcherControlHandle;
1527
1528    fn control_handle(&self) -> &ChildViewWatcherControlHandle {
1529        &self.control_handle
1530    }
1531
1532    fn drop_without_shutdown(mut self) {
1533        // Safety: drops once, never accessed again due to mem::forget
1534        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1535        // Prevent Drop from running (which would shut down the channel)
1536        std::mem::forget(self);
1537    }
1538}
1539
1540impl ChildViewWatcherGetStatusResponder {
1541    /// Sends a response to the FIDL transaction.
1542    ///
1543    /// Sets the channel to shutdown if an error occurs.
1544    pub fn send(self, mut status: ChildViewStatus) -> Result<(), fidl::Error> {
1545        let _result = self.send_raw(status);
1546        if _result.is_err() {
1547            self.control_handle.shutdown();
1548        }
1549        self.drop_without_shutdown();
1550        _result
1551    }
1552
1553    /// Similar to "send" but does not shutdown the channel if an error occurs.
1554    pub fn send_no_shutdown_on_err(self, mut status: ChildViewStatus) -> Result<(), fidl::Error> {
1555        let _result = self.send_raw(status);
1556        self.drop_without_shutdown();
1557        _result
1558    }
1559
1560    fn send_raw(&self, mut status: ChildViewStatus) -> Result<(), fidl::Error> {
1561        self.control_handle.inner.send::<ChildViewWatcherGetStatusResponse>(
1562            (status,),
1563            self.tx_id,
1564            0x1d622075f4fc8243,
1565            fidl::encoding::DynamicFlags::empty(),
1566        )
1567    }
1568}
1569
1570#[must_use = "FIDL methods require a response to be sent"]
1571#[derive(Debug)]
1572pub struct ChildViewWatcherGetViewRefResponder {
1573    control_handle: std::mem::ManuallyDrop<ChildViewWatcherControlHandle>,
1574    tx_id: u32,
1575}
1576
1577/// Set the the channel to be shutdown (see [`ChildViewWatcherControlHandle::shutdown`])
1578/// if the responder is dropped without sending a response, so that the client
1579/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1580impl std::ops::Drop for ChildViewWatcherGetViewRefResponder {
1581    fn drop(&mut self) {
1582        self.control_handle.shutdown();
1583        // Safety: drops once, never accessed again
1584        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1585    }
1586}
1587
1588impl fidl::endpoints::Responder for ChildViewWatcherGetViewRefResponder {
1589    type ControlHandle = ChildViewWatcherControlHandle;
1590
1591    fn control_handle(&self) -> &ChildViewWatcherControlHandle {
1592        &self.control_handle
1593    }
1594
1595    fn drop_without_shutdown(mut self) {
1596        // Safety: drops once, never accessed again due to mem::forget
1597        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1598        // Prevent Drop from running (which would shut down the channel)
1599        std::mem::forget(self);
1600    }
1601}
1602
1603impl ChildViewWatcherGetViewRefResponder {
1604    /// Sends a response to the FIDL transaction.
1605    ///
1606    /// Sets the channel to shutdown if an error occurs.
1607    pub fn send(self, mut view_ref: fidl_fuchsia_ui_views::ViewRef) -> Result<(), fidl::Error> {
1608        let _result = self.send_raw(view_ref);
1609        if _result.is_err() {
1610            self.control_handle.shutdown();
1611        }
1612        self.drop_without_shutdown();
1613        _result
1614    }
1615
1616    /// Similar to "send" but does not shutdown the channel if an error occurs.
1617    pub fn send_no_shutdown_on_err(
1618        self,
1619        mut view_ref: fidl_fuchsia_ui_views::ViewRef,
1620    ) -> Result<(), fidl::Error> {
1621        let _result = self.send_raw(view_ref);
1622        self.drop_without_shutdown();
1623        _result
1624    }
1625
1626    fn send_raw(&self, mut view_ref: fidl_fuchsia_ui_views::ViewRef) -> Result<(), fidl::Error> {
1627        self.control_handle.inner.send::<ChildViewWatcherGetViewRefResponse>(
1628            (&mut view_ref,),
1629            self.tx_id,
1630            0x3b2f3ca31e8908b4,
1631            fidl::encoding::DynamicFlags::empty(),
1632        )
1633    }
1634}
1635
1636#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1637pub struct FlatlandMarker;
1638
1639impl fidl::endpoints::ProtocolMarker for FlatlandMarker {
1640    type Proxy = FlatlandProxy;
1641    type RequestStream = FlatlandRequestStream;
1642    #[cfg(target_os = "fuchsia")]
1643    type SynchronousProxy = FlatlandSynchronousProxy;
1644
1645    const DEBUG_NAME: &'static str = "fuchsia.ui.composition.Flatland";
1646}
1647impl fidl::endpoints::DiscoverableProtocolMarker for FlatlandMarker {}
1648
1649pub trait FlatlandProxyInterface: Send + Sync {
1650    fn r#present(&self, args: PresentArgs) -> Result<(), fidl::Error>;
1651    fn r#create_view(
1652        &self,
1653        token: fidl_fuchsia_ui_views::ViewCreationToken,
1654        parent_viewport_watcher: fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>,
1655    ) -> Result<(), fidl::Error>;
1656    fn r#create_view2(
1657        &self,
1658        token: fidl_fuchsia_ui_views::ViewCreationToken,
1659        view_identity: fidl_fuchsia_ui_views::ViewIdentityOnCreation,
1660        protocols: ViewBoundProtocols,
1661        parent_viewport_watcher: fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>,
1662    ) -> Result<(), fidl::Error>;
1663    fn r#create_transform(&self, transform_id: &TransformId) -> Result<(), fidl::Error>;
1664    fn r#set_translation(
1665        &self,
1666        transform_id: &TransformId,
1667        translation: &fidl_fuchsia_math::Vec_,
1668    ) -> Result<(), fidl::Error>;
1669    fn r#set_orientation(
1670        &self,
1671        transform_id: &TransformId,
1672        orientation: Orientation,
1673    ) -> Result<(), fidl::Error>;
1674    fn r#set_scale(
1675        &self,
1676        transform_id: &TransformId,
1677        scale: &fidl_fuchsia_math::VecF,
1678    ) -> Result<(), fidl::Error>;
1679    fn r#set_opacity(&self, transform_id: &TransformId, value: f32) -> Result<(), fidl::Error>;
1680    fn r#set_clip_boundary(
1681        &self,
1682        transform_id: &TransformId,
1683        rect: Option<&fidl_fuchsia_math::Rect>,
1684    ) -> Result<(), fidl::Error>;
1685    fn r#add_child(
1686        &self,
1687        parent_transform_id: &TransformId,
1688        child_transform_id: &TransformId,
1689    ) -> Result<(), fidl::Error>;
1690    fn r#remove_child(
1691        &self,
1692        parent_transform_id: &TransformId,
1693        child_transform_id: &TransformId,
1694    ) -> Result<(), fidl::Error>;
1695    fn r#replace_children(
1696        &self,
1697        parent_transform_id: &TransformId,
1698        new_child_transform_ids: &[TransformId],
1699    ) -> Result<(), fidl::Error>;
1700    fn r#set_root_transform(&self, transform_id: &TransformId) -> Result<(), fidl::Error>;
1701    fn r#set_hit_regions(
1702        &self,
1703        transform_id: &TransformId,
1704        regions: &[HitRegion],
1705    ) -> Result<(), fidl::Error>;
1706    fn r#set_infinite_hit_region(
1707        &self,
1708        transform_id: &TransformId,
1709        hit_test: HitTestInteraction,
1710    ) -> Result<(), fidl::Error>;
1711    fn r#create_viewport(
1712        &self,
1713        viewport_id: &ContentId,
1714        token: fidl_fuchsia_ui_views::ViewportCreationToken,
1715        properties: &ViewportProperties,
1716        child_view_watcher: fidl::endpoints::ServerEnd<ChildViewWatcherMarker>,
1717    ) -> Result<(), fidl::Error>;
1718    fn r#create_image(
1719        &self,
1720        image_id: &ContentId,
1721        import_token: BufferCollectionImportToken,
1722        vmo_index: u32,
1723        properties: &ImageProperties,
1724    ) -> Result<(), fidl::Error>;
1725    fn r#set_image_sample_region(
1726        &self,
1727        image_id: &ContentId,
1728        rect: &fidl_fuchsia_math::RectF,
1729    ) -> Result<(), fidl::Error>;
1730    fn r#set_image_destination_size(
1731        &self,
1732        image_id: &ContentId,
1733        size: &fidl_fuchsia_math::SizeU,
1734    ) -> Result<(), fidl::Error>;
1735    fn r#set_image_blending_function(
1736        &self,
1737        image_id: &ContentId,
1738        blend_mode: BlendMode,
1739    ) -> Result<(), fidl::Error>;
1740    fn r#set_image_blend_mode(
1741        &self,
1742        image_id: &ContentId,
1743        blend_mode: BlendMode2,
1744    ) -> Result<(), fidl::Error>;
1745    fn r#set_image_opacity(&self, image_id: &ContentId, val: f32) -> Result<(), fidl::Error>;
1746    fn r#set_image_flip(&self, image_id: &ContentId, flip: ImageFlip) -> Result<(), fidl::Error>;
1747    fn r#create_filled_rect(&self, rect_id: &ContentId) -> Result<(), fidl::Error>;
1748    fn r#set_solid_fill(
1749        &self,
1750        rect_id: &ContentId,
1751        color: &ColorRgba,
1752        size: &fidl_fuchsia_math::SizeU,
1753    ) -> Result<(), fidl::Error>;
1754    fn r#release_filled_rect(&self, rect_id: &ContentId) -> Result<(), fidl::Error>;
1755    fn r#set_content(
1756        &self,
1757        transform_id: &TransformId,
1758        content_id: &ContentId,
1759    ) -> Result<(), fidl::Error>;
1760    fn r#set_viewport_properties(
1761        &self,
1762        viewport_id: &ContentId,
1763        properties: &ViewportProperties,
1764    ) -> Result<(), fidl::Error>;
1765    fn r#release_transform(&self, transform_id: &TransformId) -> Result<(), fidl::Error>;
1766    fn r#release_view(&self) -> Result<(), fidl::Error>;
1767    type ReleaseViewportResponseFut: std::future::Future<
1768            Output = Result<fidl_fuchsia_ui_views::ViewportCreationToken, fidl::Error>,
1769        > + Send;
1770    fn r#release_viewport(&self, viewport_id: &ContentId) -> Self::ReleaseViewportResponseFut;
1771    fn r#release_image(&self, image_id: &ContentId) -> Result<(), fidl::Error>;
1772    fn r#clear(&self) -> Result<(), fidl::Error>;
1773    fn r#set_debug_name(&self, name: &str) -> Result<(), fidl::Error>;
1774}
1775#[derive(Debug)]
1776#[cfg(target_os = "fuchsia")]
1777pub struct FlatlandSynchronousProxy {
1778    client: fidl::client::sync::Client,
1779}
1780
1781#[cfg(target_os = "fuchsia")]
1782impl fidl::endpoints::SynchronousProxy for FlatlandSynchronousProxy {
1783    type Proxy = FlatlandProxy;
1784    type Protocol = FlatlandMarker;
1785
1786    fn from_channel(inner: fidl::Channel) -> Self {
1787        Self::new(inner)
1788    }
1789
1790    fn into_channel(self) -> fidl::Channel {
1791        self.client.into_channel()
1792    }
1793
1794    fn as_channel(&self) -> &fidl::Channel {
1795        self.client.as_channel()
1796    }
1797}
1798
1799#[cfg(target_os = "fuchsia")]
1800impl FlatlandSynchronousProxy {
1801    pub fn new(channel: fidl::Channel) -> Self {
1802        let protocol_name = <FlatlandMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1803        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1804    }
1805
1806    pub fn into_channel(self) -> fidl::Channel {
1807        self.client.into_channel()
1808    }
1809
1810    /// Waits until an event arrives and returns it. It is safe for other
1811    /// threads to make concurrent requests while waiting for an event.
1812    pub fn wait_for_event(
1813        &self,
1814        deadline: zx::MonotonicInstant,
1815    ) -> Result<FlatlandEvent, fidl::Error> {
1816        FlatlandEvent::decode(self.client.wait_for_event(deadline)?)
1817    }
1818
1819    /// Complete execution of all feed-forward operations.
1820    ///
1821    /// If executing an operation produces an error (e.g., CreateTransform(0)), an [`OnError`] event
1822    /// is emitted. Operations that produce errors are ignored and the channel is closed.
1823    ///
1824    /// If the execution is completed successfully, [`OnNextFrameBegin`] emits NO_ERROR along
1825    /// with other valid fields.
1826    ///
1827    /// The client may only call [`Present`] when they have a non-zero number of present credits,
1828    /// which are tracked by the server. The server may increment the number of credits when it
1829    /// fires the [`OnNextFrameBegin`] event, which informs the client when it receives additional
1830    /// present credits. Each [`Present`] call uses one present credit and decrements the server
1831    /// count by one. If the client calls [`Present`] with no present credits, the server will
1832    /// return a `NO_PRESENTS_REMAINING` error.
1833    ///
1834    /// The client should assume that prior to receiving any [`OnNextFrameBegin`] events, they have
1835    /// one present credit.
1836    ///
1837    /// Every [`Present`] call results in one [`OnNextFrameBegin`] event, and one
1838    /// [`OnFramePresented`] event, typically in that order.
1839    ///
1840    /// When the commands flushed by [`Present`] make it to display, an [`OnFramePresented`] event
1841    /// is fired. This event includes information pertaining to all [`Present`]s that had content
1842    /// that were part of that frame.
1843    ///
1844    /// See [`fuchsia.ui.composition/PresentArgs`] documentation above for more detailed information
1845    /// on what arguments are passed in and their role.
1846    pub fn r#present(&self, mut args: PresentArgs) -> Result<(), fidl::Error> {
1847        self.client.send::<FlatlandPresentRequest>(
1848            (&mut args,),
1849            0x50acc2aa1f0acec7,
1850            fidl::encoding::DynamicFlags::empty(),
1851        )
1852    }
1853
1854    /// Two Flatland instances may be connected in a parent-child relationship. The parent endpoint
1855    /// is held in a Viewport, and the child endpoint is held in a View. The parent Flatland
1856    /// instance that creates a Viewport has control over how the child's View is integrated into
1857    /// its own View.
1858    ///
1859    /// The lifecycle of a parent-child connection starts with two endpoints of a channel object:
1860    /// a ViewportCreationToken and a ViewCreationToken. Out-of-band protocols pass the
1861    /// ViewportCreationToken to the parent, which calls [`CreateViewport`], and the
1862    /// ViewCreationToken to the child, which calls [`CreateView`].
1863    ///
1864    /// Only nodes connected to the Root Transform in this Flatland instance will be rendered into
1865    /// the parent's Viewport.
1866    ///
1867    /// Calling [`CreateView`] a second time will disconnect the Root Transform from the existing
1868    /// parent's Viewport, and attach it to a new parent's Viewport. In other words, each View can
1869    /// only have one parent.
1870    ///
1871    /// This function is queued, meaning that the Root Transform will not be attached to the
1872    /// parent Viewport until [`Present`] is called. However, clients will receive information
1873    /// through their ParentViewportWatcher (e.g., LayoutInfo) immediately after calling this
1874    /// function, even if they have not called [`Present`] or [`SetRootTransform`]. This allows
1875    /// clients to wait for layout information from their parent before calling [`Present`].
1876    ///
1877    /// Any illegal operations on ParentViewportWatcher will cause both ParentViewportWatcher
1878    /// channel and this Flatland channel to be torn down.
1879    ///
1880    /// Lifecycle note. The lifetime of the ParentViewportWatcher channel is bound by the peer
1881    /// ViewportCreationToken. When the ViewportCreationToken dies, this ParentViewportWatcher
1882    /// channel is destroyed.
1883    ///
1884    /// Views and subgraphs of Views created using `CreateView` will not be represented in the
1885    /// ViewTree, and hence will not be able to participate in any ViewTree-dependent interactions
1886    /// such as touch, mouse or focus.
1887    /// The Flatland protocol provides no way for Views in the subgraph of a View created with
1888    /// `CreateView` to know that they are excluded from the ViewTree.
1889    pub fn r#create_view(
1890        &self,
1891        mut token: fidl_fuchsia_ui_views::ViewCreationToken,
1892        mut parent_viewport_watcher: fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>,
1893    ) -> Result<(), fidl::Error> {
1894        self.client.send::<FlatlandCreateViewRequest>(
1895            (&mut token, parent_viewport_watcher),
1896            0x504686eb25864780,
1897            fidl::encoding::DynamicFlags::empty(),
1898        )
1899    }
1900
1901    /// Identical to [`CreateView`], except it allows association of View identity (ViewRef) and
1902    /// view-bound protocols.
1903    pub fn r#create_view2(
1904        &self,
1905        mut token: fidl_fuchsia_ui_views::ViewCreationToken,
1906        mut view_identity: fidl_fuchsia_ui_views::ViewIdentityOnCreation,
1907        mut protocols: ViewBoundProtocols,
1908        mut parent_viewport_watcher: fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>,
1909    ) -> Result<(), fidl::Error> {
1910        self.client.send::<FlatlandCreateView2Request>(
1911            (&mut token, &mut view_identity, &mut protocols, parent_viewport_watcher),
1912            0x340a3a40c2fdbd5e,
1913            fidl::encoding::DynamicFlags::empty(),
1914        )
1915    }
1916
1917    /// Creates a new Transform node. Transforms are a hierarchical piece of a Flatland graph. They
1918    /// can have children, and can reference Content. A sub-graph represented by a Transform and its
1919    /// descendants can be rendered to a display.
1920    ///
1921    /// Transforms are kept alive, even when released, as long as they are children of either an
1922    /// unreleased Transform, or the Root Transform.
1923    ///
1924    /// Each Transform can have a single piece of attached Content. Common types of Content include
1925    /// bitmaps, asynchronous streams of images, and Viewports to Views hosted in other Flatland
1926    /// instances.
1927    ///
1928    /// Transforms have attributes. Child Transforms inherit the combined attributes of their
1929    /// parents. Content attached to a Transform is also affected by that Transform's attributes.
1930    ///
1931    /// When a sub-graph of Transforms is rendered, Content will be rendered back-to-front, starting
1932    /// with the Content on the root transform, and continuing recursively through all of its child
1933    /// Transforms in the order the children were added. See [`AddChild`] for more information.
1934    ///
1935    /// Zero is not a valid transform id. All other values are valid, assuming they are not already
1936    /// in use (see [`ReleaseTransform`] for more details).
1937    pub fn r#create_transform(&self, mut transform_id: &TransformId) -> Result<(), fidl::Error> {
1938        self.client.send::<FlatlandCreateTransformRequest>(
1939            (transform_id,),
1940            0x5e042a4d3de3efb0,
1941            fidl::encoding::DynamicFlags::empty(),
1942        )
1943    }
1944
1945    /// All Transform objects support all attributes.
1946    ///
1947    /// Geometric attributes are applied in the following order:
1948    /// 1. Scale (relative to the parent transform's coordinate space)
1949    /// 2. Orientation (relative to the parent transform's coordinate space)
1950    /// 3. Translation (relative to the parent transforms's coordinate space,
1951    ///    unaffected by scale applied to the current transform).
1952    /// 4. Clipping (relative to the current transform's coordinate space)
1953    ///
1954    /// The effects of each of these attributes are cumulative. This means the transform's position
1955    /// in the view space, and its clip boundary, will be calculated based on that chain of
1956    /// geometric attributes going up to the root transform.
1957    ///
1958    /// For instance, in a nested hierarchy such as the following:
1959    ///     [Root-Transform -> Transform1 -> Transform2 -> CurrentTransform]
1960    /// If Transform1 is translated by [2,0] and Transform2 is translated by [0,1] then the
1961    /// view-space position of CurrentTransform will be [2,1].
1962    ///
1963    /// Sets the translation on a Transform. The order of geometric attribute application is
1964    /// addressed above.
1965    pub fn r#set_translation(
1966        &self,
1967        mut transform_id: &TransformId,
1968        mut translation: &fidl_fuchsia_math::Vec_,
1969    ) -> Result<(), fidl::Error> {
1970        self.client.send::<FlatlandSetTranslationRequest>(
1971            (transform_id, translation),
1972            0x7863398291fba346,
1973            fidl::encoding::DynamicFlags::empty(),
1974        )
1975    }
1976
1977    /// Sets the orientation on a Transform. The order of geometric attribute application is
1978    /// addressed in the documentation for [`SetTranslation`]. In Flatland, the +X axis is
1979    /// to the right and the +Y axis is down. There is no notion of a Z axis. CCW is defined
1980    /// from the POV of the user, as if a skeuomorphoic clock is displayed on the screen.
1981    pub fn r#set_orientation(
1982        &self,
1983        mut transform_id: &TransformId,
1984        mut orientation: Orientation,
1985    ) -> Result<(), fidl::Error> {
1986        self.client.send::<FlatlandSetOrientationRequest>(
1987            (transform_id, orientation),
1988            0x4915310bc4928edc,
1989            fidl::encoding::DynamicFlags::empty(),
1990        )
1991    }
1992
1993    /// Sets the scale on a transform. The order of geometric attribute application is
1994    /// addressed above. The (x,y) values in the VecF |scale| refer to the scale factor in the
1995    /// x-axis (width) and y-axis (height) respectively. Scale values must be normal 32-bit
1996    /// floating point values: https://en.wikipedia.org/wiki/Normal_number_%28computing%29
1997    pub fn r#set_scale(
1998        &self,
1999        mut transform_id: &TransformId,
2000        mut scale: &fidl_fuchsia_math::VecF,
2001    ) -> Result<(), fidl::Error> {
2002        self.client.send::<FlatlandSetScaleRequest>(
2003            (transform_id, scale),
2004            0x1ea1766fd8996bb4,
2005            fidl::encoding::DynamicFlags::empty(),
2006        )
2007    }
2008
2009    /// Sets an opacity in linear space to be applied to a transform and its descendents,
2010    /// which include other transforms and content. Opacity values must be in the range
2011    /// of [0.0, 1.0], where 0.0 is completely transparent and 1.0 is completely opaque.
2012    /// Attempting to call this function with values outside that range will result in
2013    /// an error. A transform's opacity value is multiplied with that of its parent. This
2014    /// effect works differently from group opacity. Using group opacity, child nodes are
2015    /// rendered together first, and then have the parent's opacity applied as a post-effect.
2016    /// Here, opacity is applied to each child individually. This may result in a very
2017    /// different effect.
2018    pub fn r#set_opacity(
2019        &self,
2020        mut transform_id: &TransformId,
2021        mut value: f32,
2022    ) -> Result<(), fidl::Error> {
2023        self.client.send::<FlatlandSetOpacityRequest>(
2024            (transform_id, value),
2025            0x3775fc2c00b432fa,
2026            fidl::encoding::DynamicFlags::empty(),
2027        )
2028    }
2029
2030    /// Sets the bounds, expressed in the local coordinate space of the transform, that
2031    /// constrains the region that content attached to this transform can be rendered to.
2032    /// If the content's area exceeds the clip bounds, the area outside the bounds will
2033    /// not be rendered. These bounds are valid for all children of this transform node as
2034    /// well, which includes nested Flatland instances and their node hierarchies.
2035    /// If a child transform attempts to set clip bounds larger than that of its parent,
2036    /// it will be clipped to the parent's clip bounds. The default state is for a transform
2037    /// to be unclipped, meaning it will not have any bounds placed on its render region.
2038    /// The clip width/height must be positive. Negative values will result in an error.
2039    /// Passing in an empty box to the |rect| parameter will remove the clip bounds.
2040    pub fn r#set_clip_boundary(
2041        &self,
2042        mut transform_id: &TransformId,
2043        mut rect: Option<&fidl_fuchsia_math::Rect>,
2044    ) -> Result<(), fidl::Error> {
2045        self.client.send::<FlatlandSetClipBoundaryRequest>(
2046            (transform_id, rect),
2047            0x6507843df12222d2,
2048            fidl::encoding::DynamicFlags::empty(),
2049        )
2050    }
2051
2052    /// Adds a child Transform to a parent Transform. The new child Transform, and any Content
2053    /// attached to it or its children, will be rendered on top of the parent's Content, as well as
2054    /// any previously added children.
2055    pub fn r#add_child(
2056        &self,
2057        mut parent_transform_id: &TransformId,
2058        mut child_transform_id: &TransformId,
2059    ) -> Result<(), fidl::Error> {
2060        self.client.send::<FlatlandAddChildRequest>(
2061            (parent_transform_id, child_transform_id),
2062            0x67a8abd2f19b1a74,
2063            fidl::encoding::DynamicFlags::empty(),
2064        )
2065    }
2066
2067    /// Removes a child Transform from a parent Transform.
2068    pub fn r#remove_child(
2069        &self,
2070        mut parent_transform_id: &TransformId,
2071        mut child_transform_id: &TransformId,
2072    ) -> Result<(), fidl::Error> {
2073        self.client.send::<FlatlandRemoveChildRequest>(
2074            (parent_transform_id, child_transform_id),
2075            0x41d6cd90b298b67a,
2076            fidl::encoding::DynamicFlags::empty(),
2077        )
2078    }
2079
2080    /// Removes all child Transforms from a parent Transform and replaces them with the new child
2081    /// transforms in `new_child_transform_ids`.
2082    pub fn r#replace_children(
2083        &self,
2084        mut parent_transform_id: &TransformId,
2085        mut new_child_transform_ids: &[TransformId],
2086    ) -> Result<(), fidl::Error> {
2087        self.client.send::<FlatlandReplaceChildrenRequest>(
2088            (parent_transform_id, new_child_transform_ids),
2089            0x5b6d86cbbff81316,
2090            fidl::encoding::DynamicFlags::empty(),
2091        )
2092    }
2093
2094    /// Sets the Root Transform for the graph.
2095    ///
2096    /// The sub-graph defined by the Root Transform and its children will be rendered as View
2097    /// in the connected parent's Viewport (see [`CreateView`]). Any parents of the Root Transform
2098    /// in this Graph will be ignored.
2099    ///
2100    /// The Root Transform, and all children of the Root Transform, are kept alive if they are
2101    /// released (see [`ReleaseTransform`] for more details).
2102    ///
2103    /// There is only ever one Root. Since 0 is not a valid transform id (see [`CreateTransform`]),
2104    /// calling SetRootTransform(0) clears the current Root, destroying any previously released
2105    /// objects that are not referenced by the new root.
2106    ///
2107    /// Note that every View has a clip boundary equivalent to its logical size. Anything outside
2108    /// that clip boundary will not be rendered. Hence, the Root Transform has a useful coordinate
2109    /// space of (0, 0) to (logical_size.width, logical_size.height), where (0, 0) is the upper left
2110    /// corner.
2111    ///
2112    /// Setting the root transform installs a full screen hit region on the root transform. Clients
2113    /// may remove this hit region if they don't want users to be able to interact with the root
2114    /// transform's content. For additional details on hit regions, see the [`SetHitRegions`]
2115    /// documentation.
2116    ///
2117    /// Default hit region rules
2118    ///
2119    ///   A default hit region follows these rules:
2120    ///   - When [`SetRootTransform`](T) is called, T receives a maximal hit region, covering the
2121    ///   entire view.
2122    ///   - If [`SetHitRegions`] is called on T, either before or after [`SetRootTransform`](T),
2123    ///   then no default hit region is active and the client specified hit regions are used.
2124    ///   - If a transform is no longer the root transform, i.e., [`SetRootTransform`](U) is
2125    ///   called, then the original transform no longer has its default hit region.
2126    ///   - Clients can remove or modify the root transform's hit regions the same way they would
2127    ///   reset any other transform's hit regions, by calling [`SetHitRegions`] with the appropriate
2128    ///   vector.
2129    pub fn r#set_root_transform(&self, mut transform_id: &TransformId) -> Result<(), fidl::Error> {
2130        self.client.send::<FlatlandSetRootTransformRequest>(
2131            (transform_id,),
2132            0x6e80ca5bcc566cd8,
2133            fidl::encoding::DynamicFlags::empty(),
2134        )
2135    }
2136
2137    /// Sets the interactive areas for a Transform. By default, Content is not interactive; hit
2138    /// regions must be placed for a user to interact with the Content in a View. Because hit
2139    /// regions are described in the Flatland protocol, a Flatland instance can synchronize Content
2140    /// and hit regions.
2141    ///
2142    /// Each hit region is placed in the coordinate space of the owning Transform, and may or may
2143    /// not interact with different types of hit testing, depending on its [`HitTestInteraction`]
2144    /// type. When there are multiple hit regions that intersect with a hit test, the precedence
2145    /// rules given below dictate which hit region has interacted with the hit test. Only Transforms
2146    /// that transitively connect to the root Transform have their hit regions interact with a hit
2147    /// test.
2148    ///
2149    /// Calling this function replaces any previous values set on this Transform. To reset a
2150    /// Transform to "no hit testing": send an empty vector with [`SetHitRegions`].
2151    ///
2152    /// Note that root transforms get a default hit region installed by Flatland. For more details,
2153    /// see the [`SetRootTransform`] documentation.
2154    ///
2155    /// Precedence rules
2156    ///   Within a Transform, if multiple hit regions overlap, the hit test examines each
2157    ///   intersecting hit region for a possible interaction. Thus, for a regular hit test R and an
2158    ///   accessibility hit test A, where R and A both intersect two hit regions D ([`DEFAULT`]) and
2159    ///   S ([`SEMANTICALLY_INVISIBLE`]) on the same Transform, (1) R interacts with both D and S,
2160    ///   and (2) A only interacts with D. Generally, hit regions that overlap in a single Transform
2161    ///   can cause confusing behavior.
2162    ///
2163    ///   Within a View, for a given hit test, the front-most Transform's hit regions take
2164    ///   precedence over those behind. This follows the expected reverse "render order" of
2165    ///   Transforms (described in [`CreateTransform`]), where a user expects to interact with
2166    ///   Content that is visible, or front-most.
2167    ///
2168    ///   Across Flatland instances, for a given hit test, the front-most instance's front-most
2169    ///   Transform's hit regions take precedence over those behind. This follows the expected
2170    ///   reverse "render order" of views, where a user expects to interact with the View that is
2171    ///   visible, or front-most. For example, if a child View owns Content that is rendered over
2172    ///   the parent View, the user expects to interact with the child's Content.
2173    pub fn r#set_hit_regions(
2174        &self,
2175        mut transform_id: &TransformId,
2176        mut regions: &[HitRegion],
2177    ) -> Result<(), fidl::Error> {
2178        self.client.send::<FlatlandSetHitRegionsRequest>(
2179            (transform_id, regions),
2180            0x31c9d17b07c37ce4,
2181            fidl::encoding::DynamicFlags::empty(),
2182        )
2183    }
2184
2185    /// Identical to [`SetHitRegions`], except the hit region associated with [`transform_id`]
2186    /// covers an infinite region. The hit region is invariant against translation, scaling, and
2187    /// orientation of the Transform.
2188    ///
2189    /// An infinite hit region is still limited in extent by the View's clip boundary, just like a
2190    /// finite hit region.
2191    ///
2192    /// Calling this function replaces any previous values set on this Transform. To reset a
2193    /// Transform to "no hit testing": send an empty vector with [`SetHitRegions`].
2194    pub fn r#set_infinite_hit_region(
2195        &self,
2196        mut transform_id: &TransformId,
2197        mut hit_test: HitTestInteraction,
2198    ) -> Result<(), fidl::Error> {
2199        self.client.send::<FlatlandSetInfiniteHitRegionRequest>(
2200            (transform_id, hit_test),
2201            0x26d81af852d29562,
2202            fidl::encoding::DynamicFlags::empty(),
2203        )
2204    }
2205
2206    /// The Viewport and View pair, together, represent the connection between two Flatland
2207    /// instances. The Viewport is created in the parent, and the View is created in the child. The
2208    /// parent has control over how the child's View is integrated into its own View.
2209    ///
2210    /// Any illegal operations on ChildViewWatcher will cause both ChildViewWatcher channel and this
2211    /// Flatland channel to be torn down.
2212    ///
2213    /// `ViewportProperties` must have logical_size set. This is the initial size that will drive
2214    /// the layout of the child. The logical_size is also used as the default Content size, but
2215    /// subsequent changes to the logical_size will have no effect on the Content size.
2216    ///
2217    /// `ViewportProperties` may have inset field not set. In that case, the default value of
2218    /// (0, 0, 0, 0) is used.
2219    ///
2220    /// The logical_size must have positive X and Y components.
2221    ///
2222    /// Zero is not a valid ContentId. All other values are valid, assuming they are not already
2223    /// in use for another piece of Content (see [`ReleaseViewport`] for more details).
2224    ///
2225    /// Lifecycle note. The lifetime of the ChildViewWatcher channel is bound by the peer
2226    /// ViewCreationToken. When the ViewCreationToken dies, this ChildViewWatcher channel is
2227    /// destroyed.
2228    pub fn r#create_viewport(
2229        &self,
2230        mut viewport_id: &ContentId,
2231        mut token: fidl_fuchsia_ui_views::ViewportCreationToken,
2232        mut properties: &ViewportProperties,
2233        mut child_view_watcher: fidl::endpoints::ServerEnd<ChildViewWatcherMarker>,
2234    ) -> Result<(), fidl::Error> {
2235        self.client.send::<FlatlandCreateViewportRequest>(
2236            (viewport_id, &mut token, properties, child_view_watcher),
2237            0x2485fbcab7f943c,
2238            fidl::encoding::DynamicFlags::empty(),
2239        )
2240    }
2241
2242    /// An Image is a bitmap backed by a specific VMO in a BufferCollection.
2243    ///
2244    /// Image creation requires an allocated BufferCollection registered with Allocator. This
2245    /// function will fail unless all clients of the specified BufferCollection have set their
2246    /// constraints.
2247    ///
2248    /// The Image must reference a valid VMO index and must have ImageProperties that fall within
2249    /// the constraints specified by the backing BufferCollection (i.e. width and height within a
2250    /// valid range, etc.)
2251    ///
2252    /// Zero is not a valid Image id. All other values are valid, assuming they are not already in
2253    /// use for another piece of Content (see [`ReleaseImage`] for more details).
2254    pub fn r#create_image(
2255        &self,
2256        mut image_id: &ContentId,
2257        mut import_token: BufferCollectionImportToken,
2258        mut vmo_index: u32,
2259        mut properties: &ImageProperties,
2260    ) -> Result<(), fidl::Error> {
2261        self.client.send::<FlatlandCreateImageRequest>(
2262            (image_id, &mut import_token, vmo_index, properties),
2263            0x26fae823c4ebedad,
2264            fidl::encoding::DynamicFlags::empty(),
2265        )
2266    }
2267
2268    /// This function is used to determine the region (in texel space) of an image that will be used
2269    /// by Flatland when rendering. The image to be sampled is referenced by [`image_id`] and the
2270    /// sample region is specified by [`rect`] which itself is comprised of an origin point (x,y) as
2271    /// well as a width and height, in unnormalized coordinates. It is illegal to call this function
2272    /// on non-image content, or to sample a region outside of the texel space of the image. In
2273    /// other words, the region specifed by [`rect`] must not exceed the ranges (0, image_width) and
2274    /// (0, image_height). If (rect.x + rect.width > image_width) or (rect.y + rect.height >
2275    /// image_height) or if any of the values are negative, this will result in an error.
2276    ///
2277    /// If this method is not called, the default sample region is the rectangle with origin at
2278    /// (0, 0) and width and height set at ImageProperties from [`CreateImage`].
2279    pub fn r#set_image_sample_region(
2280        &self,
2281        mut image_id: &ContentId,
2282        mut rect: &fidl_fuchsia_math::RectF,
2283    ) -> Result<(), fidl::Error> {
2284        self.client.send::<FlatlandSetImageSampleRegionRequest>(
2285            (image_id, rect),
2286            0x8039391d715eb28,
2287            fidl::encoding::DynamicFlags::empty(),
2288        )
2289    }
2290
2291    /// The content size for an Image is the size of the rectangle in the parent's logical
2292    /// coordinate space that the image occupies. This combined with the global translation of the
2293    /// transform it is attached to determines the size and location of where the content is
2294    /// rendered on the display.
2295    ///
2296    /// If this method is not called, the default image destination size is the width and height set
2297    /// at ImageProperties from [`CreateImage`]. The destination size will be affected by scaling if
2298    /// [`SetScale`] is used on the attached Transform or its parents.
2299    pub fn r#set_image_destination_size(
2300        &self,
2301        mut image_id: &ContentId,
2302        mut size: &fidl_fuchsia_math::SizeU,
2303    ) -> Result<(), fidl::Error> {
2304        self.client.send::<FlatlandSetImageDestinationSizeRequest>(
2305            (image_id, size),
2306            0x766cf99a2ec58446,
2307            fidl::encoding::DynamicFlags::empty(),
2308        )
2309    }
2310
2311    /// Determines the blend function to use when rendering the content specified by
2312    /// |image_id|. |image_id| must be a valid ContentId associated to a transform through
2313    /// a call to |CreateImage| or |CreateFilledRect|. For details on the different blend functions
2314    /// that are available, please refer to the BlendMode enum. If this function is not called, then
2315    /// the default blendmode is BlendMode::SRC.
2316    pub fn r#set_image_blending_function(
2317        &self,
2318        mut image_id: &ContentId,
2319        mut blend_mode: BlendMode,
2320    ) -> Result<(), fidl::Error> {
2321        self.client.send::<FlatlandSetImageBlendingFunctionRequest>(
2322            (image_id, blend_mode),
2323            0x10f5da1356275b7b,
2324            fidl::encoding::DynamicFlags::empty(),
2325        )
2326    }
2327
2328    /// Determines the blend function to use when rendering the content specified by
2329    /// |image_id|. |image_id| must be a valid ContentId associated to a transform through
2330    /// a call to |CreateImage| or |CreateFilledRect|. For details on the different blend functions
2331    /// that are available, please refer to the BlendMode2 enum. If this function is not called,
2332    /// the default blendmode is BlendMode2::REPLACE.
2333    pub fn r#set_image_blend_mode(
2334        &self,
2335        mut image_id: &ContentId,
2336        mut blend_mode: BlendMode2,
2337    ) -> Result<(), fidl::Error> {
2338        self.client.send::<FlatlandSetImageBlendModeRequest>(
2339            (image_id, blend_mode),
2340            0x5b1667f130c3de67,
2341            fidl::encoding::DynamicFlags::empty(),
2342        )
2343    }
2344
2345    /// Sets an opacity in linear space to be applied to a flatland image. Opacity values must
2346    /// be in the range [0.0, 1.0].
2347    pub fn r#set_image_opacity(
2348        &self,
2349        mut image_id: &ContentId,
2350        mut val: f32,
2351    ) -> Result<(), fidl::Error> {
2352        self.client.send::<FlatlandSetImageOpacityRequest>(
2353            (image_id, val),
2354            0x2da9e4ef4c2cff6f,
2355            fidl::encoding::DynamicFlags::empty(),
2356        )
2357    }
2358
2359    /// Sets the image flip to be applied to a flatland image. This call must be performed after a
2360    /// successful |CreateImage| call. If an invalid |image_id| is supplied, the channel will be
2361    /// closed due to FlatlandError::BAD_OPERATION. This flip will be applied to the Image before
2362    /// parent Transform Orientations. If this function is not called, then the default flip value
2363    /// is ImageFlip::NONE.
2364    pub fn r#set_image_flip(
2365        &self,
2366        mut image_id: &ContentId,
2367        mut flip: ImageFlip,
2368    ) -> Result<(), fidl::Error> {
2369        self.client.send::<FlatlandSetImageFlipRequest>(
2370            (image_id, flip),
2371            0x21b20f2c14aae6bc,
2372            fidl::encoding::DynamicFlags::empty(),
2373        )
2374    }
2375
2376    /// Creates a solid-color rectangle. By default a filled-rect does not have a defined
2377    /// color or size. It is necessary to call |SetSolidFill| to specify a color and size
2378    /// before a filled rect can be used for rendering. Not doing so will result the
2379    pub fn r#create_filled_rect(&self, mut rect_id: &ContentId) -> Result<(), fidl::Error> {
2380        self.client.send::<FlatlandCreateFilledRectRequest>(
2381            (rect_id,),
2382            0x5e62355abc1c4c5d,
2383            fidl::encoding::DynamicFlags::empty(),
2384        )
2385    }
2386
2387    /// Defines the color and size of a filled rect. |rect_id| must refer to content that
2388    /// was created via a call to CreateFilledRect. The color is not premultiplied. Color values
2389    /// must be within the range [0,1] inclusive, and normal 32-bit
2390    /// floating point values: https://en.wikipedia.org/wiki/Normal_number_%28computing%29. Values
2391    /// that do not conform to these specifications will cause the channel to close.
2392    /// The rectangle's top left corner will be at (0, 0) in its transform's coordinate space.
2393    /// Hence, its bottom right corner will be at (size.width, size.height).
2394    pub fn r#set_solid_fill(
2395        &self,
2396        mut rect_id: &ContentId,
2397        mut color: &ColorRgba,
2398        mut size: &fidl_fuchsia_math::SizeU,
2399    ) -> Result<(), fidl::Error> {
2400        self.client.send::<FlatlandSetSolidFillRequest>(
2401            (rect_id, color, size),
2402            0x32d6ef41e182dfa5,
2403            fidl::encoding::DynamicFlags::empty(),
2404        )
2405    }
2406
2407    /// Automatically garbage collects the rectangle when it is no longer needed for
2408    /// rendering. |rect_id| must have been instantiated with a call to
2409    /// |CreateFilledRect|. Once released, the ID immediately goes out of scope and is free
2410    /// to be used again.
2411    pub fn r#release_filled_rect(&self, mut rect_id: &ContentId) -> Result<(), fidl::Error> {
2412        self.client.send::<FlatlandReleaseFilledRectRequest>(
2413            (rect_id,),
2414            0x7392cabe45618f9b,
2415            fidl::encoding::DynamicFlags::empty(),
2416        )
2417    }
2418
2419    /// Setting a piece of Content on a Transform makes that Content visible in the render tree as
2420    /// long as the Transform is visible from the root Transform. The Content will be rendered
2421    /// before, and therefore "behind", any Content attached to the descendants of the Transform.
2422    ///
2423    /// Because each Transform can have, at most, a single piece of Content on it, calling this
2424    /// function on a Transform that already has Content will replace that Content.
2425    ///
2426    /// A Content may be set on more than one Transform.
2427    ///
2428    /// Calling this function with a Content id of 0 will remove any Content currently on the
2429    /// Transform.
2430    pub fn r#set_content(
2431        &self,
2432        mut transform_id: &TransformId,
2433        mut content_id: &ContentId,
2434    ) -> Result<(), fidl::Error> {
2435        self.client.send::<FlatlandSetContentRequest>(
2436            (transform_id, content_id),
2437            0x4ed2cfc0ce130862,
2438            fidl::encoding::DynamicFlags::empty(),
2439        )
2440    }
2441
2442    /// Transforms are usually sufficient to change how Content is presented. Viewports, however,
2443    /// have special properties that are not part of the Transform hierarchy. Those properties can
2444    /// be set using this function.
2445    pub fn r#set_viewport_properties(
2446        &self,
2447        mut viewport_id: &ContentId,
2448        mut properties: &ViewportProperties,
2449    ) -> Result<(), fidl::Error> {
2450        self.client.send::<FlatlandSetViewportPropertiesRequest>(
2451            (viewport_id, properties),
2452            0x66ab67e9608ddb9f,
2453            fidl::encoding::DynamicFlags::empty(),
2454        )
2455    }
2456
2457    /// Released Transforms will be garbage collected by the system once they are no longer
2458    /// necessary for rendering. For Transforms, this means there is no path from any unreleased
2459    /// Transform to the newly-released Transform.
2460    ///
2461    /// Once released, the id immediately goes out of scope for future function calls and can be
2462    /// reused when creating new Transforms.
2463    ///
2464    /// It is an error to call functions with a released id (unless that id has been reused to
2465    /// construct a new Transform).
2466    pub fn r#release_transform(&self, mut transform_id: &TransformId) -> Result<(), fidl::Error> {
2467        self.client.send::<FlatlandReleaseTransformRequest>(
2468            (transform_id,),
2469            0xab9328419451c22,
2470            fidl::encoding::DynamicFlags::empty(),
2471        )
2472    }
2473
2474    pub fn r#release_view(&self) -> Result<(), fidl::Error> {
2475        self.client.send::<fidl::encoding::EmptyPayload>(
2476            (),
2477            0x5b35aab9baffecae,
2478            fidl::encoding::DynamicFlags::empty(),
2479        )
2480    }
2481
2482    /// Releases a Viewport from the scene, even if the Viewport is still connected to a Transform.
2483    /// Unlike other resources, Viewports are garbage collected by the system during the next
2484    /// [`Present`] because a removed Viewport is guaranteed to provide no renderable content.
2485    ///
2486    /// Use SetContent(transform_id, 0) to clean up references to released Viewports.
2487    ///
2488    /// Despite having a return type, this function is still feed-forward like [`CreateView`] and
2489    /// requires a call to [`Present`] to be executed. The ViewportCreationToken will be returned
2490    /// after the presented operations have been executed.
2491    pub fn r#release_viewport(
2492        &self,
2493        mut viewport_id: &ContentId,
2494        ___deadline: zx::MonotonicInstant,
2495    ) -> Result<fidl_fuchsia_ui_views::ViewportCreationToken, fidl::Error> {
2496        let _response = self
2497            .client
2498            .send_query::<FlatlandReleaseViewportRequest, FlatlandReleaseViewportResponse>(
2499                (viewport_id,),
2500                0xbad474aeb5293f9,
2501                fidl::encoding::DynamicFlags::empty(),
2502                ___deadline,
2503            )?;
2504        Ok(_response.token)
2505    }
2506
2507    /// Released Images will be garbage collected by the system once they are no longer necessary
2508    /// for rendering. For Images, this means the Image is no longer attached to any Transform and
2509    /// any pending rendering that references the Image is complete.
2510    ///
2511    /// Use SetContent(transform_id, 0) to clean up references to released Images.
2512    ///
2513    /// Once released, the id immediately goes out of scope for future function calls and can be
2514    /// reused when creating new Images.
2515    ///
2516    /// It is an error to call functions with a released id (unless that id has been reused to
2517    /// construct a new Image).
2518    pub fn r#release_image(&self, mut image_id: &ContentId) -> Result<(), fidl::Error> {
2519        self.client.send::<FlatlandReleaseImageRequest>(
2520            (image_id,),
2521            0xb884ffdbc72c111,
2522            fidl::encoding::DynamicFlags::empty(),
2523        )
2524    }
2525
2526    /// This function will reset all state on this interface. This includes destroying all existing
2527    /// View and Viewports without returning the associated Token to the caller.
2528    pub fn r#clear(&self) -> Result<(), fidl::Error> {
2529        self.client.send::<fidl::encoding::EmptyPayload>(
2530            (),
2531            0x4ec8817c02828c3e,
2532            fidl::encoding::DynamicFlags::empty(),
2533        )
2534    }
2535
2536    /// Set debug name of the current client that can be used by Flatland to print as a prefix to
2537    /// logs to help client distinguish what is theirs. [`name`] can be an arbitrary string, but the
2538    /// current process name (see fsl::GetCurrentProcessName()) is a good default.
2539    pub fn r#set_debug_name(&self, mut name: &str) -> Result<(), fidl::Error> {
2540        self.client.send::<FlatlandSetDebugNameRequest>(
2541            (name,),
2542            0x46a8b397e68a8888,
2543            fidl::encoding::DynamicFlags::empty(),
2544        )
2545    }
2546}
2547
2548#[cfg(target_os = "fuchsia")]
2549impl From<FlatlandSynchronousProxy> for zx::Handle {
2550    fn from(value: FlatlandSynchronousProxy) -> Self {
2551        value.into_channel().into()
2552    }
2553}
2554
2555#[cfg(target_os = "fuchsia")]
2556impl From<fidl::Channel> for FlatlandSynchronousProxy {
2557    fn from(value: fidl::Channel) -> Self {
2558        Self::new(value)
2559    }
2560}
2561
2562#[cfg(target_os = "fuchsia")]
2563impl fidl::endpoints::FromClient for FlatlandSynchronousProxy {
2564    type Protocol = FlatlandMarker;
2565
2566    fn from_client(value: fidl::endpoints::ClientEnd<FlatlandMarker>) -> Self {
2567        Self::new(value.into_channel())
2568    }
2569}
2570
2571#[derive(Debug, Clone)]
2572pub struct FlatlandProxy {
2573    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2574}
2575
2576impl fidl::endpoints::Proxy for FlatlandProxy {
2577    type Protocol = FlatlandMarker;
2578
2579    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2580        Self::new(inner)
2581    }
2582
2583    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2584        self.client.into_channel().map_err(|client| Self { client })
2585    }
2586
2587    fn as_channel(&self) -> &::fidl::AsyncChannel {
2588        self.client.as_channel()
2589    }
2590}
2591
2592impl FlatlandProxy {
2593    /// Create a new Proxy for fuchsia.ui.composition/Flatland.
2594    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2595        let protocol_name = <FlatlandMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2596        Self { client: fidl::client::Client::new(channel, protocol_name) }
2597    }
2598
2599    /// Get a Stream of events from the remote end of the protocol.
2600    ///
2601    /// # Panics
2602    ///
2603    /// Panics if the event stream was already taken.
2604    pub fn take_event_stream(&self) -> FlatlandEventStream {
2605        FlatlandEventStream { event_receiver: self.client.take_event_receiver() }
2606    }
2607
2608    /// Complete execution of all feed-forward operations.
2609    ///
2610    /// If executing an operation produces an error (e.g., CreateTransform(0)), an [`OnError`] event
2611    /// is emitted. Operations that produce errors are ignored and the channel is closed.
2612    ///
2613    /// If the execution is completed successfully, [`OnNextFrameBegin`] emits NO_ERROR along
2614    /// with other valid fields.
2615    ///
2616    /// The client may only call [`Present`] when they have a non-zero number of present credits,
2617    /// which are tracked by the server. The server may increment the number of credits when it
2618    /// fires the [`OnNextFrameBegin`] event, which informs the client when it receives additional
2619    /// present credits. Each [`Present`] call uses one present credit and decrements the server
2620    /// count by one. If the client calls [`Present`] with no present credits, the server will
2621    /// return a `NO_PRESENTS_REMAINING` error.
2622    ///
2623    /// The client should assume that prior to receiving any [`OnNextFrameBegin`] events, they have
2624    /// one present credit.
2625    ///
2626    /// Every [`Present`] call results in one [`OnNextFrameBegin`] event, and one
2627    /// [`OnFramePresented`] event, typically in that order.
2628    ///
2629    /// When the commands flushed by [`Present`] make it to display, an [`OnFramePresented`] event
2630    /// is fired. This event includes information pertaining to all [`Present`]s that had content
2631    /// that were part of that frame.
2632    ///
2633    /// See [`fuchsia.ui.composition/PresentArgs`] documentation above for more detailed information
2634    /// on what arguments are passed in and their role.
2635    pub fn r#present(&self, mut args: PresentArgs) -> Result<(), fidl::Error> {
2636        FlatlandProxyInterface::r#present(self, args)
2637    }
2638
2639    /// Two Flatland instances may be connected in a parent-child relationship. The parent endpoint
2640    /// is held in a Viewport, and the child endpoint is held in a View. The parent Flatland
2641    /// instance that creates a Viewport has control over how the child's View is integrated into
2642    /// its own View.
2643    ///
2644    /// The lifecycle of a parent-child connection starts with two endpoints of a channel object:
2645    /// a ViewportCreationToken and a ViewCreationToken. Out-of-band protocols pass the
2646    /// ViewportCreationToken to the parent, which calls [`CreateViewport`], and the
2647    /// ViewCreationToken to the child, which calls [`CreateView`].
2648    ///
2649    /// Only nodes connected to the Root Transform in this Flatland instance will be rendered into
2650    /// the parent's Viewport.
2651    ///
2652    /// Calling [`CreateView`] a second time will disconnect the Root Transform from the existing
2653    /// parent's Viewport, and attach it to a new parent's Viewport. In other words, each View can
2654    /// only have one parent.
2655    ///
2656    /// This function is queued, meaning that the Root Transform will not be attached to the
2657    /// parent Viewport until [`Present`] is called. However, clients will receive information
2658    /// through their ParentViewportWatcher (e.g., LayoutInfo) immediately after calling this
2659    /// function, even if they have not called [`Present`] or [`SetRootTransform`]. This allows
2660    /// clients to wait for layout information from their parent before calling [`Present`].
2661    ///
2662    /// Any illegal operations on ParentViewportWatcher will cause both ParentViewportWatcher
2663    /// channel and this Flatland channel to be torn down.
2664    ///
2665    /// Lifecycle note. The lifetime of the ParentViewportWatcher channel is bound by the peer
2666    /// ViewportCreationToken. When the ViewportCreationToken dies, this ParentViewportWatcher
2667    /// channel is destroyed.
2668    ///
2669    /// Views and subgraphs of Views created using `CreateView` will not be represented in the
2670    /// ViewTree, and hence will not be able to participate in any ViewTree-dependent interactions
2671    /// such as touch, mouse or focus.
2672    /// The Flatland protocol provides no way for Views in the subgraph of a View created with
2673    /// `CreateView` to know that they are excluded from the ViewTree.
2674    pub fn r#create_view(
2675        &self,
2676        mut token: fidl_fuchsia_ui_views::ViewCreationToken,
2677        mut parent_viewport_watcher: fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>,
2678    ) -> Result<(), fidl::Error> {
2679        FlatlandProxyInterface::r#create_view(self, token, parent_viewport_watcher)
2680    }
2681
2682    /// Identical to [`CreateView`], except it allows association of View identity (ViewRef) and
2683    /// view-bound protocols.
2684    pub fn r#create_view2(
2685        &self,
2686        mut token: fidl_fuchsia_ui_views::ViewCreationToken,
2687        mut view_identity: fidl_fuchsia_ui_views::ViewIdentityOnCreation,
2688        mut protocols: ViewBoundProtocols,
2689        mut parent_viewport_watcher: fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>,
2690    ) -> Result<(), fidl::Error> {
2691        FlatlandProxyInterface::r#create_view2(
2692            self,
2693            token,
2694            view_identity,
2695            protocols,
2696            parent_viewport_watcher,
2697        )
2698    }
2699
2700    /// Creates a new Transform node. Transforms are a hierarchical piece of a Flatland graph. They
2701    /// can have children, and can reference Content. A sub-graph represented by a Transform and its
2702    /// descendants can be rendered to a display.
2703    ///
2704    /// Transforms are kept alive, even when released, as long as they are children of either an
2705    /// unreleased Transform, or the Root Transform.
2706    ///
2707    /// Each Transform can have a single piece of attached Content. Common types of Content include
2708    /// bitmaps, asynchronous streams of images, and Viewports to Views hosted in other Flatland
2709    /// instances.
2710    ///
2711    /// Transforms have attributes. Child Transforms inherit the combined attributes of their
2712    /// parents. Content attached to a Transform is also affected by that Transform's attributes.
2713    ///
2714    /// When a sub-graph of Transforms is rendered, Content will be rendered back-to-front, starting
2715    /// with the Content on the root transform, and continuing recursively through all of its child
2716    /// Transforms in the order the children were added. See [`AddChild`] for more information.
2717    ///
2718    /// Zero is not a valid transform id. All other values are valid, assuming they are not already
2719    /// in use (see [`ReleaseTransform`] for more details).
2720    pub fn r#create_transform(&self, mut transform_id: &TransformId) -> Result<(), fidl::Error> {
2721        FlatlandProxyInterface::r#create_transform(self, transform_id)
2722    }
2723
2724    /// All Transform objects support all attributes.
2725    ///
2726    /// Geometric attributes are applied in the following order:
2727    /// 1. Scale (relative to the parent transform's coordinate space)
2728    /// 2. Orientation (relative to the parent transform's coordinate space)
2729    /// 3. Translation (relative to the parent transforms's coordinate space,
2730    ///    unaffected by scale applied to the current transform).
2731    /// 4. Clipping (relative to the current transform's coordinate space)
2732    ///
2733    /// The effects of each of these attributes are cumulative. This means the transform's position
2734    /// in the view space, and its clip boundary, will be calculated based on that chain of
2735    /// geometric attributes going up to the root transform.
2736    ///
2737    /// For instance, in a nested hierarchy such as the following:
2738    ///     [Root-Transform -> Transform1 -> Transform2 -> CurrentTransform]
2739    /// If Transform1 is translated by [2,0] and Transform2 is translated by [0,1] then the
2740    /// view-space position of CurrentTransform will be [2,1].
2741    ///
2742    /// Sets the translation on a Transform. The order of geometric attribute application is
2743    /// addressed above.
2744    pub fn r#set_translation(
2745        &self,
2746        mut transform_id: &TransformId,
2747        mut translation: &fidl_fuchsia_math::Vec_,
2748    ) -> Result<(), fidl::Error> {
2749        FlatlandProxyInterface::r#set_translation(self, transform_id, translation)
2750    }
2751
2752    /// Sets the orientation on a Transform. The order of geometric attribute application is
2753    /// addressed in the documentation for [`SetTranslation`]. In Flatland, the +X axis is
2754    /// to the right and the +Y axis is down. There is no notion of a Z axis. CCW is defined
2755    /// from the POV of the user, as if a skeuomorphoic clock is displayed on the screen.
2756    pub fn r#set_orientation(
2757        &self,
2758        mut transform_id: &TransformId,
2759        mut orientation: Orientation,
2760    ) -> Result<(), fidl::Error> {
2761        FlatlandProxyInterface::r#set_orientation(self, transform_id, orientation)
2762    }
2763
2764    /// Sets the scale on a transform. The order of geometric attribute application is
2765    /// addressed above. The (x,y) values in the VecF |scale| refer to the scale factor in the
2766    /// x-axis (width) and y-axis (height) respectively. Scale values must be normal 32-bit
2767    /// floating point values: https://en.wikipedia.org/wiki/Normal_number_%28computing%29
2768    pub fn r#set_scale(
2769        &self,
2770        mut transform_id: &TransformId,
2771        mut scale: &fidl_fuchsia_math::VecF,
2772    ) -> Result<(), fidl::Error> {
2773        FlatlandProxyInterface::r#set_scale(self, transform_id, scale)
2774    }
2775
2776    /// Sets an opacity in linear space to be applied to a transform and its descendents,
2777    /// which include other transforms and content. Opacity values must be in the range
2778    /// of [0.0, 1.0], where 0.0 is completely transparent and 1.0 is completely opaque.
2779    /// Attempting to call this function with values outside that range will result in
2780    /// an error. A transform's opacity value is multiplied with that of its parent. This
2781    /// effect works differently from group opacity. Using group opacity, child nodes are
2782    /// rendered together first, and then have the parent's opacity applied as a post-effect.
2783    /// Here, opacity is applied to each child individually. This may result in a very
2784    /// different effect.
2785    pub fn r#set_opacity(
2786        &self,
2787        mut transform_id: &TransformId,
2788        mut value: f32,
2789    ) -> Result<(), fidl::Error> {
2790        FlatlandProxyInterface::r#set_opacity(self, transform_id, value)
2791    }
2792
2793    /// Sets the bounds, expressed in the local coordinate space of the transform, that
2794    /// constrains the region that content attached to this transform can be rendered to.
2795    /// If the content's area exceeds the clip bounds, the area outside the bounds will
2796    /// not be rendered. These bounds are valid for all children of this transform node as
2797    /// well, which includes nested Flatland instances and their node hierarchies.
2798    /// If a child transform attempts to set clip bounds larger than that of its parent,
2799    /// it will be clipped to the parent's clip bounds. The default state is for a transform
2800    /// to be unclipped, meaning it will not have any bounds placed on its render region.
2801    /// The clip width/height must be positive. Negative values will result in an error.
2802    /// Passing in an empty box to the |rect| parameter will remove the clip bounds.
2803    pub fn r#set_clip_boundary(
2804        &self,
2805        mut transform_id: &TransformId,
2806        mut rect: Option<&fidl_fuchsia_math::Rect>,
2807    ) -> Result<(), fidl::Error> {
2808        FlatlandProxyInterface::r#set_clip_boundary(self, transform_id, rect)
2809    }
2810
2811    /// Adds a child Transform to a parent Transform. The new child Transform, and any Content
2812    /// attached to it or its children, will be rendered on top of the parent's Content, as well as
2813    /// any previously added children.
2814    pub fn r#add_child(
2815        &self,
2816        mut parent_transform_id: &TransformId,
2817        mut child_transform_id: &TransformId,
2818    ) -> Result<(), fidl::Error> {
2819        FlatlandProxyInterface::r#add_child(self, parent_transform_id, child_transform_id)
2820    }
2821
2822    /// Removes a child Transform from a parent Transform.
2823    pub fn r#remove_child(
2824        &self,
2825        mut parent_transform_id: &TransformId,
2826        mut child_transform_id: &TransformId,
2827    ) -> Result<(), fidl::Error> {
2828        FlatlandProxyInterface::r#remove_child(self, parent_transform_id, child_transform_id)
2829    }
2830
2831    /// Removes all child Transforms from a parent Transform and replaces them with the new child
2832    /// transforms in `new_child_transform_ids`.
2833    pub fn r#replace_children(
2834        &self,
2835        mut parent_transform_id: &TransformId,
2836        mut new_child_transform_ids: &[TransformId],
2837    ) -> Result<(), fidl::Error> {
2838        FlatlandProxyInterface::r#replace_children(
2839            self,
2840            parent_transform_id,
2841            new_child_transform_ids,
2842        )
2843    }
2844
2845    /// Sets the Root Transform for the graph.
2846    ///
2847    /// The sub-graph defined by the Root Transform and its children will be rendered as View
2848    /// in the connected parent's Viewport (see [`CreateView`]). Any parents of the Root Transform
2849    /// in this Graph will be ignored.
2850    ///
2851    /// The Root Transform, and all children of the Root Transform, are kept alive if they are
2852    /// released (see [`ReleaseTransform`] for more details).
2853    ///
2854    /// There is only ever one Root. Since 0 is not a valid transform id (see [`CreateTransform`]),
2855    /// calling SetRootTransform(0) clears the current Root, destroying any previously released
2856    /// objects that are not referenced by the new root.
2857    ///
2858    /// Note that every View has a clip boundary equivalent to its logical size. Anything outside
2859    /// that clip boundary will not be rendered. Hence, the Root Transform has a useful coordinate
2860    /// space of (0, 0) to (logical_size.width, logical_size.height), where (0, 0) is the upper left
2861    /// corner.
2862    ///
2863    /// Setting the root transform installs a full screen hit region on the root transform. Clients
2864    /// may remove this hit region if they don't want users to be able to interact with the root
2865    /// transform's content. For additional details on hit regions, see the [`SetHitRegions`]
2866    /// documentation.
2867    ///
2868    /// Default hit region rules
2869    ///
2870    ///   A default hit region follows these rules:
2871    ///   - When [`SetRootTransform`](T) is called, T receives a maximal hit region, covering the
2872    ///   entire view.
2873    ///   - If [`SetHitRegions`] is called on T, either before or after [`SetRootTransform`](T),
2874    ///   then no default hit region is active and the client specified hit regions are used.
2875    ///   - If a transform is no longer the root transform, i.e., [`SetRootTransform`](U) is
2876    ///   called, then the original transform no longer has its default hit region.
2877    ///   - Clients can remove or modify the root transform's hit regions the same way they would
2878    ///   reset any other transform's hit regions, by calling [`SetHitRegions`] with the appropriate
2879    ///   vector.
2880    pub fn r#set_root_transform(&self, mut transform_id: &TransformId) -> Result<(), fidl::Error> {
2881        FlatlandProxyInterface::r#set_root_transform(self, transform_id)
2882    }
2883
2884    /// Sets the interactive areas for a Transform. By default, Content is not interactive; hit
2885    /// regions must be placed for a user to interact with the Content in a View. Because hit
2886    /// regions are described in the Flatland protocol, a Flatland instance can synchronize Content
2887    /// and hit regions.
2888    ///
2889    /// Each hit region is placed in the coordinate space of the owning Transform, and may or may
2890    /// not interact with different types of hit testing, depending on its [`HitTestInteraction`]
2891    /// type. When there are multiple hit regions that intersect with a hit test, the precedence
2892    /// rules given below dictate which hit region has interacted with the hit test. Only Transforms
2893    /// that transitively connect to the root Transform have their hit regions interact with a hit
2894    /// test.
2895    ///
2896    /// Calling this function replaces any previous values set on this Transform. To reset a
2897    /// Transform to "no hit testing": send an empty vector with [`SetHitRegions`].
2898    ///
2899    /// Note that root transforms get a default hit region installed by Flatland. For more details,
2900    /// see the [`SetRootTransform`] documentation.
2901    ///
2902    /// Precedence rules
2903    ///   Within a Transform, if multiple hit regions overlap, the hit test examines each
2904    ///   intersecting hit region for a possible interaction. Thus, for a regular hit test R and an
2905    ///   accessibility hit test A, where R and A both intersect two hit regions D ([`DEFAULT`]) and
2906    ///   S ([`SEMANTICALLY_INVISIBLE`]) on the same Transform, (1) R interacts with both D and S,
2907    ///   and (2) A only interacts with D. Generally, hit regions that overlap in a single Transform
2908    ///   can cause confusing behavior.
2909    ///
2910    ///   Within a View, for a given hit test, the front-most Transform's hit regions take
2911    ///   precedence over those behind. This follows the expected reverse "render order" of
2912    ///   Transforms (described in [`CreateTransform`]), where a user expects to interact with
2913    ///   Content that is visible, or front-most.
2914    ///
2915    ///   Across Flatland instances, for a given hit test, the front-most instance's front-most
2916    ///   Transform's hit regions take precedence over those behind. This follows the expected
2917    ///   reverse "render order" of views, where a user expects to interact with the View that is
2918    ///   visible, or front-most. For example, if a child View owns Content that is rendered over
2919    ///   the parent View, the user expects to interact with the child's Content.
2920    pub fn r#set_hit_regions(
2921        &self,
2922        mut transform_id: &TransformId,
2923        mut regions: &[HitRegion],
2924    ) -> Result<(), fidl::Error> {
2925        FlatlandProxyInterface::r#set_hit_regions(self, transform_id, regions)
2926    }
2927
2928    /// Identical to [`SetHitRegions`], except the hit region associated with [`transform_id`]
2929    /// covers an infinite region. The hit region is invariant against translation, scaling, and
2930    /// orientation of the Transform.
2931    ///
2932    /// An infinite hit region is still limited in extent by the View's clip boundary, just like a
2933    /// finite hit region.
2934    ///
2935    /// Calling this function replaces any previous values set on this Transform. To reset a
2936    /// Transform to "no hit testing": send an empty vector with [`SetHitRegions`].
2937    pub fn r#set_infinite_hit_region(
2938        &self,
2939        mut transform_id: &TransformId,
2940        mut hit_test: HitTestInteraction,
2941    ) -> Result<(), fidl::Error> {
2942        FlatlandProxyInterface::r#set_infinite_hit_region(self, transform_id, hit_test)
2943    }
2944
2945    /// The Viewport and View pair, together, represent the connection between two Flatland
2946    /// instances. The Viewport is created in the parent, and the View is created in the child. The
2947    /// parent has control over how the child's View is integrated into its own View.
2948    ///
2949    /// Any illegal operations on ChildViewWatcher will cause both ChildViewWatcher channel and this
2950    /// Flatland channel to be torn down.
2951    ///
2952    /// `ViewportProperties` must have logical_size set. This is the initial size that will drive
2953    /// the layout of the child. The logical_size is also used as the default Content size, but
2954    /// subsequent changes to the logical_size will have no effect on the Content size.
2955    ///
2956    /// `ViewportProperties` may have inset field not set. In that case, the default value of
2957    /// (0, 0, 0, 0) is used.
2958    ///
2959    /// The logical_size must have positive X and Y components.
2960    ///
2961    /// Zero is not a valid ContentId. All other values are valid, assuming they are not already
2962    /// in use for another piece of Content (see [`ReleaseViewport`] for more details).
2963    ///
2964    /// Lifecycle note. The lifetime of the ChildViewWatcher channel is bound by the peer
2965    /// ViewCreationToken. When the ViewCreationToken dies, this ChildViewWatcher channel is
2966    /// destroyed.
2967    pub fn r#create_viewport(
2968        &self,
2969        mut viewport_id: &ContentId,
2970        mut token: fidl_fuchsia_ui_views::ViewportCreationToken,
2971        mut properties: &ViewportProperties,
2972        mut child_view_watcher: fidl::endpoints::ServerEnd<ChildViewWatcherMarker>,
2973    ) -> Result<(), fidl::Error> {
2974        FlatlandProxyInterface::r#create_viewport(
2975            self,
2976            viewport_id,
2977            token,
2978            properties,
2979            child_view_watcher,
2980        )
2981    }
2982
2983    /// An Image is a bitmap backed by a specific VMO in a BufferCollection.
2984    ///
2985    /// Image creation requires an allocated BufferCollection registered with Allocator. This
2986    /// function will fail unless all clients of the specified BufferCollection have set their
2987    /// constraints.
2988    ///
2989    /// The Image must reference a valid VMO index and must have ImageProperties that fall within
2990    /// the constraints specified by the backing BufferCollection (i.e. width and height within a
2991    /// valid range, etc.)
2992    ///
2993    /// Zero is not a valid Image id. All other values are valid, assuming they are not already in
2994    /// use for another piece of Content (see [`ReleaseImage`] for more details).
2995    pub fn r#create_image(
2996        &self,
2997        mut image_id: &ContentId,
2998        mut import_token: BufferCollectionImportToken,
2999        mut vmo_index: u32,
3000        mut properties: &ImageProperties,
3001    ) -> Result<(), fidl::Error> {
3002        FlatlandProxyInterface::r#create_image(self, image_id, import_token, vmo_index, properties)
3003    }
3004
3005    /// This function is used to determine the region (in texel space) of an image that will be used
3006    /// by Flatland when rendering. The image to be sampled is referenced by [`image_id`] and the
3007    /// sample region is specified by [`rect`] which itself is comprised of an origin point (x,y) as
3008    /// well as a width and height, in unnormalized coordinates. It is illegal to call this function
3009    /// on non-image content, or to sample a region outside of the texel space of the image. In
3010    /// other words, the region specifed by [`rect`] must not exceed the ranges (0, image_width) and
3011    /// (0, image_height). If (rect.x + rect.width > image_width) or (rect.y + rect.height >
3012    /// image_height) or if any of the values are negative, this will result in an error.
3013    ///
3014    /// If this method is not called, the default sample region is the rectangle with origin at
3015    /// (0, 0) and width and height set at ImageProperties from [`CreateImage`].
3016    pub fn r#set_image_sample_region(
3017        &self,
3018        mut image_id: &ContentId,
3019        mut rect: &fidl_fuchsia_math::RectF,
3020    ) -> Result<(), fidl::Error> {
3021        FlatlandProxyInterface::r#set_image_sample_region(self, image_id, rect)
3022    }
3023
3024    /// The content size for an Image is the size of the rectangle in the parent's logical
3025    /// coordinate space that the image occupies. This combined with the global translation of the
3026    /// transform it is attached to determines the size and location of where the content is
3027    /// rendered on the display.
3028    ///
3029    /// If this method is not called, the default image destination size is the width and height set
3030    /// at ImageProperties from [`CreateImage`]. The destination size will be affected by scaling if
3031    /// [`SetScale`] is used on the attached Transform or its parents.
3032    pub fn r#set_image_destination_size(
3033        &self,
3034        mut image_id: &ContentId,
3035        mut size: &fidl_fuchsia_math::SizeU,
3036    ) -> Result<(), fidl::Error> {
3037        FlatlandProxyInterface::r#set_image_destination_size(self, image_id, size)
3038    }
3039
3040    /// Determines the blend function to use when rendering the content specified by
3041    /// |image_id|. |image_id| must be a valid ContentId associated to a transform through
3042    /// a call to |CreateImage| or |CreateFilledRect|. For details on the different blend functions
3043    /// that are available, please refer to the BlendMode enum. If this function is not called, then
3044    /// the default blendmode is BlendMode::SRC.
3045    pub fn r#set_image_blending_function(
3046        &self,
3047        mut image_id: &ContentId,
3048        mut blend_mode: BlendMode,
3049    ) -> Result<(), fidl::Error> {
3050        FlatlandProxyInterface::r#set_image_blending_function(self, image_id, blend_mode)
3051    }
3052
3053    /// Determines the blend function to use when rendering the content specified by
3054    /// |image_id|. |image_id| must be a valid ContentId associated to a transform through
3055    /// a call to |CreateImage| or |CreateFilledRect|. For details on the different blend functions
3056    /// that are available, please refer to the BlendMode2 enum. If this function is not called,
3057    /// the default blendmode is BlendMode2::REPLACE.
3058    pub fn r#set_image_blend_mode(
3059        &self,
3060        mut image_id: &ContentId,
3061        mut blend_mode: BlendMode2,
3062    ) -> Result<(), fidl::Error> {
3063        FlatlandProxyInterface::r#set_image_blend_mode(self, image_id, blend_mode)
3064    }
3065
3066    /// Sets an opacity in linear space to be applied to a flatland image. Opacity values must
3067    /// be in the range [0.0, 1.0].
3068    pub fn r#set_image_opacity(
3069        &self,
3070        mut image_id: &ContentId,
3071        mut val: f32,
3072    ) -> Result<(), fidl::Error> {
3073        FlatlandProxyInterface::r#set_image_opacity(self, image_id, val)
3074    }
3075
3076    /// Sets the image flip to be applied to a flatland image. This call must be performed after a
3077    /// successful |CreateImage| call. If an invalid |image_id| is supplied, the channel will be
3078    /// closed due to FlatlandError::BAD_OPERATION. This flip will be applied to the Image before
3079    /// parent Transform Orientations. If this function is not called, then the default flip value
3080    /// is ImageFlip::NONE.
3081    pub fn r#set_image_flip(
3082        &self,
3083        mut image_id: &ContentId,
3084        mut flip: ImageFlip,
3085    ) -> Result<(), fidl::Error> {
3086        FlatlandProxyInterface::r#set_image_flip(self, image_id, flip)
3087    }
3088
3089    /// Creates a solid-color rectangle. By default a filled-rect does not have a defined
3090    /// color or size. It is necessary to call |SetSolidFill| to specify a color and size
3091    /// before a filled rect can be used for rendering. Not doing so will result the
3092    pub fn r#create_filled_rect(&self, mut rect_id: &ContentId) -> Result<(), fidl::Error> {
3093        FlatlandProxyInterface::r#create_filled_rect(self, rect_id)
3094    }
3095
3096    /// Defines the color and size of a filled rect. |rect_id| must refer to content that
3097    /// was created via a call to CreateFilledRect. The color is not premultiplied. Color values
3098    /// must be within the range [0,1] inclusive, and normal 32-bit
3099    /// floating point values: https://en.wikipedia.org/wiki/Normal_number_%28computing%29. Values
3100    /// that do not conform to these specifications will cause the channel to close.
3101    /// The rectangle's top left corner will be at (0, 0) in its transform's coordinate space.
3102    /// Hence, its bottom right corner will be at (size.width, size.height).
3103    pub fn r#set_solid_fill(
3104        &self,
3105        mut rect_id: &ContentId,
3106        mut color: &ColorRgba,
3107        mut size: &fidl_fuchsia_math::SizeU,
3108    ) -> Result<(), fidl::Error> {
3109        FlatlandProxyInterface::r#set_solid_fill(self, rect_id, color, size)
3110    }
3111
3112    /// Automatically garbage collects the rectangle when it is no longer needed for
3113    /// rendering. |rect_id| must have been instantiated with a call to
3114    /// |CreateFilledRect|. Once released, the ID immediately goes out of scope and is free
3115    /// to be used again.
3116    pub fn r#release_filled_rect(&self, mut rect_id: &ContentId) -> Result<(), fidl::Error> {
3117        FlatlandProxyInterface::r#release_filled_rect(self, rect_id)
3118    }
3119
3120    /// Setting a piece of Content on a Transform makes that Content visible in the render tree as
3121    /// long as the Transform is visible from the root Transform. The Content will be rendered
3122    /// before, and therefore "behind", any Content attached to the descendants of the Transform.
3123    ///
3124    /// Because each Transform can have, at most, a single piece of Content on it, calling this
3125    /// function on a Transform that already has Content will replace that Content.
3126    ///
3127    /// A Content may be set on more than one Transform.
3128    ///
3129    /// Calling this function with a Content id of 0 will remove any Content currently on the
3130    /// Transform.
3131    pub fn r#set_content(
3132        &self,
3133        mut transform_id: &TransformId,
3134        mut content_id: &ContentId,
3135    ) -> Result<(), fidl::Error> {
3136        FlatlandProxyInterface::r#set_content(self, transform_id, content_id)
3137    }
3138
3139    /// Transforms are usually sufficient to change how Content is presented. Viewports, however,
3140    /// have special properties that are not part of the Transform hierarchy. Those properties can
3141    /// be set using this function.
3142    pub fn r#set_viewport_properties(
3143        &self,
3144        mut viewport_id: &ContentId,
3145        mut properties: &ViewportProperties,
3146    ) -> Result<(), fidl::Error> {
3147        FlatlandProxyInterface::r#set_viewport_properties(self, viewport_id, properties)
3148    }
3149
3150    /// Released Transforms will be garbage collected by the system once they are no longer
3151    /// necessary for rendering. For Transforms, this means there is no path from any unreleased
3152    /// Transform to the newly-released Transform.
3153    ///
3154    /// Once released, the id immediately goes out of scope for future function calls and can be
3155    /// reused when creating new Transforms.
3156    ///
3157    /// It is an error to call functions with a released id (unless that id has been reused to
3158    /// construct a new Transform).
3159    pub fn r#release_transform(&self, mut transform_id: &TransformId) -> Result<(), fidl::Error> {
3160        FlatlandProxyInterface::r#release_transform(self, transform_id)
3161    }
3162
3163    pub fn r#release_view(&self) -> Result<(), fidl::Error> {
3164        FlatlandProxyInterface::r#release_view(self)
3165    }
3166
3167    /// Releases a Viewport from the scene, even if the Viewport is still connected to a Transform.
3168    /// Unlike other resources, Viewports are garbage collected by the system during the next
3169    /// [`Present`] because a removed Viewport is guaranteed to provide no renderable content.
3170    ///
3171    /// Use SetContent(transform_id, 0) to clean up references to released Viewports.
3172    ///
3173    /// Despite having a return type, this function is still feed-forward like [`CreateView`] and
3174    /// requires a call to [`Present`] to be executed. The ViewportCreationToken will be returned
3175    /// after the presented operations have been executed.
3176    pub fn r#release_viewport(
3177        &self,
3178        mut viewport_id: &ContentId,
3179    ) -> fidl::client::QueryResponseFut<
3180        fidl_fuchsia_ui_views::ViewportCreationToken,
3181        fidl::encoding::DefaultFuchsiaResourceDialect,
3182    > {
3183        FlatlandProxyInterface::r#release_viewport(self, viewport_id)
3184    }
3185
3186    /// Released Images will be garbage collected by the system once they are no longer necessary
3187    /// for rendering. For Images, this means the Image is no longer attached to any Transform and
3188    /// any pending rendering that references the Image is complete.
3189    ///
3190    /// Use SetContent(transform_id, 0) to clean up references to released Images.
3191    ///
3192    /// Once released, the id immediately goes out of scope for future function calls and can be
3193    /// reused when creating new Images.
3194    ///
3195    /// It is an error to call functions with a released id (unless that id has been reused to
3196    /// construct a new Image).
3197    pub fn r#release_image(&self, mut image_id: &ContentId) -> Result<(), fidl::Error> {
3198        FlatlandProxyInterface::r#release_image(self, image_id)
3199    }
3200
3201    /// This function will reset all state on this interface. This includes destroying all existing
3202    /// View and Viewports without returning the associated Token to the caller.
3203    pub fn r#clear(&self) -> Result<(), fidl::Error> {
3204        FlatlandProxyInterface::r#clear(self)
3205    }
3206
3207    /// Set debug name of the current client that can be used by Flatland to print as a prefix to
3208    /// logs to help client distinguish what is theirs. [`name`] can be an arbitrary string, but the
3209    /// current process name (see fsl::GetCurrentProcessName()) is a good default.
3210    pub fn r#set_debug_name(&self, mut name: &str) -> Result<(), fidl::Error> {
3211        FlatlandProxyInterface::r#set_debug_name(self, name)
3212    }
3213}
3214
3215impl FlatlandProxyInterface for FlatlandProxy {
3216    fn r#present(&self, mut args: PresentArgs) -> Result<(), fidl::Error> {
3217        self.client.send::<FlatlandPresentRequest>(
3218            (&mut args,),
3219            0x50acc2aa1f0acec7,
3220            fidl::encoding::DynamicFlags::empty(),
3221        )
3222    }
3223
3224    fn r#create_view(
3225        &self,
3226        mut token: fidl_fuchsia_ui_views::ViewCreationToken,
3227        mut parent_viewport_watcher: fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>,
3228    ) -> Result<(), fidl::Error> {
3229        self.client.send::<FlatlandCreateViewRequest>(
3230            (&mut token, parent_viewport_watcher),
3231            0x504686eb25864780,
3232            fidl::encoding::DynamicFlags::empty(),
3233        )
3234    }
3235
3236    fn r#create_view2(
3237        &self,
3238        mut token: fidl_fuchsia_ui_views::ViewCreationToken,
3239        mut view_identity: fidl_fuchsia_ui_views::ViewIdentityOnCreation,
3240        mut protocols: ViewBoundProtocols,
3241        mut parent_viewport_watcher: fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>,
3242    ) -> Result<(), fidl::Error> {
3243        self.client.send::<FlatlandCreateView2Request>(
3244            (&mut token, &mut view_identity, &mut protocols, parent_viewport_watcher),
3245            0x340a3a40c2fdbd5e,
3246            fidl::encoding::DynamicFlags::empty(),
3247        )
3248    }
3249
3250    fn r#create_transform(&self, mut transform_id: &TransformId) -> Result<(), fidl::Error> {
3251        self.client.send::<FlatlandCreateTransformRequest>(
3252            (transform_id,),
3253            0x5e042a4d3de3efb0,
3254            fidl::encoding::DynamicFlags::empty(),
3255        )
3256    }
3257
3258    fn r#set_translation(
3259        &self,
3260        mut transform_id: &TransformId,
3261        mut translation: &fidl_fuchsia_math::Vec_,
3262    ) -> Result<(), fidl::Error> {
3263        self.client.send::<FlatlandSetTranslationRequest>(
3264            (transform_id, translation),
3265            0x7863398291fba346,
3266            fidl::encoding::DynamicFlags::empty(),
3267        )
3268    }
3269
3270    fn r#set_orientation(
3271        &self,
3272        mut transform_id: &TransformId,
3273        mut orientation: Orientation,
3274    ) -> Result<(), fidl::Error> {
3275        self.client.send::<FlatlandSetOrientationRequest>(
3276            (transform_id, orientation),
3277            0x4915310bc4928edc,
3278            fidl::encoding::DynamicFlags::empty(),
3279        )
3280    }
3281
3282    fn r#set_scale(
3283        &self,
3284        mut transform_id: &TransformId,
3285        mut scale: &fidl_fuchsia_math::VecF,
3286    ) -> Result<(), fidl::Error> {
3287        self.client.send::<FlatlandSetScaleRequest>(
3288            (transform_id, scale),
3289            0x1ea1766fd8996bb4,
3290            fidl::encoding::DynamicFlags::empty(),
3291        )
3292    }
3293
3294    fn r#set_opacity(
3295        &self,
3296        mut transform_id: &TransformId,
3297        mut value: f32,
3298    ) -> Result<(), fidl::Error> {
3299        self.client.send::<FlatlandSetOpacityRequest>(
3300            (transform_id, value),
3301            0x3775fc2c00b432fa,
3302            fidl::encoding::DynamicFlags::empty(),
3303        )
3304    }
3305
3306    fn r#set_clip_boundary(
3307        &self,
3308        mut transform_id: &TransformId,
3309        mut rect: Option<&fidl_fuchsia_math::Rect>,
3310    ) -> Result<(), fidl::Error> {
3311        self.client.send::<FlatlandSetClipBoundaryRequest>(
3312            (transform_id, rect),
3313            0x6507843df12222d2,
3314            fidl::encoding::DynamicFlags::empty(),
3315        )
3316    }
3317
3318    fn r#add_child(
3319        &self,
3320        mut parent_transform_id: &TransformId,
3321        mut child_transform_id: &TransformId,
3322    ) -> Result<(), fidl::Error> {
3323        self.client.send::<FlatlandAddChildRequest>(
3324            (parent_transform_id, child_transform_id),
3325            0x67a8abd2f19b1a74,
3326            fidl::encoding::DynamicFlags::empty(),
3327        )
3328    }
3329
3330    fn r#remove_child(
3331        &self,
3332        mut parent_transform_id: &TransformId,
3333        mut child_transform_id: &TransformId,
3334    ) -> Result<(), fidl::Error> {
3335        self.client.send::<FlatlandRemoveChildRequest>(
3336            (parent_transform_id, child_transform_id),
3337            0x41d6cd90b298b67a,
3338            fidl::encoding::DynamicFlags::empty(),
3339        )
3340    }
3341
3342    fn r#replace_children(
3343        &self,
3344        mut parent_transform_id: &TransformId,
3345        mut new_child_transform_ids: &[TransformId],
3346    ) -> Result<(), fidl::Error> {
3347        self.client.send::<FlatlandReplaceChildrenRequest>(
3348            (parent_transform_id, new_child_transform_ids),
3349            0x5b6d86cbbff81316,
3350            fidl::encoding::DynamicFlags::empty(),
3351        )
3352    }
3353
3354    fn r#set_root_transform(&self, mut transform_id: &TransformId) -> Result<(), fidl::Error> {
3355        self.client.send::<FlatlandSetRootTransformRequest>(
3356            (transform_id,),
3357            0x6e80ca5bcc566cd8,
3358            fidl::encoding::DynamicFlags::empty(),
3359        )
3360    }
3361
3362    fn r#set_hit_regions(
3363        &self,
3364        mut transform_id: &TransformId,
3365        mut regions: &[HitRegion],
3366    ) -> Result<(), fidl::Error> {
3367        self.client.send::<FlatlandSetHitRegionsRequest>(
3368            (transform_id, regions),
3369            0x31c9d17b07c37ce4,
3370            fidl::encoding::DynamicFlags::empty(),
3371        )
3372    }
3373
3374    fn r#set_infinite_hit_region(
3375        &self,
3376        mut transform_id: &TransformId,
3377        mut hit_test: HitTestInteraction,
3378    ) -> Result<(), fidl::Error> {
3379        self.client.send::<FlatlandSetInfiniteHitRegionRequest>(
3380            (transform_id, hit_test),
3381            0x26d81af852d29562,
3382            fidl::encoding::DynamicFlags::empty(),
3383        )
3384    }
3385
3386    fn r#create_viewport(
3387        &self,
3388        mut viewport_id: &ContentId,
3389        mut token: fidl_fuchsia_ui_views::ViewportCreationToken,
3390        mut properties: &ViewportProperties,
3391        mut child_view_watcher: fidl::endpoints::ServerEnd<ChildViewWatcherMarker>,
3392    ) -> Result<(), fidl::Error> {
3393        self.client.send::<FlatlandCreateViewportRequest>(
3394            (viewport_id, &mut token, properties, child_view_watcher),
3395            0x2485fbcab7f943c,
3396            fidl::encoding::DynamicFlags::empty(),
3397        )
3398    }
3399
3400    fn r#create_image(
3401        &self,
3402        mut image_id: &ContentId,
3403        mut import_token: BufferCollectionImportToken,
3404        mut vmo_index: u32,
3405        mut properties: &ImageProperties,
3406    ) -> Result<(), fidl::Error> {
3407        self.client.send::<FlatlandCreateImageRequest>(
3408            (image_id, &mut import_token, vmo_index, properties),
3409            0x26fae823c4ebedad,
3410            fidl::encoding::DynamicFlags::empty(),
3411        )
3412    }
3413
3414    fn r#set_image_sample_region(
3415        &self,
3416        mut image_id: &ContentId,
3417        mut rect: &fidl_fuchsia_math::RectF,
3418    ) -> Result<(), fidl::Error> {
3419        self.client.send::<FlatlandSetImageSampleRegionRequest>(
3420            (image_id, rect),
3421            0x8039391d715eb28,
3422            fidl::encoding::DynamicFlags::empty(),
3423        )
3424    }
3425
3426    fn r#set_image_destination_size(
3427        &self,
3428        mut image_id: &ContentId,
3429        mut size: &fidl_fuchsia_math::SizeU,
3430    ) -> Result<(), fidl::Error> {
3431        self.client.send::<FlatlandSetImageDestinationSizeRequest>(
3432            (image_id, size),
3433            0x766cf99a2ec58446,
3434            fidl::encoding::DynamicFlags::empty(),
3435        )
3436    }
3437
3438    fn r#set_image_blending_function(
3439        &self,
3440        mut image_id: &ContentId,
3441        mut blend_mode: BlendMode,
3442    ) -> Result<(), fidl::Error> {
3443        self.client.send::<FlatlandSetImageBlendingFunctionRequest>(
3444            (image_id, blend_mode),
3445            0x10f5da1356275b7b,
3446            fidl::encoding::DynamicFlags::empty(),
3447        )
3448    }
3449
3450    fn r#set_image_blend_mode(
3451        &self,
3452        mut image_id: &ContentId,
3453        mut blend_mode: BlendMode2,
3454    ) -> Result<(), fidl::Error> {
3455        self.client.send::<FlatlandSetImageBlendModeRequest>(
3456            (image_id, blend_mode),
3457            0x5b1667f130c3de67,
3458            fidl::encoding::DynamicFlags::empty(),
3459        )
3460    }
3461
3462    fn r#set_image_opacity(
3463        &self,
3464        mut image_id: &ContentId,
3465        mut val: f32,
3466    ) -> Result<(), fidl::Error> {
3467        self.client.send::<FlatlandSetImageOpacityRequest>(
3468            (image_id, val),
3469            0x2da9e4ef4c2cff6f,
3470            fidl::encoding::DynamicFlags::empty(),
3471        )
3472    }
3473
3474    fn r#set_image_flip(
3475        &self,
3476        mut image_id: &ContentId,
3477        mut flip: ImageFlip,
3478    ) -> Result<(), fidl::Error> {
3479        self.client.send::<FlatlandSetImageFlipRequest>(
3480            (image_id, flip),
3481            0x21b20f2c14aae6bc,
3482            fidl::encoding::DynamicFlags::empty(),
3483        )
3484    }
3485
3486    fn r#create_filled_rect(&self, mut rect_id: &ContentId) -> Result<(), fidl::Error> {
3487        self.client.send::<FlatlandCreateFilledRectRequest>(
3488            (rect_id,),
3489            0x5e62355abc1c4c5d,
3490            fidl::encoding::DynamicFlags::empty(),
3491        )
3492    }
3493
3494    fn r#set_solid_fill(
3495        &self,
3496        mut rect_id: &ContentId,
3497        mut color: &ColorRgba,
3498        mut size: &fidl_fuchsia_math::SizeU,
3499    ) -> Result<(), fidl::Error> {
3500        self.client.send::<FlatlandSetSolidFillRequest>(
3501            (rect_id, color, size),
3502            0x32d6ef41e182dfa5,
3503            fidl::encoding::DynamicFlags::empty(),
3504        )
3505    }
3506
3507    fn r#release_filled_rect(&self, mut rect_id: &ContentId) -> Result<(), fidl::Error> {
3508        self.client.send::<FlatlandReleaseFilledRectRequest>(
3509            (rect_id,),
3510            0x7392cabe45618f9b,
3511            fidl::encoding::DynamicFlags::empty(),
3512        )
3513    }
3514
3515    fn r#set_content(
3516        &self,
3517        mut transform_id: &TransformId,
3518        mut content_id: &ContentId,
3519    ) -> Result<(), fidl::Error> {
3520        self.client.send::<FlatlandSetContentRequest>(
3521            (transform_id, content_id),
3522            0x4ed2cfc0ce130862,
3523            fidl::encoding::DynamicFlags::empty(),
3524        )
3525    }
3526
3527    fn r#set_viewport_properties(
3528        &self,
3529        mut viewport_id: &ContentId,
3530        mut properties: &ViewportProperties,
3531    ) -> Result<(), fidl::Error> {
3532        self.client.send::<FlatlandSetViewportPropertiesRequest>(
3533            (viewport_id, properties),
3534            0x66ab67e9608ddb9f,
3535            fidl::encoding::DynamicFlags::empty(),
3536        )
3537    }
3538
3539    fn r#release_transform(&self, mut transform_id: &TransformId) -> Result<(), fidl::Error> {
3540        self.client.send::<FlatlandReleaseTransformRequest>(
3541            (transform_id,),
3542            0xab9328419451c22,
3543            fidl::encoding::DynamicFlags::empty(),
3544        )
3545    }
3546
3547    fn r#release_view(&self) -> Result<(), fidl::Error> {
3548        self.client.send::<fidl::encoding::EmptyPayload>(
3549            (),
3550            0x5b35aab9baffecae,
3551            fidl::encoding::DynamicFlags::empty(),
3552        )
3553    }
3554
3555    type ReleaseViewportResponseFut = fidl::client::QueryResponseFut<
3556        fidl_fuchsia_ui_views::ViewportCreationToken,
3557        fidl::encoding::DefaultFuchsiaResourceDialect,
3558    >;
3559    fn r#release_viewport(&self, mut viewport_id: &ContentId) -> Self::ReleaseViewportResponseFut {
3560        fn _decode(
3561            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3562        ) -> Result<fidl_fuchsia_ui_views::ViewportCreationToken, fidl::Error> {
3563            let _response = fidl::client::decode_transaction_body::<
3564                FlatlandReleaseViewportResponse,
3565                fidl::encoding::DefaultFuchsiaResourceDialect,
3566                0xbad474aeb5293f9,
3567            >(_buf?)?;
3568            Ok(_response.token)
3569        }
3570        self.client.send_query_and_decode::<
3571            FlatlandReleaseViewportRequest,
3572            fidl_fuchsia_ui_views::ViewportCreationToken,
3573        >(
3574            (viewport_id,),
3575            0xbad474aeb5293f9,
3576            fidl::encoding::DynamicFlags::empty(),
3577            _decode,
3578        )
3579    }
3580
3581    fn r#release_image(&self, mut image_id: &ContentId) -> Result<(), fidl::Error> {
3582        self.client.send::<FlatlandReleaseImageRequest>(
3583            (image_id,),
3584            0xb884ffdbc72c111,
3585            fidl::encoding::DynamicFlags::empty(),
3586        )
3587    }
3588
3589    fn r#clear(&self) -> Result<(), fidl::Error> {
3590        self.client.send::<fidl::encoding::EmptyPayload>(
3591            (),
3592            0x4ec8817c02828c3e,
3593            fidl::encoding::DynamicFlags::empty(),
3594        )
3595    }
3596
3597    fn r#set_debug_name(&self, mut name: &str) -> Result<(), fidl::Error> {
3598        self.client.send::<FlatlandSetDebugNameRequest>(
3599            (name,),
3600            0x46a8b397e68a8888,
3601            fidl::encoding::DynamicFlags::empty(),
3602        )
3603    }
3604}
3605
3606pub struct FlatlandEventStream {
3607    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
3608}
3609
3610impl std::marker::Unpin for FlatlandEventStream {}
3611
3612impl futures::stream::FusedStream for FlatlandEventStream {
3613    fn is_terminated(&self) -> bool {
3614        self.event_receiver.is_terminated()
3615    }
3616}
3617
3618impl futures::Stream for FlatlandEventStream {
3619    type Item = Result<FlatlandEvent, fidl::Error>;
3620
3621    fn poll_next(
3622        mut self: std::pin::Pin<&mut Self>,
3623        cx: &mut std::task::Context<'_>,
3624    ) -> std::task::Poll<Option<Self::Item>> {
3625        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
3626            &mut self.event_receiver,
3627            cx
3628        )?) {
3629            Some(buf) => std::task::Poll::Ready(Some(FlatlandEvent::decode(buf))),
3630            None => std::task::Poll::Ready(None),
3631        }
3632    }
3633}
3634
3635#[derive(Debug)]
3636pub enum FlatlandEvent {
3637    OnNextFrameBegin { values: OnNextFrameBeginValues },
3638    OnFramePresented { frame_presented_info: fidl_fuchsia_scenic_scheduling::FramePresentedInfo },
3639    OnError { error: FlatlandError },
3640}
3641
3642impl FlatlandEvent {
3643    #[allow(irrefutable_let_patterns)]
3644    pub fn into_on_next_frame_begin(self) -> Option<OnNextFrameBeginValues> {
3645        if let FlatlandEvent::OnNextFrameBegin { values } = self { Some((values)) } else { None }
3646    }
3647    #[allow(irrefutable_let_patterns)]
3648    pub fn into_on_frame_presented(
3649        self,
3650    ) -> Option<fidl_fuchsia_scenic_scheduling::FramePresentedInfo> {
3651        if let FlatlandEvent::OnFramePresented { frame_presented_info } = self {
3652            Some((frame_presented_info))
3653        } else {
3654            None
3655        }
3656    }
3657    #[allow(irrefutable_let_patterns)]
3658    pub fn into_on_error(self) -> Option<FlatlandError> {
3659        if let FlatlandEvent::OnError { error } = self { Some((error)) } else { None }
3660    }
3661
3662    /// Decodes a message buffer as a [`FlatlandEvent`].
3663    fn decode(
3664        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3665    ) -> Result<FlatlandEvent, fidl::Error> {
3666        let (bytes, _handles) = buf.split_mut();
3667        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3668        debug_assert_eq!(tx_header.tx_id, 0);
3669        match tx_header.ordinal {
3670            0x10f69a5cdeece84a => {
3671                let mut out = fidl::new_empty!(
3672                    FlatlandOnNextFrameBeginRequest,
3673                    fidl::encoding::DefaultFuchsiaResourceDialect
3674                );
3675                fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandOnNextFrameBeginRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
3676                Ok((FlatlandEvent::OnNextFrameBegin { values: out.values }))
3677            }
3678            0x56e43e1a5f30216d => {
3679                let mut out = fidl::new_empty!(
3680                    FlatlandOnFramePresentedRequest,
3681                    fidl::encoding::DefaultFuchsiaResourceDialect
3682                );
3683                fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandOnFramePresentedRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
3684                Ok((FlatlandEvent::OnFramePresented {
3685                    frame_presented_info: out.frame_presented_info,
3686                }))
3687            }
3688            0x1ebf39e90cd8b8d => {
3689                let mut out = fidl::new_empty!(
3690                    FlatlandOnErrorRequest,
3691                    fidl::encoding::DefaultFuchsiaResourceDialect
3692                );
3693                fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandOnErrorRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
3694                Ok((FlatlandEvent::OnError { error: out.error }))
3695            }
3696            _ => Err(fidl::Error::UnknownOrdinal {
3697                ordinal: tx_header.ordinal,
3698                protocol_name: <FlatlandMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3699            }),
3700        }
3701    }
3702}
3703
3704/// A Stream of incoming requests for fuchsia.ui.composition/Flatland.
3705pub struct FlatlandRequestStream {
3706    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3707    is_terminated: bool,
3708}
3709
3710impl std::marker::Unpin for FlatlandRequestStream {}
3711
3712impl futures::stream::FusedStream for FlatlandRequestStream {
3713    fn is_terminated(&self) -> bool {
3714        self.is_terminated
3715    }
3716}
3717
3718impl fidl::endpoints::RequestStream for FlatlandRequestStream {
3719    type Protocol = FlatlandMarker;
3720    type ControlHandle = FlatlandControlHandle;
3721
3722    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
3723        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3724    }
3725
3726    fn control_handle(&self) -> Self::ControlHandle {
3727        FlatlandControlHandle { inner: self.inner.clone() }
3728    }
3729
3730    fn into_inner(
3731        self,
3732    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3733    {
3734        (self.inner, self.is_terminated)
3735    }
3736
3737    fn from_inner(
3738        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3739        is_terminated: bool,
3740    ) -> Self {
3741        Self { inner, is_terminated }
3742    }
3743}
3744
3745impl futures::Stream for FlatlandRequestStream {
3746    type Item = Result<FlatlandRequest, fidl::Error>;
3747
3748    fn poll_next(
3749        mut self: std::pin::Pin<&mut Self>,
3750        cx: &mut std::task::Context<'_>,
3751    ) -> std::task::Poll<Option<Self::Item>> {
3752        let this = &mut *self;
3753        if this.inner.check_shutdown(cx) {
3754            this.is_terminated = true;
3755            return std::task::Poll::Ready(None);
3756        }
3757        if this.is_terminated {
3758            panic!("polled FlatlandRequestStream after completion");
3759        }
3760        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3761            |bytes, handles| {
3762                match this.inner.channel().read_etc(cx, bytes, handles) {
3763                    std::task::Poll::Ready(Ok(())) => {}
3764                    std::task::Poll::Pending => return std::task::Poll::Pending,
3765                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3766                        this.is_terminated = true;
3767                        return std::task::Poll::Ready(None);
3768                    }
3769                    std::task::Poll::Ready(Err(e)) => {
3770                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3771                            e.into(),
3772                        ))));
3773                    }
3774                }
3775
3776                // A message has been received from the channel
3777                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3778
3779                std::task::Poll::Ready(Some(match header.ordinal {
3780                    0x50acc2aa1f0acec7 => {
3781                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3782                        let mut req = fidl::new_empty!(
3783                            FlatlandPresentRequest,
3784                            fidl::encoding::DefaultFuchsiaResourceDialect
3785                        );
3786                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandPresentRequest>(&header, _body_bytes, handles, &mut req)?;
3787                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
3788                        Ok(FlatlandRequest::Present { args: req.args, control_handle })
3789                    }
3790                    0x504686eb25864780 => {
3791                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3792                        let mut req = fidl::new_empty!(
3793                            FlatlandCreateViewRequest,
3794                            fidl::encoding::DefaultFuchsiaResourceDialect
3795                        );
3796                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandCreateViewRequest>(&header, _body_bytes, handles, &mut req)?;
3797                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
3798                        Ok(FlatlandRequest::CreateView {
3799                            token: req.token,
3800                            parent_viewport_watcher: req.parent_viewport_watcher,
3801
3802                            control_handle,
3803                        })
3804                    }
3805                    0x340a3a40c2fdbd5e => {
3806                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3807                        let mut req = fidl::new_empty!(
3808                            FlatlandCreateView2Request,
3809                            fidl::encoding::DefaultFuchsiaResourceDialect
3810                        );
3811                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandCreateView2Request>(&header, _body_bytes, handles, &mut req)?;
3812                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
3813                        Ok(FlatlandRequest::CreateView2 {
3814                            token: req.token,
3815                            view_identity: req.view_identity,
3816                            protocols: req.protocols,
3817                            parent_viewport_watcher: req.parent_viewport_watcher,
3818
3819                            control_handle,
3820                        })
3821                    }
3822                    0x5e042a4d3de3efb0 => {
3823                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3824                        let mut req = fidl::new_empty!(
3825                            FlatlandCreateTransformRequest,
3826                            fidl::encoding::DefaultFuchsiaResourceDialect
3827                        );
3828                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandCreateTransformRequest>(&header, _body_bytes, handles, &mut req)?;
3829                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
3830                        Ok(FlatlandRequest::CreateTransform {
3831                            transform_id: req.transform_id,
3832
3833                            control_handle,
3834                        })
3835                    }
3836                    0x7863398291fba346 => {
3837                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3838                        let mut req = fidl::new_empty!(
3839                            FlatlandSetTranslationRequest,
3840                            fidl::encoding::DefaultFuchsiaResourceDialect
3841                        );
3842                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetTranslationRequest>(&header, _body_bytes, handles, &mut req)?;
3843                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
3844                        Ok(FlatlandRequest::SetTranslation {
3845                            transform_id: req.transform_id,
3846                            translation: req.translation,
3847
3848                            control_handle,
3849                        })
3850                    }
3851                    0x4915310bc4928edc => {
3852                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3853                        let mut req = fidl::new_empty!(
3854                            FlatlandSetOrientationRequest,
3855                            fidl::encoding::DefaultFuchsiaResourceDialect
3856                        );
3857                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetOrientationRequest>(&header, _body_bytes, handles, &mut req)?;
3858                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
3859                        Ok(FlatlandRequest::SetOrientation {
3860                            transform_id: req.transform_id,
3861                            orientation: req.orientation,
3862
3863                            control_handle,
3864                        })
3865                    }
3866                    0x1ea1766fd8996bb4 => {
3867                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3868                        let mut req = fidl::new_empty!(
3869                            FlatlandSetScaleRequest,
3870                            fidl::encoding::DefaultFuchsiaResourceDialect
3871                        );
3872                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetScaleRequest>(&header, _body_bytes, handles, &mut req)?;
3873                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
3874                        Ok(FlatlandRequest::SetScale {
3875                            transform_id: req.transform_id,
3876                            scale: req.scale,
3877
3878                            control_handle,
3879                        })
3880                    }
3881                    0x3775fc2c00b432fa => {
3882                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3883                        let mut req = fidl::new_empty!(
3884                            FlatlandSetOpacityRequest,
3885                            fidl::encoding::DefaultFuchsiaResourceDialect
3886                        );
3887                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetOpacityRequest>(&header, _body_bytes, handles, &mut req)?;
3888                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
3889                        Ok(FlatlandRequest::SetOpacity {
3890                            transform_id: req.transform_id,
3891                            value: req.value,
3892
3893                            control_handle,
3894                        })
3895                    }
3896                    0x6507843df12222d2 => {
3897                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3898                        let mut req = fidl::new_empty!(
3899                            FlatlandSetClipBoundaryRequest,
3900                            fidl::encoding::DefaultFuchsiaResourceDialect
3901                        );
3902                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetClipBoundaryRequest>(&header, _body_bytes, handles, &mut req)?;
3903                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
3904                        Ok(FlatlandRequest::SetClipBoundary {
3905                            transform_id: req.transform_id,
3906                            rect: req.rect,
3907
3908                            control_handle,
3909                        })
3910                    }
3911                    0x67a8abd2f19b1a74 => {
3912                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3913                        let mut req = fidl::new_empty!(
3914                            FlatlandAddChildRequest,
3915                            fidl::encoding::DefaultFuchsiaResourceDialect
3916                        );
3917                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandAddChildRequest>(&header, _body_bytes, handles, &mut req)?;
3918                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
3919                        Ok(FlatlandRequest::AddChild {
3920                            parent_transform_id: req.parent_transform_id,
3921                            child_transform_id: req.child_transform_id,
3922
3923                            control_handle,
3924                        })
3925                    }
3926                    0x41d6cd90b298b67a => {
3927                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3928                        let mut req = fidl::new_empty!(
3929                            FlatlandRemoveChildRequest,
3930                            fidl::encoding::DefaultFuchsiaResourceDialect
3931                        );
3932                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandRemoveChildRequest>(&header, _body_bytes, handles, &mut req)?;
3933                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
3934                        Ok(FlatlandRequest::RemoveChild {
3935                            parent_transform_id: req.parent_transform_id,
3936                            child_transform_id: req.child_transform_id,
3937
3938                            control_handle,
3939                        })
3940                    }
3941                    0x5b6d86cbbff81316 => {
3942                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3943                        let mut req = fidl::new_empty!(
3944                            FlatlandReplaceChildrenRequest,
3945                            fidl::encoding::DefaultFuchsiaResourceDialect
3946                        );
3947                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandReplaceChildrenRequest>(&header, _body_bytes, handles, &mut req)?;
3948                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
3949                        Ok(FlatlandRequest::ReplaceChildren {
3950                            parent_transform_id: req.parent_transform_id,
3951                            new_child_transform_ids: req.new_child_transform_ids,
3952
3953                            control_handle,
3954                        })
3955                    }
3956                    0x6e80ca5bcc566cd8 => {
3957                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3958                        let mut req = fidl::new_empty!(
3959                            FlatlandSetRootTransformRequest,
3960                            fidl::encoding::DefaultFuchsiaResourceDialect
3961                        );
3962                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetRootTransformRequest>(&header, _body_bytes, handles, &mut req)?;
3963                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
3964                        Ok(FlatlandRequest::SetRootTransform {
3965                            transform_id: req.transform_id,
3966
3967                            control_handle,
3968                        })
3969                    }
3970                    0x31c9d17b07c37ce4 => {
3971                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3972                        let mut req = fidl::new_empty!(
3973                            FlatlandSetHitRegionsRequest,
3974                            fidl::encoding::DefaultFuchsiaResourceDialect
3975                        );
3976                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetHitRegionsRequest>(&header, _body_bytes, handles, &mut req)?;
3977                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
3978                        Ok(FlatlandRequest::SetHitRegions {
3979                            transform_id: req.transform_id,
3980                            regions: req.regions,
3981
3982                            control_handle,
3983                        })
3984                    }
3985                    0x26d81af852d29562 => {
3986                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3987                        let mut req = fidl::new_empty!(
3988                            FlatlandSetInfiniteHitRegionRequest,
3989                            fidl::encoding::DefaultFuchsiaResourceDialect
3990                        );
3991                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetInfiniteHitRegionRequest>(&header, _body_bytes, handles, &mut req)?;
3992                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
3993                        Ok(FlatlandRequest::SetInfiniteHitRegion {
3994                            transform_id: req.transform_id,
3995                            hit_test: req.hit_test,
3996
3997                            control_handle,
3998                        })
3999                    }
4000                    0x2485fbcab7f943c => {
4001                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4002                        let mut req = fidl::new_empty!(
4003                            FlatlandCreateViewportRequest,
4004                            fidl::encoding::DefaultFuchsiaResourceDialect
4005                        );
4006                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandCreateViewportRequest>(&header, _body_bytes, handles, &mut req)?;
4007                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4008                        Ok(FlatlandRequest::CreateViewport {
4009                            viewport_id: req.viewport_id,
4010                            token: req.token,
4011                            properties: req.properties,
4012                            child_view_watcher: req.child_view_watcher,
4013
4014                            control_handle,
4015                        })
4016                    }
4017                    0x26fae823c4ebedad => {
4018                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4019                        let mut req = fidl::new_empty!(
4020                            FlatlandCreateImageRequest,
4021                            fidl::encoding::DefaultFuchsiaResourceDialect
4022                        );
4023                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandCreateImageRequest>(&header, _body_bytes, handles, &mut req)?;
4024                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4025                        Ok(FlatlandRequest::CreateImage {
4026                            image_id: req.image_id,
4027                            import_token: req.import_token,
4028                            vmo_index: req.vmo_index,
4029                            properties: req.properties,
4030
4031                            control_handle,
4032                        })
4033                    }
4034                    0x8039391d715eb28 => {
4035                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4036                        let mut req = fidl::new_empty!(
4037                            FlatlandSetImageSampleRegionRequest,
4038                            fidl::encoding::DefaultFuchsiaResourceDialect
4039                        );
4040                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetImageSampleRegionRequest>(&header, _body_bytes, handles, &mut req)?;
4041                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4042                        Ok(FlatlandRequest::SetImageSampleRegion {
4043                            image_id: req.image_id,
4044                            rect: req.rect,
4045
4046                            control_handle,
4047                        })
4048                    }
4049                    0x766cf99a2ec58446 => {
4050                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4051                        let mut req = fidl::new_empty!(
4052                            FlatlandSetImageDestinationSizeRequest,
4053                            fidl::encoding::DefaultFuchsiaResourceDialect
4054                        );
4055                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetImageDestinationSizeRequest>(&header, _body_bytes, handles, &mut req)?;
4056                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4057                        Ok(FlatlandRequest::SetImageDestinationSize {
4058                            image_id: req.image_id,
4059                            size: req.size,
4060
4061                            control_handle,
4062                        })
4063                    }
4064                    0x10f5da1356275b7b => {
4065                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4066                        let mut req = fidl::new_empty!(
4067                            FlatlandSetImageBlendingFunctionRequest,
4068                            fidl::encoding::DefaultFuchsiaResourceDialect
4069                        );
4070                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetImageBlendingFunctionRequest>(&header, _body_bytes, handles, &mut req)?;
4071                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4072                        Ok(FlatlandRequest::SetImageBlendingFunction {
4073                            image_id: req.image_id,
4074                            blend_mode: req.blend_mode,
4075
4076                            control_handle,
4077                        })
4078                    }
4079                    0x5b1667f130c3de67 => {
4080                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4081                        let mut req = fidl::new_empty!(
4082                            FlatlandSetImageBlendModeRequest,
4083                            fidl::encoding::DefaultFuchsiaResourceDialect
4084                        );
4085                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetImageBlendModeRequest>(&header, _body_bytes, handles, &mut req)?;
4086                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4087                        Ok(FlatlandRequest::SetImageBlendMode {
4088                            image_id: req.image_id,
4089                            blend_mode: req.blend_mode,
4090
4091                            control_handle,
4092                        })
4093                    }
4094                    0x2da9e4ef4c2cff6f => {
4095                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4096                        let mut req = fidl::new_empty!(
4097                            FlatlandSetImageOpacityRequest,
4098                            fidl::encoding::DefaultFuchsiaResourceDialect
4099                        );
4100                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetImageOpacityRequest>(&header, _body_bytes, handles, &mut req)?;
4101                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4102                        Ok(FlatlandRequest::SetImageOpacity {
4103                            image_id: req.image_id,
4104                            val: req.val,
4105
4106                            control_handle,
4107                        })
4108                    }
4109                    0x21b20f2c14aae6bc => {
4110                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4111                        let mut req = fidl::new_empty!(
4112                            FlatlandSetImageFlipRequest,
4113                            fidl::encoding::DefaultFuchsiaResourceDialect
4114                        );
4115                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetImageFlipRequest>(&header, _body_bytes, handles, &mut req)?;
4116                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4117                        Ok(FlatlandRequest::SetImageFlip {
4118                            image_id: req.image_id,
4119                            flip: req.flip,
4120
4121                            control_handle,
4122                        })
4123                    }
4124                    0x5e62355abc1c4c5d => {
4125                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4126                        let mut req = fidl::new_empty!(
4127                            FlatlandCreateFilledRectRequest,
4128                            fidl::encoding::DefaultFuchsiaResourceDialect
4129                        );
4130                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandCreateFilledRectRequest>(&header, _body_bytes, handles, &mut req)?;
4131                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4132                        Ok(FlatlandRequest::CreateFilledRect {
4133                            rect_id: req.rect_id,
4134
4135                            control_handle,
4136                        })
4137                    }
4138                    0x32d6ef41e182dfa5 => {
4139                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4140                        let mut req = fidl::new_empty!(
4141                            FlatlandSetSolidFillRequest,
4142                            fidl::encoding::DefaultFuchsiaResourceDialect
4143                        );
4144                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetSolidFillRequest>(&header, _body_bytes, handles, &mut req)?;
4145                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4146                        Ok(FlatlandRequest::SetSolidFill {
4147                            rect_id: req.rect_id,
4148                            color: req.color,
4149                            size: req.size,
4150
4151                            control_handle,
4152                        })
4153                    }
4154                    0x7392cabe45618f9b => {
4155                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4156                        let mut req = fidl::new_empty!(
4157                            FlatlandReleaseFilledRectRequest,
4158                            fidl::encoding::DefaultFuchsiaResourceDialect
4159                        );
4160                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandReleaseFilledRectRequest>(&header, _body_bytes, handles, &mut req)?;
4161                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4162                        Ok(FlatlandRequest::ReleaseFilledRect {
4163                            rect_id: req.rect_id,
4164
4165                            control_handle,
4166                        })
4167                    }
4168                    0x4ed2cfc0ce130862 => {
4169                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4170                        let mut req = fidl::new_empty!(
4171                            FlatlandSetContentRequest,
4172                            fidl::encoding::DefaultFuchsiaResourceDialect
4173                        );
4174                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetContentRequest>(&header, _body_bytes, handles, &mut req)?;
4175                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4176                        Ok(FlatlandRequest::SetContent {
4177                            transform_id: req.transform_id,
4178                            content_id: req.content_id,
4179
4180                            control_handle,
4181                        })
4182                    }
4183                    0x66ab67e9608ddb9f => {
4184                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4185                        let mut req = fidl::new_empty!(
4186                            FlatlandSetViewportPropertiesRequest,
4187                            fidl::encoding::DefaultFuchsiaResourceDialect
4188                        );
4189                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetViewportPropertiesRequest>(&header, _body_bytes, handles, &mut req)?;
4190                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4191                        Ok(FlatlandRequest::SetViewportProperties {
4192                            viewport_id: req.viewport_id,
4193                            properties: req.properties,
4194
4195                            control_handle,
4196                        })
4197                    }
4198                    0xab9328419451c22 => {
4199                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4200                        let mut req = fidl::new_empty!(
4201                            FlatlandReleaseTransformRequest,
4202                            fidl::encoding::DefaultFuchsiaResourceDialect
4203                        );
4204                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandReleaseTransformRequest>(&header, _body_bytes, handles, &mut req)?;
4205                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4206                        Ok(FlatlandRequest::ReleaseTransform {
4207                            transform_id: req.transform_id,
4208
4209                            control_handle,
4210                        })
4211                    }
4212                    0x5b35aab9baffecae => {
4213                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4214                        let mut req = fidl::new_empty!(
4215                            fidl::encoding::EmptyPayload,
4216                            fidl::encoding::DefaultFuchsiaResourceDialect
4217                        );
4218                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
4219                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4220                        Ok(FlatlandRequest::ReleaseView { control_handle })
4221                    }
4222                    0xbad474aeb5293f9 => {
4223                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4224                        let mut req = fidl::new_empty!(
4225                            FlatlandReleaseViewportRequest,
4226                            fidl::encoding::DefaultFuchsiaResourceDialect
4227                        );
4228                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandReleaseViewportRequest>(&header, _body_bytes, handles, &mut req)?;
4229                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4230                        Ok(FlatlandRequest::ReleaseViewport {
4231                            viewport_id: req.viewport_id,
4232
4233                            responder: FlatlandReleaseViewportResponder {
4234                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4235                                tx_id: header.tx_id,
4236                            },
4237                        })
4238                    }
4239                    0xb884ffdbc72c111 => {
4240                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4241                        let mut req = fidl::new_empty!(
4242                            FlatlandReleaseImageRequest,
4243                            fidl::encoding::DefaultFuchsiaResourceDialect
4244                        );
4245                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandReleaseImageRequest>(&header, _body_bytes, handles, &mut req)?;
4246                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4247                        Ok(FlatlandRequest::ReleaseImage { image_id: req.image_id, control_handle })
4248                    }
4249                    0x4ec8817c02828c3e => {
4250                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4251                        let mut req = fidl::new_empty!(
4252                            fidl::encoding::EmptyPayload,
4253                            fidl::encoding::DefaultFuchsiaResourceDialect
4254                        );
4255                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
4256                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4257                        Ok(FlatlandRequest::Clear { control_handle })
4258                    }
4259                    0x46a8b397e68a8888 => {
4260                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4261                        let mut req = fidl::new_empty!(
4262                            FlatlandSetDebugNameRequest,
4263                            fidl::encoding::DefaultFuchsiaResourceDialect
4264                        );
4265                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetDebugNameRequest>(&header, _body_bytes, handles, &mut req)?;
4266                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4267                        Ok(FlatlandRequest::SetDebugName { name: req.name, control_handle })
4268                    }
4269                    _ => Err(fidl::Error::UnknownOrdinal {
4270                        ordinal: header.ordinal,
4271                        protocol_name:
4272                            <FlatlandMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4273                    }),
4274                }))
4275            },
4276        )
4277    }
4278}
4279
4280/// Each Flatland instance contains a Graph, which consists of a set of objects, and the
4281/// relationships between those objects. The client can specify a subset of those objects
4282/// (specifically, the directed acyclic graph starting at the root transform) to be presented as
4283/// content to some kind of output -- usually, a display.
4284///
4285/// Flatland Graphs are both hierarchical, and distributed. Graphs from different Flatland instances
4286/// may be connected together, allowing multiple processes to be involved in authoring content for a
4287/// particular output.
4288///
4289/// All functions in this protocol are feed-forward. The operations they represent are not fully
4290/// executed until [`Present`] is called.
4291#[derive(Debug)]
4292pub enum FlatlandRequest {
4293    /// Complete execution of all feed-forward operations.
4294    ///
4295    /// If executing an operation produces an error (e.g., CreateTransform(0)), an [`OnError`] event
4296    /// is emitted. Operations that produce errors are ignored and the channel is closed.
4297    ///
4298    /// If the execution is completed successfully, [`OnNextFrameBegin`] emits NO_ERROR along
4299    /// with other valid fields.
4300    ///
4301    /// The client may only call [`Present`] when they have a non-zero number of present credits,
4302    /// which are tracked by the server. The server may increment the number of credits when it
4303    /// fires the [`OnNextFrameBegin`] event, which informs the client when it receives additional
4304    /// present credits. Each [`Present`] call uses one present credit and decrements the server
4305    /// count by one. If the client calls [`Present`] with no present credits, the server will
4306    /// return a `NO_PRESENTS_REMAINING` error.
4307    ///
4308    /// The client should assume that prior to receiving any [`OnNextFrameBegin`] events, they have
4309    /// one present credit.
4310    ///
4311    /// Every [`Present`] call results in one [`OnNextFrameBegin`] event, and one
4312    /// [`OnFramePresented`] event, typically in that order.
4313    ///
4314    /// When the commands flushed by [`Present`] make it to display, an [`OnFramePresented`] event
4315    /// is fired. This event includes information pertaining to all [`Present`]s that had content
4316    /// that were part of that frame.
4317    ///
4318    /// See [`fuchsia.ui.composition/PresentArgs`] documentation above for more detailed information
4319    /// on what arguments are passed in and their role.
4320    Present {
4321        args: PresentArgs,
4322        control_handle: FlatlandControlHandle,
4323    },
4324    /// Two Flatland instances may be connected in a parent-child relationship. The parent endpoint
4325    /// is held in a Viewport, and the child endpoint is held in a View. The parent Flatland
4326    /// instance that creates a Viewport has control over how the child's View is integrated into
4327    /// its own View.
4328    ///
4329    /// The lifecycle of a parent-child connection starts with two endpoints of a channel object:
4330    /// a ViewportCreationToken and a ViewCreationToken. Out-of-band protocols pass the
4331    /// ViewportCreationToken to the parent, which calls [`CreateViewport`], and the
4332    /// ViewCreationToken to the child, which calls [`CreateView`].
4333    ///
4334    /// Only nodes connected to the Root Transform in this Flatland instance will be rendered into
4335    /// the parent's Viewport.
4336    ///
4337    /// Calling [`CreateView`] a second time will disconnect the Root Transform from the existing
4338    /// parent's Viewport, and attach it to a new parent's Viewport. In other words, each View can
4339    /// only have one parent.
4340    ///
4341    /// This function is queued, meaning that the Root Transform will not be attached to the
4342    /// parent Viewport until [`Present`] is called. However, clients will receive information
4343    /// through their ParentViewportWatcher (e.g., LayoutInfo) immediately after calling this
4344    /// function, even if they have not called [`Present`] or [`SetRootTransform`]. This allows
4345    /// clients to wait for layout information from their parent before calling [`Present`].
4346    ///
4347    /// Any illegal operations on ParentViewportWatcher will cause both ParentViewportWatcher
4348    /// channel and this Flatland channel to be torn down.
4349    ///
4350    /// Lifecycle note. The lifetime of the ParentViewportWatcher channel is bound by the peer
4351    /// ViewportCreationToken. When the ViewportCreationToken dies, this ParentViewportWatcher
4352    /// channel is destroyed.
4353    ///
4354    /// Views and subgraphs of Views created using `CreateView` will not be represented in the
4355    /// ViewTree, and hence will not be able to participate in any ViewTree-dependent interactions
4356    /// such as touch, mouse or focus.
4357    /// The Flatland protocol provides no way for Views in the subgraph of a View created with
4358    /// `CreateView` to know that they are excluded from the ViewTree.
4359    CreateView {
4360        token: fidl_fuchsia_ui_views::ViewCreationToken,
4361        parent_viewport_watcher: fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>,
4362        control_handle: FlatlandControlHandle,
4363    },
4364    /// Identical to [`CreateView`], except it allows association of View identity (ViewRef) and
4365    /// view-bound protocols.
4366    CreateView2 {
4367        token: fidl_fuchsia_ui_views::ViewCreationToken,
4368        view_identity: fidl_fuchsia_ui_views::ViewIdentityOnCreation,
4369        protocols: ViewBoundProtocols,
4370        parent_viewport_watcher: fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>,
4371        control_handle: FlatlandControlHandle,
4372    },
4373    /// Creates a new Transform node. Transforms are a hierarchical piece of a Flatland graph. They
4374    /// can have children, and can reference Content. A sub-graph represented by a Transform and its
4375    /// descendants can be rendered to a display.
4376    ///
4377    /// Transforms are kept alive, even when released, as long as they are children of either an
4378    /// unreleased Transform, or the Root Transform.
4379    ///
4380    /// Each Transform can have a single piece of attached Content. Common types of Content include
4381    /// bitmaps, asynchronous streams of images, and Viewports to Views hosted in other Flatland
4382    /// instances.
4383    ///
4384    /// Transforms have attributes. Child Transforms inherit the combined attributes of their
4385    /// parents. Content attached to a Transform is also affected by that Transform's attributes.
4386    ///
4387    /// When a sub-graph of Transforms is rendered, Content will be rendered back-to-front, starting
4388    /// with the Content on the root transform, and continuing recursively through all of its child
4389    /// Transforms in the order the children were added. See [`AddChild`] for more information.
4390    ///
4391    /// Zero is not a valid transform id. All other values are valid, assuming they are not already
4392    /// in use (see [`ReleaseTransform`] for more details).
4393    CreateTransform {
4394        transform_id: TransformId,
4395        control_handle: FlatlandControlHandle,
4396    },
4397    /// All Transform objects support all attributes.
4398    ///
4399    /// Geometric attributes are applied in the following order:
4400    /// 1. Scale (relative to the parent transform's coordinate space)
4401    /// 2. Orientation (relative to the parent transform's coordinate space)
4402    /// 3. Translation (relative to the parent transforms's coordinate space,
4403    ///    unaffected by scale applied to the current transform).
4404    /// 4. Clipping (relative to the current transform's coordinate space)
4405    ///
4406    /// The effects of each of these attributes are cumulative. This means the transform's position
4407    /// in the view space, and its clip boundary, will be calculated based on that chain of
4408    /// geometric attributes going up to the root transform.
4409    ///
4410    /// For instance, in a nested hierarchy such as the following:
4411    ///     [Root-Transform -> Transform1 -> Transform2 -> CurrentTransform]
4412    /// If Transform1 is translated by [2,0] and Transform2 is translated by [0,1] then the
4413    /// view-space position of CurrentTransform will be [2,1].
4414    ///
4415    /// Sets the translation on a Transform. The order of geometric attribute application is
4416    /// addressed above.
4417    SetTranslation {
4418        transform_id: TransformId,
4419        translation: fidl_fuchsia_math::Vec_,
4420        control_handle: FlatlandControlHandle,
4421    },
4422    /// Sets the orientation on a Transform. The order of geometric attribute application is
4423    /// addressed in the documentation for [`SetTranslation`]. In Flatland, the +X axis is
4424    /// to the right and the +Y axis is down. There is no notion of a Z axis. CCW is defined
4425    /// from the POV of the user, as if a skeuomorphoic clock is displayed on the screen.
4426    SetOrientation {
4427        transform_id: TransformId,
4428        orientation: Orientation,
4429        control_handle: FlatlandControlHandle,
4430    },
4431    /// Sets the scale on a transform. The order of geometric attribute application is
4432    /// addressed above. The (x,y) values in the VecF |scale| refer to the scale factor in the
4433    /// x-axis (width) and y-axis (height) respectively. Scale values must be normal 32-bit
4434    /// floating point values: https://en.wikipedia.org/wiki/Normal_number_%28computing%29
4435    SetScale {
4436        transform_id: TransformId,
4437        scale: fidl_fuchsia_math::VecF,
4438        control_handle: FlatlandControlHandle,
4439    },
4440    /// Sets an opacity in linear space to be applied to a transform and its descendents,
4441    /// which include other transforms and content. Opacity values must be in the range
4442    /// of [0.0, 1.0], where 0.0 is completely transparent and 1.0 is completely opaque.
4443    /// Attempting to call this function with values outside that range will result in
4444    /// an error. A transform's opacity value is multiplied with that of its parent. This
4445    /// effect works differently from group opacity. Using group opacity, child nodes are
4446    /// rendered together first, and then have the parent's opacity applied as a post-effect.
4447    /// Here, opacity is applied to each child individually. This may result in a very
4448    /// different effect.
4449    SetOpacity {
4450        transform_id: TransformId,
4451        value: f32,
4452        control_handle: FlatlandControlHandle,
4453    },
4454    /// Sets the bounds, expressed in the local coordinate space of the transform, that
4455    /// constrains the region that content attached to this transform can be rendered to.
4456    /// If the content's area exceeds the clip bounds, the area outside the bounds will
4457    /// not be rendered. These bounds are valid for all children of this transform node as
4458    /// well, which includes nested Flatland instances and their node hierarchies.
4459    /// If a child transform attempts to set clip bounds larger than that of its parent,
4460    /// it will be clipped to the parent's clip bounds. The default state is for a transform
4461    /// to be unclipped, meaning it will not have any bounds placed on its render region.
4462    /// The clip width/height must be positive. Negative values will result in an error.
4463    /// Passing in an empty box to the |rect| parameter will remove the clip bounds.
4464    SetClipBoundary {
4465        transform_id: TransformId,
4466        rect: Option<Box<fidl_fuchsia_math::Rect>>,
4467        control_handle: FlatlandControlHandle,
4468    },
4469    /// Adds a child Transform to a parent Transform. The new child Transform, and any Content
4470    /// attached to it or its children, will be rendered on top of the parent's Content, as well as
4471    /// any previously added children.
4472    AddChild {
4473        parent_transform_id: TransformId,
4474        child_transform_id: TransformId,
4475        control_handle: FlatlandControlHandle,
4476    },
4477    /// Removes a child Transform from a parent Transform.
4478    RemoveChild {
4479        parent_transform_id: TransformId,
4480        child_transform_id: TransformId,
4481        control_handle: FlatlandControlHandle,
4482    },
4483    /// Removes all child Transforms from a parent Transform and replaces them with the new child
4484    /// transforms in `new_child_transform_ids`.
4485    ReplaceChildren {
4486        parent_transform_id: TransformId,
4487        new_child_transform_ids: Vec<TransformId>,
4488        control_handle: FlatlandControlHandle,
4489    },
4490    /// Sets the Root Transform for the graph.
4491    ///
4492    /// The sub-graph defined by the Root Transform and its children will be rendered as View
4493    /// in the connected parent's Viewport (see [`CreateView`]). Any parents of the Root Transform
4494    /// in this Graph will be ignored.
4495    ///
4496    /// The Root Transform, and all children of the Root Transform, are kept alive if they are
4497    /// released (see [`ReleaseTransform`] for more details).
4498    ///
4499    /// There is only ever one Root. Since 0 is not a valid transform id (see [`CreateTransform`]),
4500    /// calling SetRootTransform(0) clears the current Root, destroying any previously released
4501    /// objects that are not referenced by the new root.
4502    ///
4503    /// Note that every View has a clip boundary equivalent to its logical size. Anything outside
4504    /// that clip boundary will not be rendered. Hence, the Root Transform has a useful coordinate
4505    /// space of (0, 0) to (logical_size.width, logical_size.height), where (0, 0) is the upper left
4506    /// corner.
4507    ///
4508    /// Setting the root transform installs a full screen hit region on the root transform. Clients
4509    /// may remove this hit region if they don't want users to be able to interact with the root
4510    /// transform's content. For additional details on hit regions, see the [`SetHitRegions`]
4511    /// documentation.
4512    ///
4513    /// Default hit region rules
4514    ///
4515    ///   A default hit region follows these rules:
4516    ///   - When [`SetRootTransform`](T) is called, T receives a maximal hit region, covering the
4517    ///   entire view.
4518    ///   - If [`SetHitRegions`] is called on T, either before or after [`SetRootTransform`](T),
4519    ///   then no default hit region is active and the client specified hit regions are used.
4520    ///   - If a transform is no longer the root transform, i.e., [`SetRootTransform`](U) is
4521    ///   called, then the original transform no longer has its default hit region.
4522    ///   - Clients can remove or modify the root transform's hit regions the same way they would
4523    ///   reset any other transform's hit regions, by calling [`SetHitRegions`] with the appropriate
4524    ///   vector.
4525    SetRootTransform {
4526        transform_id: TransformId,
4527        control_handle: FlatlandControlHandle,
4528    },
4529    /// Sets the interactive areas for a Transform. By default, Content is not interactive; hit
4530    /// regions must be placed for a user to interact with the Content in a View. Because hit
4531    /// regions are described in the Flatland protocol, a Flatland instance can synchronize Content
4532    /// and hit regions.
4533    ///
4534    /// Each hit region is placed in the coordinate space of the owning Transform, and may or may
4535    /// not interact with different types of hit testing, depending on its [`HitTestInteraction`]
4536    /// type. When there are multiple hit regions that intersect with a hit test, the precedence
4537    /// rules given below dictate which hit region has interacted with the hit test. Only Transforms
4538    /// that transitively connect to the root Transform have their hit regions interact with a hit
4539    /// test.
4540    ///
4541    /// Calling this function replaces any previous values set on this Transform. To reset a
4542    /// Transform to "no hit testing": send an empty vector with [`SetHitRegions`].
4543    ///
4544    /// Note that root transforms get a default hit region installed by Flatland. For more details,
4545    /// see the [`SetRootTransform`] documentation.
4546    ///
4547    /// Precedence rules
4548    ///   Within a Transform, if multiple hit regions overlap, the hit test examines each
4549    ///   intersecting hit region for a possible interaction. Thus, for a regular hit test R and an
4550    ///   accessibility hit test A, where R and A both intersect two hit regions D ([`DEFAULT`]) and
4551    ///   S ([`SEMANTICALLY_INVISIBLE`]) on the same Transform, (1) R interacts with both D and S,
4552    ///   and (2) A only interacts with D. Generally, hit regions that overlap in a single Transform
4553    ///   can cause confusing behavior.
4554    ///
4555    ///   Within a View, for a given hit test, the front-most Transform's hit regions take
4556    ///   precedence over those behind. This follows the expected reverse "render order" of
4557    ///   Transforms (described in [`CreateTransform`]), where a user expects to interact with
4558    ///   Content that is visible, or front-most.
4559    ///
4560    ///   Across Flatland instances, for a given hit test, the front-most instance's front-most
4561    ///   Transform's hit regions take precedence over those behind. This follows the expected
4562    ///   reverse "render order" of views, where a user expects to interact with the View that is
4563    ///   visible, or front-most. For example, if a child View owns Content that is rendered over
4564    ///   the parent View, the user expects to interact with the child's Content.
4565    SetHitRegions {
4566        transform_id: TransformId,
4567        regions: Vec<HitRegion>,
4568        control_handle: FlatlandControlHandle,
4569    },
4570    /// Identical to [`SetHitRegions`], except the hit region associated with [`transform_id`]
4571    /// covers an infinite region. The hit region is invariant against translation, scaling, and
4572    /// orientation of the Transform.
4573    ///
4574    /// An infinite hit region is still limited in extent by the View's clip boundary, just like a
4575    /// finite hit region.
4576    ///
4577    /// Calling this function replaces any previous values set on this Transform. To reset a
4578    /// Transform to "no hit testing": send an empty vector with [`SetHitRegions`].
4579    SetInfiniteHitRegion {
4580        transform_id: TransformId,
4581        hit_test: HitTestInteraction,
4582        control_handle: FlatlandControlHandle,
4583    },
4584    /// The Viewport and View pair, together, represent the connection between two Flatland
4585    /// instances. The Viewport is created in the parent, and the View is created in the child. The
4586    /// parent has control over how the child's View is integrated into its own View.
4587    ///
4588    /// Any illegal operations on ChildViewWatcher will cause both ChildViewWatcher channel and this
4589    /// Flatland channel to be torn down.
4590    ///
4591    /// `ViewportProperties` must have logical_size set. This is the initial size that will drive
4592    /// the layout of the child. The logical_size is also used as the default Content size, but
4593    /// subsequent changes to the logical_size will have no effect on the Content size.
4594    ///
4595    /// `ViewportProperties` may have inset field not set. In that case, the default value of
4596    /// (0, 0, 0, 0) is used.
4597    ///
4598    /// The logical_size must have positive X and Y components.
4599    ///
4600    /// Zero is not a valid ContentId. All other values are valid, assuming they are not already
4601    /// in use for another piece of Content (see [`ReleaseViewport`] for more details).
4602    ///
4603    /// Lifecycle note. The lifetime of the ChildViewWatcher channel is bound by the peer
4604    /// ViewCreationToken. When the ViewCreationToken dies, this ChildViewWatcher channel is
4605    /// destroyed.
4606    CreateViewport {
4607        viewport_id: ContentId,
4608        token: fidl_fuchsia_ui_views::ViewportCreationToken,
4609        properties: ViewportProperties,
4610        child_view_watcher: fidl::endpoints::ServerEnd<ChildViewWatcherMarker>,
4611        control_handle: FlatlandControlHandle,
4612    },
4613    /// An Image is a bitmap backed by a specific VMO in a BufferCollection.
4614    ///
4615    /// Image creation requires an allocated BufferCollection registered with Allocator. This
4616    /// function will fail unless all clients of the specified BufferCollection have set their
4617    /// constraints.
4618    ///
4619    /// The Image must reference a valid VMO index and must have ImageProperties that fall within
4620    /// the constraints specified by the backing BufferCollection (i.e. width and height within a
4621    /// valid range, etc.)
4622    ///
4623    /// Zero is not a valid Image id. All other values are valid, assuming they are not already in
4624    /// use for another piece of Content (see [`ReleaseImage`] for more details).
4625    CreateImage {
4626        image_id: ContentId,
4627        import_token: BufferCollectionImportToken,
4628        vmo_index: u32,
4629        properties: ImageProperties,
4630        control_handle: FlatlandControlHandle,
4631    },
4632    /// This function is used to determine the region (in texel space) of an image that will be used
4633    /// by Flatland when rendering. The image to be sampled is referenced by [`image_id`] and the
4634    /// sample region is specified by [`rect`] which itself is comprised of an origin point (x,y) as
4635    /// well as a width and height, in unnormalized coordinates. It is illegal to call this function
4636    /// on non-image content, or to sample a region outside of the texel space of the image. In
4637    /// other words, the region specifed by [`rect`] must not exceed the ranges (0, image_width) and
4638    /// (0, image_height). If (rect.x + rect.width > image_width) or (rect.y + rect.height >
4639    /// image_height) or if any of the values are negative, this will result in an error.
4640    ///
4641    /// If this method is not called, the default sample region is the rectangle with origin at
4642    /// (0, 0) and width and height set at ImageProperties from [`CreateImage`].
4643    SetImageSampleRegion {
4644        image_id: ContentId,
4645        rect: fidl_fuchsia_math::RectF,
4646        control_handle: FlatlandControlHandle,
4647    },
4648    /// The content size for an Image is the size of the rectangle in the parent's logical
4649    /// coordinate space that the image occupies. This combined with the global translation of the
4650    /// transform it is attached to determines the size and location of where the content is
4651    /// rendered on the display.
4652    ///
4653    /// If this method is not called, the default image destination size is the width and height set
4654    /// at ImageProperties from [`CreateImage`]. The destination size will be affected by scaling if
4655    /// [`SetScale`] is used on the attached Transform or its parents.
4656    SetImageDestinationSize {
4657        image_id: ContentId,
4658        size: fidl_fuchsia_math::SizeU,
4659        control_handle: FlatlandControlHandle,
4660    },
4661    /// Determines the blend function to use when rendering the content specified by
4662    /// |image_id|. |image_id| must be a valid ContentId associated to a transform through
4663    /// a call to |CreateImage| or |CreateFilledRect|. For details on the different blend functions
4664    /// that are available, please refer to the BlendMode enum. If this function is not called, then
4665    /// the default blendmode is BlendMode::SRC.
4666    SetImageBlendingFunction {
4667        image_id: ContentId,
4668        blend_mode: BlendMode,
4669        control_handle: FlatlandControlHandle,
4670    },
4671    /// Determines the blend function to use when rendering the content specified by
4672    /// |image_id|. |image_id| must be a valid ContentId associated to a transform through
4673    /// a call to |CreateImage| or |CreateFilledRect|. For details on the different blend functions
4674    /// that are available, please refer to the BlendMode2 enum. If this function is not called,
4675    /// the default blendmode is BlendMode2::REPLACE.
4676    SetImageBlendMode {
4677        image_id: ContentId,
4678        blend_mode: BlendMode2,
4679        control_handle: FlatlandControlHandle,
4680    },
4681    /// Sets an opacity in linear space to be applied to a flatland image. Opacity values must
4682    /// be in the range [0.0, 1.0].
4683    SetImageOpacity {
4684        image_id: ContentId,
4685        val: f32,
4686        control_handle: FlatlandControlHandle,
4687    },
4688    /// Sets the image flip to be applied to a flatland image. This call must be performed after a
4689    /// successful |CreateImage| call. If an invalid |image_id| is supplied, the channel will be
4690    /// closed due to FlatlandError::BAD_OPERATION. This flip will be applied to the Image before
4691    /// parent Transform Orientations. If this function is not called, then the default flip value
4692    /// is ImageFlip::NONE.
4693    SetImageFlip {
4694        image_id: ContentId,
4695        flip: ImageFlip,
4696        control_handle: FlatlandControlHandle,
4697    },
4698    /// Creates a solid-color rectangle. By default a filled-rect does not have a defined
4699    /// color or size. It is necessary to call |SetSolidFill| to specify a color and size
4700    /// before a filled rect can be used for rendering. Not doing so will result the
4701    CreateFilledRect {
4702        rect_id: ContentId,
4703        control_handle: FlatlandControlHandle,
4704    },
4705    /// Defines the color and size of a filled rect. |rect_id| must refer to content that
4706    /// was created via a call to CreateFilledRect. The color is not premultiplied. Color values
4707    /// must be within the range [0,1] inclusive, and normal 32-bit
4708    /// floating point values: https://en.wikipedia.org/wiki/Normal_number_%28computing%29. Values
4709    /// that do not conform to these specifications will cause the channel to close.
4710    /// The rectangle's top left corner will be at (0, 0) in its transform's coordinate space.
4711    /// Hence, its bottom right corner will be at (size.width, size.height).
4712    SetSolidFill {
4713        rect_id: ContentId,
4714        color: ColorRgba,
4715        size: fidl_fuchsia_math::SizeU,
4716        control_handle: FlatlandControlHandle,
4717    },
4718    /// Automatically garbage collects the rectangle when it is no longer needed for
4719    /// rendering. |rect_id| must have been instantiated with a call to
4720    /// |CreateFilledRect|. Once released, the ID immediately goes out of scope and is free
4721    /// to be used again.
4722    ReleaseFilledRect {
4723        rect_id: ContentId,
4724        control_handle: FlatlandControlHandle,
4725    },
4726    /// Setting a piece of Content on a Transform makes that Content visible in the render tree as
4727    /// long as the Transform is visible from the root Transform. The Content will be rendered
4728    /// before, and therefore "behind", any Content attached to the descendants of the Transform.
4729    ///
4730    /// Because each Transform can have, at most, a single piece of Content on it, calling this
4731    /// function on a Transform that already has Content will replace that Content.
4732    ///
4733    /// A Content may be set on more than one Transform.
4734    ///
4735    /// Calling this function with a Content id of 0 will remove any Content currently on the
4736    /// Transform.
4737    SetContent {
4738        transform_id: TransformId,
4739        content_id: ContentId,
4740        control_handle: FlatlandControlHandle,
4741    },
4742    /// Transforms are usually sufficient to change how Content is presented. Viewports, however,
4743    /// have special properties that are not part of the Transform hierarchy. Those properties can
4744    /// be set using this function.
4745    SetViewportProperties {
4746        viewport_id: ContentId,
4747        properties: ViewportProperties,
4748        control_handle: FlatlandControlHandle,
4749    },
4750    /// Released Transforms will be garbage collected by the system once they are no longer
4751    /// necessary for rendering. For Transforms, this means there is no path from any unreleased
4752    /// Transform to the newly-released Transform.
4753    ///
4754    /// Once released, the id immediately goes out of scope for future function calls and can be
4755    /// reused when creating new Transforms.
4756    ///
4757    /// It is an error to call functions with a released id (unless that id has been reused to
4758    /// construct a new Transform).
4759    ReleaseTransform {
4760        transform_id: TransformId,
4761        control_handle: FlatlandControlHandle,
4762    },
4763    ReleaseView {
4764        control_handle: FlatlandControlHandle,
4765    },
4766    /// Releases a Viewport from the scene, even if the Viewport is still connected to a Transform.
4767    /// Unlike other resources, Viewports are garbage collected by the system during the next
4768    /// [`Present`] because a removed Viewport is guaranteed to provide no renderable content.
4769    ///
4770    /// Use SetContent(transform_id, 0) to clean up references to released Viewports.
4771    ///
4772    /// Despite having a return type, this function is still feed-forward like [`CreateView`] and
4773    /// requires a call to [`Present`] to be executed. The ViewportCreationToken will be returned
4774    /// after the presented operations have been executed.
4775    ReleaseViewport {
4776        viewport_id: ContentId,
4777        responder: FlatlandReleaseViewportResponder,
4778    },
4779    /// Released Images will be garbage collected by the system once they are no longer necessary
4780    /// for rendering. For Images, this means the Image is no longer attached to any Transform and
4781    /// any pending rendering that references the Image is complete.
4782    ///
4783    /// Use SetContent(transform_id, 0) to clean up references to released Images.
4784    ///
4785    /// Once released, the id immediately goes out of scope for future function calls and can be
4786    /// reused when creating new Images.
4787    ///
4788    /// It is an error to call functions with a released id (unless that id has been reused to
4789    /// construct a new Image).
4790    ReleaseImage {
4791        image_id: ContentId,
4792        control_handle: FlatlandControlHandle,
4793    },
4794    /// This function will reset all state on this interface. This includes destroying all existing
4795    /// View and Viewports without returning the associated Token to the caller.
4796    Clear {
4797        control_handle: FlatlandControlHandle,
4798    },
4799    /// Set debug name of the current client that can be used by Flatland to print as a prefix to
4800    /// logs to help client distinguish what is theirs. [`name`] can be an arbitrary string, but the
4801    /// current process name (see fsl::GetCurrentProcessName()) is a good default.
4802    SetDebugName {
4803        name: String,
4804        control_handle: FlatlandControlHandle,
4805    },
4806}
4807
4808impl FlatlandRequest {
4809    #[allow(irrefutable_let_patterns)]
4810    pub fn into_present(self) -> Option<(PresentArgs, FlatlandControlHandle)> {
4811        if let FlatlandRequest::Present { args, control_handle } = self {
4812            Some((args, control_handle))
4813        } else {
4814            None
4815        }
4816    }
4817
4818    #[allow(irrefutable_let_patterns)]
4819    pub fn into_create_view(
4820        self,
4821    ) -> Option<(
4822        fidl_fuchsia_ui_views::ViewCreationToken,
4823        fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>,
4824        FlatlandControlHandle,
4825    )> {
4826        if let FlatlandRequest::CreateView { token, parent_viewport_watcher, control_handle } = self
4827        {
4828            Some((token, parent_viewport_watcher, control_handle))
4829        } else {
4830            None
4831        }
4832    }
4833
4834    #[allow(irrefutable_let_patterns)]
4835    pub fn into_create_view2(
4836        self,
4837    ) -> Option<(
4838        fidl_fuchsia_ui_views::ViewCreationToken,
4839        fidl_fuchsia_ui_views::ViewIdentityOnCreation,
4840        ViewBoundProtocols,
4841        fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>,
4842        FlatlandControlHandle,
4843    )> {
4844        if let FlatlandRequest::CreateView2 {
4845            token,
4846            view_identity,
4847            protocols,
4848            parent_viewport_watcher,
4849            control_handle,
4850        } = self
4851        {
4852            Some((token, view_identity, protocols, parent_viewport_watcher, control_handle))
4853        } else {
4854            None
4855        }
4856    }
4857
4858    #[allow(irrefutable_let_patterns)]
4859    pub fn into_create_transform(self) -> Option<(TransformId, FlatlandControlHandle)> {
4860        if let FlatlandRequest::CreateTransform { transform_id, control_handle } = self {
4861            Some((transform_id, control_handle))
4862        } else {
4863            None
4864        }
4865    }
4866
4867    #[allow(irrefutable_let_patterns)]
4868    pub fn into_set_translation(
4869        self,
4870    ) -> Option<(TransformId, fidl_fuchsia_math::Vec_, FlatlandControlHandle)> {
4871        if let FlatlandRequest::SetTranslation { transform_id, translation, control_handle } = self
4872        {
4873            Some((transform_id, translation, control_handle))
4874        } else {
4875            None
4876        }
4877    }
4878
4879    #[allow(irrefutable_let_patterns)]
4880    pub fn into_set_orientation(self) -> Option<(TransformId, Orientation, FlatlandControlHandle)> {
4881        if let FlatlandRequest::SetOrientation { transform_id, orientation, control_handle } = self
4882        {
4883            Some((transform_id, orientation, control_handle))
4884        } else {
4885            None
4886        }
4887    }
4888
4889    #[allow(irrefutable_let_patterns)]
4890    pub fn into_set_scale(
4891        self,
4892    ) -> Option<(TransformId, fidl_fuchsia_math::VecF, FlatlandControlHandle)> {
4893        if let FlatlandRequest::SetScale { transform_id, scale, control_handle } = self {
4894            Some((transform_id, scale, control_handle))
4895        } else {
4896            None
4897        }
4898    }
4899
4900    #[allow(irrefutable_let_patterns)]
4901    pub fn into_set_opacity(self) -> Option<(TransformId, f32, FlatlandControlHandle)> {
4902        if let FlatlandRequest::SetOpacity { transform_id, value, control_handle } = self {
4903            Some((transform_id, value, control_handle))
4904        } else {
4905            None
4906        }
4907    }
4908
4909    #[allow(irrefutable_let_patterns)]
4910    pub fn into_set_clip_boundary(
4911        self,
4912    ) -> Option<(TransformId, Option<Box<fidl_fuchsia_math::Rect>>, FlatlandControlHandle)> {
4913        if let FlatlandRequest::SetClipBoundary { transform_id, rect, control_handle } = self {
4914            Some((transform_id, rect, control_handle))
4915        } else {
4916            None
4917        }
4918    }
4919
4920    #[allow(irrefutable_let_patterns)]
4921    pub fn into_add_child(self) -> Option<(TransformId, TransformId, FlatlandControlHandle)> {
4922        if let FlatlandRequest::AddChild {
4923            parent_transform_id,
4924            child_transform_id,
4925            control_handle,
4926        } = self
4927        {
4928            Some((parent_transform_id, child_transform_id, control_handle))
4929        } else {
4930            None
4931        }
4932    }
4933
4934    #[allow(irrefutable_let_patterns)]
4935    pub fn into_remove_child(self) -> Option<(TransformId, TransformId, FlatlandControlHandle)> {
4936        if let FlatlandRequest::RemoveChild {
4937            parent_transform_id,
4938            child_transform_id,
4939            control_handle,
4940        } = self
4941        {
4942            Some((parent_transform_id, child_transform_id, control_handle))
4943        } else {
4944            None
4945        }
4946    }
4947
4948    #[allow(irrefutable_let_patterns)]
4949    pub fn into_replace_children(
4950        self,
4951    ) -> Option<(TransformId, Vec<TransformId>, FlatlandControlHandle)> {
4952        if let FlatlandRequest::ReplaceChildren {
4953            parent_transform_id,
4954            new_child_transform_ids,
4955            control_handle,
4956        } = self
4957        {
4958            Some((parent_transform_id, new_child_transform_ids, control_handle))
4959        } else {
4960            None
4961        }
4962    }
4963
4964    #[allow(irrefutable_let_patterns)]
4965    pub fn into_set_root_transform(self) -> Option<(TransformId, FlatlandControlHandle)> {
4966        if let FlatlandRequest::SetRootTransform { transform_id, control_handle } = self {
4967            Some((transform_id, control_handle))
4968        } else {
4969            None
4970        }
4971    }
4972
4973    #[allow(irrefutable_let_patterns)]
4974    pub fn into_set_hit_regions(
4975        self,
4976    ) -> Option<(TransformId, Vec<HitRegion>, FlatlandControlHandle)> {
4977        if let FlatlandRequest::SetHitRegions { transform_id, regions, control_handle } = self {
4978            Some((transform_id, regions, control_handle))
4979        } else {
4980            None
4981        }
4982    }
4983
4984    #[allow(irrefutable_let_patterns)]
4985    pub fn into_set_infinite_hit_region(
4986        self,
4987    ) -> Option<(TransformId, HitTestInteraction, FlatlandControlHandle)> {
4988        if let FlatlandRequest::SetInfiniteHitRegion { transform_id, hit_test, control_handle } =
4989            self
4990        {
4991            Some((transform_id, hit_test, control_handle))
4992        } else {
4993            None
4994        }
4995    }
4996
4997    #[allow(irrefutable_let_patterns)]
4998    pub fn into_create_viewport(
4999        self,
5000    ) -> Option<(
5001        ContentId,
5002        fidl_fuchsia_ui_views::ViewportCreationToken,
5003        ViewportProperties,
5004        fidl::endpoints::ServerEnd<ChildViewWatcherMarker>,
5005        FlatlandControlHandle,
5006    )> {
5007        if let FlatlandRequest::CreateViewport {
5008            viewport_id,
5009            token,
5010            properties,
5011            child_view_watcher,
5012            control_handle,
5013        } = self
5014        {
5015            Some((viewport_id, token, properties, child_view_watcher, control_handle))
5016        } else {
5017            None
5018        }
5019    }
5020
5021    #[allow(irrefutable_let_patterns)]
5022    pub fn into_create_image(
5023        self,
5024    ) -> Option<(ContentId, BufferCollectionImportToken, u32, ImageProperties, FlatlandControlHandle)>
5025    {
5026        if let FlatlandRequest::CreateImage {
5027            image_id,
5028            import_token,
5029            vmo_index,
5030            properties,
5031            control_handle,
5032        } = self
5033        {
5034            Some((image_id, import_token, vmo_index, properties, control_handle))
5035        } else {
5036            None
5037        }
5038    }
5039
5040    #[allow(irrefutable_let_patterns)]
5041    pub fn into_set_image_sample_region(
5042        self,
5043    ) -> Option<(ContentId, fidl_fuchsia_math::RectF, FlatlandControlHandle)> {
5044        if let FlatlandRequest::SetImageSampleRegion { image_id, rect, control_handle } = self {
5045            Some((image_id, rect, control_handle))
5046        } else {
5047            None
5048        }
5049    }
5050
5051    #[allow(irrefutable_let_patterns)]
5052    pub fn into_set_image_destination_size(
5053        self,
5054    ) -> Option<(ContentId, fidl_fuchsia_math::SizeU, FlatlandControlHandle)> {
5055        if let FlatlandRequest::SetImageDestinationSize { image_id, size, control_handle } = self {
5056            Some((image_id, size, control_handle))
5057        } else {
5058            None
5059        }
5060    }
5061
5062    #[allow(irrefutable_let_patterns)]
5063    pub fn into_set_image_blending_function(
5064        self,
5065    ) -> Option<(ContentId, BlendMode, FlatlandControlHandle)> {
5066        if let FlatlandRequest::SetImageBlendingFunction { image_id, blend_mode, control_handle } =
5067            self
5068        {
5069            Some((image_id, blend_mode, control_handle))
5070        } else {
5071            None
5072        }
5073    }
5074
5075    #[allow(irrefutable_let_patterns)]
5076    pub fn into_set_image_blend_mode(
5077        self,
5078    ) -> Option<(ContentId, BlendMode2, FlatlandControlHandle)> {
5079        if let FlatlandRequest::SetImageBlendMode { image_id, blend_mode, control_handle } = self {
5080            Some((image_id, blend_mode, control_handle))
5081        } else {
5082            None
5083        }
5084    }
5085
5086    #[allow(irrefutable_let_patterns)]
5087    pub fn into_set_image_opacity(self) -> Option<(ContentId, f32, FlatlandControlHandle)> {
5088        if let FlatlandRequest::SetImageOpacity { image_id, val, control_handle } = self {
5089            Some((image_id, val, control_handle))
5090        } else {
5091            None
5092        }
5093    }
5094
5095    #[allow(irrefutable_let_patterns)]
5096    pub fn into_set_image_flip(self) -> Option<(ContentId, ImageFlip, FlatlandControlHandle)> {
5097        if let FlatlandRequest::SetImageFlip { image_id, flip, control_handle } = self {
5098            Some((image_id, flip, control_handle))
5099        } else {
5100            None
5101        }
5102    }
5103
5104    #[allow(irrefutable_let_patterns)]
5105    pub fn into_create_filled_rect(self) -> Option<(ContentId, FlatlandControlHandle)> {
5106        if let FlatlandRequest::CreateFilledRect { rect_id, control_handle } = self {
5107            Some((rect_id, control_handle))
5108        } else {
5109            None
5110        }
5111    }
5112
5113    #[allow(irrefutable_let_patterns)]
5114    pub fn into_set_solid_fill(
5115        self,
5116    ) -> Option<(ContentId, ColorRgba, fidl_fuchsia_math::SizeU, FlatlandControlHandle)> {
5117        if let FlatlandRequest::SetSolidFill { rect_id, color, size, control_handle } = self {
5118            Some((rect_id, color, size, control_handle))
5119        } else {
5120            None
5121        }
5122    }
5123
5124    #[allow(irrefutable_let_patterns)]
5125    pub fn into_release_filled_rect(self) -> Option<(ContentId, FlatlandControlHandle)> {
5126        if let FlatlandRequest::ReleaseFilledRect { rect_id, control_handle } = self {
5127            Some((rect_id, control_handle))
5128        } else {
5129            None
5130        }
5131    }
5132
5133    #[allow(irrefutable_let_patterns)]
5134    pub fn into_set_content(self) -> Option<(TransformId, ContentId, FlatlandControlHandle)> {
5135        if let FlatlandRequest::SetContent { transform_id, content_id, control_handle } = self {
5136            Some((transform_id, content_id, control_handle))
5137        } else {
5138            None
5139        }
5140    }
5141
5142    #[allow(irrefutable_let_patterns)]
5143    pub fn into_set_viewport_properties(
5144        self,
5145    ) -> Option<(ContentId, ViewportProperties, FlatlandControlHandle)> {
5146        if let FlatlandRequest::SetViewportProperties { viewport_id, properties, control_handle } =
5147            self
5148        {
5149            Some((viewport_id, properties, control_handle))
5150        } else {
5151            None
5152        }
5153    }
5154
5155    #[allow(irrefutable_let_patterns)]
5156    pub fn into_release_transform(self) -> Option<(TransformId, FlatlandControlHandle)> {
5157        if let FlatlandRequest::ReleaseTransform { transform_id, control_handle } = self {
5158            Some((transform_id, control_handle))
5159        } else {
5160            None
5161        }
5162    }
5163
5164    #[allow(irrefutable_let_patterns)]
5165    pub fn into_release_view(self) -> Option<(FlatlandControlHandle)> {
5166        if let FlatlandRequest::ReleaseView { control_handle } = self {
5167            Some((control_handle))
5168        } else {
5169            None
5170        }
5171    }
5172
5173    #[allow(irrefutable_let_patterns)]
5174    pub fn into_release_viewport(self) -> Option<(ContentId, FlatlandReleaseViewportResponder)> {
5175        if let FlatlandRequest::ReleaseViewport { viewport_id, responder } = self {
5176            Some((viewport_id, responder))
5177        } else {
5178            None
5179        }
5180    }
5181
5182    #[allow(irrefutable_let_patterns)]
5183    pub fn into_release_image(self) -> Option<(ContentId, FlatlandControlHandle)> {
5184        if let FlatlandRequest::ReleaseImage { image_id, control_handle } = self {
5185            Some((image_id, control_handle))
5186        } else {
5187            None
5188        }
5189    }
5190
5191    #[allow(irrefutable_let_patterns)]
5192    pub fn into_clear(self) -> Option<(FlatlandControlHandle)> {
5193        if let FlatlandRequest::Clear { control_handle } = self {
5194            Some((control_handle))
5195        } else {
5196            None
5197        }
5198    }
5199
5200    #[allow(irrefutable_let_patterns)]
5201    pub fn into_set_debug_name(self) -> Option<(String, FlatlandControlHandle)> {
5202        if let FlatlandRequest::SetDebugName { name, control_handle } = self {
5203            Some((name, control_handle))
5204        } else {
5205            None
5206        }
5207    }
5208
5209    /// Name of the method defined in FIDL
5210    pub fn method_name(&self) -> &'static str {
5211        match *self {
5212            FlatlandRequest::Present { .. } => "present",
5213            FlatlandRequest::CreateView { .. } => "create_view",
5214            FlatlandRequest::CreateView2 { .. } => "create_view2",
5215            FlatlandRequest::CreateTransform { .. } => "create_transform",
5216            FlatlandRequest::SetTranslation { .. } => "set_translation",
5217            FlatlandRequest::SetOrientation { .. } => "set_orientation",
5218            FlatlandRequest::SetScale { .. } => "set_scale",
5219            FlatlandRequest::SetOpacity { .. } => "set_opacity",
5220            FlatlandRequest::SetClipBoundary { .. } => "set_clip_boundary",
5221            FlatlandRequest::AddChild { .. } => "add_child",
5222            FlatlandRequest::RemoveChild { .. } => "remove_child",
5223            FlatlandRequest::ReplaceChildren { .. } => "replace_children",
5224            FlatlandRequest::SetRootTransform { .. } => "set_root_transform",
5225            FlatlandRequest::SetHitRegions { .. } => "set_hit_regions",
5226            FlatlandRequest::SetInfiniteHitRegion { .. } => "set_infinite_hit_region",
5227            FlatlandRequest::CreateViewport { .. } => "create_viewport",
5228            FlatlandRequest::CreateImage { .. } => "create_image",
5229            FlatlandRequest::SetImageSampleRegion { .. } => "set_image_sample_region",
5230            FlatlandRequest::SetImageDestinationSize { .. } => "set_image_destination_size",
5231            FlatlandRequest::SetImageBlendingFunction { .. } => "set_image_blending_function",
5232            FlatlandRequest::SetImageBlendMode { .. } => "set_image_blend_mode",
5233            FlatlandRequest::SetImageOpacity { .. } => "set_image_opacity",
5234            FlatlandRequest::SetImageFlip { .. } => "set_image_flip",
5235            FlatlandRequest::CreateFilledRect { .. } => "create_filled_rect",
5236            FlatlandRequest::SetSolidFill { .. } => "set_solid_fill",
5237            FlatlandRequest::ReleaseFilledRect { .. } => "release_filled_rect",
5238            FlatlandRequest::SetContent { .. } => "set_content",
5239            FlatlandRequest::SetViewportProperties { .. } => "set_viewport_properties",
5240            FlatlandRequest::ReleaseTransform { .. } => "release_transform",
5241            FlatlandRequest::ReleaseView { .. } => "release_view",
5242            FlatlandRequest::ReleaseViewport { .. } => "release_viewport",
5243            FlatlandRequest::ReleaseImage { .. } => "release_image",
5244            FlatlandRequest::Clear { .. } => "clear",
5245            FlatlandRequest::SetDebugName { .. } => "set_debug_name",
5246        }
5247    }
5248}
5249
5250#[derive(Debug, Clone)]
5251pub struct FlatlandControlHandle {
5252    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5253}
5254
5255impl fidl::endpoints::ControlHandle for FlatlandControlHandle {
5256    fn shutdown(&self) {
5257        self.inner.shutdown()
5258    }
5259    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
5260        self.inner.shutdown_with_epitaph(status)
5261    }
5262
5263    fn is_closed(&self) -> bool {
5264        self.inner.channel().is_closed()
5265    }
5266    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
5267        self.inner.channel().on_closed()
5268    }
5269
5270    #[cfg(target_os = "fuchsia")]
5271    fn signal_peer(
5272        &self,
5273        clear_mask: zx::Signals,
5274        set_mask: zx::Signals,
5275    ) -> Result<(), zx_status::Status> {
5276        use fidl::Peered;
5277        self.inner.channel().signal_peer(clear_mask, set_mask)
5278    }
5279}
5280
5281impl FlatlandControlHandle {
5282    pub fn send_on_next_frame_begin(
5283        &self,
5284        mut values: &OnNextFrameBeginValues,
5285    ) -> Result<(), fidl::Error> {
5286        self.inner.send::<FlatlandOnNextFrameBeginRequest>(
5287            (values,),
5288            0,
5289            0x10f69a5cdeece84a,
5290            fidl::encoding::DynamicFlags::empty(),
5291        )
5292    }
5293
5294    pub fn send_on_frame_presented(
5295        &self,
5296        mut frame_presented_info: &fidl_fuchsia_scenic_scheduling::FramePresentedInfo,
5297    ) -> Result<(), fidl::Error> {
5298        self.inner.send::<FlatlandOnFramePresentedRequest>(
5299            (frame_presented_info,),
5300            0,
5301            0x56e43e1a5f30216d,
5302            fidl::encoding::DynamicFlags::empty(),
5303        )
5304    }
5305
5306    pub fn send_on_error(&self, mut error: FlatlandError) -> Result<(), fidl::Error> {
5307        self.inner.send::<FlatlandOnErrorRequest>(
5308            (error,),
5309            0,
5310            0x1ebf39e90cd8b8d,
5311            fidl::encoding::DynamicFlags::empty(),
5312        )
5313    }
5314}
5315
5316#[must_use = "FIDL methods require a response to be sent"]
5317#[derive(Debug)]
5318pub struct FlatlandReleaseViewportResponder {
5319    control_handle: std::mem::ManuallyDrop<FlatlandControlHandle>,
5320    tx_id: u32,
5321}
5322
5323/// Set the the channel to be shutdown (see [`FlatlandControlHandle::shutdown`])
5324/// if the responder is dropped without sending a response, so that the client
5325/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5326impl std::ops::Drop for FlatlandReleaseViewportResponder {
5327    fn drop(&mut self) {
5328        self.control_handle.shutdown();
5329        // Safety: drops once, never accessed again
5330        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5331    }
5332}
5333
5334impl fidl::endpoints::Responder for FlatlandReleaseViewportResponder {
5335    type ControlHandle = FlatlandControlHandle;
5336
5337    fn control_handle(&self) -> &FlatlandControlHandle {
5338        &self.control_handle
5339    }
5340
5341    fn drop_without_shutdown(mut self) {
5342        // Safety: drops once, never accessed again due to mem::forget
5343        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5344        // Prevent Drop from running (which would shut down the channel)
5345        std::mem::forget(self);
5346    }
5347}
5348
5349impl FlatlandReleaseViewportResponder {
5350    /// Sends a response to the FIDL transaction.
5351    ///
5352    /// Sets the channel to shutdown if an error occurs.
5353    pub fn send(
5354        self,
5355        mut token: fidl_fuchsia_ui_views::ViewportCreationToken,
5356    ) -> Result<(), fidl::Error> {
5357        let _result = self.send_raw(token);
5358        if _result.is_err() {
5359            self.control_handle.shutdown();
5360        }
5361        self.drop_without_shutdown();
5362        _result
5363    }
5364
5365    /// Similar to "send" but does not shutdown the channel if an error occurs.
5366    pub fn send_no_shutdown_on_err(
5367        self,
5368        mut token: fidl_fuchsia_ui_views::ViewportCreationToken,
5369    ) -> Result<(), fidl::Error> {
5370        let _result = self.send_raw(token);
5371        self.drop_without_shutdown();
5372        _result
5373    }
5374
5375    fn send_raw(
5376        &self,
5377        mut token: fidl_fuchsia_ui_views::ViewportCreationToken,
5378    ) -> Result<(), fidl::Error> {
5379        self.control_handle.inner.send::<FlatlandReleaseViewportResponse>(
5380            (&mut token,),
5381            self.tx_id,
5382            0xbad474aeb5293f9,
5383            fidl::encoding::DynamicFlags::empty(),
5384        )
5385    }
5386}
5387
5388#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
5389pub struct FlatlandDisplayMarker;
5390
5391impl fidl::endpoints::ProtocolMarker for FlatlandDisplayMarker {
5392    type Proxy = FlatlandDisplayProxy;
5393    type RequestStream = FlatlandDisplayRequestStream;
5394    #[cfg(target_os = "fuchsia")]
5395    type SynchronousProxy = FlatlandDisplaySynchronousProxy;
5396
5397    const DEBUG_NAME: &'static str = "fuchsia.ui.composition.FlatlandDisplay";
5398}
5399impl fidl::endpoints::DiscoverableProtocolMarker for FlatlandDisplayMarker {}
5400
5401pub trait FlatlandDisplayProxyInterface: Send + Sync {
5402    fn r#set_content(
5403        &self,
5404        token: fidl_fuchsia_ui_views::ViewportCreationToken,
5405        child_view_watcher: fidl::endpoints::ServerEnd<ChildViewWatcherMarker>,
5406    ) -> Result<(), fidl::Error>;
5407    fn r#set_device_pixel_ratio(
5408        &self,
5409        device_pixel_ratio: &fidl_fuchsia_math::VecF,
5410    ) -> Result<(), fidl::Error>;
5411}
5412#[derive(Debug)]
5413#[cfg(target_os = "fuchsia")]
5414pub struct FlatlandDisplaySynchronousProxy {
5415    client: fidl::client::sync::Client,
5416}
5417
5418#[cfg(target_os = "fuchsia")]
5419impl fidl::endpoints::SynchronousProxy for FlatlandDisplaySynchronousProxy {
5420    type Proxy = FlatlandDisplayProxy;
5421    type Protocol = FlatlandDisplayMarker;
5422
5423    fn from_channel(inner: fidl::Channel) -> Self {
5424        Self::new(inner)
5425    }
5426
5427    fn into_channel(self) -> fidl::Channel {
5428        self.client.into_channel()
5429    }
5430
5431    fn as_channel(&self) -> &fidl::Channel {
5432        self.client.as_channel()
5433    }
5434}
5435
5436#[cfg(target_os = "fuchsia")]
5437impl FlatlandDisplaySynchronousProxy {
5438    pub fn new(channel: fidl::Channel) -> Self {
5439        let protocol_name = <FlatlandDisplayMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
5440        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
5441    }
5442
5443    pub fn into_channel(self) -> fidl::Channel {
5444        self.client.into_channel()
5445    }
5446
5447    /// Waits until an event arrives and returns it. It is safe for other
5448    /// threads to make concurrent requests while waiting for an event.
5449    pub fn wait_for_event(
5450        &self,
5451        deadline: zx::MonotonicInstant,
5452    ) -> Result<FlatlandDisplayEvent, fidl::Error> {
5453        FlatlandDisplayEvent::decode(self.client.wait_for_event(deadline)?)
5454    }
5455
5456    pub fn r#set_content(
5457        &self,
5458        mut token: fidl_fuchsia_ui_views::ViewportCreationToken,
5459        mut child_view_watcher: fidl::endpoints::ServerEnd<ChildViewWatcherMarker>,
5460    ) -> Result<(), fidl::Error> {
5461        self.client.send::<FlatlandDisplaySetContentRequest>(
5462            (&mut token, child_view_watcher),
5463            0x6748193a39918298,
5464            fidl::encoding::DynamicFlags::empty(),
5465        )
5466    }
5467
5468    /// Sets the ratio of display's physical pixels to device independent pixels that should be used
5469    /// for the tree of Flatland content that are attached to this display. See
5470    /// [`LayoutInfo.device_pixel_ratio`] for details.
5471    ///
5472    /// The default value is (1.0, 1.0). The valid values are 1.0 and above.
5473    pub fn r#set_device_pixel_ratio(
5474        &self,
5475        mut device_pixel_ratio: &fidl_fuchsia_math::VecF,
5476    ) -> Result<(), fidl::Error> {
5477        self.client.send::<FlatlandDisplaySetDevicePixelRatioRequest>(
5478            (device_pixel_ratio,),
5479            0x392c3e70cc0a81a4,
5480            fidl::encoding::DynamicFlags::empty(),
5481        )
5482    }
5483}
5484
5485#[cfg(target_os = "fuchsia")]
5486impl From<FlatlandDisplaySynchronousProxy> for zx::Handle {
5487    fn from(value: FlatlandDisplaySynchronousProxy) -> Self {
5488        value.into_channel().into()
5489    }
5490}
5491
5492#[cfg(target_os = "fuchsia")]
5493impl From<fidl::Channel> for FlatlandDisplaySynchronousProxy {
5494    fn from(value: fidl::Channel) -> Self {
5495        Self::new(value)
5496    }
5497}
5498
5499#[cfg(target_os = "fuchsia")]
5500impl fidl::endpoints::FromClient for FlatlandDisplaySynchronousProxy {
5501    type Protocol = FlatlandDisplayMarker;
5502
5503    fn from_client(value: fidl::endpoints::ClientEnd<FlatlandDisplayMarker>) -> Self {
5504        Self::new(value.into_channel())
5505    }
5506}
5507
5508#[derive(Debug, Clone)]
5509pub struct FlatlandDisplayProxy {
5510    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
5511}
5512
5513impl fidl::endpoints::Proxy for FlatlandDisplayProxy {
5514    type Protocol = FlatlandDisplayMarker;
5515
5516    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
5517        Self::new(inner)
5518    }
5519
5520    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
5521        self.client.into_channel().map_err(|client| Self { client })
5522    }
5523
5524    fn as_channel(&self) -> &::fidl::AsyncChannel {
5525        self.client.as_channel()
5526    }
5527}
5528
5529impl FlatlandDisplayProxy {
5530    /// Create a new Proxy for fuchsia.ui.composition/FlatlandDisplay.
5531    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
5532        let protocol_name = <FlatlandDisplayMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
5533        Self { client: fidl::client::Client::new(channel, protocol_name) }
5534    }
5535
5536    /// Get a Stream of events from the remote end of the protocol.
5537    ///
5538    /// # Panics
5539    ///
5540    /// Panics if the event stream was already taken.
5541    pub fn take_event_stream(&self) -> FlatlandDisplayEventStream {
5542        FlatlandDisplayEventStream { event_receiver: self.client.take_event_receiver() }
5543    }
5544
5545    pub fn r#set_content(
5546        &self,
5547        mut token: fidl_fuchsia_ui_views::ViewportCreationToken,
5548        mut child_view_watcher: fidl::endpoints::ServerEnd<ChildViewWatcherMarker>,
5549    ) -> Result<(), fidl::Error> {
5550        FlatlandDisplayProxyInterface::r#set_content(self, token, child_view_watcher)
5551    }
5552
5553    /// Sets the ratio of display's physical pixels to device independent pixels that should be used
5554    /// for the tree of Flatland content that are attached to this display. See
5555    /// [`LayoutInfo.device_pixel_ratio`] for details.
5556    ///
5557    /// The default value is (1.0, 1.0). The valid values are 1.0 and above.
5558    pub fn r#set_device_pixel_ratio(
5559        &self,
5560        mut device_pixel_ratio: &fidl_fuchsia_math::VecF,
5561    ) -> Result<(), fidl::Error> {
5562        FlatlandDisplayProxyInterface::r#set_device_pixel_ratio(self, device_pixel_ratio)
5563    }
5564}
5565
5566impl FlatlandDisplayProxyInterface for FlatlandDisplayProxy {
5567    fn r#set_content(
5568        &self,
5569        mut token: fidl_fuchsia_ui_views::ViewportCreationToken,
5570        mut child_view_watcher: fidl::endpoints::ServerEnd<ChildViewWatcherMarker>,
5571    ) -> Result<(), fidl::Error> {
5572        self.client.send::<FlatlandDisplaySetContentRequest>(
5573            (&mut token, child_view_watcher),
5574            0x6748193a39918298,
5575            fidl::encoding::DynamicFlags::empty(),
5576        )
5577    }
5578
5579    fn r#set_device_pixel_ratio(
5580        &self,
5581        mut device_pixel_ratio: &fidl_fuchsia_math::VecF,
5582    ) -> Result<(), fidl::Error> {
5583        self.client.send::<FlatlandDisplaySetDevicePixelRatioRequest>(
5584            (device_pixel_ratio,),
5585            0x392c3e70cc0a81a4,
5586            fidl::encoding::DynamicFlags::empty(),
5587        )
5588    }
5589}
5590
5591pub struct FlatlandDisplayEventStream {
5592    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
5593}
5594
5595impl std::marker::Unpin for FlatlandDisplayEventStream {}
5596
5597impl futures::stream::FusedStream for FlatlandDisplayEventStream {
5598    fn is_terminated(&self) -> bool {
5599        self.event_receiver.is_terminated()
5600    }
5601}
5602
5603impl futures::Stream for FlatlandDisplayEventStream {
5604    type Item = Result<FlatlandDisplayEvent, fidl::Error>;
5605
5606    fn poll_next(
5607        mut self: std::pin::Pin<&mut Self>,
5608        cx: &mut std::task::Context<'_>,
5609    ) -> std::task::Poll<Option<Self::Item>> {
5610        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
5611            &mut self.event_receiver,
5612            cx
5613        )?) {
5614            Some(buf) => std::task::Poll::Ready(Some(FlatlandDisplayEvent::decode(buf))),
5615            None => std::task::Poll::Ready(None),
5616        }
5617    }
5618}
5619
5620#[derive(Debug)]
5621pub enum FlatlandDisplayEvent {}
5622
5623impl FlatlandDisplayEvent {
5624    /// Decodes a message buffer as a [`FlatlandDisplayEvent`].
5625    fn decode(
5626        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
5627    ) -> Result<FlatlandDisplayEvent, fidl::Error> {
5628        let (bytes, _handles) = buf.split_mut();
5629        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5630        debug_assert_eq!(tx_header.tx_id, 0);
5631        match tx_header.ordinal {
5632            _ => Err(fidl::Error::UnknownOrdinal {
5633                ordinal: tx_header.ordinal,
5634                protocol_name:
5635                    <FlatlandDisplayMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5636            }),
5637        }
5638    }
5639}
5640
5641/// A Stream of incoming requests for fuchsia.ui.composition/FlatlandDisplay.
5642pub struct FlatlandDisplayRequestStream {
5643    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5644    is_terminated: bool,
5645}
5646
5647impl std::marker::Unpin for FlatlandDisplayRequestStream {}
5648
5649impl futures::stream::FusedStream for FlatlandDisplayRequestStream {
5650    fn is_terminated(&self) -> bool {
5651        self.is_terminated
5652    }
5653}
5654
5655impl fidl::endpoints::RequestStream for FlatlandDisplayRequestStream {
5656    type Protocol = FlatlandDisplayMarker;
5657    type ControlHandle = FlatlandDisplayControlHandle;
5658
5659    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
5660        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
5661    }
5662
5663    fn control_handle(&self) -> Self::ControlHandle {
5664        FlatlandDisplayControlHandle { inner: self.inner.clone() }
5665    }
5666
5667    fn into_inner(
5668        self,
5669    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
5670    {
5671        (self.inner, self.is_terminated)
5672    }
5673
5674    fn from_inner(
5675        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5676        is_terminated: bool,
5677    ) -> Self {
5678        Self { inner, is_terminated }
5679    }
5680}
5681
5682impl futures::Stream for FlatlandDisplayRequestStream {
5683    type Item = Result<FlatlandDisplayRequest, fidl::Error>;
5684
5685    fn poll_next(
5686        mut self: std::pin::Pin<&mut Self>,
5687        cx: &mut std::task::Context<'_>,
5688    ) -> std::task::Poll<Option<Self::Item>> {
5689        let this = &mut *self;
5690        if this.inner.check_shutdown(cx) {
5691            this.is_terminated = true;
5692            return std::task::Poll::Ready(None);
5693        }
5694        if this.is_terminated {
5695            panic!("polled FlatlandDisplayRequestStream after completion");
5696        }
5697        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
5698            |bytes, handles| {
5699                match this.inner.channel().read_etc(cx, bytes, handles) {
5700                    std::task::Poll::Ready(Ok(())) => {}
5701                    std::task::Poll::Pending => return std::task::Poll::Pending,
5702                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
5703                        this.is_terminated = true;
5704                        return std::task::Poll::Ready(None);
5705                    }
5706                    std::task::Poll::Ready(Err(e)) => {
5707                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
5708                            e.into(),
5709                        ))));
5710                    }
5711                }
5712
5713                // A message has been received from the channel
5714                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5715
5716                std::task::Poll::Ready(Some(match header.ordinal {
5717                    0x6748193a39918298 => {
5718                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5719                        let mut req = fidl::new_empty!(
5720                            FlatlandDisplaySetContentRequest,
5721                            fidl::encoding::DefaultFuchsiaResourceDialect
5722                        );
5723                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandDisplaySetContentRequest>(&header, _body_bytes, handles, &mut req)?;
5724                        let control_handle =
5725                            FlatlandDisplayControlHandle { inner: this.inner.clone() };
5726                        Ok(FlatlandDisplayRequest::SetContent {
5727                            token: req.token,
5728                            child_view_watcher: req.child_view_watcher,
5729
5730                            control_handle,
5731                        })
5732                    }
5733                    0x392c3e70cc0a81a4 => {
5734                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5735                        let mut req = fidl::new_empty!(
5736                            FlatlandDisplaySetDevicePixelRatioRequest,
5737                            fidl::encoding::DefaultFuchsiaResourceDialect
5738                        );
5739                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandDisplaySetDevicePixelRatioRequest>(&header, _body_bytes, handles, &mut req)?;
5740                        let control_handle =
5741                            FlatlandDisplayControlHandle { inner: this.inner.clone() };
5742                        Ok(FlatlandDisplayRequest::SetDevicePixelRatio {
5743                            device_pixel_ratio: req.device_pixel_ratio,
5744
5745                            control_handle,
5746                        })
5747                    }
5748                    _ => Err(fidl::Error::UnknownOrdinal {
5749                        ordinal: header.ordinal,
5750                        protocol_name:
5751                            <FlatlandDisplayMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5752                    }),
5753                }))
5754            },
5755        )
5756    }
5757}
5758
5759/// This API connects to the singleton "primary display", and allows a tree of Flatland content to
5760/// be attached underneath.  Only one FlatlandDisplay client connection is allowed at one time.
5761#[derive(Debug)]
5762pub enum FlatlandDisplayRequest {
5763    SetContent {
5764        token: fidl_fuchsia_ui_views::ViewportCreationToken,
5765        child_view_watcher: fidl::endpoints::ServerEnd<ChildViewWatcherMarker>,
5766        control_handle: FlatlandDisplayControlHandle,
5767    },
5768    /// Sets the ratio of display's physical pixels to device independent pixels that should be used
5769    /// for the tree of Flatland content that are attached to this display. See
5770    /// [`LayoutInfo.device_pixel_ratio`] for details.
5771    ///
5772    /// The default value is (1.0, 1.0). The valid values are 1.0 and above.
5773    SetDevicePixelRatio {
5774        device_pixel_ratio: fidl_fuchsia_math::VecF,
5775        control_handle: FlatlandDisplayControlHandle,
5776    },
5777}
5778
5779impl FlatlandDisplayRequest {
5780    #[allow(irrefutable_let_patterns)]
5781    pub fn into_set_content(
5782        self,
5783    ) -> Option<(
5784        fidl_fuchsia_ui_views::ViewportCreationToken,
5785        fidl::endpoints::ServerEnd<ChildViewWatcherMarker>,
5786        FlatlandDisplayControlHandle,
5787    )> {
5788        if let FlatlandDisplayRequest::SetContent { token, child_view_watcher, control_handle } =
5789            self
5790        {
5791            Some((token, child_view_watcher, control_handle))
5792        } else {
5793            None
5794        }
5795    }
5796
5797    #[allow(irrefutable_let_patterns)]
5798    pub fn into_set_device_pixel_ratio(
5799        self,
5800    ) -> Option<(fidl_fuchsia_math::VecF, FlatlandDisplayControlHandle)> {
5801        if let FlatlandDisplayRequest::SetDevicePixelRatio { device_pixel_ratio, control_handle } =
5802            self
5803        {
5804            Some((device_pixel_ratio, control_handle))
5805        } else {
5806            None
5807        }
5808    }
5809
5810    /// Name of the method defined in FIDL
5811    pub fn method_name(&self) -> &'static str {
5812        match *self {
5813            FlatlandDisplayRequest::SetContent { .. } => "set_content",
5814            FlatlandDisplayRequest::SetDevicePixelRatio { .. } => "set_device_pixel_ratio",
5815        }
5816    }
5817}
5818
5819#[derive(Debug, Clone)]
5820pub struct FlatlandDisplayControlHandle {
5821    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5822}
5823
5824impl fidl::endpoints::ControlHandle for FlatlandDisplayControlHandle {
5825    fn shutdown(&self) {
5826        self.inner.shutdown()
5827    }
5828    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
5829        self.inner.shutdown_with_epitaph(status)
5830    }
5831
5832    fn is_closed(&self) -> bool {
5833        self.inner.channel().is_closed()
5834    }
5835    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
5836        self.inner.channel().on_closed()
5837    }
5838
5839    #[cfg(target_os = "fuchsia")]
5840    fn signal_peer(
5841        &self,
5842        clear_mask: zx::Signals,
5843        set_mask: zx::Signals,
5844    ) -> Result<(), zx_status::Status> {
5845        use fidl::Peered;
5846        self.inner.channel().signal_peer(clear_mask, set_mask)
5847    }
5848}
5849
5850impl FlatlandDisplayControlHandle {}
5851
5852#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
5853pub struct ParentViewportWatcherMarker;
5854
5855impl fidl::endpoints::ProtocolMarker for ParentViewportWatcherMarker {
5856    type Proxy = ParentViewportWatcherProxy;
5857    type RequestStream = ParentViewportWatcherRequestStream;
5858    #[cfg(target_os = "fuchsia")]
5859    type SynchronousProxy = ParentViewportWatcherSynchronousProxy;
5860
5861    const DEBUG_NAME: &'static str = "(anonymous) ParentViewportWatcher";
5862}
5863
5864pub trait ParentViewportWatcherProxyInterface: Send + Sync {
5865    type GetLayoutResponseFut: std::future::Future<Output = Result<LayoutInfo, fidl::Error>> + Send;
5866    fn r#get_layout(&self) -> Self::GetLayoutResponseFut;
5867    type GetStatusResponseFut: std::future::Future<Output = Result<ParentViewportStatus, fidl::Error>>
5868        + Send;
5869    fn r#get_status(&self) -> Self::GetStatusResponseFut;
5870}
5871#[derive(Debug)]
5872#[cfg(target_os = "fuchsia")]
5873pub struct ParentViewportWatcherSynchronousProxy {
5874    client: fidl::client::sync::Client,
5875}
5876
5877#[cfg(target_os = "fuchsia")]
5878impl fidl::endpoints::SynchronousProxy for ParentViewportWatcherSynchronousProxy {
5879    type Proxy = ParentViewportWatcherProxy;
5880    type Protocol = ParentViewportWatcherMarker;
5881
5882    fn from_channel(inner: fidl::Channel) -> Self {
5883        Self::new(inner)
5884    }
5885
5886    fn into_channel(self) -> fidl::Channel {
5887        self.client.into_channel()
5888    }
5889
5890    fn as_channel(&self) -> &fidl::Channel {
5891        self.client.as_channel()
5892    }
5893}
5894
5895#[cfg(target_os = "fuchsia")]
5896impl ParentViewportWatcherSynchronousProxy {
5897    pub fn new(channel: fidl::Channel) -> Self {
5898        let protocol_name =
5899            <ParentViewportWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
5900        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
5901    }
5902
5903    pub fn into_channel(self) -> fidl::Channel {
5904        self.client.into_channel()
5905    }
5906
5907    /// Waits until an event arrives and returns it. It is safe for other
5908    /// threads to make concurrent requests while waiting for an event.
5909    pub fn wait_for_event(
5910        &self,
5911        deadline: zx::MonotonicInstant,
5912    ) -> Result<ParentViewportWatcherEvent, fidl::Error> {
5913        ParentViewportWatcherEvent::decode(self.client.wait_for_event(deadline)?)
5914    }
5915
5916    /// A hanging get for receiving layout information. Clients may receive layout information
5917    /// before the ParentViewportWatcher operation has been presented. This allows children to
5918    /// layout their content before their first call to [`Present`]. In transition cases where two
5919    /// ParentViewportWatcher channels exist at the same time, both protocol instances will be
5920    /// receiving different layout information.
5921    ///
5922    /// This hanging get will only fire when the LayoutInfo is different than the previously
5923    /// returned LayoutInfo. Note that, since LayoutInfo is a table, only some fields may have
5924    /// changed.
5925    ///
5926    /// It is invalid to call `GetLayout` while a previous call is still pending. Doing so will
5927    /// cause both this channel and the Flatland channel that handed out ParentViewportWatcher to be
5928    /// closed.
5929    pub fn r#get_layout(
5930        &self,
5931        ___deadline: zx::MonotonicInstant,
5932    ) -> Result<LayoutInfo, fidl::Error> {
5933        let _response = self
5934            .client
5935            .send_query::<fidl::encoding::EmptyPayload, ParentViewportWatcherGetLayoutResponse>(
5936                (),
5937                0x3cbe5d9638e032,
5938                fidl::encoding::DynamicFlags::empty(),
5939                ___deadline,
5940            )?;
5941        Ok(_response.info)
5942    }
5943
5944    /// A hanging get for receiving the status of the parent Viewport. This provides global
5945    /// connectivity information to the child.
5946    ///
5947    /// This hanging get will only fire when the ParentViewportStatus is different than the
5948    /// previously returned ParentViewportStatus.
5949    ///
5950    /// It is invalid to call `GetStatus` while a previous call is still pending. Doing so will
5951    /// cause both this channel and the Flatland channel that handed out ParentViewportWatcher to be
5952    /// closed.
5953    pub fn r#get_status(
5954        &self,
5955        ___deadline: zx::MonotonicInstant,
5956    ) -> Result<ParentViewportStatus, fidl::Error> {
5957        let _response = self
5958            .client
5959            .send_query::<fidl::encoding::EmptyPayload, ParentViewportWatcherGetStatusResponse>(
5960                (),
5961                0x7caa022f050d9ea6,
5962                fidl::encoding::DynamicFlags::empty(),
5963                ___deadline,
5964            )?;
5965        Ok(_response.status)
5966    }
5967}
5968
5969#[cfg(target_os = "fuchsia")]
5970impl From<ParentViewportWatcherSynchronousProxy> for zx::Handle {
5971    fn from(value: ParentViewportWatcherSynchronousProxy) -> Self {
5972        value.into_channel().into()
5973    }
5974}
5975
5976#[cfg(target_os = "fuchsia")]
5977impl From<fidl::Channel> for ParentViewportWatcherSynchronousProxy {
5978    fn from(value: fidl::Channel) -> Self {
5979        Self::new(value)
5980    }
5981}
5982
5983#[cfg(target_os = "fuchsia")]
5984impl fidl::endpoints::FromClient for ParentViewportWatcherSynchronousProxy {
5985    type Protocol = ParentViewportWatcherMarker;
5986
5987    fn from_client(value: fidl::endpoints::ClientEnd<ParentViewportWatcherMarker>) -> Self {
5988        Self::new(value.into_channel())
5989    }
5990}
5991
5992#[derive(Debug, Clone)]
5993pub struct ParentViewportWatcherProxy {
5994    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
5995}
5996
5997impl fidl::endpoints::Proxy for ParentViewportWatcherProxy {
5998    type Protocol = ParentViewportWatcherMarker;
5999
6000    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
6001        Self::new(inner)
6002    }
6003
6004    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
6005        self.client.into_channel().map_err(|client| Self { client })
6006    }
6007
6008    fn as_channel(&self) -> &::fidl::AsyncChannel {
6009        self.client.as_channel()
6010    }
6011}
6012
6013impl ParentViewportWatcherProxy {
6014    /// Create a new Proxy for fuchsia.ui.composition/ParentViewportWatcher.
6015    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
6016        let protocol_name =
6017            <ParentViewportWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
6018        Self { client: fidl::client::Client::new(channel, protocol_name) }
6019    }
6020
6021    /// Get a Stream of events from the remote end of the protocol.
6022    ///
6023    /// # Panics
6024    ///
6025    /// Panics if the event stream was already taken.
6026    pub fn take_event_stream(&self) -> ParentViewportWatcherEventStream {
6027        ParentViewportWatcherEventStream { event_receiver: self.client.take_event_receiver() }
6028    }
6029
6030    /// A hanging get for receiving layout information. Clients may receive layout information
6031    /// before the ParentViewportWatcher operation has been presented. This allows children to
6032    /// layout their content before their first call to [`Present`]. In transition cases where two
6033    /// ParentViewportWatcher channels exist at the same time, both protocol instances will be
6034    /// receiving different layout information.
6035    ///
6036    /// This hanging get will only fire when the LayoutInfo is different than the previously
6037    /// returned LayoutInfo. Note that, since LayoutInfo is a table, only some fields may have
6038    /// changed.
6039    ///
6040    /// It is invalid to call `GetLayout` while a previous call is still pending. Doing so will
6041    /// cause both this channel and the Flatland channel that handed out ParentViewportWatcher to be
6042    /// closed.
6043    pub fn r#get_layout(
6044        &self,
6045    ) -> fidl::client::QueryResponseFut<LayoutInfo, fidl::encoding::DefaultFuchsiaResourceDialect>
6046    {
6047        ParentViewportWatcherProxyInterface::r#get_layout(self)
6048    }
6049
6050    /// A hanging get for receiving the status of the parent Viewport. This provides global
6051    /// connectivity information to the child.
6052    ///
6053    /// This hanging get will only fire when the ParentViewportStatus is different than the
6054    /// previously returned ParentViewportStatus.
6055    ///
6056    /// It is invalid to call `GetStatus` while a previous call is still pending. Doing so will
6057    /// cause both this channel and the Flatland channel that handed out ParentViewportWatcher to be
6058    /// closed.
6059    pub fn r#get_status(
6060        &self,
6061    ) -> fidl::client::QueryResponseFut<
6062        ParentViewportStatus,
6063        fidl::encoding::DefaultFuchsiaResourceDialect,
6064    > {
6065        ParentViewportWatcherProxyInterface::r#get_status(self)
6066    }
6067}
6068
6069impl ParentViewportWatcherProxyInterface for ParentViewportWatcherProxy {
6070    type GetLayoutResponseFut =
6071        fidl::client::QueryResponseFut<LayoutInfo, fidl::encoding::DefaultFuchsiaResourceDialect>;
6072    fn r#get_layout(&self) -> Self::GetLayoutResponseFut {
6073        fn _decode(
6074            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6075        ) -> Result<LayoutInfo, fidl::Error> {
6076            let _response = fidl::client::decode_transaction_body::<
6077                ParentViewportWatcherGetLayoutResponse,
6078                fidl::encoding::DefaultFuchsiaResourceDialect,
6079                0x3cbe5d9638e032,
6080            >(_buf?)?;
6081            Ok(_response.info)
6082        }
6083        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, LayoutInfo>(
6084            (),
6085            0x3cbe5d9638e032,
6086            fidl::encoding::DynamicFlags::empty(),
6087            _decode,
6088        )
6089    }
6090
6091    type GetStatusResponseFut = fidl::client::QueryResponseFut<
6092        ParentViewportStatus,
6093        fidl::encoding::DefaultFuchsiaResourceDialect,
6094    >;
6095    fn r#get_status(&self) -> Self::GetStatusResponseFut {
6096        fn _decode(
6097            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6098        ) -> Result<ParentViewportStatus, fidl::Error> {
6099            let _response = fidl::client::decode_transaction_body::<
6100                ParentViewportWatcherGetStatusResponse,
6101                fidl::encoding::DefaultFuchsiaResourceDialect,
6102                0x7caa022f050d9ea6,
6103            >(_buf?)?;
6104            Ok(_response.status)
6105        }
6106        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ParentViewportStatus>(
6107            (),
6108            0x7caa022f050d9ea6,
6109            fidl::encoding::DynamicFlags::empty(),
6110            _decode,
6111        )
6112    }
6113}
6114
6115pub struct ParentViewportWatcherEventStream {
6116    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
6117}
6118
6119impl std::marker::Unpin for ParentViewportWatcherEventStream {}
6120
6121impl futures::stream::FusedStream for ParentViewportWatcherEventStream {
6122    fn is_terminated(&self) -> bool {
6123        self.event_receiver.is_terminated()
6124    }
6125}
6126
6127impl futures::Stream for ParentViewportWatcherEventStream {
6128    type Item = Result<ParentViewportWatcherEvent, fidl::Error>;
6129
6130    fn poll_next(
6131        mut self: std::pin::Pin<&mut Self>,
6132        cx: &mut std::task::Context<'_>,
6133    ) -> std::task::Poll<Option<Self::Item>> {
6134        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
6135            &mut self.event_receiver,
6136            cx
6137        )?) {
6138            Some(buf) => std::task::Poll::Ready(Some(ParentViewportWatcherEvent::decode(buf))),
6139            None => std::task::Poll::Ready(None),
6140        }
6141    }
6142}
6143
6144#[derive(Debug)]
6145pub enum ParentViewportWatcherEvent {}
6146
6147impl ParentViewportWatcherEvent {
6148    /// Decodes a message buffer as a [`ParentViewportWatcherEvent`].
6149    fn decode(
6150        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
6151    ) -> Result<ParentViewportWatcherEvent, fidl::Error> {
6152        let (bytes, _handles) = buf.split_mut();
6153        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6154        debug_assert_eq!(tx_header.tx_id, 0);
6155        match tx_header.ordinal {
6156            _ => Err(fidl::Error::UnknownOrdinal {
6157                ordinal: tx_header.ordinal,
6158                protocol_name:
6159                    <ParentViewportWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6160            }),
6161        }
6162    }
6163}
6164
6165/// A Stream of incoming requests for fuchsia.ui.composition/ParentViewportWatcher.
6166pub struct ParentViewportWatcherRequestStream {
6167    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6168    is_terminated: bool,
6169}
6170
6171impl std::marker::Unpin for ParentViewportWatcherRequestStream {}
6172
6173impl futures::stream::FusedStream for ParentViewportWatcherRequestStream {
6174    fn is_terminated(&self) -> bool {
6175        self.is_terminated
6176    }
6177}
6178
6179impl fidl::endpoints::RequestStream for ParentViewportWatcherRequestStream {
6180    type Protocol = ParentViewportWatcherMarker;
6181    type ControlHandle = ParentViewportWatcherControlHandle;
6182
6183    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
6184        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
6185    }
6186
6187    fn control_handle(&self) -> Self::ControlHandle {
6188        ParentViewportWatcherControlHandle { inner: self.inner.clone() }
6189    }
6190
6191    fn into_inner(
6192        self,
6193    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
6194    {
6195        (self.inner, self.is_terminated)
6196    }
6197
6198    fn from_inner(
6199        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6200        is_terminated: bool,
6201    ) -> Self {
6202        Self { inner, is_terminated }
6203    }
6204}
6205
6206impl futures::Stream for ParentViewportWatcherRequestStream {
6207    type Item = Result<ParentViewportWatcherRequest, fidl::Error>;
6208
6209    fn poll_next(
6210        mut self: std::pin::Pin<&mut Self>,
6211        cx: &mut std::task::Context<'_>,
6212    ) -> std::task::Poll<Option<Self::Item>> {
6213        let this = &mut *self;
6214        if this.inner.check_shutdown(cx) {
6215            this.is_terminated = true;
6216            return std::task::Poll::Ready(None);
6217        }
6218        if this.is_terminated {
6219            panic!("polled ParentViewportWatcherRequestStream after completion");
6220        }
6221        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
6222            |bytes, handles| {
6223                match this.inner.channel().read_etc(cx, bytes, handles) {
6224                    std::task::Poll::Ready(Ok(())) => {}
6225                    std::task::Poll::Pending => return std::task::Poll::Pending,
6226                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
6227                        this.is_terminated = true;
6228                        return std::task::Poll::Ready(None);
6229                    }
6230                    std::task::Poll::Ready(Err(e)) => {
6231                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
6232                            e.into(),
6233                        ))));
6234                    }
6235                }
6236
6237                // A message has been received from the channel
6238                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6239
6240                std::task::Poll::Ready(Some(match header.ordinal {
6241                0x3cbe5d9638e032 => {
6242                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6243                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
6244                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
6245                    let control_handle = ParentViewportWatcherControlHandle {
6246                        inner: this.inner.clone(),
6247                    };
6248                    Ok(ParentViewportWatcherRequest::GetLayout {
6249                        responder: ParentViewportWatcherGetLayoutResponder {
6250                            control_handle: std::mem::ManuallyDrop::new(control_handle),
6251                            tx_id: header.tx_id,
6252                        },
6253                    })
6254                }
6255                0x7caa022f050d9ea6 => {
6256                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6257                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
6258                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
6259                    let control_handle = ParentViewportWatcherControlHandle {
6260                        inner: this.inner.clone(),
6261                    };
6262                    Ok(ParentViewportWatcherRequest::GetStatus {
6263                        responder: ParentViewportWatcherGetStatusResponder {
6264                            control_handle: std::mem::ManuallyDrop::new(control_handle),
6265                            tx_id: header.tx_id,
6266                        },
6267                    })
6268                }
6269                _ => Err(fidl::Error::UnknownOrdinal {
6270                    ordinal: header.ordinal,
6271                    protocol_name: <ParentViewportWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6272                }),
6273            }))
6274            },
6275        )
6276    }
6277}
6278
6279/// A protocol that provides information about the parent Viewport attached to a Flatland instance's
6280/// sole View.  Although Flatland instances can have at most one view, it is possible to have
6281/// multiple ParentViewportWatchers during the brief transition period when replacing the instance's
6282/// View with another, e.g. via [`CreateView`].  During this period, certain updates may be
6283/// duplicated and sent to each ParentViewportWatcher connection.
6284///
6285/// A ParentViewportWatcher will remain connected as long as the corresponding parent Viewport
6286/// exists; the connection will also be closed if the parents's ViewportCreationToken is dropped
6287/// without using it to create a Viewport.
6288#[derive(Debug)]
6289pub enum ParentViewportWatcherRequest {
6290    /// A hanging get for receiving layout information. Clients may receive layout information
6291    /// before the ParentViewportWatcher operation has been presented. This allows children to
6292    /// layout their content before their first call to [`Present`]. In transition cases where two
6293    /// ParentViewportWatcher channels exist at the same time, both protocol instances will be
6294    /// receiving different layout information.
6295    ///
6296    /// This hanging get will only fire when the LayoutInfo is different than the previously
6297    /// returned LayoutInfo. Note that, since LayoutInfo is a table, only some fields may have
6298    /// changed.
6299    ///
6300    /// It is invalid to call `GetLayout` while a previous call is still pending. Doing so will
6301    /// cause both this channel and the Flatland channel that handed out ParentViewportWatcher to be
6302    /// closed.
6303    GetLayout { responder: ParentViewportWatcherGetLayoutResponder },
6304    /// A hanging get for receiving the status of the parent Viewport. This provides global
6305    /// connectivity information to the child.
6306    ///
6307    /// This hanging get will only fire when the ParentViewportStatus is different than the
6308    /// previously returned ParentViewportStatus.
6309    ///
6310    /// It is invalid to call `GetStatus` while a previous call is still pending. Doing so will
6311    /// cause both this channel and the Flatland channel that handed out ParentViewportWatcher to be
6312    /// closed.
6313    GetStatus { responder: ParentViewportWatcherGetStatusResponder },
6314}
6315
6316impl ParentViewportWatcherRequest {
6317    #[allow(irrefutable_let_patterns)]
6318    pub fn into_get_layout(self) -> Option<(ParentViewportWatcherGetLayoutResponder)> {
6319        if let ParentViewportWatcherRequest::GetLayout { responder } = self {
6320            Some((responder))
6321        } else {
6322            None
6323        }
6324    }
6325
6326    #[allow(irrefutable_let_patterns)]
6327    pub fn into_get_status(self) -> Option<(ParentViewportWatcherGetStatusResponder)> {
6328        if let ParentViewportWatcherRequest::GetStatus { responder } = self {
6329            Some((responder))
6330        } else {
6331            None
6332        }
6333    }
6334
6335    /// Name of the method defined in FIDL
6336    pub fn method_name(&self) -> &'static str {
6337        match *self {
6338            ParentViewportWatcherRequest::GetLayout { .. } => "get_layout",
6339            ParentViewportWatcherRequest::GetStatus { .. } => "get_status",
6340        }
6341    }
6342}
6343
6344#[derive(Debug, Clone)]
6345pub struct ParentViewportWatcherControlHandle {
6346    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6347}
6348
6349impl fidl::endpoints::ControlHandle for ParentViewportWatcherControlHandle {
6350    fn shutdown(&self) {
6351        self.inner.shutdown()
6352    }
6353    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
6354        self.inner.shutdown_with_epitaph(status)
6355    }
6356
6357    fn is_closed(&self) -> bool {
6358        self.inner.channel().is_closed()
6359    }
6360    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
6361        self.inner.channel().on_closed()
6362    }
6363
6364    #[cfg(target_os = "fuchsia")]
6365    fn signal_peer(
6366        &self,
6367        clear_mask: zx::Signals,
6368        set_mask: zx::Signals,
6369    ) -> Result<(), zx_status::Status> {
6370        use fidl::Peered;
6371        self.inner.channel().signal_peer(clear_mask, set_mask)
6372    }
6373}
6374
6375impl ParentViewportWatcherControlHandle {}
6376
6377#[must_use = "FIDL methods require a response to be sent"]
6378#[derive(Debug)]
6379pub struct ParentViewportWatcherGetLayoutResponder {
6380    control_handle: std::mem::ManuallyDrop<ParentViewportWatcherControlHandle>,
6381    tx_id: u32,
6382}
6383
6384/// Set the the channel to be shutdown (see [`ParentViewportWatcherControlHandle::shutdown`])
6385/// if the responder is dropped without sending a response, so that the client
6386/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6387impl std::ops::Drop for ParentViewportWatcherGetLayoutResponder {
6388    fn drop(&mut self) {
6389        self.control_handle.shutdown();
6390        // Safety: drops once, never accessed again
6391        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6392    }
6393}
6394
6395impl fidl::endpoints::Responder for ParentViewportWatcherGetLayoutResponder {
6396    type ControlHandle = ParentViewportWatcherControlHandle;
6397
6398    fn control_handle(&self) -> &ParentViewportWatcherControlHandle {
6399        &self.control_handle
6400    }
6401
6402    fn drop_without_shutdown(mut self) {
6403        // Safety: drops once, never accessed again due to mem::forget
6404        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6405        // Prevent Drop from running (which would shut down the channel)
6406        std::mem::forget(self);
6407    }
6408}
6409
6410impl ParentViewportWatcherGetLayoutResponder {
6411    /// Sends a response to the FIDL transaction.
6412    ///
6413    /// Sets the channel to shutdown if an error occurs.
6414    pub fn send(self, mut info: &LayoutInfo) -> Result<(), fidl::Error> {
6415        let _result = self.send_raw(info);
6416        if _result.is_err() {
6417            self.control_handle.shutdown();
6418        }
6419        self.drop_without_shutdown();
6420        _result
6421    }
6422
6423    /// Similar to "send" but does not shutdown the channel if an error occurs.
6424    pub fn send_no_shutdown_on_err(self, mut info: &LayoutInfo) -> Result<(), fidl::Error> {
6425        let _result = self.send_raw(info);
6426        self.drop_without_shutdown();
6427        _result
6428    }
6429
6430    fn send_raw(&self, mut info: &LayoutInfo) -> Result<(), fidl::Error> {
6431        self.control_handle.inner.send::<ParentViewportWatcherGetLayoutResponse>(
6432            (info,),
6433            self.tx_id,
6434            0x3cbe5d9638e032,
6435            fidl::encoding::DynamicFlags::empty(),
6436        )
6437    }
6438}
6439
6440#[must_use = "FIDL methods require a response to be sent"]
6441#[derive(Debug)]
6442pub struct ParentViewportWatcherGetStatusResponder {
6443    control_handle: std::mem::ManuallyDrop<ParentViewportWatcherControlHandle>,
6444    tx_id: u32,
6445}
6446
6447/// Set the the channel to be shutdown (see [`ParentViewportWatcherControlHandle::shutdown`])
6448/// if the responder is dropped without sending a response, so that the client
6449/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6450impl std::ops::Drop for ParentViewportWatcherGetStatusResponder {
6451    fn drop(&mut self) {
6452        self.control_handle.shutdown();
6453        // Safety: drops once, never accessed again
6454        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6455    }
6456}
6457
6458impl fidl::endpoints::Responder for ParentViewportWatcherGetStatusResponder {
6459    type ControlHandle = ParentViewportWatcherControlHandle;
6460
6461    fn control_handle(&self) -> &ParentViewportWatcherControlHandle {
6462        &self.control_handle
6463    }
6464
6465    fn drop_without_shutdown(mut self) {
6466        // Safety: drops once, never accessed again due to mem::forget
6467        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6468        // Prevent Drop from running (which would shut down the channel)
6469        std::mem::forget(self);
6470    }
6471}
6472
6473impl ParentViewportWatcherGetStatusResponder {
6474    /// Sends a response to the FIDL transaction.
6475    ///
6476    /// Sets the channel to shutdown if an error occurs.
6477    pub fn send(self, mut status: ParentViewportStatus) -> Result<(), fidl::Error> {
6478        let _result = self.send_raw(status);
6479        if _result.is_err() {
6480            self.control_handle.shutdown();
6481        }
6482        self.drop_without_shutdown();
6483        _result
6484    }
6485
6486    /// Similar to "send" but does not shutdown the channel if an error occurs.
6487    pub fn send_no_shutdown_on_err(
6488        self,
6489        mut status: ParentViewportStatus,
6490    ) -> Result<(), fidl::Error> {
6491        let _result = self.send_raw(status);
6492        self.drop_without_shutdown();
6493        _result
6494    }
6495
6496    fn send_raw(&self, mut status: ParentViewportStatus) -> Result<(), fidl::Error> {
6497        self.control_handle.inner.send::<ParentViewportWatcherGetStatusResponse>(
6498            (status,),
6499            self.tx_id,
6500            0x7caa022f050d9ea6,
6501            fidl::encoding::DynamicFlags::empty(),
6502        )
6503    }
6504}
6505
6506#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
6507pub struct ScreenCaptureMarker;
6508
6509impl fidl::endpoints::ProtocolMarker for ScreenCaptureMarker {
6510    type Proxy = ScreenCaptureProxy;
6511    type RequestStream = ScreenCaptureRequestStream;
6512    #[cfg(target_os = "fuchsia")]
6513    type SynchronousProxy = ScreenCaptureSynchronousProxy;
6514
6515    const DEBUG_NAME: &'static str = "fuchsia.ui.composition.ScreenCapture";
6516}
6517impl fidl::endpoints::DiscoverableProtocolMarker for ScreenCaptureMarker {}
6518pub type ScreenCaptureConfigureResult = Result<(), ScreenCaptureError>;
6519pub type ScreenCaptureGetNextFrameResult = Result<FrameInfo, ScreenCaptureError>;
6520pub type ScreenCaptureReleaseFrameResult = Result<(), ScreenCaptureError>;
6521
6522pub trait ScreenCaptureProxyInterface: Send + Sync {
6523    type ConfigureResponseFut: std::future::Future<Output = Result<ScreenCaptureConfigureResult, fidl::Error>>
6524        + Send;
6525    fn r#configure(&self, payload: ScreenCaptureConfig) -> Self::ConfigureResponseFut;
6526    type GetNextFrameResponseFut: std::future::Future<Output = Result<ScreenCaptureGetNextFrameResult, fidl::Error>>
6527        + Send;
6528    fn r#get_next_frame(&self, payload: GetNextFrameArgs) -> Self::GetNextFrameResponseFut;
6529    type ReleaseFrameResponseFut: std::future::Future<Output = Result<ScreenCaptureReleaseFrameResult, fidl::Error>>
6530        + Send;
6531    fn r#release_frame(&self, buffer_id: u32) -> Self::ReleaseFrameResponseFut;
6532}
6533#[derive(Debug)]
6534#[cfg(target_os = "fuchsia")]
6535pub struct ScreenCaptureSynchronousProxy {
6536    client: fidl::client::sync::Client,
6537}
6538
6539#[cfg(target_os = "fuchsia")]
6540impl fidl::endpoints::SynchronousProxy for ScreenCaptureSynchronousProxy {
6541    type Proxy = ScreenCaptureProxy;
6542    type Protocol = ScreenCaptureMarker;
6543
6544    fn from_channel(inner: fidl::Channel) -> Self {
6545        Self::new(inner)
6546    }
6547
6548    fn into_channel(self) -> fidl::Channel {
6549        self.client.into_channel()
6550    }
6551
6552    fn as_channel(&self) -> &fidl::Channel {
6553        self.client.as_channel()
6554    }
6555}
6556
6557#[cfg(target_os = "fuchsia")]
6558impl ScreenCaptureSynchronousProxy {
6559    pub fn new(channel: fidl::Channel) -> Self {
6560        let protocol_name = <ScreenCaptureMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
6561        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
6562    }
6563
6564    pub fn into_channel(self) -> fidl::Channel {
6565        self.client.into_channel()
6566    }
6567
6568    /// Waits until an event arrives and returns it. It is safe for other
6569    /// threads to make concurrent requests while waiting for an event.
6570    pub fn wait_for_event(
6571        &self,
6572        deadline: zx::MonotonicInstant,
6573    ) -> Result<ScreenCaptureEvent, fidl::Error> {
6574        ScreenCaptureEvent::decode(self.client.wait_for_event(deadline)?)
6575    }
6576
6577    /// Clients should first use the Allocator protocol to register a
6578    /// BufferCollection. This function will fail with BAD_OPERATION unless all clients of the
6579    /// BufferCollection have set their constraints.
6580    ///
6581    /// Afterwards, clients should create and configure the images that will
6582    /// eventually be rendered to using this method. All the buffers in the
6583    /// collection from 0 to (buffer_count-1) may be used for screen capture.
6584    ///
6585    /// Clients are responsible for determining the rotation of the display,
6586    /// and applying the corrective rotation. For instance, if the display is
6587    /// mounted 90 degrees clockwise (the "top" is on the right, when looking
6588    /// at the display), then the client should specify a 270 degree rotation
6589    /// to account for it.
6590    ///
6591    /// Similarly, the clients are responsible for specifying a buffer big
6592    /// enough for the rotated image. If the buffer is too small, a best effort
6593    /// attempt will be made to render the image.
6594    ///
6595    /// Finally, clients request the server to render the current screen to the
6596    /// shared buffers using [`GetNextFrame`].
6597    ///
6598    /// [`Configure`] can be called again with a new BufferCollectionImportToken
6599    /// if the client wishes to change any of the configuration settings. In
6600    /// this case all the buffers from the previous call to [`Configure`] will
6601    /// be released.
6602    pub fn r#configure(
6603        &self,
6604        mut payload: ScreenCaptureConfig,
6605        ___deadline: zx::MonotonicInstant,
6606    ) -> Result<ScreenCaptureConfigureResult, fidl::Error> {
6607        let _response = self.client.send_query::<ScreenCaptureConfig, fidl::encoding::ResultType<
6608            fidl::encoding::EmptyStruct,
6609            ScreenCaptureError,
6610        >>(
6611            &mut payload,
6612            0x3b6e5af1d294afd9,
6613            fidl::encoding::DynamicFlags::empty(),
6614            ___deadline,
6615        )?;
6616        Ok(_response.map(|x| x))
6617    }
6618
6619    /// Following a successful call to [`Configure`], clients can call
6620    /// GetNextFrame. This will populate a buffer with the most recent frame.
6621    ///
6622    /// Clients should wait on the zx::event they pass for successful
6623    /// completion of the screenshot. It is not guaranteed that the screenshot
6624    /// will be completed by the time this function returns.
6625    ///
6626    /// The requested image will be in the BufferCollection that the client set
6627    /// up in the VMO at the index specified by buffer_id.
6628    ///
6629    /// When ScreenCapture is used to provide a stream, the rate that the
6630    /// client calls GetNextFrame will drive the frame rate.
6631    ///
6632    /// Errors:
6633    /// BAD_OPERATION if Configure was not called, or not called successfully
6634    /// MISSING_ARGS if a required argument is not present
6635    /// BUFFER_FULL if all buffers in the BufferCollection are in use. In this case, ReleaseFrame
6636    /// must be called to make a buffer available before this function can be called successfully.
6637    pub fn r#get_next_frame(
6638        &self,
6639        mut payload: GetNextFrameArgs,
6640        ___deadline: zx::MonotonicInstant,
6641    ) -> Result<ScreenCaptureGetNextFrameResult, fidl::Error> {
6642        let _response = self.client.send_query::<
6643            GetNextFrameArgs,
6644            fidl::encoding::ResultType<FrameInfo, ScreenCaptureError>,
6645        >(
6646            &mut payload,
6647            0x552c1580aab8c4a7,
6648            fidl::encoding::DynamicFlags::empty(),
6649            ___deadline,
6650        )?;
6651        Ok(_response.map(|x| x))
6652    }
6653
6654    /// Once the client no longer needs an image, they can call ReleaseFrame on
6655    /// the VMO index of the buffer so that the server can reuse it in the future.
6656    pub fn r#release_frame(
6657        &self,
6658        mut buffer_id: u32,
6659        ___deadline: zx::MonotonicInstant,
6660    ) -> Result<ScreenCaptureReleaseFrameResult, fidl::Error> {
6661        let _response =
6662            self.client.send_query::<ScreenCaptureReleaseFrameRequest, fidl::encoding::ResultType<
6663                fidl::encoding::EmptyStruct,
6664                ScreenCaptureError,
6665            >>(
6666                (buffer_id,),
6667                0x46704dce24e35950,
6668                fidl::encoding::DynamicFlags::empty(),
6669                ___deadline,
6670            )?;
6671        Ok(_response.map(|x| x))
6672    }
6673}
6674
6675#[cfg(target_os = "fuchsia")]
6676impl From<ScreenCaptureSynchronousProxy> for zx::Handle {
6677    fn from(value: ScreenCaptureSynchronousProxy) -> Self {
6678        value.into_channel().into()
6679    }
6680}
6681
6682#[cfg(target_os = "fuchsia")]
6683impl From<fidl::Channel> for ScreenCaptureSynchronousProxy {
6684    fn from(value: fidl::Channel) -> Self {
6685        Self::new(value)
6686    }
6687}
6688
6689#[cfg(target_os = "fuchsia")]
6690impl fidl::endpoints::FromClient for ScreenCaptureSynchronousProxy {
6691    type Protocol = ScreenCaptureMarker;
6692
6693    fn from_client(value: fidl::endpoints::ClientEnd<ScreenCaptureMarker>) -> Self {
6694        Self::new(value.into_channel())
6695    }
6696}
6697
6698#[derive(Debug, Clone)]
6699pub struct ScreenCaptureProxy {
6700    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
6701}
6702
6703impl fidl::endpoints::Proxy for ScreenCaptureProxy {
6704    type Protocol = ScreenCaptureMarker;
6705
6706    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
6707        Self::new(inner)
6708    }
6709
6710    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
6711        self.client.into_channel().map_err(|client| Self { client })
6712    }
6713
6714    fn as_channel(&self) -> &::fidl::AsyncChannel {
6715        self.client.as_channel()
6716    }
6717}
6718
6719impl ScreenCaptureProxy {
6720    /// Create a new Proxy for fuchsia.ui.composition/ScreenCapture.
6721    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
6722        let protocol_name = <ScreenCaptureMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
6723        Self { client: fidl::client::Client::new(channel, protocol_name) }
6724    }
6725
6726    /// Get a Stream of events from the remote end of the protocol.
6727    ///
6728    /// # Panics
6729    ///
6730    /// Panics if the event stream was already taken.
6731    pub fn take_event_stream(&self) -> ScreenCaptureEventStream {
6732        ScreenCaptureEventStream { event_receiver: self.client.take_event_receiver() }
6733    }
6734
6735    /// Clients should first use the Allocator protocol to register a
6736    /// BufferCollection. This function will fail with BAD_OPERATION unless all clients of the
6737    /// BufferCollection have set their constraints.
6738    ///
6739    /// Afterwards, clients should create and configure the images that will
6740    /// eventually be rendered to using this method. All the buffers in the
6741    /// collection from 0 to (buffer_count-1) may be used for screen capture.
6742    ///
6743    /// Clients are responsible for determining the rotation of the display,
6744    /// and applying the corrective rotation. For instance, if the display is
6745    /// mounted 90 degrees clockwise (the "top" is on the right, when looking
6746    /// at the display), then the client should specify a 270 degree rotation
6747    /// to account for it.
6748    ///
6749    /// Similarly, the clients are responsible for specifying a buffer big
6750    /// enough for the rotated image. If the buffer is too small, a best effort
6751    /// attempt will be made to render the image.
6752    ///
6753    /// Finally, clients request the server to render the current screen to the
6754    /// shared buffers using [`GetNextFrame`].
6755    ///
6756    /// [`Configure`] can be called again with a new BufferCollectionImportToken
6757    /// if the client wishes to change any of the configuration settings. In
6758    /// this case all the buffers from the previous call to [`Configure`] will
6759    /// be released.
6760    pub fn r#configure(
6761        &self,
6762        mut payload: ScreenCaptureConfig,
6763    ) -> fidl::client::QueryResponseFut<
6764        ScreenCaptureConfigureResult,
6765        fidl::encoding::DefaultFuchsiaResourceDialect,
6766    > {
6767        ScreenCaptureProxyInterface::r#configure(self, payload)
6768    }
6769
6770    /// Following a successful call to [`Configure`], clients can call
6771    /// GetNextFrame. This will populate a buffer with the most recent frame.
6772    ///
6773    /// Clients should wait on the zx::event they pass for successful
6774    /// completion of the screenshot. It is not guaranteed that the screenshot
6775    /// will be completed by the time this function returns.
6776    ///
6777    /// The requested image will be in the BufferCollection that the client set
6778    /// up in the VMO at the index specified by buffer_id.
6779    ///
6780    /// When ScreenCapture is used to provide a stream, the rate that the
6781    /// client calls GetNextFrame will drive the frame rate.
6782    ///
6783    /// Errors:
6784    /// BAD_OPERATION if Configure was not called, or not called successfully
6785    /// MISSING_ARGS if a required argument is not present
6786    /// BUFFER_FULL if all buffers in the BufferCollection are in use. In this case, ReleaseFrame
6787    /// must be called to make a buffer available before this function can be called successfully.
6788    pub fn r#get_next_frame(
6789        &self,
6790        mut payload: GetNextFrameArgs,
6791    ) -> fidl::client::QueryResponseFut<
6792        ScreenCaptureGetNextFrameResult,
6793        fidl::encoding::DefaultFuchsiaResourceDialect,
6794    > {
6795        ScreenCaptureProxyInterface::r#get_next_frame(self, payload)
6796    }
6797
6798    /// Once the client no longer needs an image, they can call ReleaseFrame on
6799    /// the VMO index of the buffer so that the server can reuse it in the future.
6800    pub fn r#release_frame(
6801        &self,
6802        mut buffer_id: u32,
6803    ) -> fidl::client::QueryResponseFut<
6804        ScreenCaptureReleaseFrameResult,
6805        fidl::encoding::DefaultFuchsiaResourceDialect,
6806    > {
6807        ScreenCaptureProxyInterface::r#release_frame(self, buffer_id)
6808    }
6809}
6810
6811impl ScreenCaptureProxyInterface for ScreenCaptureProxy {
6812    type ConfigureResponseFut = fidl::client::QueryResponseFut<
6813        ScreenCaptureConfigureResult,
6814        fidl::encoding::DefaultFuchsiaResourceDialect,
6815    >;
6816    fn r#configure(&self, mut payload: ScreenCaptureConfig) -> Self::ConfigureResponseFut {
6817        fn _decode(
6818            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6819        ) -> Result<ScreenCaptureConfigureResult, fidl::Error> {
6820            let _response = fidl::client::decode_transaction_body::<
6821                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, ScreenCaptureError>,
6822                fidl::encoding::DefaultFuchsiaResourceDialect,
6823                0x3b6e5af1d294afd9,
6824            >(_buf?)?;
6825            Ok(_response.map(|x| x))
6826        }
6827        self.client.send_query_and_decode::<ScreenCaptureConfig, ScreenCaptureConfigureResult>(
6828            &mut payload,
6829            0x3b6e5af1d294afd9,
6830            fidl::encoding::DynamicFlags::empty(),
6831            _decode,
6832        )
6833    }
6834
6835    type GetNextFrameResponseFut = fidl::client::QueryResponseFut<
6836        ScreenCaptureGetNextFrameResult,
6837        fidl::encoding::DefaultFuchsiaResourceDialect,
6838    >;
6839    fn r#get_next_frame(&self, mut payload: GetNextFrameArgs) -> Self::GetNextFrameResponseFut {
6840        fn _decode(
6841            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6842        ) -> Result<ScreenCaptureGetNextFrameResult, fidl::Error> {
6843            let _response = fidl::client::decode_transaction_body::<
6844                fidl::encoding::ResultType<FrameInfo, ScreenCaptureError>,
6845                fidl::encoding::DefaultFuchsiaResourceDialect,
6846                0x552c1580aab8c4a7,
6847            >(_buf?)?;
6848            Ok(_response.map(|x| x))
6849        }
6850        self.client.send_query_and_decode::<GetNextFrameArgs, ScreenCaptureGetNextFrameResult>(
6851            &mut payload,
6852            0x552c1580aab8c4a7,
6853            fidl::encoding::DynamicFlags::empty(),
6854            _decode,
6855        )
6856    }
6857
6858    type ReleaseFrameResponseFut = fidl::client::QueryResponseFut<
6859        ScreenCaptureReleaseFrameResult,
6860        fidl::encoding::DefaultFuchsiaResourceDialect,
6861    >;
6862    fn r#release_frame(&self, mut buffer_id: u32) -> Self::ReleaseFrameResponseFut {
6863        fn _decode(
6864            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6865        ) -> Result<ScreenCaptureReleaseFrameResult, fidl::Error> {
6866            let _response = fidl::client::decode_transaction_body::<
6867                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, ScreenCaptureError>,
6868                fidl::encoding::DefaultFuchsiaResourceDialect,
6869                0x46704dce24e35950,
6870            >(_buf?)?;
6871            Ok(_response.map(|x| x))
6872        }
6873        self.client.send_query_and_decode::<
6874            ScreenCaptureReleaseFrameRequest,
6875            ScreenCaptureReleaseFrameResult,
6876        >(
6877            (buffer_id,),
6878            0x46704dce24e35950,
6879            fidl::encoding::DynamicFlags::empty(),
6880            _decode,
6881        )
6882    }
6883}
6884
6885pub struct ScreenCaptureEventStream {
6886    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
6887}
6888
6889impl std::marker::Unpin for ScreenCaptureEventStream {}
6890
6891impl futures::stream::FusedStream for ScreenCaptureEventStream {
6892    fn is_terminated(&self) -> bool {
6893        self.event_receiver.is_terminated()
6894    }
6895}
6896
6897impl futures::Stream for ScreenCaptureEventStream {
6898    type Item = Result<ScreenCaptureEvent, fidl::Error>;
6899
6900    fn poll_next(
6901        mut self: std::pin::Pin<&mut Self>,
6902        cx: &mut std::task::Context<'_>,
6903    ) -> std::task::Poll<Option<Self::Item>> {
6904        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
6905            &mut self.event_receiver,
6906            cx
6907        )?) {
6908            Some(buf) => std::task::Poll::Ready(Some(ScreenCaptureEvent::decode(buf))),
6909            None => std::task::Poll::Ready(None),
6910        }
6911    }
6912}
6913
6914#[derive(Debug)]
6915pub enum ScreenCaptureEvent {}
6916
6917impl ScreenCaptureEvent {
6918    /// Decodes a message buffer as a [`ScreenCaptureEvent`].
6919    fn decode(
6920        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
6921    ) -> Result<ScreenCaptureEvent, fidl::Error> {
6922        let (bytes, _handles) = buf.split_mut();
6923        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6924        debug_assert_eq!(tx_header.tx_id, 0);
6925        match tx_header.ordinal {
6926            _ => Err(fidl::Error::UnknownOrdinal {
6927                ordinal: tx_header.ordinal,
6928                protocol_name: <ScreenCaptureMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6929            }),
6930        }
6931    }
6932}
6933
6934/// A Stream of incoming requests for fuchsia.ui.composition/ScreenCapture.
6935pub struct ScreenCaptureRequestStream {
6936    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6937    is_terminated: bool,
6938}
6939
6940impl std::marker::Unpin for ScreenCaptureRequestStream {}
6941
6942impl futures::stream::FusedStream for ScreenCaptureRequestStream {
6943    fn is_terminated(&self) -> bool {
6944        self.is_terminated
6945    }
6946}
6947
6948impl fidl::endpoints::RequestStream for ScreenCaptureRequestStream {
6949    type Protocol = ScreenCaptureMarker;
6950    type ControlHandle = ScreenCaptureControlHandle;
6951
6952    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
6953        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
6954    }
6955
6956    fn control_handle(&self) -> Self::ControlHandle {
6957        ScreenCaptureControlHandle { inner: self.inner.clone() }
6958    }
6959
6960    fn into_inner(
6961        self,
6962    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
6963    {
6964        (self.inner, self.is_terminated)
6965    }
6966
6967    fn from_inner(
6968        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6969        is_terminated: bool,
6970    ) -> Self {
6971        Self { inner, is_terminated }
6972    }
6973}
6974
6975impl futures::Stream for ScreenCaptureRequestStream {
6976    type Item = Result<ScreenCaptureRequest, fidl::Error>;
6977
6978    fn poll_next(
6979        mut self: std::pin::Pin<&mut Self>,
6980        cx: &mut std::task::Context<'_>,
6981    ) -> std::task::Poll<Option<Self::Item>> {
6982        let this = &mut *self;
6983        if this.inner.check_shutdown(cx) {
6984            this.is_terminated = true;
6985            return std::task::Poll::Ready(None);
6986        }
6987        if this.is_terminated {
6988            panic!("polled ScreenCaptureRequestStream after completion");
6989        }
6990        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
6991            |bytes, handles| {
6992                match this.inner.channel().read_etc(cx, bytes, handles) {
6993                    std::task::Poll::Ready(Ok(())) => {}
6994                    std::task::Poll::Pending => return std::task::Poll::Pending,
6995                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
6996                        this.is_terminated = true;
6997                        return std::task::Poll::Ready(None);
6998                    }
6999                    std::task::Poll::Ready(Err(e)) => {
7000                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
7001                            e.into(),
7002                        ))));
7003                    }
7004                }
7005
7006                // A message has been received from the channel
7007                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7008
7009                std::task::Poll::Ready(Some(match header.ordinal {
7010                    0x3b6e5af1d294afd9 => {
7011                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7012                        let mut req = fidl::new_empty!(
7013                            ScreenCaptureConfig,
7014                            fidl::encoding::DefaultFuchsiaResourceDialect
7015                        );
7016                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ScreenCaptureConfig>(&header, _body_bytes, handles, &mut req)?;
7017                        let control_handle =
7018                            ScreenCaptureControlHandle { inner: this.inner.clone() };
7019                        Ok(ScreenCaptureRequest::Configure {
7020                            payload: req,
7021                            responder: ScreenCaptureConfigureResponder {
7022                                control_handle: std::mem::ManuallyDrop::new(control_handle),
7023                                tx_id: header.tx_id,
7024                            },
7025                        })
7026                    }
7027                    0x552c1580aab8c4a7 => {
7028                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7029                        let mut req = fidl::new_empty!(
7030                            GetNextFrameArgs,
7031                            fidl::encoding::DefaultFuchsiaResourceDialect
7032                        );
7033                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<GetNextFrameArgs>(&header, _body_bytes, handles, &mut req)?;
7034                        let control_handle =
7035                            ScreenCaptureControlHandle { inner: this.inner.clone() };
7036                        Ok(ScreenCaptureRequest::GetNextFrame {
7037                            payload: req,
7038                            responder: ScreenCaptureGetNextFrameResponder {
7039                                control_handle: std::mem::ManuallyDrop::new(control_handle),
7040                                tx_id: header.tx_id,
7041                            },
7042                        })
7043                    }
7044                    0x46704dce24e35950 => {
7045                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7046                        let mut req = fidl::new_empty!(
7047                            ScreenCaptureReleaseFrameRequest,
7048                            fidl::encoding::DefaultFuchsiaResourceDialect
7049                        );
7050                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ScreenCaptureReleaseFrameRequest>(&header, _body_bytes, handles, &mut req)?;
7051                        let control_handle =
7052                            ScreenCaptureControlHandle { inner: this.inner.clone() };
7053                        Ok(ScreenCaptureRequest::ReleaseFrame {
7054                            buffer_id: req.buffer_id,
7055
7056                            responder: ScreenCaptureReleaseFrameResponder {
7057                                control_handle: std::mem::ManuallyDrop::new(control_handle),
7058                                tx_id: header.tx_id,
7059                            },
7060                        })
7061                    }
7062                    _ => Err(fidl::Error::UnknownOrdinal {
7063                        ordinal: header.ordinal,
7064                        protocol_name:
7065                            <ScreenCaptureMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
7066                    }),
7067                }))
7068            },
7069        )
7070    }
7071}
7072
7073/// This protocol provides a low-level ScreenCapture API for clients to use.
7074/// ScreenCapture clients should familiarize themselves with the
7075/// [`fuchsia.sysmem/BufferCollection`] and [`fuchsia.ui.composition/Allocator`] protocols
7076/// as those are necessary to create the BufferCollections and images ScreenCapture uses.
7077#[derive(Debug)]
7078pub enum ScreenCaptureRequest {
7079    /// Clients should first use the Allocator protocol to register a
7080    /// BufferCollection. This function will fail with BAD_OPERATION unless all clients of the
7081    /// BufferCollection have set their constraints.
7082    ///
7083    /// Afterwards, clients should create and configure the images that will
7084    /// eventually be rendered to using this method. All the buffers in the
7085    /// collection from 0 to (buffer_count-1) may be used for screen capture.
7086    ///
7087    /// Clients are responsible for determining the rotation of the display,
7088    /// and applying the corrective rotation. For instance, if the display is
7089    /// mounted 90 degrees clockwise (the "top" is on the right, when looking
7090    /// at the display), then the client should specify a 270 degree rotation
7091    /// to account for it.
7092    ///
7093    /// Similarly, the clients are responsible for specifying a buffer big
7094    /// enough for the rotated image. If the buffer is too small, a best effort
7095    /// attempt will be made to render the image.
7096    ///
7097    /// Finally, clients request the server to render the current screen to the
7098    /// shared buffers using [`GetNextFrame`].
7099    ///
7100    /// [`Configure`] can be called again with a new BufferCollectionImportToken
7101    /// if the client wishes to change any of the configuration settings. In
7102    /// this case all the buffers from the previous call to [`Configure`] will
7103    /// be released.
7104    Configure { payload: ScreenCaptureConfig, responder: ScreenCaptureConfigureResponder },
7105    /// Following a successful call to [`Configure`], clients can call
7106    /// GetNextFrame. This will populate a buffer with the most recent frame.
7107    ///
7108    /// Clients should wait on the zx::event they pass for successful
7109    /// completion of the screenshot. It is not guaranteed that the screenshot
7110    /// will be completed by the time this function returns.
7111    ///
7112    /// The requested image will be in the BufferCollection that the client set
7113    /// up in the VMO at the index specified by buffer_id.
7114    ///
7115    /// When ScreenCapture is used to provide a stream, the rate that the
7116    /// client calls GetNextFrame will drive the frame rate.
7117    ///
7118    /// Errors:
7119    /// BAD_OPERATION if Configure was not called, or not called successfully
7120    /// MISSING_ARGS if a required argument is not present
7121    /// BUFFER_FULL if all buffers in the BufferCollection are in use. In this case, ReleaseFrame
7122    /// must be called to make a buffer available before this function can be called successfully.
7123    GetNextFrame { payload: GetNextFrameArgs, responder: ScreenCaptureGetNextFrameResponder },
7124    /// Once the client no longer needs an image, they can call ReleaseFrame on
7125    /// the VMO index of the buffer so that the server can reuse it in the future.
7126    ReleaseFrame { buffer_id: u32, responder: ScreenCaptureReleaseFrameResponder },
7127}
7128
7129impl ScreenCaptureRequest {
7130    #[allow(irrefutable_let_patterns)]
7131    pub fn into_configure(self) -> Option<(ScreenCaptureConfig, ScreenCaptureConfigureResponder)> {
7132        if let ScreenCaptureRequest::Configure { payload, responder } = self {
7133            Some((payload, responder))
7134        } else {
7135            None
7136        }
7137    }
7138
7139    #[allow(irrefutable_let_patterns)]
7140    pub fn into_get_next_frame(
7141        self,
7142    ) -> Option<(GetNextFrameArgs, ScreenCaptureGetNextFrameResponder)> {
7143        if let ScreenCaptureRequest::GetNextFrame { payload, responder } = self {
7144            Some((payload, responder))
7145        } else {
7146            None
7147        }
7148    }
7149
7150    #[allow(irrefutable_let_patterns)]
7151    pub fn into_release_frame(self) -> Option<(u32, ScreenCaptureReleaseFrameResponder)> {
7152        if let ScreenCaptureRequest::ReleaseFrame { buffer_id, responder } = self {
7153            Some((buffer_id, responder))
7154        } else {
7155            None
7156        }
7157    }
7158
7159    /// Name of the method defined in FIDL
7160    pub fn method_name(&self) -> &'static str {
7161        match *self {
7162            ScreenCaptureRequest::Configure { .. } => "configure",
7163            ScreenCaptureRequest::GetNextFrame { .. } => "get_next_frame",
7164            ScreenCaptureRequest::ReleaseFrame { .. } => "release_frame",
7165        }
7166    }
7167}
7168
7169#[derive(Debug, Clone)]
7170pub struct ScreenCaptureControlHandle {
7171    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7172}
7173
7174impl fidl::endpoints::ControlHandle for ScreenCaptureControlHandle {
7175    fn shutdown(&self) {
7176        self.inner.shutdown()
7177    }
7178    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
7179        self.inner.shutdown_with_epitaph(status)
7180    }
7181
7182    fn is_closed(&self) -> bool {
7183        self.inner.channel().is_closed()
7184    }
7185    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
7186        self.inner.channel().on_closed()
7187    }
7188
7189    #[cfg(target_os = "fuchsia")]
7190    fn signal_peer(
7191        &self,
7192        clear_mask: zx::Signals,
7193        set_mask: zx::Signals,
7194    ) -> Result<(), zx_status::Status> {
7195        use fidl::Peered;
7196        self.inner.channel().signal_peer(clear_mask, set_mask)
7197    }
7198}
7199
7200impl ScreenCaptureControlHandle {}
7201
7202#[must_use = "FIDL methods require a response to be sent"]
7203#[derive(Debug)]
7204pub struct ScreenCaptureConfigureResponder {
7205    control_handle: std::mem::ManuallyDrop<ScreenCaptureControlHandle>,
7206    tx_id: u32,
7207}
7208
7209/// Set the the channel to be shutdown (see [`ScreenCaptureControlHandle::shutdown`])
7210/// if the responder is dropped without sending a response, so that the client
7211/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7212impl std::ops::Drop for ScreenCaptureConfigureResponder {
7213    fn drop(&mut self) {
7214        self.control_handle.shutdown();
7215        // Safety: drops once, never accessed again
7216        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7217    }
7218}
7219
7220impl fidl::endpoints::Responder for ScreenCaptureConfigureResponder {
7221    type ControlHandle = ScreenCaptureControlHandle;
7222
7223    fn control_handle(&self) -> &ScreenCaptureControlHandle {
7224        &self.control_handle
7225    }
7226
7227    fn drop_without_shutdown(mut self) {
7228        // Safety: drops once, never accessed again due to mem::forget
7229        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7230        // Prevent Drop from running (which would shut down the channel)
7231        std::mem::forget(self);
7232    }
7233}
7234
7235impl ScreenCaptureConfigureResponder {
7236    /// Sends a response to the FIDL transaction.
7237    ///
7238    /// Sets the channel to shutdown if an error occurs.
7239    pub fn send(self, mut result: Result<(), ScreenCaptureError>) -> Result<(), fidl::Error> {
7240        let _result = self.send_raw(result);
7241        if _result.is_err() {
7242            self.control_handle.shutdown();
7243        }
7244        self.drop_without_shutdown();
7245        _result
7246    }
7247
7248    /// Similar to "send" but does not shutdown the channel if an error occurs.
7249    pub fn send_no_shutdown_on_err(
7250        self,
7251        mut result: Result<(), ScreenCaptureError>,
7252    ) -> Result<(), fidl::Error> {
7253        let _result = self.send_raw(result);
7254        self.drop_without_shutdown();
7255        _result
7256    }
7257
7258    fn send_raw(&self, mut result: Result<(), ScreenCaptureError>) -> Result<(), fidl::Error> {
7259        self.control_handle.inner.send::<fidl::encoding::ResultType<
7260            fidl::encoding::EmptyStruct,
7261            ScreenCaptureError,
7262        >>(
7263            result,
7264            self.tx_id,
7265            0x3b6e5af1d294afd9,
7266            fidl::encoding::DynamicFlags::empty(),
7267        )
7268    }
7269}
7270
7271#[must_use = "FIDL methods require a response to be sent"]
7272#[derive(Debug)]
7273pub struct ScreenCaptureGetNextFrameResponder {
7274    control_handle: std::mem::ManuallyDrop<ScreenCaptureControlHandle>,
7275    tx_id: u32,
7276}
7277
7278/// Set the the channel to be shutdown (see [`ScreenCaptureControlHandle::shutdown`])
7279/// if the responder is dropped without sending a response, so that the client
7280/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7281impl std::ops::Drop for ScreenCaptureGetNextFrameResponder {
7282    fn drop(&mut self) {
7283        self.control_handle.shutdown();
7284        // Safety: drops once, never accessed again
7285        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7286    }
7287}
7288
7289impl fidl::endpoints::Responder for ScreenCaptureGetNextFrameResponder {
7290    type ControlHandle = ScreenCaptureControlHandle;
7291
7292    fn control_handle(&self) -> &ScreenCaptureControlHandle {
7293        &self.control_handle
7294    }
7295
7296    fn drop_without_shutdown(mut self) {
7297        // Safety: drops once, never accessed again due to mem::forget
7298        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7299        // Prevent Drop from running (which would shut down the channel)
7300        std::mem::forget(self);
7301    }
7302}
7303
7304impl ScreenCaptureGetNextFrameResponder {
7305    /// Sends a response to the FIDL transaction.
7306    ///
7307    /// Sets the channel to shutdown if an error occurs.
7308    pub fn send(
7309        self,
7310        mut result: Result<FrameInfo, ScreenCaptureError>,
7311    ) -> Result<(), fidl::Error> {
7312        let _result = self.send_raw(result);
7313        if _result.is_err() {
7314            self.control_handle.shutdown();
7315        }
7316        self.drop_without_shutdown();
7317        _result
7318    }
7319
7320    /// Similar to "send" but does not shutdown the channel if an error occurs.
7321    pub fn send_no_shutdown_on_err(
7322        self,
7323        mut result: Result<FrameInfo, ScreenCaptureError>,
7324    ) -> Result<(), fidl::Error> {
7325        let _result = self.send_raw(result);
7326        self.drop_without_shutdown();
7327        _result
7328    }
7329
7330    fn send_raw(
7331        &self,
7332        mut result: Result<FrameInfo, ScreenCaptureError>,
7333    ) -> Result<(), fidl::Error> {
7334        self.control_handle.inner.send::<fidl::encoding::ResultType<FrameInfo, ScreenCaptureError>>(
7335            result.as_mut().map_err(|e| *e),
7336            self.tx_id,
7337            0x552c1580aab8c4a7,
7338            fidl::encoding::DynamicFlags::empty(),
7339        )
7340    }
7341}
7342
7343#[must_use = "FIDL methods require a response to be sent"]
7344#[derive(Debug)]
7345pub struct ScreenCaptureReleaseFrameResponder {
7346    control_handle: std::mem::ManuallyDrop<ScreenCaptureControlHandle>,
7347    tx_id: u32,
7348}
7349
7350/// Set the the channel to be shutdown (see [`ScreenCaptureControlHandle::shutdown`])
7351/// if the responder is dropped without sending a response, so that the client
7352/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7353impl std::ops::Drop for ScreenCaptureReleaseFrameResponder {
7354    fn drop(&mut self) {
7355        self.control_handle.shutdown();
7356        // Safety: drops once, never accessed again
7357        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7358    }
7359}
7360
7361impl fidl::endpoints::Responder for ScreenCaptureReleaseFrameResponder {
7362    type ControlHandle = ScreenCaptureControlHandle;
7363
7364    fn control_handle(&self) -> &ScreenCaptureControlHandle {
7365        &self.control_handle
7366    }
7367
7368    fn drop_without_shutdown(mut self) {
7369        // Safety: drops once, never accessed again due to mem::forget
7370        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7371        // Prevent Drop from running (which would shut down the channel)
7372        std::mem::forget(self);
7373    }
7374}
7375
7376impl ScreenCaptureReleaseFrameResponder {
7377    /// Sends a response to the FIDL transaction.
7378    ///
7379    /// Sets the channel to shutdown if an error occurs.
7380    pub fn send(self, mut result: Result<(), ScreenCaptureError>) -> Result<(), fidl::Error> {
7381        let _result = self.send_raw(result);
7382        if _result.is_err() {
7383            self.control_handle.shutdown();
7384        }
7385        self.drop_without_shutdown();
7386        _result
7387    }
7388
7389    /// Similar to "send" but does not shutdown the channel if an error occurs.
7390    pub fn send_no_shutdown_on_err(
7391        self,
7392        mut result: Result<(), ScreenCaptureError>,
7393    ) -> Result<(), fidl::Error> {
7394        let _result = self.send_raw(result);
7395        self.drop_without_shutdown();
7396        _result
7397    }
7398
7399    fn send_raw(&self, mut result: Result<(), ScreenCaptureError>) -> Result<(), fidl::Error> {
7400        self.control_handle.inner.send::<fidl::encoding::ResultType<
7401            fidl::encoding::EmptyStruct,
7402            ScreenCaptureError,
7403        >>(
7404            result,
7405            self.tx_id,
7406            0x46704dce24e35950,
7407            fidl::encoding::DynamicFlags::empty(),
7408        )
7409    }
7410}
7411
7412#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
7413pub struct ScreenshotMarker;
7414
7415impl fidl::endpoints::ProtocolMarker for ScreenshotMarker {
7416    type Proxy = ScreenshotProxy;
7417    type RequestStream = ScreenshotRequestStream;
7418    #[cfg(target_os = "fuchsia")]
7419    type SynchronousProxy = ScreenshotSynchronousProxy;
7420
7421    const DEBUG_NAME: &'static str = "fuchsia.ui.composition.Screenshot";
7422}
7423impl fidl::endpoints::DiscoverableProtocolMarker for ScreenshotMarker {}
7424
7425pub trait ScreenshotProxyInterface: Send + Sync {
7426    type TakeResponseFut: std::future::Future<Output = Result<ScreenshotTakeResponse, fidl::Error>>
7427        + Send;
7428    fn r#take(&self, payload: ScreenshotTakeRequest) -> Self::TakeResponseFut;
7429    type TakeFileResponseFut: std::future::Future<Output = Result<ScreenshotTakeFileResponse, fidl::Error>>
7430        + Send;
7431    fn r#take_file(&self, payload: ScreenshotTakeFileRequest) -> Self::TakeFileResponseFut;
7432}
7433#[derive(Debug)]
7434#[cfg(target_os = "fuchsia")]
7435pub struct ScreenshotSynchronousProxy {
7436    client: fidl::client::sync::Client,
7437}
7438
7439#[cfg(target_os = "fuchsia")]
7440impl fidl::endpoints::SynchronousProxy for ScreenshotSynchronousProxy {
7441    type Proxy = ScreenshotProxy;
7442    type Protocol = ScreenshotMarker;
7443
7444    fn from_channel(inner: fidl::Channel) -> Self {
7445        Self::new(inner)
7446    }
7447
7448    fn into_channel(self) -> fidl::Channel {
7449        self.client.into_channel()
7450    }
7451
7452    fn as_channel(&self) -> &fidl::Channel {
7453        self.client.as_channel()
7454    }
7455}
7456
7457#[cfg(target_os = "fuchsia")]
7458impl ScreenshotSynchronousProxy {
7459    pub fn new(channel: fidl::Channel) -> Self {
7460        let protocol_name = <ScreenshotMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
7461        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
7462    }
7463
7464    pub fn into_channel(self) -> fidl::Channel {
7465        self.client.into_channel()
7466    }
7467
7468    /// Waits until an event arrives and returns it. It is safe for other
7469    /// threads to make concurrent requests while waiting for an event.
7470    pub fn wait_for_event(
7471        &self,
7472        deadline: zx::MonotonicInstant,
7473    ) -> Result<ScreenshotEvent, fidl::Error> {
7474        ScreenshotEvent::decode(self.client.wait_for_event(deadline)?)
7475    }
7476
7477    /// Collects the current graphical content of a display in a specified buffer `format` in the
7478    /// sRGB color space. Note that the sRGB color space is non-linear, meaning that unit tests
7479    /// doing pixel equality checks making use of non-fully saturated colors should convert to a
7480    /// linear color space.
7481    ///
7482    /// See https://fuchsia.dev/fuchsia-src/concepts/ui/scenic/color_spaces for more information.
7483    ///
7484    /// Screenshot is taken immediately, populated with the display's content from the most recent
7485    /// VSYNC.
7486    ///
7487    /// If the client calls [`Take`] a second time before a first [`Take`] call returns, the server
7488    /// will close the Screenshot connection with a ZX_ERR_SHOULD_WAIT epitaph.
7489    ///
7490    /// If capture fails due to an internal error, the server will close the Screenshot connection
7491    /// with a ZX_ERR_INTERNAL epitaph.
7492    pub fn r#take(
7493        &self,
7494        mut payload: ScreenshotTakeRequest,
7495        ___deadline: zx::MonotonicInstant,
7496    ) -> Result<ScreenshotTakeResponse, fidl::Error> {
7497        let _response = self.client.send_query::<ScreenshotTakeRequest, ScreenshotTakeResponse>(
7498            &mut payload,
7499            0x51341396e9fd2fd0,
7500            fidl::encoding::DynamicFlags::empty(),
7501            ___deadline,
7502        )?;
7503        Ok(_response)
7504    }
7505
7506    /// Collects the current graphical content of a display in a specified buffer `format` in the
7507    /// sRGB color space. Note that the sRGB color space is non-linear, meaning that unit tests
7508    /// doing pixel equality checks making use of non-fully saturated colors should convert to a
7509    /// linear color space.
7510    ///
7511    /// TODO(https://fxbug.dev/42065844): Link to fuchsia.dev documentation when it's up.
7512    ///
7513    /// Screenshot is taken immediately, populated with the display's content from the most recent
7514    /// VSYNC.
7515    ///
7516    /// If the client calls [`TakeFile`] a second time before a first [`TakeFile`] call returns,
7517    /// the server will close the Screenshot connection with a ZX_ERR_SHOULD_WAIT epitaph.
7518    ///
7519    /// If capture fails due to an internal error, the server will close the Screenshot connection
7520    /// with a ZX_ERR_INTERNAL epitaph.
7521    ///
7522    /// This call should be used if the client is on the host and does not support VMOs,
7523    /// as is the case for ffx tools.
7524    pub fn r#take_file(
7525        &self,
7526        mut payload: ScreenshotTakeFileRequest,
7527        ___deadline: zx::MonotonicInstant,
7528    ) -> Result<ScreenshotTakeFileResponse, fidl::Error> {
7529        let _response =
7530            self.client.send_query::<ScreenshotTakeFileRequest, ScreenshotTakeFileResponse>(
7531                &mut payload,
7532                0x470aeea0a4d32903,
7533                fidl::encoding::DynamicFlags::empty(),
7534                ___deadline,
7535            )?;
7536        Ok(_response)
7537    }
7538}
7539
7540#[cfg(target_os = "fuchsia")]
7541impl From<ScreenshotSynchronousProxy> for zx::Handle {
7542    fn from(value: ScreenshotSynchronousProxy) -> Self {
7543        value.into_channel().into()
7544    }
7545}
7546
7547#[cfg(target_os = "fuchsia")]
7548impl From<fidl::Channel> for ScreenshotSynchronousProxy {
7549    fn from(value: fidl::Channel) -> Self {
7550        Self::new(value)
7551    }
7552}
7553
7554#[cfg(target_os = "fuchsia")]
7555impl fidl::endpoints::FromClient for ScreenshotSynchronousProxy {
7556    type Protocol = ScreenshotMarker;
7557
7558    fn from_client(value: fidl::endpoints::ClientEnd<ScreenshotMarker>) -> Self {
7559        Self::new(value.into_channel())
7560    }
7561}
7562
7563#[derive(Debug, Clone)]
7564pub struct ScreenshotProxy {
7565    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
7566}
7567
7568impl fidl::endpoints::Proxy for ScreenshotProxy {
7569    type Protocol = ScreenshotMarker;
7570
7571    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
7572        Self::new(inner)
7573    }
7574
7575    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
7576        self.client.into_channel().map_err(|client| Self { client })
7577    }
7578
7579    fn as_channel(&self) -> &::fidl::AsyncChannel {
7580        self.client.as_channel()
7581    }
7582}
7583
7584impl ScreenshotProxy {
7585    /// Create a new Proxy for fuchsia.ui.composition/Screenshot.
7586    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
7587        let protocol_name = <ScreenshotMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
7588        Self { client: fidl::client::Client::new(channel, protocol_name) }
7589    }
7590
7591    /// Get a Stream of events from the remote end of the protocol.
7592    ///
7593    /// # Panics
7594    ///
7595    /// Panics if the event stream was already taken.
7596    pub fn take_event_stream(&self) -> ScreenshotEventStream {
7597        ScreenshotEventStream { event_receiver: self.client.take_event_receiver() }
7598    }
7599
7600    /// Collects the current graphical content of a display in a specified buffer `format` in the
7601    /// sRGB color space. Note that the sRGB color space is non-linear, meaning that unit tests
7602    /// doing pixel equality checks making use of non-fully saturated colors should convert to a
7603    /// linear color space.
7604    ///
7605    /// See https://fuchsia.dev/fuchsia-src/concepts/ui/scenic/color_spaces for more information.
7606    ///
7607    /// Screenshot is taken immediately, populated with the display's content from the most recent
7608    /// VSYNC.
7609    ///
7610    /// If the client calls [`Take`] a second time before a first [`Take`] call returns, the server
7611    /// will close the Screenshot connection with a ZX_ERR_SHOULD_WAIT epitaph.
7612    ///
7613    /// If capture fails due to an internal error, the server will close the Screenshot connection
7614    /// with a ZX_ERR_INTERNAL epitaph.
7615    pub fn r#take(
7616        &self,
7617        mut payload: ScreenshotTakeRequest,
7618    ) -> fidl::client::QueryResponseFut<
7619        ScreenshotTakeResponse,
7620        fidl::encoding::DefaultFuchsiaResourceDialect,
7621    > {
7622        ScreenshotProxyInterface::r#take(self, payload)
7623    }
7624
7625    /// Collects the current graphical content of a display in a specified buffer `format` in the
7626    /// sRGB color space. Note that the sRGB color space is non-linear, meaning that unit tests
7627    /// doing pixel equality checks making use of non-fully saturated colors should convert to a
7628    /// linear color space.
7629    ///
7630    /// TODO(https://fxbug.dev/42065844): Link to fuchsia.dev documentation when it's up.
7631    ///
7632    /// Screenshot is taken immediately, populated with the display's content from the most recent
7633    /// VSYNC.
7634    ///
7635    /// If the client calls [`TakeFile`] a second time before a first [`TakeFile`] call returns,
7636    /// the server will close the Screenshot connection with a ZX_ERR_SHOULD_WAIT epitaph.
7637    ///
7638    /// If capture fails due to an internal error, the server will close the Screenshot connection
7639    /// with a ZX_ERR_INTERNAL epitaph.
7640    ///
7641    /// This call should be used if the client is on the host and does not support VMOs,
7642    /// as is the case for ffx tools.
7643    pub fn r#take_file(
7644        &self,
7645        mut payload: ScreenshotTakeFileRequest,
7646    ) -> fidl::client::QueryResponseFut<
7647        ScreenshotTakeFileResponse,
7648        fidl::encoding::DefaultFuchsiaResourceDialect,
7649    > {
7650        ScreenshotProxyInterface::r#take_file(self, payload)
7651    }
7652}
7653
7654impl ScreenshotProxyInterface for ScreenshotProxy {
7655    type TakeResponseFut = fidl::client::QueryResponseFut<
7656        ScreenshotTakeResponse,
7657        fidl::encoding::DefaultFuchsiaResourceDialect,
7658    >;
7659    fn r#take(&self, mut payload: ScreenshotTakeRequest) -> Self::TakeResponseFut {
7660        fn _decode(
7661            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7662        ) -> Result<ScreenshotTakeResponse, fidl::Error> {
7663            let _response = fidl::client::decode_transaction_body::<
7664                ScreenshotTakeResponse,
7665                fidl::encoding::DefaultFuchsiaResourceDialect,
7666                0x51341396e9fd2fd0,
7667            >(_buf?)?;
7668            Ok(_response)
7669        }
7670        self.client.send_query_and_decode::<ScreenshotTakeRequest, ScreenshotTakeResponse>(
7671            &mut payload,
7672            0x51341396e9fd2fd0,
7673            fidl::encoding::DynamicFlags::empty(),
7674            _decode,
7675        )
7676    }
7677
7678    type TakeFileResponseFut = fidl::client::QueryResponseFut<
7679        ScreenshotTakeFileResponse,
7680        fidl::encoding::DefaultFuchsiaResourceDialect,
7681    >;
7682    fn r#take_file(&self, mut payload: ScreenshotTakeFileRequest) -> Self::TakeFileResponseFut {
7683        fn _decode(
7684            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7685        ) -> Result<ScreenshotTakeFileResponse, fidl::Error> {
7686            let _response = fidl::client::decode_transaction_body::<
7687                ScreenshotTakeFileResponse,
7688                fidl::encoding::DefaultFuchsiaResourceDialect,
7689                0x470aeea0a4d32903,
7690            >(_buf?)?;
7691            Ok(_response)
7692        }
7693        self.client.send_query_and_decode::<ScreenshotTakeFileRequest, ScreenshotTakeFileResponse>(
7694            &mut payload,
7695            0x470aeea0a4d32903,
7696            fidl::encoding::DynamicFlags::empty(),
7697            _decode,
7698        )
7699    }
7700}
7701
7702pub struct ScreenshotEventStream {
7703    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
7704}
7705
7706impl std::marker::Unpin for ScreenshotEventStream {}
7707
7708impl futures::stream::FusedStream for ScreenshotEventStream {
7709    fn is_terminated(&self) -> bool {
7710        self.event_receiver.is_terminated()
7711    }
7712}
7713
7714impl futures::Stream for ScreenshotEventStream {
7715    type Item = Result<ScreenshotEvent, fidl::Error>;
7716
7717    fn poll_next(
7718        mut self: std::pin::Pin<&mut Self>,
7719        cx: &mut std::task::Context<'_>,
7720    ) -> std::task::Poll<Option<Self::Item>> {
7721        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
7722            &mut self.event_receiver,
7723            cx
7724        )?) {
7725            Some(buf) => std::task::Poll::Ready(Some(ScreenshotEvent::decode(buf))),
7726            None => std::task::Poll::Ready(None),
7727        }
7728    }
7729}
7730
7731#[derive(Debug)]
7732pub enum ScreenshotEvent {}
7733
7734impl ScreenshotEvent {
7735    /// Decodes a message buffer as a [`ScreenshotEvent`].
7736    fn decode(
7737        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
7738    ) -> Result<ScreenshotEvent, fidl::Error> {
7739        let (bytes, _handles) = buf.split_mut();
7740        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7741        debug_assert_eq!(tx_header.tx_id, 0);
7742        match tx_header.ordinal {
7743            _ => Err(fidl::Error::UnknownOrdinal {
7744                ordinal: tx_header.ordinal,
7745                protocol_name: <ScreenshotMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
7746            }),
7747        }
7748    }
7749}
7750
7751/// A Stream of incoming requests for fuchsia.ui.composition/Screenshot.
7752pub struct ScreenshotRequestStream {
7753    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7754    is_terminated: bool,
7755}
7756
7757impl std::marker::Unpin for ScreenshotRequestStream {}
7758
7759impl futures::stream::FusedStream for ScreenshotRequestStream {
7760    fn is_terminated(&self) -> bool {
7761        self.is_terminated
7762    }
7763}
7764
7765impl fidl::endpoints::RequestStream for ScreenshotRequestStream {
7766    type Protocol = ScreenshotMarker;
7767    type ControlHandle = ScreenshotControlHandle;
7768
7769    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
7770        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
7771    }
7772
7773    fn control_handle(&self) -> Self::ControlHandle {
7774        ScreenshotControlHandle { inner: self.inner.clone() }
7775    }
7776
7777    fn into_inner(
7778        self,
7779    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
7780    {
7781        (self.inner, self.is_terminated)
7782    }
7783
7784    fn from_inner(
7785        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7786        is_terminated: bool,
7787    ) -> Self {
7788        Self { inner, is_terminated }
7789    }
7790}
7791
7792impl futures::Stream for ScreenshotRequestStream {
7793    type Item = Result<ScreenshotRequest, fidl::Error>;
7794
7795    fn poll_next(
7796        mut self: std::pin::Pin<&mut Self>,
7797        cx: &mut std::task::Context<'_>,
7798    ) -> std::task::Poll<Option<Self::Item>> {
7799        let this = &mut *self;
7800        if this.inner.check_shutdown(cx) {
7801            this.is_terminated = true;
7802            return std::task::Poll::Ready(None);
7803        }
7804        if this.is_terminated {
7805            panic!("polled ScreenshotRequestStream after completion");
7806        }
7807        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
7808            |bytes, handles| {
7809                match this.inner.channel().read_etc(cx, bytes, handles) {
7810                    std::task::Poll::Ready(Ok(())) => {}
7811                    std::task::Poll::Pending => return std::task::Poll::Pending,
7812                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
7813                        this.is_terminated = true;
7814                        return std::task::Poll::Ready(None);
7815                    }
7816                    std::task::Poll::Ready(Err(e)) => {
7817                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
7818                            e.into(),
7819                        ))));
7820                    }
7821                }
7822
7823                // A message has been received from the channel
7824                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7825
7826                std::task::Poll::Ready(Some(match header.ordinal {
7827                    0x51341396e9fd2fd0 => {
7828                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7829                        let mut req = fidl::new_empty!(
7830                            ScreenshotTakeRequest,
7831                            fidl::encoding::DefaultFuchsiaResourceDialect
7832                        );
7833                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ScreenshotTakeRequest>(&header, _body_bytes, handles, &mut req)?;
7834                        let control_handle = ScreenshotControlHandle { inner: this.inner.clone() };
7835                        Ok(ScreenshotRequest::Take {
7836                            payload: req,
7837                            responder: ScreenshotTakeResponder {
7838                                control_handle: std::mem::ManuallyDrop::new(control_handle),
7839                                tx_id: header.tx_id,
7840                            },
7841                        })
7842                    }
7843                    0x470aeea0a4d32903 => {
7844                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7845                        let mut req = fidl::new_empty!(
7846                            ScreenshotTakeFileRequest,
7847                            fidl::encoding::DefaultFuchsiaResourceDialect
7848                        );
7849                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ScreenshotTakeFileRequest>(&header, _body_bytes, handles, &mut req)?;
7850                        let control_handle = ScreenshotControlHandle { inner: this.inner.clone() };
7851                        Ok(ScreenshotRequest::TakeFile {
7852                            payload: req,
7853                            responder: ScreenshotTakeFileResponder {
7854                                control_handle: std::mem::ManuallyDrop::new(control_handle),
7855                                tx_id: header.tx_id,
7856                            },
7857                        })
7858                    }
7859                    _ => Err(fidl::Error::UnknownOrdinal {
7860                        ordinal: header.ordinal,
7861                        protocol_name:
7862                            <ScreenshotMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
7863                    }),
7864                }))
7865            },
7866        )
7867    }
7868}
7869
7870/// Collects the current graphical content of a display.
7871#[derive(Debug)]
7872pub enum ScreenshotRequest {
7873    /// Collects the current graphical content of a display in a specified buffer `format` in the
7874    /// sRGB color space. Note that the sRGB color space is non-linear, meaning that unit tests
7875    /// doing pixel equality checks making use of non-fully saturated colors should convert to a
7876    /// linear color space.
7877    ///
7878    /// See https://fuchsia.dev/fuchsia-src/concepts/ui/scenic/color_spaces for more information.
7879    ///
7880    /// Screenshot is taken immediately, populated with the display's content from the most recent
7881    /// VSYNC.
7882    ///
7883    /// If the client calls [`Take`] a second time before a first [`Take`] call returns, the server
7884    /// will close the Screenshot connection with a ZX_ERR_SHOULD_WAIT epitaph.
7885    ///
7886    /// If capture fails due to an internal error, the server will close the Screenshot connection
7887    /// with a ZX_ERR_INTERNAL epitaph.
7888    Take { payload: ScreenshotTakeRequest, responder: ScreenshotTakeResponder },
7889    /// Collects the current graphical content of a display in a specified buffer `format` in the
7890    /// sRGB color space. Note that the sRGB color space is non-linear, meaning that unit tests
7891    /// doing pixel equality checks making use of non-fully saturated colors should convert to a
7892    /// linear color space.
7893    ///
7894    /// TODO(https://fxbug.dev/42065844): Link to fuchsia.dev documentation when it's up.
7895    ///
7896    /// Screenshot is taken immediately, populated with the display's content from the most recent
7897    /// VSYNC.
7898    ///
7899    /// If the client calls [`TakeFile`] a second time before a first [`TakeFile`] call returns,
7900    /// the server will close the Screenshot connection with a ZX_ERR_SHOULD_WAIT epitaph.
7901    ///
7902    /// If capture fails due to an internal error, the server will close the Screenshot connection
7903    /// with a ZX_ERR_INTERNAL epitaph.
7904    ///
7905    /// This call should be used if the client is on the host and does not support VMOs,
7906    /// as is the case for ffx tools.
7907    TakeFile { payload: ScreenshotTakeFileRequest, responder: ScreenshotTakeFileResponder },
7908}
7909
7910impl ScreenshotRequest {
7911    #[allow(irrefutable_let_patterns)]
7912    pub fn into_take(self) -> Option<(ScreenshotTakeRequest, ScreenshotTakeResponder)> {
7913        if let ScreenshotRequest::Take { payload, responder } = self {
7914            Some((payload, responder))
7915        } else {
7916            None
7917        }
7918    }
7919
7920    #[allow(irrefutable_let_patterns)]
7921    pub fn into_take_file(
7922        self,
7923    ) -> Option<(ScreenshotTakeFileRequest, ScreenshotTakeFileResponder)> {
7924        if let ScreenshotRequest::TakeFile { payload, responder } = self {
7925            Some((payload, responder))
7926        } else {
7927            None
7928        }
7929    }
7930
7931    /// Name of the method defined in FIDL
7932    pub fn method_name(&self) -> &'static str {
7933        match *self {
7934            ScreenshotRequest::Take { .. } => "take",
7935            ScreenshotRequest::TakeFile { .. } => "take_file",
7936        }
7937    }
7938}
7939
7940#[derive(Debug, Clone)]
7941pub struct ScreenshotControlHandle {
7942    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7943}
7944
7945impl fidl::endpoints::ControlHandle for ScreenshotControlHandle {
7946    fn shutdown(&self) {
7947        self.inner.shutdown()
7948    }
7949    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
7950        self.inner.shutdown_with_epitaph(status)
7951    }
7952
7953    fn is_closed(&self) -> bool {
7954        self.inner.channel().is_closed()
7955    }
7956    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
7957        self.inner.channel().on_closed()
7958    }
7959
7960    #[cfg(target_os = "fuchsia")]
7961    fn signal_peer(
7962        &self,
7963        clear_mask: zx::Signals,
7964        set_mask: zx::Signals,
7965    ) -> Result<(), zx_status::Status> {
7966        use fidl::Peered;
7967        self.inner.channel().signal_peer(clear_mask, set_mask)
7968    }
7969}
7970
7971impl ScreenshotControlHandle {}
7972
7973#[must_use = "FIDL methods require a response to be sent"]
7974#[derive(Debug)]
7975pub struct ScreenshotTakeResponder {
7976    control_handle: std::mem::ManuallyDrop<ScreenshotControlHandle>,
7977    tx_id: u32,
7978}
7979
7980/// Set the the channel to be shutdown (see [`ScreenshotControlHandle::shutdown`])
7981/// if the responder is dropped without sending a response, so that the client
7982/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7983impl std::ops::Drop for ScreenshotTakeResponder {
7984    fn drop(&mut self) {
7985        self.control_handle.shutdown();
7986        // Safety: drops once, never accessed again
7987        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7988    }
7989}
7990
7991impl fidl::endpoints::Responder for ScreenshotTakeResponder {
7992    type ControlHandle = ScreenshotControlHandle;
7993
7994    fn control_handle(&self) -> &ScreenshotControlHandle {
7995        &self.control_handle
7996    }
7997
7998    fn drop_without_shutdown(mut self) {
7999        // Safety: drops once, never accessed again due to mem::forget
8000        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8001        // Prevent Drop from running (which would shut down the channel)
8002        std::mem::forget(self);
8003    }
8004}
8005
8006impl ScreenshotTakeResponder {
8007    /// Sends a response to the FIDL transaction.
8008    ///
8009    /// Sets the channel to shutdown if an error occurs.
8010    pub fn send(self, mut payload: ScreenshotTakeResponse) -> Result<(), fidl::Error> {
8011        let _result = self.send_raw(payload);
8012        if _result.is_err() {
8013            self.control_handle.shutdown();
8014        }
8015        self.drop_without_shutdown();
8016        _result
8017    }
8018
8019    /// Similar to "send" but does not shutdown the channel if an error occurs.
8020    pub fn send_no_shutdown_on_err(
8021        self,
8022        mut payload: ScreenshotTakeResponse,
8023    ) -> Result<(), fidl::Error> {
8024        let _result = self.send_raw(payload);
8025        self.drop_without_shutdown();
8026        _result
8027    }
8028
8029    fn send_raw(&self, mut payload: ScreenshotTakeResponse) -> Result<(), fidl::Error> {
8030        self.control_handle.inner.send::<ScreenshotTakeResponse>(
8031            &mut payload,
8032            self.tx_id,
8033            0x51341396e9fd2fd0,
8034            fidl::encoding::DynamicFlags::empty(),
8035        )
8036    }
8037}
8038
8039#[must_use = "FIDL methods require a response to be sent"]
8040#[derive(Debug)]
8041pub struct ScreenshotTakeFileResponder {
8042    control_handle: std::mem::ManuallyDrop<ScreenshotControlHandle>,
8043    tx_id: u32,
8044}
8045
8046/// Set the the channel to be shutdown (see [`ScreenshotControlHandle::shutdown`])
8047/// if the responder is dropped without sending a response, so that the client
8048/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
8049impl std::ops::Drop for ScreenshotTakeFileResponder {
8050    fn drop(&mut self) {
8051        self.control_handle.shutdown();
8052        // Safety: drops once, never accessed again
8053        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8054    }
8055}
8056
8057impl fidl::endpoints::Responder for ScreenshotTakeFileResponder {
8058    type ControlHandle = ScreenshotControlHandle;
8059
8060    fn control_handle(&self) -> &ScreenshotControlHandle {
8061        &self.control_handle
8062    }
8063
8064    fn drop_without_shutdown(mut self) {
8065        // Safety: drops once, never accessed again due to mem::forget
8066        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8067        // Prevent Drop from running (which would shut down the channel)
8068        std::mem::forget(self);
8069    }
8070}
8071
8072impl ScreenshotTakeFileResponder {
8073    /// Sends a response to the FIDL transaction.
8074    ///
8075    /// Sets the channel to shutdown if an error occurs.
8076    pub fn send(self, mut payload: ScreenshotTakeFileResponse) -> Result<(), fidl::Error> {
8077        let _result = self.send_raw(payload);
8078        if _result.is_err() {
8079            self.control_handle.shutdown();
8080        }
8081        self.drop_without_shutdown();
8082        _result
8083    }
8084
8085    /// Similar to "send" but does not shutdown the channel if an error occurs.
8086    pub fn send_no_shutdown_on_err(
8087        self,
8088        mut payload: ScreenshotTakeFileResponse,
8089    ) -> Result<(), fidl::Error> {
8090        let _result = self.send_raw(payload);
8091        self.drop_without_shutdown();
8092        _result
8093    }
8094
8095    fn send_raw(&self, mut payload: ScreenshotTakeFileResponse) -> Result<(), fidl::Error> {
8096        self.control_handle.inner.send::<ScreenshotTakeFileResponse>(
8097            &mut payload,
8098            self.tx_id,
8099            0x470aeea0a4d32903,
8100            fidl::encoding::DynamicFlags::empty(),
8101        )
8102    }
8103}
8104
8105#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
8106pub struct TrustedFlatlandFactoryMarker;
8107
8108impl fidl::endpoints::ProtocolMarker for TrustedFlatlandFactoryMarker {
8109    type Proxy = TrustedFlatlandFactoryProxy;
8110    type RequestStream = TrustedFlatlandFactoryRequestStream;
8111    #[cfg(target_os = "fuchsia")]
8112    type SynchronousProxy = TrustedFlatlandFactorySynchronousProxy;
8113
8114    const DEBUG_NAME: &'static str = "fuchsia.ui.composition.TrustedFlatlandFactory";
8115}
8116impl fidl::endpoints::DiscoverableProtocolMarker for TrustedFlatlandFactoryMarker {}
8117pub type TrustedFlatlandFactoryCreateFlatlandResult = Result<(), TrustedFlatlandFactoryError>;
8118
8119pub trait TrustedFlatlandFactoryProxyInterface: Send + Sync {
8120    type CreateFlatlandResponseFut: std::future::Future<
8121            Output = Result<TrustedFlatlandFactoryCreateFlatlandResult, fidl::Error>,
8122        > + Send;
8123    fn r#create_flatland(
8124        &self,
8125        server_end: fidl::endpoints::ServerEnd<FlatlandMarker>,
8126        config: TrustedFlatlandConfig,
8127    ) -> Self::CreateFlatlandResponseFut;
8128}
8129#[derive(Debug)]
8130#[cfg(target_os = "fuchsia")]
8131pub struct TrustedFlatlandFactorySynchronousProxy {
8132    client: fidl::client::sync::Client,
8133}
8134
8135#[cfg(target_os = "fuchsia")]
8136impl fidl::endpoints::SynchronousProxy for TrustedFlatlandFactorySynchronousProxy {
8137    type Proxy = TrustedFlatlandFactoryProxy;
8138    type Protocol = TrustedFlatlandFactoryMarker;
8139
8140    fn from_channel(inner: fidl::Channel) -> Self {
8141        Self::new(inner)
8142    }
8143
8144    fn into_channel(self) -> fidl::Channel {
8145        self.client.into_channel()
8146    }
8147
8148    fn as_channel(&self) -> &fidl::Channel {
8149        self.client.as_channel()
8150    }
8151}
8152
8153#[cfg(target_os = "fuchsia")]
8154impl TrustedFlatlandFactorySynchronousProxy {
8155    pub fn new(channel: fidl::Channel) -> Self {
8156        let protocol_name =
8157            <TrustedFlatlandFactoryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
8158        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
8159    }
8160
8161    pub fn into_channel(self) -> fidl::Channel {
8162        self.client.into_channel()
8163    }
8164
8165    /// Waits until an event arrives and returns it. It is safe for other
8166    /// threads to make concurrent requests while waiting for an event.
8167    pub fn wait_for_event(
8168        &self,
8169        deadline: zx::MonotonicInstant,
8170    ) -> Result<TrustedFlatlandFactoryEvent, fidl::Error> {
8171        TrustedFlatlandFactoryEvent::decode(self.client.wait_for_event(deadline)?)
8172    }
8173
8174    /// Creates a new Flatland instance with the specified configuration.
8175    ///
8176    /// ## Error
8177    ///
8178    /// Returns a `TrustedFlatlandFactoryError` error if the operation fails.
8179    pub fn r#create_flatland(
8180        &self,
8181        mut server_end: fidl::endpoints::ServerEnd<FlatlandMarker>,
8182        mut config: TrustedFlatlandConfig,
8183        ___deadline: zx::MonotonicInstant,
8184    ) -> Result<TrustedFlatlandFactoryCreateFlatlandResult, fidl::Error> {
8185        let _response = self.client.send_query::<
8186            TrustedFlatlandFactoryCreateFlatlandRequest,
8187            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, TrustedFlatlandFactoryError>,
8188        >(
8189            (server_end, &mut config,),
8190            0x48e89c53f00561dc,
8191            fidl::encoding::DynamicFlags::empty(),
8192            ___deadline,
8193        )?;
8194        Ok(_response.map(|x| x))
8195    }
8196}
8197
8198#[cfg(target_os = "fuchsia")]
8199impl From<TrustedFlatlandFactorySynchronousProxy> for zx::Handle {
8200    fn from(value: TrustedFlatlandFactorySynchronousProxy) -> Self {
8201        value.into_channel().into()
8202    }
8203}
8204
8205#[cfg(target_os = "fuchsia")]
8206impl From<fidl::Channel> for TrustedFlatlandFactorySynchronousProxy {
8207    fn from(value: fidl::Channel) -> Self {
8208        Self::new(value)
8209    }
8210}
8211
8212#[cfg(target_os = "fuchsia")]
8213impl fidl::endpoints::FromClient for TrustedFlatlandFactorySynchronousProxy {
8214    type Protocol = TrustedFlatlandFactoryMarker;
8215
8216    fn from_client(value: fidl::endpoints::ClientEnd<TrustedFlatlandFactoryMarker>) -> Self {
8217        Self::new(value.into_channel())
8218    }
8219}
8220
8221#[derive(Debug, Clone)]
8222pub struct TrustedFlatlandFactoryProxy {
8223    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
8224}
8225
8226impl fidl::endpoints::Proxy for TrustedFlatlandFactoryProxy {
8227    type Protocol = TrustedFlatlandFactoryMarker;
8228
8229    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
8230        Self::new(inner)
8231    }
8232
8233    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
8234        self.client.into_channel().map_err(|client| Self { client })
8235    }
8236
8237    fn as_channel(&self) -> &::fidl::AsyncChannel {
8238        self.client.as_channel()
8239    }
8240}
8241
8242impl TrustedFlatlandFactoryProxy {
8243    /// Create a new Proxy for fuchsia.ui.composition/TrustedFlatlandFactory.
8244    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
8245        let protocol_name =
8246            <TrustedFlatlandFactoryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
8247        Self { client: fidl::client::Client::new(channel, protocol_name) }
8248    }
8249
8250    /// Get a Stream of events from the remote end of the protocol.
8251    ///
8252    /// # Panics
8253    ///
8254    /// Panics if the event stream was already taken.
8255    pub fn take_event_stream(&self) -> TrustedFlatlandFactoryEventStream {
8256        TrustedFlatlandFactoryEventStream { event_receiver: self.client.take_event_receiver() }
8257    }
8258
8259    /// Creates a new Flatland instance with the specified configuration.
8260    ///
8261    /// ## Error
8262    ///
8263    /// Returns a `TrustedFlatlandFactoryError` error if the operation fails.
8264    pub fn r#create_flatland(
8265        &self,
8266        mut server_end: fidl::endpoints::ServerEnd<FlatlandMarker>,
8267        mut config: TrustedFlatlandConfig,
8268    ) -> fidl::client::QueryResponseFut<
8269        TrustedFlatlandFactoryCreateFlatlandResult,
8270        fidl::encoding::DefaultFuchsiaResourceDialect,
8271    > {
8272        TrustedFlatlandFactoryProxyInterface::r#create_flatland(self, server_end, config)
8273    }
8274}
8275
8276impl TrustedFlatlandFactoryProxyInterface for TrustedFlatlandFactoryProxy {
8277    type CreateFlatlandResponseFut = fidl::client::QueryResponseFut<
8278        TrustedFlatlandFactoryCreateFlatlandResult,
8279        fidl::encoding::DefaultFuchsiaResourceDialect,
8280    >;
8281    fn r#create_flatland(
8282        &self,
8283        mut server_end: fidl::endpoints::ServerEnd<FlatlandMarker>,
8284        mut config: TrustedFlatlandConfig,
8285    ) -> Self::CreateFlatlandResponseFut {
8286        fn _decode(
8287            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
8288        ) -> Result<TrustedFlatlandFactoryCreateFlatlandResult, fidl::Error> {
8289            let _response = fidl::client::decode_transaction_body::<
8290                fidl::encoding::ResultType<
8291                    fidl::encoding::EmptyStruct,
8292                    TrustedFlatlandFactoryError,
8293                >,
8294                fidl::encoding::DefaultFuchsiaResourceDialect,
8295                0x48e89c53f00561dc,
8296            >(_buf?)?;
8297            Ok(_response.map(|x| x))
8298        }
8299        self.client.send_query_and_decode::<
8300            TrustedFlatlandFactoryCreateFlatlandRequest,
8301            TrustedFlatlandFactoryCreateFlatlandResult,
8302        >(
8303            (server_end, &mut config,),
8304            0x48e89c53f00561dc,
8305            fidl::encoding::DynamicFlags::empty(),
8306            _decode,
8307        )
8308    }
8309}
8310
8311pub struct TrustedFlatlandFactoryEventStream {
8312    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
8313}
8314
8315impl std::marker::Unpin for TrustedFlatlandFactoryEventStream {}
8316
8317impl futures::stream::FusedStream for TrustedFlatlandFactoryEventStream {
8318    fn is_terminated(&self) -> bool {
8319        self.event_receiver.is_terminated()
8320    }
8321}
8322
8323impl futures::Stream for TrustedFlatlandFactoryEventStream {
8324    type Item = Result<TrustedFlatlandFactoryEvent, fidl::Error>;
8325
8326    fn poll_next(
8327        mut self: std::pin::Pin<&mut Self>,
8328        cx: &mut std::task::Context<'_>,
8329    ) -> std::task::Poll<Option<Self::Item>> {
8330        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
8331            &mut self.event_receiver,
8332            cx
8333        )?) {
8334            Some(buf) => std::task::Poll::Ready(Some(TrustedFlatlandFactoryEvent::decode(buf))),
8335            None => std::task::Poll::Ready(None),
8336        }
8337    }
8338}
8339
8340#[derive(Debug)]
8341pub enum TrustedFlatlandFactoryEvent {}
8342
8343impl TrustedFlatlandFactoryEvent {
8344    /// Decodes a message buffer as a [`TrustedFlatlandFactoryEvent`].
8345    fn decode(
8346        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
8347    ) -> Result<TrustedFlatlandFactoryEvent, fidl::Error> {
8348        let (bytes, _handles) = buf.split_mut();
8349        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
8350        debug_assert_eq!(tx_header.tx_id, 0);
8351        match tx_header.ordinal {
8352            _ => Err(fidl::Error::UnknownOrdinal {
8353                ordinal: tx_header.ordinal,
8354                protocol_name:
8355                    <TrustedFlatlandFactoryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
8356            }),
8357        }
8358    }
8359}
8360
8361/// A Stream of incoming requests for fuchsia.ui.composition/TrustedFlatlandFactory.
8362pub struct TrustedFlatlandFactoryRequestStream {
8363    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8364    is_terminated: bool,
8365}
8366
8367impl std::marker::Unpin for TrustedFlatlandFactoryRequestStream {}
8368
8369impl futures::stream::FusedStream for TrustedFlatlandFactoryRequestStream {
8370    fn is_terminated(&self) -> bool {
8371        self.is_terminated
8372    }
8373}
8374
8375impl fidl::endpoints::RequestStream for TrustedFlatlandFactoryRequestStream {
8376    type Protocol = TrustedFlatlandFactoryMarker;
8377    type ControlHandle = TrustedFlatlandFactoryControlHandle;
8378
8379    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
8380        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
8381    }
8382
8383    fn control_handle(&self) -> Self::ControlHandle {
8384        TrustedFlatlandFactoryControlHandle { inner: self.inner.clone() }
8385    }
8386
8387    fn into_inner(
8388        self,
8389    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
8390    {
8391        (self.inner, self.is_terminated)
8392    }
8393
8394    fn from_inner(
8395        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8396        is_terminated: bool,
8397    ) -> Self {
8398        Self { inner, is_terminated }
8399    }
8400}
8401
8402impl futures::Stream for TrustedFlatlandFactoryRequestStream {
8403    type Item = Result<TrustedFlatlandFactoryRequest, fidl::Error>;
8404
8405    fn poll_next(
8406        mut self: std::pin::Pin<&mut Self>,
8407        cx: &mut std::task::Context<'_>,
8408    ) -> std::task::Poll<Option<Self::Item>> {
8409        let this = &mut *self;
8410        if this.inner.check_shutdown(cx) {
8411            this.is_terminated = true;
8412            return std::task::Poll::Ready(None);
8413        }
8414        if this.is_terminated {
8415            panic!("polled TrustedFlatlandFactoryRequestStream after completion");
8416        }
8417        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
8418            |bytes, handles| {
8419                match this.inner.channel().read_etc(cx, bytes, handles) {
8420                    std::task::Poll::Ready(Ok(())) => {}
8421                    std::task::Poll::Pending => return std::task::Poll::Pending,
8422                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
8423                        this.is_terminated = true;
8424                        return std::task::Poll::Ready(None);
8425                    }
8426                    std::task::Poll::Ready(Err(e)) => {
8427                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
8428                            e.into(),
8429                        ))));
8430                    }
8431                }
8432
8433                // A message has been received from the channel
8434                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
8435
8436                std::task::Poll::Ready(Some(match header.ordinal {
8437                0x48e89c53f00561dc => {
8438                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
8439                    let mut req = fidl::new_empty!(TrustedFlatlandFactoryCreateFlatlandRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
8440                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<TrustedFlatlandFactoryCreateFlatlandRequest>(&header, _body_bytes, handles, &mut req)?;
8441                    let control_handle = TrustedFlatlandFactoryControlHandle {
8442                        inner: this.inner.clone(),
8443                    };
8444                    Ok(TrustedFlatlandFactoryRequest::CreateFlatland {server_end: req.server_end,
8445config: req.config,
8446
8447                        responder: TrustedFlatlandFactoryCreateFlatlandResponder {
8448                            control_handle: std::mem::ManuallyDrop::new(control_handle),
8449                            tx_id: header.tx_id,
8450                        },
8451                    })
8452                }
8453                _ => Err(fidl::Error::UnknownOrdinal {
8454                    ordinal: header.ordinal,
8455                    protocol_name: <TrustedFlatlandFactoryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
8456                }),
8457            }))
8458            },
8459        )
8460    }
8461}
8462
8463/// A privileged factory for creating Flatland instances with special configurations.
8464///
8465/// This protocol is intended for trusted clients that require fine-grained control over
8466/// Flatland's behavior for performance-critical applications. It is not intended for
8467/// general use. Misuse of this API can negatively impact system performance and stability.
8468#[derive(Debug)]
8469pub enum TrustedFlatlandFactoryRequest {
8470    /// Creates a new Flatland instance with the specified configuration.
8471    ///
8472    /// ## Error
8473    ///
8474    /// Returns a `TrustedFlatlandFactoryError` error if the operation fails.
8475    CreateFlatland {
8476        server_end: fidl::endpoints::ServerEnd<FlatlandMarker>,
8477        config: TrustedFlatlandConfig,
8478        responder: TrustedFlatlandFactoryCreateFlatlandResponder,
8479    },
8480}
8481
8482impl TrustedFlatlandFactoryRequest {
8483    #[allow(irrefutable_let_patterns)]
8484    pub fn into_create_flatland(
8485        self,
8486    ) -> Option<(
8487        fidl::endpoints::ServerEnd<FlatlandMarker>,
8488        TrustedFlatlandConfig,
8489        TrustedFlatlandFactoryCreateFlatlandResponder,
8490    )> {
8491        if let TrustedFlatlandFactoryRequest::CreateFlatland { server_end, config, responder } =
8492            self
8493        {
8494            Some((server_end, config, responder))
8495        } else {
8496            None
8497        }
8498    }
8499
8500    /// Name of the method defined in FIDL
8501    pub fn method_name(&self) -> &'static str {
8502        match *self {
8503            TrustedFlatlandFactoryRequest::CreateFlatland { .. } => "create_flatland",
8504        }
8505    }
8506}
8507
8508#[derive(Debug, Clone)]
8509pub struct TrustedFlatlandFactoryControlHandle {
8510    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8511}
8512
8513impl fidl::endpoints::ControlHandle for TrustedFlatlandFactoryControlHandle {
8514    fn shutdown(&self) {
8515        self.inner.shutdown()
8516    }
8517    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
8518        self.inner.shutdown_with_epitaph(status)
8519    }
8520
8521    fn is_closed(&self) -> bool {
8522        self.inner.channel().is_closed()
8523    }
8524    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
8525        self.inner.channel().on_closed()
8526    }
8527
8528    #[cfg(target_os = "fuchsia")]
8529    fn signal_peer(
8530        &self,
8531        clear_mask: zx::Signals,
8532        set_mask: zx::Signals,
8533    ) -> Result<(), zx_status::Status> {
8534        use fidl::Peered;
8535        self.inner.channel().signal_peer(clear_mask, set_mask)
8536    }
8537}
8538
8539impl TrustedFlatlandFactoryControlHandle {}
8540
8541#[must_use = "FIDL methods require a response to be sent"]
8542#[derive(Debug)]
8543pub struct TrustedFlatlandFactoryCreateFlatlandResponder {
8544    control_handle: std::mem::ManuallyDrop<TrustedFlatlandFactoryControlHandle>,
8545    tx_id: u32,
8546}
8547
8548/// Set the the channel to be shutdown (see [`TrustedFlatlandFactoryControlHandle::shutdown`])
8549/// if the responder is dropped without sending a response, so that the client
8550/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
8551impl std::ops::Drop for TrustedFlatlandFactoryCreateFlatlandResponder {
8552    fn drop(&mut self) {
8553        self.control_handle.shutdown();
8554        // Safety: drops once, never accessed again
8555        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8556    }
8557}
8558
8559impl fidl::endpoints::Responder for TrustedFlatlandFactoryCreateFlatlandResponder {
8560    type ControlHandle = TrustedFlatlandFactoryControlHandle;
8561
8562    fn control_handle(&self) -> &TrustedFlatlandFactoryControlHandle {
8563        &self.control_handle
8564    }
8565
8566    fn drop_without_shutdown(mut self) {
8567        // Safety: drops once, never accessed again due to mem::forget
8568        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8569        // Prevent Drop from running (which would shut down the channel)
8570        std::mem::forget(self);
8571    }
8572}
8573
8574impl TrustedFlatlandFactoryCreateFlatlandResponder {
8575    /// Sends a response to the FIDL transaction.
8576    ///
8577    /// Sets the channel to shutdown if an error occurs.
8578    pub fn send(
8579        self,
8580        mut result: Result<(), TrustedFlatlandFactoryError>,
8581    ) -> Result<(), fidl::Error> {
8582        let _result = self.send_raw(result);
8583        if _result.is_err() {
8584            self.control_handle.shutdown();
8585        }
8586        self.drop_without_shutdown();
8587        _result
8588    }
8589
8590    /// Similar to "send" but does not shutdown the channel if an error occurs.
8591    pub fn send_no_shutdown_on_err(
8592        self,
8593        mut result: Result<(), TrustedFlatlandFactoryError>,
8594    ) -> Result<(), fidl::Error> {
8595        let _result = self.send_raw(result);
8596        self.drop_without_shutdown();
8597        _result
8598    }
8599
8600    fn send_raw(
8601        &self,
8602        mut result: Result<(), TrustedFlatlandFactoryError>,
8603    ) -> Result<(), fidl::Error> {
8604        self.control_handle.inner.send::<fidl::encoding::ResultType<
8605            fidl::encoding::EmptyStruct,
8606            TrustedFlatlandFactoryError,
8607        >>(
8608            result,
8609            self.tx_id,
8610            0x48e89c53f00561dc,
8611            fidl::encoding::DynamicFlags::empty(),
8612        )
8613    }
8614}
8615
8616mod internal {
8617    use super::*;
8618
8619    impl fidl::encoding::ResourceTypeMarker for AllocatorRegisterBufferCollectionRequest {
8620        type Borrowed<'a> = &'a mut Self;
8621        fn take_or_borrow<'a>(
8622            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
8623        ) -> Self::Borrowed<'a> {
8624            value
8625        }
8626    }
8627
8628    unsafe impl fidl::encoding::TypeMarker for AllocatorRegisterBufferCollectionRequest {
8629        type Owned = Self;
8630
8631        #[inline(always)]
8632        fn inline_align(_context: fidl::encoding::Context) -> usize {
8633            8
8634        }
8635
8636        #[inline(always)]
8637        fn inline_size(_context: fidl::encoding::Context) -> usize {
8638            16
8639        }
8640    }
8641
8642    unsafe impl
8643        fidl::encoding::Encode<
8644            AllocatorRegisterBufferCollectionRequest,
8645            fidl::encoding::DefaultFuchsiaResourceDialect,
8646        > for &mut AllocatorRegisterBufferCollectionRequest
8647    {
8648        #[inline]
8649        unsafe fn encode(
8650            self,
8651            encoder: &mut fidl::encoding::Encoder<
8652                '_,
8653                fidl::encoding::DefaultFuchsiaResourceDialect,
8654            >,
8655            offset: usize,
8656            _depth: fidl::encoding::Depth,
8657        ) -> fidl::Result<()> {
8658            encoder.debug_check_bounds::<AllocatorRegisterBufferCollectionRequest>(offset);
8659            // Delegate to tuple encoding.
8660            fidl::encoding::Encode::<AllocatorRegisterBufferCollectionRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
8661                (
8662                    <RegisterBufferCollectionArgs as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.args),
8663                ),
8664                encoder, offset, _depth
8665            )
8666        }
8667    }
8668    unsafe impl<
8669        T0: fidl::encoding::Encode<
8670                RegisterBufferCollectionArgs,
8671                fidl::encoding::DefaultFuchsiaResourceDialect,
8672            >,
8673    >
8674        fidl::encoding::Encode<
8675            AllocatorRegisterBufferCollectionRequest,
8676            fidl::encoding::DefaultFuchsiaResourceDialect,
8677        > for (T0,)
8678    {
8679        #[inline]
8680        unsafe fn encode(
8681            self,
8682            encoder: &mut fidl::encoding::Encoder<
8683                '_,
8684                fidl::encoding::DefaultFuchsiaResourceDialect,
8685            >,
8686            offset: usize,
8687            depth: fidl::encoding::Depth,
8688        ) -> fidl::Result<()> {
8689            encoder.debug_check_bounds::<AllocatorRegisterBufferCollectionRequest>(offset);
8690            // Zero out padding regions. There's no need to apply masks
8691            // because the unmasked parts will be overwritten by fields.
8692            // Write the fields.
8693            self.0.encode(encoder, offset + 0, depth)?;
8694            Ok(())
8695        }
8696    }
8697
8698    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
8699        for AllocatorRegisterBufferCollectionRequest
8700    {
8701        #[inline(always)]
8702        fn new_empty() -> Self {
8703            Self {
8704                args: fidl::new_empty!(
8705                    RegisterBufferCollectionArgs,
8706                    fidl::encoding::DefaultFuchsiaResourceDialect
8707                ),
8708            }
8709        }
8710
8711        #[inline]
8712        unsafe fn decode(
8713            &mut self,
8714            decoder: &mut fidl::encoding::Decoder<
8715                '_,
8716                fidl::encoding::DefaultFuchsiaResourceDialect,
8717            >,
8718            offset: usize,
8719            _depth: fidl::encoding::Depth,
8720        ) -> fidl::Result<()> {
8721            decoder.debug_check_bounds::<Self>(offset);
8722            // Verify that padding bytes are zero.
8723            fidl::decode!(
8724                RegisterBufferCollectionArgs,
8725                fidl::encoding::DefaultFuchsiaResourceDialect,
8726                &mut self.args,
8727                decoder,
8728                offset + 0,
8729                _depth
8730            )?;
8731            Ok(())
8732        }
8733    }
8734
8735    impl fidl::encoding::ResourceTypeMarker for BufferCollectionExportToken {
8736        type Borrowed<'a> = &'a mut Self;
8737        fn take_or_borrow<'a>(
8738            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
8739        ) -> Self::Borrowed<'a> {
8740            value
8741        }
8742    }
8743
8744    unsafe impl fidl::encoding::TypeMarker for BufferCollectionExportToken {
8745        type Owned = Self;
8746
8747        #[inline(always)]
8748        fn inline_align(_context: fidl::encoding::Context) -> usize {
8749            4
8750        }
8751
8752        #[inline(always)]
8753        fn inline_size(_context: fidl::encoding::Context) -> usize {
8754            4
8755        }
8756    }
8757
8758    unsafe impl
8759        fidl::encoding::Encode<
8760            BufferCollectionExportToken,
8761            fidl::encoding::DefaultFuchsiaResourceDialect,
8762        > for &mut BufferCollectionExportToken
8763    {
8764        #[inline]
8765        unsafe fn encode(
8766            self,
8767            encoder: &mut fidl::encoding::Encoder<
8768                '_,
8769                fidl::encoding::DefaultFuchsiaResourceDialect,
8770            >,
8771            offset: usize,
8772            _depth: fidl::encoding::Depth,
8773        ) -> fidl::Result<()> {
8774            encoder.debug_check_bounds::<BufferCollectionExportToken>(offset);
8775            // Delegate to tuple encoding.
8776            fidl::encoding::Encode::<
8777                BufferCollectionExportToken,
8778                fidl::encoding::DefaultFuchsiaResourceDialect,
8779            >::encode(
8780                (<fidl::encoding::HandleType<
8781                    fidl::EventPair,
8782                    { fidl::ObjectType::EVENTPAIR.into_raw() },
8783                    2147483648,
8784                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
8785                    &mut self.value
8786                ),),
8787                encoder,
8788                offset,
8789                _depth,
8790            )
8791        }
8792    }
8793    unsafe impl<
8794        T0: fidl::encoding::Encode<
8795                fidl::encoding::HandleType<
8796                    fidl::EventPair,
8797                    { fidl::ObjectType::EVENTPAIR.into_raw() },
8798                    2147483648,
8799                >,
8800                fidl::encoding::DefaultFuchsiaResourceDialect,
8801            >,
8802    >
8803        fidl::encoding::Encode<
8804            BufferCollectionExportToken,
8805            fidl::encoding::DefaultFuchsiaResourceDialect,
8806        > for (T0,)
8807    {
8808        #[inline]
8809        unsafe fn encode(
8810            self,
8811            encoder: &mut fidl::encoding::Encoder<
8812                '_,
8813                fidl::encoding::DefaultFuchsiaResourceDialect,
8814            >,
8815            offset: usize,
8816            depth: fidl::encoding::Depth,
8817        ) -> fidl::Result<()> {
8818            encoder.debug_check_bounds::<BufferCollectionExportToken>(offset);
8819            // Zero out padding regions. There's no need to apply masks
8820            // because the unmasked parts will be overwritten by fields.
8821            // Write the fields.
8822            self.0.encode(encoder, offset + 0, depth)?;
8823            Ok(())
8824        }
8825    }
8826
8827    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
8828        for BufferCollectionExportToken
8829    {
8830        #[inline(always)]
8831        fn new_empty() -> Self {
8832            Self {
8833                value: fidl::new_empty!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
8834            }
8835        }
8836
8837        #[inline]
8838        unsafe fn decode(
8839            &mut self,
8840            decoder: &mut fidl::encoding::Decoder<
8841                '_,
8842                fidl::encoding::DefaultFuchsiaResourceDialect,
8843            >,
8844            offset: usize,
8845            _depth: fidl::encoding::Depth,
8846        ) -> fidl::Result<()> {
8847            decoder.debug_check_bounds::<Self>(offset);
8848            // Verify that padding bytes are zero.
8849            fidl::decode!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.value, decoder, offset + 0, _depth)?;
8850            Ok(())
8851        }
8852    }
8853
8854    impl fidl::encoding::ResourceTypeMarker for BufferCollectionImportToken {
8855        type Borrowed<'a> = &'a mut Self;
8856        fn take_or_borrow<'a>(
8857            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
8858        ) -> Self::Borrowed<'a> {
8859            value
8860        }
8861    }
8862
8863    unsafe impl fidl::encoding::TypeMarker for BufferCollectionImportToken {
8864        type Owned = Self;
8865
8866        #[inline(always)]
8867        fn inline_align(_context: fidl::encoding::Context) -> usize {
8868            4
8869        }
8870
8871        #[inline(always)]
8872        fn inline_size(_context: fidl::encoding::Context) -> usize {
8873            4
8874        }
8875    }
8876
8877    unsafe impl
8878        fidl::encoding::Encode<
8879            BufferCollectionImportToken,
8880            fidl::encoding::DefaultFuchsiaResourceDialect,
8881        > for &mut BufferCollectionImportToken
8882    {
8883        #[inline]
8884        unsafe fn encode(
8885            self,
8886            encoder: &mut fidl::encoding::Encoder<
8887                '_,
8888                fidl::encoding::DefaultFuchsiaResourceDialect,
8889            >,
8890            offset: usize,
8891            _depth: fidl::encoding::Depth,
8892        ) -> fidl::Result<()> {
8893            encoder.debug_check_bounds::<BufferCollectionImportToken>(offset);
8894            // Delegate to tuple encoding.
8895            fidl::encoding::Encode::<
8896                BufferCollectionImportToken,
8897                fidl::encoding::DefaultFuchsiaResourceDialect,
8898            >::encode(
8899                (<fidl::encoding::HandleType<
8900                    fidl::EventPair,
8901                    { fidl::ObjectType::EVENTPAIR.into_raw() },
8902                    2147483648,
8903                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
8904                    &mut self.value
8905                ),),
8906                encoder,
8907                offset,
8908                _depth,
8909            )
8910        }
8911    }
8912    unsafe impl<
8913        T0: fidl::encoding::Encode<
8914                fidl::encoding::HandleType<
8915                    fidl::EventPair,
8916                    { fidl::ObjectType::EVENTPAIR.into_raw() },
8917                    2147483648,
8918                >,
8919                fidl::encoding::DefaultFuchsiaResourceDialect,
8920            >,
8921    >
8922        fidl::encoding::Encode<
8923            BufferCollectionImportToken,
8924            fidl::encoding::DefaultFuchsiaResourceDialect,
8925        > for (T0,)
8926    {
8927        #[inline]
8928        unsafe fn encode(
8929            self,
8930            encoder: &mut fidl::encoding::Encoder<
8931                '_,
8932                fidl::encoding::DefaultFuchsiaResourceDialect,
8933            >,
8934            offset: usize,
8935            depth: fidl::encoding::Depth,
8936        ) -> fidl::Result<()> {
8937            encoder.debug_check_bounds::<BufferCollectionImportToken>(offset);
8938            // Zero out padding regions. There's no need to apply masks
8939            // because the unmasked parts will be overwritten by fields.
8940            // Write the fields.
8941            self.0.encode(encoder, offset + 0, depth)?;
8942            Ok(())
8943        }
8944    }
8945
8946    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
8947        for BufferCollectionImportToken
8948    {
8949        #[inline(always)]
8950        fn new_empty() -> Self {
8951            Self {
8952                value: fidl::new_empty!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
8953            }
8954        }
8955
8956        #[inline]
8957        unsafe fn decode(
8958            &mut self,
8959            decoder: &mut fidl::encoding::Decoder<
8960                '_,
8961                fidl::encoding::DefaultFuchsiaResourceDialect,
8962            >,
8963            offset: usize,
8964            _depth: fidl::encoding::Depth,
8965        ) -> fidl::Result<()> {
8966            decoder.debug_check_bounds::<Self>(offset);
8967            // Verify that padding bytes are zero.
8968            fidl::decode!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.value, decoder, offset + 0, _depth)?;
8969            Ok(())
8970        }
8971    }
8972
8973    impl fidl::encoding::ResourceTypeMarker for ChildViewWatcherGetViewRefResponse {
8974        type Borrowed<'a> = &'a mut Self;
8975        fn take_or_borrow<'a>(
8976            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
8977        ) -> Self::Borrowed<'a> {
8978            value
8979        }
8980    }
8981
8982    unsafe impl fidl::encoding::TypeMarker for ChildViewWatcherGetViewRefResponse {
8983        type Owned = Self;
8984
8985        #[inline(always)]
8986        fn inline_align(_context: fidl::encoding::Context) -> usize {
8987            4
8988        }
8989
8990        #[inline(always)]
8991        fn inline_size(_context: fidl::encoding::Context) -> usize {
8992            4
8993        }
8994    }
8995
8996    unsafe impl
8997        fidl::encoding::Encode<
8998            ChildViewWatcherGetViewRefResponse,
8999            fidl::encoding::DefaultFuchsiaResourceDialect,
9000        > for &mut ChildViewWatcherGetViewRefResponse
9001    {
9002        #[inline]
9003        unsafe fn encode(
9004            self,
9005            encoder: &mut fidl::encoding::Encoder<
9006                '_,
9007                fidl::encoding::DefaultFuchsiaResourceDialect,
9008            >,
9009            offset: usize,
9010            _depth: fidl::encoding::Depth,
9011        ) -> fidl::Result<()> {
9012            encoder.debug_check_bounds::<ChildViewWatcherGetViewRefResponse>(offset);
9013            // Delegate to tuple encoding.
9014            fidl::encoding::Encode::<ChildViewWatcherGetViewRefResponse, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
9015                (
9016                    <fidl_fuchsia_ui_views::ViewRef as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.view_ref),
9017                ),
9018                encoder, offset, _depth
9019            )
9020        }
9021    }
9022    unsafe impl<
9023        T0: fidl::encoding::Encode<
9024                fidl_fuchsia_ui_views::ViewRef,
9025                fidl::encoding::DefaultFuchsiaResourceDialect,
9026            >,
9027    >
9028        fidl::encoding::Encode<
9029            ChildViewWatcherGetViewRefResponse,
9030            fidl::encoding::DefaultFuchsiaResourceDialect,
9031        > for (T0,)
9032    {
9033        #[inline]
9034        unsafe fn encode(
9035            self,
9036            encoder: &mut fidl::encoding::Encoder<
9037                '_,
9038                fidl::encoding::DefaultFuchsiaResourceDialect,
9039            >,
9040            offset: usize,
9041            depth: fidl::encoding::Depth,
9042        ) -> fidl::Result<()> {
9043            encoder.debug_check_bounds::<ChildViewWatcherGetViewRefResponse>(offset);
9044            // Zero out padding regions. There's no need to apply masks
9045            // because the unmasked parts will be overwritten by fields.
9046            // Write the fields.
9047            self.0.encode(encoder, offset + 0, depth)?;
9048            Ok(())
9049        }
9050    }
9051
9052    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
9053        for ChildViewWatcherGetViewRefResponse
9054    {
9055        #[inline(always)]
9056        fn new_empty() -> Self {
9057            Self {
9058                view_ref: fidl::new_empty!(
9059                    fidl_fuchsia_ui_views::ViewRef,
9060                    fidl::encoding::DefaultFuchsiaResourceDialect
9061                ),
9062            }
9063        }
9064
9065        #[inline]
9066        unsafe fn decode(
9067            &mut self,
9068            decoder: &mut fidl::encoding::Decoder<
9069                '_,
9070                fidl::encoding::DefaultFuchsiaResourceDialect,
9071            >,
9072            offset: usize,
9073            _depth: fidl::encoding::Depth,
9074        ) -> fidl::Result<()> {
9075            decoder.debug_check_bounds::<Self>(offset);
9076            // Verify that padding bytes are zero.
9077            fidl::decode!(
9078                fidl_fuchsia_ui_views::ViewRef,
9079                fidl::encoding::DefaultFuchsiaResourceDialect,
9080                &mut self.view_ref,
9081                decoder,
9082                offset + 0,
9083                _depth
9084            )?;
9085            Ok(())
9086        }
9087    }
9088
9089    impl fidl::encoding::ResourceTypeMarker for FlatlandCreateFilledRectRequest {
9090        type Borrowed<'a> = &'a mut Self;
9091        fn take_or_borrow<'a>(
9092            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9093        ) -> Self::Borrowed<'a> {
9094            value
9095        }
9096    }
9097
9098    unsafe impl fidl::encoding::TypeMarker for FlatlandCreateFilledRectRequest {
9099        type Owned = Self;
9100
9101        #[inline(always)]
9102        fn inline_align(_context: fidl::encoding::Context) -> usize {
9103            8
9104        }
9105
9106        #[inline(always)]
9107        fn inline_size(_context: fidl::encoding::Context) -> usize {
9108            8
9109        }
9110        #[inline(always)]
9111        fn encode_is_copy() -> bool {
9112            true
9113        }
9114
9115        #[inline(always)]
9116        fn decode_is_copy() -> bool {
9117            true
9118        }
9119    }
9120
9121    unsafe impl
9122        fidl::encoding::Encode<
9123            FlatlandCreateFilledRectRequest,
9124            fidl::encoding::DefaultFuchsiaResourceDialect,
9125        > for &mut FlatlandCreateFilledRectRequest
9126    {
9127        #[inline]
9128        unsafe fn encode(
9129            self,
9130            encoder: &mut fidl::encoding::Encoder<
9131                '_,
9132                fidl::encoding::DefaultFuchsiaResourceDialect,
9133            >,
9134            offset: usize,
9135            _depth: fidl::encoding::Depth,
9136        ) -> fidl::Result<()> {
9137            encoder.debug_check_bounds::<FlatlandCreateFilledRectRequest>(offset);
9138            unsafe {
9139                // Copy the object into the buffer.
9140                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
9141                (buf_ptr as *mut FlatlandCreateFilledRectRequest)
9142                    .write_unaligned((self as *const FlatlandCreateFilledRectRequest).read());
9143                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
9144                // done second because the memcpy will write garbage to these bytes.
9145            }
9146            Ok(())
9147        }
9148    }
9149    unsafe impl<
9150        T0: fidl::encoding::Encode<ContentId, fidl::encoding::DefaultFuchsiaResourceDialect>,
9151    >
9152        fidl::encoding::Encode<
9153            FlatlandCreateFilledRectRequest,
9154            fidl::encoding::DefaultFuchsiaResourceDialect,
9155        > for (T0,)
9156    {
9157        #[inline]
9158        unsafe fn encode(
9159            self,
9160            encoder: &mut fidl::encoding::Encoder<
9161                '_,
9162                fidl::encoding::DefaultFuchsiaResourceDialect,
9163            >,
9164            offset: usize,
9165            depth: fidl::encoding::Depth,
9166        ) -> fidl::Result<()> {
9167            encoder.debug_check_bounds::<FlatlandCreateFilledRectRequest>(offset);
9168            // Zero out padding regions. There's no need to apply masks
9169            // because the unmasked parts will be overwritten by fields.
9170            // Write the fields.
9171            self.0.encode(encoder, offset + 0, depth)?;
9172            Ok(())
9173        }
9174    }
9175
9176    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
9177        for FlatlandCreateFilledRectRequest
9178    {
9179        #[inline(always)]
9180        fn new_empty() -> Self {
9181            Self {
9182                rect_id: fidl::new_empty!(ContentId, fidl::encoding::DefaultFuchsiaResourceDialect),
9183            }
9184        }
9185
9186        #[inline]
9187        unsafe fn decode(
9188            &mut self,
9189            decoder: &mut fidl::encoding::Decoder<
9190                '_,
9191                fidl::encoding::DefaultFuchsiaResourceDialect,
9192            >,
9193            offset: usize,
9194            _depth: fidl::encoding::Depth,
9195        ) -> fidl::Result<()> {
9196            decoder.debug_check_bounds::<Self>(offset);
9197            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
9198            // Verify that padding bytes are zero.
9199            // Copy from the buffer into the object.
9200            unsafe {
9201                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
9202            }
9203            Ok(())
9204        }
9205    }
9206
9207    impl fidl::encoding::ResourceTypeMarker for FlatlandCreateImageRequest {
9208        type Borrowed<'a> = &'a mut Self;
9209        fn take_or_borrow<'a>(
9210            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9211        ) -> Self::Borrowed<'a> {
9212            value
9213        }
9214    }
9215
9216    unsafe impl fidl::encoding::TypeMarker for FlatlandCreateImageRequest {
9217        type Owned = Self;
9218
9219        #[inline(always)]
9220        fn inline_align(_context: fidl::encoding::Context) -> usize {
9221            8
9222        }
9223
9224        #[inline(always)]
9225        fn inline_size(_context: fidl::encoding::Context) -> usize {
9226            32
9227        }
9228    }
9229
9230    unsafe impl
9231        fidl::encoding::Encode<
9232            FlatlandCreateImageRequest,
9233            fidl::encoding::DefaultFuchsiaResourceDialect,
9234        > for &mut FlatlandCreateImageRequest
9235    {
9236        #[inline]
9237        unsafe fn encode(
9238            self,
9239            encoder: &mut fidl::encoding::Encoder<
9240                '_,
9241                fidl::encoding::DefaultFuchsiaResourceDialect,
9242            >,
9243            offset: usize,
9244            _depth: fidl::encoding::Depth,
9245        ) -> fidl::Result<()> {
9246            encoder.debug_check_bounds::<FlatlandCreateImageRequest>(offset);
9247            // Delegate to tuple encoding.
9248            fidl::encoding::Encode::<FlatlandCreateImageRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
9249                (
9250                    <ContentId as fidl::encoding::ValueTypeMarker>::borrow(&self.image_id),
9251                    <BufferCollectionImportToken as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.import_token),
9252                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.vmo_index),
9253                    <ImageProperties as fidl::encoding::ValueTypeMarker>::borrow(&self.properties),
9254                ),
9255                encoder, offset, _depth
9256            )
9257        }
9258    }
9259    unsafe impl<
9260        T0: fidl::encoding::Encode<ContentId, fidl::encoding::DefaultFuchsiaResourceDialect>,
9261        T1: fidl::encoding::Encode<
9262                BufferCollectionImportToken,
9263                fidl::encoding::DefaultFuchsiaResourceDialect,
9264            >,
9265        T2: fidl::encoding::Encode<u32, fidl::encoding::DefaultFuchsiaResourceDialect>,
9266        T3: fidl::encoding::Encode<ImageProperties, fidl::encoding::DefaultFuchsiaResourceDialect>,
9267    >
9268        fidl::encoding::Encode<
9269            FlatlandCreateImageRequest,
9270            fidl::encoding::DefaultFuchsiaResourceDialect,
9271        > for (T0, T1, T2, T3)
9272    {
9273        #[inline]
9274        unsafe fn encode(
9275            self,
9276            encoder: &mut fidl::encoding::Encoder<
9277                '_,
9278                fidl::encoding::DefaultFuchsiaResourceDialect,
9279            >,
9280            offset: usize,
9281            depth: fidl::encoding::Depth,
9282        ) -> fidl::Result<()> {
9283            encoder.debug_check_bounds::<FlatlandCreateImageRequest>(offset);
9284            // Zero out padding regions. There's no need to apply masks
9285            // because the unmasked parts will be overwritten by fields.
9286            // Write the fields.
9287            self.0.encode(encoder, offset + 0, depth)?;
9288            self.1.encode(encoder, offset + 8, depth)?;
9289            self.2.encode(encoder, offset + 12, depth)?;
9290            self.3.encode(encoder, offset + 16, depth)?;
9291            Ok(())
9292        }
9293    }
9294
9295    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
9296        for FlatlandCreateImageRequest
9297    {
9298        #[inline(always)]
9299        fn new_empty() -> Self {
9300            Self {
9301                image_id: fidl::new_empty!(
9302                    ContentId,
9303                    fidl::encoding::DefaultFuchsiaResourceDialect
9304                ),
9305                import_token: fidl::new_empty!(
9306                    BufferCollectionImportToken,
9307                    fidl::encoding::DefaultFuchsiaResourceDialect
9308                ),
9309                vmo_index: fidl::new_empty!(u32, fidl::encoding::DefaultFuchsiaResourceDialect),
9310                properties: fidl::new_empty!(
9311                    ImageProperties,
9312                    fidl::encoding::DefaultFuchsiaResourceDialect
9313                ),
9314            }
9315        }
9316
9317        #[inline]
9318        unsafe fn decode(
9319            &mut self,
9320            decoder: &mut fidl::encoding::Decoder<
9321                '_,
9322                fidl::encoding::DefaultFuchsiaResourceDialect,
9323            >,
9324            offset: usize,
9325            _depth: fidl::encoding::Depth,
9326        ) -> fidl::Result<()> {
9327            decoder.debug_check_bounds::<Self>(offset);
9328            // Verify that padding bytes are zero.
9329            fidl::decode!(
9330                ContentId,
9331                fidl::encoding::DefaultFuchsiaResourceDialect,
9332                &mut self.image_id,
9333                decoder,
9334                offset + 0,
9335                _depth
9336            )?;
9337            fidl::decode!(
9338                BufferCollectionImportToken,
9339                fidl::encoding::DefaultFuchsiaResourceDialect,
9340                &mut self.import_token,
9341                decoder,
9342                offset + 8,
9343                _depth
9344            )?;
9345            fidl::decode!(
9346                u32,
9347                fidl::encoding::DefaultFuchsiaResourceDialect,
9348                &mut self.vmo_index,
9349                decoder,
9350                offset + 12,
9351                _depth
9352            )?;
9353            fidl::decode!(
9354                ImageProperties,
9355                fidl::encoding::DefaultFuchsiaResourceDialect,
9356                &mut self.properties,
9357                decoder,
9358                offset + 16,
9359                _depth
9360            )?;
9361            Ok(())
9362        }
9363    }
9364
9365    impl fidl::encoding::ResourceTypeMarker for FlatlandCreateView2Request {
9366        type Borrowed<'a> = &'a mut Self;
9367        fn take_or_borrow<'a>(
9368            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9369        ) -> Self::Borrowed<'a> {
9370            value
9371        }
9372    }
9373
9374    unsafe impl fidl::encoding::TypeMarker for FlatlandCreateView2Request {
9375        type Owned = Self;
9376
9377        #[inline(always)]
9378        fn inline_align(_context: fidl::encoding::Context) -> usize {
9379            8
9380        }
9381
9382        #[inline(always)]
9383        fn inline_size(_context: fidl::encoding::Context) -> usize {
9384            40
9385        }
9386    }
9387
9388    unsafe impl
9389        fidl::encoding::Encode<
9390            FlatlandCreateView2Request,
9391            fidl::encoding::DefaultFuchsiaResourceDialect,
9392        > for &mut FlatlandCreateView2Request
9393    {
9394        #[inline]
9395        unsafe fn encode(
9396            self,
9397            encoder: &mut fidl::encoding::Encoder<
9398                '_,
9399                fidl::encoding::DefaultFuchsiaResourceDialect,
9400            >,
9401            offset: usize,
9402            _depth: fidl::encoding::Depth,
9403        ) -> fidl::Result<()> {
9404            encoder.debug_check_bounds::<FlatlandCreateView2Request>(offset);
9405            // Delegate to tuple encoding.
9406            fidl::encoding::Encode::<FlatlandCreateView2Request, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
9407                (
9408                    <fidl_fuchsia_ui_views::ViewCreationToken as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.token),
9409                    <fidl_fuchsia_ui_views::ViewIdentityOnCreation as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.view_identity),
9410                    <ViewBoundProtocols as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.protocols),
9411                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.parent_viewport_watcher),
9412                ),
9413                encoder, offset, _depth
9414            )
9415        }
9416    }
9417    unsafe impl<
9418        T0: fidl::encoding::Encode<
9419                fidl_fuchsia_ui_views::ViewCreationToken,
9420                fidl::encoding::DefaultFuchsiaResourceDialect,
9421            >,
9422        T1: fidl::encoding::Encode<
9423                fidl_fuchsia_ui_views::ViewIdentityOnCreation,
9424                fidl::encoding::DefaultFuchsiaResourceDialect,
9425            >,
9426        T2: fidl::encoding::Encode<ViewBoundProtocols, fidl::encoding::DefaultFuchsiaResourceDialect>,
9427        T3: fidl::encoding::Encode<
9428                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>>,
9429                fidl::encoding::DefaultFuchsiaResourceDialect,
9430            >,
9431    >
9432        fidl::encoding::Encode<
9433            FlatlandCreateView2Request,
9434            fidl::encoding::DefaultFuchsiaResourceDialect,
9435        > for (T0, T1, T2, T3)
9436    {
9437        #[inline]
9438        unsafe fn encode(
9439            self,
9440            encoder: &mut fidl::encoding::Encoder<
9441                '_,
9442                fidl::encoding::DefaultFuchsiaResourceDialect,
9443            >,
9444            offset: usize,
9445            depth: fidl::encoding::Depth,
9446        ) -> fidl::Result<()> {
9447            encoder.debug_check_bounds::<FlatlandCreateView2Request>(offset);
9448            // Zero out padding regions. There's no need to apply masks
9449            // because the unmasked parts will be overwritten by fields.
9450            unsafe {
9451                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
9452                (ptr as *mut u64).write_unaligned(0);
9453            }
9454            unsafe {
9455                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(32);
9456                (ptr as *mut u64).write_unaligned(0);
9457            }
9458            // Write the fields.
9459            self.0.encode(encoder, offset + 0, depth)?;
9460            self.1.encode(encoder, offset + 4, depth)?;
9461            self.2.encode(encoder, offset + 16, depth)?;
9462            self.3.encode(encoder, offset + 32, depth)?;
9463            Ok(())
9464        }
9465    }
9466
9467    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
9468        for FlatlandCreateView2Request
9469    {
9470        #[inline(always)]
9471        fn new_empty() -> Self {
9472            Self {
9473                token: fidl::new_empty!(
9474                    fidl_fuchsia_ui_views::ViewCreationToken,
9475                    fidl::encoding::DefaultFuchsiaResourceDialect
9476                ),
9477                view_identity: fidl::new_empty!(
9478                    fidl_fuchsia_ui_views::ViewIdentityOnCreation,
9479                    fidl::encoding::DefaultFuchsiaResourceDialect
9480                ),
9481                protocols: fidl::new_empty!(
9482                    ViewBoundProtocols,
9483                    fidl::encoding::DefaultFuchsiaResourceDialect
9484                ),
9485                parent_viewport_watcher: fidl::new_empty!(
9486                    fidl::encoding::Endpoint<
9487                        fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>,
9488                    >,
9489                    fidl::encoding::DefaultFuchsiaResourceDialect
9490                ),
9491            }
9492        }
9493
9494        #[inline]
9495        unsafe fn decode(
9496            &mut self,
9497            decoder: &mut fidl::encoding::Decoder<
9498                '_,
9499                fidl::encoding::DefaultFuchsiaResourceDialect,
9500            >,
9501            offset: usize,
9502            _depth: fidl::encoding::Depth,
9503        ) -> fidl::Result<()> {
9504            decoder.debug_check_bounds::<Self>(offset);
9505            // Verify that padding bytes are zero.
9506            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(8) };
9507            let padval = unsafe { (ptr as *const u64).read_unaligned() };
9508            let mask = 0xffffffff00000000u64;
9509            let maskedval = padval & mask;
9510            if maskedval != 0 {
9511                return Err(fidl::Error::NonZeroPadding {
9512                    padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
9513                });
9514            }
9515            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(32) };
9516            let padval = unsafe { (ptr as *const u64).read_unaligned() };
9517            let mask = 0xffffffff00000000u64;
9518            let maskedval = padval & mask;
9519            if maskedval != 0 {
9520                return Err(fidl::Error::NonZeroPadding {
9521                    padding_start: offset + 32 + ((mask as u64).trailing_zeros() / 8) as usize,
9522                });
9523            }
9524            fidl::decode!(
9525                fidl_fuchsia_ui_views::ViewCreationToken,
9526                fidl::encoding::DefaultFuchsiaResourceDialect,
9527                &mut self.token,
9528                decoder,
9529                offset + 0,
9530                _depth
9531            )?;
9532            fidl::decode!(
9533                fidl_fuchsia_ui_views::ViewIdentityOnCreation,
9534                fidl::encoding::DefaultFuchsiaResourceDialect,
9535                &mut self.view_identity,
9536                decoder,
9537                offset + 4,
9538                _depth
9539            )?;
9540            fidl::decode!(
9541                ViewBoundProtocols,
9542                fidl::encoding::DefaultFuchsiaResourceDialect,
9543                &mut self.protocols,
9544                decoder,
9545                offset + 16,
9546                _depth
9547            )?;
9548            fidl::decode!(
9549                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>>,
9550                fidl::encoding::DefaultFuchsiaResourceDialect,
9551                &mut self.parent_viewport_watcher,
9552                decoder,
9553                offset + 32,
9554                _depth
9555            )?;
9556            Ok(())
9557        }
9558    }
9559
9560    impl fidl::encoding::ResourceTypeMarker for FlatlandCreateViewRequest {
9561        type Borrowed<'a> = &'a mut Self;
9562        fn take_or_borrow<'a>(
9563            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9564        ) -> Self::Borrowed<'a> {
9565            value
9566        }
9567    }
9568
9569    unsafe impl fidl::encoding::TypeMarker for FlatlandCreateViewRequest {
9570        type Owned = Self;
9571
9572        #[inline(always)]
9573        fn inline_align(_context: fidl::encoding::Context) -> usize {
9574            4
9575        }
9576
9577        #[inline(always)]
9578        fn inline_size(_context: fidl::encoding::Context) -> usize {
9579            8
9580        }
9581    }
9582
9583    unsafe impl
9584        fidl::encoding::Encode<
9585            FlatlandCreateViewRequest,
9586            fidl::encoding::DefaultFuchsiaResourceDialect,
9587        > for &mut FlatlandCreateViewRequest
9588    {
9589        #[inline]
9590        unsafe fn encode(
9591            self,
9592            encoder: &mut fidl::encoding::Encoder<
9593                '_,
9594                fidl::encoding::DefaultFuchsiaResourceDialect,
9595            >,
9596            offset: usize,
9597            _depth: fidl::encoding::Depth,
9598        ) -> fidl::Result<()> {
9599            encoder.debug_check_bounds::<FlatlandCreateViewRequest>(offset);
9600            // Delegate to tuple encoding.
9601            fidl::encoding::Encode::<FlatlandCreateViewRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
9602                (
9603                    <fidl_fuchsia_ui_views::ViewCreationToken as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.token),
9604                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.parent_viewport_watcher),
9605                ),
9606                encoder, offset, _depth
9607            )
9608        }
9609    }
9610    unsafe impl<
9611        T0: fidl::encoding::Encode<
9612                fidl_fuchsia_ui_views::ViewCreationToken,
9613                fidl::encoding::DefaultFuchsiaResourceDialect,
9614            >,
9615        T1: fidl::encoding::Encode<
9616                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>>,
9617                fidl::encoding::DefaultFuchsiaResourceDialect,
9618            >,
9619    >
9620        fidl::encoding::Encode<
9621            FlatlandCreateViewRequest,
9622            fidl::encoding::DefaultFuchsiaResourceDialect,
9623        > for (T0, T1)
9624    {
9625        #[inline]
9626        unsafe fn encode(
9627            self,
9628            encoder: &mut fidl::encoding::Encoder<
9629                '_,
9630                fidl::encoding::DefaultFuchsiaResourceDialect,
9631            >,
9632            offset: usize,
9633            depth: fidl::encoding::Depth,
9634        ) -> fidl::Result<()> {
9635            encoder.debug_check_bounds::<FlatlandCreateViewRequest>(offset);
9636            // Zero out padding regions. There's no need to apply masks
9637            // because the unmasked parts will be overwritten by fields.
9638            // Write the fields.
9639            self.0.encode(encoder, offset + 0, depth)?;
9640            self.1.encode(encoder, offset + 4, depth)?;
9641            Ok(())
9642        }
9643    }
9644
9645    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
9646        for FlatlandCreateViewRequest
9647    {
9648        #[inline(always)]
9649        fn new_empty() -> Self {
9650            Self {
9651                token: fidl::new_empty!(
9652                    fidl_fuchsia_ui_views::ViewCreationToken,
9653                    fidl::encoding::DefaultFuchsiaResourceDialect
9654                ),
9655                parent_viewport_watcher: fidl::new_empty!(
9656                    fidl::encoding::Endpoint<
9657                        fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>,
9658                    >,
9659                    fidl::encoding::DefaultFuchsiaResourceDialect
9660                ),
9661            }
9662        }
9663
9664        #[inline]
9665        unsafe fn decode(
9666            &mut self,
9667            decoder: &mut fidl::encoding::Decoder<
9668                '_,
9669                fidl::encoding::DefaultFuchsiaResourceDialect,
9670            >,
9671            offset: usize,
9672            _depth: fidl::encoding::Depth,
9673        ) -> fidl::Result<()> {
9674            decoder.debug_check_bounds::<Self>(offset);
9675            // Verify that padding bytes are zero.
9676            fidl::decode!(
9677                fidl_fuchsia_ui_views::ViewCreationToken,
9678                fidl::encoding::DefaultFuchsiaResourceDialect,
9679                &mut self.token,
9680                decoder,
9681                offset + 0,
9682                _depth
9683            )?;
9684            fidl::decode!(
9685                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>>,
9686                fidl::encoding::DefaultFuchsiaResourceDialect,
9687                &mut self.parent_viewport_watcher,
9688                decoder,
9689                offset + 4,
9690                _depth
9691            )?;
9692            Ok(())
9693        }
9694    }
9695
9696    impl fidl::encoding::ResourceTypeMarker for FlatlandCreateViewportRequest {
9697        type Borrowed<'a> = &'a mut Self;
9698        fn take_or_borrow<'a>(
9699            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9700        ) -> Self::Borrowed<'a> {
9701            value
9702        }
9703    }
9704
9705    unsafe impl fidl::encoding::TypeMarker for FlatlandCreateViewportRequest {
9706        type Owned = Self;
9707
9708        #[inline(always)]
9709        fn inline_align(_context: fidl::encoding::Context) -> usize {
9710            8
9711        }
9712
9713        #[inline(always)]
9714        fn inline_size(_context: fidl::encoding::Context) -> usize {
9715            40
9716        }
9717    }
9718
9719    unsafe impl
9720        fidl::encoding::Encode<
9721            FlatlandCreateViewportRequest,
9722            fidl::encoding::DefaultFuchsiaResourceDialect,
9723        > for &mut FlatlandCreateViewportRequest
9724    {
9725        #[inline]
9726        unsafe fn encode(
9727            self,
9728            encoder: &mut fidl::encoding::Encoder<
9729                '_,
9730                fidl::encoding::DefaultFuchsiaResourceDialect,
9731            >,
9732            offset: usize,
9733            _depth: fidl::encoding::Depth,
9734        ) -> fidl::Result<()> {
9735            encoder.debug_check_bounds::<FlatlandCreateViewportRequest>(offset);
9736            // Delegate to tuple encoding.
9737            fidl::encoding::Encode::<FlatlandCreateViewportRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
9738                (
9739                    <ContentId as fidl::encoding::ValueTypeMarker>::borrow(&self.viewport_id),
9740                    <fidl_fuchsia_ui_views::ViewportCreationToken as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.token),
9741                    <ViewportProperties as fidl::encoding::ValueTypeMarker>::borrow(&self.properties),
9742                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ChildViewWatcherMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.child_view_watcher),
9743                ),
9744                encoder, offset, _depth
9745            )
9746        }
9747    }
9748    unsafe impl<
9749        T0: fidl::encoding::Encode<ContentId, fidl::encoding::DefaultFuchsiaResourceDialect>,
9750        T1: fidl::encoding::Encode<
9751                fidl_fuchsia_ui_views::ViewportCreationToken,
9752                fidl::encoding::DefaultFuchsiaResourceDialect,
9753            >,
9754        T2: fidl::encoding::Encode<ViewportProperties, fidl::encoding::DefaultFuchsiaResourceDialect>,
9755        T3: fidl::encoding::Encode<
9756                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ChildViewWatcherMarker>>,
9757                fidl::encoding::DefaultFuchsiaResourceDialect,
9758            >,
9759    >
9760        fidl::encoding::Encode<
9761            FlatlandCreateViewportRequest,
9762            fidl::encoding::DefaultFuchsiaResourceDialect,
9763        > for (T0, T1, T2, T3)
9764    {
9765        #[inline]
9766        unsafe fn encode(
9767            self,
9768            encoder: &mut fidl::encoding::Encoder<
9769                '_,
9770                fidl::encoding::DefaultFuchsiaResourceDialect,
9771            >,
9772            offset: usize,
9773            depth: fidl::encoding::Depth,
9774        ) -> fidl::Result<()> {
9775            encoder.debug_check_bounds::<FlatlandCreateViewportRequest>(offset);
9776            // Zero out padding regions. There's no need to apply masks
9777            // because the unmasked parts will be overwritten by fields.
9778            unsafe {
9779                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
9780                (ptr as *mut u64).write_unaligned(0);
9781            }
9782            unsafe {
9783                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(32);
9784                (ptr as *mut u64).write_unaligned(0);
9785            }
9786            // Write the fields.
9787            self.0.encode(encoder, offset + 0, depth)?;
9788            self.1.encode(encoder, offset + 8, depth)?;
9789            self.2.encode(encoder, offset + 16, depth)?;
9790            self.3.encode(encoder, offset + 32, depth)?;
9791            Ok(())
9792        }
9793    }
9794
9795    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
9796        for FlatlandCreateViewportRequest
9797    {
9798        #[inline(always)]
9799        fn new_empty() -> Self {
9800            Self {
9801                viewport_id: fidl::new_empty!(
9802                    ContentId,
9803                    fidl::encoding::DefaultFuchsiaResourceDialect
9804                ),
9805                token: fidl::new_empty!(
9806                    fidl_fuchsia_ui_views::ViewportCreationToken,
9807                    fidl::encoding::DefaultFuchsiaResourceDialect
9808                ),
9809                properties: fidl::new_empty!(
9810                    ViewportProperties,
9811                    fidl::encoding::DefaultFuchsiaResourceDialect
9812                ),
9813                child_view_watcher: fidl::new_empty!(
9814                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ChildViewWatcherMarker>>,
9815                    fidl::encoding::DefaultFuchsiaResourceDialect
9816                ),
9817            }
9818        }
9819
9820        #[inline]
9821        unsafe fn decode(
9822            &mut self,
9823            decoder: &mut fidl::encoding::Decoder<
9824                '_,
9825                fidl::encoding::DefaultFuchsiaResourceDialect,
9826            >,
9827            offset: usize,
9828            _depth: fidl::encoding::Depth,
9829        ) -> fidl::Result<()> {
9830            decoder.debug_check_bounds::<Self>(offset);
9831            // Verify that padding bytes are zero.
9832            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(8) };
9833            let padval = unsafe { (ptr as *const u64).read_unaligned() };
9834            let mask = 0xffffffff00000000u64;
9835            let maskedval = padval & mask;
9836            if maskedval != 0 {
9837                return Err(fidl::Error::NonZeroPadding {
9838                    padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
9839                });
9840            }
9841            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(32) };
9842            let padval = unsafe { (ptr as *const u64).read_unaligned() };
9843            let mask = 0xffffffff00000000u64;
9844            let maskedval = padval & mask;
9845            if maskedval != 0 {
9846                return Err(fidl::Error::NonZeroPadding {
9847                    padding_start: offset + 32 + ((mask as u64).trailing_zeros() / 8) as usize,
9848                });
9849            }
9850            fidl::decode!(
9851                ContentId,
9852                fidl::encoding::DefaultFuchsiaResourceDialect,
9853                &mut self.viewport_id,
9854                decoder,
9855                offset + 0,
9856                _depth
9857            )?;
9858            fidl::decode!(
9859                fidl_fuchsia_ui_views::ViewportCreationToken,
9860                fidl::encoding::DefaultFuchsiaResourceDialect,
9861                &mut self.token,
9862                decoder,
9863                offset + 8,
9864                _depth
9865            )?;
9866            fidl::decode!(
9867                ViewportProperties,
9868                fidl::encoding::DefaultFuchsiaResourceDialect,
9869                &mut self.properties,
9870                decoder,
9871                offset + 16,
9872                _depth
9873            )?;
9874            fidl::decode!(
9875                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ChildViewWatcherMarker>>,
9876                fidl::encoding::DefaultFuchsiaResourceDialect,
9877                &mut self.child_view_watcher,
9878                decoder,
9879                offset + 32,
9880                _depth
9881            )?;
9882            Ok(())
9883        }
9884    }
9885
9886    impl fidl::encoding::ResourceTypeMarker for FlatlandDisplaySetContentRequest {
9887        type Borrowed<'a> = &'a mut Self;
9888        fn take_or_borrow<'a>(
9889            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9890        ) -> Self::Borrowed<'a> {
9891            value
9892        }
9893    }
9894
9895    unsafe impl fidl::encoding::TypeMarker for FlatlandDisplaySetContentRequest {
9896        type Owned = Self;
9897
9898        #[inline(always)]
9899        fn inline_align(_context: fidl::encoding::Context) -> usize {
9900            4
9901        }
9902
9903        #[inline(always)]
9904        fn inline_size(_context: fidl::encoding::Context) -> usize {
9905            8
9906        }
9907    }
9908
9909    unsafe impl
9910        fidl::encoding::Encode<
9911            FlatlandDisplaySetContentRequest,
9912            fidl::encoding::DefaultFuchsiaResourceDialect,
9913        > for &mut FlatlandDisplaySetContentRequest
9914    {
9915        #[inline]
9916        unsafe fn encode(
9917            self,
9918            encoder: &mut fidl::encoding::Encoder<
9919                '_,
9920                fidl::encoding::DefaultFuchsiaResourceDialect,
9921            >,
9922            offset: usize,
9923            _depth: fidl::encoding::Depth,
9924        ) -> fidl::Result<()> {
9925            encoder.debug_check_bounds::<FlatlandDisplaySetContentRequest>(offset);
9926            // Delegate to tuple encoding.
9927            fidl::encoding::Encode::<FlatlandDisplaySetContentRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
9928                (
9929                    <fidl_fuchsia_ui_views::ViewportCreationToken as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.token),
9930                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ChildViewWatcherMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.child_view_watcher),
9931                ),
9932                encoder, offset, _depth
9933            )
9934        }
9935    }
9936    unsafe impl<
9937        T0: fidl::encoding::Encode<
9938                fidl_fuchsia_ui_views::ViewportCreationToken,
9939                fidl::encoding::DefaultFuchsiaResourceDialect,
9940            >,
9941        T1: fidl::encoding::Encode<
9942                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ChildViewWatcherMarker>>,
9943                fidl::encoding::DefaultFuchsiaResourceDialect,
9944            >,
9945    >
9946        fidl::encoding::Encode<
9947            FlatlandDisplaySetContentRequest,
9948            fidl::encoding::DefaultFuchsiaResourceDialect,
9949        > for (T0, T1)
9950    {
9951        #[inline]
9952        unsafe fn encode(
9953            self,
9954            encoder: &mut fidl::encoding::Encoder<
9955                '_,
9956                fidl::encoding::DefaultFuchsiaResourceDialect,
9957            >,
9958            offset: usize,
9959            depth: fidl::encoding::Depth,
9960        ) -> fidl::Result<()> {
9961            encoder.debug_check_bounds::<FlatlandDisplaySetContentRequest>(offset);
9962            // Zero out padding regions. There's no need to apply masks
9963            // because the unmasked parts will be overwritten by fields.
9964            // Write the fields.
9965            self.0.encode(encoder, offset + 0, depth)?;
9966            self.1.encode(encoder, offset + 4, depth)?;
9967            Ok(())
9968        }
9969    }
9970
9971    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
9972        for FlatlandDisplaySetContentRequest
9973    {
9974        #[inline(always)]
9975        fn new_empty() -> Self {
9976            Self {
9977                token: fidl::new_empty!(
9978                    fidl_fuchsia_ui_views::ViewportCreationToken,
9979                    fidl::encoding::DefaultFuchsiaResourceDialect
9980                ),
9981                child_view_watcher: fidl::new_empty!(
9982                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ChildViewWatcherMarker>>,
9983                    fidl::encoding::DefaultFuchsiaResourceDialect
9984                ),
9985            }
9986        }
9987
9988        #[inline]
9989        unsafe fn decode(
9990            &mut self,
9991            decoder: &mut fidl::encoding::Decoder<
9992                '_,
9993                fidl::encoding::DefaultFuchsiaResourceDialect,
9994            >,
9995            offset: usize,
9996            _depth: fidl::encoding::Depth,
9997        ) -> fidl::Result<()> {
9998            decoder.debug_check_bounds::<Self>(offset);
9999            // Verify that padding bytes are zero.
10000            fidl::decode!(
10001                fidl_fuchsia_ui_views::ViewportCreationToken,
10002                fidl::encoding::DefaultFuchsiaResourceDialect,
10003                &mut self.token,
10004                decoder,
10005                offset + 0,
10006                _depth
10007            )?;
10008            fidl::decode!(
10009                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ChildViewWatcherMarker>>,
10010                fidl::encoding::DefaultFuchsiaResourceDialect,
10011                &mut self.child_view_watcher,
10012                decoder,
10013                offset + 4,
10014                _depth
10015            )?;
10016            Ok(())
10017        }
10018    }
10019
10020    impl fidl::encoding::ResourceTypeMarker for FlatlandPresentRequest {
10021        type Borrowed<'a> = &'a mut Self;
10022        fn take_or_borrow<'a>(
10023            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10024        ) -> Self::Borrowed<'a> {
10025            value
10026        }
10027    }
10028
10029    unsafe impl fidl::encoding::TypeMarker for FlatlandPresentRequest {
10030        type Owned = Self;
10031
10032        #[inline(always)]
10033        fn inline_align(_context: fidl::encoding::Context) -> usize {
10034            8
10035        }
10036
10037        #[inline(always)]
10038        fn inline_size(_context: fidl::encoding::Context) -> usize {
10039            16
10040        }
10041    }
10042
10043    unsafe impl
10044        fidl::encoding::Encode<
10045            FlatlandPresentRequest,
10046            fidl::encoding::DefaultFuchsiaResourceDialect,
10047        > for &mut FlatlandPresentRequest
10048    {
10049        #[inline]
10050        unsafe fn encode(
10051            self,
10052            encoder: &mut fidl::encoding::Encoder<
10053                '_,
10054                fidl::encoding::DefaultFuchsiaResourceDialect,
10055            >,
10056            offset: usize,
10057            _depth: fidl::encoding::Depth,
10058        ) -> fidl::Result<()> {
10059            encoder.debug_check_bounds::<FlatlandPresentRequest>(offset);
10060            // Delegate to tuple encoding.
10061            fidl::encoding::Encode::<
10062                FlatlandPresentRequest,
10063                fidl::encoding::DefaultFuchsiaResourceDialect,
10064            >::encode(
10065                (<PresentArgs as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
10066                    &mut self.args,
10067                ),),
10068                encoder,
10069                offset,
10070                _depth,
10071            )
10072        }
10073    }
10074    unsafe impl<
10075        T0: fidl::encoding::Encode<PresentArgs, fidl::encoding::DefaultFuchsiaResourceDialect>,
10076    >
10077        fidl::encoding::Encode<
10078            FlatlandPresentRequest,
10079            fidl::encoding::DefaultFuchsiaResourceDialect,
10080        > for (T0,)
10081    {
10082        #[inline]
10083        unsafe fn encode(
10084            self,
10085            encoder: &mut fidl::encoding::Encoder<
10086                '_,
10087                fidl::encoding::DefaultFuchsiaResourceDialect,
10088            >,
10089            offset: usize,
10090            depth: fidl::encoding::Depth,
10091        ) -> fidl::Result<()> {
10092            encoder.debug_check_bounds::<FlatlandPresentRequest>(offset);
10093            // Zero out padding regions. There's no need to apply masks
10094            // because the unmasked parts will be overwritten by fields.
10095            // Write the fields.
10096            self.0.encode(encoder, offset + 0, depth)?;
10097            Ok(())
10098        }
10099    }
10100
10101    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10102        for FlatlandPresentRequest
10103    {
10104        #[inline(always)]
10105        fn new_empty() -> Self {
10106            Self {
10107                args: fidl::new_empty!(PresentArgs, fidl::encoding::DefaultFuchsiaResourceDialect),
10108            }
10109        }
10110
10111        #[inline]
10112        unsafe fn decode(
10113            &mut self,
10114            decoder: &mut fidl::encoding::Decoder<
10115                '_,
10116                fidl::encoding::DefaultFuchsiaResourceDialect,
10117            >,
10118            offset: usize,
10119            _depth: fidl::encoding::Depth,
10120        ) -> fidl::Result<()> {
10121            decoder.debug_check_bounds::<Self>(offset);
10122            // Verify that padding bytes are zero.
10123            fidl::decode!(
10124                PresentArgs,
10125                fidl::encoding::DefaultFuchsiaResourceDialect,
10126                &mut self.args,
10127                decoder,
10128                offset + 0,
10129                _depth
10130            )?;
10131            Ok(())
10132        }
10133    }
10134
10135    impl fidl::encoding::ResourceTypeMarker for FlatlandReleaseViewportResponse {
10136        type Borrowed<'a> = &'a mut Self;
10137        fn take_or_borrow<'a>(
10138            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10139        ) -> Self::Borrowed<'a> {
10140            value
10141        }
10142    }
10143
10144    unsafe impl fidl::encoding::TypeMarker for FlatlandReleaseViewportResponse {
10145        type Owned = Self;
10146
10147        #[inline(always)]
10148        fn inline_align(_context: fidl::encoding::Context) -> usize {
10149            4
10150        }
10151
10152        #[inline(always)]
10153        fn inline_size(_context: fidl::encoding::Context) -> usize {
10154            4
10155        }
10156    }
10157
10158    unsafe impl
10159        fidl::encoding::Encode<
10160            FlatlandReleaseViewportResponse,
10161            fidl::encoding::DefaultFuchsiaResourceDialect,
10162        > for &mut FlatlandReleaseViewportResponse
10163    {
10164        #[inline]
10165        unsafe fn encode(
10166            self,
10167            encoder: &mut fidl::encoding::Encoder<
10168                '_,
10169                fidl::encoding::DefaultFuchsiaResourceDialect,
10170            >,
10171            offset: usize,
10172            _depth: fidl::encoding::Depth,
10173        ) -> fidl::Result<()> {
10174            encoder.debug_check_bounds::<FlatlandReleaseViewportResponse>(offset);
10175            // Delegate to tuple encoding.
10176            fidl::encoding::Encode::<FlatlandReleaseViewportResponse, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
10177                (
10178                    <fidl_fuchsia_ui_views::ViewportCreationToken as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.token),
10179                ),
10180                encoder, offset, _depth
10181            )
10182        }
10183    }
10184    unsafe impl<
10185        T0: fidl::encoding::Encode<
10186                fidl_fuchsia_ui_views::ViewportCreationToken,
10187                fidl::encoding::DefaultFuchsiaResourceDialect,
10188            >,
10189    >
10190        fidl::encoding::Encode<
10191            FlatlandReleaseViewportResponse,
10192            fidl::encoding::DefaultFuchsiaResourceDialect,
10193        > for (T0,)
10194    {
10195        #[inline]
10196        unsafe fn encode(
10197            self,
10198            encoder: &mut fidl::encoding::Encoder<
10199                '_,
10200                fidl::encoding::DefaultFuchsiaResourceDialect,
10201            >,
10202            offset: usize,
10203            depth: fidl::encoding::Depth,
10204        ) -> fidl::Result<()> {
10205            encoder.debug_check_bounds::<FlatlandReleaseViewportResponse>(offset);
10206            // Zero out padding regions. There's no need to apply masks
10207            // because the unmasked parts will be overwritten by fields.
10208            // Write the fields.
10209            self.0.encode(encoder, offset + 0, depth)?;
10210            Ok(())
10211        }
10212    }
10213
10214    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10215        for FlatlandReleaseViewportResponse
10216    {
10217        #[inline(always)]
10218        fn new_empty() -> Self {
10219            Self {
10220                token: fidl::new_empty!(
10221                    fidl_fuchsia_ui_views::ViewportCreationToken,
10222                    fidl::encoding::DefaultFuchsiaResourceDialect
10223                ),
10224            }
10225        }
10226
10227        #[inline]
10228        unsafe fn decode(
10229            &mut self,
10230            decoder: &mut fidl::encoding::Decoder<
10231                '_,
10232                fidl::encoding::DefaultFuchsiaResourceDialect,
10233            >,
10234            offset: usize,
10235            _depth: fidl::encoding::Depth,
10236        ) -> fidl::Result<()> {
10237            decoder.debug_check_bounds::<Self>(offset);
10238            // Verify that padding bytes are zero.
10239            fidl::decode!(
10240                fidl_fuchsia_ui_views::ViewportCreationToken,
10241                fidl::encoding::DefaultFuchsiaResourceDialect,
10242                &mut self.token,
10243                decoder,
10244                offset + 0,
10245                _depth
10246            )?;
10247            Ok(())
10248        }
10249    }
10250
10251    impl fidl::encoding::ResourceTypeMarker for FlatlandSetSolidFillRequest {
10252        type Borrowed<'a> = &'a mut Self;
10253        fn take_or_borrow<'a>(
10254            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10255        ) -> Self::Borrowed<'a> {
10256            value
10257        }
10258    }
10259
10260    unsafe impl fidl::encoding::TypeMarker for FlatlandSetSolidFillRequest {
10261        type Owned = Self;
10262
10263        #[inline(always)]
10264        fn inline_align(_context: fidl::encoding::Context) -> usize {
10265            8
10266        }
10267
10268        #[inline(always)]
10269        fn inline_size(_context: fidl::encoding::Context) -> usize {
10270            32
10271        }
10272    }
10273
10274    unsafe impl
10275        fidl::encoding::Encode<
10276            FlatlandSetSolidFillRequest,
10277            fidl::encoding::DefaultFuchsiaResourceDialect,
10278        > for &mut FlatlandSetSolidFillRequest
10279    {
10280        #[inline]
10281        unsafe fn encode(
10282            self,
10283            encoder: &mut fidl::encoding::Encoder<
10284                '_,
10285                fidl::encoding::DefaultFuchsiaResourceDialect,
10286            >,
10287            offset: usize,
10288            _depth: fidl::encoding::Depth,
10289        ) -> fidl::Result<()> {
10290            encoder.debug_check_bounds::<FlatlandSetSolidFillRequest>(offset);
10291            // Delegate to tuple encoding.
10292            fidl::encoding::Encode::<
10293                FlatlandSetSolidFillRequest,
10294                fidl::encoding::DefaultFuchsiaResourceDialect,
10295            >::encode(
10296                (
10297                    <ContentId as fidl::encoding::ValueTypeMarker>::borrow(&self.rect_id),
10298                    <ColorRgba as fidl::encoding::ValueTypeMarker>::borrow(&self.color),
10299                    <fidl_fuchsia_math::SizeU as fidl::encoding::ValueTypeMarker>::borrow(
10300                        &self.size,
10301                    ),
10302                ),
10303                encoder,
10304                offset,
10305                _depth,
10306            )
10307        }
10308    }
10309    unsafe impl<
10310        T0: fidl::encoding::Encode<ContentId, fidl::encoding::DefaultFuchsiaResourceDialect>,
10311        T1: fidl::encoding::Encode<ColorRgba, fidl::encoding::DefaultFuchsiaResourceDialect>,
10312        T2: fidl::encoding::Encode<
10313                fidl_fuchsia_math::SizeU,
10314                fidl::encoding::DefaultFuchsiaResourceDialect,
10315            >,
10316    >
10317        fidl::encoding::Encode<
10318            FlatlandSetSolidFillRequest,
10319            fidl::encoding::DefaultFuchsiaResourceDialect,
10320        > for (T0, T1, T2)
10321    {
10322        #[inline]
10323        unsafe fn encode(
10324            self,
10325            encoder: &mut fidl::encoding::Encoder<
10326                '_,
10327                fidl::encoding::DefaultFuchsiaResourceDialect,
10328            >,
10329            offset: usize,
10330            depth: fidl::encoding::Depth,
10331        ) -> fidl::Result<()> {
10332            encoder.debug_check_bounds::<FlatlandSetSolidFillRequest>(offset);
10333            // Zero out padding regions. There's no need to apply masks
10334            // because the unmasked parts will be overwritten by fields.
10335            // Write the fields.
10336            self.0.encode(encoder, offset + 0, depth)?;
10337            self.1.encode(encoder, offset + 8, depth)?;
10338            self.2.encode(encoder, offset + 24, depth)?;
10339            Ok(())
10340        }
10341    }
10342
10343    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10344        for FlatlandSetSolidFillRequest
10345    {
10346        #[inline(always)]
10347        fn new_empty() -> Self {
10348            Self {
10349                rect_id: fidl::new_empty!(ContentId, fidl::encoding::DefaultFuchsiaResourceDialect),
10350                color: fidl::new_empty!(ColorRgba, fidl::encoding::DefaultFuchsiaResourceDialect),
10351                size: fidl::new_empty!(
10352                    fidl_fuchsia_math::SizeU,
10353                    fidl::encoding::DefaultFuchsiaResourceDialect
10354                ),
10355            }
10356        }
10357
10358        #[inline]
10359        unsafe fn decode(
10360            &mut self,
10361            decoder: &mut fidl::encoding::Decoder<
10362                '_,
10363                fidl::encoding::DefaultFuchsiaResourceDialect,
10364            >,
10365            offset: usize,
10366            _depth: fidl::encoding::Depth,
10367        ) -> fidl::Result<()> {
10368            decoder.debug_check_bounds::<Self>(offset);
10369            // Verify that padding bytes are zero.
10370            fidl::decode!(
10371                ContentId,
10372                fidl::encoding::DefaultFuchsiaResourceDialect,
10373                &mut self.rect_id,
10374                decoder,
10375                offset + 0,
10376                _depth
10377            )?;
10378            fidl::decode!(
10379                ColorRgba,
10380                fidl::encoding::DefaultFuchsiaResourceDialect,
10381                &mut self.color,
10382                decoder,
10383                offset + 8,
10384                _depth
10385            )?;
10386            fidl::decode!(
10387                fidl_fuchsia_math::SizeU,
10388                fidl::encoding::DefaultFuchsiaResourceDialect,
10389                &mut self.size,
10390                decoder,
10391                offset + 24,
10392                _depth
10393            )?;
10394            Ok(())
10395        }
10396    }
10397
10398    impl fidl::encoding::ResourceTypeMarker for TrustedFlatlandFactoryCreateFlatlandRequest {
10399        type Borrowed<'a> = &'a mut Self;
10400        fn take_or_borrow<'a>(
10401            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10402        ) -> Self::Borrowed<'a> {
10403            value
10404        }
10405    }
10406
10407    unsafe impl fidl::encoding::TypeMarker for TrustedFlatlandFactoryCreateFlatlandRequest {
10408        type Owned = Self;
10409
10410        #[inline(always)]
10411        fn inline_align(_context: fidl::encoding::Context) -> usize {
10412            8
10413        }
10414
10415        #[inline(always)]
10416        fn inline_size(_context: fidl::encoding::Context) -> usize {
10417            24
10418        }
10419    }
10420
10421    unsafe impl
10422        fidl::encoding::Encode<
10423            TrustedFlatlandFactoryCreateFlatlandRequest,
10424            fidl::encoding::DefaultFuchsiaResourceDialect,
10425        > for &mut TrustedFlatlandFactoryCreateFlatlandRequest
10426    {
10427        #[inline]
10428        unsafe fn encode(
10429            self,
10430            encoder: &mut fidl::encoding::Encoder<
10431                '_,
10432                fidl::encoding::DefaultFuchsiaResourceDialect,
10433            >,
10434            offset: usize,
10435            _depth: fidl::encoding::Depth,
10436        ) -> fidl::Result<()> {
10437            encoder.debug_check_bounds::<TrustedFlatlandFactoryCreateFlatlandRequest>(offset);
10438            // Delegate to tuple encoding.
10439            fidl::encoding::Encode::<TrustedFlatlandFactoryCreateFlatlandRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
10440                (
10441                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<FlatlandMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.server_end),
10442                    <TrustedFlatlandConfig as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.config),
10443                ),
10444                encoder, offset, _depth
10445            )
10446        }
10447    }
10448    unsafe impl<
10449        T0: fidl::encoding::Encode<
10450                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<FlatlandMarker>>,
10451                fidl::encoding::DefaultFuchsiaResourceDialect,
10452            >,
10453        T1: fidl::encoding::Encode<
10454                TrustedFlatlandConfig,
10455                fidl::encoding::DefaultFuchsiaResourceDialect,
10456            >,
10457    >
10458        fidl::encoding::Encode<
10459            TrustedFlatlandFactoryCreateFlatlandRequest,
10460            fidl::encoding::DefaultFuchsiaResourceDialect,
10461        > for (T0, T1)
10462    {
10463        #[inline]
10464        unsafe fn encode(
10465            self,
10466            encoder: &mut fidl::encoding::Encoder<
10467                '_,
10468                fidl::encoding::DefaultFuchsiaResourceDialect,
10469            >,
10470            offset: usize,
10471            depth: fidl::encoding::Depth,
10472        ) -> fidl::Result<()> {
10473            encoder.debug_check_bounds::<TrustedFlatlandFactoryCreateFlatlandRequest>(offset);
10474            // Zero out padding regions. There's no need to apply masks
10475            // because the unmasked parts will be overwritten by fields.
10476            unsafe {
10477                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
10478                (ptr as *mut u64).write_unaligned(0);
10479            }
10480            // Write the fields.
10481            self.0.encode(encoder, offset + 0, depth)?;
10482            self.1.encode(encoder, offset + 8, depth)?;
10483            Ok(())
10484        }
10485    }
10486
10487    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10488        for TrustedFlatlandFactoryCreateFlatlandRequest
10489    {
10490        #[inline(always)]
10491        fn new_empty() -> Self {
10492            Self {
10493                server_end: fidl::new_empty!(
10494                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<FlatlandMarker>>,
10495                    fidl::encoding::DefaultFuchsiaResourceDialect
10496                ),
10497                config: fidl::new_empty!(
10498                    TrustedFlatlandConfig,
10499                    fidl::encoding::DefaultFuchsiaResourceDialect
10500                ),
10501            }
10502        }
10503
10504        #[inline]
10505        unsafe fn decode(
10506            &mut self,
10507            decoder: &mut fidl::encoding::Decoder<
10508                '_,
10509                fidl::encoding::DefaultFuchsiaResourceDialect,
10510            >,
10511            offset: usize,
10512            _depth: fidl::encoding::Depth,
10513        ) -> fidl::Result<()> {
10514            decoder.debug_check_bounds::<Self>(offset);
10515            // Verify that padding bytes are zero.
10516            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
10517            let padval = unsafe { (ptr as *const u64).read_unaligned() };
10518            let mask = 0xffffffff00000000u64;
10519            let maskedval = padval & mask;
10520            if maskedval != 0 {
10521                return Err(fidl::Error::NonZeroPadding {
10522                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
10523                });
10524            }
10525            fidl::decode!(
10526                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<FlatlandMarker>>,
10527                fidl::encoding::DefaultFuchsiaResourceDialect,
10528                &mut self.server_end,
10529                decoder,
10530                offset + 0,
10531                _depth
10532            )?;
10533            fidl::decode!(
10534                TrustedFlatlandConfig,
10535                fidl::encoding::DefaultFuchsiaResourceDialect,
10536                &mut self.config,
10537                decoder,
10538                offset + 8,
10539                _depth
10540            )?;
10541            Ok(())
10542        }
10543    }
10544
10545    impl FrameInfo {
10546        #[inline(always)]
10547        fn max_ordinal_present(&self) -> u64 {
10548            if let Some(_) = self.buffer_id {
10549                return 1;
10550            }
10551            0
10552        }
10553    }
10554
10555    impl fidl::encoding::ResourceTypeMarker for FrameInfo {
10556        type Borrowed<'a> = &'a mut Self;
10557        fn take_or_borrow<'a>(
10558            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10559        ) -> Self::Borrowed<'a> {
10560            value
10561        }
10562    }
10563
10564    unsafe impl fidl::encoding::TypeMarker for FrameInfo {
10565        type Owned = Self;
10566
10567        #[inline(always)]
10568        fn inline_align(_context: fidl::encoding::Context) -> usize {
10569            8
10570        }
10571
10572        #[inline(always)]
10573        fn inline_size(_context: fidl::encoding::Context) -> usize {
10574            16
10575        }
10576    }
10577
10578    unsafe impl fidl::encoding::Encode<FrameInfo, fidl::encoding::DefaultFuchsiaResourceDialect>
10579        for &mut FrameInfo
10580    {
10581        unsafe fn encode(
10582            self,
10583            encoder: &mut fidl::encoding::Encoder<
10584                '_,
10585                fidl::encoding::DefaultFuchsiaResourceDialect,
10586            >,
10587            offset: usize,
10588            mut depth: fidl::encoding::Depth,
10589        ) -> fidl::Result<()> {
10590            encoder.debug_check_bounds::<FrameInfo>(offset);
10591            // Vector header
10592            let max_ordinal: u64 = self.max_ordinal_present();
10593            encoder.write_num(max_ordinal, offset);
10594            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
10595            // Calling encoder.out_of_line_offset(0) is not allowed.
10596            if max_ordinal == 0 {
10597                return Ok(());
10598            }
10599            depth.increment()?;
10600            let envelope_size = 8;
10601            let bytes_len = max_ordinal as usize * envelope_size;
10602            #[allow(unused_variables)]
10603            let offset = encoder.out_of_line_offset(bytes_len);
10604            let mut _prev_end_offset: usize = 0;
10605            if 1 > max_ordinal {
10606                return Ok(());
10607            }
10608
10609            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
10610            // are envelope_size bytes.
10611            let cur_offset: usize = (1 - 1) * envelope_size;
10612
10613            // Zero reserved fields.
10614            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
10615
10616            // Safety:
10617            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
10618            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
10619            //   envelope_size bytes, there is always sufficient room.
10620            fidl::encoding::encode_in_envelope_optional::<
10621                u32,
10622                fidl::encoding::DefaultFuchsiaResourceDialect,
10623            >(
10624                self.buffer_id.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
10625                encoder,
10626                offset + cur_offset,
10627                depth,
10628            )?;
10629
10630            _prev_end_offset = cur_offset + envelope_size;
10631
10632            Ok(())
10633        }
10634    }
10635
10636    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for FrameInfo {
10637        #[inline(always)]
10638        fn new_empty() -> Self {
10639            Self::default()
10640        }
10641
10642        unsafe fn decode(
10643            &mut self,
10644            decoder: &mut fidl::encoding::Decoder<
10645                '_,
10646                fidl::encoding::DefaultFuchsiaResourceDialect,
10647            >,
10648            offset: usize,
10649            mut depth: fidl::encoding::Depth,
10650        ) -> fidl::Result<()> {
10651            decoder.debug_check_bounds::<Self>(offset);
10652            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
10653                None => return Err(fidl::Error::NotNullable),
10654                Some(len) => len,
10655            };
10656            // Calling decoder.out_of_line_offset(0) is not allowed.
10657            if len == 0 {
10658                return Ok(());
10659            };
10660            depth.increment()?;
10661            let envelope_size = 8;
10662            let bytes_len = len * envelope_size;
10663            let offset = decoder.out_of_line_offset(bytes_len)?;
10664            // Decode the envelope for each type.
10665            let mut _next_ordinal_to_read = 0;
10666            let mut next_offset = offset;
10667            let end_offset = offset + bytes_len;
10668            _next_ordinal_to_read += 1;
10669            if next_offset >= end_offset {
10670                return Ok(());
10671            }
10672
10673            // Decode unknown envelopes for gaps in ordinals.
10674            while _next_ordinal_to_read < 1 {
10675                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10676                _next_ordinal_to_read += 1;
10677                next_offset += envelope_size;
10678            }
10679
10680            let next_out_of_line = decoder.next_out_of_line();
10681            let handles_before = decoder.remaining_handles();
10682            if let Some((inlined, num_bytes, num_handles)) =
10683                fidl::encoding::decode_envelope_header(decoder, next_offset)?
10684            {
10685                let member_inline_size =
10686                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
10687                if inlined != (member_inline_size <= 4) {
10688                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
10689                }
10690                let inner_offset;
10691                let mut inner_depth = depth.clone();
10692                if inlined {
10693                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
10694                    inner_offset = next_offset;
10695                } else {
10696                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
10697                    inner_depth.increment()?;
10698                }
10699                let val_ref = self.buffer_id.get_or_insert_with(|| {
10700                    fidl::new_empty!(u32, fidl::encoding::DefaultFuchsiaResourceDialect)
10701                });
10702                fidl::decode!(
10703                    u32,
10704                    fidl::encoding::DefaultFuchsiaResourceDialect,
10705                    val_ref,
10706                    decoder,
10707                    inner_offset,
10708                    inner_depth
10709                )?;
10710                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
10711                {
10712                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
10713                }
10714                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
10715                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
10716                }
10717            }
10718
10719            next_offset += envelope_size;
10720
10721            // Decode the remaining unknown envelopes.
10722            while next_offset < end_offset {
10723                _next_ordinal_to_read += 1;
10724                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10725                next_offset += envelope_size;
10726            }
10727
10728            Ok(())
10729        }
10730    }
10731
10732    impl GetNextFrameArgs {
10733        #[inline(always)]
10734        fn max_ordinal_present(&self) -> u64 {
10735            if let Some(_) = self.event {
10736                return 1;
10737            }
10738            0
10739        }
10740    }
10741
10742    impl fidl::encoding::ResourceTypeMarker for GetNextFrameArgs {
10743        type Borrowed<'a> = &'a mut Self;
10744        fn take_or_borrow<'a>(
10745            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10746        ) -> Self::Borrowed<'a> {
10747            value
10748        }
10749    }
10750
10751    unsafe impl fidl::encoding::TypeMarker for GetNextFrameArgs {
10752        type Owned = Self;
10753
10754        #[inline(always)]
10755        fn inline_align(_context: fidl::encoding::Context) -> usize {
10756            8
10757        }
10758
10759        #[inline(always)]
10760        fn inline_size(_context: fidl::encoding::Context) -> usize {
10761            16
10762        }
10763    }
10764
10765    unsafe impl
10766        fidl::encoding::Encode<GetNextFrameArgs, fidl::encoding::DefaultFuchsiaResourceDialect>
10767        for &mut GetNextFrameArgs
10768    {
10769        unsafe fn encode(
10770            self,
10771            encoder: &mut fidl::encoding::Encoder<
10772                '_,
10773                fidl::encoding::DefaultFuchsiaResourceDialect,
10774            >,
10775            offset: usize,
10776            mut depth: fidl::encoding::Depth,
10777        ) -> fidl::Result<()> {
10778            encoder.debug_check_bounds::<GetNextFrameArgs>(offset);
10779            // Vector header
10780            let max_ordinal: u64 = self.max_ordinal_present();
10781            encoder.write_num(max_ordinal, offset);
10782            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
10783            // Calling encoder.out_of_line_offset(0) is not allowed.
10784            if max_ordinal == 0 {
10785                return Ok(());
10786            }
10787            depth.increment()?;
10788            let envelope_size = 8;
10789            let bytes_len = max_ordinal as usize * envelope_size;
10790            #[allow(unused_variables)]
10791            let offset = encoder.out_of_line_offset(bytes_len);
10792            let mut _prev_end_offset: usize = 0;
10793            if 1 > max_ordinal {
10794                return Ok(());
10795            }
10796
10797            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
10798            // are envelope_size bytes.
10799            let cur_offset: usize = (1 - 1) * envelope_size;
10800
10801            // Zero reserved fields.
10802            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
10803
10804            // Safety:
10805            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
10806            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
10807            //   envelope_size bytes, there is always sufficient room.
10808            fidl::encoding::encode_in_envelope_optional::<
10809                fidl::encoding::HandleType<
10810                    fidl::Event,
10811                    { fidl::ObjectType::EVENT.into_raw() },
10812                    2147483648,
10813                >,
10814                fidl::encoding::DefaultFuchsiaResourceDialect,
10815            >(
10816                self.event.as_mut().map(
10817                    <fidl::encoding::HandleType<
10818                        fidl::Event,
10819                        { fidl::ObjectType::EVENT.into_raw() },
10820                        2147483648,
10821                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
10822                ),
10823                encoder,
10824                offset + cur_offset,
10825                depth,
10826            )?;
10827
10828            _prev_end_offset = cur_offset + envelope_size;
10829
10830            Ok(())
10831        }
10832    }
10833
10834    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10835        for GetNextFrameArgs
10836    {
10837        #[inline(always)]
10838        fn new_empty() -> Self {
10839            Self::default()
10840        }
10841
10842        unsafe fn decode(
10843            &mut self,
10844            decoder: &mut fidl::encoding::Decoder<
10845                '_,
10846                fidl::encoding::DefaultFuchsiaResourceDialect,
10847            >,
10848            offset: usize,
10849            mut depth: fidl::encoding::Depth,
10850        ) -> fidl::Result<()> {
10851            decoder.debug_check_bounds::<Self>(offset);
10852            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
10853                None => return Err(fidl::Error::NotNullable),
10854                Some(len) => len,
10855            };
10856            // Calling decoder.out_of_line_offset(0) is not allowed.
10857            if len == 0 {
10858                return Ok(());
10859            };
10860            depth.increment()?;
10861            let envelope_size = 8;
10862            let bytes_len = len * envelope_size;
10863            let offset = decoder.out_of_line_offset(bytes_len)?;
10864            // Decode the envelope for each type.
10865            let mut _next_ordinal_to_read = 0;
10866            let mut next_offset = offset;
10867            let end_offset = offset + bytes_len;
10868            _next_ordinal_to_read += 1;
10869            if next_offset >= end_offset {
10870                return Ok(());
10871            }
10872
10873            // Decode unknown envelopes for gaps in ordinals.
10874            while _next_ordinal_to_read < 1 {
10875                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10876                _next_ordinal_to_read += 1;
10877                next_offset += envelope_size;
10878            }
10879
10880            let next_out_of_line = decoder.next_out_of_line();
10881            let handles_before = decoder.remaining_handles();
10882            if let Some((inlined, num_bytes, num_handles)) =
10883                fidl::encoding::decode_envelope_header(decoder, next_offset)?
10884            {
10885                let member_inline_size = <fidl::encoding::HandleType<
10886                    fidl::Event,
10887                    { fidl::ObjectType::EVENT.into_raw() },
10888                    2147483648,
10889                > as fidl::encoding::TypeMarker>::inline_size(
10890                    decoder.context
10891                );
10892                if inlined != (member_inline_size <= 4) {
10893                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
10894                }
10895                let inner_offset;
10896                let mut inner_depth = depth.clone();
10897                if inlined {
10898                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
10899                    inner_offset = next_offset;
10900                } else {
10901                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
10902                    inner_depth.increment()?;
10903                }
10904                let val_ref =
10905                self.event.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
10906                fidl::decode!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
10907                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
10908                {
10909                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
10910                }
10911                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
10912                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
10913                }
10914            }
10915
10916            next_offset += envelope_size;
10917
10918            // Decode the remaining unknown envelopes.
10919            while next_offset < end_offset {
10920                _next_ordinal_to_read += 1;
10921                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10922                next_offset += envelope_size;
10923            }
10924
10925            Ok(())
10926        }
10927    }
10928
10929    impl PresentArgs {
10930        #[inline(always)]
10931        fn max_ordinal_present(&self) -> u64 {
10932            if let Some(_) = self.unsquashable {
10933                return 4;
10934            }
10935            if let Some(_) = self.release_fences {
10936                return 3;
10937            }
10938            if let Some(_) = self.acquire_fences {
10939                return 2;
10940            }
10941            if let Some(_) = self.requested_presentation_time {
10942                return 1;
10943            }
10944            0
10945        }
10946    }
10947
10948    impl fidl::encoding::ResourceTypeMarker for PresentArgs {
10949        type Borrowed<'a> = &'a mut Self;
10950        fn take_or_borrow<'a>(
10951            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10952        ) -> Self::Borrowed<'a> {
10953            value
10954        }
10955    }
10956
10957    unsafe impl fidl::encoding::TypeMarker for PresentArgs {
10958        type Owned = Self;
10959
10960        #[inline(always)]
10961        fn inline_align(_context: fidl::encoding::Context) -> usize {
10962            8
10963        }
10964
10965        #[inline(always)]
10966        fn inline_size(_context: fidl::encoding::Context) -> usize {
10967            16
10968        }
10969    }
10970
10971    unsafe impl fidl::encoding::Encode<PresentArgs, fidl::encoding::DefaultFuchsiaResourceDialect>
10972        for &mut PresentArgs
10973    {
10974        unsafe fn encode(
10975            self,
10976            encoder: &mut fidl::encoding::Encoder<
10977                '_,
10978                fidl::encoding::DefaultFuchsiaResourceDialect,
10979            >,
10980            offset: usize,
10981            mut depth: fidl::encoding::Depth,
10982        ) -> fidl::Result<()> {
10983            encoder.debug_check_bounds::<PresentArgs>(offset);
10984            // Vector header
10985            let max_ordinal: u64 = self.max_ordinal_present();
10986            encoder.write_num(max_ordinal, offset);
10987            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
10988            // Calling encoder.out_of_line_offset(0) is not allowed.
10989            if max_ordinal == 0 {
10990                return Ok(());
10991            }
10992            depth.increment()?;
10993            let envelope_size = 8;
10994            let bytes_len = max_ordinal as usize * envelope_size;
10995            #[allow(unused_variables)]
10996            let offset = encoder.out_of_line_offset(bytes_len);
10997            let mut _prev_end_offset: usize = 0;
10998            if 1 > max_ordinal {
10999                return Ok(());
11000            }
11001
11002            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11003            // are envelope_size bytes.
11004            let cur_offset: usize = (1 - 1) * envelope_size;
11005
11006            // Zero reserved fields.
11007            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11008
11009            // Safety:
11010            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11011            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11012            //   envelope_size bytes, there is always sufficient room.
11013            fidl::encoding::encode_in_envelope_optional::<
11014                i64,
11015                fidl::encoding::DefaultFuchsiaResourceDialect,
11016            >(
11017                self.requested_presentation_time
11018                    .as_ref()
11019                    .map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
11020                encoder,
11021                offset + cur_offset,
11022                depth,
11023            )?;
11024
11025            _prev_end_offset = cur_offset + envelope_size;
11026            if 2 > max_ordinal {
11027                return Ok(());
11028            }
11029
11030            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11031            // are envelope_size bytes.
11032            let cur_offset: usize = (2 - 1) * envelope_size;
11033
11034            // Zero reserved fields.
11035            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11036
11037            // Safety:
11038            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11039            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11040            //   envelope_size bytes, there is always sufficient room.
11041            fidl::encoding::encode_in_envelope_optional::<
11042                fidl::encoding::Vector<
11043                    fidl::encoding::HandleType<
11044                        fidl::Event,
11045                        { fidl::ObjectType::EVENT.into_raw() },
11046                        2147483648,
11047                    >,
11048                    16,
11049                >,
11050                fidl::encoding::DefaultFuchsiaResourceDialect,
11051            >(
11052                self.acquire_fences.as_mut().map(
11053                    <fidl::encoding::Vector<
11054                        fidl::encoding::HandleType<
11055                            fidl::Event,
11056                            { fidl::ObjectType::EVENT.into_raw() },
11057                            2147483648,
11058                        >,
11059                        16,
11060                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
11061                ),
11062                encoder,
11063                offset + cur_offset,
11064                depth,
11065            )?;
11066
11067            _prev_end_offset = cur_offset + envelope_size;
11068            if 3 > max_ordinal {
11069                return Ok(());
11070            }
11071
11072            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11073            // are envelope_size bytes.
11074            let cur_offset: usize = (3 - 1) * envelope_size;
11075
11076            // Zero reserved fields.
11077            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11078
11079            // Safety:
11080            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11081            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11082            //   envelope_size bytes, there is always sufficient room.
11083            fidl::encoding::encode_in_envelope_optional::<
11084                fidl::encoding::Vector<
11085                    fidl::encoding::HandleType<
11086                        fidl::Event,
11087                        { fidl::ObjectType::EVENT.into_raw() },
11088                        2147483648,
11089                    >,
11090                    16,
11091                >,
11092                fidl::encoding::DefaultFuchsiaResourceDialect,
11093            >(
11094                self.release_fences.as_mut().map(
11095                    <fidl::encoding::Vector<
11096                        fidl::encoding::HandleType<
11097                            fidl::Event,
11098                            { fidl::ObjectType::EVENT.into_raw() },
11099                            2147483648,
11100                        >,
11101                        16,
11102                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
11103                ),
11104                encoder,
11105                offset + cur_offset,
11106                depth,
11107            )?;
11108
11109            _prev_end_offset = cur_offset + envelope_size;
11110            if 4 > max_ordinal {
11111                return Ok(());
11112            }
11113
11114            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11115            // are envelope_size bytes.
11116            let cur_offset: usize = (4 - 1) * envelope_size;
11117
11118            // Zero reserved fields.
11119            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11120
11121            // Safety:
11122            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11123            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11124            //   envelope_size bytes, there is always sufficient room.
11125            fidl::encoding::encode_in_envelope_optional::<
11126                bool,
11127                fidl::encoding::DefaultFuchsiaResourceDialect,
11128            >(
11129                self.unsquashable.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
11130                encoder,
11131                offset + cur_offset,
11132                depth,
11133            )?;
11134
11135            _prev_end_offset = cur_offset + envelope_size;
11136
11137            Ok(())
11138        }
11139    }
11140
11141    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for PresentArgs {
11142        #[inline(always)]
11143        fn new_empty() -> Self {
11144            Self::default()
11145        }
11146
11147        unsafe fn decode(
11148            &mut self,
11149            decoder: &mut fidl::encoding::Decoder<
11150                '_,
11151                fidl::encoding::DefaultFuchsiaResourceDialect,
11152            >,
11153            offset: usize,
11154            mut depth: fidl::encoding::Depth,
11155        ) -> fidl::Result<()> {
11156            decoder.debug_check_bounds::<Self>(offset);
11157            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
11158                None => return Err(fidl::Error::NotNullable),
11159                Some(len) => len,
11160            };
11161            // Calling decoder.out_of_line_offset(0) is not allowed.
11162            if len == 0 {
11163                return Ok(());
11164            };
11165            depth.increment()?;
11166            let envelope_size = 8;
11167            let bytes_len = len * envelope_size;
11168            let offset = decoder.out_of_line_offset(bytes_len)?;
11169            // Decode the envelope for each type.
11170            let mut _next_ordinal_to_read = 0;
11171            let mut next_offset = offset;
11172            let end_offset = offset + bytes_len;
11173            _next_ordinal_to_read += 1;
11174            if next_offset >= end_offset {
11175                return Ok(());
11176            }
11177
11178            // Decode unknown envelopes for gaps in ordinals.
11179            while _next_ordinal_to_read < 1 {
11180                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11181                _next_ordinal_to_read += 1;
11182                next_offset += envelope_size;
11183            }
11184
11185            let next_out_of_line = decoder.next_out_of_line();
11186            let handles_before = decoder.remaining_handles();
11187            if let Some((inlined, num_bytes, num_handles)) =
11188                fidl::encoding::decode_envelope_header(decoder, next_offset)?
11189            {
11190                let member_inline_size =
11191                    <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
11192                if inlined != (member_inline_size <= 4) {
11193                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
11194                }
11195                let inner_offset;
11196                let mut inner_depth = depth.clone();
11197                if inlined {
11198                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11199                    inner_offset = next_offset;
11200                } else {
11201                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11202                    inner_depth.increment()?;
11203                }
11204                let val_ref = self.requested_presentation_time.get_or_insert_with(|| {
11205                    fidl::new_empty!(i64, fidl::encoding::DefaultFuchsiaResourceDialect)
11206                });
11207                fidl::decode!(
11208                    i64,
11209                    fidl::encoding::DefaultFuchsiaResourceDialect,
11210                    val_ref,
11211                    decoder,
11212                    inner_offset,
11213                    inner_depth
11214                )?;
11215                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11216                {
11217                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
11218                }
11219                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11220                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11221                }
11222            }
11223
11224            next_offset += envelope_size;
11225            _next_ordinal_to_read += 1;
11226            if next_offset >= end_offset {
11227                return Ok(());
11228            }
11229
11230            // Decode unknown envelopes for gaps in ordinals.
11231            while _next_ordinal_to_read < 2 {
11232                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11233                _next_ordinal_to_read += 1;
11234                next_offset += envelope_size;
11235            }
11236
11237            let next_out_of_line = decoder.next_out_of_line();
11238            let handles_before = decoder.remaining_handles();
11239            if let Some((inlined, num_bytes, num_handles)) =
11240                fidl::encoding::decode_envelope_header(decoder, next_offset)?
11241            {
11242                let member_inline_size = <fidl::encoding::Vector<
11243                    fidl::encoding::HandleType<
11244                        fidl::Event,
11245                        { fidl::ObjectType::EVENT.into_raw() },
11246                        2147483648,
11247                    >,
11248                    16,
11249                > as fidl::encoding::TypeMarker>::inline_size(
11250                    decoder.context
11251                );
11252                if inlined != (member_inline_size <= 4) {
11253                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
11254                }
11255                let inner_offset;
11256                let mut inner_depth = depth.clone();
11257                if inlined {
11258                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11259                    inner_offset = next_offset;
11260                } else {
11261                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11262                    inner_depth.increment()?;
11263                }
11264                let val_ref = self.acquire_fences.get_or_insert_with(|| {
11265                    fidl::new_empty!(
11266                        fidl::encoding::Vector<
11267                            fidl::encoding::HandleType<
11268                                fidl::Event,
11269                                { fidl::ObjectType::EVENT.into_raw() },
11270                                2147483648,
11271                            >,
11272                            16,
11273                        >,
11274                        fidl::encoding::DefaultFuchsiaResourceDialect
11275                    )
11276                });
11277                fidl::decode!(
11278                    fidl::encoding::Vector<
11279                        fidl::encoding::HandleType<
11280                            fidl::Event,
11281                            { fidl::ObjectType::EVENT.into_raw() },
11282                            2147483648,
11283                        >,
11284                        16,
11285                    >,
11286                    fidl::encoding::DefaultFuchsiaResourceDialect,
11287                    val_ref,
11288                    decoder,
11289                    inner_offset,
11290                    inner_depth
11291                )?;
11292                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11293                {
11294                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
11295                }
11296                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11297                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11298                }
11299            }
11300
11301            next_offset += envelope_size;
11302            _next_ordinal_to_read += 1;
11303            if next_offset >= end_offset {
11304                return Ok(());
11305            }
11306
11307            // Decode unknown envelopes for gaps in ordinals.
11308            while _next_ordinal_to_read < 3 {
11309                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11310                _next_ordinal_to_read += 1;
11311                next_offset += envelope_size;
11312            }
11313
11314            let next_out_of_line = decoder.next_out_of_line();
11315            let handles_before = decoder.remaining_handles();
11316            if let Some((inlined, num_bytes, num_handles)) =
11317                fidl::encoding::decode_envelope_header(decoder, next_offset)?
11318            {
11319                let member_inline_size = <fidl::encoding::Vector<
11320                    fidl::encoding::HandleType<
11321                        fidl::Event,
11322                        { fidl::ObjectType::EVENT.into_raw() },
11323                        2147483648,
11324                    >,
11325                    16,
11326                > as fidl::encoding::TypeMarker>::inline_size(
11327                    decoder.context
11328                );
11329                if inlined != (member_inline_size <= 4) {
11330                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
11331                }
11332                let inner_offset;
11333                let mut inner_depth = depth.clone();
11334                if inlined {
11335                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11336                    inner_offset = next_offset;
11337                } else {
11338                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11339                    inner_depth.increment()?;
11340                }
11341                let val_ref = self.release_fences.get_or_insert_with(|| {
11342                    fidl::new_empty!(
11343                        fidl::encoding::Vector<
11344                            fidl::encoding::HandleType<
11345                                fidl::Event,
11346                                { fidl::ObjectType::EVENT.into_raw() },
11347                                2147483648,
11348                            >,
11349                            16,
11350                        >,
11351                        fidl::encoding::DefaultFuchsiaResourceDialect
11352                    )
11353                });
11354                fidl::decode!(
11355                    fidl::encoding::Vector<
11356                        fidl::encoding::HandleType<
11357                            fidl::Event,
11358                            { fidl::ObjectType::EVENT.into_raw() },
11359                            2147483648,
11360                        >,
11361                        16,
11362                    >,
11363                    fidl::encoding::DefaultFuchsiaResourceDialect,
11364                    val_ref,
11365                    decoder,
11366                    inner_offset,
11367                    inner_depth
11368                )?;
11369                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11370                {
11371                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
11372                }
11373                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11374                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11375                }
11376            }
11377
11378            next_offset += envelope_size;
11379            _next_ordinal_to_read += 1;
11380            if next_offset >= end_offset {
11381                return Ok(());
11382            }
11383
11384            // Decode unknown envelopes for gaps in ordinals.
11385            while _next_ordinal_to_read < 4 {
11386                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11387                _next_ordinal_to_read += 1;
11388                next_offset += envelope_size;
11389            }
11390
11391            let next_out_of_line = decoder.next_out_of_line();
11392            let handles_before = decoder.remaining_handles();
11393            if let Some((inlined, num_bytes, num_handles)) =
11394                fidl::encoding::decode_envelope_header(decoder, next_offset)?
11395            {
11396                let member_inline_size =
11397                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
11398                if inlined != (member_inline_size <= 4) {
11399                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
11400                }
11401                let inner_offset;
11402                let mut inner_depth = depth.clone();
11403                if inlined {
11404                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11405                    inner_offset = next_offset;
11406                } else {
11407                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11408                    inner_depth.increment()?;
11409                }
11410                let val_ref = self.unsquashable.get_or_insert_with(|| {
11411                    fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
11412                });
11413                fidl::decode!(
11414                    bool,
11415                    fidl::encoding::DefaultFuchsiaResourceDialect,
11416                    val_ref,
11417                    decoder,
11418                    inner_offset,
11419                    inner_depth
11420                )?;
11421                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11422                {
11423                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
11424                }
11425                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11426                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11427                }
11428            }
11429
11430            next_offset += envelope_size;
11431
11432            // Decode the remaining unknown envelopes.
11433            while next_offset < end_offset {
11434                _next_ordinal_to_read += 1;
11435                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11436                next_offset += envelope_size;
11437            }
11438
11439            Ok(())
11440        }
11441    }
11442
11443    impl RegisterBufferCollectionArgs {
11444        #[inline(always)]
11445        fn max_ordinal_present(&self) -> u64 {
11446            if let Some(_) = self.buffer_collection_token2 {
11447                return 5;
11448            }
11449            if let Some(_) = self.usages {
11450                return 4;
11451            }
11452            if let Some(_) = self.usage {
11453                return 3;
11454            }
11455            if let Some(_) = self.buffer_collection_token {
11456                return 2;
11457            }
11458            if let Some(_) = self.export_token {
11459                return 1;
11460            }
11461            0
11462        }
11463    }
11464
11465    impl fidl::encoding::ResourceTypeMarker for RegisterBufferCollectionArgs {
11466        type Borrowed<'a> = &'a mut Self;
11467        fn take_or_borrow<'a>(
11468            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11469        ) -> Self::Borrowed<'a> {
11470            value
11471        }
11472    }
11473
11474    unsafe impl fidl::encoding::TypeMarker for RegisterBufferCollectionArgs {
11475        type Owned = Self;
11476
11477        #[inline(always)]
11478        fn inline_align(_context: fidl::encoding::Context) -> usize {
11479            8
11480        }
11481
11482        #[inline(always)]
11483        fn inline_size(_context: fidl::encoding::Context) -> usize {
11484            16
11485        }
11486    }
11487
11488    unsafe impl
11489        fidl::encoding::Encode<
11490            RegisterBufferCollectionArgs,
11491            fidl::encoding::DefaultFuchsiaResourceDialect,
11492        > for &mut RegisterBufferCollectionArgs
11493    {
11494        unsafe fn encode(
11495            self,
11496            encoder: &mut fidl::encoding::Encoder<
11497                '_,
11498                fidl::encoding::DefaultFuchsiaResourceDialect,
11499            >,
11500            offset: usize,
11501            mut depth: fidl::encoding::Depth,
11502        ) -> fidl::Result<()> {
11503            encoder.debug_check_bounds::<RegisterBufferCollectionArgs>(offset);
11504            // Vector header
11505            let max_ordinal: u64 = self.max_ordinal_present();
11506            encoder.write_num(max_ordinal, offset);
11507            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
11508            // Calling encoder.out_of_line_offset(0) is not allowed.
11509            if max_ordinal == 0 {
11510                return Ok(());
11511            }
11512            depth.increment()?;
11513            let envelope_size = 8;
11514            let bytes_len = max_ordinal as usize * envelope_size;
11515            #[allow(unused_variables)]
11516            let offset = encoder.out_of_line_offset(bytes_len);
11517            let mut _prev_end_offset: usize = 0;
11518            if 1 > max_ordinal {
11519                return Ok(());
11520            }
11521
11522            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11523            // are envelope_size bytes.
11524            let cur_offset: usize = (1 - 1) * envelope_size;
11525
11526            // Zero reserved fields.
11527            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11528
11529            // Safety:
11530            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11531            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11532            //   envelope_size bytes, there is always sufficient room.
11533            fidl::encoding::encode_in_envelope_optional::<BufferCollectionExportToken, fidl::encoding::DefaultFuchsiaResourceDialect>(
11534            self.export_token.as_mut().map(<BufferCollectionExportToken as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
11535            encoder, offset + cur_offset, depth
11536        )?;
11537
11538            _prev_end_offset = cur_offset + envelope_size;
11539            if 2 > max_ordinal {
11540                return Ok(());
11541            }
11542
11543            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11544            // are envelope_size bytes.
11545            let cur_offset: usize = (2 - 1) * envelope_size;
11546
11547            // Zero reserved fields.
11548            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11549
11550            // Safety:
11551            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11552            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11553            //   envelope_size bytes, there is always sufficient room.
11554            fidl::encoding::encode_in_envelope_optional::<
11555                fidl::encoding::Endpoint<
11556                    fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem::BufferCollectionTokenMarker>,
11557                >,
11558                fidl::encoding::DefaultFuchsiaResourceDialect,
11559            >(
11560                self.buffer_collection_token.as_mut().map(
11561                    <fidl::encoding::Endpoint<
11562                        fidl::endpoints::ClientEnd<
11563                            fidl_fuchsia_sysmem::BufferCollectionTokenMarker,
11564                        >,
11565                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
11566                ),
11567                encoder,
11568                offset + cur_offset,
11569                depth,
11570            )?;
11571
11572            _prev_end_offset = cur_offset + envelope_size;
11573            if 3 > max_ordinal {
11574                return Ok(());
11575            }
11576
11577            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11578            // are envelope_size bytes.
11579            let cur_offset: usize = (3 - 1) * envelope_size;
11580
11581            // Zero reserved fields.
11582            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11583
11584            // Safety:
11585            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11586            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11587            //   envelope_size bytes, there is always sufficient room.
11588            fidl::encoding::encode_in_envelope_optional::<
11589                RegisterBufferCollectionUsage,
11590                fidl::encoding::DefaultFuchsiaResourceDialect,
11591            >(
11592                self.usage.as_ref().map(
11593                    <RegisterBufferCollectionUsage as fidl::encoding::ValueTypeMarker>::borrow,
11594                ),
11595                encoder,
11596                offset + cur_offset,
11597                depth,
11598            )?;
11599
11600            _prev_end_offset = cur_offset + envelope_size;
11601            if 4 > max_ordinal {
11602                return Ok(());
11603            }
11604
11605            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11606            // are envelope_size bytes.
11607            let cur_offset: usize = (4 - 1) * envelope_size;
11608
11609            // Zero reserved fields.
11610            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11611
11612            // Safety:
11613            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11614            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11615            //   envelope_size bytes, there is always sufficient room.
11616            fidl::encoding::encode_in_envelope_optional::<
11617                RegisterBufferCollectionUsages,
11618                fidl::encoding::DefaultFuchsiaResourceDialect,
11619            >(
11620                self.usages.as_ref().map(
11621                    <RegisterBufferCollectionUsages as fidl::encoding::ValueTypeMarker>::borrow,
11622                ),
11623                encoder,
11624                offset + cur_offset,
11625                depth,
11626            )?;
11627
11628            _prev_end_offset = cur_offset + envelope_size;
11629            if 5 > max_ordinal {
11630                return Ok(());
11631            }
11632
11633            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11634            // are envelope_size bytes.
11635            let cur_offset: usize = (5 - 1) * envelope_size;
11636
11637            // Zero reserved fields.
11638            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11639
11640            // Safety:
11641            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11642            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11643            //   envelope_size bytes, there is always sufficient room.
11644            fidl::encoding::encode_in_envelope_optional::<
11645                fidl::encoding::Endpoint<
11646                    fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem2::BufferCollectionTokenMarker>,
11647                >,
11648                fidl::encoding::DefaultFuchsiaResourceDialect,
11649            >(
11650                self.buffer_collection_token2.as_mut().map(
11651                    <fidl::encoding::Endpoint<
11652                        fidl::endpoints::ClientEnd<
11653                            fidl_fuchsia_sysmem2::BufferCollectionTokenMarker,
11654                        >,
11655                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
11656                ),
11657                encoder,
11658                offset + cur_offset,
11659                depth,
11660            )?;
11661
11662            _prev_end_offset = cur_offset + envelope_size;
11663
11664            Ok(())
11665        }
11666    }
11667
11668    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11669        for RegisterBufferCollectionArgs
11670    {
11671        #[inline(always)]
11672        fn new_empty() -> Self {
11673            Self::default()
11674        }
11675
11676        unsafe fn decode(
11677            &mut self,
11678            decoder: &mut fidl::encoding::Decoder<
11679                '_,
11680                fidl::encoding::DefaultFuchsiaResourceDialect,
11681            >,
11682            offset: usize,
11683            mut depth: fidl::encoding::Depth,
11684        ) -> fidl::Result<()> {
11685            decoder.debug_check_bounds::<Self>(offset);
11686            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
11687                None => return Err(fidl::Error::NotNullable),
11688                Some(len) => len,
11689            };
11690            // Calling decoder.out_of_line_offset(0) is not allowed.
11691            if len == 0 {
11692                return Ok(());
11693            };
11694            depth.increment()?;
11695            let envelope_size = 8;
11696            let bytes_len = len * envelope_size;
11697            let offset = decoder.out_of_line_offset(bytes_len)?;
11698            // Decode the envelope for each type.
11699            let mut _next_ordinal_to_read = 0;
11700            let mut next_offset = offset;
11701            let end_offset = offset + bytes_len;
11702            _next_ordinal_to_read += 1;
11703            if next_offset >= end_offset {
11704                return Ok(());
11705            }
11706
11707            // Decode unknown envelopes for gaps in ordinals.
11708            while _next_ordinal_to_read < 1 {
11709                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11710                _next_ordinal_to_read += 1;
11711                next_offset += envelope_size;
11712            }
11713
11714            let next_out_of_line = decoder.next_out_of_line();
11715            let handles_before = decoder.remaining_handles();
11716            if let Some((inlined, num_bytes, num_handles)) =
11717                fidl::encoding::decode_envelope_header(decoder, next_offset)?
11718            {
11719                let member_inline_size =
11720                    <BufferCollectionExportToken as fidl::encoding::TypeMarker>::inline_size(
11721                        decoder.context,
11722                    );
11723                if inlined != (member_inline_size <= 4) {
11724                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
11725                }
11726                let inner_offset;
11727                let mut inner_depth = depth.clone();
11728                if inlined {
11729                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11730                    inner_offset = next_offset;
11731                } else {
11732                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11733                    inner_depth.increment()?;
11734                }
11735                let val_ref = self.export_token.get_or_insert_with(|| {
11736                    fidl::new_empty!(
11737                        BufferCollectionExportToken,
11738                        fidl::encoding::DefaultFuchsiaResourceDialect
11739                    )
11740                });
11741                fidl::decode!(
11742                    BufferCollectionExportToken,
11743                    fidl::encoding::DefaultFuchsiaResourceDialect,
11744                    val_ref,
11745                    decoder,
11746                    inner_offset,
11747                    inner_depth
11748                )?;
11749                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11750                {
11751                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
11752                }
11753                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11754                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11755                }
11756            }
11757
11758            next_offset += envelope_size;
11759            _next_ordinal_to_read += 1;
11760            if next_offset >= end_offset {
11761                return Ok(());
11762            }
11763
11764            // Decode unknown envelopes for gaps in ordinals.
11765            while _next_ordinal_to_read < 2 {
11766                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11767                _next_ordinal_to_read += 1;
11768                next_offset += envelope_size;
11769            }
11770
11771            let next_out_of_line = decoder.next_out_of_line();
11772            let handles_before = decoder.remaining_handles();
11773            if let Some((inlined, num_bytes, num_handles)) =
11774                fidl::encoding::decode_envelope_header(decoder, next_offset)?
11775            {
11776                let member_inline_size = <fidl::encoding::Endpoint<
11777                    fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem::BufferCollectionTokenMarker>,
11778                > as fidl::encoding::TypeMarker>::inline_size(
11779                    decoder.context
11780                );
11781                if inlined != (member_inline_size <= 4) {
11782                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
11783                }
11784                let inner_offset;
11785                let mut inner_depth = depth.clone();
11786                if inlined {
11787                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11788                    inner_offset = next_offset;
11789                } else {
11790                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11791                    inner_depth.increment()?;
11792                }
11793                let val_ref = self.buffer_collection_token.get_or_insert_with(|| {
11794                    fidl::new_empty!(
11795                        fidl::encoding::Endpoint<
11796                            fidl::endpoints::ClientEnd<
11797                                fidl_fuchsia_sysmem::BufferCollectionTokenMarker,
11798                            >,
11799                        >,
11800                        fidl::encoding::DefaultFuchsiaResourceDialect
11801                    )
11802                });
11803                fidl::decode!(
11804                    fidl::encoding::Endpoint<
11805                        fidl::endpoints::ClientEnd<
11806                            fidl_fuchsia_sysmem::BufferCollectionTokenMarker,
11807                        >,
11808                    >,
11809                    fidl::encoding::DefaultFuchsiaResourceDialect,
11810                    val_ref,
11811                    decoder,
11812                    inner_offset,
11813                    inner_depth
11814                )?;
11815                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11816                {
11817                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
11818                }
11819                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11820                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11821                }
11822            }
11823
11824            next_offset += envelope_size;
11825            _next_ordinal_to_read += 1;
11826            if next_offset >= end_offset {
11827                return Ok(());
11828            }
11829
11830            // Decode unknown envelopes for gaps in ordinals.
11831            while _next_ordinal_to_read < 3 {
11832                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11833                _next_ordinal_to_read += 1;
11834                next_offset += envelope_size;
11835            }
11836
11837            let next_out_of_line = decoder.next_out_of_line();
11838            let handles_before = decoder.remaining_handles();
11839            if let Some((inlined, num_bytes, num_handles)) =
11840                fidl::encoding::decode_envelope_header(decoder, next_offset)?
11841            {
11842                let member_inline_size =
11843                    <RegisterBufferCollectionUsage as fidl::encoding::TypeMarker>::inline_size(
11844                        decoder.context,
11845                    );
11846                if inlined != (member_inline_size <= 4) {
11847                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
11848                }
11849                let inner_offset;
11850                let mut inner_depth = depth.clone();
11851                if inlined {
11852                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11853                    inner_offset = next_offset;
11854                } else {
11855                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11856                    inner_depth.increment()?;
11857                }
11858                let val_ref = self.usage.get_or_insert_with(|| {
11859                    fidl::new_empty!(
11860                        RegisterBufferCollectionUsage,
11861                        fidl::encoding::DefaultFuchsiaResourceDialect
11862                    )
11863                });
11864                fidl::decode!(
11865                    RegisterBufferCollectionUsage,
11866                    fidl::encoding::DefaultFuchsiaResourceDialect,
11867                    val_ref,
11868                    decoder,
11869                    inner_offset,
11870                    inner_depth
11871                )?;
11872                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11873                {
11874                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
11875                }
11876                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11877                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11878                }
11879            }
11880
11881            next_offset += envelope_size;
11882            _next_ordinal_to_read += 1;
11883            if next_offset >= end_offset {
11884                return Ok(());
11885            }
11886
11887            // Decode unknown envelopes for gaps in ordinals.
11888            while _next_ordinal_to_read < 4 {
11889                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11890                _next_ordinal_to_read += 1;
11891                next_offset += envelope_size;
11892            }
11893
11894            let next_out_of_line = decoder.next_out_of_line();
11895            let handles_before = decoder.remaining_handles();
11896            if let Some((inlined, num_bytes, num_handles)) =
11897                fidl::encoding::decode_envelope_header(decoder, next_offset)?
11898            {
11899                let member_inline_size =
11900                    <RegisterBufferCollectionUsages as fidl::encoding::TypeMarker>::inline_size(
11901                        decoder.context,
11902                    );
11903                if inlined != (member_inline_size <= 4) {
11904                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
11905                }
11906                let inner_offset;
11907                let mut inner_depth = depth.clone();
11908                if inlined {
11909                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11910                    inner_offset = next_offset;
11911                } else {
11912                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11913                    inner_depth.increment()?;
11914                }
11915                let val_ref = self.usages.get_or_insert_with(|| {
11916                    fidl::new_empty!(
11917                        RegisterBufferCollectionUsages,
11918                        fidl::encoding::DefaultFuchsiaResourceDialect
11919                    )
11920                });
11921                fidl::decode!(
11922                    RegisterBufferCollectionUsages,
11923                    fidl::encoding::DefaultFuchsiaResourceDialect,
11924                    val_ref,
11925                    decoder,
11926                    inner_offset,
11927                    inner_depth
11928                )?;
11929                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11930                {
11931                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
11932                }
11933                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11934                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11935                }
11936            }
11937
11938            next_offset += envelope_size;
11939            _next_ordinal_to_read += 1;
11940            if next_offset >= end_offset {
11941                return Ok(());
11942            }
11943
11944            // Decode unknown envelopes for gaps in ordinals.
11945            while _next_ordinal_to_read < 5 {
11946                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11947                _next_ordinal_to_read += 1;
11948                next_offset += envelope_size;
11949            }
11950
11951            let next_out_of_line = decoder.next_out_of_line();
11952            let handles_before = decoder.remaining_handles();
11953            if let Some((inlined, num_bytes, num_handles)) =
11954                fidl::encoding::decode_envelope_header(decoder, next_offset)?
11955            {
11956                let member_inline_size = <fidl::encoding::Endpoint<
11957                    fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem2::BufferCollectionTokenMarker>,
11958                > as fidl::encoding::TypeMarker>::inline_size(
11959                    decoder.context
11960                );
11961                if inlined != (member_inline_size <= 4) {
11962                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
11963                }
11964                let inner_offset;
11965                let mut inner_depth = depth.clone();
11966                if inlined {
11967                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11968                    inner_offset = next_offset;
11969                } else {
11970                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11971                    inner_depth.increment()?;
11972                }
11973                let val_ref = self.buffer_collection_token2.get_or_insert_with(|| {
11974                    fidl::new_empty!(
11975                        fidl::encoding::Endpoint<
11976                            fidl::endpoints::ClientEnd<
11977                                fidl_fuchsia_sysmem2::BufferCollectionTokenMarker,
11978                            >,
11979                        >,
11980                        fidl::encoding::DefaultFuchsiaResourceDialect
11981                    )
11982                });
11983                fidl::decode!(
11984                    fidl::encoding::Endpoint<
11985                        fidl::endpoints::ClientEnd<
11986                            fidl_fuchsia_sysmem2::BufferCollectionTokenMarker,
11987                        >,
11988                    >,
11989                    fidl::encoding::DefaultFuchsiaResourceDialect,
11990                    val_ref,
11991                    decoder,
11992                    inner_offset,
11993                    inner_depth
11994                )?;
11995                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11996                {
11997                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
11998                }
11999                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12000                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12001                }
12002            }
12003
12004            next_offset += envelope_size;
12005
12006            // Decode the remaining unknown envelopes.
12007            while next_offset < end_offset {
12008                _next_ordinal_to_read += 1;
12009                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12010                next_offset += envelope_size;
12011            }
12012
12013            Ok(())
12014        }
12015    }
12016
12017    impl ScreenCaptureConfig {
12018        #[inline(always)]
12019        fn max_ordinal_present(&self) -> u64 {
12020            if let Some(_) = self.rotation {
12021                return 4;
12022            }
12023            if let Some(_) = self.buffer_count {
12024                return 3;
12025            }
12026            if let Some(_) = self.size {
12027                return 2;
12028            }
12029            if let Some(_) = self.import_token {
12030                return 1;
12031            }
12032            0
12033        }
12034    }
12035
12036    impl fidl::encoding::ResourceTypeMarker for ScreenCaptureConfig {
12037        type Borrowed<'a> = &'a mut Self;
12038        fn take_or_borrow<'a>(
12039            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12040        ) -> Self::Borrowed<'a> {
12041            value
12042        }
12043    }
12044
12045    unsafe impl fidl::encoding::TypeMarker for ScreenCaptureConfig {
12046        type Owned = Self;
12047
12048        #[inline(always)]
12049        fn inline_align(_context: fidl::encoding::Context) -> usize {
12050            8
12051        }
12052
12053        #[inline(always)]
12054        fn inline_size(_context: fidl::encoding::Context) -> usize {
12055            16
12056        }
12057    }
12058
12059    unsafe impl
12060        fidl::encoding::Encode<ScreenCaptureConfig, fidl::encoding::DefaultFuchsiaResourceDialect>
12061        for &mut ScreenCaptureConfig
12062    {
12063        unsafe fn encode(
12064            self,
12065            encoder: &mut fidl::encoding::Encoder<
12066                '_,
12067                fidl::encoding::DefaultFuchsiaResourceDialect,
12068            >,
12069            offset: usize,
12070            mut depth: fidl::encoding::Depth,
12071        ) -> fidl::Result<()> {
12072            encoder.debug_check_bounds::<ScreenCaptureConfig>(offset);
12073            // Vector header
12074            let max_ordinal: u64 = self.max_ordinal_present();
12075            encoder.write_num(max_ordinal, offset);
12076            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
12077            // Calling encoder.out_of_line_offset(0) is not allowed.
12078            if max_ordinal == 0 {
12079                return Ok(());
12080            }
12081            depth.increment()?;
12082            let envelope_size = 8;
12083            let bytes_len = max_ordinal as usize * envelope_size;
12084            #[allow(unused_variables)]
12085            let offset = encoder.out_of_line_offset(bytes_len);
12086            let mut _prev_end_offset: usize = 0;
12087            if 1 > max_ordinal {
12088                return Ok(());
12089            }
12090
12091            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12092            // are envelope_size bytes.
12093            let cur_offset: usize = (1 - 1) * envelope_size;
12094
12095            // Zero reserved fields.
12096            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12097
12098            // Safety:
12099            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12100            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12101            //   envelope_size bytes, there is always sufficient room.
12102            fidl::encoding::encode_in_envelope_optional::<BufferCollectionImportToken, fidl::encoding::DefaultFuchsiaResourceDialect>(
12103            self.import_token.as_mut().map(<BufferCollectionImportToken as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
12104            encoder, offset + cur_offset, depth
12105        )?;
12106
12107            _prev_end_offset = cur_offset + envelope_size;
12108            if 2 > max_ordinal {
12109                return Ok(());
12110            }
12111
12112            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12113            // are envelope_size bytes.
12114            let cur_offset: usize = (2 - 1) * envelope_size;
12115
12116            // Zero reserved fields.
12117            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12118
12119            // Safety:
12120            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12121            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12122            //   envelope_size bytes, there is always sufficient room.
12123            fidl::encoding::encode_in_envelope_optional::<
12124                fidl_fuchsia_math::SizeU,
12125                fidl::encoding::DefaultFuchsiaResourceDialect,
12126            >(
12127                self.size
12128                    .as_ref()
12129                    .map(<fidl_fuchsia_math::SizeU as fidl::encoding::ValueTypeMarker>::borrow),
12130                encoder,
12131                offset + cur_offset,
12132                depth,
12133            )?;
12134
12135            _prev_end_offset = cur_offset + envelope_size;
12136            if 3 > max_ordinal {
12137                return Ok(());
12138            }
12139
12140            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12141            // are envelope_size bytes.
12142            let cur_offset: usize = (3 - 1) * envelope_size;
12143
12144            // Zero reserved fields.
12145            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12146
12147            // Safety:
12148            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12149            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12150            //   envelope_size bytes, there is always sufficient room.
12151            fidl::encoding::encode_in_envelope_optional::<
12152                u32,
12153                fidl::encoding::DefaultFuchsiaResourceDialect,
12154            >(
12155                self.buffer_count.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
12156                encoder,
12157                offset + cur_offset,
12158                depth,
12159            )?;
12160
12161            _prev_end_offset = cur_offset + envelope_size;
12162            if 4 > max_ordinal {
12163                return Ok(());
12164            }
12165
12166            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12167            // are envelope_size bytes.
12168            let cur_offset: usize = (4 - 1) * envelope_size;
12169
12170            // Zero reserved fields.
12171            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12172
12173            // Safety:
12174            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12175            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12176            //   envelope_size bytes, there is always sufficient room.
12177            fidl::encoding::encode_in_envelope_optional::<
12178                Rotation,
12179                fidl::encoding::DefaultFuchsiaResourceDialect,
12180            >(
12181                self.rotation.as_ref().map(<Rotation as fidl::encoding::ValueTypeMarker>::borrow),
12182                encoder,
12183                offset + cur_offset,
12184                depth,
12185            )?;
12186
12187            _prev_end_offset = cur_offset + envelope_size;
12188
12189            Ok(())
12190        }
12191    }
12192
12193    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
12194        for ScreenCaptureConfig
12195    {
12196        #[inline(always)]
12197        fn new_empty() -> Self {
12198            Self::default()
12199        }
12200
12201        unsafe fn decode(
12202            &mut self,
12203            decoder: &mut fidl::encoding::Decoder<
12204                '_,
12205                fidl::encoding::DefaultFuchsiaResourceDialect,
12206            >,
12207            offset: usize,
12208            mut depth: fidl::encoding::Depth,
12209        ) -> fidl::Result<()> {
12210            decoder.debug_check_bounds::<Self>(offset);
12211            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
12212                None => return Err(fidl::Error::NotNullable),
12213                Some(len) => len,
12214            };
12215            // Calling decoder.out_of_line_offset(0) is not allowed.
12216            if len == 0 {
12217                return Ok(());
12218            };
12219            depth.increment()?;
12220            let envelope_size = 8;
12221            let bytes_len = len * envelope_size;
12222            let offset = decoder.out_of_line_offset(bytes_len)?;
12223            // Decode the envelope for each type.
12224            let mut _next_ordinal_to_read = 0;
12225            let mut next_offset = offset;
12226            let end_offset = offset + bytes_len;
12227            _next_ordinal_to_read += 1;
12228            if next_offset >= end_offset {
12229                return Ok(());
12230            }
12231
12232            // Decode unknown envelopes for gaps in ordinals.
12233            while _next_ordinal_to_read < 1 {
12234                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12235                _next_ordinal_to_read += 1;
12236                next_offset += envelope_size;
12237            }
12238
12239            let next_out_of_line = decoder.next_out_of_line();
12240            let handles_before = decoder.remaining_handles();
12241            if let Some((inlined, num_bytes, num_handles)) =
12242                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12243            {
12244                let member_inline_size =
12245                    <BufferCollectionImportToken as fidl::encoding::TypeMarker>::inline_size(
12246                        decoder.context,
12247                    );
12248                if inlined != (member_inline_size <= 4) {
12249                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12250                }
12251                let inner_offset;
12252                let mut inner_depth = depth.clone();
12253                if inlined {
12254                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12255                    inner_offset = next_offset;
12256                } else {
12257                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12258                    inner_depth.increment()?;
12259                }
12260                let val_ref = self.import_token.get_or_insert_with(|| {
12261                    fidl::new_empty!(
12262                        BufferCollectionImportToken,
12263                        fidl::encoding::DefaultFuchsiaResourceDialect
12264                    )
12265                });
12266                fidl::decode!(
12267                    BufferCollectionImportToken,
12268                    fidl::encoding::DefaultFuchsiaResourceDialect,
12269                    val_ref,
12270                    decoder,
12271                    inner_offset,
12272                    inner_depth
12273                )?;
12274                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12275                {
12276                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12277                }
12278                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12279                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12280                }
12281            }
12282
12283            next_offset += envelope_size;
12284            _next_ordinal_to_read += 1;
12285            if next_offset >= end_offset {
12286                return Ok(());
12287            }
12288
12289            // Decode unknown envelopes for gaps in ordinals.
12290            while _next_ordinal_to_read < 2 {
12291                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12292                _next_ordinal_to_read += 1;
12293                next_offset += envelope_size;
12294            }
12295
12296            let next_out_of_line = decoder.next_out_of_line();
12297            let handles_before = decoder.remaining_handles();
12298            if let Some((inlined, num_bytes, num_handles)) =
12299                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12300            {
12301                let member_inline_size =
12302                    <fidl_fuchsia_math::SizeU as fidl::encoding::TypeMarker>::inline_size(
12303                        decoder.context,
12304                    );
12305                if inlined != (member_inline_size <= 4) {
12306                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12307                }
12308                let inner_offset;
12309                let mut inner_depth = depth.clone();
12310                if inlined {
12311                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12312                    inner_offset = next_offset;
12313                } else {
12314                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12315                    inner_depth.increment()?;
12316                }
12317                let val_ref = self.size.get_or_insert_with(|| {
12318                    fidl::new_empty!(
12319                        fidl_fuchsia_math::SizeU,
12320                        fidl::encoding::DefaultFuchsiaResourceDialect
12321                    )
12322                });
12323                fidl::decode!(
12324                    fidl_fuchsia_math::SizeU,
12325                    fidl::encoding::DefaultFuchsiaResourceDialect,
12326                    val_ref,
12327                    decoder,
12328                    inner_offset,
12329                    inner_depth
12330                )?;
12331                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12332                {
12333                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12334                }
12335                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12336                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12337                }
12338            }
12339
12340            next_offset += envelope_size;
12341            _next_ordinal_to_read += 1;
12342            if next_offset >= end_offset {
12343                return Ok(());
12344            }
12345
12346            // Decode unknown envelopes for gaps in ordinals.
12347            while _next_ordinal_to_read < 3 {
12348                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12349                _next_ordinal_to_read += 1;
12350                next_offset += envelope_size;
12351            }
12352
12353            let next_out_of_line = decoder.next_out_of_line();
12354            let handles_before = decoder.remaining_handles();
12355            if let Some((inlined, num_bytes, num_handles)) =
12356                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12357            {
12358                let member_inline_size =
12359                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
12360                if inlined != (member_inline_size <= 4) {
12361                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12362                }
12363                let inner_offset;
12364                let mut inner_depth = depth.clone();
12365                if inlined {
12366                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12367                    inner_offset = next_offset;
12368                } else {
12369                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12370                    inner_depth.increment()?;
12371                }
12372                let val_ref = self.buffer_count.get_or_insert_with(|| {
12373                    fidl::new_empty!(u32, fidl::encoding::DefaultFuchsiaResourceDialect)
12374                });
12375                fidl::decode!(
12376                    u32,
12377                    fidl::encoding::DefaultFuchsiaResourceDialect,
12378                    val_ref,
12379                    decoder,
12380                    inner_offset,
12381                    inner_depth
12382                )?;
12383                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12384                {
12385                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12386                }
12387                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12388                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12389                }
12390            }
12391
12392            next_offset += envelope_size;
12393            _next_ordinal_to_read += 1;
12394            if next_offset >= end_offset {
12395                return Ok(());
12396            }
12397
12398            // Decode unknown envelopes for gaps in ordinals.
12399            while _next_ordinal_to_read < 4 {
12400                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12401                _next_ordinal_to_read += 1;
12402                next_offset += envelope_size;
12403            }
12404
12405            let next_out_of_line = decoder.next_out_of_line();
12406            let handles_before = decoder.remaining_handles();
12407            if let Some((inlined, num_bytes, num_handles)) =
12408                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12409            {
12410                let member_inline_size =
12411                    <Rotation as fidl::encoding::TypeMarker>::inline_size(decoder.context);
12412                if inlined != (member_inline_size <= 4) {
12413                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12414                }
12415                let inner_offset;
12416                let mut inner_depth = depth.clone();
12417                if inlined {
12418                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12419                    inner_offset = next_offset;
12420                } else {
12421                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12422                    inner_depth.increment()?;
12423                }
12424                let val_ref = self.rotation.get_or_insert_with(|| {
12425                    fidl::new_empty!(Rotation, fidl::encoding::DefaultFuchsiaResourceDialect)
12426                });
12427                fidl::decode!(
12428                    Rotation,
12429                    fidl::encoding::DefaultFuchsiaResourceDialect,
12430                    val_ref,
12431                    decoder,
12432                    inner_offset,
12433                    inner_depth
12434                )?;
12435                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12436                {
12437                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12438                }
12439                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12440                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12441                }
12442            }
12443
12444            next_offset += envelope_size;
12445
12446            // Decode the remaining unknown envelopes.
12447            while next_offset < end_offset {
12448                _next_ordinal_to_read += 1;
12449                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12450                next_offset += envelope_size;
12451            }
12452
12453            Ok(())
12454        }
12455    }
12456
12457    impl ScreenshotTakeFileRequest {
12458        #[inline(always)]
12459        fn max_ordinal_present(&self) -> u64 {
12460            if let Some(_) = self.format {
12461                return 1;
12462            }
12463            0
12464        }
12465    }
12466
12467    impl fidl::encoding::ResourceTypeMarker for ScreenshotTakeFileRequest {
12468        type Borrowed<'a> = &'a mut Self;
12469        fn take_or_borrow<'a>(
12470            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12471        ) -> Self::Borrowed<'a> {
12472            value
12473        }
12474    }
12475
12476    unsafe impl fidl::encoding::TypeMarker for ScreenshotTakeFileRequest {
12477        type Owned = Self;
12478
12479        #[inline(always)]
12480        fn inline_align(_context: fidl::encoding::Context) -> usize {
12481            8
12482        }
12483
12484        #[inline(always)]
12485        fn inline_size(_context: fidl::encoding::Context) -> usize {
12486            16
12487        }
12488    }
12489
12490    unsafe impl
12491        fidl::encoding::Encode<
12492            ScreenshotTakeFileRequest,
12493            fidl::encoding::DefaultFuchsiaResourceDialect,
12494        > for &mut ScreenshotTakeFileRequest
12495    {
12496        unsafe fn encode(
12497            self,
12498            encoder: &mut fidl::encoding::Encoder<
12499                '_,
12500                fidl::encoding::DefaultFuchsiaResourceDialect,
12501            >,
12502            offset: usize,
12503            mut depth: fidl::encoding::Depth,
12504        ) -> fidl::Result<()> {
12505            encoder.debug_check_bounds::<ScreenshotTakeFileRequest>(offset);
12506            // Vector header
12507            let max_ordinal: u64 = self.max_ordinal_present();
12508            encoder.write_num(max_ordinal, offset);
12509            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
12510            // Calling encoder.out_of_line_offset(0) is not allowed.
12511            if max_ordinal == 0 {
12512                return Ok(());
12513            }
12514            depth.increment()?;
12515            let envelope_size = 8;
12516            let bytes_len = max_ordinal as usize * envelope_size;
12517            #[allow(unused_variables)]
12518            let offset = encoder.out_of_line_offset(bytes_len);
12519            let mut _prev_end_offset: usize = 0;
12520            if 1 > max_ordinal {
12521                return Ok(());
12522            }
12523
12524            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12525            // are envelope_size bytes.
12526            let cur_offset: usize = (1 - 1) * envelope_size;
12527
12528            // Zero reserved fields.
12529            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12530
12531            // Safety:
12532            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12533            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12534            //   envelope_size bytes, there is always sufficient room.
12535            fidl::encoding::encode_in_envelope_optional::<
12536                ScreenshotFormat,
12537                fidl::encoding::DefaultFuchsiaResourceDialect,
12538            >(
12539                self.format
12540                    .as_ref()
12541                    .map(<ScreenshotFormat as fidl::encoding::ValueTypeMarker>::borrow),
12542                encoder,
12543                offset + cur_offset,
12544                depth,
12545            )?;
12546
12547            _prev_end_offset = cur_offset + envelope_size;
12548
12549            Ok(())
12550        }
12551    }
12552
12553    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
12554        for ScreenshotTakeFileRequest
12555    {
12556        #[inline(always)]
12557        fn new_empty() -> Self {
12558            Self::default()
12559        }
12560
12561        unsafe fn decode(
12562            &mut self,
12563            decoder: &mut fidl::encoding::Decoder<
12564                '_,
12565                fidl::encoding::DefaultFuchsiaResourceDialect,
12566            >,
12567            offset: usize,
12568            mut depth: fidl::encoding::Depth,
12569        ) -> fidl::Result<()> {
12570            decoder.debug_check_bounds::<Self>(offset);
12571            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
12572                None => return Err(fidl::Error::NotNullable),
12573                Some(len) => len,
12574            };
12575            // Calling decoder.out_of_line_offset(0) is not allowed.
12576            if len == 0 {
12577                return Ok(());
12578            };
12579            depth.increment()?;
12580            let envelope_size = 8;
12581            let bytes_len = len * envelope_size;
12582            let offset = decoder.out_of_line_offset(bytes_len)?;
12583            // Decode the envelope for each type.
12584            let mut _next_ordinal_to_read = 0;
12585            let mut next_offset = offset;
12586            let end_offset = offset + bytes_len;
12587            _next_ordinal_to_read += 1;
12588            if next_offset >= end_offset {
12589                return Ok(());
12590            }
12591
12592            // Decode unknown envelopes for gaps in ordinals.
12593            while _next_ordinal_to_read < 1 {
12594                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12595                _next_ordinal_to_read += 1;
12596                next_offset += envelope_size;
12597            }
12598
12599            let next_out_of_line = decoder.next_out_of_line();
12600            let handles_before = decoder.remaining_handles();
12601            if let Some((inlined, num_bytes, num_handles)) =
12602                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12603            {
12604                let member_inline_size =
12605                    <ScreenshotFormat as fidl::encoding::TypeMarker>::inline_size(decoder.context);
12606                if inlined != (member_inline_size <= 4) {
12607                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12608                }
12609                let inner_offset;
12610                let mut inner_depth = depth.clone();
12611                if inlined {
12612                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12613                    inner_offset = next_offset;
12614                } else {
12615                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12616                    inner_depth.increment()?;
12617                }
12618                let val_ref = self.format.get_or_insert_with(|| {
12619                    fidl::new_empty!(
12620                        ScreenshotFormat,
12621                        fidl::encoding::DefaultFuchsiaResourceDialect
12622                    )
12623                });
12624                fidl::decode!(
12625                    ScreenshotFormat,
12626                    fidl::encoding::DefaultFuchsiaResourceDialect,
12627                    val_ref,
12628                    decoder,
12629                    inner_offset,
12630                    inner_depth
12631                )?;
12632                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12633                {
12634                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12635                }
12636                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12637                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12638                }
12639            }
12640
12641            next_offset += envelope_size;
12642
12643            // Decode the remaining unknown envelopes.
12644            while next_offset < end_offset {
12645                _next_ordinal_to_read += 1;
12646                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12647                next_offset += envelope_size;
12648            }
12649
12650            Ok(())
12651        }
12652    }
12653
12654    impl ScreenshotTakeFileResponse {
12655        #[inline(always)]
12656        fn max_ordinal_present(&self) -> u64 {
12657            if let Some(_) = self.size {
12658                return 2;
12659            }
12660            if let Some(_) = self.file {
12661                return 1;
12662            }
12663            0
12664        }
12665    }
12666
12667    impl fidl::encoding::ResourceTypeMarker for ScreenshotTakeFileResponse {
12668        type Borrowed<'a> = &'a mut Self;
12669        fn take_or_borrow<'a>(
12670            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12671        ) -> Self::Borrowed<'a> {
12672            value
12673        }
12674    }
12675
12676    unsafe impl fidl::encoding::TypeMarker for ScreenshotTakeFileResponse {
12677        type Owned = Self;
12678
12679        #[inline(always)]
12680        fn inline_align(_context: fidl::encoding::Context) -> usize {
12681            8
12682        }
12683
12684        #[inline(always)]
12685        fn inline_size(_context: fidl::encoding::Context) -> usize {
12686            16
12687        }
12688    }
12689
12690    unsafe impl
12691        fidl::encoding::Encode<
12692            ScreenshotTakeFileResponse,
12693            fidl::encoding::DefaultFuchsiaResourceDialect,
12694        > for &mut ScreenshotTakeFileResponse
12695    {
12696        unsafe fn encode(
12697            self,
12698            encoder: &mut fidl::encoding::Encoder<
12699                '_,
12700                fidl::encoding::DefaultFuchsiaResourceDialect,
12701            >,
12702            offset: usize,
12703            mut depth: fidl::encoding::Depth,
12704        ) -> fidl::Result<()> {
12705            encoder.debug_check_bounds::<ScreenshotTakeFileResponse>(offset);
12706            // Vector header
12707            let max_ordinal: u64 = self.max_ordinal_present();
12708            encoder.write_num(max_ordinal, offset);
12709            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
12710            // Calling encoder.out_of_line_offset(0) is not allowed.
12711            if max_ordinal == 0 {
12712                return Ok(());
12713            }
12714            depth.increment()?;
12715            let envelope_size = 8;
12716            let bytes_len = max_ordinal as usize * envelope_size;
12717            #[allow(unused_variables)]
12718            let offset = encoder.out_of_line_offset(bytes_len);
12719            let mut _prev_end_offset: usize = 0;
12720            if 1 > max_ordinal {
12721                return Ok(());
12722            }
12723
12724            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12725            // are envelope_size bytes.
12726            let cur_offset: usize = (1 - 1) * envelope_size;
12727
12728            // Zero reserved fields.
12729            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12730
12731            // Safety:
12732            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12733            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12734            //   envelope_size bytes, there is always sufficient room.
12735            fidl::encoding::encode_in_envelope_optional::<
12736                fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>>,
12737                fidl::encoding::DefaultFuchsiaResourceDialect,
12738            >(
12739                self.file.as_mut().map(
12740                    <fidl::encoding::Endpoint<
12741                        fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
12742                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
12743                ),
12744                encoder,
12745                offset + cur_offset,
12746                depth,
12747            )?;
12748
12749            _prev_end_offset = cur_offset + envelope_size;
12750            if 2 > max_ordinal {
12751                return Ok(());
12752            }
12753
12754            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12755            // are envelope_size bytes.
12756            let cur_offset: usize = (2 - 1) * envelope_size;
12757
12758            // Zero reserved fields.
12759            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12760
12761            // Safety:
12762            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12763            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12764            //   envelope_size bytes, there is always sufficient room.
12765            fidl::encoding::encode_in_envelope_optional::<
12766                fidl_fuchsia_math::SizeU,
12767                fidl::encoding::DefaultFuchsiaResourceDialect,
12768            >(
12769                self.size
12770                    .as_ref()
12771                    .map(<fidl_fuchsia_math::SizeU as fidl::encoding::ValueTypeMarker>::borrow),
12772                encoder,
12773                offset + cur_offset,
12774                depth,
12775            )?;
12776
12777            _prev_end_offset = cur_offset + envelope_size;
12778
12779            Ok(())
12780        }
12781    }
12782
12783    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
12784        for ScreenshotTakeFileResponse
12785    {
12786        #[inline(always)]
12787        fn new_empty() -> Self {
12788            Self::default()
12789        }
12790
12791        unsafe fn decode(
12792            &mut self,
12793            decoder: &mut fidl::encoding::Decoder<
12794                '_,
12795                fidl::encoding::DefaultFuchsiaResourceDialect,
12796            >,
12797            offset: usize,
12798            mut depth: fidl::encoding::Depth,
12799        ) -> fidl::Result<()> {
12800            decoder.debug_check_bounds::<Self>(offset);
12801            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
12802                None => return Err(fidl::Error::NotNullable),
12803                Some(len) => len,
12804            };
12805            // Calling decoder.out_of_line_offset(0) is not allowed.
12806            if len == 0 {
12807                return Ok(());
12808            };
12809            depth.increment()?;
12810            let envelope_size = 8;
12811            let bytes_len = len * envelope_size;
12812            let offset = decoder.out_of_line_offset(bytes_len)?;
12813            // Decode the envelope for each type.
12814            let mut _next_ordinal_to_read = 0;
12815            let mut next_offset = offset;
12816            let end_offset = offset + bytes_len;
12817            _next_ordinal_to_read += 1;
12818            if next_offset >= end_offset {
12819                return Ok(());
12820            }
12821
12822            // Decode unknown envelopes for gaps in ordinals.
12823            while _next_ordinal_to_read < 1 {
12824                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12825                _next_ordinal_to_read += 1;
12826                next_offset += envelope_size;
12827            }
12828
12829            let next_out_of_line = decoder.next_out_of_line();
12830            let handles_before = decoder.remaining_handles();
12831            if let Some((inlined, num_bytes, num_handles)) =
12832                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12833            {
12834                let member_inline_size = <fidl::encoding::Endpoint<
12835                    fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
12836                > as fidl::encoding::TypeMarker>::inline_size(
12837                    decoder.context
12838                );
12839                if inlined != (member_inline_size <= 4) {
12840                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12841                }
12842                let inner_offset;
12843                let mut inner_depth = depth.clone();
12844                if inlined {
12845                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12846                    inner_offset = next_offset;
12847                } else {
12848                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12849                    inner_depth.increment()?;
12850                }
12851                let val_ref = self.file.get_or_insert_with(|| {
12852                    fidl::new_empty!(
12853                        fidl::encoding::Endpoint<
12854                            fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
12855                        >,
12856                        fidl::encoding::DefaultFuchsiaResourceDialect
12857                    )
12858                });
12859                fidl::decode!(
12860                    fidl::encoding::Endpoint<
12861                        fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
12862                    >,
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
12937            // Decode the remaining unknown envelopes.
12938            while next_offset < end_offset {
12939                _next_ordinal_to_read += 1;
12940                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12941                next_offset += envelope_size;
12942            }
12943
12944            Ok(())
12945        }
12946    }
12947
12948    impl ScreenshotTakeRequest {
12949        #[inline(always)]
12950        fn max_ordinal_present(&self) -> u64 {
12951            if let Some(_) = self.format {
12952                return 1;
12953            }
12954            0
12955        }
12956    }
12957
12958    impl fidl::encoding::ResourceTypeMarker for ScreenshotTakeRequest {
12959        type Borrowed<'a> = &'a mut Self;
12960        fn take_or_borrow<'a>(
12961            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12962        ) -> Self::Borrowed<'a> {
12963            value
12964        }
12965    }
12966
12967    unsafe impl fidl::encoding::TypeMarker for ScreenshotTakeRequest {
12968        type Owned = Self;
12969
12970        #[inline(always)]
12971        fn inline_align(_context: fidl::encoding::Context) -> usize {
12972            8
12973        }
12974
12975        #[inline(always)]
12976        fn inline_size(_context: fidl::encoding::Context) -> usize {
12977            16
12978        }
12979    }
12980
12981    unsafe impl
12982        fidl::encoding::Encode<ScreenshotTakeRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
12983        for &mut ScreenshotTakeRequest
12984    {
12985        unsafe fn encode(
12986            self,
12987            encoder: &mut fidl::encoding::Encoder<
12988                '_,
12989                fidl::encoding::DefaultFuchsiaResourceDialect,
12990            >,
12991            offset: usize,
12992            mut depth: fidl::encoding::Depth,
12993        ) -> fidl::Result<()> {
12994            encoder.debug_check_bounds::<ScreenshotTakeRequest>(offset);
12995            // Vector header
12996            let max_ordinal: u64 = self.max_ordinal_present();
12997            encoder.write_num(max_ordinal, offset);
12998            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
12999            // Calling encoder.out_of_line_offset(0) is not allowed.
13000            if max_ordinal == 0 {
13001                return Ok(());
13002            }
13003            depth.increment()?;
13004            let envelope_size = 8;
13005            let bytes_len = max_ordinal as usize * envelope_size;
13006            #[allow(unused_variables)]
13007            let offset = encoder.out_of_line_offset(bytes_len);
13008            let mut _prev_end_offset: usize = 0;
13009            if 1 > max_ordinal {
13010                return Ok(());
13011            }
13012
13013            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
13014            // are envelope_size bytes.
13015            let cur_offset: usize = (1 - 1) * envelope_size;
13016
13017            // Zero reserved fields.
13018            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
13019
13020            // Safety:
13021            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
13022            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
13023            //   envelope_size bytes, there is always sufficient room.
13024            fidl::encoding::encode_in_envelope_optional::<
13025                ScreenshotFormat,
13026                fidl::encoding::DefaultFuchsiaResourceDialect,
13027            >(
13028                self.format
13029                    .as_ref()
13030                    .map(<ScreenshotFormat as fidl::encoding::ValueTypeMarker>::borrow),
13031                encoder,
13032                offset + cur_offset,
13033                depth,
13034            )?;
13035
13036            _prev_end_offset = cur_offset + envelope_size;
13037
13038            Ok(())
13039        }
13040    }
13041
13042    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
13043        for ScreenshotTakeRequest
13044    {
13045        #[inline(always)]
13046        fn new_empty() -> Self {
13047            Self::default()
13048        }
13049
13050        unsafe fn decode(
13051            &mut self,
13052            decoder: &mut fidl::encoding::Decoder<
13053                '_,
13054                fidl::encoding::DefaultFuchsiaResourceDialect,
13055            >,
13056            offset: usize,
13057            mut depth: fidl::encoding::Depth,
13058        ) -> fidl::Result<()> {
13059            decoder.debug_check_bounds::<Self>(offset);
13060            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
13061                None => return Err(fidl::Error::NotNullable),
13062                Some(len) => len,
13063            };
13064            // Calling decoder.out_of_line_offset(0) is not allowed.
13065            if len == 0 {
13066                return Ok(());
13067            };
13068            depth.increment()?;
13069            let envelope_size = 8;
13070            let bytes_len = len * envelope_size;
13071            let offset = decoder.out_of_line_offset(bytes_len)?;
13072            // Decode the envelope for each type.
13073            let mut _next_ordinal_to_read = 0;
13074            let mut next_offset = offset;
13075            let end_offset = offset + bytes_len;
13076            _next_ordinal_to_read += 1;
13077            if next_offset >= end_offset {
13078                return Ok(());
13079            }
13080
13081            // Decode unknown envelopes for gaps in ordinals.
13082            while _next_ordinal_to_read < 1 {
13083                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13084                _next_ordinal_to_read += 1;
13085                next_offset += envelope_size;
13086            }
13087
13088            let next_out_of_line = decoder.next_out_of_line();
13089            let handles_before = decoder.remaining_handles();
13090            if let Some((inlined, num_bytes, num_handles)) =
13091                fidl::encoding::decode_envelope_header(decoder, next_offset)?
13092            {
13093                let member_inline_size =
13094                    <ScreenshotFormat as fidl::encoding::TypeMarker>::inline_size(decoder.context);
13095                if inlined != (member_inline_size <= 4) {
13096                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
13097                }
13098                let inner_offset;
13099                let mut inner_depth = depth.clone();
13100                if inlined {
13101                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
13102                    inner_offset = next_offset;
13103                } else {
13104                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
13105                    inner_depth.increment()?;
13106                }
13107                let val_ref = self.format.get_or_insert_with(|| {
13108                    fidl::new_empty!(
13109                        ScreenshotFormat,
13110                        fidl::encoding::DefaultFuchsiaResourceDialect
13111                    )
13112                });
13113                fidl::decode!(
13114                    ScreenshotFormat,
13115                    fidl::encoding::DefaultFuchsiaResourceDialect,
13116                    val_ref,
13117                    decoder,
13118                    inner_offset,
13119                    inner_depth
13120                )?;
13121                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
13122                {
13123                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
13124                }
13125                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
13126                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
13127                }
13128            }
13129
13130            next_offset += envelope_size;
13131
13132            // Decode the remaining unknown envelopes.
13133            while next_offset < end_offset {
13134                _next_ordinal_to_read += 1;
13135                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13136                next_offset += envelope_size;
13137            }
13138
13139            Ok(())
13140        }
13141    }
13142
13143    impl ScreenshotTakeResponse {
13144        #[inline(always)]
13145        fn max_ordinal_present(&self) -> u64 {
13146            if let Some(_) = self.size {
13147                return 2;
13148            }
13149            if let Some(_) = self.vmo {
13150                return 1;
13151            }
13152            0
13153        }
13154    }
13155
13156    impl fidl::encoding::ResourceTypeMarker for ScreenshotTakeResponse {
13157        type Borrowed<'a> = &'a mut Self;
13158        fn take_or_borrow<'a>(
13159            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
13160        ) -> Self::Borrowed<'a> {
13161            value
13162        }
13163    }
13164
13165    unsafe impl fidl::encoding::TypeMarker for ScreenshotTakeResponse {
13166        type Owned = Self;
13167
13168        #[inline(always)]
13169        fn inline_align(_context: fidl::encoding::Context) -> usize {
13170            8
13171        }
13172
13173        #[inline(always)]
13174        fn inline_size(_context: fidl::encoding::Context) -> usize {
13175            16
13176        }
13177    }
13178
13179    unsafe impl
13180        fidl::encoding::Encode<
13181            ScreenshotTakeResponse,
13182            fidl::encoding::DefaultFuchsiaResourceDialect,
13183        > for &mut ScreenshotTakeResponse
13184    {
13185        unsafe fn encode(
13186            self,
13187            encoder: &mut fidl::encoding::Encoder<
13188                '_,
13189                fidl::encoding::DefaultFuchsiaResourceDialect,
13190            >,
13191            offset: usize,
13192            mut depth: fidl::encoding::Depth,
13193        ) -> fidl::Result<()> {
13194            encoder.debug_check_bounds::<ScreenshotTakeResponse>(offset);
13195            // Vector header
13196            let max_ordinal: u64 = self.max_ordinal_present();
13197            encoder.write_num(max_ordinal, offset);
13198            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
13199            // Calling encoder.out_of_line_offset(0) is not allowed.
13200            if max_ordinal == 0 {
13201                return Ok(());
13202            }
13203            depth.increment()?;
13204            let envelope_size = 8;
13205            let bytes_len = max_ordinal as usize * envelope_size;
13206            #[allow(unused_variables)]
13207            let offset = encoder.out_of_line_offset(bytes_len);
13208            let mut _prev_end_offset: usize = 0;
13209            if 1 > max_ordinal {
13210                return Ok(());
13211            }
13212
13213            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
13214            // are envelope_size bytes.
13215            let cur_offset: usize = (1 - 1) * envelope_size;
13216
13217            // Zero reserved fields.
13218            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
13219
13220            // Safety:
13221            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
13222            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
13223            //   envelope_size bytes, there is always sufficient room.
13224            fidl::encoding::encode_in_envelope_optional::<
13225                fidl::encoding::HandleType<
13226                    fidl::Vmo,
13227                    { fidl::ObjectType::VMO.into_raw() },
13228                    2147483648,
13229                >,
13230                fidl::encoding::DefaultFuchsiaResourceDialect,
13231            >(
13232                self.vmo.as_mut().map(
13233                    <fidl::encoding::HandleType<
13234                        fidl::Vmo,
13235                        { fidl::ObjectType::VMO.into_raw() },
13236                        2147483648,
13237                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
13238                ),
13239                encoder,
13240                offset + cur_offset,
13241                depth,
13242            )?;
13243
13244            _prev_end_offset = cur_offset + envelope_size;
13245            if 2 > max_ordinal {
13246                return Ok(());
13247            }
13248
13249            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
13250            // are envelope_size bytes.
13251            let cur_offset: usize = (2 - 1) * envelope_size;
13252
13253            // Zero reserved fields.
13254            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
13255
13256            // Safety:
13257            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
13258            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
13259            //   envelope_size bytes, there is always sufficient room.
13260            fidl::encoding::encode_in_envelope_optional::<
13261                fidl_fuchsia_math::SizeU,
13262                fidl::encoding::DefaultFuchsiaResourceDialect,
13263            >(
13264                self.size
13265                    .as_ref()
13266                    .map(<fidl_fuchsia_math::SizeU as fidl::encoding::ValueTypeMarker>::borrow),
13267                encoder,
13268                offset + cur_offset,
13269                depth,
13270            )?;
13271
13272            _prev_end_offset = cur_offset + envelope_size;
13273
13274            Ok(())
13275        }
13276    }
13277
13278    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
13279        for ScreenshotTakeResponse
13280    {
13281        #[inline(always)]
13282        fn new_empty() -> Self {
13283            Self::default()
13284        }
13285
13286        unsafe fn decode(
13287            &mut self,
13288            decoder: &mut fidl::encoding::Decoder<
13289                '_,
13290                fidl::encoding::DefaultFuchsiaResourceDialect,
13291            >,
13292            offset: usize,
13293            mut depth: fidl::encoding::Depth,
13294        ) -> fidl::Result<()> {
13295            decoder.debug_check_bounds::<Self>(offset);
13296            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
13297                None => return Err(fidl::Error::NotNullable),
13298                Some(len) => len,
13299            };
13300            // Calling decoder.out_of_line_offset(0) is not allowed.
13301            if len == 0 {
13302                return Ok(());
13303            };
13304            depth.increment()?;
13305            let envelope_size = 8;
13306            let bytes_len = len * envelope_size;
13307            let offset = decoder.out_of_line_offset(bytes_len)?;
13308            // Decode the envelope for each type.
13309            let mut _next_ordinal_to_read = 0;
13310            let mut next_offset = offset;
13311            let end_offset = offset + bytes_len;
13312            _next_ordinal_to_read += 1;
13313            if next_offset >= end_offset {
13314                return Ok(());
13315            }
13316
13317            // Decode unknown envelopes for gaps in ordinals.
13318            while _next_ordinal_to_read < 1 {
13319                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13320                _next_ordinal_to_read += 1;
13321                next_offset += envelope_size;
13322            }
13323
13324            let next_out_of_line = decoder.next_out_of_line();
13325            let handles_before = decoder.remaining_handles();
13326            if let Some((inlined, num_bytes, num_handles)) =
13327                fidl::encoding::decode_envelope_header(decoder, next_offset)?
13328            {
13329                let member_inline_size = <fidl::encoding::HandleType<
13330                    fidl::Vmo,
13331                    { fidl::ObjectType::VMO.into_raw() },
13332                    2147483648,
13333                > as fidl::encoding::TypeMarker>::inline_size(
13334                    decoder.context
13335                );
13336                if inlined != (member_inline_size <= 4) {
13337                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
13338                }
13339                let inner_offset;
13340                let mut inner_depth = depth.clone();
13341                if inlined {
13342                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
13343                    inner_offset = next_offset;
13344                } else {
13345                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
13346                    inner_depth.increment()?;
13347                }
13348                let val_ref =
13349                self.vmo.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
13350                fidl::decode!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
13351                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
13352                {
13353                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
13354                }
13355                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
13356                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
13357                }
13358            }
13359
13360            next_offset += envelope_size;
13361            _next_ordinal_to_read += 1;
13362            if next_offset >= end_offset {
13363                return Ok(());
13364            }
13365
13366            // Decode unknown envelopes for gaps in ordinals.
13367            while _next_ordinal_to_read < 2 {
13368                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13369                _next_ordinal_to_read += 1;
13370                next_offset += envelope_size;
13371            }
13372
13373            let next_out_of_line = decoder.next_out_of_line();
13374            let handles_before = decoder.remaining_handles();
13375            if let Some((inlined, num_bytes, num_handles)) =
13376                fidl::encoding::decode_envelope_header(decoder, next_offset)?
13377            {
13378                let member_inline_size =
13379                    <fidl_fuchsia_math::SizeU as fidl::encoding::TypeMarker>::inline_size(
13380                        decoder.context,
13381                    );
13382                if inlined != (member_inline_size <= 4) {
13383                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
13384                }
13385                let inner_offset;
13386                let mut inner_depth = depth.clone();
13387                if inlined {
13388                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
13389                    inner_offset = next_offset;
13390                } else {
13391                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
13392                    inner_depth.increment()?;
13393                }
13394                let val_ref = self.size.get_or_insert_with(|| {
13395                    fidl::new_empty!(
13396                        fidl_fuchsia_math::SizeU,
13397                        fidl::encoding::DefaultFuchsiaResourceDialect
13398                    )
13399                });
13400                fidl::decode!(
13401                    fidl_fuchsia_math::SizeU,
13402                    fidl::encoding::DefaultFuchsiaResourceDialect,
13403                    val_ref,
13404                    decoder,
13405                    inner_offset,
13406                    inner_depth
13407                )?;
13408                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
13409                {
13410                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
13411                }
13412                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
13413                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
13414                }
13415            }
13416
13417            next_offset += envelope_size;
13418
13419            // Decode the remaining unknown envelopes.
13420            while next_offset < end_offset {
13421                _next_ordinal_to_read += 1;
13422                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13423                next_offset += envelope_size;
13424            }
13425
13426            Ok(())
13427        }
13428    }
13429
13430    impl TrustedFlatlandConfig {
13431        #[inline(always)]
13432        fn max_ordinal_present(&self) -> u64 {
13433            if let Some(_) = self.pass_acquire_fences {
13434                return 2;
13435            }
13436            if let Some(_) = self.schedule_asap {
13437                return 1;
13438            }
13439            0
13440        }
13441    }
13442
13443    impl fidl::encoding::ResourceTypeMarker for TrustedFlatlandConfig {
13444        type Borrowed<'a> = &'a mut Self;
13445        fn take_or_borrow<'a>(
13446            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
13447        ) -> Self::Borrowed<'a> {
13448            value
13449        }
13450    }
13451
13452    unsafe impl fidl::encoding::TypeMarker for TrustedFlatlandConfig {
13453        type Owned = Self;
13454
13455        #[inline(always)]
13456        fn inline_align(_context: fidl::encoding::Context) -> usize {
13457            8
13458        }
13459
13460        #[inline(always)]
13461        fn inline_size(_context: fidl::encoding::Context) -> usize {
13462            16
13463        }
13464    }
13465
13466    unsafe impl
13467        fidl::encoding::Encode<TrustedFlatlandConfig, fidl::encoding::DefaultFuchsiaResourceDialect>
13468        for &mut TrustedFlatlandConfig
13469    {
13470        unsafe fn encode(
13471            self,
13472            encoder: &mut fidl::encoding::Encoder<
13473                '_,
13474                fidl::encoding::DefaultFuchsiaResourceDialect,
13475            >,
13476            offset: usize,
13477            mut depth: fidl::encoding::Depth,
13478        ) -> fidl::Result<()> {
13479            encoder.debug_check_bounds::<TrustedFlatlandConfig>(offset);
13480            // Vector header
13481            let max_ordinal: u64 = self.max_ordinal_present();
13482            encoder.write_num(max_ordinal, offset);
13483            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
13484            // Calling encoder.out_of_line_offset(0) is not allowed.
13485            if max_ordinal == 0 {
13486                return Ok(());
13487            }
13488            depth.increment()?;
13489            let envelope_size = 8;
13490            let bytes_len = max_ordinal as usize * envelope_size;
13491            #[allow(unused_variables)]
13492            let offset = encoder.out_of_line_offset(bytes_len);
13493            let mut _prev_end_offset: usize = 0;
13494            if 1 > max_ordinal {
13495                return Ok(());
13496            }
13497
13498            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
13499            // are envelope_size bytes.
13500            let cur_offset: usize = (1 - 1) * envelope_size;
13501
13502            // Zero reserved fields.
13503            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
13504
13505            // Safety:
13506            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
13507            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
13508            //   envelope_size bytes, there is always sufficient room.
13509            fidl::encoding::encode_in_envelope_optional::<
13510                bool,
13511                fidl::encoding::DefaultFuchsiaResourceDialect,
13512            >(
13513                self.schedule_asap.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
13514                encoder,
13515                offset + cur_offset,
13516                depth,
13517            )?;
13518
13519            _prev_end_offset = cur_offset + envelope_size;
13520            if 2 > max_ordinal {
13521                return Ok(());
13522            }
13523
13524            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
13525            // are envelope_size bytes.
13526            let cur_offset: usize = (2 - 1) * envelope_size;
13527
13528            // Zero reserved fields.
13529            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
13530
13531            // Safety:
13532            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
13533            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
13534            //   envelope_size bytes, there is always sufficient room.
13535            fidl::encoding::encode_in_envelope_optional::<
13536                bool,
13537                fidl::encoding::DefaultFuchsiaResourceDialect,
13538            >(
13539                self.pass_acquire_fences
13540                    .as_ref()
13541                    .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
13542                encoder,
13543                offset + cur_offset,
13544                depth,
13545            )?;
13546
13547            _prev_end_offset = cur_offset + envelope_size;
13548
13549            Ok(())
13550        }
13551    }
13552
13553    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
13554        for TrustedFlatlandConfig
13555    {
13556        #[inline(always)]
13557        fn new_empty() -> Self {
13558            Self::default()
13559        }
13560
13561        unsafe fn decode(
13562            &mut self,
13563            decoder: &mut fidl::encoding::Decoder<
13564                '_,
13565                fidl::encoding::DefaultFuchsiaResourceDialect,
13566            >,
13567            offset: usize,
13568            mut depth: fidl::encoding::Depth,
13569        ) -> fidl::Result<()> {
13570            decoder.debug_check_bounds::<Self>(offset);
13571            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
13572                None => return Err(fidl::Error::NotNullable),
13573                Some(len) => len,
13574            };
13575            // Calling decoder.out_of_line_offset(0) is not allowed.
13576            if len == 0 {
13577                return Ok(());
13578            };
13579            depth.increment()?;
13580            let envelope_size = 8;
13581            let bytes_len = len * envelope_size;
13582            let offset = decoder.out_of_line_offset(bytes_len)?;
13583            // Decode the envelope for each type.
13584            let mut _next_ordinal_to_read = 0;
13585            let mut next_offset = offset;
13586            let end_offset = offset + bytes_len;
13587            _next_ordinal_to_read += 1;
13588            if next_offset >= end_offset {
13589                return Ok(());
13590            }
13591
13592            // Decode unknown envelopes for gaps in ordinals.
13593            while _next_ordinal_to_read < 1 {
13594                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13595                _next_ordinal_to_read += 1;
13596                next_offset += envelope_size;
13597            }
13598
13599            let next_out_of_line = decoder.next_out_of_line();
13600            let handles_before = decoder.remaining_handles();
13601            if let Some((inlined, num_bytes, num_handles)) =
13602                fidl::encoding::decode_envelope_header(decoder, next_offset)?
13603            {
13604                let member_inline_size =
13605                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
13606                if inlined != (member_inline_size <= 4) {
13607                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
13608                }
13609                let inner_offset;
13610                let mut inner_depth = depth.clone();
13611                if inlined {
13612                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
13613                    inner_offset = next_offset;
13614                } else {
13615                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
13616                    inner_depth.increment()?;
13617                }
13618                let val_ref = self.schedule_asap.get_or_insert_with(|| {
13619                    fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
13620                });
13621                fidl::decode!(
13622                    bool,
13623                    fidl::encoding::DefaultFuchsiaResourceDialect,
13624                    val_ref,
13625                    decoder,
13626                    inner_offset,
13627                    inner_depth
13628                )?;
13629                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
13630                {
13631                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
13632                }
13633                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
13634                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
13635                }
13636            }
13637
13638            next_offset += envelope_size;
13639            _next_ordinal_to_read += 1;
13640            if next_offset >= end_offset {
13641                return Ok(());
13642            }
13643
13644            // Decode unknown envelopes for gaps in ordinals.
13645            while _next_ordinal_to_read < 2 {
13646                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13647                _next_ordinal_to_read += 1;
13648                next_offset += envelope_size;
13649            }
13650
13651            let next_out_of_line = decoder.next_out_of_line();
13652            let handles_before = decoder.remaining_handles();
13653            if let Some((inlined, num_bytes, num_handles)) =
13654                fidl::encoding::decode_envelope_header(decoder, next_offset)?
13655            {
13656                let member_inline_size =
13657                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
13658                if inlined != (member_inline_size <= 4) {
13659                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
13660                }
13661                let inner_offset;
13662                let mut inner_depth = depth.clone();
13663                if inlined {
13664                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
13665                    inner_offset = next_offset;
13666                } else {
13667                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
13668                    inner_depth.increment()?;
13669                }
13670                let val_ref = self.pass_acquire_fences.get_or_insert_with(|| {
13671                    fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
13672                });
13673                fidl::decode!(
13674                    bool,
13675                    fidl::encoding::DefaultFuchsiaResourceDialect,
13676                    val_ref,
13677                    decoder,
13678                    inner_offset,
13679                    inner_depth
13680                )?;
13681                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
13682                {
13683                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
13684                }
13685                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
13686                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
13687                }
13688            }
13689
13690            next_offset += envelope_size;
13691
13692            // Decode the remaining unknown envelopes.
13693            while next_offset < end_offset {
13694                _next_ordinal_to_read += 1;
13695                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13696                next_offset += envelope_size;
13697            }
13698
13699            Ok(())
13700        }
13701    }
13702
13703    impl ViewBoundProtocols {
13704        #[inline(always)]
13705        fn max_ordinal_present(&self) -> u64 {
13706            if let Some(_) = self.mouse_source {
13707                return 4;
13708            }
13709            if let Some(_) = self.touch_source {
13710                return 3;
13711            }
13712            if let Some(_) = self.view_focuser {
13713                return 2;
13714            }
13715            if let Some(_) = self.view_ref_focused {
13716                return 1;
13717            }
13718            0
13719        }
13720    }
13721
13722    impl fidl::encoding::ResourceTypeMarker for ViewBoundProtocols {
13723        type Borrowed<'a> = &'a mut Self;
13724        fn take_or_borrow<'a>(
13725            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
13726        ) -> Self::Borrowed<'a> {
13727            value
13728        }
13729    }
13730
13731    unsafe impl fidl::encoding::TypeMarker for ViewBoundProtocols {
13732        type Owned = Self;
13733
13734        #[inline(always)]
13735        fn inline_align(_context: fidl::encoding::Context) -> usize {
13736            8
13737        }
13738
13739        #[inline(always)]
13740        fn inline_size(_context: fidl::encoding::Context) -> usize {
13741            16
13742        }
13743    }
13744
13745    unsafe impl
13746        fidl::encoding::Encode<ViewBoundProtocols, fidl::encoding::DefaultFuchsiaResourceDialect>
13747        for &mut ViewBoundProtocols
13748    {
13749        unsafe fn encode(
13750            self,
13751            encoder: &mut fidl::encoding::Encoder<
13752                '_,
13753                fidl::encoding::DefaultFuchsiaResourceDialect,
13754            >,
13755            offset: usize,
13756            mut depth: fidl::encoding::Depth,
13757        ) -> fidl::Result<()> {
13758            encoder.debug_check_bounds::<ViewBoundProtocols>(offset);
13759            // Vector header
13760            let max_ordinal: u64 = self.max_ordinal_present();
13761            encoder.write_num(max_ordinal, offset);
13762            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
13763            // Calling encoder.out_of_line_offset(0) is not allowed.
13764            if max_ordinal == 0 {
13765                return Ok(());
13766            }
13767            depth.increment()?;
13768            let envelope_size = 8;
13769            let bytes_len = max_ordinal as usize * envelope_size;
13770            #[allow(unused_variables)]
13771            let offset = encoder.out_of_line_offset(bytes_len);
13772            let mut _prev_end_offset: usize = 0;
13773            if 1 > max_ordinal {
13774                return Ok(());
13775            }
13776
13777            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
13778            // are envelope_size bytes.
13779            let cur_offset: usize = (1 - 1) * envelope_size;
13780
13781            // Zero reserved fields.
13782            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
13783
13784            // Safety:
13785            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
13786            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
13787            //   envelope_size bytes, there is always sufficient room.
13788            fidl::encoding::encode_in_envelope_optional::<
13789                fidl::encoding::Endpoint<
13790                    fidl::endpoints::ServerEnd<fidl_fuchsia_ui_views::ViewRefFocusedMarker>,
13791                >,
13792                fidl::encoding::DefaultFuchsiaResourceDialect,
13793            >(
13794                self.view_ref_focused.as_mut().map(
13795                    <fidl::encoding::Endpoint<
13796                        fidl::endpoints::ServerEnd<fidl_fuchsia_ui_views::ViewRefFocusedMarker>,
13797                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
13798                ),
13799                encoder,
13800                offset + cur_offset,
13801                depth,
13802            )?;
13803
13804            _prev_end_offset = cur_offset + envelope_size;
13805            if 2 > max_ordinal {
13806                return Ok(());
13807            }
13808
13809            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
13810            // are envelope_size bytes.
13811            let cur_offset: usize = (2 - 1) * envelope_size;
13812
13813            // Zero reserved fields.
13814            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
13815
13816            // Safety:
13817            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
13818            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
13819            //   envelope_size bytes, there is always sufficient room.
13820            fidl::encoding::encode_in_envelope_optional::<
13821                fidl::encoding::Endpoint<
13822                    fidl::endpoints::ServerEnd<fidl_fuchsia_ui_views::FocuserMarker>,
13823                >,
13824                fidl::encoding::DefaultFuchsiaResourceDialect,
13825            >(
13826                self.view_focuser.as_mut().map(
13827                    <fidl::encoding::Endpoint<
13828                        fidl::endpoints::ServerEnd<fidl_fuchsia_ui_views::FocuserMarker>,
13829                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
13830                ),
13831                encoder,
13832                offset + cur_offset,
13833                depth,
13834            )?;
13835
13836            _prev_end_offset = cur_offset + envelope_size;
13837            if 3 > max_ordinal {
13838                return Ok(());
13839            }
13840
13841            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
13842            // are envelope_size bytes.
13843            let cur_offset: usize = (3 - 1) * envelope_size;
13844
13845            // Zero reserved fields.
13846            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
13847
13848            // Safety:
13849            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
13850            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
13851            //   envelope_size bytes, there is always sufficient room.
13852            fidl::encoding::encode_in_envelope_optional::<
13853                fidl::encoding::Endpoint<
13854                    fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::TouchSourceMarker>,
13855                >,
13856                fidl::encoding::DefaultFuchsiaResourceDialect,
13857            >(
13858                self.touch_source.as_mut().map(
13859                    <fidl::encoding::Endpoint<
13860                        fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::TouchSourceMarker>,
13861                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
13862                ),
13863                encoder,
13864                offset + cur_offset,
13865                depth,
13866            )?;
13867
13868            _prev_end_offset = cur_offset + envelope_size;
13869            if 4 > max_ordinal {
13870                return Ok(());
13871            }
13872
13873            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
13874            // are envelope_size bytes.
13875            let cur_offset: usize = (4 - 1) * envelope_size;
13876
13877            // Zero reserved fields.
13878            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
13879
13880            // Safety:
13881            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
13882            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
13883            //   envelope_size bytes, there is always sufficient room.
13884            fidl::encoding::encode_in_envelope_optional::<
13885                fidl::encoding::Endpoint<
13886                    fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::MouseSourceMarker>,
13887                >,
13888                fidl::encoding::DefaultFuchsiaResourceDialect,
13889            >(
13890                self.mouse_source.as_mut().map(
13891                    <fidl::encoding::Endpoint<
13892                        fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::MouseSourceMarker>,
13893                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
13894                ),
13895                encoder,
13896                offset + cur_offset,
13897                depth,
13898            )?;
13899
13900            _prev_end_offset = cur_offset + envelope_size;
13901
13902            Ok(())
13903        }
13904    }
13905
13906    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
13907        for ViewBoundProtocols
13908    {
13909        #[inline(always)]
13910        fn new_empty() -> Self {
13911            Self::default()
13912        }
13913
13914        unsafe fn decode(
13915            &mut self,
13916            decoder: &mut fidl::encoding::Decoder<
13917                '_,
13918                fidl::encoding::DefaultFuchsiaResourceDialect,
13919            >,
13920            offset: usize,
13921            mut depth: fidl::encoding::Depth,
13922        ) -> fidl::Result<()> {
13923            decoder.debug_check_bounds::<Self>(offset);
13924            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
13925                None => return Err(fidl::Error::NotNullable),
13926                Some(len) => len,
13927            };
13928            // Calling decoder.out_of_line_offset(0) is not allowed.
13929            if len == 0 {
13930                return Ok(());
13931            };
13932            depth.increment()?;
13933            let envelope_size = 8;
13934            let bytes_len = len * envelope_size;
13935            let offset = decoder.out_of_line_offset(bytes_len)?;
13936            // Decode the envelope for each type.
13937            let mut _next_ordinal_to_read = 0;
13938            let mut next_offset = offset;
13939            let end_offset = offset + bytes_len;
13940            _next_ordinal_to_read += 1;
13941            if next_offset >= end_offset {
13942                return Ok(());
13943            }
13944
13945            // Decode unknown envelopes for gaps in ordinals.
13946            while _next_ordinal_to_read < 1 {
13947                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13948                _next_ordinal_to_read += 1;
13949                next_offset += envelope_size;
13950            }
13951
13952            let next_out_of_line = decoder.next_out_of_line();
13953            let handles_before = decoder.remaining_handles();
13954            if let Some((inlined, num_bytes, num_handles)) =
13955                fidl::encoding::decode_envelope_header(decoder, next_offset)?
13956            {
13957                let member_inline_size = <fidl::encoding::Endpoint<
13958                    fidl::endpoints::ServerEnd<fidl_fuchsia_ui_views::ViewRefFocusedMarker>,
13959                > as fidl::encoding::TypeMarker>::inline_size(
13960                    decoder.context
13961                );
13962                if inlined != (member_inline_size <= 4) {
13963                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
13964                }
13965                let inner_offset;
13966                let mut inner_depth = depth.clone();
13967                if inlined {
13968                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
13969                    inner_offset = next_offset;
13970                } else {
13971                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
13972                    inner_depth.increment()?;
13973                }
13974                let val_ref = self.view_ref_focused.get_or_insert_with(|| {
13975                    fidl::new_empty!(
13976                        fidl::encoding::Endpoint<
13977                            fidl::endpoints::ServerEnd<fidl_fuchsia_ui_views::ViewRefFocusedMarker>,
13978                        >,
13979                        fidl::encoding::DefaultFuchsiaResourceDialect
13980                    )
13981                });
13982                fidl::decode!(
13983                    fidl::encoding::Endpoint<
13984                        fidl::endpoints::ServerEnd<fidl_fuchsia_ui_views::ViewRefFocusedMarker>,
13985                    >,
13986                    fidl::encoding::DefaultFuchsiaResourceDialect,
13987                    val_ref,
13988                    decoder,
13989                    inner_offset,
13990                    inner_depth
13991                )?;
13992                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
13993                {
13994                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
13995                }
13996                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
13997                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
13998                }
13999            }
14000
14001            next_offset += envelope_size;
14002            _next_ordinal_to_read += 1;
14003            if next_offset >= end_offset {
14004                return Ok(());
14005            }
14006
14007            // Decode unknown envelopes for gaps in ordinals.
14008            while _next_ordinal_to_read < 2 {
14009                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
14010                _next_ordinal_to_read += 1;
14011                next_offset += envelope_size;
14012            }
14013
14014            let next_out_of_line = decoder.next_out_of_line();
14015            let handles_before = decoder.remaining_handles();
14016            if let Some((inlined, num_bytes, num_handles)) =
14017                fidl::encoding::decode_envelope_header(decoder, next_offset)?
14018            {
14019                let member_inline_size = <fidl::encoding::Endpoint<
14020                    fidl::endpoints::ServerEnd<fidl_fuchsia_ui_views::FocuserMarker>,
14021                > as fidl::encoding::TypeMarker>::inline_size(
14022                    decoder.context
14023                );
14024                if inlined != (member_inline_size <= 4) {
14025                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
14026                }
14027                let inner_offset;
14028                let mut inner_depth = depth.clone();
14029                if inlined {
14030                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
14031                    inner_offset = next_offset;
14032                } else {
14033                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
14034                    inner_depth.increment()?;
14035                }
14036                let val_ref = self.view_focuser.get_or_insert_with(|| {
14037                    fidl::new_empty!(
14038                        fidl::encoding::Endpoint<
14039                            fidl::endpoints::ServerEnd<fidl_fuchsia_ui_views::FocuserMarker>,
14040                        >,
14041                        fidl::encoding::DefaultFuchsiaResourceDialect
14042                    )
14043                });
14044                fidl::decode!(
14045                    fidl::encoding::Endpoint<
14046                        fidl::endpoints::ServerEnd<fidl_fuchsia_ui_views::FocuserMarker>,
14047                    >,
14048                    fidl::encoding::DefaultFuchsiaResourceDialect,
14049                    val_ref,
14050                    decoder,
14051                    inner_offset,
14052                    inner_depth
14053                )?;
14054                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
14055                {
14056                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
14057                }
14058                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
14059                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
14060                }
14061            }
14062
14063            next_offset += envelope_size;
14064            _next_ordinal_to_read += 1;
14065            if next_offset >= end_offset {
14066                return Ok(());
14067            }
14068
14069            // Decode unknown envelopes for gaps in ordinals.
14070            while _next_ordinal_to_read < 3 {
14071                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
14072                _next_ordinal_to_read += 1;
14073                next_offset += envelope_size;
14074            }
14075
14076            let next_out_of_line = decoder.next_out_of_line();
14077            let handles_before = decoder.remaining_handles();
14078            if let Some((inlined, num_bytes, num_handles)) =
14079                fidl::encoding::decode_envelope_header(decoder, next_offset)?
14080            {
14081                let member_inline_size = <fidl::encoding::Endpoint<
14082                    fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::TouchSourceMarker>,
14083                > as fidl::encoding::TypeMarker>::inline_size(
14084                    decoder.context
14085                );
14086                if inlined != (member_inline_size <= 4) {
14087                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
14088                }
14089                let inner_offset;
14090                let mut inner_depth = depth.clone();
14091                if inlined {
14092                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
14093                    inner_offset = next_offset;
14094                } else {
14095                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
14096                    inner_depth.increment()?;
14097                }
14098                let val_ref = self.touch_source.get_or_insert_with(|| {
14099                    fidl::new_empty!(
14100                        fidl::encoding::Endpoint<
14101                            fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::TouchSourceMarker>,
14102                        >,
14103                        fidl::encoding::DefaultFuchsiaResourceDialect
14104                    )
14105                });
14106                fidl::decode!(
14107                    fidl::encoding::Endpoint<
14108                        fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::TouchSourceMarker>,
14109                    >,
14110                    fidl::encoding::DefaultFuchsiaResourceDialect,
14111                    val_ref,
14112                    decoder,
14113                    inner_offset,
14114                    inner_depth
14115                )?;
14116                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
14117                {
14118                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
14119                }
14120                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
14121                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
14122                }
14123            }
14124
14125            next_offset += envelope_size;
14126            _next_ordinal_to_read += 1;
14127            if next_offset >= end_offset {
14128                return Ok(());
14129            }
14130
14131            // Decode unknown envelopes for gaps in ordinals.
14132            while _next_ordinal_to_read < 4 {
14133                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
14134                _next_ordinal_to_read += 1;
14135                next_offset += envelope_size;
14136            }
14137
14138            let next_out_of_line = decoder.next_out_of_line();
14139            let handles_before = decoder.remaining_handles();
14140            if let Some((inlined, num_bytes, num_handles)) =
14141                fidl::encoding::decode_envelope_header(decoder, next_offset)?
14142            {
14143                let member_inline_size = <fidl::encoding::Endpoint<
14144                    fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::MouseSourceMarker>,
14145                > as fidl::encoding::TypeMarker>::inline_size(
14146                    decoder.context
14147                );
14148                if inlined != (member_inline_size <= 4) {
14149                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
14150                }
14151                let inner_offset;
14152                let mut inner_depth = depth.clone();
14153                if inlined {
14154                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
14155                    inner_offset = next_offset;
14156                } else {
14157                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
14158                    inner_depth.increment()?;
14159                }
14160                let val_ref = self.mouse_source.get_or_insert_with(|| {
14161                    fidl::new_empty!(
14162                        fidl::encoding::Endpoint<
14163                            fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::MouseSourceMarker>,
14164                        >,
14165                        fidl::encoding::DefaultFuchsiaResourceDialect
14166                    )
14167                });
14168                fidl::decode!(
14169                    fidl::encoding::Endpoint<
14170                        fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::MouseSourceMarker>,
14171                    >,
14172                    fidl::encoding::DefaultFuchsiaResourceDialect,
14173                    val_ref,
14174                    decoder,
14175                    inner_offset,
14176                    inner_depth
14177                )?;
14178                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
14179                {
14180                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
14181                }
14182                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
14183                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
14184                }
14185            }
14186
14187            next_offset += envelope_size;
14188
14189            // Decode the remaining unknown envelopes.
14190            while next_offset < end_offset {
14191                _next_ordinal_to_read += 1;
14192                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
14193                next_offset += envelope_size;
14194            }
14195
14196            Ok(())
14197        }
14198    }
14199}