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::Handle {
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    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
862        self.inner.shutdown_with_epitaph(status)
863    }
864
865    fn is_closed(&self) -> bool {
866        self.inner.channel().is_closed()
867    }
868    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
869        self.inner.channel().on_closed()
870    }
871
872    #[cfg(target_os = "fuchsia")]
873    fn signal_peer(
874        &self,
875        clear_mask: zx::Signals,
876        set_mask: zx::Signals,
877    ) -> Result<(), zx_status::Status> {
878        use fidl::Peered;
879        self.inner.channel().signal_peer(clear_mask, set_mask)
880    }
881}
882
883impl AllocatorControlHandle {}
884
885#[must_use = "FIDL methods require a response to be sent"]
886#[derive(Debug)]
887pub struct AllocatorRegisterBufferCollectionResponder {
888    control_handle: std::mem::ManuallyDrop<AllocatorControlHandle>,
889    tx_id: u32,
890}
891
892/// Set the the channel to be shutdown (see [`AllocatorControlHandle::shutdown`])
893/// if the responder is dropped without sending a response, so that the client
894/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
895impl std::ops::Drop for AllocatorRegisterBufferCollectionResponder {
896    fn drop(&mut self) {
897        self.control_handle.shutdown();
898        // Safety: drops once, never accessed again
899        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
900    }
901}
902
903impl fidl::endpoints::Responder for AllocatorRegisterBufferCollectionResponder {
904    type ControlHandle = AllocatorControlHandle;
905
906    fn control_handle(&self) -> &AllocatorControlHandle {
907        &self.control_handle
908    }
909
910    fn drop_without_shutdown(mut self) {
911        // Safety: drops once, never accessed again due to mem::forget
912        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
913        // Prevent Drop from running (which would shut down the channel)
914        std::mem::forget(self);
915    }
916}
917
918impl AllocatorRegisterBufferCollectionResponder {
919    /// Sends a response to the FIDL transaction.
920    ///
921    /// Sets the channel to shutdown if an error occurs.
922    pub fn send(
923        self,
924        mut result: Result<(), RegisterBufferCollectionError>,
925    ) -> Result<(), fidl::Error> {
926        let _result = self.send_raw(result);
927        if _result.is_err() {
928            self.control_handle.shutdown();
929        }
930        self.drop_without_shutdown();
931        _result
932    }
933
934    /// Similar to "send" but does not shutdown the channel if an error occurs.
935    pub fn send_no_shutdown_on_err(
936        self,
937        mut result: Result<(), RegisterBufferCollectionError>,
938    ) -> Result<(), fidl::Error> {
939        let _result = self.send_raw(result);
940        self.drop_without_shutdown();
941        _result
942    }
943
944    fn send_raw(
945        &self,
946        mut result: Result<(), RegisterBufferCollectionError>,
947    ) -> Result<(), fidl::Error> {
948        self.control_handle.inner.send::<fidl::encoding::ResultType<
949            fidl::encoding::EmptyStruct,
950            RegisterBufferCollectionError,
951        >>(
952            result,
953            self.tx_id,
954            0x494b7ea578d1061e,
955            fidl::encoding::DynamicFlags::empty(),
956        )
957    }
958}
959
960#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
961pub struct ChildViewWatcherMarker;
962
963impl fidl::endpoints::ProtocolMarker for ChildViewWatcherMarker {
964    type Proxy = ChildViewWatcherProxy;
965    type RequestStream = ChildViewWatcherRequestStream;
966    #[cfg(target_os = "fuchsia")]
967    type SynchronousProxy = ChildViewWatcherSynchronousProxy;
968
969    const DEBUG_NAME: &'static str = "(anonymous) ChildViewWatcher";
970}
971
972pub trait ChildViewWatcherProxyInterface: Send + Sync {
973    type GetStatusResponseFut: std::future::Future<Output = Result<ChildViewStatus, fidl::Error>>
974        + Send;
975    fn r#get_status(&self) -> Self::GetStatusResponseFut;
976    type GetViewRefResponseFut: std::future::Future<Output = Result<fidl_fuchsia_ui_views::ViewRef, fidl::Error>>
977        + Send;
978    fn r#get_view_ref(&self) -> Self::GetViewRefResponseFut;
979}
980#[derive(Debug)]
981#[cfg(target_os = "fuchsia")]
982pub struct ChildViewWatcherSynchronousProxy {
983    client: fidl::client::sync::Client,
984}
985
986#[cfg(target_os = "fuchsia")]
987impl fidl::endpoints::SynchronousProxy for ChildViewWatcherSynchronousProxy {
988    type Proxy = ChildViewWatcherProxy;
989    type Protocol = ChildViewWatcherMarker;
990
991    fn from_channel(inner: fidl::Channel) -> Self {
992        Self::new(inner)
993    }
994
995    fn into_channel(self) -> fidl::Channel {
996        self.client.into_channel()
997    }
998
999    fn as_channel(&self) -> &fidl::Channel {
1000        self.client.as_channel()
1001    }
1002}
1003
1004#[cfg(target_os = "fuchsia")]
1005impl ChildViewWatcherSynchronousProxy {
1006    pub fn new(channel: fidl::Channel) -> Self {
1007        let protocol_name = <ChildViewWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1008        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1009    }
1010
1011    pub fn into_channel(self) -> fidl::Channel {
1012        self.client.into_channel()
1013    }
1014
1015    /// Waits until an event arrives and returns it. It is safe for other
1016    /// threads to make concurrent requests while waiting for an event.
1017    pub fn wait_for_event(
1018        &self,
1019        deadline: zx::MonotonicInstant,
1020    ) -> Result<ChildViewWatcherEvent, fidl::Error> {
1021        ChildViewWatcherEvent::decode(self.client.wait_for_event(deadline)?)
1022    }
1023
1024    /// A hanging get for receiving the status of a View. This provides information to the parent,
1025    /// such as whether or not the child has successfully presented content through this View.
1026    ///
1027    /// This hanging get will only fire when the ChildViewStatus is different than the previously
1028    /// returned ChildViewStatus.  This can happen immediately, and even if the creator of the
1029    /// Viewport hasn't yet called Present() after calling CreateViewport().  This allows the parent
1030    /// to know that the child has content ready to display before the parent modifies their own
1031    /// local scene graph to incorporate the child content.
1032    ///
1033    /// It is invalid to call `GetStatus` while a previous call is still pending. Doing so will
1034    /// cause both this channel and the Flatland channel that handed out ChildViewWatcher to be
1035    /// closed.
1036    pub fn r#get_status(
1037        &self,
1038        ___deadline: zx::MonotonicInstant,
1039    ) -> Result<ChildViewStatus, fidl::Error> {
1040        let _response = self
1041            .client
1042            .send_query::<fidl::encoding::EmptyPayload, ChildViewWatcherGetStatusResponse>(
1043                (),
1044                0x1d622075f4fc8243,
1045                fidl::encoding::DynamicFlags::empty(),
1046                ___deadline,
1047            )?;
1048        Ok(_response.status)
1049    }
1050
1051    /// Hanging get to receive the ViewRef of the child View. This will only fire when the View ref
1052    /// is different from the previously-returned View ref. Note: currently the View ref will not
1053    /// change after it is first received, but this will change if/when the API changes to allow
1054    /// relinking of views.
1055    ///
1056    /// The ViewRef is not returned until the View is included in the View tree, in other words when
1057    /// there is a chain of ancestor transforms all the way back up to the root of the scene graph,
1058    /// i.e. the display.
1059    ///
1060    /// It is invalid to call `GetViewRef` while a previous call is still pending. Doing so will
1061    /// cause both this channel and the Flatland channel that handed out ChildViewWatcher to be
1062    /// closed.
1063    ///
1064    /// A `GetViewRef` call will hang if the View was created using `CreateView`, but returns the
1065    /// View if the View was created using CreateView2. This is because `CreateView` does not mint
1066    /// a ViewRef for that View.
1067    pub fn r#get_view_ref(
1068        &self,
1069        ___deadline: zx::MonotonicInstant,
1070    ) -> Result<fidl_fuchsia_ui_views::ViewRef, fidl::Error> {
1071        let _response = self
1072            .client
1073            .send_query::<fidl::encoding::EmptyPayload, ChildViewWatcherGetViewRefResponse>(
1074                (),
1075                0x3b2f3ca31e8908b4,
1076                fidl::encoding::DynamicFlags::empty(),
1077                ___deadline,
1078            )?;
1079        Ok(_response.view_ref)
1080    }
1081}
1082
1083#[cfg(target_os = "fuchsia")]
1084impl From<ChildViewWatcherSynchronousProxy> for zx::Handle {
1085    fn from(value: ChildViewWatcherSynchronousProxy) -> Self {
1086        value.into_channel().into()
1087    }
1088}
1089
1090#[cfg(target_os = "fuchsia")]
1091impl From<fidl::Channel> for ChildViewWatcherSynchronousProxy {
1092    fn from(value: fidl::Channel) -> Self {
1093        Self::new(value)
1094    }
1095}
1096
1097#[cfg(target_os = "fuchsia")]
1098impl fidl::endpoints::FromClient for ChildViewWatcherSynchronousProxy {
1099    type Protocol = ChildViewWatcherMarker;
1100
1101    fn from_client(value: fidl::endpoints::ClientEnd<ChildViewWatcherMarker>) -> Self {
1102        Self::new(value.into_channel())
1103    }
1104}
1105
1106#[derive(Debug, Clone)]
1107pub struct ChildViewWatcherProxy {
1108    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1109}
1110
1111impl fidl::endpoints::Proxy for ChildViewWatcherProxy {
1112    type Protocol = ChildViewWatcherMarker;
1113
1114    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1115        Self::new(inner)
1116    }
1117
1118    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1119        self.client.into_channel().map_err(|client| Self { client })
1120    }
1121
1122    fn as_channel(&self) -> &::fidl::AsyncChannel {
1123        self.client.as_channel()
1124    }
1125}
1126
1127impl ChildViewWatcherProxy {
1128    /// Create a new Proxy for fuchsia.ui.composition/ChildViewWatcher.
1129    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1130        let protocol_name = <ChildViewWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1131        Self { client: fidl::client::Client::new(channel, protocol_name) }
1132    }
1133
1134    /// Get a Stream of events from the remote end of the protocol.
1135    ///
1136    /// # Panics
1137    ///
1138    /// Panics if the event stream was already taken.
1139    pub fn take_event_stream(&self) -> ChildViewWatcherEventStream {
1140        ChildViewWatcherEventStream { event_receiver: self.client.take_event_receiver() }
1141    }
1142
1143    /// A hanging get for receiving the status of a View. This provides information to the parent,
1144    /// such as whether or not the child has successfully presented content through this View.
1145    ///
1146    /// This hanging get will only fire when the ChildViewStatus is different than the previously
1147    /// returned ChildViewStatus.  This can happen immediately, and even if the creator of the
1148    /// Viewport hasn't yet called Present() after calling CreateViewport().  This allows the parent
1149    /// to know that the child has content ready to display before the parent modifies their own
1150    /// local scene graph to incorporate the child content.
1151    ///
1152    /// It is invalid to call `GetStatus` while a previous call is still pending. Doing so will
1153    /// cause both this channel and the Flatland channel that handed out ChildViewWatcher to be
1154    /// closed.
1155    pub fn r#get_status(
1156        &self,
1157    ) -> fidl::client::QueryResponseFut<
1158        ChildViewStatus,
1159        fidl::encoding::DefaultFuchsiaResourceDialect,
1160    > {
1161        ChildViewWatcherProxyInterface::r#get_status(self)
1162    }
1163
1164    /// Hanging get to receive the ViewRef of the child View. This will only fire when the View ref
1165    /// is different from the previously-returned View ref. Note: currently the View ref will not
1166    /// change after it is first received, but this will change if/when the API changes to allow
1167    /// relinking of views.
1168    ///
1169    /// The ViewRef is not returned until the View is included in the View tree, in other words when
1170    /// there is a chain of ancestor transforms all the way back up to the root of the scene graph,
1171    /// i.e. the display.
1172    ///
1173    /// It is invalid to call `GetViewRef` while a previous call is still pending. Doing so will
1174    /// cause both this channel and the Flatland channel that handed out ChildViewWatcher to be
1175    /// closed.
1176    ///
1177    /// A `GetViewRef` call will hang if the View was created using `CreateView`, but returns the
1178    /// View if the View was created using CreateView2. This is because `CreateView` does not mint
1179    /// a ViewRef for that View.
1180    pub fn r#get_view_ref(
1181        &self,
1182    ) -> fidl::client::QueryResponseFut<
1183        fidl_fuchsia_ui_views::ViewRef,
1184        fidl::encoding::DefaultFuchsiaResourceDialect,
1185    > {
1186        ChildViewWatcherProxyInterface::r#get_view_ref(self)
1187    }
1188}
1189
1190impl ChildViewWatcherProxyInterface for ChildViewWatcherProxy {
1191    type GetStatusResponseFut = fidl::client::QueryResponseFut<
1192        ChildViewStatus,
1193        fidl::encoding::DefaultFuchsiaResourceDialect,
1194    >;
1195    fn r#get_status(&self) -> Self::GetStatusResponseFut {
1196        fn _decode(
1197            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1198        ) -> Result<ChildViewStatus, fidl::Error> {
1199            let _response = fidl::client::decode_transaction_body::<
1200                ChildViewWatcherGetStatusResponse,
1201                fidl::encoding::DefaultFuchsiaResourceDialect,
1202                0x1d622075f4fc8243,
1203            >(_buf?)?;
1204            Ok(_response.status)
1205        }
1206        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ChildViewStatus>(
1207            (),
1208            0x1d622075f4fc8243,
1209            fidl::encoding::DynamicFlags::empty(),
1210            _decode,
1211        )
1212    }
1213
1214    type GetViewRefResponseFut = fidl::client::QueryResponseFut<
1215        fidl_fuchsia_ui_views::ViewRef,
1216        fidl::encoding::DefaultFuchsiaResourceDialect,
1217    >;
1218    fn r#get_view_ref(&self) -> Self::GetViewRefResponseFut {
1219        fn _decode(
1220            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1221        ) -> Result<fidl_fuchsia_ui_views::ViewRef, fidl::Error> {
1222            let _response = fidl::client::decode_transaction_body::<
1223                ChildViewWatcherGetViewRefResponse,
1224                fidl::encoding::DefaultFuchsiaResourceDialect,
1225                0x3b2f3ca31e8908b4,
1226            >(_buf?)?;
1227            Ok(_response.view_ref)
1228        }
1229        self.client
1230            .send_query_and_decode::<fidl::encoding::EmptyPayload, fidl_fuchsia_ui_views::ViewRef>(
1231                (),
1232                0x3b2f3ca31e8908b4,
1233                fidl::encoding::DynamicFlags::empty(),
1234                _decode,
1235            )
1236    }
1237}
1238
1239pub struct ChildViewWatcherEventStream {
1240    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1241}
1242
1243impl std::marker::Unpin for ChildViewWatcherEventStream {}
1244
1245impl futures::stream::FusedStream for ChildViewWatcherEventStream {
1246    fn is_terminated(&self) -> bool {
1247        self.event_receiver.is_terminated()
1248    }
1249}
1250
1251impl futures::Stream for ChildViewWatcherEventStream {
1252    type Item = Result<ChildViewWatcherEvent, fidl::Error>;
1253
1254    fn poll_next(
1255        mut self: std::pin::Pin<&mut Self>,
1256        cx: &mut std::task::Context<'_>,
1257    ) -> std::task::Poll<Option<Self::Item>> {
1258        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1259            &mut self.event_receiver,
1260            cx
1261        )?) {
1262            Some(buf) => std::task::Poll::Ready(Some(ChildViewWatcherEvent::decode(buf))),
1263            None => std::task::Poll::Ready(None),
1264        }
1265    }
1266}
1267
1268#[derive(Debug)]
1269pub enum ChildViewWatcherEvent {}
1270
1271impl ChildViewWatcherEvent {
1272    /// Decodes a message buffer as a [`ChildViewWatcherEvent`].
1273    fn decode(
1274        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1275    ) -> Result<ChildViewWatcherEvent, fidl::Error> {
1276        let (bytes, _handles) = buf.split_mut();
1277        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1278        debug_assert_eq!(tx_header.tx_id, 0);
1279        match tx_header.ordinal {
1280            _ => Err(fidl::Error::UnknownOrdinal {
1281                ordinal: tx_header.ordinal,
1282                protocol_name:
1283                    <ChildViewWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1284            }),
1285        }
1286    }
1287}
1288
1289/// A Stream of incoming requests for fuchsia.ui.composition/ChildViewWatcher.
1290pub struct ChildViewWatcherRequestStream {
1291    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1292    is_terminated: bool,
1293}
1294
1295impl std::marker::Unpin for ChildViewWatcherRequestStream {}
1296
1297impl futures::stream::FusedStream for ChildViewWatcherRequestStream {
1298    fn is_terminated(&self) -> bool {
1299        self.is_terminated
1300    }
1301}
1302
1303impl fidl::endpoints::RequestStream for ChildViewWatcherRequestStream {
1304    type Protocol = ChildViewWatcherMarker;
1305    type ControlHandle = ChildViewWatcherControlHandle;
1306
1307    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1308        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1309    }
1310
1311    fn control_handle(&self) -> Self::ControlHandle {
1312        ChildViewWatcherControlHandle { inner: self.inner.clone() }
1313    }
1314
1315    fn into_inner(
1316        self,
1317    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1318    {
1319        (self.inner, self.is_terminated)
1320    }
1321
1322    fn from_inner(
1323        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1324        is_terminated: bool,
1325    ) -> Self {
1326        Self { inner, is_terminated }
1327    }
1328}
1329
1330impl futures::Stream for ChildViewWatcherRequestStream {
1331    type Item = Result<ChildViewWatcherRequest, fidl::Error>;
1332
1333    fn poll_next(
1334        mut self: std::pin::Pin<&mut Self>,
1335        cx: &mut std::task::Context<'_>,
1336    ) -> std::task::Poll<Option<Self::Item>> {
1337        let this = &mut *self;
1338        if this.inner.check_shutdown(cx) {
1339            this.is_terminated = true;
1340            return std::task::Poll::Ready(None);
1341        }
1342        if this.is_terminated {
1343            panic!("polled ChildViewWatcherRequestStream after completion");
1344        }
1345        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1346            |bytes, handles| {
1347                match this.inner.channel().read_etc(cx, bytes, handles) {
1348                    std::task::Poll::Ready(Ok(())) => {}
1349                    std::task::Poll::Pending => return std::task::Poll::Pending,
1350                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1351                        this.is_terminated = true;
1352                        return std::task::Poll::Ready(None);
1353                    }
1354                    std::task::Poll::Ready(Err(e)) => {
1355                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1356                            e.into(),
1357                        ))));
1358                    }
1359                }
1360
1361                // A message has been received from the channel
1362                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1363
1364                std::task::Poll::Ready(Some(match header.ordinal {
1365                    0x1d622075f4fc8243 => {
1366                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1367                        let mut req = fidl::new_empty!(
1368                            fidl::encoding::EmptyPayload,
1369                            fidl::encoding::DefaultFuchsiaResourceDialect
1370                        );
1371                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1372                        let control_handle =
1373                            ChildViewWatcherControlHandle { inner: this.inner.clone() };
1374                        Ok(ChildViewWatcherRequest::GetStatus {
1375                            responder: ChildViewWatcherGetStatusResponder {
1376                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1377                                tx_id: header.tx_id,
1378                            },
1379                        })
1380                    }
1381                    0x3b2f3ca31e8908b4 => {
1382                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1383                        let mut req = fidl::new_empty!(
1384                            fidl::encoding::EmptyPayload,
1385                            fidl::encoding::DefaultFuchsiaResourceDialect
1386                        );
1387                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1388                        let control_handle =
1389                            ChildViewWatcherControlHandle { inner: this.inner.clone() };
1390                        Ok(ChildViewWatcherRequest::GetViewRef {
1391                            responder: ChildViewWatcherGetViewRefResponder {
1392                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1393                                tx_id: header.tx_id,
1394                            },
1395                        })
1396                    }
1397                    _ => Err(fidl::Error::UnknownOrdinal {
1398                        ordinal: header.ordinal,
1399                        protocol_name:
1400                            <ChildViewWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1401                    }),
1402                }))
1403            },
1404        )
1405    }
1406}
1407
1408/// A protocol that provides information about a particular child View which is attached to the
1409/// Viewport owned by the parent client; connections to this protocol are estabished in
1410/// [`CreateViewport`].  Since a Flatland instance may contain any number of Viewports, each of
1411/// which may or may not be attached to a transform, the client can maintain connections to an
1412/// equal number of ChildViewWatcher instances.
1413///
1414/// Each ChildViewWatcher instance will remain connected as long as the corresponding child View
1415/// exists; the connection will also be closed if the child's ViewCreationToken is dropped without
1416/// using it to create a View.
1417#[derive(Debug)]
1418pub enum ChildViewWatcherRequest {
1419    /// A hanging get for receiving the status of a View. This provides information to the parent,
1420    /// such as whether or not the child has successfully presented content through this View.
1421    ///
1422    /// This hanging get will only fire when the ChildViewStatus is different than the previously
1423    /// returned ChildViewStatus.  This can happen immediately, and even if the creator of the
1424    /// Viewport hasn't yet called Present() after calling CreateViewport().  This allows the parent
1425    /// to know that the child has content ready to display before the parent modifies their own
1426    /// local scene graph to incorporate the child content.
1427    ///
1428    /// It is invalid to call `GetStatus` while a previous call is still pending. Doing so will
1429    /// cause both this channel and the Flatland channel that handed out ChildViewWatcher to be
1430    /// closed.
1431    GetStatus { responder: ChildViewWatcherGetStatusResponder },
1432    /// Hanging get to receive the ViewRef of the child View. This will only fire when the View ref
1433    /// is different from the previously-returned View ref. Note: currently the View ref will not
1434    /// change after it is first received, but this will change if/when the API changes to allow
1435    /// relinking of views.
1436    ///
1437    /// The ViewRef is not returned until the View is included in the View tree, in other words when
1438    /// there is a chain of ancestor transforms all the way back up to the root of the scene graph,
1439    /// i.e. the display.
1440    ///
1441    /// It is invalid to call `GetViewRef` while a previous call is still pending. Doing so will
1442    /// cause both this channel and the Flatland channel that handed out ChildViewWatcher to be
1443    /// closed.
1444    ///
1445    /// A `GetViewRef` call will hang if the View was created using `CreateView`, but returns the
1446    /// View if the View was created using CreateView2. This is because `CreateView` does not mint
1447    /// a ViewRef for that View.
1448    GetViewRef { responder: ChildViewWatcherGetViewRefResponder },
1449}
1450
1451impl ChildViewWatcherRequest {
1452    #[allow(irrefutable_let_patterns)]
1453    pub fn into_get_status(self) -> Option<(ChildViewWatcherGetStatusResponder)> {
1454        if let ChildViewWatcherRequest::GetStatus { responder } = self {
1455            Some((responder))
1456        } else {
1457            None
1458        }
1459    }
1460
1461    #[allow(irrefutable_let_patterns)]
1462    pub fn into_get_view_ref(self) -> Option<(ChildViewWatcherGetViewRefResponder)> {
1463        if let ChildViewWatcherRequest::GetViewRef { responder } = self {
1464            Some((responder))
1465        } else {
1466            None
1467        }
1468    }
1469
1470    /// Name of the method defined in FIDL
1471    pub fn method_name(&self) -> &'static str {
1472        match *self {
1473            ChildViewWatcherRequest::GetStatus { .. } => "get_status",
1474            ChildViewWatcherRequest::GetViewRef { .. } => "get_view_ref",
1475        }
1476    }
1477}
1478
1479#[derive(Debug, Clone)]
1480pub struct ChildViewWatcherControlHandle {
1481    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1482}
1483
1484impl fidl::endpoints::ControlHandle for ChildViewWatcherControlHandle {
1485    fn shutdown(&self) {
1486        self.inner.shutdown()
1487    }
1488    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1489        self.inner.shutdown_with_epitaph(status)
1490    }
1491
1492    fn is_closed(&self) -> bool {
1493        self.inner.channel().is_closed()
1494    }
1495    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1496        self.inner.channel().on_closed()
1497    }
1498
1499    #[cfg(target_os = "fuchsia")]
1500    fn signal_peer(
1501        &self,
1502        clear_mask: zx::Signals,
1503        set_mask: zx::Signals,
1504    ) -> Result<(), zx_status::Status> {
1505        use fidl::Peered;
1506        self.inner.channel().signal_peer(clear_mask, set_mask)
1507    }
1508}
1509
1510impl ChildViewWatcherControlHandle {}
1511
1512#[must_use = "FIDL methods require a response to be sent"]
1513#[derive(Debug)]
1514pub struct ChildViewWatcherGetStatusResponder {
1515    control_handle: std::mem::ManuallyDrop<ChildViewWatcherControlHandle>,
1516    tx_id: u32,
1517}
1518
1519/// Set the the channel to be shutdown (see [`ChildViewWatcherControlHandle::shutdown`])
1520/// if the responder is dropped without sending a response, so that the client
1521/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1522impl std::ops::Drop for ChildViewWatcherGetStatusResponder {
1523    fn drop(&mut self) {
1524        self.control_handle.shutdown();
1525        // Safety: drops once, never accessed again
1526        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1527    }
1528}
1529
1530impl fidl::endpoints::Responder for ChildViewWatcherGetStatusResponder {
1531    type ControlHandle = ChildViewWatcherControlHandle;
1532
1533    fn control_handle(&self) -> &ChildViewWatcherControlHandle {
1534        &self.control_handle
1535    }
1536
1537    fn drop_without_shutdown(mut self) {
1538        // Safety: drops once, never accessed again due to mem::forget
1539        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1540        // Prevent Drop from running (which would shut down the channel)
1541        std::mem::forget(self);
1542    }
1543}
1544
1545impl ChildViewWatcherGetStatusResponder {
1546    /// Sends a response to the FIDL transaction.
1547    ///
1548    /// Sets the channel to shutdown if an error occurs.
1549    pub fn send(self, mut status: ChildViewStatus) -> Result<(), fidl::Error> {
1550        let _result = self.send_raw(status);
1551        if _result.is_err() {
1552            self.control_handle.shutdown();
1553        }
1554        self.drop_without_shutdown();
1555        _result
1556    }
1557
1558    /// Similar to "send" but does not shutdown the channel if an error occurs.
1559    pub fn send_no_shutdown_on_err(self, mut status: ChildViewStatus) -> Result<(), fidl::Error> {
1560        let _result = self.send_raw(status);
1561        self.drop_without_shutdown();
1562        _result
1563    }
1564
1565    fn send_raw(&self, mut status: ChildViewStatus) -> Result<(), fidl::Error> {
1566        self.control_handle.inner.send::<ChildViewWatcherGetStatusResponse>(
1567            (status,),
1568            self.tx_id,
1569            0x1d622075f4fc8243,
1570            fidl::encoding::DynamicFlags::empty(),
1571        )
1572    }
1573}
1574
1575#[must_use = "FIDL methods require a response to be sent"]
1576#[derive(Debug)]
1577pub struct ChildViewWatcherGetViewRefResponder {
1578    control_handle: std::mem::ManuallyDrop<ChildViewWatcherControlHandle>,
1579    tx_id: u32,
1580}
1581
1582/// Set the the channel to be shutdown (see [`ChildViewWatcherControlHandle::shutdown`])
1583/// if the responder is dropped without sending a response, so that the client
1584/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1585impl std::ops::Drop for ChildViewWatcherGetViewRefResponder {
1586    fn drop(&mut self) {
1587        self.control_handle.shutdown();
1588        // Safety: drops once, never accessed again
1589        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1590    }
1591}
1592
1593impl fidl::endpoints::Responder for ChildViewWatcherGetViewRefResponder {
1594    type ControlHandle = ChildViewWatcherControlHandle;
1595
1596    fn control_handle(&self) -> &ChildViewWatcherControlHandle {
1597        &self.control_handle
1598    }
1599
1600    fn drop_without_shutdown(mut self) {
1601        // Safety: drops once, never accessed again due to mem::forget
1602        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1603        // Prevent Drop from running (which would shut down the channel)
1604        std::mem::forget(self);
1605    }
1606}
1607
1608impl ChildViewWatcherGetViewRefResponder {
1609    /// Sends a response to the FIDL transaction.
1610    ///
1611    /// Sets the channel to shutdown if an error occurs.
1612    pub fn send(self, mut view_ref: fidl_fuchsia_ui_views::ViewRef) -> Result<(), fidl::Error> {
1613        let _result = self.send_raw(view_ref);
1614        if _result.is_err() {
1615            self.control_handle.shutdown();
1616        }
1617        self.drop_without_shutdown();
1618        _result
1619    }
1620
1621    /// Similar to "send" but does not shutdown the channel if an error occurs.
1622    pub fn send_no_shutdown_on_err(
1623        self,
1624        mut view_ref: fidl_fuchsia_ui_views::ViewRef,
1625    ) -> Result<(), fidl::Error> {
1626        let _result = self.send_raw(view_ref);
1627        self.drop_without_shutdown();
1628        _result
1629    }
1630
1631    fn send_raw(&self, mut view_ref: fidl_fuchsia_ui_views::ViewRef) -> Result<(), fidl::Error> {
1632        self.control_handle.inner.send::<ChildViewWatcherGetViewRefResponse>(
1633            (&mut view_ref,),
1634            self.tx_id,
1635            0x3b2f3ca31e8908b4,
1636            fidl::encoding::DynamicFlags::empty(),
1637        )
1638    }
1639}
1640
1641#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1642pub struct FlatlandMarker;
1643
1644impl fidl::endpoints::ProtocolMarker for FlatlandMarker {
1645    type Proxy = FlatlandProxy;
1646    type RequestStream = FlatlandRequestStream;
1647    #[cfg(target_os = "fuchsia")]
1648    type SynchronousProxy = FlatlandSynchronousProxy;
1649
1650    const DEBUG_NAME: &'static str = "fuchsia.ui.composition.Flatland";
1651}
1652impl fidl::endpoints::DiscoverableProtocolMarker for FlatlandMarker {}
1653
1654pub trait FlatlandProxyInterface: Send + Sync {
1655    fn r#present(&self, args: PresentArgs) -> Result<(), fidl::Error>;
1656    fn r#create_view(
1657        &self,
1658        token: fidl_fuchsia_ui_views::ViewCreationToken,
1659        parent_viewport_watcher: fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>,
1660    ) -> Result<(), fidl::Error>;
1661    fn r#create_view2(
1662        &self,
1663        token: fidl_fuchsia_ui_views::ViewCreationToken,
1664        view_identity: fidl_fuchsia_ui_views::ViewIdentityOnCreation,
1665        protocols: ViewBoundProtocols,
1666        parent_viewport_watcher: fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>,
1667    ) -> Result<(), fidl::Error>;
1668    fn r#create_transform(&self, transform_id: &TransformId) -> Result<(), fidl::Error>;
1669    fn r#set_translation(
1670        &self,
1671        transform_id: &TransformId,
1672        translation: &fidl_fuchsia_math::Vec_,
1673    ) -> Result<(), fidl::Error>;
1674    fn r#set_orientation(
1675        &self,
1676        transform_id: &TransformId,
1677        orientation: Orientation,
1678    ) -> Result<(), fidl::Error>;
1679    fn r#set_scale(
1680        &self,
1681        transform_id: &TransformId,
1682        scale: &fidl_fuchsia_math::VecF,
1683    ) -> Result<(), fidl::Error>;
1684    fn r#set_opacity(&self, transform_id: &TransformId, value: f32) -> Result<(), fidl::Error>;
1685    fn r#set_clip_boundary(
1686        &self,
1687        transform_id: &TransformId,
1688        rect: Option<&fidl_fuchsia_math::Rect>,
1689    ) -> Result<(), fidl::Error>;
1690    fn r#add_child(
1691        &self,
1692        parent_transform_id: &TransformId,
1693        child_transform_id: &TransformId,
1694    ) -> Result<(), fidl::Error>;
1695    fn r#remove_child(
1696        &self,
1697        parent_transform_id: &TransformId,
1698        child_transform_id: &TransformId,
1699    ) -> Result<(), fidl::Error>;
1700    fn r#replace_children(
1701        &self,
1702        parent_transform_id: &TransformId,
1703        new_child_transform_ids: &[TransformId],
1704    ) -> Result<(), fidl::Error>;
1705    fn r#set_root_transform(&self, transform_id: &TransformId) -> Result<(), fidl::Error>;
1706    fn r#set_hit_regions(
1707        &self,
1708        transform_id: &TransformId,
1709        regions: &[HitRegion],
1710    ) -> Result<(), fidl::Error>;
1711    fn r#set_infinite_hit_region(
1712        &self,
1713        transform_id: &TransformId,
1714        hit_test: HitTestInteraction,
1715    ) -> Result<(), fidl::Error>;
1716    fn r#create_viewport(
1717        &self,
1718        viewport_id: &ContentId,
1719        token: fidl_fuchsia_ui_views::ViewportCreationToken,
1720        properties: &ViewportProperties,
1721        child_view_watcher: fidl::endpoints::ServerEnd<ChildViewWatcherMarker>,
1722    ) -> Result<(), fidl::Error>;
1723    fn r#create_image(
1724        &self,
1725        image_id: &ContentId,
1726        import_token: BufferCollectionImportToken,
1727        vmo_index: u32,
1728        properties: &ImageProperties,
1729    ) -> Result<(), fidl::Error>;
1730    fn r#set_image_sample_region(
1731        &self,
1732        image_id: &ContentId,
1733        rect: &fidl_fuchsia_math::RectF,
1734    ) -> Result<(), fidl::Error>;
1735    fn r#set_image_destination_size(
1736        &self,
1737        image_id: &ContentId,
1738        size: &fidl_fuchsia_math::SizeU,
1739    ) -> Result<(), fidl::Error>;
1740    fn r#set_image_blending_function(
1741        &self,
1742        image_id: &ContentId,
1743        blend_mode: BlendMode,
1744    ) -> Result<(), fidl::Error>;
1745    fn r#set_image_blend_mode(
1746        &self,
1747        image_id: &ContentId,
1748        blend_mode: BlendMode2,
1749    ) -> Result<(), fidl::Error>;
1750    fn r#set_image_opacity(&self, image_id: &ContentId, val: f32) -> Result<(), fidl::Error>;
1751    fn r#set_image_flip(&self, image_id: &ContentId, flip: ImageFlip) -> Result<(), fidl::Error>;
1752    fn r#create_filled_rect(&self, rect_id: &ContentId) -> Result<(), fidl::Error>;
1753    fn r#set_solid_fill(
1754        &self,
1755        rect_id: &ContentId,
1756        color: &ColorRgba,
1757        size: &fidl_fuchsia_math::SizeU,
1758    ) -> Result<(), fidl::Error>;
1759    fn r#release_filled_rect(&self, rect_id: &ContentId) -> Result<(), fidl::Error>;
1760    fn r#set_content(
1761        &self,
1762        transform_id: &TransformId,
1763        content_id: &ContentId,
1764    ) -> Result<(), fidl::Error>;
1765    fn r#set_viewport_properties(
1766        &self,
1767        viewport_id: &ContentId,
1768        properties: &ViewportProperties,
1769    ) -> Result<(), fidl::Error>;
1770    fn r#release_transform(&self, transform_id: &TransformId) -> Result<(), fidl::Error>;
1771    fn r#release_view(&self) -> Result<(), fidl::Error>;
1772    type ReleaseViewportResponseFut: std::future::Future<
1773            Output = Result<fidl_fuchsia_ui_views::ViewportCreationToken, fidl::Error>,
1774        > + Send;
1775    fn r#release_viewport(&self, viewport_id: &ContentId) -> Self::ReleaseViewportResponseFut;
1776    fn r#release_image(&self, image_id: &ContentId) -> Result<(), fidl::Error>;
1777    fn r#clear(&self) -> Result<(), fidl::Error>;
1778    fn r#set_debug_name(&self, name: &str) -> Result<(), fidl::Error>;
1779}
1780#[derive(Debug)]
1781#[cfg(target_os = "fuchsia")]
1782pub struct FlatlandSynchronousProxy {
1783    client: fidl::client::sync::Client,
1784}
1785
1786#[cfg(target_os = "fuchsia")]
1787impl fidl::endpoints::SynchronousProxy for FlatlandSynchronousProxy {
1788    type Proxy = FlatlandProxy;
1789    type Protocol = FlatlandMarker;
1790
1791    fn from_channel(inner: fidl::Channel) -> Self {
1792        Self::new(inner)
1793    }
1794
1795    fn into_channel(self) -> fidl::Channel {
1796        self.client.into_channel()
1797    }
1798
1799    fn as_channel(&self) -> &fidl::Channel {
1800        self.client.as_channel()
1801    }
1802}
1803
1804#[cfg(target_os = "fuchsia")]
1805impl FlatlandSynchronousProxy {
1806    pub fn new(channel: fidl::Channel) -> Self {
1807        let protocol_name = <FlatlandMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1808        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1809    }
1810
1811    pub fn into_channel(self) -> fidl::Channel {
1812        self.client.into_channel()
1813    }
1814
1815    /// Waits until an event arrives and returns it. It is safe for other
1816    /// threads to make concurrent requests while waiting for an event.
1817    pub fn wait_for_event(
1818        &self,
1819        deadline: zx::MonotonicInstant,
1820    ) -> Result<FlatlandEvent, fidl::Error> {
1821        FlatlandEvent::decode(self.client.wait_for_event(deadline)?)
1822    }
1823
1824    /// Complete execution of all feed-forward operations.
1825    ///
1826    /// If executing an operation produces an error (e.g., CreateTransform(0)), an [`OnError`] event
1827    /// is emitted. Operations that produce errors are ignored and the channel is closed.
1828    ///
1829    /// If the execution is completed successfully, [`OnNextFrameBegin`] emits NO_ERROR along
1830    /// with other valid fields.
1831    ///
1832    /// The client may only call [`Present`] when they have a non-zero number of present credits,
1833    /// which are tracked by the server. The server may increment the number of credits when it
1834    /// fires the [`OnNextFrameBegin`] event, which informs the client when it receives additional
1835    /// present credits. Each [`Present`] call uses one present credit and decrements the server
1836    /// count by one. If the client calls [`Present`] with no present credits, the server will
1837    /// return a `NO_PRESENTS_REMAINING` error.
1838    ///
1839    /// The client should assume that prior to receiving any [`OnNextFrameBegin`] events, they have
1840    /// one present credit.
1841    ///
1842    /// Every [`Present`] call results in one [`OnNextFrameBegin`] event, and one
1843    /// [`OnFramePresented`] event, typically in that order.
1844    ///
1845    /// When the commands flushed by [`Present`] make it to display, an [`OnFramePresented`] event
1846    /// is fired. This event includes information pertaining to all [`Present`]s that had content
1847    /// that were part of that frame.
1848    ///
1849    /// See [`fuchsia.ui.composition/PresentArgs`] documentation above for more detailed information
1850    /// on what arguments are passed in and their role.
1851    pub fn r#present(&self, mut args: PresentArgs) -> Result<(), fidl::Error> {
1852        self.client.send::<FlatlandPresentRequest>(
1853            (&mut args,),
1854            0x50acc2aa1f0acec7,
1855            fidl::encoding::DynamicFlags::empty(),
1856        )
1857    }
1858
1859    /// Two Flatland instances may be connected in a parent-child relationship. The parent endpoint
1860    /// is held in a Viewport, and the child endpoint is held in a View. The parent Flatland
1861    /// instance that creates a Viewport has control over how the child's View is integrated into
1862    /// its own View.
1863    ///
1864    /// The lifecycle of a parent-child connection starts with two endpoints of a channel object:
1865    /// a ViewportCreationToken and a ViewCreationToken. Out-of-band protocols pass the
1866    /// ViewportCreationToken to the parent, which calls [`CreateViewport`], and the
1867    /// ViewCreationToken to the child, which calls [`CreateView`].
1868    ///
1869    /// Only nodes connected to the Root Transform in this Flatland instance will be rendered into
1870    /// the parent's Viewport.
1871    ///
1872    /// Calling [`CreateView`] a second time will disconnect the Root Transform from the existing
1873    /// parent's Viewport, and attach it to a new parent's Viewport. In other words, each View can
1874    /// only have one parent.
1875    ///
1876    /// This function is queued, meaning that the Root Transform will not be attached to the
1877    /// parent Viewport until [`Present`] is called. However, clients will receive information
1878    /// through their ParentViewportWatcher (e.g., LayoutInfo) immediately after calling this
1879    /// function, even if they have not called [`Present`] or [`SetRootTransform`]. This allows
1880    /// clients to wait for layout information from their parent before calling [`Present`].
1881    ///
1882    /// Any illegal operations on ParentViewportWatcher will cause both ParentViewportWatcher
1883    /// channel and this Flatland channel to be torn down.
1884    ///
1885    /// Lifecycle note. The lifetime of the ParentViewportWatcher channel is bound by the peer
1886    /// ViewportCreationToken. When the ViewportCreationToken dies, this ParentViewportWatcher
1887    /// channel is destroyed.
1888    ///
1889    /// Views and subgraphs of Views created using `CreateView` will not be represented in the
1890    /// ViewTree, and hence will not be able to participate in any ViewTree-dependent interactions
1891    /// such as touch, mouse or focus.
1892    /// The Flatland protocol provides no way for Views in the subgraph of a View created with
1893    /// `CreateView` to know that they are excluded from the ViewTree.
1894    pub fn r#create_view(
1895        &self,
1896        mut token: fidl_fuchsia_ui_views::ViewCreationToken,
1897        mut parent_viewport_watcher: fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>,
1898    ) -> Result<(), fidl::Error> {
1899        self.client.send::<FlatlandCreateViewRequest>(
1900            (&mut token, parent_viewport_watcher),
1901            0x504686eb25864780,
1902            fidl::encoding::DynamicFlags::empty(),
1903        )
1904    }
1905
1906    /// Identical to [`CreateView`], except it allows association of View identity (ViewRef) and
1907    /// view-bound protocols.
1908    pub fn r#create_view2(
1909        &self,
1910        mut token: fidl_fuchsia_ui_views::ViewCreationToken,
1911        mut view_identity: fidl_fuchsia_ui_views::ViewIdentityOnCreation,
1912        mut protocols: ViewBoundProtocols,
1913        mut parent_viewport_watcher: fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>,
1914    ) -> Result<(), fidl::Error> {
1915        self.client.send::<FlatlandCreateView2Request>(
1916            (&mut token, &mut view_identity, &mut protocols, parent_viewport_watcher),
1917            0x340a3a40c2fdbd5e,
1918            fidl::encoding::DynamicFlags::empty(),
1919        )
1920    }
1921
1922    /// Creates a new Transform node. Transforms are a hierarchical piece of a Flatland graph. They
1923    /// can have children, and can reference Content. A sub-graph represented by a Transform and its
1924    /// descendants can be rendered to a display.
1925    ///
1926    /// Transforms are kept alive, even when released, as long as they are children of either an
1927    /// unreleased Transform, or the Root Transform.
1928    ///
1929    /// Each Transform can have a single piece of attached Content. Common types of Content include
1930    /// bitmaps, asynchronous streams of images, and Viewports to Views hosted in other Flatland
1931    /// instances.
1932    ///
1933    /// Transforms have attributes. Child Transforms inherit the combined attributes of their
1934    /// parents. Content attached to a Transform is also affected by that Transform's attributes.
1935    ///
1936    /// When a sub-graph of Transforms is rendered, Content will be rendered back-to-front, starting
1937    /// with the Content on the root transform, and continuing recursively through all of its child
1938    /// Transforms in the order the children were added. See [`AddChild`] for more information.
1939    ///
1940    /// Zero is not a valid transform id. All other values are valid, assuming they are not already
1941    /// in use (see [`ReleaseTransform`] for more details).
1942    pub fn r#create_transform(&self, mut transform_id: &TransformId) -> Result<(), fidl::Error> {
1943        self.client.send::<FlatlandCreateTransformRequest>(
1944            (transform_id,),
1945            0x5e042a4d3de3efb0,
1946            fidl::encoding::DynamicFlags::empty(),
1947        )
1948    }
1949
1950    /// All Transform objects support all attributes.
1951    ///
1952    /// Geometric attributes are applied in the following order:
1953    /// 1. Scale (relative to the parent transform's coordinate space)
1954    /// 2. Orientation (relative to the parent transform's coordinate space)
1955    /// 3. Translation (relative to the parent transforms's coordinate space,
1956    ///    unaffected by scale applied to the current transform).
1957    /// 4. Clipping (relative to the current transform's coordinate space)
1958    ///
1959    /// The effects of each of these attributes are cumulative. This means the transform's position
1960    /// in the view space, and its clip boundary, will be calculated based on that chain of
1961    /// geometric attributes going up to the root transform.
1962    ///
1963    /// For instance, in a nested hierarchy such as the following:
1964    ///     [Root-Transform -> Transform1 -> Transform2 -> CurrentTransform]
1965    /// If Transform1 is translated by [2,0] and Transform2 is translated by [0,1] then the
1966    /// view-space position of CurrentTransform will be [2,1].
1967    ///
1968    /// Sets the translation on a Transform. The order of geometric attribute application is
1969    /// addressed above.
1970    pub fn r#set_translation(
1971        &self,
1972        mut transform_id: &TransformId,
1973        mut translation: &fidl_fuchsia_math::Vec_,
1974    ) -> Result<(), fidl::Error> {
1975        self.client.send::<FlatlandSetTranslationRequest>(
1976            (transform_id, translation),
1977            0x7863398291fba346,
1978            fidl::encoding::DynamicFlags::empty(),
1979        )
1980    }
1981
1982    /// Sets the orientation on a Transform. The order of geometric attribute application is
1983    /// addressed in the documentation for [`SetTranslation`]. In Flatland, the +X axis is
1984    /// to the right and the +Y axis is down. There is no notion of a Z axis. CCW is defined
1985    /// from the POV of the user, as if a skeuomorphoic clock is displayed on the screen.
1986    pub fn r#set_orientation(
1987        &self,
1988        mut transform_id: &TransformId,
1989        mut orientation: Orientation,
1990    ) -> Result<(), fidl::Error> {
1991        self.client.send::<FlatlandSetOrientationRequest>(
1992            (transform_id, orientation),
1993            0x4915310bc4928edc,
1994            fidl::encoding::DynamicFlags::empty(),
1995        )
1996    }
1997
1998    /// Sets the scale on a transform. The order of geometric attribute application is
1999    /// addressed above. The (x,y) values in the VecF |scale| refer to the scale factor in the
2000    /// x-axis (width) and y-axis (height) respectively. Scale values must be normal 32-bit
2001    /// floating point values: https://en.wikipedia.org/wiki/Normal_number_%28computing%29
2002    pub fn r#set_scale(
2003        &self,
2004        mut transform_id: &TransformId,
2005        mut scale: &fidl_fuchsia_math::VecF,
2006    ) -> Result<(), fidl::Error> {
2007        self.client.send::<FlatlandSetScaleRequest>(
2008            (transform_id, scale),
2009            0x1ea1766fd8996bb4,
2010            fidl::encoding::DynamicFlags::empty(),
2011        )
2012    }
2013
2014    /// Sets an opacity in linear space to be applied to a transform and its descendents,
2015    /// which include other transforms and content. Opacity values must be in the range
2016    /// of [0.0, 1.0], where 0.0 is completely transparent and 1.0 is completely opaque.
2017    /// Attempting to call this function with values outside that range will result in
2018    /// an error. A transform's opacity value is multiplied with that of its parent. This
2019    /// effect works differently from group opacity. Using group opacity, child nodes are
2020    /// rendered together first, and then have the parent's opacity applied as a post-effect.
2021    /// Here, opacity is applied to each child individually. This may result in a very
2022    /// different effect.
2023    pub fn r#set_opacity(
2024        &self,
2025        mut transform_id: &TransformId,
2026        mut value: f32,
2027    ) -> Result<(), fidl::Error> {
2028        self.client.send::<FlatlandSetOpacityRequest>(
2029            (transform_id, value),
2030            0x3775fc2c00b432fa,
2031            fidl::encoding::DynamicFlags::empty(),
2032        )
2033    }
2034
2035    /// Sets the bounds, expressed in the local coordinate space of the transform, that
2036    /// constrains the region that content attached to this transform can be rendered to.
2037    /// If the content's area exceeds the clip bounds, the area outside the bounds will
2038    /// not be rendered. These bounds are valid for all children of this transform node as
2039    /// well, which includes nested Flatland instances and their node hierarchies.
2040    /// If a child transform attempts to set clip bounds larger than that of its parent,
2041    /// it will be clipped to the parent's clip bounds. The default state is for a transform
2042    /// to be unclipped, meaning it will not have any bounds placed on its render region.
2043    /// The clip width/height must be positive. Negative values will result in an error.
2044    /// Passing in an empty box to the |rect| parameter will remove the clip bounds.
2045    pub fn r#set_clip_boundary(
2046        &self,
2047        mut transform_id: &TransformId,
2048        mut rect: Option<&fidl_fuchsia_math::Rect>,
2049    ) -> Result<(), fidl::Error> {
2050        self.client.send::<FlatlandSetClipBoundaryRequest>(
2051            (transform_id, rect),
2052            0x6507843df12222d2,
2053            fidl::encoding::DynamicFlags::empty(),
2054        )
2055    }
2056
2057    /// Adds a child Transform to a parent Transform. The new child Transform, and any Content
2058    /// attached to it or its children, will be rendered on top of the parent's Content, as well as
2059    /// any previously added children.
2060    pub fn r#add_child(
2061        &self,
2062        mut parent_transform_id: &TransformId,
2063        mut child_transform_id: &TransformId,
2064    ) -> Result<(), fidl::Error> {
2065        self.client.send::<FlatlandAddChildRequest>(
2066            (parent_transform_id, child_transform_id),
2067            0x67a8abd2f19b1a74,
2068            fidl::encoding::DynamicFlags::empty(),
2069        )
2070    }
2071
2072    /// Removes a child Transform from a parent Transform.
2073    pub fn r#remove_child(
2074        &self,
2075        mut parent_transform_id: &TransformId,
2076        mut child_transform_id: &TransformId,
2077    ) -> Result<(), fidl::Error> {
2078        self.client.send::<FlatlandRemoveChildRequest>(
2079            (parent_transform_id, child_transform_id),
2080            0x41d6cd90b298b67a,
2081            fidl::encoding::DynamicFlags::empty(),
2082        )
2083    }
2084
2085    /// Removes all child Transforms from a parent Transform and replaces them with the new child
2086    /// transforms in `new_child_transform_ids`.
2087    pub fn r#replace_children(
2088        &self,
2089        mut parent_transform_id: &TransformId,
2090        mut new_child_transform_ids: &[TransformId],
2091    ) -> Result<(), fidl::Error> {
2092        self.client.send::<FlatlandReplaceChildrenRequest>(
2093            (parent_transform_id, new_child_transform_ids),
2094            0x5b6d86cbbff81316,
2095            fidl::encoding::DynamicFlags::empty(),
2096        )
2097    }
2098
2099    /// Sets the Root Transform for the graph.
2100    ///
2101    /// The sub-graph defined by the Root Transform and its children will be rendered as View
2102    /// in the connected parent's Viewport (see [`CreateView`]). Any parents of the Root Transform
2103    /// in this Graph will be ignored.
2104    ///
2105    /// The Root Transform, and all children of the Root Transform, are kept alive if they are
2106    /// released (see [`ReleaseTransform`] for more details).
2107    ///
2108    /// There is only ever one Root. Since 0 is not a valid transform id (see [`CreateTransform`]),
2109    /// calling SetRootTransform(0) clears the current Root, destroying any previously released
2110    /// objects that are not referenced by the new root.
2111    ///
2112    /// Note that every View has a clip boundary equivalent to its logical size. Anything outside
2113    /// that clip boundary will not be rendered. Hence, the Root Transform has a useful coordinate
2114    /// space of (0, 0) to (logical_size.width, logical_size.height), where (0, 0) is the upper left
2115    /// corner.
2116    ///
2117    /// Setting the root transform installs a full screen hit region on the root transform. Clients
2118    /// may remove this hit region if they don't want users to be able to interact with the root
2119    /// transform's content. For additional details on hit regions, see the [`SetHitRegions`]
2120    /// documentation.
2121    ///
2122    /// Default hit region rules
2123    ///
2124    ///   A default hit region follows these rules:
2125    ///   - When [`SetRootTransform`](T) is called, T receives a maximal hit region, covering the
2126    ///   entire view.
2127    ///   - If [`SetHitRegions`] is called on T, either before or after [`SetRootTransform`](T),
2128    ///   then no default hit region is active and the client specified hit regions are used.
2129    ///   - If a transform is no longer the root transform, i.e., [`SetRootTransform`](U) is
2130    ///   called, then the original transform no longer has its default hit region.
2131    ///   - Clients can remove or modify the root transform's hit regions the same way they would
2132    ///   reset any other transform's hit regions, by calling [`SetHitRegions`] with the appropriate
2133    ///   vector.
2134    pub fn r#set_root_transform(&self, mut transform_id: &TransformId) -> Result<(), fidl::Error> {
2135        self.client.send::<FlatlandSetRootTransformRequest>(
2136            (transform_id,),
2137            0x6e80ca5bcc566cd8,
2138            fidl::encoding::DynamicFlags::empty(),
2139        )
2140    }
2141
2142    /// Sets the interactive areas for a Transform. By default, Content is not interactive; hit
2143    /// regions must be placed for a user to interact with the Content in a View. Because hit
2144    /// regions are described in the Flatland protocol, a Flatland instance can synchronize Content
2145    /// and hit regions.
2146    ///
2147    /// Each hit region is placed in the coordinate space of the owning Transform, and may or may
2148    /// not interact with different types of hit testing, depending on its [`HitTestInteraction`]
2149    /// type. When there are multiple hit regions that intersect with a hit test, the precedence
2150    /// rules given below dictate which hit region has interacted with the hit test. Only Transforms
2151    /// that transitively connect to the root Transform have their hit regions interact with a hit
2152    /// test.
2153    ///
2154    /// Calling this function replaces any previous values set on this Transform. To reset a
2155    /// Transform to "no hit testing": send an empty vector with [`SetHitRegions`].
2156    ///
2157    /// Note that root transforms get a default hit region installed by Flatland. For more details,
2158    /// see the [`SetRootTransform`] documentation.
2159    ///
2160    /// Precedence rules
2161    ///   Within a Transform, if multiple hit regions overlap, the hit test examines each
2162    ///   intersecting hit region for a possible interaction. Thus, for a regular hit test R and an
2163    ///   accessibility hit test A, where R and A both intersect two hit regions D ([`DEFAULT`]) and
2164    ///   S ([`SEMANTICALLY_INVISIBLE`]) on the same Transform, (1) R interacts with both D and S,
2165    ///   and (2) A only interacts with D. Generally, hit regions that overlap in a single Transform
2166    ///   can cause confusing behavior.
2167    ///
2168    ///   Within a View, for a given hit test, the front-most Transform's hit regions take
2169    ///   precedence over those behind. This follows the expected reverse "render order" of
2170    ///   Transforms (described in [`CreateTransform`]), where a user expects to interact with
2171    ///   Content that is visible, or front-most.
2172    ///
2173    ///   Across Flatland instances, for a given hit test, the front-most instance's front-most
2174    ///   Transform's hit regions take precedence over those behind. This follows the expected
2175    ///   reverse "render order" of views, where a user expects to interact with the View that is
2176    ///   visible, or front-most. For example, if a child View owns Content that is rendered over
2177    ///   the parent View, the user expects to interact with the child's Content.
2178    pub fn r#set_hit_regions(
2179        &self,
2180        mut transform_id: &TransformId,
2181        mut regions: &[HitRegion],
2182    ) -> Result<(), fidl::Error> {
2183        self.client.send::<FlatlandSetHitRegionsRequest>(
2184            (transform_id, regions),
2185            0x31c9d17b07c37ce4,
2186            fidl::encoding::DynamicFlags::empty(),
2187        )
2188    }
2189
2190    /// Identical to [`SetHitRegions`], except the hit region associated with [`transform_id`]
2191    /// covers an infinite region. The hit region is invariant against translation, scaling, and
2192    /// orientation of the Transform.
2193    ///
2194    /// An infinite hit region is still limited in extent by the View's clip boundary, just like a
2195    /// finite hit region.
2196    ///
2197    /// Calling this function replaces any previous values set on this Transform. To reset a
2198    /// Transform to "no hit testing": send an empty vector with [`SetHitRegions`].
2199    pub fn r#set_infinite_hit_region(
2200        &self,
2201        mut transform_id: &TransformId,
2202        mut hit_test: HitTestInteraction,
2203    ) -> Result<(), fidl::Error> {
2204        self.client.send::<FlatlandSetInfiniteHitRegionRequest>(
2205            (transform_id, hit_test),
2206            0x26d81af852d29562,
2207            fidl::encoding::DynamicFlags::empty(),
2208        )
2209    }
2210
2211    /// The Viewport and View pair, together, represent the connection between two Flatland
2212    /// instances. The Viewport is created in the parent, and the View is created in the child. The
2213    /// parent has control over how the child's View is integrated into its own View.
2214    ///
2215    /// Any illegal operations on ChildViewWatcher will cause both ChildViewWatcher channel and this
2216    /// Flatland channel to be torn down.
2217    ///
2218    /// `ViewportProperties` must have logical_size set. This is the initial size that will drive
2219    /// the layout of the child. The logical_size is also used as the default Content size, but
2220    /// subsequent changes to the logical_size will have no effect on the Content size.
2221    ///
2222    /// `ViewportProperties` may have inset field not set. In that case, the default value of
2223    /// (0, 0, 0, 0) is used.
2224    ///
2225    /// The logical_size must have positive X and Y components.
2226    ///
2227    /// Zero is not a valid ContentId. All other values are valid, assuming they are not already
2228    /// in use for another piece of Content (see [`ReleaseViewport`] for more details).
2229    ///
2230    /// Lifecycle note. The lifetime of the ChildViewWatcher channel is bound by the peer
2231    /// ViewCreationToken. When the ViewCreationToken dies, this ChildViewWatcher channel is
2232    /// destroyed.
2233    pub fn r#create_viewport(
2234        &self,
2235        mut viewport_id: &ContentId,
2236        mut token: fidl_fuchsia_ui_views::ViewportCreationToken,
2237        mut properties: &ViewportProperties,
2238        mut child_view_watcher: fidl::endpoints::ServerEnd<ChildViewWatcherMarker>,
2239    ) -> Result<(), fidl::Error> {
2240        self.client.send::<FlatlandCreateViewportRequest>(
2241            (viewport_id, &mut token, properties, child_view_watcher),
2242            0x2485fbcab7f943c,
2243            fidl::encoding::DynamicFlags::empty(),
2244        )
2245    }
2246
2247    /// An Image is a bitmap backed by a specific VMO in a BufferCollection.
2248    ///
2249    /// Image creation requires an allocated BufferCollection registered with Allocator. This
2250    /// function will fail unless all clients of the specified BufferCollection have set their
2251    /// constraints.
2252    ///
2253    /// The Image must reference a valid VMO index and must have ImageProperties that fall within
2254    /// the constraints specified by the backing BufferCollection (i.e. width and height within a
2255    /// valid range, etc.)
2256    ///
2257    /// Zero is not a valid Image id. All other values are valid, assuming they are not already in
2258    /// use for another piece of Content (see [`ReleaseImage`] for more details).
2259    pub fn r#create_image(
2260        &self,
2261        mut image_id: &ContentId,
2262        mut import_token: BufferCollectionImportToken,
2263        mut vmo_index: u32,
2264        mut properties: &ImageProperties,
2265    ) -> Result<(), fidl::Error> {
2266        self.client.send::<FlatlandCreateImageRequest>(
2267            (image_id, &mut import_token, vmo_index, properties),
2268            0x26fae823c4ebedad,
2269            fidl::encoding::DynamicFlags::empty(),
2270        )
2271    }
2272
2273    /// This function is used to determine the region (in texel space) of an image that will be used
2274    /// by Flatland when rendering. The image to be sampled is referenced by [`image_id`] and the
2275    /// sample region is specified by [`rect`] which itself is comprised of an origin point (x,y) as
2276    /// well as a width and height, in unnormalized coordinates. It is illegal to call this function
2277    /// on non-image content, or to sample a region outside of the texel space of the image. In
2278    /// other words, the region specifed by [`rect`] must not exceed the ranges (0, image_width) and
2279    /// (0, image_height). If (rect.x + rect.width > image_width) or (rect.y + rect.height >
2280    /// image_height) or if any of the values are negative, this will result in an error.
2281    ///
2282    /// If this method is not called, the default sample region is the rectangle with origin at
2283    /// (0, 0) and width and height set at ImageProperties from [`CreateImage`].
2284    pub fn r#set_image_sample_region(
2285        &self,
2286        mut image_id: &ContentId,
2287        mut rect: &fidl_fuchsia_math::RectF,
2288    ) -> Result<(), fidl::Error> {
2289        self.client.send::<FlatlandSetImageSampleRegionRequest>(
2290            (image_id, rect),
2291            0x8039391d715eb28,
2292            fidl::encoding::DynamicFlags::empty(),
2293        )
2294    }
2295
2296    /// The content size for an Image is the size of the rectangle in the parent's logical
2297    /// coordinate space that the image occupies. This combined with the global translation of the
2298    /// transform it is attached to determines the size and location of where the content is
2299    /// rendered on the display.
2300    ///
2301    /// If this method is not called, the default image destination size is the width and height set
2302    /// at ImageProperties from [`CreateImage`]. The destination size will be affected by scaling if
2303    /// [`SetScale`] is used on the attached Transform or its parents.
2304    pub fn r#set_image_destination_size(
2305        &self,
2306        mut image_id: &ContentId,
2307        mut size: &fidl_fuchsia_math::SizeU,
2308    ) -> Result<(), fidl::Error> {
2309        self.client.send::<FlatlandSetImageDestinationSizeRequest>(
2310            (image_id, size),
2311            0x766cf99a2ec58446,
2312            fidl::encoding::DynamicFlags::empty(),
2313        )
2314    }
2315
2316    /// Determines the blend function to use when rendering the content specified by
2317    /// |image_id|. |image_id| must be a valid ContentId associated to a transform through
2318    /// a call to |CreateImage| or |CreateFilledRect|. For details on the different blend functions
2319    /// that are available, please refer to the BlendMode enum. If this function is not called, then
2320    /// the default blendmode is BlendMode::SRC.
2321    pub fn r#set_image_blending_function(
2322        &self,
2323        mut image_id: &ContentId,
2324        mut blend_mode: BlendMode,
2325    ) -> Result<(), fidl::Error> {
2326        self.client.send::<FlatlandSetImageBlendingFunctionRequest>(
2327            (image_id, blend_mode),
2328            0x10f5da1356275b7b,
2329            fidl::encoding::DynamicFlags::empty(),
2330        )
2331    }
2332
2333    /// Determines the blend function to use when rendering the content specified by
2334    /// |image_id|. |image_id| must be a valid ContentId associated to a transform through
2335    /// a call to |CreateImage| or |CreateFilledRect|. For details on the different blend functions
2336    /// that are available, please refer to the BlendMode2 enum. If this function is not called,
2337    /// the default blendmode is BlendMode2::REPLACE.
2338    pub fn r#set_image_blend_mode(
2339        &self,
2340        mut image_id: &ContentId,
2341        mut blend_mode: BlendMode2,
2342    ) -> Result<(), fidl::Error> {
2343        self.client.send::<FlatlandSetImageBlendModeRequest>(
2344            (image_id, blend_mode),
2345            0x5b1667f130c3de67,
2346            fidl::encoding::DynamicFlags::empty(),
2347        )
2348    }
2349
2350    /// Sets an opacity in linear space to be applied to a flatland image. Opacity values must
2351    /// be in the range [0.0, 1.0].
2352    pub fn r#set_image_opacity(
2353        &self,
2354        mut image_id: &ContentId,
2355        mut val: f32,
2356    ) -> Result<(), fidl::Error> {
2357        self.client.send::<FlatlandSetImageOpacityRequest>(
2358            (image_id, val),
2359            0x2da9e4ef4c2cff6f,
2360            fidl::encoding::DynamicFlags::empty(),
2361        )
2362    }
2363
2364    /// Sets the image flip to be applied to a flatland image. This call must be performed after a
2365    /// successful |CreateImage| call. If an invalid |image_id| is supplied, the channel will be
2366    /// closed due to FlatlandError::BAD_OPERATION. This flip will be applied to the Image before
2367    /// parent Transform Orientations. If this function is not called, then the default flip value
2368    /// is ImageFlip::NONE.
2369    pub fn r#set_image_flip(
2370        &self,
2371        mut image_id: &ContentId,
2372        mut flip: ImageFlip,
2373    ) -> Result<(), fidl::Error> {
2374        self.client.send::<FlatlandSetImageFlipRequest>(
2375            (image_id, flip),
2376            0x21b20f2c14aae6bc,
2377            fidl::encoding::DynamicFlags::empty(),
2378        )
2379    }
2380
2381    /// Creates a solid-color rectangle. By default a filled-rect does not have a defined
2382    /// color or size. It is necessary to call |SetSolidFill| to specify a color and size
2383    /// before a filled rect can be used for rendering. Not doing so will result the
2384    pub fn r#create_filled_rect(&self, mut rect_id: &ContentId) -> Result<(), fidl::Error> {
2385        self.client.send::<FlatlandCreateFilledRectRequest>(
2386            (rect_id,),
2387            0x5e62355abc1c4c5d,
2388            fidl::encoding::DynamicFlags::empty(),
2389        )
2390    }
2391
2392    /// Defines the color and size of a filled rect. |rect_id| must refer to content that
2393    /// was created via a call to CreateFilledRect. The color is not premultiplied. Color values
2394    /// must be within the range [0,1] inclusive, and normal 32-bit
2395    /// floating point values: https://en.wikipedia.org/wiki/Normal_number_%28computing%29. Values
2396    /// that do not conform to these specifications will cause the channel to close.
2397    /// The rectangle's top left corner will be at (0, 0) in its transform's coordinate space.
2398    /// Hence, its bottom right corner will be at (size.width, size.height).
2399    pub fn r#set_solid_fill(
2400        &self,
2401        mut rect_id: &ContentId,
2402        mut color: &ColorRgba,
2403        mut size: &fidl_fuchsia_math::SizeU,
2404    ) -> Result<(), fidl::Error> {
2405        self.client.send::<FlatlandSetSolidFillRequest>(
2406            (rect_id, color, size),
2407            0x32d6ef41e182dfa5,
2408            fidl::encoding::DynamicFlags::empty(),
2409        )
2410    }
2411
2412    /// Automatically garbage collects the rectangle when it is no longer needed for
2413    /// rendering. |rect_id| must have been instantiated with a call to
2414    /// |CreateFilledRect|. Once released, the ID immediately goes out of scope and is free
2415    /// to be used again.
2416    pub fn r#release_filled_rect(&self, mut rect_id: &ContentId) -> Result<(), fidl::Error> {
2417        self.client.send::<FlatlandReleaseFilledRectRequest>(
2418            (rect_id,),
2419            0x7392cabe45618f9b,
2420            fidl::encoding::DynamicFlags::empty(),
2421        )
2422    }
2423
2424    /// Setting a piece of Content on a Transform makes that Content visible in the render tree as
2425    /// long as the Transform is visible from the root Transform. The Content will be rendered
2426    /// before, and therefore "behind", any Content attached to the descendants of the Transform.
2427    ///
2428    /// Because each Transform can have, at most, a single piece of Content on it, calling this
2429    /// function on a Transform that already has Content will replace that Content.
2430    ///
2431    /// A Content may be set on more than one Transform.
2432    ///
2433    /// Calling this function with a Content id of 0 will remove any Content currently on the
2434    /// Transform.
2435    pub fn r#set_content(
2436        &self,
2437        mut transform_id: &TransformId,
2438        mut content_id: &ContentId,
2439    ) -> Result<(), fidl::Error> {
2440        self.client.send::<FlatlandSetContentRequest>(
2441            (transform_id, content_id),
2442            0x4ed2cfc0ce130862,
2443            fidl::encoding::DynamicFlags::empty(),
2444        )
2445    }
2446
2447    /// Transforms are usually sufficient to change how Content is presented. Viewports, however,
2448    /// have special properties that are not part of the Transform hierarchy. Those properties can
2449    /// be set using this function.
2450    pub fn r#set_viewport_properties(
2451        &self,
2452        mut viewport_id: &ContentId,
2453        mut properties: &ViewportProperties,
2454    ) -> Result<(), fidl::Error> {
2455        self.client.send::<FlatlandSetViewportPropertiesRequest>(
2456            (viewport_id, properties),
2457            0x66ab67e9608ddb9f,
2458            fidl::encoding::DynamicFlags::empty(),
2459        )
2460    }
2461
2462    /// Released Transforms will be garbage collected by the system once they are no longer
2463    /// necessary for rendering. For Transforms, this means there is no path from any unreleased
2464    /// Transform to the newly-released Transform.
2465    ///
2466    /// Once released, the id immediately goes out of scope for future function calls and can be
2467    /// reused when creating new Transforms.
2468    ///
2469    /// It is an error to call functions with a released id (unless that id has been reused to
2470    /// construct a new Transform).
2471    pub fn r#release_transform(&self, mut transform_id: &TransformId) -> Result<(), fidl::Error> {
2472        self.client.send::<FlatlandReleaseTransformRequest>(
2473            (transform_id,),
2474            0xab9328419451c22,
2475            fidl::encoding::DynamicFlags::empty(),
2476        )
2477    }
2478
2479    pub fn r#release_view(&self) -> Result<(), fidl::Error> {
2480        self.client.send::<fidl::encoding::EmptyPayload>(
2481            (),
2482            0x5b35aab9baffecae,
2483            fidl::encoding::DynamicFlags::empty(),
2484        )
2485    }
2486
2487    /// Releases a Viewport from the scene, even if the Viewport is still connected to a Transform.
2488    /// Unlike other resources, Viewports are garbage collected by the system during the next
2489    /// [`Present`] because a removed Viewport is guaranteed to provide no renderable content.
2490    ///
2491    /// Use SetContent(transform_id, 0) to clean up references to released Viewports.
2492    ///
2493    /// Despite having a return type, this function is still feed-forward like [`CreateView`] and
2494    /// requires a call to [`Present`] to be executed. The ViewportCreationToken will be returned
2495    /// after the presented operations have been executed.
2496    pub fn r#release_viewport(
2497        &self,
2498        mut viewport_id: &ContentId,
2499        ___deadline: zx::MonotonicInstant,
2500    ) -> Result<fidl_fuchsia_ui_views::ViewportCreationToken, fidl::Error> {
2501        let _response = self
2502            .client
2503            .send_query::<FlatlandReleaseViewportRequest, FlatlandReleaseViewportResponse>(
2504                (viewport_id,),
2505                0xbad474aeb5293f9,
2506                fidl::encoding::DynamicFlags::empty(),
2507                ___deadline,
2508            )?;
2509        Ok(_response.token)
2510    }
2511
2512    /// Released Images will be garbage collected by the system once they are no longer necessary
2513    /// for rendering. For Images, this means the Image is no longer attached to any Transform and
2514    /// any pending rendering that references the Image is complete.
2515    ///
2516    /// Use SetContent(transform_id, 0) to clean up references to released Images.
2517    ///
2518    /// Once released, the id immediately goes out of scope for future function calls and can be
2519    /// reused when creating new Images.
2520    ///
2521    /// It is an error to call functions with a released id (unless that id has been reused to
2522    /// construct a new Image).
2523    pub fn r#release_image(&self, mut image_id: &ContentId) -> Result<(), fidl::Error> {
2524        self.client.send::<FlatlandReleaseImageRequest>(
2525            (image_id,),
2526            0xb884ffdbc72c111,
2527            fidl::encoding::DynamicFlags::empty(),
2528        )
2529    }
2530
2531    /// This function will reset all state on this interface. This includes destroying all existing
2532    /// View and Viewports without returning the associated Token to the caller.
2533    pub fn r#clear(&self) -> Result<(), fidl::Error> {
2534        self.client.send::<fidl::encoding::EmptyPayload>(
2535            (),
2536            0x4ec8817c02828c3e,
2537            fidl::encoding::DynamicFlags::empty(),
2538        )
2539    }
2540
2541    /// Set debug name of the current client that can be used by Flatland to print as a prefix to
2542    /// logs to help client distinguish what is theirs. [`name`] can be an arbitrary string, but the
2543    /// current process name (see fsl::GetCurrentProcessName()) is a good default.
2544    pub fn r#set_debug_name(&self, mut name: &str) -> Result<(), fidl::Error> {
2545        self.client.send::<FlatlandSetDebugNameRequest>(
2546            (name,),
2547            0x46a8b397e68a8888,
2548            fidl::encoding::DynamicFlags::empty(),
2549        )
2550    }
2551}
2552
2553#[cfg(target_os = "fuchsia")]
2554impl From<FlatlandSynchronousProxy> for zx::Handle {
2555    fn from(value: FlatlandSynchronousProxy) -> Self {
2556        value.into_channel().into()
2557    }
2558}
2559
2560#[cfg(target_os = "fuchsia")]
2561impl From<fidl::Channel> for FlatlandSynchronousProxy {
2562    fn from(value: fidl::Channel) -> Self {
2563        Self::new(value)
2564    }
2565}
2566
2567#[cfg(target_os = "fuchsia")]
2568impl fidl::endpoints::FromClient for FlatlandSynchronousProxy {
2569    type Protocol = FlatlandMarker;
2570
2571    fn from_client(value: fidl::endpoints::ClientEnd<FlatlandMarker>) -> Self {
2572        Self::new(value.into_channel())
2573    }
2574}
2575
2576#[derive(Debug, Clone)]
2577pub struct FlatlandProxy {
2578    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2579}
2580
2581impl fidl::endpoints::Proxy for FlatlandProxy {
2582    type Protocol = FlatlandMarker;
2583
2584    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2585        Self::new(inner)
2586    }
2587
2588    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2589        self.client.into_channel().map_err(|client| Self { client })
2590    }
2591
2592    fn as_channel(&self) -> &::fidl::AsyncChannel {
2593        self.client.as_channel()
2594    }
2595}
2596
2597impl FlatlandProxy {
2598    /// Create a new Proxy for fuchsia.ui.composition/Flatland.
2599    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2600        let protocol_name = <FlatlandMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2601        Self { client: fidl::client::Client::new(channel, protocol_name) }
2602    }
2603
2604    /// Get a Stream of events from the remote end of the protocol.
2605    ///
2606    /// # Panics
2607    ///
2608    /// Panics if the event stream was already taken.
2609    pub fn take_event_stream(&self) -> FlatlandEventStream {
2610        FlatlandEventStream { event_receiver: self.client.take_event_receiver() }
2611    }
2612
2613    /// Complete execution of all feed-forward operations.
2614    ///
2615    /// If executing an operation produces an error (e.g., CreateTransform(0)), an [`OnError`] event
2616    /// is emitted. Operations that produce errors are ignored and the channel is closed.
2617    ///
2618    /// If the execution is completed successfully, [`OnNextFrameBegin`] emits NO_ERROR along
2619    /// with other valid fields.
2620    ///
2621    /// The client may only call [`Present`] when they have a non-zero number of present credits,
2622    /// which are tracked by the server. The server may increment the number of credits when it
2623    /// fires the [`OnNextFrameBegin`] event, which informs the client when it receives additional
2624    /// present credits. Each [`Present`] call uses one present credit and decrements the server
2625    /// count by one. If the client calls [`Present`] with no present credits, the server will
2626    /// return a `NO_PRESENTS_REMAINING` error.
2627    ///
2628    /// The client should assume that prior to receiving any [`OnNextFrameBegin`] events, they have
2629    /// one present credit.
2630    ///
2631    /// Every [`Present`] call results in one [`OnNextFrameBegin`] event, and one
2632    /// [`OnFramePresented`] event, typically in that order.
2633    ///
2634    /// When the commands flushed by [`Present`] make it to display, an [`OnFramePresented`] event
2635    /// is fired. This event includes information pertaining to all [`Present`]s that had content
2636    /// that were part of that frame.
2637    ///
2638    /// See [`fuchsia.ui.composition/PresentArgs`] documentation above for more detailed information
2639    /// on what arguments are passed in and their role.
2640    pub fn r#present(&self, mut args: PresentArgs) -> Result<(), fidl::Error> {
2641        FlatlandProxyInterface::r#present(self, args)
2642    }
2643
2644    /// Two Flatland instances may be connected in a parent-child relationship. The parent endpoint
2645    /// is held in a Viewport, and the child endpoint is held in a View. The parent Flatland
2646    /// instance that creates a Viewport has control over how the child's View is integrated into
2647    /// its own View.
2648    ///
2649    /// The lifecycle of a parent-child connection starts with two endpoints of a channel object:
2650    /// a ViewportCreationToken and a ViewCreationToken. Out-of-band protocols pass the
2651    /// ViewportCreationToken to the parent, which calls [`CreateViewport`], and the
2652    /// ViewCreationToken to the child, which calls [`CreateView`].
2653    ///
2654    /// Only nodes connected to the Root Transform in this Flatland instance will be rendered into
2655    /// the parent's Viewport.
2656    ///
2657    /// Calling [`CreateView`] a second time will disconnect the Root Transform from the existing
2658    /// parent's Viewport, and attach it to a new parent's Viewport. In other words, each View can
2659    /// only have one parent.
2660    ///
2661    /// This function is queued, meaning that the Root Transform will not be attached to the
2662    /// parent Viewport until [`Present`] is called. However, clients will receive information
2663    /// through their ParentViewportWatcher (e.g., LayoutInfo) immediately after calling this
2664    /// function, even if they have not called [`Present`] or [`SetRootTransform`]. This allows
2665    /// clients to wait for layout information from their parent before calling [`Present`].
2666    ///
2667    /// Any illegal operations on ParentViewportWatcher will cause both ParentViewportWatcher
2668    /// channel and this Flatland channel to be torn down.
2669    ///
2670    /// Lifecycle note. The lifetime of the ParentViewportWatcher channel is bound by the peer
2671    /// ViewportCreationToken. When the ViewportCreationToken dies, this ParentViewportWatcher
2672    /// channel is destroyed.
2673    ///
2674    /// Views and subgraphs of Views created using `CreateView` will not be represented in the
2675    /// ViewTree, and hence will not be able to participate in any ViewTree-dependent interactions
2676    /// such as touch, mouse or focus.
2677    /// The Flatland protocol provides no way for Views in the subgraph of a View created with
2678    /// `CreateView` to know that they are excluded from the ViewTree.
2679    pub fn r#create_view(
2680        &self,
2681        mut token: fidl_fuchsia_ui_views::ViewCreationToken,
2682        mut parent_viewport_watcher: fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>,
2683    ) -> Result<(), fidl::Error> {
2684        FlatlandProxyInterface::r#create_view(self, token, parent_viewport_watcher)
2685    }
2686
2687    /// Identical to [`CreateView`], except it allows association of View identity (ViewRef) and
2688    /// view-bound protocols.
2689    pub fn r#create_view2(
2690        &self,
2691        mut token: fidl_fuchsia_ui_views::ViewCreationToken,
2692        mut view_identity: fidl_fuchsia_ui_views::ViewIdentityOnCreation,
2693        mut protocols: ViewBoundProtocols,
2694        mut parent_viewport_watcher: fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>,
2695    ) -> Result<(), fidl::Error> {
2696        FlatlandProxyInterface::r#create_view2(
2697            self,
2698            token,
2699            view_identity,
2700            protocols,
2701            parent_viewport_watcher,
2702        )
2703    }
2704
2705    /// Creates a new Transform node. Transforms are a hierarchical piece of a Flatland graph. They
2706    /// can have children, and can reference Content. A sub-graph represented by a Transform and its
2707    /// descendants can be rendered to a display.
2708    ///
2709    /// Transforms are kept alive, even when released, as long as they are children of either an
2710    /// unreleased Transform, or the Root Transform.
2711    ///
2712    /// Each Transform can have a single piece of attached Content. Common types of Content include
2713    /// bitmaps, asynchronous streams of images, and Viewports to Views hosted in other Flatland
2714    /// instances.
2715    ///
2716    /// Transforms have attributes. Child Transforms inherit the combined attributes of their
2717    /// parents. Content attached to a Transform is also affected by that Transform's attributes.
2718    ///
2719    /// When a sub-graph of Transforms is rendered, Content will be rendered back-to-front, starting
2720    /// with the Content on the root transform, and continuing recursively through all of its child
2721    /// Transforms in the order the children were added. See [`AddChild`] for more information.
2722    ///
2723    /// Zero is not a valid transform id. All other values are valid, assuming they are not already
2724    /// in use (see [`ReleaseTransform`] for more details).
2725    pub fn r#create_transform(&self, mut transform_id: &TransformId) -> Result<(), fidl::Error> {
2726        FlatlandProxyInterface::r#create_transform(self, transform_id)
2727    }
2728
2729    /// All Transform objects support all attributes.
2730    ///
2731    /// Geometric attributes are applied in the following order:
2732    /// 1. Scale (relative to the parent transform's coordinate space)
2733    /// 2. Orientation (relative to the parent transform's coordinate space)
2734    /// 3. Translation (relative to the parent transforms's coordinate space,
2735    ///    unaffected by scale applied to the current transform).
2736    /// 4. Clipping (relative to the current transform's coordinate space)
2737    ///
2738    /// The effects of each of these attributes are cumulative. This means the transform's position
2739    /// in the view space, and its clip boundary, will be calculated based on that chain of
2740    /// geometric attributes going up to the root transform.
2741    ///
2742    /// For instance, in a nested hierarchy such as the following:
2743    ///     [Root-Transform -> Transform1 -> Transform2 -> CurrentTransform]
2744    /// If Transform1 is translated by [2,0] and Transform2 is translated by [0,1] then the
2745    /// view-space position of CurrentTransform will be [2,1].
2746    ///
2747    /// Sets the translation on a Transform. The order of geometric attribute application is
2748    /// addressed above.
2749    pub fn r#set_translation(
2750        &self,
2751        mut transform_id: &TransformId,
2752        mut translation: &fidl_fuchsia_math::Vec_,
2753    ) -> Result<(), fidl::Error> {
2754        FlatlandProxyInterface::r#set_translation(self, transform_id, translation)
2755    }
2756
2757    /// Sets the orientation on a Transform. The order of geometric attribute application is
2758    /// addressed in the documentation for [`SetTranslation`]. In Flatland, the +X axis is
2759    /// to the right and the +Y axis is down. There is no notion of a Z axis. CCW is defined
2760    /// from the POV of the user, as if a skeuomorphoic clock is displayed on the screen.
2761    pub fn r#set_orientation(
2762        &self,
2763        mut transform_id: &TransformId,
2764        mut orientation: Orientation,
2765    ) -> Result<(), fidl::Error> {
2766        FlatlandProxyInterface::r#set_orientation(self, transform_id, orientation)
2767    }
2768
2769    /// Sets the scale on a transform. The order of geometric attribute application is
2770    /// addressed above. The (x,y) values in the VecF |scale| refer to the scale factor in the
2771    /// x-axis (width) and y-axis (height) respectively. Scale values must be normal 32-bit
2772    /// floating point values: https://en.wikipedia.org/wiki/Normal_number_%28computing%29
2773    pub fn r#set_scale(
2774        &self,
2775        mut transform_id: &TransformId,
2776        mut scale: &fidl_fuchsia_math::VecF,
2777    ) -> Result<(), fidl::Error> {
2778        FlatlandProxyInterface::r#set_scale(self, transform_id, scale)
2779    }
2780
2781    /// Sets an opacity in linear space to be applied to a transform and its descendents,
2782    /// which include other transforms and content. Opacity values must be in the range
2783    /// of [0.0, 1.0], where 0.0 is completely transparent and 1.0 is completely opaque.
2784    /// Attempting to call this function with values outside that range will result in
2785    /// an error. A transform's opacity value is multiplied with that of its parent. This
2786    /// effect works differently from group opacity. Using group opacity, child nodes are
2787    /// rendered together first, and then have the parent's opacity applied as a post-effect.
2788    /// Here, opacity is applied to each child individually. This may result in a very
2789    /// different effect.
2790    pub fn r#set_opacity(
2791        &self,
2792        mut transform_id: &TransformId,
2793        mut value: f32,
2794    ) -> Result<(), fidl::Error> {
2795        FlatlandProxyInterface::r#set_opacity(self, transform_id, value)
2796    }
2797
2798    /// Sets the bounds, expressed in the local coordinate space of the transform, that
2799    /// constrains the region that content attached to this transform can be rendered to.
2800    /// If the content's area exceeds the clip bounds, the area outside the bounds will
2801    /// not be rendered. These bounds are valid for all children of this transform node as
2802    /// well, which includes nested Flatland instances and their node hierarchies.
2803    /// If a child transform attempts to set clip bounds larger than that of its parent,
2804    /// it will be clipped to the parent's clip bounds. The default state is for a transform
2805    /// to be unclipped, meaning it will not have any bounds placed on its render region.
2806    /// The clip width/height must be positive. Negative values will result in an error.
2807    /// Passing in an empty box to the |rect| parameter will remove the clip bounds.
2808    pub fn r#set_clip_boundary(
2809        &self,
2810        mut transform_id: &TransformId,
2811        mut rect: Option<&fidl_fuchsia_math::Rect>,
2812    ) -> Result<(), fidl::Error> {
2813        FlatlandProxyInterface::r#set_clip_boundary(self, transform_id, rect)
2814    }
2815
2816    /// Adds a child Transform to a parent Transform. The new child Transform, and any Content
2817    /// attached to it or its children, will be rendered on top of the parent's Content, as well as
2818    /// any previously added children.
2819    pub fn r#add_child(
2820        &self,
2821        mut parent_transform_id: &TransformId,
2822        mut child_transform_id: &TransformId,
2823    ) -> Result<(), fidl::Error> {
2824        FlatlandProxyInterface::r#add_child(self, parent_transform_id, child_transform_id)
2825    }
2826
2827    /// Removes a child Transform from a parent Transform.
2828    pub fn r#remove_child(
2829        &self,
2830        mut parent_transform_id: &TransformId,
2831        mut child_transform_id: &TransformId,
2832    ) -> Result<(), fidl::Error> {
2833        FlatlandProxyInterface::r#remove_child(self, parent_transform_id, child_transform_id)
2834    }
2835
2836    /// Removes all child Transforms from a parent Transform and replaces them with the new child
2837    /// transforms in `new_child_transform_ids`.
2838    pub fn r#replace_children(
2839        &self,
2840        mut parent_transform_id: &TransformId,
2841        mut new_child_transform_ids: &[TransformId],
2842    ) -> Result<(), fidl::Error> {
2843        FlatlandProxyInterface::r#replace_children(
2844            self,
2845            parent_transform_id,
2846            new_child_transform_ids,
2847        )
2848    }
2849
2850    /// Sets the Root Transform for the graph.
2851    ///
2852    /// The sub-graph defined by the Root Transform and its children will be rendered as View
2853    /// in the connected parent's Viewport (see [`CreateView`]). Any parents of the Root Transform
2854    /// in this Graph will be ignored.
2855    ///
2856    /// The Root Transform, and all children of the Root Transform, are kept alive if they are
2857    /// released (see [`ReleaseTransform`] for more details).
2858    ///
2859    /// There is only ever one Root. Since 0 is not a valid transform id (see [`CreateTransform`]),
2860    /// calling SetRootTransform(0) clears the current Root, destroying any previously released
2861    /// objects that are not referenced by the new root.
2862    ///
2863    /// Note that every View has a clip boundary equivalent to its logical size. Anything outside
2864    /// that clip boundary will not be rendered. Hence, the Root Transform has a useful coordinate
2865    /// space of (0, 0) to (logical_size.width, logical_size.height), where (0, 0) is the upper left
2866    /// corner.
2867    ///
2868    /// Setting the root transform installs a full screen hit region on the root transform. Clients
2869    /// may remove this hit region if they don't want users to be able to interact with the root
2870    /// transform's content. For additional details on hit regions, see the [`SetHitRegions`]
2871    /// documentation.
2872    ///
2873    /// Default hit region rules
2874    ///
2875    ///   A default hit region follows these rules:
2876    ///   - When [`SetRootTransform`](T) is called, T receives a maximal hit region, covering the
2877    ///   entire view.
2878    ///   - If [`SetHitRegions`] is called on T, either before or after [`SetRootTransform`](T),
2879    ///   then no default hit region is active and the client specified hit regions are used.
2880    ///   - If a transform is no longer the root transform, i.e., [`SetRootTransform`](U) is
2881    ///   called, then the original transform no longer has its default hit region.
2882    ///   - Clients can remove or modify the root transform's hit regions the same way they would
2883    ///   reset any other transform's hit regions, by calling [`SetHitRegions`] with the appropriate
2884    ///   vector.
2885    pub fn r#set_root_transform(&self, mut transform_id: &TransformId) -> Result<(), fidl::Error> {
2886        FlatlandProxyInterface::r#set_root_transform(self, transform_id)
2887    }
2888
2889    /// Sets the interactive areas for a Transform. By default, Content is not interactive; hit
2890    /// regions must be placed for a user to interact with the Content in a View. Because hit
2891    /// regions are described in the Flatland protocol, a Flatland instance can synchronize Content
2892    /// and hit regions.
2893    ///
2894    /// Each hit region is placed in the coordinate space of the owning Transform, and may or may
2895    /// not interact with different types of hit testing, depending on its [`HitTestInteraction`]
2896    /// type. When there are multiple hit regions that intersect with a hit test, the precedence
2897    /// rules given below dictate which hit region has interacted with the hit test. Only Transforms
2898    /// that transitively connect to the root Transform have their hit regions interact with a hit
2899    /// test.
2900    ///
2901    /// Calling this function replaces any previous values set on this Transform. To reset a
2902    /// Transform to "no hit testing": send an empty vector with [`SetHitRegions`].
2903    ///
2904    /// Note that root transforms get a default hit region installed by Flatland. For more details,
2905    /// see the [`SetRootTransform`] documentation.
2906    ///
2907    /// Precedence rules
2908    ///   Within a Transform, if multiple hit regions overlap, the hit test examines each
2909    ///   intersecting hit region for a possible interaction. Thus, for a regular hit test R and an
2910    ///   accessibility hit test A, where R and A both intersect two hit regions D ([`DEFAULT`]) and
2911    ///   S ([`SEMANTICALLY_INVISIBLE`]) on the same Transform, (1) R interacts with both D and S,
2912    ///   and (2) A only interacts with D. Generally, hit regions that overlap in a single Transform
2913    ///   can cause confusing behavior.
2914    ///
2915    ///   Within a View, for a given hit test, the front-most Transform's hit regions take
2916    ///   precedence over those behind. This follows the expected reverse "render order" of
2917    ///   Transforms (described in [`CreateTransform`]), where a user expects to interact with
2918    ///   Content that is visible, or front-most.
2919    ///
2920    ///   Across Flatland instances, for a given hit test, the front-most instance's front-most
2921    ///   Transform's hit regions take precedence over those behind. This follows the expected
2922    ///   reverse "render order" of views, where a user expects to interact with the View that is
2923    ///   visible, or front-most. For example, if a child View owns Content that is rendered over
2924    ///   the parent View, the user expects to interact with the child's Content.
2925    pub fn r#set_hit_regions(
2926        &self,
2927        mut transform_id: &TransformId,
2928        mut regions: &[HitRegion],
2929    ) -> Result<(), fidl::Error> {
2930        FlatlandProxyInterface::r#set_hit_regions(self, transform_id, regions)
2931    }
2932
2933    /// Identical to [`SetHitRegions`], except the hit region associated with [`transform_id`]
2934    /// covers an infinite region. The hit region is invariant against translation, scaling, and
2935    /// orientation of the Transform.
2936    ///
2937    /// An infinite hit region is still limited in extent by the View's clip boundary, just like a
2938    /// finite hit region.
2939    ///
2940    /// Calling this function replaces any previous values set on this Transform. To reset a
2941    /// Transform to "no hit testing": send an empty vector with [`SetHitRegions`].
2942    pub fn r#set_infinite_hit_region(
2943        &self,
2944        mut transform_id: &TransformId,
2945        mut hit_test: HitTestInteraction,
2946    ) -> Result<(), fidl::Error> {
2947        FlatlandProxyInterface::r#set_infinite_hit_region(self, transform_id, hit_test)
2948    }
2949
2950    /// The Viewport and View pair, together, represent the connection between two Flatland
2951    /// instances. The Viewport is created in the parent, and the View is created in the child. The
2952    /// parent has control over how the child's View is integrated into its own View.
2953    ///
2954    /// Any illegal operations on ChildViewWatcher will cause both ChildViewWatcher channel and this
2955    /// Flatland channel to be torn down.
2956    ///
2957    /// `ViewportProperties` must have logical_size set. This is the initial size that will drive
2958    /// the layout of the child. The logical_size is also used as the default Content size, but
2959    /// subsequent changes to the logical_size will have no effect on the Content size.
2960    ///
2961    /// `ViewportProperties` may have inset field not set. In that case, the default value of
2962    /// (0, 0, 0, 0) is used.
2963    ///
2964    /// The logical_size must have positive X and Y components.
2965    ///
2966    /// Zero is not a valid ContentId. All other values are valid, assuming they are not already
2967    /// in use for another piece of Content (see [`ReleaseViewport`] for more details).
2968    ///
2969    /// Lifecycle note. The lifetime of the ChildViewWatcher channel is bound by the peer
2970    /// ViewCreationToken. When the ViewCreationToken dies, this ChildViewWatcher channel is
2971    /// destroyed.
2972    pub fn r#create_viewport(
2973        &self,
2974        mut viewport_id: &ContentId,
2975        mut token: fidl_fuchsia_ui_views::ViewportCreationToken,
2976        mut properties: &ViewportProperties,
2977        mut child_view_watcher: fidl::endpoints::ServerEnd<ChildViewWatcherMarker>,
2978    ) -> Result<(), fidl::Error> {
2979        FlatlandProxyInterface::r#create_viewport(
2980            self,
2981            viewport_id,
2982            token,
2983            properties,
2984            child_view_watcher,
2985        )
2986    }
2987
2988    /// An Image is a bitmap backed by a specific VMO in a BufferCollection.
2989    ///
2990    /// Image creation requires an allocated BufferCollection registered with Allocator. This
2991    /// function will fail unless all clients of the specified BufferCollection have set their
2992    /// constraints.
2993    ///
2994    /// The Image must reference a valid VMO index and must have ImageProperties that fall within
2995    /// the constraints specified by the backing BufferCollection (i.e. width and height within a
2996    /// valid range, etc.)
2997    ///
2998    /// Zero is not a valid Image id. All other values are valid, assuming they are not already in
2999    /// use for another piece of Content (see [`ReleaseImage`] for more details).
3000    pub fn r#create_image(
3001        &self,
3002        mut image_id: &ContentId,
3003        mut import_token: BufferCollectionImportToken,
3004        mut vmo_index: u32,
3005        mut properties: &ImageProperties,
3006    ) -> Result<(), fidl::Error> {
3007        FlatlandProxyInterface::r#create_image(self, image_id, import_token, vmo_index, properties)
3008    }
3009
3010    /// This function is used to determine the region (in texel space) of an image that will be used
3011    /// by Flatland when rendering. The image to be sampled is referenced by [`image_id`] and the
3012    /// sample region is specified by [`rect`] which itself is comprised of an origin point (x,y) as
3013    /// well as a width and height, in unnormalized coordinates. It is illegal to call this function
3014    /// on non-image content, or to sample a region outside of the texel space of the image. In
3015    /// other words, the region specifed by [`rect`] must not exceed the ranges (0, image_width) and
3016    /// (0, image_height). If (rect.x + rect.width > image_width) or (rect.y + rect.height >
3017    /// image_height) or if any of the values are negative, this will result in an error.
3018    ///
3019    /// If this method is not called, the default sample region is the rectangle with origin at
3020    /// (0, 0) and width and height set at ImageProperties from [`CreateImage`].
3021    pub fn r#set_image_sample_region(
3022        &self,
3023        mut image_id: &ContentId,
3024        mut rect: &fidl_fuchsia_math::RectF,
3025    ) -> Result<(), fidl::Error> {
3026        FlatlandProxyInterface::r#set_image_sample_region(self, image_id, rect)
3027    }
3028
3029    /// The content size for an Image is the size of the rectangle in the parent's logical
3030    /// coordinate space that the image occupies. This combined with the global translation of the
3031    /// transform it is attached to determines the size and location of where the content is
3032    /// rendered on the display.
3033    ///
3034    /// If this method is not called, the default image destination size is the width and height set
3035    /// at ImageProperties from [`CreateImage`]. The destination size will be affected by scaling if
3036    /// [`SetScale`] is used on the attached Transform or its parents.
3037    pub fn r#set_image_destination_size(
3038        &self,
3039        mut image_id: &ContentId,
3040        mut size: &fidl_fuchsia_math::SizeU,
3041    ) -> Result<(), fidl::Error> {
3042        FlatlandProxyInterface::r#set_image_destination_size(self, image_id, size)
3043    }
3044
3045    /// Determines the blend function to use when rendering the content specified by
3046    /// |image_id|. |image_id| must be a valid ContentId associated to a transform through
3047    /// a call to |CreateImage| or |CreateFilledRect|. For details on the different blend functions
3048    /// that are available, please refer to the BlendMode enum. If this function is not called, then
3049    /// the default blendmode is BlendMode::SRC.
3050    pub fn r#set_image_blending_function(
3051        &self,
3052        mut image_id: &ContentId,
3053        mut blend_mode: BlendMode,
3054    ) -> Result<(), fidl::Error> {
3055        FlatlandProxyInterface::r#set_image_blending_function(self, image_id, blend_mode)
3056    }
3057
3058    /// Determines the blend function to use when rendering the content specified by
3059    /// |image_id|. |image_id| must be a valid ContentId associated to a transform through
3060    /// a call to |CreateImage| or |CreateFilledRect|. For details on the different blend functions
3061    /// that are available, please refer to the BlendMode2 enum. If this function is not called,
3062    /// the default blendmode is BlendMode2::REPLACE.
3063    pub fn r#set_image_blend_mode(
3064        &self,
3065        mut image_id: &ContentId,
3066        mut blend_mode: BlendMode2,
3067    ) -> Result<(), fidl::Error> {
3068        FlatlandProxyInterface::r#set_image_blend_mode(self, image_id, blend_mode)
3069    }
3070
3071    /// Sets an opacity in linear space to be applied to a flatland image. Opacity values must
3072    /// be in the range [0.0, 1.0].
3073    pub fn r#set_image_opacity(
3074        &self,
3075        mut image_id: &ContentId,
3076        mut val: f32,
3077    ) -> Result<(), fidl::Error> {
3078        FlatlandProxyInterface::r#set_image_opacity(self, image_id, val)
3079    }
3080
3081    /// Sets the image flip to be applied to a flatland image. This call must be performed after a
3082    /// successful |CreateImage| call. If an invalid |image_id| is supplied, the channel will be
3083    /// closed due to FlatlandError::BAD_OPERATION. This flip will be applied to the Image before
3084    /// parent Transform Orientations. If this function is not called, then the default flip value
3085    /// is ImageFlip::NONE.
3086    pub fn r#set_image_flip(
3087        &self,
3088        mut image_id: &ContentId,
3089        mut flip: ImageFlip,
3090    ) -> Result<(), fidl::Error> {
3091        FlatlandProxyInterface::r#set_image_flip(self, image_id, flip)
3092    }
3093
3094    /// Creates a solid-color rectangle. By default a filled-rect does not have a defined
3095    /// color or size. It is necessary to call |SetSolidFill| to specify a color and size
3096    /// before a filled rect can be used for rendering. Not doing so will result the
3097    pub fn r#create_filled_rect(&self, mut rect_id: &ContentId) -> Result<(), fidl::Error> {
3098        FlatlandProxyInterface::r#create_filled_rect(self, rect_id)
3099    }
3100
3101    /// Defines the color and size of a filled rect. |rect_id| must refer to content that
3102    /// was created via a call to CreateFilledRect. The color is not premultiplied. Color values
3103    /// must be within the range [0,1] inclusive, and normal 32-bit
3104    /// floating point values: https://en.wikipedia.org/wiki/Normal_number_%28computing%29. Values
3105    /// that do not conform to these specifications will cause the channel to close.
3106    /// The rectangle's top left corner will be at (0, 0) in its transform's coordinate space.
3107    /// Hence, its bottom right corner will be at (size.width, size.height).
3108    pub fn r#set_solid_fill(
3109        &self,
3110        mut rect_id: &ContentId,
3111        mut color: &ColorRgba,
3112        mut size: &fidl_fuchsia_math::SizeU,
3113    ) -> Result<(), fidl::Error> {
3114        FlatlandProxyInterface::r#set_solid_fill(self, rect_id, color, size)
3115    }
3116
3117    /// Automatically garbage collects the rectangle when it is no longer needed for
3118    /// rendering. |rect_id| must have been instantiated with a call to
3119    /// |CreateFilledRect|. Once released, the ID immediately goes out of scope and is free
3120    /// to be used again.
3121    pub fn r#release_filled_rect(&self, mut rect_id: &ContentId) -> Result<(), fidl::Error> {
3122        FlatlandProxyInterface::r#release_filled_rect(self, rect_id)
3123    }
3124
3125    /// Setting a piece of Content on a Transform makes that Content visible in the render tree as
3126    /// long as the Transform is visible from the root Transform. The Content will be rendered
3127    /// before, and therefore "behind", any Content attached to the descendants of the Transform.
3128    ///
3129    /// Because each Transform can have, at most, a single piece of Content on it, calling this
3130    /// function on a Transform that already has Content will replace that Content.
3131    ///
3132    /// A Content may be set on more than one Transform.
3133    ///
3134    /// Calling this function with a Content id of 0 will remove any Content currently on the
3135    /// Transform.
3136    pub fn r#set_content(
3137        &self,
3138        mut transform_id: &TransformId,
3139        mut content_id: &ContentId,
3140    ) -> Result<(), fidl::Error> {
3141        FlatlandProxyInterface::r#set_content(self, transform_id, content_id)
3142    }
3143
3144    /// Transforms are usually sufficient to change how Content is presented. Viewports, however,
3145    /// have special properties that are not part of the Transform hierarchy. Those properties can
3146    /// be set using this function.
3147    pub fn r#set_viewport_properties(
3148        &self,
3149        mut viewport_id: &ContentId,
3150        mut properties: &ViewportProperties,
3151    ) -> Result<(), fidl::Error> {
3152        FlatlandProxyInterface::r#set_viewport_properties(self, viewport_id, properties)
3153    }
3154
3155    /// Released Transforms will be garbage collected by the system once they are no longer
3156    /// necessary for rendering. For Transforms, this means there is no path from any unreleased
3157    /// Transform to the newly-released Transform.
3158    ///
3159    /// Once released, the id immediately goes out of scope for future function calls and can be
3160    /// reused when creating new Transforms.
3161    ///
3162    /// It is an error to call functions with a released id (unless that id has been reused to
3163    /// construct a new Transform).
3164    pub fn r#release_transform(&self, mut transform_id: &TransformId) -> Result<(), fidl::Error> {
3165        FlatlandProxyInterface::r#release_transform(self, transform_id)
3166    }
3167
3168    pub fn r#release_view(&self) -> Result<(), fidl::Error> {
3169        FlatlandProxyInterface::r#release_view(self)
3170    }
3171
3172    /// Releases a Viewport from the scene, even if the Viewport is still connected to a Transform.
3173    /// Unlike other resources, Viewports are garbage collected by the system during the next
3174    /// [`Present`] because a removed Viewport is guaranteed to provide no renderable content.
3175    ///
3176    /// Use SetContent(transform_id, 0) to clean up references to released Viewports.
3177    ///
3178    /// Despite having a return type, this function is still feed-forward like [`CreateView`] and
3179    /// requires a call to [`Present`] to be executed. The ViewportCreationToken will be returned
3180    /// after the presented operations have been executed.
3181    pub fn r#release_viewport(
3182        &self,
3183        mut viewport_id: &ContentId,
3184    ) -> fidl::client::QueryResponseFut<
3185        fidl_fuchsia_ui_views::ViewportCreationToken,
3186        fidl::encoding::DefaultFuchsiaResourceDialect,
3187    > {
3188        FlatlandProxyInterface::r#release_viewport(self, viewport_id)
3189    }
3190
3191    /// Released Images will be garbage collected by the system once they are no longer necessary
3192    /// for rendering. For Images, this means the Image is no longer attached to any Transform and
3193    /// any pending rendering that references the Image is complete.
3194    ///
3195    /// Use SetContent(transform_id, 0) to clean up references to released Images.
3196    ///
3197    /// Once released, the id immediately goes out of scope for future function calls and can be
3198    /// reused when creating new Images.
3199    ///
3200    /// It is an error to call functions with a released id (unless that id has been reused to
3201    /// construct a new Image).
3202    pub fn r#release_image(&self, mut image_id: &ContentId) -> Result<(), fidl::Error> {
3203        FlatlandProxyInterface::r#release_image(self, image_id)
3204    }
3205
3206    /// This function will reset all state on this interface. This includes destroying all existing
3207    /// View and Viewports without returning the associated Token to the caller.
3208    pub fn r#clear(&self) -> Result<(), fidl::Error> {
3209        FlatlandProxyInterface::r#clear(self)
3210    }
3211
3212    /// Set debug name of the current client that can be used by Flatland to print as a prefix to
3213    /// logs to help client distinguish what is theirs. [`name`] can be an arbitrary string, but the
3214    /// current process name (see fsl::GetCurrentProcessName()) is a good default.
3215    pub fn r#set_debug_name(&self, mut name: &str) -> Result<(), fidl::Error> {
3216        FlatlandProxyInterface::r#set_debug_name(self, name)
3217    }
3218}
3219
3220impl FlatlandProxyInterface for FlatlandProxy {
3221    fn r#present(&self, mut args: PresentArgs) -> Result<(), fidl::Error> {
3222        self.client.send::<FlatlandPresentRequest>(
3223            (&mut args,),
3224            0x50acc2aa1f0acec7,
3225            fidl::encoding::DynamicFlags::empty(),
3226        )
3227    }
3228
3229    fn r#create_view(
3230        &self,
3231        mut token: fidl_fuchsia_ui_views::ViewCreationToken,
3232        mut parent_viewport_watcher: fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>,
3233    ) -> Result<(), fidl::Error> {
3234        self.client.send::<FlatlandCreateViewRequest>(
3235            (&mut token, parent_viewport_watcher),
3236            0x504686eb25864780,
3237            fidl::encoding::DynamicFlags::empty(),
3238        )
3239    }
3240
3241    fn r#create_view2(
3242        &self,
3243        mut token: fidl_fuchsia_ui_views::ViewCreationToken,
3244        mut view_identity: fidl_fuchsia_ui_views::ViewIdentityOnCreation,
3245        mut protocols: ViewBoundProtocols,
3246        mut parent_viewport_watcher: fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>,
3247    ) -> Result<(), fidl::Error> {
3248        self.client.send::<FlatlandCreateView2Request>(
3249            (&mut token, &mut view_identity, &mut protocols, parent_viewport_watcher),
3250            0x340a3a40c2fdbd5e,
3251            fidl::encoding::DynamicFlags::empty(),
3252        )
3253    }
3254
3255    fn r#create_transform(&self, mut transform_id: &TransformId) -> Result<(), fidl::Error> {
3256        self.client.send::<FlatlandCreateTransformRequest>(
3257            (transform_id,),
3258            0x5e042a4d3de3efb0,
3259            fidl::encoding::DynamicFlags::empty(),
3260        )
3261    }
3262
3263    fn r#set_translation(
3264        &self,
3265        mut transform_id: &TransformId,
3266        mut translation: &fidl_fuchsia_math::Vec_,
3267    ) -> Result<(), fidl::Error> {
3268        self.client.send::<FlatlandSetTranslationRequest>(
3269            (transform_id, translation),
3270            0x7863398291fba346,
3271            fidl::encoding::DynamicFlags::empty(),
3272        )
3273    }
3274
3275    fn r#set_orientation(
3276        &self,
3277        mut transform_id: &TransformId,
3278        mut orientation: Orientation,
3279    ) -> Result<(), fidl::Error> {
3280        self.client.send::<FlatlandSetOrientationRequest>(
3281            (transform_id, orientation),
3282            0x4915310bc4928edc,
3283            fidl::encoding::DynamicFlags::empty(),
3284        )
3285    }
3286
3287    fn r#set_scale(
3288        &self,
3289        mut transform_id: &TransformId,
3290        mut scale: &fidl_fuchsia_math::VecF,
3291    ) -> Result<(), fidl::Error> {
3292        self.client.send::<FlatlandSetScaleRequest>(
3293            (transform_id, scale),
3294            0x1ea1766fd8996bb4,
3295            fidl::encoding::DynamicFlags::empty(),
3296        )
3297    }
3298
3299    fn r#set_opacity(
3300        &self,
3301        mut transform_id: &TransformId,
3302        mut value: f32,
3303    ) -> Result<(), fidl::Error> {
3304        self.client.send::<FlatlandSetOpacityRequest>(
3305            (transform_id, value),
3306            0x3775fc2c00b432fa,
3307            fidl::encoding::DynamicFlags::empty(),
3308        )
3309    }
3310
3311    fn r#set_clip_boundary(
3312        &self,
3313        mut transform_id: &TransformId,
3314        mut rect: Option<&fidl_fuchsia_math::Rect>,
3315    ) -> Result<(), fidl::Error> {
3316        self.client.send::<FlatlandSetClipBoundaryRequest>(
3317            (transform_id, rect),
3318            0x6507843df12222d2,
3319            fidl::encoding::DynamicFlags::empty(),
3320        )
3321    }
3322
3323    fn r#add_child(
3324        &self,
3325        mut parent_transform_id: &TransformId,
3326        mut child_transform_id: &TransformId,
3327    ) -> Result<(), fidl::Error> {
3328        self.client.send::<FlatlandAddChildRequest>(
3329            (parent_transform_id, child_transform_id),
3330            0x67a8abd2f19b1a74,
3331            fidl::encoding::DynamicFlags::empty(),
3332        )
3333    }
3334
3335    fn r#remove_child(
3336        &self,
3337        mut parent_transform_id: &TransformId,
3338        mut child_transform_id: &TransformId,
3339    ) -> Result<(), fidl::Error> {
3340        self.client.send::<FlatlandRemoveChildRequest>(
3341            (parent_transform_id, child_transform_id),
3342            0x41d6cd90b298b67a,
3343            fidl::encoding::DynamicFlags::empty(),
3344        )
3345    }
3346
3347    fn r#replace_children(
3348        &self,
3349        mut parent_transform_id: &TransformId,
3350        mut new_child_transform_ids: &[TransformId],
3351    ) -> Result<(), fidl::Error> {
3352        self.client.send::<FlatlandReplaceChildrenRequest>(
3353            (parent_transform_id, new_child_transform_ids),
3354            0x5b6d86cbbff81316,
3355            fidl::encoding::DynamicFlags::empty(),
3356        )
3357    }
3358
3359    fn r#set_root_transform(&self, mut transform_id: &TransformId) -> Result<(), fidl::Error> {
3360        self.client.send::<FlatlandSetRootTransformRequest>(
3361            (transform_id,),
3362            0x6e80ca5bcc566cd8,
3363            fidl::encoding::DynamicFlags::empty(),
3364        )
3365    }
3366
3367    fn r#set_hit_regions(
3368        &self,
3369        mut transform_id: &TransformId,
3370        mut regions: &[HitRegion],
3371    ) -> Result<(), fidl::Error> {
3372        self.client.send::<FlatlandSetHitRegionsRequest>(
3373            (transform_id, regions),
3374            0x31c9d17b07c37ce4,
3375            fidl::encoding::DynamicFlags::empty(),
3376        )
3377    }
3378
3379    fn r#set_infinite_hit_region(
3380        &self,
3381        mut transform_id: &TransformId,
3382        mut hit_test: HitTestInteraction,
3383    ) -> Result<(), fidl::Error> {
3384        self.client.send::<FlatlandSetInfiniteHitRegionRequest>(
3385            (transform_id, hit_test),
3386            0x26d81af852d29562,
3387            fidl::encoding::DynamicFlags::empty(),
3388        )
3389    }
3390
3391    fn r#create_viewport(
3392        &self,
3393        mut viewport_id: &ContentId,
3394        mut token: fidl_fuchsia_ui_views::ViewportCreationToken,
3395        mut properties: &ViewportProperties,
3396        mut child_view_watcher: fidl::endpoints::ServerEnd<ChildViewWatcherMarker>,
3397    ) -> Result<(), fidl::Error> {
3398        self.client.send::<FlatlandCreateViewportRequest>(
3399            (viewport_id, &mut token, properties, child_view_watcher),
3400            0x2485fbcab7f943c,
3401            fidl::encoding::DynamicFlags::empty(),
3402        )
3403    }
3404
3405    fn r#create_image(
3406        &self,
3407        mut image_id: &ContentId,
3408        mut import_token: BufferCollectionImportToken,
3409        mut vmo_index: u32,
3410        mut properties: &ImageProperties,
3411    ) -> Result<(), fidl::Error> {
3412        self.client.send::<FlatlandCreateImageRequest>(
3413            (image_id, &mut import_token, vmo_index, properties),
3414            0x26fae823c4ebedad,
3415            fidl::encoding::DynamicFlags::empty(),
3416        )
3417    }
3418
3419    fn r#set_image_sample_region(
3420        &self,
3421        mut image_id: &ContentId,
3422        mut rect: &fidl_fuchsia_math::RectF,
3423    ) -> Result<(), fidl::Error> {
3424        self.client.send::<FlatlandSetImageSampleRegionRequest>(
3425            (image_id, rect),
3426            0x8039391d715eb28,
3427            fidl::encoding::DynamicFlags::empty(),
3428        )
3429    }
3430
3431    fn r#set_image_destination_size(
3432        &self,
3433        mut image_id: &ContentId,
3434        mut size: &fidl_fuchsia_math::SizeU,
3435    ) -> Result<(), fidl::Error> {
3436        self.client.send::<FlatlandSetImageDestinationSizeRequest>(
3437            (image_id, size),
3438            0x766cf99a2ec58446,
3439            fidl::encoding::DynamicFlags::empty(),
3440        )
3441    }
3442
3443    fn r#set_image_blending_function(
3444        &self,
3445        mut image_id: &ContentId,
3446        mut blend_mode: BlendMode,
3447    ) -> Result<(), fidl::Error> {
3448        self.client.send::<FlatlandSetImageBlendingFunctionRequest>(
3449            (image_id, blend_mode),
3450            0x10f5da1356275b7b,
3451            fidl::encoding::DynamicFlags::empty(),
3452        )
3453    }
3454
3455    fn r#set_image_blend_mode(
3456        &self,
3457        mut image_id: &ContentId,
3458        mut blend_mode: BlendMode2,
3459    ) -> Result<(), fidl::Error> {
3460        self.client.send::<FlatlandSetImageBlendModeRequest>(
3461            (image_id, blend_mode),
3462            0x5b1667f130c3de67,
3463            fidl::encoding::DynamicFlags::empty(),
3464        )
3465    }
3466
3467    fn r#set_image_opacity(
3468        &self,
3469        mut image_id: &ContentId,
3470        mut val: f32,
3471    ) -> Result<(), fidl::Error> {
3472        self.client.send::<FlatlandSetImageOpacityRequest>(
3473            (image_id, val),
3474            0x2da9e4ef4c2cff6f,
3475            fidl::encoding::DynamicFlags::empty(),
3476        )
3477    }
3478
3479    fn r#set_image_flip(
3480        &self,
3481        mut image_id: &ContentId,
3482        mut flip: ImageFlip,
3483    ) -> Result<(), fidl::Error> {
3484        self.client.send::<FlatlandSetImageFlipRequest>(
3485            (image_id, flip),
3486            0x21b20f2c14aae6bc,
3487            fidl::encoding::DynamicFlags::empty(),
3488        )
3489    }
3490
3491    fn r#create_filled_rect(&self, mut rect_id: &ContentId) -> Result<(), fidl::Error> {
3492        self.client.send::<FlatlandCreateFilledRectRequest>(
3493            (rect_id,),
3494            0x5e62355abc1c4c5d,
3495            fidl::encoding::DynamicFlags::empty(),
3496        )
3497    }
3498
3499    fn r#set_solid_fill(
3500        &self,
3501        mut rect_id: &ContentId,
3502        mut color: &ColorRgba,
3503        mut size: &fidl_fuchsia_math::SizeU,
3504    ) -> Result<(), fidl::Error> {
3505        self.client.send::<FlatlandSetSolidFillRequest>(
3506            (rect_id, color, size),
3507            0x32d6ef41e182dfa5,
3508            fidl::encoding::DynamicFlags::empty(),
3509        )
3510    }
3511
3512    fn r#release_filled_rect(&self, mut rect_id: &ContentId) -> Result<(), fidl::Error> {
3513        self.client.send::<FlatlandReleaseFilledRectRequest>(
3514            (rect_id,),
3515            0x7392cabe45618f9b,
3516            fidl::encoding::DynamicFlags::empty(),
3517        )
3518    }
3519
3520    fn r#set_content(
3521        &self,
3522        mut transform_id: &TransformId,
3523        mut content_id: &ContentId,
3524    ) -> Result<(), fidl::Error> {
3525        self.client.send::<FlatlandSetContentRequest>(
3526            (transform_id, content_id),
3527            0x4ed2cfc0ce130862,
3528            fidl::encoding::DynamicFlags::empty(),
3529        )
3530    }
3531
3532    fn r#set_viewport_properties(
3533        &self,
3534        mut viewport_id: &ContentId,
3535        mut properties: &ViewportProperties,
3536    ) -> Result<(), fidl::Error> {
3537        self.client.send::<FlatlandSetViewportPropertiesRequest>(
3538            (viewport_id, properties),
3539            0x66ab67e9608ddb9f,
3540            fidl::encoding::DynamicFlags::empty(),
3541        )
3542    }
3543
3544    fn r#release_transform(&self, mut transform_id: &TransformId) -> Result<(), fidl::Error> {
3545        self.client.send::<FlatlandReleaseTransformRequest>(
3546            (transform_id,),
3547            0xab9328419451c22,
3548            fidl::encoding::DynamicFlags::empty(),
3549        )
3550    }
3551
3552    fn r#release_view(&self) -> Result<(), fidl::Error> {
3553        self.client.send::<fidl::encoding::EmptyPayload>(
3554            (),
3555            0x5b35aab9baffecae,
3556            fidl::encoding::DynamicFlags::empty(),
3557        )
3558    }
3559
3560    type ReleaseViewportResponseFut = fidl::client::QueryResponseFut<
3561        fidl_fuchsia_ui_views::ViewportCreationToken,
3562        fidl::encoding::DefaultFuchsiaResourceDialect,
3563    >;
3564    fn r#release_viewport(&self, mut viewport_id: &ContentId) -> Self::ReleaseViewportResponseFut {
3565        fn _decode(
3566            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3567        ) -> Result<fidl_fuchsia_ui_views::ViewportCreationToken, fidl::Error> {
3568            let _response = fidl::client::decode_transaction_body::<
3569                FlatlandReleaseViewportResponse,
3570                fidl::encoding::DefaultFuchsiaResourceDialect,
3571                0xbad474aeb5293f9,
3572            >(_buf?)?;
3573            Ok(_response.token)
3574        }
3575        self.client.send_query_and_decode::<
3576            FlatlandReleaseViewportRequest,
3577            fidl_fuchsia_ui_views::ViewportCreationToken,
3578        >(
3579            (viewport_id,),
3580            0xbad474aeb5293f9,
3581            fidl::encoding::DynamicFlags::empty(),
3582            _decode,
3583        )
3584    }
3585
3586    fn r#release_image(&self, mut image_id: &ContentId) -> Result<(), fidl::Error> {
3587        self.client.send::<FlatlandReleaseImageRequest>(
3588            (image_id,),
3589            0xb884ffdbc72c111,
3590            fidl::encoding::DynamicFlags::empty(),
3591        )
3592    }
3593
3594    fn r#clear(&self) -> Result<(), fidl::Error> {
3595        self.client.send::<fidl::encoding::EmptyPayload>(
3596            (),
3597            0x4ec8817c02828c3e,
3598            fidl::encoding::DynamicFlags::empty(),
3599        )
3600    }
3601
3602    fn r#set_debug_name(&self, mut name: &str) -> Result<(), fidl::Error> {
3603        self.client.send::<FlatlandSetDebugNameRequest>(
3604            (name,),
3605            0x46a8b397e68a8888,
3606            fidl::encoding::DynamicFlags::empty(),
3607        )
3608    }
3609}
3610
3611pub struct FlatlandEventStream {
3612    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
3613}
3614
3615impl std::marker::Unpin for FlatlandEventStream {}
3616
3617impl futures::stream::FusedStream for FlatlandEventStream {
3618    fn is_terminated(&self) -> bool {
3619        self.event_receiver.is_terminated()
3620    }
3621}
3622
3623impl futures::Stream for FlatlandEventStream {
3624    type Item = Result<FlatlandEvent, fidl::Error>;
3625
3626    fn poll_next(
3627        mut self: std::pin::Pin<&mut Self>,
3628        cx: &mut std::task::Context<'_>,
3629    ) -> std::task::Poll<Option<Self::Item>> {
3630        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
3631            &mut self.event_receiver,
3632            cx
3633        )?) {
3634            Some(buf) => std::task::Poll::Ready(Some(FlatlandEvent::decode(buf))),
3635            None => std::task::Poll::Ready(None),
3636        }
3637    }
3638}
3639
3640#[derive(Debug)]
3641pub enum FlatlandEvent {
3642    OnNextFrameBegin { values: OnNextFrameBeginValues },
3643    OnFramePresented { frame_presented_info: fidl_fuchsia_scenic_scheduling::FramePresentedInfo },
3644    OnError { error: FlatlandError },
3645}
3646
3647impl FlatlandEvent {
3648    #[allow(irrefutable_let_patterns)]
3649    pub fn into_on_next_frame_begin(self) -> Option<OnNextFrameBeginValues> {
3650        if let FlatlandEvent::OnNextFrameBegin { values } = self { Some((values)) } else { None }
3651    }
3652    #[allow(irrefutable_let_patterns)]
3653    pub fn into_on_frame_presented(
3654        self,
3655    ) -> Option<fidl_fuchsia_scenic_scheduling::FramePresentedInfo> {
3656        if let FlatlandEvent::OnFramePresented { frame_presented_info } = self {
3657            Some((frame_presented_info))
3658        } else {
3659            None
3660        }
3661    }
3662    #[allow(irrefutable_let_patterns)]
3663    pub fn into_on_error(self) -> Option<FlatlandError> {
3664        if let FlatlandEvent::OnError { error } = self { Some((error)) } else { None }
3665    }
3666
3667    /// Decodes a message buffer as a [`FlatlandEvent`].
3668    fn decode(
3669        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3670    ) -> Result<FlatlandEvent, fidl::Error> {
3671        let (bytes, _handles) = buf.split_mut();
3672        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3673        debug_assert_eq!(tx_header.tx_id, 0);
3674        match tx_header.ordinal {
3675            0x10f69a5cdeece84a => {
3676                let mut out = fidl::new_empty!(
3677                    FlatlandOnNextFrameBeginRequest,
3678                    fidl::encoding::DefaultFuchsiaResourceDialect
3679                );
3680                fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandOnNextFrameBeginRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
3681                Ok((FlatlandEvent::OnNextFrameBegin { values: out.values }))
3682            }
3683            0x56e43e1a5f30216d => {
3684                let mut out = fidl::new_empty!(
3685                    FlatlandOnFramePresentedRequest,
3686                    fidl::encoding::DefaultFuchsiaResourceDialect
3687                );
3688                fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandOnFramePresentedRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
3689                Ok((FlatlandEvent::OnFramePresented {
3690                    frame_presented_info: out.frame_presented_info,
3691                }))
3692            }
3693            0x1ebf39e90cd8b8d => {
3694                let mut out = fidl::new_empty!(
3695                    FlatlandOnErrorRequest,
3696                    fidl::encoding::DefaultFuchsiaResourceDialect
3697                );
3698                fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandOnErrorRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
3699                Ok((FlatlandEvent::OnError { error: out.error }))
3700            }
3701            _ => Err(fidl::Error::UnknownOrdinal {
3702                ordinal: tx_header.ordinal,
3703                protocol_name: <FlatlandMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3704            }),
3705        }
3706    }
3707}
3708
3709/// A Stream of incoming requests for fuchsia.ui.composition/Flatland.
3710pub struct FlatlandRequestStream {
3711    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3712    is_terminated: bool,
3713}
3714
3715impl std::marker::Unpin for FlatlandRequestStream {}
3716
3717impl futures::stream::FusedStream for FlatlandRequestStream {
3718    fn is_terminated(&self) -> bool {
3719        self.is_terminated
3720    }
3721}
3722
3723impl fidl::endpoints::RequestStream for FlatlandRequestStream {
3724    type Protocol = FlatlandMarker;
3725    type ControlHandle = FlatlandControlHandle;
3726
3727    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
3728        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3729    }
3730
3731    fn control_handle(&self) -> Self::ControlHandle {
3732        FlatlandControlHandle { inner: self.inner.clone() }
3733    }
3734
3735    fn into_inner(
3736        self,
3737    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3738    {
3739        (self.inner, self.is_terminated)
3740    }
3741
3742    fn from_inner(
3743        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3744        is_terminated: bool,
3745    ) -> Self {
3746        Self { inner, is_terminated }
3747    }
3748}
3749
3750impl futures::Stream for FlatlandRequestStream {
3751    type Item = Result<FlatlandRequest, fidl::Error>;
3752
3753    fn poll_next(
3754        mut self: std::pin::Pin<&mut Self>,
3755        cx: &mut std::task::Context<'_>,
3756    ) -> std::task::Poll<Option<Self::Item>> {
3757        let this = &mut *self;
3758        if this.inner.check_shutdown(cx) {
3759            this.is_terminated = true;
3760            return std::task::Poll::Ready(None);
3761        }
3762        if this.is_terminated {
3763            panic!("polled FlatlandRequestStream after completion");
3764        }
3765        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3766            |bytes, handles| {
3767                match this.inner.channel().read_etc(cx, bytes, handles) {
3768                    std::task::Poll::Ready(Ok(())) => {}
3769                    std::task::Poll::Pending => return std::task::Poll::Pending,
3770                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3771                        this.is_terminated = true;
3772                        return std::task::Poll::Ready(None);
3773                    }
3774                    std::task::Poll::Ready(Err(e)) => {
3775                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3776                            e.into(),
3777                        ))));
3778                    }
3779                }
3780
3781                // A message has been received from the channel
3782                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3783
3784                std::task::Poll::Ready(Some(match header.ordinal {
3785                    0x50acc2aa1f0acec7 => {
3786                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3787                        let mut req = fidl::new_empty!(
3788                            FlatlandPresentRequest,
3789                            fidl::encoding::DefaultFuchsiaResourceDialect
3790                        );
3791                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandPresentRequest>(&header, _body_bytes, handles, &mut req)?;
3792                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
3793                        Ok(FlatlandRequest::Present { args: req.args, control_handle })
3794                    }
3795                    0x504686eb25864780 => {
3796                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3797                        let mut req = fidl::new_empty!(
3798                            FlatlandCreateViewRequest,
3799                            fidl::encoding::DefaultFuchsiaResourceDialect
3800                        );
3801                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandCreateViewRequest>(&header, _body_bytes, handles, &mut req)?;
3802                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
3803                        Ok(FlatlandRequest::CreateView {
3804                            token: req.token,
3805                            parent_viewport_watcher: req.parent_viewport_watcher,
3806
3807                            control_handle,
3808                        })
3809                    }
3810                    0x340a3a40c2fdbd5e => {
3811                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3812                        let mut req = fidl::new_empty!(
3813                            FlatlandCreateView2Request,
3814                            fidl::encoding::DefaultFuchsiaResourceDialect
3815                        );
3816                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandCreateView2Request>(&header, _body_bytes, handles, &mut req)?;
3817                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
3818                        Ok(FlatlandRequest::CreateView2 {
3819                            token: req.token,
3820                            view_identity: req.view_identity,
3821                            protocols: req.protocols,
3822                            parent_viewport_watcher: req.parent_viewport_watcher,
3823
3824                            control_handle,
3825                        })
3826                    }
3827                    0x5e042a4d3de3efb0 => {
3828                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3829                        let mut req = fidl::new_empty!(
3830                            FlatlandCreateTransformRequest,
3831                            fidl::encoding::DefaultFuchsiaResourceDialect
3832                        );
3833                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandCreateTransformRequest>(&header, _body_bytes, handles, &mut req)?;
3834                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
3835                        Ok(FlatlandRequest::CreateTransform {
3836                            transform_id: req.transform_id,
3837
3838                            control_handle,
3839                        })
3840                    }
3841                    0x7863398291fba346 => {
3842                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3843                        let mut req = fidl::new_empty!(
3844                            FlatlandSetTranslationRequest,
3845                            fidl::encoding::DefaultFuchsiaResourceDialect
3846                        );
3847                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetTranslationRequest>(&header, _body_bytes, handles, &mut req)?;
3848                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
3849                        Ok(FlatlandRequest::SetTranslation {
3850                            transform_id: req.transform_id,
3851                            translation: req.translation,
3852
3853                            control_handle,
3854                        })
3855                    }
3856                    0x4915310bc4928edc => {
3857                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3858                        let mut req = fidl::new_empty!(
3859                            FlatlandSetOrientationRequest,
3860                            fidl::encoding::DefaultFuchsiaResourceDialect
3861                        );
3862                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetOrientationRequest>(&header, _body_bytes, handles, &mut req)?;
3863                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
3864                        Ok(FlatlandRequest::SetOrientation {
3865                            transform_id: req.transform_id,
3866                            orientation: req.orientation,
3867
3868                            control_handle,
3869                        })
3870                    }
3871                    0x1ea1766fd8996bb4 => {
3872                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3873                        let mut req = fidl::new_empty!(
3874                            FlatlandSetScaleRequest,
3875                            fidl::encoding::DefaultFuchsiaResourceDialect
3876                        );
3877                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetScaleRequest>(&header, _body_bytes, handles, &mut req)?;
3878                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
3879                        Ok(FlatlandRequest::SetScale {
3880                            transform_id: req.transform_id,
3881                            scale: req.scale,
3882
3883                            control_handle,
3884                        })
3885                    }
3886                    0x3775fc2c00b432fa => {
3887                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3888                        let mut req = fidl::new_empty!(
3889                            FlatlandSetOpacityRequest,
3890                            fidl::encoding::DefaultFuchsiaResourceDialect
3891                        );
3892                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetOpacityRequest>(&header, _body_bytes, handles, &mut req)?;
3893                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
3894                        Ok(FlatlandRequest::SetOpacity {
3895                            transform_id: req.transform_id,
3896                            value: req.value,
3897
3898                            control_handle,
3899                        })
3900                    }
3901                    0x6507843df12222d2 => {
3902                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3903                        let mut req = fidl::new_empty!(
3904                            FlatlandSetClipBoundaryRequest,
3905                            fidl::encoding::DefaultFuchsiaResourceDialect
3906                        );
3907                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetClipBoundaryRequest>(&header, _body_bytes, handles, &mut req)?;
3908                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
3909                        Ok(FlatlandRequest::SetClipBoundary {
3910                            transform_id: req.transform_id,
3911                            rect: req.rect,
3912
3913                            control_handle,
3914                        })
3915                    }
3916                    0x67a8abd2f19b1a74 => {
3917                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3918                        let mut req = fidl::new_empty!(
3919                            FlatlandAddChildRequest,
3920                            fidl::encoding::DefaultFuchsiaResourceDialect
3921                        );
3922                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandAddChildRequest>(&header, _body_bytes, handles, &mut req)?;
3923                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
3924                        Ok(FlatlandRequest::AddChild {
3925                            parent_transform_id: req.parent_transform_id,
3926                            child_transform_id: req.child_transform_id,
3927
3928                            control_handle,
3929                        })
3930                    }
3931                    0x41d6cd90b298b67a => {
3932                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3933                        let mut req = fidl::new_empty!(
3934                            FlatlandRemoveChildRequest,
3935                            fidl::encoding::DefaultFuchsiaResourceDialect
3936                        );
3937                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandRemoveChildRequest>(&header, _body_bytes, handles, &mut req)?;
3938                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
3939                        Ok(FlatlandRequest::RemoveChild {
3940                            parent_transform_id: req.parent_transform_id,
3941                            child_transform_id: req.child_transform_id,
3942
3943                            control_handle,
3944                        })
3945                    }
3946                    0x5b6d86cbbff81316 => {
3947                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3948                        let mut req = fidl::new_empty!(
3949                            FlatlandReplaceChildrenRequest,
3950                            fidl::encoding::DefaultFuchsiaResourceDialect
3951                        );
3952                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandReplaceChildrenRequest>(&header, _body_bytes, handles, &mut req)?;
3953                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
3954                        Ok(FlatlandRequest::ReplaceChildren {
3955                            parent_transform_id: req.parent_transform_id,
3956                            new_child_transform_ids: req.new_child_transform_ids,
3957
3958                            control_handle,
3959                        })
3960                    }
3961                    0x6e80ca5bcc566cd8 => {
3962                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3963                        let mut req = fidl::new_empty!(
3964                            FlatlandSetRootTransformRequest,
3965                            fidl::encoding::DefaultFuchsiaResourceDialect
3966                        );
3967                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetRootTransformRequest>(&header, _body_bytes, handles, &mut req)?;
3968                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
3969                        Ok(FlatlandRequest::SetRootTransform {
3970                            transform_id: req.transform_id,
3971
3972                            control_handle,
3973                        })
3974                    }
3975                    0x31c9d17b07c37ce4 => {
3976                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3977                        let mut req = fidl::new_empty!(
3978                            FlatlandSetHitRegionsRequest,
3979                            fidl::encoding::DefaultFuchsiaResourceDialect
3980                        );
3981                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetHitRegionsRequest>(&header, _body_bytes, handles, &mut req)?;
3982                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
3983                        Ok(FlatlandRequest::SetHitRegions {
3984                            transform_id: req.transform_id,
3985                            regions: req.regions,
3986
3987                            control_handle,
3988                        })
3989                    }
3990                    0x26d81af852d29562 => {
3991                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3992                        let mut req = fidl::new_empty!(
3993                            FlatlandSetInfiniteHitRegionRequest,
3994                            fidl::encoding::DefaultFuchsiaResourceDialect
3995                        );
3996                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetInfiniteHitRegionRequest>(&header, _body_bytes, handles, &mut req)?;
3997                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
3998                        Ok(FlatlandRequest::SetInfiniteHitRegion {
3999                            transform_id: req.transform_id,
4000                            hit_test: req.hit_test,
4001
4002                            control_handle,
4003                        })
4004                    }
4005                    0x2485fbcab7f943c => {
4006                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4007                        let mut req = fidl::new_empty!(
4008                            FlatlandCreateViewportRequest,
4009                            fidl::encoding::DefaultFuchsiaResourceDialect
4010                        );
4011                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandCreateViewportRequest>(&header, _body_bytes, handles, &mut req)?;
4012                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4013                        Ok(FlatlandRequest::CreateViewport {
4014                            viewport_id: req.viewport_id,
4015                            token: req.token,
4016                            properties: req.properties,
4017                            child_view_watcher: req.child_view_watcher,
4018
4019                            control_handle,
4020                        })
4021                    }
4022                    0x26fae823c4ebedad => {
4023                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4024                        let mut req = fidl::new_empty!(
4025                            FlatlandCreateImageRequest,
4026                            fidl::encoding::DefaultFuchsiaResourceDialect
4027                        );
4028                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandCreateImageRequest>(&header, _body_bytes, handles, &mut req)?;
4029                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4030                        Ok(FlatlandRequest::CreateImage {
4031                            image_id: req.image_id,
4032                            import_token: req.import_token,
4033                            vmo_index: req.vmo_index,
4034                            properties: req.properties,
4035
4036                            control_handle,
4037                        })
4038                    }
4039                    0x8039391d715eb28 => {
4040                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4041                        let mut req = fidl::new_empty!(
4042                            FlatlandSetImageSampleRegionRequest,
4043                            fidl::encoding::DefaultFuchsiaResourceDialect
4044                        );
4045                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetImageSampleRegionRequest>(&header, _body_bytes, handles, &mut req)?;
4046                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4047                        Ok(FlatlandRequest::SetImageSampleRegion {
4048                            image_id: req.image_id,
4049                            rect: req.rect,
4050
4051                            control_handle,
4052                        })
4053                    }
4054                    0x766cf99a2ec58446 => {
4055                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4056                        let mut req = fidl::new_empty!(
4057                            FlatlandSetImageDestinationSizeRequest,
4058                            fidl::encoding::DefaultFuchsiaResourceDialect
4059                        );
4060                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetImageDestinationSizeRequest>(&header, _body_bytes, handles, &mut req)?;
4061                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4062                        Ok(FlatlandRequest::SetImageDestinationSize {
4063                            image_id: req.image_id,
4064                            size: req.size,
4065
4066                            control_handle,
4067                        })
4068                    }
4069                    0x10f5da1356275b7b => {
4070                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4071                        let mut req = fidl::new_empty!(
4072                            FlatlandSetImageBlendingFunctionRequest,
4073                            fidl::encoding::DefaultFuchsiaResourceDialect
4074                        );
4075                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetImageBlendingFunctionRequest>(&header, _body_bytes, handles, &mut req)?;
4076                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4077                        Ok(FlatlandRequest::SetImageBlendingFunction {
4078                            image_id: req.image_id,
4079                            blend_mode: req.blend_mode,
4080
4081                            control_handle,
4082                        })
4083                    }
4084                    0x5b1667f130c3de67 => {
4085                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4086                        let mut req = fidl::new_empty!(
4087                            FlatlandSetImageBlendModeRequest,
4088                            fidl::encoding::DefaultFuchsiaResourceDialect
4089                        );
4090                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetImageBlendModeRequest>(&header, _body_bytes, handles, &mut req)?;
4091                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4092                        Ok(FlatlandRequest::SetImageBlendMode {
4093                            image_id: req.image_id,
4094                            blend_mode: req.blend_mode,
4095
4096                            control_handle,
4097                        })
4098                    }
4099                    0x2da9e4ef4c2cff6f => {
4100                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4101                        let mut req = fidl::new_empty!(
4102                            FlatlandSetImageOpacityRequest,
4103                            fidl::encoding::DefaultFuchsiaResourceDialect
4104                        );
4105                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetImageOpacityRequest>(&header, _body_bytes, handles, &mut req)?;
4106                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4107                        Ok(FlatlandRequest::SetImageOpacity {
4108                            image_id: req.image_id,
4109                            val: req.val,
4110
4111                            control_handle,
4112                        })
4113                    }
4114                    0x21b20f2c14aae6bc => {
4115                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4116                        let mut req = fidl::new_empty!(
4117                            FlatlandSetImageFlipRequest,
4118                            fidl::encoding::DefaultFuchsiaResourceDialect
4119                        );
4120                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetImageFlipRequest>(&header, _body_bytes, handles, &mut req)?;
4121                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4122                        Ok(FlatlandRequest::SetImageFlip {
4123                            image_id: req.image_id,
4124                            flip: req.flip,
4125
4126                            control_handle,
4127                        })
4128                    }
4129                    0x5e62355abc1c4c5d => {
4130                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4131                        let mut req = fidl::new_empty!(
4132                            FlatlandCreateFilledRectRequest,
4133                            fidl::encoding::DefaultFuchsiaResourceDialect
4134                        );
4135                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandCreateFilledRectRequest>(&header, _body_bytes, handles, &mut req)?;
4136                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4137                        Ok(FlatlandRequest::CreateFilledRect {
4138                            rect_id: req.rect_id,
4139
4140                            control_handle,
4141                        })
4142                    }
4143                    0x32d6ef41e182dfa5 => {
4144                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4145                        let mut req = fidl::new_empty!(
4146                            FlatlandSetSolidFillRequest,
4147                            fidl::encoding::DefaultFuchsiaResourceDialect
4148                        );
4149                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetSolidFillRequest>(&header, _body_bytes, handles, &mut req)?;
4150                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4151                        Ok(FlatlandRequest::SetSolidFill {
4152                            rect_id: req.rect_id,
4153                            color: req.color,
4154                            size: req.size,
4155
4156                            control_handle,
4157                        })
4158                    }
4159                    0x7392cabe45618f9b => {
4160                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4161                        let mut req = fidl::new_empty!(
4162                            FlatlandReleaseFilledRectRequest,
4163                            fidl::encoding::DefaultFuchsiaResourceDialect
4164                        );
4165                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandReleaseFilledRectRequest>(&header, _body_bytes, handles, &mut req)?;
4166                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4167                        Ok(FlatlandRequest::ReleaseFilledRect {
4168                            rect_id: req.rect_id,
4169
4170                            control_handle,
4171                        })
4172                    }
4173                    0x4ed2cfc0ce130862 => {
4174                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4175                        let mut req = fidl::new_empty!(
4176                            FlatlandSetContentRequest,
4177                            fidl::encoding::DefaultFuchsiaResourceDialect
4178                        );
4179                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetContentRequest>(&header, _body_bytes, handles, &mut req)?;
4180                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4181                        Ok(FlatlandRequest::SetContent {
4182                            transform_id: req.transform_id,
4183                            content_id: req.content_id,
4184
4185                            control_handle,
4186                        })
4187                    }
4188                    0x66ab67e9608ddb9f => {
4189                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4190                        let mut req = fidl::new_empty!(
4191                            FlatlandSetViewportPropertiesRequest,
4192                            fidl::encoding::DefaultFuchsiaResourceDialect
4193                        );
4194                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetViewportPropertiesRequest>(&header, _body_bytes, handles, &mut req)?;
4195                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4196                        Ok(FlatlandRequest::SetViewportProperties {
4197                            viewport_id: req.viewport_id,
4198                            properties: req.properties,
4199
4200                            control_handle,
4201                        })
4202                    }
4203                    0xab9328419451c22 => {
4204                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4205                        let mut req = fidl::new_empty!(
4206                            FlatlandReleaseTransformRequest,
4207                            fidl::encoding::DefaultFuchsiaResourceDialect
4208                        );
4209                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandReleaseTransformRequest>(&header, _body_bytes, handles, &mut req)?;
4210                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4211                        Ok(FlatlandRequest::ReleaseTransform {
4212                            transform_id: req.transform_id,
4213
4214                            control_handle,
4215                        })
4216                    }
4217                    0x5b35aab9baffecae => {
4218                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4219                        let mut req = fidl::new_empty!(
4220                            fidl::encoding::EmptyPayload,
4221                            fidl::encoding::DefaultFuchsiaResourceDialect
4222                        );
4223                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
4224                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4225                        Ok(FlatlandRequest::ReleaseView { control_handle })
4226                    }
4227                    0xbad474aeb5293f9 => {
4228                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4229                        let mut req = fidl::new_empty!(
4230                            FlatlandReleaseViewportRequest,
4231                            fidl::encoding::DefaultFuchsiaResourceDialect
4232                        );
4233                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandReleaseViewportRequest>(&header, _body_bytes, handles, &mut req)?;
4234                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4235                        Ok(FlatlandRequest::ReleaseViewport {
4236                            viewport_id: req.viewport_id,
4237
4238                            responder: FlatlandReleaseViewportResponder {
4239                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4240                                tx_id: header.tx_id,
4241                            },
4242                        })
4243                    }
4244                    0xb884ffdbc72c111 => {
4245                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4246                        let mut req = fidl::new_empty!(
4247                            FlatlandReleaseImageRequest,
4248                            fidl::encoding::DefaultFuchsiaResourceDialect
4249                        );
4250                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandReleaseImageRequest>(&header, _body_bytes, handles, &mut req)?;
4251                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4252                        Ok(FlatlandRequest::ReleaseImage { image_id: req.image_id, control_handle })
4253                    }
4254                    0x4ec8817c02828c3e => {
4255                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4256                        let mut req = fidl::new_empty!(
4257                            fidl::encoding::EmptyPayload,
4258                            fidl::encoding::DefaultFuchsiaResourceDialect
4259                        );
4260                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
4261                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4262                        Ok(FlatlandRequest::Clear { control_handle })
4263                    }
4264                    0x46a8b397e68a8888 => {
4265                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4266                        let mut req = fidl::new_empty!(
4267                            FlatlandSetDebugNameRequest,
4268                            fidl::encoding::DefaultFuchsiaResourceDialect
4269                        );
4270                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetDebugNameRequest>(&header, _body_bytes, handles, &mut req)?;
4271                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4272                        Ok(FlatlandRequest::SetDebugName { name: req.name, control_handle })
4273                    }
4274                    _ => Err(fidl::Error::UnknownOrdinal {
4275                        ordinal: header.ordinal,
4276                        protocol_name:
4277                            <FlatlandMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4278                    }),
4279                }))
4280            },
4281        )
4282    }
4283}
4284
4285/// Each Flatland instance contains a Graph, which consists of a set of objects, and the
4286/// relationships between those objects. The client can specify a subset of those objects
4287/// (specifically, the directed acyclic graph starting at the root transform) to be presented as
4288/// content to some kind of output -- usually, a display.
4289///
4290/// Flatland Graphs are both hierarchical, and distributed. Graphs from different Flatland instances
4291/// may be connected together, allowing multiple processes to be involved in authoring content for a
4292/// particular output.
4293///
4294/// All functions in this protocol are feed-forward. The operations they represent are not fully
4295/// executed until [`Present`] is called.
4296#[derive(Debug)]
4297pub enum FlatlandRequest {
4298    /// Complete execution of all feed-forward operations.
4299    ///
4300    /// If executing an operation produces an error (e.g., CreateTransform(0)), an [`OnError`] event
4301    /// is emitted. Operations that produce errors are ignored and the channel is closed.
4302    ///
4303    /// If the execution is completed successfully, [`OnNextFrameBegin`] emits NO_ERROR along
4304    /// with other valid fields.
4305    ///
4306    /// The client may only call [`Present`] when they have a non-zero number of present credits,
4307    /// which are tracked by the server. The server may increment the number of credits when it
4308    /// fires the [`OnNextFrameBegin`] event, which informs the client when it receives additional
4309    /// present credits. Each [`Present`] call uses one present credit and decrements the server
4310    /// count by one. If the client calls [`Present`] with no present credits, the server will
4311    /// return a `NO_PRESENTS_REMAINING` error.
4312    ///
4313    /// The client should assume that prior to receiving any [`OnNextFrameBegin`] events, they have
4314    /// one present credit.
4315    ///
4316    /// Every [`Present`] call results in one [`OnNextFrameBegin`] event, and one
4317    /// [`OnFramePresented`] event, typically in that order.
4318    ///
4319    /// When the commands flushed by [`Present`] make it to display, an [`OnFramePresented`] event
4320    /// is fired. This event includes information pertaining to all [`Present`]s that had content
4321    /// that were part of that frame.
4322    ///
4323    /// See [`fuchsia.ui.composition/PresentArgs`] documentation above for more detailed information
4324    /// on what arguments are passed in and their role.
4325    Present {
4326        args: PresentArgs,
4327        control_handle: FlatlandControlHandle,
4328    },
4329    /// Two Flatland instances may be connected in a parent-child relationship. The parent endpoint
4330    /// is held in a Viewport, and the child endpoint is held in a View. The parent Flatland
4331    /// instance that creates a Viewport has control over how the child's View is integrated into
4332    /// its own View.
4333    ///
4334    /// The lifecycle of a parent-child connection starts with two endpoints of a channel object:
4335    /// a ViewportCreationToken and a ViewCreationToken. Out-of-band protocols pass the
4336    /// ViewportCreationToken to the parent, which calls [`CreateViewport`], and the
4337    /// ViewCreationToken to the child, which calls [`CreateView`].
4338    ///
4339    /// Only nodes connected to the Root Transform in this Flatland instance will be rendered into
4340    /// the parent's Viewport.
4341    ///
4342    /// Calling [`CreateView`] a second time will disconnect the Root Transform from the existing
4343    /// parent's Viewport, and attach it to a new parent's Viewport. In other words, each View can
4344    /// only have one parent.
4345    ///
4346    /// This function is queued, meaning that the Root Transform will not be attached to the
4347    /// parent Viewport until [`Present`] is called. However, clients will receive information
4348    /// through their ParentViewportWatcher (e.g., LayoutInfo) immediately after calling this
4349    /// function, even if they have not called [`Present`] or [`SetRootTransform`]. This allows
4350    /// clients to wait for layout information from their parent before calling [`Present`].
4351    ///
4352    /// Any illegal operations on ParentViewportWatcher will cause both ParentViewportWatcher
4353    /// channel and this Flatland channel to be torn down.
4354    ///
4355    /// Lifecycle note. The lifetime of the ParentViewportWatcher channel is bound by the peer
4356    /// ViewportCreationToken. When the ViewportCreationToken dies, this ParentViewportWatcher
4357    /// channel is destroyed.
4358    ///
4359    /// Views and subgraphs of Views created using `CreateView` will not be represented in the
4360    /// ViewTree, and hence will not be able to participate in any ViewTree-dependent interactions
4361    /// such as touch, mouse or focus.
4362    /// The Flatland protocol provides no way for Views in the subgraph of a View created with
4363    /// `CreateView` to know that they are excluded from the ViewTree.
4364    CreateView {
4365        token: fidl_fuchsia_ui_views::ViewCreationToken,
4366        parent_viewport_watcher: fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>,
4367        control_handle: FlatlandControlHandle,
4368    },
4369    /// Identical to [`CreateView`], except it allows association of View identity (ViewRef) and
4370    /// view-bound protocols.
4371    CreateView2 {
4372        token: fidl_fuchsia_ui_views::ViewCreationToken,
4373        view_identity: fidl_fuchsia_ui_views::ViewIdentityOnCreation,
4374        protocols: ViewBoundProtocols,
4375        parent_viewport_watcher: fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>,
4376        control_handle: FlatlandControlHandle,
4377    },
4378    /// Creates a new Transform node. Transforms are a hierarchical piece of a Flatland graph. They
4379    /// can have children, and can reference Content. A sub-graph represented by a Transform and its
4380    /// descendants can be rendered to a display.
4381    ///
4382    /// Transforms are kept alive, even when released, as long as they are children of either an
4383    /// unreleased Transform, or the Root Transform.
4384    ///
4385    /// Each Transform can have a single piece of attached Content. Common types of Content include
4386    /// bitmaps, asynchronous streams of images, and Viewports to Views hosted in other Flatland
4387    /// instances.
4388    ///
4389    /// Transforms have attributes. Child Transforms inherit the combined attributes of their
4390    /// parents. Content attached to a Transform is also affected by that Transform's attributes.
4391    ///
4392    /// When a sub-graph of Transforms is rendered, Content will be rendered back-to-front, starting
4393    /// with the Content on the root transform, and continuing recursively through all of its child
4394    /// Transforms in the order the children were added. See [`AddChild`] for more information.
4395    ///
4396    /// Zero is not a valid transform id. All other values are valid, assuming they are not already
4397    /// in use (see [`ReleaseTransform`] for more details).
4398    CreateTransform {
4399        transform_id: TransformId,
4400        control_handle: FlatlandControlHandle,
4401    },
4402    /// All Transform objects support all attributes.
4403    ///
4404    /// Geometric attributes are applied in the following order:
4405    /// 1. Scale (relative to the parent transform's coordinate space)
4406    /// 2. Orientation (relative to the parent transform's coordinate space)
4407    /// 3. Translation (relative to the parent transforms's coordinate space,
4408    ///    unaffected by scale applied to the current transform).
4409    /// 4. Clipping (relative to the current transform's coordinate space)
4410    ///
4411    /// The effects of each of these attributes are cumulative. This means the transform's position
4412    /// in the view space, and its clip boundary, will be calculated based on that chain of
4413    /// geometric attributes going up to the root transform.
4414    ///
4415    /// For instance, in a nested hierarchy such as the following:
4416    ///     [Root-Transform -> Transform1 -> Transform2 -> CurrentTransform]
4417    /// If Transform1 is translated by [2,0] and Transform2 is translated by [0,1] then the
4418    /// view-space position of CurrentTransform will be [2,1].
4419    ///
4420    /// Sets the translation on a Transform. The order of geometric attribute application is
4421    /// addressed above.
4422    SetTranslation {
4423        transform_id: TransformId,
4424        translation: fidl_fuchsia_math::Vec_,
4425        control_handle: FlatlandControlHandle,
4426    },
4427    /// Sets the orientation on a Transform. The order of geometric attribute application is
4428    /// addressed in the documentation for [`SetTranslation`]. In Flatland, the +X axis is
4429    /// to the right and the +Y axis is down. There is no notion of a Z axis. CCW is defined
4430    /// from the POV of the user, as if a skeuomorphoic clock is displayed on the screen.
4431    SetOrientation {
4432        transform_id: TransformId,
4433        orientation: Orientation,
4434        control_handle: FlatlandControlHandle,
4435    },
4436    /// Sets the scale on a transform. The order of geometric attribute application is
4437    /// addressed above. The (x,y) values in the VecF |scale| refer to the scale factor in the
4438    /// x-axis (width) and y-axis (height) respectively. Scale values must be normal 32-bit
4439    /// floating point values: https://en.wikipedia.org/wiki/Normal_number_%28computing%29
4440    SetScale {
4441        transform_id: TransformId,
4442        scale: fidl_fuchsia_math::VecF,
4443        control_handle: FlatlandControlHandle,
4444    },
4445    /// Sets an opacity in linear space to be applied to a transform and its descendents,
4446    /// which include other transforms and content. Opacity values must be in the range
4447    /// of [0.0, 1.0], where 0.0 is completely transparent and 1.0 is completely opaque.
4448    /// Attempting to call this function with values outside that range will result in
4449    /// an error. A transform's opacity value is multiplied with that of its parent. This
4450    /// effect works differently from group opacity. Using group opacity, child nodes are
4451    /// rendered together first, and then have the parent's opacity applied as a post-effect.
4452    /// Here, opacity is applied to each child individually. This may result in a very
4453    /// different effect.
4454    SetOpacity {
4455        transform_id: TransformId,
4456        value: f32,
4457        control_handle: FlatlandControlHandle,
4458    },
4459    /// Sets the bounds, expressed in the local coordinate space of the transform, that
4460    /// constrains the region that content attached to this transform can be rendered to.
4461    /// If the content's area exceeds the clip bounds, the area outside the bounds will
4462    /// not be rendered. These bounds are valid for all children of this transform node as
4463    /// well, which includes nested Flatland instances and their node hierarchies.
4464    /// If a child transform attempts to set clip bounds larger than that of its parent,
4465    /// it will be clipped to the parent's clip bounds. The default state is for a transform
4466    /// to be unclipped, meaning it will not have any bounds placed on its render region.
4467    /// The clip width/height must be positive. Negative values will result in an error.
4468    /// Passing in an empty box to the |rect| parameter will remove the clip bounds.
4469    SetClipBoundary {
4470        transform_id: TransformId,
4471        rect: Option<Box<fidl_fuchsia_math::Rect>>,
4472        control_handle: FlatlandControlHandle,
4473    },
4474    /// Adds a child Transform to a parent Transform. The new child Transform, and any Content
4475    /// attached to it or its children, will be rendered on top of the parent's Content, as well as
4476    /// any previously added children.
4477    AddChild {
4478        parent_transform_id: TransformId,
4479        child_transform_id: TransformId,
4480        control_handle: FlatlandControlHandle,
4481    },
4482    /// Removes a child Transform from a parent Transform.
4483    RemoveChild {
4484        parent_transform_id: TransformId,
4485        child_transform_id: TransformId,
4486        control_handle: FlatlandControlHandle,
4487    },
4488    /// Removes all child Transforms from a parent Transform and replaces them with the new child
4489    /// transforms in `new_child_transform_ids`.
4490    ReplaceChildren {
4491        parent_transform_id: TransformId,
4492        new_child_transform_ids: Vec<TransformId>,
4493        control_handle: FlatlandControlHandle,
4494    },
4495    /// Sets the Root Transform for the graph.
4496    ///
4497    /// The sub-graph defined by the Root Transform and its children will be rendered as View
4498    /// in the connected parent's Viewport (see [`CreateView`]). Any parents of the Root Transform
4499    /// in this Graph will be ignored.
4500    ///
4501    /// The Root Transform, and all children of the Root Transform, are kept alive if they are
4502    /// released (see [`ReleaseTransform`] for more details).
4503    ///
4504    /// There is only ever one Root. Since 0 is not a valid transform id (see [`CreateTransform`]),
4505    /// calling SetRootTransform(0) clears the current Root, destroying any previously released
4506    /// objects that are not referenced by the new root.
4507    ///
4508    /// Note that every View has a clip boundary equivalent to its logical size. Anything outside
4509    /// that clip boundary will not be rendered. Hence, the Root Transform has a useful coordinate
4510    /// space of (0, 0) to (logical_size.width, logical_size.height), where (0, 0) is the upper left
4511    /// corner.
4512    ///
4513    /// Setting the root transform installs a full screen hit region on the root transform. Clients
4514    /// may remove this hit region if they don't want users to be able to interact with the root
4515    /// transform's content. For additional details on hit regions, see the [`SetHitRegions`]
4516    /// documentation.
4517    ///
4518    /// Default hit region rules
4519    ///
4520    ///   A default hit region follows these rules:
4521    ///   - When [`SetRootTransform`](T) is called, T receives a maximal hit region, covering the
4522    ///   entire view.
4523    ///   - If [`SetHitRegions`] is called on T, either before or after [`SetRootTransform`](T),
4524    ///   then no default hit region is active and the client specified hit regions are used.
4525    ///   - If a transform is no longer the root transform, i.e., [`SetRootTransform`](U) is
4526    ///   called, then the original transform no longer has its default hit region.
4527    ///   - Clients can remove or modify the root transform's hit regions the same way they would
4528    ///   reset any other transform's hit regions, by calling [`SetHitRegions`] with the appropriate
4529    ///   vector.
4530    SetRootTransform {
4531        transform_id: TransformId,
4532        control_handle: FlatlandControlHandle,
4533    },
4534    /// Sets the interactive areas for a Transform. By default, Content is not interactive; hit
4535    /// regions must be placed for a user to interact with the Content in a View. Because hit
4536    /// regions are described in the Flatland protocol, a Flatland instance can synchronize Content
4537    /// and hit regions.
4538    ///
4539    /// Each hit region is placed in the coordinate space of the owning Transform, and may or may
4540    /// not interact with different types of hit testing, depending on its [`HitTestInteraction`]
4541    /// type. When there are multiple hit regions that intersect with a hit test, the precedence
4542    /// rules given below dictate which hit region has interacted with the hit test. Only Transforms
4543    /// that transitively connect to the root Transform have their hit regions interact with a hit
4544    /// test.
4545    ///
4546    /// Calling this function replaces any previous values set on this Transform. To reset a
4547    /// Transform to "no hit testing": send an empty vector with [`SetHitRegions`].
4548    ///
4549    /// Note that root transforms get a default hit region installed by Flatland. For more details,
4550    /// see the [`SetRootTransform`] documentation.
4551    ///
4552    /// Precedence rules
4553    ///   Within a Transform, if multiple hit regions overlap, the hit test examines each
4554    ///   intersecting hit region for a possible interaction. Thus, for a regular hit test R and an
4555    ///   accessibility hit test A, where R and A both intersect two hit regions D ([`DEFAULT`]) and
4556    ///   S ([`SEMANTICALLY_INVISIBLE`]) on the same Transform, (1) R interacts with both D and S,
4557    ///   and (2) A only interacts with D. Generally, hit regions that overlap in a single Transform
4558    ///   can cause confusing behavior.
4559    ///
4560    ///   Within a View, for a given hit test, the front-most Transform's hit regions take
4561    ///   precedence over those behind. This follows the expected reverse "render order" of
4562    ///   Transforms (described in [`CreateTransform`]), where a user expects to interact with
4563    ///   Content that is visible, or front-most.
4564    ///
4565    ///   Across Flatland instances, for a given hit test, the front-most instance's front-most
4566    ///   Transform's hit regions take precedence over those behind. This follows the expected
4567    ///   reverse "render order" of views, where a user expects to interact with the View that is
4568    ///   visible, or front-most. For example, if a child View owns Content that is rendered over
4569    ///   the parent View, the user expects to interact with the child's Content.
4570    SetHitRegions {
4571        transform_id: TransformId,
4572        regions: Vec<HitRegion>,
4573        control_handle: FlatlandControlHandle,
4574    },
4575    /// Identical to [`SetHitRegions`], except the hit region associated with [`transform_id`]
4576    /// covers an infinite region. The hit region is invariant against translation, scaling, and
4577    /// orientation of the Transform.
4578    ///
4579    /// An infinite hit region is still limited in extent by the View's clip boundary, just like a
4580    /// finite hit region.
4581    ///
4582    /// Calling this function replaces any previous values set on this Transform. To reset a
4583    /// Transform to "no hit testing": send an empty vector with [`SetHitRegions`].
4584    SetInfiniteHitRegion {
4585        transform_id: TransformId,
4586        hit_test: HitTestInteraction,
4587        control_handle: FlatlandControlHandle,
4588    },
4589    /// The Viewport and View pair, together, represent the connection between two Flatland
4590    /// instances. The Viewport is created in the parent, and the View is created in the child. The
4591    /// parent has control over how the child's View is integrated into its own View.
4592    ///
4593    /// Any illegal operations on ChildViewWatcher will cause both ChildViewWatcher channel and this
4594    /// Flatland channel to be torn down.
4595    ///
4596    /// `ViewportProperties` must have logical_size set. This is the initial size that will drive
4597    /// the layout of the child. The logical_size is also used as the default Content size, but
4598    /// subsequent changes to the logical_size will have no effect on the Content size.
4599    ///
4600    /// `ViewportProperties` may have inset field not set. In that case, the default value of
4601    /// (0, 0, 0, 0) is used.
4602    ///
4603    /// The logical_size must have positive X and Y components.
4604    ///
4605    /// Zero is not a valid ContentId. All other values are valid, assuming they are not already
4606    /// in use for another piece of Content (see [`ReleaseViewport`] for more details).
4607    ///
4608    /// Lifecycle note. The lifetime of the ChildViewWatcher channel is bound by the peer
4609    /// ViewCreationToken. When the ViewCreationToken dies, this ChildViewWatcher channel is
4610    /// destroyed.
4611    CreateViewport {
4612        viewport_id: ContentId,
4613        token: fidl_fuchsia_ui_views::ViewportCreationToken,
4614        properties: ViewportProperties,
4615        child_view_watcher: fidl::endpoints::ServerEnd<ChildViewWatcherMarker>,
4616        control_handle: FlatlandControlHandle,
4617    },
4618    /// An Image is a bitmap backed by a specific VMO in a BufferCollection.
4619    ///
4620    /// Image creation requires an allocated BufferCollection registered with Allocator. This
4621    /// function will fail unless all clients of the specified BufferCollection have set their
4622    /// constraints.
4623    ///
4624    /// The Image must reference a valid VMO index and must have ImageProperties that fall within
4625    /// the constraints specified by the backing BufferCollection (i.e. width and height within a
4626    /// valid range, etc.)
4627    ///
4628    /// Zero is not a valid Image id. All other values are valid, assuming they are not already in
4629    /// use for another piece of Content (see [`ReleaseImage`] for more details).
4630    CreateImage {
4631        image_id: ContentId,
4632        import_token: BufferCollectionImportToken,
4633        vmo_index: u32,
4634        properties: ImageProperties,
4635        control_handle: FlatlandControlHandle,
4636    },
4637    /// This function is used to determine the region (in texel space) of an image that will be used
4638    /// by Flatland when rendering. The image to be sampled is referenced by [`image_id`] and the
4639    /// sample region is specified by [`rect`] which itself is comprised of an origin point (x,y) as
4640    /// well as a width and height, in unnormalized coordinates. It is illegal to call this function
4641    /// on non-image content, or to sample a region outside of the texel space of the image. In
4642    /// other words, the region specifed by [`rect`] must not exceed the ranges (0, image_width) and
4643    /// (0, image_height). If (rect.x + rect.width > image_width) or (rect.y + rect.height >
4644    /// image_height) or if any of the values are negative, this will result in an error.
4645    ///
4646    /// If this method is not called, the default sample region is the rectangle with origin at
4647    /// (0, 0) and width and height set at ImageProperties from [`CreateImage`].
4648    SetImageSampleRegion {
4649        image_id: ContentId,
4650        rect: fidl_fuchsia_math::RectF,
4651        control_handle: FlatlandControlHandle,
4652    },
4653    /// The content size for an Image is the size of the rectangle in the parent's logical
4654    /// coordinate space that the image occupies. This combined with the global translation of the
4655    /// transform it is attached to determines the size and location of where the content is
4656    /// rendered on the display.
4657    ///
4658    /// If this method is not called, the default image destination size is the width and height set
4659    /// at ImageProperties from [`CreateImage`]. The destination size will be affected by scaling if
4660    /// [`SetScale`] is used on the attached Transform or its parents.
4661    SetImageDestinationSize {
4662        image_id: ContentId,
4663        size: fidl_fuchsia_math::SizeU,
4664        control_handle: FlatlandControlHandle,
4665    },
4666    /// Determines the blend function to use when rendering the content specified by
4667    /// |image_id|. |image_id| must be a valid ContentId associated to a transform through
4668    /// a call to |CreateImage| or |CreateFilledRect|. For details on the different blend functions
4669    /// that are available, please refer to the BlendMode enum. If this function is not called, then
4670    /// the default blendmode is BlendMode::SRC.
4671    SetImageBlendingFunction {
4672        image_id: ContentId,
4673        blend_mode: BlendMode,
4674        control_handle: FlatlandControlHandle,
4675    },
4676    /// Determines the blend function to use when rendering the content specified by
4677    /// |image_id|. |image_id| must be a valid ContentId associated to a transform through
4678    /// a call to |CreateImage| or |CreateFilledRect|. For details on the different blend functions
4679    /// that are available, please refer to the BlendMode2 enum. If this function is not called,
4680    /// the default blendmode is BlendMode2::REPLACE.
4681    SetImageBlendMode {
4682        image_id: ContentId,
4683        blend_mode: BlendMode2,
4684        control_handle: FlatlandControlHandle,
4685    },
4686    /// Sets an opacity in linear space to be applied to a flatland image. Opacity values must
4687    /// be in the range [0.0, 1.0].
4688    SetImageOpacity {
4689        image_id: ContentId,
4690        val: f32,
4691        control_handle: FlatlandControlHandle,
4692    },
4693    /// Sets the image flip to be applied to a flatland image. This call must be performed after a
4694    /// successful |CreateImage| call. If an invalid |image_id| is supplied, the channel will be
4695    /// closed due to FlatlandError::BAD_OPERATION. This flip will be applied to the Image before
4696    /// parent Transform Orientations. If this function is not called, then the default flip value
4697    /// is ImageFlip::NONE.
4698    SetImageFlip {
4699        image_id: ContentId,
4700        flip: ImageFlip,
4701        control_handle: FlatlandControlHandle,
4702    },
4703    /// Creates a solid-color rectangle. By default a filled-rect does not have a defined
4704    /// color or size. It is necessary to call |SetSolidFill| to specify a color and size
4705    /// before a filled rect can be used for rendering. Not doing so will result the
4706    CreateFilledRect {
4707        rect_id: ContentId,
4708        control_handle: FlatlandControlHandle,
4709    },
4710    /// Defines the color and size of a filled rect. |rect_id| must refer to content that
4711    /// was created via a call to CreateFilledRect. The color is not premultiplied. Color values
4712    /// must be within the range [0,1] inclusive, and normal 32-bit
4713    /// floating point values: https://en.wikipedia.org/wiki/Normal_number_%28computing%29. Values
4714    /// that do not conform to these specifications will cause the channel to close.
4715    /// The rectangle's top left corner will be at (0, 0) in its transform's coordinate space.
4716    /// Hence, its bottom right corner will be at (size.width, size.height).
4717    SetSolidFill {
4718        rect_id: ContentId,
4719        color: ColorRgba,
4720        size: fidl_fuchsia_math::SizeU,
4721        control_handle: FlatlandControlHandle,
4722    },
4723    /// Automatically garbage collects the rectangle when it is no longer needed for
4724    /// rendering. |rect_id| must have been instantiated with a call to
4725    /// |CreateFilledRect|. Once released, the ID immediately goes out of scope and is free
4726    /// to be used again.
4727    ReleaseFilledRect {
4728        rect_id: ContentId,
4729        control_handle: FlatlandControlHandle,
4730    },
4731    /// Setting a piece of Content on a Transform makes that Content visible in the render tree as
4732    /// long as the Transform is visible from the root Transform. The Content will be rendered
4733    /// before, and therefore "behind", any Content attached to the descendants of the Transform.
4734    ///
4735    /// Because each Transform can have, at most, a single piece of Content on it, calling this
4736    /// function on a Transform that already has Content will replace that Content.
4737    ///
4738    /// A Content may be set on more than one Transform.
4739    ///
4740    /// Calling this function with a Content id of 0 will remove any Content currently on the
4741    /// Transform.
4742    SetContent {
4743        transform_id: TransformId,
4744        content_id: ContentId,
4745        control_handle: FlatlandControlHandle,
4746    },
4747    /// Transforms are usually sufficient to change how Content is presented. Viewports, however,
4748    /// have special properties that are not part of the Transform hierarchy. Those properties can
4749    /// be set using this function.
4750    SetViewportProperties {
4751        viewport_id: ContentId,
4752        properties: ViewportProperties,
4753        control_handle: FlatlandControlHandle,
4754    },
4755    /// Released Transforms will be garbage collected by the system once they are no longer
4756    /// necessary for rendering. For Transforms, this means there is no path from any unreleased
4757    /// Transform to the newly-released Transform.
4758    ///
4759    /// Once released, the id immediately goes out of scope for future function calls and can be
4760    /// reused when creating new Transforms.
4761    ///
4762    /// It is an error to call functions with a released id (unless that id has been reused to
4763    /// construct a new Transform).
4764    ReleaseTransform {
4765        transform_id: TransformId,
4766        control_handle: FlatlandControlHandle,
4767    },
4768    ReleaseView {
4769        control_handle: FlatlandControlHandle,
4770    },
4771    /// Releases a Viewport from the scene, even if the Viewport is still connected to a Transform.
4772    /// Unlike other resources, Viewports are garbage collected by the system during the next
4773    /// [`Present`] because a removed Viewport is guaranteed to provide no renderable content.
4774    ///
4775    /// Use SetContent(transform_id, 0) to clean up references to released Viewports.
4776    ///
4777    /// Despite having a return type, this function is still feed-forward like [`CreateView`] and
4778    /// requires a call to [`Present`] to be executed. The ViewportCreationToken will be returned
4779    /// after the presented operations have been executed.
4780    ReleaseViewport {
4781        viewport_id: ContentId,
4782        responder: FlatlandReleaseViewportResponder,
4783    },
4784    /// Released Images will be garbage collected by the system once they are no longer necessary
4785    /// for rendering. For Images, this means the Image is no longer attached to any Transform and
4786    /// any pending rendering that references the Image is complete.
4787    ///
4788    /// Use SetContent(transform_id, 0) to clean up references to released Images.
4789    ///
4790    /// Once released, the id immediately goes out of scope for future function calls and can be
4791    /// reused when creating new Images.
4792    ///
4793    /// It is an error to call functions with a released id (unless that id has been reused to
4794    /// construct a new Image).
4795    ReleaseImage {
4796        image_id: ContentId,
4797        control_handle: FlatlandControlHandle,
4798    },
4799    /// This function will reset all state on this interface. This includes destroying all existing
4800    /// View and Viewports without returning the associated Token to the caller.
4801    Clear {
4802        control_handle: FlatlandControlHandle,
4803    },
4804    /// Set debug name of the current client that can be used by Flatland to print as a prefix to
4805    /// logs to help client distinguish what is theirs. [`name`] can be an arbitrary string, but the
4806    /// current process name (see fsl::GetCurrentProcessName()) is a good default.
4807    SetDebugName {
4808        name: String,
4809        control_handle: FlatlandControlHandle,
4810    },
4811}
4812
4813impl FlatlandRequest {
4814    #[allow(irrefutable_let_patterns)]
4815    pub fn into_present(self) -> Option<(PresentArgs, FlatlandControlHandle)> {
4816        if let FlatlandRequest::Present { args, control_handle } = self {
4817            Some((args, control_handle))
4818        } else {
4819            None
4820        }
4821    }
4822
4823    #[allow(irrefutable_let_patterns)]
4824    pub fn into_create_view(
4825        self,
4826    ) -> Option<(
4827        fidl_fuchsia_ui_views::ViewCreationToken,
4828        fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>,
4829        FlatlandControlHandle,
4830    )> {
4831        if let FlatlandRequest::CreateView { token, parent_viewport_watcher, control_handle } = self
4832        {
4833            Some((token, parent_viewport_watcher, control_handle))
4834        } else {
4835            None
4836        }
4837    }
4838
4839    #[allow(irrefutable_let_patterns)]
4840    pub fn into_create_view2(
4841        self,
4842    ) -> Option<(
4843        fidl_fuchsia_ui_views::ViewCreationToken,
4844        fidl_fuchsia_ui_views::ViewIdentityOnCreation,
4845        ViewBoundProtocols,
4846        fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>,
4847        FlatlandControlHandle,
4848    )> {
4849        if let FlatlandRequest::CreateView2 {
4850            token,
4851            view_identity,
4852            protocols,
4853            parent_viewport_watcher,
4854            control_handle,
4855        } = self
4856        {
4857            Some((token, view_identity, protocols, parent_viewport_watcher, control_handle))
4858        } else {
4859            None
4860        }
4861    }
4862
4863    #[allow(irrefutable_let_patterns)]
4864    pub fn into_create_transform(self) -> Option<(TransformId, FlatlandControlHandle)> {
4865        if let FlatlandRequest::CreateTransform { transform_id, control_handle } = self {
4866            Some((transform_id, control_handle))
4867        } else {
4868            None
4869        }
4870    }
4871
4872    #[allow(irrefutable_let_patterns)]
4873    pub fn into_set_translation(
4874        self,
4875    ) -> Option<(TransformId, fidl_fuchsia_math::Vec_, FlatlandControlHandle)> {
4876        if let FlatlandRequest::SetTranslation { transform_id, translation, control_handle } = self
4877        {
4878            Some((transform_id, translation, control_handle))
4879        } else {
4880            None
4881        }
4882    }
4883
4884    #[allow(irrefutable_let_patterns)]
4885    pub fn into_set_orientation(self) -> Option<(TransformId, Orientation, FlatlandControlHandle)> {
4886        if let FlatlandRequest::SetOrientation { transform_id, orientation, control_handle } = self
4887        {
4888            Some((transform_id, orientation, control_handle))
4889        } else {
4890            None
4891        }
4892    }
4893
4894    #[allow(irrefutable_let_patterns)]
4895    pub fn into_set_scale(
4896        self,
4897    ) -> Option<(TransformId, fidl_fuchsia_math::VecF, FlatlandControlHandle)> {
4898        if let FlatlandRequest::SetScale { transform_id, scale, control_handle } = self {
4899            Some((transform_id, scale, control_handle))
4900        } else {
4901            None
4902        }
4903    }
4904
4905    #[allow(irrefutable_let_patterns)]
4906    pub fn into_set_opacity(self) -> Option<(TransformId, f32, FlatlandControlHandle)> {
4907        if let FlatlandRequest::SetOpacity { transform_id, value, control_handle } = self {
4908            Some((transform_id, value, control_handle))
4909        } else {
4910            None
4911        }
4912    }
4913
4914    #[allow(irrefutable_let_patterns)]
4915    pub fn into_set_clip_boundary(
4916        self,
4917    ) -> Option<(TransformId, Option<Box<fidl_fuchsia_math::Rect>>, FlatlandControlHandle)> {
4918        if let FlatlandRequest::SetClipBoundary { transform_id, rect, control_handle } = self {
4919            Some((transform_id, rect, control_handle))
4920        } else {
4921            None
4922        }
4923    }
4924
4925    #[allow(irrefutable_let_patterns)]
4926    pub fn into_add_child(self) -> Option<(TransformId, TransformId, FlatlandControlHandle)> {
4927        if let FlatlandRequest::AddChild {
4928            parent_transform_id,
4929            child_transform_id,
4930            control_handle,
4931        } = self
4932        {
4933            Some((parent_transform_id, child_transform_id, control_handle))
4934        } else {
4935            None
4936        }
4937    }
4938
4939    #[allow(irrefutable_let_patterns)]
4940    pub fn into_remove_child(self) -> Option<(TransformId, TransformId, FlatlandControlHandle)> {
4941        if let FlatlandRequest::RemoveChild {
4942            parent_transform_id,
4943            child_transform_id,
4944            control_handle,
4945        } = self
4946        {
4947            Some((parent_transform_id, child_transform_id, control_handle))
4948        } else {
4949            None
4950        }
4951    }
4952
4953    #[allow(irrefutable_let_patterns)]
4954    pub fn into_replace_children(
4955        self,
4956    ) -> Option<(TransformId, Vec<TransformId>, FlatlandControlHandle)> {
4957        if let FlatlandRequest::ReplaceChildren {
4958            parent_transform_id,
4959            new_child_transform_ids,
4960            control_handle,
4961        } = self
4962        {
4963            Some((parent_transform_id, new_child_transform_ids, control_handle))
4964        } else {
4965            None
4966        }
4967    }
4968
4969    #[allow(irrefutable_let_patterns)]
4970    pub fn into_set_root_transform(self) -> Option<(TransformId, FlatlandControlHandle)> {
4971        if let FlatlandRequest::SetRootTransform { transform_id, control_handle } = self {
4972            Some((transform_id, control_handle))
4973        } else {
4974            None
4975        }
4976    }
4977
4978    #[allow(irrefutable_let_patterns)]
4979    pub fn into_set_hit_regions(
4980        self,
4981    ) -> Option<(TransformId, Vec<HitRegion>, FlatlandControlHandle)> {
4982        if let FlatlandRequest::SetHitRegions { transform_id, regions, control_handle } = self {
4983            Some((transform_id, regions, control_handle))
4984        } else {
4985            None
4986        }
4987    }
4988
4989    #[allow(irrefutable_let_patterns)]
4990    pub fn into_set_infinite_hit_region(
4991        self,
4992    ) -> Option<(TransformId, HitTestInteraction, FlatlandControlHandle)> {
4993        if let FlatlandRequest::SetInfiniteHitRegion { transform_id, hit_test, control_handle } =
4994            self
4995        {
4996            Some((transform_id, hit_test, control_handle))
4997        } else {
4998            None
4999        }
5000    }
5001
5002    #[allow(irrefutable_let_patterns)]
5003    pub fn into_create_viewport(
5004        self,
5005    ) -> Option<(
5006        ContentId,
5007        fidl_fuchsia_ui_views::ViewportCreationToken,
5008        ViewportProperties,
5009        fidl::endpoints::ServerEnd<ChildViewWatcherMarker>,
5010        FlatlandControlHandle,
5011    )> {
5012        if let FlatlandRequest::CreateViewport {
5013            viewport_id,
5014            token,
5015            properties,
5016            child_view_watcher,
5017            control_handle,
5018        } = self
5019        {
5020            Some((viewport_id, token, properties, child_view_watcher, control_handle))
5021        } else {
5022            None
5023        }
5024    }
5025
5026    #[allow(irrefutable_let_patterns)]
5027    pub fn into_create_image(
5028        self,
5029    ) -> Option<(ContentId, BufferCollectionImportToken, u32, ImageProperties, FlatlandControlHandle)>
5030    {
5031        if let FlatlandRequest::CreateImage {
5032            image_id,
5033            import_token,
5034            vmo_index,
5035            properties,
5036            control_handle,
5037        } = self
5038        {
5039            Some((image_id, import_token, vmo_index, properties, control_handle))
5040        } else {
5041            None
5042        }
5043    }
5044
5045    #[allow(irrefutable_let_patterns)]
5046    pub fn into_set_image_sample_region(
5047        self,
5048    ) -> Option<(ContentId, fidl_fuchsia_math::RectF, FlatlandControlHandle)> {
5049        if let FlatlandRequest::SetImageSampleRegion { image_id, rect, control_handle } = self {
5050            Some((image_id, rect, control_handle))
5051        } else {
5052            None
5053        }
5054    }
5055
5056    #[allow(irrefutable_let_patterns)]
5057    pub fn into_set_image_destination_size(
5058        self,
5059    ) -> Option<(ContentId, fidl_fuchsia_math::SizeU, FlatlandControlHandle)> {
5060        if let FlatlandRequest::SetImageDestinationSize { image_id, size, control_handle } = self {
5061            Some((image_id, size, control_handle))
5062        } else {
5063            None
5064        }
5065    }
5066
5067    #[allow(irrefutable_let_patterns)]
5068    pub fn into_set_image_blending_function(
5069        self,
5070    ) -> Option<(ContentId, BlendMode, FlatlandControlHandle)> {
5071        if let FlatlandRequest::SetImageBlendingFunction { image_id, blend_mode, control_handle } =
5072            self
5073        {
5074            Some((image_id, blend_mode, control_handle))
5075        } else {
5076            None
5077        }
5078    }
5079
5080    #[allow(irrefutable_let_patterns)]
5081    pub fn into_set_image_blend_mode(
5082        self,
5083    ) -> Option<(ContentId, BlendMode2, FlatlandControlHandle)> {
5084        if let FlatlandRequest::SetImageBlendMode { image_id, blend_mode, control_handle } = self {
5085            Some((image_id, blend_mode, control_handle))
5086        } else {
5087            None
5088        }
5089    }
5090
5091    #[allow(irrefutable_let_patterns)]
5092    pub fn into_set_image_opacity(self) -> Option<(ContentId, f32, FlatlandControlHandle)> {
5093        if let FlatlandRequest::SetImageOpacity { image_id, val, control_handle } = self {
5094            Some((image_id, val, control_handle))
5095        } else {
5096            None
5097        }
5098    }
5099
5100    #[allow(irrefutable_let_patterns)]
5101    pub fn into_set_image_flip(self) -> Option<(ContentId, ImageFlip, FlatlandControlHandle)> {
5102        if let FlatlandRequest::SetImageFlip { image_id, flip, control_handle } = self {
5103            Some((image_id, flip, control_handle))
5104        } else {
5105            None
5106        }
5107    }
5108
5109    #[allow(irrefutable_let_patterns)]
5110    pub fn into_create_filled_rect(self) -> Option<(ContentId, FlatlandControlHandle)> {
5111        if let FlatlandRequest::CreateFilledRect { rect_id, control_handle } = self {
5112            Some((rect_id, control_handle))
5113        } else {
5114            None
5115        }
5116    }
5117
5118    #[allow(irrefutable_let_patterns)]
5119    pub fn into_set_solid_fill(
5120        self,
5121    ) -> Option<(ContentId, ColorRgba, fidl_fuchsia_math::SizeU, FlatlandControlHandle)> {
5122        if let FlatlandRequest::SetSolidFill { rect_id, color, size, control_handle } = self {
5123            Some((rect_id, color, size, control_handle))
5124        } else {
5125            None
5126        }
5127    }
5128
5129    #[allow(irrefutable_let_patterns)]
5130    pub fn into_release_filled_rect(self) -> Option<(ContentId, FlatlandControlHandle)> {
5131        if let FlatlandRequest::ReleaseFilledRect { rect_id, control_handle } = self {
5132            Some((rect_id, control_handle))
5133        } else {
5134            None
5135        }
5136    }
5137
5138    #[allow(irrefutable_let_patterns)]
5139    pub fn into_set_content(self) -> Option<(TransformId, ContentId, FlatlandControlHandle)> {
5140        if let FlatlandRequest::SetContent { transform_id, content_id, control_handle } = self {
5141            Some((transform_id, content_id, control_handle))
5142        } else {
5143            None
5144        }
5145    }
5146
5147    #[allow(irrefutable_let_patterns)]
5148    pub fn into_set_viewport_properties(
5149        self,
5150    ) -> Option<(ContentId, ViewportProperties, FlatlandControlHandle)> {
5151        if let FlatlandRequest::SetViewportProperties { viewport_id, properties, control_handle } =
5152            self
5153        {
5154            Some((viewport_id, properties, control_handle))
5155        } else {
5156            None
5157        }
5158    }
5159
5160    #[allow(irrefutable_let_patterns)]
5161    pub fn into_release_transform(self) -> Option<(TransformId, FlatlandControlHandle)> {
5162        if let FlatlandRequest::ReleaseTransform { transform_id, control_handle } = self {
5163            Some((transform_id, control_handle))
5164        } else {
5165            None
5166        }
5167    }
5168
5169    #[allow(irrefutable_let_patterns)]
5170    pub fn into_release_view(self) -> Option<(FlatlandControlHandle)> {
5171        if let FlatlandRequest::ReleaseView { control_handle } = self {
5172            Some((control_handle))
5173        } else {
5174            None
5175        }
5176    }
5177
5178    #[allow(irrefutable_let_patterns)]
5179    pub fn into_release_viewport(self) -> Option<(ContentId, FlatlandReleaseViewportResponder)> {
5180        if let FlatlandRequest::ReleaseViewport { viewport_id, responder } = self {
5181            Some((viewport_id, responder))
5182        } else {
5183            None
5184        }
5185    }
5186
5187    #[allow(irrefutable_let_patterns)]
5188    pub fn into_release_image(self) -> Option<(ContentId, FlatlandControlHandle)> {
5189        if let FlatlandRequest::ReleaseImage { image_id, control_handle } = self {
5190            Some((image_id, control_handle))
5191        } else {
5192            None
5193        }
5194    }
5195
5196    #[allow(irrefutable_let_patterns)]
5197    pub fn into_clear(self) -> Option<(FlatlandControlHandle)> {
5198        if let FlatlandRequest::Clear { control_handle } = self {
5199            Some((control_handle))
5200        } else {
5201            None
5202        }
5203    }
5204
5205    #[allow(irrefutable_let_patterns)]
5206    pub fn into_set_debug_name(self) -> Option<(String, FlatlandControlHandle)> {
5207        if let FlatlandRequest::SetDebugName { name, control_handle } = self {
5208            Some((name, control_handle))
5209        } else {
5210            None
5211        }
5212    }
5213
5214    /// Name of the method defined in FIDL
5215    pub fn method_name(&self) -> &'static str {
5216        match *self {
5217            FlatlandRequest::Present { .. } => "present",
5218            FlatlandRequest::CreateView { .. } => "create_view",
5219            FlatlandRequest::CreateView2 { .. } => "create_view2",
5220            FlatlandRequest::CreateTransform { .. } => "create_transform",
5221            FlatlandRequest::SetTranslation { .. } => "set_translation",
5222            FlatlandRequest::SetOrientation { .. } => "set_orientation",
5223            FlatlandRequest::SetScale { .. } => "set_scale",
5224            FlatlandRequest::SetOpacity { .. } => "set_opacity",
5225            FlatlandRequest::SetClipBoundary { .. } => "set_clip_boundary",
5226            FlatlandRequest::AddChild { .. } => "add_child",
5227            FlatlandRequest::RemoveChild { .. } => "remove_child",
5228            FlatlandRequest::ReplaceChildren { .. } => "replace_children",
5229            FlatlandRequest::SetRootTransform { .. } => "set_root_transform",
5230            FlatlandRequest::SetHitRegions { .. } => "set_hit_regions",
5231            FlatlandRequest::SetInfiniteHitRegion { .. } => "set_infinite_hit_region",
5232            FlatlandRequest::CreateViewport { .. } => "create_viewport",
5233            FlatlandRequest::CreateImage { .. } => "create_image",
5234            FlatlandRequest::SetImageSampleRegion { .. } => "set_image_sample_region",
5235            FlatlandRequest::SetImageDestinationSize { .. } => "set_image_destination_size",
5236            FlatlandRequest::SetImageBlendingFunction { .. } => "set_image_blending_function",
5237            FlatlandRequest::SetImageBlendMode { .. } => "set_image_blend_mode",
5238            FlatlandRequest::SetImageOpacity { .. } => "set_image_opacity",
5239            FlatlandRequest::SetImageFlip { .. } => "set_image_flip",
5240            FlatlandRequest::CreateFilledRect { .. } => "create_filled_rect",
5241            FlatlandRequest::SetSolidFill { .. } => "set_solid_fill",
5242            FlatlandRequest::ReleaseFilledRect { .. } => "release_filled_rect",
5243            FlatlandRequest::SetContent { .. } => "set_content",
5244            FlatlandRequest::SetViewportProperties { .. } => "set_viewport_properties",
5245            FlatlandRequest::ReleaseTransform { .. } => "release_transform",
5246            FlatlandRequest::ReleaseView { .. } => "release_view",
5247            FlatlandRequest::ReleaseViewport { .. } => "release_viewport",
5248            FlatlandRequest::ReleaseImage { .. } => "release_image",
5249            FlatlandRequest::Clear { .. } => "clear",
5250            FlatlandRequest::SetDebugName { .. } => "set_debug_name",
5251        }
5252    }
5253}
5254
5255#[derive(Debug, Clone)]
5256pub struct FlatlandControlHandle {
5257    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5258}
5259
5260impl fidl::endpoints::ControlHandle for FlatlandControlHandle {
5261    fn shutdown(&self) {
5262        self.inner.shutdown()
5263    }
5264    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
5265        self.inner.shutdown_with_epitaph(status)
5266    }
5267
5268    fn is_closed(&self) -> bool {
5269        self.inner.channel().is_closed()
5270    }
5271    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
5272        self.inner.channel().on_closed()
5273    }
5274
5275    #[cfg(target_os = "fuchsia")]
5276    fn signal_peer(
5277        &self,
5278        clear_mask: zx::Signals,
5279        set_mask: zx::Signals,
5280    ) -> Result<(), zx_status::Status> {
5281        use fidl::Peered;
5282        self.inner.channel().signal_peer(clear_mask, set_mask)
5283    }
5284}
5285
5286impl FlatlandControlHandle {
5287    pub fn send_on_next_frame_begin(
5288        &self,
5289        mut values: &OnNextFrameBeginValues,
5290    ) -> Result<(), fidl::Error> {
5291        self.inner.send::<FlatlandOnNextFrameBeginRequest>(
5292            (values,),
5293            0,
5294            0x10f69a5cdeece84a,
5295            fidl::encoding::DynamicFlags::empty(),
5296        )
5297    }
5298
5299    pub fn send_on_frame_presented(
5300        &self,
5301        mut frame_presented_info: &fidl_fuchsia_scenic_scheduling::FramePresentedInfo,
5302    ) -> Result<(), fidl::Error> {
5303        self.inner.send::<FlatlandOnFramePresentedRequest>(
5304            (frame_presented_info,),
5305            0,
5306            0x56e43e1a5f30216d,
5307            fidl::encoding::DynamicFlags::empty(),
5308        )
5309    }
5310
5311    pub fn send_on_error(&self, mut error: FlatlandError) -> Result<(), fidl::Error> {
5312        self.inner.send::<FlatlandOnErrorRequest>(
5313            (error,),
5314            0,
5315            0x1ebf39e90cd8b8d,
5316            fidl::encoding::DynamicFlags::empty(),
5317        )
5318    }
5319}
5320
5321#[must_use = "FIDL methods require a response to be sent"]
5322#[derive(Debug)]
5323pub struct FlatlandReleaseViewportResponder {
5324    control_handle: std::mem::ManuallyDrop<FlatlandControlHandle>,
5325    tx_id: u32,
5326}
5327
5328/// Set the the channel to be shutdown (see [`FlatlandControlHandle::shutdown`])
5329/// if the responder is dropped without sending a response, so that the client
5330/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5331impl std::ops::Drop for FlatlandReleaseViewportResponder {
5332    fn drop(&mut self) {
5333        self.control_handle.shutdown();
5334        // Safety: drops once, never accessed again
5335        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5336    }
5337}
5338
5339impl fidl::endpoints::Responder for FlatlandReleaseViewportResponder {
5340    type ControlHandle = FlatlandControlHandle;
5341
5342    fn control_handle(&self) -> &FlatlandControlHandle {
5343        &self.control_handle
5344    }
5345
5346    fn drop_without_shutdown(mut self) {
5347        // Safety: drops once, never accessed again due to mem::forget
5348        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5349        // Prevent Drop from running (which would shut down the channel)
5350        std::mem::forget(self);
5351    }
5352}
5353
5354impl FlatlandReleaseViewportResponder {
5355    /// Sends a response to the FIDL transaction.
5356    ///
5357    /// Sets the channel to shutdown if an error occurs.
5358    pub fn send(
5359        self,
5360        mut token: fidl_fuchsia_ui_views::ViewportCreationToken,
5361    ) -> Result<(), fidl::Error> {
5362        let _result = self.send_raw(token);
5363        if _result.is_err() {
5364            self.control_handle.shutdown();
5365        }
5366        self.drop_without_shutdown();
5367        _result
5368    }
5369
5370    /// Similar to "send" but does not shutdown the channel if an error occurs.
5371    pub fn send_no_shutdown_on_err(
5372        self,
5373        mut token: fidl_fuchsia_ui_views::ViewportCreationToken,
5374    ) -> Result<(), fidl::Error> {
5375        let _result = self.send_raw(token);
5376        self.drop_without_shutdown();
5377        _result
5378    }
5379
5380    fn send_raw(
5381        &self,
5382        mut token: fidl_fuchsia_ui_views::ViewportCreationToken,
5383    ) -> Result<(), fidl::Error> {
5384        self.control_handle.inner.send::<FlatlandReleaseViewportResponse>(
5385            (&mut token,),
5386            self.tx_id,
5387            0xbad474aeb5293f9,
5388            fidl::encoding::DynamicFlags::empty(),
5389        )
5390    }
5391}
5392
5393#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
5394pub struct FlatlandDisplayMarker;
5395
5396impl fidl::endpoints::ProtocolMarker for FlatlandDisplayMarker {
5397    type Proxy = FlatlandDisplayProxy;
5398    type RequestStream = FlatlandDisplayRequestStream;
5399    #[cfg(target_os = "fuchsia")]
5400    type SynchronousProxy = FlatlandDisplaySynchronousProxy;
5401
5402    const DEBUG_NAME: &'static str = "fuchsia.ui.composition.FlatlandDisplay";
5403}
5404impl fidl::endpoints::DiscoverableProtocolMarker for FlatlandDisplayMarker {}
5405
5406pub trait FlatlandDisplayProxyInterface: Send + Sync {
5407    fn r#set_content(
5408        &self,
5409        token: fidl_fuchsia_ui_views::ViewportCreationToken,
5410        child_view_watcher: fidl::endpoints::ServerEnd<ChildViewWatcherMarker>,
5411    ) -> Result<(), fidl::Error>;
5412    fn r#set_device_pixel_ratio(
5413        &self,
5414        device_pixel_ratio: &fidl_fuchsia_math::VecF,
5415    ) -> Result<(), fidl::Error>;
5416}
5417#[derive(Debug)]
5418#[cfg(target_os = "fuchsia")]
5419pub struct FlatlandDisplaySynchronousProxy {
5420    client: fidl::client::sync::Client,
5421}
5422
5423#[cfg(target_os = "fuchsia")]
5424impl fidl::endpoints::SynchronousProxy for FlatlandDisplaySynchronousProxy {
5425    type Proxy = FlatlandDisplayProxy;
5426    type Protocol = FlatlandDisplayMarker;
5427
5428    fn from_channel(inner: fidl::Channel) -> Self {
5429        Self::new(inner)
5430    }
5431
5432    fn into_channel(self) -> fidl::Channel {
5433        self.client.into_channel()
5434    }
5435
5436    fn as_channel(&self) -> &fidl::Channel {
5437        self.client.as_channel()
5438    }
5439}
5440
5441#[cfg(target_os = "fuchsia")]
5442impl FlatlandDisplaySynchronousProxy {
5443    pub fn new(channel: fidl::Channel) -> Self {
5444        let protocol_name = <FlatlandDisplayMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
5445        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
5446    }
5447
5448    pub fn into_channel(self) -> fidl::Channel {
5449        self.client.into_channel()
5450    }
5451
5452    /// Waits until an event arrives and returns it. It is safe for other
5453    /// threads to make concurrent requests while waiting for an event.
5454    pub fn wait_for_event(
5455        &self,
5456        deadline: zx::MonotonicInstant,
5457    ) -> Result<FlatlandDisplayEvent, fidl::Error> {
5458        FlatlandDisplayEvent::decode(self.client.wait_for_event(deadline)?)
5459    }
5460
5461    pub fn r#set_content(
5462        &self,
5463        mut token: fidl_fuchsia_ui_views::ViewportCreationToken,
5464        mut child_view_watcher: fidl::endpoints::ServerEnd<ChildViewWatcherMarker>,
5465    ) -> Result<(), fidl::Error> {
5466        self.client.send::<FlatlandDisplaySetContentRequest>(
5467            (&mut token, child_view_watcher),
5468            0x6748193a39918298,
5469            fidl::encoding::DynamicFlags::empty(),
5470        )
5471    }
5472
5473    /// Sets the ratio of display's physical pixels to device independent pixels that should be used
5474    /// for the tree of Flatland content that are attached to this display. See
5475    /// [`LayoutInfo.device_pixel_ratio`] for details.
5476    ///
5477    /// The default value is (1.0, 1.0). The valid values are 1.0 and above.
5478    pub fn r#set_device_pixel_ratio(
5479        &self,
5480        mut device_pixel_ratio: &fidl_fuchsia_math::VecF,
5481    ) -> Result<(), fidl::Error> {
5482        self.client.send::<FlatlandDisplaySetDevicePixelRatioRequest>(
5483            (device_pixel_ratio,),
5484            0x392c3e70cc0a81a4,
5485            fidl::encoding::DynamicFlags::empty(),
5486        )
5487    }
5488}
5489
5490#[cfg(target_os = "fuchsia")]
5491impl From<FlatlandDisplaySynchronousProxy> for zx::Handle {
5492    fn from(value: FlatlandDisplaySynchronousProxy) -> Self {
5493        value.into_channel().into()
5494    }
5495}
5496
5497#[cfg(target_os = "fuchsia")]
5498impl From<fidl::Channel> for FlatlandDisplaySynchronousProxy {
5499    fn from(value: fidl::Channel) -> Self {
5500        Self::new(value)
5501    }
5502}
5503
5504#[cfg(target_os = "fuchsia")]
5505impl fidl::endpoints::FromClient for FlatlandDisplaySynchronousProxy {
5506    type Protocol = FlatlandDisplayMarker;
5507
5508    fn from_client(value: fidl::endpoints::ClientEnd<FlatlandDisplayMarker>) -> Self {
5509        Self::new(value.into_channel())
5510    }
5511}
5512
5513#[derive(Debug, Clone)]
5514pub struct FlatlandDisplayProxy {
5515    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
5516}
5517
5518impl fidl::endpoints::Proxy for FlatlandDisplayProxy {
5519    type Protocol = FlatlandDisplayMarker;
5520
5521    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
5522        Self::new(inner)
5523    }
5524
5525    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
5526        self.client.into_channel().map_err(|client| Self { client })
5527    }
5528
5529    fn as_channel(&self) -> &::fidl::AsyncChannel {
5530        self.client.as_channel()
5531    }
5532}
5533
5534impl FlatlandDisplayProxy {
5535    /// Create a new Proxy for fuchsia.ui.composition/FlatlandDisplay.
5536    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
5537        let protocol_name = <FlatlandDisplayMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
5538        Self { client: fidl::client::Client::new(channel, protocol_name) }
5539    }
5540
5541    /// Get a Stream of events from the remote end of the protocol.
5542    ///
5543    /// # Panics
5544    ///
5545    /// Panics if the event stream was already taken.
5546    pub fn take_event_stream(&self) -> FlatlandDisplayEventStream {
5547        FlatlandDisplayEventStream { event_receiver: self.client.take_event_receiver() }
5548    }
5549
5550    pub fn r#set_content(
5551        &self,
5552        mut token: fidl_fuchsia_ui_views::ViewportCreationToken,
5553        mut child_view_watcher: fidl::endpoints::ServerEnd<ChildViewWatcherMarker>,
5554    ) -> Result<(), fidl::Error> {
5555        FlatlandDisplayProxyInterface::r#set_content(self, token, child_view_watcher)
5556    }
5557
5558    /// Sets the ratio of display's physical pixels to device independent pixels that should be used
5559    /// for the tree of Flatland content that are attached to this display. See
5560    /// [`LayoutInfo.device_pixel_ratio`] for details.
5561    ///
5562    /// The default value is (1.0, 1.0). The valid values are 1.0 and above.
5563    pub fn r#set_device_pixel_ratio(
5564        &self,
5565        mut device_pixel_ratio: &fidl_fuchsia_math::VecF,
5566    ) -> Result<(), fidl::Error> {
5567        FlatlandDisplayProxyInterface::r#set_device_pixel_ratio(self, device_pixel_ratio)
5568    }
5569}
5570
5571impl FlatlandDisplayProxyInterface for FlatlandDisplayProxy {
5572    fn r#set_content(
5573        &self,
5574        mut token: fidl_fuchsia_ui_views::ViewportCreationToken,
5575        mut child_view_watcher: fidl::endpoints::ServerEnd<ChildViewWatcherMarker>,
5576    ) -> Result<(), fidl::Error> {
5577        self.client.send::<FlatlandDisplaySetContentRequest>(
5578            (&mut token, child_view_watcher),
5579            0x6748193a39918298,
5580            fidl::encoding::DynamicFlags::empty(),
5581        )
5582    }
5583
5584    fn r#set_device_pixel_ratio(
5585        &self,
5586        mut device_pixel_ratio: &fidl_fuchsia_math::VecF,
5587    ) -> Result<(), fidl::Error> {
5588        self.client.send::<FlatlandDisplaySetDevicePixelRatioRequest>(
5589            (device_pixel_ratio,),
5590            0x392c3e70cc0a81a4,
5591            fidl::encoding::DynamicFlags::empty(),
5592        )
5593    }
5594}
5595
5596pub struct FlatlandDisplayEventStream {
5597    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
5598}
5599
5600impl std::marker::Unpin for FlatlandDisplayEventStream {}
5601
5602impl futures::stream::FusedStream for FlatlandDisplayEventStream {
5603    fn is_terminated(&self) -> bool {
5604        self.event_receiver.is_terminated()
5605    }
5606}
5607
5608impl futures::Stream for FlatlandDisplayEventStream {
5609    type Item = Result<FlatlandDisplayEvent, fidl::Error>;
5610
5611    fn poll_next(
5612        mut self: std::pin::Pin<&mut Self>,
5613        cx: &mut std::task::Context<'_>,
5614    ) -> std::task::Poll<Option<Self::Item>> {
5615        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
5616            &mut self.event_receiver,
5617            cx
5618        )?) {
5619            Some(buf) => std::task::Poll::Ready(Some(FlatlandDisplayEvent::decode(buf))),
5620            None => std::task::Poll::Ready(None),
5621        }
5622    }
5623}
5624
5625#[derive(Debug)]
5626pub enum FlatlandDisplayEvent {}
5627
5628impl FlatlandDisplayEvent {
5629    /// Decodes a message buffer as a [`FlatlandDisplayEvent`].
5630    fn decode(
5631        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
5632    ) -> Result<FlatlandDisplayEvent, fidl::Error> {
5633        let (bytes, _handles) = buf.split_mut();
5634        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5635        debug_assert_eq!(tx_header.tx_id, 0);
5636        match tx_header.ordinal {
5637            _ => Err(fidl::Error::UnknownOrdinal {
5638                ordinal: tx_header.ordinal,
5639                protocol_name:
5640                    <FlatlandDisplayMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5641            }),
5642        }
5643    }
5644}
5645
5646/// A Stream of incoming requests for fuchsia.ui.composition/FlatlandDisplay.
5647pub struct FlatlandDisplayRequestStream {
5648    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5649    is_terminated: bool,
5650}
5651
5652impl std::marker::Unpin for FlatlandDisplayRequestStream {}
5653
5654impl futures::stream::FusedStream for FlatlandDisplayRequestStream {
5655    fn is_terminated(&self) -> bool {
5656        self.is_terminated
5657    }
5658}
5659
5660impl fidl::endpoints::RequestStream for FlatlandDisplayRequestStream {
5661    type Protocol = FlatlandDisplayMarker;
5662    type ControlHandle = FlatlandDisplayControlHandle;
5663
5664    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
5665        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
5666    }
5667
5668    fn control_handle(&self) -> Self::ControlHandle {
5669        FlatlandDisplayControlHandle { inner: self.inner.clone() }
5670    }
5671
5672    fn into_inner(
5673        self,
5674    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
5675    {
5676        (self.inner, self.is_terminated)
5677    }
5678
5679    fn from_inner(
5680        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5681        is_terminated: bool,
5682    ) -> Self {
5683        Self { inner, is_terminated }
5684    }
5685}
5686
5687impl futures::Stream for FlatlandDisplayRequestStream {
5688    type Item = Result<FlatlandDisplayRequest, fidl::Error>;
5689
5690    fn poll_next(
5691        mut self: std::pin::Pin<&mut Self>,
5692        cx: &mut std::task::Context<'_>,
5693    ) -> std::task::Poll<Option<Self::Item>> {
5694        let this = &mut *self;
5695        if this.inner.check_shutdown(cx) {
5696            this.is_terminated = true;
5697            return std::task::Poll::Ready(None);
5698        }
5699        if this.is_terminated {
5700            panic!("polled FlatlandDisplayRequestStream after completion");
5701        }
5702        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
5703            |bytes, handles| {
5704                match this.inner.channel().read_etc(cx, bytes, handles) {
5705                    std::task::Poll::Ready(Ok(())) => {}
5706                    std::task::Poll::Pending => return std::task::Poll::Pending,
5707                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
5708                        this.is_terminated = true;
5709                        return std::task::Poll::Ready(None);
5710                    }
5711                    std::task::Poll::Ready(Err(e)) => {
5712                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
5713                            e.into(),
5714                        ))));
5715                    }
5716                }
5717
5718                // A message has been received from the channel
5719                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5720
5721                std::task::Poll::Ready(Some(match header.ordinal {
5722                    0x6748193a39918298 => {
5723                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5724                        let mut req = fidl::new_empty!(
5725                            FlatlandDisplaySetContentRequest,
5726                            fidl::encoding::DefaultFuchsiaResourceDialect
5727                        );
5728                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandDisplaySetContentRequest>(&header, _body_bytes, handles, &mut req)?;
5729                        let control_handle =
5730                            FlatlandDisplayControlHandle { inner: this.inner.clone() };
5731                        Ok(FlatlandDisplayRequest::SetContent {
5732                            token: req.token,
5733                            child_view_watcher: req.child_view_watcher,
5734
5735                            control_handle,
5736                        })
5737                    }
5738                    0x392c3e70cc0a81a4 => {
5739                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5740                        let mut req = fidl::new_empty!(
5741                            FlatlandDisplaySetDevicePixelRatioRequest,
5742                            fidl::encoding::DefaultFuchsiaResourceDialect
5743                        );
5744                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandDisplaySetDevicePixelRatioRequest>(&header, _body_bytes, handles, &mut req)?;
5745                        let control_handle =
5746                            FlatlandDisplayControlHandle { inner: this.inner.clone() };
5747                        Ok(FlatlandDisplayRequest::SetDevicePixelRatio {
5748                            device_pixel_ratio: req.device_pixel_ratio,
5749
5750                            control_handle,
5751                        })
5752                    }
5753                    _ => Err(fidl::Error::UnknownOrdinal {
5754                        ordinal: header.ordinal,
5755                        protocol_name:
5756                            <FlatlandDisplayMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5757                    }),
5758                }))
5759            },
5760        )
5761    }
5762}
5763
5764/// This API connects to the singleton "primary display", and allows a tree of Flatland content to
5765/// be attached underneath.  Only one FlatlandDisplay client connection is allowed at one time.
5766#[derive(Debug)]
5767pub enum FlatlandDisplayRequest {
5768    SetContent {
5769        token: fidl_fuchsia_ui_views::ViewportCreationToken,
5770        child_view_watcher: fidl::endpoints::ServerEnd<ChildViewWatcherMarker>,
5771        control_handle: FlatlandDisplayControlHandle,
5772    },
5773    /// Sets the ratio of display's physical pixels to device independent pixels that should be used
5774    /// for the tree of Flatland content that are attached to this display. See
5775    /// [`LayoutInfo.device_pixel_ratio`] for details.
5776    ///
5777    /// The default value is (1.0, 1.0). The valid values are 1.0 and above.
5778    SetDevicePixelRatio {
5779        device_pixel_ratio: fidl_fuchsia_math::VecF,
5780        control_handle: FlatlandDisplayControlHandle,
5781    },
5782}
5783
5784impl FlatlandDisplayRequest {
5785    #[allow(irrefutable_let_patterns)]
5786    pub fn into_set_content(
5787        self,
5788    ) -> Option<(
5789        fidl_fuchsia_ui_views::ViewportCreationToken,
5790        fidl::endpoints::ServerEnd<ChildViewWatcherMarker>,
5791        FlatlandDisplayControlHandle,
5792    )> {
5793        if let FlatlandDisplayRequest::SetContent { token, child_view_watcher, control_handle } =
5794            self
5795        {
5796            Some((token, child_view_watcher, control_handle))
5797        } else {
5798            None
5799        }
5800    }
5801
5802    #[allow(irrefutable_let_patterns)]
5803    pub fn into_set_device_pixel_ratio(
5804        self,
5805    ) -> Option<(fidl_fuchsia_math::VecF, FlatlandDisplayControlHandle)> {
5806        if let FlatlandDisplayRequest::SetDevicePixelRatio { device_pixel_ratio, control_handle } =
5807            self
5808        {
5809            Some((device_pixel_ratio, control_handle))
5810        } else {
5811            None
5812        }
5813    }
5814
5815    /// Name of the method defined in FIDL
5816    pub fn method_name(&self) -> &'static str {
5817        match *self {
5818            FlatlandDisplayRequest::SetContent { .. } => "set_content",
5819            FlatlandDisplayRequest::SetDevicePixelRatio { .. } => "set_device_pixel_ratio",
5820        }
5821    }
5822}
5823
5824#[derive(Debug, Clone)]
5825pub struct FlatlandDisplayControlHandle {
5826    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5827}
5828
5829impl fidl::endpoints::ControlHandle for FlatlandDisplayControlHandle {
5830    fn shutdown(&self) {
5831        self.inner.shutdown()
5832    }
5833    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
5834        self.inner.shutdown_with_epitaph(status)
5835    }
5836
5837    fn is_closed(&self) -> bool {
5838        self.inner.channel().is_closed()
5839    }
5840    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
5841        self.inner.channel().on_closed()
5842    }
5843
5844    #[cfg(target_os = "fuchsia")]
5845    fn signal_peer(
5846        &self,
5847        clear_mask: zx::Signals,
5848        set_mask: zx::Signals,
5849    ) -> Result<(), zx_status::Status> {
5850        use fidl::Peered;
5851        self.inner.channel().signal_peer(clear_mask, set_mask)
5852    }
5853}
5854
5855impl FlatlandDisplayControlHandle {}
5856
5857#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
5858pub struct ParentViewportWatcherMarker;
5859
5860impl fidl::endpoints::ProtocolMarker for ParentViewportWatcherMarker {
5861    type Proxy = ParentViewportWatcherProxy;
5862    type RequestStream = ParentViewportWatcherRequestStream;
5863    #[cfg(target_os = "fuchsia")]
5864    type SynchronousProxy = ParentViewportWatcherSynchronousProxy;
5865
5866    const DEBUG_NAME: &'static str = "(anonymous) ParentViewportWatcher";
5867}
5868
5869pub trait ParentViewportWatcherProxyInterface: Send + Sync {
5870    type GetLayoutResponseFut: std::future::Future<Output = Result<LayoutInfo, fidl::Error>> + Send;
5871    fn r#get_layout(&self) -> Self::GetLayoutResponseFut;
5872    type GetStatusResponseFut: std::future::Future<Output = Result<ParentViewportStatus, fidl::Error>>
5873        + Send;
5874    fn r#get_status(&self) -> Self::GetStatusResponseFut;
5875}
5876#[derive(Debug)]
5877#[cfg(target_os = "fuchsia")]
5878pub struct ParentViewportWatcherSynchronousProxy {
5879    client: fidl::client::sync::Client,
5880}
5881
5882#[cfg(target_os = "fuchsia")]
5883impl fidl::endpoints::SynchronousProxy for ParentViewportWatcherSynchronousProxy {
5884    type Proxy = ParentViewportWatcherProxy;
5885    type Protocol = ParentViewportWatcherMarker;
5886
5887    fn from_channel(inner: fidl::Channel) -> Self {
5888        Self::new(inner)
5889    }
5890
5891    fn into_channel(self) -> fidl::Channel {
5892        self.client.into_channel()
5893    }
5894
5895    fn as_channel(&self) -> &fidl::Channel {
5896        self.client.as_channel()
5897    }
5898}
5899
5900#[cfg(target_os = "fuchsia")]
5901impl ParentViewportWatcherSynchronousProxy {
5902    pub fn new(channel: fidl::Channel) -> Self {
5903        let protocol_name =
5904            <ParentViewportWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
5905        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
5906    }
5907
5908    pub fn into_channel(self) -> fidl::Channel {
5909        self.client.into_channel()
5910    }
5911
5912    /// Waits until an event arrives and returns it. It is safe for other
5913    /// threads to make concurrent requests while waiting for an event.
5914    pub fn wait_for_event(
5915        &self,
5916        deadline: zx::MonotonicInstant,
5917    ) -> Result<ParentViewportWatcherEvent, fidl::Error> {
5918        ParentViewportWatcherEvent::decode(self.client.wait_for_event(deadline)?)
5919    }
5920
5921    /// A hanging get for receiving layout information. Clients may receive layout information
5922    /// before the ParentViewportWatcher operation has been presented. This allows children to
5923    /// layout their content before their first call to [`Present`]. In transition cases where two
5924    /// ParentViewportWatcher channels exist at the same time, both protocol instances will be
5925    /// receiving different layout information.
5926    ///
5927    /// This hanging get will only fire when the LayoutInfo is different than the previously
5928    /// returned LayoutInfo. Note that, since LayoutInfo is a table, only some fields may have
5929    /// changed.
5930    ///
5931    /// It is invalid to call `GetLayout` while a previous call is still pending. Doing so will
5932    /// cause both this channel and the Flatland channel that handed out ParentViewportWatcher to be
5933    /// closed.
5934    pub fn r#get_layout(
5935        &self,
5936        ___deadline: zx::MonotonicInstant,
5937    ) -> Result<LayoutInfo, fidl::Error> {
5938        let _response = self
5939            .client
5940            .send_query::<fidl::encoding::EmptyPayload, ParentViewportWatcherGetLayoutResponse>(
5941                (),
5942                0x3cbe5d9638e032,
5943                fidl::encoding::DynamicFlags::empty(),
5944                ___deadline,
5945            )?;
5946        Ok(_response.info)
5947    }
5948
5949    /// A hanging get for receiving the status of the parent Viewport. This provides global
5950    /// connectivity information to the child.
5951    ///
5952    /// This hanging get will only fire when the ParentViewportStatus is different than the
5953    /// previously returned ParentViewportStatus.
5954    ///
5955    /// It is invalid to call `GetStatus` while a previous call is still pending. Doing so will
5956    /// cause both this channel and the Flatland channel that handed out ParentViewportWatcher to be
5957    /// closed.
5958    pub fn r#get_status(
5959        &self,
5960        ___deadline: zx::MonotonicInstant,
5961    ) -> Result<ParentViewportStatus, fidl::Error> {
5962        let _response = self
5963            .client
5964            .send_query::<fidl::encoding::EmptyPayload, ParentViewportWatcherGetStatusResponse>(
5965                (),
5966                0x7caa022f050d9ea6,
5967                fidl::encoding::DynamicFlags::empty(),
5968                ___deadline,
5969            )?;
5970        Ok(_response.status)
5971    }
5972}
5973
5974#[cfg(target_os = "fuchsia")]
5975impl From<ParentViewportWatcherSynchronousProxy> for zx::Handle {
5976    fn from(value: ParentViewportWatcherSynchronousProxy) -> Self {
5977        value.into_channel().into()
5978    }
5979}
5980
5981#[cfg(target_os = "fuchsia")]
5982impl From<fidl::Channel> for ParentViewportWatcherSynchronousProxy {
5983    fn from(value: fidl::Channel) -> Self {
5984        Self::new(value)
5985    }
5986}
5987
5988#[cfg(target_os = "fuchsia")]
5989impl fidl::endpoints::FromClient for ParentViewportWatcherSynchronousProxy {
5990    type Protocol = ParentViewportWatcherMarker;
5991
5992    fn from_client(value: fidl::endpoints::ClientEnd<ParentViewportWatcherMarker>) -> Self {
5993        Self::new(value.into_channel())
5994    }
5995}
5996
5997#[derive(Debug, Clone)]
5998pub struct ParentViewportWatcherProxy {
5999    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
6000}
6001
6002impl fidl::endpoints::Proxy for ParentViewportWatcherProxy {
6003    type Protocol = ParentViewportWatcherMarker;
6004
6005    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
6006        Self::new(inner)
6007    }
6008
6009    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
6010        self.client.into_channel().map_err(|client| Self { client })
6011    }
6012
6013    fn as_channel(&self) -> &::fidl::AsyncChannel {
6014        self.client.as_channel()
6015    }
6016}
6017
6018impl ParentViewportWatcherProxy {
6019    /// Create a new Proxy for fuchsia.ui.composition/ParentViewportWatcher.
6020    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
6021        let protocol_name =
6022            <ParentViewportWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
6023        Self { client: fidl::client::Client::new(channel, protocol_name) }
6024    }
6025
6026    /// Get a Stream of events from the remote end of the protocol.
6027    ///
6028    /// # Panics
6029    ///
6030    /// Panics if the event stream was already taken.
6031    pub fn take_event_stream(&self) -> ParentViewportWatcherEventStream {
6032        ParentViewportWatcherEventStream { event_receiver: self.client.take_event_receiver() }
6033    }
6034
6035    /// A hanging get for receiving layout information. Clients may receive layout information
6036    /// before the ParentViewportWatcher operation has been presented. This allows children to
6037    /// layout their content before their first call to [`Present`]. In transition cases where two
6038    /// ParentViewportWatcher channels exist at the same time, both protocol instances will be
6039    /// receiving different layout information.
6040    ///
6041    /// This hanging get will only fire when the LayoutInfo is different than the previously
6042    /// returned LayoutInfo. Note that, since LayoutInfo is a table, only some fields may have
6043    /// changed.
6044    ///
6045    /// It is invalid to call `GetLayout` while a previous call is still pending. Doing so will
6046    /// cause both this channel and the Flatland channel that handed out ParentViewportWatcher to be
6047    /// closed.
6048    pub fn r#get_layout(
6049        &self,
6050    ) -> fidl::client::QueryResponseFut<LayoutInfo, fidl::encoding::DefaultFuchsiaResourceDialect>
6051    {
6052        ParentViewportWatcherProxyInterface::r#get_layout(self)
6053    }
6054
6055    /// A hanging get for receiving the status of the parent Viewport. This provides global
6056    /// connectivity information to the child.
6057    ///
6058    /// This hanging get will only fire when the ParentViewportStatus is different than the
6059    /// previously returned ParentViewportStatus.
6060    ///
6061    /// It is invalid to call `GetStatus` while a previous call is still pending. Doing so will
6062    /// cause both this channel and the Flatland channel that handed out ParentViewportWatcher to be
6063    /// closed.
6064    pub fn r#get_status(
6065        &self,
6066    ) -> fidl::client::QueryResponseFut<
6067        ParentViewportStatus,
6068        fidl::encoding::DefaultFuchsiaResourceDialect,
6069    > {
6070        ParentViewportWatcherProxyInterface::r#get_status(self)
6071    }
6072}
6073
6074impl ParentViewportWatcherProxyInterface for ParentViewportWatcherProxy {
6075    type GetLayoutResponseFut =
6076        fidl::client::QueryResponseFut<LayoutInfo, fidl::encoding::DefaultFuchsiaResourceDialect>;
6077    fn r#get_layout(&self) -> Self::GetLayoutResponseFut {
6078        fn _decode(
6079            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6080        ) -> Result<LayoutInfo, fidl::Error> {
6081            let _response = fidl::client::decode_transaction_body::<
6082                ParentViewportWatcherGetLayoutResponse,
6083                fidl::encoding::DefaultFuchsiaResourceDialect,
6084                0x3cbe5d9638e032,
6085            >(_buf?)?;
6086            Ok(_response.info)
6087        }
6088        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, LayoutInfo>(
6089            (),
6090            0x3cbe5d9638e032,
6091            fidl::encoding::DynamicFlags::empty(),
6092            _decode,
6093        )
6094    }
6095
6096    type GetStatusResponseFut = fidl::client::QueryResponseFut<
6097        ParentViewportStatus,
6098        fidl::encoding::DefaultFuchsiaResourceDialect,
6099    >;
6100    fn r#get_status(&self) -> Self::GetStatusResponseFut {
6101        fn _decode(
6102            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6103        ) -> Result<ParentViewportStatus, fidl::Error> {
6104            let _response = fidl::client::decode_transaction_body::<
6105                ParentViewportWatcherGetStatusResponse,
6106                fidl::encoding::DefaultFuchsiaResourceDialect,
6107                0x7caa022f050d9ea6,
6108            >(_buf?)?;
6109            Ok(_response.status)
6110        }
6111        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ParentViewportStatus>(
6112            (),
6113            0x7caa022f050d9ea6,
6114            fidl::encoding::DynamicFlags::empty(),
6115            _decode,
6116        )
6117    }
6118}
6119
6120pub struct ParentViewportWatcherEventStream {
6121    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
6122}
6123
6124impl std::marker::Unpin for ParentViewportWatcherEventStream {}
6125
6126impl futures::stream::FusedStream for ParentViewportWatcherEventStream {
6127    fn is_terminated(&self) -> bool {
6128        self.event_receiver.is_terminated()
6129    }
6130}
6131
6132impl futures::Stream for ParentViewportWatcherEventStream {
6133    type Item = Result<ParentViewportWatcherEvent, fidl::Error>;
6134
6135    fn poll_next(
6136        mut self: std::pin::Pin<&mut Self>,
6137        cx: &mut std::task::Context<'_>,
6138    ) -> std::task::Poll<Option<Self::Item>> {
6139        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
6140            &mut self.event_receiver,
6141            cx
6142        )?) {
6143            Some(buf) => std::task::Poll::Ready(Some(ParentViewportWatcherEvent::decode(buf))),
6144            None => std::task::Poll::Ready(None),
6145        }
6146    }
6147}
6148
6149#[derive(Debug)]
6150pub enum ParentViewportWatcherEvent {}
6151
6152impl ParentViewportWatcherEvent {
6153    /// Decodes a message buffer as a [`ParentViewportWatcherEvent`].
6154    fn decode(
6155        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
6156    ) -> Result<ParentViewportWatcherEvent, fidl::Error> {
6157        let (bytes, _handles) = buf.split_mut();
6158        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6159        debug_assert_eq!(tx_header.tx_id, 0);
6160        match tx_header.ordinal {
6161            _ => Err(fidl::Error::UnknownOrdinal {
6162                ordinal: tx_header.ordinal,
6163                protocol_name:
6164                    <ParentViewportWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6165            }),
6166        }
6167    }
6168}
6169
6170/// A Stream of incoming requests for fuchsia.ui.composition/ParentViewportWatcher.
6171pub struct ParentViewportWatcherRequestStream {
6172    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6173    is_terminated: bool,
6174}
6175
6176impl std::marker::Unpin for ParentViewportWatcherRequestStream {}
6177
6178impl futures::stream::FusedStream for ParentViewportWatcherRequestStream {
6179    fn is_terminated(&self) -> bool {
6180        self.is_terminated
6181    }
6182}
6183
6184impl fidl::endpoints::RequestStream for ParentViewportWatcherRequestStream {
6185    type Protocol = ParentViewportWatcherMarker;
6186    type ControlHandle = ParentViewportWatcherControlHandle;
6187
6188    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
6189        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
6190    }
6191
6192    fn control_handle(&self) -> Self::ControlHandle {
6193        ParentViewportWatcherControlHandle { inner: self.inner.clone() }
6194    }
6195
6196    fn into_inner(
6197        self,
6198    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
6199    {
6200        (self.inner, self.is_terminated)
6201    }
6202
6203    fn from_inner(
6204        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6205        is_terminated: bool,
6206    ) -> Self {
6207        Self { inner, is_terminated }
6208    }
6209}
6210
6211impl futures::Stream for ParentViewportWatcherRequestStream {
6212    type Item = Result<ParentViewportWatcherRequest, fidl::Error>;
6213
6214    fn poll_next(
6215        mut self: std::pin::Pin<&mut Self>,
6216        cx: &mut std::task::Context<'_>,
6217    ) -> std::task::Poll<Option<Self::Item>> {
6218        let this = &mut *self;
6219        if this.inner.check_shutdown(cx) {
6220            this.is_terminated = true;
6221            return std::task::Poll::Ready(None);
6222        }
6223        if this.is_terminated {
6224            panic!("polled ParentViewportWatcherRequestStream after completion");
6225        }
6226        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
6227            |bytes, handles| {
6228                match this.inner.channel().read_etc(cx, bytes, handles) {
6229                    std::task::Poll::Ready(Ok(())) => {}
6230                    std::task::Poll::Pending => return std::task::Poll::Pending,
6231                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
6232                        this.is_terminated = true;
6233                        return std::task::Poll::Ready(None);
6234                    }
6235                    std::task::Poll::Ready(Err(e)) => {
6236                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
6237                            e.into(),
6238                        ))));
6239                    }
6240                }
6241
6242                // A message has been received from the channel
6243                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6244
6245                std::task::Poll::Ready(Some(match header.ordinal {
6246                0x3cbe5d9638e032 => {
6247                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6248                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
6249                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
6250                    let control_handle = ParentViewportWatcherControlHandle {
6251                        inner: this.inner.clone(),
6252                    };
6253                    Ok(ParentViewportWatcherRequest::GetLayout {
6254                        responder: ParentViewportWatcherGetLayoutResponder {
6255                            control_handle: std::mem::ManuallyDrop::new(control_handle),
6256                            tx_id: header.tx_id,
6257                        },
6258                    })
6259                }
6260                0x7caa022f050d9ea6 => {
6261                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6262                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
6263                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
6264                    let control_handle = ParentViewportWatcherControlHandle {
6265                        inner: this.inner.clone(),
6266                    };
6267                    Ok(ParentViewportWatcherRequest::GetStatus {
6268                        responder: ParentViewportWatcherGetStatusResponder {
6269                            control_handle: std::mem::ManuallyDrop::new(control_handle),
6270                            tx_id: header.tx_id,
6271                        },
6272                    })
6273                }
6274                _ => Err(fidl::Error::UnknownOrdinal {
6275                    ordinal: header.ordinal,
6276                    protocol_name: <ParentViewportWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6277                }),
6278            }))
6279            },
6280        )
6281    }
6282}
6283
6284/// A protocol that provides information about the parent Viewport attached to a Flatland instance's
6285/// sole View.  Although Flatland instances can have at most one view, it is possible to have
6286/// multiple ParentViewportWatchers during the brief transition period when replacing the instance's
6287/// View with another, e.g. via [`CreateView`].  During this period, certain updates may be
6288/// duplicated and sent to each ParentViewportWatcher connection.
6289///
6290/// A ParentViewportWatcher will remain connected as long as the corresponding parent Viewport
6291/// exists; the connection will also be closed if the parents's ViewportCreationToken is dropped
6292/// without using it to create a Viewport.
6293#[derive(Debug)]
6294pub enum ParentViewportWatcherRequest {
6295    /// A hanging get for receiving layout information. Clients may receive layout information
6296    /// before the ParentViewportWatcher operation has been presented. This allows children to
6297    /// layout their content before their first call to [`Present`]. In transition cases where two
6298    /// ParentViewportWatcher channels exist at the same time, both protocol instances will be
6299    /// receiving different layout information.
6300    ///
6301    /// This hanging get will only fire when the LayoutInfo is different than the previously
6302    /// returned LayoutInfo. Note that, since LayoutInfo is a table, only some fields may have
6303    /// changed.
6304    ///
6305    /// It is invalid to call `GetLayout` while a previous call is still pending. Doing so will
6306    /// cause both this channel and the Flatland channel that handed out ParentViewportWatcher to be
6307    /// closed.
6308    GetLayout { responder: ParentViewportWatcherGetLayoutResponder },
6309    /// A hanging get for receiving the status of the parent Viewport. This provides global
6310    /// connectivity information to the child.
6311    ///
6312    /// This hanging get will only fire when the ParentViewportStatus is different than the
6313    /// previously returned ParentViewportStatus.
6314    ///
6315    /// It is invalid to call `GetStatus` while a previous call is still pending. Doing so will
6316    /// cause both this channel and the Flatland channel that handed out ParentViewportWatcher to be
6317    /// closed.
6318    GetStatus { responder: ParentViewportWatcherGetStatusResponder },
6319}
6320
6321impl ParentViewportWatcherRequest {
6322    #[allow(irrefutable_let_patterns)]
6323    pub fn into_get_layout(self) -> Option<(ParentViewportWatcherGetLayoutResponder)> {
6324        if let ParentViewportWatcherRequest::GetLayout { responder } = self {
6325            Some((responder))
6326        } else {
6327            None
6328        }
6329    }
6330
6331    #[allow(irrefutable_let_patterns)]
6332    pub fn into_get_status(self) -> Option<(ParentViewportWatcherGetStatusResponder)> {
6333        if let ParentViewportWatcherRequest::GetStatus { responder } = self {
6334            Some((responder))
6335        } else {
6336            None
6337        }
6338    }
6339
6340    /// Name of the method defined in FIDL
6341    pub fn method_name(&self) -> &'static str {
6342        match *self {
6343            ParentViewportWatcherRequest::GetLayout { .. } => "get_layout",
6344            ParentViewportWatcherRequest::GetStatus { .. } => "get_status",
6345        }
6346    }
6347}
6348
6349#[derive(Debug, Clone)]
6350pub struct ParentViewportWatcherControlHandle {
6351    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6352}
6353
6354impl fidl::endpoints::ControlHandle for ParentViewportWatcherControlHandle {
6355    fn shutdown(&self) {
6356        self.inner.shutdown()
6357    }
6358    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
6359        self.inner.shutdown_with_epitaph(status)
6360    }
6361
6362    fn is_closed(&self) -> bool {
6363        self.inner.channel().is_closed()
6364    }
6365    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
6366        self.inner.channel().on_closed()
6367    }
6368
6369    #[cfg(target_os = "fuchsia")]
6370    fn signal_peer(
6371        &self,
6372        clear_mask: zx::Signals,
6373        set_mask: zx::Signals,
6374    ) -> Result<(), zx_status::Status> {
6375        use fidl::Peered;
6376        self.inner.channel().signal_peer(clear_mask, set_mask)
6377    }
6378}
6379
6380impl ParentViewportWatcherControlHandle {}
6381
6382#[must_use = "FIDL methods require a response to be sent"]
6383#[derive(Debug)]
6384pub struct ParentViewportWatcherGetLayoutResponder {
6385    control_handle: std::mem::ManuallyDrop<ParentViewportWatcherControlHandle>,
6386    tx_id: u32,
6387}
6388
6389/// Set the the channel to be shutdown (see [`ParentViewportWatcherControlHandle::shutdown`])
6390/// if the responder is dropped without sending a response, so that the client
6391/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6392impl std::ops::Drop for ParentViewportWatcherGetLayoutResponder {
6393    fn drop(&mut self) {
6394        self.control_handle.shutdown();
6395        // Safety: drops once, never accessed again
6396        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6397    }
6398}
6399
6400impl fidl::endpoints::Responder for ParentViewportWatcherGetLayoutResponder {
6401    type ControlHandle = ParentViewportWatcherControlHandle;
6402
6403    fn control_handle(&self) -> &ParentViewportWatcherControlHandle {
6404        &self.control_handle
6405    }
6406
6407    fn drop_without_shutdown(mut self) {
6408        // Safety: drops once, never accessed again due to mem::forget
6409        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6410        // Prevent Drop from running (which would shut down the channel)
6411        std::mem::forget(self);
6412    }
6413}
6414
6415impl ParentViewportWatcherGetLayoutResponder {
6416    /// Sends a response to the FIDL transaction.
6417    ///
6418    /// Sets the channel to shutdown if an error occurs.
6419    pub fn send(self, mut info: &LayoutInfo) -> Result<(), fidl::Error> {
6420        let _result = self.send_raw(info);
6421        if _result.is_err() {
6422            self.control_handle.shutdown();
6423        }
6424        self.drop_without_shutdown();
6425        _result
6426    }
6427
6428    /// Similar to "send" but does not shutdown the channel if an error occurs.
6429    pub fn send_no_shutdown_on_err(self, mut info: &LayoutInfo) -> Result<(), fidl::Error> {
6430        let _result = self.send_raw(info);
6431        self.drop_without_shutdown();
6432        _result
6433    }
6434
6435    fn send_raw(&self, mut info: &LayoutInfo) -> Result<(), fidl::Error> {
6436        self.control_handle.inner.send::<ParentViewportWatcherGetLayoutResponse>(
6437            (info,),
6438            self.tx_id,
6439            0x3cbe5d9638e032,
6440            fidl::encoding::DynamicFlags::empty(),
6441        )
6442    }
6443}
6444
6445#[must_use = "FIDL methods require a response to be sent"]
6446#[derive(Debug)]
6447pub struct ParentViewportWatcherGetStatusResponder {
6448    control_handle: std::mem::ManuallyDrop<ParentViewportWatcherControlHandle>,
6449    tx_id: u32,
6450}
6451
6452/// Set the the channel to be shutdown (see [`ParentViewportWatcherControlHandle::shutdown`])
6453/// if the responder is dropped without sending a response, so that the client
6454/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6455impl std::ops::Drop for ParentViewportWatcherGetStatusResponder {
6456    fn drop(&mut self) {
6457        self.control_handle.shutdown();
6458        // Safety: drops once, never accessed again
6459        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6460    }
6461}
6462
6463impl fidl::endpoints::Responder for ParentViewportWatcherGetStatusResponder {
6464    type ControlHandle = ParentViewportWatcherControlHandle;
6465
6466    fn control_handle(&self) -> &ParentViewportWatcherControlHandle {
6467        &self.control_handle
6468    }
6469
6470    fn drop_without_shutdown(mut self) {
6471        // Safety: drops once, never accessed again due to mem::forget
6472        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6473        // Prevent Drop from running (which would shut down the channel)
6474        std::mem::forget(self);
6475    }
6476}
6477
6478impl ParentViewportWatcherGetStatusResponder {
6479    /// Sends a response to the FIDL transaction.
6480    ///
6481    /// Sets the channel to shutdown if an error occurs.
6482    pub fn send(self, mut status: ParentViewportStatus) -> Result<(), fidl::Error> {
6483        let _result = self.send_raw(status);
6484        if _result.is_err() {
6485            self.control_handle.shutdown();
6486        }
6487        self.drop_without_shutdown();
6488        _result
6489    }
6490
6491    /// Similar to "send" but does not shutdown the channel if an error occurs.
6492    pub fn send_no_shutdown_on_err(
6493        self,
6494        mut status: ParentViewportStatus,
6495    ) -> Result<(), fidl::Error> {
6496        let _result = self.send_raw(status);
6497        self.drop_without_shutdown();
6498        _result
6499    }
6500
6501    fn send_raw(&self, mut status: ParentViewportStatus) -> Result<(), fidl::Error> {
6502        self.control_handle.inner.send::<ParentViewportWatcherGetStatusResponse>(
6503            (status,),
6504            self.tx_id,
6505            0x7caa022f050d9ea6,
6506            fidl::encoding::DynamicFlags::empty(),
6507        )
6508    }
6509}
6510
6511#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
6512pub struct ScreenCaptureMarker;
6513
6514impl fidl::endpoints::ProtocolMarker for ScreenCaptureMarker {
6515    type Proxy = ScreenCaptureProxy;
6516    type RequestStream = ScreenCaptureRequestStream;
6517    #[cfg(target_os = "fuchsia")]
6518    type SynchronousProxy = ScreenCaptureSynchronousProxy;
6519
6520    const DEBUG_NAME: &'static str = "fuchsia.ui.composition.ScreenCapture";
6521}
6522impl fidl::endpoints::DiscoverableProtocolMarker for ScreenCaptureMarker {}
6523pub type ScreenCaptureConfigureResult = Result<(), ScreenCaptureError>;
6524pub type ScreenCaptureGetNextFrameResult = Result<FrameInfo, ScreenCaptureError>;
6525pub type ScreenCaptureReleaseFrameResult = Result<(), ScreenCaptureError>;
6526
6527pub trait ScreenCaptureProxyInterface: Send + Sync {
6528    type ConfigureResponseFut: std::future::Future<Output = Result<ScreenCaptureConfigureResult, fidl::Error>>
6529        + Send;
6530    fn r#configure(&self, payload: ScreenCaptureConfig) -> Self::ConfigureResponseFut;
6531    type GetNextFrameResponseFut: std::future::Future<Output = Result<ScreenCaptureGetNextFrameResult, fidl::Error>>
6532        + Send;
6533    fn r#get_next_frame(&self, payload: GetNextFrameArgs) -> Self::GetNextFrameResponseFut;
6534    type ReleaseFrameResponseFut: std::future::Future<Output = Result<ScreenCaptureReleaseFrameResult, fidl::Error>>
6535        + Send;
6536    fn r#release_frame(&self, buffer_id: u32) -> Self::ReleaseFrameResponseFut;
6537}
6538#[derive(Debug)]
6539#[cfg(target_os = "fuchsia")]
6540pub struct ScreenCaptureSynchronousProxy {
6541    client: fidl::client::sync::Client,
6542}
6543
6544#[cfg(target_os = "fuchsia")]
6545impl fidl::endpoints::SynchronousProxy for ScreenCaptureSynchronousProxy {
6546    type Proxy = ScreenCaptureProxy;
6547    type Protocol = ScreenCaptureMarker;
6548
6549    fn from_channel(inner: fidl::Channel) -> Self {
6550        Self::new(inner)
6551    }
6552
6553    fn into_channel(self) -> fidl::Channel {
6554        self.client.into_channel()
6555    }
6556
6557    fn as_channel(&self) -> &fidl::Channel {
6558        self.client.as_channel()
6559    }
6560}
6561
6562#[cfg(target_os = "fuchsia")]
6563impl ScreenCaptureSynchronousProxy {
6564    pub fn new(channel: fidl::Channel) -> Self {
6565        let protocol_name = <ScreenCaptureMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
6566        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
6567    }
6568
6569    pub fn into_channel(self) -> fidl::Channel {
6570        self.client.into_channel()
6571    }
6572
6573    /// Waits until an event arrives and returns it. It is safe for other
6574    /// threads to make concurrent requests while waiting for an event.
6575    pub fn wait_for_event(
6576        &self,
6577        deadline: zx::MonotonicInstant,
6578    ) -> Result<ScreenCaptureEvent, fidl::Error> {
6579        ScreenCaptureEvent::decode(self.client.wait_for_event(deadline)?)
6580    }
6581
6582    /// Clients should first use the Allocator protocol to register a
6583    /// BufferCollection. This function will fail with BAD_OPERATION unless all clients of the
6584    /// BufferCollection have set their constraints.
6585    ///
6586    /// Afterwards, clients should create and configure the images that will
6587    /// eventually be rendered to using this method. All the buffers in the
6588    /// collection from 0 to (buffer_count-1) may be used for screen capture.
6589    ///
6590    /// Clients are responsible for determining the rotation of the display,
6591    /// and applying the corrective rotation. For instance, if the display is
6592    /// mounted 90 degrees clockwise (the "top" is on the right, when looking
6593    /// at the display), then the client should specify a 270 degree rotation
6594    /// to account for it.
6595    ///
6596    /// Similarly, the clients are responsible for specifying a buffer big
6597    /// enough for the rotated image. If the buffer is too small, a best effort
6598    /// attempt will be made to render the image.
6599    ///
6600    /// Finally, clients request the server to render the current screen to the
6601    /// shared buffers using [`GetNextFrame`].
6602    ///
6603    /// [`Configure`] can be called again with a new BufferCollectionImportToken
6604    /// if the client wishes to change any of the configuration settings. In
6605    /// this case all the buffers from the previous call to [`Configure`] will
6606    /// be released.
6607    pub fn r#configure(
6608        &self,
6609        mut payload: ScreenCaptureConfig,
6610        ___deadline: zx::MonotonicInstant,
6611    ) -> Result<ScreenCaptureConfigureResult, fidl::Error> {
6612        let _response = self.client.send_query::<ScreenCaptureConfig, fidl::encoding::ResultType<
6613            fidl::encoding::EmptyStruct,
6614            ScreenCaptureError,
6615        >>(
6616            &mut payload,
6617            0x3b6e5af1d294afd9,
6618            fidl::encoding::DynamicFlags::empty(),
6619            ___deadline,
6620        )?;
6621        Ok(_response.map(|x| x))
6622    }
6623
6624    /// Following a successful call to [`Configure`], clients can call
6625    /// GetNextFrame. This will populate a buffer with the most recent frame.
6626    ///
6627    /// Clients should wait on the zx::event they pass for successful
6628    /// completion of the screenshot. It is not guaranteed that the screenshot
6629    /// will be completed by the time this function returns.
6630    ///
6631    /// The requested image will be in the BufferCollection that the client set
6632    /// up in the VMO at the index specified by buffer_id.
6633    ///
6634    /// When ScreenCapture is used to provide a stream, the rate that the
6635    /// client calls GetNextFrame will drive the frame rate.
6636    ///
6637    /// Errors:
6638    /// BAD_OPERATION if Configure was not called, or not called successfully
6639    /// MISSING_ARGS if a required argument is not present
6640    /// BUFFER_FULL if all buffers in the BufferCollection are in use. In this case, ReleaseFrame
6641    /// must be called to make a buffer available before this function can be called successfully.
6642    pub fn r#get_next_frame(
6643        &self,
6644        mut payload: GetNextFrameArgs,
6645        ___deadline: zx::MonotonicInstant,
6646    ) -> Result<ScreenCaptureGetNextFrameResult, fidl::Error> {
6647        let _response = self.client.send_query::<
6648            GetNextFrameArgs,
6649            fidl::encoding::ResultType<FrameInfo, ScreenCaptureError>,
6650        >(
6651            &mut payload,
6652            0x552c1580aab8c4a7,
6653            fidl::encoding::DynamicFlags::empty(),
6654            ___deadline,
6655        )?;
6656        Ok(_response.map(|x| x))
6657    }
6658
6659    /// Once the client no longer needs an image, they can call ReleaseFrame on
6660    /// the VMO index of the buffer so that the server can reuse it in the future.
6661    pub fn r#release_frame(
6662        &self,
6663        mut buffer_id: u32,
6664        ___deadline: zx::MonotonicInstant,
6665    ) -> Result<ScreenCaptureReleaseFrameResult, fidl::Error> {
6666        let _response =
6667            self.client.send_query::<ScreenCaptureReleaseFrameRequest, fidl::encoding::ResultType<
6668                fidl::encoding::EmptyStruct,
6669                ScreenCaptureError,
6670            >>(
6671                (buffer_id,),
6672                0x46704dce24e35950,
6673                fidl::encoding::DynamicFlags::empty(),
6674                ___deadline,
6675            )?;
6676        Ok(_response.map(|x| x))
6677    }
6678}
6679
6680#[cfg(target_os = "fuchsia")]
6681impl From<ScreenCaptureSynchronousProxy> for zx::Handle {
6682    fn from(value: ScreenCaptureSynchronousProxy) -> Self {
6683        value.into_channel().into()
6684    }
6685}
6686
6687#[cfg(target_os = "fuchsia")]
6688impl From<fidl::Channel> for ScreenCaptureSynchronousProxy {
6689    fn from(value: fidl::Channel) -> Self {
6690        Self::new(value)
6691    }
6692}
6693
6694#[cfg(target_os = "fuchsia")]
6695impl fidl::endpoints::FromClient for ScreenCaptureSynchronousProxy {
6696    type Protocol = ScreenCaptureMarker;
6697
6698    fn from_client(value: fidl::endpoints::ClientEnd<ScreenCaptureMarker>) -> Self {
6699        Self::new(value.into_channel())
6700    }
6701}
6702
6703#[derive(Debug, Clone)]
6704pub struct ScreenCaptureProxy {
6705    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
6706}
6707
6708impl fidl::endpoints::Proxy for ScreenCaptureProxy {
6709    type Protocol = ScreenCaptureMarker;
6710
6711    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
6712        Self::new(inner)
6713    }
6714
6715    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
6716        self.client.into_channel().map_err(|client| Self { client })
6717    }
6718
6719    fn as_channel(&self) -> &::fidl::AsyncChannel {
6720        self.client.as_channel()
6721    }
6722}
6723
6724impl ScreenCaptureProxy {
6725    /// Create a new Proxy for fuchsia.ui.composition/ScreenCapture.
6726    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
6727        let protocol_name = <ScreenCaptureMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
6728        Self { client: fidl::client::Client::new(channel, protocol_name) }
6729    }
6730
6731    /// Get a Stream of events from the remote end of the protocol.
6732    ///
6733    /// # Panics
6734    ///
6735    /// Panics if the event stream was already taken.
6736    pub fn take_event_stream(&self) -> ScreenCaptureEventStream {
6737        ScreenCaptureEventStream { event_receiver: self.client.take_event_receiver() }
6738    }
6739
6740    /// Clients should first use the Allocator protocol to register a
6741    /// BufferCollection. This function will fail with BAD_OPERATION unless all clients of the
6742    /// BufferCollection have set their constraints.
6743    ///
6744    /// Afterwards, clients should create and configure the images that will
6745    /// eventually be rendered to using this method. All the buffers in the
6746    /// collection from 0 to (buffer_count-1) may be used for screen capture.
6747    ///
6748    /// Clients are responsible for determining the rotation of the display,
6749    /// and applying the corrective rotation. For instance, if the display is
6750    /// mounted 90 degrees clockwise (the "top" is on the right, when looking
6751    /// at the display), then the client should specify a 270 degree rotation
6752    /// to account for it.
6753    ///
6754    /// Similarly, the clients are responsible for specifying a buffer big
6755    /// enough for the rotated image. If the buffer is too small, a best effort
6756    /// attempt will be made to render the image.
6757    ///
6758    /// Finally, clients request the server to render the current screen to the
6759    /// shared buffers using [`GetNextFrame`].
6760    ///
6761    /// [`Configure`] can be called again with a new BufferCollectionImportToken
6762    /// if the client wishes to change any of the configuration settings. In
6763    /// this case all the buffers from the previous call to [`Configure`] will
6764    /// be released.
6765    pub fn r#configure(
6766        &self,
6767        mut payload: ScreenCaptureConfig,
6768    ) -> fidl::client::QueryResponseFut<
6769        ScreenCaptureConfigureResult,
6770        fidl::encoding::DefaultFuchsiaResourceDialect,
6771    > {
6772        ScreenCaptureProxyInterface::r#configure(self, payload)
6773    }
6774
6775    /// Following a successful call to [`Configure`], clients can call
6776    /// GetNextFrame. This will populate a buffer with the most recent frame.
6777    ///
6778    /// Clients should wait on the zx::event they pass for successful
6779    /// completion of the screenshot. It is not guaranteed that the screenshot
6780    /// will be completed by the time this function returns.
6781    ///
6782    /// The requested image will be in the BufferCollection that the client set
6783    /// up in the VMO at the index specified by buffer_id.
6784    ///
6785    /// When ScreenCapture is used to provide a stream, the rate that the
6786    /// client calls GetNextFrame will drive the frame rate.
6787    ///
6788    /// Errors:
6789    /// BAD_OPERATION if Configure was not called, or not called successfully
6790    /// MISSING_ARGS if a required argument is not present
6791    /// BUFFER_FULL if all buffers in the BufferCollection are in use. In this case, ReleaseFrame
6792    /// must be called to make a buffer available before this function can be called successfully.
6793    pub fn r#get_next_frame(
6794        &self,
6795        mut payload: GetNextFrameArgs,
6796    ) -> fidl::client::QueryResponseFut<
6797        ScreenCaptureGetNextFrameResult,
6798        fidl::encoding::DefaultFuchsiaResourceDialect,
6799    > {
6800        ScreenCaptureProxyInterface::r#get_next_frame(self, payload)
6801    }
6802
6803    /// Once the client no longer needs an image, they can call ReleaseFrame on
6804    /// the VMO index of the buffer so that the server can reuse it in the future.
6805    pub fn r#release_frame(
6806        &self,
6807        mut buffer_id: u32,
6808    ) -> fidl::client::QueryResponseFut<
6809        ScreenCaptureReleaseFrameResult,
6810        fidl::encoding::DefaultFuchsiaResourceDialect,
6811    > {
6812        ScreenCaptureProxyInterface::r#release_frame(self, buffer_id)
6813    }
6814}
6815
6816impl ScreenCaptureProxyInterface for ScreenCaptureProxy {
6817    type ConfigureResponseFut = fidl::client::QueryResponseFut<
6818        ScreenCaptureConfigureResult,
6819        fidl::encoding::DefaultFuchsiaResourceDialect,
6820    >;
6821    fn r#configure(&self, mut payload: ScreenCaptureConfig) -> Self::ConfigureResponseFut {
6822        fn _decode(
6823            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6824        ) -> Result<ScreenCaptureConfigureResult, fidl::Error> {
6825            let _response = fidl::client::decode_transaction_body::<
6826                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, ScreenCaptureError>,
6827                fidl::encoding::DefaultFuchsiaResourceDialect,
6828                0x3b6e5af1d294afd9,
6829            >(_buf?)?;
6830            Ok(_response.map(|x| x))
6831        }
6832        self.client.send_query_and_decode::<ScreenCaptureConfig, ScreenCaptureConfigureResult>(
6833            &mut payload,
6834            0x3b6e5af1d294afd9,
6835            fidl::encoding::DynamicFlags::empty(),
6836            _decode,
6837        )
6838    }
6839
6840    type GetNextFrameResponseFut = fidl::client::QueryResponseFut<
6841        ScreenCaptureGetNextFrameResult,
6842        fidl::encoding::DefaultFuchsiaResourceDialect,
6843    >;
6844    fn r#get_next_frame(&self, mut payload: GetNextFrameArgs) -> Self::GetNextFrameResponseFut {
6845        fn _decode(
6846            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6847        ) -> Result<ScreenCaptureGetNextFrameResult, fidl::Error> {
6848            let _response = fidl::client::decode_transaction_body::<
6849                fidl::encoding::ResultType<FrameInfo, ScreenCaptureError>,
6850                fidl::encoding::DefaultFuchsiaResourceDialect,
6851                0x552c1580aab8c4a7,
6852            >(_buf?)?;
6853            Ok(_response.map(|x| x))
6854        }
6855        self.client.send_query_and_decode::<GetNextFrameArgs, ScreenCaptureGetNextFrameResult>(
6856            &mut payload,
6857            0x552c1580aab8c4a7,
6858            fidl::encoding::DynamicFlags::empty(),
6859            _decode,
6860        )
6861    }
6862
6863    type ReleaseFrameResponseFut = fidl::client::QueryResponseFut<
6864        ScreenCaptureReleaseFrameResult,
6865        fidl::encoding::DefaultFuchsiaResourceDialect,
6866    >;
6867    fn r#release_frame(&self, mut buffer_id: u32) -> Self::ReleaseFrameResponseFut {
6868        fn _decode(
6869            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6870        ) -> Result<ScreenCaptureReleaseFrameResult, fidl::Error> {
6871            let _response = fidl::client::decode_transaction_body::<
6872                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, ScreenCaptureError>,
6873                fidl::encoding::DefaultFuchsiaResourceDialect,
6874                0x46704dce24e35950,
6875            >(_buf?)?;
6876            Ok(_response.map(|x| x))
6877        }
6878        self.client.send_query_and_decode::<
6879            ScreenCaptureReleaseFrameRequest,
6880            ScreenCaptureReleaseFrameResult,
6881        >(
6882            (buffer_id,),
6883            0x46704dce24e35950,
6884            fidl::encoding::DynamicFlags::empty(),
6885            _decode,
6886        )
6887    }
6888}
6889
6890pub struct ScreenCaptureEventStream {
6891    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
6892}
6893
6894impl std::marker::Unpin for ScreenCaptureEventStream {}
6895
6896impl futures::stream::FusedStream for ScreenCaptureEventStream {
6897    fn is_terminated(&self) -> bool {
6898        self.event_receiver.is_terminated()
6899    }
6900}
6901
6902impl futures::Stream for ScreenCaptureEventStream {
6903    type Item = Result<ScreenCaptureEvent, fidl::Error>;
6904
6905    fn poll_next(
6906        mut self: std::pin::Pin<&mut Self>,
6907        cx: &mut std::task::Context<'_>,
6908    ) -> std::task::Poll<Option<Self::Item>> {
6909        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
6910            &mut self.event_receiver,
6911            cx
6912        )?) {
6913            Some(buf) => std::task::Poll::Ready(Some(ScreenCaptureEvent::decode(buf))),
6914            None => std::task::Poll::Ready(None),
6915        }
6916    }
6917}
6918
6919#[derive(Debug)]
6920pub enum ScreenCaptureEvent {}
6921
6922impl ScreenCaptureEvent {
6923    /// Decodes a message buffer as a [`ScreenCaptureEvent`].
6924    fn decode(
6925        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
6926    ) -> Result<ScreenCaptureEvent, fidl::Error> {
6927        let (bytes, _handles) = buf.split_mut();
6928        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6929        debug_assert_eq!(tx_header.tx_id, 0);
6930        match tx_header.ordinal {
6931            _ => Err(fidl::Error::UnknownOrdinal {
6932                ordinal: tx_header.ordinal,
6933                protocol_name: <ScreenCaptureMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6934            }),
6935        }
6936    }
6937}
6938
6939/// A Stream of incoming requests for fuchsia.ui.composition/ScreenCapture.
6940pub struct ScreenCaptureRequestStream {
6941    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6942    is_terminated: bool,
6943}
6944
6945impl std::marker::Unpin for ScreenCaptureRequestStream {}
6946
6947impl futures::stream::FusedStream for ScreenCaptureRequestStream {
6948    fn is_terminated(&self) -> bool {
6949        self.is_terminated
6950    }
6951}
6952
6953impl fidl::endpoints::RequestStream for ScreenCaptureRequestStream {
6954    type Protocol = ScreenCaptureMarker;
6955    type ControlHandle = ScreenCaptureControlHandle;
6956
6957    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
6958        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
6959    }
6960
6961    fn control_handle(&self) -> Self::ControlHandle {
6962        ScreenCaptureControlHandle { inner: self.inner.clone() }
6963    }
6964
6965    fn into_inner(
6966        self,
6967    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
6968    {
6969        (self.inner, self.is_terminated)
6970    }
6971
6972    fn from_inner(
6973        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6974        is_terminated: bool,
6975    ) -> Self {
6976        Self { inner, is_terminated }
6977    }
6978}
6979
6980impl futures::Stream for ScreenCaptureRequestStream {
6981    type Item = Result<ScreenCaptureRequest, fidl::Error>;
6982
6983    fn poll_next(
6984        mut self: std::pin::Pin<&mut Self>,
6985        cx: &mut std::task::Context<'_>,
6986    ) -> std::task::Poll<Option<Self::Item>> {
6987        let this = &mut *self;
6988        if this.inner.check_shutdown(cx) {
6989            this.is_terminated = true;
6990            return std::task::Poll::Ready(None);
6991        }
6992        if this.is_terminated {
6993            panic!("polled ScreenCaptureRequestStream after completion");
6994        }
6995        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
6996            |bytes, handles| {
6997                match this.inner.channel().read_etc(cx, bytes, handles) {
6998                    std::task::Poll::Ready(Ok(())) => {}
6999                    std::task::Poll::Pending => return std::task::Poll::Pending,
7000                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
7001                        this.is_terminated = true;
7002                        return std::task::Poll::Ready(None);
7003                    }
7004                    std::task::Poll::Ready(Err(e)) => {
7005                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
7006                            e.into(),
7007                        ))));
7008                    }
7009                }
7010
7011                // A message has been received from the channel
7012                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7013
7014                std::task::Poll::Ready(Some(match header.ordinal {
7015                    0x3b6e5af1d294afd9 => {
7016                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7017                        let mut req = fidl::new_empty!(
7018                            ScreenCaptureConfig,
7019                            fidl::encoding::DefaultFuchsiaResourceDialect
7020                        );
7021                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ScreenCaptureConfig>(&header, _body_bytes, handles, &mut req)?;
7022                        let control_handle =
7023                            ScreenCaptureControlHandle { inner: this.inner.clone() };
7024                        Ok(ScreenCaptureRequest::Configure {
7025                            payload: req,
7026                            responder: ScreenCaptureConfigureResponder {
7027                                control_handle: std::mem::ManuallyDrop::new(control_handle),
7028                                tx_id: header.tx_id,
7029                            },
7030                        })
7031                    }
7032                    0x552c1580aab8c4a7 => {
7033                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7034                        let mut req = fidl::new_empty!(
7035                            GetNextFrameArgs,
7036                            fidl::encoding::DefaultFuchsiaResourceDialect
7037                        );
7038                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<GetNextFrameArgs>(&header, _body_bytes, handles, &mut req)?;
7039                        let control_handle =
7040                            ScreenCaptureControlHandle { inner: this.inner.clone() };
7041                        Ok(ScreenCaptureRequest::GetNextFrame {
7042                            payload: req,
7043                            responder: ScreenCaptureGetNextFrameResponder {
7044                                control_handle: std::mem::ManuallyDrop::new(control_handle),
7045                                tx_id: header.tx_id,
7046                            },
7047                        })
7048                    }
7049                    0x46704dce24e35950 => {
7050                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7051                        let mut req = fidl::new_empty!(
7052                            ScreenCaptureReleaseFrameRequest,
7053                            fidl::encoding::DefaultFuchsiaResourceDialect
7054                        );
7055                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ScreenCaptureReleaseFrameRequest>(&header, _body_bytes, handles, &mut req)?;
7056                        let control_handle =
7057                            ScreenCaptureControlHandle { inner: this.inner.clone() };
7058                        Ok(ScreenCaptureRequest::ReleaseFrame {
7059                            buffer_id: req.buffer_id,
7060
7061                            responder: ScreenCaptureReleaseFrameResponder {
7062                                control_handle: std::mem::ManuallyDrop::new(control_handle),
7063                                tx_id: header.tx_id,
7064                            },
7065                        })
7066                    }
7067                    _ => Err(fidl::Error::UnknownOrdinal {
7068                        ordinal: header.ordinal,
7069                        protocol_name:
7070                            <ScreenCaptureMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
7071                    }),
7072                }))
7073            },
7074        )
7075    }
7076}
7077
7078/// This protocol provides a low-level ScreenCapture API for clients to use.
7079/// ScreenCapture clients should familiarize themselves with the
7080/// [`fuchsia.sysmem/BufferCollection`] and [`fuchsia.ui.composition/Allocator`] protocols
7081/// as those are necessary to create the BufferCollections and images ScreenCapture uses.
7082#[derive(Debug)]
7083pub enum ScreenCaptureRequest {
7084    /// Clients should first use the Allocator protocol to register a
7085    /// BufferCollection. This function will fail with BAD_OPERATION unless all clients of the
7086    /// BufferCollection have set their constraints.
7087    ///
7088    /// Afterwards, clients should create and configure the images that will
7089    /// eventually be rendered to using this method. All the buffers in the
7090    /// collection from 0 to (buffer_count-1) may be used for screen capture.
7091    ///
7092    /// Clients are responsible for determining the rotation of the display,
7093    /// and applying the corrective rotation. For instance, if the display is
7094    /// mounted 90 degrees clockwise (the "top" is on the right, when looking
7095    /// at the display), then the client should specify a 270 degree rotation
7096    /// to account for it.
7097    ///
7098    /// Similarly, the clients are responsible for specifying a buffer big
7099    /// enough for the rotated image. If the buffer is too small, a best effort
7100    /// attempt will be made to render the image.
7101    ///
7102    /// Finally, clients request the server to render the current screen to the
7103    /// shared buffers using [`GetNextFrame`].
7104    ///
7105    /// [`Configure`] can be called again with a new BufferCollectionImportToken
7106    /// if the client wishes to change any of the configuration settings. In
7107    /// this case all the buffers from the previous call to [`Configure`] will
7108    /// be released.
7109    Configure { payload: ScreenCaptureConfig, responder: ScreenCaptureConfigureResponder },
7110    /// Following a successful call to [`Configure`], clients can call
7111    /// GetNextFrame. This will populate a buffer with the most recent frame.
7112    ///
7113    /// Clients should wait on the zx::event they pass for successful
7114    /// completion of the screenshot. It is not guaranteed that the screenshot
7115    /// will be completed by the time this function returns.
7116    ///
7117    /// The requested image will be in the BufferCollection that the client set
7118    /// up in the VMO at the index specified by buffer_id.
7119    ///
7120    /// When ScreenCapture is used to provide a stream, the rate that the
7121    /// client calls GetNextFrame will drive the frame rate.
7122    ///
7123    /// Errors:
7124    /// BAD_OPERATION if Configure was not called, or not called successfully
7125    /// MISSING_ARGS if a required argument is not present
7126    /// BUFFER_FULL if all buffers in the BufferCollection are in use. In this case, ReleaseFrame
7127    /// must be called to make a buffer available before this function can be called successfully.
7128    GetNextFrame { payload: GetNextFrameArgs, responder: ScreenCaptureGetNextFrameResponder },
7129    /// Once the client no longer needs an image, they can call ReleaseFrame on
7130    /// the VMO index of the buffer so that the server can reuse it in the future.
7131    ReleaseFrame { buffer_id: u32, responder: ScreenCaptureReleaseFrameResponder },
7132}
7133
7134impl ScreenCaptureRequest {
7135    #[allow(irrefutable_let_patterns)]
7136    pub fn into_configure(self) -> Option<(ScreenCaptureConfig, ScreenCaptureConfigureResponder)> {
7137        if let ScreenCaptureRequest::Configure { payload, responder } = self {
7138            Some((payload, responder))
7139        } else {
7140            None
7141        }
7142    }
7143
7144    #[allow(irrefutable_let_patterns)]
7145    pub fn into_get_next_frame(
7146        self,
7147    ) -> Option<(GetNextFrameArgs, ScreenCaptureGetNextFrameResponder)> {
7148        if let ScreenCaptureRequest::GetNextFrame { payload, responder } = self {
7149            Some((payload, responder))
7150        } else {
7151            None
7152        }
7153    }
7154
7155    #[allow(irrefutable_let_patterns)]
7156    pub fn into_release_frame(self) -> Option<(u32, ScreenCaptureReleaseFrameResponder)> {
7157        if let ScreenCaptureRequest::ReleaseFrame { buffer_id, responder } = self {
7158            Some((buffer_id, responder))
7159        } else {
7160            None
7161        }
7162    }
7163
7164    /// Name of the method defined in FIDL
7165    pub fn method_name(&self) -> &'static str {
7166        match *self {
7167            ScreenCaptureRequest::Configure { .. } => "configure",
7168            ScreenCaptureRequest::GetNextFrame { .. } => "get_next_frame",
7169            ScreenCaptureRequest::ReleaseFrame { .. } => "release_frame",
7170        }
7171    }
7172}
7173
7174#[derive(Debug, Clone)]
7175pub struct ScreenCaptureControlHandle {
7176    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7177}
7178
7179impl fidl::endpoints::ControlHandle for ScreenCaptureControlHandle {
7180    fn shutdown(&self) {
7181        self.inner.shutdown()
7182    }
7183    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
7184        self.inner.shutdown_with_epitaph(status)
7185    }
7186
7187    fn is_closed(&self) -> bool {
7188        self.inner.channel().is_closed()
7189    }
7190    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
7191        self.inner.channel().on_closed()
7192    }
7193
7194    #[cfg(target_os = "fuchsia")]
7195    fn signal_peer(
7196        &self,
7197        clear_mask: zx::Signals,
7198        set_mask: zx::Signals,
7199    ) -> Result<(), zx_status::Status> {
7200        use fidl::Peered;
7201        self.inner.channel().signal_peer(clear_mask, set_mask)
7202    }
7203}
7204
7205impl ScreenCaptureControlHandle {}
7206
7207#[must_use = "FIDL methods require a response to be sent"]
7208#[derive(Debug)]
7209pub struct ScreenCaptureConfigureResponder {
7210    control_handle: std::mem::ManuallyDrop<ScreenCaptureControlHandle>,
7211    tx_id: u32,
7212}
7213
7214/// Set the the channel to be shutdown (see [`ScreenCaptureControlHandle::shutdown`])
7215/// if the responder is dropped without sending a response, so that the client
7216/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7217impl std::ops::Drop for ScreenCaptureConfigureResponder {
7218    fn drop(&mut self) {
7219        self.control_handle.shutdown();
7220        // Safety: drops once, never accessed again
7221        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7222    }
7223}
7224
7225impl fidl::endpoints::Responder for ScreenCaptureConfigureResponder {
7226    type ControlHandle = ScreenCaptureControlHandle;
7227
7228    fn control_handle(&self) -> &ScreenCaptureControlHandle {
7229        &self.control_handle
7230    }
7231
7232    fn drop_without_shutdown(mut self) {
7233        // Safety: drops once, never accessed again due to mem::forget
7234        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7235        // Prevent Drop from running (which would shut down the channel)
7236        std::mem::forget(self);
7237    }
7238}
7239
7240impl ScreenCaptureConfigureResponder {
7241    /// Sends a response to the FIDL transaction.
7242    ///
7243    /// Sets the channel to shutdown if an error occurs.
7244    pub fn send(self, mut result: Result<(), ScreenCaptureError>) -> Result<(), fidl::Error> {
7245        let _result = self.send_raw(result);
7246        if _result.is_err() {
7247            self.control_handle.shutdown();
7248        }
7249        self.drop_without_shutdown();
7250        _result
7251    }
7252
7253    /// Similar to "send" but does not shutdown the channel if an error occurs.
7254    pub fn send_no_shutdown_on_err(
7255        self,
7256        mut result: Result<(), ScreenCaptureError>,
7257    ) -> Result<(), fidl::Error> {
7258        let _result = self.send_raw(result);
7259        self.drop_without_shutdown();
7260        _result
7261    }
7262
7263    fn send_raw(&self, mut result: Result<(), ScreenCaptureError>) -> Result<(), fidl::Error> {
7264        self.control_handle.inner.send::<fidl::encoding::ResultType<
7265            fidl::encoding::EmptyStruct,
7266            ScreenCaptureError,
7267        >>(
7268            result,
7269            self.tx_id,
7270            0x3b6e5af1d294afd9,
7271            fidl::encoding::DynamicFlags::empty(),
7272        )
7273    }
7274}
7275
7276#[must_use = "FIDL methods require a response to be sent"]
7277#[derive(Debug)]
7278pub struct ScreenCaptureGetNextFrameResponder {
7279    control_handle: std::mem::ManuallyDrop<ScreenCaptureControlHandle>,
7280    tx_id: u32,
7281}
7282
7283/// Set the the channel to be shutdown (see [`ScreenCaptureControlHandle::shutdown`])
7284/// if the responder is dropped without sending a response, so that the client
7285/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7286impl std::ops::Drop for ScreenCaptureGetNextFrameResponder {
7287    fn drop(&mut self) {
7288        self.control_handle.shutdown();
7289        // Safety: drops once, never accessed again
7290        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7291    }
7292}
7293
7294impl fidl::endpoints::Responder for ScreenCaptureGetNextFrameResponder {
7295    type ControlHandle = ScreenCaptureControlHandle;
7296
7297    fn control_handle(&self) -> &ScreenCaptureControlHandle {
7298        &self.control_handle
7299    }
7300
7301    fn drop_without_shutdown(mut self) {
7302        // Safety: drops once, never accessed again due to mem::forget
7303        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7304        // Prevent Drop from running (which would shut down the channel)
7305        std::mem::forget(self);
7306    }
7307}
7308
7309impl ScreenCaptureGetNextFrameResponder {
7310    /// Sends a response to the FIDL transaction.
7311    ///
7312    /// Sets the channel to shutdown if an error occurs.
7313    pub fn send(
7314        self,
7315        mut result: Result<FrameInfo, ScreenCaptureError>,
7316    ) -> Result<(), fidl::Error> {
7317        let _result = self.send_raw(result);
7318        if _result.is_err() {
7319            self.control_handle.shutdown();
7320        }
7321        self.drop_without_shutdown();
7322        _result
7323    }
7324
7325    /// Similar to "send" but does not shutdown the channel if an error occurs.
7326    pub fn send_no_shutdown_on_err(
7327        self,
7328        mut result: Result<FrameInfo, ScreenCaptureError>,
7329    ) -> Result<(), fidl::Error> {
7330        let _result = self.send_raw(result);
7331        self.drop_without_shutdown();
7332        _result
7333    }
7334
7335    fn send_raw(
7336        &self,
7337        mut result: Result<FrameInfo, ScreenCaptureError>,
7338    ) -> Result<(), fidl::Error> {
7339        self.control_handle.inner.send::<fidl::encoding::ResultType<FrameInfo, ScreenCaptureError>>(
7340            result.as_mut().map_err(|e| *e),
7341            self.tx_id,
7342            0x552c1580aab8c4a7,
7343            fidl::encoding::DynamicFlags::empty(),
7344        )
7345    }
7346}
7347
7348#[must_use = "FIDL methods require a response to be sent"]
7349#[derive(Debug)]
7350pub struct ScreenCaptureReleaseFrameResponder {
7351    control_handle: std::mem::ManuallyDrop<ScreenCaptureControlHandle>,
7352    tx_id: u32,
7353}
7354
7355/// Set the the channel to be shutdown (see [`ScreenCaptureControlHandle::shutdown`])
7356/// if the responder is dropped without sending a response, so that the client
7357/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7358impl std::ops::Drop for ScreenCaptureReleaseFrameResponder {
7359    fn drop(&mut self) {
7360        self.control_handle.shutdown();
7361        // Safety: drops once, never accessed again
7362        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7363    }
7364}
7365
7366impl fidl::endpoints::Responder for ScreenCaptureReleaseFrameResponder {
7367    type ControlHandle = ScreenCaptureControlHandle;
7368
7369    fn control_handle(&self) -> &ScreenCaptureControlHandle {
7370        &self.control_handle
7371    }
7372
7373    fn drop_without_shutdown(mut self) {
7374        // Safety: drops once, never accessed again due to mem::forget
7375        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7376        // Prevent Drop from running (which would shut down the channel)
7377        std::mem::forget(self);
7378    }
7379}
7380
7381impl ScreenCaptureReleaseFrameResponder {
7382    /// Sends a response to the FIDL transaction.
7383    ///
7384    /// Sets the channel to shutdown if an error occurs.
7385    pub fn send(self, mut result: Result<(), ScreenCaptureError>) -> Result<(), fidl::Error> {
7386        let _result = self.send_raw(result);
7387        if _result.is_err() {
7388            self.control_handle.shutdown();
7389        }
7390        self.drop_without_shutdown();
7391        _result
7392    }
7393
7394    /// Similar to "send" but does not shutdown the channel if an error occurs.
7395    pub fn send_no_shutdown_on_err(
7396        self,
7397        mut result: Result<(), ScreenCaptureError>,
7398    ) -> Result<(), fidl::Error> {
7399        let _result = self.send_raw(result);
7400        self.drop_without_shutdown();
7401        _result
7402    }
7403
7404    fn send_raw(&self, mut result: Result<(), ScreenCaptureError>) -> Result<(), fidl::Error> {
7405        self.control_handle.inner.send::<fidl::encoding::ResultType<
7406            fidl::encoding::EmptyStruct,
7407            ScreenCaptureError,
7408        >>(
7409            result,
7410            self.tx_id,
7411            0x46704dce24e35950,
7412            fidl::encoding::DynamicFlags::empty(),
7413        )
7414    }
7415}
7416
7417#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
7418pub struct ScreenshotMarker;
7419
7420impl fidl::endpoints::ProtocolMarker for ScreenshotMarker {
7421    type Proxy = ScreenshotProxy;
7422    type RequestStream = ScreenshotRequestStream;
7423    #[cfg(target_os = "fuchsia")]
7424    type SynchronousProxy = ScreenshotSynchronousProxy;
7425
7426    const DEBUG_NAME: &'static str = "fuchsia.ui.composition.Screenshot";
7427}
7428impl fidl::endpoints::DiscoverableProtocolMarker for ScreenshotMarker {}
7429
7430pub trait ScreenshotProxyInterface: Send + Sync {
7431    type TakeResponseFut: std::future::Future<Output = Result<ScreenshotTakeResponse, fidl::Error>>
7432        + Send;
7433    fn r#take(&self, payload: ScreenshotTakeRequest) -> Self::TakeResponseFut;
7434    type TakeFileResponseFut: std::future::Future<Output = Result<ScreenshotTakeFileResponse, fidl::Error>>
7435        + Send;
7436    fn r#take_file(&self, payload: ScreenshotTakeFileRequest) -> Self::TakeFileResponseFut;
7437}
7438#[derive(Debug)]
7439#[cfg(target_os = "fuchsia")]
7440pub struct ScreenshotSynchronousProxy {
7441    client: fidl::client::sync::Client,
7442}
7443
7444#[cfg(target_os = "fuchsia")]
7445impl fidl::endpoints::SynchronousProxy for ScreenshotSynchronousProxy {
7446    type Proxy = ScreenshotProxy;
7447    type Protocol = ScreenshotMarker;
7448
7449    fn from_channel(inner: fidl::Channel) -> Self {
7450        Self::new(inner)
7451    }
7452
7453    fn into_channel(self) -> fidl::Channel {
7454        self.client.into_channel()
7455    }
7456
7457    fn as_channel(&self) -> &fidl::Channel {
7458        self.client.as_channel()
7459    }
7460}
7461
7462#[cfg(target_os = "fuchsia")]
7463impl ScreenshotSynchronousProxy {
7464    pub fn new(channel: fidl::Channel) -> Self {
7465        let protocol_name = <ScreenshotMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
7466        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
7467    }
7468
7469    pub fn into_channel(self) -> fidl::Channel {
7470        self.client.into_channel()
7471    }
7472
7473    /// Waits until an event arrives and returns it. It is safe for other
7474    /// threads to make concurrent requests while waiting for an event.
7475    pub fn wait_for_event(
7476        &self,
7477        deadline: zx::MonotonicInstant,
7478    ) -> Result<ScreenshotEvent, fidl::Error> {
7479        ScreenshotEvent::decode(self.client.wait_for_event(deadline)?)
7480    }
7481
7482    /// Collects the current graphical content of a display in a specified buffer `format` in the
7483    /// sRGB color space. Note that the sRGB color space is non-linear, meaning that unit tests
7484    /// doing pixel equality checks making use of non-fully saturated colors should convert to a
7485    /// linear color space.
7486    ///
7487    /// See https://fuchsia.dev/fuchsia-src/concepts/ui/scenic/color_spaces for more information.
7488    ///
7489    /// Screenshot is taken immediately, populated with the display's content from the most recent
7490    /// VSYNC.
7491    ///
7492    /// If the client calls [`Take`] a second time before a first [`Take`] call returns, the server
7493    /// will close the Screenshot connection with a ZX_ERR_SHOULD_WAIT epitaph.
7494    ///
7495    /// If capture fails due to an internal error, the server will close the Screenshot connection
7496    /// with a ZX_ERR_INTERNAL epitaph.
7497    pub fn r#take(
7498        &self,
7499        mut payload: ScreenshotTakeRequest,
7500        ___deadline: zx::MonotonicInstant,
7501    ) -> Result<ScreenshotTakeResponse, fidl::Error> {
7502        let _response = self.client.send_query::<ScreenshotTakeRequest, ScreenshotTakeResponse>(
7503            &mut payload,
7504            0x51341396e9fd2fd0,
7505            fidl::encoding::DynamicFlags::empty(),
7506            ___deadline,
7507        )?;
7508        Ok(_response)
7509    }
7510
7511    /// Collects the current graphical content of a display in a specified buffer `format` in the
7512    /// sRGB color space. Note that the sRGB color space is non-linear, meaning that unit tests
7513    /// doing pixel equality checks making use of non-fully saturated colors should convert to a
7514    /// linear color space.
7515    ///
7516    /// TODO(https://fxbug.dev/42065844): Link to fuchsia.dev documentation when it's up.
7517    ///
7518    /// Screenshot is taken immediately, populated with the display's content from the most recent
7519    /// VSYNC.
7520    ///
7521    /// If the client calls [`TakeFile`] a second time before a first [`TakeFile`] call returns,
7522    /// the server will close the Screenshot connection with a ZX_ERR_SHOULD_WAIT epitaph.
7523    ///
7524    /// If capture fails due to an internal error, the server will close the Screenshot connection
7525    /// with a ZX_ERR_INTERNAL epitaph.
7526    ///
7527    /// This call should be used if the client is on the host and does not support VMOs,
7528    /// as is the case for ffx tools.
7529    pub fn r#take_file(
7530        &self,
7531        mut payload: ScreenshotTakeFileRequest,
7532        ___deadline: zx::MonotonicInstant,
7533    ) -> Result<ScreenshotTakeFileResponse, fidl::Error> {
7534        let _response =
7535            self.client.send_query::<ScreenshotTakeFileRequest, ScreenshotTakeFileResponse>(
7536                &mut payload,
7537                0x470aeea0a4d32903,
7538                fidl::encoding::DynamicFlags::empty(),
7539                ___deadline,
7540            )?;
7541        Ok(_response)
7542    }
7543}
7544
7545#[cfg(target_os = "fuchsia")]
7546impl From<ScreenshotSynchronousProxy> for zx::Handle {
7547    fn from(value: ScreenshotSynchronousProxy) -> Self {
7548        value.into_channel().into()
7549    }
7550}
7551
7552#[cfg(target_os = "fuchsia")]
7553impl From<fidl::Channel> for ScreenshotSynchronousProxy {
7554    fn from(value: fidl::Channel) -> Self {
7555        Self::new(value)
7556    }
7557}
7558
7559#[cfg(target_os = "fuchsia")]
7560impl fidl::endpoints::FromClient for ScreenshotSynchronousProxy {
7561    type Protocol = ScreenshotMarker;
7562
7563    fn from_client(value: fidl::endpoints::ClientEnd<ScreenshotMarker>) -> Self {
7564        Self::new(value.into_channel())
7565    }
7566}
7567
7568#[derive(Debug, Clone)]
7569pub struct ScreenshotProxy {
7570    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
7571}
7572
7573impl fidl::endpoints::Proxy for ScreenshotProxy {
7574    type Protocol = ScreenshotMarker;
7575
7576    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
7577        Self::new(inner)
7578    }
7579
7580    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
7581        self.client.into_channel().map_err(|client| Self { client })
7582    }
7583
7584    fn as_channel(&self) -> &::fidl::AsyncChannel {
7585        self.client.as_channel()
7586    }
7587}
7588
7589impl ScreenshotProxy {
7590    /// Create a new Proxy for fuchsia.ui.composition/Screenshot.
7591    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
7592        let protocol_name = <ScreenshotMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
7593        Self { client: fidl::client::Client::new(channel, protocol_name) }
7594    }
7595
7596    /// Get a Stream of events from the remote end of the protocol.
7597    ///
7598    /// # Panics
7599    ///
7600    /// Panics if the event stream was already taken.
7601    pub fn take_event_stream(&self) -> ScreenshotEventStream {
7602        ScreenshotEventStream { event_receiver: self.client.take_event_receiver() }
7603    }
7604
7605    /// Collects the current graphical content of a display in a specified buffer `format` in the
7606    /// sRGB color space. Note that the sRGB color space is non-linear, meaning that unit tests
7607    /// doing pixel equality checks making use of non-fully saturated colors should convert to a
7608    /// linear color space.
7609    ///
7610    /// See https://fuchsia.dev/fuchsia-src/concepts/ui/scenic/color_spaces for more information.
7611    ///
7612    /// Screenshot is taken immediately, populated with the display's content from the most recent
7613    /// VSYNC.
7614    ///
7615    /// If the client calls [`Take`] a second time before a first [`Take`] call returns, the server
7616    /// will close the Screenshot connection with a ZX_ERR_SHOULD_WAIT epitaph.
7617    ///
7618    /// If capture fails due to an internal error, the server will close the Screenshot connection
7619    /// with a ZX_ERR_INTERNAL epitaph.
7620    pub fn r#take(
7621        &self,
7622        mut payload: ScreenshotTakeRequest,
7623    ) -> fidl::client::QueryResponseFut<
7624        ScreenshotTakeResponse,
7625        fidl::encoding::DefaultFuchsiaResourceDialect,
7626    > {
7627        ScreenshotProxyInterface::r#take(self, payload)
7628    }
7629
7630    /// Collects the current graphical content of a display in a specified buffer `format` in the
7631    /// sRGB color space. Note that the sRGB color space is non-linear, meaning that unit tests
7632    /// doing pixel equality checks making use of non-fully saturated colors should convert to a
7633    /// linear color space.
7634    ///
7635    /// TODO(https://fxbug.dev/42065844): Link to fuchsia.dev documentation when it's up.
7636    ///
7637    /// Screenshot is taken immediately, populated with the display's content from the most recent
7638    /// VSYNC.
7639    ///
7640    /// If the client calls [`TakeFile`] a second time before a first [`TakeFile`] call returns,
7641    /// the server will close the Screenshot connection with a ZX_ERR_SHOULD_WAIT epitaph.
7642    ///
7643    /// If capture fails due to an internal error, the server will close the Screenshot connection
7644    /// with a ZX_ERR_INTERNAL epitaph.
7645    ///
7646    /// This call should be used if the client is on the host and does not support VMOs,
7647    /// as is the case for ffx tools.
7648    pub fn r#take_file(
7649        &self,
7650        mut payload: ScreenshotTakeFileRequest,
7651    ) -> fidl::client::QueryResponseFut<
7652        ScreenshotTakeFileResponse,
7653        fidl::encoding::DefaultFuchsiaResourceDialect,
7654    > {
7655        ScreenshotProxyInterface::r#take_file(self, payload)
7656    }
7657}
7658
7659impl ScreenshotProxyInterface for ScreenshotProxy {
7660    type TakeResponseFut = fidl::client::QueryResponseFut<
7661        ScreenshotTakeResponse,
7662        fidl::encoding::DefaultFuchsiaResourceDialect,
7663    >;
7664    fn r#take(&self, mut payload: ScreenshotTakeRequest) -> Self::TakeResponseFut {
7665        fn _decode(
7666            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7667        ) -> Result<ScreenshotTakeResponse, fidl::Error> {
7668            let _response = fidl::client::decode_transaction_body::<
7669                ScreenshotTakeResponse,
7670                fidl::encoding::DefaultFuchsiaResourceDialect,
7671                0x51341396e9fd2fd0,
7672            >(_buf?)?;
7673            Ok(_response)
7674        }
7675        self.client.send_query_and_decode::<ScreenshotTakeRequest, ScreenshotTakeResponse>(
7676            &mut payload,
7677            0x51341396e9fd2fd0,
7678            fidl::encoding::DynamicFlags::empty(),
7679            _decode,
7680        )
7681    }
7682
7683    type TakeFileResponseFut = fidl::client::QueryResponseFut<
7684        ScreenshotTakeFileResponse,
7685        fidl::encoding::DefaultFuchsiaResourceDialect,
7686    >;
7687    fn r#take_file(&self, mut payload: ScreenshotTakeFileRequest) -> Self::TakeFileResponseFut {
7688        fn _decode(
7689            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7690        ) -> Result<ScreenshotTakeFileResponse, fidl::Error> {
7691            let _response = fidl::client::decode_transaction_body::<
7692                ScreenshotTakeFileResponse,
7693                fidl::encoding::DefaultFuchsiaResourceDialect,
7694                0x470aeea0a4d32903,
7695            >(_buf?)?;
7696            Ok(_response)
7697        }
7698        self.client.send_query_and_decode::<ScreenshotTakeFileRequest, ScreenshotTakeFileResponse>(
7699            &mut payload,
7700            0x470aeea0a4d32903,
7701            fidl::encoding::DynamicFlags::empty(),
7702            _decode,
7703        )
7704    }
7705}
7706
7707pub struct ScreenshotEventStream {
7708    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
7709}
7710
7711impl std::marker::Unpin for ScreenshotEventStream {}
7712
7713impl futures::stream::FusedStream for ScreenshotEventStream {
7714    fn is_terminated(&self) -> bool {
7715        self.event_receiver.is_terminated()
7716    }
7717}
7718
7719impl futures::Stream for ScreenshotEventStream {
7720    type Item = Result<ScreenshotEvent, fidl::Error>;
7721
7722    fn poll_next(
7723        mut self: std::pin::Pin<&mut Self>,
7724        cx: &mut std::task::Context<'_>,
7725    ) -> std::task::Poll<Option<Self::Item>> {
7726        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
7727            &mut self.event_receiver,
7728            cx
7729        )?) {
7730            Some(buf) => std::task::Poll::Ready(Some(ScreenshotEvent::decode(buf))),
7731            None => std::task::Poll::Ready(None),
7732        }
7733    }
7734}
7735
7736#[derive(Debug)]
7737pub enum ScreenshotEvent {}
7738
7739impl ScreenshotEvent {
7740    /// Decodes a message buffer as a [`ScreenshotEvent`].
7741    fn decode(
7742        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
7743    ) -> Result<ScreenshotEvent, fidl::Error> {
7744        let (bytes, _handles) = buf.split_mut();
7745        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7746        debug_assert_eq!(tx_header.tx_id, 0);
7747        match tx_header.ordinal {
7748            _ => Err(fidl::Error::UnknownOrdinal {
7749                ordinal: tx_header.ordinal,
7750                protocol_name: <ScreenshotMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
7751            }),
7752        }
7753    }
7754}
7755
7756/// A Stream of incoming requests for fuchsia.ui.composition/Screenshot.
7757pub struct ScreenshotRequestStream {
7758    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7759    is_terminated: bool,
7760}
7761
7762impl std::marker::Unpin for ScreenshotRequestStream {}
7763
7764impl futures::stream::FusedStream for ScreenshotRequestStream {
7765    fn is_terminated(&self) -> bool {
7766        self.is_terminated
7767    }
7768}
7769
7770impl fidl::endpoints::RequestStream for ScreenshotRequestStream {
7771    type Protocol = ScreenshotMarker;
7772    type ControlHandle = ScreenshotControlHandle;
7773
7774    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
7775        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
7776    }
7777
7778    fn control_handle(&self) -> Self::ControlHandle {
7779        ScreenshotControlHandle { inner: self.inner.clone() }
7780    }
7781
7782    fn into_inner(
7783        self,
7784    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
7785    {
7786        (self.inner, self.is_terminated)
7787    }
7788
7789    fn from_inner(
7790        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7791        is_terminated: bool,
7792    ) -> Self {
7793        Self { inner, is_terminated }
7794    }
7795}
7796
7797impl futures::Stream for ScreenshotRequestStream {
7798    type Item = Result<ScreenshotRequest, fidl::Error>;
7799
7800    fn poll_next(
7801        mut self: std::pin::Pin<&mut Self>,
7802        cx: &mut std::task::Context<'_>,
7803    ) -> std::task::Poll<Option<Self::Item>> {
7804        let this = &mut *self;
7805        if this.inner.check_shutdown(cx) {
7806            this.is_terminated = true;
7807            return std::task::Poll::Ready(None);
7808        }
7809        if this.is_terminated {
7810            panic!("polled ScreenshotRequestStream after completion");
7811        }
7812        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
7813            |bytes, handles| {
7814                match this.inner.channel().read_etc(cx, bytes, handles) {
7815                    std::task::Poll::Ready(Ok(())) => {}
7816                    std::task::Poll::Pending => return std::task::Poll::Pending,
7817                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
7818                        this.is_terminated = true;
7819                        return std::task::Poll::Ready(None);
7820                    }
7821                    std::task::Poll::Ready(Err(e)) => {
7822                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
7823                            e.into(),
7824                        ))));
7825                    }
7826                }
7827
7828                // A message has been received from the channel
7829                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7830
7831                std::task::Poll::Ready(Some(match header.ordinal {
7832                    0x51341396e9fd2fd0 => {
7833                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7834                        let mut req = fidl::new_empty!(
7835                            ScreenshotTakeRequest,
7836                            fidl::encoding::DefaultFuchsiaResourceDialect
7837                        );
7838                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ScreenshotTakeRequest>(&header, _body_bytes, handles, &mut req)?;
7839                        let control_handle = ScreenshotControlHandle { inner: this.inner.clone() };
7840                        Ok(ScreenshotRequest::Take {
7841                            payload: req,
7842                            responder: ScreenshotTakeResponder {
7843                                control_handle: std::mem::ManuallyDrop::new(control_handle),
7844                                tx_id: header.tx_id,
7845                            },
7846                        })
7847                    }
7848                    0x470aeea0a4d32903 => {
7849                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7850                        let mut req = fidl::new_empty!(
7851                            ScreenshotTakeFileRequest,
7852                            fidl::encoding::DefaultFuchsiaResourceDialect
7853                        );
7854                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ScreenshotTakeFileRequest>(&header, _body_bytes, handles, &mut req)?;
7855                        let control_handle = ScreenshotControlHandle { inner: this.inner.clone() };
7856                        Ok(ScreenshotRequest::TakeFile {
7857                            payload: req,
7858                            responder: ScreenshotTakeFileResponder {
7859                                control_handle: std::mem::ManuallyDrop::new(control_handle),
7860                                tx_id: header.tx_id,
7861                            },
7862                        })
7863                    }
7864                    _ => Err(fidl::Error::UnknownOrdinal {
7865                        ordinal: header.ordinal,
7866                        protocol_name:
7867                            <ScreenshotMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
7868                    }),
7869                }))
7870            },
7871        )
7872    }
7873}
7874
7875/// Collects the current graphical content of a display.
7876#[derive(Debug)]
7877pub enum ScreenshotRequest {
7878    /// Collects the current graphical content of a display in a specified buffer `format` in the
7879    /// sRGB color space. Note that the sRGB color space is non-linear, meaning that unit tests
7880    /// doing pixel equality checks making use of non-fully saturated colors should convert to a
7881    /// linear color space.
7882    ///
7883    /// See https://fuchsia.dev/fuchsia-src/concepts/ui/scenic/color_spaces for more information.
7884    ///
7885    /// Screenshot is taken immediately, populated with the display's content from the most recent
7886    /// VSYNC.
7887    ///
7888    /// If the client calls [`Take`] a second time before a first [`Take`] call returns, the server
7889    /// will close the Screenshot connection with a ZX_ERR_SHOULD_WAIT epitaph.
7890    ///
7891    /// If capture fails due to an internal error, the server will close the Screenshot connection
7892    /// with a ZX_ERR_INTERNAL epitaph.
7893    Take { payload: ScreenshotTakeRequest, responder: ScreenshotTakeResponder },
7894    /// Collects the current graphical content of a display in a specified buffer `format` in the
7895    /// sRGB color space. Note that the sRGB color space is non-linear, meaning that unit tests
7896    /// doing pixel equality checks making use of non-fully saturated colors should convert to a
7897    /// linear color space.
7898    ///
7899    /// TODO(https://fxbug.dev/42065844): Link to fuchsia.dev documentation when it's up.
7900    ///
7901    /// Screenshot is taken immediately, populated with the display's content from the most recent
7902    /// VSYNC.
7903    ///
7904    /// If the client calls [`TakeFile`] a second time before a first [`TakeFile`] call returns,
7905    /// the server will close the Screenshot connection with a ZX_ERR_SHOULD_WAIT epitaph.
7906    ///
7907    /// If capture fails due to an internal error, the server will close the Screenshot connection
7908    /// with a ZX_ERR_INTERNAL epitaph.
7909    ///
7910    /// This call should be used if the client is on the host and does not support VMOs,
7911    /// as is the case for ffx tools.
7912    TakeFile { payload: ScreenshotTakeFileRequest, responder: ScreenshotTakeFileResponder },
7913}
7914
7915impl ScreenshotRequest {
7916    #[allow(irrefutable_let_patterns)]
7917    pub fn into_take(self) -> Option<(ScreenshotTakeRequest, ScreenshotTakeResponder)> {
7918        if let ScreenshotRequest::Take { payload, responder } = self {
7919            Some((payload, responder))
7920        } else {
7921            None
7922        }
7923    }
7924
7925    #[allow(irrefutable_let_patterns)]
7926    pub fn into_take_file(
7927        self,
7928    ) -> Option<(ScreenshotTakeFileRequest, ScreenshotTakeFileResponder)> {
7929        if let ScreenshotRequest::TakeFile { payload, responder } = self {
7930            Some((payload, responder))
7931        } else {
7932            None
7933        }
7934    }
7935
7936    /// Name of the method defined in FIDL
7937    pub fn method_name(&self) -> &'static str {
7938        match *self {
7939            ScreenshotRequest::Take { .. } => "take",
7940            ScreenshotRequest::TakeFile { .. } => "take_file",
7941        }
7942    }
7943}
7944
7945#[derive(Debug, Clone)]
7946pub struct ScreenshotControlHandle {
7947    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7948}
7949
7950impl fidl::endpoints::ControlHandle for ScreenshotControlHandle {
7951    fn shutdown(&self) {
7952        self.inner.shutdown()
7953    }
7954    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
7955        self.inner.shutdown_with_epitaph(status)
7956    }
7957
7958    fn is_closed(&self) -> bool {
7959        self.inner.channel().is_closed()
7960    }
7961    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
7962        self.inner.channel().on_closed()
7963    }
7964
7965    #[cfg(target_os = "fuchsia")]
7966    fn signal_peer(
7967        &self,
7968        clear_mask: zx::Signals,
7969        set_mask: zx::Signals,
7970    ) -> Result<(), zx_status::Status> {
7971        use fidl::Peered;
7972        self.inner.channel().signal_peer(clear_mask, set_mask)
7973    }
7974}
7975
7976impl ScreenshotControlHandle {}
7977
7978#[must_use = "FIDL methods require a response to be sent"]
7979#[derive(Debug)]
7980pub struct ScreenshotTakeResponder {
7981    control_handle: std::mem::ManuallyDrop<ScreenshotControlHandle>,
7982    tx_id: u32,
7983}
7984
7985/// Set the the channel to be shutdown (see [`ScreenshotControlHandle::shutdown`])
7986/// if the responder is dropped without sending a response, so that the client
7987/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7988impl std::ops::Drop for ScreenshotTakeResponder {
7989    fn drop(&mut self) {
7990        self.control_handle.shutdown();
7991        // Safety: drops once, never accessed again
7992        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7993    }
7994}
7995
7996impl fidl::endpoints::Responder for ScreenshotTakeResponder {
7997    type ControlHandle = ScreenshotControlHandle;
7998
7999    fn control_handle(&self) -> &ScreenshotControlHandle {
8000        &self.control_handle
8001    }
8002
8003    fn drop_without_shutdown(mut self) {
8004        // Safety: drops once, never accessed again due to mem::forget
8005        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8006        // Prevent Drop from running (which would shut down the channel)
8007        std::mem::forget(self);
8008    }
8009}
8010
8011impl ScreenshotTakeResponder {
8012    /// Sends a response to the FIDL transaction.
8013    ///
8014    /// Sets the channel to shutdown if an error occurs.
8015    pub fn send(self, mut payload: ScreenshotTakeResponse) -> Result<(), fidl::Error> {
8016        let _result = self.send_raw(payload);
8017        if _result.is_err() {
8018            self.control_handle.shutdown();
8019        }
8020        self.drop_without_shutdown();
8021        _result
8022    }
8023
8024    /// Similar to "send" but does not shutdown the channel if an error occurs.
8025    pub fn send_no_shutdown_on_err(
8026        self,
8027        mut payload: ScreenshotTakeResponse,
8028    ) -> Result<(), fidl::Error> {
8029        let _result = self.send_raw(payload);
8030        self.drop_without_shutdown();
8031        _result
8032    }
8033
8034    fn send_raw(&self, mut payload: ScreenshotTakeResponse) -> Result<(), fidl::Error> {
8035        self.control_handle.inner.send::<ScreenshotTakeResponse>(
8036            &mut payload,
8037            self.tx_id,
8038            0x51341396e9fd2fd0,
8039            fidl::encoding::DynamicFlags::empty(),
8040        )
8041    }
8042}
8043
8044#[must_use = "FIDL methods require a response to be sent"]
8045#[derive(Debug)]
8046pub struct ScreenshotTakeFileResponder {
8047    control_handle: std::mem::ManuallyDrop<ScreenshotControlHandle>,
8048    tx_id: u32,
8049}
8050
8051/// Set the the channel to be shutdown (see [`ScreenshotControlHandle::shutdown`])
8052/// if the responder is dropped without sending a response, so that the client
8053/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
8054impl std::ops::Drop for ScreenshotTakeFileResponder {
8055    fn drop(&mut self) {
8056        self.control_handle.shutdown();
8057        // Safety: drops once, never accessed again
8058        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8059    }
8060}
8061
8062impl fidl::endpoints::Responder for ScreenshotTakeFileResponder {
8063    type ControlHandle = ScreenshotControlHandle;
8064
8065    fn control_handle(&self) -> &ScreenshotControlHandle {
8066        &self.control_handle
8067    }
8068
8069    fn drop_without_shutdown(mut self) {
8070        // Safety: drops once, never accessed again due to mem::forget
8071        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8072        // Prevent Drop from running (which would shut down the channel)
8073        std::mem::forget(self);
8074    }
8075}
8076
8077impl ScreenshotTakeFileResponder {
8078    /// Sends a response to the FIDL transaction.
8079    ///
8080    /// Sets the channel to shutdown if an error occurs.
8081    pub fn send(self, mut payload: ScreenshotTakeFileResponse) -> Result<(), fidl::Error> {
8082        let _result = self.send_raw(payload);
8083        if _result.is_err() {
8084            self.control_handle.shutdown();
8085        }
8086        self.drop_without_shutdown();
8087        _result
8088    }
8089
8090    /// Similar to "send" but does not shutdown the channel if an error occurs.
8091    pub fn send_no_shutdown_on_err(
8092        self,
8093        mut payload: ScreenshotTakeFileResponse,
8094    ) -> Result<(), fidl::Error> {
8095        let _result = self.send_raw(payload);
8096        self.drop_without_shutdown();
8097        _result
8098    }
8099
8100    fn send_raw(&self, mut payload: ScreenshotTakeFileResponse) -> Result<(), fidl::Error> {
8101        self.control_handle.inner.send::<ScreenshotTakeFileResponse>(
8102            &mut payload,
8103            self.tx_id,
8104            0x470aeea0a4d32903,
8105            fidl::encoding::DynamicFlags::empty(),
8106        )
8107    }
8108}
8109
8110#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
8111pub struct TrustedFlatlandFactoryMarker;
8112
8113impl fidl::endpoints::ProtocolMarker for TrustedFlatlandFactoryMarker {
8114    type Proxy = TrustedFlatlandFactoryProxy;
8115    type RequestStream = TrustedFlatlandFactoryRequestStream;
8116    #[cfg(target_os = "fuchsia")]
8117    type SynchronousProxy = TrustedFlatlandFactorySynchronousProxy;
8118
8119    const DEBUG_NAME: &'static str = "fuchsia.ui.composition.TrustedFlatlandFactory";
8120}
8121impl fidl::endpoints::DiscoverableProtocolMarker for TrustedFlatlandFactoryMarker {}
8122pub type TrustedFlatlandFactoryCreateFlatlandResult = Result<(), TrustedFlatlandFactoryError>;
8123
8124pub trait TrustedFlatlandFactoryProxyInterface: Send + Sync {
8125    type CreateFlatlandResponseFut: std::future::Future<
8126            Output = Result<TrustedFlatlandFactoryCreateFlatlandResult, fidl::Error>,
8127        > + Send;
8128    fn r#create_flatland(
8129        &self,
8130        server_end: fidl::endpoints::ServerEnd<FlatlandMarker>,
8131        config: TrustedFlatlandConfig,
8132    ) -> Self::CreateFlatlandResponseFut;
8133}
8134#[derive(Debug)]
8135#[cfg(target_os = "fuchsia")]
8136pub struct TrustedFlatlandFactorySynchronousProxy {
8137    client: fidl::client::sync::Client,
8138}
8139
8140#[cfg(target_os = "fuchsia")]
8141impl fidl::endpoints::SynchronousProxy for TrustedFlatlandFactorySynchronousProxy {
8142    type Proxy = TrustedFlatlandFactoryProxy;
8143    type Protocol = TrustedFlatlandFactoryMarker;
8144
8145    fn from_channel(inner: fidl::Channel) -> Self {
8146        Self::new(inner)
8147    }
8148
8149    fn into_channel(self) -> fidl::Channel {
8150        self.client.into_channel()
8151    }
8152
8153    fn as_channel(&self) -> &fidl::Channel {
8154        self.client.as_channel()
8155    }
8156}
8157
8158#[cfg(target_os = "fuchsia")]
8159impl TrustedFlatlandFactorySynchronousProxy {
8160    pub fn new(channel: fidl::Channel) -> Self {
8161        let protocol_name =
8162            <TrustedFlatlandFactoryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
8163        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
8164    }
8165
8166    pub fn into_channel(self) -> fidl::Channel {
8167        self.client.into_channel()
8168    }
8169
8170    /// Waits until an event arrives and returns it. It is safe for other
8171    /// threads to make concurrent requests while waiting for an event.
8172    pub fn wait_for_event(
8173        &self,
8174        deadline: zx::MonotonicInstant,
8175    ) -> Result<TrustedFlatlandFactoryEvent, fidl::Error> {
8176        TrustedFlatlandFactoryEvent::decode(self.client.wait_for_event(deadline)?)
8177    }
8178
8179    /// Creates a new Flatland instance with the specified configuration.
8180    ///
8181    /// ## Error
8182    ///
8183    /// Returns a `TrustedFlatlandFactoryError` error if the operation fails.
8184    pub fn r#create_flatland(
8185        &self,
8186        mut server_end: fidl::endpoints::ServerEnd<FlatlandMarker>,
8187        mut config: TrustedFlatlandConfig,
8188        ___deadline: zx::MonotonicInstant,
8189    ) -> Result<TrustedFlatlandFactoryCreateFlatlandResult, fidl::Error> {
8190        let _response = self.client.send_query::<
8191            TrustedFlatlandFactoryCreateFlatlandRequest,
8192            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, TrustedFlatlandFactoryError>,
8193        >(
8194            (server_end, &mut config,),
8195            0x48e89c53f00561dc,
8196            fidl::encoding::DynamicFlags::empty(),
8197            ___deadline,
8198        )?;
8199        Ok(_response.map(|x| x))
8200    }
8201}
8202
8203#[cfg(target_os = "fuchsia")]
8204impl From<TrustedFlatlandFactorySynchronousProxy> for zx::Handle {
8205    fn from(value: TrustedFlatlandFactorySynchronousProxy) -> Self {
8206        value.into_channel().into()
8207    }
8208}
8209
8210#[cfg(target_os = "fuchsia")]
8211impl From<fidl::Channel> for TrustedFlatlandFactorySynchronousProxy {
8212    fn from(value: fidl::Channel) -> Self {
8213        Self::new(value)
8214    }
8215}
8216
8217#[cfg(target_os = "fuchsia")]
8218impl fidl::endpoints::FromClient for TrustedFlatlandFactorySynchronousProxy {
8219    type Protocol = TrustedFlatlandFactoryMarker;
8220
8221    fn from_client(value: fidl::endpoints::ClientEnd<TrustedFlatlandFactoryMarker>) -> Self {
8222        Self::new(value.into_channel())
8223    }
8224}
8225
8226#[derive(Debug, Clone)]
8227pub struct TrustedFlatlandFactoryProxy {
8228    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
8229}
8230
8231impl fidl::endpoints::Proxy for TrustedFlatlandFactoryProxy {
8232    type Protocol = TrustedFlatlandFactoryMarker;
8233
8234    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
8235        Self::new(inner)
8236    }
8237
8238    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
8239        self.client.into_channel().map_err(|client| Self { client })
8240    }
8241
8242    fn as_channel(&self) -> &::fidl::AsyncChannel {
8243        self.client.as_channel()
8244    }
8245}
8246
8247impl TrustedFlatlandFactoryProxy {
8248    /// Create a new Proxy for fuchsia.ui.composition/TrustedFlatlandFactory.
8249    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
8250        let protocol_name =
8251            <TrustedFlatlandFactoryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
8252        Self { client: fidl::client::Client::new(channel, protocol_name) }
8253    }
8254
8255    /// Get a Stream of events from the remote end of the protocol.
8256    ///
8257    /// # Panics
8258    ///
8259    /// Panics if the event stream was already taken.
8260    pub fn take_event_stream(&self) -> TrustedFlatlandFactoryEventStream {
8261        TrustedFlatlandFactoryEventStream { event_receiver: self.client.take_event_receiver() }
8262    }
8263
8264    /// Creates a new Flatland instance with the specified configuration.
8265    ///
8266    /// ## Error
8267    ///
8268    /// Returns a `TrustedFlatlandFactoryError` error if the operation fails.
8269    pub fn r#create_flatland(
8270        &self,
8271        mut server_end: fidl::endpoints::ServerEnd<FlatlandMarker>,
8272        mut config: TrustedFlatlandConfig,
8273    ) -> fidl::client::QueryResponseFut<
8274        TrustedFlatlandFactoryCreateFlatlandResult,
8275        fidl::encoding::DefaultFuchsiaResourceDialect,
8276    > {
8277        TrustedFlatlandFactoryProxyInterface::r#create_flatland(self, server_end, config)
8278    }
8279}
8280
8281impl TrustedFlatlandFactoryProxyInterface for TrustedFlatlandFactoryProxy {
8282    type CreateFlatlandResponseFut = fidl::client::QueryResponseFut<
8283        TrustedFlatlandFactoryCreateFlatlandResult,
8284        fidl::encoding::DefaultFuchsiaResourceDialect,
8285    >;
8286    fn r#create_flatland(
8287        &self,
8288        mut server_end: fidl::endpoints::ServerEnd<FlatlandMarker>,
8289        mut config: TrustedFlatlandConfig,
8290    ) -> Self::CreateFlatlandResponseFut {
8291        fn _decode(
8292            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
8293        ) -> Result<TrustedFlatlandFactoryCreateFlatlandResult, fidl::Error> {
8294            let _response = fidl::client::decode_transaction_body::<
8295                fidl::encoding::ResultType<
8296                    fidl::encoding::EmptyStruct,
8297                    TrustedFlatlandFactoryError,
8298                >,
8299                fidl::encoding::DefaultFuchsiaResourceDialect,
8300                0x48e89c53f00561dc,
8301            >(_buf?)?;
8302            Ok(_response.map(|x| x))
8303        }
8304        self.client.send_query_and_decode::<
8305            TrustedFlatlandFactoryCreateFlatlandRequest,
8306            TrustedFlatlandFactoryCreateFlatlandResult,
8307        >(
8308            (server_end, &mut config,),
8309            0x48e89c53f00561dc,
8310            fidl::encoding::DynamicFlags::empty(),
8311            _decode,
8312        )
8313    }
8314}
8315
8316pub struct TrustedFlatlandFactoryEventStream {
8317    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
8318}
8319
8320impl std::marker::Unpin for TrustedFlatlandFactoryEventStream {}
8321
8322impl futures::stream::FusedStream for TrustedFlatlandFactoryEventStream {
8323    fn is_terminated(&self) -> bool {
8324        self.event_receiver.is_terminated()
8325    }
8326}
8327
8328impl futures::Stream for TrustedFlatlandFactoryEventStream {
8329    type Item = Result<TrustedFlatlandFactoryEvent, fidl::Error>;
8330
8331    fn poll_next(
8332        mut self: std::pin::Pin<&mut Self>,
8333        cx: &mut std::task::Context<'_>,
8334    ) -> std::task::Poll<Option<Self::Item>> {
8335        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
8336            &mut self.event_receiver,
8337            cx
8338        )?) {
8339            Some(buf) => std::task::Poll::Ready(Some(TrustedFlatlandFactoryEvent::decode(buf))),
8340            None => std::task::Poll::Ready(None),
8341        }
8342    }
8343}
8344
8345#[derive(Debug)]
8346pub enum TrustedFlatlandFactoryEvent {}
8347
8348impl TrustedFlatlandFactoryEvent {
8349    /// Decodes a message buffer as a [`TrustedFlatlandFactoryEvent`].
8350    fn decode(
8351        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
8352    ) -> Result<TrustedFlatlandFactoryEvent, fidl::Error> {
8353        let (bytes, _handles) = buf.split_mut();
8354        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
8355        debug_assert_eq!(tx_header.tx_id, 0);
8356        match tx_header.ordinal {
8357            _ => Err(fidl::Error::UnknownOrdinal {
8358                ordinal: tx_header.ordinal,
8359                protocol_name:
8360                    <TrustedFlatlandFactoryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
8361            }),
8362        }
8363    }
8364}
8365
8366/// A Stream of incoming requests for fuchsia.ui.composition/TrustedFlatlandFactory.
8367pub struct TrustedFlatlandFactoryRequestStream {
8368    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8369    is_terminated: bool,
8370}
8371
8372impl std::marker::Unpin for TrustedFlatlandFactoryRequestStream {}
8373
8374impl futures::stream::FusedStream for TrustedFlatlandFactoryRequestStream {
8375    fn is_terminated(&self) -> bool {
8376        self.is_terminated
8377    }
8378}
8379
8380impl fidl::endpoints::RequestStream for TrustedFlatlandFactoryRequestStream {
8381    type Protocol = TrustedFlatlandFactoryMarker;
8382    type ControlHandle = TrustedFlatlandFactoryControlHandle;
8383
8384    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
8385        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
8386    }
8387
8388    fn control_handle(&self) -> Self::ControlHandle {
8389        TrustedFlatlandFactoryControlHandle { inner: self.inner.clone() }
8390    }
8391
8392    fn into_inner(
8393        self,
8394    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
8395    {
8396        (self.inner, self.is_terminated)
8397    }
8398
8399    fn from_inner(
8400        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8401        is_terminated: bool,
8402    ) -> Self {
8403        Self { inner, is_terminated }
8404    }
8405}
8406
8407impl futures::Stream for TrustedFlatlandFactoryRequestStream {
8408    type Item = Result<TrustedFlatlandFactoryRequest, fidl::Error>;
8409
8410    fn poll_next(
8411        mut self: std::pin::Pin<&mut Self>,
8412        cx: &mut std::task::Context<'_>,
8413    ) -> std::task::Poll<Option<Self::Item>> {
8414        let this = &mut *self;
8415        if this.inner.check_shutdown(cx) {
8416            this.is_terminated = true;
8417            return std::task::Poll::Ready(None);
8418        }
8419        if this.is_terminated {
8420            panic!("polled TrustedFlatlandFactoryRequestStream after completion");
8421        }
8422        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
8423            |bytes, handles| {
8424                match this.inner.channel().read_etc(cx, bytes, handles) {
8425                    std::task::Poll::Ready(Ok(())) => {}
8426                    std::task::Poll::Pending => return std::task::Poll::Pending,
8427                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
8428                        this.is_terminated = true;
8429                        return std::task::Poll::Ready(None);
8430                    }
8431                    std::task::Poll::Ready(Err(e)) => {
8432                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
8433                            e.into(),
8434                        ))));
8435                    }
8436                }
8437
8438                // A message has been received from the channel
8439                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
8440
8441                std::task::Poll::Ready(Some(match header.ordinal {
8442                0x48e89c53f00561dc => {
8443                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
8444                    let mut req = fidl::new_empty!(TrustedFlatlandFactoryCreateFlatlandRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
8445                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<TrustedFlatlandFactoryCreateFlatlandRequest>(&header, _body_bytes, handles, &mut req)?;
8446                    let control_handle = TrustedFlatlandFactoryControlHandle {
8447                        inner: this.inner.clone(),
8448                    };
8449                    Ok(TrustedFlatlandFactoryRequest::CreateFlatland {server_end: req.server_end,
8450config: req.config,
8451
8452                        responder: TrustedFlatlandFactoryCreateFlatlandResponder {
8453                            control_handle: std::mem::ManuallyDrop::new(control_handle),
8454                            tx_id: header.tx_id,
8455                        },
8456                    })
8457                }
8458                _ => Err(fidl::Error::UnknownOrdinal {
8459                    ordinal: header.ordinal,
8460                    protocol_name: <TrustedFlatlandFactoryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
8461                }),
8462            }))
8463            },
8464        )
8465    }
8466}
8467
8468/// A privileged factory for creating Flatland instances with special configurations.
8469///
8470/// This protocol is intended for trusted clients that require fine-grained control over
8471/// Flatland's behavior for performance-critical applications. It is not intended for
8472/// general use. Misuse of this API can negatively impact system performance and stability.
8473#[derive(Debug)]
8474pub enum TrustedFlatlandFactoryRequest {
8475    /// Creates a new Flatland instance with the specified configuration.
8476    ///
8477    /// ## Error
8478    ///
8479    /// Returns a `TrustedFlatlandFactoryError` error if the operation fails.
8480    CreateFlatland {
8481        server_end: fidl::endpoints::ServerEnd<FlatlandMarker>,
8482        config: TrustedFlatlandConfig,
8483        responder: TrustedFlatlandFactoryCreateFlatlandResponder,
8484    },
8485}
8486
8487impl TrustedFlatlandFactoryRequest {
8488    #[allow(irrefutable_let_patterns)]
8489    pub fn into_create_flatland(
8490        self,
8491    ) -> Option<(
8492        fidl::endpoints::ServerEnd<FlatlandMarker>,
8493        TrustedFlatlandConfig,
8494        TrustedFlatlandFactoryCreateFlatlandResponder,
8495    )> {
8496        if let TrustedFlatlandFactoryRequest::CreateFlatland { server_end, config, responder } =
8497            self
8498        {
8499            Some((server_end, config, responder))
8500        } else {
8501            None
8502        }
8503    }
8504
8505    /// Name of the method defined in FIDL
8506    pub fn method_name(&self) -> &'static str {
8507        match *self {
8508            TrustedFlatlandFactoryRequest::CreateFlatland { .. } => "create_flatland",
8509        }
8510    }
8511}
8512
8513#[derive(Debug, Clone)]
8514pub struct TrustedFlatlandFactoryControlHandle {
8515    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8516}
8517
8518impl fidl::endpoints::ControlHandle for TrustedFlatlandFactoryControlHandle {
8519    fn shutdown(&self) {
8520        self.inner.shutdown()
8521    }
8522    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
8523        self.inner.shutdown_with_epitaph(status)
8524    }
8525
8526    fn is_closed(&self) -> bool {
8527        self.inner.channel().is_closed()
8528    }
8529    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
8530        self.inner.channel().on_closed()
8531    }
8532
8533    #[cfg(target_os = "fuchsia")]
8534    fn signal_peer(
8535        &self,
8536        clear_mask: zx::Signals,
8537        set_mask: zx::Signals,
8538    ) -> Result<(), zx_status::Status> {
8539        use fidl::Peered;
8540        self.inner.channel().signal_peer(clear_mask, set_mask)
8541    }
8542}
8543
8544impl TrustedFlatlandFactoryControlHandle {}
8545
8546#[must_use = "FIDL methods require a response to be sent"]
8547#[derive(Debug)]
8548pub struct TrustedFlatlandFactoryCreateFlatlandResponder {
8549    control_handle: std::mem::ManuallyDrop<TrustedFlatlandFactoryControlHandle>,
8550    tx_id: u32,
8551}
8552
8553/// Set the the channel to be shutdown (see [`TrustedFlatlandFactoryControlHandle::shutdown`])
8554/// if the responder is dropped without sending a response, so that the client
8555/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
8556impl std::ops::Drop for TrustedFlatlandFactoryCreateFlatlandResponder {
8557    fn drop(&mut self) {
8558        self.control_handle.shutdown();
8559        // Safety: drops once, never accessed again
8560        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8561    }
8562}
8563
8564impl fidl::endpoints::Responder for TrustedFlatlandFactoryCreateFlatlandResponder {
8565    type ControlHandle = TrustedFlatlandFactoryControlHandle;
8566
8567    fn control_handle(&self) -> &TrustedFlatlandFactoryControlHandle {
8568        &self.control_handle
8569    }
8570
8571    fn drop_without_shutdown(mut self) {
8572        // Safety: drops once, never accessed again due to mem::forget
8573        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8574        // Prevent Drop from running (which would shut down the channel)
8575        std::mem::forget(self);
8576    }
8577}
8578
8579impl TrustedFlatlandFactoryCreateFlatlandResponder {
8580    /// Sends a response to the FIDL transaction.
8581    ///
8582    /// Sets the channel to shutdown if an error occurs.
8583    pub fn send(
8584        self,
8585        mut result: Result<(), TrustedFlatlandFactoryError>,
8586    ) -> Result<(), fidl::Error> {
8587        let _result = self.send_raw(result);
8588        if _result.is_err() {
8589            self.control_handle.shutdown();
8590        }
8591        self.drop_without_shutdown();
8592        _result
8593    }
8594
8595    /// Similar to "send" but does not shutdown the channel if an error occurs.
8596    pub fn send_no_shutdown_on_err(
8597        self,
8598        mut result: Result<(), TrustedFlatlandFactoryError>,
8599    ) -> Result<(), fidl::Error> {
8600        let _result = self.send_raw(result);
8601        self.drop_without_shutdown();
8602        _result
8603    }
8604
8605    fn send_raw(
8606        &self,
8607        mut result: Result<(), TrustedFlatlandFactoryError>,
8608    ) -> Result<(), fidl::Error> {
8609        self.control_handle.inner.send::<fidl::encoding::ResultType<
8610            fidl::encoding::EmptyStruct,
8611            TrustedFlatlandFactoryError,
8612        >>(
8613            result,
8614            self.tx_id,
8615            0x48e89c53f00561dc,
8616            fidl::encoding::DynamicFlags::empty(),
8617        )
8618    }
8619}
8620
8621mod internal {
8622    use super::*;
8623
8624    impl fidl::encoding::ResourceTypeMarker for AllocatorRegisterBufferCollectionRequest {
8625        type Borrowed<'a> = &'a mut Self;
8626        fn take_or_borrow<'a>(
8627            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
8628        ) -> Self::Borrowed<'a> {
8629            value
8630        }
8631    }
8632
8633    unsafe impl fidl::encoding::TypeMarker for AllocatorRegisterBufferCollectionRequest {
8634        type Owned = Self;
8635
8636        #[inline(always)]
8637        fn inline_align(_context: fidl::encoding::Context) -> usize {
8638            8
8639        }
8640
8641        #[inline(always)]
8642        fn inline_size(_context: fidl::encoding::Context) -> usize {
8643            16
8644        }
8645    }
8646
8647    unsafe impl
8648        fidl::encoding::Encode<
8649            AllocatorRegisterBufferCollectionRequest,
8650            fidl::encoding::DefaultFuchsiaResourceDialect,
8651        > for &mut AllocatorRegisterBufferCollectionRequest
8652    {
8653        #[inline]
8654        unsafe fn encode(
8655            self,
8656            encoder: &mut fidl::encoding::Encoder<
8657                '_,
8658                fidl::encoding::DefaultFuchsiaResourceDialect,
8659            >,
8660            offset: usize,
8661            _depth: fidl::encoding::Depth,
8662        ) -> fidl::Result<()> {
8663            encoder.debug_check_bounds::<AllocatorRegisterBufferCollectionRequest>(offset);
8664            // Delegate to tuple encoding.
8665            fidl::encoding::Encode::<AllocatorRegisterBufferCollectionRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
8666                (
8667                    <RegisterBufferCollectionArgs as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.args),
8668                ),
8669                encoder, offset, _depth
8670            )
8671        }
8672    }
8673    unsafe impl<
8674        T0: fidl::encoding::Encode<
8675                RegisterBufferCollectionArgs,
8676                fidl::encoding::DefaultFuchsiaResourceDialect,
8677            >,
8678    >
8679        fidl::encoding::Encode<
8680            AllocatorRegisterBufferCollectionRequest,
8681            fidl::encoding::DefaultFuchsiaResourceDialect,
8682        > for (T0,)
8683    {
8684        #[inline]
8685        unsafe fn encode(
8686            self,
8687            encoder: &mut fidl::encoding::Encoder<
8688                '_,
8689                fidl::encoding::DefaultFuchsiaResourceDialect,
8690            >,
8691            offset: usize,
8692            depth: fidl::encoding::Depth,
8693        ) -> fidl::Result<()> {
8694            encoder.debug_check_bounds::<AllocatorRegisterBufferCollectionRequest>(offset);
8695            // Zero out padding regions. There's no need to apply masks
8696            // because the unmasked parts will be overwritten by fields.
8697            // Write the fields.
8698            self.0.encode(encoder, offset + 0, depth)?;
8699            Ok(())
8700        }
8701    }
8702
8703    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
8704        for AllocatorRegisterBufferCollectionRequest
8705    {
8706        #[inline(always)]
8707        fn new_empty() -> Self {
8708            Self {
8709                args: fidl::new_empty!(
8710                    RegisterBufferCollectionArgs,
8711                    fidl::encoding::DefaultFuchsiaResourceDialect
8712                ),
8713            }
8714        }
8715
8716        #[inline]
8717        unsafe fn decode(
8718            &mut self,
8719            decoder: &mut fidl::encoding::Decoder<
8720                '_,
8721                fidl::encoding::DefaultFuchsiaResourceDialect,
8722            >,
8723            offset: usize,
8724            _depth: fidl::encoding::Depth,
8725        ) -> fidl::Result<()> {
8726            decoder.debug_check_bounds::<Self>(offset);
8727            // Verify that padding bytes are zero.
8728            fidl::decode!(
8729                RegisterBufferCollectionArgs,
8730                fidl::encoding::DefaultFuchsiaResourceDialect,
8731                &mut self.args,
8732                decoder,
8733                offset + 0,
8734                _depth
8735            )?;
8736            Ok(())
8737        }
8738    }
8739
8740    impl fidl::encoding::ResourceTypeMarker for BufferCollectionExportToken {
8741        type Borrowed<'a> = &'a mut Self;
8742        fn take_or_borrow<'a>(
8743            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
8744        ) -> Self::Borrowed<'a> {
8745            value
8746        }
8747    }
8748
8749    unsafe impl fidl::encoding::TypeMarker for BufferCollectionExportToken {
8750        type Owned = Self;
8751
8752        #[inline(always)]
8753        fn inline_align(_context: fidl::encoding::Context) -> usize {
8754            4
8755        }
8756
8757        #[inline(always)]
8758        fn inline_size(_context: fidl::encoding::Context) -> usize {
8759            4
8760        }
8761    }
8762
8763    unsafe impl
8764        fidl::encoding::Encode<
8765            BufferCollectionExportToken,
8766            fidl::encoding::DefaultFuchsiaResourceDialect,
8767        > for &mut BufferCollectionExportToken
8768    {
8769        #[inline]
8770        unsafe fn encode(
8771            self,
8772            encoder: &mut fidl::encoding::Encoder<
8773                '_,
8774                fidl::encoding::DefaultFuchsiaResourceDialect,
8775            >,
8776            offset: usize,
8777            _depth: fidl::encoding::Depth,
8778        ) -> fidl::Result<()> {
8779            encoder.debug_check_bounds::<BufferCollectionExportToken>(offset);
8780            // Delegate to tuple encoding.
8781            fidl::encoding::Encode::<
8782                BufferCollectionExportToken,
8783                fidl::encoding::DefaultFuchsiaResourceDialect,
8784            >::encode(
8785                (<fidl::encoding::HandleType<
8786                    fidl::EventPair,
8787                    { fidl::ObjectType::EVENTPAIR.into_raw() },
8788                    2147483648,
8789                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
8790                    &mut self.value
8791                ),),
8792                encoder,
8793                offset,
8794                _depth,
8795            )
8796        }
8797    }
8798    unsafe impl<
8799        T0: fidl::encoding::Encode<
8800                fidl::encoding::HandleType<
8801                    fidl::EventPair,
8802                    { fidl::ObjectType::EVENTPAIR.into_raw() },
8803                    2147483648,
8804                >,
8805                fidl::encoding::DefaultFuchsiaResourceDialect,
8806            >,
8807    >
8808        fidl::encoding::Encode<
8809            BufferCollectionExportToken,
8810            fidl::encoding::DefaultFuchsiaResourceDialect,
8811        > for (T0,)
8812    {
8813        #[inline]
8814        unsafe fn encode(
8815            self,
8816            encoder: &mut fidl::encoding::Encoder<
8817                '_,
8818                fidl::encoding::DefaultFuchsiaResourceDialect,
8819            >,
8820            offset: usize,
8821            depth: fidl::encoding::Depth,
8822        ) -> fidl::Result<()> {
8823            encoder.debug_check_bounds::<BufferCollectionExportToken>(offset);
8824            // Zero out padding regions. There's no need to apply masks
8825            // because the unmasked parts will be overwritten by fields.
8826            // Write the fields.
8827            self.0.encode(encoder, offset + 0, depth)?;
8828            Ok(())
8829        }
8830    }
8831
8832    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
8833        for BufferCollectionExportToken
8834    {
8835        #[inline(always)]
8836        fn new_empty() -> Self {
8837            Self {
8838                value: fidl::new_empty!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
8839            }
8840        }
8841
8842        #[inline]
8843        unsafe fn decode(
8844            &mut self,
8845            decoder: &mut fidl::encoding::Decoder<
8846                '_,
8847                fidl::encoding::DefaultFuchsiaResourceDialect,
8848            >,
8849            offset: usize,
8850            _depth: fidl::encoding::Depth,
8851        ) -> fidl::Result<()> {
8852            decoder.debug_check_bounds::<Self>(offset);
8853            // Verify that padding bytes are zero.
8854            fidl::decode!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.value, decoder, offset + 0, _depth)?;
8855            Ok(())
8856        }
8857    }
8858
8859    impl fidl::encoding::ResourceTypeMarker for BufferCollectionImportToken {
8860        type Borrowed<'a> = &'a mut Self;
8861        fn take_or_borrow<'a>(
8862            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
8863        ) -> Self::Borrowed<'a> {
8864            value
8865        }
8866    }
8867
8868    unsafe impl fidl::encoding::TypeMarker for BufferCollectionImportToken {
8869        type Owned = Self;
8870
8871        #[inline(always)]
8872        fn inline_align(_context: fidl::encoding::Context) -> usize {
8873            4
8874        }
8875
8876        #[inline(always)]
8877        fn inline_size(_context: fidl::encoding::Context) -> usize {
8878            4
8879        }
8880    }
8881
8882    unsafe impl
8883        fidl::encoding::Encode<
8884            BufferCollectionImportToken,
8885            fidl::encoding::DefaultFuchsiaResourceDialect,
8886        > for &mut BufferCollectionImportToken
8887    {
8888        #[inline]
8889        unsafe fn encode(
8890            self,
8891            encoder: &mut fidl::encoding::Encoder<
8892                '_,
8893                fidl::encoding::DefaultFuchsiaResourceDialect,
8894            >,
8895            offset: usize,
8896            _depth: fidl::encoding::Depth,
8897        ) -> fidl::Result<()> {
8898            encoder.debug_check_bounds::<BufferCollectionImportToken>(offset);
8899            // Delegate to tuple encoding.
8900            fidl::encoding::Encode::<
8901                BufferCollectionImportToken,
8902                fidl::encoding::DefaultFuchsiaResourceDialect,
8903            >::encode(
8904                (<fidl::encoding::HandleType<
8905                    fidl::EventPair,
8906                    { fidl::ObjectType::EVENTPAIR.into_raw() },
8907                    2147483648,
8908                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
8909                    &mut self.value
8910                ),),
8911                encoder,
8912                offset,
8913                _depth,
8914            )
8915        }
8916    }
8917    unsafe impl<
8918        T0: fidl::encoding::Encode<
8919                fidl::encoding::HandleType<
8920                    fidl::EventPair,
8921                    { fidl::ObjectType::EVENTPAIR.into_raw() },
8922                    2147483648,
8923                >,
8924                fidl::encoding::DefaultFuchsiaResourceDialect,
8925            >,
8926    >
8927        fidl::encoding::Encode<
8928            BufferCollectionImportToken,
8929            fidl::encoding::DefaultFuchsiaResourceDialect,
8930        > for (T0,)
8931    {
8932        #[inline]
8933        unsafe fn encode(
8934            self,
8935            encoder: &mut fidl::encoding::Encoder<
8936                '_,
8937                fidl::encoding::DefaultFuchsiaResourceDialect,
8938            >,
8939            offset: usize,
8940            depth: fidl::encoding::Depth,
8941        ) -> fidl::Result<()> {
8942            encoder.debug_check_bounds::<BufferCollectionImportToken>(offset);
8943            // Zero out padding regions. There's no need to apply masks
8944            // because the unmasked parts will be overwritten by fields.
8945            // Write the fields.
8946            self.0.encode(encoder, offset + 0, depth)?;
8947            Ok(())
8948        }
8949    }
8950
8951    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
8952        for BufferCollectionImportToken
8953    {
8954        #[inline(always)]
8955        fn new_empty() -> Self {
8956            Self {
8957                value: fidl::new_empty!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
8958            }
8959        }
8960
8961        #[inline]
8962        unsafe fn decode(
8963            &mut self,
8964            decoder: &mut fidl::encoding::Decoder<
8965                '_,
8966                fidl::encoding::DefaultFuchsiaResourceDialect,
8967            >,
8968            offset: usize,
8969            _depth: fidl::encoding::Depth,
8970        ) -> fidl::Result<()> {
8971            decoder.debug_check_bounds::<Self>(offset);
8972            // Verify that padding bytes are zero.
8973            fidl::decode!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.value, decoder, offset + 0, _depth)?;
8974            Ok(())
8975        }
8976    }
8977
8978    impl fidl::encoding::ResourceTypeMarker for ChildViewWatcherGetViewRefResponse {
8979        type Borrowed<'a> = &'a mut Self;
8980        fn take_or_borrow<'a>(
8981            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
8982        ) -> Self::Borrowed<'a> {
8983            value
8984        }
8985    }
8986
8987    unsafe impl fidl::encoding::TypeMarker for ChildViewWatcherGetViewRefResponse {
8988        type Owned = Self;
8989
8990        #[inline(always)]
8991        fn inline_align(_context: fidl::encoding::Context) -> usize {
8992            4
8993        }
8994
8995        #[inline(always)]
8996        fn inline_size(_context: fidl::encoding::Context) -> usize {
8997            4
8998        }
8999    }
9000
9001    unsafe impl
9002        fidl::encoding::Encode<
9003            ChildViewWatcherGetViewRefResponse,
9004            fidl::encoding::DefaultFuchsiaResourceDialect,
9005        > for &mut ChildViewWatcherGetViewRefResponse
9006    {
9007        #[inline]
9008        unsafe fn encode(
9009            self,
9010            encoder: &mut fidl::encoding::Encoder<
9011                '_,
9012                fidl::encoding::DefaultFuchsiaResourceDialect,
9013            >,
9014            offset: usize,
9015            _depth: fidl::encoding::Depth,
9016        ) -> fidl::Result<()> {
9017            encoder.debug_check_bounds::<ChildViewWatcherGetViewRefResponse>(offset);
9018            // Delegate to tuple encoding.
9019            fidl::encoding::Encode::<ChildViewWatcherGetViewRefResponse, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
9020                (
9021                    <fidl_fuchsia_ui_views::ViewRef as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.view_ref),
9022                ),
9023                encoder, offset, _depth
9024            )
9025        }
9026    }
9027    unsafe impl<
9028        T0: fidl::encoding::Encode<
9029                fidl_fuchsia_ui_views::ViewRef,
9030                fidl::encoding::DefaultFuchsiaResourceDialect,
9031            >,
9032    >
9033        fidl::encoding::Encode<
9034            ChildViewWatcherGetViewRefResponse,
9035            fidl::encoding::DefaultFuchsiaResourceDialect,
9036        > for (T0,)
9037    {
9038        #[inline]
9039        unsafe fn encode(
9040            self,
9041            encoder: &mut fidl::encoding::Encoder<
9042                '_,
9043                fidl::encoding::DefaultFuchsiaResourceDialect,
9044            >,
9045            offset: usize,
9046            depth: fidl::encoding::Depth,
9047        ) -> fidl::Result<()> {
9048            encoder.debug_check_bounds::<ChildViewWatcherGetViewRefResponse>(offset);
9049            // Zero out padding regions. There's no need to apply masks
9050            // because the unmasked parts will be overwritten by fields.
9051            // Write the fields.
9052            self.0.encode(encoder, offset + 0, depth)?;
9053            Ok(())
9054        }
9055    }
9056
9057    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
9058        for ChildViewWatcherGetViewRefResponse
9059    {
9060        #[inline(always)]
9061        fn new_empty() -> Self {
9062            Self {
9063                view_ref: fidl::new_empty!(
9064                    fidl_fuchsia_ui_views::ViewRef,
9065                    fidl::encoding::DefaultFuchsiaResourceDialect
9066                ),
9067            }
9068        }
9069
9070        #[inline]
9071        unsafe fn decode(
9072            &mut self,
9073            decoder: &mut fidl::encoding::Decoder<
9074                '_,
9075                fidl::encoding::DefaultFuchsiaResourceDialect,
9076            >,
9077            offset: usize,
9078            _depth: fidl::encoding::Depth,
9079        ) -> fidl::Result<()> {
9080            decoder.debug_check_bounds::<Self>(offset);
9081            // Verify that padding bytes are zero.
9082            fidl::decode!(
9083                fidl_fuchsia_ui_views::ViewRef,
9084                fidl::encoding::DefaultFuchsiaResourceDialect,
9085                &mut self.view_ref,
9086                decoder,
9087                offset + 0,
9088                _depth
9089            )?;
9090            Ok(())
9091        }
9092    }
9093
9094    impl fidl::encoding::ResourceTypeMarker for FlatlandCreateFilledRectRequest {
9095        type Borrowed<'a> = &'a mut Self;
9096        fn take_or_borrow<'a>(
9097            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9098        ) -> Self::Borrowed<'a> {
9099            value
9100        }
9101    }
9102
9103    unsafe impl fidl::encoding::TypeMarker for FlatlandCreateFilledRectRequest {
9104        type Owned = Self;
9105
9106        #[inline(always)]
9107        fn inline_align(_context: fidl::encoding::Context) -> usize {
9108            8
9109        }
9110
9111        #[inline(always)]
9112        fn inline_size(_context: fidl::encoding::Context) -> usize {
9113            8
9114        }
9115        #[inline(always)]
9116        fn encode_is_copy() -> bool {
9117            true
9118        }
9119
9120        #[inline(always)]
9121        fn decode_is_copy() -> bool {
9122            true
9123        }
9124    }
9125
9126    unsafe impl
9127        fidl::encoding::Encode<
9128            FlatlandCreateFilledRectRequest,
9129            fidl::encoding::DefaultFuchsiaResourceDialect,
9130        > for &mut FlatlandCreateFilledRectRequest
9131    {
9132        #[inline]
9133        unsafe fn encode(
9134            self,
9135            encoder: &mut fidl::encoding::Encoder<
9136                '_,
9137                fidl::encoding::DefaultFuchsiaResourceDialect,
9138            >,
9139            offset: usize,
9140            _depth: fidl::encoding::Depth,
9141        ) -> fidl::Result<()> {
9142            encoder.debug_check_bounds::<FlatlandCreateFilledRectRequest>(offset);
9143            unsafe {
9144                // Copy the object into the buffer.
9145                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
9146                (buf_ptr as *mut FlatlandCreateFilledRectRequest)
9147                    .write_unaligned((self as *const FlatlandCreateFilledRectRequest).read());
9148                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
9149                // done second because the memcpy will write garbage to these bytes.
9150            }
9151            Ok(())
9152        }
9153    }
9154    unsafe impl<
9155        T0: fidl::encoding::Encode<ContentId, fidl::encoding::DefaultFuchsiaResourceDialect>,
9156    >
9157        fidl::encoding::Encode<
9158            FlatlandCreateFilledRectRequest,
9159            fidl::encoding::DefaultFuchsiaResourceDialect,
9160        > for (T0,)
9161    {
9162        #[inline]
9163        unsafe fn encode(
9164            self,
9165            encoder: &mut fidl::encoding::Encoder<
9166                '_,
9167                fidl::encoding::DefaultFuchsiaResourceDialect,
9168            >,
9169            offset: usize,
9170            depth: fidl::encoding::Depth,
9171        ) -> fidl::Result<()> {
9172            encoder.debug_check_bounds::<FlatlandCreateFilledRectRequest>(offset);
9173            // Zero out padding regions. There's no need to apply masks
9174            // because the unmasked parts will be overwritten by fields.
9175            // Write the fields.
9176            self.0.encode(encoder, offset + 0, depth)?;
9177            Ok(())
9178        }
9179    }
9180
9181    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
9182        for FlatlandCreateFilledRectRequest
9183    {
9184        #[inline(always)]
9185        fn new_empty() -> Self {
9186            Self {
9187                rect_id: fidl::new_empty!(ContentId, fidl::encoding::DefaultFuchsiaResourceDialect),
9188            }
9189        }
9190
9191        #[inline]
9192        unsafe fn decode(
9193            &mut self,
9194            decoder: &mut fidl::encoding::Decoder<
9195                '_,
9196                fidl::encoding::DefaultFuchsiaResourceDialect,
9197            >,
9198            offset: usize,
9199            _depth: fidl::encoding::Depth,
9200        ) -> fidl::Result<()> {
9201            decoder.debug_check_bounds::<Self>(offset);
9202            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
9203            // Verify that padding bytes are zero.
9204            // Copy from the buffer into the object.
9205            unsafe {
9206                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
9207            }
9208            Ok(())
9209        }
9210    }
9211
9212    impl fidl::encoding::ResourceTypeMarker for FlatlandCreateImageRequest {
9213        type Borrowed<'a> = &'a mut Self;
9214        fn take_or_borrow<'a>(
9215            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9216        ) -> Self::Borrowed<'a> {
9217            value
9218        }
9219    }
9220
9221    unsafe impl fidl::encoding::TypeMarker for FlatlandCreateImageRequest {
9222        type Owned = Self;
9223
9224        #[inline(always)]
9225        fn inline_align(_context: fidl::encoding::Context) -> usize {
9226            8
9227        }
9228
9229        #[inline(always)]
9230        fn inline_size(_context: fidl::encoding::Context) -> usize {
9231            32
9232        }
9233    }
9234
9235    unsafe impl
9236        fidl::encoding::Encode<
9237            FlatlandCreateImageRequest,
9238            fidl::encoding::DefaultFuchsiaResourceDialect,
9239        > for &mut FlatlandCreateImageRequest
9240    {
9241        #[inline]
9242        unsafe fn encode(
9243            self,
9244            encoder: &mut fidl::encoding::Encoder<
9245                '_,
9246                fidl::encoding::DefaultFuchsiaResourceDialect,
9247            >,
9248            offset: usize,
9249            _depth: fidl::encoding::Depth,
9250        ) -> fidl::Result<()> {
9251            encoder.debug_check_bounds::<FlatlandCreateImageRequest>(offset);
9252            // Delegate to tuple encoding.
9253            fidl::encoding::Encode::<FlatlandCreateImageRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
9254                (
9255                    <ContentId as fidl::encoding::ValueTypeMarker>::borrow(&self.image_id),
9256                    <BufferCollectionImportToken as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.import_token),
9257                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.vmo_index),
9258                    <ImageProperties as fidl::encoding::ValueTypeMarker>::borrow(&self.properties),
9259                ),
9260                encoder, offset, _depth
9261            )
9262        }
9263    }
9264    unsafe impl<
9265        T0: fidl::encoding::Encode<ContentId, fidl::encoding::DefaultFuchsiaResourceDialect>,
9266        T1: fidl::encoding::Encode<
9267                BufferCollectionImportToken,
9268                fidl::encoding::DefaultFuchsiaResourceDialect,
9269            >,
9270        T2: fidl::encoding::Encode<u32, fidl::encoding::DefaultFuchsiaResourceDialect>,
9271        T3: fidl::encoding::Encode<ImageProperties, fidl::encoding::DefaultFuchsiaResourceDialect>,
9272    >
9273        fidl::encoding::Encode<
9274            FlatlandCreateImageRequest,
9275            fidl::encoding::DefaultFuchsiaResourceDialect,
9276        > for (T0, T1, T2, T3)
9277    {
9278        #[inline]
9279        unsafe fn encode(
9280            self,
9281            encoder: &mut fidl::encoding::Encoder<
9282                '_,
9283                fidl::encoding::DefaultFuchsiaResourceDialect,
9284            >,
9285            offset: usize,
9286            depth: fidl::encoding::Depth,
9287        ) -> fidl::Result<()> {
9288            encoder.debug_check_bounds::<FlatlandCreateImageRequest>(offset);
9289            // Zero out padding regions. There's no need to apply masks
9290            // because the unmasked parts will be overwritten by fields.
9291            // Write the fields.
9292            self.0.encode(encoder, offset + 0, depth)?;
9293            self.1.encode(encoder, offset + 8, depth)?;
9294            self.2.encode(encoder, offset + 12, depth)?;
9295            self.3.encode(encoder, offset + 16, depth)?;
9296            Ok(())
9297        }
9298    }
9299
9300    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
9301        for FlatlandCreateImageRequest
9302    {
9303        #[inline(always)]
9304        fn new_empty() -> Self {
9305            Self {
9306                image_id: fidl::new_empty!(
9307                    ContentId,
9308                    fidl::encoding::DefaultFuchsiaResourceDialect
9309                ),
9310                import_token: fidl::new_empty!(
9311                    BufferCollectionImportToken,
9312                    fidl::encoding::DefaultFuchsiaResourceDialect
9313                ),
9314                vmo_index: fidl::new_empty!(u32, fidl::encoding::DefaultFuchsiaResourceDialect),
9315                properties: fidl::new_empty!(
9316                    ImageProperties,
9317                    fidl::encoding::DefaultFuchsiaResourceDialect
9318                ),
9319            }
9320        }
9321
9322        #[inline]
9323        unsafe fn decode(
9324            &mut self,
9325            decoder: &mut fidl::encoding::Decoder<
9326                '_,
9327                fidl::encoding::DefaultFuchsiaResourceDialect,
9328            >,
9329            offset: usize,
9330            _depth: fidl::encoding::Depth,
9331        ) -> fidl::Result<()> {
9332            decoder.debug_check_bounds::<Self>(offset);
9333            // Verify that padding bytes are zero.
9334            fidl::decode!(
9335                ContentId,
9336                fidl::encoding::DefaultFuchsiaResourceDialect,
9337                &mut self.image_id,
9338                decoder,
9339                offset + 0,
9340                _depth
9341            )?;
9342            fidl::decode!(
9343                BufferCollectionImportToken,
9344                fidl::encoding::DefaultFuchsiaResourceDialect,
9345                &mut self.import_token,
9346                decoder,
9347                offset + 8,
9348                _depth
9349            )?;
9350            fidl::decode!(
9351                u32,
9352                fidl::encoding::DefaultFuchsiaResourceDialect,
9353                &mut self.vmo_index,
9354                decoder,
9355                offset + 12,
9356                _depth
9357            )?;
9358            fidl::decode!(
9359                ImageProperties,
9360                fidl::encoding::DefaultFuchsiaResourceDialect,
9361                &mut self.properties,
9362                decoder,
9363                offset + 16,
9364                _depth
9365            )?;
9366            Ok(())
9367        }
9368    }
9369
9370    impl fidl::encoding::ResourceTypeMarker for FlatlandCreateView2Request {
9371        type Borrowed<'a> = &'a mut Self;
9372        fn take_or_borrow<'a>(
9373            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9374        ) -> Self::Borrowed<'a> {
9375            value
9376        }
9377    }
9378
9379    unsafe impl fidl::encoding::TypeMarker for FlatlandCreateView2Request {
9380        type Owned = Self;
9381
9382        #[inline(always)]
9383        fn inline_align(_context: fidl::encoding::Context) -> usize {
9384            8
9385        }
9386
9387        #[inline(always)]
9388        fn inline_size(_context: fidl::encoding::Context) -> usize {
9389            40
9390        }
9391    }
9392
9393    unsafe impl
9394        fidl::encoding::Encode<
9395            FlatlandCreateView2Request,
9396            fidl::encoding::DefaultFuchsiaResourceDialect,
9397        > for &mut FlatlandCreateView2Request
9398    {
9399        #[inline]
9400        unsafe fn encode(
9401            self,
9402            encoder: &mut fidl::encoding::Encoder<
9403                '_,
9404                fidl::encoding::DefaultFuchsiaResourceDialect,
9405            >,
9406            offset: usize,
9407            _depth: fidl::encoding::Depth,
9408        ) -> fidl::Result<()> {
9409            encoder.debug_check_bounds::<FlatlandCreateView2Request>(offset);
9410            // Delegate to tuple encoding.
9411            fidl::encoding::Encode::<FlatlandCreateView2Request, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
9412                (
9413                    <fidl_fuchsia_ui_views::ViewCreationToken as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.token),
9414                    <fidl_fuchsia_ui_views::ViewIdentityOnCreation as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.view_identity),
9415                    <ViewBoundProtocols as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.protocols),
9416                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.parent_viewport_watcher),
9417                ),
9418                encoder, offset, _depth
9419            )
9420        }
9421    }
9422    unsafe impl<
9423        T0: fidl::encoding::Encode<
9424                fidl_fuchsia_ui_views::ViewCreationToken,
9425                fidl::encoding::DefaultFuchsiaResourceDialect,
9426            >,
9427        T1: fidl::encoding::Encode<
9428                fidl_fuchsia_ui_views::ViewIdentityOnCreation,
9429                fidl::encoding::DefaultFuchsiaResourceDialect,
9430            >,
9431        T2: fidl::encoding::Encode<ViewBoundProtocols, fidl::encoding::DefaultFuchsiaResourceDialect>,
9432        T3: fidl::encoding::Encode<
9433                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>>,
9434                fidl::encoding::DefaultFuchsiaResourceDialect,
9435            >,
9436    >
9437        fidl::encoding::Encode<
9438            FlatlandCreateView2Request,
9439            fidl::encoding::DefaultFuchsiaResourceDialect,
9440        > for (T0, T1, T2, T3)
9441    {
9442        #[inline]
9443        unsafe fn encode(
9444            self,
9445            encoder: &mut fidl::encoding::Encoder<
9446                '_,
9447                fidl::encoding::DefaultFuchsiaResourceDialect,
9448            >,
9449            offset: usize,
9450            depth: fidl::encoding::Depth,
9451        ) -> fidl::Result<()> {
9452            encoder.debug_check_bounds::<FlatlandCreateView2Request>(offset);
9453            // Zero out padding regions. There's no need to apply masks
9454            // because the unmasked parts will be overwritten by fields.
9455            unsafe {
9456                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
9457                (ptr as *mut u64).write_unaligned(0);
9458            }
9459            unsafe {
9460                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(32);
9461                (ptr as *mut u64).write_unaligned(0);
9462            }
9463            // Write the fields.
9464            self.0.encode(encoder, offset + 0, depth)?;
9465            self.1.encode(encoder, offset + 4, depth)?;
9466            self.2.encode(encoder, offset + 16, depth)?;
9467            self.3.encode(encoder, offset + 32, depth)?;
9468            Ok(())
9469        }
9470    }
9471
9472    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
9473        for FlatlandCreateView2Request
9474    {
9475        #[inline(always)]
9476        fn new_empty() -> Self {
9477            Self {
9478                token: fidl::new_empty!(
9479                    fidl_fuchsia_ui_views::ViewCreationToken,
9480                    fidl::encoding::DefaultFuchsiaResourceDialect
9481                ),
9482                view_identity: fidl::new_empty!(
9483                    fidl_fuchsia_ui_views::ViewIdentityOnCreation,
9484                    fidl::encoding::DefaultFuchsiaResourceDialect
9485                ),
9486                protocols: fidl::new_empty!(
9487                    ViewBoundProtocols,
9488                    fidl::encoding::DefaultFuchsiaResourceDialect
9489                ),
9490                parent_viewport_watcher: fidl::new_empty!(
9491                    fidl::encoding::Endpoint<
9492                        fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>,
9493                    >,
9494                    fidl::encoding::DefaultFuchsiaResourceDialect
9495                ),
9496            }
9497        }
9498
9499        #[inline]
9500        unsafe fn decode(
9501            &mut self,
9502            decoder: &mut fidl::encoding::Decoder<
9503                '_,
9504                fidl::encoding::DefaultFuchsiaResourceDialect,
9505            >,
9506            offset: usize,
9507            _depth: fidl::encoding::Depth,
9508        ) -> fidl::Result<()> {
9509            decoder.debug_check_bounds::<Self>(offset);
9510            // Verify that padding bytes are zero.
9511            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(8) };
9512            let padval = unsafe { (ptr as *const u64).read_unaligned() };
9513            let mask = 0xffffffff00000000u64;
9514            let maskedval = padval & mask;
9515            if maskedval != 0 {
9516                return Err(fidl::Error::NonZeroPadding {
9517                    padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
9518                });
9519            }
9520            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(32) };
9521            let padval = unsafe { (ptr as *const u64).read_unaligned() };
9522            let mask = 0xffffffff00000000u64;
9523            let maskedval = padval & mask;
9524            if maskedval != 0 {
9525                return Err(fidl::Error::NonZeroPadding {
9526                    padding_start: offset + 32 + ((mask as u64).trailing_zeros() / 8) as usize,
9527                });
9528            }
9529            fidl::decode!(
9530                fidl_fuchsia_ui_views::ViewCreationToken,
9531                fidl::encoding::DefaultFuchsiaResourceDialect,
9532                &mut self.token,
9533                decoder,
9534                offset + 0,
9535                _depth
9536            )?;
9537            fidl::decode!(
9538                fidl_fuchsia_ui_views::ViewIdentityOnCreation,
9539                fidl::encoding::DefaultFuchsiaResourceDialect,
9540                &mut self.view_identity,
9541                decoder,
9542                offset + 4,
9543                _depth
9544            )?;
9545            fidl::decode!(
9546                ViewBoundProtocols,
9547                fidl::encoding::DefaultFuchsiaResourceDialect,
9548                &mut self.protocols,
9549                decoder,
9550                offset + 16,
9551                _depth
9552            )?;
9553            fidl::decode!(
9554                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>>,
9555                fidl::encoding::DefaultFuchsiaResourceDialect,
9556                &mut self.parent_viewport_watcher,
9557                decoder,
9558                offset + 32,
9559                _depth
9560            )?;
9561            Ok(())
9562        }
9563    }
9564
9565    impl fidl::encoding::ResourceTypeMarker for FlatlandCreateViewRequest {
9566        type Borrowed<'a> = &'a mut Self;
9567        fn take_or_borrow<'a>(
9568            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9569        ) -> Self::Borrowed<'a> {
9570            value
9571        }
9572    }
9573
9574    unsafe impl fidl::encoding::TypeMarker for FlatlandCreateViewRequest {
9575        type Owned = Self;
9576
9577        #[inline(always)]
9578        fn inline_align(_context: fidl::encoding::Context) -> usize {
9579            4
9580        }
9581
9582        #[inline(always)]
9583        fn inline_size(_context: fidl::encoding::Context) -> usize {
9584            8
9585        }
9586    }
9587
9588    unsafe impl
9589        fidl::encoding::Encode<
9590            FlatlandCreateViewRequest,
9591            fidl::encoding::DefaultFuchsiaResourceDialect,
9592        > for &mut FlatlandCreateViewRequest
9593    {
9594        #[inline]
9595        unsafe fn encode(
9596            self,
9597            encoder: &mut fidl::encoding::Encoder<
9598                '_,
9599                fidl::encoding::DefaultFuchsiaResourceDialect,
9600            >,
9601            offset: usize,
9602            _depth: fidl::encoding::Depth,
9603        ) -> fidl::Result<()> {
9604            encoder.debug_check_bounds::<FlatlandCreateViewRequest>(offset);
9605            // Delegate to tuple encoding.
9606            fidl::encoding::Encode::<FlatlandCreateViewRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
9607                (
9608                    <fidl_fuchsia_ui_views::ViewCreationToken as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.token),
9609                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.parent_viewport_watcher),
9610                ),
9611                encoder, offset, _depth
9612            )
9613        }
9614    }
9615    unsafe impl<
9616        T0: fidl::encoding::Encode<
9617                fidl_fuchsia_ui_views::ViewCreationToken,
9618                fidl::encoding::DefaultFuchsiaResourceDialect,
9619            >,
9620        T1: fidl::encoding::Encode<
9621                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>>,
9622                fidl::encoding::DefaultFuchsiaResourceDialect,
9623            >,
9624    >
9625        fidl::encoding::Encode<
9626            FlatlandCreateViewRequest,
9627            fidl::encoding::DefaultFuchsiaResourceDialect,
9628        > for (T0, T1)
9629    {
9630        #[inline]
9631        unsafe fn encode(
9632            self,
9633            encoder: &mut fidl::encoding::Encoder<
9634                '_,
9635                fidl::encoding::DefaultFuchsiaResourceDialect,
9636            >,
9637            offset: usize,
9638            depth: fidl::encoding::Depth,
9639        ) -> fidl::Result<()> {
9640            encoder.debug_check_bounds::<FlatlandCreateViewRequest>(offset);
9641            // Zero out padding regions. There's no need to apply masks
9642            // because the unmasked parts will be overwritten by fields.
9643            // Write the fields.
9644            self.0.encode(encoder, offset + 0, depth)?;
9645            self.1.encode(encoder, offset + 4, depth)?;
9646            Ok(())
9647        }
9648    }
9649
9650    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
9651        for FlatlandCreateViewRequest
9652    {
9653        #[inline(always)]
9654        fn new_empty() -> Self {
9655            Self {
9656                token: fidl::new_empty!(
9657                    fidl_fuchsia_ui_views::ViewCreationToken,
9658                    fidl::encoding::DefaultFuchsiaResourceDialect
9659                ),
9660                parent_viewport_watcher: fidl::new_empty!(
9661                    fidl::encoding::Endpoint<
9662                        fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>,
9663                    >,
9664                    fidl::encoding::DefaultFuchsiaResourceDialect
9665                ),
9666            }
9667        }
9668
9669        #[inline]
9670        unsafe fn decode(
9671            &mut self,
9672            decoder: &mut fidl::encoding::Decoder<
9673                '_,
9674                fidl::encoding::DefaultFuchsiaResourceDialect,
9675            >,
9676            offset: usize,
9677            _depth: fidl::encoding::Depth,
9678        ) -> fidl::Result<()> {
9679            decoder.debug_check_bounds::<Self>(offset);
9680            // Verify that padding bytes are zero.
9681            fidl::decode!(
9682                fidl_fuchsia_ui_views::ViewCreationToken,
9683                fidl::encoding::DefaultFuchsiaResourceDialect,
9684                &mut self.token,
9685                decoder,
9686                offset + 0,
9687                _depth
9688            )?;
9689            fidl::decode!(
9690                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>>,
9691                fidl::encoding::DefaultFuchsiaResourceDialect,
9692                &mut self.parent_viewport_watcher,
9693                decoder,
9694                offset + 4,
9695                _depth
9696            )?;
9697            Ok(())
9698        }
9699    }
9700
9701    impl fidl::encoding::ResourceTypeMarker for FlatlandCreateViewportRequest {
9702        type Borrowed<'a> = &'a mut Self;
9703        fn take_or_borrow<'a>(
9704            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9705        ) -> Self::Borrowed<'a> {
9706            value
9707        }
9708    }
9709
9710    unsafe impl fidl::encoding::TypeMarker for FlatlandCreateViewportRequest {
9711        type Owned = Self;
9712
9713        #[inline(always)]
9714        fn inline_align(_context: fidl::encoding::Context) -> usize {
9715            8
9716        }
9717
9718        #[inline(always)]
9719        fn inline_size(_context: fidl::encoding::Context) -> usize {
9720            40
9721        }
9722    }
9723
9724    unsafe impl
9725        fidl::encoding::Encode<
9726            FlatlandCreateViewportRequest,
9727            fidl::encoding::DefaultFuchsiaResourceDialect,
9728        > for &mut FlatlandCreateViewportRequest
9729    {
9730        #[inline]
9731        unsafe fn encode(
9732            self,
9733            encoder: &mut fidl::encoding::Encoder<
9734                '_,
9735                fidl::encoding::DefaultFuchsiaResourceDialect,
9736            >,
9737            offset: usize,
9738            _depth: fidl::encoding::Depth,
9739        ) -> fidl::Result<()> {
9740            encoder.debug_check_bounds::<FlatlandCreateViewportRequest>(offset);
9741            // Delegate to tuple encoding.
9742            fidl::encoding::Encode::<FlatlandCreateViewportRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
9743                (
9744                    <ContentId as fidl::encoding::ValueTypeMarker>::borrow(&self.viewport_id),
9745                    <fidl_fuchsia_ui_views::ViewportCreationToken as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.token),
9746                    <ViewportProperties as fidl::encoding::ValueTypeMarker>::borrow(&self.properties),
9747                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ChildViewWatcherMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.child_view_watcher),
9748                ),
9749                encoder, offset, _depth
9750            )
9751        }
9752    }
9753    unsafe impl<
9754        T0: fidl::encoding::Encode<ContentId, fidl::encoding::DefaultFuchsiaResourceDialect>,
9755        T1: fidl::encoding::Encode<
9756                fidl_fuchsia_ui_views::ViewportCreationToken,
9757                fidl::encoding::DefaultFuchsiaResourceDialect,
9758            >,
9759        T2: fidl::encoding::Encode<ViewportProperties, fidl::encoding::DefaultFuchsiaResourceDialect>,
9760        T3: fidl::encoding::Encode<
9761                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ChildViewWatcherMarker>>,
9762                fidl::encoding::DefaultFuchsiaResourceDialect,
9763            >,
9764    >
9765        fidl::encoding::Encode<
9766            FlatlandCreateViewportRequest,
9767            fidl::encoding::DefaultFuchsiaResourceDialect,
9768        > for (T0, T1, T2, T3)
9769    {
9770        #[inline]
9771        unsafe fn encode(
9772            self,
9773            encoder: &mut fidl::encoding::Encoder<
9774                '_,
9775                fidl::encoding::DefaultFuchsiaResourceDialect,
9776            >,
9777            offset: usize,
9778            depth: fidl::encoding::Depth,
9779        ) -> fidl::Result<()> {
9780            encoder.debug_check_bounds::<FlatlandCreateViewportRequest>(offset);
9781            // Zero out padding regions. There's no need to apply masks
9782            // because the unmasked parts will be overwritten by fields.
9783            unsafe {
9784                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
9785                (ptr as *mut u64).write_unaligned(0);
9786            }
9787            unsafe {
9788                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(32);
9789                (ptr as *mut u64).write_unaligned(0);
9790            }
9791            // Write the fields.
9792            self.0.encode(encoder, offset + 0, depth)?;
9793            self.1.encode(encoder, offset + 8, depth)?;
9794            self.2.encode(encoder, offset + 16, depth)?;
9795            self.3.encode(encoder, offset + 32, depth)?;
9796            Ok(())
9797        }
9798    }
9799
9800    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
9801        for FlatlandCreateViewportRequest
9802    {
9803        #[inline(always)]
9804        fn new_empty() -> Self {
9805            Self {
9806                viewport_id: fidl::new_empty!(
9807                    ContentId,
9808                    fidl::encoding::DefaultFuchsiaResourceDialect
9809                ),
9810                token: fidl::new_empty!(
9811                    fidl_fuchsia_ui_views::ViewportCreationToken,
9812                    fidl::encoding::DefaultFuchsiaResourceDialect
9813                ),
9814                properties: fidl::new_empty!(
9815                    ViewportProperties,
9816                    fidl::encoding::DefaultFuchsiaResourceDialect
9817                ),
9818                child_view_watcher: fidl::new_empty!(
9819                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ChildViewWatcherMarker>>,
9820                    fidl::encoding::DefaultFuchsiaResourceDialect
9821                ),
9822            }
9823        }
9824
9825        #[inline]
9826        unsafe fn decode(
9827            &mut self,
9828            decoder: &mut fidl::encoding::Decoder<
9829                '_,
9830                fidl::encoding::DefaultFuchsiaResourceDialect,
9831            >,
9832            offset: usize,
9833            _depth: fidl::encoding::Depth,
9834        ) -> fidl::Result<()> {
9835            decoder.debug_check_bounds::<Self>(offset);
9836            // Verify that padding bytes are zero.
9837            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(8) };
9838            let padval = unsafe { (ptr as *const u64).read_unaligned() };
9839            let mask = 0xffffffff00000000u64;
9840            let maskedval = padval & mask;
9841            if maskedval != 0 {
9842                return Err(fidl::Error::NonZeroPadding {
9843                    padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
9844                });
9845            }
9846            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(32) };
9847            let padval = unsafe { (ptr as *const u64).read_unaligned() };
9848            let mask = 0xffffffff00000000u64;
9849            let maskedval = padval & mask;
9850            if maskedval != 0 {
9851                return Err(fidl::Error::NonZeroPadding {
9852                    padding_start: offset + 32 + ((mask as u64).trailing_zeros() / 8) as usize,
9853                });
9854            }
9855            fidl::decode!(
9856                ContentId,
9857                fidl::encoding::DefaultFuchsiaResourceDialect,
9858                &mut self.viewport_id,
9859                decoder,
9860                offset + 0,
9861                _depth
9862            )?;
9863            fidl::decode!(
9864                fidl_fuchsia_ui_views::ViewportCreationToken,
9865                fidl::encoding::DefaultFuchsiaResourceDialect,
9866                &mut self.token,
9867                decoder,
9868                offset + 8,
9869                _depth
9870            )?;
9871            fidl::decode!(
9872                ViewportProperties,
9873                fidl::encoding::DefaultFuchsiaResourceDialect,
9874                &mut self.properties,
9875                decoder,
9876                offset + 16,
9877                _depth
9878            )?;
9879            fidl::decode!(
9880                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ChildViewWatcherMarker>>,
9881                fidl::encoding::DefaultFuchsiaResourceDialect,
9882                &mut self.child_view_watcher,
9883                decoder,
9884                offset + 32,
9885                _depth
9886            )?;
9887            Ok(())
9888        }
9889    }
9890
9891    impl fidl::encoding::ResourceTypeMarker for FlatlandDisplaySetContentRequest {
9892        type Borrowed<'a> = &'a mut Self;
9893        fn take_or_borrow<'a>(
9894            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9895        ) -> Self::Borrowed<'a> {
9896            value
9897        }
9898    }
9899
9900    unsafe impl fidl::encoding::TypeMarker for FlatlandDisplaySetContentRequest {
9901        type Owned = Self;
9902
9903        #[inline(always)]
9904        fn inline_align(_context: fidl::encoding::Context) -> usize {
9905            4
9906        }
9907
9908        #[inline(always)]
9909        fn inline_size(_context: fidl::encoding::Context) -> usize {
9910            8
9911        }
9912    }
9913
9914    unsafe impl
9915        fidl::encoding::Encode<
9916            FlatlandDisplaySetContentRequest,
9917            fidl::encoding::DefaultFuchsiaResourceDialect,
9918        > for &mut FlatlandDisplaySetContentRequest
9919    {
9920        #[inline]
9921        unsafe fn encode(
9922            self,
9923            encoder: &mut fidl::encoding::Encoder<
9924                '_,
9925                fidl::encoding::DefaultFuchsiaResourceDialect,
9926            >,
9927            offset: usize,
9928            _depth: fidl::encoding::Depth,
9929        ) -> fidl::Result<()> {
9930            encoder.debug_check_bounds::<FlatlandDisplaySetContentRequest>(offset);
9931            // Delegate to tuple encoding.
9932            fidl::encoding::Encode::<FlatlandDisplaySetContentRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
9933                (
9934                    <fidl_fuchsia_ui_views::ViewportCreationToken as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.token),
9935                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ChildViewWatcherMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.child_view_watcher),
9936                ),
9937                encoder, offset, _depth
9938            )
9939        }
9940    }
9941    unsafe impl<
9942        T0: fidl::encoding::Encode<
9943                fidl_fuchsia_ui_views::ViewportCreationToken,
9944                fidl::encoding::DefaultFuchsiaResourceDialect,
9945            >,
9946        T1: fidl::encoding::Encode<
9947                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ChildViewWatcherMarker>>,
9948                fidl::encoding::DefaultFuchsiaResourceDialect,
9949            >,
9950    >
9951        fidl::encoding::Encode<
9952            FlatlandDisplaySetContentRequest,
9953            fidl::encoding::DefaultFuchsiaResourceDialect,
9954        > for (T0, T1)
9955    {
9956        #[inline]
9957        unsafe fn encode(
9958            self,
9959            encoder: &mut fidl::encoding::Encoder<
9960                '_,
9961                fidl::encoding::DefaultFuchsiaResourceDialect,
9962            >,
9963            offset: usize,
9964            depth: fidl::encoding::Depth,
9965        ) -> fidl::Result<()> {
9966            encoder.debug_check_bounds::<FlatlandDisplaySetContentRequest>(offset);
9967            // Zero out padding regions. There's no need to apply masks
9968            // because the unmasked parts will be overwritten by fields.
9969            // Write the fields.
9970            self.0.encode(encoder, offset + 0, depth)?;
9971            self.1.encode(encoder, offset + 4, depth)?;
9972            Ok(())
9973        }
9974    }
9975
9976    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
9977        for FlatlandDisplaySetContentRequest
9978    {
9979        #[inline(always)]
9980        fn new_empty() -> Self {
9981            Self {
9982                token: fidl::new_empty!(
9983                    fidl_fuchsia_ui_views::ViewportCreationToken,
9984                    fidl::encoding::DefaultFuchsiaResourceDialect
9985                ),
9986                child_view_watcher: fidl::new_empty!(
9987                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ChildViewWatcherMarker>>,
9988                    fidl::encoding::DefaultFuchsiaResourceDialect
9989                ),
9990            }
9991        }
9992
9993        #[inline]
9994        unsafe fn decode(
9995            &mut self,
9996            decoder: &mut fidl::encoding::Decoder<
9997                '_,
9998                fidl::encoding::DefaultFuchsiaResourceDialect,
9999            >,
10000            offset: usize,
10001            _depth: fidl::encoding::Depth,
10002        ) -> fidl::Result<()> {
10003            decoder.debug_check_bounds::<Self>(offset);
10004            // Verify that padding bytes are zero.
10005            fidl::decode!(
10006                fidl_fuchsia_ui_views::ViewportCreationToken,
10007                fidl::encoding::DefaultFuchsiaResourceDialect,
10008                &mut self.token,
10009                decoder,
10010                offset + 0,
10011                _depth
10012            )?;
10013            fidl::decode!(
10014                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ChildViewWatcherMarker>>,
10015                fidl::encoding::DefaultFuchsiaResourceDialect,
10016                &mut self.child_view_watcher,
10017                decoder,
10018                offset + 4,
10019                _depth
10020            )?;
10021            Ok(())
10022        }
10023    }
10024
10025    impl fidl::encoding::ResourceTypeMarker for FlatlandPresentRequest {
10026        type Borrowed<'a> = &'a mut Self;
10027        fn take_or_borrow<'a>(
10028            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10029        ) -> Self::Borrowed<'a> {
10030            value
10031        }
10032    }
10033
10034    unsafe impl fidl::encoding::TypeMarker for FlatlandPresentRequest {
10035        type Owned = Self;
10036
10037        #[inline(always)]
10038        fn inline_align(_context: fidl::encoding::Context) -> usize {
10039            8
10040        }
10041
10042        #[inline(always)]
10043        fn inline_size(_context: fidl::encoding::Context) -> usize {
10044            16
10045        }
10046    }
10047
10048    unsafe impl
10049        fidl::encoding::Encode<
10050            FlatlandPresentRequest,
10051            fidl::encoding::DefaultFuchsiaResourceDialect,
10052        > for &mut FlatlandPresentRequest
10053    {
10054        #[inline]
10055        unsafe fn encode(
10056            self,
10057            encoder: &mut fidl::encoding::Encoder<
10058                '_,
10059                fidl::encoding::DefaultFuchsiaResourceDialect,
10060            >,
10061            offset: usize,
10062            _depth: fidl::encoding::Depth,
10063        ) -> fidl::Result<()> {
10064            encoder.debug_check_bounds::<FlatlandPresentRequest>(offset);
10065            // Delegate to tuple encoding.
10066            fidl::encoding::Encode::<
10067                FlatlandPresentRequest,
10068                fidl::encoding::DefaultFuchsiaResourceDialect,
10069            >::encode(
10070                (<PresentArgs as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
10071                    &mut self.args,
10072                ),),
10073                encoder,
10074                offset,
10075                _depth,
10076            )
10077        }
10078    }
10079    unsafe impl<
10080        T0: fidl::encoding::Encode<PresentArgs, fidl::encoding::DefaultFuchsiaResourceDialect>,
10081    >
10082        fidl::encoding::Encode<
10083            FlatlandPresentRequest,
10084            fidl::encoding::DefaultFuchsiaResourceDialect,
10085        > for (T0,)
10086    {
10087        #[inline]
10088        unsafe fn encode(
10089            self,
10090            encoder: &mut fidl::encoding::Encoder<
10091                '_,
10092                fidl::encoding::DefaultFuchsiaResourceDialect,
10093            >,
10094            offset: usize,
10095            depth: fidl::encoding::Depth,
10096        ) -> fidl::Result<()> {
10097            encoder.debug_check_bounds::<FlatlandPresentRequest>(offset);
10098            // Zero out padding regions. There's no need to apply masks
10099            // because the unmasked parts will be overwritten by fields.
10100            // Write the fields.
10101            self.0.encode(encoder, offset + 0, depth)?;
10102            Ok(())
10103        }
10104    }
10105
10106    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10107        for FlatlandPresentRequest
10108    {
10109        #[inline(always)]
10110        fn new_empty() -> Self {
10111            Self {
10112                args: fidl::new_empty!(PresentArgs, fidl::encoding::DefaultFuchsiaResourceDialect),
10113            }
10114        }
10115
10116        #[inline]
10117        unsafe fn decode(
10118            &mut self,
10119            decoder: &mut fidl::encoding::Decoder<
10120                '_,
10121                fidl::encoding::DefaultFuchsiaResourceDialect,
10122            >,
10123            offset: usize,
10124            _depth: fidl::encoding::Depth,
10125        ) -> fidl::Result<()> {
10126            decoder.debug_check_bounds::<Self>(offset);
10127            // Verify that padding bytes are zero.
10128            fidl::decode!(
10129                PresentArgs,
10130                fidl::encoding::DefaultFuchsiaResourceDialect,
10131                &mut self.args,
10132                decoder,
10133                offset + 0,
10134                _depth
10135            )?;
10136            Ok(())
10137        }
10138    }
10139
10140    impl fidl::encoding::ResourceTypeMarker for FlatlandReleaseViewportResponse {
10141        type Borrowed<'a> = &'a mut Self;
10142        fn take_or_borrow<'a>(
10143            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10144        ) -> Self::Borrowed<'a> {
10145            value
10146        }
10147    }
10148
10149    unsafe impl fidl::encoding::TypeMarker for FlatlandReleaseViewportResponse {
10150        type Owned = Self;
10151
10152        #[inline(always)]
10153        fn inline_align(_context: fidl::encoding::Context) -> usize {
10154            4
10155        }
10156
10157        #[inline(always)]
10158        fn inline_size(_context: fidl::encoding::Context) -> usize {
10159            4
10160        }
10161    }
10162
10163    unsafe impl
10164        fidl::encoding::Encode<
10165            FlatlandReleaseViewportResponse,
10166            fidl::encoding::DefaultFuchsiaResourceDialect,
10167        > for &mut FlatlandReleaseViewportResponse
10168    {
10169        #[inline]
10170        unsafe fn encode(
10171            self,
10172            encoder: &mut fidl::encoding::Encoder<
10173                '_,
10174                fidl::encoding::DefaultFuchsiaResourceDialect,
10175            >,
10176            offset: usize,
10177            _depth: fidl::encoding::Depth,
10178        ) -> fidl::Result<()> {
10179            encoder.debug_check_bounds::<FlatlandReleaseViewportResponse>(offset);
10180            // Delegate to tuple encoding.
10181            fidl::encoding::Encode::<FlatlandReleaseViewportResponse, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
10182                (
10183                    <fidl_fuchsia_ui_views::ViewportCreationToken as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.token),
10184                ),
10185                encoder, offset, _depth
10186            )
10187        }
10188    }
10189    unsafe impl<
10190        T0: fidl::encoding::Encode<
10191                fidl_fuchsia_ui_views::ViewportCreationToken,
10192                fidl::encoding::DefaultFuchsiaResourceDialect,
10193            >,
10194    >
10195        fidl::encoding::Encode<
10196            FlatlandReleaseViewportResponse,
10197            fidl::encoding::DefaultFuchsiaResourceDialect,
10198        > for (T0,)
10199    {
10200        #[inline]
10201        unsafe fn encode(
10202            self,
10203            encoder: &mut fidl::encoding::Encoder<
10204                '_,
10205                fidl::encoding::DefaultFuchsiaResourceDialect,
10206            >,
10207            offset: usize,
10208            depth: fidl::encoding::Depth,
10209        ) -> fidl::Result<()> {
10210            encoder.debug_check_bounds::<FlatlandReleaseViewportResponse>(offset);
10211            // Zero out padding regions. There's no need to apply masks
10212            // because the unmasked parts will be overwritten by fields.
10213            // Write the fields.
10214            self.0.encode(encoder, offset + 0, depth)?;
10215            Ok(())
10216        }
10217    }
10218
10219    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10220        for FlatlandReleaseViewportResponse
10221    {
10222        #[inline(always)]
10223        fn new_empty() -> Self {
10224            Self {
10225                token: fidl::new_empty!(
10226                    fidl_fuchsia_ui_views::ViewportCreationToken,
10227                    fidl::encoding::DefaultFuchsiaResourceDialect
10228                ),
10229            }
10230        }
10231
10232        #[inline]
10233        unsafe fn decode(
10234            &mut self,
10235            decoder: &mut fidl::encoding::Decoder<
10236                '_,
10237                fidl::encoding::DefaultFuchsiaResourceDialect,
10238            >,
10239            offset: usize,
10240            _depth: fidl::encoding::Depth,
10241        ) -> fidl::Result<()> {
10242            decoder.debug_check_bounds::<Self>(offset);
10243            // Verify that padding bytes are zero.
10244            fidl::decode!(
10245                fidl_fuchsia_ui_views::ViewportCreationToken,
10246                fidl::encoding::DefaultFuchsiaResourceDialect,
10247                &mut self.token,
10248                decoder,
10249                offset + 0,
10250                _depth
10251            )?;
10252            Ok(())
10253        }
10254    }
10255
10256    impl fidl::encoding::ResourceTypeMarker for FlatlandSetSolidFillRequest {
10257        type Borrowed<'a> = &'a mut Self;
10258        fn take_or_borrow<'a>(
10259            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10260        ) -> Self::Borrowed<'a> {
10261            value
10262        }
10263    }
10264
10265    unsafe impl fidl::encoding::TypeMarker for FlatlandSetSolidFillRequest {
10266        type Owned = Self;
10267
10268        #[inline(always)]
10269        fn inline_align(_context: fidl::encoding::Context) -> usize {
10270            8
10271        }
10272
10273        #[inline(always)]
10274        fn inline_size(_context: fidl::encoding::Context) -> usize {
10275            32
10276        }
10277    }
10278
10279    unsafe impl
10280        fidl::encoding::Encode<
10281            FlatlandSetSolidFillRequest,
10282            fidl::encoding::DefaultFuchsiaResourceDialect,
10283        > for &mut FlatlandSetSolidFillRequest
10284    {
10285        #[inline]
10286        unsafe fn encode(
10287            self,
10288            encoder: &mut fidl::encoding::Encoder<
10289                '_,
10290                fidl::encoding::DefaultFuchsiaResourceDialect,
10291            >,
10292            offset: usize,
10293            _depth: fidl::encoding::Depth,
10294        ) -> fidl::Result<()> {
10295            encoder.debug_check_bounds::<FlatlandSetSolidFillRequest>(offset);
10296            // Delegate to tuple encoding.
10297            fidl::encoding::Encode::<
10298                FlatlandSetSolidFillRequest,
10299                fidl::encoding::DefaultFuchsiaResourceDialect,
10300            >::encode(
10301                (
10302                    <ContentId as fidl::encoding::ValueTypeMarker>::borrow(&self.rect_id),
10303                    <ColorRgba as fidl::encoding::ValueTypeMarker>::borrow(&self.color),
10304                    <fidl_fuchsia_math::SizeU as fidl::encoding::ValueTypeMarker>::borrow(
10305                        &self.size,
10306                    ),
10307                ),
10308                encoder,
10309                offset,
10310                _depth,
10311            )
10312        }
10313    }
10314    unsafe impl<
10315        T0: fidl::encoding::Encode<ContentId, fidl::encoding::DefaultFuchsiaResourceDialect>,
10316        T1: fidl::encoding::Encode<ColorRgba, fidl::encoding::DefaultFuchsiaResourceDialect>,
10317        T2: fidl::encoding::Encode<
10318                fidl_fuchsia_math::SizeU,
10319                fidl::encoding::DefaultFuchsiaResourceDialect,
10320            >,
10321    >
10322        fidl::encoding::Encode<
10323            FlatlandSetSolidFillRequest,
10324            fidl::encoding::DefaultFuchsiaResourceDialect,
10325        > for (T0, T1, T2)
10326    {
10327        #[inline]
10328        unsafe fn encode(
10329            self,
10330            encoder: &mut fidl::encoding::Encoder<
10331                '_,
10332                fidl::encoding::DefaultFuchsiaResourceDialect,
10333            >,
10334            offset: usize,
10335            depth: fidl::encoding::Depth,
10336        ) -> fidl::Result<()> {
10337            encoder.debug_check_bounds::<FlatlandSetSolidFillRequest>(offset);
10338            // Zero out padding regions. There's no need to apply masks
10339            // because the unmasked parts will be overwritten by fields.
10340            // Write the fields.
10341            self.0.encode(encoder, offset + 0, depth)?;
10342            self.1.encode(encoder, offset + 8, depth)?;
10343            self.2.encode(encoder, offset + 24, depth)?;
10344            Ok(())
10345        }
10346    }
10347
10348    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10349        for FlatlandSetSolidFillRequest
10350    {
10351        #[inline(always)]
10352        fn new_empty() -> Self {
10353            Self {
10354                rect_id: fidl::new_empty!(ContentId, fidl::encoding::DefaultFuchsiaResourceDialect),
10355                color: fidl::new_empty!(ColorRgba, fidl::encoding::DefaultFuchsiaResourceDialect),
10356                size: fidl::new_empty!(
10357                    fidl_fuchsia_math::SizeU,
10358                    fidl::encoding::DefaultFuchsiaResourceDialect
10359                ),
10360            }
10361        }
10362
10363        #[inline]
10364        unsafe fn decode(
10365            &mut self,
10366            decoder: &mut fidl::encoding::Decoder<
10367                '_,
10368                fidl::encoding::DefaultFuchsiaResourceDialect,
10369            >,
10370            offset: usize,
10371            _depth: fidl::encoding::Depth,
10372        ) -> fidl::Result<()> {
10373            decoder.debug_check_bounds::<Self>(offset);
10374            // Verify that padding bytes are zero.
10375            fidl::decode!(
10376                ContentId,
10377                fidl::encoding::DefaultFuchsiaResourceDialect,
10378                &mut self.rect_id,
10379                decoder,
10380                offset + 0,
10381                _depth
10382            )?;
10383            fidl::decode!(
10384                ColorRgba,
10385                fidl::encoding::DefaultFuchsiaResourceDialect,
10386                &mut self.color,
10387                decoder,
10388                offset + 8,
10389                _depth
10390            )?;
10391            fidl::decode!(
10392                fidl_fuchsia_math::SizeU,
10393                fidl::encoding::DefaultFuchsiaResourceDialect,
10394                &mut self.size,
10395                decoder,
10396                offset + 24,
10397                _depth
10398            )?;
10399            Ok(())
10400        }
10401    }
10402
10403    impl fidl::encoding::ResourceTypeMarker for TrustedFlatlandFactoryCreateFlatlandRequest {
10404        type Borrowed<'a> = &'a mut Self;
10405        fn take_or_borrow<'a>(
10406            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10407        ) -> Self::Borrowed<'a> {
10408            value
10409        }
10410    }
10411
10412    unsafe impl fidl::encoding::TypeMarker for TrustedFlatlandFactoryCreateFlatlandRequest {
10413        type Owned = Self;
10414
10415        #[inline(always)]
10416        fn inline_align(_context: fidl::encoding::Context) -> usize {
10417            8
10418        }
10419
10420        #[inline(always)]
10421        fn inline_size(_context: fidl::encoding::Context) -> usize {
10422            24
10423        }
10424    }
10425
10426    unsafe impl
10427        fidl::encoding::Encode<
10428            TrustedFlatlandFactoryCreateFlatlandRequest,
10429            fidl::encoding::DefaultFuchsiaResourceDialect,
10430        > for &mut TrustedFlatlandFactoryCreateFlatlandRequest
10431    {
10432        #[inline]
10433        unsafe fn encode(
10434            self,
10435            encoder: &mut fidl::encoding::Encoder<
10436                '_,
10437                fidl::encoding::DefaultFuchsiaResourceDialect,
10438            >,
10439            offset: usize,
10440            _depth: fidl::encoding::Depth,
10441        ) -> fidl::Result<()> {
10442            encoder.debug_check_bounds::<TrustedFlatlandFactoryCreateFlatlandRequest>(offset);
10443            // Delegate to tuple encoding.
10444            fidl::encoding::Encode::<TrustedFlatlandFactoryCreateFlatlandRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
10445                (
10446                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<FlatlandMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.server_end),
10447                    <TrustedFlatlandConfig as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.config),
10448                ),
10449                encoder, offset, _depth
10450            )
10451        }
10452    }
10453    unsafe impl<
10454        T0: fidl::encoding::Encode<
10455                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<FlatlandMarker>>,
10456                fidl::encoding::DefaultFuchsiaResourceDialect,
10457            >,
10458        T1: fidl::encoding::Encode<
10459                TrustedFlatlandConfig,
10460                fidl::encoding::DefaultFuchsiaResourceDialect,
10461            >,
10462    >
10463        fidl::encoding::Encode<
10464            TrustedFlatlandFactoryCreateFlatlandRequest,
10465            fidl::encoding::DefaultFuchsiaResourceDialect,
10466        > for (T0, T1)
10467    {
10468        #[inline]
10469        unsafe fn encode(
10470            self,
10471            encoder: &mut fidl::encoding::Encoder<
10472                '_,
10473                fidl::encoding::DefaultFuchsiaResourceDialect,
10474            >,
10475            offset: usize,
10476            depth: fidl::encoding::Depth,
10477        ) -> fidl::Result<()> {
10478            encoder.debug_check_bounds::<TrustedFlatlandFactoryCreateFlatlandRequest>(offset);
10479            // Zero out padding regions. There's no need to apply masks
10480            // because the unmasked parts will be overwritten by fields.
10481            unsafe {
10482                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
10483                (ptr as *mut u64).write_unaligned(0);
10484            }
10485            // Write the fields.
10486            self.0.encode(encoder, offset + 0, depth)?;
10487            self.1.encode(encoder, offset + 8, depth)?;
10488            Ok(())
10489        }
10490    }
10491
10492    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10493        for TrustedFlatlandFactoryCreateFlatlandRequest
10494    {
10495        #[inline(always)]
10496        fn new_empty() -> Self {
10497            Self {
10498                server_end: fidl::new_empty!(
10499                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<FlatlandMarker>>,
10500                    fidl::encoding::DefaultFuchsiaResourceDialect
10501                ),
10502                config: fidl::new_empty!(
10503                    TrustedFlatlandConfig,
10504                    fidl::encoding::DefaultFuchsiaResourceDialect
10505                ),
10506            }
10507        }
10508
10509        #[inline]
10510        unsafe fn decode(
10511            &mut self,
10512            decoder: &mut fidl::encoding::Decoder<
10513                '_,
10514                fidl::encoding::DefaultFuchsiaResourceDialect,
10515            >,
10516            offset: usize,
10517            _depth: fidl::encoding::Depth,
10518        ) -> fidl::Result<()> {
10519            decoder.debug_check_bounds::<Self>(offset);
10520            // Verify that padding bytes are zero.
10521            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
10522            let padval = unsafe { (ptr as *const u64).read_unaligned() };
10523            let mask = 0xffffffff00000000u64;
10524            let maskedval = padval & mask;
10525            if maskedval != 0 {
10526                return Err(fidl::Error::NonZeroPadding {
10527                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
10528                });
10529            }
10530            fidl::decode!(
10531                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<FlatlandMarker>>,
10532                fidl::encoding::DefaultFuchsiaResourceDialect,
10533                &mut self.server_end,
10534                decoder,
10535                offset + 0,
10536                _depth
10537            )?;
10538            fidl::decode!(
10539                TrustedFlatlandConfig,
10540                fidl::encoding::DefaultFuchsiaResourceDialect,
10541                &mut self.config,
10542                decoder,
10543                offset + 8,
10544                _depth
10545            )?;
10546            Ok(())
10547        }
10548    }
10549
10550    impl FrameInfo {
10551        #[inline(always)]
10552        fn max_ordinal_present(&self) -> u64 {
10553            if let Some(_) = self.buffer_id {
10554                return 1;
10555            }
10556            0
10557        }
10558    }
10559
10560    impl fidl::encoding::ResourceTypeMarker for FrameInfo {
10561        type Borrowed<'a> = &'a mut Self;
10562        fn take_or_borrow<'a>(
10563            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10564        ) -> Self::Borrowed<'a> {
10565            value
10566        }
10567    }
10568
10569    unsafe impl fidl::encoding::TypeMarker for FrameInfo {
10570        type Owned = Self;
10571
10572        #[inline(always)]
10573        fn inline_align(_context: fidl::encoding::Context) -> usize {
10574            8
10575        }
10576
10577        #[inline(always)]
10578        fn inline_size(_context: fidl::encoding::Context) -> usize {
10579            16
10580        }
10581    }
10582
10583    unsafe impl fidl::encoding::Encode<FrameInfo, fidl::encoding::DefaultFuchsiaResourceDialect>
10584        for &mut FrameInfo
10585    {
10586        unsafe fn encode(
10587            self,
10588            encoder: &mut fidl::encoding::Encoder<
10589                '_,
10590                fidl::encoding::DefaultFuchsiaResourceDialect,
10591            >,
10592            offset: usize,
10593            mut depth: fidl::encoding::Depth,
10594        ) -> fidl::Result<()> {
10595            encoder.debug_check_bounds::<FrameInfo>(offset);
10596            // Vector header
10597            let max_ordinal: u64 = self.max_ordinal_present();
10598            encoder.write_num(max_ordinal, offset);
10599            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
10600            // Calling encoder.out_of_line_offset(0) is not allowed.
10601            if max_ordinal == 0 {
10602                return Ok(());
10603            }
10604            depth.increment()?;
10605            let envelope_size = 8;
10606            let bytes_len = max_ordinal as usize * envelope_size;
10607            #[allow(unused_variables)]
10608            let offset = encoder.out_of_line_offset(bytes_len);
10609            let mut _prev_end_offset: usize = 0;
10610            if 1 > max_ordinal {
10611                return Ok(());
10612            }
10613
10614            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
10615            // are envelope_size bytes.
10616            let cur_offset: usize = (1 - 1) * envelope_size;
10617
10618            // Zero reserved fields.
10619            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
10620
10621            // Safety:
10622            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
10623            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
10624            //   envelope_size bytes, there is always sufficient room.
10625            fidl::encoding::encode_in_envelope_optional::<
10626                u32,
10627                fidl::encoding::DefaultFuchsiaResourceDialect,
10628            >(
10629                self.buffer_id.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
10630                encoder,
10631                offset + cur_offset,
10632                depth,
10633            )?;
10634
10635            _prev_end_offset = cur_offset + envelope_size;
10636
10637            Ok(())
10638        }
10639    }
10640
10641    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for FrameInfo {
10642        #[inline(always)]
10643        fn new_empty() -> Self {
10644            Self::default()
10645        }
10646
10647        unsafe fn decode(
10648            &mut self,
10649            decoder: &mut fidl::encoding::Decoder<
10650                '_,
10651                fidl::encoding::DefaultFuchsiaResourceDialect,
10652            >,
10653            offset: usize,
10654            mut depth: fidl::encoding::Depth,
10655        ) -> fidl::Result<()> {
10656            decoder.debug_check_bounds::<Self>(offset);
10657            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
10658                None => return Err(fidl::Error::NotNullable),
10659                Some(len) => len,
10660            };
10661            // Calling decoder.out_of_line_offset(0) is not allowed.
10662            if len == 0 {
10663                return Ok(());
10664            };
10665            depth.increment()?;
10666            let envelope_size = 8;
10667            let bytes_len = len * envelope_size;
10668            let offset = decoder.out_of_line_offset(bytes_len)?;
10669            // Decode the envelope for each type.
10670            let mut _next_ordinal_to_read = 0;
10671            let mut next_offset = offset;
10672            let end_offset = offset + bytes_len;
10673            _next_ordinal_to_read += 1;
10674            if next_offset >= end_offset {
10675                return Ok(());
10676            }
10677
10678            // Decode unknown envelopes for gaps in ordinals.
10679            while _next_ordinal_to_read < 1 {
10680                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10681                _next_ordinal_to_read += 1;
10682                next_offset += envelope_size;
10683            }
10684
10685            let next_out_of_line = decoder.next_out_of_line();
10686            let handles_before = decoder.remaining_handles();
10687            if let Some((inlined, num_bytes, num_handles)) =
10688                fidl::encoding::decode_envelope_header(decoder, next_offset)?
10689            {
10690                let member_inline_size =
10691                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
10692                if inlined != (member_inline_size <= 4) {
10693                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
10694                }
10695                let inner_offset;
10696                let mut inner_depth = depth.clone();
10697                if inlined {
10698                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
10699                    inner_offset = next_offset;
10700                } else {
10701                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
10702                    inner_depth.increment()?;
10703                }
10704                let val_ref = self.buffer_id.get_or_insert_with(|| {
10705                    fidl::new_empty!(u32, fidl::encoding::DefaultFuchsiaResourceDialect)
10706                });
10707                fidl::decode!(
10708                    u32,
10709                    fidl::encoding::DefaultFuchsiaResourceDialect,
10710                    val_ref,
10711                    decoder,
10712                    inner_offset,
10713                    inner_depth
10714                )?;
10715                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
10716                {
10717                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
10718                }
10719                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
10720                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
10721                }
10722            }
10723
10724            next_offset += envelope_size;
10725
10726            // Decode the remaining unknown envelopes.
10727            while next_offset < end_offset {
10728                _next_ordinal_to_read += 1;
10729                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10730                next_offset += envelope_size;
10731            }
10732
10733            Ok(())
10734        }
10735    }
10736
10737    impl GetNextFrameArgs {
10738        #[inline(always)]
10739        fn max_ordinal_present(&self) -> u64 {
10740            if let Some(_) = self.event {
10741                return 1;
10742            }
10743            0
10744        }
10745    }
10746
10747    impl fidl::encoding::ResourceTypeMarker for GetNextFrameArgs {
10748        type Borrowed<'a> = &'a mut Self;
10749        fn take_or_borrow<'a>(
10750            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10751        ) -> Self::Borrowed<'a> {
10752            value
10753        }
10754    }
10755
10756    unsafe impl fidl::encoding::TypeMarker for GetNextFrameArgs {
10757        type Owned = Self;
10758
10759        #[inline(always)]
10760        fn inline_align(_context: fidl::encoding::Context) -> usize {
10761            8
10762        }
10763
10764        #[inline(always)]
10765        fn inline_size(_context: fidl::encoding::Context) -> usize {
10766            16
10767        }
10768    }
10769
10770    unsafe impl
10771        fidl::encoding::Encode<GetNextFrameArgs, fidl::encoding::DefaultFuchsiaResourceDialect>
10772        for &mut GetNextFrameArgs
10773    {
10774        unsafe fn encode(
10775            self,
10776            encoder: &mut fidl::encoding::Encoder<
10777                '_,
10778                fidl::encoding::DefaultFuchsiaResourceDialect,
10779            >,
10780            offset: usize,
10781            mut depth: fidl::encoding::Depth,
10782        ) -> fidl::Result<()> {
10783            encoder.debug_check_bounds::<GetNextFrameArgs>(offset);
10784            // Vector header
10785            let max_ordinal: u64 = self.max_ordinal_present();
10786            encoder.write_num(max_ordinal, offset);
10787            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
10788            // Calling encoder.out_of_line_offset(0) is not allowed.
10789            if max_ordinal == 0 {
10790                return Ok(());
10791            }
10792            depth.increment()?;
10793            let envelope_size = 8;
10794            let bytes_len = max_ordinal as usize * envelope_size;
10795            #[allow(unused_variables)]
10796            let offset = encoder.out_of_line_offset(bytes_len);
10797            let mut _prev_end_offset: usize = 0;
10798            if 1 > max_ordinal {
10799                return Ok(());
10800            }
10801
10802            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
10803            // are envelope_size bytes.
10804            let cur_offset: usize = (1 - 1) * envelope_size;
10805
10806            // Zero reserved fields.
10807            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
10808
10809            // Safety:
10810            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
10811            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
10812            //   envelope_size bytes, there is always sufficient room.
10813            fidl::encoding::encode_in_envelope_optional::<
10814                fidl::encoding::HandleType<
10815                    fidl::Event,
10816                    { fidl::ObjectType::EVENT.into_raw() },
10817                    2147483648,
10818                >,
10819                fidl::encoding::DefaultFuchsiaResourceDialect,
10820            >(
10821                self.event.as_mut().map(
10822                    <fidl::encoding::HandleType<
10823                        fidl::Event,
10824                        { fidl::ObjectType::EVENT.into_raw() },
10825                        2147483648,
10826                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
10827                ),
10828                encoder,
10829                offset + cur_offset,
10830                depth,
10831            )?;
10832
10833            _prev_end_offset = cur_offset + envelope_size;
10834
10835            Ok(())
10836        }
10837    }
10838
10839    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10840        for GetNextFrameArgs
10841    {
10842        #[inline(always)]
10843        fn new_empty() -> Self {
10844            Self::default()
10845        }
10846
10847        unsafe fn decode(
10848            &mut self,
10849            decoder: &mut fidl::encoding::Decoder<
10850                '_,
10851                fidl::encoding::DefaultFuchsiaResourceDialect,
10852            >,
10853            offset: usize,
10854            mut depth: fidl::encoding::Depth,
10855        ) -> fidl::Result<()> {
10856            decoder.debug_check_bounds::<Self>(offset);
10857            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
10858                None => return Err(fidl::Error::NotNullable),
10859                Some(len) => len,
10860            };
10861            // Calling decoder.out_of_line_offset(0) is not allowed.
10862            if len == 0 {
10863                return Ok(());
10864            };
10865            depth.increment()?;
10866            let envelope_size = 8;
10867            let bytes_len = len * envelope_size;
10868            let offset = decoder.out_of_line_offset(bytes_len)?;
10869            // Decode the envelope for each type.
10870            let mut _next_ordinal_to_read = 0;
10871            let mut next_offset = offset;
10872            let end_offset = offset + bytes_len;
10873            _next_ordinal_to_read += 1;
10874            if next_offset >= end_offset {
10875                return Ok(());
10876            }
10877
10878            // Decode unknown envelopes for gaps in ordinals.
10879            while _next_ordinal_to_read < 1 {
10880                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10881                _next_ordinal_to_read += 1;
10882                next_offset += envelope_size;
10883            }
10884
10885            let next_out_of_line = decoder.next_out_of_line();
10886            let handles_before = decoder.remaining_handles();
10887            if let Some((inlined, num_bytes, num_handles)) =
10888                fidl::encoding::decode_envelope_header(decoder, next_offset)?
10889            {
10890                let member_inline_size = <fidl::encoding::HandleType<
10891                    fidl::Event,
10892                    { fidl::ObjectType::EVENT.into_raw() },
10893                    2147483648,
10894                > as fidl::encoding::TypeMarker>::inline_size(
10895                    decoder.context
10896                );
10897                if inlined != (member_inline_size <= 4) {
10898                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
10899                }
10900                let inner_offset;
10901                let mut inner_depth = depth.clone();
10902                if inlined {
10903                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
10904                    inner_offset = next_offset;
10905                } else {
10906                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
10907                    inner_depth.increment()?;
10908                }
10909                let val_ref =
10910                self.event.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
10911                fidl::decode!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
10912                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
10913                {
10914                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
10915                }
10916                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
10917                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
10918                }
10919            }
10920
10921            next_offset += envelope_size;
10922
10923            // Decode the remaining unknown envelopes.
10924            while next_offset < end_offset {
10925                _next_ordinal_to_read += 1;
10926                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10927                next_offset += envelope_size;
10928            }
10929
10930            Ok(())
10931        }
10932    }
10933
10934    impl PresentArgs {
10935        #[inline(always)]
10936        fn max_ordinal_present(&self) -> u64 {
10937            if let Some(_) = self.unsquashable {
10938                return 4;
10939            }
10940            if let Some(_) = self.release_fences {
10941                return 3;
10942            }
10943            if let Some(_) = self.acquire_fences {
10944                return 2;
10945            }
10946            if let Some(_) = self.requested_presentation_time {
10947                return 1;
10948            }
10949            0
10950        }
10951    }
10952
10953    impl fidl::encoding::ResourceTypeMarker for PresentArgs {
10954        type Borrowed<'a> = &'a mut Self;
10955        fn take_or_borrow<'a>(
10956            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10957        ) -> Self::Borrowed<'a> {
10958            value
10959        }
10960    }
10961
10962    unsafe impl fidl::encoding::TypeMarker for PresentArgs {
10963        type Owned = Self;
10964
10965        #[inline(always)]
10966        fn inline_align(_context: fidl::encoding::Context) -> usize {
10967            8
10968        }
10969
10970        #[inline(always)]
10971        fn inline_size(_context: fidl::encoding::Context) -> usize {
10972            16
10973        }
10974    }
10975
10976    unsafe impl fidl::encoding::Encode<PresentArgs, fidl::encoding::DefaultFuchsiaResourceDialect>
10977        for &mut PresentArgs
10978    {
10979        unsafe fn encode(
10980            self,
10981            encoder: &mut fidl::encoding::Encoder<
10982                '_,
10983                fidl::encoding::DefaultFuchsiaResourceDialect,
10984            >,
10985            offset: usize,
10986            mut depth: fidl::encoding::Depth,
10987        ) -> fidl::Result<()> {
10988            encoder.debug_check_bounds::<PresentArgs>(offset);
10989            // Vector header
10990            let max_ordinal: u64 = self.max_ordinal_present();
10991            encoder.write_num(max_ordinal, offset);
10992            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
10993            // Calling encoder.out_of_line_offset(0) is not allowed.
10994            if max_ordinal == 0 {
10995                return Ok(());
10996            }
10997            depth.increment()?;
10998            let envelope_size = 8;
10999            let bytes_len = max_ordinal as usize * envelope_size;
11000            #[allow(unused_variables)]
11001            let offset = encoder.out_of_line_offset(bytes_len);
11002            let mut _prev_end_offset: usize = 0;
11003            if 1 > max_ordinal {
11004                return Ok(());
11005            }
11006
11007            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11008            // are envelope_size bytes.
11009            let cur_offset: usize = (1 - 1) * envelope_size;
11010
11011            // Zero reserved fields.
11012            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11013
11014            // Safety:
11015            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11016            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11017            //   envelope_size bytes, there is always sufficient room.
11018            fidl::encoding::encode_in_envelope_optional::<
11019                i64,
11020                fidl::encoding::DefaultFuchsiaResourceDialect,
11021            >(
11022                self.requested_presentation_time
11023                    .as_ref()
11024                    .map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
11025                encoder,
11026                offset + cur_offset,
11027                depth,
11028            )?;
11029
11030            _prev_end_offset = cur_offset + envelope_size;
11031            if 2 > max_ordinal {
11032                return Ok(());
11033            }
11034
11035            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11036            // are envelope_size bytes.
11037            let cur_offset: usize = (2 - 1) * envelope_size;
11038
11039            // Zero reserved fields.
11040            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11041
11042            // Safety:
11043            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11044            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11045            //   envelope_size bytes, there is always sufficient room.
11046            fidl::encoding::encode_in_envelope_optional::<
11047                fidl::encoding::Vector<
11048                    fidl::encoding::HandleType<
11049                        fidl::Event,
11050                        { fidl::ObjectType::EVENT.into_raw() },
11051                        2147483648,
11052                    >,
11053                    16,
11054                >,
11055                fidl::encoding::DefaultFuchsiaResourceDialect,
11056            >(
11057                self.acquire_fences.as_mut().map(
11058                    <fidl::encoding::Vector<
11059                        fidl::encoding::HandleType<
11060                            fidl::Event,
11061                            { fidl::ObjectType::EVENT.into_raw() },
11062                            2147483648,
11063                        >,
11064                        16,
11065                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
11066                ),
11067                encoder,
11068                offset + cur_offset,
11069                depth,
11070            )?;
11071
11072            _prev_end_offset = cur_offset + envelope_size;
11073            if 3 > max_ordinal {
11074                return Ok(());
11075            }
11076
11077            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11078            // are envelope_size bytes.
11079            let cur_offset: usize = (3 - 1) * envelope_size;
11080
11081            // Zero reserved fields.
11082            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11083
11084            // Safety:
11085            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11086            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11087            //   envelope_size bytes, there is always sufficient room.
11088            fidl::encoding::encode_in_envelope_optional::<
11089                fidl::encoding::Vector<
11090                    fidl::encoding::HandleType<
11091                        fidl::Event,
11092                        { fidl::ObjectType::EVENT.into_raw() },
11093                        2147483648,
11094                    >,
11095                    16,
11096                >,
11097                fidl::encoding::DefaultFuchsiaResourceDialect,
11098            >(
11099                self.release_fences.as_mut().map(
11100                    <fidl::encoding::Vector<
11101                        fidl::encoding::HandleType<
11102                            fidl::Event,
11103                            { fidl::ObjectType::EVENT.into_raw() },
11104                            2147483648,
11105                        >,
11106                        16,
11107                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
11108                ),
11109                encoder,
11110                offset + cur_offset,
11111                depth,
11112            )?;
11113
11114            _prev_end_offset = cur_offset + envelope_size;
11115            if 4 > max_ordinal {
11116                return Ok(());
11117            }
11118
11119            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11120            // are envelope_size bytes.
11121            let cur_offset: usize = (4 - 1) * envelope_size;
11122
11123            // Zero reserved fields.
11124            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11125
11126            // Safety:
11127            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11128            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11129            //   envelope_size bytes, there is always sufficient room.
11130            fidl::encoding::encode_in_envelope_optional::<
11131                bool,
11132                fidl::encoding::DefaultFuchsiaResourceDialect,
11133            >(
11134                self.unsquashable.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
11135                encoder,
11136                offset + cur_offset,
11137                depth,
11138            )?;
11139
11140            _prev_end_offset = cur_offset + envelope_size;
11141
11142            Ok(())
11143        }
11144    }
11145
11146    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for PresentArgs {
11147        #[inline(always)]
11148        fn new_empty() -> Self {
11149            Self::default()
11150        }
11151
11152        unsafe fn decode(
11153            &mut self,
11154            decoder: &mut fidl::encoding::Decoder<
11155                '_,
11156                fidl::encoding::DefaultFuchsiaResourceDialect,
11157            >,
11158            offset: usize,
11159            mut depth: fidl::encoding::Depth,
11160        ) -> fidl::Result<()> {
11161            decoder.debug_check_bounds::<Self>(offset);
11162            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
11163                None => return Err(fidl::Error::NotNullable),
11164                Some(len) => len,
11165            };
11166            // Calling decoder.out_of_line_offset(0) is not allowed.
11167            if len == 0 {
11168                return Ok(());
11169            };
11170            depth.increment()?;
11171            let envelope_size = 8;
11172            let bytes_len = len * envelope_size;
11173            let offset = decoder.out_of_line_offset(bytes_len)?;
11174            // Decode the envelope for each type.
11175            let mut _next_ordinal_to_read = 0;
11176            let mut next_offset = offset;
11177            let end_offset = offset + bytes_len;
11178            _next_ordinal_to_read += 1;
11179            if next_offset >= end_offset {
11180                return Ok(());
11181            }
11182
11183            // Decode unknown envelopes for gaps in ordinals.
11184            while _next_ordinal_to_read < 1 {
11185                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11186                _next_ordinal_to_read += 1;
11187                next_offset += envelope_size;
11188            }
11189
11190            let next_out_of_line = decoder.next_out_of_line();
11191            let handles_before = decoder.remaining_handles();
11192            if let Some((inlined, num_bytes, num_handles)) =
11193                fidl::encoding::decode_envelope_header(decoder, next_offset)?
11194            {
11195                let member_inline_size =
11196                    <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
11197                if inlined != (member_inline_size <= 4) {
11198                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
11199                }
11200                let inner_offset;
11201                let mut inner_depth = depth.clone();
11202                if inlined {
11203                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11204                    inner_offset = next_offset;
11205                } else {
11206                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11207                    inner_depth.increment()?;
11208                }
11209                let val_ref = self.requested_presentation_time.get_or_insert_with(|| {
11210                    fidl::new_empty!(i64, fidl::encoding::DefaultFuchsiaResourceDialect)
11211                });
11212                fidl::decode!(
11213                    i64,
11214                    fidl::encoding::DefaultFuchsiaResourceDialect,
11215                    val_ref,
11216                    decoder,
11217                    inner_offset,
11218                    inner_depth
11219                )?;
11220                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11221                {
11222                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
11223                }
11224                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11225                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11226                }
11227            }
11228
11229            next_offset += envelope_size;
11230            _next_ordinal_to_read += 1;
11231            if next_offset >= end_offset {
11232                return Ok(());
11233            }
11234
11235            // Decode unknown envelopes for gaps in ordinals.
11236            while _next_ordinal_to_read < 2 {
11237                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11238                _next_ordinal_to_read += 1;
11239                next_offset += envelope_size;
11240            }
11241
11242            let next_out_of_line = decoder.next_out_of_line();
11243            let handles_before = decoder.remaining_handles();
11244            if let Some((inlined, num_bytes, num_handles)) =
11245                fidl::encoding::decode_envelope_header(decoder, next_offset)?
11246            {
11247                let member_inline_size = <fidl::encoding::Vector<
11248                    fidl::encoding::HandleType<
11249                        fidl::Event,
11250                        { fidl::ObjectType::EVENT.into_raw() },
11251                        2147483648,
11252                    >,
11253                    16,
11254                > as fidl::encoding::TypeMarker>::inline_size(
11255                    decoder.context
11256                );
11257                if inlined != (member_inline_size <= 4) {
11258                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
11259                }
11260                let inner_offset;
11261                let mut inner_depth = depth.clone();
11262                if inlined {
11263                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11264                    inner_offset = next_offset;
11265                } else {
11266                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11267                    inner_depth.increment()?;
11268                }
11269                let val_ref = self.acquire_fences.get_or_insert_with(|| {
11270                    fidl::new_empty!(
11271                        fidl::encoding::Vector<
11272                            fidl::encoding::HandleType<
11273                                fidl::Event,
11274                                { fidl::ObjectType::EVENT.into_raw() },
11275                                2147483648,
11276                            >,
11277                            16,
11278                        >,
11279                        fidl::encoding::DefaultFuchsiaResourceDialect
11280                    )
11281                });
11282                fidl::decode!(
11283                    fidl::encoding::Vector<
11284                        fidl::encoding::HandleType<
11285                            fidl::Event,
11286                            { fidl::ObjectType::EVENT.into_raw() },
11287                            2147483648,
11288                        >,
11289                        16,
11290                    >,
11291                    fidl::encoding::DefaultFuchsiaResourceDialect,
11292                    val_ref,
11293                    decoder,
11294                    inner_offset,
11295                    inner_depth
11296                )?;
11297                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11298                {
11299                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
11300                }
11301                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11302                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11303                }
11304            }
11305
11306            next_offset += envelope_size;
11307            _next_ordinal_to_read += 1;
11308            if next_offset >= end_offset {
11309                return Ok(());
11310            }
11311
11312            // Decode unknown envelopes for gaps in ordinals.
11313            while _next_ordinal_to_read < 3 {
11314                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11315                _next_ordinal_to_read += 1;
11316                next_offset += envelope_size;
11317            }
11318
11319            let next_out_of_line = decoder.next_out_of_line();
11320            let handles_before = decoder.remaining_handles();
11321            if let Some((inlined, num_bytes, num_handles)) =
11322                fidl::encoding::decode_envelope_header(decoder, next_offset)?
11323            {
11324                let member_inline_size = <fidl::encoding::Vector<
11325                    fidl::encoding::HandleType<
11326                        fidl::Event,
11327                        { fidl::ObjectType::EVENT.into_raw() },
11328                        2147483648,
11329                    >,
11330                    16,
11331                > as fidl::encoding::TypeMarker>::inline_size(
11332                    decoder.context
11333                );
11334                if inlined != (member_inline_size <= 4) {
11335                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
11336                }
11337                let inner_offset;
11338                let mut inner_depth = depth.clone();
11339                if inlined {
11340                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11341                    inner_offset = next_offset;
11342                } else {
11343                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11344                    inner_depth.increment()?;
11345                }
11346                let val_ref = self.release_fences.get_or_insert_with(|| {
11347                    fidl::new_empty!(
11348                        fidl::encoding::Vector<
11349                            fidl::encoding::HandleType<
11350                                fidl::Event,
11351                                { fidl::ObjectType::EVENT.into_raw() },
11352                                2147483648,
11353                            >,
11354                            16,
11355                        >,
11356                        fidl::encoding::DefaultFuchsiaResourceDialect
11357                    )
11358                });
11359                fidl::decode!(
11360                    fidl::encoding::Vector<
11361                        fidl::encoding::HandleType<
11362                            fidl::Event,
11363                            { fidl::ObjectType::EVENT.into_raw() },
11364                            2147483648,
11365                        >,
11366                        16,
11367                    >,
11368                    fidl::encoding::DefaultFuchsiaResourceDialect,
11369                    val_ref,
11370                    decoder,
11371                    inner_offset,
11372                    inner_depth
11373                )?;
11374                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11375                {
11376                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
11377                }
11378                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11379                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11380                }
11381            }
11382
11383            next_offset += envelope_size;
11384            _next_ordinal_to_read += 1;
11385            if next_offset >= end_offset {
11386                return Ok(());
11387            }
11388
11389            // Decode unknown envelopes for gaps in ordinals.
11390            while _next_ordinal_to_read < 4 {
11391                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11392                _next_ordinal_to_read += 1;
11393                next_offset += envelope_size;
11394            }
11395
11396            let next_out_of_line = decoder.next_out_of_line();
11397            let handles_before = decoder.remaining_handles();
11398            if let Some((inlined, num_bytes, num_handles)) =
11399                fidl::encoding::decode_envelope_header(decoder, next_offset)?
11400            {
11401                let member_inline_size =
11402                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
11403                if inlined != (member_inline_size <= 4) {
11404                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
11405                }
11406                let inner_offset;
11407                let mut inner_depth = depth.clone();
11408                if inlined {
11409                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11410                    inner_offset = next_offset;
11411                } else {
11412                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11413                    inner_depth.increment()?;
11414                }
11415                let val_ref = self.unsquashable.get_or_insert_with(|| {
11416                    fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
11417                });
11418                fidl::decode!(
11419                    bool,
11420                    fidl::encoding::DefaultFuchsiaResourceDialect,
11421                    val_ref,
11422                    decoder,
11423                    inner_offset,
11424                    inner_depth
11425                )?;
11426                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11427                {
11428                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
11429                }
11430                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11431                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11432                }
11433            }
11434
11435            next_offset += envelope_size;
11436
11437            // Decode the remaining unknown envelopes.
11438            while next_offset < end_offset {
11439                _next_ordinal_to_read += 1;
11440                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11441                next_offset += envelope_size;
11442            }
11443
11444            Ok(())
11445        }
11446    }
11447
11448    impl RegisterBufferCollectionArgs {
11449        #[inline(always)]
11450        fn max_ordinal_present(&self) -> u64 {
11451            if let Some(_) = self.buffer_collection_token2 {
11452                return 5;
11453            }
11454            if let Some(_) = self.usages {
11455                return 4;
11456            }
11457            if let Some(_) = self.usage {
11458                return 3;
11459            }
11460            if let Some(_) = self.buffer_collection_token {
11461                return 2;
11462            }
11463            if let Some(_) = self.export_token {
11464                return 1;
11465            }
11466            0
11467        }
11468    }
11469
11470    impl fidl::encoding::ResourceTypeMarker for RegisterBufferCollectionArgs {
11471        type Borrowed<'a> = &'a mut Self;
11472        fn take_or_borrow<'a>(
11473            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11474        ) -> Self::Borrowed<'a> {
11475            value
11476        }
11477    }
11478
11479    unsafe impl fidl::encoding::TypeMarker for RegisterBufferCollectionArgs {
11480        type Owned = Self;
11481
11482        #[inline(always)]
11483        fn inline_align(_context: fidl::encoding::Context) -> usize {
11484            8
11485        }
11486
11487        #[inline(always)]
11488        fn inline_size(_context: fidl::encoding::Context) -> usize {
11489            16
11490        }
11491    }
11492
11493    unsafe impl
11494        fidl::encoding::Encode<
11495            RegisterBufferCollectionArgs,
11496            fidl::encoding::DefaultFuchsiaResourceDialect,
11497        > for &mut RegisterBufferCollectionArgs
11498    {
11499        unsafe fn encode(
11500            self,
11501            encoder: &mut fidl::encoding::Encoder<
11502                '_,
11503                fidl::encoding::DefaultFuchsiaResourceDialect,
11504            >,
11505            offset: usize,
11506            mut depth: fidl::encoding::Depth,
11507        ) -> fidl::Result<()> {
11508            encoder.debug_check_bounds::<RegisterBufferCollectionArgs>(offset);
11509            // Vector header
11510            let max_ordinal: u64 = self.max_ordinal_present();
11511            encoder.write_num(max_ordinal, offset);
11512            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
11513            // Calling encoder.out_of_line_offset(0) is not allowed.
11514            if max_ordinal == 0 {
11515                return Ok(());
11516            }
11517            depth.increment()?;
11518            let envelope_size = 8;
11519            let bytes_len = max_ordinal as usize * envelope_size;
11520            #[allow(unused_variables)]
11521            let offset = encoder.out_of_line_offset(bytes_len);
11522            let mut _prev_end_offset: usize = 0;
11523            if 1 > max_ordinal {
11524                return Ok(());
11525            }
11526
11527            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11528            // are envelope_size bytes.
11529            let cur_offset: usize = (1 - 1) * envelope_size;
11530
11531            // Zero reserved fields.
11532            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11533
11534            // Safety:
11535            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11536            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11537            //   envelope_size bytes, there is always sufficient room.
11538            fidl::encoding::encode_in_envelope_optional::<BufferCollectionExportToken, fidl::encoding::DefaultFuchsiaResourceDialect>(
11539            self.export_token.as_mut().map(<BufferCollectionExportToken as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
11540            encoder, offset + cur_offset, depth
11541        )?;
11542
11543            _prev_end_offset = cur_offset + envelope_size;
11544            if 2 > max_ordinal {
11545                return Ok(());
11546            }
11547
11548            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11549            // are envelope_size bytes.
11550            let cur_offset: usize = (2 - 1) * envelope_size;
11551
11552            // Zero reserved fields.
11553            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11554
11555            // Safety:
11556            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11557            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11558            //   envelope_size bytes, there is always sufficient room.
11559            fidl::encoding::encode_in_envelope_optional::<
11560                fidl::encoding::Endpoint<
11561                    fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem::BufferCollectionTokenMarker>,
11562                >,
11563                fidl::encoding::DefaultFuchsiaResourceDialect,
11564            >(
11565                self.buffer_collection_token.as_mut().map(
11566                    <fidl::encoding::Endpoint<
11567                        fidl::endpoints::ClientEnd<
11568                            fidl_fuchsia_sysmem::BufferCollectionTokenMarker,
11569                        >,
11570                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
11571                ),
11572                encoder,
11573                offset + cur_offset,
11574                depth,
11575            )?;
11576
11577            _prev_end_offset = cur_offset + envelope_size;
11578            if 3 > max_ordinal {
11579                return Ok(());
11580            }
11581
11582            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11583            // are envelope_size bytes.
11584            let cur_offset: usize = (3 - 1) * envelope_size;
11585
11586            // Zero reserved fields.
11587            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11588
11589            // Safety:
11590            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11591            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11592            //   envelope_size bytes, there is always sufficient room.
11593            fidl::encoding::encode_in_envelope_optional::<
11594                RegisterBufferCollectionUsage,
11595                fidl::encoding::DefaultFuchsiaResourceDialect,
11596            >(
11597                self.usage.as_ref().map(
11598                    <RegisterBufferCollectionUsage as fidl::encoding::ValueTypeMarker>::borrow,
11599                ),
11600                encoder,
11601                offset + cur_offset,
11602                depth,
11603            )?;
11604
11605            _prev_end_offset = cur_offset + envelope_size;
11606            if 4 > max_ordinal {
11607                return Ok(());
11608            }
11609
11610            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11611            // are envelope_size bytes.
11612            let cur_offset: usize = (4 - 1) * envelope_size;
11613
11614            // Zero reserved fields.
11615            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11616
11617            // Safety:
11618            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11619            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11620            //   envelope_size bytes, there is always sufficient room.
11621            fidl::encoding::encode_in_envelope_optional::<
11622                RegisterBufferCollectionUsages,
11623                fidl::encoding::DefaultFuchsiaResourceDialect,
11624            >(
11625                self.usages.as_ref().map(
11626                    <RegisterBufferCollectionUsages as fidl::encoding::ValueTypeMarker>::borrow,
11627                ),
11628                encoder,
11629                offset + cur_offset,
11630                depth,
11631            )?;
11632
11633            _prev_end_offset = cur_offset + envelope_size;
11634            if 5 > max_ordinal {
11635                return Ok(());
11636            }
11637
11638            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11639            // are envelope_size bytes.
11640            let cur_offset: usize = (5 - 1) * envelope_size;
11641
11642            // Zero reserved fields.
11643            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11644
11645            // Safety:
11646            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11647            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11648            //   envelope_size bytes, there is always sufficient room.
11649            fidl::encoding::encode_in_envelope_optional::<
11650                fidl::encoding::Endpoint<
11651                    fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem2::BufferCollectionTokenMarker>,
11652                >,
11653                fidl::encoding::DefaultFuchsiaResourceDialect,
11654            >(
11655                self.buffer_collection_token2.as_mut().map(
11656                    <fidl::encoding::Endpoint<
11657                        fidl::endpoints::ClientEnd<
11658                            fidl_fuchsia_sysmem2::BufferCollectionTokenMarker,
11659                        >,
11660                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
11661                ),
11662                encoder,
11663                offset + cur_offset,
11664                depth,
11665            )?;
11666
11667            _prev_end_offset = cur_offset + envelope_size;
11668
11669            Ok(())
11670        }
11671    }
11672
11673    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11674        for RegisterBufferCollectionArgs
11675    {
11676        #[inline(always)]
11677        fn new_empty() -> Self {
11678            Self::default()
11679        }
11680
11681        unsafe fn decode(
11682            &mut self,
11683            decoder: &mut fidl::encoding::Decoder<
11684                '_,
11685                fidl::encoding::DefaultFuchsiaResourceDialect,
11686            >,
11687            offset: usize,
11688            mut depth: fidl::encoding::Depth,
11689        ) -> fidl::Result<()> {
11690            decoder.debug_check_bounds::<Self>(offset);
11691            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
11692                None => return Err(fidl::Error::NotNullable),
11693                Some(len) => len,
11694            };
11695            // Calling decoder.out_of_line_offset(0) is not allowed.
11696            if len == 0 {
11697                return Ok(());
11698            };
11699            depth.increment()?;
11700            let envelope_size = 8;
11701            let bytes_len = len * envelope_size;
11702            let offset = decoder.out_of_line_offset(bytes_len)?;
11703            // Decode the envelope for each type.
11704            let mut _next_ordinal_to_read = 0;
11705            let mut next_offset = offset;
11706            let end_offset = offset + bytes_len;
11707            _next_ordinal_to_read += 1;
11708            if next_offset >= end_offset {
11709                return Ok(());
11710            }
11711
11712            // Decode unknown envelopes for gaps in ordinals.
11713            while _next_ordinal_to_read < 1 {
11714                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11715                _next_ordinal_to_read += 1;
11716                next_offset += envelope_size;
11717            }
11718
11719            let next_out_of_line = decoder.next_out_of_line();
11720            let handles_before = decoder.remaining_handles();
11721            if let Some((inlined, num_bytes, num_handles)) =
11722                fidl::encoding::decode_envelope_header(decoder, next_offset)?
11723            {
11724                let member_inline_size =
11725                    <BufferCollectionExportToken as fidl::encoding::TypeMarker>::inline_size(
11726                        decoder.context,
11727                    );
11728                if inlined != (member_inline_size <= 4) {
11729                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
11730                }
11731                let inner_offset;
11732                let mut inner_depth = depth.clone();
11733                if inlined {
11734                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11735                    inner_offset = next_offset;
11736                } else {
11737                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11738                    inner_depth.increment()?;
11739                }
11740                let val_ref = self.export_token.get_or_insert_with(|| {
11741                    fidl::new_empty!(
11742                        BufferCollectionExportToken,
11743                        fidl::encoding::DefaultFuchsiaResourceDialect
11744                    )
11745                });
11746                fidl::decode!(
11747                    BufferCollectionExportToken,
11748                    fidl::encoding::DefaultFuchsiaResourceDialect,
11749                    val_ref,
11750                    decoder,
11751                    inner_offset,
11752                    inner_depth
11753                )?;
11754                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11755                {
11756                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
11757                }
11758                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11759                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11760                }
11761            }
11762
11763            next_offset += envelope_size;
11764            _next_ordinal_to_read += 1;
11765            if next_offset >= end_offset {
11766                return Ok(());
11767            }
11768
11769            // Decode unknown envelopes for gaps in ordinals.
11770            while _next_ordinal_to_read < 2 {
11771                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11772                _next_ordinal_to_read += 1;
11773                next_offset += envelope_size;
11774            }
11775
11776            let next_out_of_line = decoder.next_out_of_line();
11777            let handles_before = decoder.remaining_handles();
11778            if let Some((inlined, num_bytes, num_handles)) =
11779                fidl::encoding::decode_envelope_header(decoder, next_offset)?
11780            {
11781                let member_inline_size = <fidl::encoding::Endpoint<
11782                    fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem::BufferCollectionTokenMarker>,
11783                > as fidl::encoding::TypeMarker>::inline_size(
11784                    decoder.context
11785                );
11786                if inlined != (member_inline_size <= 4) {
11787                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
11788                }
11789                let inner_offset;
11790                let mut inner_depth = depth.clone();
11791                if inlined {
11792                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11793                    inner_offset = next_offset;
11794                } else {
11795                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11796                    inner_depth.increment()?;
11797                }
11798                let val_ref = self.buffer_collection_token.get_or_insert_with(|| {
11799                    fidl::new_empty!(
11800                        fidl::encoding::Endpoint<
11801                            fidl::endpoints::ClientEnd<
11802                                fidl_fuchsia_sysmem::BufferCollectionTokenMarker,
11803                            >,
11804                        >,
11805                        fidl::encoding::DefaultFuchsiaResourceDialect
11806                    )
11807                });
11808                fidl::decode!(
11809                    fidl::encoding::Endpoint<
11810                        fidl::endpoints::ClientEnd<
11811                            fidl_fuchsia_sysmem::BufferCollectionTokenMarker,
11812                        >,
11813                    >,
11814                    fidl::encoding::DefaultFuchsiaResourceDialect,
11815                    val_ref,
11816                    decoder,
11817                    inner_offset,
11818                    inner_depth
11819                )?;
11820                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11821                {
11822                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
11823                }
11824                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11825                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11826                }
11827            }
11828
11829            next_offset += envelope_size;
11830            _next_ordinal_to_read += 1;
11831            if next_offset >= end_offset {
11832                return Ok(());
11833            }
11834
11835            // Decode unknown envelopes for gaps in ordinals.
11836            while _next_ordinal_to_read < 3 {
11837                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11838                _next_ordinal_to_read += 1;
11839                next_offset += envelope_size;
11840            }
11841
11842            let next_out_of_line = decoder.next_out_of_line();
11843            let handles_before = decoder.remaining_handles();
11844            if let Some((inlined, num_bytes, num_handles)) =
11845                fidl::encoding::decode_envelope_header(decoder, next_offset)?
11846            {
11847                let member_inline_size =
11848                    <RegisterBufferCollectionUsage as fidl::encoding::TypeMarker>::inline_size(
11849                        decoder.context,
11850                    );
11851                if inlined != (member_inline_size <= 4) {
11852                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
11853                }
11854                let inner_offset;
11855                let mut inner_depth = depth.clone();
11856                if inlined {
11857                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11858                    inner_offset = next_offset;
11859                } else {
11860                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11861                    inner_depth.increment()?;
11862                }
11863                let val_ref = self.usage.get_or_insert_with(|| {
11864                    fidl::new_empty!(
11865                        RegisterBufferCollectionUsage,
11866                        fidl::encoding::DefaultFuchsiaResourceDialect
11867                    )
11868                });
11869                fidl::decode!(
11870                    RegisterBufferCollectionUsage,
11871                    fidl::encoding::DefaultFuchsiaResourceDialect,
11872                    val_ref,
11873                    decoder,
11874                    inner_offset,
11875                    inner_depth
11876                )?;
11877                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11878                {
11879                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
11880                }
11881                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11882                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11883                }
11884            }
11885
11886            next_offset += envelope_size;
11887            _next_ordinal_to_read += 1;
11888            if next_offset >= end_offset {
11889                return Ok(());
11890            }
11891
11892            // Decode unknown envelopes for gaps in ordinals.
11893            while _next_ordinal_to_read < 4 {
11894                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11895                _next_ordinal_to_read += 1;
11896                next_offset += envelope_size;
11897            }
11898
11899            let next_out_of_line = decoder.next_out_of_line();
11900            let handles_before = decoder.remaining_handles();
11901            if let Some((inlined, num_bytes, num_handles)) =
11902                fidl::encoding::decode_envelope_header(decoder, next_offset)?
11903            {
11904                let member_inline_size =
11905                    <RegisterBufferCollectionUsages as fidl::encoding::TypeMarker>::inline_size(
11906                        decoder.context,
11907                    );
11908                if inlined != (member_inline_size <= 4) {
11909                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
11910                }
11911                let inner_offset;
11912                let mut inner_depth = depth.clone();
11913                if inlined {
11914                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11915                    inner_offset = next_offset;
11916                } else {
11917                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11918                    inner_depth.increment()?;
11919                }
11920                let val_ref = self.usages.get_or_insert_with(|| {
11921                    fidl::new_empty!(
11922                        RegisterBufferCollectionUsages,
11923                        fidl::encoding::DefaultFuchsiaResourceDialect
11924                    )
11925                });
11926                fidl::decode!(
11927                    RegisterBufferCollectionUsages,
11928                    fidl::encoding::DefaultFuchsiaResourceDialect,
11929                    val_ref,
11930                    decoder,
11931                    inner_offset,
11932                    inner_depth
11933                )?;
11934                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11935                {
11936                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
11937                }
11938                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11939                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11940                }
11941            }
11942
11943            next_offset += envelope_size;
11944            _next_ordinal_to_read += 1;
11945            if next_offset >= end_offset {
11946                return Ok(());
11947            }
11948
11949            // Decode unknown envelopes for gaps in ordinals.
11950            while _next_ordinal_to_read < 5 {
11951                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11952                _next_ordinal_to_read += 1;
11953                next_offset += envelope_size;
11954            }
11955
11956            let next_out_of_line = decoder.next_out_of_line();
11957            let handles_before = decoder.remaining_handles();
11958            if let Some((inlined, num_bytes, num_handles)) =
11959                fidl::encoding::decode_envelope_header(decoder, next_offset)?
11960            {
11961                let member_inline_size = <fidl::encoding::Endpoint<
11962                    fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem2::BufferCollectionTokenMarker>,
11963                > as fidl::encoding::TypeMarker>::inline_size(
11964                    decoder.context
11965                );
11966                if inlined != (member_inline_size <= 4) {
11967                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
11968                }
11969                let inner_offset;
11970                let mut inner_depth = depth.clone();
11971                if inlined {
11972                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11973                    inner_offset = next_offset;
11974                } else {
11975                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11976                    inner_depth.increment()?;
11977                }
11978                let val_ref = self.buffer_collection_token2.get_or_insert_with(|| {
11979                    fidl::new_empty!(
11980                        fidl::encoding::Endpoint<
11981                            fidl::endpoints::ClientEnd<
11982                                fidl_fuchsia_sysmem2::BufferCollectionTokenMarker,
11983                            >,
11984                        >,
11985                        fidl::encoding::DefaultFuchsiaResourceDialect
11986                    )
11987                });
11988                fidl::decode!(
11989                    fidl::encoding::Endpoint<
11990                        fidl::endpoints::ClientEnd<
11991                            fidl_fuchsia_sysmem2::BufferCollectionTokenMarker,
11992                        >,
11993                    >,
11994                    fidl::encoding::DefaultFuchsiaResourceDialect,
11995                    val_ref,
11996                    decoder,
11997                    inner_offset,
11998                    inner_depth
11999                )?;
12000                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12001                {
12002                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12003                }
12004                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12005                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12006                }
12007            }
12008
12009            next_offset += envelope_size;
12010
12011            // Decode the remaining unknown envelopes.
12012            while next_offset < end_offset {
12013                _next_ordinal_to_read += 1;
12014                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12015                next_offset += envelope_size;
12016            }
12017
12018            Ok(())
12019        }
12020    }
12021
12022    impl ScreenCaptureConfig {
12023        #[inline(always)]
12024        fn max_ordinal_present(&self) -> u64 {
12025            if let Some(_) = self.rotation {
12026                return 4;
12027            }
12028            if let Some(_) = self.buffer_count {
12029                return 3;
12030            }
12031            if let Some(_) = self.size {
12032                return 2;
12033            }
12034            if let Some(_) = self.import_token {
12035                return 1;
12036            }
12037            0
12038        }
12039    }
12040
12041    impl fidl::encoding::ResourceTypeMarker for ScreenCaptureConfig {
12042        type Borrowed<'a> = &'a mut Self;
12043        fn take_or_borrow<'a>(
12044            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12045        ) -> Self::Borrowed<'a> {
12046            value
12047        }
12048    }
12049
12050    unsafe impl fidl::encoding::TypeMarker for ScreenCaptureConfig {
12051        type Owned = Self;
12052
12053        #[inline(always)]
12054        fn inline_align(_context: fidl::encoding::Context) -> usize {
12055            8
12056        }
12057
12058        #[inline(always)]
12059        fn inline_size(_context: fidl::encoding::Context) -> usize {
12060            16
12061        }
12062    }
12063
12064    unsafe impl
12065        fidl::encoding::Encode<ScreenCaptureConfig, fidl::encoding::DefaultFuchsiaResourceDialect>
12066        for &mut ScreenCaptureConfig
12067    {
12068        unsafe fn encode(
12069            self,
12070            encoder: &mut fidl::encoding::Encoder<
12071                '_,
12072                fidl::encoding::DefaultFuchsiaResourceDialect,
12073            >,
12074            offset: usize,
12075            mut depth: fidl::encoding::Depth,
12076        ) -> fidl::Result<()> {
12077            encoder.debug_check_bounds::<ScreenCaptureConfig>(offset);
12078            // Vector header
12079            let max_ordinal: u64 = self.max_ordinal_present();
12080            encoder.write_num(max_ordinal, offset);
12081            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
12082            // Calling encoder.out_of_line_offset(0) is not allowed.
12083            if max_ordinal == 0 {
12084                return Ok(());
12085            }
12086            depth.increment()?;
12087            let envelope_size = 8;
12088            let bytes_len = max_ordinal as usize * envelope_size;
12089            #[allow(unused_variables)]
12090            let offset = encoder.out_of_line_offset(bytes_len);
12091            let mut _prev_end_offset: usize = 0;
12092            if 1 > max_ordinal {
12093                return Ok(());
12094            }
12095
12096            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12097            // are envelope_size bytes.
12098            let cur_offset: usize = (1 - 1) * envelope_size;
12099
12100            // Zero reserved fields.
12101            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12102
12103            // Safety:
12104            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12105            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12106            //   envelope_size bytes, there is always sufficient room.
12107            fidl::encoding::encode_in_envelope_optional::<BufferCollectionImportToken, fidl::encoding::DefaultFuchsiaResourceDialect>(
12108            self.import_token.as_mut().map(<BufferCollectionImportToken as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
12109            encoder, offset + cur_offset, depth
12110        )?;
12111
12112            _prev_end_offset = cur_offset + envelope_size;
12113            if 2 > max_ordinal {
12114                return Ok(());
12115            }
12116
12117            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12118            // are envelope_size bytes.
12119            let cur_offset: usize = (2 - 1) * envelope_size;
12120
12121            // Zero reserved fields.
12122            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12123
12124            // Safety:
12125            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12126            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12127            //   envelope_size bytes, there is always sufficient room.
12128            fidl::encoding::encode_in_envelope_optional::<
12129                fidl_fuchsia_math::SizeU,
12130                fidl::encoding::DefaultFuchsiaResourceDialect,
12131            >(
12132                self.size
12133                    .as_ref()
12134                    .map(<fidl_fuchsia_math::SizeU as fidl::encoding::ValueTypeMarker>::borrow),
12135                encoder,
12136                offset + cur_offset,
12137                depth,
12138            )?;
12139
12140            _prev_end_offset = cur_offset + envelope_size;
12141            if 3 > max_ordinal {
12142                return Ok(());
12143            }
12144
12145            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12146            // are envelope_size bytes.
12147            let cur_offset: usize = (3 - 1) * envelope_size;
12148
12149            // Zero reserved fields.
12150            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12151
12152            // Safety:
12153            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12154            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12155            //   envelope_size bytes, there is always sufficient room.
12156            fidl::encoding::encode_in_envelope_optional::<
12157                u32,
12158                fidl::encoding::DefaultFuchsiaResourceDialect,
12159            >(
12160                self.buffer_count.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
12161                encoder,
12162                offset + cur_offset,
12163                depth,
12164            )?;
12165
12166            _prev_end_offset = cur_offset + envelope_size;
12167            if 4 > max_ordinal {
12168                return Ok(());
12169            }
12170
12171            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12172            // are envelope_size bytes.
12173            let cur_offset: usize = (4 - 1) * envelope_size;
12174
12175            // Zero reserved fields.
12176            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12177
12178            // Safety:
12179            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12180            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12181            //   envelope_size bytes, there is always sufficient room.
12182            fidl::encoding::encode_in_envelope_optional::<
12183                Rotation,
12184                fidl::encoding::DefaultFuchsiaResourceDialect,
12185            >(
12186                self.rotation.as_ref().map(<Rotation as fidl::encoding::ValueTypeMarker>::borrow),
12187                encoder,
12188                offset + cur_offset,
12189                depth,
12190            )?;
12191
12192            _prev_end_offset = cur_offset + envelope_size;
12193
12194            Ok(())
12195        }
12196    }
12197
12198    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
12199        for ScreenCaptureConfig
12200    {
12201        #[inline(always)]
12202        fn new_empty() -> Self {
12203            Self::default()
12204        }
12205
12206        unsafe fn decode(
12207            &mut self,
12208            decoder: &mut fidl::encoding::Decoder<
12209                '_,
12210                fidl::encoding::DefaultFuchsiaResourceDialect,
12211            >,
12212            offset: usize,
12213            mut depth: fidl::encoding::Depth,
12214        ) -> fidl::Result<()> {
12215            decoder.debug_check_bounds::<Self>(offset);
12216            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
12217                None => return Err(fidl::Error::NotNullable),
12218                Some(len) => len,
12219            };
12220            // Calling decoder.out_of_line_offset(0) is not allowed.
12221            if len == 0 {
12222                return Ok(());
12223            };
12224            depth.increment()?;
12225            let envelope_size = 8;
12226            let bytes_len = len * envelope_size;
12227            let offset = decoder.out_of_line_offset(bytes_len)?;
12228            // Decode the envelope for each type.
12229            let mut _next_ordinal_to_read = 0;
12230            let mut next_offset = offset;
12231            let end_offset = offset + bytes_len;
12232            _next_ordinal_to_read += 1;
12233            if next_offset >= end_offset {
12234                return Ok(());
12235            }
12236
12237            // Decode unknown envelopes for gaps in ordinals.
12238            while _next_ordinal_to_read < 1 {
12239                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12240                _next_ordinal_to_read += 1;
12241                next_offset += envelope_size;
12242            }
12243
12244            let next_out_of_line = decoder.next_out_of_line();
12245            let handles_before = decoder.remaining_handles();
12246            if let Some((inlined, num_bytes, num_handles)) =
12247                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12248            {
12249                let member_inline_size =
12250                    <BufferCollectionImportToken as fidl::encoding::TypeMarker>::inline_size(
12251                        decoder.context,
12252                    );
12253                if inlined != (member_inline_size <= 4) {
12254                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12255                }
12256                let inner_offset;
12257                let mut inner_depth = depth.clone();
12258                if inlined {
12259                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12260                    inner_offset = next_offset;
12261                } else {
12262                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12263                    inner_depth.increment()?;
12264                }
12265                let val_ref = self.import_token.get_or_insert_with(|| {
12266                    fidl::new_empty!(
12267                        BufferCollectionImportToken,
12268                        fidl::encoding::DefaultFuchsiaResourceDialect
12269                    )
12270                });
12271                fidl::decode!(
12272                    BufferCollectionImportToken,
12273                    fidl::encoding::DefaultFuchsiaResourceDialect,
12274                    val_ref,
12275                    decoder,
12276                    inner_offset,
12277                    inner_depth
12278                )?;
12279                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12280                {
12281                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12282                }
12283                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12284                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12285                }
12286            }
12287
12288            next_offset += envelope_size;
12289            _next_ordinal_to_read += 1;
12290            if next_offset >= end_offset {
12291                return Ok(());
12292            }
12293
12294            // Decode unknown envelopes for gaps in ordinals.
12295            while _next_ordinal_to_read < 2 {
12296                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12297                _next_ordinal_to_read += 1;
12298                next_offset += envelope_size;
12299            }
12300
12301            let next_out_of_line = decoder.next_out_of_line();
12302            let handles_before = decoder.remaining_handles();
12303            if let Some((inlined, num_bytes, num_handles)) =
12304                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12305            {
12306                let member_inline_size =
12307                    <fidl_fuchsia_math::SizeU as fidl::encoding::TypeMarker>::inline_size(
12308                        decoder.context,
12309                    );
12310                if inlined != (member_inline_size <= 4) {
12311                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12312                }
12313                let inner_offset;
12314                let mut inner_depth = depth.clone();
12315                if inlined {
12316                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12317                    inner_offset = next_offset;
12318                } else {
12319                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12320                    inner_depth.increment()?;
12321                }
12322                let val_ref = self.size.get_or_insert_with(|| {
12323                    fidl::new_empty!(
12324                        fidl_fuchsia_math::SizeU,
12325                        fidl::encoding::DefaultFuchsiaResourceDialect
12326                    )
12327                });
12328                fidl::decode!(
12329                    fidl_fuchsia_math::SizeU,
12330                    fidl::encoding::DefaultFuchsiaResourceDialect,
12331                    val_ref,
12332                    decoder,
12333                    inner_offset,
12334                    inner_depth
12335                )?;
12336                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12337                {
12338                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12339                }
12340                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12341                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12342                }
12343            }
12344
12345            next_offset += envelope_size;
12346            _next_ordinal_to_read += 1;
12347            if next_offset >= end_offset {
12348                return Ok(());
12349            }
12350
12351            // Decode unknown envelopes for gaps in ordinals.
12352            while _next_ordinal_to_read < 3 {
12353                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12354                _next_ordinal_to_read += 1;
12355                next_offset += envelope_size;
12356            }
12357
12358            let next_out_of_line = decoder.next_out_of_line();
12359            let handles_before = decoder.remaining_handles();
12360            if let Some((inlined, num_bytes, num_handles)) =
12361                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12362            {
12363                let member_inline_size =
12364                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
12365                if inlined != (member_inline_size <= 4) {
12366                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12367                }
12368                let inner_offset;
12369                let mut inner_depth = depth.clone();
12370                if inlined {
12371                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12372                    inner_offset = next_offset;
12373                } else {
12374                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12375                    inner_depth.increment()?;
12376                }
12377                let val_ref = self.buffer_count.get_or_insert_with(|| {
12378                    fidl::new_empty!(u32, fidl::encoding::DefaultFuchsiaResourceDialect)
12379                });
12380                fidl::decode!(
12381                    u32,
12382                    fidl::encoding::DefaultFuchsiaResourceDialect,
12383                    val_ref,
12384                    decoder,
12385                    inner_offset,
12386                    inner_depth
12387                )?;
12388                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12389                {
12390                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12391                }
12392                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12393                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12394                }
12395            }
12396
12397            next_offset += envelope_size;
12398            _next_ordinal_to_read += 1;
12399            if next_offset >= end_offset {
12400                return Ok(());
12401            }
12402
12403            // Decode unknown envelopes for gaps in ordinals.
12404            while _next_ordinal_to_read < 4 {
12405                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12406                _next_ordinal_to_read += 1;
12407                next_offset += envelope_size;
12408            }
12409
12410            let next_out_of_line = decoder.next_out_of_line();
12411            let handles_before = decoder.remaining_handles();
12412            if let Some((inlined, num_bytes, num_handles)) =
12413                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12414            {
12415                let member_inline_size =
12416                    <Rotation as fidl::encoding::TypeMarker>::inline_size(decoder.context);
12417                if inlined != (member_inline_size <= 4) {
12418                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12419                }
12420                let inner_offset;
12421                let mut inner_depth = depth.clone();
12422                if inlined {
12423                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12424                    inner_offset = next_offset;
12425                } else {
12426                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12427                    inner_depth.increment()?;
12428                }
12429                let val_ref = self.rotation.get_or_insert_with(|| {
12430                    fidl::new_empty!(Rotation, fidl::encoding::DefaultFuchsiaResourceDialect)
12431                });
12432                fidl::decode!(
12433                    Rotation,
12434                    fidl::encoding::DefaultFuchsiaResourceDialect,
12435                    val_ref,
12436                    decoder,
12437                    inner_offset,
12438                    inner_depth
12439                )?;
12440                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12441                {
12442                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12443                }
12444                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12445                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12446                }
12447            }
12448
12449            next_offset += envelope_size;
12450
12451            // Decode the remaining unknown envelopes.
12452            while next_offset < end_offset {
12453                _next_ordinal_to_read += 1;
12454                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12455                next_offset += envelope_size;
12456            }
12457
12458            Ok(())
12459        }
12460    }
12461
12462    impl ScreenshotTakeFileRequest {
12463        #[inline(always)]
12464        fn max_ordinal_present(&self) -> u64 {
12465            if let Some(_) = self.format {
12466                return 1;
12467            }
12468            0
12469        }
12470    }
12471
12472    impl fidl::encoding::ResourceTypeMarker for ScreenshotTakeFileRequest {
12473        type Borrowed<'a> = &'a mut Self;
12474        fn take_or_borrow<'a>(
12475            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12476        ) -> Self::Borrowed<'a> {
12477            value
12478        }
12479    }
12480
12481    unsafe impl fidl::encoding::TypeMarker for ScreenshotTakeFileRequest {
12482        type Owned = Self;
12483
12484        #[inline(always)]
12485        fn inline_align(_context: fidl::encoding::Context) -> usize {
12486            8
12487        }
12488
12489        #[inline(always)]
12490        fn inline_size(_context: fidl::encoding::Context) -> usize {
12491            16
12492        }
12493    }
12494
12495    unsafe impl
12496        fidl::encoding::Encode<
12497            ScreenshotTakeFileRequest,
12498            fidl::encoding::DefaultFuchsiaResourceDialect,
12499        > for &mut ScreenshotTakeFileRequest
12500    {
12501        unsafe fn encode(
12502            self,
12503            encoder: &mut fidl::encoding::Encoder<
12504                '_,
12505                fidl::encoding::DefaultFuchsiaResourceDialect,
12506            >,
12507            offset: usize,
12508            mut depth: fidl::encoding::Depth,
12509        ) -> fidl::Result<()> {
12510            encoder.debug_check_bounds::<ScreenshotTakeFileRequest>(offset);
12511            // Vector header
12512            let max_ordinal: u64 = self.max_ordinal_present();
12513            encoder.write_num(max_ordinal, offset);
12514            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
12515            // Calling encoder.out_of_line_offset(0) is not allowed.
12516            if max_ordinal == 0 {
12517                return Ok(());
12518            }
12519            depth.increment()?;
12520            let envelope_size = 8;
12521            let bytes_len = max_ordinal as usize * envelope_size;
12522            #[allow(unused_variables)]
12523            let offset = encoder.out_of_line_offset(bytes_len);
12524            let mut _prev_end_offset: usize = 0;
12525            if 1 > max_ordinal {
12526                return Ok(());
12527            }
12528
12529            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12530            // are envelope_size bytes.
12531            let cur_offset: usize = (1 - 1) * envelope_size;
12532
12533            // Zero reserved fields.
12534            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12535
12536            // Safety:
12537            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12538            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12539            //   envelope_size bytes, there is always sufficient room.
12540            fidl::encoding::encode_in_envelope_optional::<
12541                ScreenshotFormat,
12542                fidl::encoding::DefaultFuchsiaResourceDialect,
12543            >(
12544                self.format
12545                    .as_ref()
12546                    .map(<ScreenshotFormat as fidl::encoding::ValueTypeMarker>::borrow),
12547                encoder,
12548                offset + cur_offset,
12549                depth,
12550            )?;
12551
12552            _prev_end_offset = cur_offset + envelope_size;
12553
12554            Ok(())
12555        }
12556    }
12557
12558    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
12559        for ScreenshotTakeFileRequest
12560    {
12561        #[inline(always)]
12562        fn new_empty() -> Self {
12563            Self::default()
12564        }
12565
12566        unsafe fn decode(
12567            &mut self,
12568            decoder: &mut fidl::encoding::Decoder<
12569                '_,
12570                fidl::encoding::DefaultFuchsiaResourceDialect,
12571            >,
12572            offset: usize,
12573            mut depth: fidl::encoding::Depth,
12574        ) -> fidl::Result<()> {
12575            decoder.debug_check_bounds::<Self>(offset);
12576            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
12577                None => return Err(fidl::Error::NotNullable),
12578                Some(len) => len,
12579            };
12580            // Calling decoder.out_of_line_offset(0) is not allowed.
12581            if len == 0 {
12582                return Ok(());
12583            };
12584            depth.increment()?;
12585            let envelope_size = 8;
12586            let bytes_len = len * envelope_size;
12587            let offset = decoder.out_of_line_offset(bytes_len)?;
12588            // Decode the envelope for each type.
12589            let mut _next_ordinal_to_read = 0;
12590            let mut next_offset = offset;
12591            let end_offset = offset + bytes_len;
12592            _next_ordinal_to_read += 1;
12593            if next_offset >= end_offset {
12594                return Ok(());
12595            }
12596
12597            // Decode unknown envelopes for gaps in ordinals.
12598            while _next_ordinal_to_read < 1 {
12599                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12600                _next_ordinal_to_read += 1;
12601                next_offset += envelope_size;
12602            }
12603
12604            let next_out_of_line = decoder.next_out_of_line();
12605            let handles_before = decoder.remaining_handles();
12606            if let Some((inlined, num_bytes, num_handles)) =
12607                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12608            {
12609                let member_inline_size =
12610                    <ScreenshotFormat as fidl::encoding::TypeMarker>::inline_size(decoder.context);
12611                if inlined != (member_inline_size <= 4) {
12612                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12613                }
12614                let inner_offset;
12615                let mut inner_depth = depth.clone();
12616                if inlined {
12617                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12618                    inner_offset = next_offset;
12619                } else {
12620                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12621                    inner_depth.increment()?;
12622                }
12623                let val_ref = self.format.get_or_insert_with(|| {
12624                    fidl::new_empty!(
12625                        ScreenshotFormat,
12626                        fidl::encoding::DefaultFuchsiaResourceDialect
12627                    )
12628                });
12629                fidl::decode!(
12630                    ScreenshotFormat,
12631                    fidl::encoding::DefaultFuchsiaResourceDialect,
12632                    val_ref,
12633                    decoder,
12634                    inner_offset,
12635                    inner_depth
12636                )?;
12637                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12638                {
12639                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12640                }
12641                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12642                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12643                }
12644            }
12645
12646            next_offset += envelope_size;
12647
12648            // Decode the remaining unknown envelopes.
12649            while next_offset < end_offset {
12650                _next_ordinal_to_read += 1;
12651                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12652                next_offset += envelope_size;
12653            }
12654
12655            Ok(())
12656        }
12657    }
12658
12659    impl ScreenshotTakeFileResponse {
12660        #[inline(always)]
12661        fn max_ordinal_present(&self) -> u64 {
12662            if let Some(_) = self.size {
12663                return 2;
12664            }
12665            if let Some(_) = self.file {
12666                return 1;
12667            }
12668            0
12669        }
12670    }
12671
12672    impl fidl::encoding::ResourceTypeMarker for ScreenshotTakeFileResponse {
12673        type Borrowed<'a> = &'a mut Self;
12674        fn take_or_borrow<'a>(
12675            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12676        ) -> Self::Borrowed<'a> {
12677            value
12678        }
12679    }
12680
12681    unsafe impl fidl::encoding::TypeMarker for ScreenshotTakeFileResponse {
12682        type Owned = Self;
12683
12684        #[inline(always)]
12685        fn inline_align(_context: fidl::encoding::Context) -> usize {
12686            8
12687        }
12688
12689        #[inline(always)]
12690        fn inline_size(_context: fidl::encoding::Context) -> usize {
12691            16
12692        }
12693    }
12694
12695    unsafe impl
12696        fidl::encoding::Encode<
12697            ScreenshotTakeFileResponse,
12698            fidl::encoding::DefaultFuchsiaResourceDialect,
12699        > for &mut ScreenshotTakeFileResponse
12700    {
12701        unsafe fn encode(
12702            self,
12703            encoder: &mut fidl::encoding::Encoder<
12704                '_,
12705                fidl::encoding::DefaultFuchsiaResourceDialect,
12706            >,
12707            offset: usize,
12708            mut depth: fidl::encoding::Depth,
12709        ) -> fidl::Result<()> {
12710            encoder.debug_check_bounds::<ScreenshotTakeFileResponse>(offset);
12711            // Vector header
12712            let max_ordinal: u64 = self.max_ordinal_present();
12713            encoder.write_num(max_ordinal, offset);
12714            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
12715            // Calling encoder.out_of_line_offset(0) is not allowed.
12716            if max_ordinal == 0 {
12717                return Ok(());
12718            }
12719            depth.increment()?;
12720            let envelope_size = 8;
12721            let bytes_len = max_ordinal as usize * envelope_size;
12722            #[allow(unused_variables)]
12723            let offset = encoder.out_of_line_offset(bytes_len);
12724            let mut _prev_end_offset: usize = 0;
12725            if 1 > max_ordinal {
12726                return Ok(());
12727            }
12728
12729            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12730            // are envelope_size bytes.
12731            let cur_offset: usize = (1 - 1) * envelope_size;
12732
12733            // Zero reserved fields.
12734            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12735
12736            // Safety:
12737            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12738            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12739            //   envelope_size bytes, there is always sufficient room.
12740            fidl::encoding::encode_in_envelope_optional::<
12741                fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>>,
12742                fidl::encoding::DefaultFuchsiaResourceDialect,
12743            >(
12744                self.file.as_mut().map(
12745                    <fidl::encoding::Endpoint<
12746                        fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
12747                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
12748                ),
12749                encoder,
12750                offset + cur_offset,
12751                depth,
12752            )?;
12753
12754            _prev_end_offset = cur_offset + envelope_size;
12755            if 2 > max_ordinal {
12756                return Ok(());
12757            }
12758
12759            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12760            // are envelope_size bytes.
12761            let cur_offset: usize = (2 - 1) * envelope_size;
12762
12763            // Zero reserved fields.
12764            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12765
12766            // Safety:
12767            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12768            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12769            //   envelope_size bytes, there is always sufficient room.
12770            fidl::encoding::encode_in_envelope_optional::<
12771                fidl_fuchsia_math::SizeU,
12772                fidl::encoding::DefaultFuchsiaResourceDialect,
12773            >(
12774                self.size
12775                    .as_ref()
12776                    .map(<fidl_fuchsia_math::SizeU as fidl::encoding::ValueTypeMarker>::borrow),
12777                encoder,
12778                offset + cur_offset,
12779                depth,
12780            )?;
12781
12782            _prev_end_offset = cur_offset + envelope_size;
12783
12784            Ok(())
12785        }
12786    }
12787
12788    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
12789        for ScreenshotTakeFileResponse
12790    {
12791        #[inline(always)]
12792        fn new_empty() -> Self {
12793            Self::default()
12794        }
12795
12796        unsafe fn decode(
12797            &mut self,
12798            decoder: &mut fidl::encoding::Decoder<
12799                '_,
12800                fidl::encoding::DefaultFuchsiaResourceDialect,
12801            >,
12802            offset: usize,
12803            mut depth: fidl::encoding::Depth,
12804        ) -> fidl::Result<()> {
12805            decoder.debug_check_bounds::<Self>(offset);
12806            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
12807                None => return Err(fidl::Error::NotNullable),
12808                Some(len) => len,
12809            };
12810            // Calling decoder.out_of_line_offset(0) is not allowed.
12811            if len == 0 {
12812                return Ok(());
12813            };
12814            depth.increment()?;
12815            let envelope_size = 8;
12816            let bytes_len = len * envelope_size;
12817            let offset = decoder.out_of_line_offset(bytes_len)?;
12818            // Decode the envelope for each type.
12819            let mut _next_ordinal_to_read = 0;
12820            let mut next_offset = offset;
12821            let end_offset = offset + bytes_len;
12822            _next_ordinal_to_read += 1;
12823            if next_offset >= end_offset {
12824                return Ok(());
12825            }
12826
12827            // Decode unknown envelopes for gaps in ordinals.
12828            while _next_ordinal_to_read < 1 {
12829                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12830                _next_ordinal_to_read += 1;
12831                next_offset += envelope_size;
12832            }
12833
12834            let next_out_of_line = decoder.next_out_of_line();
12835            let handles_before = decoder.remaining_handles();
12836            if let Some((inlined, num_bytes, num_handles)) =
12837                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12838            {
12839                let member_inline_size = <fidl::encoding::Endpoint<
12840                    fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
12841                > as fidl::encoding::TypeMarker>::inline_size(
12842                    decoder.context
12843                );
12844                if inlined != (member_inline_size <= 4) {
12845                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12846                }
12847                let inner_offset;
12848                let mut inner_depth = depth.clone();
12849                if inlined {
12850                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12851                    inner_offset = next_offset;
12852                } else {
12853                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12854                    inner_depth.increment()?;
12855                }
12856                let val_ref = self.file.get_or_insert_with(|| {
12857                    fidl::new_empty!(
12858                        fidl::encoding::Endpoint<
12859                            fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
12860                        >,
12861                        fidl::encoding::DefaultFuchsiaResourceDialect
12862                    )
12863                });
12864                fidl::decode!(
12865                    fidl::encoding::Endpoint<
12866                        fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
12867                    >,
12868                    fidl::encoding::DefaultFuchsiaResourceDialect,
12869                    val_ref,
12870                    decoder,
12871                    inner_offset,
12872                    inner_depth
12873                )?;
12874                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12875                {
12876                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12877                }
12878                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12879                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12880                }
12881            }
12882
12883            next_offset += envelope_size;
12884            _next_ordinal_to_read += 1;
12885            if next_offset >= end_offset {
12886                return Ok(());
12887            }
12888
12889            // Decode unknown envelopes for gaps in ordinals.
12890            while _next_ordinal_to_read < 2 {
12891                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12892                _next_ordinal_to_read += 1;
12893                next_offset += envelope_size;
12894            }
12895
12896            let next_out_of_line = decoder.next_out_of_line();
12897            let handles_before = decoder.remaining_handles();
12898            if let Some((inlined, num_bytes, num_handles)) =
12899                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12900            {
12901                let member_inline_size =
12902                    <fidl_fuchsia_math::SizeU as fidl::encoding::TypeMarker>::inline_size(
12903                        decoder.context,
12904                    );
12905                if inlined != (member_inline_size <= 4) {
12906                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12907                }
12908                let inner_offset;
12909                let mut inner_depth = depth.clone();
12910                if inlined {
12911                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12912                    inner_offset = next_offset;
12913                } else {
12914                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12915                    inner_depth.increment()?;
12916                }
12917                let val_ref = self.size.get_or_insert_with(|| {
12918                    fidl::new_empty!(
12919                        fidl_fuchsia_math::SizeU,
12920                        fidl::encoding::DefaultFuchsiaResourceDialect
12921                    )
12922                });
12923                fidl::decode!(
12924                    fidl_fuchsia_math::SizeU,
12925                    fidl::encoding::DefaultFuchsiaResourceDialect,
12926                    val_ref,
12927                    decoder,
12928                    inner_offset,
12929                    inner_depth
12930                )?;
12931                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12932                {
12933                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12934                }
12935                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12936                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12937                }
12938            }
12939
12940            next_offset += envelope_size;
12941
12942            // Decode the remaining unknown envelopes.
12943            while next_offset < end_offset {
12944                _next_ordinal_to_read += 1;
12945                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12946                next_offset += envelope_size;
12947            }
12948
12949            Ok(())
12950        }
12951    }
12952
12953    impl ScreenshotTakeRequest {
12954        #[inline(always)]
12955        fn max_ordinal_present(&self) -> u64 {
12956            if let Some(_) = self.format {
12957                return 1;
12958            }
12959            0
12960        }
12961    }
12962
12963    impl fidl::encoding::ResourceTypeMarker for ScreenshotTakeRequest {
12964        type Borrowed<'a> = &'a mut Self;
12965        fn take_or_borrow<'a>(
12966            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12967        ) -> Self::Borrowed<'a> {
12968            value
12969        }
12970    }
12971
12972    unsafe impl fidl::encoding::TypeMarker for ScreenshotTakeRequest {
12973        type Owned = Self;
12974
12975        #[inline(always)]
12976        fn inline_align(_context: fidl::encoding::Context) -> usize {
12977            8
12978        }
12979
12980        #[inline(always)]
12981        fn inline_size(_context: fidl::encoding::Context) -> usize {
12982            16
12983        }
12984    }
12985
12986    unsafe impl
12987        fidl::encoding::Encode<ScreenshotTakeRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
12988        for &mut ScreenshotTakeRequest
12989    {
12990        unsafe fn encode(
12991            self,
12992            encoder: &mut fidl::encoding::Encoder<
12993                '_,
12994                fidl::encoding::DefaultFuchsiaResourceDialect,
12995            >,
12996            offset: usize,
12997            mut depth: fidl::encoding::Depth,
12998        ) -> fidl::Result<()> {
12999            encoder.debug_check_bounds::<ScreenshotTakeRequest>(offset);
13000            // Vector header
13001            let max_ordinal: u64 = self.max_ordinal_present();
13002            encoder.write_num(max_ordinal, offset);
13003            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
13004            // Calling encoder.out_of_line_offset(0) is not allowed.
13005            if max_ordinal == 0 {
13006                return Ok(());
13007            }
13008            depth.increment()?;
13009            let envelope_size = 8;
13010            let bytes_len = max_ordinal as usize * envelope_size;
13011            #[allow(unused_variables)]
13012            let offset = encoder.out_of_line_offset(bytes_len);
13013            let mut _prev_end_offset: usize = 0;
13014            if 1 > max_ordinal {
13015                return Ok(());
13016            }
13017
13018            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
13019            // are envelope_size bytes.
13020            let cur_offset: usize = (1 - 1) * envelope_size;
13021
13022            // Zero reserved fields.
13023            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
13024
13025            // Safety:
13026            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
13027            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
13028            //   envelope_size bytes, there is always sufficient room.
13029            fidl::encoding::encode_in_envelope_optional::<
13030                ScreenshotFormat,
13031                fidl::encoding::DefaultFuchsiaResourceDialect,
13032            >(
13033                self.format
13034                    .as_ref()
13035                    .map(<ScreenshotFormat as fidl::encoding::ValueTypeMarker>::borrow),
13036                encoder,
13037                offset + cur_offset,
13038                depth,
13039            )?;
13040
13041            _prev_end_offset = cur_offset + envelope_size;
13042
13043            Ok(())
13044        }
13045    }
13046
13047    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
13048        for ScreenshotTakeRequest
13049    {
13050        #[inline(always)]
13051        fn new_empty() -> Self {
13052            Self::default()
13053        }
13054
13055        unsafe fn decode(
13056            &mut self,
13057            decoder: &mut fidl::encoding::Decoder<
13058                '_,
13059                fidl::encoding::DefaultFuchsiaResourceDialect,
13060            >,
13061            offset: usize,
13062            mut depth: fidl::encoding::Depth,
13063        ) -> fidl::Result<()> {
13064            decoder.debug_check_bounds::<Self>(offset);
13065            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
13066                None => return Err(fidl::Error::NotNullable),
13067                Some(len) => len,
13068            };
13069            // Calling decoder.out_of_line_offset(0) is not allowed.
13070            if len == 0 {
13071                return Ok(());
13072            };
13073            depth.increment()?;
13074            let envelope_size = 8;
13075            let bytes_len = len * envelope_size;
13076            let offset = decoder.out_of_line_offset(bytes_len)?;
13077            // Decode the envelope for each type.
13078            let mut _next_ordinal_to_read = 0;
13079            let mut next_offset = offset;
13080            let end_offset = offset + bytes_len;
13081            _next_ordinal_to_read += 1;
13082            if next_offset >= end_offset {
13083                return Ok(());
13084            }
13085
13086            // Decode unknown envelopes for gaps in ordinals.
13087            while _next_ordinal_to_read < 1 {
13088                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13089                _next_ordinal_to_read += 1;
13090                next_offset += envelope_size;
13091            }
13092
13093            let next_out_of_line = decoder.next_out_of_line();
13094            let handles_before = decoder.remaining_handles();
13095            if let Some((inlined, num_bytes, num_handles)) =
13096                fidl::encoding::decode_envelope_header(decoder, next_offset)?
13097            {
13098                let member_inline_size =
13099                    <ScreenshotFormat as fidl::encoding::TypeMarker>::inline_size(decoder.context);
13100                if inlined != (member_inline_size <= 4) {
13101                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
13102                }
13103                let inner_offset;
13104                let mut inner_depth = depth.clone();
13105                if inlined {
13106                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
13107                    inner_offset = next_offset;
13108                } else {
13109                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
13110                    inner_depth.increment()?;
13111                }
13112                let val_ref = self.format.get_or_insert_with(|| {
13113                    fidl::new_empty!(
13114                        ScreenshotFormat,
13115                        fidl::encoding::DefaultFuchsiaResourceDialect
13116                    )
13117                });
13118                fidl::decode!(
13119                    ScreenshotFormat,
13120                    fidl::encoding::DefaultFuchsiaResourceDialect,
13121                    val_ref,
13122                    decoder,
13123                    inner_offset,
13124                    inner_depth
13125                )?;
13126                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
13127                {
13128                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
13129                }
13130                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
13131                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
13132                }
13133            }
13134
13135            next_offset += envelope_size;
13136
13137            // Decode the remaining unknown envelopes.
13138            while next_offset < end_offset {
13139                _next_ordinal_to_read += 1;
13140                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13141                next_offset += envelope_size;
13142            }
13143
13144            Ok(())
13145        }
13146    }
13147
13148    impl ScreenshotTakeResponse {
13149        #[inline(always)]
13150        fn max_ordinal_present(&self) -> u64 {
13151            if let Some(_) = self.size {
13152                return 2;
13153            }
13154            if let Some(_) = self.vmo {
13155                return 1;
13156            }
13157            0
13158        }
13159    }
13160
13161    impl fidl::encoding::ResourceTypeMarker for ScreenshotTakeResponse {
13162        type Borrowed<'a> = &'a mut Self;
13163        fn take_or_borrow<'a>(
13164            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
13165        ) -> Self::Borrowed<'a> {
13166            value
13167        }
13168    }
13169
13170    unsafe impl fidl::encoding::TypeMarker for ScreenshotTakeResponse {
13171        type Owned = Self;
13172
13173        #[inline(always)]
13174        fn inline_align(_context: fidl::encoding::Context) -> usize {
13175            8
13176        }
13177
13178        #[inline(always)]
13179        fn inline_size(_context: fidl::encoding::Context) -> usize {
13180            16
13181        }
13182    }
13183
13184    unsafe impl
13185        fidl::encoding::Encode<
13186            ScreenshotTakeResponse,
13187            fidl::encoding::DefaultFuchsiaResourceDialect,
13188        > for &mut ScreenshotTakeResponse
13189    {
13190        unsafe fn encode(
13191            self,
13192            encoder: &mut fidl::encoding::Encoder<
13193                '_,
13194                fidl::encoding::DefaultFuchsiaResourceDialect,
13195            >,
13196            offset: usize,
13197            mut depth: fidl::encoding::Depth,
13198        ) -> fidl::Result<()> {
13199            encoder.debug_check_bounds::<ScreenshotTakeResponse>(offset);
13200            // Vector header
13201            let max_ordinal: u64 = self.max_ordinal_present();
13202            encoder.write_num(max_ordinal, offset);
13203            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
13204            // Calling encoder.out_of_line_offset(0) is not allowed.
13205            if max_ordinal == 0 {
13206                return Ok(());
13207            }
13208            depth.increment()?;
13209            let envelope_size = 8;
13210            let bytes_len = max_ordinal as usize * envelope_size;
13211            #[allow(unused_variables)]
13212            let offset = encoder.out_of_line_offset(bytes_len);
13213            let mut _prev_end_offset: usize = 0;
13214            if 1 > max_ordinal {
13215                return Ok(());
13216            }
13217
13218            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
13219            // are envelope_size bytes.
13220            let cur_offset: usize = (1 - 1) * envelope_size;
13221
13222            // Zero reserved fields.
13223            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
13224
13225            // Safety:
13226            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
13227            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
13228            //   envelope_size bytes, there is always sufficient room.
13229            fidl::encoding::encode_in_envelope_optional::<
13230                fidl::encoding::HandleType<
13231                    fidl::Vmo,
13232                    { fidl::ObjectType::VMO.into_raw() },
13233                    2147483648,
13234                >,
13235                fidl::encoding::DefaultFuchsiaResourceDialect,
13236            >(
13237                self.vmo.as_mut().map(
13238                    <fidl::encoding::HandleType<
13239                        fidl::Vmo,
13240                        { fidl::ObjectType::VMO.into_raw() },
13241                        2147483648,
13242                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
13243                ),
13244                encoder,
13245                offset + cur_offset,
13246                depth,
13247            )?;
13248
13249            _prev_end_offset = cur_offset + envelope_size;
13250            if 2 > max_ordinal {
13251                return Ok(());
13252            }
13253
13254            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
13255            // are envelope_size bytes.
13256            let cur_offset: usize = (2 - 1) * envelope_size;
13257
13258            // Zero reserved fields.
13259            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
13260
13261            // Safety:
13262            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
13263            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
13264            //   envelope_size bytes, there is always sufficient room.
13265            fidl::encoding::encode_in_envelope_optional::<
13266                fidl_fuchsia_math::SizeU,
13267                fidl::encoding::DefaultFuchsiaResourceDialect,
13268            >(
13269                self.size
13270                    .as_ref()
13271                    .map(<fidl_fuchsia_math::SizeU as fidl::encoding::ValueTypeMarker>::borrow),
13272                encoder,
13273                offset + cur_offset,
13274                depth,
13275            )?;
13276
13277            _prev_end_offset = cur_offset + envelope_size;
13278
13279            Ok(())
13280        }
13281    }
13282
13283    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
13284        for ScreenshotTakeResponse
13285    {
13286        #[inline(always)]
13287        fn new_empty() -> Self {
13288            Self::default()
13289        }
13290
13291        unsafe fn decode(
13292            &mut self,
13293            decoder: &mut fidl::encoding::Decoder<
13294                '_,
13295                fidl::encoding::DefaultFuchsiaResourceDialect,
13296            >,
13297            offset: usize,
13298            mut depth: fidl::encoding::Depth,
13299        ) -> fidl::Result<()> {
13300            decoder.debug_check_bounds::<Self>(offset);
13301            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
13302                None => return Err(fidl::Error::NotNullable),
13303                Some(len) => len,
13304            };
13305            // Calling decoder.out_of_line_offset(0) is not allowed.
13306            if len == 0 {
13307                return Ok(());
13308            };
13309            depth.increment()?;
13310            let envelope_size = 8;
13311            let bytes_len = len * envelope_size;
13312            let offset = decoder.out_of_line_offset(bytes_len)?;
13313            // Decode the envelope for each type.
13314            let mut _next_ordinal_to_read = 0;
13315            let mut next_offset = offset;
13316            let end_offset = offset + bytes_len;
13317            _next_ordinal_to_read += 1;
13318            if next_offset >= end_offset {
13319                return Ok(());
13320            }
13321
13322            // Decode unknown envelopes for gaps in ordinals.
13323            while _next_ordinal_to_read < 1 {
13324                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13325                _next_ordinal_to_read += 1;
13326                next_offset += envelope_size;
13327            }
13328
13329            let next_out_of_line = decoder.next_out_of_line();
13330            let handles_before = decoder.remaining_handles();
13331            if let Some((inlined, num_bytes, num_handles)) =
13332                fidl::encoding::decode_envelope_header(decoder, next_offset)?
13333            {
13334                let member_inline_size = <fidl::encoding::HandleType<
13335                    fidl::Vmo,
13336                    { fidl::ObjectType::VMO.into_raw() },
13337                    2147483648,
13338                > as fidl::encoding::TypeMarker>::inline_size(
13339                    decoder.context
13340                );
13341                if inlined != (member_inline_size <= 4) {
13342                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
13343                }
13344                let inner_offset;
13345                let mut inner_depth = depth.clone();
13346                if inlined {
13347                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
13348                    inner_offset = next_offset;
13349                } else {
13350                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
13351                    inner_depth.increment()?;
13352                }
13353                let val_ref =
13354                self.vmo.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
13355                fidl::decode!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
13356                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
13357                {
13358                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
13359                }
13360                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
13361                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
13362                }
13363            }
13364
13365            next_offset += envelope_size;
13366            _next_ordinal_to_read += 1;
13367            if next_offset >= end_offset {
13368                return Ok(());
13369            }
13370
13371            // Decode unknown envelopes for gaps in ordinals.
13372            while _next_ordinal_to_read < 2 {
13373                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13374                _next_ordinal_to_read += 1;
13375                next_offset += envelope_size;
13376            }
13377
13378            let next_out_of_line = decoder.next_out_of_line();
13379            let handles_before = decoder.remaining_handles();
13380            if let Some((inlined, num_bytes, num_handles)) =
13381                fidl::encoding::decode_envelope_header(decoder, next_offset)?
13382            {
13383                let member_inline_size =
13384                    <fidl_fuchsia_math::SizeU as fidl::encoding::TypeMarker>::inline_size(
13385                        decoder.context,
13386                    );
13387                if inlined != (member_inline_size <= 4) {
13388                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
13389                }
13390                let inner_offset;
13391                let mut inner_depth = depth.clone();
13392                if inlined {
13393                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
13394                    inner_offset = next_offset;
13395                } else {
13396                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
13397                    inner_depth.increment()?;
13398                }
13399                let val_ref = self.size.get_or_insert_with(|| {
13400                    fidl::new_empty!(
13401                        fidl_fuchsia_math::SizeU,
13402                        fidl::encoding::DefaultFuchsiaResourceDialect
13403                    )
13404                });
13405                fidl::decode!(
13406                    fidl_fuchsia_math::SizeU,
13407                    fidl::encoding::DefaultFuchsiaResourceDialect,
13408                    val_ref,
13409                    decoder,
13410                    inner_offset,
13411                    inner_depth
13412                )?;
13413                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
13414                {
13415                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
13416                }
13417                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
13418                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
13419                }
13420            }
13421
13422            next_offset += envelope_size;
13423
13424            // Decode the remaining unknown envelopes.
13425            while next_offset < end_offset {
13426                _next_ordinal_to_read += 1;
13427                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13428                next_offset += envelope_size;
13429            }
13430
13431            Ok(())
13432        }
13433    }
13434
13435    impl TrustedFlatlandConfig {
13436        #[inline(always)]
13437        fn max_ordinal_present(&self) -> u64 {
13438            if let Some(_) = self.skips_present_credits {
13439                return 3;
13440            }
13441            if let Some(_) = self.pass_acquire_fences {
13442                return 2;
13443            }
13444            if let Some(_) = self.schedule_asap {
13445                return 1;
13446            }
13447            0
13448        }
13449    }
13450
13451    impl fidl::encoding::ResourceTypeMarker for TrustedFlatlandConfig {
13452        type Borrowed<'a> = &'a mut Self;
13453        fn take_or_borrow<'a>(
13454            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
13455        ) -> Self::Borrowed<'a> {
13456            value
13457        }
13458    }
13459
13460    unsafe impl fidl::encoding::TypeMarker for TrustedFlatlandConfig {
13461        type Owned = Self;
13462
13463        #[inline(always)]
13464        fn inline_align(_context: fidl::encoding::Context) -> usize {
13465            8
13466        }
13467
13468        #[inline(always)]
13469        fn inline_size(_context: fidl::encoding::Context) -> usize {
13470            16
13471        }
13472    }
13473
13474    unsafe impl
13475        fidl::encoding::Encode<TrustedFlatlandConfig, fidl::encoding::DefaultFuchsiaResourceDialect>
13476        for &mut TrustedFlatlandConfig
13477    {
13478        unsafe fn encode(
13479            self,
13480            encoder: &mut fidl::encoding::Encoder<
13481                '_,
13482                fidl::encoding::DefaultFuchsiaResourceDialect,
13483            >,
13484            offset: usize,
13485            mut depth: fidl::encoding::Depth,
13486        ) -> fidl::Result<()> {
13487            encoder.debug_check_bounds::<TrustedFlatlandConfig>(offset);
13488            // Vector header
13489            let max_ordinal: u64 = self.max_ordinal_present();
13490            encoder.write_num(max_ordinal, offset);
13491            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
13492            // Calling encoder.out_of_line_offset(0) is not allowed.
13493            if max_ordinal == 0 {
13494                return Ok(());
13495            }
13496            depth.increment()?;
13497            let envelope_size = 8;
13498            let bytes_len = max_ordinal as usize * envelope_size;
13499            #[allow(unused_variables)]
13500            let offset = encoder.out_of_line_offset(bytes_len);
13501            let mut _prev_end_offset: usize = 0;
13502            if 1 > max_ordinal {
13503                return Ok(());
13504            }
13505
13506            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
13507            // are envelope_size bytes.
13508            let cur_offset: usize = (1 - 1) * envelope_size;
13509
13510            // Zero reserved fields.
13511            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
13512
13513            // Safety:
13514            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
13515            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
13516            //   envelope_size bytes, there is always sufficient room.
13517            fidl::encoding::encode_in_envelope_optional::<
13518                bool,
13519                fidl::encoding::DefaultFuchsiaResourceDialect,
13520            >(
13521                self.schedule_asap.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
13522                encoder,
13523                offset + cur_offset,
13524                depth,
13525            )?;
13526
13527            _prev_end_offset = cur_offset + envelope_size;
13528            if 2 > max_ordinal {
13529                return Ok(());
13530            }
13531
13532            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
13533            // are envelope_size bytes.
13534            let cur_offset: usize = (2 - 1) * envelope_size;
13535
13536            // Zero reserved fields.
13537            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
13538
13539            // Safety:
13540            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
13541            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
13542            //   envelope_size bytes, there is always sufficient room.
13543            fidl::encoding::encode_in_envelope_optional::<
13544                bool,
13545                fidl::encoding::DefaultFuchsiaResourceDialect,
13546            >(
13547                self.pass_acquire_fences
13548                    .as_ref()
13549                    .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
13550                encoder,
13551                offset + cur_offset,
13552                depth,
13553            )?;
13554
13555            _prev_end_offset = cur_offset + envelope_size;
13556            if 3 > max_ordinal {
13557                return Ok(());
13558            }
13559
13560            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
13561            // are envelope_size bytes.
13562            let cur_offset: usize = (3 - 1) * envelope_size;
13563
13564            // Zero reserved fields.
13565            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
13566
13567            // Safety:
13568            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
13569            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
13570            //   envelope_size bytes, there is always sufficient room.
13571            fidl::encoding::encode_in_envelope_optional::<
13572                bool,
13573                fidl::encoding::DefaultFuchsiaResourceDialect,
13574            >(
13575                self.skips_present_credits
13576                    .as_ref()
13577                    .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
13578                encoder,
13579                offset + cur_offset,
13580                depth,
13581            )?;
13582
13583            _prev_end_offset = cur_offset + envelope_size;
13584
13585            Ok(())
13586        }
13587    }
13588
13589    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
13590        for TrustedFlatlandConfig
13591    {
13592        #[inline(always)]
13593        fn new_empty() -> Self {
13594            Self::default()
13595        }
13596
13597        unsafe fn decode(
13598            &mut self,
13599            decoder: &mut fidl::encoding::Decoder<
13600                '_,
13601                fidl::encoding::DefaultFuchsiaResourceDialect,
13602            >,
13603            offset: usize,
13604            mut depth: fidl::encoding::Depth,
13605        ) -> fidl::Result<()> {
13606            decoder.debug_check_bounds::<Self>(offset);
13607            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
13608                None => return Err(fidl::Error::NotNullable),
13609                Some(len) => len,
13610            };
13611            // Calling decoder.out_of_line_offset(0) is not allowed.
13612            if len == 0 {
13613                return Ok(());
13614            };
13615            depth.increment()?;
13616            let envelope_size = 8;
13617            let bytes_len = len * envelope_size;
13618            let offset = decoder.out_of_line_offset(bytes_len)?;
13619            // Decode the envelope for each type.
13620            let mut _next_ordinal_to_read = 0;
13621            let mut next_offset = offset;
13622            let end_offset = offset + bytes_len;
13623            _next_ordinal_to_read += 1;
13624            if next_offset >= end_offset {
13625                return Ok(());
13626            }
13627
13628            // Decode unknown envelopes for gaps in ordinals.
13629            while _next_ordinal_to_read < 1 {
13630                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13631                _next_ordinal_to_read += 1;
13632                next_offset += envelope_size;
13633            }
13634
13635            let next_out_of_line = decoder.next_out_of_line();
13636            let handles_before = decoder.remaining_handles();
13637            if let Some((inlined, num_bytes, num_handles)) =
13638                fidl::encoding::decode_envelope_header(decoder, next_offset)?
13639            {
13640                let member_inline_size =
13641                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
13642                if inlined != (member_inline_size <= 4) {
13643                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
13644                }
13645                let inner_offset;
13646                let mut inner_depth = depth.clone();
13647                if inlined {
13648                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
13649                    inner_offset = next_offset;
13650                } else {
13651                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
13652                    inner_depth.increment()?;
13653                }
13654                let val_ref = self.schedule_asap.get_or_insert_with(|| {
13655                    fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
13656                });
13657                fidl::decode!(
13658                    bool,
13659                    fidl::encoding::DefaultFuchsiaResourceDialect,
13660                    val_ref,
13661                    decoder,
13662                    inner_offset,
13663                    inner_depth
13664                )?;
13665                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
13666                {
13667                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
13668                }
13669                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
13670                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
13671                }
13672            }
13673
13674            next_offset += envelope_size;
13675            _next_ordinal_to_read += 1;
13676            if next_offset >= end_offset {
13677                return Ok(());
13678            }
13679
13680            // Decode unknown envelopes for gaps in ordinals.
13681            while _next_ordinal_to_read < 2 {
13682                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13683                _next_ordinal_to_read += 1;
13684                next_offset += envelope_size;
13685            }
13686
13687            let next_out_of_line = decoder.next_out_of_line();
13688            let handles_before = decoder.remaining_handles();
13689            if let Some((inlined, num_bytes, num_handles)) =
13690                fidl::encoding::decode_envelope_header(decoder, next_offset)?
13691            {
13692                let member_inline_size =
13693                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
13694                if inlined != (member_inline_size <= 4) {
13695                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
13696                }
13697                let inner_offset;
13698                let mut inner_depth = depth.clone();
13699                if inlined {
13700                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
13701                    inner_offset = next_offset;
13702                } else {
13703                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
13704                    inner_depth.increment()?;
13705                }
13706                let val_ref = self.pass_acquire_fences.get_or_insert_with(|| {
13707                    fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
13708                });
13709                fidl::decode!(
13710                    bool,
13711                    fidl::encoding::DefaultFuchsiaResourceDialect,
13712                    val_ref,
13713                    decoder,
13714                    inner_offset,
13715                    inner_depth
13716                )?;
13717                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
13718                {
13719                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
13720                }
13721                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
13722                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
13723                }
13724            }
13725
13726            next_offset += envelope_size;
13727            _next_ordinal_to_read += 1;
13728            if next_offset >= end_offset {
13729                return Ok(());
13730            }
13731
13732            // Decode unknown envelopes for gaps in ordinals.
13733            while _next_ordinal_to_read < 3 {
13734                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13735                _next_ordinal_to_read += 1;
13736                next_offset += envelope_size;
13737            }
13738
13739            let next_out_of_line = decoder.next_out_of_line();
13740            let handles_before = decoder.remaining_handles();
13741            if let Some((inlined, num_bytes, num_handles)) =
13742                fidl::encoding::decode_envelope_header(decoder, next_offset)?
13743            {
13744                let member_inline_size =
13745                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
13746                if inlined != (member_inline_size <= 4) {
13747                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
13748                }
13749                let inner_offset;
13750                let mut inner_depth = depth.clone();
13751                if inlined {
13752                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
13753                    inner_offset = next_offset;
13754                } else {
13755                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
13756                    inner_depth.increment()?;
13757                }
13758                let val_ref = self.skips_present_credits.get_or_insert_with(|| {
13759                    fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
13760                });
13761                fidl::decode!(
13762                    bool,
13763                    fidl::encoding::DefaultFuchsiaResourceDialect,
13764                    val_ref,
13765                    decoder,
13766                    inner_offset,
13767                    inner_depth
13768                )?;
13769                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
13770                {
13771                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
13772                }
13773                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
13774                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
13775                }
13776            }
13777
13778            next_offset += envelope_size;
13779
13780            // Decode the remaining unknown envelopes.
13781            while next_offset < end_offset {
13782                _next_ordinal_to_read += 1;
13783                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13784                next_offset += envelope_size;
13785            }
13786
13787            Ok(())
13788        }
13789    }
13790
13791    impl ViewBoundProtocols {
13792        #[inline(always)]
13793        fn max_ordinal_present(&self) -> u64 {
13794            if let Some(_) = self.mouse_source {
13795                return 4;
13796            }
13797            if let Some(_) = self.touch_source {
13798                return 3;
13799            }
13800            if let Some(_) = self.view_focuser {
13801                return 2;
13802            }
13803            if let Some(_) = self.view_ref_focused {
13804                return 1;
13805            }
13806            0
13807        }
13808    }
13809
13810    impl fidl::encoding::ResourceTypeMarker for ViewBoundProtocols {
13811        type Borrowed<'a> = &'a mut Self;
13812        fn take_or_borrow<'a>(
13813            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
13814        ) -> Self::Borrowed<'a> {
13815            value
13816        }
13817    }
13818
13819    unsafe impl fidl::encoding::TypeMarker for ViewBoundProtocols {
13820        type Owned = Self;
13821
13822        #[inline(always)]
13823        fn inline_align(_context: fidl::encoding::Context) -> usize {
13824            8
13825        }
13826
13827        #[inline(always)]
13828        fn inline_size(_context: fidl::encoding::Context) -> usize {
13829            16
13830        }
13831    }
13832
13833    unsafe impl
13834        fidl::encoding::Encode<ViewBoundProtocols, fidl::encoding::DefaultFuchsiaResourceDialect>
13835        for &mut ViewBoundProtocols
13836    {
13837        unsafe fn encode(
13838            self,
13839            encoder: &mut fidl::encoding::Encoder<
13840                '_,
13841                fidl::encoding::DefaultFuchsiaResourceDialect,
13842            >,
13843            offset: usize,
13844            mut depth: fidl::encoding::Depth,
13845        ) -> fidl::Result<()> {
13846            encoder.debug_check_bounds::<ViewBoundProtocols>(offset);
13847            // Vector header
13848            let max_ordinal: u64 = self.max_ordinal_present();
13849            encoder.write_num(max_ordinal, offset);
13850            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
13851            // Calling encoder.out_of_line_offset(0) is not allowed.
13852            if max_ordinal == 0 {
13853                return Ok(());
13854            }
13855            depth.increment()?;
13856            let envelope_size = 8;
13857            let bytes_len = max_ordinal as usize * envelope_size;
13858            #[allow(unused_variables)]
13859            let offset = encoder.out_of_line_offset(bytes_len);
13860            let mut _prev_end_offset: usize = 0;
13861            if 1 > max_ordinal {
13862                return Ok(());
13863            }
13864
13865            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
13866            // are envelope_size bytes.
13867            let cur_offset: usize = (1 - 1) * envelope_size;
13868
13869            // Zero reserved fields.
13870            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
13871
13872            // Safety:
13873            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
13874            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
13875            //   envelope_size bytes, there is always sufficient room.
13876            fidl::encoding::encode_in_envelope_optional::<
13877                fidl::encoding::Endpoint<
13878                    fidl::endpoints::ServerEnd<fidl_fuchsia_ui_views::ViewRefFocusedMarker>,
13879                >,
13880                fidl::encoding::DefaultFuchsiaResourceDialect,
13881            >(
13882                self.view_ref_focused.as_mut().map(
13883                    <fidl::encoding::Endpoint<
13884                        fidl::endpoints::ServerEnd<fidl_fuchsia_ui_views::ViewRefFocusedMarker>,
13885                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
13886                ),
13887                encoder,
13888                offset + cur_offset,
13889                depth,
13890            )?;
13891
13892            _prev_end_offset = cur_offset + envelope_size;
13893            if 2 > max_ordinal {
13894                return Ok(());
13895            }
13896
13897            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
13898            // are envelope_size bytes.
13899            let cur_offset: usize = (2 - 1) * envelope_size;
13900
13901            // Zero reserved fields.
13902            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
13903
13904            // Safety:
13905            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
13906            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
13907            //   envelope_size bytes, there is always sufficient room.
13908            fidl::encoding::encode_in_envelope_optional::<
13909                fidl::encoding::Endpoint<
13910                    fidl::endpoints::ServerEnd<fidl_fuchsia_ui_views::FocuserMarker>,
13911                >,
13912                fidl::encoding::DefaultFuchsiaResourceDialect,
13913            >(
13914                self.view_focuser.as_mut().map(
13915                    <fidl::encoding::Endpoint<
13916                        fidl::endpoints::ServerEnd<fidl_fuchsia_ui_views::FocuserMarker>,
13917                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
13918                ),
13919                encoder,
13920                offset + cur_offset,
13921                depth,
13922            )?;
13923
13924            _prev_end_offset = cur_offset + envelope_size;
13925            if 3 > max_ordinal {
13926                return Ok(());
13927            }
13928
13929            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
13930            // are envelope_size bytes.
13931            let cur_offset: usize = (3 - 1) * envelope_size;
13932
13933            // Zero reserved fields.
13934            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
13935
13936            // Safety:
13937            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
13938            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
13939            //   envelope_size bytes, there is always sufficient room.
13940            fidl::encoding::encode_in_envelope_optional::<
13941                fidl::encoding::Endpoint<
13942                    fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::TouchSourceMarker>,
13943                >,
13944                fidl::encoding::DefaultFuchsiaResourceDialect,
13945            >(
13946                self.touch_source.as_mut().map(
13947                    <fidl::encoding::Endpoint<
13948                        fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::TouchSourceMarker>,
13949                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
13950                ),
13951                encoder,
13952                offset + cur_offset,
13953                depth,
13954            )?;
13955
13956            _prev_end_offset = cur_offset + envelope_size;
13957            if 4 > max_ordinal {
13958                return Ok(());
13959            }
13960
13961            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
13962            // are envelope_size bytes.
13963            let cur_offset: usize = (4 - 1) * envelope_size;
13964
13965            // Zero reserved fields.
13966            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
13967
13968            // Safety:
13969            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
13970            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
13971            //   envelope_size bytes, there is always sufficient room.
13972            fidl::encoding::encode_in_envelope_optional::<
13973                fidl::encoding::Endpoint<
13974                    fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::MouseSourceMarker>,
13975                >,
13976                fidl::encoding::DefaultFuchsiaResourceDialect,
13977            >(
13978                self.mouse_source.as_mut().map(
13979                    <fidl::encoding::Endpoint<
13980                        fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::MouseSourceMarker>,
13981                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
13982                ),
13983                encoder,
13984                offset + cur_offset,
13985                depth,
13986            )?;
13987
13988            _prev_end_offset = cur_offset + envelope_size;
13989
13990            Ok(())
13991        }
13992    }
13993
13994    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
13995        for ViewBoundProtocols
13996    {
13997        #[inline(always)]
13998        fn new_empty() -> Self {
13999            Self::default()
14000        }
14001
14002        unsafe fn decode(
14003            &mut self,
14004            decoder: &mut fidl::encoding::Decoder<
14005                '_,
14006                fidl::encoding::DefaultFuchsiaResourceDialect,
14007            >,
14008            offset: usize,
14009            mut depth: fidl::encoding::Depth,
14010        ) -> fidl::Result<()> {
14011            decoder.debug_check_bounds::<Self>(offset);
14012            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
14013                None => return Err(fidl::Error::NotNullable),
14014                Some(len) => len,
14015            };
14016            // Calling decoder.out_of_line_offset(0) is not allowed.
14017            if len == 0 {
14018                return Ok(());
14019            };
14020            depth.increment()?;
14021            let envelope_size = 8;
14022            let bytes_len = len * envelope_size;
14023            let offset = decoder.out_of_line_offset(bytes_len)?;
14024            // Decode the envelope for each type.
14025            let mut _next_ordinal_to_read = 0;
14026            let mut next_offset = offset;
14027            let end_offset = offset + bytes_len;
14028            _next_ordinal_to_read += 1;
14029            if next_offset >= end_offset {
14030                return Ok(());
14031            }
14032
14033            // Decode unknown envelopes for gaps in ordinals.
14034            while _next_ordinal_to_read < 1 {
14035                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
14036                _next_ordinal_to_read += 1;
14037                next_offset += envelope_size;
14038            }
14039
14040            let next_out_of_line = decoder.next_out_of_line();
14041            let handles_before = decoder.remaining_handles();
14042            if let Some((inlined, num_bytes, num_handles)) =
14043                fidl::encoding::decode_envelope_header(decoder, next_offset)?
14044            {
14045                let member_inline_size = <fidl::encoding::Endpoint<
14046                    fidl::endpoints::ServerEnd<fidl_fuchsia_ui_views::ViewRefFocusedMarker>,
14047                > as fidl::encoding::TypeMarker>::inline_size(
14048                    decoder.context
14049                );
14050                if inlined != (member_inline_size <= 4) {
14051                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
14052                }
14053                let inner_offset;
14054                let mut inner_depth = depth.clone();
14055                if inlined {
14056                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
14057                    inner_offset = next_offset;
14058                } else {
14059                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
14060                    inner_depth.increment()?;
14061                }
14062                let val_ref = self.view_ref_focused.get_or_insert_with(|| {
14063                    fidl::new_empty!(
14064                        fidl::encoding::Endpoint<
14065                            fidl::endpoints::ServerEnd<fidl_fuchsia_ui_views::ViewRefFocusedMarker>,
14066                        >,
14067                        fidl::encoding::DefaultFuchsiaResourceDialect
14068                    )
14069                });
14070                fidl::decode!(
14071                    fidl::encoding::Endpoint<
14072                        fidl::endpoints::ServerEnd<fidl_fuchsia_ui_views::ViewRefFocusedMarker>,
14073                    >,
14074                    fidl::encoding::DefaultFuchsiaResourceDialect,
14075                    val_ref,
14076                    decoder,
14077                    inner_offset,
14078                    inner_depth
14079                )?;
14080                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
14081                {
14082                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
14083                }
14084                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
14085                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
14086                }
14087            }
14088
14089            next_offset += envelope_size;
14090            _next_ordinal_to_read += 1;
14091            if next_offset >= end_offset {
14092                return Ok(());
14093            }
14094
14095            // Decode unknown envelopes for gaps in ordinals.
14096            while _next_ordinal_to_read < 2 {
14097                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
14098                _next_ordinal_to_read += 1;
14099                next_offset += envelope_size;
14100            }
14101
14102            let next_out_of_line = decoder.next_out_of_line();
14103            let handles_before = decoder.remaining_handles();
14104            if let Some((inlined, num_bytes, num_handles)) =
14105                fidl::encoding::decode_envelope_header(decoder, next_offset)?
14106            {
14107                let member_inline_size = <fidl::encoding::Endpoint<
14108                    fidl::endpoints::ServerEnd<fidl_fuchsia_ui_views::FocuserMarker>,
14109                > as fidl::encoding::TypeMarker>::inline_size(
14110                    decoder.context
14111                );
14112                if inlined != (member_inline_size <= 4) {
14113                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
14114                }
14115                let inner_offset;
14116                let mut inner_depth = depth.clone();
14117                if inlined {
14118                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
14119                    inner_offset = next_offset;
14120                } else {
14121                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
14122                    inner_depth.increment()?;
14123                }
14124                let val_ref = self.view_focuser.get_or_insert_with(|| {
14125                    fidl::new_empty!(
14126                        fidl::encoding::Endpoint<
14127                            fidl::endpoints::ServerEnd<fidl_fuchsia_ui_views::FocuserMarker>,
14128                        >,
14129                        fidl::encoding::DefaultFuchsiaResourceDialect
14130                    )
14131                });
14132                fidl::decode!(
14133                    fidl::encoding::Endpoint<
14134                        fidl::endpoints::ServerEnd<fidl_fuchsia_ui_views::FocuserMarker>,
14135                    >,
14136                    fidl::encoding::DefaultFuchsiaResourceDialect,
14137                    val_ref,
14138                    decoder,
14139                    inner_offset,
14140                    inner_depth
14141                )?;
14142                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
14143                {
14144                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
14145                }
14146                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
14147                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
14148                }
14149            }
14150
14151            next_offset += envelope_size;
14152            _next_ordinal_to_read += 1;
14153            if next_offset >= end_offset {
14154                return Ok(());
14155            }
14156
14157            // Decode unknown envelopes for gaps in ordinals.
14158            while _next_ordinal_to_read < 3 {
14159                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
14160                _next_ordinal_to_read += 1;
14161                next_offset += envelope_size;
14162            }
14163
14164            let next_out_of_line = decoder.next_out_of_line();
14165            let handles_before = decoder.remaining_handles();
14166            if let Some((inlined, num_bytes, num_handles)) =
14167                fidl::encoding::decode_envelope_header(decoder, next_offset)?
14168            {
14169                let member_inline_size = <fidl::encoding::Endpoint<
14170                    fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::TouchSourceMarker>,
14171                > as fidl::encoding::TypeMarker>::inline_size(
14172                    decoder.context
14173                );
14174                if inlined != (member_inline_size <= 4) {
14175                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
14176                }
14177                let inner_offset;
14178                let mut inner_depth = depth.clone();
14179                if inlined {
14180                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
14181                    inner_offset = next_offset;
14182                } else {
14183                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
14184                    inner_depth.increment()?;
14185                }
14186                let val_ref = self.touch_source.get_or_insert_with(|| {
14187                    fidl::new_empty!(
14188                        fidl::encoding::Endpoint<
14189                            fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::TouchSourceMarker>,
14190                        >,
14191                        fidl::encoding::DefaultFuchsiaResourceDialect
14192                    )
14193                });
14194                fidl::decode!(
14195                    fidl::encoding::Endpoint<
14196                        fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::TouchSourceMarker>,
14197                    >,
14198                    fidl::encoding::DefaultFuchsiaResourceDialect,
14199                    val_ref,
14200                    decoder,
14201                    inner_offset,
14202                    inner_depth
14203                )?;
14204                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
14205                {
14206                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
14207                }
14208                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
14209                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
14210                }
14211            }
14212
14213            next_offset += envelope_size;
14214            _next_ordinal_to_read += 1;
14215            if next_offset >= end_offset {
14216                return Ok(());
14217            }
14218
14219            // Decode unknown envelopes for gaps in ordinals.
14220            while _next_ordinal_to_read < 4 {
14221                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
14222                _next_ordinal_to_read += 1;
14223                next_offset += envelope_size;
14224            }
14225
14226            let next_out_of_line = decoder.next_out_of_line();
14227            let handles_before = decoder.remaining_handles();
14228            if let Some((inlined, num_bytes, num_handles)) =
14229                fidl::encoding::decode_envelope_header(decoder, next_offset)?
14230            {
14231                let member_inline_size = <fidl::encoding::Endpoint<
14232                    fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::MouseSourceMarker>,
14233                > as fidl::encoding::TypeMarker>::inline_size(
14234                    decoder.context
14235                );
14236                if inlined != (member_inline_size <= 4) {
14237                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
14238                }
14239                let inner_offset;
14240                let mut inner_depth = depth.clone();
14241                if inlined {
14242                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
14243                    inner_offset = next_offset;
14244                } else {
14245                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
14246                    inner_depth.increment()?;
14247                }
14248                let val_ref = self.mouse_source.get_or_insert_with(|| {
14249                    fidl::new_empty!(
14250                        fidl::encoding::Endpoint<
14251                            fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::MouseSourceMarker>,
14252                        >,
14253                        fidl::encoding::DefaultFuchsiaResourceDialect
14254                    )
14255                });
14256                fidl::decode!(
14257                    fidl::encoding::Endpoint<
14258                        fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::MouseSourceMarker>,
14259                    >,
14260                    fidl::encoding::DefaultFuchsiaResourceDialect,
14261                    val_ref,
14262                    decoder,
14263                    inner_offset,
14264                    inner_depth
14265                )?;
14266                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
14267                {
14268                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
14269                }
14270                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
14271                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
14272                }
14273            }
14274
14275            next_offset += envelope_size;
14276
14277            // Decode the remaining unknown envelopes.
14278            while next_offset < end_offset {
14279                _next_ordinal_to_read += 1;
14280                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
14281                next_offset += envelope_size;
14282            }
14283
14284            Ok(())
14285        }
14286    }
14287}