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    /// If true, the client will not utilize Flatland's built in frame-scheduling mechanism and
426    /// will ignore present credits, instead relying on their own flow control system.
427    ///
428    /// If absent, `skips_present_credits` is false.
429    pub skips_present_credits: Option<bool>,
430    #[doc(hidden)]
431    pub __source_breaking: fidl::marker::SourceBreaking,
432}
433
434impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for TrustedFlatlandConfig {}
435
436/// The protocol endpoints bound to a Flatland ViewCreationToken. These protocols operate on the
437/// View that ViewCreationToken created in the Flatland session.
438#[derive(Debug, Default, PartialEq)]
439pub struct ViewBoundProtocols {
440    /// Learn when a View gains focus.
441    ///
442    /// Server-bound ViewRef. The [`view_ref_focused`] client does not specify the ViewRef
443    /// explicitly; instead, the server implementation uses the ViewRef used in View creation for
444    /// reporting focus movement on/off this View.
445    pub view_ref_focused:
446        Option<fidl::endpoints::ServerEnd<fidl_fuchsia_ui_views::ViewRefFocusedMarker>>,
447    /// Enable a View to request focus transfer to a child (target) View.
448    ///
449    /// Server-bound ViewRef. The [`view_focuser`] client does not specify the "requestor" ViewRef
450    /// explicitly, only the "target" ViewRef. Instead, the server implementation uses the ViewRef
451    /// used in View creation as the "requestor" ViewRef.
452    pub view_focuser: Option<fidl::endpoints::ServerEnd<fidl_fuchsia_ui_views::FocuserMarker>>,
453    /// Receive touch events that are associated with a View.
454    pub touch_source:
455        Option<fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::TouchSourceMarker>>,
456    /// Receive mouse events that are associated with a View.
457    pub mouse_source:
458        Option<fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::MouseSourceMarker>>,
459    #[doc(hidden)]
460    pub __source_breaking: fidl::marker::SourceBreaking,
461}
462
463impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for ViewBoundProtocols {}
464
465#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
466pub struct AllocatorMarker;
467
468impl fidl::endpoints::ProtocolMarker for AllocatorMarker {
469    type Proxy = AllocatorProxy;
470    type RequestStream = AllocatorRequestStream;
471    #[cfg(target_os = "fuchsia")]
472    type SynchronousProxy = AllocatorSynchronousProxy;
473
474    const DEBUG_NAME: &'static str = "fuchsia.ui.composition.Allocator";
475}
476impl fidl::endpoints::DiscoverableProtocolMarker for AllocatorMarker {}
477pub type AllocatorRegisterBufferCollectionResult = Result<(), RegisterBufferCollectionError>;
478
479pub trait AllocatorProxyInterface: Send + Sync {
480    type RegisterBufferCollectionResponseFut: std::future::Future<Output = Result<AllocatorRegisterBufferCollectionResult, fidl::Error>>
481        + Send;
482    fn r#register_buffer_collection(
483        &self,
484        args: RegisterBufferCollectionArgs,
485    ) -> Self::RegisterBufferCollectionResponseFut;
486}
487#[derive(Debug)]
488#[cfg(target_os = "fuchsia")]
489pub struct AllocatorSynchronousProxy {
490    client: fidl::client::sync::Client,
491}
492
493#[cfg(target_os = "fuchsia")]
494impl fidl::endpoints::SynchronousProxy for AllocatorSynchronousProxy {
495    type Proxy = AllocatorProxy;
496    type Protocol = AllocatorMarker;
497
498    fn from_channel(inner: fidl::Channel) -> Self {
499        Self::new(inner)
500    }
501
502    fn into_channel(self) -> fidl::Channel {
503        self.client.into_channel()
504    }
505
506    fn as_channel(&self) -> &fidl::Channel {
507        self.client.as_channel()
508    }
509}
510
511#[cfg(target_os = "fuchsia")]
512impl AllocatorSynchronousProxy {
513    pub fn new(channel: fidl::Channel) -> Self {
514        let protocol_name = <AllocatorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
515        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
516    }
517
518    pub fn into_channel(self) -> fidl::Channel {
519        self.client.into_channel()
520    }
521
522    /// Waits until an event arrives and returns it. It is safe for other
523    /// threads to make concurrent requests while waiting for an event.
524    pub fn wait_for_event(
525        &self,
526        deadline: zx::MonotonicInstant,
527    ) -> Result<AllocatorEvent, fidl::Error> {
528        AllocatorEvent::decode(self.client.wait_for_event(deadline)?)
529    }
530
531    /// A BufferCollection is a set of VMOs created by Sysmem and shared by a number of
532    /// participants, one of which is the Flatland Renderer. Some content, such as Images, use a
533    /// BufferCollection as their backing memory.
534    ///
535    /// See [`RegisterBufferCollectionArgs`] for information on each argument.
536    pub fn r#register_buffer_collection(
537        &self,
538        mut args: RegisterBufferCollectionArgs,
539        ___deadline: zx::MonotonicInstant,
540    ) -> Result<AllocatorRegisterBufferCollectionResult, fidl::Error> {
541        let _response = self
542            .client
543            .send_query::<AllocatorRegisterBufferCollectionRequest, fidl::encoding::ResultType<
544                fidl::encoding::EmptyStruct,
545                RegisterBufferCollectionError,
546            >>(
547                (&mut args,),
548                0x494b7ea578d1061e,
549                fidl::encoding::DynamicFlags::empty(),
550                ___deadline,
551            )?;
552        Ok(_response.map(|x| x))
553    }
554}
555
556#[cfg(target_os = "fuchsia")]
557impl From<AllocatorSynchronousProxy> for zx::NullableHandle {
558    fn from(value: AllocatorSynchronousProxy) -> Self {
559        value.into_channel().into()
560    }
561}
562
563#[cfg(target_os = "fuchsia")]
564impl From<fidl::Channel> for AllocatorSynchronousProxy {
565    fn from(value: fidl::Channel) -> Self {
566        Self::new(value)
567    }
568}
569
570#[cfg(target_os = "fuchsia")]
571impl fidl::endpoints::FromClient for AllocatorSynchronousProxy {
572    type Protocol = AllocatorMarker;
573
574    fn from_client(value: fidl::endpoints::ClientEnd<AllocatorMarker>) -> Self {
575        Self::new(value.into_channel())
576    }
577}
578
579#[derive(Debug, Clone)]
580pub struct AllocatorProxy {
581    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
582}
583
584impl fidl::endpoints::Proxy for AllocatorProxy {
585    type Protocol = AllocatorMarker;
586
587    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
588        Self::new(inner)
589    }
590
591    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
592        self.client.into_channel().map_err(|client| Self { client })
593    }
594
595    fn as_channel(&self) -> &::fidl::AsyncChannel {
596        self.client.as_channel()
597    }
598}
599
600impl AllocatorProxy {
601    /// Create a new Proxy for fuchsia.ui.composition/Allocator.
602    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
603        let protocol_name = <AllocatorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
604        Self { client: fidl::client::Client::new(channel, protocol_name) }
605    }
606
607    /// Get a Stream of events from the remote end of the protocol.
608    ///
609    /// # Panics
610    ///
611    /// Panics if the event stream was already taken.
612    pub fn take_event_stream(&self) -> AllocatorEventStream {
613        AllocatorEventStream { event_receiver: self.client.take_event_receiver() }
614    }
615
616    /// A BufferCollection is a set of VMOs created by Sysmem and shared by a number of
617    /// participants, one of which is the Flatland Renderer. Some content, such as Images, use a
618    /// BufferCollection as their backing memory.
619    ///
620    /// See [`RegisterBufferCollectionArgs`] for information on each argument.
621    pub fn r#register_buffer_collection(
622        &self,
623        mut args: RegisterBufferCollectionArgs,
624    ) -> fidl::client::QueryResponseFut<
625        AllocatorRegisterBufferCollectionResult,
626        fidl::encoding::DefaultFuchsiaResourceDialect,
627    > {
628        AllocatorProxyInterface::r#register_buffer_collection(self, args)
629    }
630}
631
632impl AllocatorProxyInterface for AllocatorProxy {
633    type RegisterBufferCollectionResponseFut = fidl::client::QueryResponseFut<
634        AllocatorRegisterBufferCollectionResult,
635        fidl::encoding::DefaultFuchsiaResourceDialect,
636    >;
637    fn r#register_buffer_collection(
638        &self,
639        mut args: RegisterBufferCollectionArgs,
640    ) -> Self::RegisterBufferCollectionResponseFut {
641        fn _decode(
642            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
643        ) -> Result<AllocatorRegisterBufferCollectionResult, fidl::Error> {
644            let _response = fidl::client::decode_transaction_body::<
645                fidl::encoding::ResultType<
646                    fidl::encoding::EmptyStruct,
647                    RegisterBufferCollectionError,
648                >,
649                fidl::encoding::DefaultFuchsiaResourceDialect,
650                0x494b7ea578d1061e,
651            >(_buf?)?;
652            Ok(_response.map(|x| x))
653        }
654        self.client.send_query_and_decode::<
655            AllocatorRegisterBufferCollectionRequest,
656            AllocatorRegisterBufferCollectionResult,
657        >(
658            (&mut args,),
659            0x494b7ea578d1061e,
660            fidl::encoding::DynamicFlags::empty(),
661            _decode,
662        )
663    }
664}
665
666pub struct AllocatorEventStream {
667    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
668}
669
670impl std::marker::Unpin for AllocatorEventStream {}
671
672impl futures::stream::FusedStream for AllocatorEventStream {
673    fn is_terminated(&self) -> bool {
674        self.event_receiver.is_terminated()
675    }
676}
677
678impl futures::Stream for AllocatorEventStream {
679    type Item = Result<AllocatorEvent, fidl::Error>;
680
681    fn poll_next(
682        mut self: std::pin::Pin<&mut Self>,
683        cx: &mut std::task::Context<'_>,
684    ) -> std::task::Poll<Option<Self::Item>> {
685        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
686            &mut self.event_receiver,
687            cx
688        )?) {
689            Some(buf) => std::task::Poll::Ready(Some(AllocatorEvent::decode(buf))),
690            None => std::task::Poll::Ready(None),
691        }
692    }
693}
694
695#[derive(Debug)]
696pub enum AllocatorEvent {}
697
698impl AllocatorEvent {
699    /// Decodes a message buffer as a [`AllocatorEvent`].
700    fn decode(
701        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
702    ) -> Result<AllocatorEvent, fidl::Error> {
703        let (bytes, _handles) = buf.split_mut();
704        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
705        debug_assert_eq!(tx_header.tx_id, 0);
706        match tx_header.ordinal {
707            _ => Err(fidl::Error::UnknownOrdinal {
708                ordinal: tx_header.ordinal,
709                protocol_name: <AllocatorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
710            }),
711        }
712    }
713}
714
715/// A Stream of incoming requests for fuchsia.ui.composition/Allocator.
716pub struct AllocatorRequestStream {
717    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
718    is_terminated: bool,
719}
720
721impl std::marker::Unpin for AllocatorRequestStream {}
722
723impl futures::stream::FusedStream for AllocatorRequestStream {
724    fn is_terminated(&self) -> bool {
725        self.is_terminated
726    }
727}
728
729impl fidl::endpoints::RequestStream for AllocatorRequestStream {
730    type Protocol = AllocatorMarker;
731    type ControlHandle = AllocatorControlHandle;
732
733    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
734        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
735    }
736
737    fn control_handle(&self) -> Self::ControlHandle {
738        AllocatorControlHandle { inner: self.inner.clone() }
739    }
740
741    fn into_inner(
742        self,
743    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
744    {
745        (self.inner, self.is_terminated)
746    }
747
748    fn from_inner(
749        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
750        is_terminated: bool,
751    ) -> Self {
752        Self { inner, is_terminated }
753    }
754}
755
756impl futures::Stream for AllocatorRequestStream {
757    type Item = Result<AllocatorRequest, fidl::Error>;
758
759    fn poll_next(
760        mut self: std::pin::Pin<&mut Self>,
761        cx: &mut std::task::Context<'_>,
762    ) -> std::task::Poll<Option<Self::Item>> {
763        let this = &mut *self;
764        if this.inner.check_shutdown(cx) {
765            this.is_terminated = true;
766            return std::task::Poll::Ready(None);
767        }
768        if this.is_terminated {
769            panic!("polled AllocatorRequestStream after completion");
770        }
771        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
772            |bytes, handles| {
773                match this.inner.channel().read_etc(cx, bytes, handles) {
774                    std::task::Poll::Ready(Ok(())) => {}
775                    std::task::Poll::Pending => return std::task::Poll::Pending,
776                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
777                        this.is_terminated = true;
778                        return std::task::Poll::Ready(None);
779                    }
780                    std::task::Poll::Ready(Err(e)) => {
781                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
782                            e.into(),
783                        ))));
784                    }
785                }
786
787                // A message has been received from the channel
788                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
789
790                std::task::Poll::Ready(Some(match header.ordinal {
791                    0x494b7ea578d1061e => {
792                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
793                        let mut req = fidl::new_empty!(
794                            AllocatorRegisterBufferCollectionRequest,
795                            fidl::encoding::DefaultFuchsiaResourceDialect
796                        );
797                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AllocatorRegisterBufferCollectionRequest>(&header, _body_bytes, handles, &mut req)?;
798                        let control_handle = AllocatorControlHandle { inner: this.inner.clone() };
799                        Ok(AllocatorRequest::RegisterBufferCollection {
800                            args: req.args,
801
802                            responder: AllocatorRegisterBufferCollectionResponder {
803                                control_handle: std::mem::ManuallyDrop::new(control_handle),
804                                tx_id: header.tx_id,
805                            },
806                        })
807                    }
808                    _ => Err(fidl::Error::UnknownOrdinal {
809                        ordinal: header.ordinal,
810                        protocol_name:
811                            <AllocatorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
812                    }),
813                }))
814            },
815        )
816    }
817}
818
819#[derive(Debug)]
820pub enum AllocatorRequest {
821    /// A BufferCollection is a set of VMOs created by Sysmem and shared by a number of
822    /// participants, one of which is the Flatland Renderer. Some content, such as Images, use a
823    /// BufferCollection as their backing memory.
824    ///
825    /// See [`RegisterBufferCollectionArgs`] for information on each argument.
826    RegisterBufferCollection {
827        args: RegisterBufferCollectionArgs,
828        responder: AllocatorRegisterBufferCollectionResponder,
829    },
830}
831
832impl AllocatorRequest {
833    #[allow(irrefutable_let_patterns)]
834    pub fn into_register_buffer_collection(
835        self,
836    ) -> Option<(RegisterBufferCollectionArgs, AllocatorRegisterBufferCollectionResponder)> {
837        if let AllocatorRequest::RegisterBufferCollection { args, responder } = self {
838            Some((args, responder))
839        } else {
840            None
841        }
842    }
843
844    /// Name of the method defined in FIDL
845    pub fn method_name(&self) -> &'static str {
846        match *self {
847            AllocatorRequest::RegisterBufferCollection { .. } => "register_buffer_collection",
848        }
849    }
850}
851
852#[derive(Debug, Clone)]
853pub struct AllocatorControlHandle {
854    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
855}
856
857impl fidl::endpoints::ControlHandle for AllocatorControlHandle {
858    fn shutdown(&self) {
859        self.inner.shutdown()
860    }
861
862    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
863        self.inner.shutdown_with_epitaph(status)
864    }
865
866    fn is_closed(&self) -> bool {
867        self.inner.channel().is_closed()
868    }
869    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
870        self.inner.channel().on_closed()
871    }
872
873    #[cfg(target_os = "fuchsia")]
874    fn signal_peer(
875        &self,
876        clear_mask: zx::Signals,
877        set_mask: zx::Signals,
878    ) -> Result<(), zx_status::Status> {
879        use fidl::Peered;
880        self.inner.channel().signal_peer(clear_mask, set_mask)
881    }
882}
883
884impl AllocatorControlHandle {}
885
886#[must_use = "FIDL methods require a response to be sent"]
887#[derive(Debug)]
888pub struct AllocatorRegisterBufferCollectionResponder {
889    control_handle: std::mem::ManuallyDrop<AllocatorControlHandle>,
890    tx_id: u32,
891}
892
893/// Set the the channel to be shutdown (see [`AllocatorControlHandle::shutdown`])
894/// if the responder is dropped without sending a response, so that the client
895/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
896impl std::ops::Drop for AllocatorRegisterBufferCollectionResponder {
897    fn drop(&mut self) {
898        self.control_handle.shutdown();
899        // Safety: drops once, never accessed again
900        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
901    }
902}
903
904impl fidl::endpoints::Responder for AllocatorRegisterBufferCollectionResponder {
905    type ControlHandle = AllocatorControlHandle;
906
907    fn control_handle(&self) -> &AllocatorControlHandle {
908        &self.control_handle
909    }
910
911    fn drop_without_shutdown(mut self) {
912        // Safety: drops once, never accessed again due to mem::forget
913        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
914        // Prevent Drop from running (which would shut down the channel)
915        std::mem::forget(self);
916    }
917}
918
919impl AllocatorRegisterBufferCollectionResponder {
920    /// Sends a response to the FIDL transaction.
921    ///
922    /// Sets the channel to shutdown if an error occurs.
923    pub fn send(
924        self,
925        mut result: Result<(), RegisterBufferCollectionError>,
926    ) -> Result<(), fidl::Error> {
927        let _result = self.send_raw(result);
928        if _result.is_err() {
929            self.control_handle.shutdown();
930        }
931        self.drop_without_shutdown();
932        _result
933    }
934
935    /// Similar to "send" but does not shutdown the channel if an error occurs.
936    pub fn send_no_shutdown_on_err(
937        self,
938        mut result: Result<(), RegisterBufferCollectionError>,
939    ) -> Result<(), fidl::Error> {
940        let _result = self.send_raw(result);
941        self.drop_without_shutdown();
942        _result
943    }
944
945    fn send_raw(
946        &self,
947        mut result: Result<(), RegisterBufferCollectionError>,
948    ) -> Result<(), fidl::Error> {
949        self.control_handle.inner.send::<fidl::encoding::ResultType<
950            fidl::encoding::EmptyStruct,
951            RegisterBufferCollectionError,
952        >>(
953            result,
954            self.tx_id,
955            0x494b7ea578d1061e,
956            fidl::encoding::DynamicFlags::empty(),
957        )
958    }
959}
960
961#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
962pub struct ChildViewWatcherMarker;
963
964impl fidl::endpoints::ProtocolMarker for ChildViewWatcherMarker {
965    type Proxy = ChildViewWatcherProxy;
966    type RequestStream = ChildViewWatcherRequestStream;
967    #[cfg(target_os = "fuchsia")]
968    type SynchronousProxy = ChildViewWatcherSynchronousProxy;
969
970    const DEBUG_NAME: &'static str = "(anonymous) ChildViewWatcher";
971}
972
973pub trait ChildViewWatcherProxyInterface: Send + Sync {
974    type GetStatusResponseFut: std::future::Future<Output = Result<ChildViewStatus, fidl::Error>>
975        + Send;
976    fn r#get_status(&self) -> Self::GetStatusResponseFut;
977    type GetViewRefResponseFut: std::future::Future<Output = Result<fidl_fuchsia_ui_views::ViewRef, fidl::Error>>
978        + Send;
979    fn r#get_view_ref(&self) -> Self::GetViewRefResponseFut;
980}
981#[derive(Debug)]
982#[cfg(target_os = "fuchsia")]
983pub struct ChildViewWatcherSynchronousProxy {
984    client: fidl::client::sync::Client,
985}
986
987#[cfg(target_os = "fuchsia")]
988impl fidl::endpoints::SynchronousProxy for ChildViewWatcherSynchronousProxy {
989    type Proxy = ChildViewWatcherProxy;
990    type Protocol = ChildViewWatcherMarker;
991
992    fn from_channel(inner: fidl::Channel) -> Self {
993        Self::new(inner)
994    }
995
996    fn into_channel(self) -> fidl::Channel {
997        self.client.into_channel()
998    }
999
1000    fn as_channel(&self) -> &fidl::Channel {
1001        self.client.as_channel()
1002    }
1003}
1004
1005#[cfg(target_os = "fuchsia")]
1006impl ChildViewWatcherSynchronousProxy {
1007    pub fn new(channel: fidl::Channel) -> Self {
1008        let protocol_name = <ChildViewWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1009        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1010    }
1011
1012    pub fn into_channel(self) -> fidl::Channel {
1013        self.client.into_channel()
1014    }
1015
1016    /// Waits until an event arrives and returns it. It is safe for other
1017    /// threads to make concurrent requests while waiting for an event.
1018    pub fn wait_for_event(
1019        &self,
1020        deadline: zx::MonotonicInstant,
1021    ) -> Result<ChildViewWatcherEvent, fidl::Error> {
1022        ChildViewWatcherEvent::decode(self.client.wait_for_event(deadline)?)
1023    }
1024
1025    /// A hanging get for receiving the status of a View. This provides information to the parent,
1026    /// such as whether or not the child has successfully presented content through this View.
1027    ///
1028    /// This hanging get will only fire when the ChildViewStatus is different than the previously
1029    /// returned ChildViewStatus.  This can happen immediately, and even if the creator of the
1030    /// Viewport hasn't yet called Present() after calling CreateViewport().  This allows the parent
1031    /// to know that the child has content ready to display before the parent modifies their own
1032    /// local scene graph to incorporate the child content.
1033    ///
1034    /// It is invalid to call `GetStatus` while a previous call is still pending. Doing so will
1035    /// cause both this channel and the Flatland channel that handed out ChildViewWatcher to be
1036    /// closed.
1037    pub fn r#get_status(
1038        &self,
1039        ___deadline: zx::MonotonicInstant,
1040    ) -> Result<ChildViewStatus, fidl::Error> {
1041        let _response = self
1042            .client
1043            .send_query::<fidl::encoding::EmptyPayload, ChildViewWatcherGetStatusResponse>(
1044                (),
1045                0x1d622075f4fc8243,
1046                fidl::encoding::DynamicFlags::empty(),
1047                ___deadline,
1048            )?;
1049        Ok(_response.status)
1050    }
1051
1052    /// Hanging get to receive the ViewRef of the child View. This will only fire when the View ref
1053    /// is different from the previously-returned View ref. Note: currently the View ref will not
1054    /// change after it is first received, but this will change if/when the API changes to allow
1055    /// relinking of views.
1056    ///
1057    /// The ViewRef is not returned until the View is included in the View tree, in other words when
1058    /// there is a chain of ancestor transforms all the way back up to the root of the scene graph,
1059    /// i.e. the display.
1060    ///
1061    /// It is invalid to call `GetViewRef` while a previous call is still pending. Doing so will
1062    /// cause both this channel and the Flatland channel that handed out ChildViewWatcher to be
1063    /// closed.
1064    ///
1065    /// A `GetViewRef` call will hang if the View was created using `CreateView`, but returns the
1066    /// View if the View was created using CreateView2. This is because `CreateView` does not mint
1067    /// a ViewRef for that View.
1068    pub fn r#get_view_ref(
1069        &self,
1070        ___deadline: zx::MonotonicInstant,
1071    ) -> Result<fidl_fuchsia_ui_views::ViewRef, fidl::Error> {
1072        let _response = self
1073            .client
1074            .send_query::<fidl::encoding::EmptyPayload, ChildViewWatcherGetViewRefResponse>(
1075                (),
1076                0x3b2f3ca31e8908b4,
1077                fidl::encoding::DynamicFlags::empty(),
1078                ___deadline,
1079            )?;
1080        Ok(_response.view_ref)
1081    }
1082}
1083
1084#[cfg(target_os = "fuchsia")]
1085impl From<ChildViewWatcherSynchronousProxy> for zx::NullableHandle {
1086    fn from(value: ChildViewWatcherSynchronousProxy) -> Self {
1087        value.into_channel().into()
1088    }
1089}
1090
1091#[cfg(target_os = "fuchsia")]
1092impl From<fidl::Channel> for ChildViewWatcherSynchronousProxy {
1093    fn from(value: fidl::Channel) -> Self {
1094        Self::new(value)
1095    }
1096}
1097
1098#[cfg(target_os = "fuchsia")]
1099impl fidl::endpoints::FromClient for ChildViewWatcherSynchronousProxy {
1100    type Protocol = ChildViewWatcherMarker;
1101
1102    fn from_client(value: fidl::endpoints::ClientEnd<ChildViewWatcherMarker>) -> Self {
1103        Self::new(value.into_channel())
1104    }
1105}
1106
1107#[derive(Debug, Clone)]
1108pub struct ChildViewWatcherProxy {
1109    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1110}
1111
1112impl fidl::endpoints::Proxy for ChildViewWatcherProxy {
1113    type Protocol = ChildViewWatcherMarker;
1114
1115    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1116        Self::new(inner)
1117    }
1118
1119    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1120        self.client.into_channel().map_err(|client| Self { client })
1121    }
1122
1123    fn as_channel(&self) -> &::fidl::AsyncChannel {
1124        self.client.as_channel()
1125    }
1126}
1127
1128impl ChildViewWatcherProxy {
1129    /// Create a new Proxy for fuchsia.ui.composition/ChildViewWatcher.
1130    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1131        let protocol_name = <ChildViewWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1132        Self { client: fidl::client::Client::new(channel, protocol_name) }
1133    }
1134
1135    /// Get a Stream of events from the remote end of the protocol.
1136    ///
1137    /// # Panics
1138    ///
1139    /// Panics if the event stream was already taken.
1140    pub fn take_event_stream(&self) -> ChildViewWatcherEventStream {
1141        ChildViewWatcherEventStream { event_receiver: self.client.take_event_receiver() }
1142    }
1143
1144    /// A hanging get for receiving the status of a View. This provides information to the parent,
1145    /// such as whether or not the child has successfully presented content through this View.
1146    ///
1147    /// This hanging get will only fire when the ChildViewStatus is different than the previously
1148    /// returned ChildViewStatus.  This can happen immediately, and even if the creator of the
1149    /// Viewport hasn't yet called Present() after calling CreateViewport().  This allows the parent
1150    /// to know that the child has content ready to display before the parent modifies their own
1151    /// local scene graph to incorporate the child content.
1152    ///
1153    /// It is invalid to call `GetStatus` while a previous call is still pending. Doing so will
1154    /// cause both this channel and the Flatland channel that handed out ChildViewWatcher to be
1155    /// closed.
1156    pub fn r#get_status(
1157        &self,
1158    ) -> fidl::client::QueryResponseFut<
1159        ChildViewStatus,
1160        fidl::encoding::DefaultFuchsiaResourceDialect,
1161    > {
1162        ChildViewWatcherProxyInterface::r#get_status(self)
1163    }
1164
1165    /// Hanging get to receive the ViewRef of the child View. This will only fire when the View ref
1166    /// is different from the previously-returned View ref. Note: currently the View ref will not
1167    /// change after it is first received, but this will change if/when the API changes to allow
1168    /// relinking of views.
1169    ///
1170    /// The ViewRef is not returned until the View is included in the View tree, in other words when
1171    /// there is a chain of ancestor transforms all the way back up to the root of the scene graph,
1172    /// i.e. the display.
1173    ///
1174    /// It is invalid to call `GetViewRef` while a previous call is still pending. Doing so will
1175    /// cause both this channel and the Flatland channel that handed out ChildViewWatcher to be
1176    /// closed.
1177    ///
1178    /// A `GetViewRef` call will hang if the View was created using `CreateView`, but returns the
1179    /// View if the View was created using CreateView2. This is because `CreateView` does not mint
1180    /// a ViewRef for that View.
1181    pub fn r#get_view_ref(
1182        &self,
1183    ) -> fidl::client::QueryResponseFut<
1184        fidl_fuchsia_ui_views::ViewRef,
1185        fidl::encoding::DefaultFuchsiaResourceDialect,
1186    > {
1187        ChildViewWatcherProxyInterface::r#get_view_ref(self)
1188    }
1189}
1190
1191impl ChildViewWatcherProxyInterface for ChildViewWatcherProxy {
1192    type GetStatusResponseFut = fidl::client::QueryResponseFut<
1193        ChildViewStatus,
1194        fidl::encoding::DefaultFuchsiaResourceDialect,
1195    >;
1196    fn r#get_status(&self) -> Self::GetStatusResponseFut {
1197        fn _decode(
1198            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1199        ) -> Result<ChildViewStatus, fidl::Error> {
1200            let _response = fidl::client::decode_transaction_body::<
1201                ChildViewWatcherGetStatusResponse,
1202                fidl::encoding::DefaultFuchsiaResourceDialect,
1203                0x1d622075f4fc8243,
1204            >(_buf?)?;
1205            Ok(_response.status)
1206        }
1207        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ChildViewStatus>(
1208            (),
1209            0x1d622075f4fc8243,
1210            fidl::encoding::DynamicFlags::empty(),
1211            _decode,
1212        )
1213    }
1214
1215    type GetViewRefResponseFut = fidl::client::QueryResponseFut<
1216        fidl_fuchsia_ui_views::ViewRef,
1217        fidl::encoding::DefaultFuchsiaResourceDialect,
1218    >;
1219    fn r#get_view_ref(&self) -> Self::GetViewRefResponseFut {
1220        fn _decode(
1221            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1222        ) -> Result<fidl_fuchsia_ui_views::ViewRef, fidl::Error> {
1223            let _response = fidl::client::decode_transaction_body::<
1224                ChildViewWatcherGetViewRefResponse,
1225                fidl::encoding::DefaultFuchsiaResourceDialect,
1226                0x3b2f3ca31e8908b4,
1227            >(_buf?)?;
1228            Ok(_response.view_ref)
1229        }
1230        self.client
1231            .send_query_and_decode::<fidl::encoding::EmptyPayload, fidl_fuchsia_ui_views::ViewRef>(
1232                (),
1233                0x3b2f3ca31e8908b4,
1234                fidl::encoding::DynamicFlags::empty(),
1235                _decode,
1236            )
1237    }
1238}
1239
1240pub struct ChildViewWatcherEventStream {
1241    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1242}
1243
1244impl std::marker::Unpin for ChildViewWatcherEventStream {}
1245
1246impl futures::stream::FusedStream for ChildViewWatcherEventStream {
1247    fn is_terminated(&self) -> bool {
1248        self.event_receiver.is_terminated()
1249    }
1250}
1251
1252impl futures::Stream for ChildViewWatcherEventStream {
1253    type Item = Result<ChildViewWatcherEvent, fidl::Error>;
1254
1255    fn poll_next(
1256        mut self: std::pin::Pin<&mut Self>,
1257        cx: &mut std::task::Context<'_>,
1258    ) -> std::task::Poll<Option<Self::Item>> {
1259        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1260            &mut self.event_receiver,
1261            cx
1262        )?) {
1263            Some(buf) => std::task::Poll::Ready(Some(ChildViewWatcherEvent::decode(buf))),
1264            None => std::task::Poll::Ready(None),
1265        }
1266    }
1267}
1268
1269#[derive(Debug)]
1270pub enum ChildViewWatcherEvent {}
1271
1272impl ChildViewWatcherEvent {
1273    /// Decodes a message buffer as a [`ChildViewWatcherEvent`].
1274    fn decode(
1275        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1276    ) -> Result<ChildViewWatcherEvent, fidl::Error> {
1277        let (bytes, _handles) = buf.split_mut();
1278        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1279        debug_assert_eq!(tx_header.tx_id, 0);
1280        match tx_header.ordinal {
1281            _ => Err(fidl::Error::UnknownOrdinal {
1282                ordinal: tx_header.ordinal,
1283                protocol_name:
1284                    <ChildViewWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1285            }),
1286        }
1287    }
1288}
1289
1290/// A Stream of incoming requests for fuchsia.ui.composition/ChildViewWatcher.
1291pub struct ChildViewWatcherRequestStream {
1292    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1293    is_terminated: bool,
1294}
1295
1296impl std::marker::Unpin for ChildViewWatcherRequestStream {}
1297
1298impl futures::stream::FusedStream for ChildViewWatcherRequestStream {
1299    fn is_terminated(&self) -> bool {
1300        self.is_terminated
1301    }
1302}
1303
1304impl fidl::endpoints::RequestStream for ChildViewWatcherRequestStream {
1305    type Protocol = ChildViewWatcherMarker;
1306    type ControlHandle = ChildViewWatcherControlHandle;
1307
1308    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1309        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1310    }
1311
1312    fn control_handle(&self) -> Self::ControlHandle {
1313        ChildViewWatcherControlHandle { inner: self.inner.clone() }
1314    }
1315
1316    fn into_inner(
1317        self,
1318    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1319    {
1320        (self.inner, self.is_terminated)
1321    }
1322
1323    fn from_inner(
1324        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1325        is_terminated: bool,
1326    ) -> Self {
1327        Self { inner, is_terminated }
1328    }
1329}
1330
1331impl futures::Stream for ChildViewWatcherRequestStream {
1332    type Item = Result<ChildViewWatcherRequest, fidl::Error>;
1333
1334    fn poll_next(
1335        mut self: std::pin::Pin<&mut Self>,
1336        cx: &mut std::task::Context<'_>,
1337    ) -> std::task::Poll<Option<Self::Item>> {
1338        let this = &mut *self;
1339        if this.inner.check_shutdown(cx) {
1340            this.is_terminated = true;
1341            return std::task::Poll::Ready(None);
1342        }
1343        if this.is_terminated {
1344            panic!("polled ChildViewWatcherRequestStream after completion");
1345        }
1346        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1347            |bytes, handles| {
1348                match this.inner.channel().read_etc(cx, bytes, handles) {
1349                    std::task::Poll::Ready(Ok(())) => {}
1350                    std::task::Poll::Pending => return std::task::Poll::Pending,
1351                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1352                        this.is_terminated = true;
1353                        return std::task::Poll::Ready(None);
1354                    }
1355                    std::task::Poll::Ready(Err(e)) => {
1356                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1357                            e.into(),
1358                        ))));
1359                    }
1360                }
1361
1362                // A message has been received from the channel
1363                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1364
1365                std::task::Poll::Ready(Some(match header.ordinal {
1366                    0x1d622075f4fc8243 => {
1367                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1368                        let mut req = fidl::new_empty!(
1369                            fidl::encoding::EmptyPayload,
1370                            fidl::encoding::DefaultFuchsiaResourceDialect
1371                        );
1372                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1373                        let control_handle =
1374                            ChildViewWatcherControlHandle { inner: this.inner.clone() };
1375                        Ok(ChildViewWatcherRequest::GetStatus {
1376                            responder: ChildViewWatcherGetStatusResponder {
1377                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1378                                tx_id: header.tx_id,
1379                            },
1380                        })
1381                    }
1382                    0x3b2f3ca31e8908b4 => {
1383                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1384                        let mut req = fidl::new_empty!(
1385                            fidl::encoding::EmptyPayload,
1386                            fidl::encoding::DefaultFuchsiaResourceDialect
1387                        );
1388                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1389                        let control_handle =
1390                            ChildViewWatcherControlHandle { inner: this.inner.clone() };
1391                        Ok(ChildViewWatcherRequest::GetViewRef {
1392                            responder: ChildViewWatcherGetViewRefResponder {
1393                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1394                                tx_id: header.tx_id,
1395                            },
1396                        })
1397                    }
1398                    _ => Err(fidl::Error::UnknownOrdinal {
1399                        ordinal: header.ordinal,
1400                        protocol_name:
1401                            <ChildViewWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1402                    }),
1403                }))
1404            },
1405        )
1406    }
1407}
1408
1409/// A protocol that provides information about a particular child View which is attached to the
1410/// Viewport owned by the parent client; connections to this protocol are estabished in
1411/// [`CreateViewport`].  Since a Flatland instance may contain any number of Viewports, each of
1412/// which may or may not be attached to a transform, the client can maintain connections to an
1413/// equal number of ChildViewWatcher instances.
1414///
1415/// Each ChildViewWatcher instance will remain connected as long as the corresponding child View
1416/// exists; the connection will also be closed if the child's ViewCreationToken is dropped without
1417/// using it to create a View.
1418#[derive(Debug)]
1419pub enum ChildViewWatcherRequest {
1420    /// A hanging get for receiving the status of a View. This provides information to the parent,
1421    /// such as whether or not the child has successfully presented content through this View.
1422    ///
1423    /// This hanging get will only fire when the ChildViewStatus is different than the previously
1424    /// returned ChildViewStatus.  This can happen immediately, and even if the creator of the
1425    /// Viewport hasn't yet called Present() after calling CreateViewport().  This allows the parent
1426    /// to know that the child has content ready to display before the parent modifies their own
1427    /// local scene graph to incorporate the child content.
1428    ///
1429    /// It is invalid to call `GetStatus` while a previous call is still pending. Doing so will
1430    /// cause both this channel and the Flatland channel that handed out ChildViewWatcher to be
1431    /// closed.
1432    GetStatus { responder: ChildViewWatcherGetStatusResponder },
1433    /// Hanging get to receive the ViewRef of the child View. This will only fire when the View ref
1434    /// is different from the previously-returned View ref. Note: currently the View ref will not
1435    /// change after it is first received, but this will change if/when the API changes to allow
1436    /// relinking of views.
1437    ///
1438    /// The ViewRef is not returned until the View is included in the View tree, in other words when
1439    /// there is a chain of ancestor transforms all the way back up to the root of the scene graph,
1440    /// i.e. the display.
1441    ///
1442    /// It is invalid to call `GetViewRef` while a previous call is still pending. Doing so will
1443    /// cause both this channel and the Flatland channel that handed out ChildViewWatcher to be
1444    /// closed.
1445    ///
1446    /// A `GetViewRef` call will hang if the View was created using `CreateView`, but returns the
1447    /// View if the View was created using CreateView2. This is because `CreateView` does not mint
1448    /// a ViewRef for that View.
1449    GetViewRef { responder: ChildViewWatcherGetViewRefResponder },
1450}
1451
1452impl ChildViewWatcherRequest {
1453    #[allow(irrefutable_let_patterns)]
1454    pub fn into_get_status(self) -> Option<(ChildViewWatcherGetStatusResponder)> {
1455        if let ChildViewWatcherRequest::GetStatus { responder } = self {
1456            Some((responder))
1457        } else {
1458            None
1459        }
1460    }
1461
1462    #[allow(irrefutable_let_patterns)]
1463    pub fn into_get_view_ref(self) -> Option<(ChildViewWatcherGetViewRefResponder)> {
1464        if let ChildViewWatcherRequest::GetViewRef { responder } = self {
1465            Some((responder))
1466        } else {
1467            None
1468        }
1469    }
1470
1471    /// Name of the method defined in FIDL
1472    pub fn method_name(&self) -> &'static str {
1473        match *self {
1474            ChildViewWatcherRequest::GetStatus { .. } => "get_status",
1475            ChildViewWatcherRequest::GetViewRef { .. } => "get_view_ref",
1476        }
1477    }
1478}
1479
1480#[derive(Debug, Clone)]
1481pub struct ChildViewWatcherControlHandle {
1482    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1483}
1484
1485impl fidl::endpoints::ControlHandle for ChildViewWatcherControlHandle {
1486    fn shutdown(&self) {
1487        self.inner.shutdown()
1488    }
1489
1490    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1491        self.inner.shutdown_with_epitaph(status)
1492    }
1493
1494    fn is_closed(&self) -> bool {
1495        self.inner.channel().is_closed()
1496    }
1497    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1498        self.inner.channel().on_closed()
1499    }
1500
1501    #[cfg(target_os = "fuchsia")]
1502    fn signal_peer(
1503        &self,
1504        clear_mask: zx::Signals,
1505        set_mask: zx::Signals,
1506    ) -> Result<(), zx_status::Status> {
1507        use fidl::Peered;
1508        self.inner.channel().signal_peer(clear_mask, set_mask)
1509    }
1510}
1511
1512impl ChildViewWatcherControlHandle {}
1513
1514#[must_use = "FIDL methods require a response to be sent"]
1515#[derive(Debug)]
1516pub struct ChildViewWatcherGetStatusResponder {
1517    control_handle: std::mem::ManuallyDrop<ChildViewWatcherControlHandle>,
1518    tx_id: u32,
1519}
1520
1521/// Set the the channel to be shutdown (see [`ChildViewWatcherControlHandle::shutdown`])
1522/// if the responder is dropped without sending a response, so that the client
1523/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1524impl std::ops::Drop for ChildViewWatcherGetStatusResponder {
1525    fn drop(&mut self) {
1526        self.control_handle.shutdown();
1527        // Safety: drops once, never accessed again
1528        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1529    }
1530}
1531
1532impl fidl::endpoints::Responder for ChildViewWatcherGetStatusResponder {
1533    type ControlHandle = ChildViewWatcherControlHandle;
1534
1535    fn control_handle(&self) -> &ChildViewWatcherControlHandle {
1536        &self.control_handle
1537    }
1538
1539    fn drop_without_shutdown(mut self) {
1540        // Safety: drops once, never accessed again due to mem::forget
1541        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1542        // Prevent Drop from running (which would shut down the channel)
1543        std::mem::forget(self);
1544    }
1545}
1546
1547impl ChildViewWatcherGetStatusResponder {
1548    /// Sends a response to the FIDL transaction.
1549    ///
1550    /// Sets the channel to shutdown if an error occurs.
1551    pub fn send(self, mut status: ChildViewStatus) -> Result<(), fidl::Error> {
1552        let _result = self.send_raw(status);
1553        if _result.is_err() {
1554            self.control_handle.shutdown();
1555        }
1556        self.drop_without_shutdown();
1557        _result
1558    }
1559
1560    /// Similar to "send" but does not shutdown the channel if an error occurs.
1561    pub fn send_no_shutdown_on_err(self, mut status: ChildViewStatus) -> Result<(), fidl::Error> {
1562        let _result = self.send_raw(status);
1563        self.drop_without_shutdown();
1564        _result
1565    }
1566
1567    fn send_raw(&self, mut status: ChildViewStatus) -> Result<(), fidl::Error> {
1568        self.control_handle.inner.send::<ChildViewWatcherGetStatusResponse>(
1569            (status,),
1570            self.tx_id,
1571            0x1d622075f4fc8243,
1572            fidl::encoding::DynamicFlags::empty(),
1573        )
1574    }
1575}
1576
1577#[must_use = "FIDL methods require a response to be sent"]
1578#[derive(Debug)]
1579pub struct ChildViewWatcherGetViewRefResponder {
1580    control_handle: std::mem::ManuallyDrop<ChildViewWatcherControlHandle>,
1581    tx_id: u32,
1582}
1583
1584/// Set the the channel to be shutdown (see [`ChildViewWatcherControlHandle::shutdown`])
1585/// if the responder is dropped without sending a response, so that the client
1586/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1587impl std::ops::Drop for ChildViewWatcherGetViewRefResponder {
1588    fn drop(&mut self) {
1589        self.control_handle.shutdown();
1590        // Safety: drops once, never accessed again
1591        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1592    }
1593}
1594
1595impl fidl::endpoints::Responder for ChildViewWatcherGetViewRefResponder {
1596    type ControlHandle = ChildViewWatcherControlHandle;
1597
1598    fn control_handle(&self) -> &ChildViewWatcherControlHandle {
1599        &self.control_handle
1600    }
1601
1602    fn drop_without_shutdown(mut self) {
1603        // Safety: drops once, never accessed again due to mem::forget
1604        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1605        // Prevent Drop from running (which would shut down the channel)
1606        std::mem::forget(self);
1607    }
1608}
1609
1610impl ChildViewWatcherGetViewRefResponder {
1611    /// Sends a response to the FIDL transaction.
1612    ///
1613    /// Sets the channel to shutdown if an error occurs.
1614    pub fn send(self, mut view_ref: fidl_fuchsia_ui_views::ViewRef) -> Result<(), fidl::Error> {
1615        let _result = self.send_raw(view_ref);
1616        if _result.is_err() {
1617            self.control_handle.shutdown();
1618        }
1619        self.drop_without_shutdown();
1620        _result
1621    }
1622
1623    /// Similar to "send" but does not shutdown the channel if an error occurs.
1624    pub fn send_no_shutdown_on_err(
1625        self,
1626        mut view_ref: fidl_fuchsia_ui_views::ViewRef,
1627    ) -> Result<(), fidl::Error> {
1628        let _result = self.send_raw(view_ref);
1629        self.drop_without_shutdown();
1630        _result
1631    }
1632
1633    fn send_raw(&self, mut view_ref: fidl_fuchsia_ui_views::ViewRef) -> Result<(), fidl::Error> {
1634        self.control_handle.inner.send::<ChildViewWatcherGetViewRefResponse>(
1635            (&mut view_ref,),
1636            self.tx_id,
1637            0x3b2f3ca31e8908b4,
1638            fidl::encoding::DynamicFlags::empty(),
1639        )
1640    }
1641}
1642
1643#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1644pub struct FlatlandMarker;
1645
1646impl fidl::endpoints::ProtocolMarker for FlatlandMarker {
1647    type Proxy = FlatlandProxy;
1648    type RequestStream = FlatlandRequestStream;
1649    #[cfg(target_os = "fuchsia")]
1650    type SynchronousProxy = FlatlandSynchronousProxy;
1651
1652    const DEBUG_NAME: &'static str = "fuchsia.ui.composition.Flatland";
1653}
1654impl fidl::endpoints::DiscoverableProtocolMarker for FlatlandMarker {}
1655
1656pub trait FlatlandProxyInterface: Send + Sync {
1657    fn r#release_image_immediately(&self, image_id: &ContentId) -> Result<(), fidl::Error>;
1658    fn r#present(&self, args: PresentArgs) -> Result<(), fidl::Error>;
1659    fn r#create_view(
1660        &self,
1661        token: fidl_fuchsia_ui_views::ViewCreationToken,
1662        parent_viewport_watcher: fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>,
1663    ) -> Result<(), fidl::Error>;
1664    fn r#create_view2(
1665        &self,
1666        token: fidl_fuchsia_ui_views::ViewCreationToken,
1667        view_identity: fidl_fuchsia_ui_views::ViewIdentityOnCreation,
1668        protocols: ViewBoundProtocols,
1669        parent_viewport_watcher: fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>,
1670    ) -> Result<(), fidl::Error>;
1671    fn r#create_transform(&self, transform_id: &TransformId) -> Result<(), fidl::Error>;
1672    fn r#set_translation(
1673        &self,
1674        transform_id: &TransformId,
1675        translation: &fidl_fuchsia_math::Vec_,
1676    ) -> Result<(), fidl::Error>;
1677    fn r#set_orientation(
1678        &self,
1679        transform_id: &TransformId,
1680        orientation: Orientation,
1681    ) -> Result<(), fidl::Error>;
1682    fn r#set_scale(
1683        &self,
1684        transform_id: &TransformId,
1685        scale: &fidl_fuchsia_math::VecF,
1686    ) -> Result<(), fidl::Error>;
1687    fn r#set_opacity(&self, transform_id: &TransformId, value: f32) -> Result<(), fidl::Error>;
1688    fn r#set_clip_boundary(
1689        &self,
1690        transform_id: &TransformId,
1691        rect: Option<&fidl_fuchsia_math::Rect>,
1692    ) -> Result<(), fidl::Error>;
1693    fn r#add_child(
1694        &self,
1695        parent_transform_id: &TransformId,
1696        child_transform_id: &TransformId,
1697    ) -> Result<(), fidl::Error>;
1698    fn r#remove_child(
1699        &self,
1700        parent_transform_id: &TransformId,
1701        child_transform_id: &TransformId,
1702    ) -> Result<(), fidl::Error>;
1703    fn r#replace_children(
1704        &self,
1705        parent_transform_id: &TransformId,
1706        new_child_transform_ids: &[TransformId],
1707    ) -> Result<(), fidl::Error>;
1708    fn r#set_root_transform(&self, transform_id: &TransformId) -> Result<(), fidl::Error>;
1709    fn r#set_hit_regions(
1710        &self,
1711        transform_id: &TransformId,
1712        regions: &[HitRegion],
1713    ) -> Result<(), fidl::Error>;
1714    fn r#set_infinite_hit_region(
1715        &self,
1716        transform_id: &TransformId,
1717        hit_test: HitTestInteraction,
1718    ) -> Result<(), fidl::Error>;
1719    fn r#create_viewport(
1720        &self,
1721        viewport_id: &ContentId,
1722        token: fidl_fuchsia_ui_views::ViewportCreationToken,
1723        properties: &ViewportProperties,
1724        child_view_watcher: fidl::endpoints::ServerEnd<ChildViewWatcherMarker>,
1725    ) -> Result<(), fidl::Error>;
1726    fn r#create_image(
1727        &self,
1728        image_id: &ContentId,
1729        import_token: BufferCollectionImportToken,
1730        vmo_index: u32,
1731        properties: &ImageProperties,
1732    ) -> Result<(), fidl::Error>;
1733    fn r#set_image_sample_region(
1734        &self,
1735        image_id: &ContentId,
1736        rect: &fidl_fuchsia_math::RectF,
1737    ) -> Result<(), fidl::Error>;
1738    fn r#set_image_destination_size(
1739        &self,
1740        image_id: &ContentId,
1741        size: &fidl_fuchsia_math::SizeU,
1742    ) -> Result<(), fidl::Error>;
1743    fn r#set_image_blending_function(
1744        &self,
1745        image_id: &ContentId,
1746        blend_mode: BlendMode,
1747    ) -> Result<(), fidl::Error>;
1748    fn r#set_image_blend_mode(
1749        &self,
1750        image_id: &ContentId,
1751        blend_mode: BlendMode2,
1752    ) -> Result<(), fidl::Error>;
1753    fn r#set_image_opacity(&self, image_id: &ContentId, val: f32) -> Result<(), fidl::Error>;
1754    fn r#set_image_flip(&self, image_id: &ContentId, flip: ImageFlip) -> Result<(), fidl::Error>;
1755    fn r#create_filled_rect(&self, rect_id: &ContentId) -> Result<(), fidl::Error>;
1756    fn r#set_solid_fill(
1757        &self,
1758        rect_id: &ContentId,
1759        color: &ColorRgba,
1760        size: &fidl_fuchsia_math::SizeU,
1761    ) -> Result<(), fidl::Error>;
1762    fn r#release_filled_rect(&self, rect_id: &ContentId) -> Result<(), fidl::Error>;
1763    fn r#set_content(
1764        &self,
1765        transform_id: &TransformId,
1766        content_id: &ContentId,
1767    ) -> Result<(), fidl::Error>;
1768    fn r#set_viewport_properties(
1769        &self,
1770        viewport_id: &ContentId,
1771        properties: &ViewportProperties,
1772    ) -> Result<(), fidl::Error>;
1773    fn r#release_transform(&self, transform_id: &TransformId) -> Result<(), fidl::Error>;
1774    fn r#release_view(&self) -> Result<(), fidl::Error>;
1775    type ReleaseViewportResponseFut: std::future::Future<
1776            Output = Result<fidl_fuchsia_ui_views::ViewportCreationToken, fidl::Error>,
1777        > + Send;
1778    fn r#release_viewport(&self, viewport_id: &ContentId) -> Self::ReleaseViewportResponseFut;
1779    fn r#release_image(&self, image_id: &ContentId) -> Result<(), fidl::Error>;
1780    fn r#clear(&self) -> Result<(), fidl::Error>;
1781    fn r#set_debug_name(&self, name: &str) -> Result<(), fidl::Error>;
1782}
1783#[derive(Debug)]
1784#[cfg(target_os = "fuchsia")]
1785pub struct FlatlandSynchronousProxy {
1786    client: fidl::client::sync::Client,
1787}
1788
1789#[cfg(target_os = "fuchsia")]
1790impl fidl::endpoints::SynchronousProxy for FlatlandSynchronousProxy {
1791    type Proxy = FlatlandProxy;
1792    type Protocol = FlatlandMarker;
1793
1794    fn from_channel(inner: fidl::Channel) -> Self {
1795        Self::new(inner)
1796    }
1797
1798    fn into_channel(self) -> fidl::Channel {
1799        self.client.into_channel()
1800    }
1801
1802    fn as_channel(&self) -> &fidl::Channel {
1803        self.client.as_channel()
1804    }
1805}
1806
1807#[cfg(target_os = "fuchsia")]
1808impl FlatlandSynchronousProxy {
1809    pub fn new(channel: fidl::Channel) -> Self {
1810        let protocol_name = <FlatlandMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1811        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1812    }
1813
1814    pub fn into_channel(self) -> fidl::Channel {
1815        self.client.into_channel()
1816    }
1817
1818    /// Waits until an event arrives and returns it. It is safe for other
1819    /// threads to make concurrent requests while waiting for an event.
1820    pub fn wait_for_event(
1821        &self,
1822        deadline: zx::MonotonicInstant,
1823    ) -> Result<FlatlandEvent, fidl::Error> {
1824        FlatlandEvent::decode(self.client.wait_for_event(deadline)?)
1825    }
1826
1827    /// Releases an image immediately, without waiting for the next present.
1828    pub fn r#release_image_immediately(&self, mut image_id: &ContentId) -> Result<(), fidl::Error> {
1829        self.client.send::<TrustedFlatlandReleaseImageImmediatelyRequest>(
1830            (image_id,),
1831            0x245e1ac080772c8,
1832            fidl::encoding::DynamicFlags::empty(),
1833        )
1834    }
1835
1836    /// Complete execution of all feed-forward operations.
1837    ///
1838    /// If executing an operation produces an error (e.g., CreateTransform(0)), an [`OnError`] event
1839    /// is emitted. Operations that produce errors are ignored and the channel is closed.
1840    ///
1841    /// If the execution is completed successfully, [`OnNextFrameBegin`] emits NO_ERROR along
1842    /// with other valid fields.
1843    ///
1844    /// The client may only call [`Present`] when they have a non-zero number of present credits,
1845    /// which are tracked by the server. The server may increment the number of credits when it
1846    /// fires the [`OnNextFrameBegin`] event, which informs the client when it receives additional
1847    /// present credits. Each [`Present`] call uses one present credit and decrements the server
1848    /// count by one. If the client calls [`Present`] with no present credits, the server will
1849    /// return a `NO_PRESENTS_REMAINING` error.
1850    ///
1851    /// The client should assume that prior to receiving any [`OnNextFrameBegin`] events, they have
1852    /// one present credit.
1853    ///
1854    /// Every [`Present`] call results in one [`OnNextFrameBegin`] event, and one
1855    /// [`OnFramePresented`] event, typically in that order.
1856    ///
1857    /// When the commands flushed by [`Present`] make it to display, an [`OnFramePresented`] event
1858    /// is fired. This event includes information pertaining to all [`Present`]s that had content
1859    /// that were part of that frame.
1860    ///
1861    /// See [`fuchsia.ui.composition/PresentArgs`] documentation above for more detailed information
1862    /// on what arguments are passed in and their role.
1863    pub fn r#present(&self, mut args: PresentArgs) -> Result<(), fidl::Error> {
1864        self.client.send::<FlatlandPresentRequest>(
1865            (&mut args,),
1866            0x50acc2aa1f0acec7,
1867            fidl::encoding::DynamicFlags::empty(),
1868        )
1869    }
1870
1871    /// Two Flatland instances may be connected in a parent-child relationship. The parent endpoint
1872    /// is held in a Viewport, and the child endpoint is held in a View. The parent Flatland
1873    /// instance that creates a Viewport has control over how the child's View is integrated into
1874    /// its own View.
1875    ///
1876    /// The lifecycle of a parent-child connection starts with two endpoints of a channel object:
1877    /// a ViewportCreationToken and a ViewCreationToken. Out-of-band protocols pass the
1878    /// ViewportCreationToken to the parent, which calls [`CreateViewport`], and the
1879    /// ViewCreationToken to the child, which calls [`CreateView`].
1880    ///
1881    /// Only nodes connected to the Root Transform in this Flatland instance will be rendered into
1882    /// the parent's Viewport.
1883    ///
1884    /// Calling [`CreateView`] a second time will disconnect the Root Transform from the existing
1885    /// parent's Viewport, and attach it to a new parent's Viewport. In other words, each View can
1886    /// only have one parent.
1887    ///
1888    /// This function is queued, meaning that the Root Transform will not be attached to the
1889    /// parent Viewport until [`Present`] is called. However, clients will receive information
1890    /// through their ParentViewportWatcher (e.g., LayoutInfo) immediately after calling this
1891    /// function, even if they have not called [`Present`] or [`SetRootTransform`]. This allows
1892    /// clients to wait for layout information from their parent before calling [`Present`].
1893    ///
1894    /// Any illegal operations on ParentViewportWatcher will cause both ParentViewportWatcher
1895    /// channel and this Flatland channel to be torn down.
1896    ///
1897    /// Lifecycle note. The lifetime of the ParentViewportWatcher channel is bound by the peer
1898    /// ViewportCreationToken. When the ViewportCreationToken dies, this ParentViewportWatcher
1899    /// channel is destroyed.
1900    ///
1901    /// Views and subgraphs of Views created using `CreateView` will not be represented in the
1902    /// ViewTree, and hence will not be able to participate in any ViewTree-dependent interactions
1903    /// such as touch, mouse or focus.
1904    /// The Flatland protocol provides no way for Views in the subgraph of a View created with
1905    /// `CreateView` to know that they are excluded from the ViewTree.
1906    pub fn r#create_view(
1907        &self,
1908        mut token: fidl_fuchsia_ui_views::ViewCreationToken,
1909        mut parent_viewport_watcher: fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>,
1910    ) -> Result<(), fidl::Error> {
1911        self.client.send::<FlatlandCreateViewRequest>(
1912            (&mut token, parent_viewport_watcher),
1913            0x504686eb25864780,
1914            fidl::encoding::DynamicFlags::empty(),
1915        )
1916    }
1917
1918    /// Identical to [`CreateView`], except it allows association of View identity (ViewRef) and
1919    /// view-bound protocols.
1920    pub fn r#create_view2(
1921        &self,
1922        mut token: fidl_fuchsia_ui_views::ViewCreationToken,
1923        mut view_identity: fidl_fuchsia_ui_views::ViewIdentityOnCreation,
1924        mut protocols: ViewBoundProtocols,
1925        mut parent_viewport_watcher: fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>,
1926    ) -> Result<(), fidl::Error> {
1927        self.client.send::<FlatlandCreateView2Request>(
1928            (&mut token, &mut view_identity, &mut protocols, parent_viewport_watcher),
1929            0x340a3a40c2fdbd5e,
1930            fidl::encoding::DynamicFlags::empty(),
1931        )
1932    }
1933
1934    /// Creates a new Transform node. Transforms are a hierarchical piece of a Flatland graph. They
1935    /// can have children, and can reference Content. A sub-graph represented by a Transform and its
1936    /// descendants can be rendered to a display.
1937    ///
1938    /// Transforms are kept alive, even when released, as long as they are children of either an
1939    /// unreleased Transform, or the Root Transform.
1940    ///
1941    /// Each Transform can have a single piece of attached Content. Common types of Content include
1942    /// bitmaps, asynchronous streams of images, and Viewports to Views hosted in other Flatland
1943    /// instances.
1944    ///
1945    /// Transforms have attributes. Child Transforms inherit the combined attributes of their
1946    /// parents. Content attached to a Transform is also affected by that Transform's attributes.
1947    ///
1948    /// When a sub-graph of Transforms is rendered, Content will be rendered back-to-front, starting
1949    /// with the Content on the root transform, and continuing recursively through all of its child
1950    /// Transforms in the order the children were added. See [`AddChild`] for more information.
1951    ///
1952    /// Zero is not a valid transform id. All other values are valid, assuming they are not already
1953    /// in use (see [`ReleaseTransform`] for more details).
1954    pub fn r#create_transform(&self, mut transform_id: &TransformId) -> Result<(), fidl::Error> {
1955        self.client.send::<FlatlandCreateTransformRequest>(
1956            (transform_id,),
1957            0x5e042a4d3de3efb0,
1958            fidl::encoding::DynamicFlags::empty(),
1959        )
1960    }
1961
1962    /// All Transform objects support all attributes.
1963    ///
1964    /// Geometric attributes are applied in the following order:
1965    /// 1. Scale (relative to the parent transform's coordinate space)
1966    /// 2. Orientation (relative to the parent transform's coordinate space)
1967    /// 3. Translation (relative to the parent transforms's coordinate space,
1968    ///    unaffected by scale applied to the current transform).
1969    /// 4. Clipping (relative to the current transform's coordinate space)
1970    ///
1971    /// The effects of each of these attributes are cumulative. This means the transform's position
1972    /// in the view space, and its clip boundary, will be calculated based on that chain of
1973    /// geometric attributes going up to the root transform.
1974    ///
1975    /// For instance, in a nested hierarchy such as the following:
1976    ///     [Root-Transform -> Transform1 -> Transform2 -> CurrentTransform]
1977    /// If Transform1 is translated by [2,0] and Transform2 is translated by [0,1] then the
1978    /// view-space position of CurrentTransform will be [2,1].
1979    ///
1980    /// Sets the translation on a Transform. The order of geometric attribute application is
1981    /// addressed above.
1982    pub fn r#set_translation(
1983        &self,
1984        mut transform_id: &TransformId,
1985        mut translation: &fidl_fuchsia_math::Vec_,
1986    ) -> Result<(), fidl::Error> {
1987        self.client.send::<FlatlandSetTranslationRequest>(
1988            (transform_id, translation),
1989            0x7863398291fba346,
1990            fidl::encoding::DynamicFlags::empty(),
1991        )
1992    }
1993
1994    /// Sets the orientation on a Transform. The order of geometric attribute application is
1995    /// addressed in the documentation for [`SetTranslation`]. In Flatland, the +X axis is
1996    /// to the right and the +Y axis is down. There is no notion of a Z axis. CCW is defined
1997    /// from the POV of the user, as if a skeuomorphoic clock is displayed on the screen.
1998    pub fn r#set_orientation(
1999        &self,
2000        mut transform_id: &TransformId,
2001        mut orientation: Orientation,
2002    ) -> Result<(), fidl::Error> {
2003        self.client.send::<FlatlandSetOrientationRequest>(
2004            (transform_id, orientation),
2005            0x4915310bc4928edc,
2006            fidl::encoding::DynamicFlags::empty(),
2007        )
2008    }
2009
2010    /// Sets the scale on a transform. The order of geometric attribute application is
2011    /// addressed above. The (x,y) values in the VecF |scale| refer to the scale factor in the
2012    /// x-axis (width) and y-axis (height) respectively. Scale values must be normal 32-bit
2013    /// floating point values: https://en.wikipedia.org/wiki/Normal_number_%28computing%29
2014    pub fn r#set_scale(
2015        &self,
2016        mut transform_id: &TransformId,
2017        mut scale: &fidl_fuchsia_math::VecF,
2018    ) -> Result<(), fidl::Error> {
2019        self.client.send::<FlatlandSetScaleRequest>(
2020            (transform_id, scale),
2021            0x1ea1766fd8996bb4,
2022            fidl::encoding::DynamicFlags::empty(),
2023        )
2024    }
2025
2026    /// Sets an opacity in linear space to be applied to a transform and its descendents,
2027    /// which include other transforms and content. Opacity values must be in the range
2028    /// of [0.0, 1.0], where 0.0 is completely transparent and 1.0 is completely opaque.
2029    /// Attempting to call this function with values outside that range will result in
2030    /// an error. A transform's opacity value is multiplied with that of its parent. This
2031    /// effect works differently from group opacity. Using group opacity, child nodes are
2032    /// rendered together first, and then have the parent's opacity applied as a post-effect.
2033    /// Here, opacity is applied to each child individually. This may result in a very
2034    /// different effect.
2035    pub fn r#set_opacity(
2036        &self,
2037        mut transform_id: &TransformId,
2038        mut value: f32,
2039    ) -> Result<(), fidl::Error> {
2040        self.client.send::<FlatlandSetOpacityRequest>(
2041            (transform_id, value),
2042            0x3775fc2c00b432fa,
2043            fidl::encoding::DynamicFlags::empty(),
2044        )
2045    }
2046
2047    /// Sets the bounds, expressed in the local coordinate space of the transform, that
2048    /// constrains the region that content attached to this transform can be rendered to.
2049    /// If the content's area exceeds the clip bounds, the area outside the bounds will
2050    /// not be rendered. These bounds are valid for all children of this transform node as
2051    /// well, which includes nested Flatland instances and their node hierarchies.
2052    /// If a child transform attempts to set clip bounds larger than that of its parent,
2053    /// it will be clipped to the parent's clip bounds. The default state is for a transform
2054    /// to be unclipped, meaning it will not have any bounds placed on its render region.
2055    /// The clip width/height must be positive. Negative values will result in an error.
2056    /// Passing in an empty box to the |rect| parameter will remove the clip bounds.
2057    pub fn r#set_clip_boundary(
2058        &self,
2059        mut transform_id: &TransformId,
2060        mut rect: Option<&fidl_fuchsia_math::Rect>,
2061    ) -> Result<(), fidl::Error> {
2062        self.client.send::<FlatlandSetClipBoundaryRequest>(
2063            (transform_id, rect),
2064            0x6507843df12222d2,
2065            fidl::encoding::DynamicFlags::empty(),
2066        )
2067    }
2068
2069    /// Adds a child Transform to a parent Transform. The new child Transform, and any Content
2070    /// attached to it or its children, will be rendered on top of the parent's Content, as well as
2071    /// any previously added children.
2072    pub fn r#add_child(
2073        &self,
2074        mut parent_transform_id: &TransformId,
2075        mut child_transform_id: &TransformId,
2076    ) -> Result<(), fidl::Error> {
2077        self.client.send::<FlatlandAddChildRequest>(
2078            (parent_transform_id, child_transform_id),
2079            0x67a8abd2f19b1a74,
2080            fidl::encoding::DynamicFlags::empty(),
2081        )
2082    }
2083
2084    /// Removes a child Transform from a parent Transform.
2085    pub fn r#remove_child(
2086        &self,
2087        mut parent_transform_id: &TransformId,
2088        mut child_transform_id: &TransformId,
2089    ) -> Result<(), fidl::Error> {
2090        self.client.send::<FlatlandRemoveChildRequest>(
2091            (parent_transform_id, child_transform_id),
2092            0x41d6cd90b298b67a,
2093            fidl::encoding::DynamicFlags::empty(),
2094        )
2095    }
2096
2097    /// Removes all child Transforms from a parent Transform and replaces them with the new child
2098    /// transforms in `new_child_transform_ids`.
2099    pub fn r#replace_children(
2100        &self,
2101        mut parent_transform_id: &TransformId,
2102        mut new_child_transform_ids: &[TransformId],
2103    ) -> Result<(), fidl::Error> {
2104        self.client.send::<FlatlandReplaceChildrenRequest>(
2105            (parent_transform_id, new_child_transform_ids),
2106            0x5b6d86cbbff81316,
2107            fidl::encoding::DynamicFlags::empty(),
2108        )
2109    }
2110
2111    /// Sets the Root Transform for the graph.
2112    ///
2113    /// The sub-graph defined by the Root Transform and its children will be rendered as View
2114    /// in the connected parent's Viewport (see [`CreateView`]). Any parents of the Root Transform
2115    /// in this Graph will be ignored.
2116    ///
2117    /// The Root Transform, and all children of the Root Transform, are kept alive if they are
2118    /// released (see [`ReleaseTransform`] for more details).
2119    ///
2120    /// There is only ever one Root. Since 0 is not a valid transform id (see [`CreateTransform`]),
2121    /// calling SetRootTransform(0) clears the current Root, destroying any previously released
2122    /// objects that are not referenced by the new root.
2123    ///
2124    /// Note that every View has a clip boundary equivalent to its logical size. Anything outside
2125    /// that clip boundary will not be rendered. Hence, the Root Transform has a useful coordinate
2126    /// space of (0, 0) to (logical_size.width, logical_size.height), where (0, 0) is the upper left
2127    /// corner.
2128    ///
2129    /// Setting the root transform installs a full screen hit region on the root transform. Clients
2130    /// may remove this hit region if they don't want users to be able to interact with the root
2131    /// transform's content. For additional details on hit regions, see the [`SetHitRegions`]
2132    /// documentation.
2133    ///
2134    /// Default hit region rules
2135    ///
2136    ///   A default hit region follows these rules:
2137    ///   - When [`SetRootTransform`](T) is called, T receives a maximal hit region, covering the
2138    ///   entire view.
2139    ///   - If [`SetHitRegions`] is called on T, either before or after [`SetRootTransform`](T),
2140    ///   then no default hit region is active and the client specified hit regions are used.
2141    ///   - If a transform is no longer the root transform, i.e., [`SetRootTransform`](U) is
2142    ///   called, then the original transform no longer has its default hit region.
2143    ///   - Clients can remove or modify the root transform's hit regions the same way they would
2144    ///   reset any other transform's hit regions, by calling [`SetHitRegions`] with the appropriate
2145    ///   vector.
2146    pub fn r#set_root_transform(&self, mut transform_id: &TransformId) -> Result<(), fidl::Error> {
2147        self.client.send::<FlatlandSetRootTransformRequest>(
2148            (transform_id,),
2149            0x6e80ca5bcc566cd8,
2150            fidl::encoding::DynamicFlags::empty(),
2151        )
2152    }
2153
2154    /// Sets the interactive areas for a Transform. By default, Content is not interactive; hit
2155    /// regions must be placed for a user to interact with the Content in a View. Because hit
2156    /// regions are described in the Flatland protocol, a Flatland instance can synchronize Content
2157    /// and hit regions.
2158    ///
2159    /// Each hit region is placed in the coordinate space of the owning Transform, and may or may
2160    /// not interact with different types of hit testing, depending on its [`HitTestInteraction`]
2161    /// type. When there are multiple hit regions that intersect with a hit test, the precedence
2162    /// rules given below dictate which hit region has interacted with the hit test. Only Transforms
2163    /// that transitively connect to the root Transform have their hit regions interact with a hit
2164    /// test.
2165    ///
2166    /// Calling this function replaces any previous values set on this Transform. To reset a
2167    /// Transform to "no hit testing": send an empty vector with [`SetHitRegions`].
2168    ///
2169    /// Note that root transforms get a default hit region installed by Flatland. For more details,
2170    /// see the [`SetRootTransform`] documentation.
2171    ///
2172    /// Precedence rules
2173    ///   Within a Transform, if multiple hit regions overlap, the hit test examines each
2174    ///   intersecting hit region for a possible interaction. Thus, for a regular hit test R and an
2175    ///   accessibility hit test A, where R and A both intersect two hit regions D ([`DEFAULT`]) and
2176    ///   S ([`SEMANTICALLY_INVISIBLE`]) on the same Transform, (1) R interacts with both D and S,
2177    ///   and (2) A only interacts with D. Generally, hit regions that overlap in a single Transform
2178    ///   can cause confusing behavior.
2179    ///
2180    ///   Within a View, for a given hit test, the front-most Transform's hit regions take
2181    ///   precedence over those behind. This follows the expected reverse "render order" of
2182    ///   Transforms (described in [`CreateTransform`]), where a user expects to interact with
2183    ///   Content that is visible, or front-most.
2184    ///
2185    ///   Across Flatland instances, for a given hit test, the front-most instance's front-most
2186    ///   Transform's hit regions take precedence over those behind. This follows the expected
2187    ///   reverse "render order" of views, where a user expects to interact with the View that is
2188    ///   visible, or front-most. For example, if a child View owns Content that is rendered over
2189    ///   the parent View, the user expects to interact with the child's Content.
2190    pub fn r#set_hit_regions(
2191        &self,
2192        mut transform_id: &TransformId,
2193        mut regions: &[HitRegion],
2194    ) -> Result<(), fidl::Error> {
2195        self.client.send::<FlatlandSetHitRegionsRequest>(
2196            (transform_id, regions),
2197            0x31c9d17b07c37ce4,
2198            fidl::encoding::DynamicFlags::empty(),
2199        )
2200    }
2201
2202    /// Identical to [`SetHitRegions`], except the hit region associated with [`transform_id`]
2203    /// covers an infinite region. The hit region is invariant against translation, scaling, and
2204    /// orientation of the Transform.
2205    ///
2206    /// An infinite hit region is still limited in extent by the View's clip boundary, just like a
2207    /// finite hit region.
2208    ///
2209    /// Calling this function replaces any previous values set on this Transform. To reset a
2210    /// Transform to "no hit testing": send an empty vector with [`SetHitRegions`].
2211    pub fn r#set_infinite_hit_region(
2212        &self,
2213        mut transform_id: &TransformId,
2214        mut hit_test: HitTestInteraction,
2215    ) -> Result<(), fidl::Error> {
2216        self.client.send::<FlatlandSetInfiniteHitRegionRequest>(
2217            (transform_id, hit_test),
2218            0x26d81af852d29562,
2219            fidl::encoding::DynamicFlags::empty(),
2220        )
2221    }
2222
2223    /// The Viewport and View pair, together, represent the connection between two Flatland
2224    /// instances. The Viewport is created in the parent, and the View is created in the child. The
2225    /// parent has control over how the child's View is integrated into its own View.
2226    ///
2227    /// Any illegal operations on ChildViewWatcher will cause both ChildViewWatcher channel and this
2228    /// Flatland channel to be torn down.
2229    ///
2230    /// `ViewportProperties` must have logical_size set. This is the initial size that will drive
2231    /// the layout of the child. The logical_size is also used as the default Content size, but
2232    /// subsequent changes to the logical_size will have no effect on the Content size.
2233    ///
2234    /// `ViewportProperties` may have inset field not set. In that case, the default value of
2235    /// (0, 0, 0, 0) is used.
2236    ///
2237    /// The logical_size must have positive X and Y components.
2238    ///
2239    /// Zero is not a valid ContentId. All other values are valid, assuming they are not already
2240    /// in use for another piece of Content (see [`ReleaseViewport`] for more details).
2241    ///
2242    /// Lifecycle note. The lifetime of the ChildViewWatcher channel is bound by the peer
2243    /// ViewCreationToken. When the ViewCreationToken dies, this ChildViewWatcher channel is
2244    /// destroyed.
2245    pub fn r#create_viewport(
2246        &self,
2247        mut viewport_id: &ContentId,
2248        mut token: fidl_fuchsia_ui_views::ViewportCreationToken,
2249        mut properties: &ViewportProperties,
2250        mut child_view_watcher: fidl::endpoints::ServerEnd<ChildViewWatcherMarker>,
2251    ) -> Result<(), fidl::Error> {
2252        self.client.send::<FlatlandCreateViewportRequest>(
2253            (viewport_id, &mut token, properties, child_view_watcher),
2254            0x2485fbcab7f943c,
2255            fidl::encoding::DynamicFlags::empty(),
2256        )
2257    }
2258
2259    /// An Image is a bitmap backed by a specific VMO in a BufferCollection.
2260    ///
2261    /// Image creation requires an allocated BufferCollection registered with Allocator. This
2262    /// function will fail unless all clients of the specified BufferCollection have set their
2263    /// constraints.
2264    ///
2265    /// The Image must reference a valid VMO index and must have ImageProperties that fall within
2266    /// the constraints specified by the backing BufferCollection (i.e. width and height within a
2267    /// valid range, etc.)
2268    ///
2269    /// Zero is not a valid Image id. All other values are valid, assuming they are not already in
2270    /// use for another piece of Content (see [`ReleaseImage`] for more details).
2271    pub fn r#create_image(
2272        &self,
2273        mut image_id: &ContentId,
2274        mut import_token: BufferCollectionImportToken,
2275        mut vmo_index: u32,
2276        mut properties: &ImageProperties,
2277    ) -> Result<(), fidl::Error> {
2278        self.client.send::<FlatlandCreateImageRequest>(
2279            (image_id, &mut import_token, vmo_index, properties),
2280            0x26fae823c4ebedad,
2281            fidl::encoding::DynamicFlags::empty(),
2282        )
2283    }
2284
2285    /// This function is used to determine the region (in texel space) of an image that will be used
2286    /// by Flatland when rendering. The image to be sampled is referenced by [`image_id`] and the
2287    /// sample region is specified by [`rect`] which itself is comprised of an origin point (x,y) as
2288    /// well as a width and height, in unnormalized coordinates. It is illegal to call this function
2289    /// on non-image content, or to sample a region outside of the texel space of the image. In
2290    /// other words, the region specifed by [`rect`] must not exceed the ranges (0, image_width) and
2291    /// (0, image_height). If (rect.x + rect.width > image_width) or (rect.y + rect.height >
2292    /// image_height) or if any of the values are negative, this will result in an error.
2293    ///
2294    /// If this method is not called, the default sample region is the rectangle with origin at
2295    /// (0, 0) and width and height set at ImageProperties from [`CreateImage`].
2296    pub fn r#set_image_sample_region(
2297        &self,
2298        mut image_id: &ContentId,
2299        mut rect: &fidl_fuchsia_math::RectF,
2300    ) -> Result<(), fidl::Error> {
2301        self.client.send::<FlatlandSetImageSampleRegionRequest>(
2302            (image_id, rect),
2303            0x8039391d715eb28,
2304            fidl::encoding::DynamicFlags::empty(),
2305        )
2306    }
2307
2308    /// The content size for an Image is the size of the rectangle in the parent's logical
2309    /// coordinate space that the image occupies. This combined with the global translation of the
2310    /// transform it is attached to determines the size and location of where the content is
2311    /// rendered on the display.
2312    ///
2313    /// If this method is not called, the default image destination size is the width and height set
2314    /// at ImageProperties from [`CreateImage`]. The destination size will be affected by scaling if
2315    /// [`SetScale`] is used on the attached Transform or its parents.
2316    pub fn r#set_image_destination_size(
2317        &self,
2318        mut image_id: &ContentId,
2319        mut size: &fidl_fuchsia_math::SizeU,
2320    ) -> Result<(), fidl::Error> {
2321        self.client.send::<FlatlandSetImageDestinationSizeRequest>(
2322            (image_id, size),
2323            0x766cf99a2ec58446,
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 BlendMode enum. If this function is not called, then
2332    /// the default blendmode is BlendMode::SRC.
2333    pub fn r#set_image_blending_function(
2334        &self,
2335        mut image_id: &ContentId,
2336        mut blend_mode: BlendMode,
2337    ) -> Result<(), fidl::Error> {
2338        self.client.send::<FlatlandSetImageBlendingFunctionRequest>(
2339            (image_id, blend_mode),
2340            0x10f5da1356275b7b,
2341            fidl::encoding::DynamicFlags::empty(),
2342        )
2343    }
2344
2345    /// Determines the blend function to use when rendering the content specified by
2346    /// |image_id|. |image_id| must be a valid ContentId associated to a transform through
2347    /// a call to |CreateImage| or |CreateFilledRect|. For details on the different blend functions
2348    /// that are available, please refer to the BlendMode2 enum. If this function is not called,
2349    /// the default blendmode is BlendMode2::REPLACE.
2350    pub fn r#set_image_blend_mode(
2351        &self,
2352        mut image_id: &ContentId,
2353        mut blend_mode: BlendMode2,
2354    ) -> Result<(), fidl::Error> {
2355        self.client.send::<FlatlandSetImageBlendModeRequest>(
2356            (image_id, blend_mode),
2357            0x5b1667f130c3de67,
2358            fidl::encoding::DynamicFlags::empty(),
2359        )
2360    }
2361
2362    /// Sets an opacity in linear space to be applied to a flatland image. Opacity values must
2363    /// be in the range [0.0, 1.0].
2364    pub fn r#set_image_opacity(
2365        &self,
2366        mut image_id: &ContentId,
2367        mut val: f32,
2368    ) -> Result<(), fidl::Error> {
2369        self.client.send::<FlatlandSetImageOpacityRequest>(
2370            (image_id, val),
2371            0x2da9e4ef4c2cff6f,
2372            fidl::encoding::DynamicFlags::empty(),
2373        )
2374    }
2375
2376    /// Sets the image flip to be applied to a flatland image. This call must be performed after a
2377    /// successful |CreateImage| call. If an invalid |image_id| is supplied, the channel will be
2378    /// closed due to FlatlandError::BAD_OPERATION. This flip will be applied to the Image before
2379    /// parent Transform Orientations. If this function is not called, then the default flip value
2380    /// is ImageFlip::NONE.
2381    pub fn r#set_image_flip(
2382        &self,
2383        mut image_id: &ContentId,
2384        mut flip: ImageFlip,
2385    ) -> Result<(), fidl::Error> {
2386        self.client.send::<FlatlandSetImageFlipRequest>(
2387            (image_id, flip),
2388            0x21b20f2c14aae6bc,
2389            fidl::encoding::DynamicFlags::empty(),
2390        )
2391    }
2392
2393    /// Creates a solid-color rectangle. By default a filled-rect does not have a defined
2394    /// color or size. It is necessary to call |SetSolidFill| to specify a color and size
2395    /// before a filled rect can be used for rendering. Not doing so will result the
2396    pub fn r#create_filled_rect(&self, mut rect_id: &ContentId) -> Result<(), fidl::Error> {
2397        self.client.send::<FlatlandCreateFilledRectRequest>(
2398            (rect_id,),
2399            0x5e62355abc1c4c5d,
2400            fidl::encoding::DynamicFlags::empty(),
2401        )
2402    }
2403
2404    /// Defines the color and size of a filled rect. |rect_id| must refer to content that
2405    /// was created via a call to CreateFilledRect. The color is not premultiplied. Color values
2406    /// must be within the range [0,1] inclusive, and normal 32-bit
2407    /// floating point values: https://en.wikipedia.org/wiki/Normal_number_%28computing%29. Values
2408    /// that do not conform to these specifications will cause the channel to close.
2409    /// The rectangle's top left corner will be at (0, 0) in its transform's coordinate space.
2410    /// Hence, its bottom right corner will be at (size.width, size.height).
2411    pub fn r#set_solid_fill(
2412        &self,
2413        mut rect_id: &ContentId,
2414        mut color: &ColorRgba,
2415        mut size: &fidl_fuchsia_math::SizeU,
2416    ) -> Result<(), fidl::Error> {
2417        self.client.send::<FlatlandSetSolidFillRequest>(
2418            (rect_id, color, size),
2419            0x32d6ef41e182dfa5,
2420            fidl::encoding::DynamicFlags::empty(),
2421        )
2422    }
2423
2424    /// Automatically garbage collects the rectangle when it is no longer needed for
2425    /// rendering. |rect_id| must have been instantiated with a call to
2426    /// |CreateFilledRect|. Once released, the ID immediately goes out of scope and is free
2427    /// to be used again.
2428    pub fn r#release_filled_rect(&self, mut rect_id: &ContentId) -> Result<(), fidl::Error> {
2429        self.client.send::<FlatlandReleaseFilledRectRequest>(
2430            (rect_id,),
2431            0x7392cabe45618f9b,
2432            fidl::encoding::DynamicFlags::empty(),
2433        )
2434    }
2435
2436    /// Setting a piece of Content on a Transform makes that Content visible in the render tree as
2437    /// long as the Transform is visible from the root Transform. The Content will be rendered
2438    /// before, and therefore "behind", any Content attached to the descendants of the Transform.
2439    ///
2440    /// Because each Transform can have, at most, a single piece of Content on it, calling this
2441    /// function on a Transform that already has Content will replace that Content.
2442    ///
2443    /// A Content may be set on more than one Transform.
2444    ///
2445    /// Calling this function with a Content id of 0 will remove any Content currently on the
2446    /// Transform.
2447    pub fn r#set_content(
2448        &self,
2449        mut transform_id: &TransformId,
2450        mut content_id: &ContentId,
2451    ) -> Result<(), fidl::Error> {
2452        self.client.send::<FlatlandSetContentRequest>(
2453            (transform_id, content_id),
2454            0x4ed2cfc0ce130862,
2455            fidl::encoding::DynamicFlags::empty(),
2456        )
2457    }
2458
2459    /// Transforms are usually sufficient to change how Content is presented. Viewports, however,
2460    /// have special properties that are not part of the Transform hierarchy. Those properties can
2461    /// be set using this function.
2462    pub fn r#set_viewport_properties(
2463        &self,
2464        mut viewport_id: &ContentId,
2465        mut properties: &ViewportProperties,
2466    ) -> Result<(), fidl::Error> {
2467        self.client.send::<FlatlandSetViewportPropertiesRequest>(
2468            (viewport_id, properties),
2469            0x66ab67e9608ddb9f,
2470            fidl::encoding::DynamicFlags::empty(),
2471        )
2472    }
2473
2474    /// Released Transforms will be garbage collected by the system once they are no longer
2475    /// necessary for rendering. For Transforms, this means there is no path from any unreleased
2476    /// Transform to the newly-released Transform.
2477    ///
2478    /// Once released, the id immediately goes out of scope for future function calls and can be
2479    /// reused when creating new Transforms.
2480    ///
2481    /// It is an error to call functions with a released id (unless that id has been reused to
2482    /// construct a new Transform).
2483    pub fn r#release_transform(&self, mut transform_id: &TransformId) -> Result<(), fidl::Error> {
2484        self.client.send::<FlatlandReleaseTransformRequest>(
2485            (transform_id,),
2486            0xab9328419451c22,
2487            fidl::encoding::DynamicFlags::empty(),
2488        )
2489    }
2490
2491    pub fn r#release_view(&self) -> Result<(), fidl::Error> {
2492        self.client.send::<fidl::encoding::EmptyPayload>(
2493            (),
2494            0x5b35aab9baffecae,
2495            fidl::encoding::DynamicFlags::empty(),
2496        )
2497    }
2498
2499    /// Releases a Viewport from the scene, even if the Viewport is still connected to a Transform.
2500    /// Unlike other resources, Viewports are garbage collected by the system during the next
2501    /// [`Present`] because a removed Viewport is guaranteed to provide no renderable content.
2502    ///
2503    /// Use SetContent(transform_id, 0) to clean up references to released Viewports.
2504    ///
2505    /// Despite having a return type, this function is still feed-forward like [`CreateView`] and
2506    /// requires a call to [`Present`] to be executed. The ViewportCreationToken will be returned
2507    /// after the presented operations have been executed.
2508    pub fn r#release_viewport(
2509        &self,
2510        mut viewport_id: &ContentId,
2511        ___deadline: zx::MonotonicInstant,
2512    ) -> Result<fidl_fuchsia_ui_views::ViewportCreationToken, fidl::Error> {
2513        let _response = self
2514            .client
2515            .send_query::<FlatlandReleaseViewportRequest, FlatlandReleaseViewportResponse>(
2516                (viewport_id,),
2517                0xbad474aeb5293f9,
2518                fidl::encoding::DynamicFlags::empty(),
2519                ___deadline,
2520            )?;
2521        Ok(_response.token)
2522    }
2523
2524    /// Released Images will be garbage collected by the system once they are no longer necessary
2525    /// for rendering. For Images, this means the Image is no longer attached to any Transform and
2526    /// any pending rendering that references the Image is complete.
2527    ///
2528    /// Use SetContent(transform_id, 0) to clean up references to released Images.
2529    ///
2530    /// Once released, the id immediately goes out of scope for future function calls and can be
2531    /// reused when creating new Images.
2532    ///
2533    /// It is an error to call functions with a released id (unless that id has been reused to
2534    /// construct a new Image).
2535    pub fn r#release_image(&self, mut image_id: &ContentId) -> Result<(), fidl::Error> {
2536        self.client.send::<FlatlandReleaseImageRequest>(
2537            (image_id,),
2538            0xb884ffdbc72c111,
2539            fidl::encoding::DynamicFlags::empty(),
2540        )
2541    }
2542
2543    /// This function will reset all state on this interface. This includes destroying all existing
2544    /// View and Viewports without returning the associated Token to the caller.
2545    pub fn r#clear(&self) -> Result<(), fidl::Error> {
2546        self.client.send::<fidl::encoding::EmptyPayload>(
2547            (),
2548            0x4ec8817c02828c3e,
2549            fidl::encoding::DynamicFlags::empty(),
2550        )
2551    }
2552
2553    /// Set debug name of the current client that can be used by Flatland to print as a prefix to
2554    /// logs to help client distinguish what is theirs. [`name`] can be an arbitrary string, but the
2555    /// current process name (see fsl::GetCurrentProcessName()) is a good default.
2556    pub fn r#set_debug_name(&self, mut name: &str) -> Result<(), fidl::Error> {
2557        self.client.send::<FlatlandSetDebugNameRequest>(
2558            (name,),
2559            0x46a8b397e68a8888,
2560            fidl::encoding::DynamicFlags::empty(),
2561        )
2562    }
2563}
2564
2565#[cfg(target_os = "fuchsia")]
2566impl From<FlatlandSynchronousProxy> for zx::NullableHandle {
2567    fn from(value: FlatlandSynchronousProxy) -> Self {
2568        value.into_channel().into()
2569    }
2570}
2571
2572#[cfg(target_os = "fuchsia")]
2573impl From<fidl::Channel> for FlatlandSynchronousProxy {
2574    fn from(value: fidl::Channel) -> Self {
2575        Self::new(value)
2576    }
2577}
2578
2579#[cfg(target_os = "fuchsia")]
2580impl fidl::endpoints::FromClient for FlatlandSynchronousProxy {
2581    type Protocol = FlatlandMarker;
2582
2583    fn from_client(value: fidl::endpoints::ClientEnd<FlatlandMarker>) -> Self {
2584        Self::new(value.into_channel())
2585    }
2586}
2587
2588#[derive(Debug, Clone)]
2589pub struct FlatlandProxy {
2590    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2591}
2592
2593impl fidl::endpoints::Proxy for FlatlandProxy {
2594    type Protocol = FlatlandMarker;
2595
2596    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2597        Self::new(inner)
2598    }
2599
2600    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2601        self.client.into_channel().map_err(|client| Self { client })
2602    }
2603
2604    fn as_channel(&self) -> &::fidl::AsyncChannel {
2605        self.client.as_channel()
2606    }
2607}
2608
2609impl FlatlandProxy {
2610    /// Create a new Proxy for fuchsia.ui.composition/Flatland.
2611    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2612        let protocol_name = <FlatlandMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2613        Self { client: fidl::client::Client::new(channel, protocol_name) }
2614    }
2615
2616    /// Get a Stream of events from the remote end of the protocol.
2617    ///
2618    /// # Panics
2619    ///
2620    /// Panics if the event stream was already taken.
2621    pub fn take_event_stream(&self) -> FlatlandEventStream {
2622        FlatlandEventStream { event_receiver: self.client.take_event_receiver() }
2623    }
2624
2625    /// Releases an image immediately, without waiting for the next present.
2626    pub fn r#release_image_immediately(&self, mut image_id: &ContentId) -> Result<(), fidl::Error> {
2627        FlatlandProxyInterface::r#release_image_immediately(self, image_id)
2628    }
2629
2630    /// Complete execution of all feed-forward operations.
2631    ///
2632    /// If executing an operation produces an error (e.g., CreateTransform(0)), an [`OnError`] event
2633    /// is emitted. Operations that produce errors are ignored and the channel is closed.
2634    ///
2635    /// If the execution is completed successfully, [`OnNextFrameBegin`] emits NO_ERROR along
2636    /// with other valid fields.
2637    ///
2638    /// The client may only call [`Present`] when they have a non-zero number of present credits,
2639    /// which are tracked by the server. The server may increment the number of credits when it
2640    /// fires the [`OnNextFrameBegin`] event, which informs the client when it receives additional
2641    /// present credits. Each [`Present`] call uses one present credit and decrements the server
2642    /// count by one. If the client calls [`Present`] with no present credits, the server will
2643    /// return a `NO_PRESENTS_REMAINING` error.
2644    ///
2645    /// The client should assume that prior to receiving any [`OnNextFrameBegin`] events, they have
2646    /// one present credit.
2647    ///
2648    /// Every [`Present`] call results in one [`OnNextFrameBegin`] event, and one
2649    /// [`OnFramePresented`] event, typically in that order.
2650    ///
2651    /// When the commands flushed by [`Present`] make it to display, an [`OnFramePresented`] event
2652    /// is fired. This event includes information pertaining to all [`Present`]s that had content
2653    /// that were part of that frame.
2654    ///
2655    /// See [`fuchsia.ui.composition/PresentArgs`] documentation above for more detailed information
2656    /// on what arguments are passed in and their role.
2657    pub fn r#present(&self, mut args: PresentArgs) -> Result<(), fidl::Error> {
2658        FlatlandProxyInterface::r#present(self, args)
2659    }
2660
2661    /// Two Flatland instances may be connected in a parent-child relationship. The parent endpoint
2662    /// is held in a Viewport, and the child endpoint is held in a View. The parent Flatland
2663    /// instance that creates a Viewport has control over how the child's View is integrated into
2664    /// its own View.
2665    ///
2666    /// The lifecycle of a parent-child connection starts with two endpoints of a channel object:
2667    /// a ViewportCreationToken and a ViewCreationToken. Out-of-band protocols pass the
2668    /// ViewportCreationToken to the parent, which calls [`CreateViewport`], and the
2669    /// ViewCreationToken to the child, which calls [`CreateView`].
2670    ///
2671    /// Only nodes connected to the Root Transform in this Flatland instance will be rendered into
2672    /// the parent's Viewport.
2673    ///
2674    /// Calling [`CreateView`] a second time will disconnect the Root Transform from the existing
2675    /// parent's Viewport, and attach it to a new parent's Viewport. In other words, each View can
2676    /// only have one parent.
2677    ///
2678    /// This function is queued, meaning that the Root Transform will not be attached to the
2679    /// parent Viewport until [`Present`] is called. However, clients will receive information
2680    /// through their ParentViewportWatcher (e.g., LayoutInfo) immediately after calling this
2681    /// function, even if they have not called [`Present`] or [`SetRootTransform`]. This allows
2682    /// clients to wait for layout information from their parent before calling [`Present`].
2683    ///
2684    /// Any illegal operations on ParentViewportWatcher will cause both ParentViewportWatcher
2685    /// channel and this Flatland channel to be torn down.
2686    ///
2687    /// Lifecycle note. The lifetime of the ParentViewportWatcher channel is bound by the peer
2688    /// ViewportCreationToken. When the ViewportCreationToken dies, this ParentViewportWatcher
2689    /// channel is destroyed.
2690    ///
2691    /// Views and subgraphs of Views created using `CreateView` will not be represented in the
2692    /// ViewTree, and hence will not be able to participate in any ViewTree-dependent interactions
2693    /// such as touch, mouse or focus.
2694    /// The Flatland protocol provides no way for Views in the subgraph of a View created with
2695    /// `CreateView` to know that they are excluded from the ViewTree.
2696    pub fn r#create_view(
2697        &self,
2698        mut token: fidl_fuchsia_ui_views::ViewCreationToken,
2699        mut parent_viewport_watcher: fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>,
2700    ) -> Result<(), fidl::Error> {
2701        FlatlandProxyInterface::r#create_view(self, token, parent_viewport_watcher)
2702    }
2703
2704    /// Identical to [`CreateView`], except it allows association of View identity (ViewRef) and
2705    /// view-bound protocols.
2706    pub fn r#create_view2(
2707        &self,
2708        mut token: fidl_fuchsia_ui_views::ViewCreationToken,
2709        mut view_identity: fidl_fuchsia_ui_views::ViewIdentityOnCreation,
2710        mut protocols: ViewBoundProtocols,
2711        mut parent_viewport_watcher: fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>,
2712    ) -> Result<(), fidl::Error> {
2713        FlatlandProxyInterface::r#create_view2(
2714            self,
2715            token,
2716            view_identity,
2717            protocols,
2718            parent_viewport_watcher,
2719        )
2720    }
2721
2722    /// Creates a new Transform node. Transforms are a hierarchical piece of a Flatland graph. They
2723    /// can have children, and can reference Content. A sub-graph represented by a Transform and its
2724    /// descendants can be rendered to a display.
2725    ///
2726    /// Transforms are kept alive, even when released, as long as they are children of either an
2727    /// unreleased Transform, or the Root Transform.
2728    ///
2729    /// Each Transform can have a single piece of attached Content. Common types of Content include
2730    /// bitmaps, asynchronous streams of images, and Viewports to Views hosted in other Flatland
2731    /// instances.
2732    ///
2733    /// Transforms have attributes. Child Transforms inherit the combined attributes of their
2734    /// parents. Content attached to a Transform is also affected by that Transform's attributes.
2735    ///
2736    /// When a sub-graph of Transforms is rendered, Content will be rendered back-to-front, starting
2737    /// with the Content on the root transform, and continuing recursively through all of its child
2738    /// Transforms in the order the children were added. See [`AddChild`] for more information.
2739    ///
2740    /// Zero is not a valid transform id. All other values are valid, assuming they are not already
2741    /// in use (see [`ReleaseTransform`] for more details).
2742    pub fn r#create_transform(&self, mut transform_id: &TransformId) -> Result<(), fidl::Error> {
2743        FlatlandProxyInterface::r#create_transform(self, transform_id)
2744    }
2745
2746    /// All Transform objects support all attributes.
2747    ///
2748    /// Geometric attributes are applied in the following order:
2749    /// 1. Scale (relative to the parent transform's coordinate space)
2750    /// 2. Orientation (relative to the parent transform's coordinate space)
2751    /// 3. Translation (relative to the parent transforms's coordinate space,
2752    ///    unaffected by scale applied to the current transform).
2753    /// 4. Clipping (relative to the current transform's coordinate space)
2754    ///
2755    /// The effects of each of these attributes are cumulative. This means the transform's position
2756    /// in the view space, and its clip boundary, will be calculated based on that chain of
2757    /// geometric attributes going up to the root transform.
2758    ///
2759    /// For instance, in a nested hierarchy such as the following:
2760    ///     [Root-Transform -> Transform1 -> Transform2 -> CurrentTransform]
2761    /// If Transform1 is translated by [2,0] and Transform2 is translated by [0,1] then the
2762    /// view-space position of CurrentTransform will be [2,1].
2763    ///
2764    /// Sets the translation on a Transform. The order of geometric attribute application is
2765    /// addressed above.
2766    pub fn r#set_translation(
2767        &self,
2768        mut transform_id: &TransformId,
2769        mut translation: &fidl_fuchsia_math::Vec_,
2770    ) -> Result<(), fidl::Error> {
2771        FlatlandProxyInterface::r#set_translation(self, transform_id, translation)
2772    }
2773
2774    /// Sets the orientation on a Transform. The order of geometric attribute application is
2775    /// addressed in the documentation for [`SetTranslation`]. In Flatland, the +X axis is
2776    /// to the right and the +Y axis is down. There is no notion of a Z axis. CCW is defined
2777    /// from the POV of the user, as if a skeuomorphoic clock is displayed on the screen.
2778    pub fn r#set_orientation(
2779        &self,
2780        mut transform_id: &TransformId,
2781        mut orientation: Orientation,
2782    ) -> Result<(), fidl::Error> {
2783        FlatlandProxyInterface::r#set_orientation(self, transform_id, orientation)
2784    }
2785
2786    /// Sets the scale on a transform. The order of geometric attribute application is
2787    /// addressed above. The (x,y) values in the VecF |scale| refer to the scale factor in the
2788    /// x-axis (width) and y-axis (height) respectively. Scale values must be normal 32-bit
2789    /// floating point values: https://en.wikipedia.org/wiki/Normal_number_%28computing%29
2790    pub fn r#set_scale(
2791        &self,
2792        mut transform_id: &TransformId,
2793        mut scale: &fidl_fuchsia_math::VecF,
2794    ) -> Result<(), fidl::Error> {
2795        FlatlandProxyInterface::r#set_scale(self, transform_id, scale)
2796    }
2797
2798    /// Sets an opacity in linear space to be applied to a transform and its descendents,
2799    /// which include other transforms and content. Opacity values must be in the range
2800    /// of [0.0, 1.0], where 0.0 is completely transparent and 1.0 is completely opaque.
2801    /// Attempting to call this function with values outside that range will result in
2802    /// an error. A transform's opacity value is multiplied with that of its parent. This
2803    /// effect works differently from group opacity. Using group opacity, child nodes are
2804    /// rendered together first, and then have the parent's opacity applied as a post-effect.
2805    /// Here, opacity is applied to each child individually. This may result in a very
2806    /// different effect.
2807    pub fn r#set_opacity(
2808        &self,
2809        mut transform_id: &TransformId,
2810        mut value: f32,
2811    ) -> Result<(), fidl::Error> {
2812        FlatlandProxyInterface::r#set_opacity(self, transform_id, value)
2813    }
2814
2815    /// Sets the bounds, expressed in the local coordinate space of the transform, that
2816    /// constrains the region that content attached to this transform can be rendered to.
2817    /// If the content's area exceeds the clip bounds, the area outside the bounds will
2818    /// not be rendered. These bounds are valid for all children of this transform node as
2819    /// well, which includes nested Flatland instances and their node hierarchies.
2820    /// If a child transform attempts to set clip bounds larger than that of its parent,
2821    /// it will be clipped to the parent's clip bounds. The default state is for a transform
2822    /// to be unclipped, meaning it will not have any bounds placed on its render region.
2823    /// The clip width/height must be positive. Negative values will result in an error.
2824    /// Passing in an empty box to the |rect| parameter will remove the clip bounds.
2825    pub fn r#set_clip_boundary(
2826        &self,
2827        mut transform_id: &TransformId,
2828        mut rect: Option<&fidl_fuchsia_math::Rect>,
2829    ) -> Result<(), fidl::Error> {
2830        FlatlandProxyInterface::r#set_clip_boundary(self, transform_id, rect)
2831    }
2832
2833    /// Adds a child Transform to a parent Transform. The new child Transform, and any Content
2834    /// attached to it or its children, will be rendered on top of the parent's Content, as well as
2835    /// any previously added children.
2836    pub fn r#add_child(
2837        &self,
2838        mut parent_transform_id: &TransformId,
2839        mut child_transform_id: &TransformId,
2840    ) -> Result<(), fidl::Error> {
2841        FlatlandProxyInterface::r#add_child(self, parent_transform_id, child_transform_id)
2842    }
2843
2844    /// Removes a child Transform from a parent Transform.
2845    pub fn r#remove_child(
2846        &self,
2847        mut parent_transform_id: &TransformId,
2848        mut child_transform_id: &TransformId,
2849    ) -> Result<(), fidl::Error> {
2850        FlatlandProxyInterface::r#remove_child(self, parent_transform_id, child_transform_id)
2851    }
2852
2853    /// Removes all child Transforms from a parent Transform and replaces them with the new child
2854    /// transforms in `new_child_transform_ids`.
2855    pub fn r#replace_children(
2856        &self,
2857        mut parent_transform_id: &TransformId,
2858        mut new_child_transform_ids: &[TransformId],
2859    ) -> Result<(), fidl::Error> {
2860        FlatlandProxyInterface::r#replace_children(
2861            self,
2862            parent_transform_id,
2863            new_child_transform_ids,
2864        )
2865    }
2866
2867    /// Sets the Root Transform for the graph.
2868    ///
2869    /// The sub-graph defined by the Root Transform and its children will be rendered as View
2870    /// in the connected parent's Viewport (see [`CreateView`]). Any parents of the Root Transform
2871    /// in this Graph will be ignored.
2872    ///
2873    /// The Root Transform, and all children of the Root Transform, are kept alive if they are
2874    /// released (see [`ReleaseTransform`] for more details).
2875    ///
2876    /// There is only ever one Root. Since 0 is not a valid transform id (see [`CreateTransform`]),
2877    /// calling SetRootTransform(0) clears the current Root, destroying any previously released
2878    /// objects that are not referenced by the new root.
2879    ///
2880    /// Note that every View has a clip boundary equivalent to its logical size. Anything outside
2881    /// that clip boundary will not be rendered. Hence, the Root Transform has a useful coordinate
2882    /// space of (0, 0) to (logical_size.width, logical_size.height), where (0, 0) is the upper left
2883    /// corner.
2884    ///
2885    /// Setting the root transform installs a full screen hit region on the root transform. Clients
2886    /// may remove this hit region if they don't want users to be able to interact with the root
2887    /// transform's content. For additional details on hit regions, see the [`SetHitRegions`]
2888    /// documentation.
2889    ///
2890    /// Default hit region rules
2891    ///
2892    ///   A default hit region follows these rules:
2893    ///   - When [`SetRootTransform`](T) is called, T receives a maximal hit region, covering the
2894    ///   entire view.
2895    ///   - If [`SetHitRegions`] is called on T, either before or after [`SetRootTransform`](T),
2896    ///   then no default hit region is active and the client specified hit regions are used.
2897    ///   - If a transform is no longer the root transform, i.e., [`SetRootTransform`](U) is
2898    ///   called, then the original transform no longer has its default hit region.
2899    ///   - Clients can remove or modify the root transform's hit regions the same way they would
2900    ///   reset any other transform's hit regions, by calling [`SetHitRegions`] with the appropriate
2901    ///   vector.
2902    pub fn r#set_root_transform(&self, mut transform_id: &TransformId) -> Result<(), fidl::Error> {
2903        FlatlandProxyInterface::r#set_root_transform(self, transform_id)
2904    }
2905
2906    /// Sets the interactive areas for a Transform. By default, Content is not interactive; hit
2907    /// regions must be placed for a user to interact with the Content in a View. Because hit
2908    /// regions are described in the Flatland protocol, a Flatland instance can synchronize Content
2909    /// and hit regions.
2910    ///
2911    /// Each hit region is placed in the coordinate space of the owning Transform, and may or may
2912    /// not interact with different types of hit testing, depending on its [`HitTestInteraction`]
2913    /// type. When there are multiple hit regions that intersect with a hit test, the precedence
2914    /// rules given below dictate which hit region has interacted with the hit test. Only Transforms
2915    /// that transitively connect to the root Transform have their hit regions interact with a hit
2916    /// test.
2917    ///
2918    /// Calling this function replaces any previous values set on this Transform. To reset a
2919    /// Transform to "no hit testing": send an empty vector with [`SetHitRegions`].
2920    ///
2921    /// Note that root transforms get a default hit region installed by Flatland. For more details,
2922    /// see the [`SetRootTransform`] documentation.
2923    ///
2924    /// Precedence rules
2925    ///   Within a Transform, if multiple hit regions overlap, the hit test examines each
2926    ///   intersecting hit region for a possible interaction. Thus, for a regular hit test R and an
2927    ///   accessibility hit test A, where R and A both intersect two hit regions D ([`DEFAULT`]) and
2928    ///   S ([`SEMANTICALLY_INVISIBLE`]) on the same Transform, (1) R interacts with both D and S,
2929    ///   and (2) A only interacts with D. Generally, hit regions that overlap in a single Transform
2930    ///   can cause confusing behavior.
2931    ///
2932    ///   Within a View, for a given hit test, the front-most Transform's hit regions take
2933    ///   precedence over those behind. This follows the expected reverse "render order" of
2934    ///   Transforms (described in [`CreateTransform`]), where a user expects to interact with
2935    ///   Content that is visible, or front-most.
2936    ///
2937    ///   Across Flatland instances, for a given hit test, the front-most instance's front-most
2938    ///   Transform's hit regions take precedence over those behind. This follows the expected
2939    ///   reverse "render order" of views, where a user expects to interact with the View that is
2940    ///   visible, or front-most. For example, if a child View owns Content that is rendered over
2941    ///   the parent View, the user expects to interact with the child's Content.
2942    pub fn r#set_hit_regions(
2943        &self,
2944        mut transform_id: &TransformId,
2945        mut regions: &[HitRegion],
2946    ) -> Result<(), fidl::Error> {
2947        FlatlandProxyInterface::r#set_hit_regions(self, transform_id, regions)
2948    }
2949
2950    /// Identical to [`SetHitRegions`], except the hit region associated with [`transform_id`]
2951    /// covers an infinite region. The hit region is invariant against translation, scaling, and
2952    /// orientation of the Transform.
2953    ///
2954    /// An infinite hit region is still limited in extent by the View's clip boundary, just like a
2955    /// finite hit region.
2956    ///
2957    /// Calling this function replaces any previous values set on this Transform. To reset a
2958    /// Transform to "no hit testing": send an empty vector with [`SetHitRegions`].
2959    pub fn r#set_infinite_hit_region(
2960        &self,
2961        mut transform_id: &TransformId,
2962        mut hit_test: HitTestInteraction,
2963    ) -> Result<(), fidl::Error> {
2964        FlatlandProxyInterface::r#set_infinite_hit_region(self, transform_id, hit_test)
2965    }
2966
2967    /// The Viewport and View pair, together, represent the connection between two Flatland
2968    /// instances. The Viewport is created in the parent, and the View is created in the child. The
2969    /// parent has control over how the child's View is integrated into its own View.
2970    ///
2971    /// Any illegal operations on ChildViewWatcher will cause both ChildViewWatcher channel and this
2972    /// Flatland channel to be torn down.
2973    ///
2974    /// `ViewportProperties` must have logical_size set. This is the initial size that will drive
2975    /// the layout of the child. The logical_size is also used as the default Content size, but
2976    /// subsequent changes to the logical_size will have no effect on the Content size.
2977    ///
2978    /// `ViewportProperties` may have inset field not set. In that case, the default value of
2979    /// (0, 0, 0, 0) is used.
2980    ///
2981    /// The logical_size must have positive X and Y components.
2982    ///
2983    /// Zero is not a valid ContentId. All other values are valid, assuming they are not already
2984    /// in use for another piece of Content (see [`ReleaseViewport`] for more details).
2985    ///
2986    /// Lifecycle note. The lifetime of the ChildViewWatcher channel is bound by the peer
2987    /// ViewCreationToken. When the ViewCreationToken dies, this ChildViewWatcher channel is
2988    /// destroyed.
2989    pub fn r#create_viewport(
2990        &self,
2991        mut viewport_id: &ContentId,
2992        mut token: fidl_fuchsia_ui_views::ViewportCreationToken,
2993        mut properties: &ViewportProperties,
2994        mut child_view_watcher: fidl::endpoints::ServerEnd<ChildViewWatcherMarker>,
2995    ) -> Result<(), fidl::Error> {
2996        FlatlandProxyInterface::r#create_viewport(
2997            self,
2998            viewport_id,
2999            token,
3000            properties,
3001            child_view_watcher,
3002        )
3003    }
3004
3005    /// An Image is a bitmap backed by a specific VMO in a BufferCollection.
3006    ///
3007    /// Image creation requires an allocated BufferCollection registered with Allocator. This
3008    /// function will fail unless all clients of the specified BufferCollection have set their
3009    /// constraints.
3010    ///
3011    /// The Image must reference a valid VMO index and must have ImageProperties that fall within
3012    /// the constraints specified by the backing BufferCollection (i.e. width and height within a
3013    /// valid range, etc.)
3014    ///
3015    /// Zero is not a valid Image id. All other values are valid, assuming they are not already in
3016    /// use for another piece of Content (see [`ReleaseImage`] for more details).
3017    pub fn r#create_image(
3018        &self,
3019        mut image_id: &ContentId,
3020        mut import_token: BufferCollectionImportToken,
3021        mut vmo_index: u32,
3022        mut properties: &ImageProperties,
3023    ) -> Result<(), fidl::Error> {
3024        FlatlandProxyInterface::r#create_image(self, image_id, import_token, vmo_index, properties)
3025    }
3026
3027    /// This function is used to determine the region (in texel space) of an image that will be used
3028    /// by Flatland when rendering. The image to be sampled is referenced by [`image_id`] and the
3029    /// sample region is specified by [`rect`] which itself is comprised of an origin point (x,y) as
3030    /// well as a width and height, in unnormalized coordinates. It is illegal to call this function
3031    /// on non-image content, or to sample a region outside of the texel space of the image. In
3032    /// other words, the region specifed by [`rect`] must not exceed the ranges (0, image_width) and
3033    /// (0, image_height). If (rect.x + rect.width > image_width) or (rect.y + rect.height >
3034    /// image_height) or if any of the values are negative, this will result in an error.
3035    ///
3036    /// If this method is not called, the default sample region is the rectangle with origin at
3037    /// (0, 0) and width and height set at ImageProperties from [`CreateImage`].
3038    pub fn r#set_image_sample_region(
3039        &self,
3040        mut image_id: &ContentId,
3041        mut rect: &fidl_fuchsia_math::RectF,
3042    ) -> Result<(), fidl::Error> {
3043        FlatlandProxyInterface::r#set_image_sample_region(self, image_id, rect)
3044    }
3045
3046    /// The content size for an Image is the size of the rectangle in the parent's logical
3047    /// coordinate space that the image occupies. This combined with the global translation of the
3048    /// transform it is attached to determines the size and location of where the content is
3049    /// rendered on the display.
3050    ///
3051    /// If this method is not called, the default image destination size is the width and height set
3052    /// at ImageProperties from [`CreateImage`]. The destination size will be affected by scaling if
3053    /// [`SetScale`] is used on the attached Transform or its parents.
3054    pub fn r#set_image_destination_size(
3055        &self,
3056        mut image_id: &ContentId,
3057        mut size: &fidl_fuchsia_math::SizeU,
3058    ) -> Result<(), fidl::Error> {
3059        FlatlandProxyInterface::r#set_image_destination_size(self, image_id, size)
3060    }
3061
3062    /// Determines the blend function to use when rendering the content specified by
3063    /// |image_id|. |image_id| must be a valid ContentId associated to a transform through
3064    /// a call to |CreateImage| or |CreateFilledRect|. For details on the different blend functions
3065    /// that are available, please refer to the BlendMode enum. If this function is not called, then
3066    /// the default blendmode is BlendMode::SRC.
3067    pub fn r#set_image_blending_function(
3068        &self,
3069        mut image_id: &ContentId,
3070        mut blend_mode: BlendMode,
3071    ) -> Result<(), fidl::Error> {
3072        FlatlandProxyInterface::r#set_image_blending_function(self, image_id, blend_mode)
3073    }
3074
3075    /// Determines the blend function to use when rendering the content specified by
3076    /// |image_id|. |image_id| must be a valid ContentId associated to a transform through
3077    /// a call to |CreateImage| or |CreateFilledRect|. For details on the different blend functions
3078    /// that are available, please refer to the BlendMode2 enum. If this function is not called,
3079    /// the default blendmode is BlendMode2::REPLACE.
3080    pub fn r#set_image_blend_mode(
3081        &self,
3082        mut image_id: &ContentId,
3083        mut blend_mode: BlendMode2,
3084    ) -> Result<(), fidl::Error> {
3085        FlatlandProxyInterface::r#set_image_blend_mode(self, image_id, blend_mode)
3086    }
3087
3088    /// Sets an opacity in linear space to be applied to a flatland image. Opacity values must
3089    /// be in the range [0.0, 1.0].
3090    pub fn r#set_image_opacity(
3091        &self,
3092        mut image_id: &ContentId,
3093        mut val: f32,
3094    ) -> Result<(), fidl::Error> {
3095        FlatlandProxyInterface::r#set_image_opacity(self, image_id, val)
3096    }
3097
3098    /// Sets the image flip to be applied to a flatland image. This call must be performed after a
3099    /// successful |CreateImage| call. If an invalid |image_id| is supplied, the channel will be
3100    /// closed due to FlatlandError::BAD_OPERATION. This flip will be applied to the Image before
3101    /// parent Transform Orientations. If this function is not called, then the default flip value
3102    /// is ImageFlip::NONE.
3103    pub fn r#set_image_flip(
3104        &self,
3105        mut image_id: &ContentId,
3106        mut flip: ImageFlip,
3107    ) -> Result<(), fidl::Error> {
3108        FlatlandProxyInterface::r#set_image_flip(self, image_id, flip)
3109    }
3110
3111    /// Creates a solid-color rectangle. By default a filled-rect does not have a defined
3112    /// color or size. It is necessary to call |SetSolidFill| to specify a color and size
3113    /// before a filled rect can be used for rendering. Not doing so will result the
3114    pub fn r#create_filled_rect(&self, mut rect_id: &ContentId) -> Result<(), fidl::Error> {
3115        FlatlandProxyInterface::r#create_filled_rect(self, rect_id)
3116    }
3117
3118    /// Defines the color and size of a filled rect. |rect_id| must refer to content that
3119    /// was created via a call to CreateFilledRect. The color is not premultiplied. Color values
3120    /// must be within the range [0,1] inclusive, and normal 32-bit
3121    /// floating point values: https://en.wikipedia.org/wiki/Normal_number_%28computing%29. Values
3122    /// that do not conform to these specifications will cause the channel to close.
3123    /// The rectangle's top left corner will be at (0, 0) in its transform's coordinate space.
3124    /// Hence, its bottom right corner will be at (size.width, size.height).
3125    pub fn r#set_solid_fill(
3126        &self,
3127        mut rect_id: &ContentId,
3128        mut color: &ColorRgba,
3129        mut size: &fidl_fuchsia_math::SizeU,
3130    ) -> Result<(), fidl::Error> {
3131        FlatlandProxyInterface::r#set_solid_fill(self, rect_id, color, size)
3132    }
3133
3134    /// Automatically garbage collects the rectangle when it is no longer needed for
3135    /// rendering. |rect_id| must have been instantiated with a call to
3136    /// |CreateFilledRect|. Once released, the ID immediately goes out of scope and is free
3137    /// to be used again.
3138    pub fn r#release_filled_rect(&self, mut rect_id: &ContentId) -> Result<(), fidl::Error> {
3139        FlatlandProxyInterface::r#release_filled_rect(self, rect_id)
3140    }
3141
3142    /// Setting a piece of Content on a Transform makes that Content visible in the render tree as
3143    /// long as the Transform is visible from the root Transform. The Content will be rendered
3144    /// before, and therefore "behind", any Content attached to the descendants of the Transform.
3145    ///
3146    /// Because each Transform can have, at most, a single piece of Content on it, calling this
3147    /// function on a Transform that already has Content will replace that Content.
3148    ///
3149    /// A Content may be set on more than one Transform.
3150    ///
3151    /// Calling this function with a Content id of 0 will remove any Content currently on the
3152    /// Transform.
3153    pub fn r#set_content(
3154        &self,
3155        mut transform_id: &TransformId,
3156        mut content_id: &ContentId,
3157    ) -> Result<(), fidl::Error> {
3158        FlatlandProxyInterface::r#set_content(self, transform_id, content_id)
3159    }
3160
3161    /// Transforms are usually sufficient to change how Content is presented. Viewports, however,
3162    /// have special properties that are not part of the Transform hierarchy. Those properties can
3163    /// be set using this function.
3164    pub fn r#set_viewport_properties(
3165        &self,
3166        mut viewport_id: &ContentId,
3167        mut properties: &ViewportProperties,
3168    ) -> Result<(), fidl::Error> {
3169        FlatlandProxyInterface::r#set_viewport_properties(self, viewport_id, properties)
3170    }
3171
3172    /// Released Transforms will be garbage collected by the system once they are no longer
3173    /// necessary for rendering. For Transforms, this means there is no path from any unreleased
3174    /// Transform to the newly-released Transform.
3175    ///
3176    /// Once released, the id immediately goes out of scope for future function calls and can be
3177    /// reused when creating new Transforms.
3178    ///
3179    /// It is an error to call functions with a released id (unless that id has been reused to
3180    /// construct a new Transform).
3181    pub fn r#release_transform(&self, mut transform_id: &TransformId) -> Result<(), fidl::Error> {
3182        FlatlandProxyInterface::r#release_transform(self, transform_id)
3183    }
3184
3185    pub fn r#release_view(&self) -> Result<(), fidl::Error> {
3186        FlatlandProxyInterface::r#release_view(self)
3187    }
3188
3189    /// Releases a Viewport from the scene, even if the Viewport is still connected to a Transform.
3190    /// Unlike other resources, Viewports are garbage collected by the system during the next
3191    /// [`Present`] because a removed Viewport is guaranteed to provide no renderable content.
3192    ///
3193    /// Use SetContent(transform_id, 0) to clean up references to released Viewports.
3194    ///
3195    /// Despite having a return type, this function is still feed-forward like [`CreateView`] and
3196    /// requires a call to [`Present`] to be executed. The ViewportCreationToken will be returned
3197    /// after the presented operations have been executed.
3198    pub fn r#release_viewport(
3199        &self,
3200        mut viewport_id: &ContentId,
3201    ) -> fidl::client::QueryResponseFut<
3202        fidl_fuchsia_ui_views::ViewportCreationToken,
3203        fidl::encoding::DefaultFuchsiaResourceDialect,
3204    > {
3205        FlatlandProxyInterface::r#release_viewport(self, viewport_id)
3206    }
3207
3208    /// Released Images will be garbage collected by the system once they are no longer necessary
3209    /// for rendering. For Images, this means the Image is no longer attached to any Transform and
3210    /// any pending rendering that references the Image is complete.
3211    ///
3212    /// Use SetContent(transform_id, 0) to clean up references to released Images.
3213    ///
3214    /// Once released, the id immediately goes out of scope for future function calls and can be
3215    /// reused when creating new Images.
3216    ///
3217    /// It is an error to call functions with a released id (unless that id has been reused to
3218    /// construct a new Image).
3219    pub fn r#release_image(&self, mut image_id: &ContentId) -> Result<(), fidl::Error> {
3220        FlatlandProxyInterface::r#release_image(self, image_id)
3221    }
3222
3223    /// This function will reset all state on this interface. This includes destroying all existing
3224    /// View and Viewports without returning the associated Token to the caller.
3225    pub fn r#clear(&self) -> Result<(), fidl::Error> {
3226        FlatlandProxyInterface::r#clear(self)
3227    }
3228
3229    /// Set debug name of the current client that can be used by Flatland to print as a prefix to
3230    /// logs to help client distinguish what is theirs. [`name`] can be an arbitrary string, but the
3231    /// current process name (see fsl::GetCurrentProcessName()) is a good default.
3232    pub fn r#set_debug_name(&self, mut name: &str) -> Result<(), fidl::Error> {
3233        FlatlandProxyInterface::r#set_debug_name(self, name)
3234    }
3235}
3236
3237impl FlatlandProxyInterface for FlatlandProxy {
3238    fn r#release_image_immediately(&self, mut image_id: &ContentId) -> Result<(), fidl::Error> {
3239        self.client.send::<TrustedFlatlandReleaseImageImmediatelyRequest>(
3240            (image_id,),
3241            0x245e1ac080772c8,
3242            fidl::encoding::DynamicFlags::empty(),
3243        )
3244    }
3245
3246    fn r#present(&self, mut args: PresentArgs) -> Result<(), fidl::Error> {
3247        self.client.send::<FlatlandPresentRequest>(
3248            (&mut args,),
3249            0x50acc2aa1f0acec7,
3250            fidl::encoding::DynamicFlags::empty(),
3251        )
3252    }
3253
3254    fn r#create_view(
3255        &self,
3256        mut token: fidl_fuchsia_ui_views::ViewCreationToken,
3257        mut parent_viewport_watcher: fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>,
3258    ) -> Result<(), fidl::Error> {
3259        self.client.send::<FlatlandCreateViewRequest>(
3260            (&mut token, parent_viewport_watcher),
3261            0x504686eb25864780,
3262            fidl::encoding::DynamicFlags::empty(),
3263        )
3264    }
3265
3266    fn r#create_view2(
3267        &self,
3268        mut token: fidl_fuchsia_ui_views::ViewCreationToken,
3269        mut view_identity: fidl_fuchsia_ui_views::ViewIdentityOnCreation,
3270        mut protocols: ViewBoundProtocols,
3271        mut parent_viewport_watcher: fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>,
3272    ) -> Result<(), fidl::Error> {
3273        self.client.send::<FlatlandCreateView2Request>(
3274            (&mut token, &mut view_identity, &mut protocols, parent_viewport_watcher),
3275            0x340a3a40c2fdbd5e,
3276            fidl::encoding::DynamicFlags::empty(),
3277        )
3278    }
3279
3280    fn r#create_transform(&self, mut transform_id: &TransformId) -> Result<(), fidl::Error> {
3281        self.client.send::<FlatlandCreateTransformRequest>(
3282            (transform_id,),
3283            0x5e042a4d3de3efb0,
3284            fidl::encoding::DynamicFlags::empty(),
3285        )
3286    }
3287
3288    fn r#set_translation(
3289        &self,
3290        mut transform_id: &TransformId,
3291        mut translation: &fidl_fuchsia_math::Vec_,
3292    ) -> Result<(), fidl::Error> {
3293        self.client.send::<FlatlandSetTranslationRequest>(
3294            (transform_id, translation),
3295            0x7863398291fba346,
3296            fidl::encoding::DynamicFlags::empty(),
3297        )
3298    }
3299
3300    fn r#set_orientation(
3301        &self,
3302        mut transform_id: &TransformId,
3303        mut orientation: Orientation,
3304    ) -> Result<(), fidl::Error> {
3305        self.client.send::<FlatlandSetOrientationRequest>(
3306            (transform_id, orientation),
3307            0x4915310bc4928edc,
3308            fidl::encoding::DynamicFlags::empty(),
3309        )
3310    }
3311
3312    fn r#set_scale(
3313        &self,
3314        mut transform_id: &TransformId,
3315        mut scale: &fidl_fuchsia_math::VecF,
3316    ) -> Result<(), fidl::Error> {
3317        self.client.send::<FlatlandSetScaleRequest>(
3318            (transform_id, scale),
3319            0x1ea1766fd8996bb4,
3320            fidl::encoding::DynamicFlags::empty(),
3321        )
3322    }
3323
3324    fn r#set_opacity(
3325        &self,
3326        mut transform_id: &TransformId,
3327        mut value: f32,
3328    ) -> Result<(), fidl::Error> {
3329        self.client.send::<FlatlandSetOpacityRequest>(
3330            (transform_id, value),
3331            0x3775fc2c00b432fa,
3332            fidl::encoding::DynamicFlags::empty(),
3333        )
3334    }
3335
3336    fn r#set_clip_boundary(
3337        &self,
3338        mut transform_id: &TransformId,
3339        mut rect: Option<&fidl_fuchsia_math::Rect>,
3340    ) -> Result<(), fidl::Error> {
3341        self.client.send::<FlatlandSetClipBoundaryRequest>(
3342            (transform_id, rect),
3343            0x6507843df12222d2,
3344            fidl::encoding::DynamicFlags::empty(),
3345        )
3346    }
3347
3348    fn r#add_child(
3349        &self,
3350        mut parent_transform_id: &TransformId,
3351        mut child_transform_id: &TransformId,
3352    ) -> Result<(), fidl::Error> {
3353        self.client.send::<FlatlandAddChildRequest>(
3354            (parent_transform_id, child_transform_id),
3355            0x67a8abd2f19b1a74,
3356            fidl::encoding::DynamicFlags::empty(),
3357        )
3358    }
3359
3360    fn r#remove_child(
3361        &self,
3362        mut parent_transform_id: &TransformId,
3363        mut child_transform_id: &TransformId,
3364    ) -> Result<(), fidl::Error> {
3365        self.client.send::<FlatlandRemoveChildRequest>(
3366            (parent_transform_id, child_transform_id),
3367            0x41d6cd90b298b67a,
3368            fidl::encoding::DynamicFlags::empty(),
3369        )
3370    }
3371
3372    fn r#replace_children(
3373        &self,
3374        mut parent_transform_id: &TransformId,
3375        mut new_child_transform_ids: &[TransformId],
3376    ) -> Result<(), fidl::Error> {
3377        self.client.send::<FlatlandReplaceChildrenRequest>(
3378            (parent_transform_id, new_child_transform_ids),
3379            0x5b6d86cbbff81316,
3380            fidl::encoding::DynamicFlags::empty(),
3381        )
3382    }
3383
3384    fn r#set_root_transform(&self, mut transform_id: &TransformId) -> Result<(), fidl::Error> {
3385        self.client.send::<FlatlandSetRootTransformRequest>(
3386            (transform_id,),
3387            0x6e80ca5bcc566cd8,
3388            fidl::encoding::DynamicFlags::empty(),
3389        )
3390    }
3391
3392    fn r#set_hit_regions(
3393        &self,
3394        mut transform_id: &TransformId,
3395        mut regions: &[HitRegion],
3396    ) -> Result<(), fidl::Error> {
3397        self.client.send::<FlatlandSetHitRegionsRequest>(
3398            (transform_id, regions),
3399            0x31c9d17b07c37ce4,
3400            fidl::encoding::DynamicFlags::empty(),
3401        )
3402    }
3403
3404    fn r#set_infinite_hit_region(
3405        &self,
3406        mut transform_id: &TransformId,
3407        mut hit_test: HitTestInteraction,
3408    ) -> Result<(), fidl::Error> {
3409        self.client.send::<FlatlandSetInfiniteHitRegionRequest>(
3410            (transform_id, hit_test),
3411            0x26d81af852d29562,
3412            fidl::encoding::DynamicFlags::empty(),
3413        )
3414    }
3415
3416    fn r#create_viewport(
3417        &self,
3418        mut viewport_id: &ContentId,
3419        mut token: fidl_fuchsia_ui_views::ViewportCreationToken,
3420        mut properties: &ViewportProperties,
3421        mut child_view_watcher: fidl::endpoints::ServerEnd<ChildViewWatcherMarker>,
3422    ) -> Result<(), fidl::Error> {
3423        self.client.send::<FlatlandCreateViewportRequest>(
3424            (viewport_id, &mut token, properties, child_view_watcher),
3425            0x2485fbcab7f943c,
3426            fidl::encoding::DynamicFlags::empty(),
3427        )
3428    }
3429
3430    fn r#create_image(
3431        &self,
3432        mut image_id: &ContentId,
3433        mut import_token: BufferCollectionImportToken,
3434        mut vmo_index: u32,
3435        mut properties: &ImageProperties,
3436    ) -> Result<(), fidl::Error> {
3437        self.client.send::<FlatlandCreateImageRequest>(
3438            (image_id, &mut import_token, vmo_index, properties),
3439            0x26fae823c4ebedad,
3440            fidl::encoding::DynamicFlags::empty(),
3441        )
3442    }
3443
3444    fn r#set_image_sample_region(
3445        &self,
3446        mut image_id: &ContentId,
3447        mut rect: &fidl_fuchsia_math::RectF,
3448    ) -> Result<(), fidl::Error> {
3449        self.client.send::<FlatlandSetImageSampleRegionRequest>(
3450            (image_id, rect),
3451            0x8039391d715eb28,
3452            fidl::encoding::DynamicFlags::empty(),
3453        )
3454    }
3455
3456    fn r#set_image_destination_size(
3457        &self,
3458        mut image_id: &ContentId,
3459        mut size: &fidl_fuchsia_math::SizeU,
3460    ) -> Result<(), fidl::Error> {
3461        self.client.send::<FlatlandSetImageDestinationSizeRequest>(
3462            (image_id, size),
3463            0x766cf99a2ec58446,
3464            fidl::encoding::DynamicFlags::empty(),
3465        )
3466    }
3467
3468    fn r#set_image_blending_function(
3469        &self,
3470        mut image_id: &ContentId,
3471        mut blend_mode: BlendMode,
3472    ) -> Result<(), fidl::Error> {
3473        self.client.send::<FlatlandSetImageBlendingFunctionRequest>(
3474            (image_id, blend_mode),
3475            0x10f5da1356275b7b,
3476            fidl::encoding::DynamicFlags::empty(),
3477        )
3478    }
3479
3480    fn r#set_image_blend_mode(
3481        &self,
3482        mut image_id: &ContentId,
3483        mut blend_mode: BlendMode2,
3484    ) -> Result<(), fidl::Error> {
3485        self.client.send::<FlatlandSetImageBlendModeRequest>(
3486            (image_id, blend_mode),
3487            0x5b1667f130c3de67,
3488            fidl::encoding::DynamicFlags::empty(),
3489        )
3490    }
3491
3492    fn r#set_image_opacity(
3493        &self,
3494        mut image_id: &ContentId,
3495        mut val: f32,
3496    ) -> Result<(), fidl::Error> {
3497        self.client.send::<FlatlandSetImageOpacityRequest>(
3498            (image_id, val),
3499            0x2da9e4ef4c2cff6f,
3500            fidl::encoding::DynamicFlags::empty(),
3501        )
3502    }
3503
3504    fn r#set_image_flip(
3505        &self,
3506        mut image_id: &ContentId,
3507        mut flip: ImageFlip,
3508    ) -> Result<(), fidl::Error> {
3509        self.client.send::<FlatlandSetImageFlipRequest>(
3510            (image_id, flip),
3511            0x21b20f2c14aae6bc,
3512            fidl::encoding::DynamicFlags::empty(),
3513        )
3514    }
3515
3516    fn r#create_filled_rect(&self, mut rect_id: &ContentId) -> Result<(), fidl::Error> {
3517        self.client.send::<FlatlandCreateFilledRectRequest>(
3518            (rect_id,),
3519            0x5e62355abc1c4c5d,
3520            fidl::encoding::DynamicFlags::empty(),
3521        )
3522    }
3523
3524    fn r#set_solid_fill(
3525        &self,
3526        mut rect_id: &ContentId,
3527        mut color: &ColorRgba,
3528        mut size: &fidl_fuchsia_math::SizeU,
3529    ) -> Result<(), fidl::Error> {
3530        self.client.send::<FlatlandSetSolidFillRequest>(
3531            (rect_id, color, size),
3532            0x32d6ef41e182dfa5,
3533            fidl::encoding::DynamicFlags::empty(),
3534        )
3535    }
3536
3537    fn r#release_filled_rect(&self, mut rect_id: &ContentId) -> Result<(), fidl::Error> {
3538        self.client.send::<FlatlandReleaseFilledRectRequest>(
3539            (rect_id,),
3540            0x7392cabe45618f9b,
3541            fidl::encoding::DynamicFlags::empty(),
3542        )
3543    }
3544
3545    fn r#set_content(
3546        &self,
3547        mut transform_id: &TransformId,
3548        mut content_id: &ContentId,
3549    ) -> Result<(), fidl::Error> {
3550        self.client.send::<FlatlandSetContentRequest>(
3551            (transform_id, content_id),
3552            0x4ed2cfc0ce130862,
3553            fidl::encoding::DynamicFlags::empty(),
3554        )
3555    }
3556
3557    fn r#set_viewport_properties(
3558        &self,
3559        mut viewport_id: &ContentId,
3560        mut properties: &ViewportProperties,
3561    ) -> Result<(), fidl::Error> {
3562        self.client.send::<FlatlandSetViewportPropertiesRequest>(
3563            (viewport_id, properties),
3564            0x66ab67e9608ddb9f,
3565            fidl::encoding::DynamicFlags::empty(),
3566        )
3567    }
3568
3569    fn r#release_transform(&self, mut transform_id: &TransformId) -> Result<(), fidl::Error> {
3570        self.client.send::<FlatlandReleaseTransformRequest>(
3571            (transform_id,),
3572            0xab9328419451c22,
3573            fidl::encoding::DynamicFlags::empty(),
3574        )
3575    }
3576
3577    fn r#release_view(&self) -> Result<(), fidl::Error> {
3578        self.client.send::<fidl::encoding::EmptyPayload>(
3579            (),
3580            0x5b35aab9baffecae,
3581            fidl::encoding::DynamicFlags::empty(),
3582        )
3583    }
3584
3585    type ReleaseViewportResponseFut = fidl::client::QueryResponseFut<
3586        fidl_fuchsia_ui_views::ViewportCreationToken,
3587        fidl::encoding::DefaultFuchsiaResourceDialect,
3588    >;
3589    fn r#release_viewport(&self, mut viewport_id: &ContentId) -> Self::ReleaseViewportResponseFut {
3590        fn _decode(
3591            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3592        ) -> Result<fidl_fuchsia_ui_views::ViewportCreationToken, fidl::Error> {
3593            let _response = fidl::client::decode_transaction_body::<
3594                FlatlandReleaseViewportResponse,
3595                fidl::encoding::DefaultFuchsiaResourceDialect,
3596                0xbad474aeb5293f9,
3597            >(_buf?)?;
3598            Ok(_response.token)
3599        }
3600        self.client.send_query_and_decode::<
3601            FlatlandReleaseViewportRequest,
3602            fidl_fuchsia_ui_views::ViewportCreationToken,
3603        >(
3604            (viewport_id,),
3605            0xbad474aeb5293f9,
3606            fidl::encoding::DynamicFlags::empty(),
3607            _decode,
3608        )
3609    }
3610
3611    fn r#release_image(&self, mut image_id: &ContentId) -> Result<(), fidl::Error> {
3612        self.client.send::<FlatlandReleaseImageRequest>(
3613            (image_id,),
3614            0xb884ffdbc72c111,
3615            fidl::encoding::DynamicFlags::empty(),
3616        )
3617    }
3618
3619    fn r#clear(&self) -> Result<(), fidl::Error> {
3620        self.client.send::<fidl::encoding::EmptyPayload>(
3621            (),
3622            0x4ec8817c02828c3e,
3623            fidl::encoding::DynamicFlags::empty(),
3624        )
3625    }
3626
3627    fn r#set_debug_name(&self, mut name: &str) -> Result<(), fidl::Error> {
3628        self.client.send::<FlatlandSetDebugNameRequest>(
3629            (name,),
3630            0x46a8b397e68a8888,
3631            fidl::encoding::DynamicFlags::empty(),
3632        )
3633    }
3634}
3635
3636pub struct FlatlandEventStream {
3637    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
3638}
3639
3640impl std::marker::Unpin for FlatlandEventStream {}
3641
3642impl futures::stream::FusedStream for FlatlandEventStream {
3643    fn is_terminated(&self) -> bool {
3644        self.event_receiver.is_terminated()
3645    }
3646}
3647
3648impl futures::Stream for FlatlandEventStream {
3649    type Item = Result<FlatlandEvent, fidl::Error>;
3650
3651    fn poll_next(
3652        mut self: std::pin::Pin<&mut Self>,
3653        cx: &mut std::task::Context<'_>,
3654    ) -> std::task::Poll<Option<Self::Item>> {
3655        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
3656            &mut self.event_receiver,
3657            cx
3658        )?) {
3659            Some(buf) => std::task::Poll::Ready(Some(FlatlandEvent::decode(buf))),
3660            None => std::task::Poll::Ready(None),
3661        }
3662    }
3663}
3664
3665#[derive(Debug)]
3666pub enum FlatlandEvent {
3667    OnNextFrameBegin { values: OnNextFrameBeginValues },
3668    OnFramePresented { frame_presented_info: fidl_fuchsia_scenic_scheduling::FramePresentedInfo },
3669    OnError { error: FlatlandError },
3670}
3671
3672impl FlatlandEvent {
3673    #[allow(irrefutable_let_patterns)]
3674    pub fn into_on_next_frame_begin(self) -> Option<OnNextFrameBeginValues> {
3675        if let FlatlandEvent::OnNextFrameBegin { values } = self { Some((values)) } else { None }
3676    }
3677    #[allow(irrefutable_let_patterns)]
3678    pub fn into_on_frame_presented(
3679        self,
3680    ) -> Option<fidl_fuchsia_scenic_scheduling::FramePresentedInfo> {
3681        if let FlatlandEvent::OnFramePresented { frame_presented_info } = self {
3682            Some((frame_presented_info))
3683        } else {
3684            None
3685        }
3686    }
3687    #[allow(irrefutable_let_patterns)]
3688    pub fn into_on_error(self) -> Option<FlatlandError> {
3689        if let FlatlandEvent::OnError { error } = self { Some((error)) } else { None }
3690    }
3691
3692    /// Decodes a message buffer as a [`FlatlandEvent`].
3693    fn decode(
3694        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3695    ) -> Result<FlatlandEvent, fidl::Error> {
3696        let (bytes, _handles) = buf.split_mut();
3697        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3698        debug_assert_eq!(tx_header.tx_id, 0);
3699        match tx_header.ordinal {
3700            0x10f69a5cdeece84a => {
3701                let mut out = fidl::new_empty!(
3702                    FlatlandOnNextFrameBeginRequest,
3703                    fidl::encoding::DefaultFuchsiaResourceDialect
3704                );
3705                fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandOnNextFrameBeginRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
3706                Ok((FlatlandEvent::OnNextFrameBegin { values: out.values }))
3707            }
3708            0x56e43e1a5f30216d => {
3709                let mut out = fidl::new_empty!(
3710                    FlatlandOnFramePresentedRequest,
3711                    fidl::encoding::DefaultFuchsiaResourceDialect
3712                );
3713                fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandOnFramePresentedRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
3714                Ok((FlatlandEvent::OnFramePresented {
3715                    frame_presented_info: out.frame_presented_info,
3716                }))
3717            }
3718            0x1ebf39e90cd8b8d => {
3719                let mut out = fidl::new_empty!(
3720                    FlatlandOnErrorRequest,
3721                    fidl::encoding::DefaultFuchsiaResourceDialect
3722                );
3723                fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandOnErrorRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
3724                Ok((FlatlandEvent::OnError { error: out.error }))
3725            }
3726            _ => Err(fidl::Error::UnknownOrdinal {
3727                ordinal: tx_header.ordinal,
3728                protocol_name: <FlatlandMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3729            }),
3730        }
3731    }
3732}
3733
3734/// A Stream of incoming requests for fuchsia.ui.composition/Flatland.
3735pub struct FlatlandRequestStream {
3736    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3737    is_terminated: bool,
3738}
3739
3740impl std::marker::Unpin for FlatlandRequestStream {}
3741
3742impl futures::stream::FusedStream for FlatlandRequestStream {
3743    fn is_terminated(&self) -> bool {
3744        self.is_terminated
3745    }
3746}
3747
3748impl fidl::endpoints::RequestStream for FlatlandRequestStream {
3749    type Protocol = FlatlandMarker;
3750    type ControlHandle = FlatlandControlHandle;
3751
3752    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
3753        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3754    }
3755
3756    fn control_handle(&self) -> Self::ControlHandle {
3757        FlatlandControlHandle { inner: self.inner.clone() }
3758    }
3759
3760    fn into_inner(
3761        self,
3762    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3763    {
3764        (self.inner, self.is_terminated)
3765    }
3766
3767    fn from_inner(
3768        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3769        is_terminated: bool,
3770    ) -> Self {
3771        Self { inner, is_terminated }
3772    }
3773}
3774
3775impl futures::Stream for FlatlandRequestStream {
3776    type Item = Result<FlatlandRequest, fidl::Error>;
3777
3778    fn poll_next(
3779        mut self: std::pin::Pin<&mut Self>,
3780        cx: &mut std::task::Context<'_>,
3781    ) -> std::task::Poll<Option<Self::Item>> {
3782        let this = &mut *self;
3783        if this.inner.check_shutdown(cx) {
3784            this.is_terminated = true;
3785            return std::task::Poll::Ready(None);
3786        }
3787        if this.is_terminated {
3788            panic!("polled FlatlandRequestStream after completion");
3789        }
3790        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3791            |bytes, handles| {
3792                match this.inner.channel().read_etc(cx, bytes, handles) {
3793                    std::task::Poll::Ready(Ok(())) => {}
3794                    std::task::Poll::Pending => return std::task::Poll::Pending,
3795                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3796                        this.is_terminated = true;
3797                        return std::task::Poll::Ready(None);
3798                    }
3799                    std::task::Poll::Ready(Err(e)) => {
3800                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3801                            e.into(),
3802                        ))));
3803                    }
3804                }
3805
3806                // A message has been received from the channel
3807                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3808
3809                std::task::Poll::Ready(Some(match header.ordinal {
3810                    0x245e1ac080772c8 => {
3811                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3812                        let mut req = fidl::new_empty!(
3813                            TrustedFlatlandReleaseImageImmediatelyRequest,
3814                            fidl::encoding::DefaultFuchsiaResourceDialect
3815                        );
3816                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<TrustedFlatlandReleaseImageImmediatelyRequest>(&header, _body_bytes, handles, &mut req)?;
3817                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
3818                        Ok(FlatlandRequest::ReleaseImageImmediately {
3819                            image_id: req.image_id,
3820
3821                            control_handle,
3822                        })
3823                    }
3824                    0x50acc2aa1f0acec7 => {
3825                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3826                        let mut req = fidl::new_empty!(
3827                            FlatlandPresentRequest,
3828                            fidl::encoding::DefaultFuchsiaResourceDialect
3829                        );
3830                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandPresentRequest>(&header, _body_bytes, handles, &mut req)?;
3831                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
3832                        Ok(FlatlandRequest::Present { args: req.args, control_handle })
3833                    }
3834                    0x504686eb25864780 => {
3835                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3836                        let mut req = fidl::new_empty!(
3837                            FlatlandCreateViewRequest,
3838                            fidl::encoding::DefaultFuchsiaResourceDialect
3839                        );
3840                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandCreateViewRequest>(&header, _body_bytes, handles, &mut req)?;
3841                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
3842                        Ok(FlatlandRequest::CreateView {
3843                            token: req.token,
3844                            parent_viewport_watcher: req.parent_viewport_watcher,
3845
3846                            control_handle,
3847                        })
3848                    }
3849                    0x340a3a40c2fdbd5e => {
3850                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3851                        let mut req = fidl::new_empty!(
3852                            FlatlandCreateView2Request,
3853                            fidl::encoding::DefaultFuchsiaResourceDialect
3854                        );
3855                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandCreateView2Request>(&header, _body_bytes, handles, &mut req)?;
3856                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
3857                        Ok(FlatlandRequest::CreateView2 {
3858                            token: req.token,
3859                            view_identity: req.view_identity,
3860                            protocols: req.protocols,
3861                            parent_viewport_watcher: req.parent_viewport_watcher,
3862
3863                            control_handle,
3864                        })
3865                    }
3866                    0x5e042a4d3de3efb0 => {
3867                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3868                        let mut req = fidl::new_empty!(
3869                            FlatlandCreateTransformRequest,
3870                            fidl::encoding::DefaultFuchsiaResourceDialect
3871                        );
3872                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandCreateTransformRequest>(&header, _body_bytes, handles, &mut req)?;
3873                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
3874                        Ok(FlatlandRequest::CreateTransform {
3875                            transform_id: req.transform_id,
3876
3877                            control_handle,
3878                        })
3879                    }
3880                    0x7863398291fba346 => {
3881                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3882                        let mut req = fidl::new_empty!(
3883                            FlatlandSetTranslationRequest,
3884                            fidl::encoding::DefaultFuchsiaResourceDialect
3885                        );
3886                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetTranslationRequest>(&header, _body_bytes, handles, &mut req)?;
3887                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
3888                        Ok(FlatlandRequest::SetTranslation {
3889                            transform_id: req.transform_id,
3890                            translation: req.translation,
3891
3892                            control_handle,
3893                        })
3894                    }
3895                    0x4915310bc4928edc => {
3896                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3897                        let mut req = fidl::new_empty!(
3898                            FlatlandSetOrientationRequest,
3899                            fidl::encoding::DefaultFuchsiaResourceDialect
3900                        );
3901                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetOrientationRequest>(&header, _body_bytes, handles, &mut req)?;
3902                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
3903                        Ok(FlatlandRequest::SetOrientation {
3904                            transform_id: req.transform_id,
3905                            orientation: req.orientation,
3906
3907                            control_handle,
3908                        })
3909                    }
3910                    0x1ea1766fd8996bb4 => {
3911                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3912                        let mut req = fidl::new_empty!(
3913                            FlatlandSetScaleRequest,
3914                            fidl::encoding::DefaultFuchsiaResourceDialect
3915                        );
3916                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetScaleRequest>(&header, _body_bytes, handles, &mut req)?;
3917                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
3918                        Ok(FlatlandRequest::SetScale {
3919                            transform_id: req.transform_id,
3920                            scale: req.scale,
3921
3922                            control_handle,
3923                        })
3924                    }
3925                    0x3775fc2c00b432fa => {
3926                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3927                        let mut req = fidl::new_empty!(
3928                            FlatlandSetOpacityRequest,
3929                            fidl::encoding::DefaultFuchsiaResourceDialect
3930                        );
3931                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetOpacityRequest>(&header, _body_bytes, handles, &mut req)?;
3932                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
3933                        Ok(FlatlandRequest::SetOpacity {
3934                            transform_id: req.transform_id,
3935                            value: req.value,
3936
3937                            control_handle,
3938                        })
3939                    }
3940                    0x6507843df12222d2 => {
3941                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3942                        let mut req = fidl::new_empty!(
3943                            FlatlandSetClipBoundaryRequest,
3944                            fidl::encoding::DefaultFuchsiaResourceDialect
3945                        );
3946                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetClipBoundaryRequest>(&header, _body_bytes, handles, &mut req)?;
3947                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
3948                        Ok(FlatlandRequest::SetClipBoundary {
3949                            transform_id: req.transform_id,
3950                            rect: req.rect,
3951
3952                            control_handle,
3953                        })
3954                    }
3955                    0x67a8abd2f19b1a74 => {
3956                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3957                        let mut req = fidl::new_empty!(
3958                            FlatlandAddChildRequest,
3959                            fidl::encoding::DefaultFuchsiaResourceDialect
3960                        );
3961                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandAddChildRequest>(&header, _body_bytes, handles, &mut req)?;
3962                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
3963                        Ok(FlatlandRequest::AddChild {
3964                            parent_transform_id: req.parent_transform_id,
3965                            child_transform_id: req.child_transform_id,
3966
3967                            control_handle,
3968                        })
3969                    }
3970                    0x41d6cd90b298b67a => {
3971                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3972                        let mut req = fidl::new_empty!(
3973                            FlatlandRemoveChildRequest,
3974                            fidl::encoding::DefaultFuchsiaResourceDialect
3975                        );
3976                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandRemoveChildRequest>(&header, _body_bytes, handles, &mut req)?;
3977                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
3978                        Ok(FlatlandRequest::RemoveChild {
3979                            parent_transform_id: req.parent_transform_id,
3980                            child_transform_id: req.child_transform_id,
3981
3982                            control_handle,
3983                        })
3984                    }
3985                    0x5b6d86cbbff81316 => {
3986                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3987                        let mut req = fidl::new_empty!(
3988                            FlatlandReplaceChildrenRequest,
3989                            fidl::encoding::DefaultFuchsiaResourceDialect
3990                        );
3991                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandReplaceChildrenRequest>(&header, _body_bytes, handles, &mut req)?;
3992                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
3993                        Ok(FlatlandRequest::ReplaceChildren {
3994                            parent_transform_id: req.parent_transform_id,
3995                            new_child_transform_ids: req.new_child_transform_ids,
3996
3997                            control_handle,
3998                        })
3999                    }
4000                    0x6e80ca5bcc566cd8 => {
4001                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4002                        let mut req = fidl::new_empty!(
4003                            FlatlandSetRootTransformRequest,
4004                            fidl::encoding::DefaultFuchsiaResourceDialect
4005                        );
4006                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetRootTransformRequest>(&header, _body_bytes, handles, &mut req)?;
4007                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4008                        Ok(FlatlandRequest::SetRootTransform {
4009                            transform_id: req.transform_id,
4010
4011                            control_handle,
4012                        })
4013                    }
4014                    0x31c9d17b07c37ce4 => {
4015                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4016                        let mut req = fidl::new_empty!(
4017                            FlatlandSetHitRegionsRequest,
4018                            fidl::encoding::DefaultFuchsiaResourceDialect
4019                        );
4020                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetHitRegionsRequest>(&header, _body_bytes, handles, &mut req)?;
4021                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4022                        Ok(FlatlandRequest::SetHitRegions {
4023                            transform_id: req.transform_id,
4024                            regions: req.regions,
4025
4026                            control_handle,
4027                        })
4028                    }
4029                    0x26d81af852d29562 => {
4030                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4031                        let mut req = fidl::new_empty!(
4032                            FlatlandSetInfiniteHitRegionRequest,
4033                            fidl::encoding::DefaultFuchsiaResourceDialect
4034                        );
4035                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetInfiniteHitRegionRequest>(&header, _body_bytes, handles, &mut req)?;
4036                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4037                        Ok(FlatlandRequest::SetInfiniteHitRegion {
4038                            transform_id: req.transform_id,
4039                            hit_test: req.hit_test,
4040
4041                            control_handle,
4042                        })
4043                    }
4044                    0x2485fbcab7f943c => {
4045                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4046                        let mut req = fidl::new_empty!(
4047                            FlatlandCreateViewportRequest,
4048                            fidl::encoding::DefaultFuchsiaResourceDialect
4049                        );
4050                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandCreateViewportRequest>(&header, _body_bytes, handles, &mut req)?;
4051                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4052                        Ok(FlatlandRequest::CreateViewport {
4053                            viewport_id: req.viewport_id,
4054                            token: req.token,
4055                            properties: req.properties,
4056                            child_view_watcher: req.child_view_watcher,
4057
4058                            control_handle,
4059                        })
4060                    }
4061                    0x26fae823c4ebedad => {
4062                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4063                        let mut req = fidl::new_empty!(
4064                            FlatlandCreateImageRequest,
4065                            fidl::encoding::DefaultFuchsiaResourceDialect
4066                        );
4067                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandCreateImageRequest>(&header, _body_bytes, handles, &mut req)?;
4068                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4069                        Ok(FlatlandRequest::CreateImage {
4070                            image_id: req.image_id,
4071                            import_token: req.import_token,
4072                            vmo_index: req.vmo_index,
4073                            properties: req.properties,
4074
4075                            control_handle,
4076                        })
4077                    }
4078                    0x8039391d715eb28 => {
4079                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4080                        let mut req = fidl::new_empty!(
4081                            FlatlandSetImageSampleRegionRequest,
4082                            fidl::encoding::DefaultFuchsiaResourceDialect
4083                        );
4084                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetImageSampleRegionRequest>(&header, _body_bytes, handles, &mut req)?;
4085                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4086                        Ok(FlatlandRequest::SetImageSampleRegion {
4087                            image_id: req.image_id,
4088                            rect: req.rect,
4089
4090                            control_handle,
4091                        })
4092                    }
4093                    0x766cf99a2ec58446 => {
4094                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4095                        let mut req = fidl::new_empty!(
4096                            FlatlandSetImageDestinationSizeRequest,
4097                            fidl::encoding::DefaultFuchsiaResourceDialect
4098                        );
4099                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetImageDestinationSizeRequest>(&header, _body_bytes, handles, &mut req)?;
4100                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4101                        Ok(FlatlandRequest::SetImageDestinationSize {
4102                            image_id: req.image_id,
4103                            size: req.size,
4104
4105                            control_handle,
4106                        })
4107                    }
4108                    0x10f5da1356275b7b => {
4109                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4110                        let mut req = fidl::new_empty!(
4111                            FlatlandSetImageBlendingFunctionRequest,
4112                            fidl::encoding::DefaultFuchsiaResourceDialect
4113                        );
4114                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetImageBlendingFunctionRequest>(&header, _body_bytes, handles, &mut req)?;
4115                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4116                        Ok(FlatlandRequest::SetImageBlendingFunction {
4117                            image_id: req.image_id,
4118                            blend_mode: req.blend_mode,
4119
4120                            control_handle,
4121                        })
4122                    }
4123                    0x5b1667f130c3de67 => {
4124                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4125                        let mut req = fidl::new_empty!(
4126                            FlatlandSetImageBlendModeRequest,
4127                            fidl::encoding::DefaultFuchsiaResourceDialect
4128                        );
4129                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetImageBlendModeRequest>(&header, _body_bytes, handles, &mut req)?;
4130                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4131                        Ok(FlatlandRequest::SetImageBlendMode {
4132                            image_id: req.image_id,
4133                            blend_mode: req.blend_mode,
4134
4135                            control_handle,
4136                        })
4137                    }
4138                    0x2da9e4ef4c2cff6f => {
4139                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4140                        let mut req = fidl::new_empty!(
4141                            FlatlandSetImageOpacityRequest,
4142                            fidl::encoding::DefaultFuchsiaResourceDialect
4143                        );
4144                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetImageOpacityRequest>(&header, _body_bytes, handles, &mut req)?;
4145                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4146                        Ok(FlatlandRequest::SetImageOpacity {
4147                            image_id: req.image_id,
4148                            val: req.val,
4149
4150                            control_handle,
4151                        })
4152                    }
4153                    0x21b20f2c14aae6bc => {
4154                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4155                        let mut req = fidl::new_empty!(
4156                            FlatlandSetImageFlipRequest,
4157                            fidl::encoding::DefaultFuchsiaResourceDialect
4158                        );
4159                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetImageFlipRequest>(&header, _body_bytes, handles, &mut req)?;
4160                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4161                        Ok(FlatlandRequest::SetImageFlip {
4162                            image_id: req.image_id,
4163                            flip: req.flip,
4164
4165                            control_handle,
4166                        })
4167                    }
4168                    0x5e62355abc1c4c5d => {
4169                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4170                        let mut req = fidl::new_empty!(
4171                            FlatlandCreateFilledRectRequest,
4172                            fidl::encoding::DefaultFuchsiaResourceDialect
4173                        );
4174                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandCreateFilledRectRequest>(&header, _body_bytes, handles, &mut req)?;
4175                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4176                        Ok(FlatlandRequest::CreateFilledRect {
4177                            rect_id: req.rect_id,
4178
4179                            control_handle,
4180                        })
4181                    }
4182                    0x32d6ef41e182dfa5 => {
4183                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4184                        let mut req = fidl::new_empty!(
4185                            FlatlandSetSolidFillRequest,
4186                            fidl::encoding::DefaultFuchsiaResourceDialect
4187                        );
4188                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetSolidFillRequest>(&header, _body_bytes, handles, &mut req)?;
4189                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4190                        Ok(FlatlandRequest::SetSolidFill {
4191                            rect_id: req.rect_id,
4192                            color: req.color,
4193                            size: req.size,
4194
4195                            control_handle,
4196                        })
4197                    }
4198                    0x7392cabe45618f9b => {
4199                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4200                        let mut req = fidl::new_empty!(
4201                            FlatlandReleaseFilledRectRequest,
4202                            fidl::encoding::DefaultFuchsiaResourceDialect
4203                        );
4204                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandReleaseFilledRectRequest>(&header, _body_bytes, handles, &mut req)?;
4205                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4206                        Ok(FlatlandRequest::ReleaseFilledRect {
4207                            rect_id: req.rect_id,
4208
4209                            control_handle,
4210                        })
4211                    }
4212                    0x4ed2cfc0ce130862 => {
4213                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4214                        let mut req = fidl::new_empty!(
4215                            FlatlandSetContentRequest,
4216                            fidl::encoding::DefaultFuchsiaResourceDialect
4217                        );
4218                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetContentRequest>(&header, _body_bytes, handles, &mut req)?;
4219                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4220                        Ok(FlatlandRequest::SetContent {
4221                            transform_id: req.transform_id,
4222                            content_id: req.content_id,
4223
4224                            control_handle,
4225                        })
4226                    }
4227                    0x66ab67e9608ddb9f => {
4228                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4229                        let mut req = fidl::new_empty!(
4230                            FlatlandSetViewportPropertiesRequest,
4231                            fidl::encoding::DefaultFuchsiaResourceDialect
4232                        );
4233                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetViewportPropertiesRequest>(&header, _body_bytes, handles, &mut req)?;
4234                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4235                        Ok(FlatlandRequest::SetViewportProperties {
4236                            viewport_id: req.viewport_id,
4237                            properties: req.properties,
4238
4239                            control_handle,
4240                        })
4241                    }
4242                    0xab9328419451c22 => {
4243                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4244                        let mut req = fidl::new_empty!(
4245                            FlatlandReleaseTransformRequest,
4246                            fidl::encoding::DefaultFuchsiaResourceDialect
4247                        );
4248                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandReleaseTransformRequest>(&header, _body_bytes, handles, &mut req)?;
4249                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4250                        Ok(FlatlandRequest::ReleaseTransform {
4251                            transform_id: req.transform_id,
4252
4253                            control_handle,
4254                        })
4255                    }
4256                    0x5b35aab9baffecae => {
4257                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4258                        let mut req = fidl::new_empty!(
4259                            fidl::encoding::EmptyPayload,
4260                            fidl::encoding::DefaultFuchsiaResourceDialect
4261                        );
4262                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
4263                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4264                        Ok(FlatlandRequest::ReleaseView { control_handle })
4265                    }
4266                    0xbad474aeb5293f9 => {
4267                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4268                        let mut req = fidl::new_empty!(
4269                            FlatlandReleaseViewportRequest,
4270                            fidl::encoding::DefaultFuchsiaResourceDialect
4271                        );
4272                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandReleaseViewportRequest>(&header, _body_bytes, handles, &mut req)?;
4273                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4274                        Ok(FlatlandRequest::ReleaseViewport {
4275                            viewport_id: req.viewport_id,
4276
4277                            responder: FlatlandReleaseViewportResponder {
4278                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4279                                tx_id: header.tx_id,
4280                            },
4281                        })
4282                    }
4283                    0xb884ffdbc72c111 => {
4284                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4285                        let mut req = fidl::new_empty!(
4286                            FlatlandReleaseImageRequest,
4287                            fidl::encoding::DefaultFuchsiaResourceDialect
4288                        );
4289                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandReleaseImageRequest>(&header, _body_bytes, handles, &mut req)?;
4290                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4291                        Ok(FlatlandRequest::ReleaseImage { image_id: req.image_id, control_handle })
4292                    }
4293                    0x4ec8817c02828c3e => {
4294                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4295                        let mut req = fidl::new_empty!(
4296                            fidl::encoding::EmptyPayload,
4297                            fidl::encoding::DefaultFuchsiaResourceDialect
4298                        );
4299                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
4300                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4301                        Ok(FlatlandRequest::Clear { control_handle })
4302                    }
4303                    0x46a8b397e68a8888 => {
4304                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4305                        let mut req = fidl::new_empty!(
4306                            FlatlandSetDebugNameRequest,
4307                            fidl::encoding::DefaultFuchsiaResourceDialect
4308                        );
4309                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetDebugNameRequest>(&header, _body_bytes, handles, &mut req)?;
4310                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4311                        Ok(FlatlandRequest::SetDebugName { name: req.name, control_handle })
4312                    }
4313                    _ => Err(fidl::Error::UnknownOrdinal {
4314                        ordinal: header.ordinal,
4315                        protocol_name:
4316                            <FlatlandMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4317                    }),
4318                }))
4319            },
4320        )
4321    }
4322}
4323
4324/// Each Flatland instance contains a Graph, which consists of a set of objects, and the
4325/// relationships between those objects. The client can specify a subset of those objects
4326/// (specifically, the directed acyclic graph starting at the root transform) to be presented as
4327/// content to some kind of output -- usually, a display.
4328///
4329/// Flatland Graphs are both hierarchical, and distributed. Graphs from different Flatland instances
4330/// may be connected together, allowing multiple processes to be involved in authoring content for a
4331/// particular output.
4332///
4333/// All functions in this protocol are feed-forward. The operations they represent are not fully
4334/// executed until [`Present`] is called.
4335#[derive(Debug)]
4336pub enum FlatlandRequest {
4337    /// Releases an image immediately, without waiting for the next present.
4338    ReleaseImageImmediately {
4339        image_id: ContentId,
4340        control_handle: FlatlandControlHandle,
4341    },
4342    /// Complete execution of all feed-forward operations.
4343    ///
4344    /// If executing an operation produces an error (e.g., CreateTransform(0)), an [`OnError`] event
4345    /// is emitted. Operations that produce errors are ignored and the channel is closed.
4346    ///
4347    /// If the execution is completed successfully, [`OnNextFrameBegin`] emits NO_ERROR along
4348    /// with other valid fields.
4349    ///
4350    /// The client may only call [`Present`] when they have a non-zero number of present credits,
4351    /// which are tracked by the server. The server may increment the number of credits when it
4352    /// fires the [`OnNextFrameBegin`] event, which informs the client when it receives additional
4353    /// present credits. Each [`Present`] call uses one present credit and decrements the server
4354    /// count by one. If the client calls [`Present`] with no present credits, the server will
4355    /// return a `NO_PRESENTS_REMAINING` error.
4356    ///
4357    /// The client should assume that prior to receiving any [`OnNextFrameBegin`] events, they have
4358    /// one present credit.
4359    ///
4360    /// Every [`Present`] call results in one [`OnNextFrameBegin`] event, and one
4361    /// [`OnFramePresented`] event, typically in that order.
4362    ///
4363    /// When the commands flushed by [`Present`] make it to display, an [`OnFramePresented`] event
4364    /// is fired. This event includes information pertaining to all [`Present`]s that had content
4365    /// that were part of that frame.
4366    ///
4367    /// See [`fuchsia.ui.composition/PresentArgs`] documentation above for more detailed information
4368    /// on what arguments are passed in and their role.
4369    Present {
4370        args: PresentArgs,
4371        control_handle: FlatlandControlHandle,
4372    },
4373    /// Two Flatland instances may be connected in a parent-child relationship. The parent endpoint
4374    /// is held in a Viewport, and the child endpoint is held in a View. The parent Flatland
4375    /// instance that creates a Viewport has control over how the child's View is integrated into
4376    /// its own View.
4377    ///
4378    /// The lifecycle of a parent-child connection starts with two endpoints of a channel object:
4379    /// a ViewportCreationToken and a ViewCreationToken. Out-of-band protocols pass the
4380    /// ViewportCreationToken to the parent, which calls [`CreateViewport`], and the
4381    /// ViewCreationToken to the child, which calls [`CreateView`].
4382    ///
4383    /// Only nodes connected to the Root Transform in this Flatland instance will be rendered into
4384    /// the parent's Viewport.
4385    ///
4386    /// Calling [`CreateView`] a second time will disconnect the Root Transform from the existing
4387    /// parent's Viewport, and attach it to a new parent's Viewport. In other words, each View can
4388    /// only have one parent.
4389    ///
4390    /// This function is queued, meaning that the Root Transform will not be attached to the
4391    /// parent Viewport until [`Present`] is called. However, clients will receive information
4392    /// through their ParentViewportWatcher (e.g., LayoutInfo) immediately after calling this
4393    /// function, even if they have not called [`Present`] or [`SetRootTransform`]. This allows
4394    /// clients to wait for layout information from their parent before calling [`Present`].
4395    ///
4396    /// Any illegal operations on ParentViewportWatcher will cause both ParentViewportWatcher
4397    /// channel and this Flatland channel to be torn down.
4398    ///
4399    /// Lifecycle note. The lifetime of the ParentViewportWatcher channel is bound by the peer
4400    /// ViewportCreationToken. When the ViewportCreationToken dies, this ParentViewportWatcher
4401    /// channel is destroyed.
4402    ///
4403    /// Views and subgraphs of Views created using `CreateView` will not be represented in the
4404    /// ViewTree, and hence will not be able to participate in any ViewTree-dependent interactions
4405    /// such as touch, mouse or focus.
4406    /// The Flatland protocol provides no way for Views in the subgraph of a View created with
4407    /// `CreateView` to know that they are excluded from the ViewTree.
4408    CreateView {
4409        token: fidl_fuchsia_ui_views::ViewCreationToken,
4410        parent_viewport_watcher: fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>,
4411        control_handle: FlatlandControlHandle,
4412    },
4413    /// Identical to [`CreateView`], except it allows association of View identity (ViewRef) and
4414    /// view-bound protocols.
4415    CreateView2 {
4416        token: fidl_fuchsia_ui_views::ViewCreationToken,
4417        view_identity: fidl_fuchsia_ui_views::ViewIdentityOnCreation,
4418        protocols: ViewBoundProtocols,
4419        parent_viewport_watcher: fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>,
4420        control_handle: FlatlandControlHandle,
4421    },
4422    /// Creates a new Transform node. Transforms are a hierarchical piece of a Flatland graph. They
4423    /// can have children, and can reference Content. A sub-graph represented by a Transform and its
4424    /// descendants can be rendered to a display.
4425    ///
4426    /// Transforms are kept alive, even when released, as long as they are children of either an
4427    /// unreleased Transform, or the Root Transform.
4428    ///
4429    /// Each Transform can have a single piece of attached Content. Common types of Content include
4430    /// bitmaps, asynchronous streams of images, and Viewports to Views hosted in other Flatland
4431    /// instances.
4432    ///
4433    /// Transforms have attributes. Child Transforms inherit the combined attributes of their
4434    /// parents. Content attached to a Transform is also affected by that Transform's attributes.
4435    ///
4436    /// When a sub-graph of Transforms is rendered, Content will be rendered back-to-front, starting
4437    /// with the Content on the root transform, and continuing recursively through all of its child
4438    /// Transforms in the order the children were added. See [`AddChild`] for more information.
4439    ///
4440    /// Zero is not a valid transform id. All other values are valid, assuming they are not already
4441    /// in use (see [`ReleaseTransform`] for more details).
4442    CreateTransform {
4443        transform_id: TransformId,
4444        control_handle: FlatlandControlHandle,
4445    },
4446    /// All Transform objects support all attributes.
4447    ///
4448    /// Geometric attributes are applied in the following order:
4449    /// 1. Scale (relative to the parent transform's coordinate space)
4450    /// 2. Orientation (relative to the parent transform's coordinate space)
4451    /// 3. Translation (relative to the parent transforms's coordinate space,
4452    ///    unaffected by scale applied to the current transform).
4453    /// 4. Clipping (relative to the current transform's coordinate space)
4454    ///
4455    /// The effects of each of these attributes are cumulative. This means the transform's position
4456    /// in the view space, and its clip boundary, will be calculated based on that chain of
4457    /// geometric attributes going up to the root transform.
4458    ///
4459    /// For instance, in a nested hierarchy such as the following:
4460    ///     [Root-Transform -> Transform1 -> Transform2 -> CurrentTransform]
4461    /// If Transform1 is translated by [2,0] and Transform2 is translated by [0,1] then the
4462    /// view-space position of CurrentTransform will be [2,1].
4463    ///
4464    /// Sets the translation on a Transform. The order of geometric attribute application is
4465    /// addressed above.
4466    SetTranslation {
4467        transform_id: TransformId,
4468        translation: fidl_fuchsia_math::Vec_,
4469        control_handle: FlatlandControlHandle,
4470    },
4471    /// Sets the orientation on a Transform. The order of geometric attribute application is
4472    /// addressed in the documentation for [`SetTranslation`]. In Flatland, the +X axis is
4473    /// to the right and the +Y axis is down. There is no notion of a Z axis. CCW is defined
4474    /// from the POV of the user, as if a skeuomorphoic clock is displayed on the screen.
4475    SetOrientation {
4476        transform_id: TransformId,
4477        orientation: Orientation,
4478        control_handle: FlatlandControlHandle,
4479    },
4480    /// Sets the scale on a transform. The order of geometric attribute application is
4481    /// addressed above. The (x,y) values in the VecF |scale| refer to the scale factor in the
4482    /// x-axis (width) and y-axis (height) respectively. Scale values must be normal 32-bit
4483    /// floating point values: https://en.wikipedia.org/wiki/Normal_number_%28computing%29
4484    SetScale {
4485        transform_id: TransformId,
4486        scale: fidl_fuchsia_math::VecF,
4487        control_handle: FlatlandControlHandle,
4488    },
4489    /// Sets an opacity in linear space to be applied to a transform and its descendents,
4490    /// which include other transforms and content. Opacity values must be in the range
4491    /// of [0.0, 1.0], where 0.0 is completely transparent and 1.0 is completely opaque.
4492    /// Attempting to call this function with values outside that range will result in
4493    /// an error. A transform's opacity value is multiplied with that of its parent. This
4494    /// effect works differently from group opacity. Using group opacity, child nodes are
4495    /// rendered together first, and then have the parent's opacity applied as a post-effect.
4496    /// Here, opacity is applied to each child individually. This may result in a very
4497    /// different effect.
4498    SetOpacity {
4499        transform_id: TransformId,
4500        value: f32,
4501        control_handle: FlatlandControlHandle,
4502    },
4503    /// Sets the bounds, expressed in the local coordinate space of the transform, that
4504    /// constrains the region that content attached to this transform can be rendered to.
4505    /// If the content's area exceeds the clip bounds, the area outside the bounds will
4506    /// not be rendered. These bounds are valid for all children of this transform node as
4507    /// well, which includes nested Flatland instances and their node hierarchies.
4508    /// If a child transform attempts to set clip bounds larger than that of its parent,
4509    /// it will be clipped to the parent's clip bounds. The default state is for a transform
4510    /// to be unclipped, meaning it will not have any bounds placed on its render region.
4511    /// The clip width/height must be positive. Negative values will result in an error.
4512    /// Passing in an empty box to the |rect| parameter will remove the clip bounds.
4513    SetClipBoundary {
4514        transform_id: TransformId,
4515        rect: Option<Box<fidl_fuchsia_math::Rect>>,
4516        control_handle: FlatlandControlHandle,
4517    },
4518    /// Adds a child Transform to a parent Transform. The new child Transform, and any Content
4519    /// attached to it or its children, will be rendered on top of the parent's Content, as well as
4520    /// any previously added children.
4521    AddChild {
4522        parent_transform_id: TransformId,
4523        child_transform_id: TransformId,
4524        control_handle: FlatlandControlHandle,
4525    },
4526    /// Removes a child Transform from a parent Transform.
4527    RemoveChild {
4528        parent_transform_id: TransformId,
4529        child_transform_id: TransformId,
4530        control_handle: FlatlandControlHandle,
4531    },
4532    /// Removes all child Transforms from a parent Transform and replaces them with the new child
4533    /// transforms in `new_child_transform_ids`.
4534    ReplaceChildren {
4535        parent_transform_id: TransformId,
4536        new_child_transform_ids: Vec<TransformId>,
4537        control_handle: FlatlandControlHandle,
4538    },
4539    /// Sets the Root Transform for the graph.
4540    ///
4541    /// The sub-graph defined by the Root Transform and its children will be rendered as View
4542    /// in the connected parent's Viewport (see [`CreateView`]). Any parents of the Root Transform
4543    /// in this Graph will be ignored.
4544    ///
4545    /// The Root Transform, and all children of the Root Transform, are kept alive if they are
4546    /// released (see [`ReleaseTransform`] for more details).
4547    ///
4548    /// There is only ever one Root. Since 0 is not a valid transform id (see [`CreateTransform`]),
4549    /// calling SetRootTransform(0) clears the current Root, destroying any previously released
4550    /// objects that are not referenced by the new root.
4551    ///
4552    /// Note that every View has a clip boundary equivalent to its logical size. Anything outside
4553    /// that clip boundary will not be rendered. Hence, the Root Transform has a useful coordinate
4554    /// space of (0, 0) to (logical_size.width, logical_size.height), where (0, 0) is the upper left
4555    /// corner.
4556    ///
4557    /// Setting the root transform installs a full screen hit region on the root transform. Clients
4558    /// may remove this hit region if they don't want users to be able to interact with the root
4559    /// transform's content. For additional details on hit regions, see the [`SetHitRegions`]
4560    /// documentation.
4561    ///
4562    /// Default hit region rules
4563    ///
4564    ///   A default hit region follows these rules:
4565    ///   - When [`SetRootTransform`](T) is called, T receives a maximal hit region, covering the
4566    ///   entire view.
4567    ///   - If [`SetHitRegions`] is called on T, either before or after [`SetRootTransform`](T),
4568    ///   then no default hit region is active and the client specified hit regions are used.
4569    ///   - If a transform is no longer the root transform, i.e., [`SetRootTransform`](U) is
4570    ///   called, then the original transform no longer has its default hit region.
4571    ///   - Clients can remove or modify the root transform's hit regions the same way they would
4572    ///   reset any other transform's hit regions, by calling [`SetHitRegions`] with the appropriate
4573    ///   vector.
4574    SetRootTransform {
4575        transform_id: TransformId,
4576        control_handle: FlatlandControlHandle,
4577    },
4578    /// Sets the interactive areas for a Transform. By default, Content is not interactive; hit
4579    /// regions must be placed for a user to interact with the Content in a View. Because hit
4580    /// regions are described in the Flatland protocol, a Flatland instance can synchronize Content
4581    /// and hit regions.
4582    ///
4583    /// Each hit region is placed in the coordinate space of the owning Transform, and may or may
4584    /// not interact with different types of hit testing, depending on its [`HitTestInteraction`]
4585    /// type. When there are multiple hit regions that intersect with a hit test, the precedence
4586    /// rules given below dictate which hit region has interacted with the hit test. Only Transforms
4587    /// that transitively connect to the root Transform have their hit regions interact with a hit
4588    /// test.
4589    ///
4590    /// Calling this function replaces any previous values set on this Transform. To reset a
4591    /// Transform to "no hit testing": send an empty vector with [`SetHitRegions`].
4592    ///
4593    /// Note that root transforms get a default hit region installed by Flatland. For more details,
4594    /// see the [`SetRootTransform`] documentation.
4595    ///
4596    /// Precedence rules
4597    ///   Within a Transform, if multiple hit regions overlap, the hit test examines each
4598    ///   intersecting hit region for a possible interaction. Thus, for a regular hit test R and an
4599    ///   accessibility hit test A, where R and A both intersect two hit regions D ([`DEFAULT`]) and
4600    ///   S ([`SEMANTICALLY_INVISIBLE`]) on the same Transform, (1) R interacts with both D and S,
4601    ///   and (2) A only interacts with D. Generally, hit regions that overlap in a single Transform
4602    ///   can cause confusing behavior.
4603    ///
4604    ///   Within a View, for a given hit test, the front-most Transform's hit regions take
4605    ///   precedence over those behind. This follows the expected reverse "render order" of
4606    ///   Transforms (described in [`CreateTransform`]), where a user expects to interact with
4607    ///   Content that is visible, or front-most.
4608    ///
4609    ///   Across Flatland instances, for a given hit test, the front-most instance's front-most
4610    ///   Transform's hit regions take precedence over those behind. This follows the expected
4611    ///   reverse "render order" of views, where a user expects to interact with the View that is
4612    ///   visible, or front-most. For example, if a child View owns Content that is rendered over
4613    ///   the parent View, the user expects to interact with the child's Content.
4614    SetHitRegions {
4615        transform_id: TransformId,
4616        regions: Vec<HitRegion>,
4617        control_handle: FlatlandControlHandle,
4618    },
4619    /// Identical to [`SetHitRegions`], except the hit region associated with [`transform_id`]
4620    /// covers an infinite region. The hit region is invariant against translation, scaling, and
4621    /// orientation of the Transform.
4622    ///
4623    /// An infinite hit region is still limited in extent by the View's clip boundary, just like a
4624    /// finite hit region.
4625    ///
4626    /// Calling this function replaces any previous values set on this Transform. To reset a
4627    /// Transform to "no hit testing": send an empty vector with [`SetHitRegions`].
4628    SetInfiniteHitRegion {
4629        transform_id: TransformId,
4630        hit_test: HitTestInteraction,
4631        control_handle: FlatlandControlHandle,
4632    },
4633    /// The Viewport and View pair, together, represent the connection between two Flatland
4634    /// instances. The Viewport is created in the parent, and the View is created in the child. The
4635    /// parent has control over how the child's View is integrated into its own View.
4636    ///
4637    /// Any illegal operations on ChildViewWatcher will cause both ChildViewWatcher channel and this
4638    /// Flatland channel to be torn down.
4639    ///
4640    /// `ViewportProperties` must have logical_size set. This is the initial size that will drive
4641    /// the layout of the child. The logical_size is also used as the default Content size, but
4642    /// subsequent changes to the logical_size will have no effect on the Content size.
4643    ///
4644    /// `ViewportProperties` may have inset field not set. In that case, the default value of
4645    /// (0, 0, 0, 0) is used.
4646    ///
4647    /// The logical_size must have positive X and Y components.
4648    ///
4649    /// Zero is not a valid ContentId. All other values are valid, assuming they are not already
4650    /// in use for another piece of Content (see [`ReleaseViewport`] for more details).
4651    ///
4652    /// Lifecycle note. The lifetime of the ChildViewWatcher channel is bound by the peer
4653    /// ViewCreationToken. When the ViewCreationToken dies, this ChildViewWatcher channel is
4654    /// destroyed.
4655    CreateViewport {
4656        viewport_id: ContentId,
4657        token: fidl_fuchsia_ui_views::ViewportCreationToken,
4658        properties: ViewportProperties,
4659        child_view_watcher: fidl::endpoints::ServerEnd<ChildViewWatcherMarker>,
4660        control_handle: FlatlandControlHandle,
4661    },
4662    /// An Image is a bitmap backed by a specific VMO in a BufferCollection.
4663    ///
4664    /// Image creation requires an allocated BufferCollection registered with Allocator. This
4665    /// function will fail unless all clients of the specified BufferCollection have set their
4666    /// constraints.
4667    ///
4668    /// The Image must reference a valid VMO index and must have ImageProperties that fall within
4669    /// the constraints specified by the backing BufferCollection (i.e. width and height within a
4670    /// valid range, etc.)
4671    ///
4672    /// Zero is not a valid Image id. All other values are valid, assuming they are not already in
4673    /// use for another piece of Content (see [`ReleaseImage`] for more details).
4674    CreateImage {
4675        image_id: ContentId,
4676        import_token: BufferCollectionImportToken,
4677        vmo_index: u32,
4678        properties: ImageProperties,
4679        control_handle: FlatlandControlHandle,
4680    },
4681    /// This function is used to determine the region (in texel space) of an image that will be used
4682    /// by Flatland when rendering. The image to be sampled is referenced by [`image_id`] and the
4683    /// sample region is specified by [`rect`] which itself is comprised of an origin point (x,y) as
4684    /// well as a width and height, in unnormalized coordinates. It is illegal to call this function
4685    /// on non-image content, or to sample a region outside of the texel space of the image. In
4686    /// other words, the region specifed by [`rect`] must not exceed the ranges (0, image_width) and
4687    /// (0, image_height). If (rect.x + rect.width > image_width) or (rect.y + rect.height >
4688    /// image_height) or if any of the values are negative, this will result in an error.
4689    ///
4690    /// If this method is not called, the default sample region is the rectangle with origin at
4691    /// (0, 0) and width and height set at ImageProperties from [`CreateImage`].
4692    SetImageSampleRegion {
4693        image_id: ContentId,
4694        rect: fidl_fuchsia_math::RectF,
4695        control_handle: FlatlandControlHandle,
4696    },
4697    /// The content size for an Image is the size of the rectangle in the parent's logical
4698    /// coordinate space that the image occupies. This combined with the global translation of the
4699    /// transform it is attached to determines the size and location of where the content is
4700    /// rendered on the display.
4701    ///
4702    /// If this method is not called, the default image destination size is the width and height set
4703    /// at ImageProperties from [`CreateImage`]. The destination size will be affected by scaling if
4704    /// [`SetScale`] is used on the attached Transform or its parents.
4705    SetImageDestinationSize {
4706        image_id: ContentId,
4707        size: fidl_fuchsia_math::SizeU,
4708        control_handle: FlatlandControlHandle,
4709    },
4710    /// Determines the blend function to use when rendering the content specified by
4711    /// |image_id|. |image_id| must be a valid ContentId associated to a transform through
4712    /// a call to |CreateImage| or |CreateFilledRect|. For details on the different blend functions
4713    /// that are available, please refer to the BlendMode enum. If this function is not called, then
4714    /// the default blendmode is BlendMode::SRC.
4715    SetImageBlendingFunction {
4716        image_id: ContentId,
4717        blend_mode: BlendMode,
4718        control_handle: FlatlandControlHandle,
4719    },
4720    /// Determines the blend function to use when rendering the content specified by
4721    /// |image_id|. |image_id| must be a valid ContentId associated to a transform through
4722    /// a call to |CreateImage| or |CreateFilledRect|. For details on the different blend functions
4723    /// that are available, please refer to the BlendMode2 enum. If this function is not called,
4724    /// the default blendmode is BlendMode2::REPLACE.
4725    SetImageBlendMode {
4726        image_id: ContentId,
4727        blend_mode: BlendMode2,
4728        control_handle: FlatlandControlHandle,
4729    },
4730    /// Sets an opacity in linear space to be applied to a flatland image. Opacity values must
4731    /// be in the range [0.0, 1.0].
4732    SetImageOpacity {
4733        image_id: ContentId,
4734        val: f32,
4735        control_handle: FlatlandControlHandle,
4736    },
4737    /// Sets the image flip to be applied to a flatland image. This call must be performed after a
4738    /// successful |CreateImage| call. If an invalid |image_id| is supplied, the channel will be
4739    /// closed due to FlatlandError::BAD_OPERATION. This flip will be applied to the Image before
4740    /// parent Transform Orientations. If this function is not called, then the default flip value
4741    /// is ImageFlip::NONE.
4742    SetImageFlip {
4743        image_id: ContentId,
4744        flip: ImageFlip,
4745        control_handle: FlatlandControlHandle,
4746    },
4747    /// Creates a solid-color rectangle. By default a filled-rect does not have a defined
4748    /// color or size. It is necessary to call |SetSolidFill| to specify a color and size
4749    /// before a filled rect can be used for rendering. Not doing so will result the
4750    CreateFilledRect {
4751        rect_id: ContentId,
4752        control_handle: FlatlandControlHandle,
4753    },
4754    /// Defines the color and size of a filled rect. |rect_id| must refer to content that
4755    /// was created via a call to CreateFilledRect. The color is not premultiplied. Color values
4756    /// must be within the range [0,1] inclusive, and normal 32-bit
4757    /// floating point values: https://en.wikipedia.org/wiki/Normal_number_%28computing%29. Values
4758    /// that do not conform to these specifications will cause the channel to close.
4759    /// The rectangle's top left corner will be at (0, 0) in its transform's coordinate space.
4760    /// Hence, its bottom right corner will be at (size.width, size.height).
4761    SetSolidFill {
4762        rect_id: ContentId,
4763        color: ColorRgba,
4764        size: fidl_fuchsia_math::SizeU,
4765        control_handle: FlatlandControlHandle,
4766    },
4767    /// Automatically garbage collects the rectangle when it is no longer needed for
4768    /// rendering. |rect_id| must have been instantiated with a call to
4769    /// |CreateFilledRect|. Once released, the ID immediately goes out of scope and is free
4770    /// to be used again.
4771    ReleaseFilledRect {
4772        rect_id: ContentId,
4773        control_handle: FlatlandControlHandle,
4774    },
4775    /// Setting a piece of Content on a Transform makes that Content visible in the render tree as
4776    /// long as the Transform is visible from the root Transform. The Content will be rendered
4777    /// before, and therefore "behind", any Content attached to the descendants of the Transform.
4778    ///
4779    /// Because each Transform can have, at most, a single piece of Content on it, calling this
4780    /// function on a Transform that already has Content will replace that Content.
4781    ///
4782    /// A Content may be set on more than one Transform.
4783    ///
4784    /// Calling this function with a Content id of 0 will remove any Content currently on the
4785    /// Transform.
4786    SetContent {
4787        transform_id: TransformId,
4788        content_id: ContentId,
4789        control_handle: FlatlandControlHandle,
4790    },
4791    /// Transforms are usually sufficient to change how Content is presented. Viewports, however,
4792    /// have special properties that are not part of the Transform hierarchy. Those properties can
4793    /// be set using this function.
4794    SetViewportProperties {
4795        viewport_id: ContentId,
4796        properties: ViewportProperties,
4797        control_handle: FlatlandControlHandle,
4798    },
4799    /// Released Transforms will be garbage collected by the system once they are no longer
4800    /// necessary for rendering. For Transforms, this means there is no path from any unreleased
4801    /// Transform to the newly-released Transform.
4802    ///
4803    /// Once released, the id immediately goes out of scope for future function calls and can be
4804    /// reused when creating new Transforms.
4805    ///
4806    /// It is an error to call functions with a released id (unless that id has been reused to
4807    /// construct a new Transform).
4808    ReleaseTransform {
4809        transform_id: TransformId,
4810        control_handle: FlatlandControlHandle,
4811    },
4812    ReleaseView {
4813        control_handle: FlatlandControlHandle,
4814    },
4815    /// Releases a Viewport from the scene, even if the Viewport is still connected to a Transform.
4816    /// Unlike other resources, Viewports are garbage collected by the system during the next
4817    /// [`Present`] because a removed Viewport is guaranteed to provide no renderable content.
4818    ///
4819    /// Use SetContent(transform_id, 0) to clean up references to released Viewports.
4820    ///
4821    /// Despite having a return type, this function is still feed-forward like [`CreateView`] and
4822    /// requires a call to [`Present`] to be executed. The ViewportCreationToken will be returned
4823    /// after the presented operations have been executed.
4824    ReleaseViewport {
4825        viewport_id: ContentId,
4826        responder: FlatlandReleaseViewportResponder,
4827    },
4828    /// Released Images will be garbage collected by the system once they are no longer necessary
4829    /// for rendering. For Images, this means the Image is no longer attached to any Transform and
4830    /// any pending rendering that references the Image is complete.
4831    ///
4832    /// Use SetContent(transform_id, 0) to clean up references to released Images.
4833    ///
4834    /// Once released, the id immediately goes out of scope for future function calls and can be
4835    /// reused when creating new Images.
4836    ///
4837    /// It is an error to call functions with a released id (unless that id has been reused to
4838    /// construct a new Image).
4839    ReleaseImage {
4840        image_id: ContentId,
4841        control_handle: FlatlandControlHandle,
4842    },
4843    /// This function will reset all state on this interface. This includes destroying all existing
4844    /// View and Viewports without returning the associated Token to the caller.
4845    Clear {
4846        control_handle: FlatlandControlHandle,
4847    },
4848    /// Set debug name of the current client that can be used by Flatland to print as a prefix to
4849    /// logs to help client distinguish what is theirs. [`name`] can be an arbitrary string, but the
4850    /// current process name (see fsl::GetCurrentProcessName()) is a good default.
4851    SetDebugName {
4852        name: String,
4853        control_handle: FlatlandControlHandle,
4854    },
4855}
4856
4857impl FlatlandRequest {
4858    #[allow(irrefutable_let_patterns)]
4859    pub fn into_release_image_immediately(self) -> Option<(ContentId, FlatlandControlHandle)> {
4860        if let FlatlandRequest::ReleaseImageImmediately { image_id, control_handle } = self {
4861            Some((image_id, control_handle))
4862        } else {
4863            None
4864        }
4865    }
4866
4867    #[allow(irrefutable_let_patterns)]
4868    pub fn into_present(self) -> Option<(PresentArgs, FlatlandControlHandle)> {
4869        if let FlatlandRequest::Present { args, control_handle } = self {
4870            Some((args, control_handle))
4871        } else {
4872            None
4873        }
4874    }
4875
4876    #[allow(irrefutable_let_patterns)]
4877    pub fn into_create_view(
4878        self,
4879    ) -> Option<(
4880        fidl_fuchsia_ui_views::ViewCreationToken,
4881        fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>,
4882        FlatlandControlHandle,
4883    )> {
4884        if let FlatlandRequest::CreateView { token, parent_viewport_watcher, control_handle } = self
4885        {
4886            Some((token, parent_viewport_watcher, control_handle))
4887        } else {
4888            None
4889        }
4890    }
4891
4892    #[allow(irrefutable_let_patterns)]
4893    pub fn into_create_view2(
4894        self,
4895    ) -> Option<(
4896        fidl_fuchsia_ui_views::ViewCreationToken,
4897        fidl_fuchsia_ui_views::ViewIdentityOnCreation,
4898        ViewBoundProtocols,
4899        fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>,
4900        FlatlandControlHandle,
4901    )> {
4902        if let FlatlandRequest::CreateView2 {
4903            token,
4904            view_identity,
4905            protocols,
4906            parent_viewport_watcher,
4907            control_handle,
4908        } = self
4909        {
4910            Some((token, view_identity, protocols, parent_viewport_watcher, control_handle))
4911        } else {
4912            None
4913        }
4914    }
4915
4916    #[allow(irrefutable_let_patterns)]
4917    pub fn into_create_transform(self) -> Option<(TransformId, FlatlandControlHandle)> {
4918        if let FlatlandRequest::CreateTransform { transform_id, control_handle } = self {
4919            Some((transform_id, control_handle))
4920        } else {
4921            None
4922        }
4923    }
4924
4925    #[allow(irrefutable_let_patterns)]
4926    pub fn into_set_translation(
4927        self,
4928    ) -> Option<(TransformId, fidl_fuchsia_math::Vec_, FlatlandControlHandle)> {
4929        if let FlatlandRequest::SetTranslation { transform_id, translation, control_handle } = self
4930        {
4931            Some((transform_id, translation, control_handle))
4932        } else {
4933            None
4934        }
4935    }
4936
4937    #[allow(irrefutable_let_patterns)]
4938    pub fn into_set_orientation(self) -> Option<(TransformId, Orientation, FlatlandControlHandle)> {
4939        if let FlatlandRequest::SetOrientation { transform_id, orientation, control_handle } = self
4940        {
4941            Some((transform_id, orientation, control_handle))
4942        } else {
4943            None
4944        }
4945    }
4946
4947    #[allow(irrefutable_let_patterns)]
4948    pub fn into_set_scale(
4949        self,
4950    ) -> Option<(TransformId, fidl_fuchsia_math::VecF, FlatlandControlHandle)> {
4951        if let FlatlandRequest::SetScale { transform_id, scale, control_handle } = self {
4952            Some((transform_id, scale, control_handle))
4953        } else {
4954            None
4955        }
4956    }
4957
4958    #[allow(irrefutable_let_patterns)]
4959    pub fn into_set_opacity(self) -> Option<(TransformId, f32, FlatlandControlHandle)> {
4960        if let FlatlandRequest::SetOpacity { transform_id, value, control_handle } = self {
4961            Some((transform_id, value, control_handle))
4962        } else {
4963            None
4964        }
4965    }
4966
4967    #[allow(irrefutable_let_patterns)]
4968    pub fn into_set_clip_boundary(
4969        self,
4970    ) -> Option<(TransformId, Option<Box<fidl_fuchsia_math::Rect>>, FlatlandControlHandle)> {
4971        if let FlatlandRequest::SetClipBoundary { transform_id, rect, control_handle } = self {
4972            Some((transform_id, rect, control_handle))
4973        } else {
4974            None
4975        }
4976    }
4977
4978    #[allow(irrefutable_let_patterns)]
4979    pub fn into_add_child(self) -> Option<(TransformId, TransformId, FlatlandControlHandle)> {
4980        if let FlatlandRequest::AddChild {
4981            parent_transform_id,
4982            child_transform_id,
4983            control_handle,
4984        } = self
4985        {
4986            Some((parent_transform_id, child_transform_id, control_handle))
4987        } else {
4988            None
4989        }
4990    }
4991
4992    #[allow(irrefutable_let_patterns)]
4993    pub fn into_remove_child(self) -> Option<(TransformId, TransformId, FlatlandControlHandle)> {
4994        if let FlatlandRequest::RemoveChild {
4995            parent_transform_id,
4996            child_transform_id,
4997            control_handle,
4998        } = self
4999        {
5000            Some((parent_transform_id, child_transform_id, control_handle))
5001        } else {
5002            None
5003        }
5004    }
5005
5006    #[allow(irrefutable_let_patterns)]
5007    pub fn into_replace_children(
5008        self,
5009    ) -> Option<(TransformId, Vec<TransformId>, FlatlandControlHandle)> {
5010        if let FlatlandRequest::ReplaceChildren {
5011            parent_transform_id,
5012            new_child_transform_ids,
5013            control_handle,
5014        } = self
5015        {
5016            Some((parent_transform_id, new_child_transform_ids, control_handle))
5017        } else {
5018            None
5019        }
5020    }
5021
5022    #[allow(irrefutable_let_patterns)]
5023    pub fn into_set_root_transform(self) -> Option<(TransformId, FlatlandControlHandle)> {
5024        if let FlatlandRequest::SetRootTransform { transform_id, control_handle } = self {
5025            Some((transform_id, control_handle))
5026        } else {
5027            None
5028        }
5029    }
5030
5031    #[allow(irrefutable_let_patterns)]
5032    pub fn into_set_hit_regions(
5033        self,
5034    ) -> Option<(TransformId, Vec<HitRegion>, FlatlandControlHandle)> {
5035        if let FlatlandRequest::SetHitRegions { transform_id, regions, control_handle } = self {
5036            Some((transform_id, regions, control_handle))
5037        } else {
5038            None
5039        }
5040    }
5041
5042    #[allow(irrefutable_let_patterns)]
5043    pub fn into_set_infinite_hit_region(
5044        self,
5045    ) -> Option<(TransformId, HitTestInteraction, FlatlandControlHandle)> {
5046        if let FlatlandRequest::SetInfiniteHitRegion { transform_id, hit_test, control_handle } =
5047            self
5048        {
5049            Some((transform_id, hit_test, control_handle))
5050        } else {
5051            None
5052        }
5053    }
5054
5055    #[allow(irrefutable_let_patterns)]
5056    pub fn into_create_viewport(
5057        self,
5058    ) -> Option<(
5059        ContentId,
5060        fidl_fuchsia_ui_views::ViewportCreationToken,
5061        ViewportProperties,
5062        fidl::endpoints::ServerEnd<ChildViewWatcherMarker>,
5063        FlatlandControlHandle,
5064    )> {
5065        if let FlatlandRequest::CreateViewport {
5066            viewport_id,
5067            token,
5068            properties,
5069            child_view_watcher,
5070            control_handle,
5071        } = self
5072        {
5073            Some((viewport_id, token, properties, child_view_watcher, control_handle))
5074        } else {
5075            None
5076        }
5077    }
5078
5079    #[allow(irrefutable_let_patterns)]
5080    pub fn into_create_image(
5081        self,
5082    ) -> Option<(ContentId, BufferCollectionImportToken, u32, ImageProperties, FlatlandControlHandle)>
5083    {
5084        if let FlatlandRequest::CreateImage {
5085            image_id,
5086            import_token,
5087            vmo_index,
5088            properties,
5089            control_handle,
5090        } = self
5091        {
5092            Some((image_id, import_token, vmo_index, properties, control_handle))
5093        } else {
5094            None
5095        }
5096    }
5097
5098    #[allow(irrefutable_let_patterns)]
5099    pub fn into_set_image_sample_region(
5100        self,
5101    ) -> Option<(ContentId, fidl_fuchsia_math::RectF, FlatlandControlHandle)> {
5102        if let FlatlandRequest::SetImageSampleRegion { image_id, rect, control_handle } = self {
5103            Some((image_id, rect, control_handle))
5104        } else {
5105            None
5106        }
5107    }
5108
5109    #[allow(irrefutable_let_patterns)]
5110    pub fn into_set_image_destination_size(
5111        self,
5112    ) -> Option<(ContentId, fidl_fuchsia_math::SizeU, FlatlandControlHandle)> {
5113        if let FlatlandRequest::SetImageDestinationSize { image_id, size, control_handle } = self {
5114            Some((image_id, size, control_handle))
5115        } else {
5116            None
5117        }
5118    }
5119
5120    #[allow(irrefutable_let_patterns)]
5121    pub fn into_set_image_blending_function(
5122        self,
5123    ) -> Option<(ContentId, BlendMode, FlatlandControlHandle)> {
5124        if let FlatlandRequest::SetImageBlendingFunction { image_id, blend_mode, control_handle } =
5125            self
5126        {
5127            Some((image_id, blend_mode, control_handle))
5128        } else {
5129            None
5130        }
5131    }
5132
5133    #[allow(irrefutable_let_patterns)]
5134    pub fn into_set_image_blend_mode(
5135        self,
5136    ) -> Option<(ContentId, BlendMode2, FlatlandControlHandle)> {
5137        if let FlatlandRequest::SetImageBlendMode { image_id, blend_mode, control_handle } = self {
5138            Some((image_id, blend_mode, control_handle))
5139        } else {
5140            None
5141        }
5142    }
5143
5144    #[allow(irrefutable_let_patterns)]
5145    pub fn into_set_image_opacity(self) -> Option<(ContentId, f32, FlatlandControlHandle)> {
5146        if let FlatlandRequest::SetImageOpacity { image_id, val, control_handle } = self {
5147            Some((image_id, val, control_handle))
5148        } else {
5149            None
5150        }
5151    }
5152
5153    #[allow(irrefutable_let_patterns)]
5154    pub fn into_set_image_flip(self) -> Option<(ContentId, ImageFlip, FlatlandControlHandle)> {
5155        if let FlatlandRequest::SetImageFlip { image_id, flip, control_handle } = self {
5156            Some((image_id, flip, control_handle))
5157        } else {
5158            None
5159        }
5160    }
5161
5162    #[allow(irrefutable_let_patterns)]
5163    pub fn into_create_filled_rect(self) -> Option<(ContentId, FlatlandControlHandle)> {
5164        if let FlatlandRequest::CreateFilledRect { rect_id, control_handle } = self {
5165            Some((rect_id, control_handle))
5166        } else {
5167            None
5168        }
5169    }
5170
5171    #[allow(irrefutable_let_patterns)]
5172    pub fn into_set_solid_fill(
5173        self,
5174    ) -> Option<(ContentId, ColorRgba, fidl_fuchsia_math::SizeU, FlatlandControlHandle)> {
5175        if let FlatlandRequest::SetSolidFill { rect_id, color, size, control_handle } = self {
5176            Some((rect_id, color, size, control_handle))
5177        } else {
5178            None
5179        }
5180    }
5181
5182    #[allow(irrefutable_let_patterns)]
5183    pub fn into_release_filled_rect(self) -> Option<(ContentId, FlatlandControlHandle)> {
5184        if let FlatlandRequest::ReleaseFilledRect { rect_id, control_handle } = self {
5185            Some((rect_id, control_handle))
5186        } else {
5187            None
5188        }
5189    }
5190
5191    #[allow(irrefutable_let_patterns)]
5192    pub fn into_set_content(self) -> Option<(TransformId, ContentId, FlatlandControlHandle)> {
5193        if let FlatlandRequest::SetContent { transform_id, content_id, control_handle } = self {
5194            Some((transform_id, content_id, control_handle))
5195        } else {
5196            None
5197        }
5198    }
5199
5200    #[allow(irrefutable_let_patterns)]
5201    pub fn into_set_viewport_properties(
5202        self,
5203    ) -> Option<(ContentId, ViewportProperties, FlatlandControlHandle)> {
5204        if let FlatlandRequest::SetViewportProperties { viewport_id, properties, control_handle } =
5205            self
5206        {
5207            Some((viewport_id, properties, control_handle))
5208        } else {
5209            None
5210        }
5211    }
5212
5213    #[allow(irrefutable_let_patterns)]
5214    pub fn into_release_transform(self) -> Option<(TransformId, FlatlandControlHandle)> {
5215        if let FlatlandRequest::ReleaseTransform { transform_id, control_handle } = self {
5216            Some((transform_id, control_handle))
5217        } else {
5218            None
5219        }
5220    }
5221
5222    #[allow(irrefutable_let_patterns)]
5223    pub fn into_release_view(self) -> Option<(FlatlandControlHandle)> {
5224        if let FlatlandRequest::ReleaseView { control_handle } = self {
5225            Some((control_handle))
5226        } else {
5227            None
5228        }
5229    }
5230
5231    #[allow(irrefutable_let_patterns)]
5232    pub fn into_release_viewport(self) -> Option<(ContentId, FlatlandReleaseViewportResponder)> {
5233        if let FlatlandRequest::ReleaseViewport { viewport_id, responder } = self {
5234            Some((viewport_id, responder))
5235        } else {
5236            None
5237        }
5238    }
5239
5240    #[allow(irrefutable_let_patterns)]
5241    pub fn into_release_image(self) -> Option<(ContentId, FlatlandControlHandle)> {
5242        if let FlatlandRequest::ReleaseImage { image_id, control_handle } = self {
5243            Some((image_id, control_handle))
5244        } else {
5245            None
5246        }
5247    }
5248
5249    #[allow(irrefutable_let_patterns)]
5250    pub fn into_clear(self) -> Option<(FlatlandControlHandle)> {
5251        if let FlatlandRequest::Clear { control_handle } = self {
5252            Some((control_handle))
5253        } else {
5254            None
5255        }
5256    }
5257
5258    #[allow(irrefutable_let_patterns)]
5259    pub fn into_set_debug_name(self) -> Option<(String, FlatlandControlHandle)> {
5260        if let FlatlandRequest::SetDebugName { name, control_handle } = self {
5261            Some((name, control_handle))
5262        } else {
5263            None
5264        }
5265    }
5266
5267    /// Name of the method defined in FIDL
5268    pub fn method_name(&self) -> &'static str {
5269        match *self {
5270            FlatlandRequest::ReleaseImageImmediately { .. } => "release_image_immediately",
5271            FlatlandRequest::Present { .. } => "present",
5272            FlatlandRequest::CreateView { .. } => "create_view",
5273            FlatlandRequest::CreateView2 { .. } => "create_view2",
5274            FlatlandRequest::CreateTransform { .. } => "create_transform",
5275            FlatlandRequest::SetTranslation { .. } => "set_translation",
5276            FlatlandRequest::SetOrientation { .. } => "set_orientation",
5277            FlatlandRequest::SetScale { .. } => "set_scale",
5278            FlatlandRequest::SetOpacity { .. } => "set_opacity",
5279            FlatlandRequest::SetClipBoundary { .. } => "set_clip_boundary",
5280            FlatlandRequest::AddChild { .. } => "add_child",
5281            FlatlandRequest::RemoveChild { .. } => "remove_child",
5282            FlatlandRequest::ReplaceChildren { .. } => "replace_children",
5283            FlatlandRequest::SetRootTransform { .. } => "set_root_transform",
5284            FlatlandRequest::SetHitRegions { .. } => "set_hit_regions",
5285            FlatlandRequest::SetInfiniteHitRegion { .. } => "set_infinite_hit_region",
5286            FlatlandRequest::CreateViewport { .. } => "create_viewport",
5287            FlatlandRequest::CreateImage { .. } => "create_image",
5288            FlatlandRequest::SetImageSampleRegion { .. } => "set_image_sample_region",
5289            FlatlandRequest::SetImageDestinationSize { .. } => "set_image_destination_size",
5290            FlatlandRequest::SetImageBlendingFunction { .. } => "set_image_blending_function",
5291            FlatlandRequest::SetImageBlendMode { .. } => "set_image_blend_mode",
5292            FlatlandRequest::SetImageOpacity { .. } => "set_image_opacity",
5293            FlatlandRequest::SetImageFlip { .. } => "set_image_flip",
5294            FlatlandRequest::CreateFilledRect { .. } => "create_filled_rect",
5295            FlatlandRequest::SetSolidFill { .. } => "set_solid_fill",
5296            FlatlandRequest::ReleaseFilledRect { .. } => "release_filled_rect",
5297            FlatlandRequest::SetContent { .. } => "set_content",
5298            FlatlandRequest::SetViewportProperties { .. } => "set_viewport_properties",
5299            FlatlandRequest::ReleaseTransform { .. } => "release_transform",
5300            FlatlandRequest::ReleaseView { .. } => "release_view",
5301            FlatlandRequest::ReleaseViewport { .. } => "release_viewport",
5302            FlatlandRequest::ReleaseImage { .. } => "release_image",
5303            FlatlandRequest::Clear { .. } => "clear",
5304            FlatlandRequest::SetDebugName { .. } => "set_debug_name",
5305        }
5306    }
5307}
5308
5309#[derive(Debug, Clone)]
5310pub struct FlatlandControlHandle {
5311    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5312}
5313
5314impl fidl::endpoints::ControlHandle for FlatlandControlHandle {
5315    fn shutdown(&self) {
5316        self.inner.shutdown()
5317    }
5318
5319    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
5320        self.inner.shutdown_with_epitaph(status)
5321    }
5322
5323    fn is_closed(&self) -> bool {
5324        self.inner.channel().is_closed()
5325    }
5326    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
5327        self.inner.channel().on_closed()
5328    }
5329
5330    #[cfg(target_os = "fuchsia")]
5331    fn signal_peer(
5332        &self,
5333        clear_mask: zx::Signals,
5334        set_mask: zx::Signals,
5335    ) -> Result<(), zx_status::Status> {
5336        use fidl::Peered;
5337        self.inner.channel().signal_peer(clear_mask, set_mask)
5338    }
5339}
5340
5341impl FlatlandControlHandle {
5342    pub fn send_on_next_frame_begin(
5343        &self,
5344        mut values: &OnNextFrameBeginValues,
5345    ) -> Result<(), fidl::Error> {
5346        self.inner.send::<FlatlandOnNextFrameBeginRequest>(
5347            (values,),
5348            0,
5349            0x10f69a5cdeece84a,
5350            fidl::encoding::DynamicFlags::empty(),
5351        )
5352    }
5353
5354    pub fn send_on_frame_presented(
5355        &self,
5356        mut frame_presented_info: &fidl_fuchsia_scenic_scheduling::FramePresentedInfo,
5357    ) -> Result<(), fidl::Error> {
5358        self.inner.send::<FlatlandOnFramePresentedRequest>(
5359            (frame_presented_info,),
5360            0,
5361            0x56e43e1a5f30216d,
5362            fidl::encoding::DynamicFlags::empty(),
5363        )
5364    }
5365
5366    pub fn send_on_error(&self, mut error: FlatlandError) -> Result<(), fidl::Error> {
5367        self.inner.send::<FlatlandOnErrorRequest>(
5368            (error,),
5369            0,
5370            0x1ebf39e90cd8b8d,
5371            fidl::encoding::DynamicFlags::empty(),
5372        )
5373    }
5374}
5375
5376#[must_use = "FIDL methods require a response to be sent"]
5377#[derive(Debug)]
5378pub struct FlatlandReleaseViewportResponder {
5379    control_handle: std::mem::ManuallyDrop<FlatlandControlHandle>,
5380    tx_id: u32,
5381}
5382
5383/// Set the the channel to be shutdown (see [`FlatlandControlHandle::shutdown`])
5384/// if the responder is dropped without sending a response, so that the client
5385/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5386impl std::ops::Drop for FlatlandReleaseViewportResponder {
5387    fn drop(&mut self) {
5388        self.control_handle.shutdown();
5389        // Safety: drops once, never accessed again
5390        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5391    }
5392}
5393
5394impl fidl::endpoints::Responder for FlatlandReleaseViewportResponder {
5395    type ControlHandle = FlatlandControlHandle;
5396
5397    fn control_handle(&self) -> &FlatlandControlHandle {
5398        &self.control_handle
5399    }
5400
5401    fn drop_without_shutdown(mut self) {
5402        // Safety: drops once, never accessed again due to mem::forget
5403        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5404        // Prevent Drop from running (which would shut down the channel)
5405        std::mem::forget(self);
5406    }
5407}
5408
5409impl FlatlandReleaseViewportResponder {
5410    /// Sends a response to the FIDL transaction.
5411    ///
5412    /// Sets the channel to shutdown if an error occurs.
5413    pub fn send(
5414        self,
5415        mut token: fidl_fuchsia_ui_views::ViewportCreationToken,
5416    ) -> Result<(), fidl::Error> {
5417        let _result = self.send_raw(token);
5418        if _result.is_err() {
5419            self.control_handle.shutdown();
5420        }
5421        self.drop_without_shutdown();
5422        _result
5423    }
5424
5425    /// Similar to "send" but does not shutdown the channel if an error occurs.
5426    pub fn send_no_shutdown_on_err(
5427        self,
5428        mut token: fidl_fuchsia_ui_views::ViewportCreationToken,
5429    ) -> Result<(), fidl::Error> {
5430        let _result = self.send_raw(token);
5431        self.drop_without_shutdown();
5432        _result
5433    }
5434
5435    fn send_raw(
5436        &self,
5437        mut token: fidl_fuchsia_ui_views::ViewportCreationToken,
5438    ) -> Result<(), fidl::Error> {
5439        self.control_handle.inner.send::<FlatlandReleaseViewportResponse>(
5440            (&mut token,),
5441            self.tx_id,
5442            0xbad474aeb5293f9,
5443            fidl::encoding::DynamicFlags::empty(),
5444        )
5445    }
5446}
5447
5448#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
5449pub struct FlatlandDisplayMarker;
5450
5451impl fidl::endpoints::ProtocolMarker for FlatlandDisplayMarker {
5452    type Proxy = FlatlandDisplayProxy;
5453    type RequestStream = FlatlandDisplayRequestStream;
5454    #[cfg(target_os = "fuchsia")]
5455    type SynchronousProxy = FlatlandDisplaySynchronousProxy;
5456
5457    const DEBUG_NAME: &'static str = "fuchsia.ui.composition.FlatlandDisplay";
5458}
5459impl fidl::endpoints::DiscoverableProtocolMarker for FlatlandDisplayMarker {}
5460
5461pub trait FlatlandDisplayProxyInterface: Send + Sync {
5462    fn r#set_content(
5463        &self,
5464        token: fidl_fuchsia_ui_views::ViewportCreationToken,
5465        child_view_watcher: fidl::endpoints::ServerEnd<ChildViewWatcherMarker>,
5466    ) -> Result<(), fidl::Error>;
5467    fn r#set_device_pixel_ratio(
5468        &self,
5469        device_pixel_ratio: &fidl_fuchsia_math::VecF,
5470    ) -> Result<(), fidl::Error>;
5471}
5472#[derive(Debug)]
5473#[cfg(target_os = "fuchsia")]
5474pub struct FlatlandDisplaySynchronousProxy {
5475    client: fidl::client::sync::Client,
5476}
5477
5478#[cfg(target_os = "fuchsia")]
5479impl fidl::endpoints::SynchronousProxy for FlatlandDisplaySynchronousProxy {
5480    type Proxy = FlatlandDisplayProxy;
5481    type Protocol = FlatlandDisplayMarker;
5482
5483    fn from_channel(inner: fidl::Channel) -> Self {
5484        Self::new(inner)
5485    }
5486
5487    fn into_channel(self) -> fidl::Channel {
5488        self.client.into_channel()
5489    }
5490
5491    fn as_channel(&self) -> &fidl::Channel {
5492        self.client.as_channel()
5493    }
5494}
5495
5496#[cfg(target_os = "fuchsia")]
5497impl FlatlandDisplaySynchronousProxy {
5498    pub fn new(channel: fidl::Channel) -> Self {
5499        let protocol_name = <FlatlandDisplayMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
5500        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
5501    }
5502
5503    pub fn into_channel(self) -> fidl::Channel {
5504        self.client.into_channel()
5505    }
5506
5507    /// Waits until an event arrives and returns it. It is safe for other
5508    /// threads to make concurrent requests while waiting for an event.
5509    pub fn wait_for_event(
5510        &self,
5511        deadline: zx::MonotonicInstant,
5512    ) -> Result<FlatlandDisplayEvent, fidl::Error> {
5513        FlatlandDisplayEvent::decode(self.client.wait_for_event(deadline)?)
5514    }
5515
5516    pub fn r#set_content(
5517        &self,
5518        mut token: fidl_fuchsia_ui_views::ViewportCreationToken,
5519        mut child_view_watcher: fidl::endpoints::ServerEnd<ChildViewWatcherMarker>,
5520    ) -> Result<(), fidl::Error> {
5521        self.client.send::<FlatlandDisplaySetContentRequest>(
5522            (&mut token, child_view_watcher),
5523            0x6748193a39918298,
5524            fidl::encoding::DynamicFlags::empty(),
5525        )
5526    }
5527
5528    /// Sets the ratio of display's physical pixels to device independent pixels that should be used
5529    /// for the tree of Flatland content that are attached to this display. See
5530    /// [`LayoutInfo.device_pixel_ratio`] for details.
5531    ///
5532    /// The default value is (1.0, 1.0). The valid values are 1.0 and above.
5533    pub fn r#set_device_pixel_ratio(
5534        &self,
5535        mut device_pixel_ratio: &fidl_fuchsia_math::VecF,
5536    ) -> Result<(), fidl::Error> {
5537        self.client.send::<FlatlandDisplaySetDevicePixelRatioRequest>(
5538            (device_pixel_ratio,),
5539            0x392c3e70cc0a81a4,
5540            fidl::encoding::DynamicFlags::empty(),
5541        )
5542    }
5543}
5544
5545#[cfg(target_os = "fuchsia")]
5546impl From<FlatlandDisplaySynchronousProxy> for zx::NullableHandle {
5547    fn from(value: FlatlandDisplaySynchronousProxy) -> Self {
5548        value.into_channel().into()
5549    }
5550}
5551
5552#[cfg(target_os = "fuchsia")]
5553impl From<fidl::Channel> for FlatlandDisplaySynchronousProxy {
5554    fn from(value: fidl::Channel) -> Self {
5555        Self::new(value)
5556    }
5557}
5558
5559#[cfg(target_os = "fuchsia")]
5560impl fidl::endpoints::FromClient for FlatlandDisplaySynchronousProxy {
5561    type Protocol = FlatlandDisplayMarker;
5562
5563    fn from_client(value: fidl::endpoints::ClientEnd<FlatlandDisplayMarker>) -> Self {
5564        Self::new(value.into_channel())
5565    }
5566}
5567
5568#[derive(Debug, Clone)]
5569pub struct FlatlandDisplayProxy {
5570    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
5571}
5572
5573impl fidl::endpoints::Proxy for FlatlandDisplayProxy {
5574    type Protocol = FlatlandDisplayMarker;
5575
5576    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
5577        Self::new(inner)
5578    }
5579
5580    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
5581        self.client.into_channel().map_err(|client| Self { client })
5582    }
5583
5584    fn as_channel(&self) -> &::fidl::AsyncChannel {
5585        self.client.as_channel()
5586    }
5587}
5588
5589impl FlatlandDisplayProxy {
5590    /// Create a new Proxy for fuchsia.ui.composition/FlatlandDisplay.
5591    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
5592        let protocol_name = <FlatlandDisplayMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
5593        Self { client: fidl::client::Client::new(channel, protocol_name) }
5594    }
5595
5596    /// Get a Stream of events from the remote end of the protocol.
5597    ///
5598    /// # Panics
5599    ///
5600    /// Panics if the event stream was already taken.
5601    pub fn take_event_stream(&self) -> FlatlandDisplayEventStream {
5602        FlatlandDisplayEventStream { event_receiver: self.client.take_event_receiver() }
5603    }
5604
5605    pub fn r#set_content(
5606        &self,
5607        mut token: fidl_fuchsia_ui_views::ViewportCreationToken,
5608        mut child_view_watcher: fidl::endpoints::ServerEnd<ChildViewWatcherMarker>,
5609    ) -> Result<(), fidl::Error> {
5610        FlatlandDisplayProxyInterface::r#set_content(self, token, child_view_watcher)
5611    }
5612
5613    /// Sets the ratio of display's physical pixels to device independent pixels that should be used
5614    /// for the tree of Flatland content that are attached to this display. See
5615    /// [`LayoutInfo.device_pixel_ratio`] for details.
5616    ///
5617    /// The default value is (1.0, 1.0). The valid values are 1.0 and above.
5618    pub fn r#set_device_pixel_ratio(
5619        &self,
5620        mut device_pixel_ratio: &fidl_fuchsia_math::VecF,
5621    ) -> Result<(), fidl::Error> {
5622        FlatlandDisplayProxyInterface::r#set_device_pixel_ratio(self, device_pixel_ratio)
5623    }
5624}
5625
5626impl FlatlandDisplayProxyInterface for FlatlandDisplayProxy {
5627    fn r#set_content(
5628        &self,
5629        mut token: fidl_fuchsia_ui_views::ViewportCreationToken,
5630        mut child_view_watcher: fidl::endpoints::ServerEnd<ChildViewWatcherMarker>,
5631    ) -> Result<(), fidl::Error> {
5632        self.client.send::<FlatlandDisplaySetContentRequest>(
5633            (&mut token, child_view_watcher),
5634            0x6748193a39918298,
5635            fidl::encoding::DynamicFlags::empty(),
5636        )
5637    }
5638
5639    fn r#set_device_pixel_ratio(
5640        &self,
5641        mut device_pixel_ratio: &fidl_fuchsia_math::VecF,
5642    ) -> Result<(), fidl::Error> {
5643        self.client.send::<FlatlandDisplaySetDevicePixelRatioRequest>(
5644            (device_pixel_ratio,),
5645            0x392c3e70cc0a81a4,
5646            fidl::encoding::DynamicFlags::empty(),
5647        )
5648    }
5649}
5650
5651pub struct FlatlandDisplayEventStream {
5652    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
5653}
5654
5655impl std::marker::Unpin for FlatlandDisplayEventStream {}
5656
5657impl futures::stream::FusedStream for FlatlandDisplayEventStream {
5658    fn is_terminated(&self) -> bool {
5659        self.event_receiver.is_terminated()
5660    }
5661}
5662
5663impl futures::Stream for FlatlandDisplayEventStream {
5664    type Item = Result<FlatlandDisplayEvent, fidl::Error>;
5665
5666    fn poll_next(
5667        mut self: std::pin::Pin<&mut Self>,
5668        cx: &mut std::task::Context<'_>,
5669    ) -> std::task::Poll<Option<Self::Item>> {
5670        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
5671            &mut self.event_receiver,
5672            cx
5673        )?) {
5674            Some(buf) => std::task::Poll::Ready(Some(FlatlandDisplayEvent::decode(buf))),
5675            None => std::task::Poll::Ready(None),
5676        }
5677    }
5678}
5679
5680#[derive(Debug)]
5681pub enum FlatlandDisplayEvent {}
5682
5683impl FlatlandDisplayEvent {
5684    /// Decodes a message buffer as a [`FlatlandDisplayEvent`].
5685    fn decode(
5686        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
5687    ) -> Result<FlatlandDisplayEvent, fidl::Error> {
5688        let (bytes, _handles) = buf.split_mut();
5689        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5690        debug_assert_eq!(tx_header.tx_id, 0);
5691        match tx_header.ordinal {
5692            _ => Err(fidl::Error::UnknownOrdinal {
5693                ordinal: tx_header.ordinal,
5694                protocol_name:
5695                    <FlatlandDisplayMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5696            }),
5697        }
5698    }
5699}
5700
5701/// A Stream of incoming requests for fuchsia.ui.composition/FlatlandDisplay.
5702pub struct FlatlandDisplayRequestStream {
5703    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5704    is_terminated: bool,
5705}
5706
5707impl std::marker::Unpin for FlatlandDisplayRequestStream {}
5708
5709impl futures::stream::FusedStream for FlatlandDisplayRequestStream {
5710    fn is_terminated(&self) -> bool {
5711        self.is_terminated
5712    }
5713}
5714
5715impl fidl::endpoints::RequestStream for FlatlandDisplayRequestStream {
5716    type Protocol = FlatlandDisplayMarker;
5717    type ControlHandle = FlatlandDisplayControlHandle;
5718
5719    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
5720        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
5721    }
5722
5723    fn control_handle(&self) -> Self::ControlHandle {
5724        FlatlandDisplayControlHandle { inner: self.inner.clone() }
5725    }
5726
5727    fn into_inner(
5728        self,
5729    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
5730    {
5731        (self.inner, self.is_terminated)
5732    }
5733
5734    fn from_inner(
5735        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5736        is_terminated: bool,
5737    ) -> Self {
5738        Self { inner, is_terminated }
5739    }
5740}
5741
5742impl futures::Stream for FlatlandDisplayRequestStream {
5743    type Item = Result<FlatlandDisplayRequest, fidl::Error>;
5744
5745    fn poll_next(
5746        mut self: std::pin::Pin<&mut Self>,
5747        cx: &mut std::task::Context<'_>,
5748    ) -> std::task::Poll<Option<Self::Item>> {
5749        let this = &mut *self;
5750        if this.inner.check_shutdown(cx) {
5751            this.is_terminated = true;
5752            return std::task::Poll::Ready(None);
5753        }
5754        if this.is_terminated {
5755            panic!("polled FlatlandDisplayRequestStream after completion");
5756        }
5757        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
5758            |bytes, handles| {
5759                match this.inner.channel().read_etc(cx, bytes, handles) {
5760                    std::task::Poll::Ready(Ok(())) => {}
5761                    std::task::Poll::Pending => return std::task::Poll::Pending,
5762                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
5763                        this.is_terminated = true;
5764                        return std::task::Poll::Ready(None);
5765                    }
5766                    std::task::Poll::Ready(Err(e)) => {
5767                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
5768                            e.into(),
5769                        ))));
5770                    }
5771                }
5772
5773                // A message has been received from the channel
5774                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5775
5776                std::task::Poll::Ready(Some(match header.ordinal {
5777                    0x6748193a39918298 => {
5778                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5779                        let mut req = fidl::new_empty!(
5780                            FlatlandDisplaySetContentRequest,
5781                            fidl::encoding::DefaultFuchsiaResourceDialect
5782                        );
5783                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandDisplaySetContentRequest>(&header, _body_bytes, handles, &mut req)?;
5784                        let control_handle =
5785                            FlatlandDisplayControlHandle { inner: this.inner.clone() };
5786                        Ok(FlatlandDisplayRequest::SetContent {
5787                            token: req.token,
5788                            child_view_watcher: req.child_view_watcher,
5789
5790                            control_handle,
5791                        })
5792                    }
5793                    0x392c3e70cc0a81a4 => {
5794                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5795                        let mut req = fidl::new_empty!(
5796                            FlatlandDisplaySetDevicePixelRatioRequest,
5797                            fidl::encoding::DefaultFuchsiaResourceDialect
5798                        );
5799                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandDisplaySetDevicePixelRatioRequest>(&header, _body_bytes, handles, &mut req)?;
5800                        let control_handle =
5801                            FlatlandDisplayControlHandle { inner: this.inner.clone() };
5802                        Ok(FlatlandDisplayRequest::SetDevicePixelRatio {
5803                            device_pixel_ratio: req.device_pixel_ratio,
5804
5805                            control_handle,
5806                        })
5807                    }
5808                    _ => Err(fidl::Error::UnknownOrdinal {
5809                        ordinal: header.ordinal,
5810                        protocol_name:
5811                            <FlatlandDisplayMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5812                    }),
5813                }))
5814            },
5815        )
5816    }
5817}
5818
5819/// This API connects to the singleton "primary display", and allows a tree of Flatland content to
5820/// be attached underneath.  Only one FlatlandDisplay client connection is allowed at one time.
5821#[derive(Debug)]
5822pub enum FlatlandDisplayRequest {
5823    SetContent {
5824        token: fidl_fuchsia_ui_views::ViewportCreationToken,
5825        child_view_watcher: fidl::endpoints::ServerEnd<ChildViewWatcherMarker>,
5826        control_handle: FlatlandDisplayControlHandle,
5827    },
5828    /// Sets the ratio of display's physical pixels to device independent pixels that should be used
5829    /// for the tree of Flatland content that are attached to this display. See
5830    /// [`LayoutInfo.device_pixel_ratio`] for details.
5831    ///
5832    /// The default value is (1.0, 1.0). The valid values are 1.0 and above.
5833    SetDevicePixelRatio {
5834        device_pixel_ratio: fidl_fuchsia_math::VecF,
5835        control_handle: FlatlandDisplayControlHandle,
5836    },
5837}
5838
5839impl FlatlandDisplayRequest {
5840    #[allow(irrefutable_let_patterns)]
5841    pub fn into_set_content(
5842        self,
5843    ) -> Option<(
5844        fidl_fuchsia_ui_views::ViewportCreationToken,
5845        fidl::endpoints::ServerEnd<ChildViewWatcherMarker>,
5846        FlatlandDisplayControlHandle,
5847    )> {
5848        if let FlatlandDisplayRequest::SetContent { token, child_view_watcher, control_handle } =
5849            self
5850        {
5851            Some((token, child_view_watcher, control_handle))
5852        } else {
5853            None
5854        }
5855    }
5856
5857    #[allow(irrefutable_let_patterns)]
5858    pub fn into_set_device_pixel_ratio(
5859        self,
5860    ) -> Option<(fidl_fuchsia_math::VecF, FlatlandDisplayControlHandle)> {
5861        if let FlatlandDisplayRequest::SetDevicePixelRatio { device_pixel_ratio, control_handle } =
5862            self
5863        {
5864            Some((device_pixel_ratio, control_handle))
5865        } else {
5866            None
5867        }
5868    }
5869
5870    /// Name of the method defined in FIDL
5871    pub fn method_name(&self) -> &'static str {
5872        match *self {
5873            FlatlandDisplayRequest::SetContent { .. } => "set_content",
5874            FlatlandDisplayRequest::SetDevicePixelRatio { .. } => "set_device_pixel_ratio",
5875        }
5876    }
5877}
5878
5879#[derive(Debug, Clone)]
5880pub struct FlatlandDisplayControlHandle {
5881    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5882}
5883
5884impl fidl::endpoints::ControlHandle for FlatlandDisplayControlHandle {
5885    fn shutdown(&self) {
5886        self.inner.shutdown()
5887    }
5888
5889    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
5890        self.inner.shutdown_with_epitaph(status)
5891    }
5892
5893    fn is_closed(&self) -> bool {
5894        self.inner.channel().is_closed()
5895    }
5896    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
5897        self.inner.channel().on_closed()
5898    }
5899
5900    #[cfg(target_os = "fuchsia")]
5901    fn signal_peer(
5902        &self,
5903        clear_mask: zx::Signals,
5904        set_mask: zx::Signals,
5905    ) -> Result<(), zx_status::Status> {
5906        use fidl::Peered;
5907        self.inner.channel().signal_peer(clear_mask, set_mask)
5908    }
5909}
5910
5911impl FlatlandDisplayControlHandle {}
5912
5913#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
5914pub struct ParentViewportWatcherMarker;
5915
5916impl fidl::endpoints::ProtocolMarker for ParentViewportWatcherMarker {
5917    type Proxy = ParentViewportWatcherProxy;
5918    type RequestStream = ParentViewportWatcherRequestStream;
5919    #[cfg(target_os = "fuchsia")]
5920    type SynchronousProxy = ParentViewportWatcherSynchronousProxy;
5921
5922    const DEBUG_NAME: &'static str = "(anonymous) ParentViewportWatcher";
5923}
5924
5925pub trait ParentViewportWatcherProxyInterface: Send + Sync {
5926    type GetLayoutResponseFut: std::future::Future<Output = Result<LayoutInfo, fidl::Error>> + Send;
5927    fn r#get_layout(&self) -> Self::GetLayoutResponseFut;
5928    type GetStatusResponseFut: std::future::Future<Output = Result<ParentViewportStatus, fidl::Error>>
5929        + Send;
5930    fn r#get_status(&self) -> Self::GetStatusResponseFut;
5931}
5932#[derive(Debug)]
5933#[cfg(target_os = "fuchsia")]
5934pub struct ParentViewportWatcherSynchronousProxy {
5935    client: fidl::client::sync::Client,
5936}
5937
5938#[cfg(target_os = "fuchsia")]
5939impl fidl::endpoints::SynchronousProxy for ParentViewportWatcherSynchronousProxy {
5940    type Proxy = ParentViewportWatcherProxy;
5941    type Protocol = ParentViewportWatcherMarker;
5942
5943    fn from_channel(inner: fidl::Channel) -> Self {
5944        Self::new(inner)
5945    }
5946
5947    fn into_channel(self) -> fidl::Channel {
5948        self.client.into_channel()
5949    }
5950
5951    fn as_channel(&self) -> &fidl::Channel {
5952        self.client.as_channel()
5953    }
5954}
5955
5956#[cfg(target_os = "fuchsia")]
5957impl ParentViewportWatcherSynchronousProxy {
5958    pub fn new(channel: fidl::Channel) -> Self {
5959        let protocol_name =
5960            <ParentViewportWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
5961        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
5962    }
5963
5964    pub fn into_channel(self) -> fidl::Channel {
5965        self.client.into_channel()
5966    }
5967
5968    /// Waits until an event arrives and returns it. It is safe for other
5969    /// threads to make concurrent requests while waiting for an event.
5970    pub fn wait_for_event(
5971        &self,
5972        deadline: zx::MonotonicInstant,
5973    ) -> Result<ParentViewportWatcherEvent, fidl::Error> {
5974        ParentViewportWatcherEvent::decode(self.client.wait_for_event(deadline)?)
5975    }
5976
5977    /// A hanging get for receiving layout information. Clients may receive layout information
5978    /// before the ParentViewportWatcher operation has been presented. This allows children to
5979    /// layout their content before their first call to [`Present`]. In transition cases where two
5980    /// ParentViewportWatcher channels exist at the same time, both protocol instances will be
5981    /// receiving different layout information.
5982    ///
5983    /// This hanging get will only fire when the LayoutInfo is different than the previously
5984    /// returned LayoutInfo. Note that, since LayoutInfo is a table, only some fields may have
5985    /// changed.
5986    ///
5987    /// It is invalid to call `GetLayout` while a previous call is still pending. Doing so will
5988    /// cause both this channel and the Flatland channel that handed out ParentViewportWatcher to be
5989    /// closed.
5990    pub fn r#get_layout(
5991        &self,
5992        ___deadline: zx::MonotonicInstant,
5993    ) -> Result<LayoutInfo, fidl::Error> {
5994        let _response = self
5995            .client
5996            .send_query::<fidl::encoding::EmptyPayload, ParentViewportWatcherGetLayoutResponse>(
5997                (),
5998                0x3cbe5d9638e032,
5999                fidl::encoding::DynamicFlags::empty(),
6000                ___deadline,
6001            )?;
6002        Ok(_response.info)
6003    }
6004
6005    /// A hanging get for receiving the status of the parent Viewport. This provides global
6006    /// connectivity information to the child.
6007    ///
6008    /// This hanging get will only fire when the ParentViewportStatus is different than the
6009    /// previously returned ParentViewportStatus.
6010    ///
6011    /// It is invalid to call `GetStatus` while a previous call is still pending. Doing so will
6012    /// cause both this channel and the Flatland channel that handed out ParentViewportWatcher to be
6013    /// closed.
6014    pub fn r#get_status(
6015        &self,
6016        ___deadline: zx::MonotonicInstant,
6017    ) -> Result<ParentViewportStatus, fidl::Error> {
6018        let _response = self
6019            .client
6020            .send_query::<fidl::encoding::EmptyPayload, ParentViewportWatcherGetStatusResponse>(
6021                (),
6022                0x7caa022f050d9ea6,
6023                fidl::encoding::DynamicFlags::empty(),
6024                ___deadline,
6025            )?;
6026        Ok(_response.status)
6027    }
6028}
6029
6030#[cfg(target_os = "fuchsia")]
6031impl From<ParentViewportWatcherSynchronousProxy> for zx::NullableHandle {
6032    fn from(value: ParentViewportWatcherSynchronousProxy) -> Self {
6033        value.into_channel().into()
6034    }
6035}
6036
6037#[cfg(target_os = "fuchsia")]
6038impl From<fidl::Channel> for ParentViewportWatcherSynchronousProxy {
6039    fn from(value: fidl::Channel) -> Self {
6040        Self::new(value)
6041    }
6042}
6043
6044#[cfg(target_os = "fuchsia")]
6045impl fidl::endpoints::FromClient for ParentViewportWatcherSynchronousProxy {
6046    type Protocol = ParentViewportWatcherMarker;
6047
6048    fn from_client(value: fidl::endpoints::ClientEnd<ParentViewportWatcherMarker>) -> Self {
6049        Self::new(value.into_channel())
6050    }
6051}
6052
6053#[derive(Debug, Clone)]
6054pub struct ParentViewportWatcherProxy {
6055    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
6056}
6057
6058impl fidl::endpoints::Proxy for ParentViewportWatcherProxy {
6059    type Protocol = ParentViewportWatcherMarker;
6060
6061    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
6062        Self::new(inner)
6063    }
6064
6065    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
6066        self.client.into_channel().map_err(|client| Self { client })
6067    }
6068
6069    fn as_channel(&self) -> &::fidl::AsyncChannel {
6070        self.client.as_channel()
6071    }
6072}
6073
6074impl ParentViewportWatcherProxy {
6075    /// Create a new Proxy for fuchsia.ui.composition/ParentViewportWatcher.
6076    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
6077        let protocol_name =
6078            <ParentViewportWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
6079        Self { client: fidl::client::Client::new(channel, protocol_name) }
6080    }
6081
6082    /// Get a Stream of events from the remote end of the protocol.
6083    ///
6084    /// # Panics
6085    ///
6086    /// Panics if the event stream was already taken.
6087    pub fn take_event_stream(&self) -> ParentViewportWatcherEventStream {
6088        ParentViewportWatcherEventStream { event_receiver: self.client.take_event_receiver() }
6089    }
6090
6091    /// A hanging get for receiving layout information. Clients may receive layout information
6092    /// before the ParentViewportWatcher operation has been presented. This allows children to
6093    /// layout their content before their first call to [`Present`]. In transition cases where two
6094    /// ParentViewportWatcher channels exist at the same time, both protocol instances will be
6095    /// receiving different layout information.
6096    ///
6097    /// This hanging get will only fire when the LayoutInfo is different than the previously
6098    /// returned LayoutInfo. Note that, since LayoutInfo is a table, only some fields may have
6099    /// changed.
6100    ///
6101    /// It is invalid to call `GetLayout` while a previous call is still pending. Doing so will
6102    /// cause both this channel and the Flatland channel that handed out ParentViewportWatcher to be
6103    /// closed.
6104    pub fn r#get_layout(
6105        &self,
6106    ) -> fidl::client::QueryResponseFut<LayoutInfo, fidl::encoding::DefaultFuchsiaResourceDialect>
6107    {
6108        ParentViewportWatcherProxyInterface::r#get_layout(self)
6109    }
6110
6111    /// A hanging get for receiving the status of the parent Viewport. This provides global
6112    /// connectivity information to the child.
6113    ///
6114    /// This hanging get will only fire when the ParentViewportStatus is different than the
6115    /// previously returned ParentViewportStatus.
6116    ///
6117    /// It is invalid to call `GetStatus` while a previous call is still pending. Doing so will
6118    /// cause both this channel and the Flatland channel that handed out ParentViewportWatcher to be
6119    /// closed.
6120    pub fn r#get_status(
6121        &self,
6122    ) -> fidl::client::QueryResponseFut<
6123        ParentViewportStatus,
6124        fidl::encoding::DefaultFuchsiaResourceDialect,
6125    > {
6126        ParentViewportWatcherProxyInterface::r#get_status(self)
6127    }
6128}
6129
6130impl ParentViewportWatcherProxyInterface for ParentViewportWatcherProxy {
6131    type GetLayoutResponseFut =
6132        fidl::client::QueryResponseFut<LayoutInfo, fidl::encoding::DefaultFuchsiaResourceDialect>;
6133    fn r#get_layout(&self) -> Self::GetLayoutResponseFut {
6134        fn _decode(
6135            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6136        ) -> Result<LayoutInfo, fidl::Error> {
6137            let _response = fidl::client::decode_transaction_body::<
6138                ParentViewportWatcherGetLayoutResponse,
6139                fidl::encoding::DefaultFuchsiaResourceDialect,
6140                0x3cbe5d9638e032,
6141            >(_buf?)?;
6142            Ok(_response.info)
6143        }
6144        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, LayoutInfo>(
6145            (),
6146            0x3cbe5d9638e032,
6147            fidl::encoding::DynamicFlags::empty(),
6148            _decode,
6149        )
6150    }
6151
6152    type GetStatusResponseFut = fidl::client::QueryResponseFut<
6153        ParentViewportStatus,
6154        fidl::encoding::DefaultFuchsiaResourceDialect,
6155    >;
6156    fn r#get_status(&self) -> Self::GetStatusResponseFut {
6157        fn _decode(
6158            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6159        ) -> Result<ParentViewportStatus, fidl::Error> {
6160            let _response = fidl::client::decode_transaction_body::<
6161                ParentViewportWatcherGetStatusResponse,
6162                fidl::encoding::DefaultFuchsiaResourceDialect,
6163                0x7caa022f050d9ea6,
6164            >(_buf?)?;
6165            Ok(_response.status)
6166        }
6167        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ParentViewportStatus>(
6168            (),
6169            0x7caa022f050d9ea6,
6170            fidl::encoding::DynamicFlags::empty(),
6171            _decode,
6172        )
6173    }
6174}
6175
6176pub struct ParentViewportWatcherEventStream {
6177    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
6178}
6179
6180impl std::marker::Unpin for ParentViewportWatcherEventStream {}
6181
6182impl futures::stream::FusedStream for ParentViewportWatcherEventStream {
6183    fn is_terminated(&self) -> bool {
6184        self.event_receiver.is_terminated()
6185    }
6186}
6187
6188impl futures::Stream for ParentViewportWatcherEventStream {
6189    type Item = Result<ParentViewportWatcherEvent, fidl::Error>;
6190
6191    fn poll_next(
6192        mut self: std::pin::Pin<&mut Self>,
6193        cx: &mut std::task::Context<'_>,
6194    ) -> std::task::Poll<Option<Self::Item>> {
6195        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
6196            &mut self.event_receiver,
6197            cx
6198        )?) {
6199            Some(buf) => std::task::Poll::Ready(Some(ParentViewportWatcherEvent::decode(buf))),
6200            None => std::task::Poll::Ready(None),
6201        }
6202    }
6203}
6204
6205#[derive(Debug)]
6206pub enum ParentViewportWatcherEvent {}
6207
6208impl ParentViewportWatcherEvent {
6209    /// Decodes a message buffer as a [`ParentViewportWatcherEvent`].
6210    fn decode(
6211        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
6212    ) -> Result<ParentViewportWatcherEvent, fidl::Error> {
6213        let (bytes, _handles) = buf.split_mut();
6214        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6215        debug_assert_eq!(tx_header.tx_id, 0);
6216        match tx_header.ordinal {
6217            _ => Err(fidl::Error::UnknownOrdinal {
6218                ordinal: tx_header.ordinal,
6219                protocol_name:
6220                    <ParentViewportWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6221            }),
6222        }
6223    }
6224}
6225
6226/// A Stream of incoming requests for fuchsia.ui.composition/ParentViewportWatcher.
6227pub struct ParentViewportWatcherRequestStream {
6228    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6229    is_terminated: bool,
6230}
6231
6232impl std::marker::Unpin for ParentViewportWatcherRequestStream {}
6233
6234impl futures::stream::FusedStream for ParentViewportWatcherRequestStream {
6235    fn is_terminated(&self) -> bool {
6236        self.is_terminated
6237    }
6238}
6239
6240impl fidl::endpoints::RequestStream for ParentViewportWatcherRequestStream {
6241    type Protocol = ParentViewportWatcherMarker;
6242    type ControlHandle = ParentViewportWatcherControlHandle;
6243
6244    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
6245        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
6246    }
6247
6248    fn control_handle(&self) -> Self::ControlHandle {
6249        ParentViewportWatcherControlHandle { inner: self.inner.clone() }
6250    }
6251
6252    fn into_inner(
6253        self,
6254    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
6255    {
6256        (self.inner, self.is_terminated)
6257    }
6258
6259    fn from_inner(
6260        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6261        is_terminated: bool,
6262    ) -> Self {
6263        Self { inner, is_terminated }
6264    }
6265}
6266
6267impl futures::Stream for ParentViewportWatcherRequestStream {
6268    type Item = Result<ParentViewportWatcherRequest, fidl::Error>;
6269
6270    fn poll_next(
6271        mut self: std::pin::Pin<&mut Self>,
6272        cx: &mut std::task::Context<'_>,
6273    ) -> std::task::Poll<Option<Self::Item>> {
6274        let this = &mut *self;
6275        if this.inner.check_shutdown(cx) {
6276            this.is_terminated = true;
6277            return std::task::Poll::Ready(None);
6278        }
6279        if this.is_terminated {
6280            panic!("polled ParentViewportWatcherRequestStream after completion");
6281        }
6282        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
6283            |bytes, handles| {
6284                match this.inner.channel().read_etc(cx, bytes, handles) {
6285                    std::task::Poll::Ready(Ok(())) => {}
6286                    std::task::Poll::Pending => return std::task::Poll::Pending,
6287                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
6288                        this.is_terminated = true;
6289                        return std::task::Poll::Ready(None);
6290                    }
6291                    std::task::Poll::Ready(Err(e)) => {
6292                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
6293                            e.into(),
6294                        ))));
6295                    }
6296                }
6297
6298                // A message has been received from the channel
6299                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6300
6301                std::task::Poll::Ready(Some(match header.ordinal {
6302                0x3cbe5d9638e032 => {
6303                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6304                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
6305                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
6306                    let control_handle = ParentViewportWatcherControlHandle {
6307                        inner: this.inner.clone(),
6308                    };
6309                    Ok(ParentViewportWatcherRequest::GetLayout {
6310                        responder: ParentViewportWatcherGetLayoutResponder {
6311                            control_handle: std::mem::ManuallyDrop::new(control_handle),
6312                            tx_id: header.tx_id,
6313                        },
6314                    })
6315                }
6316                0x7caa022f050d9ea6 => {
6317                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6318                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
6319                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
6320                    let control_handle = ParentViewportWatcherControlHandle {
6321                        inner: this.inner.clone(),
6322                    };
6323                    Ok(ParentViewportWatcherRequest::GetStatus {
6324                        responder: ParentViewportWatcherGetStatusResponder {
6325                            control_handle: std::mem::ManuallyDrop::new(control_handle),
6326                            tx_id: header.tx_id,
6327                        },
6328                    })
6329                }
6330                _ => Err(fidl::Error::UnknownOrdinal {
6331                    ordinal: header.ordinal,
6332                    protocol_name: <ParentViewportWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6333                }),
6334            }))
6335            },
6336        )
6337    }
6338}
6339
6340/// A protocol that provides information about the parent Viewport attached to a Flatland instance's
6341/// sole View.  Although Flatland instances can have at most one view, it is possible to have
6342/// multiple ParentViewportWatchers during the brief transition period when replacing the instance's
6343/// View with another, e.g. via [`CreateView`].  During this period, certain updates may be
6344/// duplicated and sent to each ParentViewportWatcher connection.
6345///
6346/// A ParentViewportWatcher will remain connected as long as the corresponding parent Viewport
6347/// exists; the connection will also be closed if the parents's ViewportCreationToken is dropped
6348/// without using it to create a Viewport.
6349#[derive(Debug)]
6350pub enum ParentViewportWatcherRequest {
6351    /// A hanging get for receiving layout information. Clients may receive layout information
6352    /// before the ParentViewportWatcher operation has been presented. This allows children to
6353    /// layout their content before their first call to [`Present`]. In transition cases where two
6354    /// ParentViewportWatcher channels exist at the same time, both protocol instances will be
6355    /// receiving different layout information.
6356    ///
6357    /// This hanging get will only fire when the LayoutInfo is different than the previously
6358    /// returned LayoutInfo. Note that, since LayoutInfo is a table, only some fields may have
6359    /// changed.
6360    ///
6361    /// It is invalid to call `GetLayout` while a previous call is still pending. Doing so will
6362    /// cause both this channel and the Flatland channel that handed out ParentViewportWatcher to be
6363    /// closed.
6364    GetLayout { responder: ParentViewportWatcherGetLayoutResponder },
6365    /// A hanging get for receiving the status of the parent Viewport. This provides global
6366    /// connectivity information to the child.
6367    ///
6368    /// This hanging get will only fire when the ParentViewportStatus is different than the
6369    /// previously returned ParentViewportStatus.
6370    ///
6371    /// It is invalid to call `GetStatus` while a previous call is still pending. Doing so will
6372    /// cause both this channel and the Flatland channel that handed out ParentViewportWatcher to be
6373    /// closed.
6374    GetStatus { responder: ParentViewportWatcherGetStatusResponder },
6375}
6376
6377impl ParentViewportWatcherRequest {
6378    #[allow(irrefutable_let_patterns)]
6379    pub fn into_get_layout(self) -> Option<(ParentViewportWatcherGetLayoutResponder)> {
6380        if let ParentViewportWatcherRequest::GetLayout { responder } = self {
6381            Some((responder))
6382        } else {
6383            None
6384        }
6385    }
6386
6387    #[allow(irrefutable_let_patterns)]
6388    pub fn into_get_status(self) -> Option<(ParentViewportWatcherGetStatusResponder)> {
6389        if let ParentViewportWatcherRequest::GetStatus { responder } = self {
6390            Some((responder))
6391        } else {
6392            None
6393        }
6394    }
6395
6396    /// Name of the method defined in FIDL
6397    pub fn method_name(&self) -> &'static str {
6398        match *self {
6399            ParentViewportWatcherRequest::GetLayout { .. } => "get_layout",
6400            ParentViewportWatcherRequest::GetStatus { .. } => "get_status",
6401        }
6402    }
6403}
6404
6405#[derive(Debug, Clone)]
6406pub struct ParentViewportWatcherControlHandle {
6407    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6408}
6409
6410impl fidl::endpoints::ControlHandle for ParentViewportWatcherControlHandle {
6411    fn shutdown(&self) {
6412        self.inner.shutdown()
6413    }
6414
6415    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
6416        self.inner.shutdown_with_epitaph(status)
6417    }
6418
6419    fn is_closed(&self) -> bool {
6420        self.inner.channel().is_closed()
6421    }
6422    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
6423        self.inner.channel().on_closed()
6424    }
6425
6426    #[cfg(target_os = "fuchsia")]
6427    fn signal_peer(
6428        &self,
6429        clear_mask: zx::Signals,
6430        set_mask: zx::Signals,
6431    ) -> Result<(), zx_status::Status> {
6432        use fidl::Peered;
6433        self.inner.channel().signal_peer(clear_mask, set_mask)
6434    }
6435}
6436
6437impl ParentViewportWatcherControlHandle {}
6438
6439#[must_use = "FIDL methods require a response to be sent"]
6440#[derive(Debug)]
6441pub struct ParentViewportWatcherGetLayoutResponder {
6442    control_handle: std::mem::ManuallyDrop<ParentViewportWatcherControlHandle>,
6443    tx_id: u32,
6444}
6445
6446/// Set the the channel to be shutdown (see [`ParentViewportWatcherControlHandle::shutdown`])
6447/// if the responder is dropped without sending a response, so that the client
6448/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6449impl std::ops::Drop for ParentViewportWatcherGetLayoutResponder {
6450    fn drop(&mut self) {
6451        self.control_handle.shutdown();
6452        // Safety: drops once, never accessed again
6453        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6454    }
6455}
6456
6457impl fidl::endpoints::Responder for ParentViewportWatcherGetLayoutResponder {
6458    type ControlHandle = ParentViewportWatcherControlHandle;
6459
6460    fn control_handle(&self) -> &ParentViewportWatcherControlHandle {
6461        &self.control_handle
6462    }
6463
6464    fn drop_without_shutdown(mut self) {
6465        // Safety: drops once, never accessed again due to mem::forget
6466        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6467        // Prevent Drop from running (which would shut down the channel)
6468        std::mem::forget(self);
6469    }
6470}
6471
6472impl ParentViewportWatcherGetLayoutResponder {
6473    /// Sends a response to the FIDL transaction.
6474    ///
6475    /// Sets the channel to shutdown if an error occurs.
6476    pub fn send(self, mut info: &LayoutInfo) -> Result<(), fidl::Error> {
6477        let _result = self.send_raw(info);
6478        if _result.is_err() {
6479            self.control_handle.shutdown();
6480        }
6481        self.drop_without_shutdown();
6482        _result
6483    }
6484
6485    /// Similar to "send" but does not shutdown the channel if an error occurs.
6486    pub fn send_no_shutdown_on_err(self, mut info: &LayoutInfo) -> Result<(), fidl::Error> {
6487        let _result = self.send_raw(info);
6488        self.drop_without_shutdown();
6489        _result
6490    }
6491
6492    fn send_raw(&self, mut info: &LayoutInfo) -> Result<(), fidl::Error> {
6493        self.control_handle.inner.send::<ParentViewportWatcherGetLayoutResponse>(
6494            (info,),
6495            self.tx_id,
6496            0x3cbe5d9638e032,
6497            fidl::encoding::DynamicFlags::empty(),
6498        )
6499    }
6500}
6501
6502#[must_use = "FIDL methods require a response to be sent"]
6503#[derive(Debug)]
6504pub struct ParentViewportWatcherGetStatusResponder {
6505    control_handle: std::mem::ManuallyDrop<ParentViewportWatcherControlHandle>,
6506    tx_id: u32,
6507}
6508
6509/// Set the the channel to be shutdown (see [`ParentViewportWatcherControlHandle::shutdown`])
6510/// if the responder is dropped without sending a response, so that the client
6511/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6512impl std::ops::Drop for ParentViewportWatcherGetStatusResponder {
6513    fn drop(&mut self) {
6514        self.control_handle.shutdown();
6515        // Safety: drops once, never accessed again
6516        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6517    }
6518}
6519
6520impl fidl::endpoints::Responder for ParentViewportWatcherGetStatusResponder {
6521    type ControlHandle = ParentViewportWatcherControlHandle;
6522
6523    fn control_handle(&self) -> &ParentViewportWatcherControlHandle {
6524        &self.control_handle
6525    }
6526
6527    fn drop_without_shutdown(mut self) {
6528        // Safety: drops once, never accessed again due to mem::forget
6529        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6530        // Prevent Drop from running (which would shut down the channel)
6531        std::mem::forget(self);
6532    }
6533}
6534
6535impl ParentViewportWatcherGetStatusResponder {
6536    /// Sends a response to the FIDL transaction.
6537    ///
6538    /// Sets the channel to shutdown if an error occurs.
6539    pub fn send(self, mut status: ParentViewportStatus) -> Result<(), fidl::Error> {
6540        let _result = self.send_raw(status);
6541        if _result.is_err() {
6542            self.control_handle.shutdown();
6543        }
6544        self.drop_without_shutdown();
6545        _result
6546    }
6547
6548    /// Similar to "send" but does not shutdown the channel if an error occurs.
6549    pub fn send_no_shutdown_on_err(
6550        self,
6551        mut status: ParentViewportStatus,
6552    ) -> Result<(), fidl::Error> {
6553        let _result = self.send_raw(status);
6554        self.drop_without_shutdown();
6555        _result
6556    }
6557
6558    fn send_raw(&self, mut status: ParentViewportStatus) -> Result<(), fidl::Error> {
6559        self.control_handle.inner.send::<ParentViewportWatcherGetStatusResponse>(
6560            (status,),
6561            self.tx_id,
6562            0x7caa022f050d9ea6,
6563            fidl::encoding::DynamicFlags::empty(),
6564        )
6565    }
6566}
6567
6568#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
6569pub struct ScreenCaptureMarker;
6570
6571impl fidl::endpoints::ProtocolMarker for ScreenCaptureMarker {
6572    type Proxy = ScreenCaptureProxy;
6573    type RequestStream = ScreenCaptureRequestStream;
6574    #[cfg(target_os = "fuchsia")]
6575    type SynchronousProxy = ScreenCaptureSynchronousProxy;
6576
6577    const DEBUG_NAME: &'static str = "fuchsia.ui.composition.ScreenCapture";
6578}
6579impl fidl::endpoints::DiscoverableProtocolMarker for ScreenCaptureMarker {}
6580pub type ScreenCaptureConfigureResult = Result<(), ScreenCaptureError>;
6581pub type ScreenCaptureGetNextFrameResult = Result<FrameInfo, ScreenCaptureError>;
6582pub type ScreenCaptureReleaseFrameResult = Result<(), ScreenCaptureError>;
6583
6584pub trait ScreenCaptureProxyInterface: Send + Sync {
6585    type ConfigureResponseFut: std::future::Future<Output = Result<ScreenCaptureConfigureResult, fidl::Error>>
6586        + Send;
6587    fn r#configure(&self, payload: ScreenCaptureConfig) -> Self::ConfigureResponseFut;
6588    type GetNextFrameResponseFut: std::future::Future<Output = Result<ScreenCaptureGetNextFrameResult, fidl::Error>>
6589        + Send;
6590    fn r#get_next_frame(&self, payload: GetNextFrameArgs) -> Self::GetNextFrameResponseFut;
6591    type ReleaseFrameResponseFut: std::future::Future<Output = Result<ScreenCaptureReleaseFrameResult, fidl::Error>>
6592        + Send;
6593    fn r#release_frame(&self, buffer_id: u32) -> Self::ReleaseFrameResponseFut;
6594}
6595#[derive(Debug)]
6596#[cfg(target_os = "fuchsia")]
6597pub struct ScreenCaptureSynchronousProxy {
6598    client: fidl::client::sync::Client,
6599}
6600
6601#[cfg(target_os = "fuchsia")]
6602impl fidl::endpoints::SynchronousProxy for ScreenCaptureSynchronousProxy {
6603    type Proxy = ScreenCaptureProxy;
6604    type Protocol = ScreenCaptureMarker;
6605
6606    fn from_channel(inner: fidl::Channel) -> Self {
6607        Self::new(inner)
6608    }
6609
6610    fn into_channel(self) -> fidl::Channel {
6611        self.client.into_channel()
6612    }
6613
6614    fn as_channel(&self) -> &fidl::Channel {
6615        self.client.as_channel()
6616    }
6617}
6618
6619#[cfg(target_os = "fuchsia")]
6620impl ScreenCaptureSynchronousProxy {
6621    pub fn new(channel: fidl::Channel) -> Self {
6622        let protocol_name = <ScreenCaptureMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
6623        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
6624    }
6625
6626    pub fn into_channel(self) -> fidl::Channel {
6627        self.client.into_channel()
6628    }
6629
6630    /// Waits until an event arrives and returns it. It is safe for other
6631    /// threads to make concurrent requests while waiting for an event.
6632    pub fn wait_for_event(
6633        &self,
6634        deadline: zx::MonotonicInstant,
6635    ) -> Result<ScreenCaptureEvent, fidl::Error> {
6636        ScreenCaptureEvent::decode(self.client.wait_for_event(deadline)?)
6637    }
6638
6639    /// Clients should first use the Allocator protocol to register a
6640    /// BufferCollection. This function will fail with BAD_OPERATION unless all clients of the
6641    /// BufferCollection have set their constraints.
6642    ///
6643    /// Afterwards, clients should create and configure the images that will
6644    /// eventually be rendered to using this method. All the buffers in the
6645    /// collection from 0 to (buffer_count-1) may be used for screen capture.
6646    ///
6647    /// Clients are responsible for determining the rotation of the display,
6648    /// and applying the corrective rotation. For instance, if the display is
6649    /// mounted 90 degrees clockwise (the "top" is on the right, when looking
6650    /// at the display), then the client should specify a 270 degree rotation
6651    /// to account for it.
6652    ///
6653    /// Similarly, the clients are responsible for specifying a buffer big
6654    /// enough for the rotated image. If the buffer is too small, a best effort
6655    /// attempt will be made to render the image.
6656    ///
6657    /// Finally, clients request the server to render the current screen to the
6658    /// shared buffers using [`GetNextFrame`].
6659    ///
6660    /// [`Configure`] can be called again with a new BufferCollectionImportToken
6661    /// if the client wishes to change any of the configuration settings. In
6662    /// this case all the buffers from the previous call to [`Configure`] will
6663    /// be released.
6664    pub fn r#configure(
6665        &self,
6666        mut payload: ScreenCaptureConfig,
6667        ___deadline: zx::MonotonicInstant,
6668    ) -> Result<ScreenCaptureConfigureResult, fidl::Error> {
6669        let _response = self.client.send_query::<ScreenCaptureConfig, fidl::encoding::ResultType<
6670            fidl::encoding::EmptyStruct,
6671            ScreenCaptureError,
6672        >>(
6673            &mut payload,
6674            0x3b6e5af1d294afd9,
6675            fidl::encoding::DynamicFlags::empty(),
6676            ___deadline,
6677        )?;
6678        Ok(_response.map(|x| x))
6679    }
6680
6681    /// Following a successful call to [`Configure`], clients can call
6682    /// GetNextFrame. This will populate a buffer with the most recent frame.
6683    ///
6684    /// Clients should wait on the zx::event they pass for successful
6685    /// completion of the screenshot. It is not guaranteed that the screenshot
6686    /// will be completed by the time this function returns.
6687    ///
6688    /// The requested image will be in the BufferCollection that the client set
6689    /// up in the VMO at the index specified by buffer_id.
6690    ///
6691    /// When ScreenCapture is used to provide a stream, the rate that the
6692    /// client calls GetNextFrame will drive the frame rate.
6693    ///
6694    /// Errors:
6695    /// BAD_OPERATION if Configure was not called, or not called successfully
6696    /// MISSING_ARGS if a required argument is not present
6697    /// BUFFER_FULL if all buffers in the BufferCollection are in use. In this case, ReleaseFrame
6698    /// must be called to make a buffer available before this function can be called successfully.
6699    pub fn r#get_next_frame(
6700        &self,
6701        mut payload: GetNextFrameArgs,
6702        ___deadline: zx::MonotonicInstant,
6703    ) -> Result<ScreenCaptureGetNextFrameResult, fidl::Error> {
6704        let _response = self.client.send_query::<
6705            GetNextFrameArgs,
6706            fidl::encoding::ResultType<FrameInfo, ScreenCaptureError>,
6707        >(
6708            &mut payload,
6709            0x552c1580aab8c4a7,
6710            fidl::encoding::DynamicFlags::empty(),
6711            ___deadline,
6712        )?;
6713        Ok(_response.map(|x| x))
6714    }
6715
6716    /// Once the client no longer needs an image, they can call ReleaseFrame on
6717    /// the VMO index of the buffer so that the server can reuse it in the future.
6718    pub fn r#release_frame(
6719        &self,
6720        mut buffer_id: u32,
6721        ___deadline: zx::MonotonicInstant,
6722    ) -> Result<ScreenCaptureReleaseFrameResult, fidl::Error> {
6723        let _response =
6724            self.client.send_query::<ScreenCaptureReleaseFrameRequest, fidl::encoding::ResultType<
6725                fidl::encoding::EmptyStruct,
6726                ScreenCaptureError,
6727            >>(
6728                (buffer_id,),
6729                0x46704dce24e35950,
6730                fidl::encoding::DynamicFlags::empty(),
6731                ___deadline,
6732            )?;
6733        Ok(_response.map(|x| x))
6734    }
6735}
6736
6737#[cfg(target_os = "fuchsia")]
6738impl From<ScreenCaptureSynchronousProxy> for zx::NullableHandle {
6739    fn from(value: ScreenCaptureSynchronousProxy) -> Self {
6740        value.into_channel().into()
6741    }
6742}
6743
6744#[cfg(target_os = "fuchsia")]
6745impl From<fidl::Channel> for ScreenCaptureSynchronousProxy {
6746    fn from(value: fidl::Channel) -> Self {
6747        Self::new(value)
6748    }
6749}
6750
6751#[cfg(target_os = "fuchsia")]
6752impl fidl::endpoints::FromClient for ScreenCaptureSynchronousProxy {
6753    type Protocol = ScreenCaptureMarker;
6754
6755    fn from_client(value: fidl::endpoints::ClientEnd<ScreenCaptureMarker>) -> Self {
6756        Self::new(value.into_channel())
6757    }
6758}
6759
6760#[derive(Debug, Clone)]
6761pub struct ScreenCaptureProxy {
6762    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
6763}
6764
6765impl fidl::endpoints::Proxy for ScreenCaptureProxy {
6766    type Protocol = ScreenCaptureMarker;
6767
6768    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
6769        Self::new(inner)
6770    }
6771
6772    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
6773        self.client.into_channel().map_err(|client| Self { client })
6774    }
6775
6776    fn as_channel(&self) -> &::fidl::AsyncChannel {
6777        self.client.as_channel()
6778    }
6779}
6780
6781impl ScreenCaptureProxy {
6782    /// Create a new Proxy for fuchsia.ui.composition/ScreenCapture.
6783    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
6784        let protocol_name = <ScreenCaptureMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
6785        Self { client: fidl::client::Client::new(channel, protocol_name) }
6786    }
6787
6788    /// Get a Stream of events from the remote end of the protocol.
6789    ///
6790    /// # Panics
6791    ///
6792    /// Panics if the event stream was already taken.
6793    pub fn take_event_stream(&self) -> ScreenCaptureEventStream {
6794        ScreenCaptureEventStream { event_receiver: self.client.take_event_receiver() }
6795    }
6796
6797    /// Clients should first use the Allocator protocol to register a
6798    /// BufferCollection. This function will fail with BAD_OPERATION unless all clients of the
6799    /// BufferCollection have set their constraints.
6800    ///
6801    /// Afterwards, clients should create and configure the images that will
6802    /// eventually be rendered to using this method. All the buffers in the
6803    /// collection from 0 to (buffer_count-1) may be used for screen capture.
6804    ///
6805    /// Clients are responsible for determining the rotation of the display,
6806    /// and applying the corrective rotation. For instance, if the display is
6807    /// mounted 90 degrees clockwise (the "top" is on the right, when looking
6808    /// at the display), then the client should specify a 270 degree rotation
6809    /// to account for it.
6810    ///
6811    /// Similarly, the clients are responsible for specifying a buffer big
6812    /// enough for the rotated image. If the buffer is too small, a best effort
6813    /// attempt will be made to render the image.
6814    ///
6815    /// Finally, clients request the server to render the current screen to the
6816    /// shared buffers using [`GetNextFrame`].
6817    ///
6818    /// [`Configure`] can be called again with a new BufferCollectionImportToken
6819    /// if the client wishes to change any of the configuration settings. In
6820    /// this case all the buffers from the previous call to [`Configure`] will
6821    /// be released.
6822    pub fn r#configure(
6823        &self,
6824        mut payload: ScreenCaptureConfig,
6825    ) -> fidl::client::QueryResponseFut<
6826        ScreenCaptureConfigureResult,
6827        fidl::encoding::DefaultFuchsiaResourceDialect,
6828    > {
6829        ScreenCaptureProxyInterface::r#configure(self, payload)
6830    }
6831
6832    /// Following a successful call to [`Configure`], clients can call
6833    /// GetNextFrame. This will populate a buffer with the most recent frame.
6834    ///
6835    /// Clients should wait on the zx::event they pass for successful
6836    /// completion of the screenshot. It is not guaranteed that the screenshot
6837    /// will be completed by the time this function returns.
6838    ///
6839    /// The requested image will be in the BufferCollection that the client set
6840    /// up in the VMO at the index specified by buffer_id.
6841    ///
6842    /// When ScreenCapture is used to provide a stream, the rate that the
6843    /// client calls GetNextFrame will drive the frame rate.
6844    ///
6845    /// Errors:
6846    /// BAD_OPERATION if Configure was not called, or not called successfully
6847    /// MISSING_ARGS if a required argument is not present
6848    /// BUFFER_FULL if all buffers in the BufferCollection are in use. In this case, ReleaseFrame
6849    /// must be called to make a buffer available before this function can be called successfully.
6850    pub fn r#get_next_frame(
6851        &self,
6852        mut payload: GetNextFrameArgs,
6853    ) -> fidl::client::QueryResponseFut<
6854        ScreenCaptureGetNextFrameResult,
6855        fidl::encoding::DefaultFuchsiaResourceDialect,
6856    > {
6857        ScreenCaptureProxyInterface::r#get_next_frame(self, payload)
6858    }
6859
6860    /// Once the client no longer needs an image, they can call ReleaseFrame on
6861    /// the VMO index of the buffer so that the server can reuse it in the future.
6862    pub fn r#release_frame(
6863        &self,
6864        mut buffer_id: u32,
6865    ) -> fidl::client::QueryResponseFut<
6866        ScreenCaptureReleaseFrameResult,
6867        fidl::encoding::DefaultFuchsiaResourceDialect,
6868    > {
6869        ScreenCaptureProxyInterface::r#release_frame(self, buffer_id)
6870    }
6871}
6872
6873impl ScreenCaptureProxyInterface for ScreenCaptureProxy {
6874    type ConfigureResponseFut = fidl::client::QueryResponseFut<
6875        ScreenCaptureConfigureResult,
6876        fidl::encoding::DefaultFuchsiaResourceDialect,
6877    >;
6878    fn r#configure(&self, mut payload: ScreenCaptureConfig) -> Self::ConfigureResponseFut {
6879        fn _decode(
6880            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6881        ) -> Result<ScreenCaptureConfigureResult, fidl::Error> {
6882            let _response = fidl::client::decode_transaction_body::<
6883                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, ScreenCaptureError>,
6884                fidl::encoding::DefaultFuchsiaResourceDialect,
6885                0x3b6e5af1d294afd9,
6886            >(_buf?)?;
6887            Ok(_response.map(|x| x))
6888        }
6889        self.client.send_query_and_decode::<ScreenCaptureConfig, ScreenCaptureConfigureResult>(
6890            &mut payload,
6891            0x3b6e5af1d294afd9,
6892            fidl::encoding::DynamicFlags::empty(),
6893            _decode,
6894        )
6895    }
6896
6897    type GetNextFrameResponseFut = fidl::client::QueryResponseFut<
6898        ScreenCaptureGetNextFrameResult,
6899        fidl::encoding::DefaultFuchsiaResourceDialect,
6900    >;
6901    fn r#get_next_frame(&self, mut payload: GetNextFrameArgs) -> Self::GetNextFrameResponseFut {
6902        fn _decode(
6903            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6904        ) -> Result<ScreenCaptureGetNextFrameResult, fidl::Error> {
6905            let _response = fidl::client::decode_transaction_body::<
6906                fidl::encoding::ResultType<FrameInfo, ScreenCaptureError>,
6907                fidl::encoding::DefaultFuchsiaResourceDialect,
6908                0x552c1580aab8c4a7,
6909            >(_buf?)?;
6910            Ok(_response.map(|x| x))
6911        }
6912        self.client.send_query_and_decode::<GetNextFrameArgs, ScreenCaptureGetNextFrameResult>(
6913            &mut payload,
6914            0x552c1580aab8c4a7,
6915            fidl::encoding::DynamicFlags::empty(),
6916            _decode,
6917        )
6918    }
6919
6920    type ReleaseFrameResponseFut = fidl::client::QueryResponseFut<
6921        ScreenCaptureReleaseFrameResult,
6922        fidl::encoding::DefaultFuchsiaResourceDialect,
6923    >;
6924    fn r#release_frame(&self, mut buffer_id: u32) -> Self::ReleaseFrameResponseFut {
6925        fn _decode(
6926            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6927        ) -> Result<ScreenCaptureReleaseFrameResult, fidl::Error> {
6928            let _response = fidl::client::decode_transaction_body::<
6929                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, ScreenCaptureError>,
6930                fidl::encoding::DefaultFuchsiaResourceDialect,
6931                0x46704dce24e35950,
6932            >(_buf?)?;
6933            Ok(_response.map(|x| x))
6934        }
6935        self.client.send_query_and_decode::<
6936            ScreenCaptureReleaseFrameRequest,
6937            ScreenCaptureReleaseFrameResult,
6938        >(
6939            (buffer_id,),
6940            0x46704dce24e35950,
6941            fidl::encoding::DynamicFlags::empty(),
6942            _decode,
6943        )
6944    }
6945}
6946
6947pub struct ScreenCaptureEventStream {
6948    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
6949}
6950
6951impl std::marker::Unpin for ScreenCaptureEventStream {}
6952
6953impl futures::stream::FusedStream for ScreenCaptureEventStream {
6954    fn is_terminated(&self) -> bool {
6955        self.event_receiver.is_terminated()
6956    }
6957}
6958
6959impl futures::Stream for ScreenCaptureEventStream {
6960    type Item = Result<ScreenCaptureEvent, fidl::Error>;
6961
6962    fn poll_next(
6963        mut self: std::pin::Pin<&mut Self>,
6964        cx: &mut std::task::Context<'_>,
6965    ) -> std::task::Poll<Option<Self::Item>> {
6966        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
6967            &mut self.event_receiver,
6968            cx
6969        )?) {
6970            Some(buf) => std::task::Poll::Ready(Some(ScreenCaptureEvent::decode(buf))),
6971            None => std::task::Poll::Ready(None),
6972        }
6973    }
6974}
6975
6976#[derive(Debug)]
6977pub enum ScreenCaptureEvent {}
6978
6979impl ScreenCaptureEvent {
6980    /// Decodes a message buffer as a [`ScreenCaptureEvent`].
6981    fn decode(
6982        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
6983    ) -> Result<ScreenCaptureEvent, fidl::Error> {
6984        let (bytes, _handles) = buf.split_mut();
6985        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6986        debug_assert_eq!(tx_header.tx_id, 0);
6987        match tx_header.ordinal {
6988            _ => Err(fidl::Error::UnknownOrdinal {
6989                ordinal: tx_header.ordinal,
6990                protocol_name: <ScreenCaptureMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6991            }),
6992        }
6993    }
6994}
6995
6996/// A Stream of incoming requests for fuchsia.ui.composition/ScreenCapture.
6997pub struct ScreenCaptureRequestStream {
6998    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6999    is_terminated: bool,
7000}
7001
7002impl std::marker::Unpin for ScreenCaptureRequestStream {}
7003
7004impl futures::stream::FusedStream for ScreenCaptureRequestStream {
7005    fn is_terminated(&self) -> bool {
7006        self.is_terminated
7007    }
7008}
7009
7010impl fidl::endpoints::RequestStream for ScreenCaptureRequestStream {
7011    type Protocol = ScreenCaptureMarker;
7012    type ControlHandle = ScreenCaptureControlHandle;
7013
7014    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
7015        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
7016    }
7017
7018    fn control_handle(&self) -> Self::ControlHandle {
7019        ScreenCaptureControlHandle { inner: self.inner.clone() }
7020    }
7021
7022    fn into_inner(
7023        self,
7024    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
7025    {
7026        (self.inner, self.is_terminated)
7027    }
7028
7029    fn from_inner(
7030        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7031        is_terminated: bool,
7032    ) -> Self {
7033        Self { inner, is_terminated }
7034    }
7035}
7036
7037impl futures::Stream for ScreenCaptureRequestStream {
7038    type Item = Result<ScreenCaptureRequest, fidl::Error>;
7039
7040    fn poll_next(
7041        mut self: std::pin::Pin<&mut Self>,
7042        cx: &mut std::task::Context<'_>,
7043    ) -> std::task::Poll<Option<Self::Item>> {
7044        let this = &mut *self;
7045        if this.inner.check_shutdown(cx) {
7046            this.is_terminated = true;
7047            return std::task::Poll::Ready(None);
7048        }
7049        if this.is_terminated {
7050            panic!("polled ScreenCaptureRequestStream after completion");
7051        }
7052        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
7053            |bytes, handles| {
7054                match this.inner.channel().read_etc(cx, bytes, handles) {
7055                    std::task::Poll::Ready(Ok(())) => {}
7056                    std::task::Poll::Pending => return std::task::Poll::Pending,
7057                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
7058                        this.is_terminated = true;
7059                        return std::task::Poll::Ready(None);
7060                    }
7061                    std::task::Poll::Ready(Err(e)) => {
7062                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
7063                            e.into(),
7064                        ))));
7065                    }
7066                }
7067
7068                // A message has been received from the channel
7069                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7070
7071                std::task::Poll::Ready(Some(match header.ordinal {
7072                    0x3b6e5af1d294afd9 => {
7073                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7074                        let mut req = fidl::new_empty!(
7075                            ScreenCaptureConfig,
7076                            fidl::encoding::DefaultFuchsiaResourceDialect
7077                        );
7078                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ScreenCaptureConfig>(&header, _body_bytes, handles, &mut req)?;
7079                        let control_handle =
7080                            ScreenCaptureControlHandle { inner: this.inner.clone() };
7081                        Ok(ScreenCaptureRequest::Configure {
7082                            payload: req,
7083                            responder: ScreenCaptureConfigureResponder {
7084                                control_handle: std::mem::ManuallyDrop::new(control_handle),
7085                                tx_id: header.tx_id,
7086                            },
7087                        })
7088                    }
7089                    0x552c1580aab8c4a7 => {
7090                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7091                        let mut req = fidl::new_empty!(
7092                            GetNextFrameArgs,
7093                            fidl::encoding::DefaultFuchsiaResourceDialect
7094                        );
7095                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<GetNextFrameArgs>(&header, _body_bytes, handles, &mut req)?;
7096                        let control_handle =
7097                            ScreenCaptureControlHandle { inner: this.inner.clone() };
7098                        Ok(ScreenCaptureRequest::GetNextFrame {
7099                            payload: req,
7100                            responder: ScreenCaptureGetNextFrameResponder {
7101                                control_handle: std::mem::ManuallyDrop::new(control_handle),
7102                                tx_id: header.tx_id,
7103                            },
7104                        })
7105                    }
7106                    0x46704dce24e35950 => {
7107                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7108                        let mut req = fidl::new_empty!(
7109                            ScreenCaptureReleaseFrameRequest,
7110                            fidl::encoding::DefaultFuchsiaResourceDialect
7111                        );
7112                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ScreenCaptureReleaseFrameRequest>(&header, _body_bytes, handles, &mut req)?;
7113                        let control_handle =
7114                            ScreenCaptureControlHandle { inner: this.inner.clone() };
7115                        Ok(ScreenCaptureRequest::ReleaseFrame {
7116                            buffer_id: req.buffer_id,
7117
7118                            responder: ScreenCaptureReleaseFrameResponder {
7119                                control_handle: std::mem::ManuallyDrop::new(control_handle),
7120                                tx_id: header.tx_id,
7121                            },
7122                        })
7123                    }
7124                    _ => Err(fidl::Error::UnknownOrdinal {
7125                        ordinal: header.ordinal,
7126                        protocol_name:
7127                            <ScreenCaptureMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
7128                    }),
7129                }))
7130            },
7131        )
7132    }
7133}
7134
7135/// This protocol provides a low-level ScreenCapture API for clients to use.
7136/// ScreenCapture clients should familiarize themselves with the
7137/// [`fuchsia.sysmem/BufferCollection`] and [`fuchsia.ui.composition/Allocator`] protocols
7138/// as those are necessary to create the BufferCollections and images ScreenCapture uses.
7139#[derive(Debug)]
7140pub enum ScreenCaptureRequest {
7141    /// Clients should first use the Allocator protocol to register a
7142    /// BufferCollection. This function will fail with BAD_OPERATION unless all clients of the
7143    /// BufferCollection have set their constraints.
7144    ///
7145    /// Afterwards, clients should create and configure the images that will
7146    /// eventually be rendered to using this method. All the buffers in the
7147    /// collection from 0 to (buffer_count-1) may be used for screen capture.
7148    ///
7149    /// Clients are responsible for determining the rotation of the display,
7150    /// and applying the corrective rotation. For instance, if the display is
7151    /// mounted 90 degrees clockwise (the "top" is on the right, when looking
7152    /// at the display), then the client should specify a 270 degree rotation
7153    /// to account for it.
7154    ///
7155    /// Similarly, the clients are responsible for specifying a buffer big
7156    /// enough for the rotated image. If the buffer is too small, a best effort
7157    /// attempt will be made to render the image.
7158    ///
7159    /// Finally, clients request the server to render the current screen to the
7160    /// shared buffers using [`GetNextFrame`].
7161    ///
7162    /// [`Configure`] can be called again with a new BufferCollectionImportToken
7163    /// if the client wishes to change any of the configuration settings. In
7164    /// this case all the buffers from the previous call to [`Configure`] will
7165    /// be released.
7166    Configure { payload: ScreenCaptureConfig, responder: ScreenCaptureConfigureResponder },
7167    /// Following a successful call to [`Configure`], clients can call
7168    /// GetNextFrame. This will populate a buffer with the most recent frame.
7169    ///
7170    /// Clients should wait on the zx::event they pass for successful
7171    /// completion of the screenshot. It is not guaranteed that the screenshot
7172    /// will be completed by the time this function returns.
7173    ///
7174    /// The requested image will be in the BufferCollection that the client set
7175    /// up in the VMO at the index specified by buffer_id.
7176    ///
7177    /// When ScreenCapture is used to provide a stream, the rate that the
7178    /// client calls GetNextFrame will drive the frame rate.
7179    ///
7180    /// Errors:
7181    /// BAD_OPERATION if Configure was not called, or not called successfully
7182    /// MISSING_ARGS if a required argument is not present
7183    /// BUFFER_FULL if all buffers in the BufferCollection are in use. In this case, ReleaseFrame
7184    /// must be called to make a buffer available before this function can be called successfully.
7185    GetNextFrame { payload: GetNextFrameArgs, responder: ScreenCaptureGetNextFrameResponder },
7186    /// Once the client no longer needs an image, they can call ReleaseFrame on
7187    /// the VMO index of the buffer so that the server can reuse it in the future.
7188    ReleaseFrame { buffer_id: u32, responder: ScreenCaptureReleaseFrameResponder },
7189}
7190
7191impl ScreenCaptureRequest {
7192    #[allow(irrefutable_let_patterns)]
7193    pub fn into_configure(self) -> Option<(ScreenCaptureConfig, ScreenCaptureConfigureResponder)> {
7194        if let ScreenCaptureRequest::Configure { payload, responder } = self {
7195            Some((payload, responder))
7196        } else {
7197            None
7198        }
7199    }
7200
7201    #[allow(irrefutable_let_patterns)]
7202    pub fn into_get_next_frame(
7203        self,
7204    ) -> Option<(GetNextFrameArgs, ScreenCaptureGetNextFrameResponder)> {
7205        if let ScreenCaptureRequest::GetNextFrame { payload, responder } = self {
7206            Some((payload, responder))
7207        } else {
7208            None
7209        }
7210    }
7211
7212    #[allow(irrefutable_let_patterns)]
7213    pub fn into_release_frame(self) -> Option<(u32, ScreenCaptureReleaseFrameResponder)> {
7214        if let ScreenCaptureRequest::ReleaseFrame { buffer_id, responder } = self {
7215            Some((buffer_id, responder))
7216        } else {
7217            None
7218        }
7219    }
7220
7221    /// Name of the method defined in FIDL
7222    pub fn method_name(&self) -> &'static str {
7223        match *self {
7224            ScreenCaptureRequest::Configure { .. } => "configure",
7225            ScreenCaptureRequest::GetNextFrame { .. } => "get_next_frame",
7226            ScreenCaptureRequest::ReleaseFrame { .. } => "release_frame",
7227        }
7228    }
7229}
7230
7231#[derive(Debug, Clone)]
7232pub struct ScreenCaptureControlHandle {
7233    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7234}
7235
7236impl fidl::endpoints::ControlHandle for ScreenCaptureControlHandle {
7237    fn shutdown(&self) {
7238        self.inner.shutdown()
7239    }
7240
7241    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
7242        self.inner.shutdown_with_epitaph(status)
7243    }
7244
7245    fn is_closed(&self) -> bool {
7246        self.inner.channel().is_closed()
7247    }
7248    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
7249        self.inner.channel().on_closed()
7250    }
7251
7252    #[cfg(target_os = "fuchsia")]
7253    fn signal_peer(
7254        &self,
7255        clear_mask: zx::Signals,
7256        set_mask: zx::Signals,
7257    ) -> Result<(), zx_status::Status> {
7258        use fidl::Peered;
7259        self.inner.channel().signal_peer(clear_mask, set_mask)
7260    }
7261}
7262
7263impl ScreenCaptureControlHandle {}
7264
7265#[must_use = "FIDL methods require a response to be sent"]
7266#[derive(Debug)]
7267pub struct ScreenCaptureConfigureResponder {
7268    control_handle: std::mem::ManuallyDrop<ScreenCaptureControlHandle>,
7269    tx_id: u32,
7270}
7271
7272/// Set the the channel to be shutdown (see [`ScreenCaptureControlHandle::shutdown`])
7273/// if the responder is dropped without sending a response, so that the client
7274/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7275impl std::ops::Drop for ScreenCaptureConfigureResponder {
7276    fn drop(&mut self) {
7277        self.control_handle.shutdown();
7278        // Safety: drops once, never accessed again
7279        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7280    }
7281}
7282
7283impl fidl::endpoints::Responder for ScreenCaptureConfigureResponder {
7284    type ControlHandle = ScreenCaptureControlHandle;
7285
7286    fn control_handle(&self) -> &ScreenCaptureControlHandle {
7287        &self.control_handle
7288    }
7289
7290    fn drop_without_shutdown(mut self) {
7291        // Safety: drops once, never accessed again due to mem::forget
7292        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7293        // Prevent Drop from running (which would shut down the channel)
7294        std::mem::forget(self);
7295    }
7296}
7297
7298impl ScreenCaptureConfigureResponder {
7299    /// Sends a response to the FIDL transaction.
7300    ///
7301    /// Sets the channel to shutdown if an error occurs.
7302    pub fn send(self, mut result: Result<(), ScreenCaptureError>) -> Result<(), fidl::Error> {
7303        let _result = self.send_raw(result);
7304        if _result.is_err() {
7305            self.control_handle.shutdown();
7306        }
7307        self.drop_without_shutdown();
7308        _result
7309    }
7310
7311    /// Similar to "send" but does not shutdown the channel if an error occurs.
7312    pub fn send_no_shutdown_on_err(
7313        self,
7314        mut result: Result<(), ScreenCaptureError>,
7315    ) -> Result<(), fidl::Error> {
7316        let _result = self.send_raw(result);
7317        self.drop_without_shutdown();
7318        _result
7319    }
7320
7321    fn send_raw(&self, mut result: Result<(), ScreenCaptureError>) -> Result<(), fidl::Error> {
7322        self.control_handle.inner.send::<fidl::encoding::ResultType<
7323            fidl::encoding::EmptyStruct,
7324            ScreenCaptureError,
7325        >>(
7326            result,
7327            self.tx_id,
7328            0x3b6e5af1d294afd9,
7329            fidl::encoding::DynamicFlags::empty(),
7330        )
7331    }
7332}
7333
7334#[must_use = "FIDL methods require a response to be sent"]
7335#[derive(Debug)]
7336pub struct ScreenCaptureGetNextFrameResponder {
7337    control_handle: std::mem::ManuallyDrop<ScreenCaptureControlHandle>,
7338    tx_id: u32,
7339}
7340
7341/// Set the the channel to be shutdown (see [`ScreenCaptureControlHandle::shutdown`])
7342/// if the responder is dropped without sending a response, so that the client
7343/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7344impl std::ops::Drop for ScreenCaptureGetNextFrameResponder {
7345    fn drop(&mut self) {
7346        self.control_handle.shutdown();
7347        // Safety: drops once, never accessed again
7348        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7349    }
7350}
7351
7352impl fidl::endpoints::Responder for ScreenCaptureGetNextFrameResponder {
7353    type ControlHandle = ScreenCaptureControlHandle;
7354
7355    fn control_handle(&self) -> &ScreenCaptureControlHandle {
7356        &self.control_handle
7357    }
7358
7359    fn drop_without_shutdown(mut self) {
7360        // Safety: drops once, never accessed again due to mem::forget
7361        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7362        // Prevent Drop from running (which would shut down the channel)
7363        std::mem::forget(self);
7364    }
7365}
7366
7367impl ScreenCaptureGetNextFrameResponder {
7368    /// Sends a response to the FIDL transaction.
7369    ///
7370    /// Sets the channel to shutdown if an error occurs.
7371    pub fn send(
7372        self,
7373        mut result: Result<FrameInfo, ScreenCaptureError>,
7374    ) -> Result<(), fidl::Error> {
7375        let _result = self.send_raw(result);
7376        if _result.is_err() {
7377            self.control_handle.shutdown();
7378        }
7379        self.drop_without_shutdown();
7380        _result
7381    }
7382
7383    /// Similar to "send" but does not shutdown the channel if an error occurs.
7384    pub fn send_no_shutdown_on_err(
7385        self,
7386        mut result: Result<FrameInfo, ScreenCaptureError>,
7387    ) -> Result<(), fidl::Error> {
7388        let _result = self.send_raw(result);
7389        self.drop_without_shutdown();
7390        _result
7391    }
7392
7393    fn send_raw(
7394        &self,
7395        mut result: Result<FrameInfo, ScreenCaptureError>,
7396    ) -> Result<(), fidl::Error> {
7397        self.control_handle.inner.send::<fidl::encoding::ResultType<FrameInfo, ScreenCaptureError>>(
7398            result.as_mut().map_err(|e| *e),
7399            self.tx_id,
7400            0x552c1580aab8c4a7,
7401            fidl::encoding::DynamicFlags::empty(),
7402        )
7403    }
7404}
7405
7406#[must_use = "FIDL methods require a response to be sent"]
7407#[derive(Debug)]
7408pub struct ScreenCaptureReleaseFrameResponder {
7409    control_handle: std::mem::ManuallyDrop<ScreenCaptureControlHandle>,
7410    tx_id: u32,
7411}
7412
7413/// Set the the channel to be shutdown (see [`ScreenCaptureControlHandle::shutdown`])
7414/// if the responder is dropped without sending a response, so that the client
7415/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7416impl std::ops::Drop for ScreenCaptureReleaseFrameResponder {
7417    fn drop(&mut self) {
7418        self.control_handle.shutdown();
7419        // Safety: drops once, never accessed again
7420        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7421    }
7422}
7423
7424impl fidl::endpoints::Responder for ScreenCaptureReleaseFrameResponder {
7425    type ControlHandle = ScreenCaptureControlHandle;
7426
7427    fn control_handle(&self) -> &ScreenCaptureControlHandle {
7428        &self.control_handle
7429    }
7430
7431    fn drop_without_shutdown(mut self) {
7432        // Safety: drops once, never accessed again due to mem::forget
7433        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7434        // Prevent Drop from running (which would shut down the channel)
7435        std::mem::forget(self);
7436    }
7437}
7438
7439impl ScreenCaptureReleaseFrameResponder {
7440    /// Sends a response to the FIDL transaction.
7441    ///
7442    /// Sets the channel to shutdown if an error occurs.
7443    pub fn send(self, mut result: Result<(), ScreenCaptureError>) -> Result<(), fidl::Error> {
7444        let _result = self.send_raw(result);
7445        if _result.is_err() {
7446            self.control_handle.shutdown();
7447        }
7448        self.drop_without_shutdown();
7449        _result
7450    }
7451
7452    /// Similar to "send" but does not shutdown the channel if an error occurs.
7453    pub fn send_no_shutdown_on_err(
7454        self,
7455        mut result: Result<(), ScreenCaptureError>,
7456    ) -> Result<(), fidl::Error> {
7457        let _result = self.send_raw(result);
7458        self.drop_without_shutdown();
7459        _result
7460    }
7461
7462    fn send_raw(&self, mut result: Result<(), ScreenCaptureError>) -> Result<(), fidl::Error> {
7463        self.control_handle.inner.send::<fidl::encoding::ResultType<
7464            fidl::encoding::EmptyStruct,
7465            ScreenCaptureError,
7466        >>(
7467            result,
7468            self.tx_id,
7469            0x46704dce24e35950,
7470            fidl::encoding::DynamicFlags::empty(),
7471        )
7472    }
7473}
7474
7475#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
7476pub struct ScreenshotMarker;
7477
7478impl fidl::endpoints::ProtocolMarker for ScreenshotMarker {
7479    type Proxy = ScreenshotProxy;
7480    type RequestStream = ScreenshotRequestStream;
7481    #[cfg(target_os = "fuchsia")]
7482    type SynchronousProxy = ScreenshotSynchronousProxy;
7483
7484    const DEBUG_NAME: &'static str = "fuchsia.ui.composition.Screenshot";
7485}
7486impl fidl::endpoints::DiscoverableProtocolMarker for ScreenshotMarker {}
7487
7488pub trait ScreenshotProxyInterface: Send + Sync {
7489    type TakeResponseFut: std::future::Future<Output = Result<ScreenshotTakeResponse, fidl::Error>>
7490        + Send;
7491    fn r#take(&self, payload: ScreenshotTakeRequest) -> Self::TakeResponseFut;
7492    type TakeFileResponseFut: std::future::Future<Output = Result<ScreenshotTakeFileResponse, fidl::Error>>
7493        + Send;
7494    fn r#take_file(&self, payload: ScreenshotTakeFileRequest) -> Self::TakeFileResponseFut;
7495}
7496#[derive(Debug)]
7497#[cfg(target_os = "fuchsia")]
7498pub struct ScreenshotSynchronousProxy {
7499    client: fidl::client::sync::Client,
7500}
7501
7502#[cfg(target_os = "fuchsia")]
7503impl fidl::endpoints::SynchronousProxy for ScreenshotSynchronousProxy {
7504    type Proxy = ScreenshotProxy;
7505    type Protocol = ScreenshotMarker;
7506
7507    fn from_channel(inner: fidl::Channel) -> Self {
7508        Self::new(inner)
7509    }
7510
7511    fn into_channel(self) -> fidl::Channel {
7512        self.client.into_channel()
7513    }
7514
7515    fn as_channel(&self) -> &fidl::Channel {
7516        self.client.as_channel()
7517    }
7518}
7519
7520#[cfg(target_os = "fuchsia")]
7521impl ScreenshotSynchronousProxy {
7522    pub fn new(channel: fidl::Channel) -> Self {
7523        let protocol_name = <ScreenshotMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
7524        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
7525    }
7526
7527    pub fn into_channel(self) -> fidl::Channel {
7528        self.client.into_channel()
7529    }
7530
7531    /// Waits until an event arrives and returns it. It is safe for other
7532    /// threads to make concurrent requests while waiting for an event.
7533    pub fn wait_for_event(
7534        &self,
7535        deadline: zx::MonotonicInstant,
7536    ) -> Result<ScreenshotEvent, fidl::Error> {
7537        ScreenshotEvent::decode(self.client.wait_for_event(deadline)?)
7538    }
7539
7540    /// Collects the current graphical content of a display in a specified buffer `format` in the
7541    /// sRGB color space. Note that the sRGB color space is non-linear, meaning that unit tests
7542    /// doing pixel equality checks making use of non-fully saturated colors should convert to a
7543    /// linear color space.
7544    ///
7545    /// See https://fuchsia.dev/fuchsia-src/concepts/ui/scenic/color_spaces for more information.
7546    ///
7547    /// Screenshot is taken immediately, populated with the display's content from the most recent
7548    /// VSYNC.
7549    ///
7550    /// If the client calls [`Take`] a second time before a first [`Take`] call returns, the server
7551    /// will close the Screenshot connection with a ZX_ERR_SHOULD_WAIT epitaph.
7552    ///
7553    /// If capture fails due to an internal error, the server will close the Screenshot connection
7554    /// with a ZX_ERR_INTERNAL epitaph.
7555    pub fn r#take(
7556        &self,
7557        mut payload: ScreenshotTakeRequest,
7558        ___deadline: zx::MonotonicInstant,
7559    ) -> Result<ScreenshotTakeResponse, fidl::Error> {
7560        let _response = self.client.send_query::<ScreenshotTakeRequest, ScreenshotTakeResponse>(
7561            &mut payload,
7562            0x51341396e9fd2fd0,
7563            fidl::encoding::DynamicFlags::empty(),
7564            ___deadline,
7565        )?;
7566        Ok(_response)
7567    }
7568
7569    /// Collects the current graphical content of a display in a specified buffer `format` in the
7570    /// sRGB color space. Note that the sRGB color space is non-linear, meaning that unit tests
7571    /// doing pixel equality checks making use of non-fully saturated colors should convert to a
7572    /// linear color space.
7573    ///
7574    /// TODO(https://fxbug.dev/42065844): Link to fuchsia.dev documentation when it's up.
7575    ///
7576    /// Screenshot is taken immediately, populated with the display's content from the most recent
7577    /// VSYNC.
7578    ///
7579    /// If the client calls [`TakeFile`] a second time before a first [`TakeFile`] call returns,
7580    /// the server will close the Screenshot connection with a ZX_ERR_SHOULD_WAIT epitaph.
7581    ///
7582    /// If capture fails due to an internal error, the server will close the Screenshot connection
7583    /// with a ZX_ERR_INTERNAL epitaph.
7584    ///
7585    /// This call should be used if the client is on the host and does not support VMOs,
7586    /// as is the case for ffx tools.
7587    pub fn r#take_file(
7588        &self,
7589        mut payload: ScreenshotTakeFileRequest,
7590        ___deadline: zx::MonotonicInstant,
7591    ) -> Result<ScreenshotTakeFileResponse, fidl::Error> {
7592        let _response =
7593            self.client.send_query::<ScreenshotTakeFileRequest, ScreenshotTakeFileResponse>(
7594                &mut payload,
7595                0x470aeea0a4d32903,
7596                fidl::encoding::DynamicFlags::empty(),
7597                ___deadline,
7598            )?;
7599        Ok(_response)
7600    }
7601}
7602
7603#[cfg(target_os = "fuchsia")]
7604impl From<ScreenshotSynchronousProxy> for zx::NullableHandle {
7605    fn from(value: ScreenshotSynchronousProxy) -> Self {
7606        value.into_channel().into()
7607    }
7608}
7609
7610#[cfg(target_os = "fuchsia")]
7611impl From<fidl::Channel> for ScreenshotSynchronousProxy {
7612    fn from(value: fidl::Channel) -> Self {
7613        Self::new(value)
7614    }
7615}
7616
7617#[cfg(target_os = "fuchsia")]
7618impl fidl::endpoints::FromClient for ScreenshotSynchronousProxy {
7619    type Protocol = ScreenshotMarker;
7620
7621    fn from_client(value: fidl::endpoints::ClientEnd<ScreenshotMarker>) -> Self {
7622        Self::new(value.into_channel())
7623    }
7624}
7625
7626#[derive(Debug, Clone)]
7627pub struct ScreenshotProxy {
7628    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
7629}
7630
7631impl fidl::endpoints::Proxy for ScreenshotProxy {
7632    type Protocol = ScreenshotMarker;
7633
7634    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
7635        Self::new(inner)
7636    }
7637
7638    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
7639        self.client.into_channel().map_err(|client| Self { client })
7640    }
7641
7642    fn as_channel(&self) -> &::fidl::AsyncChannel {
7643        self.client.as_channel()
7644    }
7645}
7646
7647impl ScreenshotProxy {
7648    /// Create a new Proxy for fuchsia.ui.composition/Screenshot.
7649    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
7650        let protocol_name = <ScreenshotMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
7651        Self { client: fidl::client::Client::new(channel, protocol_name) }
7652    }
7653
7654    /// Get a Stream of events from the remote end of the protocol.
7655    ///
7656    /// # Panics
7657    ///
7658    /// Panics if the event stream was already taken.
7659    pub fn take_event_stream(&self) -> ScreenshotEventStream {
7660        ScreenshotEventStream { event_receiver: self.client.take_event_receiver() }
7661    }
7662
7663    /// Collects the current graphical content of a display in a specified buffer `format` in the
7664    /// sRGB color space. Note that the sRGB color space is non-linear, meaning that unit tests
7665    /// doing pixel equality checks making use of non-fully saturated colors should convert to a
7666    /// linear color space.
7667    ///
7668    /// See https://fuchsia.dev/fuchsia-src/concepts/ui/scenic/color_spaces for more information.
7669    ///
7670    /// Screenshot is taken immediately, populated with the display's content from the most recent
7671    /// VSYNC.
7672    ///
7673    /// If the client calls [`Take`] a second time before a first [`Take`] call returns, the server
7674    /// will close the Screenshot connection with a ZX_ERR_SHOULD_WAIT epitaph.
7675    ///
7676    /// If capture fails due to an internal error, the server will close the Screenshot connection
7677    /// with a ZX_ERR_INTERNAL epitaph.
7678    pub fn r#take(
7679        &self,
7680        mut payload: ScreenshotTakeRequest,
7681    ) -> fidl::client::QueryResponseFut<
7682        ScreenshotTakeResponse,
7683        fidl::encoding::DefaultFuchsiaResourceDialect,
7684    > {
7685        ScreenshotProxyInterface::r#take(self, payload)
7686    }
7687
7688    /// Collects the current graphical content of a display in a specified buffer `format` in the
7689    /// sRGB color space. Note that the sRGB color space is non-linear, meaning that unit tests
7690    /// doing pixel equality checks making use of non-fully saturated colors should convert to a
7691    /// linear color space.
7692    ///
7693    /// TODO(https://fxbug.dev/42065844): Link to fuchsia.dev documentation when it's up.
7694    ///
7695    /// Screenshot is taken immediately, populated with the display's content from the most recent
7696    /// VSYNC.
7697    ///
7698    /// If the client calls [`TakeFile`] a second time before a first [`TakeFile`] call returns,
7699    /// the server will close the Screenshot connection with a ZX_ERR_SHOULD_WAIT epitaph.
7700    ///
7701    /// If capture fails due to an internal error, the server will close the Screenshot connection
7702    /// with a ZX_ERR_INTERNAL epitaph.
7703    ///
7704    /// This call should be used if the client is on the host and does not support VMOs,
7705    /// as is the case for ffx tools.
7706    pub fn r#take_file(
7707        &self,
7708        mut payload: ScreenshotTakeFileRequest,
7709    ) -> fidl::client::QueryResponseFut<
7710        ScreenshotTakeFileResponse,
7711        fidl::encoding::DefaultFuchsiaResourceDialect,
7712    > {
7713        ScreenshotProxyInterface::r#take_file(self, payload)
7714    }
7715}
7716
7717impl ScreenshotProxyInterface for ScreenshotProxy {
7718    type TakeResponseFut = fidl::client::QueryResponseFut<
7719        ScreenshotTakeResponse,
7720        fidl::encoding::DefaultFuchsiaResourceDialect,
7721    >;
7722    fn r#take(&self, mut payload: ScreenshotTakeRequest) -> Self::TakeResponseFut {
7723        fn _decode(
7724            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7725        ) -> Result<ScreenshotTakeResponse, fidl::Error> {
7726            let _response = fidl::client::decode_transaction_body::<
7727                ScreenshotTakeResponse,
7728                fidl::encoding::DefaultFuchsiaResourceDialect,
7729                0x51341396e9fd2fd0,
7730            >(_buf?)?;
7731            Ok(_response)
7732        }
7733        self.client.send_query_and_decode::<ScreenshotTakeRequest, ScreenshotTakeResponse>(
7734            &mut payload,
7735            0x51341396e9fd2fd0,
7736            fidl::encoding::DynamicFlags::empty(),
7737            _decode,
7738        )
7739    }
7740
7741    type TakeFileResponseFut = fidl::client::QueryResponseFut<
7742        ScreenshotTakeFileResponse,
7743        fidl::encoding::DefaultFuchsiaResourceDialect,
7744    >;
7745    fn r#take_file(&self, mut payload: ScreenshotTakeFileRequest) -> Self::TakeFileResponseFut {
7746        fn _decode(
7747            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7748        ) -> Result<ScreenshotTakeFileResponse, fidl::Error> {
7749            let _response = fidl::client::decode_transaction_body::<
7750                ScreenshotTakeFileResponse,
7751                fidl::encoding::DefaultFuchsiaResourceDialect,
7752                0x470aeea0a4d32903,
7753            >(_buf?)?;
7754            Ok(_response)
7755        }
7756        self.client.send_query_and_decode::<ScreenshotTakeFileRequest, ScreenshotTakeFileResponse>(
7757            &mut payload,
7758            0x470aeea0a4d32903,
7759            fidl::encoding::DynamicFlags::empty(),
7760            _decode,
7761        )
7762    }
7763}
7764
7765pub struct ScreenshotEventStream {
7766    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
7767}
7768
7769impl std::marker::Unpin for ScreenshotEventStream {}
7770
7771impl futures::stream::FusedStream for ScreenshotEventStream {
7772    fn is_terminated(&self) -> bool {
7773        self.event_receiver.is_terminated()
7774    }
7775}
7776
7777impl futures::Stream for ScreenshotEventStream {
7778    type Item = Result<ScreenshotEvent, fidl::Error>;
7779
7780    fn poll_next(
7781        mut self: std::pin::Pin<&mut Self>,
7782        cx: &mut std::task::Context<'_>,
7783    ) -> std::task::Poll<Option<Self::Item>> {
7784        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
7785            &mut self.event_receiver,
7786            cx
7787        )?) {
7788            Some(buf) => std::task::Poll::Ready(Some(ScreenshotEvent::decode(buf))),
7789            None => std::task::Poll::Ready(None),
7790        }
7791    }
7792}
7793
7794#[derive(Debug)]
7795pub enum ScreenshotEvent {}
7796
7797impl ScreenshotEvent {
7798    /// Decodes a message buffer as a [`ScreenshotEvent`].
7799    fn decode(
7800        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
7801    ) -> Result<ScreenshotEvent, fidl::Error> {
7802        let (bytes, _handles) = buf.split_mut();
7803        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7804        debug_assert_eq!(tx_header.tx_id, 0);
7805        match tx_header.ordinal {
7806            _ => Err(fidl::Error::UnknownOrdinal {
7807                ordinal: tx_header.ordinal,
7808                protocol_name: <ScreenshotMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
7809            }),
7810        }
7811    }
7812}
7813
7814/// A Stream of incoming requests for fuchsia.ui.composition/Screenshot.
7815pub struct ScreenshotRequestStream {
7816    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7817    is_terminated: bool,
7818}
7819
7820impl std::marker::Unpin for ScreenshotRequestStream {}
7821
7822impl futures::stream::FusedStream for ScreenshotRequestStream {
7823    fn is_terminated(&self) -> bool {
7824        self.is_terminated
7825    }
7826}
7827
7828impl fidl::endpoints::RequestStream for ScreenshotRequestStream {
7829    type Protocol = ScreenshotMarker;
7830    type ControlHandle = ScreenshotControlHandle;
7831
7832    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
7833        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
7834    }
7835
7836    fn control_handle(&self) -> Self::ControlHandle {
7837        ScreenshotControlHandle { inner: self.inner.clone() }
7838    }
7839
7840    fn into_inner(
7841        self,
7842    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
7843    {
7844        (self.inner, self.is_terminated)
7845    }
7846
7847    fn from_inner(
7848        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7849        is_terminated: bool,
7850    ) -> Self {
7851        Self { inner, is_terminated }
7852    }
7853}
7854
7855impl futures::Stream for ScreenshotRequestStream {
7856    type Item = Result<ScreenshotRequest, fidl::Error>;
7857
7858    fn poll_next(
7859        mut self: std::pin::Pin<&mut Self>,
7860        cx: &mut std::task::Context<'_>,
7861    ) -> std::task::Poll<Option<Self::Item>> {
7862        let this = &mut *self;
7863        if this.inner.check_shutdown(cx) {
7864            this.is_terminated = true;
7865            return std::task::Poll::Ready(None);
7866        }
7867        if this.is_terminated {
7868            panic!("polled ScreenshotRequestStream after completion");
7869        }
7870        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
7871            |bytes, handles| {
7872                match this.inner.channel().read_etc(cx, bytes, handles) {
7873                    std::task::Poll::Ready(Ok(())) => {}
7874                    std::task::Poll::Pending => return std::task::Poll::Pending,
7875                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
7876                        this.is_terminated = true;
7877                        return std::task::Poll::Ready(None);
7878                    }
7879                    std::task::Poll::Ready(Err(e)) => {
7880                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
7881                            e.into(),
7882                        ))));
7883                    }
7884                }
7885
7886                // A message has been received from the channel
7887                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7888
7889                std::task::Poll::Ready(Some(match header.ordinal {
7890                    0x51341396e9fd2fd0 => {
7891                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7892                        let mut req = fidl::new_empty!(
7893                            ScreenshotTakeRequest,
7894                            fidl::encoding::DefaultFuchsiaResourceDialect
7895                        );
7896                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ScreenshotTakeRequest>(&header, _body_bytes, handles, &mut req)?;
7897                        let control_handle = ScreenshotControlHandle { inner: this.inner.clone() };
7898                        Ok(ScreenshotRequest::Take {
7899                            payload: req,
7900                            responder: ScreenshotTakeResponder {
7901                                control_handle: std::mem::ManuallyDrop::new(control_handle),
7902                                tx_id: header.tx_id,
7903                            },
7904                        })
7905                    }
7906                    0x470aeea0a4d32903 => {
7907                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7908                        let mut req = fidl::new_empty!(
7909                            ScreenshotTakeFileRequest,
7910                            fidl::encoding::DefaultFuchsiaResourceDialect
7911                        );
7912                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ScreenshotTakeFileRequest>(&header, _body_bytes, handles, &mut req)?;
7913                        let control_handle = ScreenshotControlHandle { inner: this.inner.clone() };
7914                        Ok(ScreenshotRequest::TakeFile {
7915                            payload: req,
7916                            responder: ScreenshotTakeFileResponder {
7917                                control_handle: std::mem::ManuallyDrop::new(control_handle),
7918                                tx_id: header.tx_id,
7919                            },
7920                        })
7921                    }
7922                    _ => Err(fidl::Error::UnknownOrdinal {
7923                        ordinal: header.ordinal,
7924                        protocol_name:
7925                            <ScreenshotMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
7926                    }),
7927                }))
7928            },
7929        )
7930    }
7931}
7932
7933/// Collects the current graphical content of a display.
7934#[derive(Debug)]
7935pub enum ScreenshotRequest {
7936    /// Collects the current graphical content of a display in a specified buffer `format` in the
7937    /// sRGB color space. Note that the sRGB color space is non-linear, meaning that unit tests
7938    /// doing pixel equality checks making use of non-fully saturated colors should convert to a
7939    /// linear color space.
7940    ///
7941    /// See https://fuchsia.dev/fuchsia-src/concepts/ui/scenic/color_spaces for more information.
7942    ///
7943    /// Screenshot is taken immediately, populated with the display's content from the most recent
7944    /// VSYNC.
7945    ///
7946    /// If the client calls [`Take`] a second time before a first [`Take`] call returns, the server
7947    /// will close the Screenshot connection with a ZX_ERR_SHOULD_WAIT epitaph.
7948    ///
7949    /// If capture fails due to an internal error, the server will close the Screenshot connection
7950    /// with a ZX_ERR_INTERNAL epitaph.
7951    Take { payload: ScreenshotTakeRequest, responder: ScreenshotTakeResponder },
7952    /// Collects the current graphical content of a display in a specified buffer `format` in the
7953    /// sRGB color space. Note that the sRGB color space is non-linear, meaning that unit tests
7954    /// doing pixel equality checks making use of non-fully saturated colors should convert to a
7955    /// linear color space.
7956    ///
7957    /// TODO(https://fxbug.dev/42065844): Link to fuchsia.dev documentation when it's up.
7958    ///
7959    /// Screenshot is taken immediately, populated with the display's content from the most recent
7960    /// VSYNC.
7961    ///
7962    /// If the client calls [`TakeFile`] a second time before a first [`TakeFile`] call returns,
7963    /// the server will close the Screenshot connection with a ZX_ERR_SHOULD_WAIT epitaph.
7964    ///
7965    /// If capture fails due to an internal error, the server will close the Screenshot connection
7966    /// with a ZX_ERR_INTERNAL epitaph.
7967    ///
7968    /// This call should be used if the client is on the host and does not support VMOs,
7969    /// as is the case for ffx tools.
7970    TakeFile { payload: ScreenshotTakeFileRequest, responder: ScreenshotTakeFileResponder },
7971}
7972
7973impl ScreenshotRequest {
7974    #[allow(irrefutable_let_patterns)]
7975    pub fn into_take(self) -> Option<(ScreenshotTakeRequest, ScreenshotTakeResponder)> {
7976        if let ScreenshotRequest::Take { payload, responder } = self {
7977            Some((payload, responder))
7978        } else {
7979            None
7980        }
7981    }
7982
7983    #[allow(irrefutable_let_patterns)]
7984    pub fn into_take_file(
7985        self,
7986    ) -> Option<(ScreenshotTakeFileRequest, ScreenshotTakeFileResponder)> {
7987        if let ScreenshotRequest::TakeFile { payload, responder } = self {
7988            Some((payload, responder))
7989        } else {
7990            None
7991        }
7992    }
7993
7994    /// Name of the method defined in FIDL
7995    pub fn method_name(&self) -> &'static str {
7996        match *self {
7997            ScreenshotRequest::Take { .. } => "take",
7998            ScreenshotRequest::TakeFile { .. } => "take_file",
7999        }
8000    }
8001}
8002
8003#[derive(Debug, Clone)]
8004pub struct ScreenshotControlHandle {
8005    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8006}
8007
8008impl fidl::endpoints::ControlHandle for ScreenshotControlHandle {
8009    fn shutdown(&self) {
8010        self.inner.shutdown()
8011    }
8012
8013    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
8014        self.inner.shutdown_with_epitaph(status)
8015    }
8016
8017    fn is_closed(&self) -> bool {
8018        self.inner.channel().is_closed()
8019    }
8020    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
8021        self.inner.channel().on_closed()
8022    }
8023
8024    #[cfg(target_os = "fuchsia")]
8025    fn signal_peer(
8026        &self,
8027        clear_mask: zx::Signals,
8028        set_mask: zx::Signals,
8029    ) -> Result<(), zx_status::Status> {
8030        use fidl::Peered;
8031        self.inner.channel().signal_peer(clear_mask, set_mask)
8032    }
8033}
8034
8035impl ScreenshotControlHandle {}
8036
8037#[must_use = "FIDL methods require a response to be sent"]
8038#[derive(Debug)]
8039pub struct ScreenshotTakeResponder {
8040    control_handle: std::mem::ManuallyDrop<ScreenshotControlHandle>,
8041    tx_id: u32,
8042}
8043
8044/// Set the the channel to be shutdown (see [`ScreenshotControlHandle::shutdown`])
8045/// if the responder is dropped without sending a response, so that the client
8046/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
8047impl std::ops::Drop for ScreenshotTakeResponder {
8048    fn drop(&mut self) {
8049        self.control_handle.shutdown();
8050        // Safety: drops once, never accessed again
8051        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8052    }
8053}
8054
8055impl fidl::endpoints::Responder for ScreenshotTakeResponder {
8056    type ControlHandle = ScreenshotControlHandle;
8057
8058    fn control_handle(&self) -> &ScreenshotControlHandle {
8059        &self.control_handle
8060    }
8061
8062    fn drop_without_shutdown(mut self) {
8063        // Safety: drops once, never accessed again due to mem::forget
8064        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8065        // Prevent Drop from running (which would shut down the channel)
8066        std::mem::forget(self);
8067    }
8068}
8069
8070impl ScreenshotTakeResponder {
8071    /// Sends a response to the FIDL transaction.
8072    ///
8073    /// Sets the channel to shutdown if an error occurs.
8074    pub fn send(self, mut payload: ScreenshotTakeResponse) -> Result<(), fidl::Error> {
8075        let _result = self.send_raw(payload);
8076        if _result.is_err() {
8077            self.control_handle.shutdown();
8078        }
8079        self.drop_without_shutdown();
8080        _result
8081    }
8082
8083    /// Similar to "send" but does not shutdown the channel if an error occurs.
8084    pub fn send_no_shutdown_on_err(
8085        self,
8086        mut payload: ScreenshotTakeResponse,
8087    ) -> Result<(), fidl::Error> {
8088        let _result = self.send_raw(payload);
8089        self.drop_without_shutdown();
8090        _result
8091    }
8092
8093    fn send_raw(&self, mut payload: ScreenshotTakeResponse) -> Result<(), fidl::Error> {
8094        self.control_handle.inner.send::<ScreenshotTakeResponse>(
8095            &mut payload,
8096            self.tx_id,
8097            0x51341396e9fd2fd0,
8098            fidl::encoding::DynamicFlags::empty(),
8099        )
8100    }
8101}
8102
8103#[must_use = "FIDL methods require a response to be sent"]
8104#[derive(Debug)]
8105pub struct ScreenshotTakeFileResponder {
8106    control_handle: std::mem::ManuallyDrop<ScreenshotControlHandle>,
8107    tx_id: u32,
8108}
8109
8110/// Set the the channel to be shutdown (see [`ScreenshotControlHandle::shutdown`])
8111/// if the responder is dropped without sending a response, so that the client
8112/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
8113impl std::ops::Drop for ScreenshotTakeFileResponder {
8114    fn drop(&mut self) {
8115        self.control_handle.shutdown();
8116        // Safety: drops once, never accessed again
8117        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8118    }
8119}
8120
8121impl fidl::endpoints::Responder for ScreenshotTakeFileResponder {
8122    type ControlHandle = ScreenshotControlHandle;
8123
8124    fn control_handle(&self) -> &ScreenshotControlHandle {
8125        &self.control_handle
8126    }
8127
8128    fn drop_without_shutdown(mut self) {
8129        // Safety: drops once, never accessed again due to mem::forget
8130        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8131        // Prevent Drop from running (which would shut down the channel)
8132        std::mem::forget(self);
8133    }
8134}
8135
8136impl ScreenshotTakeFileResponder {
8137    /// Sends a response to the FIDL transaction.
8138    ///
8139    /// Sets the channel to shutdown if an error occurs.
8140    pub fn send(self, mut payload: ScreenshotTakeFileResponse) -> Result<(), fidl::Error> {
8141        let _result = self.send_raw(payload);
8142        if _result.is_err() {
8143            self.control_handle.shutdown();
8144        }
8145        self.drop_without_shutdown();
8146        _result
8147    }
8148
8149    /// Similar to "send" but does not shutdown the channel if an error occurs.
8150    pub fn send_no_shutdown_on_err(
8151        self,
8152        mut payload: ScreenshotTakeFileResponse,
8153    ) -> Result<(), fidl::Error> {
8154        let _result = self.send_raw(payload);
8155        self.drop_without_shutdown();
8156        _result
8157    }
8158
8159    fn send_raw(&self, mut payload: ScreenshotTakeFileResponse) -> Result<(), fidl::Error> {
8160        self.control_handle.inner.send::<ScreenshotTakeFileResponse>(
8161            &mut payload,
8162            self.tx_id,
8163            0x470aeea0a4d32903,
8164            fidl::encoding::DynamicFlags::empty(),
8165        )
8166    }
8167}
8168
8169#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
8170pub struct TrustedFlatlandMarker;
8171
8172impl fidl::endpoints::ProtocolMarker for TrustedFlatlandMarker {
8173    type Proxy = TrustedFlatlandProxy;
8174    type RequestStream = TrustedFlatlandRequestStream;
8175    #[cfg(target_os = "fuchsia")]
8176    type SynchronousProxy = TrustedFlatlandSynchronousProxy;
8177
8178    const DEBUG_NAME: &'static str = "(anonymous) TrustedFlatland";
8179}
8180
8181pub trait TrustedFlatlandProxyInterface: Send + Sync {
8182    fn r#release_image_immediately(&self, image_id: &ContentId) -> Result<(), fidl::Error>;
8183}
8184#[derive(Debug)]
8185#[cfg(target_os = "fuchsia")]
8186pub struct TrustedFlatlandSynchronousProxy {
8187    client: fidl::client::sync::Client,
8188}
8189
8190#[cfg(target_os = "fuchsia")]
8191impl fidl::endpoints::SynchronousProxy for TrustedFlatlandSynchronousProxy {
8192    type Proxy = TrustedFlatlandProxy;
8193    type Protocol = TrustedFlatlandMarker;
8194
8195    fn from_channel(inner: fidl::Channel) -> Self {
8196        Self::new(inner)
8197    }
8198
8199    fn into_channel(self) -> fidl::Channel {
8200        self.client.into_channel()
8201    }
8202
8203    fn as_channel(&self) -> &fidl::Channel {
8204        self.client.as_channel()
8205    }
8206}
8207
8208#[cfg(target_os = "fuchsia")]
8209impl TrustedFlatlandSynchronousProxy {
8210    pub fn new(channel: fidl::Channel) -> Self {
8211        let protocol_name = <TrustedFlatlandMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
8212        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
8213    }
8214
8215    pub fn into_channel(self) -> fidl::Channel {
8216        self.client.into_channel()
8217    }
8218
8219    /// Waits until an event arrives and returns it. It is safe for other
8220    /// threads to make concurrent requests while waiting for an event.
8221    pub fn wait_for_event(
8222        &self,
8223        deadline: zx::MonotonicInstant,
8224    ) -> Result<TrustedFlatlandEvent, fidl::Error> {
8225        TrustedFlatlandEvent::decode(self.client.wait_for_event(deadline)?)
8226    }
8227
8228    /// Releases an image immediately, without waiting for the next present.
8229    pub fn r#release_image_immediately(&self, mut image_id: &ContentId) -> Result<(), fidl::Error> {
8230        self.client.send::<TrustedFlatlandReleaseImageImmediatelyRequest>(
8231            (image_id,),
8232            0x245e1ac080772c8,
8233            fidl::encoding::DynamicFlags::empty(),
8234        )
8235    }
8236}
8237
8238#[cfg(target_os = "fuchsia")]
8239impl From<TrustedFlatlandSynchronousProxy> for zx::NullableHandle {
8240    fn from(value: TrustedFlatlandSynchronousProxy) -> Self {
8241        value.into_channel().into()
8242    }
8243}
8244
8245#[cfg(target_os = "fuchsia")]
8246impl From<fidl::Channel> for TrustedFlatlandSynchronousProxy {
8247    fn from(value: fidl::Channel) -> Self {
8248        Self::new(value)
8249    }
8250}
8251
8252#[cfg(target_os = "fuchsia")]
8253impl fidl::endpoints::FromClient for TrustedFlatlandSynchronousProxy {
8254    type Protocol = TrustedFlatlandMarker;
8255
8256    fn from_client(value: fidl::endpoints::ClientEnd<TrustedFlatlandMarker>) -> Self {
8257        Self::new(value.into_channel())
8258    }
8259}
8260
8261#[derive(Debug, Clone)]
8262pub struct TrustedFlatlandProxy {
8263    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
8264}
8265
8266impl fidl::endpoints::Proxy for TrustedFlatlandProxy {
8267    type Protocol = TrustedFlatlandMarker;
8268
8269    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
8270        Self::new(inner)
8271    }
8272
8273    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
8274        self.client.into_channel().map_err(|client| Self { client })
8275    }
8276
8277    fn as_channel(&self) -> &::fidl::AsyncChannel {
8278        self.client.as_channel()
8279    }
8280}
8281
8282impl TrustedFlatlandProxy {
8283    /// Create a new Proxy for fuchsia.ui.composition/TrustedFlatland.
8284    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
8285        let protocol_name = <TrustedFlatlandMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
8286        Self { client: fidl::client::Client::new(channel, protocol_name) }
8287    }
8288
8289    /// Get a Stream of events from the remote end of the protocol.
8290    ///
8291    /// # Panics
8292    ///
8293    /// Panics if the event stream was already taken.
8294    pub fn take_event_stream(&self) -> TrustedFlatlandEventStream {
8295        TrustedFlatlandEventStream { event_receiver: self.client.take_event_receiver() }
8296    }
8297
8298    /// Releases an image immediately, without waiting for the next present.
8299    pub fn r#release_image_immediately(&self, mut image_id: &ContentId) -> Result<(), fidl::Error> {
8300        TrustedFlatlandProxyInterface::r#release_image_immediately(self, image_id)
8301    }
8302}
8303
8304impl TrustedFlatlandProxyInterface for TrustedFlatlandProxy {
8305    fn r#release_image_immediately(&self, mut image_id: &ContentId) -> Result<(), fidl::Error> {
8306        self.client.send::<TrustedFlatlandReleaseImageImmediatelyRequest>(
8307            (image_id,),
8308            0x245e1ac080772c8,
8309            fidl::encoding::DynamicFlags::empty(),
8310        )
8311    }
8312}
8313
8314pub struct TrustedFlatlandEventStream {
8315    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
8316}
8317
8318impl std::marker::Unpin for TrustedFlatlandEventStream {}
8319
8320impl futures::stream::FusedStream for TrustedFlatlandEventStream {
8321    fn is_terminated(&self) -> bool {
8322        self.event_receiver.is_terminated()
8323    }
8324}
8325
8326impl futures::Stream for TrustedFlatlandEventStream {
8327    type Item = Result<TrustedFlatlandEvent, fidl::Error>;
8328
8329    fn poll_next(
8330        mut self: std::pin::Pin<&mut Self>,
8331        cx: &mut std::task::Context<'_>,
8332    ) -> std::task::Poll<Option<Self::Item>> {
8333        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
8334            &mut self.event_receiver,
8335            cx
8336        )?) {
8337            Some(buf) => std::task::Poll::Ready(Some(TrustedFlatlandEvent::decode(buf))),
8338            None => std::task::Poll::Ready(None),
8339        }
8340    }
8341}
8342
8343#[derive(Debug)]
8344pub enum TrustedFlatlandEvent {}
8345
8346impl TrustedFlatlandEvent {
8347    /// Decodes a message buffer as a [`TrustedFlatlandEvent`].
8348    fn decode(
8349        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
8350    ) -> Result<TrustedFlatlandEvent, fidl::Error> {
8351        let (bytes, _handles) = buf.split_mut();
8352        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
8353        debug_assert_eq!(tx_header.tx_id, 0);
8354        match tx_header.ordinal {
8355            _ => Err(fidl::Error::UnknownOrdinal {
8356                ordinal: tx_header.ordinal,
8357                protocol_name:
8358                    <TrustedFlatlandMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
8359            }),
8360        }
8361    }
8362}
8363
8364/// A Stream of incoming requests for fuchsia.ui.composition/TrustedFlatland.
8365pub struct TrustedFlatlandRequestStream {
8366    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8367    is_terminated: bool,
8368}
8369
8370impl std::marker::Unpin for TrustedFlatlandRequestStream {}
8371
8372impl futures::stream::FusedStream for TrustedFlatlandRequestStream {
8373    fn is_terminated(&self) -> bool {
8374        self.is_terminated
8375    }
8376}
8377
8378impl fidl::endpoints::RequestStream for TrustedFlatlandRequestStream {
8379    type Protocol = TrustedFlatlandMarker;
8380    type ControlHandle = TrustedFlatlandControlHandle;
8381
8382    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
8383        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
8384    }
8385
8386    fn control_handle(&self) -> Self::ControlHandle {
8387        TrustedFlatlandControlHandle { inner: self.inner.clone() }
8388    }
8389
8390    fn into_inner(
8391        self,
8392    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
8393    {
8394        (self.inner, self.is_terminated)
8395    }
8396
8397    fn from_inner(
8398        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8399        is_terminated: bool,
8400    ) -> Self {
8401        Self { inner, is_terminated }
8402    }
8403}
8404
8405impl futures::Stream for TrustedFlatlandRequestStream {
8406    type Item = Result<TrustedFlatlandRequest, fidl::Error>;
8407
8408    fn poll_next(
8409        mut self: std::pin::Pin<&mut Self>,
8410        cx: &mut std::task::Context<'_>,
8411    ) -> std::task::Poll<Option<Self::Item>> {
8412        let this = &mut *self;
8413        if this.inner.check_shutdown(cx) {
8414            this.is_terminated = true;
8415            return std::task::Poll::Ready(None);
8416        }
8417        if this.is_terminated {
8418            panic!("polled TrustedFlatlandRequestStream after completion");
8419        }
8420        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
8421            |bytes, handles| {
8422                match this.inner.channel().read_etc(cx, bytes, handles) {
8423                    std::task::Poll::Ready(Ok(())) => {}
8424                    std::task::Poll::Pending => return std::task::Poll::Pending,
8425                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
8426                        this.is_terminated = true;
8427                        return std::task::Poll::Ready(None);
8428                    }
8429                    std::task::Poll::Ready(Err(e)) => {
8430                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
8431                            e.into(),
8432                        ))));
8433                    }
8434                }
8435
8436                // A message has been received from the channel
8437                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
8438
8439                std::task::Poll::Ready(Some(match header.ordinal {
8440                    0x245e1ac080772c8 => {
8441                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
8442                        let mut req = fidl::new_empty!(
8443                            TrustedFlatlandReleaseImageImmediatelyRequest,
8444                            fidl::encoding::DefaultFuchsiaResourceDialect
8445                        );
8446                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<TrustedFlatlandReleaseImageImmediatelyRequest>(&header, _body_bytes, handles, &mut req)?;
8447                        let control_handle =
8448                            TrustedFlatlandControlHandle { inner: this.inner.clone() };
8449                        Ok(TrustedFlatlandRequest::ReleaseImageImmediately {
8450                            image_id: req.image_id,
8451
8452                            control_handle,
8453                        })
8454                    }
8455                    _ => Err(fidl::Error::UnknownOrdinal {
8456                        ordinal: header.ordinal,
8457                        protocol_name:
8458                            <TrustedFlatlandMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
8459                    }),
8460                }))
8461            },
8462        )
8463    }
8464}
8465
8466/// A privileged protocol for trusted Flatland instances that require special capabilities.
8467///
8468/// This protocol is composed into [`fuchsia.ui.composition/Flatland`]. Methods in this protocol
8469/// are only available if the `Flatland` instance was created through
8470/// [`fuchsia.ui.composition/TrustedFlatlandFactory`].
8471#[derive(Debug)]
8472pub enum TrustedFlatlandRequest {
8473    /// Releases an image immediately, without waiting for the next present.
8474    ReleaseImageImmediately { image_id: ContentId, control_handle: TrustedFlatlandControlHandle },
8475}
8476
8477impl TrustedFlatlandRequest {
8478    #[allow(irrefutable_let_patterns)]
8479    pub fn into_release_image_immediately(
8480        self,
8481    ) -> Option<(ContentId, TrustedFlatlandControlHandle)> {
8482        if let TrustedFlatlandRequest::ReleaseImageImmediately { image_id, control_handle } = self {
8483            Some((image_id, control_handle))
8484        } else {
8485            None
8486        }
8487    }
8488
8489    /// Name of the method defined in FIDL
8490    pub fn method_name(&self) -> &'static str {
8491        match *self {
8492            TrustedFlatlandRequest::ReleaseImageImmediately { .. } => "release_image_immediately",
8493        }
8494    }
8495}
8496
8497#[derive(Debug, Clone)]
8498pub struct TrustedFlatlandControlHandle {
8499    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8500}
8501
8502impl fidl::endpoints::ControlHandle for TrustedFlatlandControlHandle {
8503    fn shutdown(&self) {
8504        self.inner.shutdown()
8505    }
8506
8507    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
8508        self.inner.shutdown_with_epitaph(status)
8509    }
8510
8511    fn is_closed(&self) -> bool {
8512        self.inner.channel().is_closed()
8513    }
8514    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
8515        self.inner.channel().on_closed()
8516    }
8517
8518    #[cfg(target_os = "fuchsia")]
8519    fn signal_peer(
8520        &self,
8521        clear_mask: zx::Signals,
8522        set_mask: zx::Signals,
8523    ) -> Result<(), zx_status::Status> {
8524        use fidl::Peered;
8525        self.inner.channel().signal_peer(clear_mask, set_mask)
8526    }
8527}
8528
8529impl TrustedFlatlandControlHandle {}
8530
8531#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
8532pub struct TrustedFlatlandFactoryMarker;
8533
8534impl fidl::endpoints::ProtocolMarker for TrustedFlatlandFactoryMarker {
8535    type Proxy = TrustedFlatlandFactoryProxy;
8536    type RequestStream = TrustedFlatlandFactoryRequestStream;
8537    #[cfg(target_os = "fuchsia")]
8538    type SynchronousProxy = TrustedFlatlandFactorySynchronousProxy;
8539
8540    const DEBUG_NAME: &'static str = "fuchsia.ui.composition.TrustedFlatlandFactory";
8541}
8542impl fidl::endpoints::DiscoverableProtocolMarker for TrustedFlatlandFactoryMarker {}
8543pub type TrustedFlatlandFactoryCreateFlatlandResult = Result<(), TrustedFlatlandFactoryError>;
8544
8545pub trait TrustedFlatlandFactoryProxyInterface: Send + Sync {
8546    type CreateFlatlandResponseFut: std::future::Future<
8547            Output = Result<TrustedFlatlandFactoryCreateFlatlandResult, fidl::Error>,
8548        > + Send;
8549    fn r#create_flatland(
8550        &self,
8551        server_end: fidl::endpoints::ServerEnd<FlatlandMarker>,
8552        config: TrustedFlatlandConfig,
8553    ) -> Self::CreateFlatlandResponseFut;
8554}
8555#[derive(Debug)]
8556#[cfg(target_os = "fuchsia")]
8557pub struct TrustedFlatlandFactorySynchronousProxy {
8558    client: fidl::client::sync::Client,
8559}
8560
8561#[cfg(target_os = "fuchsia")]
8562impl fidl::endpoints::SynchronousProxy for TrustedFlatlandFactorySynchronousProxy {
8563    type Proxy = TrustedFlatlandFactoryProxy;
8564    type Protocol = TrustedFlatlandFactoryMarker;
8565
8566    fn from_channel(inner: fidl::Channel) -> Self {
8567        Self::new(inner)
8568    }
8569
8570    fn into_channel(self) -> fidl::Channel {
8571        self.client.into_channel()
8572    }
8573
8574    fn as_channel(&self) -> &fidl::Channel {
8575        self.client.as_channel()
8576    }
8577}
8578
8579#[cfg(target_os = "fuchsia")]
8580impl TrustedFlatlandFactorySynchronousProxy {
8581    pub fn new(channel: fidl::Channel) -> Self {
8582        let protocol_name =
8583            <TrustedFlatlandFactoryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
8584        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
8585    }
8586
8587    pub fn into_channel(self) -> fidl::Channel {
8588        self.client.into_channel()
8589    }
8590
8591    /// Waits until an event arrives and returns it. It is safe for other
8592    /// threads to make concurrent requests while waiting for an event.
8593    pub fn wait_for_event(
8594        &self,
8595        deadline: zx::MonotonicInstant,
8596    ) -> Result<TrustedFlatlandFactoryEvent, fidl::Error> {
8597        TrustedFlatlandFactoryEvent::decode(self.client.wait_for_event(deadline)?)
8598    }
8599
8600    /// Creates a new Flatland instance with the specified configuration.
8601    ///
8602    /// ## Error
8603    ///
8604    /// Returns a `TrustedFlatlandFactoryError` error if the operation fails.
8605    pub fn r#create_flatland(
8606        &self,
8607        mut server_end: fidl::endpoints::ServerEnd<FlatlandMarker>,
8608        mut config: TrustedFlatlandConfig,
8609        ___deadline: zx::MonotonicInstant,
8610    ) -> Result<TrustedFlatlandFactoryCreateFlatlandResult, fidl::Error> {
8611        let _response = self.client.send_query::<
8612            TrustedFlatlandFactoryCreateFlatlandRequest,
8613            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, TrustedFlatlandFactoryError>,
8614        >(
8615            (server_end, &mut config,),
8616            0x48e89c53f00561dc,
8617            fidl::encoding::DynamicFlags::empty(),
8618            ___deadline,
8619        )?;
8620        Ok(_response.map(|x| x))
8621    }
8622}
8623
8624#[cfg(target_os = "fuchsia")]
8625impl From<TrustedFlatlandFactorySynchronousProxy> for zx::NullableHandle {
8626    fn from(value: TrustedFlatlandFactorySynchronousProxy) -> Self {
8627        value.into_channel().into()
8628    }
8629}
8630
8631#[cfg(target_os = "fuchsia")]
8632impl From<fidl::Channel> for TrustedFlatlandFactorySynchronousProxy {
8633    fn from(value: fidl::Channel) -> Self {
8634        Self::new(value)
8635    }
8636}
8637
8638#[cfg(target_os = "fuchsia")]
8639impl fidl::endpoints::FromClient for TrustedFlatlandFactorySynchronousProxy {
8640    type Protocol = TrustedFlatlandFactoryMarker;
8641
8642    fn from_client(value: fidl::endpoints::ClientEnd<TrustedFlatlandFactoryMarker>) -> Self {
8643        Self::new(value.into_channel())
8644    }
8645}
8646
8647#[derive(Debug, Clone)]
8648pub struct TrustedFlatlandFactoryProxy {
8649    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
8650}
8651
8652impl fidl::endpoints::Proxy for TrustedFlatlandFactoryProxy {
8653    type Protocol = TrustedFlatlandFactoryMarker;
8654
8655    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
8656        Self::new(inner)
8657    }
8658
8659    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
8660        self.client.into_channel().map_err(|client| Self { client })
8661    }
8662
8663    fn as_channel(&self) -> &::fidl::AsyncChannel {
8664        self.client.as_channel()
8665    }
8666}
8667
8668impl TrustedFlatlandFactoryProxy {
8669    /// Create a new Proxy for fuchsia.ui.composition/TrustedFlatlandFactory.
8670    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
8671        let protocol_name =
8672            <TrustedFlatlandFactoryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
8673        Self { client: fidl::client::Client::new(channel, protocol_name) }
8674    }
8675
8676    /// Get a Stream of events from the remote end of the protocol.
8677    ///
8678    /// # Panics
8679    ///
8680    /// Panics if the event stream was already taken.
8681    pub fn take_event_stream(&self) -> TrustedFlatlandFactoryEventStream {
8682        TrustedFlatlandFactoryEventStream { event_receiver: self.client.take_event_receiver() }
8683    }
8684
8685    /// Creates a new Flatland instance with the specified configuration.
8686    ///
8687    /// ## Error
8688    ///
8689    /// Returns a `TrustedFlatlandFactoryError` error if the operation fails.
8690    pub fn r#create_flatland(
8691        &self,
8692        mut server_end: fidl::endpoints::ServerEnd<FlatlandMarker>,
8693        mut config: TrustedFlatlandConfig,
8694    ) -> fidl::client::QueryResponseFut<
8695        TrustedFlatlandFactoryCreateFlatlandResult,
8696        fidl::encoding::DefaultFuchsiaResourceDialect,
8697    > {
8698        TrustedFlatlandFactoryProxyInterface::r#create_flatland(self, server_end, config)
8699    }
8700}
8701
8702impl TrustedFlatlandFactoryProxyInterface for TrustedFlatlandFactoryProxy {
8703    type CreateFlatlandResponseFut = fidl::client::QueryResponseFut<
8704        TrustedFlatlandFactoryCreateFlatlandResult,
8705        fidl::encoding::DefaultFuchsiaResourceDialect,
8706    >;
8707    fn r#create_flatland(
8708        &self,
8709        mut server_end: fidl::endpoints::ServerEnd<FlatlandMarker>,
8710        mut config: TrustedFlatlandConfig,
8711    ) -> Self::CreateFlatlandResponseFut {
8712        fn _decode(
8713            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
8714        ) -> Result<TrustedFlatlandFactoryCreateFlatlandResult, fidl::Error> {
8715            let _response = fidl::client::decode_transaction_body::<
8716                fidl::encoding::ResultType<
8717                    fidl::encoding::EmptyStruct,
8718                    TrustedFlatlandFactoryError,
8719                >,
8720                fidl::encoding::DefaultFuchsiaResourceDialect,
8721                0x48e89c53f00561dc,
8722            >(_buf?)?;
8723            Ok(_response.map(|x| x))
8724        }
8725        self.client.send_query_and_decode::<
8726            TrustedFlatlandFactoryCreateFlatlandRequest,
8727            TrustedFlatlandFactoryCreateFlatlandResult,
8728        >(
8729            (server_end, &mut config,),
8730            0x48e89c53f00561dc,
8731            fidl::encoding::DynamicFlags::empty(),
8732            _decode,
8733        )
8734    }
8735}
8736
8737pub struct TrustedFlatlandFactoryEventStream {
8738    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
8739}
8740
8741impl std::marker::Unpin for TrustedFlatlandFactoryEventStream {}
8742
8743impl futures::stream::FusedStream for TrustedFlatlandFactoryEventStream {
8744    fn is_terminated(&self) -> bool {
8745        self.event_receiver.is_terminated()
8746    }
8747}
8748
8749impl futures::Stream for TrustedFlatlandFactoryEventStream {
8750    type Item = Result<TrustedFlatlandFactoryEvent, fidl::Error>;
8751
8752    fn poll_next(
8753        mut self: std::pin::Pin<&mut Self>,
8754        cx: &mut std::task::Context<'_>,
8755    ) -> std::task::Poll<Option<Self::Item>> {
8756        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
8757            &mut self.event_receiver,
8758            cx
8759        )?) {
8760            Some(buf) => std::task::Poll::Ready(Some(TrustedFlatlandFactoryEvent::decode(buf))),
8761            None => std::task::Poll::Ready(None),
8762        }
8763    }
8764}
8765
8766#[derive(Debug)]
8767pub enum TrustedFlatlandFactoryEvent {}
8768
8769impl TrustedFlatlandFactoryEvent {
8770    /// Decodes a message buffer as a [`TrustedFlatlandFactoryEvent`].
8771    fn decode(
8772        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
8773    ) -> Result<TrustedFlatlandFactoryEvent, fidl::Error> {
8774        let (bytes, _handles) = buf.split_mut();
8775        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
8776        debug_assert_eq!(tx_header.tx_id, 0);
8777        match tx_header.ordinal {
8778            _ => Err(fidl::Error::UnknownOrdinal {
8779                ordinal: tx_header.ordinal,
8780                protocol_name:
8781                    <TrustedFlatlandFactoryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
8782            }),
8783        }
8784    }
8785}
8786
8787/// A Stream of incoming requests for fuchsia.ui.composition/TrustedFlatlandFactory.
8788pub struct TrustedFlatlandFactoryRequestStream {
8789    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8790    is_terminated: bool,
8791}
8792
8793impl std::marker::Unpin for TrustedFlatlandFactoryRequestStream {}
8794
8795impl futures::stream::FusedStream for TrustedFlatlandFactoryRequestStream {
8796    fn is_terminated(&self) -> bool {
8797        self.is_terminated
8798    }
8799}
8800
8801impl fidl::endpoints::RequestStream for TrustedFlatlandFactoryRequestStream {
8802    type Protocol = TrustedFlatlandFactoryMarker;
8803    type ControlHandle = TrustedFlatlandFactoryControlHandle;
8804
8805    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
8806        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
8807    }
8808
8809    fn control_handle(&self) -> Self::ControlHandle {
8810        TrustedFlatlandFactoryControlHandle { inner: self.inner.clone() }
8811    }
8812
8813    fn into_inner(
8814        self,
8815    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
8816    {
8817        (self.inner, self.is_terminated)
8818    }
8819
8820    fn from_inner(
8821        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8822        is_terminated: bool,
8823    ) -> Self {
8824        Self { inner, is_terminated }
8825    }
8826}
8827
8828impl futures::Stream for TrustedFlatlandFactoryRequestStream {
8829    type Item = Result<TrustedFlatlandFactoryRequest, fidl::Error>;
8830
8831    fn poll_next(
8832        mut self: std::pin::Pin<&mut Self>,
8833        cx: &mut std::task::Context<'_>,
8834    ) -> std::task::Poll<Option<Self::Item>> {
8835        let this = &mut *self;
8836        if this.inner.check_shutdown(cx) {
8837            this.is_terminated = true;
8838            return std::task::Poll::Ready(None);
8839        }
8840        if this.is_terminated {
8841            panic!("polled TrustedFlatlandFactoryRequestStream after completion");
8842        }
8843        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
8844            |bytes, handles| {
8845                match this.inner.channel().read_etc(cx, bytes, handles) {
8846                    std::task::Poll::Ready(Ok(())) => {}
8847                    std::task::Poll::Pending => return std::task::Poll::Pending,
8848                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
8849                        this.is_terminated = true;
8850                        return std::task::Poll::Ready(None);
8851                    }
8852                    std::task::Poll::Ready(Err(e)) => {
8853                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
8854                            e.into(),
8855                        ))));
8856                    }
8857                }
8858
8859                // A message has been received from the channel
8860                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
8861
8862                std::task::Poll::Ready(Some(match header.ordinal {
8863                0x48e89c53f00561dc => {
8864                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
8865                    let mut req = fidl::new_empty!(TrustedFlatlandFactoryCreateFlatlandRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
8866                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<TrustedFlatlandFactoryCreateFlatlandRequest>(&header, _body_bytes, handles, &mut req)?;
8867                    let control_handle = TrustedFlatlandFactoryControlHandle {
8868                        inner: this.inner.clone(),
8869                    };
8870                    Ok(TrustedFlatlandFactoryRequest::CreateFlatland {server_end: req.server_end,
8871config: req.config,
8872
8873                        responder: TrustedFlatlandFactoryCreateFlatlandResponder {
8874                            control_handle: std::mem::ManuallyDrop::new(control_handle),
8875                            tx_id: header.tx_id,
8876                        },
8877                    })
8878                }
8879                _ => Err(fidl::Error::UnknownOrdinal {
8880                    ordinal: header.ordinal,
8881                    protocol_name: <TrustedFlatlandFactoryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
8882                }),
8883            }))
8884            },
8885        )
8886    }
8887}
8888
8889/// A privileged factory for creating Flatland instances with special configurations.
8890///
8891/// This protocol is intended for trusted clients that require fine-grained control over
8892/// Flatland's behavior for performance-critical applications. It is not intended for
8893/// general use. Misuse of this API can negatively impact system performance and stability.
8894#[derive(Debug)]
8895pub enum TrustedFlatlandFactoryRequest {
8896    /// Creates a new Flatland instance with the specified configuration.
8897    ///
8898    /// ## Error
8899    ///
8900    /// Returns a `TrustedFlatlandFactoryError` error if the operation fails.
8901    CreateFlatland {
8902        server_end: fidl::endpoints::ServerEnd<FlatlandMarker>,
8903        config: TrustedFlatlandConfig,
8904        responder: TrustedFlatlandFactoryCreateFlatlandResponder,
8905    },
8906}
8907
8908impl TrustedFlatlandFactoryRequest {
8909    #[allow(irrefutable_let_patterns)]
8910    pub fn into_create_flatland(
8911        self,
8912    ) -> Option<(
8913        fidl::endpoints::ServerEnd<FlatlandMarker>,
8914        TrustedFlatlandConfig,
8915        TrustedFlatlandFactoryCreateFlatlandResponder,
8916    )> {
8917        if let TrustedFlatlandFactoryRequest::CreateFlatland { server_end, config, responder } =
8918            self
8919        {
8920            Some((server_end, config, responder))
8921        } else {
8922            None
8923        }
8924    }
8925
8926    /// Name of the method defined in FIDL
8927    pub fn method_name(&self) -> &'static str {
8928        match *self {
8929            TrustedFlatlandFactoryRequest::CreateFlatland { .. } => "create_flatland",
8930        }
8931    }
8932}
8933
8934#[derive(Debug, Clone)]
8935pub struct TrustedFlatlandFactoryControlHandle {
8936    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8937}
8938
8939impl fidl::endpoints::ControlHandle for TrustedFlatlandFactoryControlHandle {
8940    fn shutdown(&self) {
8941        self.inner.shutdown()
8942    }
8943
8944    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
8945        self.inner.shutdown_with_epitaph(status)
8946    }
8947
8948    fn is_closed(&self) -> bool {
8949        self.inner.channel().is_closed()
8950    }
8951    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
8952        self.inner.channel().on_closed()
8953    }
8954
8955    #[cfg(target_os = "fuchsia")]
8956    fn signal_peer(
8957        &self,
8958        clear_mask: zx::Signals,
8959        set_mask: zx::Signals,
8960    ) -> Result<(), zx_status::Status> {
8961        use fidl::Peered;
8962        self.inner.channel().signal_peer(clear_mask, set_mask)
8963    }
8964}
8965
8966impl TrustedFlatlandFactoryControlHandle {}
8967
8968#[must_use = "FIDL methods require a response to be sent"]
8969#[derive(Debug)]
8970pub struct TrustedFlatlandFactoryCreateFlatlandResponder {
8971    control_handle: std::mem::ManuallyDrop<TrustedFlatlandFactoryControlHandle>,
8972    tx_id: u32,
8973}
8974
8975/// Set the the channel to be shutdown (see [`TrustedFlatlandFactoryControlHandle::shutdown`])
8976/// if the responder is dropped without sending a response, so that the client
8977/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
8978impl std::ops::Drop for TrustedFlatlandFactoryCreateFlatlandResponder {
8979    fn drop(&mut self) {
8980        self.control_handle.shutdown();
8981        // Safety: drops once, never accessed again
8982        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8983    }
8984}
8985
8986impl fidl::endpoints::Responder for TrustedFlatlandFactoryCreateFlatlandResponder {
8987    type ControlHandle = TrustedFlatlandFactoryControlHandle;
8988
8989    fn control_handle(&self) -> &TrustedFlatlandFactoryControlHandle {
8990        &self.control_handle
8991    }
8992
8993    fn drop_without_shutdown(mut self) {
8994        // Safety: drops once, never accessed again due to mem::forget
8995        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8996        // Prevent Drop from running (which would shut down the channel)
8997        std::mem::forget(self);
8998    }
8999}
9000
9001impl TrustedFlatlandFactoryCreateFlatlandResponder {
9002    /// Sends a response to the FIDL transaction.
9003    ///
9004    /// Sets the channel to shutdown if an error occurs.
9005    pub fn send(
9006        self,
9007        mut result: Result<(), TrustedFlatlandFactoryError>,
9008    ) -> Result<(), fidl::Error> {
9009        let _result = self.send_raw(result);
9010        if _result.is_err() {
9011            self.control_handle.shutdown();
9012        }
9013        self.drop_without_shutdown();
9014        _result
9015    }
9016
9017    /// Similar to "send" but does not shutdown the channel if an error occurs.
9018    pub fn send_no_shutdown_on_err(
9019        self,
9020        mut result: Result<(), TrustedFlatlandFactoryError>,
9021    ) -> Result<(), fidl::Error> {
9022        let _result = self.send_raw(result);
9023        self.drop_without_shutdown();
9024        _result
9025    }
9026
9027    fn send_raw(
9028        &self,
9029        mut result: Result<(), TrustedFlatlandFactoryError>,
9030    ) -> Result<(), fidl::Error> {
9031        self.control_handle.inner.send::<fidl::encoding::ResultType<
9032            fidl::encoding::EmptyStruct,
9033            TrustedFlatlandFactoryError,
9034        >>(
9035            result,
9036            self.tx_id,
9037            0x48e89c53f00561dc,
9038            fidl::encoding::DynamicFlags::empty(),
9039        )
9040    }
9041}
9042
9043mod internal {
9044    use super::*;
9045
9046    impl fidl::encoding::ResourceTypeMarker for AllocatorRegisterBufferCollectionRequest {
9047        type Borrowed<'a> = &'a mut Self;
9048        fn take_or_borrow<'a>(
9049            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9050        ) -> Self::Borrowed<'a> {
9051            value
9052        }
9053    }
9054
9055    unsafe impl fidl::encoding::TypeMarker for AllocatorRegisterBufferCollectionRequest {
9056        type Owned = Self;
9057
9058        #[inline(always)]
9059        fn inline_align(_context: fidl::encoding::Context) -> usize {
9060            8
9061        }
9062
9063        #[inline(always)]
9064        fn inline_size(_context: fidl::encoding::Context) -> usize {
9065            16
9066        }
9067    }
9068
9069    unsafe impl
9070        fidl::encoding::Encode<
9071            AllocatorRegisterBufferCollectionRequest,
9072            fidl::encoding::DefaultFuchsiaResourceDialect,
9073        > for &mut AllocatorRegisterBufferCollectionRequest
9074    {
9075        #[inline]
9076        unsafe fn encode(
9077            self,
9078            encoder: &mut fidl::encoding::Encoder<
9079                '_,
9080                fidl::encoding::DefaultFuchsiaResourceDialect,
9081            >,
9082            offset: usize,
9083            _depth: fidl::encoding::Depth,
9084        ) -> fidl::Result<()> {
9085            encoder.debug_check_bounds::<AllocatorRegisterBufferCollectionRequest>(offset);
9086            // Delegate to tuple encoding.
9087            fidl::encoding::Encode::<AllocatorRegisterBufferCollectionRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
9088                (
9089                    <RegisterBufferCollectionArgs as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.args),
9090                ),
9091                encoder, offset, _depth
9092            )
9093        }
9094    }
9095    unsafe impl<
9096        T0: fidl::encoding::Encode<
9097                RegisterBufferCollectionArgs,
9098                fidl::encoding::DefaultFuchsiaResourceDialect,
9099            >,
9100    >
9101        fidl::encoding::Encode<
9102            AllocatorRegisterBufferCollectionRequest,
9103            fidl::encoding::DefaultFuchsiaResourceDialect,
9104        > for (T0,)
9105    {
9106        #[inline]
9107        unsafe fn encode(
9108            self,
9109            encoder: &mut fidl::encoding::Encoder<
9110                '_,
9111                fidl::encoding::DefaultFuchsiaResourceDialect,
9112            >,
9113            offset: usize,
9114            depth: fidl::encoding::Depth,
9115        ) -> fidl::Result<()> {
9116            encoder.debug_check_bounds::<AllocatorRegisterBufferCollectionRequest>(offset);
9117            // Zero out padding regions. There's no need to apply masks
9118            // because the unmasked parts will be overwritten by fields.
9119            // Write the fields.
9120            self.0.encode(encoder, offset + 0, depth)?;
9121            Ok(())
9122        }
9123    }
9124
9125    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
9126        for AllocatorRegisterBufferCollectionRequest
9127    {
9128        #[inline(always)]
9129        fn new_empty() -> Self {
9130            Self {
9131                args: fidl::new_empty!(
9132                    RegisterBufferCollectionArgs,
9133                    fidl::encoding::DefaultFuchsiaResourceDialect
9134                ),
9135            }
9136        }
9137
9138        #[inline]
9139        unsafe fn decode(
9140            &mut self,
9141            decoder: &mut fidl::encoding::Decoder<
9142                '_,
9143                fidl::encoding::DefaultFuchsiaResourceDialect,
9144            >,
9145            offset: usize,
9146            _depth: fidl::encoding::Depth,
9147        ) -> fidl::Result<()> {
9148            decoder.debug_check_bounds::<Self>(offset);
9149            // Verify that padding bytes are zero.
9150            fidl::decode!(
9151                RegisterBufferCollectionArgs,
9152                fidl::encoding::DefaultFuchsiaResourceDialect,
9153                &mut self.args,
9154                decoder,
9155                offset + 0,
9156                _depth
9157            )?;
9158            Ok(())
9159        }
9160    }
9161
9162    impl fidl::encoding::ResourceTypeMarker for BufferCollectionExportToken {
9163        type Borrowed<'a> = &'a mut Self;
9164        fn take_or_borrow<'a>(
9165            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9166        ) -> Self::Borrowed<'a> {
9167            value
9168        }
9169    }
9170
9171    unsafe impl fidl::encoding::TypeMarker for BufferCollectionExportToken {
9172        type Owned = Self;
9173
9174        #[inline(always)]
9175        fn inline_align(_context: fidl::encoding::Context) -> usize {
9176            4
9177        }
9178
9179        #[inline(always)]
9180        fn inline_size(_context: fidl::encoding::Context) -> usize {
9181            4
9182        }
9183    }
9184
9185    unsafe impl
9186        fidl::encoding::Encode<
9187            BufferCollectionExportToken,
9188            fidl::encoding::DefaultFuchsiaResourceDialect,
9189        > for &mut BufferCollectionExportToken
9190    {
9191        #[inline]
9192        unsafe fn encode(
9193            self,
9194            encoder: &mut fidl::encoding::Encoder<
9195                '_,
9196                fidl::encoding::DefaultFuchsiaResourceDialect,
9197            >,
9198            offset: usize,
9199            _depth: fidl::encoding::Depth,
9200        ) -> fidl::Result<()> {
9201            encoder.debug_check_bounds::<BufferCollectionExportToken>(offset);
9202            // Delegate to tuple encoding.
9203            fidl::encoding::Encode::<
9204                BufferCollectionExportToken,
9205                fidl::encoding::DefaultFuchsiaResourceDialect,
9206            >::encode(
9207                (<fidl::encoding::HandleType<
9208                    fidl::EventPair,
9209                    { fidl::ObjectType::EVENTPAIR.into_raw() },
9210                    2147483648,
9211                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
9212                    &mut self.value
9213                ),),
9214                encoder,
9215                offset,
9216                _depth,
9217            )
9218        }
9219    }
9220    unsafe impl<
9221        T0: fidl::encoding::Encode<
9222                fidl::encoding::HandleType<
9223                    fidl::EventPair,
9224                    { fidl::ObjectType::EVENTPAIR.into_raw() },
9225                    2147483648,
9226                >,
9227                fidl::encoding::DefaultFuchsiaResourceDialect,
9228            >,
9229    >
9230        fidl::encoding::Encode<
9231            BufferCollectionExportToken,
9232            fidl::encoding::DefaultFuchsiaResourceDialect,
9233        > for (T0,)
9234    {
9235        #[inline]
9236        unsafe fn encode(
9237            self,
9238            encoder: &mut fidl::encoding::Encoder<
9239                '_,
9240                fidl::encoding::DefaultFuchsiaResourceDialect,
9241            >,
9242            offset: usize,
9243            depth: fidl::encoding::Depth,
9244        ) -> fidl::Result<()> {
9245            encoder.debug_check_bounds::<BufferCollectionExportToken>(offset);
9246            // Zero out padding regions. There's no need to apply masks
9247            // because the unmasked parts will be overwritten by fields.
9248            // Write the fields.
9249            self.0.encode(encoder, offset + 0, depth)?;
9250            Ok(())
9251        }
9252    }
9253
9254    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
9255        for BufferCollectionExportToken
9256    {
9257        #[inline(always)]
9258        fn new_empty() -> Self {
9259            Self {
9260                value: fidl::new_empty!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
9261            }
9262        }
9263
9264        #[inline]
9265        unsafe fn decode(
9266            &mut self,
9267            decoder: &mut fidl::encoding::Decoder<
9268                '_,
9269                fidl::encoding::DefaultFuchsiaResourceDialect,
9270            >,
9271            offset: usize,
9272            _depth: fidl::encoding::Depth,
9273        ) -> fidl::Result<()> {
9274            decoder.debug_check_bounds::<Self>(offset);
9275            // Verify that padding bytes are zero.
9276            fidl::decode!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.value, decoder, offset + 0, _depth)?;
9277            Ok(())
9278        }
9279    }
9280
9281    impl fidl::encoding::ResourceTypeMarker for BufferCollectionImportToken {
9282        type Borrowed<'a> = &'a mut Self;
9283        fn take_or_borrow<'a>(
9284            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9285        ) -> Self::Borrowed<'a> {
9286            value
9287        }
9288    }
9289
9290    unsafe impl fidl::encoding::TypeMarker for BufferCollectionImportToken {
9291        type Owned = Self;
9292
9293        #[inline(always)]
9294        fn inline_align(_context: fidl::encoding::Context) -> usize {
9295            4
9296        }
9297
9298        #[inline(always)]
9299        fn inline_size(_context: fidl::encoding::Context) -> usize {
9300            4
9301        }
9302    }
9303
9304    unsafe impl
9305        fidl::encoding::Encode<
9306            BufferCollectionImportToken,
9307            fidl::encoding::DefaultFuchsiaResourceDialect,
9308        > for &mut BufferCollectionImportToken
9309    {
9310        #[inline]
9311        unsafe fn encode(
9312            self,
9313            encoder: &mut fidl::encoding::Encoder<
9314                '_,
9315                fidl::encoding::DefaultFuchsiaResourceDialect,
9316            >,
9317            offset: usize,
9318            _depth: fidl::encoding::Depth,
9319        ) -> fidl::Result<()> {
9320            encoder.debug_check_bounds::<BufferCollectionImportToken>(offset);
9321            // Delegate to tuple encoding.
9322            fidl::encoding::Encode::<
9323                BufferCollectionImportToken,
9324                fidl::encoding::DefaultFuchsiaResourceDialect,
9325            >::encode(
9326                (<fidl::encoding::HandleType<
9327                    fidl::EventPair,
9328                    { fidl::ObjectType::EVENTPAIR.into_raw() },
9329                    2147483648,
9330                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
9331                    &mut self.value
9332                ),),
9333                encoder,
9334                offset,
9335                _depth,
9336            )
9337        }
9338    }
9339    unsafe impl<
9340        T0: fidl::encoding::Encode<
9341                fidl::encoding::HandleType<
9342                    fidl::EventPair,
9343                    { fidl::ObjectType::EVENTPAIR.into_raw() },
9344                    2147483648,
9345                >,
9346                fidl::encoding::DefaultFuchsiaResourceDialect,
9347            >,
9348    >
9349        fidl::encoding::Encode<
9350            BufferCollectionImportToken,
9351            fidl::encoding::DefaultFuchsiaResourceDialect,
9352        > for (T0,)
9353    {
9354        #[inline]
9355        unsafe fn encode(
9356            self,
9357            encoder: &mut fidl::encoding::Encoder<
9358                '_,
9359                fidl::encoding::DefaultFuchsiaResourceDialect,
9360            >,
9361            offset: usize,
9362            depth: fidl::encoding::Depth,
9363        ) -> fidl::Result<()> {
9364            encoder.debug_check_bounds::<BufferCollectionImportToken>(offset);
9365            // Zero out padding regions. There's no need to apply masks
9366            // because the unmasked parts will be overwritten by fields.
9367            // Write the fields.
9368            self.0.encode(encoder, offset + 0, depth)?;
9369            Ok(())
9370        }
9371    }
9372
9373    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
9374        for BufferCollectionImportToken
9375    {
9376        #[inline(always)]
9377        fn new_empty() -> Self {
9378            Self {
9379                value: fidl::new_empty!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
9380            }
9381        }
9382
9383        #[inline]
9384        unsafe fn decode(
9385            &mut self,
9386            decoder: &mut fidl::encoding::Decoder<
9387                '_,
9388                fidl::encoding::DefaultFuchsiaResourceDialect,
9389            >,
9390            offset: usize,
9391            _depth: fidl::encoding::Depth,
9392        ) -> fidl::Result<()> {
9393            decoder.debug_check_bounds::<Self>(offset);
9394            // Verify that padding bytes are zero.
9395            fidl::decode!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.value, decoder, offset + 0, _depth)?;
9396            Ok(())
9397        }
9398    }
9399
9400    impl fidl::encoding::ResourceTypeMarker for ChildViewWatcherGetViewRefResponse {
9401        type Borrowed<'a> = &'a mut Self;
9402        fn take_or_borrow<'a>(
9403            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9404        ) -> Self::Borrowed<'a> {
9405            value
9406        }
9407    }
9408
9409    unsafe impl fidl::encoding::TypeMarker for ChildViewWatcherGetViewRefResponse {
9410        type Owned = Self;
9411
9412        #[inline(always)]
9413        fn inline_align(_context: fidl::encoding::Context) -> usize {
9414            4
9415        }
9416
9417        #[inline(always)]
9418        fn inline_size(_context: fidl::encoding::Context) -> usize {
9419            4
9420        }
9421    }
9422
9423    unsafe impl
9424        fidl::encoding::Encode<
9425            ChildViewWatcherGetViewRefResponse,
9426            fidl::encoding::DefaultFuchsiaResourceDialect,
9427        > for &mut ChildViewWatcherGetViewRefResponse
9428    {
9429        #[inline]
9430        unsafe fn encode(
9431            self,
9432            encoder: &mut fidl::encoding::Encoder<
9433                '_,
9434                fidl::encoding::DefaultFuchsiaResourceDialect,
9435            >,
9436            offset: usize,
9437            _depth: fidl::encoding::Depth,
9438        ) -> fidl::Result<()> {
9439            encoder.debug_check_bounds::<ChildViewWatcherGetViewRefResponse>(offset);
9440            // Delegate to tuple encoding.
9441            fidl::encoding::Encode::<ChildViewWatcherGetViewRefResponse, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
9442                (
9443                    <fidl_fuchsia_ui_views::ViewRef as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.view_ref),
9444                ),
9445                encoder, offset, _depth
9446            )
9447        }
9448    }
9449    unsafe impl<
9450        T0: fidl::encoding::Encode<
9451                fidl_fuchsia_ui_views::ViewRef,
9452                fidl::encoding::DefaultFuchsiaResourceDialect,
9453            >,
9454    >
9455        fidl::encoding::Encode<
9456            ChildViewWatcherGetViewRefResponse,
9457            fidl::encoding::DefaultFuchsiaResourceDialect,
9458        > for (T0,)
9459    {
9460        #[inline]
9461        unsafe fn encode(
9462            self,
9463            encoder: &mut fidl::encoding::Encoder<
9464                '_,
9465                fidl::encoding::DefaultFuchsiaResourceDialect,
9466            >,
9467            offset: usize,
9468            depth: fidl::encoding::Depth,
9469        ) -> fidl::Result<()> {
9470            encoder.debug_check_bounds::<ChildViewWatcherGetViewRefResponse>(offset);
9471            // Zero out padding regions. There's no need to apply masks
9472            // because the unmasked parts will be overwritten by fields.
9473            // Write the fields.
9474            self.0.encode(encoder, offset + 0, depth)?;
9475            Ok(())
9476        }
9477    }
9478
9479    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
9480        for ChildViewWatcherGetViewRefResponse
9481    {
9482        #[inline(always)]
9483        fn new_empty() -> Self {
9484            Self {
9485                view_ref: fidl::new_empty!(
9486                    fidl_fuchsia_ui_views::ViewRef,
9487                    fidl::encoding::DefaultFuchsiaResourceDialect
9488                ),
9489            }
9490        }
9491
9492        #[inline]
9493        unsafe fn decode(
9494            &mut self,
9495            decoder: &mut fidl::encoding::Decoder<
9496                '_,
9497                fidl::encoding::DefaultFuchsiaResourceDialect,
9498            >,
9499            offset: usize,
9500            _depth: fidl::encoding::Depth,
9501        ) -> fidl::Result<()> {
9502            decoder.debug_check_bounds::<Self>(offset);
9503            // Verify that padding bytes are zero.
9504            fidl::decode!(
9505                fidl_fuchsia_ui_views::ViewRef,
9506                fidl::encoding::DefaultFuchsiaResourceDialect,
9507                &mut self.view_ref,
9508                decoder,
9509                offset + 0,
9510                _depth
9511            )?;
9512            Ok(())
9513        }
9514    }
9515
9516    impl fidl::encoding::ResourceTypeMarker for FlatlandCreateFilledRectRequest {
9517        type Borrowed<'a> = &'a mut Self;
9518        fn take_or_borrow<'a>(
9519            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9520        ) -> Self::Borrowed<'a> {
9521            value
9522        }
9523    }
9524
9525    unsafe impl fidl::encoding::TypeMarker for FlatlandCreateFilledRectRequest {
9526        type Owned = Self;
9527
9528        #[inline(always)]
9529        fn inline_align(_context: fidl::encoding::Context) -> usize {
9530            8
9531        }
9532
9533        #[inline(always)]
9534        fn inline_size(_context: fidl::encoding::Context) -> usize {
9535            8
9536        }
9537        #[inline(always)]
9538        fn encode_is_copy() -> bool {
9539            true
9540        }
9541
9542        #[inline(always)]
9543        fn decode_is_copy() -> bool {
9544            true
9545        }
9546    }
9547
9548    unsafe impl
9549        fidl::encoding::Encode<
9550            FlatlandCreateFilledRectRequest,
9551            fidl::encoding::DefaultFuchsiaResourceDialect,
9552        > for &mut FlatlandCreateFilledRectRequest
9553    {
9554        #[inline]
9555        unsafe fn encode(
9556            self,
9557            encoder: &mut fidl::encoding::Encoder<
9558                '_,
9559                fidl::encoding::DefaultFuchsiaResourceDialect,
9560            >,
9561            offset: usize,
9562            _depth: fidl::encoding::Depth,
9563        ) -> fidl::Result<()> {
9564            encoder.debug_check_bounds::<FlatlandCreateFilledRectRequest>(offset);
9565            unsafe {
9566                // Copy the object into the buffer.
9567                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
9568                (buf_ptr as *mut FlatlandCreateFilledRectRequest)
9569                    .write_unaligned((self as *const FlatlandCreateFilledRectRequest).read());
9570                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
9571                // done second because the memcpy will write garbage to these bytes.
9572            }
9573            Ok(())
9574        }
9575    }
9576    unsafe impl<
9577        T0: fidl::encoding::Encode<ContentId, fidl::encoding::DefaultFuchsiaResourceDialect>,
9578    >
9579        fidl::encoding::Encode<
9580            FlatlandCreateFilledRectRequest,
9581            fidl::encoding::DefaultFuchsiaResourceDialect,
9582        > for (T0,)
9583    {
9584        #[inline]
9585        unsafe fn encode(
9586            self,
9587            encoder: &mut fidl::encoding::Encoder<
9588                '_,
9589                fidl::encoding::DefaultFuchsiaResourceDialect,
9590            >,
9591            offset: usize,
9592            depth: fidl::encoding::Depth,
9593        ) -> fidl::Result<()> {
9594            encoder.debug_check_bounds::<FlatlandCreateFilledRectRequest>(offset);
9595            // Zero out padding regions. There's no need to apply masks
9596            // because the unmasked parts will be overwritten by fields.
9597            // Write the fields.
9598            self.0.encode(encoder, offset + 0, depth)?;
9599            Ok(())
9600        }
9601    }
9602
9603    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
9604        for FlatlandCreateFilledRectRequest
9605    {
9606        #[inline(always)]
9607        fn new_empty() -> Self {
9608            Self {
9609                rect_id: fidl::new_empty!(ContentId, fidl::encoding::DefaultFuchsiaResourceDialect),
9610            }
9611        }
9612
9613        #[inline]
9614        unsafe fn decode(
9615            &mut self,
9616            decoder: &mut fidl::encoding::Decoder<
9617                '_,
9618                fidl::encoding::DefaultFuchsiaResourceDialect,
9619            >,
9620            offset: usize,
9621            _depth: fidl::encoding::Depth,
9622        ) -> fidl::Result<()> {
9623            decoder.debug_check_bounds::<Self>(offset);
9624            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
9625            // Verify that padding bytes are zero.
9626            // Copy from the buffer into the object.
9627            unsafe {
9628                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
9629            }
9630            Ok(())
9631        }
9632    }
9633
9634    impl fidl::encoding::ResourceTypeMarker for FlatlandCreateImageRequest {
9635        type Borrowed<'a> = &'a mut Self;
9636        fn take_or_borrow<'a>(
9637            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9638        ) -> Self::Borrowed<'a> {
9639            value
9640        }
9641    }
9642
9643    unsafe impl fidl::encoding::TypeMarker for FlatlandCreateImageRequest {
9644        type Owned = Self;
9645
9646        #[inline(always)]
9647        fn inline_align(_context: fidl::encoding::Context) -> usize {
9648            8
9649        }
9650
9651        #[inline(always)]
9652        fn inline_size(_context: fidl::encoding::Context) -> usize {
9653            32
9654        }
9655    }
9656
9657    unsafe impl
9658        fidl::encoding::Encode<
9659            FlatlandCreateImageRequest,
9660            fidl::encoding::DefaultFuchsiaResourceDialect,
9661        > for &mut FlatlandCreateImageRequest
9662    {
9663        #[inline]
9664        unsafe fn encode(
9665            self,
9666            encoder: &mut fidl::encoding::Encoder<
9667                '_,
9668                fidl::encoding::DefaultFuchsiaResourceDialect,
9669            >,
9670            offset: usize,
9671            _depth: fidl::encoding::Depth,
9672        ) -> fidl::Result<()> {
9673            encoder.debug_check_bounds::<FlatlandCreateImageRequest>(offset);
9674            // Delegate to tuple encoding.
9675            fidl::encoding::Encode::<FlatlandCreateImageRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
9676                (
9677                    <ContentId as fidl::encoding::ValueTypeMarker>::borrow(&self.image_id),
9678                    <BufferCollectionImportToken as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.import_token),
9679                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.vmo_index),
9680                    <ImageProperties as fidl::encoding::ValueTypeMarker>::borrow(&self.properties),
9681                ),
9682                encoder, offset, _depth
9683            )
9684        }
9685    }
9686    unsafe impl<
9687        T0: fidl::encoding::Encode<ContentId, fidl::encoding::DefaultFuchsiaResourceDialect>,
9688        T1: fidl::encoding::Encode<
9689                BufferCollectionImportToken,
9690                fidl::encoding::DefaultFuchsiaResourceDialect,
9691            >,
9692        T2: fidl::encoding::Encode<u32, fidl::encoding::DefaultFuchsiaResourceDialect>,
9693        T3: fidl::encoding::Encode<ImageProperties, fidl::encoding::DefaultFuchsiaResourceDialect>,
9694    >
9695        fidl::encoding::Encode<
9696            FlatlandCreateImageRequest,
9697            fidl::encoding::DefaultFuchsiaResourceDialect,
9698        > for (T0, T1, T2, T3)
9699    {
9700        #[inline]
9701        unsafe fn encode(
9702            self,
9703            encoder: &mut fidl::encoding::Encoder<
9704                '_,
9705                fidl::encoding::DefaultFuchsiaResourceDialect,
9706            >,
9707            offset: usize,
9708            depth: fidl::encoding::Depth,
9709        ) -> fidl::Result<()> {
9710            encoder.debug_check_bounds::<FlatlandCreateImageRequest>(offset);
9711            // Zero out padding regions. There's no need to apply masks
9712            // because the unmasked parts will be overwritten by fields.
9713            // Write the fields.
9714            self.0.encode(encoder, offset + 0, depth)?;
9715            self.1.encode(encoder, offset + 8, depth)?;
9716            self.2.encode(encoder, offset + 12, depth)?;
9717            self.3.encode(encoder, offset + 16, depth)?;
9718            Ok(())
9719        }
9720    }
9721
9722    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
9723        for FlatlandCreateImageRequest
9724    {
9725        #[inline(always)]
9726        fn new_empty() -> Self {
9727            Self {
9728                image_id: fidl::new_empty!(
9729                    ContentId,
9730                    fidl::encoding::DefaultFuchsiaResourceDialect
9731                ),
9732                import_token: fidl::new_empty!(
9733                    BufferCollectionImportToken,
9734                    fidl::encoding::DefaultFuchsiaResourceDialect
9735                ),
9736                vmo_index: fidl::new_empty!(u32, fidl::encoding::DefaultFuchsiaResourceDialect),
9737                properties: fidl::new_empty!(
9738                    ImageProperties,
9739                    fidl::encoding::DefaultFuchsiaResourceDialect
9740                ),
9741            }
9742        }
9743
9744        #[inline]
9745        unsafe fn decode(
9746            &mut self,
9747            decoder: &mut fidl::encoding::Decoder<
9748                '_,
9749                fidl::encoding::DefaultFuchsiaResourceDialect,
9750            >,
9751            offset: usize,
9752            _depth: fidl::encoding::Depth,
9753        ) -> fidl::Result<()> {
9754            decoder.debug_check_bounds::<Self>(offset);
9755            // Verify that padding bytes are zero.
9756            fidl::decode!(
9757                ContentId,
9758                fidl::encoding::DefaultFuchsiaResourceDialect,
9759                &mut self.image_id,
9760                decoder,
9761                offset + 0,
9762                _depth
9763            )?;
9764            fidl::decode!(
9765                BufferCollectionImportToken,
9766                fidl::encoding::DefaultFuchsiaResourceDialect,
9767                &mut self.import_token,
9768                decoder,
9769                offset + 8,
9770                _depth
9771            )?;
9772            fidl::decode!(
9773                u32,
9774                fidl::encoding::DefaultFuchsiaResourceDialect,
9775                &mut self.vmo_index,
9776                decoder,
9777                offset + 12,
9778                _depth
9779            )?;
9780            fidl::decode!(
9781                ImageProperties,
9782                fidl::encoding::DefaultFuchsiaResourceDialect,
9783                &mut self.properties,
9784                decoder,
9785                offset + 16,
9786                _depth
9787            )?;
9788            Ok(())
9789        }
9790    }
9791
9792    impl fidl::encoding::ResourceTypeMarker for FlatlandCreateView2Request {
9793        type Borrowed<'a> = &'a mut Self;
9794        fn take_or_borrow<'a>(
9795            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9796        ) -> Self::Borrowed<'a> {
9797            value
9798        }
9799    }
9800
9801    unsafe impl fidl::encoding::TypeMarker for FlatlandCreateView2Request {
9802        type Owned = Self;
9803
9804        #[inline(always)]
9805        fn inline_align(_context: fidl::encoding::Context) -> usize {
9806            8
9807        }
9808
9809        #[inline(always)]
9810        fn inline_size(_context: fidl::encoding::Context) -> usize {
9811            40
9812        }
9813    }
9814
9815    unsafe impl
9816        fidl::encoding::Encode<
9817            FlatlandCreateView2Request,
9818            fidl::encoding::DefaultFuchsiaResourceDialect,
9819        > for &mut FlatlandCreateView2Request
9820    {
9821        #[inline]
9822        unsafe fn encode(
9823            self,
9824            encoder: &mut fidl::encoding::Encoder<
9825                '_,
9826                fidl::encoding::DefaultFuchsiaResourceDialect,
9827            >,
9828            offset: usize,
9829            _depth: fidl::encoding::Depth,
9830        ) -> fidl::Result<()> {
9831            encoder.debug_check_bounds::<FlatlandCreateView2Request>(offset);
9832            // Delegate to tuple encoding.
9833            fidl::encoding::Encode::<FlatlandCreateView2Request, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
9834                (
9835                    <fidl_fuchsia_ui_views::ViewCreationToken as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.token),
9836                    <fidl_fuchsia_ui_views::ViewIdentityOnCreation as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.view_identity),
9837                    <ViewBoundProtocols as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.protocols),
9838                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.parent_viewport_watcher),
9839                ),
9840                encoder, offset, _depth
9841            )
9842        }
9843    }
9844    unsafe impl<
9845        T0: fidl::encoding::Encode<
9846                fidl_fuchsia_ui_views::ViewCreationToken,
9847                fidl::encoding::DefaultFuchsiaResourceDialect,
9848            >,
9849        T1: fidl::encoding::Encode<
9850                fidl_fuchsia_ui_views::ViewIdentityOnCreation,
9851                fidl::encoding::DefaultFuchsiaResourceDialect,
9852            >,
9853        T2: fidl::encoding::Encode<ViewBoundProtocols, fidl::encoding::DefaultFuchsiaResourceDialect>,
9854        T3: fidl::encoding::Encode<
9855                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>>,
9856                fidl::encoding::DefaultFuchsiaResourceDialect,
9857            >,
9858    >
9859        fidl::encoding::Encode<
9860            FlatlandCreateView2Request,
9861            fidl::encoding::DefaultFuchsiaResourceDialect,
9862        > for (T0, T1, T2, T3)
9863    {
9864        #[inline]
9865        unsafe fn encode(
9866            self,
9867            encoder: &mut fidl::encoding::Encoder<
9868                '_,
9869                fidl::encoding::DefaultFuchsiaResourceDialect,
9870            >,
9871            offset: usize,
9872            depth: fidl::encoding::Depth,
9873        ) -> fidl::Result<()> {
9874            encoder.debug_check_bounds::<FlatlandCreateView2Request>(offset);
9875            // Zero out padding regions. There's no need to apply masks
9876            // because the unmasked parts will be overwritten by fields.
9877            unsafe {
9878                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
9879                (ptr as *mut u64).write_unaligned(0);
9880            }
9881            unsafe {
9882                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(32);
9883                (ptr as *mut u64).write_unaligned(0);
9884            }
9885            // Write the fields.
9886            self.0.encode(encoder, offset + 0, depth)?;
9887            self.1.encode(encoder, offset + 4, depth)?;
9888            self.2.encode(encoder, offset + 16, depth)?;
9889            self.3.encode(encoder, offset + 32, depth)?;
9890            Ok(())
9891        }
9892    }
9893
9894    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
9895        for FlatlandCreateView2Request
9896    {
9897        #[inline(always)]
9898        fn new_empty() -> Self {
9899            Self {
9900                token: fidl::new_empty!(
9901                    fidl_fuchsia_ui_views::ViewCreationToken,
9902                    fidl::encoding::DefaultFuchsiaResourceDialect
9903                ),
9904                view_identity: fidl::new_empty!(
9905                    fidl_fuchsia_ui_views::ViewIdentityOnCreation,
9906                    fidl::encoding::DefaultFuchsiaResourceDialect
9907                ),
9908                protocols: fidl::new_empty!(
9909                    ViewBoundProtocols,
9910                    fidl::encoding::DefaultFuchsiaResourceDialect
9911                ),
9912                parent_viewport_watcher: fidl::new_empty!(
9913                    fidl::encoding::Endpoint<
9914                        fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>,
9915                    >,
9916                    fidl::encoding::DefaultFuchsiaResourceDialect
9917                ),
9918            }
9919        }
9920
9921        #[inline]
9922        unsafe fn decode(
9923            &mut self,
9924            decoder: &mut fidl::encoding::Decoder<
9925                '_,
9926                fidl::encoding::DefaultFuchsiaResourceDialect,
9927            >,
9928            offset: usize,
9929            _depth: fidl::encoding::Depth,
9930        ) -> fidl::Result<()> {
9931            decoder.debug_check_bounds::<Self>(offset);
9932            // Verify that padding bytes are zero.
9933            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(8) };
9934            let padval = unsafe { (ptr as *const u64).read_unaligned() };
9935            let mask = 0xffffffff00000000u64;
9936            let maskedval = padval & mask;
9937            if maskedval != 0 {
9938                return Err(fidl::Error::NonZeroPadding {
9939                    padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
9940                });
9941            }
9942            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(32) };
9943            let padval = unsafe { (ptr as *const u64).read_unaligned() };
9944            let mask = 0xffffffff00000000u64;
9945            let maskedval = padval & mask;
9946            if maskedval != 0 {
9947                return Err(fidl::Error::NonZeroPadding {
9948                    padding_start: offset + 32 + ((mask as u64).trailing_zeros() / 8) as usize,
9949                });
9950            }
9951            fidl::decode!(
9952                fidl_fuchsia_ui_views::ViewCreationToken,
9953                fidl::encoding::DefaultFuchsiaResourceDialect,
9954                &mut self.token,
9955                decoder,
9956                offset + 0,
9957                _depth
9958            )?;
9959            fidl::decode!(
9960                fidl_fuchsia_ui_views::ViewIdentityOnCreation,
9961                fidl::encoding::DefaultFuchsiaResourceDialect,
9962                &mut self.view_identity,
9963                decoder,
9964                offset + 4,
9965                _depth
9966            )?;
9967            fidl::decode!(
9968                ViewBoundProtocols,
9969                fidl::encoding::DefaultFuchsiaResourceDialect,
9970                &mut self.protocols,
9971                decoder,
9972                offset + 16,
9973                _depth
9974            )?;
9975            fidl::decode!(
9976                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>>,
9977                fidl::encoding::DefaultFuchsiaResourceDialect,
9978                &mut self.parent_viewport_watcher,
9979                decoder,
9980                offset + 32,
9981                _depth
9982            )?;
9983            Ok(())
9984        }
9985    }
9986
9987    impl fidl::encoding::ResourceTypeMarker for FlatlandCreateViewRequest {
9988        type Borrowed<'a> = &'a mut Self;
9989        fn take_or_borrow<'a>(
9990            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9991        ) -> Self::Borrowed<'a> {
9992            value
9993        }
9994    }
9995
9996    unsafe impl fidl::encoding::TypeMarker for FlatlandCreateViewRequest {
9997        type Owned = Self;
9998
9999        #[inline(always)]
10000        fn inline_align(_context: fidl::encoding::Context) -> usize {
10001            4
10002        }
10003
10004        #[inline(always)]
10005        fn inline_size(_context: fidl::encoding::Context) -> usize {
10006            8
10007        }
10008    }
10009
10010    unsafe impl
10011        fidl::encoding::Encode<
10012            FlatlandCreateViewRequest,
10013            fidl::encoding::DefaultFuchsiaResourceDialect,
10014        > for &mut FlatlandCreateViewRequest
10015    {
10016        #[inline]
10017        unsafe fn encode(
10018            self,
10019            encoder: &mut fidl::encoding::Encoder<
10020                '_,
10021                fidl::encoding::DefaultFuchsiaResourceDialect,
10022            >,
10023            offset: usize,
10024            _depth: fidl::encoding::Depth,
10025        ) -> fidl::Result<()> {
10026            encoder.debug_check_bounds::<FlatlandCreateViewRequest>(offset);
10027            // Delegate to tuple encoding.
10028            fidl::encoding::Encode::<FlatlandCreateViewRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
10029                (
10030                    <fidl_fuchsia_ui_views::ViewCreationToken as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.token),
10031                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.parent_viewport_watcher),
10032                ),
10033                encoder, offset, _depth
10034            )
10035        }
10036    }
10037    unsafe impl<
10038        T0: fidl::encoding::Encode<
10039                fidl_fuchsia_ui_views::ViewCreationToken,
10040                fidl::encoding::DefaultFuchsiaResourceDialect,
10041            >,
10042        T1: fidl::encoding::Encode<
10043                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>>,
10044                fidl::encoding::DefaultFuchsiaResourceDialect,
10045            >,
10046    >
10047        fidl::encoding::Encode<
10048            FlatlandCreateViewRequest,
10049            fidl::encoding::DefaultFuchsiaResourceDialect,
10050        > for (T0, T1)
10051    {
10052        #[inline]
10053        unsafe fn encode(
10054            self,
10055            encoder: &mut fidl::encoding::Encoder<
10056                '_,
10057                fidl::encoding::DefaultFuchsiaResourceDialect,
10058            >,
10059            offset: usize,
10060            depth: fidl::encoding::Depth,
10061        ) -> fidl::Result<()> {
10062            encoder.debug_check_bounds::<FlatlandCreateViewRequest>(offset);
10063            // Zero out padding regions. There's no need to apply masks
10064            // because the unmasked parts will be overwritten by fields.
10065            // Write the fields.
10066            self.0.encode(encoder, offset + 0, depth)?;
10067            self.1.encode(encoder, offset + 4, depth)?;
10068            Ok(())
10069        }
10070    }
10071
10072    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10073        for FlatlandCreateViewRequest
10074    {
10075        #[inline(always)]
10076        fn new_empty() -> Self {
10077            Self {
10078                token: fidl::new_empty!(
10079                    fidl_fuchsia_ui_views::ViewCreationToken,
10080                    fidl::encoding::DefaultFuchsiaResourceDialect
10081                ),
10082                parent_viewport_watcher: fidl::new_empty!(
10083                    fidl::encoding::Endpoint<
10084                        fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>,
10085                    >,
10086                    fidl::encoding::DefaultFuchsiaResourceDialect
10087                ),
10088            }
10089        }
10090
10091        #[inline]
10092        unsafe fn decode(
10093            &mut self,
10094            decoder: &mut fidl::encoding::Decoder<
10095                '_,
10096                fidl::encoding::DefaultFuchsiaResourceDialect,
10097            >,
10098            offset: usize,
10099            _depth: fidl::encoding::Depth,
10100        ) -> fidl::Result<()> {
10101            decoder.debug_check_bounds::<Self>(offset);
10102            // Verify that padding bytes are zero.
10103            fidl::decode!(
10104                fidl_fuchsia_ui_views::ViewCreationToken,
10105                fidl::encoding::DefaultFuchsiaResourceDialect,
10106                &mut self.token,
10107                decoder,
10108                offset + 0,
10109                _depth
10110            )?;
10111            fidl::decode!(
10112                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>>,
10113                fidl::encoding::DefaultFuchsiaResourceDialect,
10114                &mut self.parent_viewport_watcher,
10115                decoder,
10116                offset + 4,
10117                _depth
10118            )?;
10119            Ok(())
10120        }
10121    }
10122
10123    impl fidl::encoding::ResourceTypeMarker for FlatlandCreateViewportRequest {
10124        type Borrowed<'a> = &'a mut Self;
10125        fn take_or_borrow<'a>(
10126            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10127        ) -> Self::Borrowed<'a> {
10128            value
10129        }
10130    }
10131
10132    unsafe impl fidl::encoding::TypeMarker for FlatlandCreateViewportRequest {
10133        type Owned = Self;
10134
10135        #[inline(always)]
10136        fn inline_align(_context: fidl::encoding::Context) -> usize {
10137            8
10138        }
10139
10140        #[inline(always)]
10141        fn inline_size(_context: fidl::encoding::Context) -> usize {
10142            40
10143        }
10144    }
10145
10146    unsafe impl
10147        fidl::encoding::Encode<
10148            FlatlandCreateViewportRequest,
10149            fidl::encoding::DefaultFuchsiaResourceDialect,
10150        > for &mut FlatlandCreateViewportRequest
10151    {
10152        #[inline]
10153        unsafe fn encode(
10154            self,
10155            encoder: &mut fidl::encoding::Encoder<
10156                '_,
10157                fidl::encoding::DefaultFuchsiaResourceDialect,
10158            >,
10159            offset: usize,
10160            _depth: fidl::encoding::Depth,
10161        ) -> fidl::Result<()> {
10162            encoder.debug_check_bounds::<FlatlandCreateViewportRequest>(offset);
10163            // Delegate to tuple encoding.
10164            fidl::encoding::Encode::<FlatlandCreateViewportRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
10165                (
10166                    <ContentId as fidl::encoding::ValueTypeMarker>::borrow(&self.viewport_id),
10167                    <fidl_fuchsia_ui_views::ViewportCreationToken as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.token),
10168                    <ViewportProperties as fidl::encoding::ValueTypeMarker>::borrow(&self.properties),
10169                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ChildViewWatcherMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.child_view_watcher),
10170                ),
10171                encoder, offset, _depth
10172            )
10173        }
10174    }
10175    unsafe impl<
10176        T0: fidl::encoding::Encode<ContentId, fidl::encoding::DefaultFuchsiaResourceDialect>,
10177        T1: fidl::encoding::Encode<
10178                fidl_fuchsia_ui_views::ViewportCreationToken,
10179                fidl::encoding::DefaultFuchsiaResourceDialect,
10180            >,
10181        T2: fidl::encoding::Encode<ViewportProperties, fidl::encoding::DefaultFuchsiaResourceDialect>,
10182        T3: fidl::encoding::Encode<
10183                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ChildViewWatcherMarker>>,
10184                fidl::encoding::DefaultFuchsiaResourceDialect,
10185            >,
10186    >
10187        fidl::encoding::Encode<
10188            FlatlandCreateViewportRequest,
10189            fidl::encoding::DefaultFuchsiaResourceDialect,
10190        > for (T0, T1, T2, T3)
10191    {
10192        #[inline]
10193        unsafe fn encode(
10194            self,
10195            encoder: &mut fidl::encoding::Encoder<
10196                '_,
10197                fidl::encoding::DefaultFuchsiaResourceDialect,
10198            >,
10199            offset: usize,
10200            depth: fidl::encoding::Depth,
10201        ) -> fidl::Result<()> {
10202            encoder.debug_check_bounds::<FlatlandCreateViewportRequest>(offset);
10203            // Zero out padding regions. There's no need to apply masks
10204            // because the unmasked parts will be overwritten by fields.
10205            unsafe {
10206                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
10207                (ptr as *mut u64).write_unaligned(0);
10208            }
10209            unsafe {
10210                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(32);
10211                (ptr as *mut u64).write_unaligned(0);
10212            }
10213            // Write the fields.
10214            self.0.encode(encoder, offset + 0, depth)?;
10215            self.1.encode(encoder, offset + 8, depth)?;
10216            self.2.encode(encoder, offset + 16, depth)?;
10217            self.3.encode(encoder, offset + 32, depth)?;
10218            Ok(())
10219        }
10220    }
10221
10222    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10223        for FlatlandCreateViewportRequest
10224    {
10225        #[inline(always)]
10226        fn new_empty() -> Self {
10227            Self {
10228                viewport_id: fidl::new_empty!(
10229                    ContentId,
10230                    fidl::encoding::DefaultFuchsiaResourceDialect
10231                ),
10232                token: fidl::new_empty!(
10233                    fidl_fuchsia_ui_views::ViewportCreationToken,
10234                    fidl::encoding::DefaultFuchsiaResourceDialect
10235                ),
10236                properties: fidl::new_empty!(
10237                    ViewportProperties,
10238                    fidl::encoding::DefaultFuchsiaResourceDialect
10239                ),
10240                child_view_watcher: fidl::new_empty!(
10241                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ChildViewWatcherMarker>>,
10242                    fidl::encoding::DefaultFuchsiaResourceDialect
10243                ),
10244            }
10245        }
10246
10247        #[inline]
10248        unsafe fn decode(
10249            &mut self,
10250            decoder: &mut fidl::encoding::Decoder<
10251                '_,
10252                fidl::encoding::DefaultFuchsiaResourceDialect,
10253            >,
10254            offset: usize,
10255            _depth: fidl::encoding::Depth,
10256        ) -> fidl::Result<()> {
10257            decoder.debug_check_bounds::<Self>(offset);
10258            // Verify that padding bytes are zero.
10259            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(8) };
10260            let padval = unsafe { (ptr as *const u64).read_unaligned() };
10261            let mask = 0xffffffff00000000u64;
10262            let maskedval = padval & mask;
10263            if maskedval != 0 {
10264                return Err(fidl::Error::NonZeroPadding {
10265                    padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
10266                });
10267            }
10268            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(32) };
10269            let padval = unsafe { (ptr as *const u64).read_unaligned() };
10270            let mask = 0xffffffff00000000u64;
10271            let maskedval = padval & mask;
10272            if maskedval != 0 {
10273                return Err(fidl::Error::NonZeroPadding {
10274                    padding_start: offset + 32 + ((mask as u64).trailing_zeros() / 8) as usize,
10275                });
10276            }
10277            fidl::decode!(
10278                ContentId,
10279                fidl::encoding::DefaultFuchsiaResourceDialect,
10280                &mut self.viewport_id,
10281                decoder,
10282                offset + 0,
10283                _depth
10284            )?;
10285            fidl::decode!(
10286                fidl_fuchsia_ui_views::ViewportCreationToken,
10287                fidl::encoding::DefaultFuchsiaResourceDialect,
10288                &mut self.token,
10289                decoder,
10290                offset + 8,
10291                _depth
10292            )?;
10293            fidl::decode!(
10294                ViewportProperties,
10295                fidl::encoding::DefaultFuchsiaResourceDialect,
10296                &mut self.properties,
10297                decoder,
10298                offset + 16,
10299                _depth
10300            )?;
10301            fidl::decode!(
10302                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ChildViewWatcherMarker>>,
10303                fidl::encoding::DefaultFuchsiaResourceDialect,
10304                &mut self.child_view_watcher,
10305                decoder,
10306                offset + 32,
10307                _depth
10308            )?;
10309            Ok(())
10310        }
10311    }
10312
10313    impl fidl::encoding::ResourceTypeMarker for FlatlandDisplaySetContentRequest {
10314        type Borrowed<'a> = &'a mut Self;
10315        fn take_or_borrow<'a>(
10316            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10317        ) -> Self::Borrowed<'a> {
10318            value
10319        }
10320    }
10321
10322    unsafe impl fidl::encoding::TypeMarker for FlatlandDisplaySetContentRequest {
10323        type Owned = Self;
10324
10325        #[inline(always)]
10326        fn inline_align(_context: fidl::encoding::Context) -> usize {
10327            4
10328        }
10329
10330        #[inline(always)]
10331        fn inline_size(_context: fidl::encoding::Context) -> usize {
10332            8
10333        }
10334    }
10335
10336    unsafe impl
10337        fidl::encoding::Encode<
10338            FlatlandDisplaySetContentRequest,
10339            fidl::encoding::DefaultFuchsiaResourceDialect,
10340        > for &mut FlatlandDisplaySetContentRequest
10341    {
10342        #[inline]
10343        unsafe fn encode(
10344            self,
10345            encoder: &mut fidl::encoding::Encoder<
10346                '_,
10347                fidl::encoding::DefaultFuchsiaResourceDialect,
10348            >,
10349            offset: usize,
10350            _depth: fidl::encoding::Depth,
10351        ) -> fidl::Result<()> {
10352            encoder.debug_check_bounds::<FlatlandDisplaySetContentRequest>(offset);
10353            // Delegate to tuple encoding.
10354            fidl::encoding::Encode::<FlatlandDisplaySetContentRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
10355                (
10356                    <fidl_fuchsia_ui_views::ViewportCreationToken as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.token),
10357                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ChildViewWatcherMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.child_view_watcher),
10358                ),
10359                encoder, offset, _depth
10360            )
10361        }
10362    }
10363    unsafe impl<
10364        T0: fidl::encoding::Encode<
10365                fidl_fuchsia_ui_views::ViewportCreationToken,
10366                fidl::encoding::DefaultFuchsiaResourceDialect,
10367            >,
10368        T1: fidl::encoding::Encode<
10369                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ChildViewWatcherMarker>>,
10370                fidl::encoding::DefaultFuchsiaResourceDialect,
10371            >,
10372    >
10373        fidl::encoding::Encode<
10374            FlatlandDisplaySetContentRequest,
10375            fidl::encoding::DefaultFuchsiaResourceDialect,
10376        > for (T0, T1)
10377    {
10378        #[inline]
10379        unsafe fn encode(
10380            self,
10381            encoder: &mut fidl::encoding::Encoder<
10382                '_,
10383                fidl::encoding::DefaultFuchsiaResourceDialect,
10384            >,
10385            offset: usize,
10386            depth: fidl::encoding::Depth,
10387        ) -> fidl::Result<()> {
10388            encoder.debug_check_bounds::<FlatlandDisplaySetContentRequest>(offset);
10389            // Zero out padding regions. There's no need to apply masks
10390            // because the unmasked parts will be overwritten by fields.
10391            // Write the fields.
10392            self.0.encode(encoder, offset + 0, depth)?;
10393            self.1.encode(encoder, offset + 4, depth)?;
10394            Ok(())
10395        }
10396    }
10397
10398    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10399        for FlatlandDisplaySetContentRequest
10400    {
10401        #[inline(always)]
10402        fn new_empty() -> Self {
10403            Self {
10404                token: fidl::new_empty!(
10405                    fidl_fuchsia_ui_views::ViewportCreationToken,
10406                    fidl::encoding::DefaultFuchsiaResourceDialect
10407                ),
10408                child_view_watcher: fidl::new_empty!(
10409                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ChildViewWatcherMarker>>,
10410                    fidl::encoding::DefaultFuchsiaResourceDialect
10411                ),
10412            }
10413        }
10414
10415        #[inline]
10416        unsafe fn decode(
10417            &mut self,
10418            decoder: &mut fidl::encoding::Decoder<
10419                '_,
10420                fidl::encoding::DefaultFuchsiaResourceDialect,
10421            >,
10422            offset: usize,
10423            _depth: fidl::encoding::Depth,
10424        ) -> fidl::Result<()> {
10425            decoder.debug_check_bounds::<Self>(offset);
10426            // Verify that padding bytes are zero.
10427            fidl::decode!(
10428                fidl_fuchsia_ui_views::ViewportCreationToken,
10429                fidl::encoding::DefaultFuchsiaResourceDialect,
10430                &mut self.token,
10431                decoder,
10432                offset + 0,
10433                _depth
10434            )?;
10435            fidl::decode!(
10436                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ChildViewWatcherMarker>>,
10437                fidl::encoding::DefaultFuchsiaResourceDialect,
10438                &mut self.child_view_watcher,
10439                decoder,
10440                offset + 4,
10441                _depth
10442            )?;
10443            Ok(())
10444        }
10445    }
10446
10447    impl fidl::encoding::ResourceTypeMarker for FlatlandPresentRequest {
10448        type Borrowed<'a> = &'a mut Self;
10449        fn take_or_borrow<'a>(
10450            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10451        ) -> Self::Borrowed<'a> {
10452            value
10453        }
10454    }
10455
10456    unsafe impl fidl::encoding::TypeMarker for FlatlandPresentRequest {
10457        type Owned = Self;
10458
10459        #[inline(always)]
10460        fn inline_align(_context: fidl::encoding::Context) -> usize {
10461            8
10462        }
10463
10464        #[inline(always)]
10465        fn inline_size(_context: fidl::encoding::Context) -> usize {
10466            16
10467        }
10468    }
10469
10470    unsafe impl
10471        fidl::encoding::Encode<
10472            FlatlandPresentRequest,
10473            fidl::encoding::DefaultFuchsiaResourceDialect,
10474        > for &mut FlatlandPresentRequest
10475    {
10476        #[inline]
10477        unsafe fn encode(
10478            self,
10479            encoder: &mut fidl::encoding::Encoder<
10480                '_,
10481                fidl::encoding::DefaultFuchsiaResourceDialect,
10482            >,
10483            offset: usize,
10484            _depth: fidl::encoding::Depth,
10485        ) -> fidl::Result<()> {
10486            encoder.debug_check_bounds::<FlatlandPresentRequest>(offset);
10487            // Delegate to tuple encoding.
10488            fidl::encoding::Encode::<
10489                FlatlandPresentRequest,
10490                fidl::encoding::DefaultFuchsiaResourceDialect,
10491            >::encode(
10492                (<PresentArgs as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
10493                    &mut self.args,
10494                ),),
10495                encoder,
10496                offset,
10497                _depth,
10498            )
10499        }
10500    }
10501    unsafe impl<
10502        T0: fidl::encoding::Encode<PresentArgs, fidl::encoding::DefaultFuchsiaResourceDialect>,
10503    >
10504        fidl::encoding::Encode<
10505            FlatlandPresentRequest,
10506            fidl::encoding::DefaultFuchsiaResourceDialect,
10507        > for (T0,)
10508    {
10509        #[inline]
10510        unsafe fn encode(
10511            self,
10512            encoder: &mut fidl::encoding::Encoder<
10513                '_,
10514                fidl::encoding::DefaultFuchsiaResourceDialect,
10515            >,
10516            offset: usize,
10517            depth: fidl::encoding::Depth,
10518        ) -> fidl::Result<()> {
10519            encoder.debug_check_bounds::<FlatlandPresentRequest>(offset);
10520            // Zero out padding regions. There's no need to apply masks
10521            // because the unmasked parts will be overwritten by fields.
10522            // Write the fields.
10523            self.0.encode(encoder, offset + 0, depth)?;
10524            Ok(())
10525        }
10526    }
10527
10528    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10529        for FlatlandPresentRequest
10530    {
10531        #[inline(always)]
10532        fn new_empty() -> Self {
10533            Self {
10534                args: fidl::new_empty!(PresentArgs, fidl::encoding::DefaultFuchsiaResourceDialect),
10535            }
10536        }
10537
10538        #[inline]
10539        unsafe fn decode(
10540            &mut self,
10541            decoder: &mut fidl::encoding::Decoder<
10542                '_,
10543                fidl::encoding::DefaultFuchsiaResourceDialect,
10544            >,
10545            offset: usize,
10546            _depth: fidl::encoding::Depth,
10547        ) -> fidl::Result<()> {
10548            decoder.debug_check_bounds::<Self>(offset);
10549            // Verify that padding bytes are zero.
10550            fidl::decode!(
10551                PresentArgs,
10552                fidl::encoding::DefaultFuchsiaResourceDialect,
10553                &mut self.args,
10554                decoder,
10555                offset + 0,
10556                _depth
10557            )?;
10558            Ok(())
10559        }
10560    }
10561
10562    impl fidl::encoding::ResourceTypeMarker for FlatlandReleaseViewportResponse {
10563        type Borrowed<'a> = &'a mut Self;
10564        fn take_or_borrow<'a>(
10565            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10566        ) -> Self::Borrowed<'a> {
10567            value
10568        }
10569    }
10570
10571    unsafe impl fidl::encoding::TypeMarker for FlatlandReleaseViewportResponse {
10572        type Owned = Self;
10573
10574        #[inline(always)]
10575        fn inline_align(_context: fidl::encoding::Context) -> usize {
10576            4
10577        }
10578
10579        #[inline(always)]
10580        fn inline_size(_context: fidl::encoding::Context) -> usize {
10581            4
10582        }
10583    }
10584
10585    unsafe impl
10586        fidl::encoding::Encode<
10587            FlatlandReleaseViewportResponse,
10588            fidl::encoding::DefaultFuchsiaResourceDialect,
10589        > for &mut FlatlandReleaseViewportResponse
10590    {
10591        #[inline]
10592        unsafe fn encode(
10593            self,
10594            encoder: &mut fidl::encoding::Encoder<
10595                '_,
10596                fidl::encoding::DefaultFuchsiaResourceDialect,
10597            >,
10598            offset: usize,
10599            _depth: fidl::encoding::Depth,
10600        ) -> fidl::Result<()> {
10601            encoder.debug_check_bounds::<FlatlandReleaseViewportResponse>(offset);
10602            // Delegate to tuple encoding.
10603            fidl::encoding::Encode::<FlatlandReleaseViewportResponse, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
10604                (
10605                    <fidl_fuchsia_ui_views::ViewportCreationToken as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.token),
10606                ),
10607                encoder, offset, _depth
10608            )
10609        }
10610    }
10611    unsafe impl<
10612        T0: fidl::encoding::Encode<
10613                fidl_fuchsia_ui_views::ViewportCreationToken,
10614                fidl::encoding::DefaultFuchsiaResourceDialect,
10615            >,
10616    >
10617        fidl::encoding::Encode<
10618            FlatlandReleaseViewportResponse,
10619            fidl::encoding::DefaultFuchsiaResourceDialect,
10620        > for (T0,)
10621    {
10622        #[inline]
10623        unsafe fn encode(
10624            self,
10625            encoder: &mut fidl::encoding::Encoder<
10626                '_,
10627                fidl::encoding::DefaultFuchsiaResourceDialect,
10628            >,
10629            offset: usize,
10630            depth: fidl::encoding::Depth,
10631        ) -> fidl::Result<()> {
10632            encoder.debug_check_bounds::<FlatlandReleaseViewportResponse>(offset);
10633            // Zero out padding regions. There's no need to apply masks
10634            // because the unmasked parts will be overwritten by fields.
10635            // Write the fields.
10636            self.0.encode(encoder, offset + 0, depth)?;
10637            Ok(())
10638        }
10639    }
10640
10641    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10642        for FlatlandReleaseViewportResponse
10643    {
10644        #[inline(always)]
10645        fn new_empty() -> Self {
10646            Self {
10647                token: fidl::new_empty!(
10648                    fidl_fuchsia_ui_views::ViewportCreationToken,
10649                    fidl::encoding::DefaultFuchsiaResourceDialect
10650                ),
10651            }
10652        }
10653
10654        #[inline]
10655        unsafe fn decode(
10656            &mut self,
10657            decoder: &mut fidl::encoding::Decoder<
10658                '_,
10659                fidl::encoding::DefaultFuchsiaResourceDialect,
10660            >,
10661            offset: usize,
10662            _depth: fidl::encoding::Depth,
10663        ) -> fidl::Result<()> {
10664            decoder.debug_check_bounds::<Self>(offset);
10665            // Verify that padding bytes are zero.
10666            fidl::decode!(
10667                fidl_fuchsia_ui_views::ViewportCreationToken,
10668                fidl::encoding::DefaultFuchsiaResourceDialect,
10669                &mut self.token,
10670                decoder,
10671                offset + 0,
10672                _depth
10673            )?;
10674            Ok(())
10675        }
10676    }
10677
10678    impl fidl::encoding::ResourceTypeMarker for FlatlandSetSolidFillRequest {
10679        type Borrowed<'a> = &'a mut Self;
10680        fn take_or_borrow<'a>(
10681            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10682        ) -> Self::Borrowed<'a> {
10683            value
10684        }
10685    }
10686
10687    unsafe impl fidl::encoding::TypeMarker for FlatlandSetSolidFillRequest {
10688        type Owned = Self;
10689
10690        #[inline(always)]
10691        fn inline_align(_context: fidl::encoding::Context) -> usize {
10692            8
10693        }
10694
10695        #[inline(always)]
10696        fn inline_size(_context: fidl::encoding::Context) -> usize {
10697            32
10698        }
10699    }
10700
10701    unsafe impl
10702        fidl::encoding::Encode<
10703            FlatlandSetSolidFillRequest,
10704            fidl::encoding::DefaultFuchsiaResourceDialect,
10705        > for &mut FlatlandSetSolidFillRequest
10706    {
10707        #[inline]
10708        unsafe fn encode(
10709            self,
10710            encoder: &mut fidl::encoding::Encoder<
10711                '_,
10712                fidl::encoding::DefaultFuchsiaResourceDialect,
10713            >,
10714            offset: usize,
10715            _depth: fidl::encoding::Depth,
10716        ) -> fidl::Result<()> {
10717            encoder.debug_check_bounds::<FlatlandSetSolidFillRequest>(offset);
10718            // Delegate to tuple encoding.
10719            fidl::encoding::Encode::<
10720                FlatlandSetSolidFillRequest,
10721                fidl::encoding::DefaultFuchsiaResourceDialect,
10722            >::encode(
10723                (
10724                    <ContentId as fidl::encoding::ValueTypeMarker>::borrow(&self.rect_id),
10725                    <ColorRgba as fidl::encoding::ValueTypeMarker>::borrow(&self.color),
10726                    <fidl_fuchsia_math::SizeU as fidl::encoding::ValueTypeMarker>::borrow(
10727                        &self.size,
10728                    ),
10729                ),
10730                encoder,
10731                offset,
10732                _depth,
10733            )
10734        }
10735    }
10736    unsafe impl<
10737        T0: fidl::encoding::Encode<ContentId, fidl::encoding::DefaultFuchsiaResourceDialect>,
10738        T1: fidl::encoding::Encode<ColorRgba, fidl::encoding::DefaultFuchsiaResourceDialect>,
10739        T2: fidl::encoding::Encode<
10740                fidl_fuchsia_math::SizeU,
10741                fidl::encoding::DefaultFuchsiaResourceDialect,
10742            >,
10743    >
10744        fidl::encoding::Encode<
10745            FlatlandSetSolidFillRequest,
10746            fidl::encoding::DefaultFuchsiaResourceDialect,
10747        > for (T0, T1, T2)
10748    {
10749        #[inline]
10750        unsafe fn encode(
10751            self,
10752            encoder: &mut fidl::encoding::Encoder<
10753                '_,
10754                fidl::encoding::DefaultFuchsiaResourceDialect,
10755            >,
10756            offset: usize,
10757            depth: fidl::encoding::Depth,
10758        ) -> fidl::Result<()> {
10759            encoder.debug_check_bounds::<FlatlandSetSolidFillRequest>(offset);
10760            // Zero out padding regions. There's no need to apply masks
10761            // because the unmasked parts will be overwritten by fields.
10762            // Write the fields.
10763            self.0.encode(encoder, offset + 0, depth)?;
10764            self.1.encode(encoder, offset + 8, depth)?;
10765            self.2.encode(encoder, offset + 24, depth)?;
10766            Ok(())
10767        }
10768    }
10769
10770    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10771        for FlatlandSetSolidFillRequest
10772    {
10773        #[inline(always)]
10774        fn new_empty() -> Self {
10775            Self {
10776                rect_id: fidl::new_empty!(ContentId, fidl::encoding::DefaultFuchsiaResourceDialect),
10777                color: fidl::new_empty!(ColorRgba, fidl::encoding::DefaultFuchsiaResourceDialect),
10778                size: fidl::new_empty!(
10779                    fidl_fuchsia_math::SizeU,
10780                    fidl::encoding::DefaultFuchsiaResourceDialect
10781                ),
10782            }
10783        }
10784
10785        #[inline]
10786        unsafe fn decode(
10787            &mut self,
10788            decoder: &mut fidl::encoding::Decoder<
10789                '_,
10790                fidl::encoding::DefaultFuchsiaResourceDialect,
10791            >,
10792            offset: usize,
10793            _depth: fidl::encoding::Depth,
10794        ) -> fidl::Result<()> {
10795            decoder.debug_check_bounds::<Self>(offset);
10796            // Verify that padding bytes are zero.
10797            fidl::decode!(
10798                ContentId,
10799                fidl::encoding::DefaultFuchsiaResourceDialect,
10800                &mut self.rect_id,
10801                decoder,
10802                offset + 0,
10803                _depth
10804            )?;
10805            fidl::decode!(
10806                ColorRgba,
10807                fidl::encoding::DefaultFuchsiaResourceDialect,
10808                &mut self.color,
10809                decoder,
10810                offset + 8,
10811                _depth
10812            )?;
10813            fidl::decode!(
10814                fidl_fuchsia_math::SizeU,
10815                fidl::encoding::DefaultFuchsiaResourceDialect,
10816                &mut self.size,
10817                decoder,
10818                offset + 24,
10819                _depth
10820            )?;
10821            Ok(())
10822        }
10823    }
10824
10825    impl fidl::encoding::ResourceTypeMarker for TrustedFlatlandFactoryCreateFlatlandRequest {
10826        type Borrowed<'a> = &'a mut Self;
10827        fn take_or_borrow<'a>(
10828            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10829        ) -> Self::Borrowed<'a> {
10830            value
10831        }
10832    }
10833
10834    unsafe impl fidl::encoding::TypeMarker for TrustedFlatlandFactoryCreateFlatlandRequest {
10835        type Owned = Self;
10836
10837        #[inline(always)]
10838        fn inline_align(_context: fidl::encoding::Context) -> usize {
10839            8
10840        }
10841
10842        #[inline(always)]
10843        fn inline_size(_context: fidl::encoding::Context) -> usize {
10844            24
10845        }
10846    }
10847
10848    unsafe impl
10849        fidl::encoding::Encode<
10850            TrustedFlatlandFactoryCreateFlatlandRequest,
10851            fidl::encoding::DefaultFuchsiaResourceDialect,
10852        > for &mut TrustedFlatlandFactoryCreateFlatlandRequest
10853    {
10854        #[inline]
10855        unsafe fn encode(
10856            self,
10857            encoder: &mut fidl::encoding::Encoder<
10858                '_,
10859                fidl::encoding::DefaultFuchsiaResourceDialect,
10860            >,
10861            offset: usize,
10862            _depth: fidl::encoding::Depth,
10863        ) -> fidl::Result<()> {
10864            encoder.debug_check_bounds::<TrustedFlatlandFactoryCreateFlatlandRequest>(offset);
10865            // Delegate to tuple encoding.
10866            fidl::encoding::Encode::<TrustedFlatlandFactoryCreateFlatlandRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
10867                (
10868                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<FlatlandMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.server_end),
10869                    <TrustedFlatlandConfig as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.config),
10870                ),
10871                encoder, offset, _depth
10872            )
10873        }
10874    }
10875    unsafe impl<
10876        T0: fidl::encoding::Encode<
10877                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<FlatlandMarker>>,
10878                fidl::encoding::DefaultFuchsiaResourceDialect,
10879            >,
10880        T1: fidl::encoding::Encode<
10881                TrustedFlatlandConfig,
10882                fidl::encoding::DefaultFuchsiaResourceDialect,
10883            >,
10884    >
10885        fidl::encoding::Encode<
10886            TrustedFlatlandFactoryCreateFlatlandRequest,
10887            fidl::encoding::DefaultFuchsiaResourceDialect,
10888        > for (T0, T1)
10889    {
10890        #[inline]
10891        unsafe fn encode(
10892            self,
10893            encoder: &mut fidl::encoding::Encoder<
10894                '_,
10895                fidl::encoding::DefaultFuchsiaResourceDialect,
10896            >,
10897            offset: usize,
10898            depth: fidl::encoding::Depth,
10899        ) -> fidl::Result<()> {
10900            encoder.debug_check_bounds::<TrustedFlatlandFactoryCreateFlatlandRequest>(offset);
10901            // Zero out padding regions. There's no need to apply masks
10902            // because the unmasked parts will be overwritten by fields.
10903            unsafe {
10904                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
10905                (ptr as *mut u64).write_unaligned(0);
10906            }
10907            // Write the fields.
10908            self.0.encode(encoder, offset + 0, depth)?;
10909            self.1.encode(encoder, offset + 8, depth)?;
10910            Ok(())
10911        }
10912    }
10913
10914    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10915        for TrustedFlatlandFactoryCreateFlatlandRequest
10916    {
10917        #[inline(always)]
10918        fn new_empty() -> Self {
10919            Self {
10920                server_end: fidl::new_empty!(
10921                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<FlatlandMarker>>,
10922                    fidl::encoding::DefaultFuchsiaResourceDialect
10923                ),
10924                config: fidl::new_empty!(
10925                    TrustedFlatlandConfig,
10926                    fidl::encoding::DefaultFuchsiaResourceDialect
10927                ),
10928            }
10929        }
10930
10931        #[inline]
10932        unsafe fn decode(
10933            &mut self,
10934            decoder: &mut fidl::encoding::Decoder<
10935                '_,
10936                fidl::encoding::DefaultFuchsiaResourceDialect,
10937            >,
10938            offset: usize,
10939            _depth: fidl::encoding::Depth,
10940        ) -> fidl::Result<()> {
10941            decoder.debug_check_bounds::<Self>(offset);
10942            // Verify that padding bytes are zero.
10943            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
10944            let padval = unsafe { (ptr as *const u64).read_unaligned() };
10945            let mask = 0xffffffff00000000u64;
10946            let maskedval = padval & mask;
10947            if maskedval != 0 {
10948                return Err(fidl::Error::NonZeroPadding {
10949                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
10950                });
10951            }
10952            fidl::decode!(
10953                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<FlatlandMarker>>,
10954                fidl::encoding::DefaultFuchsiaResourceDialect,
10955                &mut self.server_end,
10956                decoder,
10957                offset + 0,
10958                _depth
10959            )?;
10960            fidl::decode!(
10961                TrustedFlatlandConfig,
10962                fidl::encoding::DefaultFuchsiaResourceDialect,
10963                &mut self.config,
10964                decoder,
10965                offset + 8,
10966                _depth
10967            )?;
10968            Ok(())
10969        }
10970    }
10971
10972    impl FrameInfo {
10973        #[inline(always)]
10974        fn max_ordinal_present(&self) -> u64 {
10975            if let Some(_) = self.buffer_id {
10976                return 1;
10977            }
10978            0
10979        }
10980    }
10981
10982    impl fidl::encoding::ResourceTypeMarker for FrameInfo {
10983        type Borrowed<'a> = &'a mut Self;
10984        fn take_or_borrow<'a>(
10985            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10986        ) -> Self::Borrowed<'a> {
10987            value
10988        }
10989    }
10990
10991    unsafe impl fidl::encoding::TypeMarker for FrameInfo {
10992        type Owned = Self;
10993
10994        #[inline(always)]
10995        fn inline_align(_context: fidl::encoding::Context) -> usize {
10996            8
10997        }
10998
10999        #[inline(always)]
11000        fn inline_size(_context: fidl::encoding::Context) -> usize {
11001            16
11002        }
11003    }
11004
11005    unsafe impl fidl::encoding::Encode<FrameInfo, fidl::encoding::DefaultFuchsiaResourceDialect>
11006        for &mut FrameInfo
11007    {
11008        unsafe fn encode(
11009            self,
11010            encoder: &mut fidl::encoding::Encoder<
11011                '_,
11012                fidl::encoding::DefaultFuchsiaResourceDialect,
11013            >,
11014            offset: usize,
11015            mut depth: fidl::encoding::Depth,
11016        ) -> fidl::Result<()> {
11017            encoder.debug_check_bounds::<FrameInfo>(offset);
11018            // Vector header
11019            let max_ordinal: u64 = self.max_ordinal_present();
11020            encoder.write_num(max_ordinal, offset);
11021            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
11022            // Calling encoder.out_of_line_offset(0) is not allowed.
11023            if max_ordinal == 0 {
11024                return Ok(());
11025            }
11026            depth.increment()?;
11027            let envelope_size = 8;
11028            let bytes_len = max_ordinal as usize * envelope_size;
11029            #[allow(unused_variables)]
11030            let offset = encoder.out_of_line_offset(bytes_len);
11031            let mut _prev_end_offset: usize = 0;
11032            if 1 > max_ordinal {
11033                return Ok(());
11034            }
11035
11036            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11037            // are envelope_size bytes.
11038            let cur_offset: usize = (1 - 1) * envelope_size;
11039
11040            // Zero reserved fields.
11041            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11042
11043            // Safety:
11044            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11045            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11046            //   envelope_size bytes, there is always sufficient room.
11047            fidl::encoding::encode_in_envelope_optional::<
11048                u32,
11049                fidl::encoding::DefaultFuchsiaResourceDialect,
11050            >(
11051                self.buffer_id.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
11052                encoder,
11053                offset + cur_offset,
11054                depth,
11055            )?;
11056
11057            _prev_end_offset = cur_offset + envelope_size;
11058
11059            Ok(())
11060        }
11061    }
11062
11063    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for FrameInfo {
11064        #[inline(always)]
11065        fn new_empty() -> Self {
11066            Self::default()
11067        }
11068
11069        unsafe fn decode(
11070            &mut self,
11071            decoder: &mut fidl::encoding::Decoder<
11072                '_,
11073                fidl::encoding::DefaultFuchsiaResourceDialect,
11074            >,
11075            offset: usize,
11076            mut depth: fidl::encoding::Depth,
11077        ) -> fidl::Result<()> {
11078            decoder.debug_check_bounds::<Self>(offset);
11079            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
11080                None => return Err(fidl::Error::NotNullable),
11081                Some(len) => len,
11082            };
11083            // Calling decoder.out_of_line_offset(0) is not allowed.
11084            if len == 0 {
11085                return Ok(());
11086            };
11087            depth.increment()?;
11088            let envelope_size = 8;
11089            let bytes_len = len * envelope_size;
11090            let offset = decoder.out_of_line_offset(bytes_len)?;
11091            // Decode the envelope for each type.
11092            let mut _next_ordinal_to_read = 0;
11093            let mut next_offset = offset;
11094            let end_offset = offset + bytes_len;
11095            _next_ordinal_to_read += 1;
11096            if next_offset >= end_offset {
11097                return Ok(());
11098            }
11099
11100            // Decode unknown envelopes for gaps in ordinals.
11101            while _next_ordinal_to_read < 1 {
11102                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11103                _next_ordinal_to_read += 1;
11104                next_offset += envelope_size;
11105            }
11106
11107            let next_out_of_line = decoder.next_out_of_line();
11108            let handles_before = decoder.remaining_handles();
11109            if let Some((inlined, num_bytes, num_handles)) =
11110                fidl::encoding::decode_envelope_header(decoder, next_offset)?
11111            {
11112                let member_inline_size =
11113                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
11114                if inlined != (member_inline_size <= 4) {
11115                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
11116                }
11117                let inner_offset;
11118                let mut inner_depth = depth.clone();
11119                if inlined {
11120                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11121                    inner_offset = next_offset;
11122                } else {
11123                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11124                    inner_depth.increment()?;
11125                }
11126                let val_ref = self.buffer_id.get_or_insert_with(|| {
11127                    fidl::new_empty!(u32, fidl::encoding::DefaultFuchsiaResourceDialect)
11128                });
11129                fidl::decode!(
11130                    u32,
11131                    fidl::encoding::DefaultFuchsiaResourceDialect,
11132                    val_ref,
11133                    decoder,
11134                    inner_offset,
11135                    inner_depth
11136                )?;
11137                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11138                {
11139                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
11140                }
11141                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11142                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11143                }
11144            }
11145
11146            next_offset += envelope_size;
11147
11148            // Decode the remaining unknown envelopes.
11149            while next_offset < end_offset {
11150                _next_ordinal_to_read += 1;
11151                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11152                next_offset += envelope_size;
11153            }
11154
11155            Ok(())
11156        }
11157    }
11158
11159    impl GetNextFrameArgs {
11160        #[inline(always)]
11161        fn max_ordinal_present(&self) -> u64 {
11162            if let Some(_) = self.event {
11163                return 1;
11164            }
11165            0
11166        }
11167    }
11168
11169    impl fidl::encoding::ResourceTypeMarker for GetNextFrameArgs {
11170        type Borrowed<'a> = &'a mut Self;
11171        fn take_or_borrow<'a>(
11172            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11173        ) -> Self::Borrowed<'a> {
11174            value
11175        }
11176    }
11177
11178    unsafe impl fidl::encoding::TypeMarker for GetNextFrameArgs {
11179        type Owned = Self;
11180
11181        #[inline(always)]
11182        fn inline_align(_context: fidl::encoding::Context) -> usize {
11183            8
11184        }
11185
11186        #[inline(always)]
11187        fn inline_size(_context: fidl::encoding::Context) -> usize {
11188            16
11189        }
11190    }
11191
11192    unsafe impl
11193        fidl::encoding::Encode<GetNextFrameArgs, fidl::encoding::DefaultFuchsiaResourceDialect>
11194        for &mut GetNextFrameArgs
11195    {
11196        unsafe fn encode(
11197            self,
11198            encoder: &mut fidl::encoding::Encoder<
11199                '_,
11200                fidl::encoding::DefaultFuchsiaResourceDialect,
11201            >,
11202            offset: usize,
11203            mut depth: fidl::encoding::Depth,
11204        ) -> fidl::Result<()> {
11205            encoder.debug_check_bounds::<GetNextFrameArgs>(offset);
11206            // Vector header
11207            let max_ordinal: u64 = self.max_ordinal_present();
11208            encoder.write_num(max_ordinal, offset);
11209            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
11210            // Calling encoder.out_of_line_offset(0) is not allowed.
11211            if max_ordinal == 0 {
11212                return Ok(());
11213            }
11214            depth.increment()?;
11215            let envelope_size = 8;
11216            let bytes_len = max_ordinal as usize * envelope_size;
11217            #[allow(unused_variables)]
11218            let offset = encoder.out_of_line_offset(bytes_len);
11219            let mut _prev_end_offset: usize = 0;
11220            if 1 > max_ordinal {
11221                return Ok(());
11222            }
11223
11224            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11225            // are envelope_size bytes.
11226            let cur_offset: usize = (1 - 1) * envelope_size;
11227
11228            // Zero reserved fields.
11229            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11230
11231            // Safety:
11232            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11233            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11234            //   envelope_size bytes, there is always sufficient room.
11235            fidl::encoding::encode_in_envelope_optional::<
11236                fidl::encoding::HandleType<
11237                    fidl::Event,
11238                    { fidl::ObjectType::EVENT.into_raw() },
11239                    2147483648,
11240                >,
11241                fidl::encoding::DefaultFuchsiaResourceDialect,
11242            >(
11243                self.event.as_mut().map(
11244                    <fidl::encoding::HandleType<
11245                        fidl::Event,
11246                        { fidl::ObjectType::EVENT.into_raw() },
11247                        2147483648,
11248                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
11249                ),
11250                encoder,
11251                offset + cur_offset,
11252                depth,
11253            )?;
11254
11255            _prev_end_offset = cur_offset + envelope_size;
11256
11257            Ok(())
11258        }
11259    }
11260
11261    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11262        for GetNextFrameArgs
11263    {
11264        #[inline(always)]
11265        fn new_empty() -> Self {
11266            Self::default()
11267        }
11268
11269        unsafe fn decode(
11270            &mut self,
11271            decoder: &mut fidl::encoding::Decoder<
11272                '_,
11273                fidl::encoding::DefaultFuchsiaResourceDialect,
11274            >,
11275            offset: usize,
11276            mut depth: fidl::encoding::Depth,
11277        ) -> fidl::Result<()> {
11278            decoder.debug_check_bounds::<Self>(offset);
11279            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
11280                None => return Err(fidl::Error::NotNullable),
11281                Some(len) => len,
11282            };
11283            // Calling decoder.out_of_line_offset(0) is not allowed.
11284            if len == 0 {
11285                return Ok(());
11286            };
11287            depth.increment()?;
11288            let envelope_size = 8;
11289            let bytes_len = len * envelope_size;
11290            let offset = decoder.out_of_line_offset(bytes_len)?;
11291            // Decode the envelope for each type.
11292            let mut _next_ordinal_to_read = 0;
11293            let mut next_offset = offset;
11294            let end_offset = offset + bytes_len;
11295            _next_ordinal_to_read += 1;
11296            if next_offset >= end_offset {
11297                return Ok(());
11298            }
11299
11300            // Decode unknown envelopes for gaps in ordinals.
11301            while _next_ordinal_to_read < 1 {
11302                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11303                _next_ordinal_to_read += 1;
11304                next_offset += envelope_size;
11305            }
11306
11307            let next_out_of_line = decoder.next_out_of_line();
11308            let handles_before = decoder.remaining_handles();
11309            if let Some((inlined, num_bytes, num_handles)) =
11310                fidl::encoding::decode_envelope_header(decoder, next_offset)?
11311            {
11312                let member_inline_size = <fidl::encoding::HandleType<
11313                    fidl::Event,
11314                    { fidl::ObjectType::EVENT.into_raw() },
11315                    2147483648,
11316                > as fidl::encoding::TypeMarker>::inline_size(
11317                    decoder.context
11318                );
11319                if inlined != (member_inline_size <= 4) {
11320                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
11321                }
11322                let inner_offset;
11323                let mut inner_depth = depth.clone();
11324                if inlined {
11325                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11326                    inner_offset = next_offset;
11327                } else {
11328                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11329                    inner_depth.increment()?;
11330                }
11331                let val_ref =
11332                self.event.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
11333                fidl::decode!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
11334                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11335                {
11336                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
11337                }
11338                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11339                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11340                }
11341            }
11342
11343            next_offset += envelope_size;
11344
11345            // Decode the remaining unknown envelopes.
11346            while next_offset < end_offset {
11347                _next_ordinal_to_read += 1;
11348                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11349                next_offset += envelope_size;
11350            }
11351
11352            Ok(())
11353        }
11354    }
11355
11356    impl PresentArgs {
11357        #[inline(always)]
11358        fn max_ordinal_present(&self) -> u64 {
11359            if let Some(_) = self.unsquashable {
11360                return 4;
11361            }
11362            if let Some(_) = self.release_fences {
11363                return 3;
11364            }
11365            if let Some(_) = self.acquire_fences {
11366                return 2;
11367            }
11368            if let Some(_) = self.requested_presentation_time {
11369                return 1;
11370            }
11371            0
11372        }
11373    }
11374
11375    impl fidl::encoding::ResourceTypeMarker for PresentArgs {
11376        type Borrowed<'a> = &'a mut Self;
11377        fn take_or_borrow<'a>(
11378            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11379        ) -> Self::Borrowed<'a> {
11380            value
11381        }
11382    }
11383
11384    unsafe impl fidl::encoding::TypeMarker for PresentArgs {
11385        type Owned = Self;
11386
11387        #[inline(always)]
11388        fn inline_align(_context: fidl::encoding::Context) -> usize {
11389            8
11390        }
11391
11392        #[inline(always)]
11393        fn inline_size(_context: fidl::encoding::Context) -> usize {
11394            16
11395        }
11396    }
11397
11398    unsafe impl fidl::encoding::Encode<PresentArgs, fidl::encoding::DefaultFuchsiaResourceDialect>
11399        for &mut PresentArgs
11400    {
11401        unsafe fn encode(
11402            self,
11403            encoder: &mut fidl::encoding::Encoder<
11404                '_,
11405                fidl::encoding::DefaultFuchsiaResourceDialect,
11406            >,
11407            offset: usize,
11408            mut depth: fidl::encoding::Depth,
11409        ) -> fidl::Result<()> {
11410            encoder.debug_check_bounds::<PresentArgs>(offset);
11411            // Vector header
11412            let max_ordinal: u64 = self.max_ordinal_present();
11413            encoder.write_num(max_ordinal, offset);
11414            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
11415            // Calling encoder.out_of_line_offset(0) is not allowed.
11416            if max_ordinal == 0 {
11417                return Ok(());
11418            }
11419            depth.increment()?;
11420            let envelope_size = 8;
11421            let bytes_len = max_ordinal as usize * envelope_size;
11422            #[allow(unused_variables)]
11423            let offset = encoder.out_of_line_offset(bytes_len);
11424            let mut _prev_end_offset: usize = 0;
11425            if 1 > max_ordinal {
11426                return Ok(());
11427            }
11428
11429            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11430            // are envelope_size bytes.
11431            let cur_offset: usize = (1 - 1) * envelope_size;
11432
11433            // Zero reserved fields.
11434            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11435
11436            // Safety:
11437            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11438            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11439            //   envelope_size bytes, there is always sufficient room.
11440            fidl::encoding::encode_in_envelope_optional::<
11441                i64,
11442                fidl::encoding::DefaultFuchsiaResourceDialect,
11443            >(
11444                self.requested_presentation_time
11445                    .as_ref()
11446                    .map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
11447                encoder,
11448                offset + cur_offset,
11449                depth,
11450            )?;
11451
11452            _prev_end_offset = cur_offset + envelope_size;
11453            if 2 > max_ordinal {
11454                return Ok(());
11455            }
11456
11457            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11458            // are envelope_size bytes.
11459            let cur_offset: usize = (2 - 1) * envelope_size;
11460
11461            // Zero reserved fields.
11462            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11463
11464            // Safety:
11465            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11466            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11467            //   envelope_size bytes, there is always sufficient room.
11468            fidl::encoding::encode_in_envelope_optional::<
11469                fidl::encoding::Vector<
11470                    fidl::encoding::HandleType<
11471                        fidl::Event,
11472                        { fidl::ObjectType::EVENT.into_raw() },
11473                        2147483648,
11474                    >,
11475                    16,
11476                >,
11477                fidl::encoding::DefaultFuchsiaResourceDialect,
11478            >(
11479                self.acquire_fences.as_mut().map(
11480                    <fidl::encoding::Vector<
11481                        fidl::encoding::HandleType<
11482                            fidl::Event,
11483                            { fidl::ObjectType::EVENT.into_raw() },
11484                            2147483648,
11485                        >,
11486                        16,
11487                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
11488                ),
11489                encoder,
11490                offset + cur_offset,
11491                depth,
11492            )?;
11493
11494            _prev_end_offset = cur_offset + envelope_size;
11495            if 3 > max_ordinal {
11496                return Ok(());
11497            }
11498
11499            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11500            // are envelope_size bytes.
11501            let cur_offset: usize = (3 - 1) * envelope_size;
11502
11503            // Zero reserved fields.
11504            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11505
11506            // Safety:
11507            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11508            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11509            //   envelope_size bytes, there is always sufficient room.
11510            fidl::encoding::encode_in_envelope_optional::<
11511                fidl::encoding::Vector<
11512                    fidl::encoding::HandleType<
11513                        fidl::Event,
11514                        { fidl::ObjectType::EVENT.into_raw() },
11515                        2147483648,
11516                    >,
11517                    16,
11518                >,
11519                fidl::encoding::DefaultFuchsiaResourceDialect,
11520            >(
11521                self.release_fences.as_mut().map(
11522                    <fidl::encoding::Vector<
11523                        fidl::encoding::HandleType<
11524                            fidl::Event,
11525                            { fidl::ObjectType::EVENT.into_raw() },
11526                            2147483648,
11527                        >,
11528                        16,
11529                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
11530                ),
11531                encoder,
11532                offset + cur_offset,
11533                depth,
11534            )?;
11535
11536            _prev_end_offset = cur_offset + envelope_size;
11537            if 4 > max_ordinal {
11538                return Ok(());
11539            }
11540
11541            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11542            // are envelope_size bytes.
11543            let cur_offset: usize = (4 - 1) * envelope_size;
11544
11545            // Zero reserved fields.
11546            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11547
11548            // Safety:
11549            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11550            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11551            //   envelope_size bytes, there is always sufficient room.
11552            fidl::encoding::encode_in_envelope_optional::<
11553                bool,
11554                fidl::encoding::DefaultFuchsiaResourceDialect,
11555            >(
11556                self.unsquashable.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
11557                encoder,
11558                offset + cur_offset,
11559                depth,
11560            )?;
11561
11562            _prev_end_offset = cur_offset + envelope_size;
11563
11564            Ok(())
11565        }
11566    }
11567
11568    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for PresentArgs {
11569        #[inline(always)]
11570        fn new_empty() -> Self {
11571            Self::default()
11572        }
11573
11574        unsafe fn decode(
11575            &mut self,
11576            decoder: &mut fidl::encoding::Decoder<
11577                '_,
11578                fidl::encoding::DefaultFuchsiaResourceDialect,
11579            >,
11580            offset: usize,
11581            mut depth: fidl::encoding::Depth,
11582        ) -> fidl::Result<()> {
11583            decoder.debug_check_bounds::<Self>(offset);
11584            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
11585                None => return Err(fidl::Error::NotNullable),
11586                Some(len) => len,
11587            };
11588            // Calling decoder.out_of_line_offset(0) is not allowed.
11589            if len == 0 {
11590                return Ok(());
11591            };
11592            depth.increment()?;
11593            let envelope_size = 8;
11594            let bytes_len = len * envelope_size;
11595            let offset = decoder.out_of_line_offset(bytes_len)?;
11596            // Decode the envelope for each type.
11597            let mut _next_ordinal_to_read = 0;
11598            let mut next_offset = offset;
11599            let end_offset = offset + bytes_len;
11600            _next_ordinal_to_read += 1;
11601            if next_offset >= end_offset {
11602                return Ok(());
11603            }
11604
11605            // Decode unknown envelopes for gaps in ordinals.
11606            while _next_ordinal_to_read < 1 {
11607                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11608                _next_ordinal_to_read += 1;
11609                next_offset += envelope_size;
11610            }
11611
11612            let next_out_of_line = decoder.next_out_of_line();
11613            let handles_before = decoder.remaining_handles();
11614            if let Some((inlined, num_bytes, num_handles)) =
11615                fidl::encoding::decode_envelope_header(decoder, next_offset)?
11616            {
11617                let member_inline_size =
11618                    <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
11619                if inlined != (member_inline_size <= 4) {
11620                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
11621                }
11622                let inner_offset;
11623                let mut inner_depth = depth.clone();
11624                if inlined {
11625                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11626                    inner_offset = next_offset;
11627                } else {
11628                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11629                    inner_depth.increment()?;
11630                }
11631                let val_ref = self.requested_presentation_time.get_or_insert_with(|| {
11632                    fidl::new_empty!(i64, fidl::encoding::DefaultFuchsiaResourceDialect)
11633                });
11634                fidl::decode!(
11635                    i64,
11636                    fidl::encoding::DefaultFuchsiaResourceDialect,
11637                    val_ref,
11638                    decoder,
11639                    inner_offset,
11640                    inner_depth
11641                )?;
11642                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11643                {
11644                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
11645                }
11646                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11647                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11648                }
11649            }
11650
11651            next_offset += envelope_size;
11652            _next_ordinal_to_read += 1;
11653            if next_offset >= end_offset {
11654                return Ok(());
11655            }
11656
11657            // Decode unknown envelopes for gaps in ordinals.
11658            while _next_ordinal_to_read < 2 {
11659                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11660                _next_ordinal_to_read += 1;
11661                next_offset += envelope_size;
11662            }
11663
11664            let next_out_of_line = decoder.next_out_of_line();
11665            let handles_before = decoder.remaining_handles();
11666            if let Some((inlined, num_bytes, num_handles)) =
11667                fidl::encoding::decode_envelope_header(decoder, next_offset)?
11668            {
11669                let member_inline_size = <fidl::encoding::Vector<
11670                    fidl::encoding::HandleType<
11671                        fidl::Event,
11672                        { fidl::ObjectType::EVENT.into_raw() },
11673                        2147483648,
11674                    >,
11675                    16,
11676                > as fidl::encoding::TypeMarker>::inline_size(
11677                    decoder.context
11678                );
11679                if inlined != (member_inline_size <= 4) {
11680                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
11681                }
11682                let inner_offset;
11683                let mut inner_depth = depth.clone();
11684                if inlined {
11685                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11686                    inner_offset = next_offset;
11687                } else {
11688                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11689                    inner_depth.increment()?;
11690                }
11691                let val_ref = self.acquire_fences.get_or_insert_with(|| {
11692                    fidl::new_empty!(
11693                        fidl::encoding::Vector<
11694                            fidl::encoding::HandleType<
11695                                fidl::Event,
11696                                { fidl::ObjectType::EVENT.into_raw() },
11697                                2147483648,
11698                            >,
11699                            16,
11700                        >,
11701                        fidl::encoding::DefaultFuchsiaResourceDialect
11702                    )
11703                });
11704                fidl::decode!(
11705                    fidl::encoding::Vector<
11706                        fidl::encoding::HandleType<
11707                            fidl::Event,
11708                            { fidl::ObjectType::EVENT.into_raw() },
11709                            2147483648,
11710                        >,
11711                        16,
11712                    >,
11713                    fidl::encoding::DefaultFuchsiaResourceDialect,
11714                    val_ref,
11715                    decoder,
11716                    inner_offset,
11717                    inner_depth
11718                )?;
11719                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11720                {
11721                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
11722                }
11723                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11724                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11725                }
11726            }
11727
11728            next_offset += envelope_size;
11729            _next_ordinal_to_read += 1;
11730            if next_offset >= end_offset {
11731                return Ok(());
11732            }
11733
11734            // Decode unknown envelopes for gaps in ordinals.
11735            while _next_ordinal_to_read < 3 {
11736                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11737                _next_ordinal_to_read += 1;
11738                next_offset += envelope_size;
11739            }
11740
11741            let next_out_of_line = decoder.next_out_of_line();
11742            let handles_before = decoder.remaining_handles();
11743            if let Some((inlined, num_bytes, num_handles)) =
11744                fidl::encoding::decode_envelope_header(decoder, next_offset)?
11745            {
11746                let member_inline_size = <fidl::encoding::Vector<
11747                    fidl::encoding::HandleType<
11748                        fidl::Event,
11749                        { fidl::ObjectType::EVENT.into_raw() },
11750                        2147483648,
11751                    >,
11752                    16,
11753                > as fidl::encoding::TypeMarker>::inline_size(
11754                    decoder.context
11755                );
11756                if inlined != (member_inline_size <= 4) {
11757                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
11758                }
11759                let inner_offset;
11760                let mut inner_depth = depth.clone();
11761                if inlined {
11762                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11763                    inner_offset = next_offset;
11764                } else {
11765                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11766                    inner_depth.increment()?;
11767                }
11768                let val_ref = self.release_fences.get_or_insert_with(|| {
11769                    fidl::new_empty!(
11770                        fidl::encoding::Vector<
11771                            fidl::encoding::HandleType<
11772                                fidl::Event,
11773                                { fidl::ObjectType::EVENT.into_raw() },
11774                                2147483648,
11775                            >,
11776                            16,
11777                        >,
11778                        fidl::encoding::DefaultFuchsiaResourceDialect
11779                    )
11780                });
11781                fidl::decode!(
11782                    fidl::encoding::Vector<
11783                        fidl::encoding::HandleType<
11784                            fidl::Event,
11785                            { fidl::ObjectType::EVENT.into_raw() },
11786                            2147483648,
11787                        >,
11788                        16,
11789                    >,
11790                    fidl::encoding::DefaultFuchsiaResourceDialect,
11791                    val_ref,
11792                    decoder,
11793                    inner_offset,
11794                    inner_depth
11795                )?;
11796                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11797                {
11798                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
11799                }
11800                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11801                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11802                }
11803            }
11804
11805            next_offset += envelope_size;
11806            _next_ordinal_to_read += 1;
11807            if next_offset >= end_offset {
11808                return Ok(());
11809            }
11810
11811            // Decode unknown envelopes for gaps in ordinals.
11812            while _next_ordinal_to_read < 4 {
11813                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11814                _next_ordinal_to_read += 1;
11815                next_offset += envelope_size;
11816            }
11817
11818            let next_out_of_line = decoder.next_out_of_line();
11819            let handles_before = decoder.remaining_handles();
11820            if let Some((inlined, num_bytes, num_handles)) =
11821                fidl::encoding::decode_envelope_header(decoder, next_offset)?
11822            {
11823                let member_inline_size =
11824                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
11825                if inlined != (member_inline_size <= 4) {
11826                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
11827                }
11828                let inner_offset;
11829                let mut inner_depth = depth.clone();
11830                if inlined {
11831                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11832                    inner_offset = next_offset;
11833                } else {
11834                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11835                    inner_depth.increment()?;
11836                }
11837                let val_ref = self.unsquashable.get_or_insert_with(|| {
11838                    fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
11839                });
11840                fidl::decode!(
11841                    bool,
11842                    fidl::encoding::DefaultFuchsiaResourceDialect,
11843                    val_ref,
11844                    decoder,
11845                    inner_offset,
11846                    inner_depth
11847                )?;
11848                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11849                {
11850                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
11851                }
11852                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11853                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11854                }
11855            }
11856
11857            next_offset += envelope_size;
11858
11859            // Decode the remaining unknown envelopes.
11860            while next_offset < end_offset {
11861                _next_ordinal_to_read += 1;
11862                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11863                next_offset += envelope_size;
11864            }
11865
11866            Ok(())
11867        }
11868    }
11869
11870    impl RegisterBufferCollectionArgs {
11871        #[inline(always)]
11872        fn max_ordinal_present(&self) -> u64 {
11873            if let Some(_) = self.buffer_collection_token2 {
11874                return 5;
11875            }
11876            if let Some(_) = self.usages {
11877                return 4;
11878            }
11879            if let Some(_) = self.usage {
11880                return 3;
11881            }
11882            if let Some(_) = self.buffer_collection_token {
11883                return 2;
11884            }
11885            if let Some(_) = self.export_token {
11886                return 1;
11887            }
11888            0
11889        }
11890    }
11891
11892    impl fidl::encoding::ResourceTypeMarker for RegisterBufferCollectionArgs {
11893        type Borrowed<'a> = &'a mut Self;
11894        fn take_or_borrow<'a>(
11895            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11896        ) -> Self::Borrowed<'a> {
11897            value
11898        }
11899    }
11900
11901    unsafe impl fidl::encoding::TypeMarker for RegisterBufferCollectionArgs {
11902        type Owned = Self;
11903
11904        #[inline(always)]
11905        fn inline_align(_context: fidl::encoding::Context) -> usize {
11906            8
11907        }
11908
11909        #[inline(always)]
11910        fn inline_size(_context: fidl::encoding::Context) -> usize {
11911            16
11912        }
11913    }
11914
11915    unsafe impl
11916        fidl::encoding::Encode<
11917            RegisterBufferCollectionArgs,
11918            fidl::encoding::DefaultFuchsiaResourceDialect,
11919        > for &mut RegisterBufferCollectionArgs
11920    {
11921        unsafe fn encode(
11922            self,
11923            encoder: &mut fidl::encoding::Encoder<
11924                '_,
11925                fidl::encoding::DefaultFuchsiaResourceDialect,
11926            >,
11927            offset: usize,
11928            mut depth: fidl::encoding::Depth,
11929        ) -> fidl::Result<()> {
11930            encoder.debug_check_bounds::<RegisterBufferCollectionArgs>(offset);
11931            // Vector header
11932            let max_ordinal: u64 = self.max_ordinal_present();
11933            encoder.write_num(max_ordinal, offset);
11934            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
11935            // Calling encoder.out_of_line_offset(0) is not allowed.
11936            if max_ordinal == 0 {
11937                return Ok(());
11938            }
11939            depth.increment()?;
11940            let envelope_size = 8;
11941            let bytes_len = max_ordinal as usize * envelope_size;
11942            #[allow(unused_variables)]
11943            let offset = encoder.out_of_line_offset(bytes_len);
11944            let mut _prev_end_offset: usize = 0;
11945            if 1 > max_ordinal {
11946                return Ok(());
11947            }
11948
11949            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11950            // are envelope_size bytes.
11951            let cur_offset: usize = (1 - 1) * envelope_size;
11952
11953            // Zero reserved fields.
11954            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11955
11956            // Safety:
11957            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11958            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11959            //   envelope_size bytes, there is always sufficient room.
11960            fidl::encoding::encode_in_envelope_optional::<BufferCollectionExportToken, fidl::encoding::DefaultFuchsiaResourceDialect>(
11961            self.export_token.as_mut().map(<BufferCollectionExportToken as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
11962            encoder, offset + cur_offset, depth
11963        )?;
11964
11965            _prev_end_offset = cur_offset + envelope_size;
11966            if 2 > max_ordinal {
11967                return Ok(());
11968            }
11969
11970            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11971            // are envelope_size bytes.
11972            let cur_offset: usize = (2 - 1) * envelope_size;
11973
11974            // Zero reserved fields.
11975            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11976
11977            // Safety:
11978            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11979            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11980            //   envelope_size bytes, there is always sufficient room.
11981            fidl::encoding::encode_in_envelope_optional::<
11982                fidl::encoding::Endpoint<
11983                    fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem::BufferCollectionTokenMarker>,
11984                >,
11985                fidl::encoding::DefaultFuchsiaResourceDialect,
11986            >(
11987                self.buffer_collection_token.as_mut().map(
11988                    <fidl::encoding::Endpoint<
11989                        fidl::endpoints::ClientEnd<
11990                            fidl_fuchsia_sysmem::BufferCollectionTokenMarker,
11991                        >,
11992                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
11993                ),
11994                encoder,
11995                offset + cur_offset,
11996                depth,
11997            )?;
11998
11999            _prev_end_offset = cur_offset + envelope_size;
12000            if 3 > max_ordinal {
12001                return Ok(());
12002            }
12003
12004            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12005            // are envelope_size bytes.
12006            let cur_offset: usize = (3 - 1) * envelope_size;
12007
12008            // Zero reserved fields.
12009            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12010
12011            // Safety:
12012            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12013            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12014            //   envelope_size bytes, there is always sufficient room.
12015            fidl::encoding::encode_in_envelope_optional::<
12016                RegisterBufferCollectionUsage,
12017                fidl::encoding::DefaultFuchsiaResourceDialect,
12018            >(
12019                self.usage.as_ref().map(
12020                    <RegisterBufferCollectionUsage as fidl::encoding::ValueTypeMarker>::borrow,
12021                ),
12022                encoder,
12023                offset + cur_offset,
12024                depth,
12025            )?;
12026
12027            _prev_end_offset = cur_offset + envelope_size;
12028            if 4 > max_ordinal {
12029                return Ok(());
12030            }
12031
12032            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12033            // are envelope_size bytes.
12034            let cur_offset: usize = (4 - 1) * envelope_size;
12035
12036            // Zero reserved fields.
12037            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12038
12039            // Safety:
12040            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12041            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12042            //   envelope_size bytes, there is always sufficient room.
12043            fidl::encoding::encode_in_envelope_optional::<
12044                RegisterBufferCollectionUsages,
12045                fidl::encoding::DefaultFuchsiaResourceDialect,
12046            >(
12047                self.usages.as_ref().map(
12048                    <RegisterBufferCollectionUsages as fidl::encoding::ValueTypeMarker>::borrow,
12049                ),
12050                encoder,
12051                offset + cur_offset,
12052                depth,
12053            )?;
12054
12055            _prev_end_offset = cur_offset + envelope_size;
12056            if 5 > max_ordinal {
12057                return Ok(());
12058            }
12059
12060            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12061            // are envelope_size bytes.
12062            let cur_offset: usize = (5 - 1) * envelope_size;
12063
12064            // Zero reserved fields.
12065            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12066
12067            // Safety:
12068            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12069            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12070            //   envelope_size bytes, there is always sufficient room.
12071            fidl::encoding::encode_in_envelope_optional::<
12072                fidl::encoding::Endpoint<
12073                    fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem2::BufferCollectionTokenMarker>,
12074                >,
12075                fidl::encoding::DefaultFuchsiaResourceDialect,
12076            >(
12077                self.buffer_collection_token2.as_mut().map(
12078                    <fidl::encoding::Endpoint<
12079                        fidl::endpoints::ClientEnd<
12080                            fidl_fuchsia_sysmem2::BufferCollectionTokenMarker,
12081                        >,
12082                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
12083                ),
12084                encoder,
12085                offset + cur_offset,
12086                depth,
12087            )?;
12088
12089            _prev_end_offset = cur_offset + envelope_size;
12090
12091            Ok(())
12092        }
12093    }
12094
12095    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
12096        for RegisterBufferCollectionArgs
12097    {
12098        #[inline(always)]
12099        fn new_empty() -> Self {
12100            Self::default()
12101        }
12102
12103        unsafe fn decode(
12104            &mut self,
12105            decoder: &mut fidl::encoding::Decoder<
12106                '_,
12107                fidl::encoding::DefaultFuchsiaResourceDialect,
12108            >,
12109            offset: usize,
12110            mut depth: fidl::encoding::Depth,
12111        ) -> fidl::Result<()> {
12112            decoder.debug_check_bounds::<Self>(offset);
12113            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
12114                None => return Err(fidl::Error::NotNullable),
12115                Some(len) => len,
12116            };
12117            // Calling decoder.out_of_line_offset(0) is not allowed.
12118            if len == 0 {
12119                return Ok(());
12120            };
12121            depth.increment()?;
12122            let envelope_size = 8;
12123            let bytes_len = len * envelope_size;
12124            let offset = decoder.out_of_line_offset(bytes_len)?;
12125            // Decode the envelope for each type.
12126            let mut _next_ordinal_to_read = 0;
12127            let mut next_offset = offset;
12128            let end_offset = offset + bytes_len;
12129            _next_ordinal_to_read += 1;
12130            if next_offset >= end_offset {
12131                return Ok(());
12132            }
12133
12134            // Decode unknown envelopes for gaps in ordinals.
12135            while _next_ordinal_to_read < 1 {
12136                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12137                _next_ordinal_to_read += 1;
12138                next_offset += envelope_size;
12139            }
12140
12141            let next_out_of_line = decoder.next_out_of_line();
12142            let handles_before = decoder.remaining_handles();
12143            if let Some((inlined, num_bytes, num_handles)) =
12144                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12145            {
12146                let member_inline_size =
12147                    <BufferCollectionExportToken as fidl::encoding::TypeMarker>::inline_size(
12148                        decoder.context,
12149                    );
12150                if inlined != (member_inline_size <= 4) {
12151                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12152                }
12153                let inner_offset;
12154                let mut inner_depth = depth.clone();
12155                if inlined {
12156                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12157                    inner_offset = next_offset;
12158                } else {
12159                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12160                    inner_depth.increment()?;
12161                }
12162                let val_ref = self.export_token.get_or_insert_with(|| {
12163                    fidl::new_empty!(
12164                        BufferCollectionExportToken,
12165                        fidl::encoding::DefaultFuchsiaResourceDialect
12166                    )
12167                });
12168                fidl::decode!(
12169                    BufferCollectionExportToken,
12170                    fidl::encoding::DefaultFuchsiaResourceDialect,
12171                    val_ref,
12172                    decoder,
12173                    inner_offset,
12174                    inner_depth
12175                )?;
12176                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12177                {
12178                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12179                }
12180                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12181                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12182                }
12183            }
12184
12185            next_offset += envelope_size;
12186            _next_ordinal_to_read += 1;
12187            if next_offset >= end_offset {
12188                return Ok(());
12189            }
12190
12191            // Decode unknown envelopes for gaps in ordinals.
12192            while _next_ordinal_to_read < 2 {
12193                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12194                _next_ordinal_to_read += 1;
12195                next_offset += envelope_size;
12196            }
12197
12198            let next_out_of_line = decoder.next_out_of_line();
12199            let handles_before = decoder.remaining_handles();
12200            if let Some((inlined, num_bytes, num_handles)) =
12201                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12202            {
12203                let member_inline_size = <fidl::encoding::Endpoint<
12204                    fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem::BufferCollectionTokenMarker>,
12205                > as fidl::encoding::TypeMarker>::inline_size(
12206                    decoder.context
12207                );
12208                if inlined != (member_inline_size <= 4) {
12209                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12210                }
12211                let inner_offset;
12212                let mut inner_depth = depth.clone();
12213                if inlined {
12214                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12215                    inner_offset = next_offset;
12216                } else {
12217                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12218                    inner_depth.increment()?;
12219                }
12220                let val_ref = self.buffer_collection_token.get_or_insert_with(|| {
12221                    fidl::new_empty!(
12222                        fidl::encoding::Endpoint<
12223                            fidl::endpoints::ClientEnd<
12224                                fidl_fuchsia_sysmem::BufferCollectionTokenMarker,
12225                            >,
12226                        >,
12227                        fidl::encoding::DefaultFuchsiaResourceDialect
12228                    )
12229                });
12230                fidl::decode!(
12231                    fidl::encoding::Endpoint<
12232                        fidl::endpoints::ClientEnd<
12233                            fidl_fuchsia_sysmem::BufferCollectionTokenMarker,
12234                        >,
12235                    >,
12236                    fidl::encoding::DefaultFuchsiaResourceDialect,
12237                    val_ref,
12238                    decoder,
12239                    inner_offset,
12240                    inner_depth
12241                )?;
12242                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12243                {
12244                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12245                }
12246                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12247                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12248                }
12249            }
12250
12251            next_offset += envelope_size;
12252            _next_ordinal_to_read += 1;
12253            if next_offset >= end_offset {
12254                return Ok(());
12255            }
12256
12257            // Decode unknown envelopes for gaps in ordinals.
12258            while _next_ordinal_to_read < 3 {
12259                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12260                _next_ordinal_to_read += 1;
12261                next_offset += envelope_size;
12262            }
12263
12264            let next_out_of_line = decoder.next_out_of_line();
12265            let handles_before = decoder.remaining_handles();
12266            if let Some((inlined, num_bytes, num_handles)) =
12267                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12268            {
12269                let member_inline_size =
12270                    <RegisterBufferCollectionUsage as fidl::encoding::TypeMarker>::inline_size(
12271                        decoder.context,
12272                    );
12273                if inlined != (member_inline_size <= 4) {
12274                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12275                }
12276                let inner_offset;
12277                let mut inner_depth = depth.clone();
12278                if inlined {
12279                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12280                    inner_offset = next_offset;
12281                } else {
12282                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12283                    inner_depth.increment()?;
12284                }
12285                let val_ref = self.usage.get_or_insert_with(|| {
12286                    fidl::new_empty!(
12287                        RegisterBufferCollectionUsage,
12288                        fidl::encoding::DefaultFuchsiaResourceDialect
12289                    )
12290                });
12291                fidl::decode!(
12292                    RegisterBufferCollectionUsage,
12293                    fidl::encoding::DefaultFuchsiaResourceDialect,
12294                    val_ref,
12295                    decoder,
12296                    inner_offset,
12297                    inner_depth
12298                )?;
12299                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12300                {
12301                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12302                }
12303                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12304                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12305                }
12306            }
12307
12308            next_offset += envelope_size;
12309            _next_ordinal_to_read += 1;
12310            if next_offset >= end_offset {
12311                return Ok(());
12312            }
12313
12314            // Decode unknown envelopes for gaps in ordinals.
12315            while _next_ordinal_to_read < 4 {
12316                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12317                _next_ordinal_to_read += 1;
12318                next_offset += envelope_size;
12319            }
12320
12321            let next_out_of_line = decoder.next_out_of_line();
12322            let handles_before = decoder.remaining_handles();
12323            if let Some((inlined, num_bytes, num_handles)) =
12324                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12325            {
12326                let member_inline_size =
12327                    <RegisterBufferCollectionUsages as fidl::encoding::TypeMarker>::inline_size(
12328                        decoder.context,
12329                    );
12330                if inlined != (member_inline_size <= 4) {
12331                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12332                }
12333                let inner_offset;
12334                let mut inner_depth = depth.clone();
12335                if inlined {
12336                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12337                    inner_offset = next_offset;
12338                } else {
12339                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12340                    inner_depth.increment()?;
12341                }
12342                let val_ref = self.usages.get_or_insert_with(|| {
12343                    fidl::new_empty!(
12344                        RegisterBufferCollectionUsages,
12345                        fidl::encoding::DefaultFuchsiaResourceDialect
12346                    )
12347                });
12348                fidl::decode!(
12349                    RegisterBufferCollectionUsages,
12350                    fidl::encoding::DefaultFuchsiaResourceDialect,
12351                    val_ref,
12352                    decoder,
12353                    inner_offset,
12354                    inner_depth
12355                )?;
12356                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12357                {
12358                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12359                }
12360                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12361                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12362                }
12363            }
12364
12365            next_offset += envelope_size;
12366            _next_ordinal_to_read += 1;
12367            if next_offset >= end_offset {
12368                return Ok(());
12369            }
12370
12371            // Decode unknown envelopes for gaps in ordinals.
12372            while _next_ordinal_to_read < 5 {
12373                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12374                _next_ordinal_to_read += 1;
12375                next_offset += envelope_size;
12376            }
12377
12378            let next_out_of_line = decoder.next_out_of_line();
12379            let handles_before = decoder.remaining_handles();
12380            if let Some((inlined, num_bytes, num_handles)) =
12381                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12382            {
12383                let member_inline_size = <fidl::encoding::Endpoint<
12384                    fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem2::BufferCollectionTokenMarker>,
12385                > as fidl::encoding::TypeMarker>::inline_size(
12386                    decoder.context
12387                );
12388                if inlined != (member_inline_size <= 4) {
12389                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12390                }
12391                let inner_offset;
12392                let mut inner_depth = depth.clone();
12393                if inlined {
12394                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12395                    inner_offset = next_offset;
12396                } else {
12397                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12398                    inner_depth.increment()?;
12399                }
12400                let val_ref = self.buffer_collection_token2.get_or_insert_with(|| {
12401                    fidl::new_empty!(
12402                        fidl::encoding::Endpoint<
12403                            fidl::endpoints::ClientEnd<
12404                                fidl_fuchsia_sysmem2::BufferCollectionTokenMarker,
12405                            >,
12406                        >,
12407                        fidl::encoding::DefaultFuchsiaResourceDialect
12408                    )
12409                });
12410                fidl::decode!(
12411                    fidl::encoding::Endpoint<
12412                        fidl::endpoints::ClientEnd<
12413                            fidl_fuchsia_sysmem2::BufferCollectionTokenMarker,
12414                        >,
12415                    >,
12416                    fidl::encoding::DefaultFuchsiaResourceDialect,
12417                    val_ref,
12418                    decoder,
12419                    inner_offset,
12420                    inner_depth
12421                )?;
12422                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12423                {
12424                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12425                }
12426                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12427                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12428                }
12429            }
12430
12431            next_offset += envelope_size;
12432
12433            // Decode the remaining unknown envelopes.
12434            while next_offset < end_offset {
12435                _next_ordinal_to_read += 1;
12436                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12437                next_offset += envelope_size;
12438            }
12439
12440            Ok(())
12441        }
12442    }
12443
12444    impl ScreenCaptureConfig {
12445        #[inline(always)]
12446        fn max_ordinal_present(&self) -> u64 {
12447            if let Some(_) = self.rotation {
12448                return 4;
12449            }
12450            if let Some(_) = self.buffer_count {
12451                return 3;
12452            }
12453            if let Some(_) = self.size {
12454                return 2;
12455            }
12456            if let Some(_) = self.import_token {
12457                return 1;
12458            }
12459            0
12460        }
12461    }
12462
12463    impl fidl::encoding::ResourceTypeMarker for ScreenCaptureConfig {
12464        type Borrowed<'a> = &'a mut Self;
12465        fn take_or_borrow<'a>(
12466            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12467        ) -> Self::Borrowed<'a> {
12468            value
12469        }
12470    }
12471
12472    unsafe impl fidl::encoding::TypeMarker for ScreenCaptureConfig {
12473        type Owned = Self;
12474
12475        #[inline(always)]
12476        fn inline_align(_context: fidl::encoding::Context) -> usize {
12477            8
12478        }
12479
12480        #[inline(always)]
12481        fn inline_size(_context: fidl::encoding::Context) -> usize {
12482            16
12483        }
12484    }
12485
12486    unsafe impl
12487        fidl::encoding::Encode<ScreenCaptureConfig, fidl::encoding::DefaultFuchsiaResourceDialect>
12488        for &mut ScreenCaptureConfig
12489    {
12490        unsafe fn encode(
12491            self,
12492            encoder: &mut fidl::encoding::Encoder<
12493                '_,
12494                fidl::encoding::DefaultFuchsiaResourceDialect,
12495            >,
12496            offset: usize,
12497            mut depth: fidl::encoding::Depth,
12498        ) -> fidl::Result<()> {
12499            encoder.debug_check_bounds::<ScreenCaptureConfig>(offset);
12500            // Vector header
12501            let max_ordinal: u64 = self.max_ordinal_present();
12502            encoder.write_num(max_ordinal, offset);
12503            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
12504            // Calling encoder.out_of_line_offset(0) is not allowed.
12505            if max_ordinal == 0 {
12506                return Ok(());
12507            }
12508            depth.increment()?;
12509            let envelope_size = 8;
12510            let bytes_len = max_ordinal as usize * envelope_size;
12511            #[allow(unused_variables)]
12512            let offset = encoder.out_of_line_offset(bytes_len);
12513            let mut _prev_end_offset: usize = 0;
12514            if 1 > max_ordinal {
12515                return Ok(());
12516            }
12517
12518            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12519            // are envelope_size bytes.
12520            let cur_offset: usize = (1 - 1) * envelope_size;
12521
12522            // Zero reserved fields.
12523            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12524
12525            // Safety:
12526            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12527            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12528            //   envelope_size bytes, there is always sufficient room.
12529            fidl::encoding::encode_in_envelope_optional::<BufferCollectionImportToken, fidl::encoding::DefaultFuchsiaResourceDialect>(
12530            self.import_token.as_mut().map(<BufferCollectionImportToken as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
12531            encoder, offset + cur_offset, depth
12532        )?;
12533
12534            _prev_end_offset = cur_offset + envelope_size;
12535            if 2 > max_ordinal {
12536                return Ok(());
12537            }
12538
12539            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12540            // are envelope_size bytes.
12541            let cur_offset: usize = (2 - 1) * envelope_size;
12542
12543            // Zero reserved fields.
12544            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12545
12546            // Safety:
12547            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12548            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12549            //   envelope_size bytes, there is always sufficient room.
12550            fidl::encoding::encode_in_envelope_optional::<
12551                fidl_fuchsia_math::SizeU,
12552                fidl::encoding::DefaultFuchsiaResourceDialect,
12553            >(
12554                self.size
12555                    .as_ref()
12556                    .map(<fidl_fuchsia_math::SizeU as fidl::encoding::ValueTypeMarker>::borrow),
12557                encoder,
12558                offset + cur_offset,
12559                depth,
12560            )?;
12561
12562            _prev_end_offset = cur_offset + envelope_size;
12563            if 3 > max_ordinal {
12564                return Ok(());
12565            }
12566
12567            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12568            // are envelope_size bytes.
12569            let cur_offset: usize = (3 - 1) * envelope_size;
12570
12571            // Zero reserved fields.
12572            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12573
12574            // Safety:
12575            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12576            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12577            //   envelope_size bytes, there is always sufficient room.
12578            fidl::encoding::encode_in_envelope_optional::<
12579                u32,
12580                fidl::encoding::DefaultFuchsiaResourceDialect,
12581            >(
12582                self.buffer_count.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
12583                encoder,
12584                offset + cur_offset,
12585                depth,
12586            )?;
12587
12588            _prev_end_offset = cur_offset + envelope_size;
12589            if 4 > max_ordinal {
12590                return Ok(());
12591            }
12592
12593            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12594            // are envelope_size bytes.
12595            let cur_offset: usize = (4 - 1) * envelope_size;
12596
12597            // Zero reserved fields.
12598            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12599
12600            // Safety:
12601            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12602            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12603            //   envelope_size bytes, there is always sufficient room.
12604            fidl::encoding::encode_in_envelope_optional::<
12605                Rotation,
12606                fidl::encoding::DefaultFuchsiaResourceDialect,
12607            >(
12608                self.rotation.as_ref().map(<Rotation as fidl::encoding::ValueTypeMarker>::borrow),
12609                encoder,
12610                offset + cur_offset,
12611                depth,
12612            )?;
12613
12614            _prev_end_offset = cur_offset + envelope_size;
12615
12616            Ok(())
12617        }
12618    }
12619
12620    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
12621        for ScreenCaptureConfig
12622    {
12623        #[inline(always)]
12624        fn new_empty() -> Self {
12625            Self::default()
12626        }
12627
12628        unsafe fn decode(
12629            &mut self,
12630            decoder: &mut fidl::encoding::Decoder<
12631                '_,
12632                fidl::encoding::DefaultFuchsiaResourceDialect,
12633            >,
12634            offset: usize,
12635            mut depth: fidl::encoding::Depth,
12636        ) -> fidl::Result<()> {
12637            decoder.debug_check_bounds::<Self>(offset);
12638            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
12639                None => return Err(fidl::Error::NotNullable),
12640                Some(len) => len,
12641            };
12642            // Calling decoder.out_of_line_offset(0) is not allowed.
12643            if len == 0 {
12644                return Ok(());
12645            };
12646            depth.increment()?;
12647            let envelope_size = 8;
12648            let bytes_len = len * envelope_size;
12649            let offset = decoder.out_of_line_offset(bytes_len)?;
12650            // Decode the envelope for each type.
12651            let mut _next_ordinal_to_read = 0;
12652            let mut next_offset = offset;
12653            let end_offset = offset + bytes_len;
12654            _next_ordinal_to_read += 1;
12655            if next_offset >= end_offset {
12656                return Ok(());
12657            }
12658
12659            // Decode unknown envelopes for gaps in ordinals.
12660            while _next_ordinal_to_read < 1 {
12661                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12662                _next_ordinal_to_read += 1;
12663                next_offset += envelope_size;
12664            }
12665
12666            let next_out_of_line = decoder.next_out_of_line();
12667            let handles_before = decoder.remaining_handles();
12668            if let Some((inlined, num_bytes, num_handles)) =
12669                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12670            {
12671                let member_inline_size =
12672                    <BufferCollectionImportToken as fidl::encoding::TypeMarker>::inline_size(
12673                        decoder.context,
12674                    );
12675                if inlined != (member_inline_size <= 4) {
12676                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12677                }
12678                let inner_offset;
12679                let mut inner_depth = depth.clone();
12680                if inlined {
12681                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12682                    inner_offset = next_offset;
12683                } else {
12684                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12685                    inner_depth.increment()?;
12686                }
12687                let val_ref = self.import_token.get_or_insert_with(|| {
12688                    fidl::new_empty!(
12689                        BufferCollectionImportToken,
12690                        fidl::encoding::DefaultFuchsiaResourceDialect
12691                    )
12692                });
12693                fidl::decode!(
12694                    BufferCollectionImportToken,
12695                    fidl::encoding::DefaultFuchsiaResourceDialect,
12696                    val_ref,
12697                    decoder,
12698                    inner_offset,
12699                    inner_depth
12700                )?;
12701                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12702                {
12703                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12704                }
12705                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12706                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12707                }
12708            }
12709
12710            next_offset += envelope_size;
12711            _next_ordinal_to_read += 1;
12712            if next_offset >= end_offset {
12713                return Ok(());
12714            }
12715
12716            // Decode unknown envelopes for gaps in ordinals.
12717            while _next_ordinal_to_read < 2 {
12718                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12719                _next_ordinal_to_read += 1;
12720                next_offset += envelope_size;
12721            }
12722
12723            let next_out_of_line = decoder.next_out_of_line();
12724            let handles_before = decoder.remaining_handles();
12725            if let Some((inlined, num_bytes, num_handles)) =
12726                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12727            {
12728                let member_inline_size =
12729                    <fidl_fuchsia_math::SizeU as fidl::encoding::TypeMarker>::inline_size(
12730                        decoder.context,
12731                    );
12732                if inlined != (member_inline_size <= 4) {
12733                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12734                }
12735                let inner_offset;
12736                let mut inner_depth = depth.clone();
12737                if inlined {
12738                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12739                    inner_offset = next_offset;
12740                } else {
12741                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12742                    inner_depth.increment()?;
12743                }
12744                let val_ref = self.size.get_or_insert_with(|| {
12745                    fidl::new_empty!(
12746                        fidl_fuchsia_math::SizeU,
12747                        fidl::encoding::DefaultFuchsiaResourceDialect
12748                    )
12749                });
12750                fidl::decode!(
12751                    fidl_fuchsia_math::SizeU,
12752                    fidl::encoding::DefaultFuchsiaResourceDialect,
12753                    val_ref,
12754                    decoder,
12755                    inner_offset,
12756                    inner_depth
12757                )?;
12758                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12759                {
12760                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12761                }
12762                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12763                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12764                }
12765            }
12766
12767            next_offset += envelope_size;
12768            _next_ordinal_to_read += 1;
12769            if next_offset >= end_offset {
12770                return Ok(());
12771            }
12772
12773            // Decode unknown envelopes for gaps in ordinals.
12774            while _next_ordinal_to_read < 3 {
12775                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12776                _next_ordinal_to_read += 1;
12777                next_offset += envelope_size;
12778            }
12779
12780            let next_out_of_line = decoder.next_out_of_line();
12781            let handles_before = decoder.remaining_handles();
12782            if let Some((inlined, num_bytes, num_handles)) =
12783                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12784            {
12785                let member_inline_size =
12786                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
12787                if inlined != (member_inline_size <= 4) {
12788                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12789                }
12790                let inner_offset;
12791                let mut inner_depth = depth.clone();
12792                if inlined {
12793                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12794                    inner_offset = next_offset;
12795                } else {
12796                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12797                    inner_depth.increment()?;
12798                }
12799                let val_ref = self.buffer_count.get_or_insert_with(|| {
12800                    fidl::new_empty!(u32, fidl::encoding::DefaultFuchsiaResourceDialect)
12801                });
12802                fidl::decode!(
12803                    u32,
12804                    fidl::encoding::DefaultFuchsiaResourceDialect,
12805                    val_ref,
12806                    decoder,
12807                    inner_offset,
12808                    inner_depth
12809                )?;
12810                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12811                {
12812                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12813                }
12814                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12815                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12816                }
12817            }
12818
12819            next_offset += envelope_size;
12820            _next_ordinal_to_read += 1;
12821            if next_offset >= end_offset {
12822                return Ok(());
12823            }
12824
12825            // Decode unknown envelopes for gaps in ordinals.
12826            while _next_ordinal_to_read < 4 {
12827                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12828                _next_ordinal_to_read += 1;
12829                next_offset += envelope_size;
12830            }
12831
12832            let next_out_of_line = decoder.next_out_of_line();
12833            let handles_before = decoder.remaining_handles();
12834            if let Some((inlined, num_bytes, num_handles)) =
12835                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12836            {
12837                let member_inline_size =
12838                    <Rotation as fidl::encoding::TypeMarker>::inline_size(decoder.context);
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.rotation.get_or_insert_with(|| {
12852                    fidl::new_empty!(Rotation, fidl::encoding::DefaultFuchsiaResourceDialect)
12853                });
12854                fidl::decode!(
12855                    Rotation,
12856                    fidl::encoding::DefaultFuchsiaResourceDialect,
12857                    val_ref,
12858                    decoder,
12859                    inner_offset,
12860                    inner_depth
12861                )?;
12862                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12863                {
12864                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12865                }
12866                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12867                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12868                }
12869            }
12870
12871            next_offset += envelope_size;
12872
12873            // Decode the remaining unknown envelopes.
12874            while next_offset < end_offset {
12875                _next_ordinal_to_read += 1;
12876                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12877                next_offset += envelope_size;
12878            }
12879
12880            Ok(())
12881        }
12882    }
12883
12884    impl ScreenshotTakeFileRequest {
12885        #[inline(always)]
12886        fn max_ordinal_present(&self) -> u64 {
12887            if let Some(_) = self.format {
12888                return 1;
12889            }
12890            0
12891        }
12892    }
12893
12894    impl fidl::encoding::ResourceTypeMarker for ScreenshotTakeFileRequest {
12895        type Borrowed<'a> = &'a mut Self;
12896        fn take_or_borrow<'a>(
12897            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12898        ) -> Self::Borrowed<'a> {
12899            value
12900        }
12901    }
12902
12903    unsafe impl fidl::encoding::TypeMarker for ScreenshotTakeFileRequest {
12904        type Owned = Self;
12905
12906        #[inline(always)]
12907        fn inline_align(_context: fidl::encoding::Context) -> usize {
12908            8
12909        }
12910
12911        #[inline(always)]
12912        fn inline_size(_context: fidl::encoding::Context) -> usize {
12913            16
12914        }
12915    }
12916
12917    unsafe impl
12918        fidl::encoding::Encode<
12919            ScreenshotTakeFileRequest,
12920            fidl::encoding::DefaultFuchsiaResourceDialect,
12921        > for &mut ScreenshotTakeFileRequest
12922    {
12923        unsafe fn encode(
12924            self,
12925            encoder: &mut fidl::encoding::Encoder<
12926                '_,
12927                fidl::encoding::DefaultFuchsiaResourceDialect,
12928            >,
12929            offset: usize,
12930            mut depth: fidl::encoding::Depth,
12931        ) -> fidl::Result<()> {
12932            encoder.debug_check_bounds::<ScreenshotTakeFileRequest>(offset);
12933            // Vector header
12934            let max_ordinal: u64 = self.max_ordinal_present();
12935            encoder.write_num(max_ordinal, offset);
12936            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
12937            // Calling encoder.out_of_line_offset(0) is not allowed.
12938            if max_ordinal == 0 {
12939                return Ok(());
12940            }
12941            depth.increment()?;
12942            let envelope_size = 8;
12943            let bytes_len = max_ordinal as usize * envelope_size;
12944            #[allow(unused_variables)]
12945            let offset = encoder.out_of_line_offset(bytes_len);
12946            let mut _prev_end_offset: usize = 0;
12947            if 1 > max_ordinal {
12948                return Ok(());
12949            }
12950
12951            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12952            // are envelope_size bytes.
12953            let cur_offset: usize = (1 - 1) * envelope_size;
12954
12955            // Zero reserved fields.
12956            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12957
12958            // Safety:
12959            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12960            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12961            //   envelope_size bytes, there is always sufficient room.
12962            fidl::encoding::encode_in_envelope_optional::<
12963                ScreenshotFormat,
12964                fidl::encoding::DefaultFuchsiaResourceDialect,
12965            >(
12966                self.format
12967                    .as_ref()
12968                    .map(<ScreenshotFormat as fidl::encoding::ValueTypeMarker>::borrow),
12969                encoder,
12970                offset + cur_offset,
12971                depth,
12972            )?;
12973
12974            _prev_end_offset = cur_offset + envelope_size;
12975
12976            Ok(())
12977        }
12978    }
12979
12980    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
12981        for ScreenshotTakeFileRequest
12982    {
12983        #[inline(always)]
12984        fn new_empty() -> Self {
12985            Self::default()
12986        }
12987
12988        unsafe fn decode(
12989            &mut self,
12990            decoder: &mut fidl::encoding::Decoder<
12991                '_,
12992                fidl::encoding::DefaultFuchsiaResourceDialect,
12993            >,
12994            offset: usize,
12995            mut depth: fidl::encoding::Depth,
12996        ) -> fidl::Result<()> {
12997            decoder.debug_check_bounds::<Self>(offset);
12998            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
12999                None => return Err(fidl::Error::NotNullable),
13000                Some(len) => len,
13001            };
13002            // Calling decoder.out_of_line_offset(0) is not allowed.
13003            if len == 0 {
13004                return Ok(());
13005            };
13006            depth.increment()?;
13007            let envelope_size = 8;
13008            let bytes_len = len * envelope_size;
13009            let offset = decoder.out_of_line_offset(bytes_len)?;
13010            // Decode the envelope for each type.
13011            let mut _next_ordinal_to_read = 0;
13012            let mut next_offset = offset;
13013            let end_offset = offset + bytes_len;
13014            _next_ordinal_to_read += 1;
13015            if next_offset >= end_offset {
13016                return Ok(());
13017            }
13018
13019            // Decode unknown envelopes for gaps in ordinals.
13020            while _next_ordinal_to_read < 1 {
13021                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13022                _next_ordinal_to_read += 1;
13023                next_offset += envelope_size;
13024            }
13025
13026            let next_out_of_line = decoder.next_out_of_line();
13027            let handles_before = decoder.remaining_handles();
13028            if let Some((inlined, num_bytes, num_handles)) =
13029                fidl::encoding::decode_envelope_header(decoder, next_offset)?
13030            {
13031                let member_inline_size =
13032                    <ScreenshotFormat as fidl::encoding::TypeMarker>::inline_size(decoder.context);
13033                if inlined != (member_inline_size <= 4) {
13034                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
13035                }
13036                let inner_offset;
13037                let mut inner_depth = depth.clone();
13038                if inlined {
13039                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
13040                    inner_offset = next_offset;
13041                } else {
13042                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
13043                    inner_depth.increment()?;
13044                }
13045                let val_ref = self.format.get_or_insert_with(|| {
13046                    fidl::new_empty!(
13047                        ScreenshotFormat,
13048                        fidl::encoding::DefaultFuchsiaResourceDialect
13049                    )
13050                });
13051                fidl::decode!(
13052                    ScreenshotFormat,
13053                    fidl::encoding::DefaultFuchsiaResourceDialect,
13054                    val_ref,
13055                    decoder,
13056                    inner_offset,
13057                    inner_depth
13058                )?;
13059                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
13060                {
13061                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
13062                }
13063                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
13064                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
13065                }
13066            }
13067
13068            next_offset += envelope_size;
13069
13070            // Decode the remaining unknown envelopes.
13071            while next_offset < end_offset {
13072                _next_ordinal_to_read += 1;
13073                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13074                next_offset += envelope_size;
13075            }
13076
13077            Ok(())
13078        }
13079    }
13080
13081    impl ScreenshotTakeFileResponse {
13082        #[inline(always)]
13083        fn max_ordinal_present(&self) -> u64 {
13084            if let Some(_) = self.size {
13085                return 2;
13086            }
13087            if let Some(_) = self.file {
13088                return 1;
13089            }
13090            0
13091        }
13092    }
13093
13094    impl fidl::encoding::ResourceTypeMarker for ScreenshotTakeFileResponse {
13095        type Borrowed<'a> = &'a mut Self;
13096        fn take_or_borrow<'a>(
13097            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
13098        ) -> Self::Borrowed<'a> {
13099            value
13100        }
13101    }
13102
13103    unsafe impl fidl::encoding::TypeMarker for ScreenshotTakeFileResponse {
13104        type Owned = Self;
13105
13106        #[inline(always)]
13107        fn inline_align(_context: fidl::encoding::Context) -> usize {
13108            8
13109        }
13110
13111        #[inline(always)]
13112        fn inline_size(_context: fidl::encoding::Context) -> usize {
13113            16
13114        }
13115    }
13116
13117    unsafe impl
13118        fidl::encoding::Encode<
13119            ScreenshotTakeFileResponse,
13120            fidl::encoding::DefaultFuchsiaResourceDialect,
13121        > for &mut ScreenshotTakeFileResponse
13122    {
13123        unsafe fn encode(
13124            self,
13125            encoder: &mut fidl::encoding::Encoder<
13126                '_,
13127                fidl::encoding::DefaultFuchsiaResourceDialect,
13128            >,
13129            offset: usize,
13130            mut depth: fidl::encoding::Depth,
13131        ) -> fidl::Result<()> {
13132            encoder.debug_check_bounds::<ScreenshotTakeFileResponse>(offset);
13133            // Vector header
13134            let max_ordinal: u64 = self.max_ordinal_present();
13135            encoder.write_num(max_ordinal, offset);
13136            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
13137            // Calling encoder.out_of_line_offset(0) is not allowed.
13138            if max_ordinal == 0 {
13139                return Ok(());
13140            }
13141            depth.increment()?;
13142            let envelope_size = 8;
13143            let bytes_len = max_ordinal as usize * envelope_size;
13144            #[allow(unused_variables)]
13145            let offset = encoder.out_of_line_offset(bytes_len);
13146            let mut _prev_end_offset: usize = 0;
13147            if 1 > max_ordinal {
13148                return Ok(());
13149            }
13150
13151            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
13152            // are envelope_size bytes.
13153            let cur_offset: usize = (1 - 1) * envelope_size;
13154
13155            // Zero reserved fields.
13156            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
13157
13158            // Safety:
13159            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
13160            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
13161            //   envelope_size bytes, there is always sufficient room.
13162            fidl::encoding::encode_in_envelope_optional::<
13163                fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>>,
13164                fidl::encoding::DefaultFuchsiaResourceDialect,
13165            >(
13166                self.file.as_mut().map(
13167                    <fidl::encoding::Endpoint<
13168                        fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
13169                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
13170                ),
13171                encoder,
13172                offset + cur_offset,
13173                depth,
13174            )?;
13175
13176            _prev_end_offset = cur_offset + envelope_size;
13177            if 2 > max_ordinal {
13178                return Ok(());
13179            }
13180
13181            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
13182            // are envelope_size bytes.
13183            let cur_offset: usize = (2 - 1) * envelope_size;
13184
13185            // Zero reserved fields.
13186            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
13187
13188            // Safety:
13189            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
13190            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
13191            //   envelope_size bytes, there is always sufficient room.
13192            fidl::encoding::encode_in_envelope_optional::<
13193                fidl_fuchsia_math::SizeU,
13194                fidl::encoding::DefaultFuchsiaResourceDialect,
13195            >(
13196                self.size
13197                    .as_ref()
13198                    .map(<fidl_fuchsia_math::SizeU as fidl::encoding::ValueTypeMarker>::borrow),
13199                encoder,
13200                offset + cur_offset,
13201                depth,
13202            )?;
13203
13204            _prev_end_offset = cur_offset + envelope_size;
13205
13206            Ok(())
13207        }
13208    }
13209
13210    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
13211        for ScreenshotTakeFileResponse
13212    {
13213        #[inline(always)]
13214        fn new_empty() -> Self {
13215            Self::default()
13216        }
13217
13218        unsafe fn decode(
13219            &mut self,
13220            decoder: &mut fidl::encoding::Decoder<
13221                '_,
13222                fidl::encoding::DefaultFuchsiaResourceDialect,
13223            >,
13224            offset: usize,
13225            mut depth: fidl::encoding::Depth,
13226        ) -> fidl::Result<()> {
13227            decoder.debug_check_bounds::<Self>(offset);
13228            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
13229                None => return Err(fidl::Error::NotNullable),
13230                Some(len) => len,
13231            };
13232            // Calling decoder.out_of_line_offset(0) is not allowed.
13233            if len == 0 {
13234                return Ok(());
13235            };
13236            depth.increment()?;
13237            let envelope_size = 8;
13238            let bytes_len = len * envelope_size;
13239            let offset = decoder.out_of_line_offset(bytes_len)?;
13240            // Decode the envelope for each type.
13241            let mut _next_ordinal_to_read = 0;
13242            let mut next_offset = offset;
13243            let end_offset = offset + bytes_len;
13244            _next_ordinal_to_read += 1;
13245            if next_offset >= end_offset {
13246                return Ok(());
13247            }
13248
13249            // Decode unknown envelopes for gaps in ordinals.
13250            while _next_ordinal_to_read < 1 {
13251                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13252                _next_ordinal_to_read += 1;
13253                next_offset += envelope_size;
13254            }
13255
13256            let next_out_of_line = decoder.next_out_of_line();
13257            let handles_before = decoder.remaining_handles();
13258            if let Some((inlined, num_bytes, num_handles)) =
13259                fidl::encoding::decode_envelope_header(decoder, next_offset)?
13260            {
13261                let member_inline_size = <fidl::encoding::Endpoint<
13262                    fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
13263                > as fidl::encoding::TypeMarker>::inline_size(
13264                    decoder.context
13265                );
13266                if inlined != (member_inline_size <= 4) {
13267                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
13268                }
13269                let inner_offset;
13270                let mut inner_depth = depth.clone();
13271                if inlined {
13272                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
13273                    inner_offset = next_offset;
13274                } else {
13275                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
13276                    inner_depth.increment()?;
13277                }
13278                let val_ref = self.file.get_or_insert_with(|| {
13279                    fidl::new_empty!(
13280                        fidl::encoding::Endpoint<
13281                            fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
13282                        >,
13283                        fidl::encoding::DefaultFuchsiaResourceDialect
13284                    )
13285                });
13286                fidl::decode!(
13287                    fidl::encoding::Endpoint<
13288                        fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
13289                    >,
13290                    fidl::encoding::DefaultFuchsiaResourceDialect,
13291                    val_ref,
13292                    decoder,
13293                    inner_offset,
13294                    inner_depth
13295                )?;
13296                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
13297                {
13298                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
13299                }
13300                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
13301                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
13302                }
13303            }
13304
13305            next_offset += envelope_size;
13306            _next_ordinal_to_read += 1;
13307            if next_offset >= end_offset {
13308                return Ok(());
13309            }
13310
13311            // Decode unknown envelopes for gaps in ordinals.
13312            while _next_ordinal_to_read < 2 {
13313                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13314                _next_ordinal_to_read += 1;
13315                next_offset += envelope_size;
13316            }
13317
13318            let next_out_of_line = decoder.next_out_of_line();
13319            let handles_before = decoder.remaining_handles();
13320            if let Some((inlined, num_bytes, num_handles)) =
13321                fidl::encoding::decode_envelope_header(decoder, next_offset)?
13322            {
13323                let member_inline_size =
13324                    <fidl_fuchsia_math::SizeU as fidl::encoding::TypeMarker>::inline_size(
13325                        decoder.context,
13326                    );
13327                if inlined != (member_inline_size <= 4) {
13328                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
13329                }
13330                let inner_offset;
13331                let mut inner_depth = depth.clone();
13332                if inlined {
13333                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
13334                    inner_offset = next_offset;
13335                } else {
13336                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
13337                    inner_depth.increment()?;
13338                }
13339                let val_ref = self.size.get_or_insert_with(|| {
13340                    fidl::new_empty!(
13341                        fidl_fuchsia_math::SizeU,
13342                        fidl::encoding::DefaultFuchsiaResourceDialect
13343                    )
13344                });
13345                fidl::decode!(
13346                    fidl_fuchsia_math::SizeU,
13347                    fidl::encoding::DefaultFuchsiaResourceDialect,
13348                    val_ref,
13349                    decoder,
13350                    inner_offset,
13351                    inner_depth
13352                )?;
13353                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
13354                {
13355                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
13356                }
13357                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
13358                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
13359                }
13360            }
13361
13362            next_offset += envelope_size;
13363
13364            // Decode the remaining unknown envelopes.
13365            while next_offset < end_offset {
13366                _next_ordinal_to_read += 1;
13367                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13368                next_offset += envelope_size;
13369            }
13370
13371            Ok(())
13372        }
13373    }
13374
13375    impl ScreenshotTakeRequest {
13376        #[inline(always)]
13377        fn max_ordinal_present(&self) -> u64 {
13378            if let Some(_) = self.format {
13379                return 1;
13380            }
13381            0
13382        }
13383    }
13384
13385    impl fidl::encoding::ResourceTypeMarker for ScreenshotTakeRequest {
13386        type Borrowed<'a> = &'a mut Self;
13387        fn take_or_borrow<'a>(
13388            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
13389        ) -> Self::Borrowed<'a> {
13390            value
13391        }
13392    }
13393
13394    unsafe impl fidl::encoding::TypeMarker for ScreenshotTakeRequest {
13395        type Owned = Self;
13396
13397        #[inline(always)]
13398        fn inline_align(_context: fidl::encoding::Context) -> usize {
13399            8
13400        }
13401
13402        #[inline(always)]
13403        fn inline_size(_context: fidl::encoding::Context) -> usize {
13404            16
13405        }
13406    }
13407
13408    unsafe impl
13409        fidl::encoding::Encode<ScreenshotTakeRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
13410        for &mut ScreenshotTakeRequest
13411    {
13412        unsafe fn encode(
13413            self,
13414            encoder: &mut fidl::encoding::Encoder<
13415                '_,
13416                fidl::encoding::DefaultFuchsiaResourceDialect,
13417            >,
13418            offset: usize,
13419            mut depth: fidl::encoding::Depth,
13420        ) -> fidl::Result<()> {
13421            encoder.debug_check_bounds::<ScreenshotTakeRequest>(offset);
13422            // Vector header
13423            let max_ordinal: u64 = self.max_ordinal_present();
13424            encoder.write_num(max_ordinal, offset);
13425            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
13426            // Calling encoder.out_of_line_offset(0) is not allowed.
13427            if max_ordinal == 0 {
13428                return Ok(());
13429            }
13430            depth.increment()?;
13431            let envelope_size = 8;
13432            let bytes_len = max_ordinal as usize * envelope_size;
13433            #[allow(unused_variables)]
13434            let offset = encoder.out_of_line_offset(bytes_len);
13435            let mut _prev_end_offset: usize = 0;
13436            if 1 > max_ordinal {
13437                return Ok(());
13438            }
13439
13440            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
13441            // are envelope_size bytes.
13442            let cur_offset: usize = (1 - 1) * envelope_size;
13443
13444            // Zero reserved fields.
13445            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
13446
13447            // Safety:
13448            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
13449            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
13450            //   envelope_size bytes, there is always sufficient room.
13451            fidl::encoding::encode_in_envelope_optional::<
13452                ScreenshotFormat,
13453                fidl::encoding::DefaultFuchsiaResourceDialect,
13454            >(
13455                self.format
13456                    .as_ref()
13457                    .map(<ScreenshotFormat as fidl::encoding::ValueTypeMarker>::borrow),
13458                encoder,
13459                offset + cur_offset,
13460                depth,
13461            )?;
13462
13463            _prev_end_offset = cur_offset + envelope_size;
13464
13465            Ok(())
13466        }
13467    }
13468
13469    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
13470        for ScreenshotTakeRequest
13471    {
13472        #[inline(always)]
13473        fn new_empty() -> Self {
13474            Self::default()
13475        }
13476
13477        unsafe fn decode(
13478            &mut self,
13479            decoder: &mut fidl::encoding::Decoder<
13480                '_,
13481                fidl::encoding::DefaultFuchsiaResourceDialect,
13482            >,
13483            offset: usize,
13484            mut depth: fidl::encoding::Depth,
13485        ) -> fidl::Result<()> {
13486            decoder.debug_check_bounds::<Self>(offset);
13487            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
13488                None => return Err(fidl::Error::NotNullable),
13489                Some(len) => len,
13490            };
13491            // Calling decoder.out_of_line_offset(0) is not allowed.
13492            if len == 0 {
13493                return Ok(());
13494            };
13495            depth.increment()?;
13496            let envelope_size = 8;
13497            let bytes_len = len * envelope_size;
13498            let offset = decoder.out_of_line_offset(bytes_len)?;
13499            // Decode the envelope for each type.
13500            let mut _next_ordinal_to_read = 0;
13501            let mut next_offset = offset;
13502            let end_offset = offset + bytes_len;
13503            _next_ordinal_to_read += 1;
13504            if next_offset >= end_offset {
13505                return Ok(());
13506            }
13507
13508            // Decode unknown envelopes for gaps in ordinals.
13509            while _next_ordinal_to_read < 1 {
13510                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13511                _next_ordinal_to_read += 1;
13512                next_offset += envelope_size;
13513            }
13514
13515            let next_out_of_line = decoder.next_out_of_line();
13516            let handles_before = decoder.remaining_handles();
13517            if let Some((inlined, num_bytes, num_handles)) =
13518                fidl::encoding::decode_envelope_header(decoder, next_offset)?
13519            {
13520                let member_inline_size =
13521                    <ScreenshotFormat as fidl::encoding::TypeMarker>::inline_size(decoder.context);
13522                if inlined != (member_inline_size <= 4) {
13523                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
13524                }
13525                let inner_offset;
13526                let mut inner_depth = depth.clone();
13527                if inlined {
13528                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
13529                    inner_offset = next_offset;
13530                } else {
13531                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
13532                    inner_depth.increment()?;
13533                }
13534                let val_ref = self.format.get_or_insert_with(|| {
13535                    fidl::new_empty!(
13536                        ScreenshotFormat,
13537                        fidl::encoding::DefaultFuchsiaResourceDialect
13538                    )
13539                });
13540                fidl::decode!(
13541                    ScreenshotFormat,
13542                    fidl::encoding::DefaultFuchsiaResourceDialect,
13543                    val_ref,
13544                    decoder,
13545                    inner_offset,
13546                    inner_depth
13547                )?;
13548                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
13549                {
13550                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
13551                }
13552                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
13553                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
13554                }
13555            }
13556
13557            next_offset += envelope_size;
13558
13559            // Decode the remaining unknown envelopes.
13560            while next_offset < end_offset {
13561                _next_ordinal_to_read += 1;
13562                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13563                next_offset += envelope_size;
13564            }
13565
13566            Ok(())
13567        }
13568    }
13569
13570    impl ScreenshotTakeResponse {
13571        #[inline(always)]
13572        fn max_ordinal_present(&self) -> u64 {
13573            if let Some(_) = self.size {
13574                return 2;
13575            }
13576            if let Some(_) = self.vmo {
13577                return 1;
13578            }
13579            0
13580        }
13581    }
13582
13583    impl fidl::encoding::ResourceTypeMarker for ScreenshotTakeResponse {
13584        type Borrowed<'a> = &'a mut Self;
13585        fn take_or_borrow<'a>(
13586            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
13587        ) -> Self::Borrowed<'a> {
13588            value
13589        }
13590    }
13591
13592    unsafe impl fidl::encoding::TypeMarker for ScreenshotTakeResponse {
13593        type Owned = Self;
13594
13595        #[inline(always)]
13596        fn inline_align(_context: fidl::encoding::Context) -> usize {
13597            8
13598        }
13599
13600        #[inline(always)]
13601        fn inline_size(_context: fidl::encoding::Context) -> usize {
13602            16
13603        }
13604    }
13605
13606    unsafe impl
13607        fidl::encoding::Encode<
13608            ScreenshotTakeResponse,
13609            fidl::encoding::DefaultFuchsiaResourceDialect,
13610        > for &mut ScreenshotTakeResponse
13611    {
13612        unsafe fn encode(
13613            self,
13614            encoder: &mut fidl::encoding::Encoder<
13615                '_,
13616                fidl::encoding::DefaultFuchsiaResourceDialect,
13617            >,
13618            offset: usize,
13619            mut depth: fidl::encoding::Depth,
13620        ) -> fidl::Result<()> {
13621            encoder.debug_check_bounds::<ScreenshotTakeResponse>(offset);
13622            // Vector header
13623            let max_ordinal: u64 = self.max_ordinal_present();
13624            encoder.write_num(max_ordinal, offset);
13625            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
13626            // Calling encoder.out_of_line_offset(0) is not allowed.
13627            if max_ordinal == 0 {
13628                return Ok(());
13629            }
13630            depth.increment()?;
13631            let envelope_size = 8;
13632            let bytes_len = max_ordinal as usize * envelope_size;
13633            #[allow(unused_variables)]
13634            let offset = encoder.out_of_line_offset(bytes_len);
13635            let mut _prev_end_offset: usize = 0;
13636            if 1 > max_ordinal {
13637                return Ok(());
13638            }
13639
13640            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
13641            // are envelope_size bytes.
13642            let cur_offset: usize = (1 - 1) * envelope_size;
13643
13644            // Zero reserved fields.
13645            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
13646
13647            // Safety:
13648            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
13649            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
13650            //   envelope_size bytes, there is always sufficient room.
13651            fidl::encoding::encode_in_envelope_optional::<
13652                fidl::encoding::HandleType<
13653                    fidl::Vmo,
13654                    { fidl::ObjectType::VMO.into_raw() },
13655                    2147483648,
13656                >,
13657                fidl::encoding::DefaultFuchsiaResourceDialect,
13658            >(
13659                self.vmo.as_mut().map(
13660                    <fidl::encoding::HandleType<
13661                        fidl::Vmo,
13662                        { fidl::ObjectType::VMO.into_raw() },
13663                        2147483648,
13664                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
13665                ),
13666                encoder,
13667                offset + cur_offset,
13668                depth,
13669            )?;
13670
13671            _prev_end_offset = cur_offset + envelope_size;
13672            if 2 > max_ordinal {
13673                return Ok(());
13674            }
13675
13676            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
13677            // are envelope_size bytes.
13678            let cur_offset: usize = (2 - 1) * envelope_size;
13679
13680            // Zero reserved fields.
13681            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
13682
13683            // Safety:
13684            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
13685            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
13686            //   envelope_size bytes, there is always sufficient room.
13687            fidl::encoding::encode_in_envelope_optional::<
13688                fidl_fuchsia_math::SizeU,
13689                fidl::encoding::DefaultFuchsiaResourceDialect,
13690            >(
13691                self.size
13692                    .as_ref()
13693                    .map(<fidl_fuchsia_math::SizeU as fidl::encoding::ValueTypeMarker>::borrow),
13694                encoder,
13695                offset + cur_offset,
13696                depth,
13697            )?;
13698
13699            _prev_end_offset = cur_offset + envelope_size;
13700
13701            Ok(())
13702        }
13703    }
13704
13705    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
13706        for ScreenshotTakeResponse
13707    {
13708        #[inline(always)]
13709        fn new_empty() -> Self {
13710            Self::default()
13711        }
13712
13713        unsafe fn decode(
13714            &mut self,
13715            decoder: &mut fidl::encoding::Decoder<
13716                '_,
13717                fidl::encoding::DefaultFuchsiaResourceDialect,
13718            >,
13719            offset: usize,
13720            mut depth: fidl::encoding::Depth,
13721        ) -> fidl::Result<()> {
13722            decoder.debug_check_bounds::<Self>(offset);
13723            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
13724                None => return Err(fidl::Error::NotNullable),
13725                Some(len) => len,
13726            };
13727            // Calling decoder.out_of_line_offset(0) is not allowed.
13728            if len == 0 {
13729                return Ok(());
13730            };
13731            depth.increment()?;
13732            let envelope_size = 8;
13733            let bytes_len = len * envelope_size;
13734            let offset = decoder.out_of_line_offset(bytes_len)?;
13735            // Decode the envelope for each type.
13736            let mut _next_ordinal_to_read = 0;
13737            let mut next_offset = offset;
13738            let end_offset = offset + bytes_len;
13739            _next_ordinal_to_read += 1;
13740            if next_offset >= end_offset {
13741                return Ok(());
13742            }
13743
13744            // Decode unknown envelopes for gaps in ordinals.
13745            while _next_ordinal_to_read < 1 {
13746                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13747                _next_ordinal_to_read += 1;
13748                next_offset += envelope_size;
13749            }
13750
13751            let next_out_of_line = decoder.next_out_of_line();
13752            let handles_before = decoder.remaining_handles();
13753            if let Some((inlined, num_bytes, num_handles)) =
13754                fidl::encoding::decode_envelope_header(decoder, next_offset)?
13755            {
13756                let member_inline_size = <fidl::encoding::HandleType<
13757                    fidl::Vmo,
13758                    { fidl::ObjectType::VMO.into_raw() },
13759                    2147483648,
13760                > as fidl::encoding::TypeMarker>::inline_size(
13761                    decoder.context
13762                );
13763                if inlined != (member_inline_size <= 4) {
13764                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
13765                }
13766                let inner_offset;
13767                let mut inner_depth = depth.clone();
13768                if inlined {
13769                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
13770                    inner_offset = next_offset;
13771                } else {
13772                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
13773                    inner_depth.increment()?;
13774                }
13775                let val_ref =
13776                self.vmo.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
13777                fidl::decode!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
13778                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
13779                {
13780                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
13781                }
13782                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
13783                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
13784                }
13785            }
13786
13787            next_offset += envelope_size;
13788            _next_ordinal_to_read += 1;
13789            if next_offset >= end_offset {
13790                return Ok(());
13791            }
13792
13793            // Decode unknown envelopes for gaps in ordinals.
13794            while _next_ordinal_to_read < 2 {
13795                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13796                _next_ordinal_to_read += 1;
13797                next_offset += envelope_size;
13798            }
13799
13800            let next_out_of_line = decoder.next_out_of_line();
13801            let handles_before = decoder.remaining_handles();
13802            if let Some((inlined, num_bytes, num_handles)) =
13803                fidl::encoding::decode_envelope_header(decoder, next_offset)?
13804            {
13805                let member_inline_size =
13806                    <fidl_fuchsia_math::SizeU as fidl::encoding::TypeMarker>::inline_size(
13807                        decoder.context,
13808                    );
13809                if inlined != (member_inline_size <= 4) {
13810                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
13811                }
13812                let inner_offset;
13813                let mut inner_depth = depth.clone();
13814                if inlined {
13815                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
13816                    inner_offset = next_offset;
13817                } else {
13818                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
13819                    inner_depth.increment()?;
13820                }
13821                let val_ref = self.size.get_or_insert_with(|| {
13822                    fidl::new_empty!(
13823                        fidl_fuchsia_math::SizeU,
13824                        fidl::encoding::DefaultFuchsiaResourceDialect
13825                    )
13826                });
13827                fidl::decode!(
13828                    fidl_fuchsia_math::SizeU,
13829                    fidl::encoding::DefaultFuchsiaResourceDialect,
13830                    val_ref,
13831                    decoder,
13832                    inner_offset,
13833                    inner_depth
13834                )?;
13835                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
13836                {
13837                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
13838                }
13839                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
13840                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
13841                }
13842            }
13843
13844            next_offset += envelope_size;
13845
13846            // Decode the remaining unknown envelopes.
13847            while next_offset < end_offset {
13848                _next_ordinal_to_read += 1;
13849                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13850                next_offset += envelope_size;
13851            }
13852
13853            Ok(())
13854        }
13855    }
13856
13857    impl TrustedFlatlandConfig {
13858        #[inline(always)]
13859        fn max_ordinal_present(&self) -> u64 {
13860            if let Some(_) = self.skips_present_credits {
13861                return 3;
13862            }
13863            if let Some(_) = self.pass_acquire_fences {
13864                return 2;
13865            }
13866            if let Some(_) = self.schedule_asap {
13867                return 1;
13868            }
13869            0
13870        }
13871    }
13872
13873    impl fidl::encoding::ResourceTypeMarker for TrustedFlatlandConfig {
13874        type Borrowed<'a> = &'a mut Self;
13875        fn take_or_borrow<'a>(
13876            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
13877        ) -> Self::Borrowed<'a> {
13878            value
13879        }
13880    }
13881
13882    unsafe impl fidl::encoding::TypeMarker for TrustedFlatlandConfig {
13883        type Owned = Self;
13884
13885        #[inline(always)]
13886        fn inline_align(_context: fidl::encoding::Context) -> usize {
13887            8
13888        }
13889
13890        #[inline(always)]
13891        fn inline_size(_context: fidl::encoding::Context) -> usize {
13892            16
13893        }
13894    }
13895
13896    unsafe impl
13897        fidl::encoding::Encode<TrustedFlatlandConfig, fidl::encoding::DefaultFuchsiaResourceDialect>
13898        for &mut TrustedFlatlandConfig
13899    {
13900        unsafe fn encode(
13901            self,
13902            encoder: &mut fidl::encoding::Encoder<
13903                '_,
13904                fidl::encoding::DefaultFuchsiaResourceDialect,
13905            >,
13906            offset: usize,
13907            mut depth: fidl::encoding::Depth,
13908        ) -> fidl::Result<()> {
13909            encoder.debug_check_bounds::<TrustedFlatlandConfig>(offset);
13910            // Vector header
13911            let max_ordinal: u64 = self.max_ordinal_present();
13912            encoder.write_num(max_ordinal, offset);
13913            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
13914            // Calling encoder.out_of_line_offset(0) is not allowed.
13915            if max_ordinal == 0 {
13916                return Ok(());
13917            }
13918            depth.increment()?;
13919            let envelope_size = 8;
13920            let bytes_len = max_ordinal as usize * envelope_size;
13921            #[allow(unused_variables)]
13922            let offset = encoder.out_of_line_offset(bytes_len);
13923            let mut _prev_end_offset: usize = 0;
13924            if 1 > max_ordinal {
13925                return Ok(());
13926            }
13927
13928            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
13929            // are envelope_size bytes.
13930            let cur_offset: usize = (1 - 1) * envelope_size;
13931
13932            // Zero reserved fields.
13933            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
13934
13935            // Safety:
13936            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
13937            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
13938            //   envelope_size bytes, there is always sufficient room.
13939            fidl::encoding::encode_in_envelope_optional::<
13940                bool,
13941                fidl::encoding::DefaultFuchsiaResourceDialect,
13942            >(
13943                self.schedule_asap.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
13944                encoder,
13945                offset + cur_offset,
13946                depth,
13947            )?;
13948
13949            _prev_end_offset = cur_offset + envelope_size;
13950            if 2 > max_ordinal {
13951                return Ok(());
13952            }
13953
13954            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
13955            // are envelope_size bytes.
13956            let cur_offset: usize = (2 - 1) * envelope_size;
13957
13958            // Zero reserved fields.
13959            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
13960
13961            // Safety:
13962            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
13963            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
13964            //   envelope_size bytes, there is always sufficient room.
13965            fidl::encoding::encode_in_envelope_optional::<
13966                bool,
13967                fidl::encoding::DefaultFuchsiaResourceDialect,
13968            >(
13969                self.pass_acquire_fences
13970                    .as_ref()
13971                    .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
13972                encoder,
13973                offset + cur_offset,
13974                depth,
13975            )?;
13976
13977            _prev_end_offset = cur_offset + envelope_size;
13978            if 3 > max_ordinal {
13979                return Ok(());
13980            }
13981
13982            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
13983            // are envelope_size bytes.
13984            let cur_offset: usize = (3 - 1) * envelope_size;
13985
13986            // Zero reserved fields.
13987            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
13988
13989            // Safety:
13990            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
13991            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
13992            //   envelope_size bytes, there is always sufficient room.
13993            fidl::encoding::encode_in_envelope_optional::<
13994                bool,
13995                fidl::encoding::DefaultFuchsiaResourceDialect,
13996            >(
13997                self.skips_present_credits
13998                    .as_ref()
13999                    .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
14000                encoder,
14001                offset + cur_offset,
14002                depth,
14003            )?;
14004
14005            _prev_end_offset = cur_offset + envelope_size;
14006
14007            Ok(())
14008        }
14009    }
14010
14011    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
14012        for TrustedFlatlandConfig
14013    {
14014        #[inline(always)]
14015        fn new_empty() -> Self {
14016            Self::default()
14017        }
14018
14019        unsafe fn decode(
14020            &mut self,
14021            decoder: &mut fidl::encoding::Decoder<
14022                '_,
14023                fidl::encoding::DefaultFuchsiaResourceDialect,
14024            >,
14025            offset: usize,
14026            mut depth: fidl::encoding::Depth,
14027        ) -> fidl::Result<()> {
14028            decoder.debug_check_bounds::<Self>(offset);
14029            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
14030                None => return Err(fidl::Error::NotNullable),
14031                Some(len) => len,
14032            };
14033            // Calling decoder.out_of_line_offset(0) is not allowed.
14034            if len == 0 {
14035                return Ok(());
14036            };
14037            depth.increment()?;
14038            let envelope_size = 8;
14039            let bytes_len = len * envelope_size;
14040            let offset = decoder.out_of_line_offset(bytes_len)?;
14041            // Decode the envelope for each type.
14042            let mut _next_ordinal_to_read = 0;
14043            let mut next_offset = offset;
14044            let end_offset = offset + bytes_len;
14045            _next_ordinal_to_read += 1;
14046            if next_offset >= end_offset {
14047                return Ok(());
14048            }
14049
14050            // Decode unknown envelopes for gaps in ordinals.
14051            while _next_ordinal_to_read < 1 {
14052                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
14053                _next_ordinal_to_read += 1;
14054                next_offset += envelope_size;
14055            }
14056
14057            let next_out_of_line = decoder.next_out_of_line();
14058            let handles_before = decoder.remaining_handles();
14059            if let Some((inlined, num_bytes, num_handles)) =
14060                fidl::encoding::decode_envelope_header(decoder, next_offset)?
14061            {
14062                let member_inline_size =
14063                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
14064                if inlined != (member_inline_size <= 4) {
14065                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
14066                }
14067                let inner_offset;
14068                let mut inner_depth = depth.clone();
14069                if inlined {
14070                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
14071                    inner_offset = next_offset;
14072                } else {
14073                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
14074                    inner_depth.increment()?;
14075                }
14076                let val_ref = self.schedule_asap.get_or_insert_with(|| {
14077                    fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
14078                });
14079                fidl::decode!(
14080                    bool,
14081                    fidl::encoding::DefaultFuchsiaResourceDialect,
14082                    val_ref,
14083                    decoder,
14084                    inner_offset,
14085                    inner_depth
14086                )?;
14087                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
14088                {
14089                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
14090                }
14091                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
14092                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
14093                }
14094            }
14095
14096            next_offset += envelope_size;
14097            _next_ordinal_to_read += 1;
14098            if next_offset >= end_offset {
14099                return Ok(());
14100            }
14101
14102            // Decode unknown envelopes for gaps in ordinals.
14103            while _next_ordinal_to_read < 2 {
14104                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
14105                _next_ordinal_to_read += 1;
14106                next_offset += envelope_size;
14107            }
14108
14109            let next_out_of_line = decoder.next_out_of_line();
14110            let handles_before = decoder.remaining_handles();
14111            if let Some((inlined, num_bytes, num_handles)) =
14112                fidl::encoding::decode_envelope_header(decoder, next_offset)?
14113            {
14114                let member_inline_size =
14115                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
14116                if inlined != (member_inline_size <= 4) {
14117                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
14118                }
14119                let inner_offset;
14120                let mut inner_depth = depth.clone();
14121                if inlined {
14122                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
14123                    inner_offset = next_offset;
14124                } else {
14125                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
14126                    inner_depth.increment()?;
14127                }
14128                let val_ref = self.pass_acquire_fences.get_or_insert_with(|| {
14129                    fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
14130                });
14131                fidl::decode!(
14132                    bool,
14133                    fidl::encoding::DefaultFuchsiaResourceDialect,
14134                    val_ref,
14135                    decoder,
14136                    inner_offset,
14137                    inner_depth
14138                )?;
14139                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
14140                {
14141                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
14142                }
14143                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
14144                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
14145                }
14146            }
14147
14148            next_offset += envelope_size;
14149            _next_ordinal_to_read += 1;
14150            if next_offset >= end_offset {
14151                return Ok(());
14152            }
14153
14154            // Decode unknown envelopes for gaps in ordinals.
14155            while _next_ordinal_to_read < 3 {
14156                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
14157                _next_ordinal_to_read += 1;
14158                next_offset += envelope_size;
14159            }
14160
14161            let next_out_of_line = decoder.next_out_of_line();
14162            let handles_before = decoder.remaining_handles();
14163            if let Some((inlined, num_bytes, num_handles)) =
14164                fidl::encoding::decode_envelope_header(decoder, next_offset)?
14165            {
14166                let member_inline_size =
14167                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
14168                if inlined != (member_inline_size <= 4) {
14169                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
14170                }
14171                let inner_offset;
14172                let mut inner_depth = depth.clone();
14173                if inlined {
14174                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
14175                    inner_offset = next_offset;
14176                } else {
14177                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
14178                    inner_depth.increment()?;
14179                }
14180                let val_ref = self.skips_present_credits.get_or_insert_with(|| {
14181                    fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
14182                });
14183                fidl::decode!(
14184                    bool,
14185                    fidl::encoding::DefaultFuchsiaResourceDialect,
14186                    val_ref,
14187                    decoder,
14188                    inner_offset,
14189                    inner_depth
14190                )?;
14191                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
14192                {
14193                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
14194                }
14195                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
14196                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
14197                }
14198            }
14199
14200            next_offset += envelope_size;
14201
14202            // Decode the remaining unknown envelopes.
14203            while next_offset < end_offset {
14204                _next_ordinal_to_read += 1;
14205                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
14206                next_offset += envelope_size;
14207            }
14208
14209            Ok(())
14210        }
14211    }
14212
14213    impl ViewBoundProtocols {
14214        #[inline(always)]
14215        fn max_ordinal_present(&self) -> u64 {
14216            if let Some(_) = self.mouse_source {
14217                return 4;
14218            }
14219            if let Some(_) = self.touch_source {
14220                return 3;
14221            }
14222            if let Some(_) = self.view_focuser {
14223                return 2;
14224            }
14225            if let Some(_) = self.view_ref_focused {
14226                return 1;
14227            }
14228            0
14229        }
14230    }
14231
14232    impl fidl::encoding::ResourceTypeMarker for ViewBoundProtocols {
14233        type Borrowed<'a> = &'a mut Self;
14234        fn take_or_borrow<'a>(
14235            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
14236        ) -> Self::Borrowed<'a> {
14237            value
14238        }
14239    }
14240
14241    unsafe impl fidl::encoding::TypeMarker for ViewBoundProtocols {
14242        type Owned = Self;
14243
14244        #[inline(always)]
14245        fn inline_align(_context: fidl::encoding::Context) -> usize {
14246            8
14247        }
14248
14249        #[inline(always)]
14250        fn inline_size(_context: fidl::encoding::Context) -> usize {
14251            16
14252        }
14253    }
14254
14255    unsafe impl
14256        fidl::encoding::Encode<ViewBoundProtocols, fidl::encoding::DefaultFuchsiaResourceDialect>
14257        for &mut ViewBoundProtocols
14258    {
14259        unsafe fn encode(
14260            self,
14261            encoder: &mut fidl::encoding::Encoder<
14262                '_,
14263                fidl::encoding::DefaultFuchsiaResourceDialect,
14264            >,
14265            offset: usize,
14266            mut depth: fidl::encoding::Depth,
14267        ) -> fidl::Result<()> {
14268            encoder.debug_check_bounds::<ViewBoundProtocols>(offset);
14269            // Vector header
14270            let max_ordinal: u64 = self.max_ordinal_present();
14271            encoder.write_num(max_ordinal, offset);
14272            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
14273            // Calling encoder.out_of_line_offset(0) is not allowed.
14274            if max_ordinal == 0 {
14275                return Ok(());
14276            }
14277            depth.increment()?;
14278            let envelope_size = 8;
14279            let bytes_len = max_ordinal as usize * envelope_size;
14280            #[allow(unused_variables)]
14281            let offset = encoder.out_of_line_offset(bytes_len);
14282            let mut _prev_end_offset: usize = 0;
14283            if 1 > max_ordinal {
14284                return Ok(());
14285            }
14286
14287            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
14288            // are envelope_size bytes.
14289            let cur_offset: usize = (1 - 1) * envelope_size;
14290
14291            // Zero reserved fields.
14292            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
14293
14294            // Safety:
14295            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
14296            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
14297            //   envelope_size bytes, there is always sufficient room.
14298            fidl::encoding::encode_in_envelope_optional::<
14299                fidl::encoding::Endpoint<
14300                    fidl::endpoints::ServerEnd<fidl_fuchsia_ui_views::ViewRefFocusedMarker>,
14301                >,
14302                fidl::encoding::DefaultFuchsiaResourceDialect,
14303            >(
14304                self.view_ref_focused.as_mut().map(
14305                    <fidl::encoding::Endpoint<
14306                        fidl::endpoints::ServerEnd<fidl_fuchsia_ui_views::ViewRefFocusedMarker>,
14307                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
14308                ),
14309                encoder,
14310                offset + cur_offset,
14311                depth,
14312            )?;
14313
14314            _prev_end_offset = cur_offset + envelope_size;
14315            if 2 > max_ordinal {
14316                return Ok(());
14317            }
14318
14319            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
14320            // are envelope_size bytes.
14321            let cur_offset: usize = (2 - 1) * envelope_size;
14322
14323            // Zero reserved fields.
14324            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
14325
14326            // Safety:
14327            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
14328            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
14329            //   envelope_size bytes, there is always sufficient room.
14330            fidl::encoding::encode_in_envelope_optional::<
14331                fidl::encoding::Endpoint<
14332                    fidl::endpoints::ServerEnd<fidl_fuchsia_ui_views::FocuserMarker>,
14333                >,
14334                fidl::encoding::DefaultFuchsiaResourceDialect,
14335            >(
14336                self.view_focuser.as_mut().map(
14337                    <fidl::encoding::Endpoint<
14338                        fidl::endpoints::ServerEnd<fidl_fuchsia_ui_views::FocuserMarker>,
14339                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
14340                ),
14341                encoder,
14342                offset + cur_offset,
14343                depth,
14344            )?;
14345
14346            _prev_end_offset = cur_offset + envelope_size;
14347            if 3 > max_ordinal {
14348                return Ok(());
14349            }
14350
14351            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
14352            // are envelope_size bytes.
14353            let cur_offset: usize = (3 - 1) * envelope_size;
14354
14355            // Zero reserved fields.
14356            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
14357
14358            // Safety:
14359            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
14360            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
14361            //   envelope_size bytes, there is always sufficient room.
14362            fidl::encoding::encode_in_envelope_optional::<
14363                fidl::encoding::Endpoint<
14364                    fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::TouchSourceMarker>,
14365                >,
14366                fidl::encoding::DefaultFuchsiaResourceDialect,
14367            >(
14368                self.touch_source.as_mut().map(
14369                    <fidl::encoding::Endpoint<
14370                        fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::TouchSourceMarker>,
14371                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
14372                ),
14373                encoder,
14374                offset + cur_offset,
14375                depth,
14376            )?;
14377
14378            _prev_end_offset = cur_offset + envelope_size;
14379            if 4 > max_ordinal {
14380                return Ok(());
14381            }
14382
14383            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
14384            // are envelope_size bytes.
14385            let cur_offset: usize = (4 - 1) * envelope_size;
14386
14387            // Zero reserved fields.
14388            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
14389
14390            // Safety:
14391            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
14392            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
14393            //   envelope_size bytes, there is always sufficient room.
14394            fidl::encoding::encode_in_envelope_optional::<
14395                fidl::encoding::Endpoint<
14396                    fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::MouseSourceMarker>,
14397                >,
14398                fidl::encoding::DefaultFuchsiaResourceDialect,
14399            >(
14400                self.mouse_source.as_mut().map(
14401                    <fidl::encoding::Endpoint<
14402                        fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::MouseSourceMarker>,
14403                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
14404                ),
14405                encoder,
14406                offset + cur_offset,
14407                depth,
14408            )?;
14409
14410            _prev_end_offset = cur_offset + envelope_size;
14411
14412            Ok(())
14413        }
14414    }
14415
14416    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
14417        for ViewBoundProtocols
14418    {
14419        #[inline(always)]
14420        fn new_empty() -> Self {
14421            Self::default()
14422        }
14423
14424        unsafe fn decode(
14425            &mut self,
14426            decoder: &mut fidl::encoding::Decoder<
14427                '_,
14428                fidl::encoding::DefaultFuchsiaResourceDialect,
14429            >,
14430            offset: usize,
14431            mut depth: fidl::encoding::Depth,
14432        ) -> fidl::Result<()> {
14433            decoder.debug_check_bounds::<Self>(offset);
14434            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
14435                None => return Err(fidl::Error::NotNullable),
14436                Some(len) => len,
14437            };
14438            // Calling decoder.out_of_line_offset(0) is not allowed.
14439            if len == 0 {
14440                return Ok(());
14441            };
14442            depth.increment()?;
14443            let envelope_size = 8;
14444            let bytes_len = len * envelope_size;
14445            let offset = decoder.out_of_line_offset(bytes_len)?;
14446            // Decode the envelope for each type.
14447            let mut _next_ordinal_to_read = 0;
14448            let mut next_offset = offset;
14449            let end_offset = offset + bytes_len;
14450            _next_ordinal_to_read += 1;
14451            if next_offset >= end_offset {
14452                return Ok(());
14453            }
14454
14455            // Decode unknown envelopes for gaps in ordinals.
14456            while _next_ordinal_to_read < 1 {
14457                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
14458                _next_ordinal_to_read += 1;
14459                next_offset += envelope_size;
14460            }
14461
14462            let next_out_of_line = decoder.next_out_of_line();
14463            let handles_before = decoder.remaining_handles();
14464            if let Some((inlined, num_bytes, num_handles)) =
14465                fidl::encoding::decode_envelope_header(decoder, next_offset)?
14466            {
14467                let member_inline_size = <fidl::encoding::Endpoint<
14468                    fidl::endpoints::ServerEnd<fidl_fuchsia_ui_views::ViewRefFocusedMarker>,
14469                > as fidl::encoding::TypeMarker>::inline_size(
14470                    decoder.context
14471                );
14472                if inlined != (member_inline_size <= 4) {
14473                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
14474                }
14475                let inner_offset;
14476                let mut inner_depth = depth.clone();
14477                if inlined {
14478                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
14479                    inner_offset = next_offset;
14480                } else {
14481                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
14482                    inner_depth.increment()?;
14483                }
14484                let val_ref = self.view_ref_focused.get_or_insert_with(|| {
14485                    fidl::new_empty!(
14486                        fidl::encoding::Endpoint<
14487                            fidl::endpoints::ServerEnd<fidl_fuchsia_ui_views::ViewRefFocusedMarker>,
14488                        >,
14489                        fidl::encoding::DefaultFuchsiaResourceDialect
14490                    )
14491                });
14492                fidl::decode!(
14493                    fidl::encoding::Endpoint<
14494                        fidl::endpoints::ServerEnd<fidl_fuchsia_ui_views::ViewRefFocusedMarker>,
14495                    >,
14496                    fidl::encoding::DefaultFuchsiaResourceDialect,
14497                    val_ref,
14498                    decoder,
14499                    inner_offset,
14500                    inner_depth
14501                )?;
14502                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
14503                {
14504                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
14505                }
14506                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
14507                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
14508                }
14509            }
14510
14511            next_offset += envelope_size;
14512            _next_ordinal_to_read += 1;
14513            if next_offset >= end_offset {
14514                return Ok(());
14515            }
14516
14517            // Decode unknown envelopes for gaps in ordinals.
14518            while _next_ordinal_to_read < 2 {
14519                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
14520                _next_ordinal_to_read += 1;
14521                next_offset += envelope_size;
14522            }
14523
14524            let next_out_of_line = decoder.next_out_of_line();
14525            let handles_before = decoder.remaining_handles();
14526            if let Some((inlined, num_bytes, num_handles)) =
14527                fidl::encoding::decode_envelope_header(decoder, next_offset)?
14528            {
14529                let member_inline_size = <fidl::encoding::Endpoint<
14530                    fidl::endpoints::ServerEnd<fidl_fuchsia_ui_views::FocuserMarker>,
14531                > as fidl::encoding::TypeMarker>::inline_size(
14532                    decoder.context
14533                );
14534                if inlined != (member_inline_size <= 4) {
14535                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
14536                }
14537                let inner_offset;
14538                let mut inner_depth = depth.clone();
14539                if inlined {
14540                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
14541                    inner_offset = next_offset;
14542                } else {
14543                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
14544                    inner_depth.increment()?;
14545                }
14546                let val_ref = self.view_focuser.get_or_insert_with(|| {
14547                    fidl::new_empty!(
14548                        fidl::encoding::Endpoint<
14549                            fidl::endpoints::ServerEnd<fidl_fuchsia_ui_views::FocuserMarker>,
14550                        >,
14551                        fidl::encoding::DefaultFuchsiaResourceDialect
14552                    )
14553                });
14554                fidl::decode!(
14555                    fidl::encoding::Endpoint<
14556                        fidl::endpoints::ServerEnd<fidl_fuchsia_ui_views::FocuserMarker>,
14557                    >,
14558                    fidl::encoding::DefaultFuchsiaResourceDialect,
14559                    val_ref,
14560                    decoder,
14561                    inner_offset,
14562                    inner_depth
14563                )?;
14564                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
14565                {
14566                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
14567                }
14568                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
14569                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
14570                }
14571            }
14572
14573            next_offset += envelope_size;
14574            _next_ordinal_to_read += 1;
14575            if next_offset >= end_offset {
14576                return Ok(());
14577            }
14578
14579            // Decode unknown envelopes for gaps in ordinals.
14580            while _next_ordinal_to_read < 3 {
14581                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
14582                _next_ordinal_to_read += 1;
14583                next_offset += envelope_size;
14584            }
14585
14586            let next_out_of_line = decoder.next_out_of_line();
14587            let handles_before = decoder.remaining_handles();
14588            if let Some((inlined, num_bytes, num_handles)) =
14589                fidl::encoding::decode_envelope_header(decoder, next_offset)?
14590            {
14591                let member_inline_size = <fidl::encoding::Endpoint<
14592                    fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::TouchSourceMarker>,
14593                > as fidl::encoding::TypeMarker>::inline_size(
14594                    decoder.context
14595                );
14596                if inlined != (member_inline_size <= 4) {
14597                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
14598                }
14599                let inner_offset;
14600                let mut inner_depth = depth.clone();
14601                if inlined {
14602                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
14603                    inner_offset = next_offset;
14604                } else {
14605                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
14606                    inner_depth.increment()?;
14607                }
14608                let val_ref = self.touch_source.get_or_insert_with(|| {
14609                    fidl::new_empty!(
14610                        fidl::encoding::Endpoint<
14611                            fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::TouchSourceMarker>,
14612                        >,
14613                        fidl::encoding::DefaultFuchsiaResourceDialect
14614                    )
14615                });
14616                fidl::decode!(
14617                    fidl::encoding::Endpoint<
14618                        fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::TouchSourceMarker>,
14619                    >,
14620                    fidl::encoding::DefaultFuchsiaResourceDialect,
14621                    val_ref,
14622                    decoder,
14623                    inner_offset,
14624                    inner_depth
14625                )?;
14626                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
14627                {
14628                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
14629                }
14630                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
14631                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
14632                }
14633            }
14634
14635            next_offset += envelope_size;
14636            _next_ordinal_to_read += 1;
14637            if next_offset >= end_offset {
14638                return Ok(());
14639            }
14640
14641            // Decode unknown envelopes for gaps in ordinals.
14642            while _next_ordinal_to_read < 4 {
14643                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
14644                _next_ordinal_to_read += 1;
14645                next_offset += envelope_size;
14646            }
14647
14648            let next_out_of_line = decoder.next_out_of_line();
14649            let handles_before = decoder.remaining_handles();
14650            if let Some((inlined, num_bytes, num_handles)) =
14651                fidl::encoding::decode_envelope_header(decoder, next_offset)?
14652            {
14653                let member_inline_size = <fidl::encoding::Endpoint<
14654                    fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::MouseSourceMarker>,
14655                > as fidl::encoding::TypeMarker>::inline_size(
14656                    decoder.context
14657                );
14658                if inlined != (member_inline_size <= 4) {
14659                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
14660                }
14661                let inner_offset;
14662                let mut inner_depth = depth.clone();
14663                if inlined {
14664                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
14665                    inner_offset = next_offset;
14666                } else {
14667                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
14668                    inner_depth.increment()?;
14669                }
14670                let val_ref = self.mouse_source.get_or_insert_with(|| {
14671                    fidl::new_empty!(
14672                        fidl::encoding::Endpoint<
14673                            fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::MouseSourceMarker>,
14674                        >,
14675                        fidl::encoding::DefaultFuchsiaResourceDialect
14676                    )
14677                });
14678                fidl::decode!(
14679                    fidl::encoding::Endpoint<
14680                        fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::MouseSourceMarker>,
14681                    >,
14682                    fidl::encoding::DefaultFuchsiaResourceDialect,
14683                    val_ref,
14684                    decoder,
14685                    inner_offset,
14686                    inner_depth
14687                )?;
14688                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
14689                {
14690                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
14691                }
14692                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
14693                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
14694                }
14695            }
14696
14697            next_offset += envelope_size;
14698
14699            // Decode the remaining unknown envelopes.
14700            while next_offset < end_offset {
14701                _next_ordinal_to_read += 1;
14702                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
14703                next_offset += envelope_size;
14704            }
14705
14706            Ok(())
14707        }
14708    }
14709}