fidl_fuchsia_ui_composition/
fidl_fuchsia_ui_composition.rs

1// WARNING: This file is machine generated by fidlgen.
2
3#![warn(clippy::all)]
4#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
5
6use bitflags::bitflags;
7use fidl::client::QueryResponseFut;
8use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
9use fidl::endpoints::{ControlHandle as _, Responder as _};
10pub use fidl_fuchsia_ui_composition__common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, PartialEq)]
15pub struct AllocatorRegisterBufferCollectionRequest {
16    pub args: RegisterBufferCollectionArgs,
17}
18
19impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
20    for AllocatorRegisterBufferCollectionRequest
21{
22}
23
24/// A typed wrapper for an eventpair, representing the registry endpoint of a buffer collection.
25#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
26pub struct BufferCollectionExportToken {
27    pub value: fidl::EventPair,
28}
29
30impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
31    for BufferCollectionExportToken
32{
33}
34
35/// A typed wrapper for an eventpair, representing the Image import endpoint of a buffer
36/// collection.
37#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
38pub struct BufferCollectionImportToken {
39    pub value: fidl::EventPair,
40}
41
42impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
43    for BufferCollectionImportToken
44{
45}
46
47#[derive(Debug, PartialEq)]
48pub struct ChildViewWatcherGetViewRefResponse {
49    pub view_ref: fidl_fuchsia_ui_views::ViewRef,
50}
51
52impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
53    for ChildViewWatcherGetViewRefResponse
54{
55}
56
57#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
58#[repr(C)]
59pub struct FlatlandCreateFilledRectRequest {
60    pub rect_id: ContentId,
61}
62
63impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
64    for FlatlandCreateFilledRectRequest
65{
66}
67
68#[derive(Debug, PartialEq)]
69pub struct FlatlandCreateImageRequest {
70    pub image_id: ContentId,
71    pub import_token: BufferCollectionImportToken,
72    pub vmo_index: u32,
73    pub properties: ImageProperties,
74}
75
76impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
77    for FlatlandCreateImageRequest
78{
79}
80
81#[derive(Debug, PartialEq)]
82pub struct FlatlandCreateView2Request {
83    /// A typed wrapper for a channel, representing the child endpoint of the connection
84    /// between two Flatland instances.
85    pub token: fidl_fuchsia_ui_views::ViewCreationToken,
86    /// The ViewRef to strongly associate with [`token`].
87    pub view_identity: fidl_fuchsia_ui_views::ViewIdentityOnCreation,
88    /// The protocol endpoints that are strongly bound to the ViewRef in [`view_identity`].
89    /// The protocols are bound when the view is created and installed in the view tree.
90    pub protocols: ViewBoundProtocols,
91    pub parent_viewport_watcher: fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>,
92}
93
94impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
95    for FlatlandCreateView2Request
96{
97}
98
99#[derive(Debug, PartialEq)]
100pub struct FlatlandCreateViewRequest {
101    pub token: fidl_fuchsia_ui_views::ViewCreationToken,
102    pub parent_viewport_watcher: fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>,
103}
104
105impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for FlatlandCreateViewRequest {}
106
107#[derive(Debug, PartialEq)]
108pub struct FlatlandCreateViewportRequest {
109    pub viewport_id: ContentId,
110    /// A typed wrapper for a channel, representing the parent endpoint of the connection
111    /// between two Flatland instances.
112    pub token: fidl_fuchsia_ui_views::ViewportCreationToken,
113    pub properties: ViewportProperties,
114    pub child_view_watcher: fidl::endpoints::ServerEnd<ChildViewWatcherMarker>,
115}
116
117impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
118    for FlatlandCreateViewportRequest
119{
120}
121
122#[derive(Debug, PartialEq)]
123pub struct FlatlandDisplaySetContentRequest {
124    pub token: fidl_fuchsia_ui_views::ViewportCreationToken,
125    pub child_view_watcher: fidl::endpoints::ServerEnd<ChildViewWatcherMarker>,
126}
127
128impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
129    for FlatlandDisplaySetContentRequest
130{
131}
132
133#[derive(Debug, PartialEq)]
134pub struct FlatlandPresentRequest {
135    pub args: PresentArgs,
136}
137
138impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for FlatlandPresentRequest {}
139
140#[derive(Debug, PartialEq)]
141pub struct FlatlandReleaseViewportResponse {
142    pub token: fidl_fuchsia_ui_views::ViewportCreationToken,
143}
144
145impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
146    for FlatlandReleaseViewportResponse
147{
148}
149
150#[derive(Debug, PartialEq)]
151pub struct FlatlandSetSolidFillRequest {
152    pub rect_id: ContentId,
153    pub color: ColorRgba,
154    pub size: fidl_fuchsia_math::SizeU,
155}
156
157impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
158    for FlatlandSetSolidFillRequest
159{
160}
161
162#[derive(Debug, PartialEq)]
163pub struct TrustedFlatlandFactoryCreateFlatlandRequest {
164    /// The server end of the `fuchsia.ui.composition.Flatland` protocol to be created.
165    pub server_end: fidl::endpoints::ServerEnd<FlatlandMarker>,
166    /// The configuration for the new Flatland instance. See `TrustedFlatlandConfig` for
167    /// details on available options.
168    pub config: TrustedFlatlandConfig,
169}
170
171impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
172    for TrustedFlatlandFactoryCreateFlatlandRequest
173{
174}
175
176/// Metadata about the frame rendered by [`GetNextFrame`].
177#[derive(Debug, Default, PartialEq)]
178pub struct FrameInfo {
179    /// The index of the VMO where the requested frame has been rendered. Required.
180    pub buffer_id: Option<u32>,
181    #[doc(hidden)]
182    pub __source_breaking: fidl::marker::SourceBreaking,
183}
184
185impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for FrameInfo {}
186
187/// The arguments passed into the [`GetNextFrame`] call. All fields are necessary.
188#[derive(Debug, Default, PartialEq)]
189pub struct GetNextFrameArgs {
190    /// The event that will signal when the requested frame has been rendered. Required.
191    pub event: Option<fidl::Event>,
192    #[doc(hidden)]
193    pub __source_breaking: fidl::marker::SourceBreaking,
194}
195
196impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for GetNextFrameArgs {}
197
198/// Arguments passed into [`Present`]. All arguments are optional, and if an
199/// argument is omitted Flatland will use a reasonable default, specified below.
200#[derive(Debug, Default, PartialEq)]
201pub struct PresentArgs {
202    /// `requested_presentation_time` specifies the time on or after which the client would like the
203    /// enqueued operations to take visible effect (light up pixels on the screen), expressed in
204    /// nanoseconds in the `CLOCK_MONOTONIC` timebase.
205    ///
206    /// The default `requested_presentation_time` is 0.
207    ///
208    /// Using a `requested_presentation_time` in the present or past (such as 0) schedules enqueued
209    /// operations to take visible effect as soon as possible, during the next frame to be prepared.
210    ///
211    /// Using a `requested_presentation_time` in the future schedules the enqueued operations to
212    /// take visible effect on or as closely as possible after the stated time, but no earlier.
213    ///
214    /// Each rendered frame has a target presentation time. This is when Flatland aims to have the
215    /// frame presented to the user. Before rendering a frame, Flatland applies all
216    /// enqueued operations associated with all squashable calls to [`Present`] whose
217    /// `requested_presentation_time` is on or before the frame's target presentation time.
218    pub requested_presentation_time: Option<i64>,
219    /// Flatland will wait until all of a Flatland instance's `acquire_fences` are ready before it
220    /// will execute the presented commands. Not signaling `acquire_fences` will block the current
221    /// [`Present`] as well as the following ones even if their `acquire_fences` are signaled.
222    ///
223    /// The default `acquire_fences` value is the empty vector.
224    pub acquire_fences: Option<Vec<fidl::Event>>,
225    /// Flatland will signal all `release_fences` when it is safe to reuse resources which no longer
226    /// appear in the local scene graph at the time of the current [`Present`].  At the latest, this
227    /// will happen when the local scene graph (checkpointed at this [`Present`]) has been
228    /// integrated into the global scene graph, and the global scene has been displayed on screen.
229    ///
230    /// (Under some circumstances, the fences may be signaled earlier, but clients do not need to
231    /// worry about this: the fences will only be signaled when it is safe to reuse the associated
232    /// resources).
233    ///
234    /// These fences are intended to manage the reuse of shared memory resources such as sysmem
235    /// buffers.  For example, it is undesirable for the client to render into an image which is
236    /// currently displayed on screen, because this may result in graphical artifacts such as
237    /// tearing.
238    ///
239    /// It is up to the client to maintain the mapping between each fence and the resources which
240    /// will become reusable when the fence is signaled.  A common strategy is to keep track of
241    /// resources which were used by the previous [`Present`] but are no longer used by the current
242    /// [`Present`].  For example, if an image is removed from the scene by the current [`Present`],
243    /// the client would insert a fence here.  When the fence is later signaled, the client knows
244    /// that it is safe to render into the image and insert it into the local scene graph in a
245    /// subsequent [`Present`].
246    ///
247    /// If an error occurs, Flatland may close the channel without signaling these fences.  Clients
248    /// may immediately release shared buffers, but they should not immediately modify such buffers,
249    /// because they may still be displayed on screen.  There is currently no good signal available
250    /// to the client about when it is safe to reuse shared buffers.
251    ///
252    /// The default `release_fences` value is the empty vector.
253    pub release_fences: Option<Vec<fidl::Event>>,
254    /// If `unsquashable` is true, then the update is guaranteed to be uniquely shown for at
255    /// least one vsync interval.
256    ///
257    /// If `unsquashable` is false, then the update can be combined with those that come after
258    /// it.
259    ///
260    /// If absent, `unsquashable` is false.
261    pub unsquashable: Option<bool>,
262    #[doc(hidden)]
263    pub __source_breaking: fidl::marker::SourceBreaking,
264}
265
266impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for PresentArgs {}
267
268/// The table of arguments for [`RegisterBufferCollection`]. Note that some
269/// fields below are REQUIRED.
270#[derive(Debug, Default, PartialEq)]
271pub struct RegisterBufferCollectionArgs {
272    /// Clients can send [`export_token`] to register buffer collections with Allocator to be used
273    /// later in [`fuchsia.ui.composition/Flatland`] instances or other Scenic APIs, such as
274    /// Screenshot.
275    ///
276    /// For example, by passing a [`BufferCollectionImportToken`] containing the matching peer of
277    /// [`BufferCollectionExportToken`], they can create image resources via
278    /// [`fuchsia.ui.composition/Flatland.CreateImage`].
279    ///
280    /// Clients should wait for the response before using `import_token`.
281    ///
282    /// This field is REQUIRED.
283    pub export_token: Option<BufferCollectionExportToken>,
284    pub buffer_collection_token:
285        Option<fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem::BufferCollectionTokenMarker>>,
286    /// The client can register a buffer collection for various uses, each
287    /// coming with their own unique constraints.
288    ///
289    /// This field is OPTIONAL. If `usage` is omitted it will be treated as if
290    /// it has the DEFAULT option.
291    ///
292    /// # Deprecation
293    ///
294    /// This arg is deprecated at API version 9 with addition of |usages|.
295    ///
296    /// If both the `usages` and `usage` fields are set, `usages` takes precedence and `usage` is
297    /// ignored.
298    pub usage: Option<RegisterBufferCollectionUsage>,
299    /// The client can register a buffer collection for various uses and has the ability to
300    /// combine usages if multiple are needed.
301    ///
302    /// This field is OPTIONAL. If `usages` is omitted it will be treated as if
303    /// it has only the DEFAULT option.
304    pub usages: Option<RegisterBufferCollectionUsages>,
305    /// Flatland participates in the allocation of buffers by setting constraints on the
306    /// BufferCollection referenced by `buffer_collection_token`. It will not block on buffers
307    /// being allocated until the client creates content using the BufferCollection.
308    ///
309    /// The buffer collection registered with `export_token` is available and kept alive as long
310    /// as the client holds a valid [`BufferCollectionImportToken`]. They will be garbage collected
311    /// when all [`BufferCollectionImportToken`]s are closed and all the associated Image resources
312    /// are released.
313    ///
314    /// Exactly one of `buffer_collection_token2` / `buffer_collection_token` must be set.
315    pub buffer_collection_token2:
316        Option<fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem2::BufferCollectionTokenMarker>>,
317    #[doc(hidden)]
318    pub __source_breaking: fidl::marker::SourceBreaking,
319}
320
321impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
322    for RegisterBufferCollectionArgs
323{
324}
325
326/// The arguments passed into the [`Configure`] call. Note that not all fields are necessary.
327#[derive(Debug, Default, PartialEq)]
328pub struct ScreenCaptureConfig {
329    /// The import token referencing a BufferCollection registered with
330    /// Allocator. Required.
331    pub import_token: Option<BufferCollectionImportToken>,
332    /// The size of the image in pixels. Required.
333    pub size: Option<fidl_fuchsia_math::SizeU>,
334    /// The number of buffers in the BufferCollection. Required.
335    pub buffer_count: Option<u32>,
336    /// The rotation to be applied to the stream of images. Optional; if absent no rotation is
337    /// applied.
338    pub rotation: Option<Rotation>,
339    #[doc(hidden)]
340    pub __source_breaking: fidl::marker::SourceBreaking,
341}
342
343impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for ScreenCaptureConfig {}
344
345#[derive(Debug, Default, PartialEq)]
346pub struct ScreenshotTakeFileRequest {
347    /// Format of the requested screenshot.
348    pub format: Option<ScreenshotFormat>,
349    #[doc(hidden)]
350    pub __source_breaking: fidl::marker::SourceBreaking,
351}
352
353impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for ScreenshotTakeFileRequest {}
354
355#[derive(Debug, Default, PartialEq)]
356pub struct ScreenshotTakeFileResponse {
357    /// |fuchsia.io.File| channel used to read the generated screenshot file data.
358    /// The server side of the channel is stored on the device until ZX_CHANNEL_PEER_CLOSED
359    /// is detected.
360    ///
361    /// Basic usage: After the client recieves the client end of the file channel,
362    /// to avoid memory pile-ups, it should finish reading the data
363    /// before calling [`TakeFile`] again. When finished reading,
364    /// the client should call [`Close`] on the |fuchsia.io.File| channel, this will release
365    /// the memory allocated on the server side.
366    pub file: Option<fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>>,
367    /// Size of the screenshot in pixels.
368    pub size: Option<fidl_fuchsia_math::SizeU>,
369    #[doc(hidden)]
370    pub __source_breaking: fidl::marker::SourceBreaking,
371}
372
373impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
374    for ScreenshotTakeFileResponse
375{
376}
377
378#[derive(Debug, Default, PartialEq)]
379pub struct ScreenshotTakeRequest {
380    /// Format of the requested screenshot.
381    pub format: Option<ScreenshotFormat>,
382    #[doc(hidden)]
383    pub __source_breaking: fidl::marker::SourceBreaking,
384}
385
386impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for ScreenshotTakeRequest {}
387
388#[derive(Debug, Default, PartialEq)]
389pub struct ScreenshotTakeResponse {
390    /// CPU mappable read-only VMO that contains screenshot data. The server owns the VMO and
391    /// may reuse for the next [`Take`]. The VMO is guaranteed to be accessible after mapping.
392    /// In some allocations, VMO::read() might not be available, i.e. on emulator.
393    ///
394    /// Basic usage: After the client receives a VMO handle, to ensure data stability, it should
395    /// finish reading the VMO before calling [`Take`] again. When finished reading, the client
396    /// should drop the VMO handle.
397    ///
398    /// Advanced usage: To edit the data, or to persist it beyond the next [`Take`] call, the
399    /// client should copy the data to a private VMO.
400    pub vmo: Option<fidl::Vmo>,
401    /// Size of the screenshot in pixels.
402    pub size: Option<fidl_fuchsia_math::SizeU>,
403    #[doc(hidden)]
404    pub __source_breaking: fidl::marker::SourceBreaking,
405}
406
407impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for ScreenshotTakeResponse {}
408
409/// All arguments are optional; default values will be provided if they are absent.
410/// By default, the resulting Flatland will behave identically to connecting
411/// to the `fuchsia.ui.composition.Flatland` service instead of connecting via the factory.
412#[derive(Debug, Default, PartialEq)]
413pub struct TrustedFlatlandConfig {
414    /// If true, a frame will be scheduled to be presented as soon as all acquire fences are
415    /// signaled, instead of waiting for other clients to present in the same vsync. This can reduce
416    /// latency for this client, but may increase power consumption.
417    ///
418    /// If absent, `schedule_asap` is false.
419    pub schedule_asap: Option<bool>,
420    /// If true, Scenic should pass acquire fences to the drivers for composition HW, instead of
421    /// waiting for them on CPU. This can improve performance by reducing CPU overhead.
422    ///
423    /// If absent, `pass_acquire_fences` is false.
424    pub pass_acquire_fences: Option<bool>,
425    /// If true, the client will not utilize Flatland's built in frame-scheduling mechanism and
426    /// will ignore present credits, instead relying on their own flow control system.
427    ///
428    /// If absent, `skips_present_credits` is false.
429    pub skips_present_credits: Option<bool>,
430    #[doc(hidden)]
431    pub __source_breaking: fidl::marker::SourceBreaking,
432}
433
434impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for TrustedFlatlandConfig {}
435
436/// The protocol endpoints bound to a Flatland ViewCreationToken. These protocols operate on the
437/// View that ViewCreationToken created in the Flatland session.
438#[derive(Debug, Default, PartialEq)]
439pub struct ViewBoundProtocols {
440    /// Learn when a View gains focus.
441    ///
442    /// Server-bound ViewRef. The [`view_ref_focused`] client does not specify the ViewRef
443    /// explicitly; instead, the server implementation uses the ViewRef used in View creation for
444    /// reporting focus movement on/off this View.
445    pub view_ref_focused:
446        Option<fidl::endpoints::ServerEnd<fidl_fuchsia_ui_views::ViewRefFocusedMarker>>,
447    /// Enable a View to request focus transfer to a child (target) View.
448    ///
449    /// Server-bound ViewRef. The [`view_focuser`] client does not specify the "requestor" ViewRef
450    /// explicitly, only the "target" ViewRef. Instead, the server implementation uses the ViewRef
451    /// used in View creation as the "requestor" ViewRef.
452    pub view_focuser: Option<fidl::endpoints::ServerEnd<fidl_fuchsia_ui_views::FocuserMarker>>,
453    /// Receive touch events that are associated with a View.
454    pub touch_source:
455        Option<fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::TouchSourceMarker>>,
456    /// Receive mouse events that are associated with a View.
457    pub mouse_source:
458        Option<fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::MouseSourceMarker>>,
459    #[doc(hidden)]
460    pub __source_breaking: fidl::marker::SourceBreaking,
461}
462
463impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for ViewBoundProtocols {}
464
465#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
466pub struct AllocatorMarker;
467
468impl fidl::endpoints::ProtocolMarker for AllocatorMarker {
469    type Proxy = AllocatorProxy;
470    type RequestStream = AllocatorRequestStream;
471    #[cfg(target_os = "fuchsia")]
472    type SynchronousProxy = AllocatorSynchronousProxy;
473
474    const DEBUG_NAME: &'static str = "fuchsia.ui.composition.Allocator";
475}
476impl fidl::endpoints::DiscoverableProtocolMarker for AllocatorMarker {}
477pub type AllocatorRegisterBufferCollectionResult = Result<(), RegisterBufferCollectionError>;
478
479pub trait AllocatorProxyInterface: Send + Sync {
480    type RegisterBufferCollectionResponseFut: std::future::Future<Output = Result<AllocatorRegisterBufferCollectionResult, fidl::Error>>
481        + Send;
482    fn r#register_buffer_collection(
483        &self,
484        args: RegisterBufferCollectionArgs,
485    ) -> Self::RegisterBufferCollectionResponseFut;
486}
487#[derive(Debug)]
488#[cfg(target_os = "fuchsia")]
489pub struct AllocatorSynchronousProxy {
490    client: fidl::client::sync::Client,
491}
492
493#[cfg(target_os = "fuchsia")]
494impl fidl::endpoints::SynchronousProxy for AllocatorSynchronousProxy {
495    type Proxy = AllocatorProxy;
496    type Protocol = AllocatorMarker;
497
498    fn from_channel(inner: fidl::Channel) -> Self {
499        Self::new(inner)
500    }
501
502    fn into_channel(self) -> fidl::Channel {
503        self.client.into_channel()
504    }
505
506    fn as_channel(&self) -> &fidl::Channel {
507        self.client.as_channel()
508    }
509}
510
511#[cfg(target_os = "fuchsia")]
512impl AllocatorSynchronousProxy {
513    pub fn new(channel: fidl::Channel) -> Self {
514        let protocol_name = <AllocatorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
515        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
516    }
517
518    pub fn into_channel(self) -> fidl::Channel {
519        self.client.into_channel()
520    }
521
522    /// Waits until an event arrives and returns it. It is safe for other
523    /// threads to make concurrent requests while waiting for an event.
524    pub fn wait_for_event(
525        &self,
526        deadline: zx::MonotonicInstant,
527    ) -> Result<AllocatorEvent, fidl::Error> {
528        AllocatorEvent::decode(self.client.wait_for_event(deadline)?)
529    }
530
531    /// A BufferCollection is a set of VMOs created by Sysmem and shared by a number of
532    /// participants, one of which is the Flatland Renderer. Some content, such as Images, use a
533    /// BufferCollection as their backing memory.
534    ///
535    /// See [`RegisterBufferCollectionArgs`] for information on each argument.
536    pub fn r#register_buffer_collection(
537        &self,
538        mut args: RegisterBufferCollectionArgs,
539        ___deadline: zx::MonotonicInstant,
540    ) -> Result<AllocatorRegisterBufferCollectionResult, fidl::Error> {
541        let _response = self
542            .client
543            .send_query::<AllocatorRegisterBufferCollectionRequest, fidl::encoding::ResultType<
544                fidl::encoding::EmptyStruct,
545                RegisterBufferCollectionError,
546            >>(
547                (&mut args,),
548                0x494b7ea578d1061e,
549                fidl::encoding::DynamicFlags::empty(),
550                ___deadline,
551            )?;
552        Ok(_response.map(|x| x))
553    }
554}
555
556#[cfg(target_os = "fuchsia")]
557impl From<AllocatorSynchronousProxy> for zx::NullableHandle {
558    fn from(value: AllocatorSynchronousProxy) -> Self {
559        value.into_channel().into()
560    }
561}
562
563#[cfg(target_os = "fuchsia")]
564impl From<fidl::Channel> for AllocatorSynchronousProxy {
565    fn from(value: fidl::Channel) -> Self {
566        Self::new(value)
567    }
568}
569
570#[cfg(target_os = "fuchsia")]
571impl fidl::endpoints::FromClient for AllocatorSynchronousProxy {
572    type Protocol = AllocatorMarker;
573
574    fn from_client(value: fidl::endpoints::ClientEnd<AllocatorMarker>) -> Self {
575        Self::new(value.into_channel())
576    }
577}
578
579#[derive(Debug, Clone)]
580pub struct AllocatorProxy {
581    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
582}
583
584impl fidl::endpoints::Proxy for AllocatorProxy {
585    type Protocol = AllocatorMarker;
586
587    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
588        Self::new(inner)
589    }
590
591    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
592        self.client.into_channel().map_err(|client| Self { client })
593    }
594
595    fn as_channel(&self) -> &::fidl::AsyncChannel {
596        self.client.as_channel()
597    }
598}
599
600impl AllocatorProxy {
601    /// Create a new Proxy for fuchsia.ui.composition/Allocator.
602    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
603        let protocol_name = <AllocatorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
604        Self { client: fidl::client::Client::new(channel, protocol_name) }
605    }
606
607    /// Get a Stream of events from the remote end of the protocol.
608    ///
609    /// # Panics
610    ///
611    /// Panics if the event stream was already taken.
612    pub fn take_event_stream(&self) -> AllocatorEventStream {
613        AllocatorEventStream { event_receiver: self.client.take_event_receiver() }
614    }
615
616    /// A BufferCollection is a set of VMOs created by Sysmem and shared by a number of
617    /// participants, one of which is the Flatland Renderer. Some content, such as Images, use a
618    /// BufferCollection as their backing memory.
619    ///
620    /// See [`RegisterBufferCollectionArgs`] for information on each argument.
621    pub fn r#register_buffer_collection(
622        &self,
623        mut args: RegisterBufferCollectionArgs,
624    ) -> fidl::client::QueryResponseFut<
625        AllocatorRegisterBufferCollectionResult,
626        fidl::encoding::DefaultFuchsiaResourceDialect,
627    > {
628        AllocatorProxyInterface::r#register_buffer_collection(self, args)
629    }
630}
631
632impl AllocatorProxyInterface for AllocatorProxy {
633    type RegisterBufferCollectionResponseFut = fidl::client::QueryResponseFut<
634        AllocatorRegisterBufferCollectionResult,
635        fidl::encoding::DefaultFuchsiaResourceDialect,
636    >;
637    fn r#register_buffer_collection(
638        &self,
639        mut args: RegisterBufferCollectionArgs,
640    ) -> Self::RegisterBufferCollectionResponseFut {
641        fn _decode(
642            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
643        ) -> Result<AllocatorRegisterBufferCollectionResult, fidl::Error> {
644            let _response = fidl::client::decode_transaction_body::<
645                fidl::encoding::ResultType<
646                    fidl::encoding::EmptyStruct,
647                    RegisterBufferCollectionError,
648                >,
649                fidl::encoding::DefaultFuchsiaResourceDialect,
650                0x494b7ea578d1061e,
651            >(_buf?)?;
652            Ok(_response.map(|x| x))
653        }
654        self.client.send_query_and_decode::<
655            AllocatorRegisterBufferCollectionRequest,
656            AllocatorRegisterBufferCollectionResult,
657        >(
658            (&mut args,),
659            0x494b7ea578d1061e,
660            fidl::encoding::DynamicFlags::empty(),
661            _decode,
662        )
663    }
664}
665
666pub struct AllocatorEventStream {
667    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
668}
669
670impl std::marker::Unpin for AllocatorEventStream {}
671
672impl futures::stream::FusedStream for AllocatorEventStream {
673    fn is_terminated(&self) -> bool {
674        self.event_receiver.is_terminated()
675    }
676}
677
678impl futures::Stream for AllocatorEventStream {
679    type Item = Result<AllocatorEvent, fidl::Error>;
680
681    fn poll_next(
682        mut self: std::pin::Pin<&mut Self>,
683        cx: &mut std::task::Context<'_>,
684    ) -> std::task::Poll<Option<Self::Item>> {
685        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
686            &mut self.event_receiver,
687            cx
688        )?) {
689            Some(buf) => std::task::Poll::Ready(Some(AllocatorEvent::decode(buf))),
690            None => std::task::Poll::Ready(None),
691        }
692    }
693}
694
695#[derive(Debug)]
696pub enum AllocatorEvent {}
697
698impl AllocatorEvent {
699    /// Decodes a message buffer as a [`AllocatorEvent`].
700    fn decode(
701        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
702    ) -> Result<AllocatorEvent, fidl::Error> {
703        let (bytes, _handles) = buf.split_mut();
704        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
705        debug_assert_eq!(tx_header.tx_id, 0);
706        match tx_header.ordinal {
707            _ => Err(fidl::Error::UnknownOrdinal {
708                ordinal: tx_header.ordinal,
709                protocol_name: <AllocatorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
710            }),
711        }
712    }
713}
714
715/// A Stream of incoming requests for fuchsia.ui.composition/Allocator.
716pub struct AllocatorRequestStream {
717    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
718    is_terminated: bool,
719}
720
721impl std::marker::Unpin for AllocatorRequestStream {}
722
723impl futures::stream::FusedStream for AllocatorRequestStream {
724    fn is_terminated(&self) -> bool {
725        self.is_terminated
726    }
727}
728
729impl fidl::endpoints::RequestStream for AllocatorRequestStream {
730    type Protocol = AllocatorMarker;
731    type ControlHandle = AllocatorControlHandle;
732
733    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
734        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
735    }
736
737    fn control_handle(&self) -> Self::ControlHandle {
738        AllocatorControlHandle { inner: self.inner.clone() }
739    }
740
741    fn into_inner(
742        self,
743    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
744    {
745        (self.inner, self.is_terminated)
746    }
747
748    fn from_inner(
749        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
750        is_terminated: bool,
751    ) -> Self {
752        Self { inner, is_terminated }
753    }
754}
755
756impl futures::Stream for AllocatorRequestStream {
757    type Item = Result<AllocatorRequest, fidl::Error>;
758
759    fn poll_next(
760        mut self: std::pin::Pin<&mut Self>,
761        cx: &mut std::task::Context<'_>,
762    ) -> std::task::Poll<Option<Self::Item>> {
763        let this = &mut *self;
764        if this.inner.check_shutdown(cx) {
765            this.is_terminated = true;
766            return std::task::Poll::Ready(None);
767        }
768        if this.is_terminated {
769            panic!("polled AllocatorRequestStream after completion");
770        }
771        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
772            |bytes, handles| {
773                match this.inner.channel().read_etc(cx, bytes, handles) {
774                    std::task::Poll::Ready(Ok(())) => {}
775                    std::task::Poll::Pending => return std::task::Poll::Pending,
776                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
777                        this.is_terminated = true;
778                        return std::task::Poll::Ready(None);
779                    }
780                    std::task::Poll::Ready(Err(e)) => {
781                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
782                            e.into(),
783                        ))));
784                    }
785                }
786
787                // A message has been received from the channel
788                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
789
790                std::task::Poll::Ready(Some(match header.ordinal {
791                    0x494b7ea578d1061e => {
792                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
793                        let mut req = fidl::new_empty!(
794                            AllocatorRegisterBufferCollectionRequest,
795                            fidl::encoding::DefaultFuchsiaResourceDialect
796                        );
797                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AllocatorRegisterBufferCollectionRequest>(&header, _body_bytes, handles, &mut req)?;
798                        let control_handle = AllocatorControlHandle { inner: this.inner.clone() };
799                        Ok(AllocatorRequest::RegisterBufferCollection {
800                            args: req.args,
801
802                            responder: AllocatorRegisterBufferCollectionResponder {
803                                control_handle: std::mem::ManuallyDrop::new(control_handle),
804                                tx_id: header.tx_id,
805                            },
806                        })
807                    }
808                    _ => Err(fidl::Error::UnknownOrdinal {
809                        ordinal: header.ordinal,
810                        protocol_name:
811                            <AllocatorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
812                    }),
813                }))
814            },
815        )
816    }
817}
818
819#[derive(Debug)]
820pub enum AllocatorRequest {
821    /// A BufferCollection is a set of VMOs created by Sysmem and shared by a number of
822    /// participants, one of which is the Flatland Renderer. Some content, such as Images, use a
823    /// BufferCollection as their backing memory.
824    ///
825    /// See [`RegisterBufferCollectionArgs`] for information on each argument.
826    RegisterBufferCollection {
827        args: RegisterBufferCollectionArgs,
828        responder: AllocatorRegisterBufferCollectionResponder,
829    },
830}
831
832impl AllocatorRequest {
833    #[allow(irrefutable_let_patterns)]
834    pub fn into_register_buffer_collection(
835        self,
836    ) -> Option<(RegisterBufferCollectionArgs, AllocatorRegisterBufferCollectionResponder)> {
837        if let AllocatorRequest::RegisterBufferCollection { args, responder } = self {
838            Some((args, responder))
839        } else {
840            None
841        }
842    }
843
844    /// Name of the method defined in FIDL
845    pub fn method_name(&self) -> &'static str {
846        match *self {
847            AllocatorRequest::RegisterBufferCollection { .. } => "register_buffer_collection",
848        }
849    }
850}
851
852#[derive(Debug, Clone)]
853pub struct AllocatorControlHandle {
854    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
855}
856
857impl fidl::endpoints::ControlHandle for AllocatorControlHandle {
858    fn shutdown(&self) {
859        self.inner.shutdown()
860    }
861
862    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
863        self.inner.shutdown_with_epitaph(status)
864    }
865
866    fn is_closed(&self) -> bool {
867        self.inner.channel().is_closed()
868    }
869    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
870        self.inner.channel().on_closed()
871    }
872
873    #[cfg(target_os = "fuchsia")]
874    fn signal_peer(
875        &self,
876        clear_mask: zx::Signals,
877        set_mask: zx::Signals,
878    ) -> Result<(), zx_status::Status> {
879        use fidl::Peered;
880        self.inner.channel().signal_peer(clear_mask, set_mask)
881    }
882}
883
884impl AllocatorControlHandle {}
885
886#[must_use = "FIDL methods require a response to be sent"]
887#[derive(Debug)]
888pub struct AllocatorRegisterBufferCollectionResponder {
889    control_handle: std::mem::ManuallyDrop<AllocatorControlHandle>,
890    tx_id: u32,
891}
892
893/// Set the the channel to be shutdown (see [`AllocatorControlHandle::shutdown`])
894/// if the responder is dropped without sending a response, so that the client
895/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
896impl std::ops::Drop for AllocatorRegisterBufferCollectionResponder {
897    fn drop(&mut self) {
898        self.control_handle.shutdown();
899        // Safety: drops once, never accessed again
900        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
901    }
902}
903
904impl fidl::endpoints::Responder for AllocatorRegisterBufferCollectionResponder {
905    type ControlHandle = AllocatorControlHandle;
906
907    fn control_handle(&self) -> &AllocatorControlHandle {
908        &self.control_handle
909    }
910
911    fn drop_without_shutdown(mut self) {
912        // Safety: drops once, never accessed again due to mem::forget
913        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
914        // Prevent Drop from running (which would shut down the channel)
915        std::mem::forget(self);
916    }
917}
918
919impl AllocatorRegisterBufferCollectionResponder {
920    /// Sends a response to the FIDL transaction.
921    ///
922    /// Sets the channel to shutdown if an error occurs.
923    pub fn send(
924        self,
925        mut result: Result<(), RegisterBufferCollectionError>,
926    ) -> Result<(), fidl::Error> {
927        let _result = self.send_raw(result);
928        if _result.is_err() {
929            self.control_handle.shutdown();
930        }
931        self.drop_without_shutdown();
932        _result
933    }
934
935    /// Similar to "send" but does not shutdown the channel if an error occurs.
936    pub fn send_no_shutdown_on_err(
937        self,
938        mut result: Result<(), RegisterBufferCollectionError>,
939    ) -> Result<(), fidl::Error> {
940        let _result = self.send_raw(result);
941        self.drop_without_shutdown();
942        _result
943    }
944
945    fn send_raw(
946        &self,
947        mut result: Result<(), RegisterBufferCollectionError>,
948    ) -> Result<(), fidl::Error> {
949        self.control_handle.inner.send::<fidl::encoding::ResultType<
950            fidl::encoding::EmptyStruct,
951            RegisterBufferCollectionError,
952        >>(
953            result,
954            self.tx_id,
955            0x494b7ea578d1061e,
956            fidl::encoding::DynamicFlags::empty(),
957        )
958    }
959}
960
961#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
962pub struct ChildViewWatcherMarker;
963
964impl fidl::endpoints::ProtocolMarker for ChildViewWatcherMarker {
965    type Proxy = ChildViewWatcherProxy;
966    type RequestStream = ChildViewWatcherRequestStream;
967    #[cfg(target_os = "fuchsia")]
968    type SynchronousProxy = ChildViewWatcherSynchronousProxy;
969
970    const DEBUG_NAME: &'static str = "(anonymous) ChildViewWatcher";
971}
972
973pub trait ChildViewWatcherProxyInterface: Send + Sync {
974    type GetStatusResponseFut: std::future::Future<Output = Result<ChildViewStatus, fidl::Error>>
975        + Send;
976    fn r#get_status(&self) -> Self::GetStatusResponseFut;
977    type GetViewRefResponseFut: std::future::Future<Output = Result<fidl_fuchsia_ui_views::ViewRef, fidl::Error>>
978        + Send;
979    fn r#get_view_ref(&self) -> Self::GetViewRefResponseFut;
980}
981#[derive(Debug)]
982#[cfg(target_os = "fuchsia")]
983pub struct ChildViewWatcherSynchronousProxy {
984    client: fidl::client::sync::Client,
985}
986
987#[cfg(target_os = "fuchsia")]
988impl fidl::endpoints::SynchronousProxy for ChildViewWatcherSynchronousProxy {
989    type Proxy = ChildViewWatcherProxy;
990    type Protocol = ChildViewWatcherMarker;
991
992    fn from_channel(inner: fidl::Channel) -> Self {
993        Self::new(inner)
994    }
995
996    fn into_channel(self) -> fidl::Channel {
997        self.client.into_channel()
998    }
999
1000    fn as_channel(&self) -> &fidl::Channel {
1001        self.client.as_channel()
1002    }
1003}
1004
1005#[cfg(target_os = "fuchsia")]
1006impl ChildViewWatcherSynchronousProxy {
1007    pub fn new(channel: fidl::Channel) -> Self {
1008        let protocol_name = <ChildViewWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1009        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1010    }
1011
1012    pub fn into_channel(self) -> fidl::Channel {
1013        self.client.into_channel()
1014    }
1015
1016    /// Waits until an event arrives and returns it. It is safe for other
1017    /// threads to make concurrent requests while waiting for an event.
1018    pub fn wait_for_event(
1019        &self,
1020        deadline: zx::MonotonicInstant,
1021    ) -> Result<ChildViewWatcherEvent, fidl::Error> {
1022        ChildViewWatcherEvent::decode(self.client.wait_for_event(deadline)?)
1023    }
1024
1025    /// A hanging get for receiving the status of a View. This provides information to the parent,
1026    /// such as whether or not the child has successfully presented content through this View.
1027    ///
1028    /// This hanging get will only fire when the ChildViewStatus is different than the previously
1029    /// returned ChildViewStatus.  This can happen immediately, and even if the creator of the
1030    /// Viewport hasn't yet called Present() after calling CreateViewport().  This allows the parent
1031    /// to know that the child has content ready to display before the parent modifies their own
1032    /// local scene graph to incorporate the child content.
1033    ///
1034    /// It is invalid to call `GetStatus` while a previous call is still pending. Doing so will
1035    /// cause both this channel and the Flatland channel that handed out ChildViewWatcher to be
1036    /// closed.
1037    pub fn r#get_status(
1038        &self,
1039        ___deadline: zx::MonotonicInstant,
1040    ) -> Result<ChildViewStatus, fidl::Error> {
1041        let _response = self
1042            .client
1043            .send_query::<fidl::encoding::EmptyPayload, ChildViewWatcherGetStatusResponse>(
1044                (),
1045                0x1d622075f4fc8243,
1046                fidl::encoding::DynamicFlags::empty(),
1047                ___deadline,
1048            )?;
1049        Ok(_response.status)
1050    }
1051
1052    /// Hanging get to receive the ViewRef of the child View. This will only fire when the View ref
1053    /// is different from the previously-returned View ref. Note: currently the View ref will not
1054    /// change after it is first received, but this will change if/when the API changes to allow
1055    /// relinking of views.
1056    ///
1057    /// The ViewRef is not returned until the View is included in the View tree, in other words when
1058    /// there is a chain of ancestor transforms all the way back up to the root of the scene graph,
1059    /// i.e. the display.
1060    ///
1061    /// It is invalid to call `GetViewRef` while a previous call is still pending. Doing so will
1062    /// cause both this channel and the Flatland channel that handed out ChildViewWatcher to be
1063    /// closed.
1064    ///
1065    /// A `GetViewRef` call will hang if the View was created using `CreateView`, but returns the
1066    /// View if the View was created using CreateView2. This is because `CreateView` does not mint
1067    /// a ViewRef for that View.
1068    pub fn r#get_view_ref(
1069        &self,
1070        ___deadline: zx::MonotonicInstant,
1071    ) -> Result<fidl_fuchsia_ui_views::ViewRef, fidl::Error> {
1072        let _response = self
1073            .client
1074            .send_query::<fidl::encoding::EmptyPayload, ChildViewWatcherGetViewRefResponse>(
1075                (),
1076                0x3b2f3ca31e8908b4,
1077                fidl::encoding::DynamicFlags::empty(),
1078                ___deadline,
1079            )?;
1080        Ok(_response.view_ref)
1081    }
1082}
1083
1084#[cfg(target_os = "fuchsia")]
1085impl From<ChildViewWatcherSynchronousProxy> for zx::NullableHandle {
1086    fn from(value: ChildViewWatcherSynchronousProxy) -> Self {
1087        value.into_channel().into()
1088    }
1089}
1090
1091#[cfg(target_os = "fuchsia")]
1092impl From<fidl::Channel> for ChildViewWatcherSynchronousProxy {
1093    fn from(value: fidl::Channel) -> Self {
1094        Self::new(value)
1095    }
1096}
1097
1098#[cfg(target_os = "fuchsia")]
1099impl fidl::endpoints::FromClient for ChildViewWatcherSynchronousProxy {
1100    type Protocol = ChildViewWatcherMarker;
1101
1102    fn from_client(value: fidl::endpoints::ClientEnd<ChildViewWatcherMarker>) -> Self {
1103        Self::new(value.into_channel())
1104    }
1105}
1106
1107#[derive(Debug, Clone)]
1108pub struct ChildViewWatcherProxy {
1109    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1110}
1111
1112impl fidl::endpoints::Proxy for ChildViewWatcherProxy {
1113    type Protocol = ChildViewWatcherMarker;
1114
1115    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1116        Self::new(inner)
1117    }
1118
1119    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1120        self.client.into_channel().map_err(|client| Self { client })
1121    }
1122
1123    fn as_channel(&self) -> &::fidl::AsyncChannel {
1124        self.client.as_channel()
1125    }
1126}
1127
1128impl ChildViewWatcherProxy {
1129    /// Create a new Proxy for fuchsia.ui.composition/ChildViewWatcher.
1130    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1131        let protocol_name = <ChildViewWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1132        Self { client: fidl::client::Client::new(channel, protocol_name) }
1133    }
1134
1135    /// Get a Stream of events from the remote end of the protocol.
1136    ///
1137    /// # Panics
1138    ///
1139    /// Panics if the event stream was already taken.
1140    pub fn take_event_stream(&self) -> ChildViewWatcherEventStream {
1141        ChildViewWatcherEventStream { event_receiver: self.client.take_event_receiver() }
1142    }
1143
1144    /// A hanging get for receiving the status of a View. This provides information to the parent,
1145    /// such as whether or not the child has successfully presented content through this View.
1146    ///
1147    /// This hanging get will only fire when the ChildViewStatus is different than the previously
1148    /// returned ChildViewStatus.  This can happen immediately, and even if the creator of the
1149    /// Viewport hasn't yet called Present() after calling CreateViewport().  This allows the parent
1150    /// to know that the child has content ready to display before the parent modifies their own
1151    /// local scene graph to incorporate the child content.
1152    ///
1153    /// It is invalid to call `GetStatus` while a previous call is still pending. Doing so will
1154    /// cause both this channel and the Flatland channel that handed out ChildViewWatcher to be
1155    /// closed.
1156    pub fn r#get_status(
1157        &self,
1158    ) -> fidl::client::QueryResponseFut<
1159        ChildViewStatus,
1160        fidl::encoding::DefaultFuchsiaResourceDialect,
1161    > {
1162        ChildViewWatcherProxyInterface::r#get_status(self)
1163    }
1164
1165    /// Hanging get to receive the ViewRef of the child View. This will only fire when the View ref
1166    /// is different from the previously-returned View ref. Note: currently the View ref will not
1167    /// change after it is first received, but this will change if/when the API changes to allow
1168    /// relinking of views.
1169    ///
1170    /// The ViewRef is not returned until the View is included in the View tree, in other words when
1171    /// there is a chain of ancestor transforms all the way back up to the root of the scene graph,
1172    /// i.e. the display.
1173    ///
1174    /// It is invalid to call `GetViewRef` while a previous call is still pending. Doing so will
1175    /// cause both this channel and the Flatland channel that handed out ChildViewWatcher to be
1176    /// closed.
1177    ///
1178    /// A `GetViewRef` call will hang if the View was created using `CreateView`, but returns the
1179    /// View if the View was created using CreateView2. This is because `CreateView` does not mint
1180    /// a ViewRef for that View.
1181    pub fn r#get_view_ref(
1182        &self,
1183    ) -> fidl::client::QueryResponseFut<
1184        fidl_fuchsia_ui_views::ViewRef,
1185        fidl::encoding::DefaultFuchsiaResourceDialect,
1186    > {
1187        ChildViewWatcherProxyInterface::r#get_view_ref(self)
1188    }
1189}
1190
1191impl ChildViewWatcherProxyInterface for ChildViewWatcherProxy {
1192    type GetStatusResponseFut = fidl::client::QueryResponseFut<
1193        ChildViewStatus,
1194        fidl::encoding::DefaultFuchsiaResourceDialect,
1195    >;
1196    fn r#get_status(&self) -> Self::GetStatusResponseFut {
1197        fn _decode(
1198            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1199        ) -> Result<ChildViewStatus, fidl::Error> {
1200            let _response = fidl::client::decode_transaction_body::<
1201                ChildViewWatcherGetStatusResponse,
1202                fidl::encoding::DefaultFuchsiaResourceDialect,
1203                0x1d622075f4fc8243,
1204            >(_buf?)?;
1205            Ok(_response.status)
1206        }
1207        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ChildViewStatus>(
1208            (),
1209            0x1d622075f4fc8243,
1210            fidl::encoding::DynamicFlags::empty(),
1211            _decode,
1212        )
1213    }
1214
1215    type GetViewRefResponseFut = fidl::client::QueryResponseFut<
1216        fidl_fuchsia_ui_views::ViewRef,
1217        fidl::encoding::DefaultFuchsiaResourceDialect,
1218    >;
1219    fn r#get_view_ref(&self) -> Self::GetViewRefResponseFut {
1220        fn _decode(
1221            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1222        ) -> Result<fidl_fuchsia_ui_views::ViewRef, fidl::Error> {
1223            let _response = fidl::client::decode_transaction_body::<
1224                ChildViewWatcherGetViewRefResponse,
1225                fidl::encoding::DefaultFuchsiaResourceDialect,
1226                0x3b2f3ca31e8908b4,
1227            >(_buf?)?;
1228            Ok(_response.view_ref)
1229        }
1230        self.client
1231            .send_query_and_decode::<fidl::encoding::EmptyPayload, fidl_fuchsia_ui_views::ViewRef>(
1232                (),
1233                0x3b2f3ca31e8908b4,
1234                fidl::encoding::DynamicFlags::empty(),
1235                _decode,
1236            )
1237    }
1238}
1239
1240pub struct ChildViewWatcherEventStream {
1241    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1242}
1243
1244impl std::marker::Unpin for ChildViewWatcherEventStream {}
1245
1246impl futures::stream::FusedStream for ChildViewWatcherEventStream {
1247    fn is_terminated(&self) -> bool {
1248        self.event_receiver.is_terminated()
1249    }
1250}
1251
1252impl futures::Stream for ChildViewWatcherEventStream {
1253    type Item = Result<ChildViewWatcherEvent, fidl::Error>;
1254
1255    fn poll_next(
1256        mut self: std::pin::Pin<&mut Self>,
1257        cx: &mut std::task::Context<'_>,
1258    ) -> std::task::Poll<Option<Self::Item>> {
1259        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1260            &mut self.event_receiver,
1261            cx
1262        )?) {
1263            Some(buf) => std::task::Poll::Ready(Some(ChildViewWatcherEvent::decode(buf))),
1264            None => std::task::Poll::Ready(None),
1265        }
1266    }
1267}
1268
1269#[derive(Debug)]
1270pub enum ChildViewWatcherEvent {}
1271
1272impl ChildViewWatcherEvent {
1273    /// Decodes a message buffer as a [`ChildViewWatcherEvent`].
1274    fn decode(
1275        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1276    ) -> Result<ChildViewWatcherEvent, fidl::Error> {
1277        let (bytes, _handles) = buf.split_mut();
1278        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1279        debug_assert_eq!(tx_header.tx_id, 0);
1280        match tx_header.ordinal {
1281            _ => Err(fidl::Error::UnknownOrdinal {
1282                ordinal: tx_header.ordinal,
1283                protocol_name:
1284                    <ChildViewWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1285            }),
1286        }
1287    }
1288}
1289
1290/// A Stream of incoming requests for fuchsia.ui.composition/ChildViewWatcher.
1291pub struct ChildViewWatcherRequestStream {
1292    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1293    is_terminated: bool,
1294}
1295
1296impl std::marker::Unpin for ChildViewWatcherRequestStream {}
1297
1298impl futures::stream::FusedStream for ChildViewWatcherRequestStream {
1299    fn is_terminated(&self) -> bool {
1300        self.is_terminated
1301    }
1302}
1303
1304impl fidl::endpoints::RequestStream for ChildViewWatcherRequestStream {
1305    type Protocol = ChildViewWatcherMarker;
1306    type ControlHandle = ChildViewWatcherControlHandle;
1307
1308    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1309        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1310    }
1311
1312    fn control_handle(&self) -> Self::ControlHandle {
1313        ChildViewWatcherControlHandle { inner: self.inner.clone() }
1314    }
1315
1316    fn into_inner(
1317        self,
1318    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1319    {
1320        (self.inner, self.is_terminated)
1321    }
1322
1323    fn from_inner(
1324        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1325        is_terminated: bool,
1326    ) -> Self {
1327        Self { inner, is_terminated }
1328    }
1329}
1330
1331impl futures::Stream for ChildViewWatcherRequestStream {
1332    type Item = Result<ChildViewWatcherRequest, fidl::Error>;
1333
1334    fn poll_next(
1335        mut self: std::pin::Pin<&mut Self>,
1336        cx: &mut std::task::Context<'_>,
1337    ) -> std::task::Poll<Option<Self::Item>> {
1338        let this = &mut *self;
1339        if this.inner.check_shutdown(cx) {
1340            this.is_terminated = true;
1341            return std::task::Poll::Ready(None);
1342        }
1343        if this.is_terminated {
1344            panic!("polled ChildViewWatcherRequestStream after completion");
1345        }
1346        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1347            |bytes, handles| {
1348                match this.inner.channel().read_etc(cx, bytes, handles) {
1349                    std::task::Poll::Ready(Ok(())) => {}
1350                    std::task::Poll::Pending => return std::task::Poll::Pending,
1351                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1352                        this.is_terminated = true;
1353                        return std::task::Poll::Ready(None);
1354                    }
1355                    std::task::Poll::Ready(Err(e)) => {
1356                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1357                            e.into(),
1358                        ))));
1359                    }
1360                }
1361
1362                // A message has been received from the channel
1363                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1364
1365                std::task::Poll::Ready(Some(match header.ordinal {
1366                    0x1d622075f4fc8243 => {
1367                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1368                        let mut req = fidl::new_empty!(
1369                            fidl::encoding::EmptyPayload,
1370                            fidl::encoding::DefaultFuchsiaResourceDialect
1371                        );
1372                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1373                        let control_handle =
1374                            ChildViewWatcherControlHandle { inner: this.inner.clone() };
1375                        Ok(ChildViewWatcherRequest::GetStatus {
1376                            responder: ChildViewWatcherGetStatusResponder {
1377                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1378                                tx_id: header.tx_id,
1379                            },
1380                        })
1381                    }
1382                    0x3b2f3ca31e8908b4 => {
1383                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1384                        let mut req = fidl::new_empty!(
1385                            fidl::encoding::EmptyPayload,
1386                            fidl::encoding::DefaultFuchsiaResourceDialect
1387                        );
1388                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1389                        let control_handle =
1390                            ChildViewWatcherControlHandle { inner: this.inner.clone() };
1391                        Ok(ChildViewWatcherRequest::GetViewRef {
1392                            responder: ChildViewWatcherGetViewRefResponder {
1393                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1394                                tx_id: header.tx_id,
1395                            },
1396                        })
1397                    }
1398                    _ => Err(fidl::Error::UnknownOrdinal {
1399                        ordinal: header.ordinal,
1400                        protocol_name:
1401                            <ChildViewWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1402                    }),
1403                }))
1404            },
1405        )
1406    }
1407}
1408
1409/// A protocol that provides information about a particular child View which is attached to the
1410/// Viewport owned by the parent client; connections to this protocol are estabished in
1411/// [`CreateViewport`].  Since a Flatland instance may contain any number of Viewports, each of
1412/// which may or may not be attached to a transform, the client can maintain connections to an
1413/// equal number of ChildViewWatcher instances.
1414///
1415/// Each ChildViewWatcher instance will remain connected as long as the corresponding child View
1416/// exists; the connection will also be closed if the child's ViewCreationToken is dropped without
1417/// using it to create a View.
1418#[derive(Debug)]
1419pub enum ChildViewWatcherRequest {
1420    /// A hanging get for receiving the status of a View. This provides information to the parent,
1421    /// such as whether or not the child has successfully presented content through this View.
1422    ///
1423    /// This hanging get will only fire when the ChildViewStatus is different than the previously
1424    /// returned ChildViewStatus.  This can happen immediately, and even if the creator of the
1425    /// Viewport hasn't yet called Present() after calling CreateViewport().  This allows the parent
1426    /// to know that the child has content ready to display before the parent modifies their own
1427    /// local scene graph to incorporate the child content.
1428    ///
1429    /// It is invalid to call `GetStatus` while a previous call is still pending. Doing so will
1430    /// cause both this channel and the Flatland channel that handed out ChildViewWatcher to be
1431    /// closed.
1432    GetStatus { responder: ChildViewWatcherGetStatusResponder },
1433    /// Hanging get to receive the ViewRef of the child View. This will only fire when the View ref
1434    /// is different from the previously-returned View ref. Note: currently the View ref will not
1435    /// change after it is first received, but this will change if/when the API changes to allow
1436    /// relinking of views.
1437    ///
1438    /// The ViewRef is not returned until the View is included in the View tree, in other words when
1439    /// there is a chain of ancestor transforms all the way back up to the root of the scene graph,
1440    /// i.e. the display.
1441    ///
1442    /// It is invalid to call `GetViewRef` while a previous call is still pending. Doing so will
1443    /// cause both this channel and the Flatland channel that handed out ChildViewWatcher to be
1444    /// closed.
1445    ///
1446    /// A `GetViewRef` call will hang if the View was created using `CreateView`, but returns the
1447    /// View if the View was created using CreateView2. This is because `CreateView` does not mint
1448    /// a ViewRef for that View.
1449    GetViewRef { responder: ChildViewWatcherGetViewRefResponder },
1450}
1451
1452impl ChildViewWatcherRequest {
1453    #[allow(irrefutable_let_patterns)]
1454    pub fn into_get_status(self) -> Option<(ChildViewWatcherGetStatusResponder)> {
1455        if let ChildViewWatcherRequest::GetStatus { responder } = self {
1456            Some((responder))
1457        } else {
1458            None
1459        }
1460    }
1461
1462    #[allow(irrefutable_let_patterns)]
1463    pub fn into_get_view_ref(self) -> Option<(ChildViewWatcherGetViewRefResponder)> {
1464        if let ChildViewWatcherRequest::GetViewRef { responder } = self {
1465            Some((responder))
1466        } else {
1467            None
1468        }
1469    }
1470
1471    /// Name of the method defined in FIDL
1472    pub fn method_name(&self) -> &'static str {
1473        match *self {
1474            ChildViewWatcherRequest::GetStatus { .. } => "get_status",
1475            ChildViewWatcherRequest::GetViewRef { .. } => "get_view_ref",
1476        }
1477    }
1478}
1479
1480#[derive(Debug, Clone)]
1481pub struct ChildViewWatcherControlHandle {
1482    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1483}
1484
1485impl fidl::endpoints::ControlHandle for ChildViewWatcherControlHandle {
1486    fn shutdown(&self) {
1487        self.inner.shutdown()
1488    }
1489
1490    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1491        self.inner.shutdown_with_epitaph(status)
1492    }
1493
1494    fn is_closed(&self) -> bool {
1495        self.inner.channel().is_closed()
1496    }
1497    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1498        self.inner.channel().on_closed()
1499    }
1500
1501    #[cfg(target_os = "fuchsia")]
1502    fn signal_peer(
1503        &self,
1504        clear_mask: zx::Signals,
1505        set_mask: zx::Signals,
1506    ) -> Result<(), zx_status::Status> {
1507        use fidl::Peered;
1508        self.inner.channel().signal_peer(clear_mask, set_mask)
1509    }
1510}
1511
1512impl ChildViewWatcherControlHandle {}
1513
1514#[must_use = "FIDL methods require a response to be sent"]
1515#[derive(Debug)]
1516pub struct ChildViewWatcherGetStatusResponder {
1517    control_handle: std::mem::ManuallyDrop<ChildViewWatcherControlHandle>,
1518    tx_id: u32,
1519}
1520
1521/// Set the the channel to be shutdown (see [`ChildViewWatcherControlHandle::shutdown`])
1522/// if the responder is dropped without sending a response, so that the client
1523/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1524impl std::ops::Drop for ChildViewWatcherGetStatusResponder {
1525    fn drop(&mut self) {
1526        self.control_handle.shutdown();
1527        // Safety: drops once, never accessed again
1528        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1529    }
1530}
1531
1532impl fidl::endpoints::Responder for ChildViewWatcherGetStatusResponder {
1533    type ControlHandle = ChildViewWatcherControlHandle;
1534
1535    fn control_handle(&self) -> &ChildViewWatcherControlHandle {
1536        &self.control_handle
1537    }
1538
1539    fn drop_without_shutdown(mut self) {
1540        // Safety: drops once, never accessed again due to mem::forget
1541        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1542        // Prevent Drop from running (which would shut down the channel)
1543        std::mem::forget(self);
1544    }
1545}
1546
1547impl ChildViewWatcherGetStatusResponder {
1548    /// Sends a response to the FIDL transaction.
1549    ///
1550    /// Sets the channel to shutdown if an error occurs.
1551    pub fn send(self, mut status: ChildViewStatus) -> Result<(), fidl::Error> {
1552        let _result = self.send_raw(status);
1553        if _result.is_err() {
1554            self.control_handle.shutdown();
1555        }
1556        self.drop_without_shutdown();
1557        _result
1558    }
1559
1560    /// Similar to "send" but does not shutdown the channel if an error occurs.
1561    pub fn send_no_shutdown_on_err(self, mut status: ChildViewStatus) -> Result<(), fidl::Error> {
1562        let _result = self.send_raw(status);
1563        self.drop_without_shutdown();
1564        _result
1565    }
1566
1567    fn send_raw(&self, mut status: ChildViewStatus) -> Result<(), fidl::Error> {
1568        self.control_handle.inner.send::<ChildViewWatcherGetStatusResponse>(
1569            (status,),
1570            self.tx_id,
1571            0x1d622075f4fc8243,
1572            fidl::encoding::DynamicFlags::empty(),
1573        )
1574    }
1575}
1576
1577#[must_use = "FIDL methods require a response to be sent"]
1578#[derive(Debug)]
1579pub struct ChildViewWatcherGetViewRefResponder {
1580    control_handle: std::mem::ManuallyDrop<ChildViewWatcherControlHandle>,
1581    tx_id: u32,
1582}
1583
1584/// Set the the channel to be shutdown (see [`ChildViewWatcherControlHandle::shutdown`])
1585/// if the responder is dropped without sending a response, so that the client
1586/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1587impl std::ops::Drop for ChildViewWatcherGetViewRefResponder {
1588    fn drop(&mut self) {
1589        self.control_handle.shutdown();
1590        // Safety: drops once, never accessed again
1591        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1592    }
1593}
1594
1595impl fidl::endpoints::Responder for ChildViewWatcherGetViewRefResponder {
1596    type ControlHandle = ChildViewWatcherControlHandle;
1597
1598    fn control_handle(&self) -> &ChildViewWatcherControlHandle {
1599        &self.control_handle
1600    }
1601
1602    fn drop_without_shutdown(mut self) {
1603        // Safety: drops once, never accessed again due to mem::forget
1604        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1605        // Prevent Drop from running (which would shut down the channel)
1606        std::mem::forget(self);
1607    }
1608}
1609
1610impl ChildViewWatcherGetViewRefResponder {
1611    /// Sends a response to the FIDL transaction.
1612    ///
1613    /// Sets the channel to shutdown if an error occurs.
1614    pub fn send(self, mut view_ref: fidl_fuchsia_ui_views::ViewRef) -> Result<(), fidl::Error> {
1615        let _result = self.send_raw(view_ref);
1616        if _result.is_err() {
1617            self.control_handle.shutdown();
1618        }
1619        self.drop_without_shutdown();
1620        _result
1621    }
1622
1623    /// Similar to "send" but does not shutdown the channel if an error occurs.
1624    pub fn send_no_shutdown_on_err(
1625        self,
1626        mut view_ref: fidl_fuchsia_ui_views::ViewRef,
1627    ) -> Result<(), fidl::Error> {
1628        let _result = self.send_raw(view_ref);
1629        self.drop_without_shutdown();
1630        _result
1631    }
1632
1633    fn send_raw(&self, mut view_ref: fidl_fuchsia_ui_views::ViewRef) -> Result<(), fidl::Error> {
1634        self.control_handle.inner.send::<ChildViewWatcherGetViewRefResponse>(
1635            (&mut view_ref,),
1636            self.tx_id,
1637            0x3b2f3ca31e8908b4,
1638            fidl::encoding::DynamicFlags::empty(),
1639        )
1640    }
1641}
1642
1643#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1644pub struct FlatlandMarker;
1645
1646impl fidl::endpoints::ProtocolMarker for FlatlandMarker {
1647    type Proxy = FlatlandProxy;
1648    type RequestStream = FlatlandRequestStream;
1649    #[cfg(target_os = "fuchsia")]
1650    type SynchronousProxy = FlatlandSynchronousProxy;
1651
1652    const DEBUG_NAME: &'static str = "fuchsia.ui.composition.Flatland";
1653}
1654impl fidl::endpoints::DiscoverableProtocolMarker for FlatlandMarker {}
1655
1656pub trait FlatlandProxyInterface: Send + Sync {
1657    fn r#present(&self, args: PresentArgs) -> Result<(), fidl::Error>;
1658    fn r#create_view(
1659        &self,
1660        token: fidl_fuchsia_ui_views::ViewCreationToken,
1661        parent_viewport_watcher: fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>,
1662    ) -> Result<(), fidl::Error>;
1663    fn r#create_view2(
1664        &self,
1665        token: fidl_fuchsia_ui_views::ViewCreationToken,
1666        view_identity: fidl_fuchsia_ui_views::ViewIdentityOnCreation,
1667        protocols: ViewBoundProtocols,
1668        parent_viewport_watcher: fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>,
1669    ) -> Result<(), fidl::Error>;
1670    fn r#create_transform(&self, transform_id: &TransformId) -> Result<(), fidl::Error>;
1671    fn r#set_translation(
1672        &self,
1673        transform_id: &TransformId,
1674        translation: &fidl_fuchsia_math::Vec_,
1675    ) -> Result<(), fidl::Error>;
1676    fn r#set_orientation(
1677        &self,
1678        transform_id: &TransformId,
1679        orientation: Orientation,
1680    ) -> Result<(), fidl::Error>;
1681    fn r#set_scale(
1682        &self,
1683        transform_id: &TransformId,
1684        scale: &fidl_fuchsia_math::VecF,
1685    ) -> Result<(), fidl::Error>;
1686    fn r#set_opacity(&self, transform_id: &TransformId, value: f32) -> Result<(), fidl::Error>;
1687    fn r#set_clip_boundary(
1688        &self,
1689        transform_id: &TransformId,
1690        rect: Option<&fidl_fuchsia_math::Rect>,
1691    ) -> Result<(), fidl::Error>;
1692    fn r#add_child(
1693        &self,
1694        parent_transform_id: &TransformId,
1695        child_transform_id: &TransformId,
1696    ) -> Result<(), fidl::Error>;
1697    fn r#remove_child(
1698        &self,
1699        parent_transform_id: &TransformId,
1700        child_transform_id: &TransformId,
1701    ) -> Result<(), fidl::Error>;
1702    fn r#replace_children(
1703        &self,
1704        parent_transform_id: &TransformId,
1705        new_child_transform_ids: &[TransformId],
1706    ) -> Result<(), fidl::Error>;
1707    fn r#set_root_transform(&self, transform_id: &TransformId) -> Result<(), fidl::Error>;
1708    fn r#set_hit_regions(
1709        &self,
1710        transform_id: &TransformId,
1711        regions: &[HitRegion],
1712    ) -> Result<(), fidl::Error>;
1713    fn r#set_infinite_hit_region(
1714        &self,
1715        transform_id: &TransformId,
1716        hit_test: HitTestInteraction,
1717    ) -> Result<(), fidl::Error>;
1718    fn r#create_viewport(
1719        &self,
1720        viewport_id: &ContentId,
1721        token: fidl_fuchsia_ui_views::ViewportCreationToken,
1722        properties: &ViewportProperties,
1723        child_view_watcher: fidl::endpoints::ServerEnd<ChildViewWatcherMarker>,
1724    ) -> Result<(), fidl::Error>;
1725    fn r#create_image(
1726        &self,
1727        image_id: &ContentId,
1728        import_token: BufferCollectionImportToken,
1729        vmo_index: u32,
1730        properties: &ImageProperties,
1731    ) -> Result<(), fidl::Error>;
1732    fn r#set_image_sample_region(
1733        &self,
1734        image_id: &ContentId,
1735        rect: &fidl_fuchsia_math::RectF,
1736    ) -> Result<(), fidl::Error>;
1737    fn r#set_image_destination_size(
1738        &self,
1739        image_id: &ContentId,
1740        size: &fidl_fuchsia_math::SizeU,
1741    ) -> Result<(), fidl::Error>;
1742    fn r#set_image_blending_function(
1743        &self,
1744        image_id: &ContentId,
1745        blend_mode: BlendMode,
1746    ) -> Result<(), fidl::Error>;
1747    fn r#set_image_blend_mode(
1748        &self,
1749        image_id: &ContentId,
1750        blend_mode: BlendMode2,
1751    ) -> Result<(), fidl::Error>;
1752    fn r#set_image_opacity(&self, image_id: &ContentId, val: f32) -> Result<(), fidl::Error>;
1753    fn r#set_image_flip(&self, image_id: &ContentId, flip: ImageFlip) -> Result<(), fidl::Error>;
1754    fn r#create_filled_rect(&self, rect_id: &ContentId) -> Result<(), fidl::Error>;
1755    fn r#set_solid_fill(
1756        &self,
1757        rect_id: &ContentId,
1758        color: &ColorRgba,
1759        size: &fidl_fuchsia_math::SizeU,
1760    ) -> Result<(), fidl::Error>;
1761    fn r#release_filled_rect(&self, rect_id: &ContentId) -> Result<(), fidl::Error>;
1762    fn r#set_content(
1763        &self,
1764        transform_id: &TransformId,
1765        content_id: &ContentId,
1766    ) -> Result<(), fidl::Error>;
1767    fn r#set_viewport_properties(
1768        &self,
1769        viewport_id: &ContentId,
1770        properties: &ViewportProperties,
1771    ) -> Result<(), fidl::Error>;
1772    fn r#release_transform(&self, transform_id: &TransformId) -> Result<(), fidl::Error>;
1773    fn r#release_view(&self) -> Result<(), fidl::Error>;
1774    type ReleaseViewportResponseFut: std::future::Future<
1775            Output = Result<fidl_fuchsia_ui_views::ViewportCreationToken, fidl::Error>,
1776        > + Send;
1777    fn r#release_viewport(&self, viewport_id: &ContentId) -> Self::ReleaseViewportResponseFut;
1778    fn r#release_image(&self, image_id: &ContentId) -> Result<(), fidl::Error>;
1779    fn r#clear(&self) -> Result<(), fidl::Error>;
1780    fn r#set_debug_name(&self, name: &str) -> Result<(), fidl::Error>;
1781}
1782#[derive(Debug)]
1783#[cfg(target_os = "fuchsia")]
1784pub struct FlatlandSynchronousProxy {
1785    client: fidl::client::sync::Client,
1786}
1787
1788#[cfg(target_os = "fuchsia")]
1789impl fidl::endpoints::SynchronousProxy for FlatlandSynchronousProxy {
1790    type Proxy = FlatlandProxy;
1791    type Protocol = FlatlandMarker;
1792
1793    fn from_channel(inner: fidl::Channel) -> Self {
1794        Self::new(inner)
1795    }
1796
1797    fn into_channel(self) -> fidl::Channel {
1798        self.client.into_channel()
1799    }
1800
1801    fn as_channel(&self) -> &fidl::Channel {
1802        self.client.as_channel()
1803    }
1804}
1805
1806#[cfg(target_os = "fuchsia")]
1807impl FlatlandSynchronousProxy {
1808    pub fn new(channel: fidl::Channel) -> Self {
1809        let protocol_name = <FlatlandMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1810        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1811    }
1812
1813    pub fn into_channel(self) -> fidl::Channel {
1814        self.client.into_channel()
1815    }
1816
1817    /// Waits until an event arrives and returns it. It is safe for other
1818    /// threads to make concurrent requests while waiting for an event.
1819    pub fn wait_for_event(
1820        &self,
1821        deadline: zx::MonotonicInstant,
1822    ) -> Result<FlatlandEvent, fidl::Error> {
1823        FlatlandEvent::decode(self.client.wait_for_event(deadline)?)
1824    }
1825
1826    /// Complete execution of all feed-forward operations.
1827    ///
1828    /// If executing an operation produces an error (e.g., CreateTransform(0)), an [`OnError`] event
1829    /// is emitted. Operations that produce errors are ignored and the channel is closed.
1830    ///
1831    /// If the execution is completed successfully, [`OnNextFrameBegin`] emits NO_ERROR along
1832    /// with other valid fields.
1833    ///
1834    /// The client may only call [`Present`] when they have a non-zero number of present credits,
1835    /// which are tracked by the server. The server may increment the number of credits when it
1836    /// fires the [`OnNextFrameBegin`] event, which informs the client when it receives additional
1837    /// present credits. Each [`Present`] call uses one present credit and decrements the server
1838    /// count by one. If the client calls [`Present`] with no present credits, the server will
1839    /// return a `NO_PRESENTS_REMAINING` error.
1840    ///
1841    /// The client should assume that prior to receiving any [`OnNextFrameBegin`] events, they have
1842    /// one present credit.
1843    ///
1844    /// Every [`Present`] call results in one [`OnNextFrameBegin`] event, and one
1845    /// [`OnFramePresented`] event, typically in that order.
1846    ///
1847    /// When the commands flushed by [`Present`] make it to display, an [`OnFramePresented`] event
1848    /// is fired. This event includes information pertaining to all [`Present`]s that had content
1849    /// that were part of that frame.
1850    ///
1851    /// See [`fuchsia.ui.composition/PresentArgs`] documentation above for more detailed information
1852    /// on what arguments are passed in and their role.
1853    pub fn r#present(&self, mut args: PresentArgs) -> Result<(), fidl::Error> {
1854        self.client.send::<FlatlandPresentRequest>(
1855            (&mut args,),
1856            0x50acc2aa1f0acec7,
1857            fidl::encoding::DynamicFlags::empty(),
1858        )
1859    }
1860
1861    /// Two Flatland instances may be connected in a parent-child relationship. The parent endpoint
1862    /// is held in a Viewport, and the child endpoint is held in a View. The parent Flatland
1863    /// instance that creates a Viewport has control over how the child's View is integrated into
1864    /// its own View.
1865    ///
1866    /// The lifecycle of a parent-child connection starts with two endpoints of a channel object:
1867    /// a ViewportCreationToken and a ViewCreationToken. Out-of-band protocols pass the
1868    /// ViewportCreationToken to the parent, which calls [`CreateViewport`], and the
1869    /// ViewCreationToken to the child, which calls [`CreateView`].
1870    ///
1871    /// Only nodes connected to the Root Transform in this Flatland instance will be rendered into
1872    /// the parent's Viewport.
1873    ///
1874    /// Calling [`CreateView`] a second time will disconnect the Root Transform from the existing
1875    /// parent's Viewport, and attach it to a new parent's Viewport. In other words, each View can
1876    /// only have one parent.
1877    ///
1878    /// This function is queued, meaning that the Root Transform will not be attached to the
1879    /// parent Viewport until [`Present`] is called. However, clients will receive information
1880    /// through their ParentViewportWatcher (e.g., LayoutInfo) immediately after calling this
1881    /// function, even if they have not called [`Present`] or [`SetRootTransform`]. This allows
1882    /// clients to wait for layout information from their parent before calling [`Present`].
1883    ///
1884    /// Any illegal operations on ParentViewportWatcher will cause both ParentViewportWatcher
1885    /// channel and this Flatland channel to be torn down.
1886    ///
1887    /// Lifecycle note. The lifetime of the ParentViewportWatcher channel is bound by the peer
1888    /// ViewportCreationToken. When the ViewportCreationToken dies, this ParentViewportWatcher
1889    /// channel is destroyed.
1890    ///
1891    /// Views and subgraphs of Views created using `CreateView` will not be represented in the
1892    /// ViewTree, and hence will not be able to participate in any ViewTree-dependent interactions
1893    /// such as touch, mouse or focus.
1894    /// The Flatland protocol provides no way for Views in the subgraph of a View created with
1895    /// `CreateView` to know that they are excluded from the ViewTree.
1896    pub fn r#create_view(
1897        &self,
1898        mut token: fidl_fuchsia_ui_views::ViewCreationToken,
1899        mut parent_viewport_watcher: fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>,
1900    ) -> Result<(), fidl::Error> {
1901        self.client.send::<FlatlandCreateViewRequest>(
1902            (&mut token, parent_viewport_watcher),
1903            0x504686eb25864780,
1904            fidl::encoding::DynamicFlags::empty(),
1905        )
1906    }
1907
1908    /// Identical to [`CreateView`], except it allows association of View identity (ViewRef) and
1909    /// view-bound protocols.
1910    pub fn r#create_view2(
1911        &self,
1912        mut token: fidl_fuchsia_ui_views::ViewCreationToken,
1913        mut view_identity: fidl_fuchsia_ui_views::ViewIdentityOnCreation,
1914        mut protocols: ViewBoundProtocols,
1915        mut parent_viewport_watcher: fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>,
1916    ) -> Result<(), fidl::Error> {
1917        self.client.send::<FlatlandCreateView2Request>(
1918            (&mut token, &mut view_identity, &mut protocols, parent_viewport_watcher),
1919            0x340a3a40c2fdbd5e,
1920            fidl::encoding::DynamicFlags::empty(),
1921        )
1922    }
1923
1924    /// Creates a new Transform node. Transforms are a hierarchical piece of a Flatland graph. They
1925    /// can have children, and can reference Content. A sub-graph represented by a Transform and its
1926    /// descendants can be rendered to a display.
1927    ///
1928    /// Transforms are kept alive, even when released, as long as they are children of either an
1929    /// unreleased Transform, or the Root Transform.
1930    ///
1931    /// Each Transform can have a single piece of attached Content. Common types of Content include
1932    /// bitmaps, asynchronous streams of images, and Viewports to Views hosted in other Flatland
1933    /// instances.
1934    ///
1935    /// Transforms have attributes. Child Transforms inherit the combined attributes of their
1936    /// parents. Content attached to a Transform is also affected by that Transform's attributes.
1937    ///
1938    /// When a sub-graph of Transforms is rendered, Content will be rendered back-to-front, starting
1939    /// with the Content on the root transform, and continuing recursively through all of its child
1940    /// Transforms in the order the children were added. See [`AddChild`] for more information.
1941    ///
1942    /// Zero is not a valid transform id. All other values are valid, assuming they are not already
1943    /// in use (see [`ReleaseTransform`] for more details).
1944    pub fn r#create_transform(&self, mut transform_id: &TransformId) -> Result<(), fidl::Error> {
1945        self.client.send::<FlatlandCreateTransformRequest>(
1946            (transform_id,),
1947            0x5e042a4d3de3efb0,
1948            fidl::encoding::DynamicFlags::empty(),
1949        )
1950    }
1951
1952    /// All Transform objects support all attributes.
1953    ///
1954    /// Geometric attributes are applied in the following order:
1955    /// 1. Scale (relative to the parent transform's coordinate space)
1956    /// 2. Orientation (relative to the parent transform's coordinate space)
1957    /// 3. Translation (relative to the parent transforms's coordinate space,
1958    ///    unaffected by scale applied to the current transform).
1959    /// 4. Clipping (relative to the current transform's coordinate space)
1960    ///
1961    /// The effects of each of these attributes are cumulative. This means the transform's position
1962    /// in the view space, and its clip boundary, will be calculated based on that chain of
1963    /// geometric attributes going up to the root transform.
1964    ///
1965    /// For instance, in a nested hierarchy such as the following:
1966    ///     [Root-Transform -> Transform1 -> Transform2 -> CurrentTransform]
1967    /// If Transform1 is translated by [2,0] and Transform2 is translated by [0,1] then the
1968    /// view-space position of CurrentTransform will be [2,1].
1969    ///
1970    /// Sets the translation on a Transform. The order of geometric attribute application is
1971    /// addressed above.
1972    pub fn r#set_translation(
1973        &self,
1974        mut transform_id: &TransformId,
1975        mut translation: &fidl_fuchsia_math::Vec_,
1976    ) -> Result<(), fidl::Error> {
1977        self.client.send::<FlatlandSetTranslationRequest>(
1978            (transform_id, translation),
1979            0x7863398291fba346,
1980            fidl::encoding::DynamicFlags::empty(),
1981        )
1982    }
1983
1984    /// Sets the orientation on a Transform. The order of geometric attribute application is
1985    /// addressed in the documentation for [`SetTranslation`]. In Flatland, the +X axis is
1986    /// to the right and the +Y axis is down. There is no notion of a Z axis. CCW is defined
1987    /// from the POV of the user, as if a skeuomorphoic clock is displayed on the screen.
1988    pub fn r#set_orientation(
1989        &self,
1990        mut transform_id: &TransformId,
1991        mut orientation: Orientation,
1992    ) -> Result<(), fidl::Error> {
1993        self.client.send::<FlatlandSetOrientationRequest>(
1994            (transform_id, orientation),
1995            0x4915310bc4928edc,
1996            fidl::encoding::DynamicFlags::empty(),
1997        )
1998    }
1999
2000    /// Sets the scale on a transform. The order of geometric attribute application is
2001    /// addressed above. The (x,y) values in the VecF |scale| refer to the scale factor in the
2002    /// x-axis (width) and y-axis (height) respectively. Scale values must be normal 32-bit
2003    /// floating point values: https://en.wikipedia.org/wiki/Normal_number_%28computing%29
2004    pub fn r#set_scale(
2005        &self,
2006        mut transform_id: &TransformId,
2007        mut scale: &fidl_fuchsia_math::VecF,
2008    ) -> Result<(), fidl::Error> {
2009        self.client.send::<FlatlandSetScaleRequest>(
2010            (transform_id, scale),
2011            0x1ea1766fd8996bb4,
2012            fidl::encoding::DynamicFlags::empty(),
2013        )
2014    }
2015
2016    /// Sets an opacity in linear space to be applied to a transform and its descendents,
2017    /// which include other transforms and content. Opacity values must be in the range
2018    /// of [0.0, 1.0], where 0.0 is completely transparent and 1.0 is completely opaque.
2019    /// Attempting to call this function with values outside that range will result in
2020    /// an error. A transform's opacity value is multiplied with that of its parent. This
2021    /// effect works differently from group opacity. Using group opacity, child nodes are
2022    /// rendered together first, and then have the parent's opacity applied as a post-effect.
2023    /// Here, opacity is applied to each child individually. This may result in a very
2024    /// different effect.
2025    pub fn r#set_opacity(
2026        &self,
2027        mut transform_id: &TransformId,
2028        mut value: f32,
2029    ) -> Result<(), fidl::Error> {
2030        self.client.send::<FlatlandSetOpacityRequest>(
2031            (transform_id, value),
2032            0x3775fc2c00b432fa,
2033            fidl::encoding::DynamicFlags::empty(),
2034        )
2035    }
2036
2037    /// Sets the bounds, expressed in the local coordinate space of the transform, that
2038    /// constrains the region that content attached to this transform can be rendered to.
2039    /// If the content's area exceeds the clip bounds, the area outside the bounds will
2040    /// not be rendered. These bounds are valid for all children of this transform node as
2041    /// well, which includes nested Flatland instances and their node hierarchies.
2042    /// If a child transform attempts to set clip bounds larger than that of its parent,
2043    /// it will be clipped to the parent's clip bounds. The default state is for a transform
2044    /// to be unclipped, meaning it will not have any bounds placed on its render region.
2045    /// The clip width/height must be positive. Negative values will result in an error.
2046    /// Passing in an empty box to the |rect| parameter will remove the clip bounds.
2047    pub fn r#set_clip_boundary(
2048        &self,
2049        mut transform_id: &TransformId,
2050        mut rect: Option<&fidl_fuchsia_math::Rect>,
2051    ) -> Result<(), fidl::Error> {
2052        self.client.send::<FlatlandSetClipBoundaryRequest>(
2053            (transform_id, rect),
2054            0x6507843df12222d2,
2055            fidl::encoding::DynamicFlags::empty(),
2056        )
2057    }
2058
2059    /// Adds a child Transform to a parent Transform. The new child Transform, and any Content
2060    /// attached to it or its children, will be rendered on top of the parent's Content, as well as
2061    /// any previously added children.
2062    pub fn r#add_child(
2063        &self,
2064        mut parent_transform_id: &TransformId,
2065        mut child_transform_id: &TransformId,
2066    ) -> Result<(), fidl::Error> {
2067        self.client.send::<FlatlandAddChildRequest>(
2068            (parent_transform_id, child_transform_id),
2069            0x67a8abd2f19b1a74,
2070            fidl::encoding::DynamicFlags::empty(),
2071        )
2072    }
2073
2074    /// Removes a child Transform from a parent Transform.
2075    pub fn r#remove_child(
2076        &self,
2077        mut parent_transform_id: &TransformId,
2078        mut child_transform_id: &TransformId,
2079    ) -> Result<(), fidl::Error> {
2080        self.client.send::<FlatlandRemoveChildRequest>(
2081            (parent_transform_id, child_transform_id),
2082            0x41d6cd90b298b67a,
2083            fidl::encoding::DynamicFlags::empty(),
2084        )
2085    }
2086
2087    /// Removes all child Transforms from a parent Transform and replaces them with the new child
2088    /// transforms in `new_child_transform_ids`.
2089    pub fn r#replace_children(
2090        &self,
2091        mut parent_transform_id: &TransformId,
2092        mut new_child_transform_ids: &[TransformId],
2093    ) -> Result<(), fidl::Error> {
2094        self.client.send::<FlatlandReplaceChildrenRequest>(
2095            (parent_transform_id, new_child_transform_ids),
2096            0x5b6d86cbbff81316,
2097            fidl::encoding::DynamicFlags::empty(),
2098        )
2099    }
2100
2101    /// Sets the Root Transform for the graph.
2102    ///
2103    /// The sub-graph defined by the Root Transform and its children will be rendered as View
2104    /// in the connected parent's Viewport (see [`CreateView`]). Any parents of the Root Transform
2105    /// in this Graph will be ignored.
2106    ///
2107    /// The Root Transform, and all children of the Root Transform, are kept alive if they are
2108    /// released (see [`ReleaseTransform`] for more details).
2109    ///
2110    /// There is only ever one Root. Since 0 is not a valid transform id (see [`CreateTransform`]),
2111    /// calling SetRootTransform(0) clears the current Root, destroying any previously released
2112    /// objects that are not referenced by the new root.
2113    ///
2114    /// Note that every View has a clip boundary equivalent to its logical size. Anything outside
2115    /// that clip boundary will not be rendered. Hence, the Root Transform has a useful coordinate
2116    /// space of (0, 0) to (logical_size.width, logical_size.height), where (0, 0) is the upper left
2117    /// corner.
2118    ///
2119    /// Setting the root transform installs a full screen hit region on the root transform. Clients
2120    /// may remove this hit region if they don't want users to be able to interact with the root
2121    /// transform's content. For additional details on hit regions, see the [`SetHitRegions`]
2122    /// documentation.
2123    ///
2124    /// Default hit region rules
2125    ///
2126    ///   A default hit region follows these rules:
2127    ///   - When [`SetRootTransform`](T) is called, T receives a maximal hit region, covering the
2128    ///   entire view.
2129    ///   - If [`SetHitRegions`] is called on T, either before or after [`SetRootTransform`](T),
2130    ///   then no default hit region is active and the client specified hit regions are used.
2131    ///   - If a transform is no longer the root transform, i.e., [`SetRootTransform`](U) is
2132    ///   called, then the original transform no longer has its default hit region.
2133    ///   - Clients can remove or modify the root transform's hit regions the same way they would
2134    ///   reset any other transform's hit regions, by calling [`SetHitRegions`] with the appropriate
2135    ///   vector.
2136    pub fn r#set_root_transform(&self, mut transform_id: &TransformId) -> Result<(), fidl::Error> {
2137        self.client.send::<FlatlandSetRootTransformRequest>(
2138            (transform_id,),
2139            0x6e80ca5bcc566cd8,
2140            fidl::encoding::DynamicFlags::empty(),
2141        )
2142    }
2143
2144    /// Sets the interactive areas for a Transform. By default, Content is not interactive; hit
2145    /// regions must be placed for a user to interact with the Content in a View. Because hit
2146    /// regions are described in the Flatland protocol, a Flatland instance can synchronize Content
2147    /// and hit regions.
2148    ///
2149    /// Each hit region is placed in the coordinate space of the owning Transform, and may or may
2150    /// not interact with different types of hit testing, depending on its [`HitTestInteraction`]
2151    /// type. When there are multiple hit regions that intersect with a hit test, the precedence
2152    /// rules given below dictate which hit region has interacted with the hit test. Only Transforms
2153    /// that transitively connect to the root Transform have their hit regions interact with a hit
2154    /// test.
2155    ///
2156    /// Calling this function replaces any previous values set on this Transform. To reset a
2157    /// Transform to "no hit testing": send an empty vector with [`SetHitRegions`].
2158    ///
2159    /// Note that root transforms get a default hit region installed by Flatland. For more details,
2160    /// see the [`SetRootTransform`] documentation.
2161    ///
2162    /// Precedence rules
2163    ///   Within a Transform, if multiple hit regions overlap, the hit test examines each
2164    ///   intersecting hit region for a possible interaction. Thus, for a regular hit test R and an
2165    ///   accessibility hit test A, where R and A both intersect two hit regions D ([`DEFAULT`]) and
2166    ///   S ([`SEMANTICALLY_INVISIBLE`]) on the same Transform, (1) R interacts with both D and S,
2167    ///   and (2) A only interacts with D. Generally, hit regions that overlap in a single Transform
2168    ///   can cause confusing behavior.
2169    ///
2170    ///   Within a View, for a given hit test, the front-most Transform's hit regions take
2171    ///   precedence over those behind. This follows the expected reverse "render order" of
2172    ///   Transforms (described in [`CreateTransform`]), where a user expects to interact with
2173    ///   Content that is visible, or front-most.
2174    ///
2175    ///   Across Flatland instances, for a given hit test, the front-most instance's front-most
2176    ///   Transform's hit regions take precedence over those behind. This follows the expected
2177    ///   reverse "render order" of views, where a user expects to interact with the View that is
2178    ///   visible, or front-most. For example, if a child View owns Content that is rendered over
2179    ///   the parent View, the user expects to interact with the child's Content.
2180    pub fn r#set_hit_regions(
2181        &self,
2182        mut transform_id: &TransformId,
2183        mut regions: &[HitRegion],
2184    ) -> Result<(), fidl::Error> {
2185        self.client.send::<FlatlandSetHitRegionsRequest>(
2186            (transform_id, regions),
2187            0x31c9d17b07c37ce4,
2188            fidl::encoding::DynamicFlags::empty(),
2189        )
2190    }
2191
2192    /// Identical to [`SetHitRegions`], except the hit region associated with [`transform_id`]
2193    /// covers an infinite region. The hit region is invariant against translation, scaling, and
2194    /// orientation of the Transform.
2195    ///
2196    /// An infinite hit region is still limited in extent by the View's clip boundary, just like a
2197    /// finite hit region.
2198    ///
2199    /// Calling this function replaces any previous values set on this Transform. To reset a
2200    /// Transform to "no hit testing": send an empty vector with [`SetHitRegions`].
2201    pub fn r#set_infinite_hit_region(
2202        &self,
2203        mut transform_id: &TransformId,
2204        mut hit_test: HitTestInteraction,
2205    ) -> Result<(), fidl::Error> {
2206        self.client.send::<FlatlandSetInfiniteHitRegionRequest>(
2207            (transform_id, hit_test),
2208            0x26d81af852d29562,
2209            fidl::encoding::DynamicFlags::empty(),
2210        )
2211    }
2212
2213    /// The Viewport and View pair, together, represent the connection between two Flatland
2214    /// instances. The Viewport is created in the parent, and the View is created in the child. The
2215    /// parent has control over how the child's View is integrated into its own View.
2216    ///
2217    /// Any illegal operations on ChildViewWatcher will cause both ChildViewWatcher channel and this
2218    /// Flatland channel to be torn down.
2219    ///
2220    /// `ViewportProperties` must have logical_size set. This is the initial size that will drive
2221    /// the layout of the child. The logical_size is also used as the default Content size, but
2222    /// subsequent changes to the logical_size will have no effect on the Content size.
2223    ///
2224    /// `ViewportProperties` may have inset field not set. In that case, the default value of
2225    /// (0, 0, 0, 0) is used.
2226    ///
2227    /// The logical_size must have positive X and Y components.
2228    ///
2229    /// Zero is not a valid ContentId. All other values are valid, assuming they are not already
2230    /// in use for another piece of Content (see [`ReleaseViewport`] for more details).
2231    ///
2232    /// Lifecycle note. The lifetime of the ChildViewWatcher channel is bound by the peer
2233    /// ViewCreationToken. When the ViewCreationToken dies, this ChildViewWatcher channel is
2234    /// destroyed.
2235    pub fn r#create_viewport(
2236        &self,
2237        mut viewport_id: &ContentId,
2238        mut token: fidl_fuchsia_ui_views::ViewportCreationToken,
2239        mut properties: &ViewportProperties,
2240        mut child_view_watcher: fidl::endpoints::ServerEnd<ChildViewWatcherMarker>,
2241    ) -> Result<(), fidl::Error> {
2242        self.client.send::<FlatlandCreateViewportRequest>(
2243            (viewport_id, &mut token, properties, child_view_watcher),
2244            0x2485fbcab7f943c,
2245            fidl::encoding::DynamicFlags::empty(),
2246        )
2247    }
2248
2249    /// An Image is a bitmap backed by a specific VMO in a BufferCollection.
2250    ///
2251    /// Image creation requires an allocated BufferCollection registered with Allocator. This
2252    /// function will fail unless all clients of the specified BufferCollection have set their
2253    /// constraints.
2254    ///
2255    /// The Image must reference a valid VMO index and must have ImageProperties that fall within
2256    /// the constraints specified by the backing BufferCollection (i.e. width and height within a
2257    /// valid range, etc.)
2258    ///
2259    /// Zero is not a valid Image id. All other values are valid, assuming they are not already in
2260    /// use for another piece of Content (see [`ReleaseImage`] for more details).
2261    pub fn r#create_image(
2262        &self,
2263        mut image_id: &ContentId,
2264        mut import_token: BufferCollectionImportToken,
2265        mut vmo_index: u32,
2266        mut properties: &ImageProperties,
2267    ) -> Result<(), fidl::Error> {
2268        self.client.send::<FlatlandCreateImageRequest>(
2269            (image_id, &mut import_token, vmo_index, properties),
2270            0x26fae823c4ebedad,
2271            fidl::encoding::DynamicFlags::empty(),
2272        )
2273    }
2274
2275    /// This function is used to determine the region (in texel space) of an image that will be used
2276    /// by Flatland when rendering. The image to be sampled is referenced by [`image_id`] and the
2277    /// sample region is specified by [`rect`] which itself is comprised of an origin point (x,y) as
2278    /// well as a width and height, in unnormalized coordinates. It is illegal to call this function
2279    /// on non-image content, or to sample a region outside of the texel space of the image. In
2280    /// other words, the region specifed by [`rect`] must not exceed the ranges (0, image_width) and
2281    /// (0, image_height). If (rect.x + rect.width > image_width) or (rect.y + rect.height >
2282    /// image_height) or if any of the values are negative, this will result in an error.
2283    ///
2284    /// If this method is not called, the default sample region is the rectangle with origin at
2285    /// (0, 0) and width and height set at ImageProperties from [`CreateImage`].
2286    pub fn r#set_image_sample_region(
2287        &self,
2288        mut image_id: &ContentId,
2289        mut rect: &fidl_fuchsia_math::RectF,
2290    ) -> Result<(), fidl::Error> {
2291        self.client.send::<FlatlandSetImageSampleRegionRequest>(
2292            (image_id, rect),
2293            0x8039391d715eb28,
2294            fidl::encoding::DynamicFlags::empty(),
2295        )
2296    }
2297
2298    /// The content size for an Image is the size of the rectangle in the parent's logical
2299    /// coordinate space that the image occupies. This combined with the global translation of the
2300    /// transform it is attached to determines the size and location of where the content is
2301    /// rendered on the display.
2302    ///
2303    /// If this method is not called, the default image destination size is the width and height set
2304    /// at ImageProperties from [`CreateImage`]. The destination size will be affected by scaling if
2305    /// [`SetScale`] is used on the attached Transform or its parents.
2306    pub fn r#set_image_destination_size(
2307        &self,
2308        mut image_id: &ContentId,
2309        mut size: &fidl_fuchsia_math::SizeU,
2310    ) -> Result<(), fidl::Error> {
2311        self.client.send::<FlatlandSetImageDestinationSizeRequest>(
2312            (image_id, size),
2313            0x766cf99a2ec58446,
2314            fidl::encoding::DynamicFlags::empty(),
2315        )
2316    }
2317
2318    /// Determines the blend function to use when rendering the content specified by
2319    /// |image_id|. |image_id| must be a valid ContentId associated to a transform through
2320    /// a call to |CreateImage| or |CreateFilledRect|. For details on the different blend functions
2321    /// that are available, please refer to the BlendMode enum. If this function is not called, then
2322    /// the default blendmode is BlendMode::SRC.
2323    pub fn r#set_image_blending_function(
2324        &self,
2325        mut image_id: &ContentId,
2326        mut blend_mode: BlendMode,
2327    ) -> Result<(), fidl::Error> {
2328        self.client.send::<FlatlandSetImageBlendingFunctionRequest>(
2329            (image_id, blend_mode),
2330            0x10f5da1356275b7b,
2331            fidl::encoding::DynamicFlags::empty(),
2332        )
2333    }
2334
2335    /// Determines the blend function to use when rendering the content specified by
2336    /// |image_id|. |image_id| must be a valid ContentId associated to a transform through
2337    /// a call to |CreateImage| or |CreateFilledRect|. For details on the different blend functions
2338    /// that are available, please refer to the BlendMode2 enum. If this function is not called,
2339    /// the default blendmode is BlendMode2::REPLACE.
2340    pub fn r#set_image_blend_mode(
2341        &self,
2342        mut image_id: &ContentId,
2343        mut blend_mode: BlendMode2,
2344    ) -> Result<(), fidl::Error> {
2345        self.client.send::<FlatlandSetImageBlendModeRequest>(
2346            (image_id, blend_mode),
2347            0x5b1667f130c3de67,
2348            fidl::encoding::DynamicFlags::empty(),
2349        )
2350    }
2351
2352    /// Sets an opacity in linear space to be applied to a flatland image. Opacity values must
2353    /// be in the range [0.0, 1.0].
2354    pub fn r#set_image_opacity(
2355        &self,
2356        mut image_id: &ContentId,
2357        mut val: f32,
2358    ) -> Result<(), fidl::Error> {
2359        self.client.send::<FlatlandSetImageOpacityRequest>(
2360            (image_id, val),
2361            0x2da9e4ef4c2cff6f,
2362            fidl::encoding::DynamicFlags::empty(),
2363        )
2364    }
2365
2366    /// Sets the image flip to be applied to a flatland image. This call must be performed after a
2367    /// successful |CreateImage| call. If an invalid |image_id| is supplied, the channel will be
2368    /// closed due to FlatlandError::BAD_OPERATION. This flip will be applied to the Image before
2369    /// parent Transform Orientations. If this function is not called, then the default flip value
2370    /// is ImageFlip::NONE.
2371    pub fn r#set_image_flip(
2372        &self,
2373        mut image_id: &ContentId,
2374        mut flip: ImageFlip,
2375    ) -> Result<(), fidl::Error> {
2376        self.client.send::<FlatlandSetImageFlipRequest>(
2377            (image_id, flip),
2378            0x21b20f2c14aae6bc,
2379            fidl::encoding::DynamicFlags::empty(),
2380        )
2381    }
2382
2383    /// Creates a solid-color rectangle. By default a filled-rect does not have a defined
2384    /// color or size. It is necessary to call |SetSolidFill| to specify a color and size
2385    /// before a filled rect can be used for rendering. Not doing so will result the
2386    pub fn r#create_filled_rect(&self, mut rect_id: &ContentId) -> Result<(), fidl::Error> {
2387        self.client.send::<FlatlandCreateFilledRectRequest>(
2388            (rect_id,),
2389            0x5e62355abc1c4c5d,
2390            fidl::encoding::DynamicFlags::empty(),
2391        )
2392    }
2393
2394    /// Defines the color and size of a filled rect. |rect_id| must refer to content that
2395    /// was created via a call to CreateFilledRect. The color is not premultiplied. Color values
2396    /// must be within the range [0,1] inclusive, and normal 32-bit
2397    /// floating point values: https://en.wikipedia.org/wiki/Normal_number_%28computing%29. Values
2398    /// that do not conform to these specifications will cause the channel to close.
2399    /// The rectangle's top left corner will be at (0, 0) in its transform's coordinate space.
2400    /// Hence, its bottom right corner will be at (size.width, size.height).
2401    pub fn r#set_solid_fill(
2402        &self,
2403        mut rect_id: &ContentId,
2404        mut color: &ColorRgba,
2405        mut size: &fidl_fuchsia_math::SizeU,
2406    ) -> Result<(), fidl::Error> {
2407        self.client.send::<FlatlandSetSolidFillRequest>(
2408            (rect_id, color, size),
2409            0x32d6ef41e182dfa5,
2410            fidl::encoding::DynamicFlags::empty(),
2411        )
2412    }
2413
2414    /// Automatically garbage collects the rectangle when it is no longer needed for
2415    /// rendering. |rect_id| must have been instantiated with a call to
2416    /// |CreateFilledRect|. Once released, the ID immediately goes out of scope and is free
2417    /// to be used again.
2418    pub fn r#release_filled_rect(&self, mut rect_id: &ContentId) -> Result<(), fidl::Error> {
2419        self.client.send::<FlatlandReleaseFilledRectRequest>(
2420            (rect_id,),
2421            0x7392cabe45618f9b,
2422            fidl::encoding::DynamicFlags::empty(),
2423        )
2424    }
2425
2426    /// Setting a piece of Content on a Transform makes that Content visible in the render tree as
2427    /// long as the Transform is visible from the root Transform. The Content will be rendered
2428    /// before, and therefore "behind", any Content attached to the descendants of the Transform.
2429    ///
2430    /// Because each Transform can have, at most, a single piece of Content on it, calling this
2431    /// function on a Transform that already has Content will replace that Content.
2432    ///
2433    /// A Content may be set on more than one Transform.
2434    ///
2435    /// Calling this function with a Content id of 0 will remove any Content currently on the
2436    /// Transform.
2437    pub fn r#set_content(
2438        &self,
2439        mut transform_id: &TransformId,
2440        mut content_id: &ContentId,
2441    ) -> Result<(), fidl::Error> {
2442        self.client.send::<FlatlandSetContentRequest>(
2443            (transform_id, content_id),
2444            0x4ed2cfc0ce130862,
2445            fidl::encoding::DynamicFlags::empty(),
2446        )
2447    }
2448
2449    /// Transforms are usually sufficient to change how Content is presented. Viewports, however,
2450    /// have special properties that are not part of the Transform hierarchy. Those properties can
2451    /// be set using this function.
2452    pub fn r#set_viewport_properties(
2453        &self,
2454        mut viewport_id: &ContentId,
2455        mut properties: &ViewportProperties,
2456    ) -> Result<(), fidl::Error> {
2457        self.client.send::<FlatlandSetViewportPropertiesRequest>(
2458            (viewport_id, properties),
2459            0x66ab67e9608ddb9f,
2460            fidl::encoding::DynamicFlags::empty(),
2461        )
2462    }
2463
2464    /// Released Transforms will be garbage collected by the system once they are no longer
2465    /// necessary for rendering. For Transforms, this means there is no path from any unreleased
2466    /// Transform to the newly-released Transform.
2467    ///
2468    /// Once released, the id immediately goes out of scope for future function calls and can be
2469    /// reused when creating new Transforms.
2470    ///
2471    /// It is an error to call functions with a released id (unless that id has been reused to
2472    /// construct a new Transform).
2473    pub fn r#release_transform(&self, mut transform_id: &TransformId) -> Result<(), fidl::Error> {
2474        self.client.send::<FlatlandReleaseTransformRequest>(
2475            (transform_id,),
2476            0xab9328419451c22,
2477            fidl::encoding::DynamicFlags::empty(),
2478        )
2479    }
2480
2481    pub fn r#release_view(&self) -> Result<(), fidl::Error> {
2482        self.client.send::<fidl::encoding::EmptyPayload>(
2483            (),
2484            0x5b35aab9baffecae,
2485            fidl::encoding::DynamicFlags::empty(),
2486        )
2487    }
2488
2489    /// Releases a Viewport from the scene, even if the Viewport is still connected to a Transform.
2490    /// Unlike other resources, Viewports are garbage collected by the system during the next
2491    /// [`Present`] because a removed Viewport is guaranteed to provide no renderable content.
2492    ///
2493    /// Use SetContent(transform_id, 0) to clean up references to released Viewports.
2494    ///
2495    /// Despite having a return type, this function is still feed-forward like [`CreateView`] and
2496    /// requires a call to [`Present`] to be executed. The ViewportCreationToken will be returned
2497    /// after the presented operations have been executed.
2498    pub fn r#release_viewport(
2499        &self,
2500        mut viewport_id: &ContentId,
2501        ___deadline: zx::MonotonicInstant,
2502    ) -> Result<fidl_fuchsia_ui_views::ViewportCreationToken, fidl::Error> {
2503        let _response = self
2504            .client
2505            .send_query::<FlatlandReleaseViewportRequest, FlatlandReleaseViewportResponse>(
2506                (viewport_id,),
2507                0xbad474aeb5293f9,
2508                fidl::encoding::DynamicFlags::empty(),
2509                ___deadline,
2510            )?;
2511        Ok(_response.token)
2512    }
2513
2514    /// Released Images will be garbage collected by the system once they are no longer necessary
2515    /// for rendering. For Images, this means the Image is no longer attached to any Transform and
2516    /// any pending rendering that references the Image is complete.
2517    ///
2518    /// Use SetContent(transform_id, 0) to clean up references to released Images.
2519    ///
2520    /// Once released, the id immediately goes out of scope for future function calls and can be
2521    /// reused when creating new Images.
2522    ///
2523    /// It is an error to call functions with a released id (unless that id has been reused to
2524    /// construct a new Image).
2525    pub fn r#release_image(&self, mut image_id: &ContentId) -> Result<(), fidl::Error> {
2526        self.client.send::<FlatlandReleaseImageRequest>(
2527            (image_id,),
2528            0xb884ffdbc72c111,
2529            fidl::encoding::DynamicFlags::empty(),
2530        )
2531    }
2532
2533    /// This function will reset all state on this interface. This includes destroying all existing
2534    /// View and Viewports without returning the associated Token to the caller.
2535    pub fn r#clear(&self) -> Result<(), fidl::Error> {
2536        self.client.send::<fidl::encoding::EmptyPayload>(
2537            (),
2538            0x4ec8817c02828c3e,
2539            fidl::encoding::DynamicFlags::empty(),
2540        )
2541    }
2542
2543    /// Set debug name of the current client that can be used by Flatland to print as a prefix to
2544    /// logs to help client distinguish what is theirs. [`name`] can be an arbitrary string, but the
2545    /// current process name (see fsl::GetCurrentProcessName()) is a good default.
2546    pub fn r#set_debug_name(&self, mut name: &str) -> Result<(), fidl::Error> {
2547        self.client.send::<FlatlandSetDebugNameRequest>(
2548            (name,),
2549            0x46a8b397e68a8888,
2550            fidl::encoding::DynamicFlags::empty(),
2551        )
2552    }
2553}
2554
2555#[cfg(target_os = "fuchsia")]
2556impl From<FlatlandSynchronousProxy> for zx::NullableHandle {
2557    fn from(value: FlatlandSynchronousProxy) -> Self {
2558        value.into_channel().into()
2559    }
2560}
2561
2562#[cfg(target_os = "fuchsia")]
2563impl From<fidl::Channel> for FlatlandSynchronousProxy {
2564    fn from(value: fidl::Channel) -> Self {
2565        Self::new(value)
2566    }
2567}
2568
2569#[cfg(target_os = "fuchsia")]
2570impl fidl::endpoints::FromClient for FlatlandSynchronousProxy {
2571    type Protocol = FlatlandMarker;
2572
2573    fn from_client(value: fidl::endpoints::ClientEnd<FlatlandMarker>) -> Self {
2574        Self::new(value.into_channel())
2575    }
2576}
2577
2578#[derive(Debug, Clone)]
2579pub struct FlatlandProxy {
2580    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2581}
2582
2583impl fidl::endpoints::Proxy for FlatlandProxy {
2584    type Protocol = FlatlandMarker;
2585
2586    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2587        Self::new(inner)
2588    }
2589
2590    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2591        self.client.into_channel().map_err(|client| Self { client })
2592    }
2593
2594    fn as_channel(&self) -> &::fidl::AsyncChannel {
2595        self.client.as_channel()
2596    }
2597}
2598
2599impl FlatlandProxy {
2600    /// Create a new Proxy for fuchsia.ui.composition/Flatland.
2601    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2602        let protocol_name = <FlatlandMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2603        Self { client: fidl::client::Client::new(channel, protocol_name) }
2604    }
2605
2606    /// Get a Stream of events from the remote end of the protocol.
2607    ///
2608    /// # Panics
2609    ///
2610    /// Panics if the event stream was already taken.
2611    pub fn take_event_stream(&self) -> FlatlandEventStream {
2612        FlatlandEventStream { event_receiver: self.client.take_event_receiver() }
2613    }
2614
2615    /// Complete execution of all feed-forward operations.
2616    ///
2617    /// If executing an operation produces an error (e.g., CreateTransform(0)), an [`OnError`] event
2618    /// is emitted. Operations that produce errors are ignored and the channel is closed.
2619    ///
2620    /// If the execution is completed successfully, [`OnNextFrameBegin`] emits NO_ERROR along
2621    /// with other valid fields.
2622    ///
2623    /// The client may only call [`Present`] when they have a non-zero number of present credits,
2624    /// which are tracked by the server. The server may increment the number of credits when it
2625    /// fires the [`OnNextFrameBegin`] event, which informs the client when it receives additional
2626    /// present credits. Each [`Present`] call uses one present credit and decrements the server
2627    /// count by one. If the client calls [`Present`] with no present credits, the server will
2628    /// return a `NO_PRESENTS_REMAINING` error.
2629    ///
2630    /// The client should assume that prior to receiving any [`OnNextFrameBegin`] events, they have
2631    /// one present credit.
2632    ///
2633    /// Every [`Present`] call results in one [`OnNextFrameBegin`] event, and one
2634    /// [`OnFramePresented`] event, typically in that order.
2635    ///
2636    /// When the commands flushed by [`Present`] make it to display, an [`OnFramePresented`] event
2637    /// is fired. This event includes information pertaining to all [`Present`]s that had content
2638    /// that were part of that frame.
2639    ///
2640    /// See [`fuchsia.ui.composition/PresentArgs`] documentation above for more detailed information
2641    /// on what arguments are passed in and their role.
2642    pub fn r#present(&self, mut args: PresentArgs) -> Result<(), fidl::Error> {
2643        FlatlandProxyInterface::r#present(self, args)
2644    }
2645
2646    /// Two Flatland instances may be connected in a parent-child relationship. The parent endpoint
2647    /// is held in a Viewport, and the child endpoint is held in a View. The parent Flatland
2648    /// instance that creates a Viewport has control over how the child's View is integrated into
2649    /// its own View.
2650    ///
2651    /// The lifecycle of a parent-child connection starts with two endpoints of a channel object:
2652    /// a ViewportCreationToken and a ViewCreationToken. Out-of-band protocols pass the
2653    /// ViewportCreationToken to the parent, which calls [`CreateViewport`], and the
2654    /// ViewCreationToken to the child, which calls [`CreateView`].
2655    ///
2656    /// Only nodes connected to the Root Transform in this Flatland instance will be rendered into
2657    /// the parent's Viewport.
2658    ///
2659    /// Calling [`CreateView`] a second time will disconnect the Root Transform from the existing
2660    /// parent's Viewport, and attach it to a new parent's Viewport. In other words, each View can
2661    /// only have one parent.
2662    ///
2663    /// This function is queued, meaning that the Root Transform will not be attached to the
2664    /// parent Viewport until [`Present`] is called. However, clients will receive information
2665    /// through their ParentViewportWatcher (e.g., LayoutInfo) immediately after calling this
2666    /// function, even if they have not called [`Present`] or [`SetRootTransform`]. This allows
2667    /// clients to wait for layout information from their parent before calling [`Present`].
2668    ///
2669    /// Any illegal operations on ParentViewportWatcher will cause both ParentViewportWatcher
2670    /// channel and this Flatland channel to be torn down.
2671    ///
2672    /// Lifecycle note. The lifetime of the ParentViewportWatcher channel is bound by the peer
2673    /// ViewportCreationToken. When the ViewportCreationToken dies, this ParentViewportWatcher
2674    /// channel is destroyed.
2675    ///
2676    /// Views and subgraphs of Views created using `CreateView` will not be represented in the
2677    /// ViewTree, and hence will not be able to participate in any ViewTree-dependent interactions
2678    /// such as touch, mouse or focus.
2679    /// The Flatland protocol provides no way for Views in the subgraph of a View created with
2680    /// `CreateView` to know that they are excluded from the ViewTree.
2681    pub fn r#create_view(
2682        &self,
2683        mut token: fidl_fuchsia_ui_views::ViewCreationToken,
2684        mut parent_viewport_watcher: fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>,
2685    ) -> Result<(), fidl::Error> {
2686        FlatlandProxyInterface::r#create_view(self, token, parent_viewport_watcher)
2687    }
2688
2689    /// Identical to [`CreateView`], except it allows association of View identity (ViewRef) and
2690    /// view-bound protocols.
2691    pub fn r#create_view2(
2692        &self,
2693        mut token: fidl_fuchsia_ui_views::ViewCreationToken,
2694        mut view_identity: fidl_fuchsia_ui_views::ViewIdentityOnCreation,
2695        mut protocols: ViewBoundProtocols,
2696        mut parent_viewport_watcher: fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>,
2697    ) -> Result<(), fidl::Error> {
2698        FlatlandProxyInterface::r#create_view2(
2699            self,
2700            token,
2701            view_identity,
2702            protocols,
2703            parent_viewport_watcher,
2704        )
2705    }
2706
2707    /// Creates a new Transform node. Transforms are a hierarchical piece of a Flatland graph. They
2708    /// can have children, and can reference Content. A sub-graph represented by a Transform and its
2709    /// descendants can be rendered to a display.
2710    ///
2711    /// Transforms are kept alive, even when released, as long as they are children of either an
2712    /// unreleased Transform, or the Root Transform.
2713    ///
2714    /// Each Transform can have a single piece of attached Content. Common types of Content include
2715    /// bitmaps, asynchronous streams of images, and Viewports to Views hosted in other Flatland
2716    /// instances.
2717    ///
2718    /// Transforms have attributes. Child Transforms inherit the combined attributes of their
2719    /// parents. Content attached to a Transform is also affected by that Transform's attributes.
2720    ///
2721    /// When a sub-graph of Transforms is rendered, Content will be rendered back-to-front, starting
2722    /// with the Content on the root transform, and continuing recursively through all of its child
2723    /// Transforms in the order the children were added. See [`AddChild`] for more information.
2724    ///
2725    /// Zero is not a valid transform id. All other values are valid, assuming they are not already
2726    /// in use (see [`ReleaseTransform`] for more details).
2727    pub fn r#create_transform(&self, mut transform_id: &TransformId) -> Result<(), fidl::Error> {
2728        FlatlandProxyInterface::r#create_transform(self, transform_id)
2729    }
2730
2731    /// All Transform objects support all attributes.
2732    ///
2733    /// Geometric attributes are applied in the following order:
2734    /// 1. Scale (relative to the parent transform's coordinate space)
2735    /// 2. Orientation (relative to the parent transform's coordinate space)
2736    /// 3. Translation (relative to the parent transforms's coordinate space,
2737    ///    unaffected by scale applied to the current transform).
2738    /// 4. Clipping (relative to the current transform's coordinate space)
2739    ///
2740    /// The effects of each of these attributes are cumulative. This means the transform's position
2741    /// in the view space, and its clip boundary, will be calculated based on that chain of
2742    /// geometric attributes going up to the root transform.
2743    ///
2744    /// For instance, in a nested hierarchy such as the following:
2745    ///     [Root-Transform -> Transform1 -> Transform2 -> CurrentTransform]
2746    /// If Transform1 is translated by [2,0] and Transform2 is translated by [0,1] then the
2747    /// view-space position of CurrentTransform will be [2,1].
2748    ///
2749    /// Sets the translation on a Transform. The order of geometric attribute application is
2750    /// addressed above.
2751    pub fn r#set_translation(
2752        &self,
2753        mut transform_id: &TransformId,
2754        mut translation: &fidl_fuchsia_math::Vec_,
2755    ) -> Result<(), fidl::Error> {
2756        FlatlandProxyInterface::r#set_translation(self, transform_id, translation)
2757    }
2758
2759    /// Sets the orientation on a Transform. The order of geometric attribute application is
2760    /// addressed in the documentation for [`SetTranslation`]. In Flatland, the +X axis is
2761    /// to the right and the +Y axis is down. There is no notion of a Z axis. CCW is defined
2762    /// from the POV of the user, as if a skeuomorphoic clock is displayed on the screen.
2763    pub fn r#set_orientation(
2764        &self,
2765        mut transform_id: &TransformId,
2766        mut orientation: Orientation,
2767    ) -> Result<(), fidl::Error> {
2768        FlatlandProxyInterface::r#set_orientation(self, transform_id, orientation)
2769    }
2770
2771    /// Sets the scale on a transform. The order of geometric attribute application is
2772    /// addressed above. The (x,y) values in the VecF |scale| refer to the scale factor in the
2773    /// x-axis (width) and y-axis (height) respectively. Scale values must be normal 32-bit
2774    /// floating point values: https://en.wikipedia.org/wiki/Normal_number_%28computing%29
2775    pub fn r#set_scale(
2776        &self,
2777        mut transform_id: &TransformId,
2778        mut scale: &fidl_fuchsia_math::VecF,
2779    ) -> Result<(), fidl::Error> {
2780        FlatlandProxyInterface::r#set_scale(self, transform_id, scale)
2781    }
2782
2783    /// Sets an opacity in linear space to be applied to a transform and its descendents,
2784    /// which include other transforms and content. Opacity values must be in the range
2785    /// of [0.0, 1.0], where 0.0 is completely transparent and 1.0 is completely opaque.
2786    /// Attempting to call this function with values outside that range will result in
2787    /// an error. A transform's opacity value is multiplied with that of its parent. This
2788    /// effect works differently from group opacity. Using group opacity, child nodes are
2789    /// rendered together first, and then have the parent's opacity applied as a post-effect.
2790    /// Here, opacity is applied to each child individually. This may result in a very
2791    /// different effect.
2792    pub fn r#set_opacity(
2793        &self,
2794        mut transform_id: &TransformId,
2795        mut value: f32,
2796    ) -> Result<(), fidl::Error> {
2797        FlatlandProxyInterface::r#set_opacity(self, transform_id, value)
2798    }
2799
2800    /// Sets the bounds, expressed in the local coordinate space of the transform, that
2801    /// constrains the region that content attached to this transform can be rendered to.
2802    /// If the content's area exceeds the clip bounds, the area outside the bounds will
2803    /// not be rendered. These bounds are valid for all children of this transform node as
2804    /// well, which includes nested Flatland instances and their node hierarchies.
2805    /// If a child transform attempts to set clip bounds larger than that of its parent,
2806    /// it will be clipped to the parent's clip bounds. The default state is for a transform
2807    /// to be unclipped, meaning it will not have any bounds placed on its render region.
2808    /// The clip width/height must be positive. Negative values will result in an error.
2809    /// Passing in an empty box to the |rect| parameter will remove the clip bounds.
2810    pub fn r#set_clip_boundary(
2811        &self,
2812        mut transform_id: &TransformId,
2813        mut rect: Option<&fidl_fuchsia_math::Rect>,
2814    ) -> Result<(), fidl::Error> {
2815        FlatlandProxyInterface::r#set_clip_boundary(self, transform_id, rect)
2816    }
2817
2818    /// Adds a child Transform to a parent Transform. The new child Transform, and any Content
2819    /// attached to it or its children, will be rendered on top of the parent's Content, as well as
2820    /// any previously added children.
2821    pub fn r#add_child(
2822        &self,
2823        mut parent_transform_id: &TransformId,
2824        mut child_transform_id: &TransformId,
2825    ) -> Result<(), fidl::Error> {
2826        FlatlandProxyInterface::r#add_child(self, parent_transform_id, child_transform_id)
2827    }
2828
2829    /// Removes a child Transform from a parent Transform.
2830    pub fn r#remove_child(
2831        &self,
2832        mut parent_transform_id: &TransformId,
2833        mut child_transform_id: &TransformId,
2834    ) -> Result<(), fidl::Error> {
2835        FlatlandProxyInterface::r#remove_child(self, parent_transform_id, child_transform_id)
2836    }
2837
2838    /// Removes all child Transforms from a parent Transform and replaces them with the new child
2839    /// transforms in `new_child_transform_ids`.
2840    pub fn r#replace_children(
2841        &self,
2842        mut parent_transform_id: &TransformId,
2843        mut new_child_transform_ids: &[TransformId],
2844    ) -> Result<(), fidl::Error> {
2845        FlatlandProxyInterface::r#replace_children(
2846            self,
2847            parent_transform_id,
2848            new_child_transform_ids,
2849        )
2850    }
2851
2852    /// Sets the Root Transform for the graph.
2853    ///
2854    /// The sub-graph defined by the Root Transform and its children will be rendered as View
2855    /// in the connected parent's Viewport (see [`CreateView`]). Any parents of the Root Transform
2856    /// in this Graph will be ignored.
2857    ///
2858    /// The Root Transform, and all children of the Root Transform, are kept alive if they are
2859    /// released (see [`ReleaseTransform`] for more details).
2860    ///
2861    /// There is only ever one Root. Since 0 is not a valid transform id (see [`CreateTransform`]),
2862    /// calling SetRootTransform(0) clears the current Root, destroying any previously released
2863    /// objects that are not referenced by the new root.
2864    ///
2865    /// Note that every View has a clip boundary equivalent to its logical size. Anything outside
2866    /// that clip boundary will not be rendered. Hence, the Root Transform has a useful coordinate
2867    /// space of (0, 0) to (logical_size.width, logical_size.height), where (0, 0) is the upper left
2868    /// corner.
2869    ///
2870    /// Setting the root transform installs a full screen hit region on the root transform. Clients
2871    /// may remove this hit region if they don't want users to be able to interact with the root
2872    /// transform's content. For additional details on hit regions, see the [`SetHitRegions`]
2873    /// documentation.
2874    ///
2875    /// Default hit region rules
2876    ///
2877    ///   A default hit region follows these rules:
2878    ///   - When [`SetRootTransform`](T) is called, T receives a maximal hit region, covering the
2879    ///   entire view.
2880    ///   - If [`SetHitRegions`] is called on T, either before or after [`SetRootTransform`](T),
2881    ///   then no default hit region is active and the client specified hit regions are used.
2882    ///   - If a transform is no longer the root transform, i.e., [`SetRootTransform`](U) is
2883    ///   called, then the original transform no longer has its default hit region.
2884    ///   - Clients can remove or modify the root transform's hit regions the same way they would
2885    ///   reset any other transform's hit regions, by calling [`SetHitRegions`] with the appropriate
2886    ///   vector.
2887    pub fn r#set_root_transform(&self, mut transform_id: &TransformId) -> Result<(), fidl::Error> {
2888        FlatlandProxyInterface::r#set_root_transform(self, transform_id)
2889    }
2890
2891    /// Sets the interactive areas for a Transform. By default, Content is not interactive; hit
2892    /// regions must be placed for a user to interact with the Content in a View. Because hit
2893    /// regions are described in the Flatland protocol, a Flatland instance can synchronize Content
2894    /// and hit regions.
2895    ///
2896    /// Each hit region is placed in the coordinate space of the owning Transform, and may or may
2897    /// not interact with different types of hit testing, depending on its [`HitTestInteraction`]
2898    /// type. When there are multiple hit regions that intersect with a hit test, the precedence
2899    /// rules given below dictate which hit region has interacted with the hit test. Only Transforms
2900    /// that transitively connect to the root Transform have their hit regions interact with a hit
2901    /// test.
2902    ///
2903    /// Calling this function replaces any previous values set on this Transform. To reset a
2904    /// Transform to "no hit testing": send an empty vector with [`SetHitRegions`].
2905    ///
2906    /// Note that root transforms get a default hit region installed by Flatland. For more details,
2907    /// see the [`SetRootTransform`] documentation.
2908    ///
2909    /// Precedence rules
2910    ///   Within a Transform, if multiple hit regions overlap, the hit test examines each
2911    ///   intersecting hit region for a possible interaction. Thus, for a regular hit test R and an
2912    ///   accessibility hit test A, where R and A both intersect two hit regions D ([`DEFAULT`]) and
2913    ///   S ([`SEMANTICALLY_INVISIBLE`]) on the same Transform, (1) R interacts with both D and S,
2914    ///   and (2) A only interacts with D. Generally, hit regions that overlap in a single Transform
2915    ///   can cause confusing behavior.
2916    ///
2917    ///   Within a View, for a given hit test, the front-most Transform's hit regions take
2918    ///   precedence over those behind. This follows the expected reverse "render order" of
2919    ///   Transforms (described in [`CreateTransform`]), where a user expects to interact with
2920    ///   Content that is visible, or front-most.
2921    ///
2922    ///   Across Flatland instances, for a given hit test, the front-most instance's front-most
2923    ///   Transform's hit regions take precedence over those behind. This follows the expected
2924    ///   reverse "render order" of views, where a user expects to interact with the View that is
2925    ///   visible, or front-most. For example, if a child View owns Content that is rendered over
2926    ///   the parent View, the user expects to interact with the child's Content.
2927    pub fn r#set_hit_regions(
2928        &self,
2929        mut transform_id: &TransformId,
2930        mut regions: &[HitRegion],
2931    ) -> Result<(), fidl::Error> {
2932        FlatlandProxyInterface::r#set_hit_regions(self, transform_id, regions)
2933    }
2934
2935    /// Identical to [`SetHitRegions`], except the hit region associated with [`transform_id`]
2936    /// covers an infinite region. The hit region is invariant against translation, scaling, and
2937    /// orientation of the Transform.
2938    ///
2939    /// An infinite hit region is still limited in extent by the View's clip boundary, just like a
2940    /// finite hit region.
2941    ///
2942    /// Calling this function replaces any previous values set on this Transform. To reset a
2943    /// Transform to "no hit testing": send an empty vector with [`SetHitRegions`].
2944    pub fn r#set_infinite_hit_region(
2945        &self,
2946        mut transform_id: &TransformId,
2947        mut hit_test: HitTestInteraction,
2948    ) -> Result<(), fidl::Error> {
2949        FlatlandProxyInterface::r#set_infinite_hit_region(self, transform_id, hit_test)
2950    }
2951
2952    /// The Viewport and View pair, together, represent the connection between two Flatland
2953    /// instances. The Viewport is created in the parent, and the View is created in the child. The
2954    /// parent has control over how the child's View is integrated into its own View.
2955    ///
2956    /// Any illegal operations on ChildViewWatcher will cause both ChildViewWatcher channel and this
2957    /// Flatland channel to be torn down.
2958    ///
2959    /// `ViewportProperties` must have logical_size set. This is the initial size that will drive
2960    /// the layout of the child. The logical_size is also used as the default Content size, but
2961    /// subsequent changes to the logical_size will have no effect on the Content size.
2962    ///
2963    /// `ViewportProperties` may have inset field not set. In that case, the default value of
2964    /// (0, 0, 0, 0) is used.
2965    ///
2966    /// The logical_size must have positive X and Y components.
2967    ///
2968    /// Zero is not a valid ContentId. All other values are valid, assuming they are not already
2969    /// in use for another piece of Content (see [`ReleaseViewport`] for more details).
2970    ///
2971    /// Lifecycle note. The lifetime of the ChildViewWatcher channel is bound by the peer
2972    /// ViewCreationToken. When the ViewCreationToken dies, this ChildViewWatcher channel is
2973    /// destroyed.
2974    pub fn r#create_viewport(
2975        &self,
2976        mut viewport_id: &ContentId,
2977        mut token: fidl_fuchsia_ui_views::ViewportCreationToken,
2978        mut properties: &ViewportProperties,
2979        mut child_view_watcher: fidl::endpoints::ServerEnd<ChildViewWatcherMarker>,
2980    ) -> Result<(), fidl::Error> {
2981        FlatlandProxyInterface::r#create_viewport(
2982            self,
2983            viewport_id,
2984            token,
2985            properties,
2986            child_view_watcher,
2987        )
2988    }
2989
2990    /// An Image is a bitmap backed by a specific VMO in a BufferCollection.
2991    ///
2992    /// Image creation requires an allocated BufferCollection registered with Allocator. This
2993    /// function will fail unless all clients of the specified BufferCollection have set their
2994    /// constraints.
2995    ///
2996    /// The Image must reference a valid VMO index and must have ImageProperties that fall within
2997    /// the constraints specified by the backing BufferCollection (i.e. width and height within a
2998    /// valid range, etc.)
2999    ///
3000    /// Zero is not a valid Image id. All other values are valid, assuming they are not already in
3001    /// use for another piece of Content (see [`ReleaseImage`] for more details).
3002    pub fn r#create_image(
3003        &self,
3004        mut image_id: &ContentId,
3005        mut import_token: BufferCollectionImportToken,
3006        mut vmo_index: u32,
3007        mut properties: &ImageProperties,
3008    ) -> Result<(), fidl::Error> {
3009        FlatlandProxyInterface::r#create_image(self, image_id, import_token, vmo_index, properties)
3010    }
3011
3012    /// This function is used to determine the region (in texel space) of an image that will be used
3013    /// by Flatland when rendering. The image to be sampled is referenced by [`image_id`] and the
3014    /// sample region is specified by [`rect`] which itself is comprised of an origin point (x,y) as
3015    /// well as a width and height, in unnormalized coordinates. It is illegal to call this function
3016    /// on non-image content, or to sample a region outside of the texel space of the image. In
3017    /// other words, the region specifed by [`rect`] must not exceed the ranges (0, image_width) and
3018    /// (0, image_height). If (rect.x + rect.width > image_width) or (rect.y + rect.height >
3019    /// image_height) or if any of the values are negative, this will result in an error.
3020    ///
3021    /// If this method is not called, the default sample region is the rectangle with origin at
3022    /// (0, 0) and width and height set at ImageProperties from [`CreateImage`].
3023    pub fn r#set_image_sample_region(
3024        &self,
3025        mut image_id: &ContentId,
3026        mut rect: &fidl_fuchsia_math::RectF,
3027    ) -> Result<(), fidl::Error> {
3028        FlatlandProxyInterface::r#set_image_sample_region(self, image_id, rect)
3029    }
3030
3031    /// The content size for an Image is the size of the rectangle in the parent's logical
3032    /// coordinate space that the image occupies. This combined with the global translation of the
3033    /// transform it is attached to determines the size and location of where the content is
3034    /// rendered on the display.
3035    ///
3036    /// If this method is not called, the default image destination size is the width and height set
3037    /// at ImageProperties from [`CreateImage`]. The destination size will be affected by scaling if
3038    /// [`SetScale`] is used on the attached Transform or its parents.
3039    pub fn r#set_image_destination_size(
3040        &self,
3041        mut image_id: &ContentId,
3042        mut size: &fidl_fuchsia_math::SizeU,
3043    ) -> Result<(), fidl::Error> {
3044        FlatlandProxyInterface::r#set_image_destination_size(self, image_id, size)
3045    }
3046
3047    /// Determines the blend function to use when rendering the content specified by
3048    /// |image_id|. |image_id| must be a valid ContentId associated to a transform through
3049    /// a call to |CreateImage| or |CreateFilledRect|. For details on the different blend functions
3050    /// that are available, please refer to the BlendMode enum. If this function is not called, then
3051    /// the default blendmode is BlendMode::SRC.
3052    pub fn r#set_image_blending_function(
3053        &self,
3054        mut image_id: &ContentId,
3055        mut blend_mode: BlendMode,
3056    ) -> Result<(), fidl::Error> {
3057        FlatlandProxyInterface::r#set_image_blending_function(self, image_id, blend_mode)
3058    }
3059
3060    /// Determines the blend function to use when rendering the content specified by
3061    /// |image_id|. |image_id| must be a valid ContentId associated to a transform through
3062    /// a call to |CreateImage| or |CreateFilledRect|. For details on the different blend functions
3063    /// that are available, please refer to the BlendMode2 enum. If this function is not called,
3064    /// the default blendmode is BlendMode2::REPLACE.
3065    pub fn r#set_image_blend_mode(
3066        &self,
3067        mut image_id: &ContentId,
3068        mut blend_mode: BlendMode2,
3069    ) -> Result<(), fidl::Error> {
3070        FlatlandProxyInterface::r#set_image_blend_mode(self, image_id, blend_mode)
3071    }
3072
3073    /// Sets an opacity in linear space to be applied to a flatland image. Opacity values must
3074    /// be in the range [0.0, 1.0].
3075    pub fn r#set_image_opacity(
3076        &self,
3077        mut image_id: &ContentId,
3078        mut val: f32,
3079    ) -> Result<(), fidl::Error> {
3080        FlatlandProxyInterface::r#set_image_opacity(self, image_id, val)
3081    }
3082
3083    /// Sets the image flip to be applied to a flatland image. This call must be performed after a
3084    /// successful |CreateImage| call. If an invalid |image_id| is supplied, the channel will be
3085    /// closed due to FlatlandError::BAD_OPERATION. This flip will be applied to the Image before
3086    /// parent Transform Orientations. If this function is not called, then the default flip value
3087    /// is ImageFlip::NONE.
3088    pub fn r#set_image_flip(
3089        &self,
3090        mut image_id: &ContentId,
3091        mut flip: ImageFlip,
3092    ) -> Result<(), fidl::Error> {
3093        FlatlandProxyInterface::r#set_image_flip(self, image_id, flip)
3094    }
3095
3096    /// Creates a solid-color rectangle. By default a filled-rect does not have a defined
3097    /// color or size. It is necessary to call |SetSolidFill| to specify a color and size
3098    /// before a filled rect can be used for rendering. Not doing so will result the
3099    pub fn r#create_filled_rect(&self, mut rect_id: &ContentId) -> Result<(), fidl::Error> {
3100        FlatlandProxyInterface::r#create_filled_rect(self, rect_id)
3101    }
3102
3103    /// Defines the color and size of a filled rect. |rect_id| must refer to content that
3104    /// was created via a call to CreateFilledRect. The color is not premultiplied. Color values
3105    /// must be within the range [0,1] inclusive, and normal 32-bit
3106    /// floating point values: https://en.wikipedia.org/wiki/Normal_number_%28computing%29. Values
3107    /// that do not conform to these specifications will cause the channel to close.
3108    /// The rectangle's top left corner will be at (0, 0) in its transform's coordinate space.
3109    /// Hence, its bottom right corner will be at (size.width, size.height).
3110    pub fn r#set_solid_fill(
3111        &self,
3112        mut rect_id: &ContentId,
3113        mut color: &ColorRgba,
3114        mut size: &fidl_fuchsia_math::SizeU,
3115    ) -> Result<(), fidl::Error> {
3116        FlatlandProxyInterface::r#set_solid_fill(self, rect_id, color, size)
3117    }
3118
3119    /// Automatically garbage collects the rectangle when it is no longer needed for
3120    /// rendering. |rect_id| must have been instantiated with a call to
3121    /// |CreateFilledRect|. Once released, the ID immediately goes out of scope and is free
3122    /// to be used again.
3123    pub fn r#release_filled_rect(&self, mut rect_id: &ContentId) -> Result<(), fidl::Error> {
3124        FlatlandProxyInterface::r#release_filled_rect(self, rect_id)
3125    }
3126
3127    /// Setting a piece of Content on a Transform makes that Content visible in the render tree as
3128    /// long as the Transform is visible from the root Transform. The Content will be rendered
3129    /// before, and therefore "behind", any Content attached to the descendants of the Transform.
3130    ///
3131    /// Because each Transform can have, at most, a single piece of Content on it, calling this
3132    /// function on a Transform that already has Content will replace that Content.
3133    ///
3134    /// A Content may be set on more than one Transform.
3135    ///
3136    /// Calling this function with a Content id of 0 will remove any Content currently on the
3137    /// Transform.
3138    pub fn r#set_content(
3139        &self,
3140        mut transform_id: &TransformId,
3141        mut content_id: &ContentId,
3142    ) -> Result<(), fidl::Error> {
3143        FlatlandProxyInterface::r#set_content(self, transform_id, content_id)
3144    }
3145
3146    /// Transforms are usually sufficient to change how Content is presented. Viewports, however,
3147    /// have special properties that are not part of the Transform hierarchy. Those properties can
3148    /// be set using this function.
3149    pub fn r#set_viewport_properties(
3150        &self,
3151        mut viewport_id: &ContentId,
3152        mut properties: &ViewportProperties,
3153    ) -> Result<(), fidl::Error> {
3154        FlatlandProxyInterface::r#set_viewport_properties(self, viewport_id, properties)
3155    }
3156
3157    /// Released Transforms will be garbage collected by the system once they are no longer
3158    /// necessary for rendering. For Transforms, this means there is no path from any unreleased
3159    /// Transform to the newly-released Transform.
3160    ///
3161    /// Once released, the id immediately goes out of scope for future function calls and can be
3162    /// reused when creating new Transforms.
3163    ///
3164    /// It is an error to call functions with a released id (unless that id has been reused to
3165    /// construct a new Transform).
3166    pub fn r#release_transform(&self, mut transform_id: &TransformId) -> Result<(), fidl::Error> {
3167        FlatlandProxyInterface::r#release_transform(self, transform_id)
3168    }
3169
3170    pub fn r#release_view(&self) -> Result<(), fidl::Error> {
3171        FlatlandProxyInterface::r#release_view(self)
3172    }
3173
3174    /// Releases a Viewport from the scene, even if the Viewport is still connected to a Transform.
3175    /// Unlike other resources, Viewports are garbage collected by the system during the next
3176    /// [`Present`] because a removed Viewport is guaranteed to provide no renderable content.
3177    ///
3178    /// Use SetContent(transform_id, 0) to clean up references to released Viewports.
3179    ///
3180    /// Despite having a return type, this function is still feed-forward like [`CreateView`] and
3181    /// requires a call to [`Present`] to be executed. The ViewportCreationToken will be returned
3182    /// after the presented operations have been executed.
3183    pub fn r#release_viewport(
3184        &self,
3185        mut viewport_id: &ContentId,
3186    ) -> fidl::client::QueryResponseFut<
3187        fidl_fuchsia_ui_views::ViewportCreationToken,
3188        fidl::encoding::DefaultFuchsiaResourceDialect,
3189    > {
3190        FlatlandProxyInterface::r#release_viewport(self, viewport_id)
3191    }
3192
3193    /// Released Images will be garbage collected by the system once they are no longer necessary
3194    /// for rendering. For Images, this means the Image is no longer attached to any Transform and
3195    /// any pending rendering that references the Image is complete.
3196    ///
3197    /// Use SetContent(transform_id, 0) to clean up references to released Images.
3198    ///
3199    /// Once released, the id immediately goes out of scope for future function calls and can be
3200    /// reused when creating new Images.
3201    ///
3202    /// It is an error to call functions with a released id (unless that id has been reused to
3203    /// construct a new Image).
3204    pub fn r#release_image(&self, mut image_id: &ContentId) -> Result<(), fidl::Error> {
3205        FlatlandProxyInterface::r#release_image(self, image_id)
3206    }
3207
3208    /// This function will reset all state on this interface. This includes destroying all existing
3209    /// View and Viewports without returning the associated Token to the caller.
3210    pub fn r#clear(&self) -> Result<(), fidl::Error> {
3211        FlatlandProxyInterface::r#clear(self)
3212    }
3213
3214    /// Set debug name of the current client that can be used by Flatland to print as a prefix to
3215    /// logs to help client distinguish what is theirs. [`name`] can be an arbitrary string, but the
3216    /// current process name (see fsl::GetCurrentProcessName()) is a good default.
3217    pub fn r#set_debug_name(&self, mut name: &str) -> Result<(), fidl::Error> {
3218        FlatlandProxyInterface::r#set_debug_name(self, name)
3219    }
3220}
3221
3222impl FlatlandProxyInterface for FlatlandProxy {
3223    fn r#present(&self, mut args: PresentArgs) -> Result<(), fidl::Error> {
3224        self.client.send::<FlatlandPresentRequest>(
3225            (&mut args,),
3226            0x50acc2aa1f0acec7,
3227            fidl::encoding::DynamicFlags::empty(),
3228        )
3229    }
3230
3231    fn r#create_view(
3232        &self,
3233        mut token: fidl_fuchsia_ui_views::ViewCreationToken,
3234        mut parent_viewport_watcher: fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>,
3235    ) -> Result<(), fidl::Error> {
3236        self.client.send::<FlatlandCreateViewRequest>(
3237            (&mut token, parent_viewport_watcher),
3238            0x504686eb25864780,
3239            fidl::encoding::DynamicFlags::empty(),
3240        )
3241    }
3242
3243    fn r#create_view2(
3244        &self,
3245        mut token: fidl_fuchsia_ui_views::ViewCreationToken,
3246        mut view_identity: fidl_fuchsia_ui_views::ViewIdentityOnCreation,
3247        mut protocols: ViewBoundProtocols,
3248        mut parent_viewport_watcher: fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>,
3249    ) -> Result<(), fidl::Error> {
3250        self.client.send::<FlatlandCreateView2Request>(
3251            (&mut token, &mut view_identity, &mut protocols, parent_viewport_watcher),
3252            0x340a3a40c2fdbd5e,
3253            fidl::encoding::DynamicFlags::empty(),
3254        )
3255    }
3256
3257    fn r#create_transform(&self, mut transform_id: &TransformId) -> Result<(), fidl::Error> {
3258        self.client.send::<FlatlandCreateTransformRequest>(
3259            (transform_id,),
3260            0x5e042a4d3de3efb0,
3261            fidl::encoding::DynamicFlags::empty(),
3262        )
3263    }
3264
3265    fn r#set_translation(
3266        &self,
3267        mut transform_id: &TransformId,
3268        mut translation: &fidl_fuchsia_math::Vec_,
3269    ) -> Result<(), fidl::Error> {
3270        self.client.send::<FlatlandSetTranslationRequest>(
3271            (transform_id, translation),
3272            0x7863398291fba346,
3273            fidl::encoding::DynamicFlags::empty(),
3274        )
3275    }
3276
3277    fn r#set_orientation(
3278        &self,
3279        mut transform_id: &TransformId,
3280        mut orientation: Orientation,
3281    ) -> Result<(), fidl::Error> {
3282        self.client.send::<FlatlandSetOrientationRequest>(
3283            (transform_id, orientation),
3284            0x4915310bc4928edc,
3285            fidl::encoding::DynamicFlags::empty(),
3286        )
3287    }
3288
3289    fn r#set_scale(
3290        &self,
3291        mut transform_id: &TransformId,
3292        mut scale: &fidl_fuchsia_math::VecF,
3293    ) -> Result<(), fidl::Error> {
3294        self.client.send::<FlatlandSetScaleRequest>(
3295            (transform_id, scale),
3296            0x1ea1766fd8996bb4,
3297            fidl::encoding::DynamicFlags::empty(),
3298        )
3299    }
3300
3301    fn r#set_opacity(
3302        &self,
3303        mut transform_id: &TransformId,
3304        mut value: f32,
3305    ) -> Result<(), fidl::Error> {
3306        self.client.send::<FlatlandSetOpacityRequest>(
3307            (transform_id, value),
3308            0x3775fc2c00b432fa,
3309            fidl::encoding::DynamicFlags::empty(),
3310        )
3311    }
3312
3313    fn r#set_clip_boundary(
3314        &self,
3315        mut transform_id: &TransformId,
3316        mut rect: Option<&fidl_fuchsia_math::Rect>,
3317    ) -> Result<(), fidl::Error> {
3318        self.client.send::<FlatlandSetClipBoundaryRequest>(
3319            (transform_id, rect),
3320            0x6507843df12222d2,
3321            fidl::encoding::DynamicFlags::empty(),
3322        )
3323    }
3324
3325    fn r#add_child(
3326        &self,
3327        mut parent_transform_id: &TransformId,
3328        mut child_transform_id: &TransformId,
3329    ) -> Result<(), fidl::Error> {
3330        self.client.send::<FlatlandAddChildRequest>(
3331            (parent_transform_id, child_transform_id),
3332            0x67a8abd2f19b1a74,
3333            fidl::encoding::DynamicFlags::empty(),
3334        )
3335    }
3336
3337    fn r#remove_child(
3338        &self,
3339        mut parent_transform_id: &TransformId,
3340        mut child_transform_id: &TransformId,
3341    ) -> Result<(), fidl::Error> {
3342        self.client.send::<FlatlandRemoveChildRequest>(
3343            (parent_transform_id, child_transform_id),
3344            0x41d6cd90b298b67a,
3345            fidl::encoding::DynamicFlags::empty(),
3346        )
3347    }
3348
3349    fn r#replace_children(
3350        &self,
3351        mut parent_transform_id: &TransformId,
3352        mut new_child_transform_ids: &[TransformId],
3353    ) -> Result<(), fidl::Error> {
3354        self.client.send::<FlatlandReplaceChildrenRequest>(
3355            (parent_transform_id, new_child_transform_ids),
3356            0x5b6d86cbbff81316,
3357            fidl::encoding::DynamicFlags::empty(),
3358        )
3359    }
3360
3361    fn r#set_root_transform(&self, mut transform_id: &TransformId) -> Result<(), fidl::Error> {
3362        self.client.send::<FlatlandSetRootTransformRequest>(
3363            (transform_id,),
3364            0x6e80ca5bcc566cd8,
3365            fidl::encoding::DynamicFlags::empty(),
3366        )
3367    }
3368
3369    fn r#set_hit_regions(
3370        &self,
3371        mut transform_id: &TransformId,
3372        mut regions: &[HitRegion],
3373    ) -> Result<(), fidl::Error> {
3374        self.client.send::<FlatlandSetHitRegionsRequest>(
3375            (transform_id, regions),
3376            0x31c9d17b07c37ce4,
3377            fidl::encoding::DynamicFlags::empty(),
3378        )
3379    }
3380
3381    fn r#set_infinite_hit_region(
3382        &self,
3383        mut transform_id: &TransformId,
3384        mut hit_test: HitTestInteraction,
3385    ) -> Result<(), fidl::Error> {
3386        self.client.send::<FlatlandSetInfiniteHitRegionRequest>(
3387            (transform_id, hit_test),
3388            0x26d81af852d29562,
3389            fidl::encoding::DynamicFlags::empty(),
3390        )
3391    }
3392
3393    fn r#create_viewport(
3394        &self,
3395        mut viewport_id: &ContentId,
3396        mut token: fidl_fuchsia_ui_views::ViewportCreationToken,
3397        mut properties: &ViewportProperties,
3398        mut child_view_watcher: fidl::endpoints::ServerEnd<ChildViewWatcherMarker>,
3399    ) -> Result<(), fidl::Error> {
3400        self.client.send::<FlatlandCreateViewportRequest>(
3401            (viewport_id, &mut token, properties, child_view_watcher),
3402            0x2485fbcab7f943c,
3403            fidl::encoding::DynamicFlags::empty(),
3404        )
3405    }
3406
3407    fn r#create_image(
3408        &self,
3409        mut image_id: &ContentId,
3410        mut import_token: BufferCollectionImportToken,
3411        mut vmo_index: u32,
3412        mut properties: &ImageProperties,
3413    ) -> Result<(), fidl::Error> {
3414        self.client.send::<FlatlandCreateImageRequest>(
3415            (image_id, &mut import_token, vmo_index, properties),
3416            0x26fae823c4ebedad,
3417            fidl::encoding::DynamicFlags::empty(),
3418        )
3419    }
3420
3421    fn r#set_image_sample_region(
3422        &self,
3423        mut image_id: &ContentId,
3424        mut rect: &fidl_fuchsia_math::RectF,
3425    ) -> Result<(), fidl::Error> {
3426        self.client.send::<FlatlandSetImageSampleRegionRequest>(
3427            (image_id, rect),
3428            0x8039391d715eb28,
3429            fidl::encoding::DynamicFlags::empty(),
3430        )
3431    }
3432
3433    fn r#set_image_destination_size(
3434        &self,
3435        mut image_id: &ContentId,
3436        mut size: &fidl_fuchsia_math::SizeU,
3437    ) -> Result<(), fidl::Error> {
3438        self.client.send::<FlatlandSetImageDestinationSizeRequest>(
3439            (image_id, size),
3440            0x766cf99a2ec58446,
3441            fidl::encoding::DynamicFlags::empty(),
3442        )
3443    }
3444
3445    fn r#set_image_blending_function(
3446        &self,
3447        mut image_id: &ContentId,
3448        mut blend_mode: BlendMode,
3449    ) -> Result<(), fidl::Error> {
3450        self.client.send::<FlatlandSetImageBlendingFunctionRequest>(
3451            (image_id, blend_mode),
3452            0x10f5da1356275b7b,
3453            fidl::encoding::DynamicFlags::empty(),
3454        )
3455    }
3456
3457    fn r#set_image_blend_mode(
3458        &self,
3459        mut image_id: &ContentId,
3460        mut blend_mode: BlendMode2,
3461    ) -> Result<(), fidl::Error> {
3462        self.client.send::<FlatlandSetImageBlendModeRequest>(
3463            (image_id, blend_mode),
3464            0x5b1667f130c3de67,
3465            fidl::encoding::DynamicFlags::empty(),
3466        )
3467    }
3468
3469    fn r#set_image_opacity(
3470        &self,
3471        mut image_id: &ContentId,
3472        mut val: f32,
3473    ) -> Result<(), fidl::Error> {
3474        self.client.send::<FlatlandSetImageOpacityRequest>(
3475            (image_id, val),
3476            0x2da9e4ef4c2cff6f,
3477            fidl::encoding::DynamicFlags::empty(),
3478        )
3479    }
3480
3481    fn r#set_image_flip(
3482        &self,
3483        mut image_id: &ContentId,
3484        mut flip: ImageFlip,
3485    ) -> Result<(), fidl::Error> {
3486        self.client.send::<FlatlandSetImageFlipRequest>(
3487            (image_id, flip),
3488            0x21b20f2c14aae6bc,
3489            fidl::encoding::DynamicFlags::empty(),
3490        )
3491    }
3492
3493    fn r#create_filled_rect(&self, mut rect_id: &ContentId) -> Result<(), fidl::Error> {
3494        self.client.send::<FlatlandCreateFilledRectRequest>(
3495            (rect_id,),
3496            0x5e62355abc1c4c5d,
3497            fidl::encoding::DynamicFlags::empty(),
3498        )
3499    }
3500
3501    fn r#set_solid_fill(
3502        &self,
3503        mut rect_id: &ContentId,
3504        mut color: &ColorRgba,
3505        mut size: &fidl_fuchsia_math::SizeU,
3506    ) -> Result<(), fidl::Error> {
3507        self.client.send::<FlatlandSetSolidFillRequest>(
3508            (rect_id, color, size),
3509            0x32d6ef41e182dfa5,
3510            fidl::encoding::DynamicFlags::empty(),
3511        )
3512    }
3513
3514    fn r#release_filled_rect(&self, mut rect_id: &ContentId) -> Result<(), fidl::Error> {
3515        self.client.send::<FlatlandReleaseFilledRectRequest>(
3516            (rect_id,),
3517            0x7392cabe45618f9b,
3518            fidl::encoding::DynamicFlags::empty(),
3519        )
3520    }
3521
3522    fn r#set_content(
3523        &self,
3524        mut transform_id: &TransformId,
3525        mut content_id: &ContentId,
3526    ) -> Result<(), fidl::Error> {
3527        self.client.send::<FlatlandSetContentRequest>(
3528            (transform_id, content_id),
3529            0x4ed2cfc0ce130862,
3530            fidl::encoding::DynamicFlags::empty(),
3531        )
3532    }
3533
3534    fn r#set_viewport_properties(
3535        &self,
3536        mut viewport_id: &ContentId,
3537        mut properties: &ViewportProperties,
3538    ) -> Result<(), fidl::Error> {
3539        self.client.send::<FlatlandSetViewportPropertiesRequest>(
3540            (viewport_id, properties),
3541            0x66ab67e9608ddb9f,
3542            fidl::encoding::DynamicFlags::empty(),
3543        )
3544    }
3545
3546    fn r#release_transform(&self, mut transform_id: &TransformId) -> Result<(), fidl::Error> {
3547        self.client.send::<FlatlandReleaseTransformRequest>(
3548            (transform_id,),
3549            0xab9328419451c22,
3550            fidl::encoding::DynamicFlags::empty(),
3551        )
3552    }
3553
3554    fn r#release_view(&self) -> Result<(), fidl::Error> {
3555        self.client.send::<fidl::encoding::EmptyPayload>(
3556            (),
3557            0x5b35aab9baffecae,
3558            fidl::encoding::DynamicFlags::empty(),
3559        )
3560    }
3561
3562    type ReleaseViewportResponseFut = fidl::client::QueryResponseFut<
3563        fidl_fuchsia_ui_views::ViewportCreationToken,
3564        fidl::encoding::DefaultFuchsiaResourceDialect,
3565    >;
3566    fn r#release_viewport(&self, mut viewport_id: &ContentId) -> Self::ReleaseViewportResponseFut {
3567        fn _decode(
3568            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3569        ) -> Result<fidl_fuchsia_ui_views::ViewportCreationToken, fidl::Error> {
3570            let _response = fidl::client::decode_transaction_body::<
3571                FlatlandReleaseViewportResponse,
3572                fidl::encoding::DefaultFuchsiaResourceDialect,
3573                0xbad474aeb5293f9,
3574            >(_buf?)?;
3575            Ok(_response.token)
3576        }
3577        self.client.send_query_and_decode::<
3578            FlatlandReleaseViewportRequest,
3579            fidl_fuchsia_ui_views::ViewportCreationToken,
3580        >(
3581            (viewport_id,),
3582            0xbad474aeb5293f9,
3583            fidl::encoding::DynamicFlags::empty(),
3584            _decode,
3585        )
3586    }
3587
3588    fn r#release_image(&self, mut image_id: &ContentId) -> Result<(), fidl::Error> {
3589        self.client.send::<FlatlandReleaseImageRequest>(
3590            (image_id,),
3591            0xb884ffdbc72c111,
3592            fidl::encoding::DynamicFlags::empty(),
3593        )
3594    }
3595
3596    fn r#clear(&self) -> Result<(), fidl::Error> {
3597        self.client.send::<fidl::encoding::EmptyPayload>(
3598            (),
3599            0x4ec8817c02828c3e,
3600            fidl::encoding::DynamicFlags::empty(),
3601        )
3602    }
3603
3604    fn r#set_debug_name(&self, mut name: &str) -> Result<(), fidl::Error> {
3605        self.client.send::<FlatlandSetDebugNameRequest>(
3606            (name,),
3607            0x46a8b397e68a8888,
3608            fidl::encoding::DynamicFlags::empty(),
3609        )
3610    }
3611}
3612
3613pub struct FlatlandEventStream {
3614    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
3615}
3616
3617impl std::marker::Unpin for FlatlandEventStream {}
3618
3619impl futures::stream::FusedStream for FlatlandEventStream {
3620    fn is_terminated(&self) -> bool {
3621        self.event_receiver.is_terminated()
3622    }
3623}
3624
3625impl futures::Stream for FlatlandEventStream {
3626    type Item = Result<FlatlandEvent, fidl::Error>;
3627
3628    fn poll_next(
3629        mut self: std::pin::Pin<&mut Self>,
3630        cx: &mut std::task::Context<'_>,
3631    ) -> std::task::Poll<Option<Self::Item>> {
3632        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
3633            &mut self.event_receiver,
3634            cx
3635        )?) {
3636            Some(buf) => std::task::Poll::Ready(Some(FlatlandEvent::decode(buf))),
3637            None => std::task::Poll::Ready(None),
3638        }
3639    }
3640}
3641
3642#[derive(Debug)]
3643pub enum FlatlandEvent {
3644    OnNextFrameBegin { values: OnNextFrameBeginValues },
3645    OnFramePresented { frame_presented_info: fidl_fuchsia_scenic_scheduling::FramePresentedInfo },
3646    OnError { error: FlatlandError },
3647}
3648
3649impl FlatlandEvent {
3650    #[allow(irrefutable_let_patterns)]
3651    pub fn into_on_next_frame_begin(self) -> Option<OnNextFrameBeginValues> {
3652        if let FlatlandEvent::OnNextFrameBegin { values } = self { Some((values)) } else { None }
3653    }
3654    #[allow(irrefutable_let_patterns)]
3655    pub fn into_on_frame_presented(
3656        self,
3657    ) -> Option<fidl_fuchsia_scenic_scheduling::FramePresentedInfo> {
3658        if let FlatlandEvent::OnFramePresented { frame_presented_info } = self {
3659            Some((frame_presented_info))
3660        } else {
3661            None
3662        }
3663    }
3664    #[allow(irrefutable_let_patterns)]
3665    pub fn into_on_error(self) -> Option<FlatlandError> {
3666        if let FlatlandEvent::OnError { error } = self { Some((error)) } else { None }
3667    }
3668
3669    /// Decodes a message buffer as a [`FlatlandEvent`].
3670    fn decode(
3671        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3672    ) -> Result<FlatlandEvent, fidl::Error> {
3673        let (bytes, _handles) = buf.split_mut();
3674        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3675        debug_assert_eq!(tx_header.tx_id, 0);
3676        match tx_header.ordinal {
3677            0x10f69a5cdeece84a => {
3678                let mut out = fidl::new_empty!(
3679                    FlatlandOnNextFrameBeginRequest,
3680                    fidl::encoding::DefaultFuchsiaResourceDialect
3681                );
3682                fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandOnNextFrameBeginRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
3683                Ok((FlatlandEvent::OnNextFrameBegin { values: out.values }))
3684            }
3685            0x56e43e1a5f30216d => {
3686                let mut out = fidl::new_empty!(
3687                    FlatlandOnFramePresentedRequest,
3688                    fidl::encoding::DefaultFuchsiaResourceDialect
3689                );
3690                fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandOnFramePresentedRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
3691                Ok((FlatlandEvent::OnFramePresented {
3692                    frame_presented_info: out.frame_presented_info,
3693                }))
3694            }
3695            0x1ebf39e90cd8b8d => {
3696                let mut out = fidl::new_empty!(
3697                    FlatlandOnErrorRequest,
3698                    fidl::encoding::DefaultFuchsiaResourceDialect
3699                );
3700                fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandOnErrorRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
3701                Ok((FlatlandEvent::OnError { error: out.error }))
3702            }
3703            _ => Err(fidl::Error::UnknownOrdinal {
3704                ordinal: tx_header.ordinal,
3705                protocol_name: <FlatlandMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3706            }),
3707        }
3708    }
3709}
3710
3711/// A Stream of incoming requests for fuchsia.ui.composition/Flatland.
3712pub struct FlatlandRequestStream {
3713    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3714    is_terminated: bool,
3715}
3716
3717impl std::marker::Unpin for FlatlandRequestStream {}
3718
3719impl futures::stream::FusedStream for FlatlandRequestStream {
3720    fn is_terminated(&self) -> bool {
3721        self.is_terminated
3722    }
3723}
3724
3725impl fidl::endpoints::RequestStream for FlatlandRequestStream {
3726    type Protocol = FlatlandMarker;
3727    type ControlHandle = FlatlandControlHandle;
3728
3729    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
3730        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3731    }
3732
3733    fn control_handle(&self) -> Self::ControlHandle {
3734        FlatlandControlHandle { inner: self.inner.clone() }
3735    }
3736
3737    fn into_inner(
3738        self,
3739    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3740    {
3741        (self.inner, self.is_terminated)
3742    }
3743
3744    fn from_inner(
3745        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3746        is_terminated: bool,
3747    ) -> Self {
3748        Self { inner, is_terminated }
3749    }
3750}
3751
3752impl futures::Stream for FlatlandRequestStream {
3753    type Item = Result<FlatlandRequest, fidl::Error>;
3754
3755    fn poll_next(
3756        mut self: std::pin::Pin<&mut Self>,
3757        cx: &mut std::task::Context<'_>,
3758    ) -> std::task::Poll<Option<Self::Item>> {
3759        let this = &mut *self;
3760        if this.inner.check_shutdown(cx) {
3761            this.is_terminated = true;
3762            return std::task::Poll::Ready(None);
3763        }
3764        if this.is_terminated {
3765            panic!("polled FlatlandRequestStream after completion");
3766        }
3767        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3768            |bytes, handles| {
3769                match this.inner.channel().read_etc(cx, bytes, handles) {
3770                    std::task::Poll::Ready(Ok(())) => {}
3771                    std::task::Poll::Pending => return std::task::Poll::Pending,
3772                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3773                        this.is_terminated = true;
3774                        return std::task::Poll::Ready(None);
3775                    }
3776                    std::task::Poll::Ready(Err(e)) => {
3777                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3778                            e.into(),
3779                        ))));
3780                    }
3781                }
3782
3783                // A message has been received from the channel
3784                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3785
3786                std::task::Poll::Ready(Some(match header.ordinal {
3787                    0x50acc2aa1f0acec7 => {
3788                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3789                        let mut req = fidl::new_empty!(
3790                            FlatlandPresentRequest,
3791                            fidl::encoding::DefaultFuchsiaResourceDialect
3792                        );
3793                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandPresentRequest>(&header, _body_bytes, handles, &mut req)?;
3794                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
3795                        Ok(FlatlandRequest::Present { args: req.args, control_handle })
3796                    }
3797                    0x504686eb25864780 => {
3798                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3799                        let mut req = fidl::new_empty!(
3800                            FlatlandCreateViewRequest,
3801                            fidl::encoding::DefaultFuchsiaResourceDialect
3802                        );
3803                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandCreateViewRequest>(&header, _body_bytes, handles, &mut req)?;
3804                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
3805                        Ok(FlatlandRequest::CreateView {
3806                            token: req.token,
3807                            parent_viewport_watcher: req.parent_viewport_watcher,
3808
3809                            control_handle,
3810                        })
3811                    }
3812                    0x340a3a40c2fdbd5e => {
3813                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3814                        let mut req = fidl::new_empty!(
3815                            FlatlandCreateView2Request,
3816                            fidl::encoding::DefaultFuchsiaResourceDialect
3817                        );
3818                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandCreateView2Request>(&header, _body_bytes, handles, &mut req)?;
3819                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
3820                        Ok(FlatlandRequest::CreateView2 {
3821                            token: req.token,
3822                            view_identity: req.view_identity,
3823                            protocols: req.protocols,
3824                            parent_viewport_watcher: req.parent_viewport_watcher,
3825
3826                            control_handle,
3827                        })
3828                    }
3829                    0x5e042a4d3de3efb0 => {
3830                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3831                        let mut req = fidl::new_empty!(
3832                            FlatlandCreateTransformRequest,
3833                            fidl::encoding::DefaultFuchsiaResourceDialect
3834                        );
3835                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandCreateTransformRequest>(&header, _body_bytes, handles, &mut req)?;
3836                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
3837                        Ok(FlatlandRequest::CreateTransform {
3838                            transform_id: req.transform_id,
3839
3840                            control_handle,
3841                        })
3842                    }
3843                    0x7863398291fba346 => {
3844                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3845                        let mut req = fidl::new_empty!(
3846                            FlatlandSetTranslationRequest,
3847                            fidl::encoding::DefaultFuchsiaResourceDialect
3848                        );
3849                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetTranslationRequest>(&header, _body_bytes, handles, &mut req)?;
3850                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
3851                        Ok(FlatlandRequest::SetTranslation {
3852                            transform_id: req.transform_id,
3853                            translation: req.translation,
3854
3855                            control_handle,
3856                        })
3857                    }
3858                    0x4915310bc4928edc => {
3859                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3860                        let mut req = fidl::new_empty!(
3861                            FlatlandSetOrientationRequest,
3862                            fidl::encoding::DefaultFuchsiaResourceDialect
3863                        );
3864                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetOrientationRequest>(&header, _body_bytes, handles, &mut req)?;
3865                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
3866                        Ok(FlatlandRequest::SetOrientation {
3867                            transform_id: req.transform_id,
3868                            orientation: req.orientation,
3869
3870                            control_handle,
3871                        })
3872                    }
3873                    0x1ea1766fd8996bb4 => {
3874                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3875                        let mut req = fidl::new_empty!(
3876                            FlatlandSetScaleRequest,
3877                            fidl::encoding::DefaultFuchsiaResourceDialect
3878                        );
3879                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetScaleRequest>(&header, _body_bytes, handles, &mut req)?;
3880                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
3881                        Ok(FlatlandRequest::SetScale {
3882                            transform_id: req.transform_id,
3883                            scale: req.scale,
3884
3885                            control_handle,
3886                        })
3887                    }
3888                    0x3775fc2c00b432fa => {
3889                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3890                        let mut req = fidl::new_empty!(
3891                            FlatlandSetOpacityRequest,
3892                            fidl::encoding::DefaultFuchsiaResourceDialect
3893                        );
3894                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetOpacityRequest>(&header, _body_bytes, handles, &mut req)?;
3895                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
3896                        Ok(FlatlandRequest::SetOpacity {
3897                            transform_id: req.transform_id,
3898                            value: req.value,
3899
3900                            control_handle,
3901                        })
3902                    }
3903                    0x6507843df12222d2 => {
3904                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3905                        let mut req = fidl::new_empty!(
3906                            FlatlandSetClipBoundaryRequest,
3907                            fidl::encoding::DefaultFuchsiaResourceDialect
3908                        );
3909                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetClipBoundaryRequest>(&header, _body_bytes, handles, &mut req)?;
3910                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
3911                        Ok(FlatlandRequest::SetClipBoundary {
3912                            transform_id: req.transform_id,
3913                            rect: req.rect,
3914
3915                            control_handle,
3916                        })
3917                    }
3918                    0x67a8abd2f19b1a74 => {
3919                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3920                        let mut req = fidl::new_empty!(
3921                            FlatlandAddChildRequest,
3922                            fidl::encoding::DefaultFuchsiaResourceDialect
3923                        );
3924                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandAddChildRequest>(&header, _body_bytes, handles, &mut req)?;
3925                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
3926                        Ok(FlatlandRequest::AddChild {
3927                            parent_transform_id: req.parent_transform_id,
3928                            child_transform_id: req.child_transform_id,
3929
3930                            control_handle,
3931                        })
3932                    }
3933                    0x41d6cd90b298b67a => {
3934                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3935                        let mut req = fidl::new_empty!(
3936                            FlatlandRemoveChildRequest,
3937                            fidl::encoding::DefaultFuchsiaResourceDialect
3938                        );
3939                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandRemoveChildRequest>(&header, _body_bytes, handles, &mut req)?;
3940                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
3941                        Ok(FlatlandRequest::RemoveChild {
3942                            parent_transform_id: req.parent_transform_id,
3943                            child_transform_id: req.child_transform_id,
3944
3945                            control_handle,
3946                        })
3947                    }
3948                    0x5b6d86cbbff81316 => {
3949                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3950                        let mut req = fidl::new_empty!(
3951                            FlatlandReplaceChildrenRequest,
3952                            fidl::encoding::DefaultFuchsiaResourceDialect
3953                        );
3954                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandReplaceChildrenRequest>(&header, _body_bytes, handles, &mut req)?;
3955                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
3956                        Ok(FlatlandRequest::ReplaceChildren {
3957                            parent_transform_id: req.parent_transform_id,
3958                            new_child_transform_ids: req.new_child_transform_ids,
3959
3960                            control_handle,
3961                        })
3962                    }
3963                    0x6e80ca5bcc566cd8 => {
3964                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3965                        let mut req = fidl::new_empty!(
3966                            FlatlandSetRootTransformRequest,
3967                            fidl::encoding::DefaultFuchsiaResourceDialect
3968                        );
3969                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetRootTransformRequest>(&header, _body_bytes, handles, &mut req)?;
3970                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
3971                        Ok(FlatlandRequest::SetRootTransform {
3972                            transform_id: req.transform_id,
3973
3974                            control_handle,
3975                        })
3976                    }
3977                    0x31c9d17b07c37ce4 => {
3978                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3979                        let mut req = fidl::new_empty!(
3980                            FlatlandSetHitRegionsRequest,
3981                            fidl::encoding::DefaultFuchsiaResourceDialect
3982                        );
3983                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetHitRegionsRequest>(&header, _body_bytes, handles, &mut req)?;
3984                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
3985                        Ok(FlatlandRequest::SetHitRegions {
3986                            transform_id: req.transform_id,
3987                            regions: req.regions,
3988
3989                            control_handle,
3990                        })
3991                    }
3992                    0x26d81af852d29562 => {
3993                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3994                        let mut req = fidl::new_empty!(
3995                            FlatlandSetInfiniteHitRegionRequest,
3996                            fidl::encoding::DefaultFuchsiaResourceDialect
3997                        );
3998                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetInfiniteHitRegionRequest>(&header, _body_bytes, handles, &mut req)?;
3999                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4000                        Ok(FlatlandRequest::SetInfiniteHitRegion {
4001                            transform_id: req.transform_id,
4002                            hit_test: req.hit_test,
4003
4004                            control_handle,
4005                        })
4006                    }
4007                    0x2485fbcab7f943c => {
4008                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4009                        let mut req = fidl::new_empty!(
4010                            FlatlandCreateViewportRequest,
4011                            fidl::encoding::DefaultFuchsiaResourceDialect
4012                        );
4013                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandCreateViewportRequest>(&header, _body_bytes, handles, &mut req)?;
4014                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4015                        Ok(FlatlandRequest::CreateViewport {
4016                            viewport_id: req.viewport_id,
4017                            token: req.token,
4018                            properties: req.properties,
4019                            child_view_watcher: req.child_view_watcher,
4020
4021                            control_handle,
4022                        })
4023                    }
4024                    0x26fae823c4ebedad => {
4025                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4026                        let mut req = fidl::new_empty!(
4027                            FlatlandCreateImageRequest,
4028                            fidl::encoding::DefaultFuchsiaResourceDialect
4029                        );
4030                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandCreateImageRequest>(&header, _body_bytes, handles, &mut req)?;
4031                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4032                        Ok(FlatlandRequest::CreateImage {
4033                            image_id: req.image_id,
4034                            import_token: req.import_token,
4035                            vmo_index: req.vmo_index,
4036                            properties: req.properties,
4037
4038                            control_handle,
4039                        })
4040                    }
4041                    0x8039391d715eb28 => {
4042                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4043                        let mut req = fidl::new_empty!(
4044                            FlatlandSetImageSampleRegionRequest,
4045                            fidl::encoding::DefaultFuchsiaResourceDialect
4046                        );
4047                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetImageSampleRegionRequest>(&header, _body_bytes, handles, &mut req)?;
4048                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4049                        Ok(FlatlandRequest::SetImageSampleRegion {
4050                            image_id: req.image_id,
4051                            rect: req.rect,
4052
4053                            control_handle,
4054                        })
4055                    }
4056                    0x766cf99a2ec58446 => {
4057                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4058                        let mut req = fidl::new_empty!(
4059                            FlatlandSetImageDestinationSizeRequest,
4060                            fidl::encoding::DefaultFuchsiaResourceDialect
4061                        );
4062                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetImageDestinationSizeRequest>(&header, _body_bytes, handles, &mut req)?;
4063                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4064                        Ok(FlatlandRequest::SetImageDestinationSize {
4065                            image_id: req.image_id,
4066                            size: req.size,
4067
4068                            control_handle,
4069                        })
4070                    }
4071                    0x10f5da1356275b7b => {
4072                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4073                        let mut req = fidl::new_empty!(
4074                            FlatlandSetImageBlendingFunctionRequest,
4075                            fidl::encoding::DefaultFuchsiaResourceDialect
4076                        );
4077                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetImageBlendingFunctionRequest>(&header, _body_bytes, handles, &mut req)?;
4078                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4079                        Ok(FlatlandRequest::SetImageBlendingFunction {
4080                            image_id: req.image_id,
4081                            blend_mode: req.blend_mode,
4082
4083                            control_handle,
4084                        })
4085                    }
4086                    0x5b1667f130c3de67 => {
4087                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4088                        let mut req = fidl::new_empty!(
4089                            FlatlandSetImageBlendModeRequest,
4090                            fidl::encoding::DefaultFuchsiaResourceDialect
4091                        );
4092                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetImageBlendModeRequest>(&header, _body_bytes, handles, &mut req)?;
4093                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4094                        Ok(FlatlandRequest::SetImageBlendMode {
4095                            image_id: req.image_id,
4096                            blend_mode: req.blend_mode,
4097
4098                            control_handle,
4099                        })
4100                    }
4101                    0x2da9e4ef4c2cff6f => {
4102                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4103                        let mut req = fidl::new_empty!(
4104                            FlatlandSetImageOpacityRequest,
4105                            fidl::encoding::DefaultFuchsiaResourceDialect
4106                        );
4107                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetImageOpacityRequest>(&header, _body_bytes, handles, &mut req)?;
4108                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4109                        Ok(FlatlandRequest::SetImageOpacity {
4110                            image_id: req.image_id,
4111                            val: req.val,
4112
4113                            control_handle,
4114                        })
4115                    }
4116                    0x21b20f2c14aae6bc => {
4117                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4118                        let mut req = fidl::new_empty!(
4119                            FlatlandSetImageFlipRequest,
4120                            fidl::encoding::DefaultFuchsiaResourceDialect
4121                        );
4122                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetImageFlipRequest>(&header, _body_bytes, handles, &mut req)?;
4123                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4124                        Ok(FlatlandRequest::SetImageFlip {
4125                            image_id: req.image_id,
4126                            flip: req.flip,
4127
4128                            control_handle,
4129                        })
4130                    }
4131                    0x5e62355abc1c4c5d => {
4132                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4133                        let mut req = fidl::new_empty!(
4134                            FlatlandCreateFilledRectRequest,
4135                            fidl::encoding::DefaultFuchsiaResourceDialect
4136                        );
4137                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandCreateFilledRectRequest>(&header, _body_bytes, handles, &mut req)?;
4138                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4139                        Ok(FlatlandRequest::CreateFilledRect {
4140                            rect_id: req.rect_id,
4141
4142                            control_handle,
4143                        })
4144                    }
4145                    0x32d6ef41e182dfa5 => {
4146                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4147                        let mut req = fidl::new_empty!(
4148                            FlatlandSetSolidFillRequest,
4149                            fidl::encoding::DefaultFuchsiaResourceDialect
4150                        );
4151                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetSolidFillRequest>(&header, _body_bytes, handles, &mut req)?;
4152                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4153                        Ok(FlatlandRequest::SetSolidFill {
4154                            rect_id: req.rect_id,
4155                            color: req.color,
4156                            size: req.size,
4157
4158                            control_handle,
4159                        })
4160                    }
4161                    0x7392cabe45618f9b => {
4162                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4163                        let mut req = fidl::new_empty!(
4164                            FlatlandReleaseFilledRectRequest,
4165                            fidl::encoding::DefaultFuchsiaResourceDialect
4166                        );
4167                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandReleaseFilledRectRequest>(&header, _body_bytes, handles, &mut req)?;
4168                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4169                        Ok(FlatlandRequest::ReleaseFilledRect {
4170                            rect_id: req.rect_id,
4171
4172                            control_handle,
4173                        })
4174                    }
4175                    0x4ed2cfc0ce130862 => {
4176                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4177                        let mut req = fidl::new_empty!(
4178                            FlatlandSetContentRequest,
4179                            fidl::encoding::DefaultFuchsiaResourceDialect
4180                        );
4181                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetContentRequest>(&header, _body_bytes, handles, &mut req)?;
4182                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4183                        Ok(FlatlandRequest::SetContent {
4184                            transform_id: req.transform_id,
4185                            content_id: req.content_id,
4186
4187                            control_handle,
4188                        })
4189                    }
4190                    0x66ab67e9608ddb9f => {
4191                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4192                        let mut req = fidl::new_empty!(
4193                            FlatlandSetViewportPropertiesRequest,
4194                            fidl::encoding::DefaultFuchsiaResourceDialect
4195                        );
4196                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetViewportPropertiesRequest>(&header, _body_bytes, handles, &mut req)?;
4197                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4198                        Ok(FlatlandRequest::SetViewportProperties {
4199                            viewport_id: req.viewport_id,
4200                            properties: req.properties,
4201
4202                            control_handle,
4203                        })
4204                    }
4205                    0xab9328419451c22 => {
4206                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4207                        let mut req = fidl::new_empty!(
4208                            FlatlandReleaseTransformRequest,
4209                            fidl::encoding::DefaultFuchsiaResourceDialect
4210                        );
4211                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandReleaseTransformRequest>(&header, _body_bytes, handles, &mut req)?;
4212                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4213                        Ok(FlatlandRequest::ReleaseTransform {
4214                            transform_id: req.transform_id,
4215
4216                            control_handle,
4217                        })
4218                    }
4219                    0x5b35aab9baffecae => {
4220                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4221                        let mut req = fidl::new_empty!(
4222                            fidl::encoding::EmptyPayload,
4223                            fidl::encoding::DefaultFuchsiaResourceDialect
4224                        );
4225                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
4226                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4227                        Ok(FlatlandRequest::ReleaseView { control_handle })
4228                    }
4229                    0xbad474aeb5293f9 => {
4230                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4231                        let mut req = fidl::new_empty!(
4232                            FlatlandReleaseViewportRequest,
4233                            fidl::encoding::DefaultFuchsiaResourceDialect
4234                        );
4235                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandReleaseViewportRequest>(&header, _body_bytes, handles, &mut req)?;
4236                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4237                        Ok(FlatlandRequest::ReleaseViewport {
4238                            viewport_id: req.viewport_id,
4239
4240                            responder: FlatlandReleaseViewportResponder {
4241                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4242                                tx_id: header.tx_id,
4243                            },
4244                        })
4245                    }
4246                    0xb884ffdbc72c111 => {
4247                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4248                        let mut req = fidl::new_empty!(
4249                            FlatlandReleaseImageRequest,
4250                            fidl::encoding::DefaultFuchsiaResourceDialect
4251                        );
4252                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandReleaseImageRequest>(&header, _body_bytes, handles, &mut req)?;
4253                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4254                        Ok(FlatlandRequest::ReleaseImage { image_id: req.image_id, control_handle })
4255                    }
4256                    0x4ec8817c02828c3e => {
4257                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4258                        let mut req = fidl::new_empty!(
4259                            fidl::encoding::EmptyPayload,
4260                            fidl::encoding::DefaultFuchsiaResourceDialect
4261                        );
4262                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
4263                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4264                        Ok(FlatlandRequest::Clear { control_handle })
4265                    }
4266                    0x46a8b397e68a8888 => {
4267                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4268                        let mut req = fidl::new_empty!(
4269                            FlatlandSetDebugNameRequest,
4270                            fidl::encoding::DefaultFuchsiaResourceDialect
4271                        );
4272                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandSetDebugNameRequest>(&header, _body_bytes, handles, &mut req)?;
4273                        let control_handle = FlatlandControlHandle { inner: this.inner.clone() };
4274                        Ok(FlatlandRequest::SetDebugName { name: req.name, control_handle })
4275                    }
4276                    _ => Err(fidl::Error::UnknownOrdinal {
4277                        ordinal: header.ordinal,
4278                        protocol_name:
4279                            <FlatlandMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4280                    }),
4281                }))
4282            },
4283        )
4284    }
4285}
4286
4287/// Each Flatland instance contains a Graph, which consists of a set of objects, and the
4288/// relationships between those objects. The client can specify a subset of those objects
4289/// (specifically, the directed acyclic graph starting at the root transform) to be presented as
4290/// content to some kind of output -- usually, a display.
4291///
4292/// Flatland Graphs are both hierarchical, and distributed. Graphs from different Flatland instances
4293/// may be connected together, allowing multiple processes to be involved in authoring content for a
4294/// particular output.
4295///
4296/// All functions in this protocol are feed-forward. The operations they represent are not fully
4297/// executed until [`Present`] is called.
4298#[derive(Debug)]
4299pub enum FlatlandRequest {
4300    /// Complete execution of all feed-forward operations.
4301    ///
4302    /// If executing an operation produces an error (e.g., CreateTransform(0)), an [`OnError`] event
4303    /// is emitted. Operations that produce errors are ignored and the channel is closed.
4304    ///
4305    /// If the execution is completed successfully, [`OnNextFrameBegin`] emits NO_ERROR along
4306    /// with other valid fields.
4307    ///
4308    /// The client may only call [`Present`] when they have a non-zero number of present credits,
4309    /// which are tracked by the server. The server may increment the number of credits when it
4310    /// fires the [`OnNextFrameBegin`] event, which informs the client when it receives additional
4311    /// present credits. Each [`Present`] call uses one present credit and decrements the server
4312    /// count by one. If the client calls [`Present`] with no present credits, the server will
4313    /// return a `NO_PRESENTS_REMAINING` error.
4314    ///
4315    /// The client should assume that prior to receiving any [`OnNextFrameBegin`] events, they have
4316    /// one present credit.
4317    ///
4318    /// Every [`Present`] call results in one [`OnNextFrameBegin`] event, and one
4319    /// [`OnFramePresented`] event, typically in that order.
4320    ///
4321    /// When the commands flushed by [`Present`] make it to display, an [`OnFramePresented`] event
4322    /// is fired. This event includes information pertaining to all [`Present`]s that had content
4323    /// that were part of that frame.
4324    ///
4325    /// See [`fuchsia.ui.composition/PresentArgs`] documentation above for more detailed information
4326    /// on what arguments are passed in and their role.
4327    Present {
4328        args: PresentArgs,
4329        control_handle: FlatlandControlHandle,
4330    },
4331    /// Two Flatland instances may be connected in a parent-child relationship. The parent endpoint
4332    /// is held in a Viewport, and the child endpoint is held in a View. The parent Flatland
4333    /// instance that creates a Viewport has control over how the child's View is integrated into
4334    /// its own View.
4335    ///
4336    /// The lifecycle of a parent-child connection starts with two endpoints of a channel object:
4337    /// a ViewportCreationToken and a ViewCreationToken. Out-of-band protocols pass the
4338    /// ViewportCreationToken to the parent, which calls [`CreateViewport`], and the
4339    /// ViewCreationToken to the child, which calls [`CreateView`].
4340    ///
4341    /// Only nodes connected to the Root Transform in this Flatland instance will be rendered into
4342    /// the parent's Viewport.
4343    ///
4344    /// Calling [`CreateView`] a second time will disconnect the Root Transform from the existing
4345    /// parent's Viewport, and attach it to a new parent's Viewport. In other words, each View can
4346    /// only have one parent.
4347    ///
4348    /// This function is queued, meaning that the Root Transform will not be attached to the
4349    /// parent Viewport until [`Present`] is called. However, clients will receive information
4350    /// through their ParentViewportWatcher (e.g., LayoutInfo) immediately after calling this
4351    /// function, even if they have not called [`Present`] or [`SetRootTransform`]. This allows
4352    /// clients to wait for layout information from their parent before calling [`Present`].
4353    ///
4354    /// Any illegal operations on ParentViewportWatcher will cause both ParentViewportWatcher
4355    /// channel and this Flatland channel to be torn down.
4356    ///
4357    /// Lifecycle note. The lifetime of the ParentViewportWatcher channel is bound by the peer
4358    /// ViewportCreationToken. When the ViewportCreationToken dies, this ParentViewportWatcher
4359    /// channel is destroyed.
4360    ///
4361    /// Views and subgraphs of Views created using `CreateView` will not be represented in the
4362    /// ViewTree, and hence will not be able to participate in any ViewTree-dependent interactions
4363    /// such as touch, mouse or focus.
4364    /// The Flatland protocol provides no way for Views in the subgraph of a View created with
4365    /// `CreateView` to know that they are excluded from the ViewTree.
4366    CreateView {
4367        token: fidl_fuchsia_ui_views::ViewCreationToken,
4368        parent_viewport_watcher: fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>,
4369        control_handle: FlatlandControlHandle,
4370    },
4371    /// Identical to [`CreateView`], except it allows association of View identity (ViewRef) and
4372    /// view-bound protocols.
4373    CreateView2 {
4374        token: fidl_fuchsia_ui_views::ViewCreationToken,
4375        view_identity: fidl_fuchsia_ui_views::ViewIdentityOnCreation,
4376        protocols: ViewBoundProtocols,
4377        parent_viewport_watcher: fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>,
4378        control_handle: FlatlandControlHandle,
4379    },
4380    /// Creates a new Transform node. Transforms are a hierarchical piece of a Flatland graph. They
4381    /// can have children, and can reference Content. A sub-graph represented by a Transform and its
4382    /// descendants can be rendered to a display.
4383    ///
4384    /// Transforms are kept alive, even when released, as long as they are children of either an
4385    /// unreleased Transform, or the Root Transform.
4386    ///
4387    /// Each Transform can have a single piece of attached Content. Common types of Content include
4388    /// bitmaps, asynchronous streams of images, and Viewports to Views hosted in other Flatland
4389    /// instances.
4390    ///
4391    /// Transforms have attributes. Child Transforms inherit the combined attributes of their
4392    /// parents. Content attached to a Transform is also affected by that Transform's attributes.
4393    ///
4394    /// When a sub-graph of Transforms is rendered, Content will be rendered back-to-front, starting
4395    /// with the Content on the root transform, and continuing recursively through all of its child
4396    /// Transforms in the order the children were added. See [`AddChild`] for more information.
4397    ///
4398    /// Zero is not a valid transform id. All other values are valid, assuming they are not already
4399    /// in use (see [`ReleaseTransform`] for more details).
4400    CreateTransform {
4401        transform_id: TransformId,
4402        control_handle: FlatlandControlHandle,
4403    },
4404    /// All Transform objects support all attributes.
4405    ///
4406    /// Geometric attributes are applied in the following order:
4407    /// 1. Scale (relative to the parent transform's coordinate space)
4408    /// 2. Orientation (relative to the parent transform's coordinate space)
4409    /// 3. Translation (relative to the parent transforms's coordinate space,
4410    ///    unaffected by scale applied to the current transform).
4411    /// 4. Clipping (relative to the current transform's coordinate space)
4412    ///
4413    /// The effects of each of these attributes are cumulative. This means the transform's position
4414    /// in the view space, and its clip boundary, will be calculated based on that chain of
4415    /// geometric attributes going up to the root transform.
4416    ///
4417    /// For instance, in a nested hierarchy such as the following:
4418    ///     [Root-Transform -> Transform1 -> Transform2 -> CurrentTransform]
4419    /// If Transform1 is translated by [2,0] and Transform2 is translated by [0,1] then the
4420    /// view-space position of CurrentTransform will be [2,1].
4421    ///
4422    /// Sets the translation on a Transform. The order of geometric attribute application is
4423    /// addressed above.
4424    SetTranslation {
4425        transform_id: TransformId,
4426        translation: fidl_fuchsia_math::Vec_,
4427        control_handle: FlatlandControlHandle,
4428    },
4429    /// Sets the orientation on a Transform. The order of geometric attribute application is
4430    /// addressed in the documentation for [`SetTranslation`]. In Flatland, the +X axis is
4431    /// to the right and the +Y axis is down. There is no notion of a Z axis. CCW is defined
4432    /// from the POV of the user, as if a skeuomorphoic clock is displayed on the screen.
4433    SetOrientation {
4434        transform_id: TransformId,
4435        orientation: Orientation,
4436        control_handle: FlatlandControlHandle,
4437    },
4438    /// Sets the scale on a transform. The order of geometric attribute application is
4439    /// addressed above. The (x,y) values in the VecF |scale| refer to the scale factor in the
4440    /// x-axis (width) and y-axis (height) respectively. Scale values must be normal 32-bit
4441    /// floating point values: https://en.wikipedia.org/wiki/Normal_number_%28computing%29
4442    SetScale {
4443        transform_id: TransformId,
4444        scale: fidl_fuchsia_math::VecF,
4445        control_handle: FlatlandControlHandle,
4446    },
4447    /// Sets an opacity in linear space to be applied to a transform and its descendents,
4448    /// which include other transforms and content. Opacity values must be in the range
4449    /// of [0.0, 1.0], where 0.0 is completely transparent and 1.0 is completely opaque.
4450    /// Attempting to call this function with values outside that range will result in
4451    /// an error. A transform's opacity value is multiplied with that of its parent. This
4452    /// effect works differently from group opacity. Using group opacity, child nodes are
4453    /// rendered together first, and then have the parent's opacity applied as a post-effect.
4454    /// Here, opacity is applied to each child individually. This may result in a very
4455    /// different effect.
4456    SetOpacity {
4457        transform_id: TransformId,
4458        value: f32,
4459        control_handle: FlatlandControlHandle,
4460    },
4461    /// Sets the bounds, expressed in the local coordinate space of the transform, that
4462    /// constrains the region that content attached to this transform can be rendered to.
4463    /// If the content's area exceeds the clip bounds, the area outside the bounds will
4464    /// not be rendered. These bounds are valid for all children of this transform node as
4465    /// well, which includes nested Flatland instances and their node hierarchies.
4466    /// If a child transform attempts to set clip bounds larger than that of its parent,
4467    /// it will be clipped to the parent's clip bounds. The default state is for a transform
4468    /// to be unclipped, meaning it will not have any bounds placed on its render region.
4469    /// The clip width/height must be positive. Negative values will result in an error.
4470    /// Passing in an empty box to the |rect| parameter will remove the clip bounds.
4471    SetClipBoundary {
4472        transform_id: TransformId,
4473        rect: Option<Box<fidl_fuchsia_math::Rect>>,
4474        control_handle: FlatlandControlHandle,
4475    },
4476    /// Adds a child Transform to a parent Transform. The new child Transform, and any Content
4477    /// attached to it or its children, will be rendered on top of the parent's Content, as well as
4478    /// any previously added children.
4479    AddChild {
4480        parent_transform_id: TransformId,
4481        child_transform_id: TransformId,
4482        control_handle: FlatlandControlHandle,
4483    },
4484    /// Removes a child Transform from a parent Transform.
4485    RemoveChild {
4486        parent_transform_id: TransformId,
4487        child_transform_id: TransformId,
4488        control_handle: FlatlandControlHandle,
4489    },
4490    /// Removes all child Transforms from a parent Transform and replaces them with the new child
4491    /// transforms in `new_child_transform_ids`.
4492    ReplaceChildren {
4493        parent_transform_id: TransformId,
4494        new_child_transform_ids: Vec<TransformId>,
4495        control_handle: FlatlandControlHandle,
4496    },
4497    /// Sets the Root Transform for the graph.
4498    ///
4499    /// The sub-graph defined by the Root Transform and its children will be rendered as View
4500    /// in the connected parent's Viewport (see [`CreateView`]). Any parents of the Root Transform
4501    /// in this Graph will be ignored.
4502    ///
4503    /// The Root Transform, and all children of the Root Transform, are kept alive if they are
4504    /// released (see [`ReleaseTransform`] for more details).
4505    ///
4506    /// There is only ever one Root. Since 0 is not a valid transform id (see [`CreateTransform`]),
4507    /// calling SetRootTransform(0) clears the current Root, destroying any previously released
4508    /// objects that are not referenced by the new root.
4509    ///
4510    /// Note that every View has a clip boundary equivalent to its logical size. Anything outside
4511    /// that clip boundary will not be rendered. Hence, the Root Transform has a useful coordinate
4512    /// space of (0, 0) to (logical_size.width, logical_size.height), where (0, 0) is the upper left
4513    /// corner.
4514    ///
4515    /// Setting the root transform installs a full screen hit region on the root transform. Clients
4516    /// may remove this hit region if they don't want users to be able to interact with the root
4517    /// transform's content. For additional details on hit regions, see the [`SetHitRegions`]
4518    /// documentation.
4519    ///
4520    /// Default hit region rules
4521    ///
4522    ///   A default hit region follows these rules:
4523    ///   - When [`SetRootTransform`](T) is called, T receives a maximal hit region, covering the
4524    ///   entire view.
4525    ///   - If [`SetHitRegions`] is called on T, either before or after [`SetRootTransform`](T),
4526    ///   then no default hit region is active and the client specified hit regions are used.
4527    ///   - If a transform is no longer the root transform, i.e., [`SetRootTransform`](U) is
4528    ///   called, then the original transform no longer has its default hit region.
4529    ///   - Clients can remove or modify the root transform's hit regions the same way they would
4530    ///   reset any other transform's hit regions, by calling [`SetHitRegions`] with the appropriate
4531    ///   vector.
4532    SetRootTransform {
4533        transform_id: TransformId,
4534        control_handle: FlatlandControlHandle,
4535    },
4536    /// Sets the interactive areas for a Transform. By default, Content is not interactive; hit
4537    /// regions must be placed for a user to interact with the Content in a View. Because hit
4538    /// regions are described in the Flatland protocol, a Flatland instance can synchronize Content
4539    /// and hit regions.
4540    ///
4541    /// Each hit region is placed in the coordinate space of the owning Transform, and may or may
4542    /// not interact with different types of hit testing, depending on its [`HitTestInteraction`]
4543    /// type. When there are multiple hit regions that intersect with a hit test, the precedence
4544    /// rules given below dictate which hit region has interacted with the hit test. Only Transforms
4545    /// that transitively connect to the root Transform have their hit regions interact with a hit
4546    /// test.
4547    ///
4548    /// Calling this function replaces any previous values set on this Transform. To reset a
4549    /// Transform to "no hit testing": send an empty vector with [`SetHitRegions`].
4550    ///
4551    /// Note that root transforms get a default hit region installed by Flatland. For more details,
4552    /// see the [`SetRootTransform`] documentation.
4553    ///
4554    /// Precedence rules
4555    ///   Within a Transform, if multiple hit regions overlap, the hit test examines each
4556    ///   intersecting hit region for a possible interaction. Thus, for a regular hit test R and an
4557    ///   accessibility hit test A, where R and A both intersect two hit regions D ([`DEFAULT`]) and
4558    ///   S ([`SEMANTICALLY_INVISIBLE`]) on the same Transform, (1) R interacts with both D and S,
4559    ///   and (2) A only interacts with D. Generally, hit regions that overlap in a single Transform
4560    ///   can cause confusing behavior.
4561    ///
4562    ///   Within a View, for a given hit test, the front-most Transform's hit regions take
4563    ///   precedence over those behind. This follows the expected reverse "render order" of
4564    ///   Transforms (described in [`CreateTransform`]), where a user expects to interact with
4565    ///   Content that is visible, or front-most.
4566    ///
4567    ///   Across Flatland instances, for a given hit test, the front-most instance's front-most
4568    ///   Transform's hit regions take precedence over those behind. This follows the expected
4569    ///   reverse "render order" of views, where a user expects to interact with the View that is
4570    ///   visible, or front-most. For example, if a child View owns Content that is rendered over
4571    ///   the parent View, the user expects to interact with the child's Content.
4572    SetHitRegions {
4573        transform_id: TransformId,
4574        regions: Vec<HitRegion>,
4575        control_handle: FlatlandControlHandle,
4576    },
4577    /// Identical to [`SetHitRegions`], except the hit region associated with [`transform_id`]
4578    /// covers an infinite region. The hit region is invariant against translation, scaling, and
4579    /// orientation of the Transform.
4580    ///
4581    /// An infinite hit region is still limited in extent by the View's clip boundary, just like a
4582    /// finite hit region.
4583    ///
4584    /// Calling this function replaces any previous values set on this Transform. To reset a
4585    /// Transform to "no hit testing": send an empty vector with [`SetHitRegions`].
4586    SetInfiniteHitRegion {
4587        transform_id: TransformId,
4588        hit_test: HitTestInteraction,
4589        control_handle: FlatlandControlHandle,
4590    },
4591    /// The Viewport and View pair, together, represent the connection between two Flatland
4592    /// instances. The Viewport is created in the parent, and the View is created in the child. The
4593    /// parent has control over how the child's View is integrated into its own View.
4594    ///
4595    /// Any illegal operations on ChildViewWatcher will cause both ChildViewWatcher channel and this
4596    /// Flatland channel to be torn down.
4597    ///
4598    /// `ViewportProperties` must have logical_size set. This is the initial size that will drive
4599    /// the layout of the child. The logical_size is also used as the default Content size, but
4600    /// subsequent changes to the logical_size will have no effect on the Content size.
4601    ///
4602    /// `ViewportProperties` may have inset field not set. In that case, the default value of
4603    /// (0, 0, 0, 0) is used.
4604    ///
4605    /// The logical_size must have positive X and Y components.
4606    ///
4607    /// Zero is not a valid ContentId. All other values are valid, assuming they are not already
4608    /// in use for another piece of Content (see [`ReleaseViewport`] for more details).
4609    ///
4610    /// Lifecycle note. The lifetime of the ChildViewWatcher channel is bound by the peer
4611    /// ViewCreationToken. When the ViewCreationToken dies, this ChildViewWatcher channel is
4612    /// destroyed.
4613    CreateViewport {
4614        viewport_id: ContentId,
4615        token: fidl_fuchsia_ui_views::ViewportCreationToken,
4616        properties: ViewportProperties,
4617        child_view_watcher: fidl::endpoints::ServerEnd<ChildViewWatcherMarker>,
4618        control_handle: FlatlandControlHandle,
4619    },
4620    /// An Image is a bitmap backed by a specific VMO in a BufferCollection.
4621    ///
4622    /// Image creation requires an allocated BufferCollection registered with Allocator. This
4623    /// function will fail unless all clients of the specified BufferCollection have set their
4624    /// constraints.
4625    ///
4626    /// The Image must reference a valid VMO index and must have ImageProperties that fall within
4627    /// the constraints specified by the backing BufferCollection (i.e. width and height within a
4628    /// valid range, etc.)
4629    ///
4630    /// Zero is not a valid Image id. All other values are valid, assuming they are not already in
4631    /// use for another piece of Content (see [`ReleaseImage`] for more details).
4632    CreateImage {
4633        image_id: ContentId,
4634        import_token: BufferCollectionImportToken,
4635        vmo_index: u32,
4636        properties: ImageProperties,
4637        control_handle: FlatlandControlHandle,
4638    },
4639    /// This function is used to determine the region (in texel space) of an image that will be used
4640    /// by Flatland when rendering. The image to be sampled is referenced by [`image_id`] and the
4641    /// sample region is specified by [`rect`] which itself is comprised of an origin point (x,y) as
4642    /// well as a width and height, in unnormalized coordinates. It is illegal to call this function
4643    /// on non-image content, or to sample a region outside of the texel space of the image. In
4644    /// other words, the region specifed by [`rect`] must not exceed the ranges (0, image_width) and
4645    /// (0, image_height). If (rect.x + rect.width > image_width) or (rect.y + rect.height >
4646    /// image_height) or if any of the values are negative, this will result in an error.
4647    ///
4648    /// If this method is not called, the default sample region is the rectangle with origin at
4649    /// (0, 0) and width and height set at ImageProperties from [`CreateImage`].
4650    SetImageSampleRegion {
4651        image_id: ContentId,
4652        rect: fidl_fuchsia_math::RectF,
4653        control_handle: FlatlandControlHandle,
4654    },
4655    /// The content size for an Image is the size of the rectangle in the parent's logical
4656    /// coordinate space that the image occupies. This combined with the global translation of the
4657    /// transform it is attached to determines the size and location of where the content is
4658    /// rendered on the display.
4659    ///
4660    /// If this method is not called, the default image destination size is the width and height set
4661    /// at ImageProperties from [`CreateImage`]. The destination size will be affected by scaling if
4662    /// [`SetScale`] is used on the attached Transform or its parents.
4663    SetImageDestinationSize {
4664        image_id: ContentId,
4665        size: fidl_fuchsia_math::SizeU,
4666        control_handle: FlatlandControlHandle,
4667    },
4668    /// Determines the blend function to use when rendering the content specified by
4669    /// |image_id|. |image_id| must be a valid ContentId associated to a transform through
4670    /// a call to |CreateImage| or |CreateFilledRect|. For details on the different blend functions
4671    /// that are available, please refer to the BlendMode enum. If this function is not called, then
4672    /// the default blendmode is BlendMode::SRC.
4673    SetImageBlendingFunction {
4674        image_id: ContentId,
4675        blend_mode: BlendMode,
4676        control_handle: FlatlandControlHandle,
4677    },
4678    /// Determines the blend function to use when rendering the content specified by
4679    /// |image_id|. |image_id| must be a valid ContentId associated to a transform through
4680    /// a call to |CreateImage| or |CreateFilledRect|. For details on the different blend functions
4681    /// that are available, please refer to the BlendMode2 enum. If this function is not called,
4682    /// the default blendmode is BlendMode2::REPLACE.
4683    SetImageBlendMode {
4684        image_id: ContentId,
4685        blend_mode: BlendMode2,
4686        control_handle: FlatlandControlHandle,
4687    },
4688    /// Sets an opacity in linear space to be applied to a flatland image. Opacity values must
4689    /// be in the range [0.0, 1.0].
4690    SetImageOpacity {
4691        image_id: ContentId,
4692        val: f32,
4693        control_handle: FlatlandControlHandle,
4694    },
4695    /// Sets the image flip to be applied to a flatland image. This call must be performed after a
4696    /// successful |CreateImage| call. If an invalid |image_id| is supplied, the channel will be
4697    /// closed due to FlatlandError::BAD_OPERATION. This flip will be applied to the Image before
4698    /// parent Transform Orientations. If this function is not called, then the default flip value
4699    /// is ImageFlip::NONE.
4700    SetImageFlip {
4701        image_id: ContentId,
4702        flip: ImageFlip,
4703        control_handle: FlatlandControlHandle,
4704    },
4705    /// Creates a solid-color rectangle. By default a filled-rect does not have a defined
4706    /// color or size. It is necessary to call |SetSolidFill| to specify a color and size
4707    /// before a filled rect can be used for rendering. Not doing so will result the
4708    CreateFilledRect {
4709        rect_id: ContentId,
4710        control_handle: FlatlandControlHandle,
4711    },
4712    /// Defines the color and size of a filled rect. |rect_id| must refer to content that
4713    /// was created via a call to CreateFilledRect. The color is not premultiplied. Color values
4714    /// must be within the range [0,1] inclusive, and normal 32-bit
4715    /// floating point values: https://en.wikipedia.org/wiki/Normal_number_%28computing%29. Values
4716    /// that do not conform to these specifications will cause the channel to close.
4717    /// The rectangle's top left corner will be at (0, 0) in its transform's coordinate space.
4718    /// Hence, its bottom right corner will be at (size.width, size.height).
4719    SetSolidFill {
4720        rect_id: ContentId,
4721        color: ColorRgba,
4722        size: fidl_fuchsia_math::SizeU,
4723        control_handle: FlatlandControlHandle,
4724    },
4725    /// Automatically garbage collects the rectangle when it is no longer needed for
4726    /// rendering. |rect_id| must have been instantiated with a call to
4727    /// |CreateFilledRect|. Once released, the ID immediately goes out of scope and is free
4728    /// to be used again.
4729    ReleaseFilledRect {
4730        rect_id: ContentId,
4731        control_handle: FlatlandControlHandle,
4732    },
4733    /// Setting a piece of Content on a Transform makes that Content visible in the render tree as
4734    /// long as the Transform is visible from the root Transform. The Content will be rendered
4735    /// before, and therefore "behind", any Content attached to the descendants of the Transform.
4736    ///
4737    /// Because each Transform can have, at most, a single piece of Content on it, calling this
4738    /// function on a Transform that already has Content will replace that Content.
4739    ///
4740    /// A Content may be set on more than one Transform.
4741    ///
4742    /// Calling this function with a Content id of 0 will remove any Content currently on the
4743    /// Transform.
4744    SetContent {
4745        transform_id: TransformId,
4746        content_id: ContentId,
4747        control_handle: FlatlandControlHandle,
4748    },
4749    /// Transforms are usually sufficient to change how Content is presented. Viewports, however,
4750    /// have special properties that are not part of the Transform hierarchy. Those properties can
4751    /// be set using this function.
4752    SetViewportProperties {
4753        viewport_id: ContentId,
4754        properties: ViewportProperties,
4755        control_handle: FlatlandControlHandle,
4756    },
4757    /// Released Transforms will be garbage collected by the system once they are no longer
4758    /// necessary for rendering. For Transforms, this means there is no path from any unreleased
4759    /// Transform to the newly-released Transform.
4760    ///
4761    /// Once released, the id immediately goes out of scope for future function calls and can be
4762    /// reused when creating new Transforms.
4763    ///
4764    /// It is an error to call functions with a released id (unless that id has been reused to
4765    /// construct a new Transform).
4766    ReleaseTransform {
4767        transform_id: TransformId,
4768        control_handle: FlatlandControlHandle,
4769    },
4770    ReleaseView {
4771        control_handle: FlatlandControlHandle,
4772    },
4773    /// Releases a Viewport from the scene, even if the Viewport is still connected to a Transform.
4774    /// Unlike other resources, Viewports are garbage collected by the system during the next
4775    /// [`Present`] because a removed Viewport is guaranteed to provide no renderable content.
4776    ///
4777    /// Use SetContent(transform_id, 0) to clean up references to released Viewports.
4778    ///
4779    /// Despite having a return type, this function is still feed-forward like [`CreateView`] and
4780    /// requires a call to [`Present`] to be executed. The ViewportCreationToken will be returned
4781    /// after the presented operations have been executed.
4782    ReleaseViewport {
4783        viewport_id: ContentId,
4784        responder: FlatlandReleaseViewportResponder,
4785    },
4786    /// Released Images will be garbage collected by the system once they are no longer necessary
4787    /// for rendering. For Images, this means the Image is no longer attached to any Transform and
4788    /// any pending rendering that references the Image is complete.
4789    ///
4790    /// Use SetContent(transform_id, 0) to clean up references to released Images.
4791    ///
4792    /// Once released, the id immediately goes out of scope for future function calls and can be
4793    /// reused when creating new Images.
4794    ///
4795    /// It is an error to call functions with a released id (unless that id has been reused to
4796    /// construct a new Image).
4797    ReleaseImage {
4798        image_id: ContentId,
4799        control_handle: FlatlandControlHandle,
4800    },
4801    /// This function will reset all state on this interface. This includes destroying all existing
4802    /// View and Viewports without returning the associated Token to the caller.
4803    Clear {
4804        control_handle: FlatlandControlHandle,
4805    },
4806    /// Set debug name of the current client that can be used by Flatland to print as a prefix to
4807    /// logs to help client distinguish what is theirs. [`name`] can be an arbitrary string, but the
4808    /// current process name (see fsl::GetCurrentProcessName()) is a good default.
4809    SetDebugName {
4810        name: String,
4811        control_handle: FlatlandControlHandle,
4812    },
4813}
4814
4815impl FlatlandRequest {
4816    #[allow(irrefutable_let_patterns)]
4817    pub fn into_present(self) -> Option<(PresentArgs, FlatlandControlHandle)> {
4818        if let FlatlandRequest::Present { args, control_handle } = self {
4819            Some((args, control_handle))
4820        } else {
4821            None
4822        }
4823    }
4824
4825    #[allow(irrefutable_let_patterns)]
4826    pub fn into_create_view(
4827        self,
4828    ) -> Option<(
4829        fidl_fuchsia_ui_views::ViewCreationToken,
4830        fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>,
4831        FlatlandControlHandle,
4832    )> {
4833        if let FlatlandRequest::CreateView { token, parent_viewport_watcher, control_handle } = self
4834        {
4835            Some((token, parent_viewport_watcher, control_handle))
4836        } else {
4837            None
4838        }
4839    }
4840
4841    #[allow(irrefutable_let_patterns)]
4842    pub fn into_create_view2(
4843        self,
4844    ) -> Option<(
4845        fidl_fuchsia_ui_views::ViewCreationToken,
4846        fidl_fuchsia_ui_views::ViewIdentityOnCreation,
4847        ViewBoundProtocols,
4848        fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>,
4849        FlatlandControlHandle,
4850    )> {
4851        if let FlatlandRequest::CreateView2 {
4852            token,
4853            view_identity,
4854            protocols,
4855            parent_viewport_watcher,
4856            control_handle,
4857        } = self
4858        {
4859            Some((token, view_identity, protocols, parent_viewport_watcher, control_handle))
4860        } else {
4861            None
4862        }
4863    }
4864
4865    #[allow(irrefutable_let_patterns)]
4866    pub fn into_create_transform(self) -> Option<(TransformId, FlatlandControlHandle)> {
4867        if let FlatlandRequest::CreateTransform { transform_id, control_handle } = self {
4868            Some((transform_id, control_handle))
4869        } else {
4870            None
4871        }
4872    }
4873
4874    #[allow(irrefutable_let_patterns)]
4875    pub fn into_set_translation(
4876        self,
4877    ) -> Option<(TransformId, fidl_fuchsia_math::Vec_, FlatlandControlHandle)> {
4878        if let FlatlandRequest::SetTranslation { transform_id, translation, control_handle } = self
4879        {
4880            Some((transform_id, translation, control_handle))
4881        } else {
4882            None
4883        }
4884    }
4885
4886    #[allow(irrefutable_let_patterns)]
4887    pub fn into_set_orientation(self) -> Option<(TransformId, Orientation, FlatlandControlHandle)> {
4888        if let FlatlandRequest::SetOrientation { transform_id, orientation, control_handle } = self
4889        {
4890            Some((transform_id, orientation, control_handle))
4891        } else {
4892            None
4893        }
4894    }
4895
4896    #[allow(irrefutable_let_patterns)]
4897    pub fn into_set_scale(
4898        self,
4899    ) -> Option<(TransformId, fidl_fuchsia_math::VecF, FlatlandControlHandle)> {
4900        if let FlatlandRequest::SetScale { transform_id, scale, control_handle } = self {
4901            Some((transform_id, scale, control_handle))
4902        } else {
4903            None
4904        }
4905    }
4906
4907    #[allow(irrefutable_let_patterns)]
4908    pub fn into_set_opacity(self) -> Option<(TransformId, f32, FlatlandControlHandle)> {
4909        if let FlatlandRequest::SetOpacity { transform_id, value, control_handle } = self {
4910            Some((transform_id, value, control_handle))
4911        } else {
4912            None
4913        }
4914    }
4915
4916    #[allow(irrefutable_let_patterns)]
4917    pub fn into_set_clip_boundary(
4918        self,
4919    ) -> Option<(TransformId, Option<Box<fidl_fuchsia_math::Rect>>, FlatlandControlHandle)> {
4920        if let FlatlandRequest::SetClipBoundary { transform_id, rect, control_handle } = self {
4921            Some((transform_id, rect, control_handle))
4922        } else {
4923            None
4924        }
4925    }
4926
4927    #[allow(irrefutable_let_patterns)]
4928    pub fn into_add_child(self) -> Option<(TransformId, TransformId, FlatlandControlHandle)> {
4929        if let FlatlandRequest::AddChild {
4930            parent_transform_id,
4931            child_transform_id,
4932            control_handle,
4933        } = self
4934        {
4935            Some((parent_transform_id, child_transform_id, control_handle))
4936        } else {
4937            None
4938        }
4939    }
4940
4941    #[allow(irrefutable_let_patterns)]
4942    pub fn into_remove_child(self) -> Option<(TransformId, TransformId, FlatlandControlHandle)> {
4943        if let FlatlandRequest::RemoveChild {
4944            parent_transform_id,
4945            child_transform_id,
4946            control_handle,
4947        } = self
4948        {
4949            Some((parent_transform_id, child_transform_id, control_handle))
4950        } else {
4951            None
4952        }
4953    }
4954
4955    #[allow(irrefutable_let_patterns)]
4956    pub fn into_replace_children(
4957        self,
4958    ) -> Option<(TransformId, Vec<TransformId>, FlatlandControlHandle)> {
4959        if let FlatlandRequest::ReplaceChildren {
4960            parent_transform_id,
4961            new_child_transform_ids,
4962            control_handle,
4963        } = self
4964        {
4965            Some((parent_transform_id, new_child_transform_ids, control_handle))
4966        } else {
4967            None
4968        }
4969    }
4970
4971    #[allow(irrefutable_let_patterns)]
4972    pub fn into_set_root_transform(self) -> Option<(TransformId, FlatlandControlHandle)> {
4973        if let FlatlandRequest::SetRootTransform { transform_id, control_handle } = self {
4974            Some((transform_id, control_handle))
4975        } else {
4976            None
4977        }
4978    }
4979
4980    #[allow(irrefutable_let_patterns)]
4981    pub fn into_set_hit_regions(
4982        self,
4983    ) -> Option<(TransformId, Vec<HitRegion>, FlatlandControlHandle)> {
4984        if let FlatlandRequest::SetHitRegions { transform_id, regions, control_handle } = self {
4985            Some((transform_id, regions, control_handle))
4986        } else {
4987            None
4988        }
4989    }
4990
4991    #[allow(irrefutable_let_patterns)]
4992    pub fn into_set_infinite_hit_region(
4993        self,
4994    ) -> Option<(TransformId, HitTestInteraction, FlatlandControlHandle)> {
4995        if let FlatlandRequest::SetInfiniteHitRegion { transform_id, hit_test, control_handle } =
4996            self
4997        {
4998            Some((transform_id, hit_test, control_handle))
4999        } else {
5000            None
5001        }
5002    }
5003
5004    #[allow(irrefutable_let_patterns)]
5005    pub fn into_create_viewport(
5006        self,
5007    ) -> Option<(
5008        ContentId,
5009        fidl_fuchsia_ui_views::ViewportCreationToken,
5010        ViewportProperties,
5011        fidl::endpoints::ServerEnd<ChildViewWatcherMarker>,
5012        FlatlandControlHandle,
5013    )> {
5014        if let FlatlandRequest::CreateViewport {
5015            viewport_id,
5016            token,
5017            properties,
5018            child_view_watcher,
5019            control_handle,
5020        } = self
5021        {
5022            Some((viewport_id, token, properties, child_view_watcher, control_handle))
5023        } else {
5024            None
5025        }
5026    }
5027
5028    #[allow(irrefutable_let_patterns)]
5029    pub fn into_create_image(
5030        self,
5031    ) -> Option<(ContentId, BufferCollectionImportToken, u32, ImageProperties, FlatlandControlHandle)>
5032    {
5033        if let FlatlandRequest::CreateImage {
5034            image_id,
5035            import_token,
5036            vmo_index,
5037            properties,
5038            control_handle,
5039        } = self
5040        {
5041            Some((image_id, import_token, vmo_index, properties, control_handle))
5042        } else {
5043            None
5044        }
5045    }
5046
5047    #[allow(irrefutable_let_patterns)]
5048    pub fn into_set_image_sample_region(
5049        self,
5050    ) -> Option<(ContentId, fidl_fuchsia_math::RectF, FlatlandControlHandle)> {
5051        if let FlatlandRequest::SetImageSampleRegion { image_id, rect, control_handle } = self {
5052            Some((image_id, rect, control_handle))
5053        } else {
5054            None
5055        }
5056    }
5057
5058    #[allow(irrefutable_let_patterns)]
5059    pub fn into_set_image_destination_size(
5060        self,
5061    ) -> Option<(ContentId, fidl_fuchsia_math::SizeU, FlatlandControlHandle)> {
5062        if let FlatlandRequest::SetImageDestinationSize { image_id, size, control_handle } = self {
5063            Some((image_id, size, control_handle))
5064        } else {
5065            None
5066        }
5067    }
5068
5069    #[allow(irrefutable_let_patterns)]
5070    pub fn into_set_image_blending_function(
5071        self,
5072    ) -> Option<(ContentId, BlendMode, FlatlandControlHandle)> {
5073        if let FlatlandRequest::SetImageBlendingFunction { image_id, blend_mode, control_handle } =
5074            self
5075        {
5076            Some((image_id, blend_mode, control_handle))
5077        } else {
5078            None
5079        }
5080    }
5081
5082    #[allow(irrefutable_let_patterns)]
5083    pub fn into_set_image_blend_mode(
5084        self,
5085    ) -> Option<(ContentId, BlendMode2, FlatlandControlHandle)> {
5086        if let FlatlandRequest::SetImageBlendMode { image_id, blend_mode, control_handle } = self {
5087            Some((image_id, blend_mode, control_handle))
5088        } else {
5089            None
5090        }
5091    }
5092
5093    #[allow(irrefutable_let_patterns)]
5094    pub fn into_set_image_opacity(self) -> Option<(ContentId, f32, FlatlandControlHandle)> {
5095        if let FlatlandRequest::SetImageOpacity { image_id, val, control_handle } = self {
5096            Some((image_id, val, control_handle))
5097        } else {
5098            None
5099        }
5100    }
5101
5102    #[allow(irrefutable_let_patterns)]
5103    pub fn into_set_image_flip(self) -> Option<(ContentId, ImageFlip, FlatlandControlHandle)> {
5104        if let FlatlandRequest::SetImageFlip { image_id, flip, control_handle } = self {
5105            Some((image_id, flip, control_handle))
5106        } else {
5107            None
5108        }
5109    }
5110
5111    #[allow(irrefutable_let_patterns)]
5112    pub fn into_create_filled_rect(self) -> Option<(ContentId, FlatlandControlHandle)> {
5113        if let FlatlandRequest::CreateFilledRect { rect_id, control_handle } = self {
5114            Some((rect_id, control_handle))
5115        } else {
5116            None
5117        }
5118    }
5119
5120    #[allow(irrefutable_let_patterns)]
5121    pub fn into_set_solid_fill(
5122        self,
5123    ) -> Option<(ContentId, ColorRgba, fidl_fuchsia_math::SizeU, FlatlandControlHandle)> {
5124        if let FlatlandRequest::SetSolidFill { rect_id, color, size, control_handle } = self {
5125            Some((rect_id, color, size, control_handle))
5126        } else {
5127            None
5128        }
5129    }
5130
5131    #[allow(irrefutable_let_patterns)]
5132    pub fn into_release_filled_rect(self) -> Option<(ContentId, FlatlandControlHandle)> {
5133        if let FlatlandRequest::ReleaseFilledRect { rect_id, control_handle } = self {
5134            Some((rect_id, control_handle))
5135        } else {
5136            None
5137        }
5138    }
5139
5140    #[allow(irrefutable_let_patterns)]
5141    pub fn into_set_content(self) -> Option<(TransformId, ContentId, FlatlandControlHandle)> {
5142        if let FlatlandRequest::SetContent { transform_id, content_id, control_handle } = self {
5143            Some((transform_id, content_id, control_handle))
5144        } else {
5145            None
5146        }
5147    }
5148
5149    #[allow(irrefutable_let_patterns)]
5150    pub fn into_set_viewport_properties(
5151        self,
5152    ) -> Option<(ContentId, ViewportProperties, FlatlandControlHandle)> {
5153        if let FlatlandRequest::SetViewportProperties { viewport_id, properties, control_handle } =
5154            self
5155        {
5156            Some((viewport_id, properties, control_handle))
5157        } else {
5158            None
5159        }
5160    }
5161
5162    #[allow(irrefutable_let_patterns)]
5163    pub fn into_release_transform(self) -> Option<(TransformId, FlatlandControlHandle)> {
5164        if let FlatlandRequest::ReleaseTransform { transform_id, control_handle } = self {
5165            Some((transform_id, control_handle))
5166        } else {
5167            None
5168        }
5169    }
5170
5171    #[allow(irrefutable_let_patterns)]
5172    pub fn into_release_view(self) -> Option<(FlatlandControlHandle)> {
5173        if let FlatlandRequest::ReleaseView { control_handle } = self {
5174            Some((control_handle))
5175        } else {
5176            None
5177        }
5178    }
5179
5180    #[allow(irrefutable_let_patterns)]
5181    pub fn into_release_viewport(self) -> Option<(ContentId, FlatlandReleaseViewportResponder)> {
5182        if let FlatlandRequest::ReleaseViewport { viewport_id, responder } = self {
5183            Some((viewport_id, responder))
5184        } else {
5185            None
5186        }
5187    }
5188
5189    #[allow(irrefutable_let_patterns)]
5190    pub fn into_release_image(self) -> Option<(ContentId, FlatlandControlHandle)> {
5191        if let FlatlandRequest::ReleaseImage { image_id, control_handle } = self {
5192            Some((image_id, control_handle))
5193        } else {
5194            None
5195        }
5196    }
5197
5198    #[allow(irrefutable_let_patterns)]
5199    pub fn into_clear(self) -> Option<(FlatlandControlHandle)> {
5200        if let FlatlandRequest::Clear { control_handle } = self {
5201            Some((control_handle))
5202        } else {
5203            None
5204        }
5205    }
5206
5207    #[allow(irrefutable_let_patterns)]
5208    pub fn into_set_debug_name(self) -> Option<(String, FlatlandControlHandle)> {
5209        if let FlatlandRequest::SetDebugName { name, control_handle } = self {
5210            Some((name, control_handle))
5211        } else {
5212            None
5213        }
5214    }
5215
5216    /// Name of the method defined in FIDL
5217    pub fn method_name(&self) -> &'static str {
5218        match *self {
5219            FlatlandRequest::Present { .. } => "present",
5220            FlatlandRequest::CreateView { .. } => "create_view",
5221            FlatlandRequest::CreateView2 { .. } => "create_view2",
5222            FlatlandRequest::CreateTransform { .. } => "create_transform",
5223            FlatlandRequest::SetTranslation { .. } => "set_translation",
5224            FlatlandRequest::SetOrientation { .. } => "set_orientation",
5225            FlatlandRequest::SetScale { .. } => "set_scale",
5226            FlatlandRequest::SetOpacity { .. } => "set_opacity",
5227            FlatlandRequest::SetClipBoundary { .. } => "set_clip_boundary",
5228            FlatlandRequest::AddChild { .. } => "add_child",
5229            FlatlandRequest::RemoveChild { .. } => "remove_child",
5230            FlatlandRequest::ReplaceChildren { .. } => "replace_children",
5231            FlatlandRequest::SetRootTransform { .. } => "set_root_transform",
5232            FlatlandRequest::SetHitRegions { .. } => "set_hit_regions",
5233            FlatlandRequest::SetInfiniteHitRegion { .. } => "set_infinite_hit_region",
5234            FlatlandRequest::CreateViewport { .. } => "create_viewport",
5235            FlatlandRequest::CreateImage { .. } => "create_image",
5236            FlatlandRequest::SetImageSampleRegion { .. } => "set_image_sample_region",
5237            FlatlandRequest::SetImageDestinationSize { .. } => "set_image_destination_size",
5238            FlatlandRequest::SetImageBlendingFunction { .. } => "set_image_blending_function",
5239            FlatlandRequest::SetImageBlendMode { .. } => "set_image_blend_mode",
5240            FlatlandRequest::SetImageOpacity { .. } => "set_image_opacity",
5241            FlatlandRequest::SetImageFlip { .. } => "set_image_flip",
5242            FlatlandRequest::CreateFilledRect { .. } => "create_filled_rect",
5243            FlatlandRequest::SetSolidFill { .. } => "set_solid_fill",
5244            FlatlandRequest::ReleaseFilledRect { .. } => "release_filled_rect",
5245            FlatlandRequest::SetContent { .. } => "set_content",
5246            FlatlandRequest::SetViewportProperties { .. } => "set_viewport_properties",
5247            FlatlandRequest::ReleaseTransform { .. } => "release_transform",
5248            FlatlandRequest::ReleaseView { .. } => "release_view",
5249            FlatlandRequest::ReleaseViewport { .. } => "release_viewport",
5250            FlatlandRequest::ReleaseImage { .. } => "release_image",
5251            FlatlandRequest::Clear { .. } => "clear",
5252            FlatlandRequest::SetDebugName { .. } => "set_debug_name",
5253        }
5254    }
5255}
5256
5257#[derive(Debug, Clone)]
5258pub struct FlatlandControlHandle {
5259    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5260}
5261
5262impl fidl::endpoints::ControlHandle for FlatlandControlHandle {
5263    fn shutdown(&self) {
5264        self.inner.shutdown()
5265    }
5266
5267    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
5268        self.inner.shutdown_with_epitaph(status)
5269    }
5270
5271    fn is_closed(&self) -> bool {
5272        self.inner.channel().is_closed()
5273    }
5274    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
5275        self.inner.channel().on_closed()
5276    }
5277
5278    #[cfg(target_os = "fuchsia")]
5279    fn signal_peer(
5280        &self,
5281        clear_mask: zx::Signals,
5282        set_mask: zx::Signals,
5283    ) -> Result<(), zx_status::Status> {
5284        use fidl::Peered;
5285        self.inner.channel().signal_peer(clear_mask, set_mask)
5286    }
5287}
5288
5289impl FlatlandControlHandle {
5290    pub fn send_on_next_frame_begin(
5291        &self,
5292        mut values: &OnNextFrameBeginValues,
5293    ) -> Result<(), fidl::Error> {
5294        self.inner.send::<FlatlandOnNextFrameBeginRequest>(
5295            (values,),
5296            0,
5297            0x10f69a5cdeece84a,
5298            fidl::encoding::DynamicFlags::empty(),
5299        )
5300    }
5301
5302    pub fn send_on_frame_presented(
5303        &self,
5304        mut frame_presented_info: &fidl_fuchsia_scenic_scheduling::FramePresentedInfo,
5305    ) -> Result<(), fidl::Error> {
5306        self.inner.send::<FlatlandOnFramePresentedRequest>(
5307            (frame_presented_info,),
5308            0,
5309            0x56e43e1a5f30216d,
5310            fidl::encoding::DynamicFlags::empty(),
5311        )
5312    }
5313
5314    pub fn send_on_error(&self, mut error: FlatlandError) -> Result<(), fidl::Error> {
5315        self.inner.send::<FlatlandOnErrorRequest>(
5316            (error,),
5317            0,
5318            0x1ebf39e90cd8b8d,
5319            fidl::encoding::DynamicFlags::empty(),
5320        )
5321    }
5322}
5323
5324#[must_use = "FIDL methods require a response to be sent"]
5325#[derive(Debug)]
5326pub struct FlatlandReleaseViewportResponder {
5327    control_handle: std::mem::ManuallyDrop<FlatlandControlHandle>,
5328    tx_id: u32,
5329}
5330
5331/// Set the the channel to be shutdown (see [`FlatlandControlHandle::shutdown`])
5332/// if the responder is dropped without sending a response, so that the client
5333/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5334impl std::ops::Drop for FlatlandReleaseViewportResponder {
5335    fn drop(&mut self) {
5336        self.control_handle.shutdown();
5337        // Safety: drops once, never accessed again
5338        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5339    }
5340}
5341
5342impl fidl::endpoints::Responder for FlatlandReleaseViewportResponder {
5343    type ControlHandle = FlatlandControlHandle;
5344
5345    fn control_handle(&self) -> &FlatlandControlHandle {
5346        &self.control_handle
5347    }
5348
5349    fn drop_without_shutdown(mut self) {
5350        // Safety: drops once, never accessed again due to mem::forget
5351        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5352        // Prevent Drop from running (which would shut down the channel)
5353        std::mem::forget(self);
5354    }
5355}
5356
5357impl FlatlandReleaseViewportResponder {
5358    /// Sends a response to the FIDL transaction.
5359    ///
5360    /// Sets the channel to shutdown if an error occurs.
5361    pub fn send(
5362        self,
5363        mut token: fidl_fuchsia_ui_views::ViewportCreationToken,
5364    ) -> Result<(), fidl::Error> {
5365        let _result = self.send_raw(token);
5366        if _result.is_err() {
5367            self.control_handle.shutdown();
5368        }
5369        self.drop_without_shutdown();
5370        _result
5371    }
5372
5373    /// Similar to "send" but does not shutdown the channel if an error occurs.
5374    pub fn send_no_shutdown_on_err(
5375        self,
5376        mut token: fidl_fuchsia_ui_views::ViewportCreationToken,
5377    ) -> Result<(), fidl::Error> {
5378        let _result = self.send_raw(token);
5379        self.drop_without_shutdown();
5380        _result
5381    }
5382
5383    fn send_raw(
5384        &self,
5385        mut token: fidl_fuchsia_ui_views::ViewportCreationToken,
5386    ) -> Result<(), fidl::Error> {
5387        self.control_handle.inner.send::<FlatlandReleaseViewportResponse>(
5388            (&mut token,),
5389            self.tx_id,
5390            0xbad474aeb5293f9,
5391            fidl::encoding::DynamicFlags::empty(),
5392        )
5393    }
5394}
5395
5396#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
5397pub struct FlatlandDisplayMarker;
5398
5399impl fidl::endpoints::ProtocolMarker for FlatlandDisplayMarker {
5400    type Proxy = FlatlandDisplayProxy;
5401    type RequestStream = FlatlandDisplayRequestStream;
5402    #[cfg(target_os = "fuchsia")]
5403    type SynchronousProxy = FlatlandDisplaySynchronousProxy;
5404
5405    const DEBUG_NAME: &'static str = "fuchsia.ui.composition.FlatlandDisplay";
5406}
5407impl fidl::endpoints::DiscoverableProtocolMarker for FlatlandDisplayMarker {}
5408
5409pub trait FlatlandDisplayProxyInterface: Send + Sync {
5410    fn r#set_content(
5411        &self,
5412        token: fidl_fuchsia_ui_views::ViewportCreationToken,
5413        child_view_watcher: fidl::endpoints::ServerEnd<ChildViewWatcherMarker>,
5414    ) -> Result<(), fidl::Error>;
5415    fn r#set_device_pixel_ratio(
5416        &self,
5417        device_pixel_ratio: &fidl_fuchsia_math::VecF,
5418    ) -> Result<(), fidl::Error>;
5419}
5420#[derive(Debug)]
5421#[cfg(target_os = "fuchsia")]
5422pub struct FlatlandDisplaySynchronousProxy {
5423    client: fidl::client::sync::Client,
5424}
5425
5426#[cfg(target_os = "fuchsia")]
5427impl fidl::endpoints::SynchronousProxy for FlatlandDisplaySynchronousProxy {
5428    type Proxy = FlatlandDisplayProxy;
5429    type Protocol = FlatlandDisplayMarker;
5430
5431    fn from_channel(inner: fidl::Channel) -> Self {
5432        Self::new(inner)
5433    }
5434
5435    fn into_channel(self) -> fidl::Channel {
5436        self.client.into_channel()
5437    }
5438
5439    fn as_channel(&self) -> &fidl::Channel {
5440        self.client.as_channel()
5441    }
5442}
5443
5444#[cfg(target_os = "fuchsia")]
5445impl FlatlandDisplaySynchronousProxy {
5446    pub fn new(channel: fidl::Channel) -> Self {
5447        let protocol_name = <FlatlandDisplayMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
5448        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
5449    }
5450
5451    pub fn into_channel(self) -> fidl::Channel {
5452        self.client.into_channel()
5453    }
5454
5455    /// Waits until an event arrives and returns it. It is safe for other
5456    /// threads to make concurrent requests while waiting for an event.
5457    pub fn wait_for_event(
5458        &self,
5459        deadline: zx::MonotonicInstant,
5460    ) -> Result<FlatlandDisplayEvent, fidl::Error> {
5461        FlatlandDisplayEvent::decode(self.client.wait_for_event(deadline)?)
5462    }
5463
5464    pub fn r#set_content(
5465        &self,
5466        mut token: fidl_fuchsia_ui_views::ViewportCreationToken,
5467        mut child_view_watcher: fidl::endpoints::ServerEnd<ChildViewWatcherMarker>,
5468    ) -> Result<(), fidl::Error> {
5469        self.client.send::<FlatlandDisplaySetContentRequest>(
5470            (&mut token, child_view_watcher),
5471            0x6748193a39918298,
5472            fidl::encoding::DynamicFlags::empty(),
5473        )
5474    }
5475
5476    /// Sets the ratio of display's physical pixels to device independent pixels that should be used
5477    /// for the tree of Flatland content that are attached to this display. See
5478    /// [`LayoutInfo.device_pixel_ratio`] for details.
5479    ///
5480    /// The default value is (1.0, 1.0). The valid values are 1.0 and above.
5481    pub fn r#set_device_pixel_ratio(
5482        &self,
5483        mut device_pixel_ratio: &fidl_fuchsia_math::VecF,
5484    ) -> Result<(), fidl::Error> {
5485        self.client.send::<FlatlandDisplaySetDevicePixelRatioRequest>(
5486            (device_pixel_ratio,),
5487            0x392c3e70cc0a81a4,
5488            fidl::encoding::DynamicFlags::empty(),
5489        )
5490    }
5491}
5492
5493#[cfg(target_os = "fuchsia")]
5494impl From<FlatlandDisplaySynchronousProxy> for zx::NullableHandle {
5495    fn from(value: FlatlandDisplaySynchronousProxy) -> Self {
5496        value.into_channel().into()
5497    }
5498}
5499
5500#[cfg(target_os = "fuchsia")]
5501impl From<fidl::Channel> for FlatlandDisplaySynchronousProxy {
5502    fn from(value: fidl::Channel) -> Self {
5503        Self::new(value)
5504    }
5505}
5506
5507#[cfg(target_os = "fuchsia")]
5508impl fidl::endpoints::FromClient for FlatlandDisplaySynchronousProxy {
5509    type Protocol = FlatlandDisplayMarker;
5510
5511    fn from_client(value: fidl::endpoints::ClientEnd<FlatlandDisplayMarker>) -> Self {
5512        Self::new(value.into_channel())
5513    }
5514}
5515
5516#[derive(Debug, Clone)]
5517pub struct FlatlandDisplayProxy {
5518    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
5519}
5520
5521impl fidl::endpoints::Proxy for FlatlandDisplayProxy {
5522    type Protocol = FlatlandDisplayMarker;
5523
5524    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
5525        Self::new(inner)
5526    }
5527
5528    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
5529        self.client.into_channel().map_err(|client| Self { client })
5530    }
5531
5532    fn as_channel(&self) -> &::fidl::AsyncChannel {
5533        self.client.as_channel()
5534    }
5535}
5536
5537impl FlatlandDisplayProxy {
5538    /// Create a new Proxy for fuchsia.ui.composition/FlatlandDisplay.
5539    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
5540        let protocol_name = <FlatlandDisplayMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
5541        Self { client: fidl::client::Client::new(channel, protocol_name) }
5542    }
5543
5544    /// Get a Stream of events from the remote end of the protocol.
5545    ///
5546    /// # Panics
5547    ///
5548    /// Panics if the event stream was already taken.
5549    pub fn take_event_stream(&self) -> FlatlandDisplayEventStream {
5550        FlatlandDisplayEventStream { event_receiver: self.client.take_event_receiver() }
5551    }
5552
5553    pub fn r#set_content(
5554        &self,
5555        mut token: fidl_fuchsia_ui_views::ViewportCreationToken,
5556        mut child_view_watcher: fidl::endpoints::ServerEnd<ChildViewWatcherMarker>,
5557    ) -> Result<(), fidl::Error> {
5558        FlatlandDisplayProxyInterface::r#set_content(self, token, child_view_watcher)
5559    }
5560
5561    /// Sets the ratio of display's physical pixels to device independent pixels that should be used
5562    /// for the tree of Flatland content that are attached to this display. See
5563    /// [`LayoutInfo.device_pixel_ratio`] for details.
5564    ///
5565    /// The default value is (1.0, 1.0). The valid values are 1.0 and above.
5566    pub fn r#set_device_pixel_ratio(
5567        &self,
5568        mut device_pixel_ratio: &fidl_fuchsia_math::VecF,
5569    ) -> Result<(), fidl::Error> {
5570        FlatlandDisplayProxyInterface::r#set_device_pixel_ratio(self, device_pixel_ratio)
5571    }
5572}
5573
5574impl FlatlandDisplayProxyInterface for FlatlandDisplayProxy {
5575    fn r#set_content(
5576        &self,
5577        mut token: fidl_fuchsia_ui_views::ViewportCreationToken,
5578        mut child_view_watcher: fidl::endpoints::ServerEnd<ChildViewWatcherMarker>,
5579    ) -> Result<(), fidl::Error> {
5580        self.client.send::<FlatlandDisplaySetContentRequest>(
5581            (&mut token, child_view_watcher),
5582            0x6748193a39918298,
5583            fidl::encoding::DynamicFlags::empty(),
5584        )
5585    }
5586
5587    fn r#set_device_pixel_ratio(
5588        &self,
5589        mut device_pixel_ratio: &fidl_fuchsia_math::VecF,
5590    ) -> Result<(), fidl::Error> {
5591        self.client.send::<FlatlandDisplaySetDevicePixelRatioRequest>(
5592            (device_pixel_ratio,),
5593            0x392c3e70cc0a81a4,
5594            fidl::encoding::DynamicFlags::empty(),
5595        )
5596    }
5597}
5598
5599pub struct FlatlandDisplayEventStream {
5600    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
5601}
5602
5603impl std::marker::Unpin for FlatlandDisplayEventStream {}
5604
5605impl futures::stream::FusedStream for FlatlandDisplayEventStream {
5606    fn is_terminated(&self) -> bool {
5607        self.event_receiver.is_terminated()
5608    }
5609}
5610
5611impl futures::Stream for FlatlandDisplayEventStream {
5612    type Item = Result<FlatlandDisplayEvent, fidl::Error>;
5613
5614    fn poll_next(
5615        mut self: std::pin::Pin<&mut Self>,
5616        cx: &mut std::task::Context<'_>,
5617    ) -> std::task::Poll<Option<Self::Item>> {
5618        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
5619            &mut self.event_receiver,
5620            cx
5621        )?) {
5622            Some(buf) => std::task::Poll::Ready(Some(FlatlandDisplayEvent::decode(buf))),
5623            None => std::task::Poll::Ready(None),
5624        }
5625    }
5626}
5627
5628#[derive(Debug)]
5629pub enum FlatlandDisplayEvent {}
5630
5631impl FlatlandDisplayEvent {
5632    /// Decodes a message buffer as a [`FlatlandDisplayEvent`].
5633    fn decode(
5634        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
5635    ) -> Result<FlatlandDisplayEvent, fidl::Error> {
5636        let (bytes, _handles) = buf.split_mut();
5637        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5638        debug_assert_eq!(tx_header.tx_id, 0);
5639        match tx_header.ordinal {
5640            _ => Err(fidl::Error::UnknownOrdinal {
5641                ordinal: tx_header.ordinal,
5642                protocol_name:
5643                    <FlatlandDisplayMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5644            }),
5645        }
5646    }
5647}
5648
5649/// A Stream of incoming requests for fuchsia.ui.composition/FlatlandDisplay.
5650pub struct FlatlandDisplayRequestStream {
5651    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5652    is_terminated: bool,
5653}
5654
5655impl std::marker::Unpin for FlatlandDisplayRequestStream {}
5656
5657impl futures::stream::FusedStream for FlatlandDisplayRequestStream {
5658    fn is_terminated(&self) -> bool {
5659        self.is_terminated
5660    }
5661}
5662
5663impl fidl::endpoints::RequestStream for FlatlandDisplayRequestStream {
5664    type Protocol = FlatlandDisplayMarker;
5665    type ControlHandle = FlatlandDisplayControlHandle;
5666
5667    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
5668        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
5669    }
5670
5671    fn control_handle(&self) -> Self::ControlHandle {
5672        FlatlandDisplayControlHandle { inner: self.inner.clone() }
5673    }
5674
5675    fn into_inner(
5676        self,
5677    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
5678    {
5679        (self.inner, self.is_terminated)
5680    }
5681
5682    fn from_inner(
5683        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5684        is_terminated: bool,
5685    ) -> Self {
5686        Self { inner, is_terminated }
5687    }
5688}
5689
5690impl futures::Stream for FlatlandDisplayRequestStream {
5691    type Item = Result<FlatlandDisplayRequest, fidl::Error>;
5692
5693    fn poll_next(
5694        mut self: std::pin::Pin<&mut Self>,
5695        cx: &mut std::task::Context<'_>,
5696    ) -> std::task::Poll<Option<Self::Item>> {
5697        let this = &mut *self;
5698        if this.inner.check_shutdown(cx) {
5699            this.is_terminated = true;
5700            return std::task::Poll::Ready(None);
5701        }
5702        if this.is_terminated {
5703            panic!("polled FlatlandDisplayRequestStream after completion");
5704        }
5705        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
5706            |bytes, handles| {
5707                match this.inner.channel().read_etc(cx, bytes, handles) {
5708                    std::task::Poll::Ready(Ok(())) => {}
5709                    std::task::Poll::Pending => return std::task::Poll::Pending,
5710                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
5711                        this.is_terminated = true;
5712                        return std::task::Poll::Ready(None);
5713                    }
5714                    std::task::Poll::Ready(Err(e)) => {
5715                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
5716                            e.into(),
5717                        ))));
5718                    }
5719                }
5720
5721                // A message has been received from the channel
5722                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5723
5724                std::task::Poll::Ready(Some(match header.ordinal {
5725                    0x6748193a39918298 => {
5726                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5727                        let mut req = fidl::new_empty!(
5728                            FlatlandDisplaySetContentRequest,
5729                            fidl::encoding::DefaultFuchsiaResourceDialect
5730                        );
5731                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandDisplaySetContentRequest>(&header, _body_bytes, handles, &mut req)?;
5732                        let control_handle =
5733                            FlatlandDisplayControlHandle { inner: this.inner.clone() };
5734                        Ok(FlatlandDisplayRequest::SetContent {
5735                            token: req.token,
5736                            child_view_watcher: req.child_view_watcher,
5737
5738                            control_handle,
5739                        })
5740                    }
5741                    0x392c3e70cc0a81a4 => {
5742                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5743                        let mut req = fidl::new_empty!(
5744                            FlatlandDisplaySetDevicePixelRatioRequest,
5745                            fidl::encoding::DefaultFuchsiaResourceDialect
5746                        );
5747                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FlatlandDisplaySetDevicePixelRatioRequest>(&header, _body_bytes, handles, &mut req)?;
5748                        let control_handle =
5749                            FlatlandDisplayControlHandle { inner: this.inner.clone() };
5750                        Ok(FlatlandDisplayRequest::SetDevicePixelRatio {
5751                            device_pixel_ratio: req.device_pixel_ratio,
5752
5753                            control_handle,
5754                        })
5755                    }
5756                    _ => Err(fidl::Error::UnknownOrdinal {
5757                        ordinal: header.ordinal,
5758                        protocol_name:
5759                            <FlatlandDisplayMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5760                    }),
5761                }))
5762            },
5763        )
5764    }
5765}
5766
5767/// This API connects to the singleton "primary display", and allows a tree of Flatland content to
5768/// be attached underneath.  Only one FlatlandDisplay client connection is allowed at one time.
5769#[derive(Debug)]
5770pub enum FlatlandDisplayRequest {
5771    SetContent {
5772        token: fidl_fuchsia_ui_views::ViewportCreationToken,
5773        child_view_watcher: fidl::endpoints::ServerEnd<ChildViewWatcherMarker>,
5774        control_handle: FlatlandDisplayControlHandle,
5775    },
5776    /// Sets the ratio of display's physical pixels to device independent pixels that should be used
5777    /// for the tree of Flatland content that are attached to this display. See
5778    /// [`LayoutInfo.device_pixel_ratio`] for details.
5779    ///
5780    /// The default value is (1.0, 1.0). The valid values are 1.0 and above.
5781    SetDevicePixelRatio {
5782        device_pixel_ratio: fidl_fuchsia_math::VecF,
5783        control_handle: FlatlandDisplayControlHandle,
5784    },
5785}
5786
5787impl FlatlandDisplayRequest {
5788    #[allow(irrefutable_let_patterns)]
5789    pub fn into_set_content(
5790        self,
5791    ) -> Option<(
5792        fidl_fuchsia_ui_views::ViewportCreationToken,
5793        fidl::endpoints::ServerEnd<ChildViewWatcherMarker>,
5794        FlatlandDisplayControlHandle,
5795    )> {
5796        if let FlatlandDisplayRequest::SetContent { token, child_view_watcher, control_handle } =
5797            self
5798        {
5799            Some((token, child_view_watcher, control_handle))
5800        } else {
5801            None
5802        }
5803    }
5804
5805    #[allow(irrefutable_let_patterns)]
5806    pub fn into_set_device_pixel_ratio(
5807        self,
5808    ) -> Option<(fidl_fuchsia_math::VecF, FlatlandDisplayControlHandle)> {
5809        if let FlatlandDisplayRequest::SetDevicePixelRatio { device_pixel_ratio, control_handle } =
5810            self
5811        {
5812            Some((device_pixel_ratio, control_handle))
5813        } else {
5814            None
5815        }
5816    }
5817
5818    /// Name of the method defined in FIDL
5819    pub fn method_name(&self) -> &'static str {
5820        match *self {
5821            FlatlandDisplayRequest::SetContent { .. } => "set_content",
5822            FlatlandDisplayRequest::SetDevicePixelRatio { .. } => "set_device_pixel_ratio",
5823        }
5824    }
5825}
5826
5827#[derive(Debug, Clone)]
5828pub struct FlatlandDisplayControlHandle {
5829    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5830}
5831
5832impl fidl::endpoints::ControlHandle for FlatlandDisplayControlHandle {
5833    fn shutdown(&self) {
5834        self.inner.shutdown()
5835    }
5836
5837    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
5838        self.inner.shutdown_with_epitaph(status)
5839    }
5840
5841    fn is_closed(&self) -> bool {
5842        self.inner.channel().is_closed()
5843    }
5844    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
5845        self.inner.channel().on_closed()
5846    }
5847
5848    #[cfg(target_os = "fuchsia")]
5849    fn signal_peer(
5850        &self,
5851        clear_mask: zx::Signals,
5852        set_mask: zx::Signals,
5853    ) -> Result<(), zx_status::Status> {
5854        use fidl::Peered;
5855        self.inner.channel().signal_peer(clear_mask, set_mask)
5856    }
5857}
5858
5859impl FlatlandDisplayControlHandle {}
5860
5861#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
5862pub struct ParentViewportWatcherMarker;
5863
5864impl fidl::endpoints::ProtocolMarker for ParentViewportWatcherMarker {
5865    type Proxy = ParentViewportWatcherProxy;
5866    type RequestStream = ParentViewportWatcherRequestStream;
5867    #[cfg(target_os = "fuchsia")]
5868    type SynchronousProxy = ParentViewportWatcherSynchronousProxy;
5869
5870    const DEBUG_NAME: &'static str = "(anonymous) ParentViewportWatcher";
5871}
5872
5873pub trait ParentViewportWatcherProxyInterface: Send + Sync {
5874    type GetLayoutResponseFut: std::future::Future<Output = Result<LayoutInfo, fidl::Error>> + Send;
5875    fn r#get_layout(&self) -> Self::GetLayoutResponseFut;
5876    type GetStatusResponseFut: std::future::Future<Output = Result<ParentViewportStatus, fidl::Error>>
5877        + Send;
5878    fn r#get_status(&self) -> Self::GetStatusResponseFut;
5879}
5880#[derive(Debug)]
5881#[cfg(target_os = "fuchsia")]
5882pub struct ParentViewportWatcherSynchronousProxy {
5883    client: fidl::client::sync::Client,
5884}
5885
5886#[cfg(target_os = "fuchsia")]
5887impl fidl::endpoints::SynchronousProxy for ParentViewportWatcherSynchronousProxy {
5888    type Proxy = ParentViewportWatcherProxy;
5889    type Protocol = ParentViewportWatcherMarker;
5890
5891    fn from_channel(inner: fidl::Channel) -> Self {
5892        Self::new(inner)
5893    }
5894
5895    fn into_channel(self) -> fidl::Channel {
5896        self.client.into_channel()
5897    }
5898
5899    fn as_channel(&self) -> &fidl::Channel {
5900        self.client.as_channel()
5901    }
5902}
5903
5904#[cfg(target_os = "fuchsia")]
5905impl ParentViewportWatcherSynchronousProxy {
5906    pub fn new(channel: fidl::Channel) -> Self {
5907        let protocol_name =
5908            <ParentViewportWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
5909        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
5910    }
5911
5912    pub fn into_channel(self) -> fidl::Channel {
5913        self.client.into_channel()
5914    }
5915
5916    /// Waits until an event arrives and returns it. It is safe for other
5917    /// threads to make concurrent requests while waiting for an event.
5918    pub fn wait_for_event(
5919        &self,
5920        deadline: zx::MonotonicInstant,
5921    ) -> Result<ParentViewportWatcherEvent, fidl::Error> {
5922        ParentViewportWatcherEvent::decode(self.client.wait_for_event(deadline)?)
5923    }
5924
5925    /// A hanging get for receiving layout information. Clients may receive layout information
5926    /// before the ParentViewportWatcher operation has been presented. This allows children to
5927    /// layout their content before their first call to [`Present`]. In transition cases where two
5928    /// ParentViewportWatcher channels exist at the same time, both protocol instances will be
5929    /// receiving different layout information.
5930    ///
5931    /// This hanging get will only fire when the LayoutInfo is different than the previously
5932    /// returned LayoutInfo. Note that, since LayoutInfo is a table, only some fields may have
5933    /// changed.
5934    ///
5935    /// It is invalid to call `GetLayout` while a previous call is still pending. Doing so will
5936    /// cause both this channel and the Flatland channel that handed out ParentViewportWatcher to be
5937    /// closed.
5938    pub fn r#get_layout(
5939        &self,
5940        ___deadline: zx::MonotonicInstant,
5941    ) -> Result<LayoutInfo, fidl::Error> {
5942        let _response = self
5943            .client
5944            .send_query::<fidl::encoding::EmptyPayload, ParentViewportWatcherGetLayoutResponse>(
5945                (),
5946                0x3cbe5d9638e032,
5947                fidl::encoding::DynamicFlags::empty(),
5948                ___deadline,
5949            )?;
5950        Ok(_response.info)
5951    }
5952
5953    /// A hanging get for receiving the status of the parent Viewport. This provides global
5954    /// connectivity information to the child.
5955    ///
5956    /// This hanging get will only fire when the ParentViewportStatus is different than the
5957    /// previously returned ParentViewportStatus.
5958    ///
5959    /// It is invalid to call `GetStatus` while a previous call is still pending. Doing so will
5960    /// cause both this channel and the Flatland channel that handed out ParentViewportWatcher to be
5961    /// closed.
5962    pub fn r#get_status(
5963        &self,
5964        ___deadline: zx::MonotonicInstant,
5965    ) -> Result<ParentViewportStatus, fidl::Error> {
5966        let _response = self
5967            .client
5968            .send_query::<fidl::encoding::EmptyPayload, ParentViewportWatcherGetStatusResponse>(
5969                (),
5970                0x7caa022f050d9ea6,
5971                fidl::encoding::DynamicFlags::empty(),
5972                ___deadline,
5973            )?;
5974        Ok(_response.status)
5975    }
5976}
5977
5978#[cfg(target_os = "fuchsia")]
5979impl From<ParentViewportWatcherSynchronousProxy> for zx::NullableHandle {
5980    fn from(value: ParentViewportWatcherSynchronousProxy) -> Self {
5981        value.into_channel().into()
5982    }
5983}
5984
5985#[cfg(target_os = "fuchsia")]
5986impl From<fidl::Channel> for ParentViewportWatcherSynchronousProxy {
5987    fn from(value: fidl::Channel) -> Self {
5988        Self::new(value)
5989    }
5990}
5991
5992#[cfg(target_os = "fuchsia")]
5993impl fidl::endpoints::FromClient for ParentViewportWatcherSynchronousProxy {
5994    type Protocol = ParentViewportWatcherMarker;
5995
5996    fn from_client(value: fidl::endpoints::ClientEnd<ParentViewportWatcherMarker>) -> Self {
5997        Self::new(value.into_channel())
5998    }
5999}
6000
6001#[derive(Debug, Clone)]
6002pub struct ParentViewportWatcherProxy {
6003    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
6004}
6005
6006impl fidl::endpoints::Proxy for ParentViewportWatcherProxy {
6007    type Protocol = ParentViewportWatcherMarker;
6008
6009    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
6010        Self::new(inner)
6011    }
6012
6013    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
6014        self.client.into_channel().map_err(|client| Self { client })
6015    }
6016
6017    fn as_channel(&self) -> &::fidl::AsyncChannel {
6018        self.client.as_channel()
6019    }
6020}
6021
6022impl ParentViewportWatcherProxy {
6023    /// Create a new Proxy for fuchsia.ui.composition/ParentViewportWatcher.
6024    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
6025        let protocol_name =
6026            <ParentViewportWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
6027        Self { client: fidl::client::Client::new(channel, protocol_name) }
6028    }
6029
6030    /// Get a Stream of events from the remote end of the protocol.
6031    ///
6032    /// # Panics
6033    ///
6034    /// Panics if the event stream was already taken.
6035    pub fn take_event_stream(&self) -> ParentViewportWatcherEventStream {
6036        ParentViewportWatcherEventStream { event_receiver: self.client.take_event_receiver() }
6037    }
6038
6039    /// A hanging get for receiving layout information. Clients may receive layout information
6040    /// before the ParentViewportWatcher operation has been presented. This allows children to
6041    /// layout their content before their first call to [`Present`]. In transition cases where two
6042    /// ParentViewportWatcher channels exist at the same time, both protocol instances will be
6043    /// receiving different layout information.
6044    ///
6045    /// This hanging get will only fire when the LayoutInfo is different than the previously
6046    /// returned LayoutInfo. Note that, since LayoutInfo is a table, only some fields may have
6047    /// changed.
6048    ///
6049    /// It is invalid to call `GetLayout` while a previous call is still pending. Doing so will
6050    /// cause both this channel and the Flatland channel that handed out ParentViewportWatcher to be
6051    /// closed.
6052    pub fn r#get_layout(
6053        &self,
6054    ) -> fidl::client::QueryResponseFut<LayoutInfo, fidl::encoding::DefaultFuchsiaResourceDialect>
6055    {
6056        ParentViewportWatcherProxyInterface::r#get_layout(self)
6057    }
6058
6059    /// A hanging get for receiving the status of the parent Viewport. This provides global
6060    /// connectivity information to the child.
6061    ///
6062    /// This hanging get will only fire when the ParentViewportStatus is different than the
6063    /// previously returned ParentViewportStatus.
6064    ///
6065    /// It is invalid to call `GetStatus` while a previous call is still pending. Doing so will
6066    /// cause both this channel and the Flatland channel that handed out ParentViewportWatcher to be
6067    /// closed.
6068    pub fn r#get_status(
6069        &self,
6070    ) -> fidl::client::QueryResponseFut<
6071        ParentViewportStatus,
6072        fidl::encoding::DefaultFuchsiaResourceDialect,
6073    > {
6074        ParentViewportWatcherProxyInterface::r#get_status(self)
6075    }
6076}
6077
6078impl ParentViewportWatcherProxyInterface for ParentViewportWatcherProxy {
6079    type GetLayoutResponseFut =
6080        fidl::client::QueryResponseFut<LayoutInfo, fidl::encoding::DefaultFuchsiaResourceDialect>;
6081    fn r#get_layout(&self) -> Self::GetLayoutResponseFut {
6082        fn _decode(
6083            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6084        ) -> Result<LayoutInfo, fidl::Error> {
6085            let _response = fidl::client::decode_transaction_body::<
6086                ParentViewportWatcherGetLayoutResponse,
6087                fidl::encoding::DefaultFuchsiaResourceDialect,
6088                0x3cbe5d9638e032,
6089            >(_buf?)?;
6090            Ok(_response.info)
6091        }
6092        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, LayoutInfo>(
6093            (),
6094            0x3cbe5d9638e032,
6095            fidl::encoding::DynamicFlags::empty(),
6096            _decode,
6097        )
6098    }
6099
6100    type GetStatusResponseFut = fidl::client::QueryResponseFut<
6101        ParentViewportStatus,
6102        fidl::encoding::DefaultFuchsiaResourceDialect,
6103    >;
6104    fn r#get_status(&self) -> Self::GetStatusResponseFut {
6105        fn _decode(
6106            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6107        ) -> Result<ParentViewportStatus, fidl::Error> {
6108            let _response = fidl::client::decode_transaction_body::<
6109                ParentViewportWatcherGetStatusResponse,
6110                fidl::encoding::DefaultFuchsiaResourceDialect,
6111                0x7caa022f050d9ea6,
6112            >(_buf?)?;
6113            Ok(_response.status)
6114        }
6115        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ParentViewportStatus>(
6116            (),
6117            0x7caa022f050d9ea6,
6118            fidl::encoding::DynamicFlags::empty(),
6119            _decode,
6120        )
6121    }
6122}
6123
6124pub struct ParentViewportWatcherEventStream {
6125    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
6126}
6127
6128impl std::marker::Unpin for ParentViewportWatcherEventStream {}
6129
6130impl futures::stream::FusedStream for ParentViewportWatcherEventStream {
6131    fn is_terminated(&self) -> bool {
6132        self.event_receiver.is_terminated()
6133    }
6134}
6135
6136impl futures::Stream for ParentViewportWatcherEventStream {
6137    type Item = Result<ParentViewportWatcherEvent, fidl::Error>;
6138
6139    fn poll_next(
6140        mut self: std::pin::Pin<&mut Self>,
6141        cx: &mut std::task::Context<'_>,
6142    ) -> std::task::Poll<Option<Self::Item>> {
6143        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
6144            &mut self.event_receiver,
6145            cx
6146        )?) {
6147            Some(buf) => std::task::Poll::Ready(Some(ParentViewportWatcherEvent::decode(buf))),
6148            None => std::task::Poll::Ready(None),
6149        }
6150    }
6151}
6152
6153#[derive(Debug)]
6154pub enum ParentViewportWatcherEvent {}
6155
6156impl ParentViewportWatcherEvent {
6157    /// Decodes a message buffer as a [`ParentViewportWatcherEvent`].
6158    fn decode(
6159        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
6160    ) -> Result<ParentViewportWatcherEvent, fidl::Error> {
6161        let (bytes, _handles) = buf.split_mut();
6162        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6163        debug_assert_eq!(tx_header.tx_id, 0);
6164        match tx_header.ordinal {
6165            _ => Err(fidl::Error::UnknownOrdinal {
6166                ordinal: tx_header.ordinal,
6167                protocol_name:
6168                    <ParentViewportWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6169            }),
6170        }
6171    }
6172}
6173
6174/// A Stream of incoming requests for fuchsia.ui.composition/ParentViewportWatcher.
6175pub struct ParentViewportWatcherRequestStream {
6176    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6177    is_terminated: bool,
6178}
6179
6180impl std::marker::Unpin for ParentViewportWatcherRequestStream {}
6181
6182impl futures::stream::FusedStream for ParentViewportWatcherRequestStream {
6183    fn is_terminated(&self) -> bool {
6184        self.is_terminated
6185    }
6186}
6187
6188impl fidl::endpoints::RequestStream for ParentViewportWatcherRequestStream {
6189    type Protocol = ParentViewportWatcherMarker;
6190    type ControlHandle = ParentViewportWatcherControlHandle;
6191
6192    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
6193        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
6194    }
6195
6196    fn control_handle(&self) -> Self::ControlHandle {
6197        ParentViewportWatcherControlHandle { inner: self.inner.clone() }
6198    }
6199
6200    fn into_inner(
6201        self,
6202    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
6203    {
6204        (self.inner, self.is_terminated)
6205    }
6206
6207    fn from_inner(
6208        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6209        is_terminated: bool,
6210    ) -> Self {
6211        Self { inner, is_terminated }
6212    }
6213}
6214
6215impl futures::Stream for ParentViewportWatcherRequestStream {
6216    type Item = Result<ParentViewportWatcherRequest, fidl::Error>;
6217
6218    fn poll_next(
6219        mut self: std::pin::Pin<&mut Self>,
6220        cx: &mut std::task::Context<'_>,
6221    ) -> std::task::Poll<Option<Self::Item>> {
6222        let this = &mut *self;
6223        if this.inner.check_shutdown(cx) {
6224            this.is_terminated = true;
6225            return std::task::Poll::Ready(None);
6226        }
6227        if this.is_terminated {
6228            panic!("polled ParentViewportWatcherRequestStream after completion");
6229        }
6230        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
6231            |bytes, handles| {
6232                match this.inner.channel().read_etc(cx, bytes, handles) {
6233                    std::task::Poll::Ready(Ok(())) => {}
6234                    std::task::Poll::Pending => return std::task::Poll::Pending,
6235                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
6236                        this.is_terminated = true;
6237                        return std::task::Poll::Ready(None);
6238                    }
6239                    std::task::Poll::Ready(Err(e)) => {
6240                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
6241                            e.into(),
6242                        ))));
6243                    }
6244                }
6245
6246                // A message has been received from the channel
6247                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6248
6249                std::task::Poll::Ready(Some(match header.ordinal {
6250                0x3cbe5d9638e032 => {
6251                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6252                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
6253                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
6254                    let control_handle = ParentViewportWatcherControlHandle {
6255                        inner: this.inner.clone(),
6256                    };
6257                    Ok(ParentViewportWatcherRequest::GetLayout {
6258                        responder: ParentViewportWatcherGetLayoutResponder {
6259                            control_handle: std::mem::ManuallyDrop::new(control_handle),
6260                            tx_id: header.tx_id,
6261                        },
6262                    })
6263                }
6264                0x7caa022f050d9ea6 => {
6265                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6266                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
6267                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
6268                    let control_handle = ParentViewportWatcherControlHandle {
6269                        inner: this.inner.clone(),
6270                    };
6271                    Ok(ParentViewportWatcherRequest::GetStatus {
6272                        responder: ParentViewportWatcherGetStatusResponder {
6273                            control_handle: std::mem::ManuallyDrop::new(control_handle),
6274                            tx_id: header.tx_id,
6275                        },
6276                    })
6277                }
6278                _ => Err(fidl::Error::UnknownOrdinal {
6279                    ordinal: header.ordinal,
6280                    protocol_name: <ParentViewportWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6281                }),
6282            }))
6283            },
6284        )
6285    }
6286}
6287
6288/// A protocol that provides information about the parent Viewport attached to a Flatland instance's
6289/// sole View.  Although Flatland instances can have at most one view, it is possible to have
6290/// multiple ParentViewportWatchers during the brief transition period when replacing the instance's
6291/// View with another, e.g. via [`CreateView`].  During this period, certain updates may be
6292/// duplicated and sent to each ParentViewportWatcher connection.
6293///
6294/// A ParentViewportWatcher will remain connected as long as the corresponding parent Viewport
6295/// exists; the connection will also be closed if the parents's ViewportCreationToken is dropped
6296/// without using it to create a Viewport.
6297#[derive(Debug)]
6298pub enum ParentViewportWatcherRequest {
6299    /// A hanging get for receiving layout information. Clients may receive layout information
6300    /// before the ParentViewportWatcher operation has been presented. This allows children to
6301    /// layout their content before their first call to [`Present`]. In transition cases where two
6302    /// ParentViewportWatcher channels exist at the same time, both protocol instances will be
6303    /// receiving different layout information.
6304    ///
6305    /// This hanging get will only fire when the LayoutInfo is different than the previously
6306    /// returned LayoutInfo. Note that, since LayoutInfo is a table, only some fields may have
6307    /// changed.
6308    ///
6309    /// It is invalid to call `GetLayout` while a previous call is still pending. Doing so will
6310    /// cause both this channel and the Flatland channel that handed out ParentViewportWatcher to be
6311    /// closed.
6312    GetLayout { responder: ParentViewportWatcherGetLayoutResponder },
6313    /// A hanging get for receiving the status of the parent Viewport. This provides global
6314    /// connectivity information to the child.
6315    ///
6316    /// This hanging get will only fire when the ParentViewportStatus is different than the
6317    /// previously returned ParentViewportStatus.
6318    ///
6319    /// It is invalid to call `GetStatus` while a previous call is still pending. Doing so will
6320    /// cause both this channel and the Flatland channel that handed out ParentViewportWatcher to be
6321    /// closed.
6322    GetStatus { responder: ParentViewportWatcherGetStatusResponder },
6323}
6324
6325impl ParentViewportWatcherRequest {
6326    #[allow(irrefutable_let_patterns)]
6327    pub fn into_get_layout(self) -> Option<(ParentViewportWatcherGetLayoutResponder)> {
6328        if let ParentViewportWatcherRequest::GetLayout { responder } = self {
6329            Some((responder))
6330        } else {
6331            None
6332        }
6333    }
6334
6335    #[allow(irrefutable_let_patterns)]
6336    pub fn into_get_status(self) -> Option<(ParentViewportWatcherGetStatusResponder)> {
6337        if let ParentViewportWatcherRequest::GetStatus { responder } = self {
6338            Some((responder))
6339        } else {
6340            None
6341        }
6342    }
6343
6344    /// Name of the method defined in FIDL
6345    pub fn method_name(&self) -> &'static str {
6346        match *self {
6347            ParentViewportWatcherRequest::GetLayout { .. } => "get_layout",
6348            ParentViewportWatcherRequest::GetStatus { .. } => "get_status",
6349        }
6350    }
6351}
6352
6353#[derive(Debug, Clone)]
6354pub struct ParentViewportWatcherControlHandle {
6355    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6356}
6357
6358impl fidl::endpoints::ControlHandle for ParentViewportWatcherControlHandle {
6359    fn shutdown(&self) {
6360        self.inner.shutdown()
6361    }
6362
6363    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
6364        self.inner.shutdown_with_epitaph(status)
6365    }
6366
6367    fn is_closed(&self) -> bool {
6368        self.inner.channel().is_closed()
6369    }
6370    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
6371        self.inner.channel().on_closed()
6372    }
6373
6374    #[cfg(target_os = "fuchsia")]
6375    fn signal_peer(
6376        &self,
6377        clear_mask: zx::Signals,
6378        set_mask: zx::Signals,
6379    ) -> Result<(), zx_status::Status> {
6380        use fidl::Peered;
6381        self.inner.channel().signal_peer(clear_mask, set_mask)
6382    }
6383}
6384
6385impl ParentViewportWatcherControlHandle {}
6386
6387#[must_use = "FIDL methods require a response to be sent"]
6388#[derive(Debug)]
6389pub struct ParentViewportWatcherGetLayoutResponder {
6390    control_handle: std::mem::ManuallyDrop<ParentViewportWatcherControlHandle>,
6391    tx_id: u32,
6392}
6393
6394/// Set the the channel to be shutdown (see [`ParentViewportWatcherControlHandle::shutdown`])
6395/// if the responder is dropped without sending a response, so that the client
6396/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6397impl std::ops::Drop for ParentViewportWatcherGetLayoutResponder {
6398    fn drop(&mut self) {
6399        self.control_handle.shutdown();
6400        // Safety: drops once, never accessed again
6401        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6402    }
6403}
6404
6405impl fidl::endpoints::Responder for ParentViewportWatcherGetLayoutResponder {
6406    type ControlHandle = ParentViewportWatcherControlHandle;
6407
6408    fn control_handle(&self) -> &ParentViewportWatcherControlHandle {
6409        &self.control_handle
6410    }
6411
6412    fn drop_without_shutdown(mut self) {
6413        // Safety: drops once, never accessed again due to mem::forget
6414        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6415        // Prevent Drop from running (which would shut down the channel)
6416        std::mem::forget(self);
6417    }
6418}
6419
6420impl ParentViewportWatcherGetLayoutResponder {
6421    /// Sends a response to the FIDL transaction.
6422    ///
6423    /// Sets the channel to shutdown if an error occurs.
6424    pub fn send(self, mut info: &LayoutInfo) -> Result<(), fidl::Error> {
6425        let _result = self.send_raw(info);
6426        if _result.is_err() {
6427            self.control_handle.shutdown();
6428        }
6429        self.drop_without_shutdown();
6430        _result
6431    }
6432
6433    /// Similar to "send" but does not shutdown the channel if an error occurs.
6434    pub fn send_no_shutdown_on_err(self, mut info: &LayoutInfo) -> Result<(), fidl::Error> {
6435        let _result = self.send_raw(info);
6436        self.drop_without_shutdown();
6437        _result
6438    }
6439
6440    fn send_raw(&self, mut info: &LayoutInfo) -> Result<(), fidl::Error> {
6441        self.control_handle.inner.send::<ParentViewportWatcherGetLayoutResponse>(
6442            (info,),
6443            self.tx_id,
6444            0x3cbe5d9638e032,
6445            fidl::encoding::DynamicFlags::empty(),
6446        )
6447    }
6448}
6449
6450#[must_use = "FIDL methods require a response to be sent"]
6451#[derive(Debug)]
6452pub struct ParentViewportWatcherGetStatusResponder {
6453    control_handle: std::mem::ManuallyDrop<ParentViewportWatcherControlHandle>,
6454    tx_id: u32,
6455}
6456
6457/// Set the the channel to be shutdown (see [`ParentViewportWatcherControlHandle::shutdown`])
6458/// if the responder is dropped without sending a response, so that the client
6459/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6460impl std::ops::Drop for ParentViewportWatcherGetStatusResponder {
6461    fn drop(&mut self) {
6462        self.control_handle.shutdown();
6463        // Safety: drops once, never accessed again
6464        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6465    }
6466}
6467
6468impl fidl::endpoints::Responder for ParentViewportWatcherGetStatusResponder {
6469    type ControlHandle = ParentViewportWatcherControlHandle;
6470
6471    fn control_handle(&self) -> &ParentViewportWatcherControlHandle {
6472        &self.control_handle
6473    }
6474
6475    fn drop_without_shutdown(mut self) {
6476        // Safety: drops once, never accessed again due to mem::forget
6477        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6478        // Prevent Drop from running (which would shut down the channel)
6479        std::mem::forget(self);
6480    }
6481}
6482
6483impl ParentViewportWatcherGetStatusResponder {
6484    /// Sends a response to the FIDL transaction.
6485    ///
6486    /// Sets the channel to shutdown if an error occurs.
6487    pub fn send(self, mut status: ParentViewportStatus) -> Result<(), fidl::Error> {
6488        let _result = self.send_raw(status);
6489        if _result.is_err() {
6490            self.control_handle.shutdown();
6491        }
6492        self.drop_without_shutdown();
6493        _result
6494    }
6495
6496    /// Similar to "send" but does not shutdown the channel if an error occurs.
6497    pub fn send_no_shutdown_on_err(
6498        self,
6499        mut status: ParentViewportStatus,
6500    ) -> Result<(), fidl::Error> {
6501        let _result = self.send_raw(status);
6502        self.drop_without_shutdown();
6503        _result
6504    }
6505
6506    fn send_raw(&self, mut status: ParentViewportStatus) -> Result<(), fidl::Error> {
6507        self.control_handle.inner.send::<ParentViewportWatcherGetStatusResponse>(
6508            (status,),
6509            self.tx_id,
6510            0x7caa022f050d9ea6,
6511            fidl::encoding::DynamicFlags::empty(),
6512        )
6513    }
6514}
6515
6516#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
6517pub struct ScreenCaptureMarker;
6518
6519impl fidl::endpoints::ProtocolMarker for ScreenCaptureMarker {
6520    type Proxy = ScreenCaptureProxy;
6521    type RequestStream = ScreenCaptureRequestStream;
6522    #[cfg(target_os = "fuchsia")]
6523    type SynchronousProxy = ScreenCaptureSynchronousProxy;
6524
6525    const DEBUG_NAME: &'static str = "fuchsia.ui.composition.ScreenCapture";
6526}
6527impl fidl::endpoints::DiscoverableProtocolMarker for ScreenCaptureMarker {}
6528pub type ScreenCaptureConfigureResult = Result<(), ScreenCaptureError>;
6529pub type ScreenCaptureGetNextFrameResult = Result<FrameInfo, ScreenCaptureError>;
6530pub type ScreenCaptureReleaseFrameResult = Result<(), ScreenCaptureError>;
6531
6532pub trait ScreenCaptureProxyInterface: Send + Sync {
6533    type ConfigureResponseFut: std::future::Future<Output = Result<ScreenCaptureConfigureResult, fidl::Error>>
6534        + Send;
6535    fn r#configure(&self, payload: ScreenCaptureConfig) -> Self::ConfigureResponseFut;
6536    type GetNextFrameResponseFut: std::future::Future<Output = Result<ScreenCaptureGetNextFrameResult, fidl::Error>>
6537        + Send;
6538    fn r#get_next_frame(&self, payload: GetNextFrameArgs) -> Self::GetNextFrameResponseFut;
6539    type ReleaseFrameResponseFut: std::future::Future<Output = Result<ScreenCaptureReleaseFrameResult, fidl::Error>>
6540        + Send;
6541    fn r#release_frame(&self, buffer_id: u32) -> Self::ReleaseFrameResponseFut;
6542}
6543#[derive(Debug)]
6544#[cfg(target_os = "fuchsia")]
6545pub struct ScreenCaptureSynchronousProxy {
6546    client: fidl::client::sync::Client,
6547}
6548
6549#[cfg(target_os = "fuchsia")]
6550impl fidl::endpoints::SynchronousProxy for ScreenCaptureSynchronousProxy {
6551    type Proxy = ScreenCaptureProxy;
6552    type Protocol = ScreenCaptureMarker;
6553
6554    fn from_channel(inner: fidl::Channel) -> Self {
6555        Self::new(inner)
6556    }
6557
6558    fn into_channel(self) -> fidl::Channel {
6559        self.client.into_channel()
6560    }
6561
6562    fn as_channel(&self) -> &fidl::Channel {
6563        self.client.as_channel()
6564    }
6565}
6566
6567#[cfg(target_os = "fuchsia")]
6568impl ScreenCaptureSynchronousProxy {
6569    pub fn new(channel: fidl::Channel) -> Self {
6570        let protocol_name = <ScreenCaptureMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
6571        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
6572    }
6573
6574    pub fn into_channel(self) -> fidl::Channel {
6575        self.client.into_channel()
6576    }
6577
6578    /// Waits until an event arrives and returns it. It is safe for other
6579    /// threads to make concurrent requests while waiting for an event.
6580    pub fn wait_for_event(
6581        &self,
6582        deadline: zx::MonotonicInstant,
6583    ) -> Result<ScreenCaptureEvent, fidl::Error> {
6584        ScreenCaptureEvent::decode(self.client.wait_for_event(deadline)?)
6585    }
6586
6587    /// Clients should first use the Allocator protocol to register a
6588    /// BufferCollection. This function will fail with BAD_OPERATION unless all clients of the
6589    /// BufferCollection have set their constraints.
6590    ///
6591    /// Afterwards, clients should create and configure the images that will
6592    /// eventually be rendered to using this method. All the buffers in the
6593    /// collection from 0 to (buffer_count-1) may be used for screen capture.
6594    ///
6595    /// Clients are responsible for determining the rotation of the display,
6596    /// and applying the corrective rotation. For instance, if the display is
6597    /// mounted 90 degrees clockwise (the "top" is on the right, when looking
6598    /// at the display), then the client should specify a 270 degree rotation
6599    /// to account for it.
6600    ///
6601    /// Similarly, the clients are responsible for specifying a buffer big
6602    /// enough for the rotated image. If the buffer is too small, a best effort
6603    /// attempt will be made to render the image.
6604    ///
6605    /// Finally, clients request the server to render the current screen to the
6606    /// shared buffers using [`GetNextFrame`].
6607    ///
6608    /// [`Configure`] can be called again with a new BufferCollectionImportToken
6609    /// if the client wishes to change any of the configuration settings. In
6610    /// this case all the buffers from the previous call to [`Configure`] will
6611    /// be released.
6612    pub fn r#configure(
6613        &self,
6614        mut payload: ScreenCaptureConfig,
6615        ___deadline: zx::MonotonicInstant,
6616    ) -> Result<ScreenCaptureConfigureResult, fidl::Error> {
6617        let _response = self.client.send_query::<ScreenCaptureConfig, fidl::encoding::ResultType<
6618            fidl::encoding::EmptyStruct,
6619            ScreenCaptureError,
6620        >>(
6621            &mut payload,
6622            0x3b6e5af1d294afd9,
6623            fidl::encoding::DynamicFlags::empty(),
6624            ___deadline,
6625        )?;
6626        Ok(_response.map(|x| x))
6627    }
6628
6629    /// Following a successful call to [`Configure`], clients can call
6630    /// GetNextFrame. This will populate a buffer with the most recent frame.
6631    ///
6632    /// Clients should wait on the zx::event they pass for successful
6633    /// completion of the screenshot. It is not guaranteed that the screenshot
6634    /// will be completed by the time this function returns.
6635    ///
6636    /// The requested image will be in the BufferCollection that the client set
6637    /// up in the VMO at the index specified by buffer_id.
6638    ///
6639    /// When ScreenCapture is used to provide a stream, the rate that the
6640    /// client calls GetNextFrame will drive the frame rate.
6641    ///
6642    /// Errors:
6643    /// BAD_OPERATION if Configure was not called, or not called successfully
6644    /// MISSING_ARGS if a required argument is not present
6645    /// BUFFER_FULL if all buffers in the BufferCollection are in use. In this case, ReleaseFrame
6646    /// must be called to make a buffer available before this function can be called successfully.
6647    pub fn r#get_next_frame(
6648        &self,
6649        mut payload: GetNextFrameArgs,
6650        ___deadline: zx::MonotonicInstant,
6651    ) -> Result<ScreenCaptureGetNextFrameResult, fidl::Error> {
6652        let _response = self.client.send_query::<
6653            GetNextFrameArgs,
6654            fidl::encoding::ResultType<FrameInfo, ScreenCaptureError>,
6655        >(
6656            &mut payload,
6657            0x552c1580aab8c4a7,
6658            fidl::encoding::DynamicFlags::empty(),
6659            ___deadline,
6660        )?;
6661        Ok(_response.map(|x| x))
6662    }
6663
6664    /// Once the client no longer needs an image, they can call ReleaseFrame on
6665    /// the VMO index of the buffer so that the server can reuse it in the future.
6666    pub fn r#release_frame(
6667        &self,
6668        mut buffer_id: u32,
6669        ___deadline: zx::MonotonicInstant,
6670    ) -> Result<ScreenCaptureReleaseFrameResult, fidl::Error> {
6671        let _response =
6672            self.client.send_query::<ScreenCaptureReleaseFrameRequest, fidl::encoding::ResultType<
6673                fidl::encoding::EmptyStruct,
6674                ScreenCaptureError,
6675            >>(
6676                (buffer_id,),
6677                0x46704dce24e35950,
6678                fidl::encoding::DynamicFlags::empty(),
6679                ___deadline,
6680            )?;
6681        Ok(_response.map(|x| x))
6682    }
6683}
6684
6685#[cfg(target_os = "fuchsia")]
6686impl From<ScreenCaptureSynchronousProxy> for zx::NullableHandle {
6687    fn from(value: ScreenCaptureSynchronousProxy) -> Self {
6688        value.into_channel().into()
6689    }
6690}
6691
6692#[cfg(target_os = "fuchsia")]
6693impl From<fidl::Channel> for ScreenCaptureSynchronousProxy {
6694    fn from(value: fidl::Channel) -> Self {
6695        Self::new(value)
6696    }
6697}
6698
6699#[cfg(target_os = "fuchsia")]
6700impl fidl::endpoints::FromClient for ScreenCaptureSynchronousProxy {
6701    type Protocol = ScreenCaptureMarker;
6702
6703    fn from_client(value: fidl::endpoints::ClientEnd<ScreenCaptureMarker>) -> Self {
6704        Self::new(value.into_channel())
6705    }
6706}
6707
6708#[derive(Debug, Clone)]
6709pub struct ScreenCaptureProxy {
6710    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
6711}
6712
6713impl fidl::endpoints::Proxy for ScreenCaptureProxy {
6714    type Protocol = ScreenCaptureMarker;
6715
6716    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
6717        Self::new(inner)
6718    }
6719
6720    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
6721        self.client.into_channel().map_err(|client| Self { client })
6722    }
6723
6724    fn as_channel(&self) -> &::fidl::AsyncChannel {
6725        self.client.as_channel()
6726    }
6727}
6728
6729impl ScreenCaptureProxy {
6730    /// Create a new Proxy for fuchsia.ui.composition/ScreenCapture.
6731    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
6732        let protocol_name = <ScreenCaptureMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
6733        Self { client: fidl::client::Client::new(channel, protocol_name) }
6734    }
6735
6736    /// Get a Stream of events from the remote end of the protocol.
6737    ///
6738    /// # Panics
6739    ///
6740    /// Panics if the event stream was already taken.
6741    pub fn take_event_stream(&self) -> ScreenCaptureEventStream {
6742        ScreenCaptureEventStream { event_receiver: self.client.take_event_receiver() }
6743    }
6744
6745    /// Clients should first use the Allocator protocol to register a
6746    /// BufferCollection. This function will fail with BAD_OPERATION unless all clients of the
6747    /// BufferCollection have set their constraints.
6748    ///
6749    /// Afterwards, clients should create and configure the images that will
6750    /// eventually be rendered to using this method. All the buffers in the
6751    /// collection from 0 to (buffer_count-1) may be used for screen capture.
6752    ///
6753    /// Clients are responsible for determining the rotation of the display,
6754    /// and applying the corrective rotation. For instance, if the display is
6755    /// mounted 90 degrees clockwise (the "top" is on the right, when looking
6756    /// at the display), then the client should specify a 270 degree rotation
6757    /// to account for it.
6758    ///
6759    /// Similarly, the clients are responsible for specifying a buffer big
6760    /// enough for the rotated image. If the buffer is too small, a best effort
6761    /// attempt will be made to render the image.
6762    ///
6763    /// Finally, clients request the server to render the current screen to the
6764    /// shared buffers using [`GetNextFrame`].
6765    ///
6766    /// [`Configure`] can be called again with a new BufferCollectionImportToken
6767    /// if the client wishes to change any of the configuration settings. In
6768    /// this case all the buffers from the previous call to [`Configure`] will
6769    /// be released.
6770    pub fn r#configure(
6771        &self,
6772        mut payload: ScreenCaptureConfig,
6773    ) -> fidl::client::QueryResponseFut<
6774        ScreenCaptureConfigureResult,
6775        fidl::encoding::DefaultFuchsiaResourceDialect,
6776    > {
6777        ScreenCaptureProxyInterface::r#configure(self, payload)
6778    }
6779
6780    /// Following a successful call to [`Configure`], clients can call
6781    /// GetNextFrame. This will populate a buffer with the most recent frame.
6782    ///
6783    /// Clients should wait on the zx::event they pass for successful
6784    /// completion of the screenshot. It is not guaranteed that the screenshot
6785    /// will be completed by the time this function returns.
6786    ///
6787    /// The requested image will be in the BufferCollection that the client set
6788    /// up in the VMO at the index specified by buffer_id.
6789    ///
6790    /// When ScreenCapture is used to provide a stream, the rate that the
6791    /// client calls GetNextFrame will drive the frame rate.
6792    ///
6793    /// Errors:
6794    /// BAD_OPERATION if Configure was not called, or not called successfully
6795    /// MISSING_ARGS if a required argument is not present
6796    /// BUFFER_FULL if all buffers in the BufferCollection are in use. In this case, ReleaseFrame
6797    /// must be called to make a buffer available before this function can be called successfully.
6798    pub fn r#get_next_frame(
6799        &self,
6800        mut payload: GetNextFrameArgs,
6801    ) -> fidl::client::QueryResponseFut<
6802        ScreenCaptureGetNextFrameResult,
6803        fidl::encoding::DefaultFuchsiaResourceDialect,
6804    > {
6805        ScreenCaptureProxyInterface::r#get_next_frame(self, payload)
6806    }
6807
6808    /// Once the client no longer needs an image, they can call ReleaseFrame on
6809    /// the VMO index of the buffer so that the server can reuse it in the future.
6810    pub fn r#release_frame(
6811        &self,
6812        mut buffer_id: u32,
6813    ) -> fidl::client::QueryResponseFut<
6814        ScreenCaptureReleaseFrameResult,
6815        fidl::encoding::DefaultFuchsiaResourceDialect,
6816    > {
6817        ScreenCaptureProxyInterface::r#release_frame(self, buffer_id)
6818    }
6819}
6820
6821impl ScreenCaptureProxyInterface for ScreenCaptureProxy {
6822    type ConfigureResponseFut = fidl::client::QueryResponseFut<
6823        ScreenCaptureConfigureResult,
6824        fidl::encoding::DefaultFuchsiaResourceDialect,
6825    >;
6826    fn r#configure(&self, mut payload: ScreenCaptureConfig) -> Self::ConfigureResponseFut {
6827        fn _decode(
6828            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6829        ) -> Result<ScreenCaptureConfigureResult, fidl::Error> {
6830            let _response = fidl::client::decode_transaction_body::<
6831                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, ScreenCaptureError>,
6832                fidl::encoding::DefaultFuchsiaResourceDialect,
6833                0x3b6e5af1d294afd9,
6834            >(_buf?)?;
6835            Ok(_response.map(|x| x))
6836        }
6837        self.client.send_query_and_decode::<ScreenCaptureConfig, ScreenCaptureConfigureResult>(
6838            &mut payload,
6839            0x3b6e5af1d294afd9,
6840            fidl::encoding::DynamicFlags::empty(),
6841            _decode,
6842        )
6843    }
6844
6845    type GetNextFrameResponseFut = fidl::client::QueryResponseFut<
6846        ScreenCaptureGetNextFrameResult,
6847        fidl::encoding::DefaultFuchsiaResourceDialect,
6848    >;
6849    fn r#get_next_frame(&self, mut payload: GetNextFrameArgs) -> Self::GetNextFrameResponseFut {
6850        fn _decode(
6851            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6852        ) -> Result<ScreenCaptureGetNextFrameResult, fidl::Error> {
6853            let _response = fidl::client::decode_transaction_body::<
6854                fidl::encoding::ResultType<FrameInfo, ScreenCaptureError>,
6855                fidl::encoding::DefaultFuchsiaResourceDialect,
6856                0x552c1580aab8c4a7,
6857            >(_buf?)?;
6858            Ok(_response.map(|x| x))
6859        }
6860        self.client.send_query_and_decode::<GetNextFrameArgs, ScreenCaptureGetNextFrameResult>(
6861            &mut payload,
6862            0x552c1580aab8c4a7,
6863            fidl::encoding::DynamicFlags::empty(),
6864            _decode,
6865        )
6866    }
6867
6868    type ReleaseFrameResponseFut = fidl::client::QueryResponseFut<
6869        ScreenCaptureReleaseFrameResult,
6870        fidl::encoding::DefaultFuchsiaResourceDialect,
6871    >;
6872    fn r#release_frame(&self, mut buffer_id: u32) -> Self::ReleaseFrameResponseFut {
6873        fn _decode(
6874            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6875        ) -> Result<ScreenCaptureReleaseFrameResult, fidl::Error> {
6876            let _response = fidl::client::decode_transaction_body::<
6877                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, ScreenCaptureError>,
6878                fidl::encoding::DefaultFuchsiaResourceDialect,
6879                0x46704dce24e35950,
6880            >(_buf?)?;
6881            Ok(_response.map(|x| x))
6882        }
6883        self.client.send_query_and_decode::<
6884            ScreenCaptureReleaseFrameRequest,
6885            ScreenCaptureReleaseFrameResult,
6886        >(
6887            (buffer_id,),
6888            0x46704dce24e35950,
6889            fidl::encoding::DynamicFlags::empty(),
6890            _decode,
6891        )
6892    }
6893}
6894
6895pub struct ScreenCaptureEventStream {
6896    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
6897}
6898
6899impl std::marker::Unpin for ScreenCaptureEventStream {}
6900
6901impl futures::stream::FusedStream for ScreenCaptureEventStream {
6902    fn is_terminated(&self) -> bool {
6903        self.event_receiver.is_terminated()
6904    }
6905}
6906
6907impl futures::Stream for ScreenCaptureEventStream {
6908    type Item = Result<ScreenCaptureEvent, fidl::Error>;
6909
6910    fn poll_next(
6911        mut self: std::pin::Pin<&mut Self>,
6912        cx: &mut std::task::Context<'_>,
6913    ) -> std::task::Poll<Option<Self::Item>> {
6914        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
6915            &mut self.event_receiver,
6916            cx
6917        )?) {
6918            Some(buf) => std::task::Poll::Ready(Some(ScreenCaptureEvent::decode(buf))),
6919            None => std::task::Poll::Ready(None),
6920        }
6921    }
6922}
6923
6924#[derive(Debug)]
6925pub enum ScreenCaptureEvent {}
6926
6927impl ScreenCaptureEvent {
6928    /// Decodes a message buffer as a [`ScreenCaptureEvent`].
6929    fn decode(
6930        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
6931    ) -> Result<ScreenCaptureEvent, fidl::Error> {
6932        let (bytes, _handles) = buf.split_mut();
6933        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6934        debug_assert_eq!(tx_header.tx_id, 0);
6935        match tx_header.ordinal {
6936            _ => Err(fidl::Error::UnknownOrdinal {
6937                ordinal: tx_header.ordinal,
6938                protocol_name: <ScreenCaptureMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6939            }),
6940        }
6941    }
6942}
6943
6944/// A Stream of incoming requests for fuchsia.ui.composition/ScreenCapture.
6945pub struct ScreenCaptureRequestStream {
6946    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6947    is_terminated: bool,
6948}
6949
6950impl std::marker::Unpin for ScreenCaptureRequestStream {}
6951
6952impl futures::stream::FusedStream for ScreenCaptureRequestStream {
6953    fn is_terminated(&self) -> bool {
6954        self.is_terminated
6955    }
6956}
6957
6958impl fidl::endpoints::RequestStream for ScreenCaptureRequestStream {
6959    type Protocol = ScreenCaptureMarker;
6960    type ControlHandle = ScreenCaptureControlHandle;
6961
6962    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
6963        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
6964    }
6965
6966    fn control_handle(&self) -> Self::ControlHandle {
6967        ScreenCaptureControlHandle { inner: self.inner.clone() }
6968    }
6969
6970    fn into_inner(
6971        self,
6972    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
6973    {
6974        (self.inner, self.is_terminated)
6975    }
6976
6977    fn from_inner(
6978        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6979        is_terminated: bool,
6980    ) -> Self {
6981        Self { inner, is_terminated }
6982    }
6983}
6984
6985impl futures::Stream for ScreenCaptureRequestStream {
6986    type Item = Result<ScreenCaptureRequest, fidl::Error>;
6987
6988    fn poll_next(
6989        mut self: std::pin::Pin<&mut Self>,
6990        cx: &mut std::task::Context<'_>,
6991    ) -> std::task::Poll<Option<Self::Item>> {
6992        let this = &mut *self;
6993        if this.inner.check_shutdown(cx) {
6994            this.is_terminated = true;
6995            return std::task::Poll::Ready(None);
6996        }
6997        if this.is_terminated {
6998            panic!("polled ScreenCaptureRequestStream after completion");
6999        }
7000        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
7001            |bytes, handles| {
7002                match this.inner.channel().read_etc(cx, bytes, handles) {
7003                    std::task::Poll::Ready(Ok(())) => {}
7004                    std::task::Poll::Pending => return std::task::Poll::Pending,
7005                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
7006                        this.is_terminated = true;
7007                        return std::task::Poll::Ready(None);
7008                    }
7009                    std::task::Poll::Ready(Err(e)) => {
7010                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
7011                            e.into(),
7012                        ))));
7013                    }
7014                }
7015
7016                // A message has been received from the channel
7017                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7018
7019                std::task::Poll::Ready(Some(match header.ordinal {
7020                    0x3b6e5af1d294afd9 => {
7021                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7022                        let mut req = fidl::new_empty!(
7023                            ScreenCaptureConfig,
7024                            fidl::encoding::DefaultFuchsiaResourceDialect
7025                        );
7026                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ScreenCaptureConfig>(&header, _body_bytes, handles, &mut req)?;
7027                        let control_handle =
7028                            ScreenCaptureControlHandle { inner: this.inner.clone() };
7029                        Ok(ScreenCaptureRequest::Configure {
7030                            payload: req,
7031                            responder: ScreenCaptureConfigureResponder {
7032                                control_handle: std::mem::ManuallyDrop::new(control_handle),
7033                                tx_id: header.tx_id,
7034                            },
7035                        })
7036                    }
7037                    0x552c1580aab8c4a7 => {
7038                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7039                        let mut req = fidl::new_empty!(
7040                            GetNextFrameArgs,
7041                            fidl::encoding::DefaultFuchsiaResourceDialect
7042                        );
7043                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<GetNextFrameArgs>(&header, _body_bytes, handles, &mut req)?;
7044                        let control_handle =
7045                            ScreenCaptureControlHandle { inner: this.inner.clone() };
7046                        Ok(ScreenCaptureRequest::GetNextFrame {
7047                            payload: req,
7048                            responder: ScreenCaptureGetNextFrameResponder {
7049                                control_handle: std::mem::ManuallyDrop::new(control_handle),
7050                                tx_id: header.tx_id,
7051                            },
7052                        })
7053                    }
7054                    0x46704dce24e35950 => {
7055                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7056                        let mut req = fidl::new_empty!(
7057                            ScreenCaptureReleaseFrameRequest,
7058                            fidl::encoding::DefaultFuchsiaResourceDialect
7059                        );
7060                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ScreenCaptureReleaseFrameRequest>(&header, _body_bytes, handles, &mut req)?;
7061                        let control_handle =
7062                            ScreenCaptureControlHandle { inner: this.inner.clone() };
7063                        Ok(ScreenCaptureRequest::ReleaseFrame {
7064                            buffer_id: req.buffer_id,
7065
7066                            responder: ScreenCaptureReleaseFrameResponder {
7067                                control_handle: std::mem::ManuallyDrop::new(control_handle),
7068                                tx_id: header.tx_id,
7069                            },
7070                        })
7071                    }
7072                    _ => Err(fidl::Error::UnknownOrdinal {
7073                        ordinal: header.ordinal,
7074                        protocol_name:
7075                            <ScreenCaptureMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
7076                    }),
7077                }))
7078            },
7079        )
7080    }
7081}
7082
7083/// This protocol provides a low-level ScreenCapture API for clients to use.
7084/// ScreenCapture clients should familiarize themselves with the
7085/// [`fuchsia.sysmem/BufferCollection`] and [`fuchsia.ui.composition/Allocator`] protocols
7086/// as those are necessary to create the BufferCollections and images ScreenCapture uses.
7087#[derive(Debug)]
7088pub enum ScreenCaptureRequest {
7089    /// Clients should first use the Allocator protocol to register a
7090    /// BufferCollection. This function will fail with BAD_OPERATION unless all clients of the
7091    /// BufferCollection have set their constraints.
7092    ///
7093    /// Afterwards, clients should create and configure the images that will
7094    /// eventually be rendered to using this method. All the buffers in the
7095    /// collection from 0 to (buffer_count-1) may be used for screen capture.
7096    ///
7097    /// Clients are responsible for determining the rotation of the display,
7098    /// and applying the corrective rotation. For instance, if the display is
7099    /// mounted 90 degrees clockwise (the "top" is on the right, when looking
7100    /// at the display), then the client should specify a 270 degree rotation
7101    /// to account for it.
7102    ///
7103    /// Similarly, the clients are responsible for specifying a buffer big
7104    /// enough for the rotated image. If the buffer is too small, a best effort
7105    /// attempt will be made to render the image.
7106    ///
7107    /// Finally, clients request the server to render the current screen to the
7108    /// shared buffers using [`GetNextFrame`].
7109    ///
7110    /// [`Configure`] can be called again with a new BufferCollectionImportToken
7111    /// if the client wishes to change any of the configuration settings. In
7112    /// this case all the buffers from the previous call to [`Configure`] will
7113    /// be released.
7114    Configure { payload: ScreenCaptureConfig, responder: ScreenCaptureConfigureResponder },
7115    /// Following a successful call to [`Configure`], clients can call
7116    /// GetNextFrame. This will populate a buffer with the most recent frame.
7117    ///
7118    /// Clients should wait on the zx::event they pass for successful
7119    /// completion of the screenshot. It is not guaranteed that the screenshot
7120    /// will be completed by the time this function returns.
7121    ///
7122    /// The requested image will be in the BufferCollection that the client set
7123    /// up in the VMO at the index specified by buffer_id.
7124    ///
7125    /// When ScreenCapture is used to provide a stream, the rate that the
7126    /// client calls GetNextFrame will drive the frame rate.
7127    ///
7128    /// Errors:
7129    /// BAD_OPERATION if Configure was not called, or not called successfully
7130    /// MISSING_ARGS if a required argument is not present
7131    /// BUFFER_FULL if all buffers in the BufferCollection are in use. In this case, ReleaseFrame
7132    /// must be called to make a buffer available before this function can be called successfully.
7133    GetNextFrame { payload: GetNextFrameArgs, responder: ScreenCaptureGetNextFrameResponder },
7134    /// Once the client no longer needs an image, they can call ReleaseFrame on
7135    /// the VMO index of the buffer so that the server can reuse it in the future.
7136    ReleaseFrame { buffer_id: u32, responder: ScreenCaptureReleaseFrameResponder },
7137}
7138
7139impl ScreenCaptureRequest {
7140    #[allow(irrefutable_let_patterns)]
7141    pub fn into_configure(self) -> Option<(ScreenCaptureConfig, ScreenCaptureConfigureResponder)> {
7142        if let ScreenCaptureRequest::Configure { payload, responder } = self {
7143            Some((payload, responder))
7144        } else {
7145            None
7146        }
7147    }
7148
7149    #[allow(irrefutable_let_patterns)]
7150    pub fn into_get_next_frame(
7151        self,
7152    ) -> Option<(GetNextFrameArgs, ScreenCaptureGetNextFrameResponder)> {
7153        if let ScreenCaptureRequest::GetNextFrame { payload, responder } = self {
7154            Some((payload, responder))
7155        } else {
7156            None
7157        }
7158    }
7159
7160    #[allow(irrefutable_let_patterns)]
7161    pub fn into_release_frame(self) -> Option<(u32, ScreenCaptureReleaseFrameResponder)> {
7162        if let ScreenCaptureRequest::ReleaseFrame { buffer_id, responder } = self {
7163            Some((buffer_id, responder))
7164        } else {
7165            None
7166        }
7167    }
7168
7169    /// Name of the method defined in FIDL
7170    pub fn method_name(&self) -> &'static str {
7171        match *self {
7172            ScreenCaptureRequest::Configure { .. } => "configure",
7173            ScreenCaptureRequest::GetNextFrame { .. } => "get_next_frame",
7174            ScreenCaptureRequest::ReleaseFrame { .. } => "release_frame",
7175        }
7176    }
7177}
7178
7179#[derive(Debug, Clone)]
7180pub struct ScreenCaptureControlHandle {
7181    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7182}
7183
7184impl fidl::endpoints::ControlHandle for ScreenCaptureControlHandle {
7185    fn shutdown(&self) {
7186        self.inner.shutdown()
7187    }
7188
7189    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
7190        self.inner.shutdown_with_epitaph(status)
7191    }
7192
7193    fn is_closed(&self) -> bool {
7194        self.inner.channel().is_closed()
7195    }
7196    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
7197        self.inner.channel().on_closed()
7198    }
7199
7200    #[cfg(target_os = "fuchsia")]
7201    fn signal_peer(
7202        &self,
7203        clear_mask: zx::Signals,
7204        set_mask: zx::Signals,
7205    ) -> Result<(), zx_status::Status> {
7206        use fidl::Peered;
7207        self.inner.channel().signal_peer(clear_mask, set_mask)
7208    }
7209}
7210
7211impl ScreenCaptureControlHandle {}
7212
7213#[must_use = "FIDL methods require a response to be sent"]
7214#[derive(Debug)]
7215pub struct ScreenCaptureConfigureResponder {
7216    control_handle: std::mem::ManuallyDrop<ScreenCaptureControlHandle>,
7217    tx_id: u32,
7218}
7219
7220/// Set the the channel to be shutdown (see [`ScreenCaptureControlHandle::shutdown`])
7221/// if the responder is dropped without sending a response, so that the client
7222/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7223impl std::ops::Drop for ScreenCaptureConfigureResponder {
7224    fn drop(&mut self) {
7225        self.control_handle.shutdown();
7226        // Safety: drops once, never accessed again
7227        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7228    }
7229}
7230
7231impl fidl::endpoints::Responder for ScreenCaptureConfigureResponder {
7232    type ControlHandle = ScreenCaptureControlHandle;
7233
7234    fn control_handle(&self) -> &ScreenCaptureControlHandle {
7235        &self.control_handle
7236    }
7237
7238    fn drop_without_shutdown(mut self) {
7239        // Safety: drops once, never accessed again due to mem::forget
7240        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7241        // Prevent Drop from running (which would shut down the channel)
7242        std::mem::forget(self);
7243    }
7244}
7245
7246impl ScreenCaptureConfigureResponder {
7247    /// Sends a response to the FIDL transaction.
7248    ///
7249    /// Sets the channel to shutdown if an error occurs.
7250    pub fn send(self, mut result: Result<(), ScreenCaptureError>) -> Result<(), fidl::Error> {
7251        let _result = self.send_raw(result);
7252        if _result.is_err() {
7253            self.control_handle.shutdown();
7254        }
7255        self.drop_without_shutdown();
7256        _result
7257    }
7258
7259    /// Similar to "send" but does not shutdown the channel if an error occurs.
7260    pub fn send_no_shutdown_on_err(
7261        self,
7262        mut result: Result<(), ScreenCaptureError>,
7263    ) -> Result<(), fidl::Error> {
7264        let _result = self.send_raw(result);
7265        self.drop_without_shutdown();
7266        _result
7267    }
7268
7269    fn send_raw(&self, mut result: Result<(), ScreenCaptureError>) -> Result<(), fidl::Error> {
7270        self.control_handle.inner.send::<fidl::encoding::ResultType<
7271            fidl::encoding::EmptyStruct,
7272            ScreenCaptureError,
7273        >>(
7274            result,
7275            self.tx_id,
7276            0x3b6e5af1d294afd9,
7277            fidl::encoding::DynamicFlags::empty(),
7278        )
7279    }
7280}
7281
7282#[must_use = "FIDL methods require a response to be sent"]
7283#[derive(Debug)]
7284pub struct ScreenCaptureGetNextFrameResponder {
7285    control_handle: std::mem::ManuallyDrop<ScreenCaptureControlHandle>,
7286    tx_id: u32,
7287}
7288
7289/// Set the the channel to be shutdown (see [`ScreenCaptureControlHandle::shutdown`])
7290/// if the responder is dropped without sending a response, so that the client
7291/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7292impl std::ops::Drop for ScreenCaptureGetNextFrameResponder {
7293    fn drop(&mut self) {
7294        self.control_handle.shutdown();
7295        // Safety: drops once, never accessed again
7296        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7297    }
7298}
7299
7300impl fidl::endpoints::Responder for ScreenCaptureGetNextFrameResponder {
7301    type ControlHandle = ScreenCaptureControlHandle;
7302
7303    fn control_handle(&self) -> &ScreenCaptureControlHandle {
7304        &self.control_handle
7305    }
7306
7307    fn drop_without_shutdown(mut self) {
7308        // Safety: drops once, never accessed again due to mem::forget
7309        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7310        // Prevent Drop from running (which would shut down the channel)
7311        std::mem::forget(self);
7312    }
7313}
7314
7315impl ScreenCaptureGetNextFrameResponder {
7316    /// Sends a response to the FIDL transaction.
7317    ///
7318    /// Sets the channel to shutdown if an error occurs.
7319    pub fn send(
7320        self,
7321        mut result: Result<FrameInfo, ScreenCaptureError>,
7322    ) -> Result<(), fidl::Error> {
7323        let _result = self.send_raw(result);
7324        if _result.is_err() {
7325            self.control_handle.shutdown();
7326        }
7327        self.drop_without_shutdown();
7328        _result
7329    }
7330
7331    /// Similar to "send" but does not shutdown the channel if an error occurs.
7332    pub fn send_no_shutdown_on_err(
7333        self,
7334        mut result: Result<FrameInfo, ScreenCaptureError>,
7335    ) -> Result<(), fidl::Error> {
7336        let _result = self.send_raw(result);
7337        self.drop_without_shutdown();
7338        _result
7339    }
7340
7341    fn send_raw(
7342        &self,
7343        mut result: Result<FrameInfo, ScreenCaptureError>,
7344    ) -> Result<(), fidl::Error> {
7345        self.control_handle.inner.send::<fidl::encoding::ResultType<FrameInfo, ScreenCaptureError>>(
7346            result.as_mut().map_err(|e| *e),
7347            self.tx_id,
7348            0x552c1580aab8c4a7,
7349            fidl::encoding::DynamicFlags::empty(),
7350        )
7351    }
7352}
7353
7354#[must_use = "FIDL methods require a response to be sent"]
7355#[derive(Debug)]
7356pub struct ScreenCaptureReleaseFrameResponder {
7357    control_handle: std::mem::ManuallyDrop<ScreenCaptureControlHandle>,
7358    tx_id: u32,
7359}
7360
7361/// Set the the channel to be shutdown (see [`ScreenCaptureControlHandle::shutdown`])
7362/// if the responder is dropped without sending a response, so that the client
7363/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7364impl std::ops::Drop for ScreenCaptureReleaseFrameResponder {
7365    fn drop(&mut self) {
7366        self.control_handle.shutdown();
7367        // Safety: drops once, never accessed again
7368        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7369    }
7370}
7371
7372impl fidl::endpoints::Responder for ScreenCaptureReleaseFrameResponder {
7373    type ControlHandle = ScreenCaptureControlHandle;
7374
7375    fn control_handle(&self) -> &ScreenCaptureControlHandle {
7376        &self.control_handle
7377    }
7378
7379    fn drop_without_shutdown(mut self) {
7380        // Safety: drops once, never accessed again due to mem::forget
7381        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7382        // Prevent Drop from running (which would shut down the channel)
7383        std::mem::forget(self);
7384    }
7385}
7386
7387impl ScreenCaptureReleaseFrameResponder {
7388    /// Sends a response to the FIDL transaction.
7389    ///
7390    /// Sets the channel to shutdown if an error occurs.
7391    pub fn send(self, mut result: Result<(), ScreenCaptureError>) -> Result<(), fidl::Error> {
7392        let _result = self.send_raw(result);
7393        if _result.is_err() {
7394            self.control_handle.shutdown();
7395        }
7396        self.drop_without_shutdown();
7397        _result
7398    }
7399
7400    /// Similar to "send" but does not shutdown the channel if an error occurs.
7401    pub fn send_no_shutdown_on_err(
7402        self,
7403        mut result: Result<(), ScreenCaptureError>,
7404    ) -> Result<(), fidl::Error> {
7405        let _result = self.send_raw(result);
7406        self.drop_without_shutdown();
7407        _result
7408    }
7409
7410    fn send_raw(&self, mut result: Result<(), ScreenCaptureError>) -> Result<(), fidl::Error> {
7411        self.control_handle.inner.send::<fidl::encoding::ResultType<
7412            fidl::encoding::EmptyStruct,
7413            ScreenCaptureError,
7414        >>(
7415            result,
7416            self.tx_id,
7417            0x46704dce24e35950,
7418            fidl::encoding::DynamicFlags::empty(),
7419        )
7420    }
7421}
7422
7423#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
7424pub struct ScreenshotMarker;
7425
7426impl fidl::endpoints::ProtocolMarker for ScreenshotMarker {
7427    type Proxy = ScreenshotProxy;
7428    type RequestStream = ScreenshotRequestStream;
7429    #[cfg(target_os = "fuchsia")]
7430    type SynchronousProxy = ScreenshotSynchronousProxy;
7431
7432    const DEBUG_NAME: &'static str = "fuchsia.ui.composition.Screenshot";
7433}
7434impl fidl::endpoints::DiscoverableProtocolMarker for ScreenshotMarker {}
7435
7436pub trait ScreenshotProxyInterface: Send + Sync {
7437    type TakeResponseFut: std::future::Future<Output = Result<ScreenshotTakeResponse, fidl::Error>>
7438        + Send;
7439    fn r#take(&self, payload: ScreenshotTakeRequest) -> Self::TakeResponseFut;
7440    type TakeFileResponseFut: std::future::Future<Output = Result<ScreenshotTakeFileResponse, fidl::Error>>
7441        + Send;
7442    fn r#take_file(&self, payload: ScreenshotTakeFileRequest) -> Self::TakeFileResponseFut;
7443}
7444#[derive(Debug)]
7445#[cfg(target_os = "fuchsia")]
7446pub struct ScreenshotSynchronousProxy {
7447    client: fidl::client::sync::Client,
7448}
7449
7450#[cfg(target_os = "fuchsia")]
7451impl fidl::endpoints::SynchronousProxy for ScreenshotSynchronousProxy {
7452    type Proxy = ScreenshotProxy;
7453    type Protocol = ScreenshotMarker;
7454
7455    fn from_channel(inner: fidl::Channel) -> Self {
7456        Self::new(inner)
7457    }
7458
7459    fn into_channel(self) -> fidl::Channel {
7460        self.client.into_channel()
7461    }
7462
7463    fn as_channel(&self) -> &fidl::Channel {
7464        self.client.as_channel()
7465    }
7466}
7467
7468#[cfg(target_os = "fuchsia")]
7469impl ScreenshotSynchronousProxy {
7470    pub fn new(channel: fidl::Channel) -> Self {
7471        let protocol_name = <ScreenshotMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
7472        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
7473    }
7474
7475    pub fn into_channel(self) -> fidl::Channel {
7476        self.client.into_channel()
7477    }
7478
7479    /// Waits until an event arrives and returns it. It is safe for other
7480    /// threads to make concurrent requests while waiting for an event.
7481    pub fn wait_for_event(
7482        &self,
7483        deadline: zx::MonotonicInstant,
7484    ) -> Result<ScreenshotEvent, fidl::Error> {
7485        ScreenshotEvent::decode(self.client.wait_for_event(deadline)?)
7486    }
7487
7488    /// Collects the current graphical content of a display in a specified buffer `format` in the
7489    /// sRGB color space. Note that the sRGB color space is non-linear, meaning that unit tests
7490    /// doing pixel equality checks making use of non-fully saturated colors should convert to a
7491    /// linear color space.
7492    ///
7493    /// See https://fuchsia.dev/fuchsia-src/concepts/ui/scenic/color_spaces for more information.
7494    ///
7495    /// Screenshot is taken immediately, populated with the display's content from the most recent
7496    /// VSYNC.
7497    ///
7498    /// If the client calls [`Take`] a second time before a first [`Take`] call returns, the server
7499    /// will close the Screenshot connection with a ZX_ERR_SHOULD_WAIT epitaph.
7500    ///
7501    /// If capture fails due to an internal error, the server will close the Screenshot connection
7502    /// with a ZX_ERR_INTERNAL epitaph.
7503    pub fn r#take(
7504        &self,
7505        mut payload: ScreenshotTakeRequest,
7506        ___deadline: zx::MonotonicInstant,
7507    ) -> Result<ScreenshotTakeResponse, fidl::Error> {
7508        let _response = self.client.send_query::<ScreenshotTakeRequest, ScreenshotTakeResponse>(
7509            &mut payload,
7510            0x51341396e9fd2fd0,
7511            fidl::encoding::DynamicFlags::empty(),
7512            ___deadline,
7513        )?;
7514        Ok(_response)
7515    }
7516
7517    /// Collects the current graphical content of a display in a specified buffer `format` in the
7518    /// sRGB color space. Note that the sRGB color space is non-linear, meaning that unit tests
7519    /// doing pixel equality checks making use of non-fully saturated colors should convert to a
7520    /// linear color space.
7521    ///
7522    /// TODO(https://fxbug.dev/42065844): Link to fuchsia.dev documentation when it's up.
7523    ///
7524    /// Screenshot is taken immediately, populated with the display's content from the most recent
7525    /// VSYNC.
7526    ///
7527    /// If the client calls [`TakeFile`] a second time before a first [`TakeFile`] call returns,
7528    /// the server will close the Screenshot connection with a ZX_ERR_SHOULD_WAIT epitaph.
7529    ///
7530    /// If capture fails due to an internal error, the server will close the Screenshot connection
7531    /// with a ZX_ERR_INTERNAL epitaph.
7532    ///
7533    /// This call should be used if the client is on the host and does not support VMOs,
7534    /// as is the case for ffx tools.
7535    pub fn r#take_file(
7536        &self,
7537        mut payload: ScreenshotTakeFileRequest,
7538        ___deadline: zx::MonotonicInstant,
7539    ) -> Result<ScreenshotTakeFileResponse, fidl::Error> {
7540        let _response =
7541            self.client.send_query::<ScreenshotTakeFileRequest, ScreenshotTakeFileResponse>(
7542                &mut payload,
7543                0x470aeea0a4d32903,
7544                fidl::encoding::DynamicFlags::empty(),
7545                ___deadline,
7546            )?;
7547        Ok(_response)
7548    }
7549}
7550
7551#[cfg(target_os = "fuchsia")]
7552impl From<ScreenshotSynchronousProxy> for zx::NullableHandle {
7553    fn from(value: ScreenshotSynchronousProxy) -> Self {
7554        value.into_channel().into()
7555    }
7556}
7557
7558#[cfg(target_os = "fuchsia")]
7559impl From<fidl::Channel> for ScreenshotSynchronousProxy {
7560    fn from(value: fidl::Channel) -> Self {
7561        Self::new(value)
7562    }
7563}
7564
7565#[cfg(target_os = "fuchsia")]
7566impl fidl::endpoints::FromClient for ScreenshotSynchronousProxy {
7567    type Protocol = ScreenshotMarker;
7568
7569    fn from_client(value: fidl::endpoints::ClientEnd<ScreenshotMarker>) -> Self {
7570        Self::new(value.into_channel())
7571    }
7572}
7573
7574#[derive(Debug, Clone)]
7575pub struct ScreenshotProxy {
7576    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
7577}
7578
7579impl fidl::endpoints::Proxy for ScreenshotProxy {
7580    type Protocol = ScreenshotMarker;
7581
7582    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
7583        Self::new(inner)
7584    }
7585
7586    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
7587        self.client.into_channel().map_err(|client| Self { client })
7588    }
7589
7590    fn as_channel(&self) -> &::fidl::AsyncChannel {
7591        self.client.as_channel()
7592    }
7593}
7594
7595impl ScreenshotProxy {
7596    /// Create a new Proxy for fuchsia.ui.composition/Screenshot.
7597    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
7598        let protocol_name = <ScreenshotMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
7599        Self { client: fidl::client::Client::new(channel, protocol_name) }
7600    }
7601
7602    /// Get a Stream of events from the remote end of the protocol.
7603    ///
7604    /// # Panics
7605    ///
7606    /// Panics if the event stream was already taken.
7607    pub fn take_event_stream(&self) -> ScreenshotEventStream {
7608        ScreenshotEventStream { event_receiver: self.client.take_event_receiver() }
7609    }
7610
7611    /// Collects the current graphical content of a display in a specified buffer `format` in the
7612    /// sRGB color space. Note that the sRGB color space is non-linear, meaning that unit tests
7613    /// doing pixel equality checks making use of non-fully saturated colors should convert to a
7614    /// linear color space.
7615    ///
7616    /// See https://fuchsia.dev/fuchsia-src/concepts/ui/scenic/color_spaces for more information.
7617    ///
7618    /// Screenshot is taken immediately, populated with the display's content from the most recent
7619    /// VSYNC.
7620    ///
7621    /// If the client calls [`Take`] a second time before a first [`Take`] call returns, the server
7622    /// will close the Screenshot connection with a ZX_ERR_SHOULD_WAIT epitaph.
7623    ///
7624    /// If capture fails due to an internal error, the server will close the Screenshot connection
7625    /// with a ZX_ERR_INTERNAL epitaph.
7626    pub fn r#take(
7627        &self,
7628        mut payload: ScreenshotTakeRequest,
7629    ) -> fidl::client::QueryResponseFut<
7630        ScreenshotTakeResponse,
7631        fidl::encoding::DefaultFuchsiaResourceDialect,
7632    > {
7633        ScreenshotProxyInterface::r#take(self, payload)
7634    }
7635
7636    /// Collects the current graphical content of a display in a specified buffer `format` in the
7637    /// sRGB color space. Note that the sRGB color space is non-linear, meaning that unit tests
7638    /// doing pixel equality checks making use of non-fully saturated colors should convert to a
7639    /// linear color space.
7640    ///
7641    /// TODO(https://fxbug.dev/42065844): Link to fuchsia.dev documentation when it's up.
7642    ///
7643    /// Screenshot is taken immediately, populated with the display's content from the most recent
7644    /// VSYNC.
7645    ///
7646    /// If the client calls [`TakeFile`] a second time before a first [`TakeFile`] call returns,
7647    /// the server will close the Screenshot connection with a ZX_ERR_SHOULD_WAIT epitaph.
7648    ///
7649    /// If capture fails due to an internal error, the server will close the Screenshot connection
7650    /// with a ZX_ERR_INTERNAL epitaph.
7651    ///
7652    /// This call should be used if the client is on the host and does not support VMOs,
7653    /// as is the case for ffx tools.
7654    pub fn r#take_file(
7655        &self,
7656        mut payload: ScreenshotTakeFileRequest,
7657    ) -> fidl::client::QueryResponseFut<
7658        ScreenshotTakeFileResponse,
7659        fidl::encoding::DefaultFuchsiaResourceDialect,
7660    > {
7661        ScreenshotProxyInterface::r#take_file(self, payload)
7662    }
7663}
7664
7665impl ScreenshotProxyInterface for ScreenshotProxy {
7666    type TakeResponseFut = fidl::client::QueryResponseFut<
7667        ScreenshotTakeResponse,
7668        fidl::encoding::DefaultFuchsiaResourceDialect,
7669    >;
7670    fn r#take(&self, mut payload: ScreenshotTakeRequest) -> Self::TakeResponseFut {
7671        fn _decode(
7672            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7673        ) -> Result<ScreenshotTakeResponse, fidl::Error> {
7674            let _response = fidl::client::decode_transaction_body::<
7675                ScreenshotTakeResponse,
7676                fidl::encoding::DefaultFuchsiaResourceDialect,
7677                0x51341396e9fd2fd0,
7678            >(_buf?)?;
7679            Ok(_response)
7680        }
7681        self.client.send_query_and_decode::<ScreenshotTakeRequest, ScreenshotTakeResponse>(
7682            &mut payload,
7683            0x51341396e9fd2fd0,
7684            fidl::encoding::DynamicFlags::empty(),
7685            _decode,
7686        )
7687    }
7688
7689    type TakeFileResponseFut = fidl::client::QueryResponseFut<
7690        ScreenshotTakeFileResponse,
7691        fidl::encoding::DefaultFuchsiaResourceDialect,
7692    >;
7693    fn r#take_file(&self, mut payload: ScreenshotTakeFileRequest) -> Self::TakeFileResponseFut {
7694        fn _decode(
7695            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7696        ) -> Result<ScreenshotTakeFileResponse, fidl::Error> {
7697            let _response = fidl::client::decode_transaction_body::<
7698                ScreenshotTakeFileResponse,
7699                fidl::encoding::DefaultFuchsiaResourceDialect,
7700                0x470aeea0a4d32903,
7701            >(_buf?)?;
7702            Ok(_response)
7703        }
7704        self.client.send_query_and_decode::<ScreenshotTakeFileRequest, ScreenshotTakeFileResponse>(
7705            &mut payload,
7706            0x470aeea0a4d32903,
7707            fidl::encoding::DynamicFlags::empty(),
7708            _decode,
7709        )
7710    }
7711}
7712
7713pub struct ScreenshotEventStream {
7714    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
7715}
7716
7717impl std::marker::Unpin for ScreenshotEventStream {}
7718
7719impl futures::stream::FusedStream for ScreenshotEventStream {
7720    fn is_terminated(&self) -> bool {
7721        self.event_receiver.is_terminated()
7722    }
7723}
7724
7725impl futures::Stream for ScreenshotEventStream {
7726    type Item = Result<ScreenshotEvent, fidl::Error>;
7727
7728    fn poll_next(
7729        mut self: std::pin::Pin<&mut Self>,
7730        cx: &mut std::task::Context<'_>,
7731    ) -> std::task::Poll<Option<Self::Item>> {
7732        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
7733            &mut self.event_receiver,
7734            cx
7735        )?) {
7736            Some(buf) => std::task::Poll::Ready(Some(ScreenshotEvent::decode(buf))),
7737            None => std::task::Poll::Ready(None),
7738        }
7739    }
7740}
7741
7742#[derive(Debug)]
7743pub enum ScreenshotEvent {}
7744
7745impl ScreenshotEvent {
7746    /// Decodes a message buffer as a [`ScreenshotEvent`].
7747    fn decode(
7748        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
7749    ) -> Result<ScreenshotEvent, fidl::Error> {
7750        let (bytes, _handles) = buf.split_mut();
7751        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7752        debug_assert_eq!(tx_header.tx_id, 0);
7753        match tx_header.ordinal {
7754            _ => Err(fidl::Error::UnknownOrdinal {
7755                ordinal: tx_header.ordinal,
7756                protocol_name: <ScreenshotMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
7757            }),
7758        }
7759    }
7760}
7761
7762/// A Stream of incoming requests for fuchsia.ui.composition/Screenshot.
7763pub struct ScreenshotRequestStream {
7764    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7765    is_terminated: bool,
7766}
7767
7768impl std::marker::Unpin for ScreenshotRequestStream {}
7769
7770impl futures::stream::FusedStream for ScreenshotRequestStream {
7771    fn is_terminated(&self) -> bool {
7772        self.is_terminated
7773    }
7774}
7775
7776impl fidl::endpoints::RequestStream for ScreenshotRequestStream {
7777    type Protocol = ScreenshotMarker;
7778    type ControlHandle = ScreenshotControlHandle;
7779
7780    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
7781        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
7782    }
7783
7784    fn control_handle(&self) -> Self::ControlHandle {
7785        ScreenshotControlHandle { inner: self.inner.clone() }
7786    }
7787
7788    fn into_inner(
7789        self,
7790    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
7791    {
7792        (self.inner, self.is_terminated)
7793    }
7794
7795    fn from_inner(
7796        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7797        is_terminated: bool,
7798    ) -> Self {
7799        Self { inner, is_terminated }
7800    }
7801}
7802
7803impl futures::Stream for ScreenshotRequestStream {
7804    type Item = Result<ScreenshotRequest, fidl::Error>;
7805
7806    fn poll_next(
7807        mut self: std::pin::Pin<&mut Self>,
7808        cx: &mut std::task::Context<'_>,
7809    ) -> std::task::Poll<Option<Self::Item>> {
7810        let this = &mut *self;
7811        if this.inner.check_shutdown(cx) {
7812            this.is_terminated = true;
7813            return std::task::Poll::Ready(None);
7814        }
7815        if this.is_terminated {
7816            panic!("polled ScreenshotRequestStream after completion");
7817        }
7818        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
7819            |bytes, handles| {
7820                match this.inner.channel().read_etc(cx, bytes, handles) {
7821                    std::task::Poll::Ready(Ok(())) => {}
7822                    std::task::Poll::Pending => return std::task::Poll::Pending,
7823                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
7824                        this.is_terminated = true;
7825                        return std::task::Poll::Ready(None);
7826                    }
7827                    std::task::Poll::Ready(Err(e)) => {
7828                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
7829                            e.into(),
7830                        ))));
7831                    }
7832                }
7833
7834                // A message has been received from the channel
7835                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7836
7837                std::task::Poll::Ready(Some(match header.ordinal {
7838                    0x51341396e9fd2fd0 => {
7839                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7840                        let mut req = fidl::new_empty!(
7841                            ScreenshotTakeRequest,
7842                            fidl::encoding::DefaultFuchsiaResourceDialect
7843                        );
7844                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ScreenshotTakeRequest>(&header, _body_bytes, handles, &mut req)?;
7845                        let control_handle = ScreenshotControlHandle { inner: this.inner.clone() };
7846                        Ok(ScreenshotRequest::Take {
7847                            payload: req,
7848                            responder: ScreenshotTakeResponder {
7849                                control_handle: std::mem::ManuallyDrop::new(control_handle),
7850                                tx_id: header.tx_id,
7851                            },
7852                        })
7853                    }
7854                    0x470aeea0a4d32903 => {
7855                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7856                        let mut req = fidl::new_empty!(
7857                            ScreenshotTakeFileRequest,
7858                            fidl::encoding::DefaultFuchsiaResourceDialect
7859                        );
7860                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ScreenshotTakeFileRequest>(&header, _body_bytes, handles, &mut req)?;
7861                        let control_handle = ScreenshotControlHandle { inner: this.inner.clone() };
7862                        Ok(ScreenshotRequest::TakeFile {
7863                            payload: req,
7864                            responder: ScreenshotTakeFileResponder {
7865                                control_handle: std::mem::ManuallyDrop::new(control_handle),
7866                                tx_id: header.tx_id,
7867                            },
7868                        })
7869                    }
7870                    _ => Err(fidl::Error::UnknownOrdinal {
7871                        ordinal: header.ordinal,
7872                        protocol_name:
7873                            <ScreenshotMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
7874                    }),
7875                }))
7876            },
7877        )
7878    }
7879}
7880
7881/// Collects the current graphical content of a display.
7882#[derive(Debug)]
7883pub enum ScreenshotRequest {
7884    /// Collects the current graphical content of a display in a specified buffer `format` in the
7885    /// sRGB color space. Note that the sRGB color space is non-linear, meaning that unit tests
7886    /// doing pixel equality checks making use of non-fully saturated colors should convert to a
7887    /// linear color space.
7888    ///
7889    /// See https://fuchsia.dev/fuchsia-src/concepts/ui/scenic/color_spaces for more information.
7890    ///
7891    /// Screenshot is taken immediately, populated with the display's content from the most recent
7892    /// VSYNC.
7893    ///
7894    /// If the client calls [`Take`] a second time before a first [`Take`] call returns, the server
7895    /// will close the Screenshot connection with a ZX_ERR_SHOULD_WAIT epitaph.
7896    ///
7897    /// If capture fails due to an internal error, the server will close the Screenshot connection
7898    /// with a ZX_ERR_INTERNAL epitaph.
7899    Take { payload: ScreenshotTakeRequest, responder: ScreenshotTakeResponder },
7900    /// Collects the current graphical content of a display in a specified buffer `format` in the
7901    /// sRGB color space. Note that the sRGB color space is non-linear, meaning that unit tests
7902    /// doing pixel equality checks making use of non-fully saturated colors should convert to a
7903    /// linear color space.
7904    ///
7905    /// TODO(https://fxbug.dev/42065844): Link to fuchsia.dev documentation when it's up.
7906    ///
7907    /// Screenshot is taken immediately, populated with the display's content from the most recent
7908    /// VSYNC.
7909    ///
7910    /// If the client calls [`TakeFile`] a second time before a first [`TakeFile`] call returns,
7911    /// the server will close the Screenshot connection with a ZX_ERR_SHOULD_WAIT epitaph.
7912    ///
7913    /// If capture fails due to an internal error, the server will close the Screenshot connection
7914    /// with a ZX_ERR_INTERNAL epitaph.
7915    ///
7916    /// This call should be used if the client is on the host and does not support VMOs,
7917    /// as is the case for ffx tools.
7918    TakeFile { payload: ScreenshotTakeFileRequest, responder: ScreenshotTakeFileResponder },
7919}
7920
7921impl ScreenshotRequest {
7922    #[allow(irrefutable_let_patterns)]
7923    pub fn into_take(self) -> Option<(ScreenshotTakeRequest, ScreenshotTakeResponder)> {
7924        if let ScreenshotRequest::Take { payload, responder } = self {
7925            Some((payload, responder))
7926        } else {
7927            None
7928        }
7929    }
7930
7931    #[allow(irrefutable_let_patterns)]
7932    pub fn into_take_file(
7933        self,
7934    ) -> Option<(ScreenshotTakeFileRequest, ScreenshotTakeFileResponder)> {
7935        if let ScreenshotRequest::TakeFile { payload, responder } = self {
7936            Some((payload, responder))
7937        } else {
7938            None
7939        }
7940    }
7941
7942    /// Name of the method defined in FIDL
7943    pub fn method_name(&self) -> &'static str {
7944        match *self {
7945            ScreenshotRequest::Take { .. } => "take",
7946            ScreenshotRequest::TakeFile { .. } => "take_file",
7947        }
7948    }
7949}
7950
7951#[derive(Debug, Clone)]
7952pub struct ScreenshotControlHandle {
7953    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7954}
7955
7956impl fidl::endpoints::ControlHandle for ScreenshotControlHandle {
7957    fn shutdown(&self) {
7958        self.inner.shutdown()
7959    }
7960
7961    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
7962        self.inner.shutdown_with_epitaph(status)
7963    }
7964
7965    fn is_closed(&self) -> bool {
7966        self.inner.channel().is_closed()
7967    }
7968    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
7969        self.inner.channel().on_closed()
7970    }
7971
7972    #[cfg(target_os = "fuchsia")]
7973    fn signal_peer(
7974        &self,
7975        clear_mask: zx::Signals,
7976        set_mask: zx::Signals,
7977    ) -> Result<(), zx_status::Status> {
7978        use fidl::Peered;
7979        self.inner.channel().signal_peer(clear_mask, set_mask)
7980    }
7981}
7982
7983impl ScreenshotControlHandle {}
7984
7985#[must_use = "FIDL methods require a response to be sent"]
7986#[derive(Debug)]
7987pub struct ScreenshotTakeResponder {
7988    control_handle: std::mem::ManuallyDrop<ScreenshotControlHandle>,
7989    tx_id: u32,
7990}
7991
7992/// Set the the channel to be shutdown (see [`ScreenshotControlHandle::shutdown`])
7993/// if the responder is dropped without sending a response, so that the client
7994/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7995impl std::ops::Drop for ScreenshotTakeResponder {
7996    fn drop(&mut self) {
7997        self.control_handle.shutdown();
7998        // Safety: drops once, never accessed again
7999        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8000    }
8001}
8002
8003impl fidl::endpoints::Responder for ScreenshotTakeResponder {
8004    type ControlHandle = ScreenshotControlHandle;
8005
8006    fn control_handle(&self) -> &ScreenshotControlHandle {
8007        &self.control_handle
8008    }
8009
8010    fn drop_without_shutdown(mut self) {
8011        // Safety: drops once, never accessed again due to mem::forget
8012        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8013        // Prevent Drop from running (which would shut down the channel)
8014        std::mem::forget(self);
8015    }
8016}
8017
8018impl ScreenshotTakeResponder {
8019    /// Sends a response to the FIDL transaction.
8020    ///
8021    /// Sets the channel to shutdown if an error occurs.
8022    pub fn send(self, mut payload: ScreenshotTakeResponse) -> Result<(), fidl::Error> {
8023        let _result = self.send_raw(payload);
8024        if _result.is_err() {
8025            self.control_handle.shutdown();
8026        }
8027        self.drop_without_shutdown();
8028        _result
8029    }
8030
8031    /// Similar to "send" but does not shutdown the channel if an error occurs.
8032    pub fn send_no_shutdown_on_err(
8033        self,
8034        mut payload: ScreenshotTakeResponse,
8035    ) -> Result<(), fidl::Error> {
8036        let _result = self.send_raw(payload);
8037        self.drop_without_shutdown();
8038        _result
8039    }
8040
8041    fn send_raw(&self, mut payload: ScreenshotTakeResponse) -> Result<(), fidl::Error> {
8042        self.control_handle.inner.send::<ScreenshotTakeResponse>(
8043            &mut payload,
8044            self.tx_id,
8045            0x51341396e9fd2fd0,
8046            fidl::encoding::DynamicFlags::empty(),
8047        )
8048    }
8049}
8050
8051#[must_use = "FIDL methods require a response to be sent"]
8052#[derive(Debug)]
8053pub struct ScreenshotTakeFileResponder {
8054    control_handle: std::mem::ManuallyDrop<ScreenshotControlHandle>,
8055    tx_id: u32,
8056}
8057
8058/// Set the the channel to be shutdown (see [`ScreenshotControlHandle::shutdown`])
8059/// if the responder is dropped without sending a response, so that the client
8060/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
8061impl std::ops::Drop for ScreenshotTakeFileResponder {
8062    fn drop(&mut self) {
8063        self.control_handle.shutdown();
8064        // Safety: drops once, never accessed again
8065        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8066    }
8067}
8068
8069impl fidl::endpoints::Responder for ScreenshotTakeFileResponder {
8070    type ControlHandle = ScreenshotControlHandle;
8071
8072    fn control_handle(&self) -> &ScreenshotControlHandle {
8073        &self.control_handle
8074    }
8075
8076    fn drop_without_shutdown(mut self) {
8077        // Safety: drops once, never accessed again due to mem::forget
8078        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8079        // Prevent Drop from running (which would shut down the channel)
8080        std::mem::forget(self);
8081    }
8082}
8083
8084impl ScreenshotTakeFileResponder {
8085    /// Sends a response to the FIDL transaction.
8086    ///
8087    /// Sets the channel to shutdown if an error occurs.
8088    pub fn send(self, mut payload: ScreenshotTakeFileResponse) -> Result<(), fidl::Error> {
8089        let _result = self.send_raw(payload);
8090        if _result.is_err() {
8091            self.control_handle.shutdown();
8092        }
8093        self.drop_without_shutdown();
8094        _result
8095    }
8096
8097    /// Similar to "send" but does not shutdown the channel if an error occurs.
8098    pub fn send_no_shutdown_on_err(
8099        self,
8100        mut payload: ScreenshotTakeFileResponse,
8101    ) -> Result<(), fidl::Error> {
8102        let _result = self.send_raw(payload);
8103        self.drop_without_shutdown();
8104        _result
8105    }
8106
8107    fn send_raw(&self, mut payload: ScreenshotTakeFileResponse) -> Result<(), fidl::Error> {
8108        self.control_handle.inner.send::<ScreenshotTakeFileResponse>(
8109            &mut payload,
8110            self.tx_id,
8111            0x470aeea0a4d32903,
8112            fidl::encoding::DynamicFlags::empty(),
8113        )
8114    }
8115}
8116
8117#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
8118pub struct TrustedFlatlandFactoryMarker;
8119
8120impl fidl::endpoints::ProtocolMarker for TrustedFlatlandFactoryMarker {
8121    type Proxy = TrustedFlatlandFactoryProxy;
8122    type RequestStream = TrustedFlatlandFactoryRequestStream;
8123    #[cfg(target_os = "fuchsia")]
8124    type SynchronousProxy = TrustedFlatlandFactorySynchronousProxy;
8125
8126    const DEBUG_NAME: &'static str = "fuchsia.ui.composition.TrustedFlatlandFactory";
8127}
8128impl fidl::endpoints::DiscoverableProtocolMarker for TrustedFlatlandFactoryMarker {}
8129pub type TrustedFlatlandFactoryCreateFlatlandResult = Result<(), TrustedFlatlandFactoryError>;
8130
8131pub trait TrustedFlatlandFactoryProxyInterface: Send + Sync {
8132    type CreateFlatlandResponseFut: std::future::Future<
8133            Output = Result<TrustedFlatlandFactoryCreateFlatlandResult, fidl::Error>,
8134        > + Send;
8135    fn r#create_flatland(
8136        &self,
8137        server_end: fidl::endpoints::ServerEnd<FlatlandMarker>,
8138        config: TrustedFlatlandConfig,
8139    ) -> Self::CreateFlatlandResponseFut;
8140}
8141#[derive(Debug)]
8142#[cfg(target_os = "fuchsia")]
8143pub struct TrustedFlatlandFactorySynchronousProxy {
8144    client: fidl::client::sync::Client,
8145}
8146
8147#[cfg(target_os = "fuchsia")]
8148impl fidl::endpoints::SynchronousProxy for TrustedFlatlandFactorySynchronousProxy {
8149    type Proxy = TrustedFlatlandFactoryProxy;
8150    type Protocol = TrustedFlatlandFactoryMarker;
8151
8152    fn from_channel(inner: fidl::Channel) -> Self {
8153        Self::new(inner)
8154    }
8155
8156    fn into_channel(self) -> fidl::Channel {
8157        self.client.into_channel()
8158    }
8159
8160    fn as_channel(&self) -> &fidl::Channel {
8161        self.client.as_channel()
8162    }
8163}
8164
8165#[cfg(target_os = "fuchsia")]
8166impl TrustedFlatlandFactorySynchronousProxy {
8167    pub fn new(channel: fidl::Channel) -> Self {
8168        let protocol_name =
8169            <TrustedFlatlandFactoryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
8170        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
8171    }
8172
8173    pub fn into_channel(self) -> fidl::Channel {
8174        self.client.into_channel()
8175    }
8176
8177    /// Waits until an event arrives and returns it. It is safe for other
8178    /// threads to make concurrent requests while waiting for an event.
8179    pub fn wait_for_event(
8180        &self,
8181        deadline: zx::MonotonicInstant,
8182    ) -> Result<TrustedFlatlandFactoryEvent, fidl::Error> {
8183        TrustedFlatlandFactoryEvent::decode(self.client.wait_for_event(deadline)?)
8184    }
8185
8186    /// Creates a new Flatland instance with the specified configuration.
8187    ///
8188    /// ## Error
8189    ///
8190    /// Returns a `TrustedFlatlandFactoryError` error if the operation fails.
8191    pub fn r#create_flatland(
8192        &self,
8193        mut server_end: fidl::endpoints::ServerEnd<FlatlandMarker>,
8194        mut config: TrustedFlatlandConfig,
8195        ___deadline: zx::MonotonicInstant,
8196    ) -> Result<TrustedFlatlandFactoryCreateFlatlandResult, fidl::Error> {
8197        let _response = self.client.send_query::<
8198            TrustedFlatlandFactoryCreateFlatlandRequest,
8199            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, TrustedFlatlandFactoryError>,
8200        >(
8201            (server_end, &mut config,),
8202            0x48e89c53f00561dc,
8203            fidl::encoding::DynamicFlags::empty(),
8204            ___deadline,
8205        )?;
8206        Ok(_response.map(|x| x))
8207    }
8208}
8209
8210#[cfg(target_os = "fuchsia")]
8211impl From<TrustedFlatlandFactorySynchronousProxy> for zx::NullableHandle {
8212    fn from(value: TrustedFlatlandFactorySynchronousProxy) -> Self {
8213        value.into_channel().into()
8214    }
8215}
8216
8217#[cfg(target_os = "fuchsia")]
8218impl From<fidl::Channel> for TrustedFlatlandFactorySynchronousProxy {
8219    fn from(value: fidl::Channel) -> Self {
8220        Self::new(value)
8221    }
8222}
8223
8224#[cfg(target_os = "fuchsia")]
8225impl fidl::endpoints::FromClient for TrustedFlatlandFactorySynchronousProxy {
8226    type Protocol = TrustedFlatlandFactoryMarker;
8227
8228    fn from_client(value: fidl::endpoints::ClientEnd<TrustedFlatlandFactoryMarker>) -> Self {
8229        Self::new(value.into_channel())
8230    }
8231}
8232
8233#[derive(Debug, Clone)]
8234pub struct TrustedFlatlandFactoryProxy {
8235    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
8236}
8237
8238impl fidl::endpoints::Proxy for TrustedFlatlandFactoryProxy {
8239    type Protocol = TrustedFlatlandFactoryMarker;
8240
8241    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
8242        Self::new(inner)
8243    }
8244
8245    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
8246        self.client.into_channel().map_err(|client| Self { client })
8247    }
8248
8249    fn as_channel(&self) -> &::fidl::AsyncChannel {
8250        self.client.as_channel()
8251    }
8252}
8253
8254impl TrustedFlatlandFactoryProxy {
8255    /// Create a new Proxy for fuchsia.ui.composition/TrustedFlatlandFactory.
8256    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
8257        let protocol_name =
8258            <TrustedFlatlandFactoryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
8259        Self { client: fidl::client::Client::new(channel, protocol_name) }
8260    }
8261
8262    /// Get a Stream of events from the remote end of the protocol.
8263    ///
8264    /// # Panics
8265    ///
8266    /// Panics if the event stream was already taken.
8267    pub fn take_event_stream(&self) -> TrustedFlatlandFactoryEventStream {
8268        TrustedFlatlandFactoryEventStream { event_receiver: self.client.take_event_receiver() }
8269    }
8270
8271    /// Creates a new Flatland instance with the specified configuration.
8272    ///
8273    /// ## Error
8274    ///
8275    /// Returns a `TrustedFlatlandFactoryError` error if the operation fails.
8276    pub fn r#create_flatland(
8277        &self,
8278        mut server_end: fidl::endpoints::ServerEnd<FlatlandMarker>,
8279        mut config: TrustedFlatlandConfig,
8280    ) -> fidl::client::QueryResponseFut<
8281        TrustedFlatlandFactoryCreateFlatlandResult,
8282        fidl::encoding::DefaultFuchsiaResourceDialect,
8283    > {
8284        TrustedFlatlandFactoryProxyInterface::r#create_flatland(self, server_end, config)
8285    }
8286}
8287
8288impl TrustedFlatlandFactoryProxyInterface for TrustedFlatlandFactoryProxy {
8289    type CreateFlatlandResponseFut = fidl::client::QueryResponseFut<
8290        TrustedFlatlandFactoryCreateFlatlandResult,
8291        fidl::encoding::DefaultFuchsiaResourceDialect,
8292    >;
8293    fn r#create_flatland(
8294        &self,
8295        mut server_end: fidl::endpoints::ServerEnd<FlatlandMarker>,
8296        mut config: TrustedFlatlandConfig,
8297    ) -> Self::CreateFlatlandResponseFut {
8298        fn _decode(
8299            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
8300        ) -> Result<TrustedFlatlandFactoryCreateFlatlandResult, fidl::Error> {
8301            let _response = fidl::client::decode_transaction_body::<
8302                fidl::encoding::ResultType<
8303                    fidl::encoding::EmptyStruct,
8304                    TrustedFlatlandFactoryError,
8305                >,
8306                fidl::encoding::DefaultFuchsiaResourceDialect,
8307                0x48e89c53f00561dc,
8308            >(_buf?)?;
8309            Ok(_response.map(|x| x))
8310        }
8311        self.client.send_query_and_decode::<
8312            TrustedFlatlandFactoryCreateFlatlandRequest,
8313            TrustedFlatlandFactoryCreateFlatlandResult,
8314        >(
8315            (server_end, &mut config,),
8316            0x48e89c53f00561dc,
8317            fidl::encoding::DynamicFlags::empty(),
8318            _decode,
8319        )
8320    }
8321}
8322
8323pub struct TrustedFlatlandFactoryEventStream {
8324    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
8325}
8326
8327impl std::marker::Unpin for TrustedFlatlandFactoryEventStream {}
8328
8329impl futures::stream::FusedStream for TrustedFlatlandFactoryEventStream {
8330    fn is_terminated(&self) -> bool {
8331        self.event_receiver.is_terminated()
8332    }
8333}
8334
8335impl futures::Stream for TrustedFlatlandFactoryEventStream {
8336    type Item = Result<TrustedFlatlandFactoryEvent, fidl::Error>;
8337
8338    fn poll_next(
8339        mut self: std::pin::Pin<&mut Self>,
8340        cx: &mut std::task::Context<'_>,
8341    ) -> std::task::Poll<Option<Self::Item>> {
8342        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
8343            &mut self.event_receiver,
8344            cx
8345        )?) {
8346            Some(buf) => std::task::Poll::Ready(Some(TrustedFlatlandFactoryEvent::decode(buf))),
8347            None => std::task::Poll::Ready(None),
8348        }
8349    }
8350}
8351
8352#[derive(Debug)]
8353pub enum TrustedFlatlandFactoryEvent {}
8354
8355impl TrustedFlatlandFactoryEvent {
8356    /// Decodes a message buffer as a [`TrustedFlatlandFactoryEvent`].
8357    fn decode(
8358        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
8359    ) -> Result<TrustedFlatlandFactoryEvent, fidl::Error> {
8360        let (bytes, _handles) = buf.split_mut();
8361        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
8362        debug_assert_eq!(tx_header.tx_id, 0);
8363        match tx_header.ordinal {
8364            _ => Err(fidl::Error::UnknownOrdinal {
8365                ordinal: tx_header.ordinal,
8366                protocol_name:
8367                    <TrustedFlatlandFactoryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
8368            }),
8369        }
8370    }
8371}
8372
8373/// A Stream of incoming requests for fuchsia.ui.composition/TrustedFlatlandFactory.
8374pub struct TrustedFlatlandFactoryRequestStream {
8375    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8376    is_terminated: bool,
8377}
8378
8379impl std::marker::Unpin for TrustedFlatlandFactoryRequestStream {}
8380
8381impl futures::stream::FusedStream for TrustedFlatlandFactoryRequestStream {
8382    fn is_terminated(&self) -> bool {
8383        self.is_terminated
8384    }
8385}
8386
8387impl fidl::endpoints::RequestStream for TrustedFlatlandFactoryRequestStream {
8388    type Protocol = TrustedFlatlandFactoryMarker;
8389    type ControlHandle = TrustedFlatlandFactoryControlHandle;
8390
8391    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
8392        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
8393    }
8394
8395    fn control_handle(&self) -> Self::ControlHandle {
8396        TrustedFlatlandFactoryControlHandle { inner: self.inner.clone() }
8397    }
8398
8399    fn into_inner(
8400        self,
8401    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
8402    {
8403        (self.inner, self.is_terminated)
8404    }
8405
8406    fn from_inner(
8407        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8408        is_terminated: bool,
8409    ) -> Self {
8410        Self { inner, is_terminated }
8411    }
8412}
8413
8414impl futures::Stream for TrustedFlatlandFactoryRequestStream {
8415    type Item = Result<TrustedFlatlandFactoryRequest, fidl::Error>;
8416
8417    fn poll_next(
8418        mut self: std::pin::Pin<&mut Self>,
8419        cx: &mut std::task::Context<'_>,
8420    ) -> std::task::Poll<Option<Self::Item>> {
8421        let this = &mut *self;
8422        if this.inner.check_shutdown(cx) {
8423            this.is_terminated = true;
8424            return std::task::Poll::Ready(None);
8425        }
8426        if this.is_terminated {
8427            panic!("polled TrustedFlatlandFactoryRequestStream after completion");
8428        }
8429        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
8430            |bytes, handles| {
8431                match this.inner.channel().read_etc(cx, bytes, handles) {
8432                    std::task::Poll::Ready(Ok(())) => {}
8433                    std::task::Poll::Pending => return std::task::Poll::Pending,
8434                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
8435                        this.is_terminated = true;
8436                        return std::task::Poll::Ready(None);
8437                    }
8438                    std::task::Poll::Ready(Err(e)) => {
8439                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
8440                            e.into(),
8441                        ))));
8442                    }
8443                }
8444
8445                // A message has been received from the channel
8446                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
8447
8448                std::task::Poll::Ready(Some(match header.ordinal {
8449                0x48e89c53f00561dc => {
8450                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
8451                    let mut req = fidl::new_empty!(TrustedFlatlandFactoryCreateFlatlandRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
8452                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<TrustedFlatlandFactoryCreateFlatlandRequest>(&header, _body_bytes, handles, &mut req)?;
8453                    let control_handle = TrustedFlatlandFactoryControlHandle {
8454                        inner: this.inner.clone(),
8455                    };
8456                    Ok(TrustedFlatlandFactoryRequest::CreateFlatland {server_end: req.server_end,
8457config: req.config,
8458
8459                        responder: TrustedFlatlandFactoryCreateFlatlandResponder {
8460                            control_handle: std::mem::ManuallyDrop::new(control_handle),
8461                            tx_id: header.tx_id,
8462                        },
8463                    })
8464                }
8465                _ => Err(fidl::Error::UnknownOrdinal {
8466                    ordinal: header.ordinal,
8467                    protocol_name: <TrustedFlatlandFactoryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
8468                }),
8469            }))
8470            },
8471        )
8472    }
8473}
8474
8475/// A privileged factory for creating Flatland instances with special configurations.
8476///
8477/// This protocol is intended for trusted clients that require fine-grained control over
8478/// Flatland's behavior for performance-critical applications. It is not intended for
8479/// general use. Misuse of this API can negatively impact system performance and stability.
8480#[derive(Debug)]
8481pub enum TrustedFlatlandFactoryRequest {
8482    /// Creates a new Flatland instance with the specified configuration.
8483    ///
8484    /// ## Error
8485    ///
8486    /// Returns a `TrustedFlatlandFactoryError` error if the operation fails.
8487    CreateFlatland {
8488        server_end: fidl::endpoints::ServerEnd<FlatlandMarker>,
8489        config: TrustedFlatlandConfig,
8490        responder: TrustedFlatlandFactoryCreateFlatlandResponder,
8491    },
8492}
8493
8494impl TrustedFlatlandFactoryRequest {
8495    #[allow(irrefutable_let_patterns)]
8496    pub fn into_create_flatland(
8497        self,
8498    ) -> Option<(
8499        fidl::endpoints::ServerEnd<FlatlandMarker>,
8500        TrustedFlatlandConfig,
8501        TrustedFlatlandFactoryCreateFlatlandResponder,
8502    )> {
8503        if let TrustedFlatlandFactoryRequest::CreateFlatland { server_end, config, responder } =
8504            self
8505        {
8506            Some((server_end, config, responder))
8507        } else {
8508            None
8509        }
8510    }
8511
8512    /// Name of the method defined in FIDL
8513    pub fn method_name(&self) -> &'static str {
8514        match *self {
8515            TrustedFlatlandFactoryRequest::CreateFlatland { .. } => "create_flatland",
8516        }
8517    }
8518}
8519
8520#[derive(Debug, Clone)]
8521pub struct TrustedFlatlandFactoryControlHandle {
8522    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8523}
8524
8525impl fidl::endpoints::ControlHandle for TrustedFlatlandFactoryControlHandle {
8526    fn shutdown(&self) {
8527        self.inner.shutdown()
8528    }
8529
8530    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
8531        self.inner.shutdown_with_epitaph(status)
8532    }
8533
8534    fn is_closed(&self) -> bool {
8535        self.inner.channel().is_closed()
8536    }
8537    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
8538        self.inner.channel().on_closed()
8539    }
8540
8541    #[cfg(target_os = "fuchsia")]
8542    fn signal_peer(
8543        &self,
8544        clear_mask: zx::Signals,
8545        set_mask: zx::Signals,
8546    ) -> Result<(), zx_status::Status> {
8547        use fidl::Peered;
8548        self.inner.channel().signal_peer(clear_mask, set_mask)
8549    }
8550}
8551
8552impl TrustedFlatlandFactoryControlHandle {}
8553
8554#[must_use = "FIDL methods require a response to be sent"]
8555#[derive(Debug)]
8556pub struct TrustedFlatlandFactoryCreateFlatlandResponder {
8557    control_handle: std::mem::ManuallyDrop<TrustedFlatlandFactoryControlHandle>,
8558    tx_id: u32,
8559}
8560
8561/// Set the the channel to be shutdown (see [`TrustedFlatlandFactoryControlHandle::shutdown`])
8562/// if the responder is dropped without sending a response, so that the client
8563/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
8564impl std::ops::Drop for TrustedFlatlandFactoryCreateFlatlandResponder {
8565    fn drop(&mut self) {
8566        self.control_handle.shutdown();
8567        // Safety: drops once, never accessed again
8568        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8569    }
8570}
8571
8572impl fidl::endpoints::Responder for TrustedFlatlandFactoryCreateFlatlandResponder {
8573    type ControlHandle = TrustedFlatlandFactoryControlHandle;
8574
8575    fn control_handle(&self) -> &TrustedFlatlandFactoryControlHandle {
8576        &self.control_handle
8577    }
8578
8579    fn drop_without_shutdown(mut self) {
8580        // Safety: drops once, never accessed again due to mem::forget
8581        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8582        // Prevent Drop from running (which would shut down the channel)
8583        std::mem::forget(self);
8584    }
8585}
8586
8587impl TrustedFlatlandFactoryCreateFlatlandResponder {
8588    /// Sends a response to the FIDL transaction.
8589    ///
8590    /// Sets the channel to shutdown if an error occurs.
8591    pub fn send(
8592        self,
8593        mut result: Result<(), TrustedFlatlandFactoryError>,
8594    ) -> Result<(), fidl::Error> {
8595        let _result = self.send_raw(result);
8596        if _result.is_err() {
8597            self.control_handle.shutdown();
8598        }
8599        self.drop_without_shutdown();
8600        _result
8601    }
8602
8603    /// Similar to "send" but does not shutdown the channel if an error occurs.
8604    pub fn send_no_shutdown_on_err(
8605        self,
8606        mut result: Result<(), TrustedFlatlandFactoryError>,
8607    ) -> Result<(), fidl::Error> {
8608        let _result = self.send_raw(result);
8609        self.drop_without_shutdown();
8610        _result
8611    }
8612
8613    fn send_raw(
8614        &self,
8615        mut result: Result<(), TrustedFlatlandFactoryError>,
8616    ) -> Result<(), fidl::Error> {
8617        self.control_handle.inner.send::<fidl::encoding::ResultType<
8618            fidl::encoding::EmptyStruct,
8619            TrustedFlatlandFactoryError,
8620        >>(
8621            result,
8622            self.tx_id,
8623            0x48e89c53f00561dc,
8624            fidl::encoding::DynamicFlags::empty(),
8625        )
8626    }
8627}
8628
8629mod internal {
8630    use super::*;
8631
8632    impl fidl::encoding::ResourceTypeMarker for AllocatorRegisterBufferCollectionRequest {
8633        type Borrowed<'a> = &'a mut Self;
8634        fn take_or_borrow<'a>(
8635            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
8636        ) -> Self::Borrowed<'a> {
8637            value
8638        }
8639    }
8640
8641    unsafe impl fidl::encoding::TypeMarker for AllocatorRegisterBufferCollectionRequest {
8642        type Owned = Self;
8643
8644        #[inline(always)]
8645        fn inline_align(_context: fidl::encoding::Context) -> usize {
8646            8
8647        }
8648
8649        #[inline(always)]
8650        fn inline_size(_context: fidl::encoding::Context) -> usize {
8651            16
8652        }
8653    }
8654
8655    unsafe impl
8656        fidl::encoding::Encode<
8657            AllocatorRegisterBufferCollectionRequest,
8658            fidl::encoding::DefaultFuchsiaResourceDialect,
8659        > for &mut AllocatorRegisterBufferCollectionRequest
8660    {
8661        #[inline]
8662        unsafe fn encode(
8663            self,
8664            encoder: &mut fidl::encoding::Encoder<
8665                '_,
8666                fidl::encoding::DefaultFuchsiaResourceDialect,
8667            >,
8668            offset: usize,
8669            _depth: fidl::encoding::Depth,
8670        ) -> fidl::Result<()> {
8671            encoder.debug_check_bounds::<AllocatorRegisterBufferCollectionRequest>(offset);
8672            // Delegate to tuple encoding.
8673            fidl::encoding::Encode::<AllocatorRegisterBufferCollectionRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
8674                (
8675                    <RegisterBufferCollectionArgs as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.args),
8676                ),
8677                encoder, offset, _depth
8678            )
8679        }
8680    }
8681    unsafe impl<
8682        T0: fidl::encoding::Encode<
8683                RegisterBufferCollectionArgs,
8684                fidl::encoding::DefaultFuchsiaResourceDialect,
8685            >,
8686    >
8687        fidl::encoding::Encode<
8688            AllocatorRegisterBufferCollectionRequest,
8689            fidl::encoding::DefaultFuchsiaResourceDialect,
8690        > for (T0,)
8691    {
8692        #[inline]
8693        unsafe fn encode(
8694            self,
8695            encoder: &mut fidl::encoding::Encoder<
8696                '_,
8697                fidl::encoding::DefaultFuchsiaResourceDialect,
8698            >,
8699            offset: usize,
8700            depth: fidl::encoding::Depth,
8701        ) -> fidl::Result<()> {
8702            encoder.debug_check_bounds::<AllocatorRegisterBufferCollectionRequest>(offset);
8703            // Zero out padding regions. There's no need to apply masks
8704            // because the unmasked parts will be overwritten by fields.
8705            // Write the fields.
8706            self.0.encode(encoder, offset + 0, depth)?;
8707            Ok(())
8708        }
8709    }
8710
8711    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
8712        for AllocatorRegisterBufferCollectionRequest
8713    {
8714        #[inline(always)]
8715        fn new_empty() -> Self {
8716            Self {
8717                args: fidl::new_empty!(
8718                    RegisterBufferCollectionArgs,
8719                    fidl::encoding::DefaultFuchsiaResourceDialect
8720                ),
8721            }
8722        }
8723
8724        #[inline]
8725        unsafe fn decode(
8726            &mut self,
8727            decoder: &mut fidl::encoding::Decoder<
8728                '_,
8729                fidl::encoding::DefaultFuchsiaResourceDialect,
8730            >,
8731            offset: usize,
8732            _depth: fidl::encoding::Depth,
8733        ) -> fidl::Result<()> {
8734            decoder.debug_check_bounds::<Self>(offset);
8735            // Verify that padding bytes are zero.
8736            fidl::decode!(
8737                RegisterBufferCollectionArgs,
8738                fidl::encoding::DefaultFuchsiaResourceDialect,
8739                &mut self.args,
8740                decoder,
8741                offset + 0,
8742                _depth
8743            )?;
8744            Ok(())
8745        }
8746    }
8747
8748    impl fidl::encoding::ResourceTypeMarker for BufferCollectionExportToken {
8749        type Borrowed<'a> = &'a mut Self;
8750        fn take_or_borrow<'a>(
8751            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
8752        ) -> Self::Borrowed<'a> {
8753            value
8754        }
8755    }
8756
8757    unsafe impl fidl::encoding::TypeMarker for BufferCollectionExportToken {
8758        type Owned = Self;
8759
8760        #[inline(always)]
8761        fn inline_align(_context: fidl::encoding::Context) -> usize {
8762            4
8763        }
8764
8765        #[inline(always)]
8766        fn inline_size(_context: fidl::encoding::Context) -> usize {
8767            4
8768        }
8769    }
8770
8771    unsafe impl
8772        fidl::encoding::Encode<
8773            BufferCollectionExportToken,
8774            fidl::encoding::DefaultFuchsiaResourceDialect,
8775        > for &mut BufferCollectionExportToken
8776    {
8777        #[inline]
8778        unsafe fn encode(
8779            self,
8780            encoder: &mut fidl::encoding::Encoder<
8781                '_,
8782                fidl::encoding::DefaultFuchsiaResourceDialect,
8783            >,
8784            offset: usize,
8785            _depth: fidl::encoding::Depth,
8786        ) -> fidl::Result<()> {
8787            encoder.debug_check_bounds::<BufferCollectionExportToken>(offset);
8788            // Delegate to tuple encoding.
8789            fidl::encoding::Encode::<
8790                BufferCollectionExportToken,
8791                fidl::encoding::DefaultFuchsiaResourceDialect,
8792            >::encode(
8793                (<fidl::encoding::HandleType<
8794                    fidl::EventPair,
8795                    { fidl::ObjectType::EVENTPAIR.into_raw() },
8796                    2147483648,
8797                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
8798                    &mut self.value
8799                ),),
8800                encoder,
8801                offset,
8802                _depth,
8803            )
8804        }
8805    }
8806    unsafe impl<
8807        T0: fidl::encoding::Encode<
8808                fidl::encoding::HandleType<
8809                    fidl::EventPair,
8810                    { fidl::ObjectType::EVENTPAIR.into_raw() },
8811                    2147483648,
8812                >,
8813                fidl::encoding::DefaultFuchsiaResourceDialect,
8814            >,
8815    >
8816        fidl::encoding::Encode<
8817            BufferCollectionExportToken,
8818            fidl::encoding::DefaultFuchsiaResourceDialect,
8819        > for (T0,)
8820    {
8821        #[inline]
8822        unsafe fn encode(
8823            self,
8824            encoder: &mut fidl::encoding::Encoder<
8825                '_,
8826                fidl::encoding::DefaultFuchsiaResourceDialect,
8827            >,
8828            offset: usize,
8829            depth: fidl::encoding::Depth,
8830        ) -> fidl::Result<()> {
8831            encoder.debug_check_bounds::<BufferCollectionExportToken>(offset);
8832            // Zero out padding regions. There's no need to apply masks
8833            // because the unmasked parts will be overwritten by fields.
8834            // Write the fields.
8835            self.0.encode(encoder, offset + 0, depth)?;
8836            Ok(())
8837        }
8838    }
8839
8840    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
8841        for BufferCollectionExportToken
8842    {
8843        #[inline(always)]
8844        fn new_empty() -> Self {
8845            Self {
8846                value: fidl::new_empty!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
8847            }
8848        }
8849
8850        #[inline]
8851        unsafe fn decode(
8852            &mut self,
8853            decoder: &mut fidl::encoding::Decoder<
8854                '_,
8855                fidl::encoding::DefaultFuchsiaResourceDialect,
8856            >,
8857            offset: usize,
8858            _depth: fidl::encoding::Depth,
8859        ) -> fidl::Result<()> {
8860            decoder.debug_check_bounds::<Self>(offset);
8861            // Verify that padding bytes are zero.
8862            fidl::decode!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.value, decoder, offset + 0, _depth)?;
8863            Ok(())
8864        }
8865    }
8866
8867    impl fidl::encoding::ResourceTypeMarker for BufferCollectionImportToken {
8868        type Borrowed<'a> = &'a mut Self;
8869        fn take_or_borrow<'a>(
8870            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
8871        ) -> Self::Borrowed<'a> {
8872            value
8873        }
8874    }
8875
8876    unsafe impl fidl::encoding::TypeMarker for BufferCollectionImportToken {
8877        type Owned = Self;
8878
8879        #[inline(always)]
8880        fn inline_align(_context: fidl::encoding::Context) -> usize {
8881            4
8882        }
8883
8884        #[inline(always)]
8885        fn inline_size(_context: fidl::encoding::Context) -> usize {
8886            4
8887        }
8888    }
8889
8890    unsafe impl
8891        fidl::encoding::Encode<
8892            BufferCollectionImportToken,
8893            fidl::encoding::DefaultFuchsiaResourceDialect,
8894        > for &mut BufferCollectionImportToken
8895    {
8896        #[inline]
8897        unsafe fn encode(
8898            self,
8899            encoder: &mut fidl::encoding::Encoder<
8900                '_,
8901                fidl::encoding::DefaultFuchsiaResourceDialect,
8902            >,
8903            offset: usize,
8904            _depth: fidl::encoding::Depth,
8905        ) -> fidl::Result<()> {
8906            encoder.debug_check_bounds::<BufferCollectionImportToken>(offset);
8907            // Delegate to tuple encoding.
8908            fidl::encoding::Encode::<
8909                BufferCollectionImportToken,
8910                fidl::encoding::DefaultFuchsiaResourceDialect,
8911            >::encode(
8912                (<fidl::encoding::HandleType<
8913                    fidl::EventPair,
8914                    { fidl::ObjectType::EVENTPAIR.into_raw() },
8915                    2147483648,
8916                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
8917                    &mut self.value
8918                ),),
8919                encoder,
8920                offset,
8921                _depth,
8922            )
8923        }
8924    }
8925    unsafe impl<
8926        T0: fidl::encoding::Encode<
8927                fidl::encoding::HandleType<
8928                    fidl::EventPair,
8929                    { fidl::ObjectType::EVENTPAIR.into_raw() },
8930                    2147483648,
8931                >,
8932                fidl::encoding::DefaultFuchsiaResourceDialect,
8933            >,
8934    >
8935        fidl::encoding::Encode<
8936            BufferCollectionImportToken,
8937            fidl::encoding::DefaultFuchsiaResourceDialect,
8938        > for (T0,)
8939    {
8940        #[inline]
8941        unsafe fn encode(
8942            self,
8943            encoder: &mut fidl::encoding::Encoder<
8944                '_,
8945                fidl::encoding::DefaultFuchsiaResourceDialect,
8946            >,
8947            offset: usize,
8948            depth: fidl::encoding::Depth,
8949        ) -> fidl::Result<()> {
8950            encoder.debug_check_bounds::<BufferCollectionImportToken>(offset);
8951            // Zero out padding regions. There's no need to apply masks
8952            // because the unmasked parts will be overwritten by fields.
8953            // Write the fields.
8954            self.0.encode(encoder, offset + 0, depth)?;
8955            Ok(())
8956        }
8957    }
8958
8959    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
8960        for BufferCollectionImportToken
8961    {
8962        #[inline(always)]
8963        fn new_empty() -> Self {
8964            Self {
8965                value: fidl::new_empty!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
8966            }
8967        }
8968
8969        #[inline]
8970        unsafe fn decode(
8971            &mut self,
8972            decoder: &mut fidl::encoding::Decoder<
8973                '_,
8974                fidl::encoding::DefaultFuchsiaResourceDialect,
8975            >,
8976            offset: usize,
8977            _depth: fidl::encoding::Depth,
8978        ) -> fidl::Result<()> {
8979            decoder.debug_check_bounds::<Self>(offset);
8980            // Verify that padding bytes are zero.
8981            fidl::decode!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.value, decoder, offset + 0, _depth)?;
8982            Ok(())
8983        }
8984    }
8985
8986    impl fidl::encoding::ResourceTypeMarker for ChildViewWatcherGetViewRefResponse {
8987        type Borrowed<'a> = &'a mut Self;
8988        fn take_or_borrow<'a>(
8989            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
8990        ) -> Self::Borrowed<'a> {
8991            value
8992        }
8993    }
8994
8995    unsafe impl fidl::encoding::TypeMarker for ChildViewWatcherGetViewRefResponse {
8996        type Owned = Self;
8997
8998        #[inline(always)]
8999        fn inline_align(_context: fidl::encoding::Context) -> usize {
9000            4
9001        }
9002
9003        #[inline(always)]
9004        fn inline_size(_context: fidl::encoding::Context) -> usize {
9005            4
9006        }
9007    }
9008
9009    unsafe impl
9010        fidl::encoding::Encode<
9011            ChildViewWatcherGetViewRefResponse,
9012            fidl::encoding::DefaultFuchsiaResourceDialect,
9013        > for &mut ChildViewWatcherGetViewRefResponse
9014    {
9015        #[inline]
9016        unsafe fn encode(
9017            self,
9018            encoder: &mut fidl::encoding::Encoder<
9019                '_,
9020                fidl::encoding::DefaultFuchsiaResourceDialect,
9021            >,
9022            offset: usize,
9023            _depth: fidl::encoding::Depth,
9024        ) -> fidl::Result<()> {
9025            encoder.debug_check_bounds::<ChildViewWatcherGetViewRefResponse>(offset);
9026            // Delegate to tuple encoding.
9027            fidl::encoding::Encode::<ChildViewWatcherGetViewRefResponse, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
9028                (
9029                    <fidl_fuchsia_ui_views::ViewRef as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.view_ref),
9030                ),
9031                encoder, offset, _depth
9032            )
9033        }
9034    }
9035    unsafe impl<
9036        T0: fidl::encoding::Encode<
9037                fidl_fuchsia_ui_views::ViewRef,
9038                fidl::encoding::DefaultFuchsiaResourceDialect,
9039            >,
9040    >
9041        fidl::encoding::Encode<
9042            ChildViewWatcherGetViewRefResponse,
9043            fidl::encoding::DefaultFuchsiaResourceDialect,
9044        > for (T0,)
9045    {
9046        #[inline]
9047        unsafe fn encode(
9048            self,
9049            encoder: &mut fidl::encoding::Encoder<
9050                '_,
9051                fidl::encoding::DefaultFuchsiaResourceDialect,
9052            >,
9053            offset: usize,
9054            depth: fidl::encoding::Depth,
9055        ) -> fidl::Result<()> {
9056            encoder.debug_check_bounds::<ChildViewWatcherGetViewRefResponse>(offset);
9057            // Zero out padding regions. There's no need to apply masks
9058            // because the unmasked parts will be overwritten by fields.
9059            // Write the fields.
9060            self.0.encode(encoder, offset + 0, depth)?;
9061            Ok(())
9062        }
9063    }
9064
9065    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
9066        for ChildViewWatcherGetViewRefResponse
9067    {
9068        #[inline(always)]
9069        fn new_empty() -> Self {
9070            Self {
9071                view_ref: fidl::new_empty!(
9072                    fidl_fuchsia_ui_views::ViewRef,
9073                    fidl::encoding::DefaultFuchsiaResourceDialect
9074                ),
9075            }
9076        }
9077
9078        #[inline]
9079        unsafe fn decode(
9080            &mut self,
9081            decoder: &mut fidl::encoding::Decoder<
9082                '_,
9083                fidl::encoding::DefaultFuchsiaResourceDialect,
9084            >,
9085            offset: usize,
9086            _depth: fidl::encoding::Depth,
9087        ) -> fidl::Result<()> {
9088            decoder.debug_check_bounds::<Self>(offset);
9089            // Verify that padding bytes are zero.
9090            fidl::decode!(
9091                fidl_fuchsia_ui_views::ViewRef,
9092                fidl::encoding::DefaultFuchsiaResourceDialect,
9093                &mut self.view_ref,
9094                decoder,
9095                offset + 0,
9096                _depth
9097            )?;
9098            Ok(())
9099        }
9100    }
9101
9102    impl fidl::encoding::ResourceTypeMarker for FlatlandCreateFilledRectRequest {
9103        type Borrowed<'a> = &'a mut Self;
9104        fn take_or_borrow<'a>(
9105            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9106        ) -> Self::Borrowed<'a> {
9107            value
9108        }
9109    }
9110
9111    unsafe impl fidl::encoding::TypeMarker for FlatlandCreateFilledRectRequest {
9112        type Owned = Self;
9113
9114        #[inline(always)]
9115        fn inline_align(_context: fidl::encoding::Context) -> usize {
9116            8
9117        }
9118
9119        #[inline(always)]
9120        fn inline_size(_context: fidl::encoding::Context) -> usize {
9121            8
9122        }
9123        #[inline(always)]
9124        fn encode_is_copy() -> bool {
9125            true
9126        }
9127
9128        #[inline(always)]
9129        fn decode_is_copy() -> bool {
9130            true
9131        }
9132    }
9133
9134    unsafe impl
9135        fidl::encoding::Encode<
9136            FlatlandCreateFilledRectRequest,
9137            fidl::encoding::DefaultFuchsiaResourceDialect,
9138        > for &mut FlatlandCreateFilledRectRequest
9139    {
9140        #[inline]
9141        unsafe fn encode(
9142            self,
9143            encoder: &mut fidl::encoding::Encoder<
9144                '_,
9145                fidl::encoding::DefaultFuchsiaResourceDialect,
9146            >,
9147            offset: usize,
9148            _depth: fidl::encoding::Depth,
9149        ) -> fidl::Result<()> {
9150            encoder.debug_check_bounds::<FlatlandCreateFilledRectRequest>(offset);
9151            unsafe {
9152                // Copy the object into the buffer.
9153                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
9154                (buf_ptr as *mut FlatlandCreateFilledRectRequest)
9155                    .write_unaligned((self as *const FlatlandCreateFilledRectRequest).read());
9156                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
9157                // done second because the memcpy will write garbage to these bytes.
9158            }
9159            Ok(())
9160        }
9161    }
9162    unsafe impl<
9163        T0: fidl::encoding::Encode<ContentId, fidl::encoding::DefaultFuchsiaResourceDialect>,
9164    >
9165        fidl::encoding::Encode<
9166            FlatlandCreateFilledRectRequest,
9167            fidl::encoding::DefaultFuchsiaResourceDialect,
9168        > for (T0,)
9169    {
9170        #[inline]
9171        unsafe fn encode(
9172            self,
9173            encoder: &mut fidl::encoding::Encoder<
9174                '_,
9175                fidl::encoding::DefaultFuchsiaResourceDialect,
9176            >,
9177            offset: usize,
9178            depth: fidl::encoding::Depth,
9179        ) -> fidl::Result<()> {
9180            encoder.debug_check_bounds::<FlatlandCreateFilledRectRequest>(offset);
9181            // Zero out padding regions. There's no need to apply masks
9182            // because the unmasked parts will be overwritten by fields.
9183            // Write the fields.
9184            self.0.encode(encoder, offset + 0, depth)?;
9185            Ok(())
9186        }
9187    }
9188
9189    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
9190        for FlatlandCreateFilledRectRequest
9191    {
9192        #[inline(always)]
9193        fn new_empty() -> Self {
9194            Self {
9195                rect_id: fidl::new_empty!(ContentId, fidl::encoding::DefaultFuchsiaResourceDialect),
9196            }
9197        }
9198
9199        #[inline]
9200        unsafe fn decode(
9201            &mut self,
9202            decoder: &mut fidl::encoding::Decoder<
9203                '_,
9204                fidl::encoding::DefaultFuchsiaResourceDialect,
9205            >,
9206            offset: usize,
9207            _depth: fidl::encoding::Depth,
9208        ) -> fidl::Result<()> {
9209            decoder.debug_check_bounds::<Self>(offset);
9210            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
9211            // Verify that padding bytes are zero.
9212            // Copy from the buffer into the object.
9213            unsafe {
9214                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
9215            }
9216            Ok(())
9217        }
9218    }
9219
9220    impl fidl::encoding::ResourceTypeMarker for FlatlandCreateImageRequest {
9221        type Borrowed<'a> = &'a mut Self;
9222        fn take_or_borrow<'a>(
9223            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9224        ) -> Self::Borrowed<'a> {
9225            value
9226        }
9227    }
9228
9229    unsafe impl fidl::encoding::TypeMarker for FlatlandCreateImageRequest {
9230        type Owned = Self;
9231
9232        #[inline(always)]
9233        fn inline_align(_context: fidl::encoding::Context) -> usize {
9234            8
9235        }
9236
9237        #[inline(always)]
9238        fn inline_size(_context: fidl::encoding::Context) -> usize {
9239            32
9240        }
9241    }
9242
9243    unsafe impl
9244        fidl::encoding::Encode<
9245            FlatlandCreateImageRequest,
9246            fidl::encoding::DefaultFuchsiaResourceDialect,
9247        > for &mut FlatlandCreateImageRequest
9248    {
9249        #[inline]
9250        unsafe fn encode(
9251            self,
9252            encoder: &mut fidl::encoding::Encoder<
9253                '_,
9254                fidl::encoding::DefaultFuchsiaResourceDialect,
9255            >,
9256            offset: usize,
9257            _depth: fidl::encoding::Depth,
9258        ) -> fidl::Result<()> {
9259            encoder.debug_check_bounds::<FlatlandCreateImageRequest>(offset);
9260            // Delegate to tuple encoding.
9261            fidl::encoding::Encode::<FlatlandCreateImageRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
9262                (
9263                    <ContentId as fidl::encoding::ValueTypeMarker>::borrow(&self.image_id),
9264                    <BufferCollectionImportToken as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.import_token),
9265                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.vmo_index),
9266                    <ImageProperties as fidl::encoding::ValueTypeMarker>::borrow(&self.properties),
9267                ),
9268                encoder, offset, _depth
9269            )
9270        }
9271    }
9272    unsafe impl<
9273        T0: fidl::encoding::Encode<ContentId, fidl::encoding::DefaultFuchsiaResourceDialect>,
9274        T1: fidl::encoding::Encode<
9275                BufferCollectionImportToken,
9276                fidl::encoding::DefaultFuchsiaResourceDialect,
9277            >,
9278        T2: fidl::encoding::Encode<u32, fidl::encoding::DefaultFuchsiaResourceDialect>,
9279        T3: fidl::encoding::Encode<ImageProperties, fidl::encoding::DefaultFuchsiaResourceDialect>,
9280    >
9281        fidl::encoding::Encode<
9282            FlatlandCreateImageRequest,
9283            fidl::encoding::DefaultFuchsiaResourceDialect,
9284        > for (T0, T1, T2, T3)
9285    {
9286        #[inline]
9287        unsafe fn encode(
9288            self,
9289            encoder: &mut fidl::encoding::Encoder<
9290                '_,
9291                fidl::encoding::DefaultFuchsiaResourceDialect,
9292            >,
9293            offset: usize,
9294            depth: fidl::encoding::Depth,
9295        ) -> fidl::Result<()> {
9296            encoder.debug_check_bounds::<FlatlandCreateImageRequest>(offset);
9297            // Zero out padding regions. There's no need to apply masks
9298            // because the unmasked parts will be overwritten by fields.
9299            // Write the fields.
9300            self.0.encode(encoder, offset + 0, depth)?;
9301            self.1.encode(encoder, offset + 8, depth)?;
9302            self.2.encode(encoder, offset + 12, depth)?;
9303            self.3.encode(encoder, offset + 16, depth)?;
9304            Ok(())
9305        }
9306    }
9307
9308    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
9309        for FlatlandCreateImageRequest
9310    {
9311        #[inline(always)]
9312        fn new_empty() -> Self {
9313            Self {
9314                image_id: fidl::new_empty!(
9315                    ContentId,
9316                    fidl::encoding::DefaultFuchsiaResourceDialect
9317                ),
9318                import_token: fidl::new_empty!(
9319                    BufferCollectionImportToken,
9320                    fidl::encoding::DefaultFuchsiaResourceDialect
9321                ),
9322                vmo_index: fidl::new_empty!(u32, fidl::encoding::DefaultFuchsiaResourceDialect),
9323                properties: fidl::new_empty!(
9324                    ImageProperties,
9325                    fidl::encoding::DefaultFuchsiaResourceDialect
9326                ),
9327            }
9328        }
9329
9330        #[inline]
9331        unsafe fn decode(
9332            &mut self,
9333            decoder: &mut fidl::encoding::Decoder<
9334                '_,
9335                fidl::encoding::DefaultFuchsiaResourceDialect,
9336            >,
9337            offset: usize,
9338            _depth: fidl::encoding::Depth,
9339        ) -> fidl::Result<()> {
9340            decoder.debug_check_bounds::<Self>(offset);
9341            // Verify that padding bytes are zero.
9342            fidl::decode!(
9343                ContentId,
9344                fidl::encoding::DefaultFuchsiaResourceDialect,
9345                &mut self.image_id,
9346                decoder,
9347                offset + 0,
9348                _depth
9349            )?;
9350            fidl::decode!(
9351                BufferCollectionImportToken,
9352                fidl::encoding::DefaultFuchsiaResourceDialect,
9353                &mut self.import_token,
9354                decoder,
9355                offset + 8,
9356                _depth
9357            )?;
9358            fidl::decode!(
9359                u32,
9360                fidl::encoding::DefaultFuchsiaResourceDialect,
9361                &mut self.vmo_index,
9362                decoder,
9363                offset + 12,
9364                _depth
9365            )?;
9366            fidl::decode!(
9367                ImageProperties,
9368                fidl::encoding::DefaultFuchsiaResourceDialect,
9369                &mut self.properties,
9370                decoder,
9371                offset + 16,
9372                _depth
9373            )?;
9374            Ok(())
9375        }
9376    }
9377
9378    impl fidl::encoding::ResourceTypeMarker for FlatlandCreateView2Request {
9379        type Borrowed<'a> = &'a mut Self;
9380        fn take_or_borrow<'a>(
9381            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9382        ) -> Self::Borrowed<'a> {
9383            value
9384        }
9385    }
9386
9387    unsafe impl fidl::encoding::TypeMarker for FlatlandCreateView2Request {
9388        type Owned = Self;
9389
9390        #[inline(always)]
9391        fn inline_align(_context: fidl::encoding::Context) -> usize {
9392            8
9393        }
9394
9395        #[inline(always)]
9396        fn inline_size(_context: fidl::encoding::Context) -> usize {
9397            40
9398        }
9399    }
9400
9401    unsafe impl
9402        fidl::encoding::Encode<
9403            FlatlandCreateView2Request,
9404            fidl::encoding::DefaultFuchsiaResourceDialect,
9405        > for &mut FlatlandCreateView2Request
9406    {
9407        #[inline]
9408        unsafe fn encode(
9409            self,
9410            encoder: &mut fidl::encoding::Encoder<
9411                '_,
9412                fidl::encoding::DefaultFuchsiaResourceDialect,
9413            >,
9414            offset: usize,
9415            _depth: fidl::encoding::Depth,
9416        ) -> fidl::Result<()> {
9417            encoder.debug_check_bounds::<FlatlandCreateView2Request>(offset);
9418            // Delegate to tuple encoding.
9419            fidl::encoding::Encode::<FlatlandCreateView2Request, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
9420                (
9421                    <fidl_fuchsia_ui_views::ViewCreationToken as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.token),
9422                    <fidl_fuchsia_ui_views::ViewIdentityOnCreation as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.view_identity),
9423                    <ViewBoundProtocols as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.protocols),
9424                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.parent_viewport_watcher),
9425                ),
9426                encoder, offset, _depth
9427            )
9428        }
9429    }
9430    unsafe impl<
9431        T0: fidl::encoding::Encode<
9432                fidl_fuchsia_ui_views::ViewCreationToken,
9433                fidl::encoding::DefaultFuchsiaResourceDialect,
9434            >,
9435        T1: fidl::encoding::Encode<
9436                fidl_fuchsia_ui_views::ViewIdentityOnCreation,
9437                fidl::encoding::DefaultFuchsiaResourceDialect,
9438            >,
9439        T2: fidl::encoding::Encode<ViewBoundProtocols, fidl::encoding::DefaultFuchsiaResourceDialect>,
9440        T3: fidl::encoding::Encode<
9441                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>>,
9442                fidl::encoding::DefaultFuchsiaResourceDialect,
9443            >,
9444    >
9445        fidl::encoding::Encode<
9446            FlatlandCreateView2Request,
9447            fidl::encoding::DefaultFuchsiaResourceDialect,
9448        > for (T0, T1, T2, T3)
9449    {
9450        #[inline]
9451        unsafe fn encode(
9452            self,
9453            encoder: &mut fidl::encoding::Encoder<
9454                '_,
9455                fidl::encoding::DefaultFuchsiaResourceDialect,
9456            >,
9457            offset: usize,
9458            depth: fidl::encoding::Depth,
9459        ) -> fidl::Result<()> {
9460            encoder.debug_check_bounds::<FlatlandCreateView2Request>(offset);
9461            // Zero out padding regions. There's no need to apply masks
9462            // because the unmasked parts will be overwritten by fields.
9463            unsafe {
9464                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
9465                (ptr as *mut u64).write_unaligned(0);
9466            }
9467            unsafe {
9468                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(32);
9469                (ptr as *mut u64).write_unaligned(0);
9470            }
9471            // Write the fields.
9472            self.0.encode(encoder, offset + 0, depth)?;
9473            self.1.encode(encoder, offset + 4, depth)?;
9474            self.2.encode(encoder, offset + 16, depth)?;
9475            self.3.encode(encoder, offset + 32, depth)?;
9476            Ok(())
9477        }
9478    }
9479
9480    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
9481        for FlatlandCreateView2Request
9482    {
9483        #[inline(always)]
9484        fn new_empty() -> Self {
9485            Self {
9486                token: fidl::new_empty!(
9487                    fidl_fuchsia_ui_views::ViewCreationToken,
9488                    fidl::encoding::DefaultFuchsiaResourceDialect
9489                ),
9490                view_identity: fidl::new_empty!(
9491                    fidl_fuchsia_ui_views::ViewIdentityOnCreation,
9492                    fidl::encoding::DefaultFuchsiaResourceDialect
9493                ),
9494                protocols: fidl::new_empty!(
9495                    ViewBoundProtocols,
9496                    fidl::encoding::DefaultFuchsiaResourceDialect
9497                ),
9498                parent_viewport_watcher: fidl::new_empty!(
9499                    fidl::encoding::Endpoint<
9500                        fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>,
9501                    >,
9502                    fidl::encoding::DefaultFuchsiaResourceDialect
9503                ),
9504            }
9505        }
9506
9507        #[inline]
9508        unsafe fn decode(
9509            &mut self,
9510            decoder: &mut fidl::encoding::Decoder<
9511                '_,
9512                fidl::encoding::DefaultFuchsiaResourceDialect,
9513            >,
9514            offset: usize,
9515            _depth: fidl::encoding::Depth,
9516        ) -> fidl::Result<()> {
9517            decoder.debug_check_bounds::<Self>(offset);
9518            // Verify that padding bytes are zero.
9519            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(8) };
9520            let padval = unsafe { (ptr as *const u64).read_unaligned() };
9521            let mask = 0xffffffff00000000u64;
9522            let maskedval = padval & mask;
9523            if maskedval != 0 {
9524                return Err(fidl::Error::NonZeroPadding {
9525                    padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
9526                });
9527            }
9528            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(32) };
9529            let padval = unsafe { (ptr as *const u64).read_unaligned() };
9530            let mask = 0xffffffff00000000u64;
9531            let maskedval = padval & mask;
9532            if maskedval != 0 {
9533                return Err(fidl::Error::NonZeroPadding {
9534                    padding_start: offset + 32 + ((mask as u64).trailing_zeros() / 8) as usize,
9535                });
9536            }
9537            fidl::decode!(
9538                fidl_fuchsia_ui_views::ViewCreationToken,
9539                fidl::encoding::DefaultFuchsiaResourceDialect,
9540                &mut self.token,
9541                decoder,
9542                offset + 0,
9543                _depth
9544            )?;
9545            fidl::decode!(
9546                fidl_fuchsia_ui_views::ViewIdentityOnCreation,
9547                fidl::encoding::DefaultFuchsiaResourceDialect,
9548                &mut self.view_identity,
9549                decoder,
9550                offset + 4,
9551                _depth
9552            )?;
9553            fidl::decode!(
9554                ViewBoundProtocols,
9555                fidl::encoding::DefaultFuchsiaResourceDialect,
9556                &mut self.protocols,
9557                decoder,
9558                offset + 16,
9559                _depth
9560            )?;
9561            fidl::decode!(
9562                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>>,
9563                fidl::encoding::DefaultFuchsiaResourceDialect,
9564                &mut self.parent_viewport_watcher,
9565                decoder,
9566                offset + 32,
9567                _depth
9568            )?;
9569            Ok(())
9570        }
9571    }
9572
9573    impl fidl::encoding::ResourceTypeMarker for FlatlandCreateViewRequest {
9574        type Borrowed<'a> = &'a mut Self;
9575        fn take_or_borrow<'a>(
9576            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9577        ) -> Self::Borrowed<'a> {
9578            value
9579        }
9580    }
9581
9582    unsafe impl fidl::encoding::TypeMarker for FlatlandCreateViewRequest {
9583        type Owned = Self;
9584
9585        #[inline(always)]
9586        fn inline_align(_context: fidl::encoding::Context) -> usize {
9587            4
9588        }
9589
9590        #[inline(always)]
9591        fn inline_size(_context: fidl::encoding::Context) -> usize {
9592            8
9593        }
9594    }
9595
9596    unsafe impl
9597        fidl::encoding::Encode<
9598            FlatlandCreateViewRequest,
9599            fidl::encoding::DefaultFuchsiaResourceDialect,
9600        > for &mut FlatlandCreateViewRequest
9601    {
9602        #[inline]
9603        unsafe fn encode(
9604            self,
9605            encoder: &mut fidl::encoding::Encoder<
9606                '_,
9607                fidl::encoding::DefaultFuchsiaResourceDialect,
9608            >,
9609            offset: usize,
9610            _depth: fidl::encoding::Depth,
9611        ) -> fidl::Result<()> {
9612            encoder.debug_check_bounds::<FlatlandCreateViewRequest>(offset);
9613            // Delegate to tuple encoding.
9614            fidl::encoding::Encode::<FlatlandCreateViewRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
9615                (
9616                    <fidl_fuchsia_ui_views::ViewCreationToken as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.token),
9617                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.parent_viewport_watcher),
9618                ),
9619                encoder, offset, _depth
9620            )
9621        }
9622    }
9623    unsafe impl<
9624        T0: fidl::encoding::Encode<
9625                fidl_fuchsia_ui_views::ViewCreationToken,
9626                fidl::encoding::DefaultFuchsiaResourceDialect,
9627            >,
9628        T1: fidl::encoding::Encode<
9629                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>>,
9630                fidl::encoding::DefaultFuchsiaResourceDialect,
9631            >,
9632    >
9633        fidl::encoding::Encode<
9634            FlatlandCreateViewRequest,
9635            fidl::encoding::DefaultFuchsiaResourceDialect,
9636        > for (T0, T1)
9637    {
9638        #[inline]
9639        unsafe fn encode(
9640            self,
9641            encoder: &mut fidl::encoding::Encoder<
9642                '_,
9643                fidl::encoding::DefaultFuchsiaResourceDialect,
9644            >,
9645            offset: usize,
9646            depth: fidl::encoding::Depth,
9647        ) -> fidl::Result<()> {
9648            encoder.debug_check_bounds::<FlatlandCreateViewRequest>(offset);
9649            // Zero out padding regions. There's no need to apply masks
9650            // because the unmasked parts will be overwritten by fields.
9651            // Write the fields.
9652            self.0.encode(encoder, offset + 0, depth)?;
9653            self.1.encode(encoder, offset + 4, depth)?;
9654            Ok(())
9655        }
9656    }
9657
9658    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
9659        for FlatlandCreateViewRequest
9660    {
9661        #[inline(always)]
9662        fn new_empty() -> Self {
9663            Self {
9664                token: fidl::new_empty!(
9665                    fidl_fuchsia_ui_views::ViewCreationToken,
9666                    fidl::encoding::DefaultFuchsiaResourceDialect
9667                ),
9668                parent_viewport_watcher: fidl::new_empty!(
9669                    fidl::encoding::Endpoint<
9670                        fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>,
9671                    >,
9672                    fidl::encoding::DefaultFuchsiaResourceDialect
9673                ),
9674            }
9675        }
9676
9677        #[inline]
9678        unsafe fn decode(
9679            &mut self,
9680            decoder: &mut fidl::encoding::Decoder<
9681                '_,
9682                fidl::encoding::DefaultFuchsiaResourceDialect,
9683            >,
9684            offset: usize,
9685            _depth: fidl::encoding::Depth,
9686        ) -> fidl::Result<()> {
9687            decoder.debug_check_bounds::<Self>(offset);
9688            // Verify that padding bytes are zero.
9689            fidl::decode!(
9690                fidl_fuchsia_ui_views::ViewCreationToken,
9691                fidl::encoding::DefaultFuchsiaResourceDialect,
9692                &mut self.token,
9693                decoder,
9694                offset + 0,
9695                _depth
9696            )?;
9697            fidl::decode!(
9698                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ParentViewportWatcherMarker>>,
9699                fidl::encoding::DefaultFuchsiaResourceDialect,
9700                &mut self.parent_viewport_watcher,
9701                decoder,
9702                offset + 4,
9703                _depth
9704            )?;
9705            Ok(())
9706        }
9707    }
9708
9709    impl fidl::encoding::ResourceTypeMarker for FlatlandCreateViewportRequest {
9710        type Borrowed<'a> = &'a mut Self;
9711        fn take_or_borrow<'a>(
9712            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9713        ) -> Self::Borrowed<'a> {
9714            value
9715        }
9716    }
9717
9718    unsafe impl fidl::encoding::TypeMarker for FlatlandCreateViewportRequest {
9719        type Owned = Self;
9720
9721        #[inline(always)]
9722        fn inline_align(_context: fidl::encoding::Context) -> usize {
9723            8
9724        }
9725
9726        #[inline(always)]
9727        fn inline_size(_context: fidl::encoding::Context) -> usize {
9728            40
9729        }
9730    }
9731
9732    unsafe impl
9733        fidl::encoding::Encode<
9734            FlatlandCreateViewportRequest,
9735            fidl::encoding::DefaultFuchsiaResourceDialect,
9736        > for &mut FlatlandCreateViewportRequest
9737    {
9738        #[inline]
9739        unsafe fn encode(
9740            self,
9741            encoder: &mut fidl::encoding::Encoder<
9742                '_,
9743                fidl::encoding::DefaultFuchsiaResourceDialect,
9744            >,
9745            offset: usize,
9746            _depth: fidl::encoding::Depth,
9747        ) -> fidl::Result<()> {
9748            encoder.debug_check_bounds::<FlatlandCreateViewportRequest>(offset);
9749            // Delegate to tuple encoding.
9750            fidl::encoding::Encode::<FlatlandCreateViewportRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
9751                (
9752                    <ContentId as fidl::encoding::ValueTypeMarker>::borrow(&self.viewport_id),
9753                    <fidl_fuchsia_ui_views::ViewportCreationToken as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.token),
9754                    <ViewportProperties as fidl::encoding::ValueTypeMarker>::borrow(&self.properties),
9755                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ChildViewWatcherMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.child_view_watcher),
9756                ),
9757                encoder, offset, _depth
9758            )
9759        }
9760    }
9761    unsafe impl<
9762        T0: fidl::encoding::Encode<ContentId, fidl::encoding::DefaultFuchsiaResourceDialect>,
9763        T1: fidl::encoding::Encode<
9764                fidl_fuchsia_ui_views::ViewportCreationToken,
9765                fidl::encoding::DefaultFuchsiaResourceDialect,
9766            >,
9767        T2: fidl::encoding::Encode<ViewportProperties, fidl::encoding::DefaultFuchsiaResourceDialect>,
9768        T3: fidl::encoding::Encode<
9769                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ChildViewWatcherMarker>>,
9770                fidl::encoding::DefaultFuchsiaResourceDialect,
9771            >,
9772    >
9773        fidl::encoding::Encode<
9774            FlatlandCreateViewportRequest,
9775            fidl::encoding::DefaultFuchsiaResourceDialect,
9776        > for (T0, T1, T2, T3)
9777    {
9778        #[inline]
9779        unsafe fn encode(
9780            self,
9781            encoder: &mut fidl::encoding::Encoder<
9782                '_,
9783                fidl::encoding::DefaultFuchsiaResourceDialect,
9784            >,
9785            offset: usize,
9786            depth: fidl::encoding::Depth,
9787        ) -> fidl::Result<()> {
9788            encoder.debug_check_bounds::<FlatlandCreateViewportRequest>(offset);
9789            // Zero out padding regions. There's no need to apply masks
9790            // because the unmasked parts will be overwritten by fields.
9791            unsafe {
9792                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
9793                (ptr as *mut u64).write_unaligned(0);
9794            }
9795            unsafe {
9796                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(32);
9797                (ptr as *mut u64).write_unaligned(0);
9798            }
9799            // Write the fields.
9800            self.0.encode(encoder, offset + 0, depth)?;
9801            self.1.encode(encoder, offset + 8, depth)?;
9802            self.2.encode(encoder, offset + 16, depth)?;
9803            self.3.encode(encoder, offset + 32, depth)?;
9804            Ok(())
9805        }
9806    }
9807
9808    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
9809        for FlatlandCreateViewportRequest
9810    {
9811        #[inline(always)]
9812        fn new_empty() -> Self {
9813            Self {
9814                viewport_id: fidl::new_empty!(
9815                    ContentId,
9816                    fidl::encoding::DefaultFuchsiaResourceDialect
9817                ),
9818                token: fidl::new_empty!(
9819                    fidl_fuchsia_ui_views::ViewportCreationToken,
9820                    fidl::encoding::DefaultFuchsiaResourceDialect
9821                ),
9822                properties: fidl::new_empty!(
9823                    ViewportProperties,
9824                    fidl::encoding::DefaultFuchsiaResourceDialect
9825                ),
9826                child_view_watcher: fidl::new_empty!(
9827                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ChildViewWatcherMarker>>,
9828                    fidl::encoding::DefaultFuchsiaResourceDialect
9829                ),
9830            }
9831        }
9832
9833        #[inline]
9834        unsafe fn decode(
9835            &mut self,
9836            decoder: &mut fidl::encoding::Decoder<
9837                '_,
9838                fidl::encoding::DefaultFuchsiaResourceDialect,
9839            >,
9840            offset: usize,
9841            _depth: fidl::encoding::Depth,
9842        ) -> fidl::Result<()> {
9843            decoder.debug_check_bounds::<Self>(offset);
9844            // Verify that padding bytes are zero.
9845            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(8) };
9846            let padval = unsafe { (ptr as *const u64).read_unaligned() };
9847            let mask = 0xffffffff00000000u64;
9848            let maskedval = padval & mask;
9849            if maskedval != 0 {
9850                return Err(fidl::Error::NonZeroPadding {
9851                    padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
9852                });
9853            }
9854            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(32) };
9855            let padval = unsafe { (ptr as *const u64).read_unaligned() };
9856            let mask = 0xffffffff00000000u64;
9857            let maskedval = padval & mask;
9858            if maskedval != 0 {
9859                return Err(fidl::Error::NonZeroPadding {
9860                    padding_start: offset + 32 + ((mask as u64).trailing_zeros() / 8) as usize,
9861                });
9862            }
9863            fidl::decode!(
9864                ContentId,
9865                fidl::encoding::DefaultFuchsiaResourceDialect,
9866                &mut self.viewport_id,
9867                decoder,
9868                offset + 0,
9869                _depth
9870            )?;
9871            fidl::decode!(
9872                fidl_fuchsia_ui_views::ViewportCreationToken,
9873                fidl::encoding::DefaultFuchsiaResourceDialect,
9874                &mut self.token,
9875                decoder,
9876                offset + 8,
9877                _depth
9878            )?;
9879            fidl::decode!(
9880                ViewportProperties,
9881                fidl::encoding::DefaultFuchsiaResourceDialect,
9882                &mut self.properties,
9883                decoder,
9884                offset + 16,
9885                _depth
9886            )?;
9887            fidl::decode!(
9888                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ChildViewWatcherMarker>>,
9889                fidl::encoding::DefaultFuchsiaResourceDialect,
9890                &mut self.child_view_watcher,
9891                decoder,
9892                offset + 32,
9893                _depth
9894            )?;
9895            Ok(())
9896        }
9897    }
9898
9899    impl fidl::encoding::ResourceTypeMarker for FlatlandDisplaySetContentRequest {
9900        type Borrowed<'a> = &'a mut Self;
9901        fn take_or_borrow<'a>(
9902            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9903        ) -> Self::Borrowed<'a> {
9904            value
9905        }
9906    }
9907
9908    unsafe impl fidl::encoding::TypeMarker for FlatlandDisplaySetContentRequest {
9909        type Owned = Self;
9910
9911        #[inline(always)]
9912        fn inline_align(_context: fidl::encoding::Context) -> usize {
9913            4
9914        }
9915
9916        #[inline(always)]
9917        fn inline_size(_context: fidl::encoding::Context) -> usize {
9918            8
9919        }
9920    }
9921
9922    unsafe impl
9923        fidl::encoding::Encode<
9924            FlatlandDisplaySetContentRequest,
9925            fidl::encoding::DefaultFuchsiaResourceDialect,
9926        > for &mut FlatlandDisplaySetContentRequest
9927    {
9928        #[inline]
9929        unsafe fn encode(
9930            self,
9931            encoder: &mut fidl::encoding::Encoder<
9932                '_,
9933                fidl::encoding::DefaultFuchsiaResourceDialect,
9934            >,
9935            offset: usize,
9936            _depth: fidl::encoding::Depth,
9937        ) -> fidl::Result<()> {
9938            encoder.debug_check_bounds::<FlatlandDisplaySetContentRequest>(offset);
9939            // Delegate to tuple encoding.
9940            fidl::encoding::Encode::<FlatlandDisplaySetContentRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
9941                (
9942                    <fidl_fuchsia_ui_views::ViewportCreationToken as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.token),
9943                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ChildViewWatcherMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.child_view_watcher),
9944                ),
9945                encoder, offset, _depth
9946            )
9947        }
9948    }
9949    unsafe impl<
9950        T0: fidl::encoding::Encode<
9951                fidl_fuchsia_ui_views::ViewportCreationToken,
9952                fidl::encoding::DefaultFuchsiaResourceDialect,
9953            >,
9954        T1: fidl::encoding::Encode<
9955                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ChildViewWatcherMarker>>,
9956                fidl::encoding::DefaultFuchsiaResourceDialect,
9957            >,
9958    >
9959        fidl::encoding::Encode<
9960            FlatlandDisplaySetContentRequest,
9961            fidl::encoding::DefaultFuchsiaResourceDialect,
9962        > for (T0, T1)
9963    {
9964        #[inline]
9965        unsafe fn encode(
9966            self,
9967            encoder: &mut fidl::encoding::Encoder<
9968                '_,
9969                fidl::encoding::DefaultFuchsiaResourceDialect,
9970            >,
9971            offset: usize,
9972            depth: fidl::encoding::Depth,
9973        ) -> fidl::Result<()> {
9974            encoder.debug_check_bounds::<FlatlandDisplaySetContentRequest>(offset);
9975            // Zero out padding regions. There's no need to apply masks
9976            // because the unmasked parts will be overwritten by fields.
9977            // Write the fields.
9978            self.0.encode(encoder, offset + 0, depth)?;
9979            self.1.encode(encoder, offset + 4, depth)?;
9980            Ok(())
9981        }
9982    }
9983
9984    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
9985        for FlatlandDisplaySetContentRequest
9986    {
9987        #[inline(always)]
9988        fn new_empty() -> Self {
9989            Self {
9990                token: fidl::new_empty!(
9991                    fidl_fuchsia_ui_views::ViewportCreationToken,
9992                    fidl::encoding::DefaultFuchsiaResourceDialect
9993                ),
9994                child_view_watcher: fidl::new_empty!(
9995                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ChildViewWatcherMarker>>,
9996                    fidl::encoding::DefaultFuchsiaResourceDialect
9997                ),
9998            }
9999        }
10000
10001        #[inline]
10002        unsafe fn decode(
10003            &mut self,
10004            decoder: &mut fidl::encoding::Decoder<
10005                '_,
10006                fidl::encoding::DefaultFuchsiaResourceDialect,
10007            >,
10008            offset: usize,
10009            _depth: fidl::encoding::Depth,
10010        ) -> fidl::Result<()> {
10011            decoder.debug_check_bounds::<Self>(offset);
10012            // Verify that padding bytes are zero.
10013            fidl::decode!(
10014                fidl_fuchsia_ui_views::ViewportCreationToken,
10015                fidl::encoding::DefaultFuchsiaResourceDialect,
10016                &mut self.token,
10017                decoder,
10018                offset + 0,
10019                _depth
10020            )?;
10021            fidl::decode!(
10022                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ChildViewWatcherMarker>>,
10023                fidl::encoding::DefaultFuchsiaResourceDialect,
10024                &mut self.child_view_watcher,
10025                decoder,
10026                offset + 4,
10027                _depth
10028            )?;
10029            Ok(())
10030        }
10031    }
10032
10033    impl fidl::encoding::ResourceTypeMarker for FlatlandPresentRequest {
10034        type Borrowed<'a> = &'a mut Self;
10035        fn take_or_borrow<'a>(
10036            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10037        ) -> Self::Borrowed<'a> {
10038            value
10039        }
10040    }
10041
10042    unsafe impl fidl::encoding::TypeMarker for FlatlandPresentRequest {
10043        type Owned = Self;
10044
10045        #[inline(always)]
10046        fn inline_align(_context: fidl::encoding::Context) -> usize {
10047            8
10048        }
10049
10050        #[inline(always)]
10051        fn inline_size(_context: fidl::encoding::Context) -> usize {
10052            16
10053        }
10054    }
10055
10056    unsafe impl
10057        fidl::encoding::Encode<
10058            FlatlandPresentRequest,
10059            fidl::encoding::DefaultFuchsiaResourceDialect,
10060        > for &mut FlatlandPresentRequest
10061    {
10062        #[inline]
10063        unsafe fn encode(
10064            self,
10065            encoder: &mut fidl::encoding::Encoder<
10066                '_,
10067                fidl::encoding::DefaultFuchsiaResourceDialect,
10068            >,
10069            offset: usize,
10070            _depth: fidl::encoding::Depth,
10071        ) -> fidl::Result<()> {
10072            encoder.debug_check_bounds::<FlatlandPresentRequest>(offset);
10073            // Delegate to tuple encoding.
10074            fidl::encoding::Encode::<
10075                FlatlandPresentRequest,
10076                fidl::encoding::DefaultFuchsiaResourceDialect,
10077            >::encode(
10078                (<PresentArgs as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
10079                    &mut self.args,
10080                ),),
10081                encoder,
10082                offset,
10083                _depth,
10084            )
10085        }
10086    }
10087    unsafe impl<
10088        T0: fidl::encoding::Encode<PresentArgs, fidl::encoding::DefaultFuchsiaResourceDialect>,
10089    >
10090        fidl::encoding::Encode<
10091            FlatlandPresentRequest,
10092            fidl::encoding::DefaultFuchsiaResourceDialect,
10093        > for (T0,)
10094    {
10095        #[inline]
10096        unsafe fn encode(
10097            self,
10098            encoder: &mut fidl::encoding::Encoder<
10099                '_,
10100                fidl::encoding::DefaultFuchsiaResourceDialect,
10101            >,
10102            offset: usize,
10103            depth: fidl::encoding::Depth,
10104        ) -> fidl::Result<()> {
10105            encoder.debug_check_bounds::<FlatlandPresentRequest>(offset);
10106            // Zero out padding regions. There's no need to apply masks
10107            // because the unmasked parts will be overwritten by fields.
10108            // Write the fields.
10109            self.0.encode(encoder, offset + 0, depth)?;
10110            Ok(())
10111        }
10112    }
10113
10114    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10115        for FlatlandPresentRequest
10116    {
10117        #[inline(always)]
10118        fn new_empty() -> Self {
10119            Self {
10120                args: fidl::new_empty!(PresentArgs, fidl::encoding::DefaultFuchsiaResourceDialect),
10121            }
10122        }
10123
10124        #[inline]
10125        unsafe fn decode(
10126            &mut self,
10127            decoder: &mut fidl::encoding::Decoder<
10128                '_,
10129                fidl::encoding::DefaultFuchsiaResourceDialect,
10130            >,
10131            offset: usize,
10132            _depth: fidl::encoding::Depth,
10133        ) -> fidl::Result<()> {
10134            decoder.debug_check_bounds::<Self>(offset);
10135            // Verify that padding bytes are zero.
10136            fidl::decode!(
10137                PresentArgs,
10138                fidl::encoding::DefaultFuchsiaResourceDialect,
10139                &mut self.args,
10140                decoder,
10141                offset + 0,
10142                _depth
10143            )?;
10144            Ok(())
10145        }
10146    }
10147
10148    impl fidl::encoding::ResourceTypeMarker for FlatlandReleaseViewportResponse {
10149        type Borrowed<'a> = &'a mut Self;
10150        fn take_or_borrow<'a>(
10151            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10152        ) -> Self::Borrowed<'a> {
10153            value
10154        }
10155    }
10156
10157    unsafe impl fidl::encoding::TypeMarker for FlatlandReleaseViewportResponse {
10158        type Owned = Self;
10159
10160        #[inline(always)]
10161        fn inline_align(_context: fidl::encoding::Context) -> usize {
10162            4
10163        }
10164
10165        #[inline(always)]
10166        fn inline_size(_context: fidl::encoding::Context) -> usize {
10167            4
10168        }
10169    }
10170
10171    unsafe impl
10172        fidl::encoding::Encode<
10173            FlatlandReleaseViewportResponse,
10174            fidl::encoding::DefaultFuchsiaResourceDialect,
10175        > for &mut FlatlandReleaseViewportResponse
10176    {
10177        #[inline]
10178        unsafe fn encode(
10179            self,
10180            encoder: &mut fidl::encoding::Encoder<
10181                '_,
10182                fidl::encoding::DefaultFuchsiaResourceDialect,
10183            >,
10184            offset: usize,
10185            _depth: fidl::encoding::Depth,
10186        ) -> fidl::Result<()> {
10187            encoder.debug_check_bounds::<FlatlandReleaseViewportResponse>(offset);
10188            // Delegate to tuple encoding.
10189            fidl::encoding::Encode::<FlatlandReleaseViewportResponse, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
10190                (
10191                    <fidl_fuchsia_ui_views::ViewportCreationToken as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.token),
10192                ),
10193                encoder, offset, _depth
10194            )
10195        }
10196    }
10197    unsafe impl<
10198        T0: fidl::encoding::Encode<
10199                fidl_fuchsia_ui_views::ViewportCreationToken,
10200                fidl::encoding::DefaultFuchsiaResourceDialect,
10201            >,
10202    >
10203        fidl::encoding::Encode<
10204            FlatlandReleaseViewportResponse,
10205            fidl::encoding::DefaultFuchsiaResourceDialect,
10206        > for (T0,)
10207    {
10208        #[inline]
10209        unsafe fn encode(
10210            self,
10211            encoder: &mut fidl::encoding::Encoder<
10212                '_,
10213                fidl::encoding::DefaultFuchsiaResourceDialect,
10214            >,
10215            offset: usize,
10216            depth: fidl::encoding::Depth,
10217        ) -> fidl::Result<()> {
10218            encoder.debug_check_bounds::<FlatlandReleaseViewportResponse>(offset);
10219            // Zero out padding regions. There's no need to apply masks
10220            // because the unmasked parts will be overwritten by fields.
10221            // Write the fields.
10222            self.0.encode(encoder, offset + 0, depth)?;
10223            Ok(())
10224        }
10225    }
10226
10227    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10228        for FlatlandReleaseViewportResponse
10229    {
10230        #[inline(always)]
10231        fn new_empty() -> Self {
10232            Self {
10233                token: fidl::new_empty!(
10234                    fidl_fuchsia_ui_views::ViewportCreationToken,
10235                    fidl::encoding::DefaultFuchsiaResourceDialect
10236                ),
10237            }
10238        }
10239
10240        #[inline]
10241        unsafe fn decode(
10242            &mut self,
10243            decoder: &mut fidl::encoding::Decoder<
10244                '_,
10245                fidl::encoding::DefaultFuchsiaResourceDialect,
10246            >,
10247            offset: usize,
10248            _depth: fidl::encoding::Depth,
10249        ) -> fidl::Result<()> {
10250            decoder.debug_check_bounds::<Self>(offset);
10251            // Verify that padding bytes are zero.
10252            fidl::decode!(
10253                fidl_fuchsia_ui_views::ViewportCreationToken,
10254                fidl::encoding::DefaultFuchsiaResourceDialect,
10255                &mut self.token,
10256                decoder,
10257                offset + 0,
10258                _depth
10259            )?;
10260            Ok(())
10261        }
10262    }
10263
10264    impl fidl::encoding::ResourceTypeMarker for FlatlandSetSolidFillRequest {
10265        type Borrowed<'a> = &'a mut Self;
10266        fn take_or_borrow<'a>(
10267            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10268        ) -> Self::Borrowed<'a> {
10269            value
10270        }
10271    }
10272
10273    unsafe impl fidl::encoding::TypeMarker for FlatlandSetSolidFillRequest {
10274        type Owned = Self;
10275
10276        #[inline(always)]
10277        fn inline_align(_context: fidl::encoding::Context) -> usize {
10278            8
10279        }
10280
10281        #[inline(always)]
10282        fn inline_size(_context: fidl::encoding::Context) -> usize {
10283            32
10284        }
10285    }
10286
10287    unsafe impl
10288        fidl::encoding::Encode<
10289            FlatlandSetSolidFillRequest,
10290            fidl::encoding::DefaultFuchsiaResourceDialect,
10291        > for &mut FlatlandSetSolidFillRequest
10292    {
10293        #[inline]
10294        unsafe fn encode(
10295            self,
10296            encoder: &mut fidl::encoding::Encoder<
10297                '_,
10298                fidl::encoding::DefaultFuchsiaResourceDialect,
10299            >,
10300            offset: usize,
10301            _depth: fidl::encoding::Depth,
10302        ) -> fidl::Result<()> {
10303            encoder.debug_check_bounds::<FlatlandSetSolidFillRequest>(offset);
10304            // Delegate to tuple encoding.
10305            fidl::encoding::Encode::<
10306                FlatlandSetSolidFillRequest,
10307                fidl::encoding::DefaultFuchsiaResourceDialect,
10308            >::encode(
10309                (
10310                    <ContentId as fidl::encoding::ValueTypeMarker>::borrow(&self.rect_id),
10311                    <ColorRgba as fidl::encoding::ValueTypeMarker>::borrow(&self.color),
10312                    <fidl_fuchsia_math::SizeU as fidl::encoding::ValueTypeMarker>::borrow(
10313                        &self.size,
10314                    ),
10315                ),
10316                encoder,
10317                offset,
10318                _depth,
10319            )
10320        }
10321    }
10322    unsafe impl<
10323        T0: fidl::encoding::Encode<ContentId, fidl::encoding::DefaultFuchsiaResourceDialect>,
10324        T1: fidl::encoding::Encode<ColorRgba, fidl::encoding::DefaultFuchsiaResourceDialect>,
10325        T2: fidl::encoding::Encode<
10326                fidl_fuchsia_math::SizeU,
10327                fidl::encoding::DefaultFuchsiaResourceDialect,
10328            >,
10329    >
10330        fidl::encoding::Encode<
10331            FlatlandSetSolidFillRequest,
10332            fidl::encoding::DefaultFuchsiaResourceDialect,
10333        > for (T0, T1, T2)
10334    {
10335        #[inline]
10336        unsafe fn encode(
10337            self,
10338            encoder: &mut fidl::encoding::Encoder<
10339                '_,
10340                fidl::encoding::DefaultFuchsiaResourceDialect,
10341            >,
10342            offset: usize,
10343            depth: fidl::encoding::Depth,
10344        ) -> fidl::Result<()> {
10345            encoder.debug_check_bounds::<FlatlandSetSolidFillRequest>(offset);
10346            // Zero out padding regions. There's no need to apply masks
10347            // because the unmasked parts will be overwritten by fields.
10348            // Write the fields.
10349            self.0.encode(encoder, offset + 0, depth)?;
10350            self.1.encode(encoder, offset + 8, depth)?;
10351            self.2.encode(encoder, offset + 24, depth)?;
10352            Ok(())
10353        }
10354    }
10355
10356    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10357        for FlatlandSetSolidFillRequest
10358    {
10359        #[inline(always)]
10360        fn new_empty() -> Self {
10361            Self {
10362                rect_id: fidl::new_empty!(ContentId, fidl::encoding::DefaultFuchsiaResourceDialect),
10363                color: fidl::new_empty!(ColorRgba, fidl::encoding::DefaultFuchsiaResourceDialect),
10364                size: fidl::new_empty!(
10365                    fidl_fuchsia_math::SizeU,
10366                    fidl::encoding::DefaultFuchsiaResourceDialect
10367                ),
10368            }
10369        }
10370
10371        #[inline]
10372        unsafe fn decode(
10373            &mut self,
10374            decoder: &mut fidl::encoding::Decoder<
10375                '_,
10376                fidl::encoding::DefaultFuchsiaResourceDialect,
10377            >,
10378            offset: usize,
10379            _depth: fidl::encoding::Depth,
10380        ) -> fidl::Result<()> {
10381            decoder.debug_check_bounds::<Self>(offset);
10382            // Verify that padding bytes are zero.
10383            fidl::decode!(
10384                ContentId,
10385                fidl::encoding::DefaultFuchsiaResourceDialect,
10386                &mut self.rect_id,
10387                decoder,
10388                offset + 0,
10389                _depth
10390            )?;
10391            fidl::decode!(
10392                ColorRgba,
10393                fidl::encoding::DefaultFuchsiaResourceDialect,
10394                &mut self.color,
10395                decoder,
10396                offset + 8,
10397                _depth
10398            )?;
10399            fidl::decode!(
10400                fidl_fuchsia_math::SizeU,
10401                fidl::encoding::DefaultFuchsiaResourceDialect,
10402                &mut self.size,
10403                decoder,
10404                offset + 24,
10405                _depth
10406            )?;
10407            Ok(())
10408        }
10409    }
10410
10411    impl fidl::encoding::ResourceTypeMarker for TrustedFlatlandFactoryCreateFlatlandRequest {
10412        type Borrowed<'a> = &'a mut Self;
10413        fn take_or_borrow<'a>(
10414            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10415        ) -> Self::Borrowed<'a> {
10416            value
10417        }
10418    }
10419
10420    unsafe impl fidl::encoding::TypeMarker for TrustedFlatlandFactoryCreateFlatlandRequest {
10421        type Owned = Self;
10422
10423        #[inline(always)]
10424        fn inline_align(_context: fidl::encoding::Context) -> usize {
10425            8
10426        }
10427
10428        #[inline(always)]
10429        fn inline_size(_context: fidl::encoding::Context) -> usize {
10430            24
10431        }
10432    }
10433
10434    unsafe impl
10435        fidl::encoding::Encode<
10436            TrustedFlatlandFactoryCreateFlatlandRequest,
10437            fidl::encoding::DefaultFuchsiaResourceDialect,
10438        > for &mut TrustedFlatlandFactoryCreateFlatlandRequest
10439    {
10440        #[inline]
10441        unsafe fn encode(
10442            self,
10443            encoder: &mut fidl::encoding::Encoder<
10444                '_,
10445                fidl::encoding::DefaultFuchsiaResourceDialect,
10446            >,
10447            offset: usize,
10448            _depth: fidl::encoding::Depth,
10449        ) -> fidl::Result<()> {
10450            encoder.debug_check_bounds::<TrustedFlatlandFactoryCreateFlatlandRequest>(offset);
10451            // Delegate to tuple encoding.
10452            fidl::encoding::Encode::<TrustedFlatlandFactoryCreateFlatlandRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
10453                (
10454                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<FlatlandMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.server_end),
10455                    <TrustedFlatlandConfig as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.config),
10456                ),
10457                encoder, offset, _depth
10458            )
10459        }
10460    }
10461    unsafe impl<
10462        T0: fidl::encoding::Encode<
10463                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<FlatlandMarker>>,
10464                fidl::encoding::DefaultFuchsiaResourceDialect,
10465            >,
10466        T1: fidl::encoding::Encode<
10467                TrustedFlatlandConfig,
10468                fidl::encoding::DefaultFuchsiaResourceDialect,
10469            >,
10470    >
10471        fidl::encoding::Encode<
10472            TrustedFlatlandFactoryCreateFlatlandRequest,
10473            fidl::encoding::DefaultFuchsiaResourceDialect,
10474        > for (T0, T1)
10475    {
10476        #[inline]
10477        unsafe fn encode(
10478            self,
10479            encoder: &mut fidl::encoding::Encoder<
10480                '_,
10481                fidl::encoding::DefaultFuchsiaResourceDialect,
10482            >,
10483            offset: usize,
10484            depth: fidl::encoding::Depth,
10485        ) -> fidl::Result<()> {
10486            encoder.debug_check_bounds::<TrustedFlatlandFactoryCreateFlatlandRequest>(offset);
10487            // Zero out padding regions. There's no need to apply masks
10488            // because the unmasked parts will be overwritten by fields.
10489            unsafe {
10490                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
10491                (ptr as *mut u64).write_unaligned(0);
10492            }
10493            // Write the fields.
10494            self.0.encode(encoder, offset + 0, depth)?;
10495            self.1.encode(encoder, offset + 8, depth)?;
10496            Ok(())
10497        }
10498    }
10499
10500    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10501        for TrustedFlatlandFactoryCreateFlatlandRequest
10502    {
10503        #[inline(always)]
10504        fn new_empty() -> Self {
10505            Self {
10506                server_end: fidl::new_empty!(
10507                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<FlatlandMarker>>,
10508                    fidl::encoding::DefaultFuchsiaResourceDialect
10509                ),
10510                config: fidl::new_empty!(
10511                    TrustedFlatlandConfig,
10512                    fidl::encoding::DefaultFuchsiaResourceDialect
10513                ),
10514            }
10515        }
10516
10517        #[inline]
10518        unsafe fn decode(
10519            &mut self,
10520            decoder: &mut fidl::encoding::Decoder<
10521                '_,
10522                fidl::encoding::DefaultFuchsiaResourceDialect,
10523            >,
10524            offset: usize,
10525            _depth: fidl::encoding::Depth,
10526        ) -> fidl::Result<()> {
10527            decoder.debug_check_bounds::<Self>(offset);
10528            // Verify that padding bytes are zero.
10529            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
10530            let padval = unsafe { (ptr as *const u64).read_unaligned() };
10531            let mask = 0xffffffff00000000u64;
10532            let maskedval = padval & mask;
10533            if maskedval != 0 {
10534                return Err(fidl::Error::NonZeroPadding {
10535                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
10536                });
10537            }
10538            fidl::decode!(
10539                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<FlatlandMarker>>,
10540                fidl::encoding::DefaultFuchsiaResourceDialect,
10541                &mut self.server_end,
10542                decoder,
10543                offset + 0,
10544                _depth
10545            )?;
10546            fidl::decode!(
10547                TrustedFlatlandConfig,
10548                fidl::encoding::DefaultFuchsiaResourceDialect,
10549                &mut self.config,
10550                decoder,
10551                offset + 8,
10552                _depth
10553            )?;
10554            Ok(())
10555        }
10556    }
10557
10558    impl FrameInfo {
10559        #[inline(always)]
10560        fn max_ordinal_present(&self) -> u64 {
10561            if let Some(_) = self.buffer_id {
10562                return 1;
10563            }
10564            0
10565        }
10566    }
10567
10568    impl fidl::encoding::ResourceTypeMarker for FrameInfo {
10569        type Borrowed<'a> = &'a mut Self;
10570        fn take_or_borrow<'a>(
10571            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10572        ) -> Self::Borrowed<'a> {
10573            value
10574        }
10575    }
10576
10577    unsafe impl fidl::encoding::TypeMarker for FrameInfo {
10578        type Owned = Self;
10579
10580        #[inline(always)]
10581        fn inline_align(_context: fidl::encoding::Context) -> usize {
10582            8
10583        }
10584
10585        #[inline(always)]
10586        fn inline_size(_context: fidl::encoding::Context) -> usize {
10587            16
10588        }
10589    }
10590
10591    unsafe impl fidl::encoding::Encode<FrameInfo, fidl::encoding::DefaultFuchsiaResourceDialect>
10592        for &mut FrameInfo
10593    {
10594        unsafe fn encode(
10595            self,
10596            encoder: &mut fidl::encoding::Encoder<
10597                '_,
10598                fidl::encoding::DefaultFuchsiaResourceDialect,
10599            >,
10600            offset: usize,
10601            mut depth: fidl::encoding::Depth,
10602        ) -> fidl::Result<()> {
10603            encoder.debug_check_bounds::<FrameInfo>(offset);
10604            // Vector header
10605            let max_ordinal: u64 = self.max_ordinal_present();
10606            encoder.write_num(max_ordinal, offset);
10607            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
10608            // Calling encoder.out_of_line_offset(0) is not allowed.
10609            if max_ordinal == 0 {
10610                return Ok(());
10611            }
10612            depth.increment()?;
10613            let envelope_size = 8;
10614            let bytes_len = max_ordinal as usize * envelope_size;
10615            #[allow(unused_variables)]
10616            let offset = encoder.out_of_line_offset(bytes_len);
10617            let mut _prev_end_offset: usize = 0;
10618            if 1 > max_ordinal {
10619                return Ok(());
10620            }
10621
10622            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
10623            // are envelope_size bytes.
10624            let cur_offset: usize = (1 - 1) * envelope_size;
10625
10626            // Zero reserved fields.
10627            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
10628
10629            // Safety:
10630            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
10631            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
10632            //   envelope_size bytes, there is always sufficient room.
10633            fidl::encoding::encode_in_envelope_optional::<
10634                u32,
10635                fidl::encoding::DefaultFuchsiaResourceDialect,
10636            >(
10637                self.buffer_id.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
10638                encoder,
10639                offset + cur_offset,
10640                depth,
10641            )?;
10642
10643            _prev_end_offset = cur_offset + envelope_size;
10644
10645            Ok(())
10646        }
10647    }
10648
10649    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for FrameInfo {
10650        #[inline(always)]
10651        fn new_empty() -> Self {
10652            Self::default()
10653        }
10654
10655        unsafe fn decode(
10656            &mut self,
10657            decoder: &mut fidl::encoding::Decoder<
10658                '_,
10659                fidl::encoding::DefaultFuchsiaResourceDialect,
10660            >,
10661            offset: usize,
10662            mut depth: fidl::encoding::Depth,
10663        ) -> fidl::Result<()> {
10664            decoder.debug_check_bounds::<Self>(offset);
10665            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
10666                None => return Err(fidl::Error::NotNullable),
10667                Some(len) => len,
10668            };
10669            // Calling decoder.out_of_line_offset(0) is not allowed.
10670            if len == 0 {
10671                return Ok(());
10672            };
10673            depth.increment()?;
10674            let envelope_size = 8;
10675            let bytes_len = len * envelope_size;
10676            let offset = decoder.out_of_line_offset(bytes_len)?;
10677            // Decode the envelope for each type.
10678            let mut _next_ordinal_to_read = 0;
10679            let mut next_offset = offset;
10680            let end_offset = offset + bytes_len;
10681            _next_ordinal_to_read += 1;
10682            if next_offset >= end_offset {
10683                return Ok(());
10684            }
10685
10686            // Decode unknown envelopes for gaps in ordinals.
10687            while _next_ordinal_to_read < 1 {
10688                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10689                _next_ordinal_to_read += 1;
10690                next_offset += envelope_size;
10691            }
10692
10693            let next_out_of_line = decoder.next_out_of_line();
10694            let handles_before = decoder.remaining_handles();
10695            if let Some((inlined, num_bytes, num_handles)) =
10696                fidl::encoding::decode_envelope_header(decoder, next_offset)?
10697            {
10698                let member_inline_size =
10699                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
10700                if inlined != (member_inline_size <= 4) {
10701                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
10702                }
10703                let inner_offset;
10704                let mut inner_depth = depth.clone();
10705                if inlined {
10706                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
10707                    inner_offset = next_offset;
10708                } else {
10709                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
10710                    inner_depth.increment()?;
10711                }
10712                let val_ref = self.buffer_id.get_or_insert_with(|| {
10713                    fidl::new_empty!(u32, fidl::encoding::DefaultFuchsiaResourceDialect)
10714                });
10715                fidl::decode!(
10716                    u32,
10717                    fidl::encoding::DefaultFuchsiaResourceDialect,
10718                    val_ref,
10719                    decoder,
10720                    inner_offset,
10721                    inner_depth
10722                )?;
10723                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
10724                {
10725                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
10726                }
10727                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
10728                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
10729                }
10730            }
10731
10732            next_offset += envelope_size;
10733
10734            // Decode the remaining unknown envelopes.
10735            while next_offset < end_offset {
10736                _next_ordinal_to_read += 1;
10737                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10738                next_offset += envelope_size;
10739            }
10740
10741            Ok(())
10742        }
10743    }
10744
10745    impl GetNextFrameArgs {
10746        #[inline(always)]
10747        fn max_ordinal_present(&self) -> u64 {
10748            if let Some(_) = self.event {
10749                return 1;
10750            }
10751            0
10752        }
10753    }
10754
10755    impl fidl::encoding::ResourceTypeMarker for GetNextFrameArgs {
10756        type Borrowed<'a> = &'a mut Self;
10757        fn take_or_borrow<'a>(
10758            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10759        ) -> Self::Borrowed<'a> {
10760            value
10761        }
10762    }
10763
10764    unsafe impl fidl::encoding::TypeMarker for GetNextFrameArgs {
10765        type Owned = Self;
10766
10767        #[inline(always)]
10768        fn inline_align(_context: fidl::encoding::Context) -> usize {
10769            8
10770        }
10771
10772        #[inline(always)]
10773        fn inline_size(_context: fidl::encoding::Context) -> usize {
10774            16
10775        }
10776    }
10777
10778    unsafe impl
10779        fidl::encoding::Encode<GetNextFrameArgs, fidl::encoding::DefaultFuchsiaResourceDialect>
10780        for &mut GetNextFrameArgs
10781    {
10782        unsafe fn encode(
10783            self,
10784            encoder: &mut fidl::encoding::Encoder<
10785                '_,
10786                fidl::encoding::DefaultFuchsiaResourceDialect,
10787            >,
10788            offset: usize,
10789            mut depth: fidl::encoding::Depth,
10790        ) -> fidl::Result<()> {
10791            encoder.debug_check_bounds::<GetNextFrameArgs>(offset);
10792            // Vector header
10793            let max_ordinal: u64 = self.max_ordinal_present();
10794            encoder.write_num(max_ordinal, offset);
10795            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
10796            // Calling encoder.out_of_line_offset(0) is not allowed.
10797            if max_ordinal == 0 {
10798                return Ok(());
10799            }
10800            depth.increment()?;
10801            let envelope_size = 8;
10802            let bytes_len = max_ordinal as usize * envelope_size;
10803            #[allow(unused_variables)]
10804            let offset = encoder.out_of_line_offset(bytes_len);
10805            let mut _prev_end_offset: usize = 0;
10806            if 1 > max_ordinal {
10807                return Ok(());
10808            }
10809
10810            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
10811            // are envelope_size bytes.
10812            let cur_offset: usize = (1 - 1) * envelope_size;
10813
10814            // Zero reserved fields.
10815            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
10816
10817            // Safety:
10818            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
10819            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
10820            //   envelope_size bytes, there is always sufficient room.
10821            fidl::encoding::encode_in_envelope_optional::<
10822                fidl::encoding::HandleType<
10823                    fidl::Event,
10824                    { fidl::ObjectType::EVENT.into_raw() },
10825                    2147483648,
10826                >,
10827                fidl::encoding::DefaultFuchsiaResourceDialect,
10828            >(
10829                self.event.as_mut().map(
10830                    <fidl::encoding::HandleType<
10831                        fidl::Event,
10832                        { fidl::ObjectType::EVENT.into_raw() },
10833                        2147483648,
10834                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
10835                ),
10836                encoder,
10837                offset + cur_offset,
10838                depth,
10839            )?;
10840
10841            _prev_end_offset = cur_offset + envelope_size;
10842
10843            Ok(())
10844        }
10845    }
10846
10847    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10848        for GetNextFrameArgs
10849    {
10850        #[inline(always)]
10851        fn new_empty() -> Self {
10852            Self::default()
10853        }
10854
10855        unsafe fn decode(
10856            &mut self,
10857            decoder: &mut fidl::encoding::Decoder<
10858                '_,
10859                fidl::encoding::DefaultFuchsiaResourceDialect,
10860            >,
10861            offset: usize,
10862            mut depth: fidl::encoding::Depth,
10863        ) -> fidl::Result<()> {
10864            decoder.debug_check_bounds::<Self>(offset);
10865            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
10866                None => return Err(fidl::Error::NotNullable),
10867                Some(len) => len,
10868            };
10869            // Calling decoder.out_of_line_offset(0) is not allowed.
10870            if len == 0 {
10871                return Ok(());
10872            };
10873            depth.increment()?;
10874            let envelope_size = 8;
10875            let bytes_len = len * envelope_size;
10876            let offset = decoder.out_of_line_offset(bytes_len)?;
10877            // Decode the envelope for each type.
10878            let mut _next_ordinal_to_read = 0;
10879            let mut next_offset = offset;
10880            let end_offset = offset + bytes_len;
10881            _next_ordinal_to_read += 1;
10882            if next_offset >= end_offset {
10883                return Ok(());
10884            }
10885
10886            // Decode unknown envelopes for gaps in ordinals.
10887            while _next_ordinal_to_read < 1 {
10888                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10889                _next_ordinal_to_read += 1;
10890                next_offset += envelope_size;
10891            }
10892
10893            let next_out_of_line = decoder.next_out_of_line();
10894            let handles_before = decoder.remaining_handles();
10895            if let Some((inlined, num_bytes, num_handles)) =
10896                fidl::encoding::decode_envelope_header(decoder, next_offset)?
10897            {
10898                let member_inline_size = <fidl::encoding::HandleType<
10899                    fidl::Event,
10900                    { fidl::ObjectType::EVENT.into_raw() },
10901                    2147483648,
10902                > as fidl::encoding::TypeMarker>::inline_size(
10903                    decoder.context
10904                );
10905                if inlined != (member_inline_size <= 4) {
10906                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
10907                }
10908                let inner_offset;
10909                let mut inner_depth = depth.clone();
10910                if inlined {
10911                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
10912                    inner_offset = next_offset;
10913                } else {
10914                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
10915                    inner_depth.increment()?;
10916                }
10917                let val_ref =
10918                self.event.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
10919                fidl::decode!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
10920                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
10921                {
10922                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
10923                }
10924                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
10925                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
10926                }
10927            }
10928
10929            next_offset += envelope_size;
10930
10931            // Decode the remaining unknown envelopes.
10932            while next_offset < end_offset {
10933                _next_ordinal_to_read += 1;
10934                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10935                next_offset += envelope_size;
10936            }
10937
10938            Ok(())
10939        }
10940    }
10941
10942    impl PresentArgs {
10943        #[inline(always)]
10944        fn max_ordinal_present(&self) -> u64 {
10945            if let Some(_) = self.unsquashable {
10946                return 4;
10947            }
10948            if let Some(_) = self.release_fences {
10949                return 3;
10950            }
10951            if let Some(_) = self.acquire_fences {
10952                return 2;
10953            }
10954            if let Some(_) = self.requested_presentation_time {
10955                return 1;
10956            }
10957            0
10958        }
10959    }
10960
10961    impl fidl::encoding::ResourceTypeMarker for PresentArgs {
10962        type Borrowed<'a> = &'a mut Self;
10963        fn take_or_borrow<'a>(
10964            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10965        ) -> Self::Borrowed<'a> {
10966            value
10967        }
10968    }
10969
10970    unsafe impl fidl::encoding::TypeMarker for PresentArgs {
10971        type Owned = Self;
10972
10973        #[inline(always)]
10974        fn inline_align(_context: fidl::encoding::Context) -> usize {
10975            8
10976        }
10977
10978        #[inline(always)]
10979        fn inline_size(_context: fidl::encoding::Context) -> usize {
10980            16
10981        }
10982    }
10983
10984    unsafe impl fidl::encoding::Encode<PresentArgs, fidl::encoding::DefaultFuchsiaResourceDialect>
10985        for &mut PresentArgs
10986    {
10987        unsafe fn encode(
10988            self,
10989            encoder: &mut fidl::encoding::Encoder<
10990                '_,
10991                fidl::encoding::DefaultFuchsiaResourceDialect,
10992            >,
10993            offset: usize,
10994            mut depth: fidl::encoding::Depth,
10995        ) -> fidl::Result<()> {
10996            encoder.debug_check_bounds::<PresentArgs>(offset);
10997            // Vector header
10998            let max_ordinal: u64 = self.max_ordinal_present();
10999            encoder.write_num(max_ordinal, offset);
11000            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
11001            // Calling encoder.out_of_line_offset(0) is not allowed.
11002            if max_ordinal == 0 {
11003                return Ok(());
11004            }
11005            depth.increment()?;
11006            let envelope_size = 8;
11007            let bytes_len = max_ordinal as usize * envelope_size;
11008            #[allow(unused_variables)]
11009            let offset = encoder.out_of_line_offset(bytes_len);
11010            let mut _prev_end_offset: usize = 0;
11011            if 1 > max_ordinal {
11012                return Ok(());
11013            }
11014
11015            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11016            // are envelope_size bytes.
11017            let cur_offset: usize = (1 - 1) * envelope_size;
11018
11019            // Zero reserved fields.
11020            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11021
11022            // Safety:
11023            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11024            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11025            //   envelope_size bytes, there is always sufficient room.
11026            fidl::encoding::encode_in_envelope_optional::<
11027                i64,
11028                fidl::encoding::DefaultFuchsiaResourceDialect,
11029            >(
11030                self.requested_presentation_time
11031                    .as_ref()
11032                    .map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
11033                encoder,
11034                offset + cur_offset,
11035                depth,
11036            )?;
11037
11038            _prev_end_offset = cur_offset + envelope_size;
11039            if 2 > max_ordinal {
11040                return Ok(());
11041            }
11042
11043            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11044            // are envelope_size bytes.
11045            let cur_offset: usize = (2 - 1) * envelope_size;
11046
11047            // Zero reserved fields.
11048            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11049
11050            // Safety:
11051            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11052            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11053            //   envelope_size bytes, there is always sufficient room.
11054            fidl::encoding::encode_in_envelope_optional::<
11055                fidl::encoding::Vector<
11056                    fidl::encoding::HandleType<
11057                        fidl::Event,
11058                        { fidl::ObjectType::EVENT.into_raw() },
11059                        2147483648,
11060                    >,
11061                    16,
11062                >,
11063                fidl::encoding::DefaultFuchsiaResourceDialect,
11064            >(
11065                self.acquire_fences.as_mut().map(
11066                    <fidl::encoding::Vector<
11067                        fidl::encoding::HandleType<
11068                            fidl::Event,
11069                            { fidl::ObjectType::EVENT.into_raw() },
11070                            2147483648,
11071                        >,
11072                        16,
11073                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
11074                ),
11075                encoder,
11076                offset + cur_offset,
11077                depth,
11078            )?;
11079
11080            _prev_end_offset = cur_offset + envelope_size;
11081            if 3 > max_ordinal {
11082                return Ok(());
11083            }
11084
11085            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11086            // are envelope_size bytes.
11087            let cur_offset: usize = (3 - 1) * envelope_size;
11088
11089            // Zero reserved fields.
11090            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11091
11092            // Safety:
11093            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11094            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11095            //   envelope_size bytes, there is always sufficient room.
11096            fidl::encoding::encode_in_envelope_optional::<
11097                fidl::encoding::Vector<
11098                    fidl::encoding::HandleType<
11099                        fidl::Event,
11100                        { fidl::ObjectType::EVENT.into_raw() },
11101                        2147483648,
11102                    >,
11103                    16,
11104                >,
11105                fidl::encoding::DefaultFuchsiaResourceDialect,
11106            >(
11107                self.release_fences.as_mut().map(
11108                    <fidl::encoding::Vector<
11109                        fidl::encoding::HandleType<
11110                            fidl::Event,
11111                            { fidl::ObjectType::EVENT.into_raw() },
11112                            2147483648,
11113                        >,
11114                        16,
11115                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
11116                ),
11117                encoder,
11118                offset + cur_offset,
11119                depth,
11120            )?;
11121
11122            _prev_end_offset = cur_offset + envelope_size;
11123            if 4 > max_ordinal {
11124                return Ok(());
11125            }
11126
11127            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11128            // are envelope_size bytes.
11129            let cur_offset: usize = (4 - 1) * envelope_size;
11130
11131            // Zero reserved fields.
11132            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11133
11134            // Safety:
11135            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11136            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11137            //   envelope_size bytes, there is always sufficient room.
11138            fidl::encoding::encode_in_envelope_optional::<
11139                bool,
11140                fidl::encoding::DefaultFuchsiaResourceDialect,
11141            >(
11142                self.unsquashable.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
11143                encoder,
11144                offset + cur_offset,
11145                depth,
11146            )?;
11147
11148            _prev_end_offset = cur_offset + envelope_size;
11149
11150            Ok(())
11151        }
11152    }
11153
11154    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for PresentArgs {
11155        #[inline(always)]
11156        fn new_empty() -> Self {
11157            Self::default()
11158        }
11159
11160        unsafe fn decode(
11161            &mut self,
11162            decoder: &mut fidl::encoding::Decoder<
11163                '_,
11164                fidl::encoding::DefaultFuchsiaResourceDialect,
11165            >,
11166            offset: usize,
11167            mut depth: fidl::encoding::Depth,
11168        ) -> fidl::Result<()> {
11169            decoder.debug_check_bounds::<Self>(offset);
11170            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
11171                None => return Err(fidl::Error::NotNullable),
11172                Some(len) => len,
11173            };
11174            // Calling decoder.out_of_line_offset(0) is not allowed.
11175            if len == 0 {
11176                return Ok(());
11177            };
11178            depth.increment()?;
11179            let envelope_size = 8;
11180            let bytes_len = len * envelope_size;
11181            let offset = decoder.out_of_line_offset(bytes_len)?;
11182            // Decode the envelope for each type.
11183            let mut _next_ordinal_to_read = 0;
11184            let mut next_offset = offset;
11185            let end_offset = offset + bytes_len;
11186            _next_ordinal_to_read += 1;
11187            if next_offset >= end_offset {
11188                return Ok(());
11189            }
11190
11191            // Decode unknown envelopes for gaps in ordinals.
11192            while _next_ordinal_to_read < 1 {
11193                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11194                _next_ordinal_to_read += 1;
11195                next_offset += envelope_size;
11196            }
11197
11198            let next_out_of_line = decoder.next_out_of_line();
11199            let handles_before = decoder.remaining_handles();
11200            if let Some((inlined, num_bytes, num_handles)) =
11201                fidl::encoding::decode_envelope_header(decoder, next_offset)?
11202            {
11203                let member_inline_size =
11204                    <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
11205                if inlined != (member_inline_size <= 4) {
11206                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
11207                }
11208                let inner_offset;
11209                let mut inner_depth = depth.clone();
11210                if inlined {
11211                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11212                    inner_offset = next_offset;
11213                } else {
11214                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11215                    inner_depth.increment()?;
11216                }
11217                let val_ref = self.requested_presentation_time.get_or_insert_with(|| {
11218                    fidl::new_empty!(i64, fidl::encoding::DefaultFuchsiaResourceDialect)
11219                });
11220                fidl::decode!(
11221                    i64,
11222                    fidl::encoding::DefaultFuchsiaResourceDialect,
11223                    val_ref,
11224                    decoder,
11225                    inner_offset,
11226                    inner_depth
11227                )?;
11228                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11229                {
11230                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
11231                }
11232                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11233                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11234                }
11235            }
11236
11237            next_offset += envelope_size;
11238            _next_ordinal_to_read += 1;
11239            if next_offset >= end_offset {
11240                return Ok(());
11241            }
11242
11243            // Decode unknown envelopes for gaps in ordinals.
11244            while _next_ordinal_to_read < 2 {
11245                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11246                _next_ordinal_to_read += 1;
11247                next_offset += envelope_size;
11248            }
11249
11250            let next_out_of_line = decoder.next_out_of_line();
11251            let handles_before = decoder.remaining_handles();
11252            if let Some((inlined, num_bytes, num_handles)) =
11253                fidl::encoding::decode_envelope_header(decoder, next_offset)?
11254            {
11255                let member_inline_size = <fidl::encoding::Vector<
11256                    fidl::encoding::HandleType<
11257                        fidl::Event,
11258                        { fidl::ObjectType::EVENT.into_raw() },
11259                        2147483648,
11260                    >,
11261                    16,
11262                > as fidl::encoding::TypeMarker>::inline_size(
11263                    decoder.context
11264                );
11265                if inlined != (member_inline_size <= 4) {
11266                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
11267                }
11268                let inner_offset;
11269                let mut inner_depth = depth.clone();
11270                if inlined {
11271                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11272                    inner_offset = next_offset;
11273                } else {
11274                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11275                    inner_depth.increment()?;
11276                }
11277                let val_ref = self.acquire_fences.get_or_insert_with(|| {
11278                    fidl::new_empty!(
11279                        fidl::encoding::Vector<
11280                            fidl::encoding::HandleType<
11281                                fidl::Event,
11282                                { fidl::ObjectType::EVENT.into_raw() },
11283                                2147483648,
11284                            >,
11285                            16,
11286                        >,
11287                        fidl::encoding::DefaultFuchsiaResourceDialect
11288                    )
11289                });
11290                fidl::decode!(
11291                    fidl::encoding::Vector<
11292                        fidl::encoding::HandleType<
11293                            fidl::Event,
11294                            { fidl::ObjectType::EVENT.into_raw() },
11295                            2147483648,
11296                        >,
11297                        16,
11298                    >,
11299                    fidl::encoding::DefaultFuchsiaResourceDialect,
11300                    val_ref,
11301                    decoder,
11302                    inner_offset,
11303                    inner_depth
11304                )?;
11305                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11306                {
11307                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
11308                }
11309                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11310                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11311                }
11312            }
11313
11314            next_offset += envelope_size;
11315            _next_ordinal_to_read += 1;
11316            if next_offset >= end_offset {
11317                return Ok(());
11318            }
11319
11320            // Decode unknown envelopes for gaps in ordinals.
11321            while _next_ordinal_to_read < 3 {
11322                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11323                _next_ordinal_to_read += 1;
11324                next_offset += envelope_size;
11325            }
11326
11327            let next_out_of_line = decoder.next_out_of_line();
11328            let handles_before = decoder.remaining_handles();
11329            if let Some((inlined, num_bytes, num_handles)) =
11330                fidl::encoding::decode_envelope_header(decoder, next_offset)?
11331            {
11332                let member_inline_size = <fidl::encoding::Vector<
11333                    fidl::encoding::HandleType<
11334                        fidl::Event,
11335                        { fidl::ObjectType::EVENT.into_raw() },
11336                        2147483648,
11337                    >,
11338                    16,
11339                > as fidl::encoding::TypeMarker>::inline_size(
11340                    decoder.context
11341                );
11342                if inlined != (member_inline_size <= 4) {
11343                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
11344                }
11345                let inner_offset;
11346                let mut inner_depth = depth.clone();
11347                if inlined {
11348                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11349                    inner_offset = next_offset;
11350                } else {
11351                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11352                    inner_depth.increment()?;
11353                }
11354                let val_ref = self.release_fences.get_or_insert_with(|| {
11355                    fidl::new_empty!(
11356                        fidl::encoding::Vector<
11357                            fidl::encoding::HandleType<
11358                                fidl::Event,
11359                                { fidl::ObjectType::EVENT.into_raw() },
11360                                2147483648,
11361                            >,
11362                            16,
11363                        >,
11364                        fidl::encoding::DefaultFuchsiaResourceDialect
11365                    )
11366                });
11367                fidl::decode!(
11368                    fidl::encoding::Vector<
11369                        fidl::encoding::HandleType<
11370                            fidl::Event,
11371                            { fidl::ObjectType::EVENT.into_raw() },
11372                            2147483648,
11373                        >,
11374                        16,
11375                    >,
11376                    fidl::encoding::DefaultFuchsiaResourceDialect,
11377                    val_ref,
11378                    decoder,
11379                    inner_offset,
11380                    inner_depth
11381                )?;
11382                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11383                {
11384                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
11385                }
11386                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11387                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11388                }
11389            }
11390
11391            next_offset += envelope_size;
11392            _next_ordinal_to_read += 1;
11393            if next_offset >= end_offset {
11394                return Ok(());
11395            }
11396
11397            // Decode unknown envelopes for gaps in ordinals.
11398            while _next_ordinal_to_read < 4 {
11399                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11400                _next_ordinal_to_read += 1;
11401                next_offset += envelope_size;
11402            }
11403
11404            let next_out_of_line = decoder.next_out_of_line();
11405            let handles_before = decoder.remaining_handles();
11406            if let Some((inlined, num_bytes, num_handles)) =
11407                fidl::encoding::decode_envelope_header(decoder, next_offset)?
11408            {
11409                let member_inline_size =
11410                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
11411                if inlined != (member_inline_size <= 4) {
11412                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
11413                }
11414                let inner_offset;
11415                let mut inner_depth = depth.clone();
11416                if inlined {
11417                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11418                    inner_offset = next_offset;
11419                } else {
11420                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11421                    inner_depth.increment()?;
11422                }
11423                let val_ref = self.unsquashable.get_or_insert_with(|| {
11424                    fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
11425                });
11426                fidl::decode!(
11427                    bool,
11428                    fidl::encoding::DefaultFuchsiaResourceDialect,
11429                    val_ref,
11430                    decoder,
11431                    inner_offset,
11432                    inner_depth
11433                )?;
11434                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11435                {
11436                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
11437                }
11438                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11439                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11440                }
11441            }
11442
11443            next_offset += envelope_size;
11444
11445            // Decode the remaining unknown envelopes.
11446            while next_offset < end_offset {
11447                _next_ordinal_to_read += 1;
11448                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11449                next_offset += envelope_size;
11450            }
11451
11452            Ok(())
11453        }
11454    }
11455
11456    impl RegisterBufferCollectionArgs {
11457        #[inline(always)]
11458        fn max_ordinal_present(&self) -> u64 {
11459            if let Some(_) = self.buffer_collection_token2 {
11460                return 5;
11461            }
11462            if let Some(_) = self.usages {
11463                return 4;
11464            }
11465            if let Some(_) = self.usage {
11466                return 3;
11467            }
11468            if let Some(_) = self.buffer_collection_token {
11469                return 2;
11470            }
11471            if let Some(_) = self.export_token {
11472                return 1;
11473            }
11474            0
11475        }
11476    }
11477
11478    impl fidl::encoding::ResourceTypeMarker for RegisterBufferCollectionArgs {
11479        type Borrowed<'a> = &'a mut Self;
11480        fn take_or_borrow<'a>(
11481            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11482        ) -> Self::Borrowed<'a> {
11483            value
11484        }
11485    }
11486
11487    unsafe impl fidl::encoding::TypeMarker for RegisterBufferCollectionArgs {
11488        type Owned = Self;
11489
11490        #[inline(always)]
11491        fn inline_align(_context: fidl::encoding::Context) -> usize {
11492            8
11493        }
11494
11495        #[inline(always)]
11496        fn inline_size(_context: fidl::encoding::Context) -> usize {
11497            16
11498        }
11499    }
11500
11501    unsafe impl
11502        fidl::encoding::Encode<
11503            RegisterBufferCollectionArgs,
11504            fidl::encoding::DefaultFuchsiaResourceDialect,
11505        > for &mut RegisterBufferCollectionArgs
11506    {
11507        unsafe fn encode(
11508            self,
11509            encoder: &mut fidl::encoding::Encoder<
11510                '_,
11511                fidl::encoding::DefaultFuchsiaResourceDialect,
11512            >,
11513            offset: usize,
11514            mut depth: fidl::encoding::Depth,
11515        ) -> fidl::Result<()> {
11516            encoder.debug_check_bounds::<RegisterBufferCollectionArgs>(offset);
11517            // Vector header
11518            let max_ordinal: u64 = self.max_ordinal_present();
11519            encoder.write_num(max_ordinal, offset);
11520            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
11521            // Calling encoder.out_of_line_offset(0) is not allowed.
11522            if max_ordinal == 0 {
11523                return Ok(());
11524            }
11525            depth.increment()?;
11526            let envelope_size = 8;
11527            let bytes_len = max_ordinal as usize * envelope_size;
11528            #[allow(unused_variables)]
11529            let offset = encoder.out_of_line_offset(bytes_len);
11530            let mut _prev_end_offset: usize = 0;
11531            if 1 > max_ordinal {
11532                return Ok(());
11533            }
11534
11535            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11536            // are envelope_size bytes.
11537            let cur_offset: usize = (1 - 1) * envelope_size;
11538
11539            // Zero reserved fields.
11540            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11541
11542            // Safety:
11543            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11544            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11545            //   envelope_size bytes, there is always sufficient room.
11546            fidl::encoding::encode_in_envelope_optional::<BufferCollectionExportToken, fidl::encoding::DefaultFuchsiaResourceDialect>(
11547            self.export_token.as_mut().map(<BufferCollectionExportToken as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
11548            encoder, offset + cur_offset, depth
11549        )?;
11550
11551            _prev_end_offset = cur_offset + envelope_size;
11552            if 2 > max_ordinal {
11553                return Ok(());
11554            }
11555
11556            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11557            // are envelope_size bytes.
11558            let cur_offset: usize = (2 - 1) * envelope_size;
11559
11560            // Zero reserved fields.
11561            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11562
11563            // Safety:
11564            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11565            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11566            //   envelope_size bytes, there is always sufficient room.
11567            fidl::encoding::encode_in_envelope_optional::<
11568                fidl::encoding::Endpoint<
11569                    fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem::BufferCollectionTokenMarker>,
11570                >,
11571                fidl::encoding::DefaultFuchsiaResourceDialect,
11572            >(
11573                self.buffer_collection_token.as_mut().map(
11574                    <fidl::encoding::Endpoint<
11575                        fidl::endpoints::ClientEnd<
11576                            fidl_fuchsia_sysmem::BufferCollectionTokenMarker,
11577                        >,
11578                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
11579                ),
11580                encoder,
11581                offset + cur_offset,
11582                depth,
11583            )?;
11584
11585            _prev_end_offset = cur_offset + envelope_size;
11586            if 3 > max_ordinal {
11587                return Ok(());
11588            }
11589
11590            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11591            // are envelope_size bytes.
11592            let cur_offset: usize = (3 - 1) * envelope_size;
11593
11594            // Zero reserved fields.
11595            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11596
11597            // Safety:
11598            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11599            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11600            //   envelope_size bytes, there is always sufficient room.
11601            fidl::encoding::encode_in_envelope_optional::<
11602                RegisterBufferCollectionUsage,
11603                fidl::encoding::DefaultFuchsiaResourceDialect,
11604            >(
11605                self.usage.as_ref().map(
11606                    <RegisterBufferCollectionUsage as fidl::encoding::ValueTypeMarker>::borrow,
11607                ),
11608                encoder,
11609                offset + cur_offset,
11610                depth,
11611            )?;
11612
11613            _prev_end_offset = cur_offset + envelope_size;
11614            if 4 > max_ordinal {
11615                return Ok(());
11616            }
11617
11618            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11619            // are envelope_size bytes.
11620            let cur_offset: usize = (4 - 1) * envelope_size;
11621
11622            // Zero reserved fields.
11623            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11624
11625            // Safety:
11626            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11627            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11628            //   envelope_size bytes, there is always sufficient room.
11629            fidl::encoding::encode_in_envelope_optional::<
11630                RegisterBufferCollectionUsages,
11631                fidl::encoding::DefaultFuchsiaResourceDialect,
11632            >(
11633                self.usages.as_ref().map(
11634                    <RegisterBufferCollectionUsages as fidl::encoding::ValueTypeMarker>::borrow,
11635                ),
11636                encoder,
11637                offset + cur_offset,
11638                depth,
11639            )?;
11640
11641            _prev_end_offset = cur_offset + envelope_size;
11642            if 5 > max_ordinal {
11643                return Ok(());
11644            }
11645
11646            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11647            // are envelope_size bytes.
11648            let cur_offset: usize = (5 - 1) * envelope_size;
11649
11650            // Zero reserved fields.
11651            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11652
11653            // Safety:
11654            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11655            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11656            //   envelope_size bytes, there is always sufficient room.
11657            fidl::encoding::encode_in_envelope_optional::<
11658                fidl::encoding::Endpoint<
11659                    fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem2::BufferCollectionTokenMarker>,
11660                >,
11661                fidl::encoding::DefaultFuchsiaResourceDialect,
11662            >(
11663                self.buffer_collection_token2.as_mut().map(
11664                    <fidl::encoding::Endpoint<
11665                        fidl::endpoints::ClientEnd<
11666                            fidl_fuchsia_sysmem2::BufferCollectionTokenMarker,
11667                        >,
11668                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
11669                ),
11670                encoder,
11671                offset + cur_offset,
11672                depth,
11673            )?;
11674
11675            _prev_end_offset = cur_offset + envelope_size;
11676
11677            Ok(())
11678        }
11679    }
11680
11681    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11682        for RegisterBufferCollectionArgs
11683    {
11684        #[inline(always)]
11685        fn new_empty() -> Self {
11686            Self::default()
11687        }
11688
11689        unsafe fn decode(
11690            &mut self,
11691            decoder: &mut fidl::encoding::Decoder<
11692                '_,
11693                fidl::encoding::DefaultFuchsiaResourceDialect,
11694            >,
11695            offset: usize,
11696            mut depth: fidl::encoding::Depth,
11697        ) -> fidl::Result<()> {
11698            decoder.debug_check_bounds::<Self>(offset);
11699            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
11700                None => return Err(fidl::Error::NotNullable),
11701                Some(len) => len,
11702            };
11703            // Calling decoder.out_of_line_offset(0) is not allowed.
11704            if len == 0 {
11705                return Ok(());
11706            };
11707            depth.increment()?;
11708            let envelope_size = 8;
11709            let bytes_len = len * envelope_size;
11710            let offset = decoder.out_of_line_offset(bytes_len)?;
11711            // Decode the envelope for each type.
11712            let mut _next_ordinal_to_read = 0;
11713            let mut next_offset = offset;
11714            let end_offset = offset + bytes_len;
11715            _next_ordinal_to_read += 1;
11716            if next_offset >= end_offset {
11717                return Ok(());
11718            }
11719
11720            // Decode unknown envelopes for gaps in ordinals.
11721            while _next_ordinal_to_read < 1 {
11722                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11723                _next_ordinal_to_read += 1;
11724                next_offset += envelope_size;
11725            }
11726
11727            let next_out_of_line = decoder.next_out_of_line();
11728            let handles_before = decoder.remaining_handles();
11729            if let Some((inlined, num_bytes, num_handles)) =
11730                fidl::encoding::decode_envelope_header(decoder, next_offset)?
11731            {
11732                let member_inline_size =
11733                    <BufferCollectionExportToken as fidl::encoding::TypeMarker>::inline_size(
11734                        decoder.context,
11735                    );
11736                if inlined != (member_inline_size <= 4) {
11737                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
11738                }
11739                let inner_offset;
11740                let mut inner_depth = depth.clone();
11741                if inlined {
11742                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11743                    inner_offset = next_offset;
11744                } else {
11745                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11746                    inner_depth.increment()?;
11747                }
11748                let val_ref = self.export_token.get_or_insert_with(|| {
11749                    fidl::new_empty!(
11750                        BufferCollectionExportToken,
11751                        fidl::encoding::DefaultFuchsiaResourceDialect
11752                    )
11753                });
11754                fidl::decode!(
11755                    BufferCollectionExportToken,
11756                    fidl::encoding::DefaultFuchsiaResourceDialect,
11757                    val_ref,
11758                    decoder,
11759                    inner_offset,
11760                    inner_depth
11761                )?;
11762                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11763                {
11764                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
11765                }
11766                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11767                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11768                }
11769            }
11770
11771            next_offset += envelope_size;
11772            _next_ordinal_to_read += 1;
11773            if next_offset >= end_offset {
11774                return Ok(());
11775            }
11776
11777            // Decode unknown envelopes for gaps in ordinals.
11778            while _next_ordinal_to_read < 2 {
11779                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11780                _next_ordinal_to_read += 1;
11781                next_offset += envelope_size;
11782            }
11783
11784            let next_out_of_line = decoder.next_out_of_line();
11785            let handles_before = decoder.remaining_handles();
11786            if let Some((inlined, num_bytes, num_handles)) =
11787                fidl::encoding::decode_envelope_header(decoder, next_offset)?
11788            {
11789                let member_inline_size = <fidl::encoding::Endpoint<
11790                    fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem::BufferCollectionTokenMarker>,
11791                > as fidl::encoding::TypeMarker>::inline_size(
11792                    decoder.context
11793                );
11794                if inlined != (member_inline_size <= 4) {
11795                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
11796                }
11797                let inner_offset;
11798                let mut inner_depth = depth.clone();
11799                if inlined {
11800                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11801                    inner_offset = next_offset;
11802                } else {
11803                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11804                    inner_depth.increment()?;
11805                }
11806                let val_ref = self.buffer_collection_token.get_or_insert_with(|| {
11807                    fidl::new_empty!(
11808                        fidl::encoding::Endpoint<
11809                            fidl::endpoints::ClientEnd<
11810                                fidl_fuchsia_sysmem::BufferCollectionTokenMarker,
11811                            >,
11812                        >,
11813                        fidl::encoding::DefaultFuchsiaResourceDialect
11814                    )
11815                });
11816                fidl::decode!(
11817                    fidl::encoding::Endpoint<
11818                        fidl::endpoints::ClientEnd<
11819                            fidl_fuchsia_sysmem::BufferCollectionTokenMarker,
11820                        >,
11821                    >,
11822                    fidl::encoding::DefaultFuchsiaResourceDialect,
11823                    val_ref,
11824                    decoder,
11825                    inner_offset,
11826                    inner_depth
11827                )?;
11828                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11829                {
11830                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
11831                }
11832                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11833                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11834                }
11835            }
11836
11837            next_offset += envelope_size;
11838            _next_ordinal_to_read += 1;
11839            if next_offset >= end_offset {
11840                return Ok(());
11841            }
11842
11843            // Decode unknown envelopes for gaps in ordinals.
11844            while _next_ordinal_to_read < 3 {
11845                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11846                _next_ordinal_to_read += 1;
11847                next_offset += envelope_size;
11848            }
11849
11850            let next_out_of_line = decoder.next_out_of_line();
11851            let handles_before = decoder.remaining_handles();
11852            if let Some((inlined, num_bytes, num_handles)) =
11853                fidl::encoding::decode_envelope_header(decoder, next_offset)?
11854            {
11855                let member_inline_size =
11856                    <RegisterBufferCollectionUsage as fidl::encoding::TypeMarker>::inline_size(
11857                        decoder.context,
11858                    );
11859                if inlined != (member_inline_size <= 4) {
11860                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
11861                }
11862                let inner_offset;
11863                let mut inner_depth = depth.clone();
11864                if inlined {
11865                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11866                    inner_offset = next_offset;
11867                } else {
11868                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11869                    inner_depth.increment()?;
11870                }
11871                let val_ref = self.usage.get_or_insert_with(|| {
11872                    fidl::new_empty!(
11873                        RegisterBufferCollectionUsage,
11874                        fidl::encoding::DefaultFuchsiaResourceDialect
11875                    )
11876                });
11877                fidl::decode!(
11878                    RegisterBufferCollectionUsage,
11879                    fidl::encoding::DefaultFuchsiaResourceDialect,
11880                    val_ref,
11881                    decoder,
11882                    inner_offset,
11883                    inner_depth
11884                )?;
11885                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11886                {
11887                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
11888                }
11889                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11890                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11891                }
11892            }
11893
11894            next_offset += envelope_size;
11895            _next_ordinal_to_read += 1;
11896            if next_offset >= end_offset {
11897                return Ok(());
11898            }
11899
11900            // Decode unknown envelopes for gaps in ordinals.
11901            while _next_ordinal_to_read < 4 {
11902                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11903                _next_ordinal_to_read += 1;
11904                next_offset += envelope_size;
11905            }
11906
11907            let next_out_of_line = decoder.next_out_of_line();
11908            let handles_before = decoder.remaining_handles();
11909            if let Some((inlined, num_bytes, num_handles)) =
11910                fidl::encoding::decode_envelope_header(decoder, next_offset)?
11911            {
11912                let member_inline_size =
11913                    <RegisterBufferCollectionUsages as fidl::encoding::TypeMarker>::inline_size(
11914                        decoder.context,
11915                    );
11916                if inlined != (member_inline_size <= 4) {
11917                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
11918                }
11919                let inner_offset;
11920                let mut inner_depth = depth.clone();
11921                if inlined {
11922                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11923                    inner_offset = next_offset;
11924                } else {
11925                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11926                    inner_depth.increment()?;
11927                }
11928                let val_ref = self.usages.get_or_insert_with(|| {
11929                    fidl::new_empty!(
11930                        RegisterBufferCollectionUsages,
11931                        fidl::encoding::DefaultFuchsiaResourceDialect
11932                    )
11933                });
11934                fidl::decode!(
11935                    RegisterBufferCollectionUsages,
11936                    fidl::encoding::DefaultFuchsiaResourceDialect,
11937                    val_ref,
11938                    decoder,
11939                    inner_offset,
11940                    inner_depth
11941                )?;
11942                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11943                {
11944                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
11945                }
11946                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11947                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11948                }
11949            }
11950
11951            next_offset += envelope_size;
11952            _next_ordinal_to_read += 1;
11953            if next_offset >= end_offset {
11954                return Ok(());
11955            }
11956
11957            // Decode unknown envelopes for gaps in ordinals.
11958            while _next_ordinal_to_read < 5 {
11959                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11960                _next_ordinal_to_read += 1;
11961                next_offset += envelope_size;
11962            }
11963
11964            let next_out_of_line = decoder.next_out_of_line();
11965            let handles_before = decoder.remaining_handles();
11966            if let Some((inlined, num_bytes, num_handles)) =
11967                fidl::encoding::decode_envelope_header(decoder, next_offset)?
11968            {
11969                let member_inline_size = <fidl::encoding::Endpoint<
11970                    fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem2::BufferCollectionTokenMarker>,
11971                > as fidl::encoding::TypeMarker>::inline_size(
11972                    decoder.context
11973                );
11974                if inlined != (member_inline_size <= 4) {
11975                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
11976                }
11977                let inner_offset;
11978                let mut inner_depth = depth.clone();
11979                if inlined {
11980                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11981                    inner_offset = next_offset;
11982                } else {
11983                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11984                    inner_depth.increment()?;
11985                }
11986                let val_ref = self.buffer_collection_token2.get_or_insert_with(|| {
11987                    fidl::new_empty!(
11988                        fidl::encoding::Endpoint<
11989                            fidl::endpoints::ClientEnd<
11990                                fidl_fuchsia_sysmem2::BufferCollectionTokenMarker,
11991                            >,
11992                        >,
11993                        fidl::encoding::DefaultFuchsiaResourceDialect
11994                    )
11995                });
11996                fidl::decode!(
11997                    fidl::encoding::Endpoint<
11998                        fidl::endpoints::ClientEnd<
11999                            fidl_fuchsia_sysmem2::BufferCollectionTokenMarker,
12000                        >,
12001                    >,
12002                    fidl::encoding::DefaultFuchsiaResourceDialect,
12003                    val_ref,
12004                    decoder,
12005                    inner_offset,
12006                    inner_depth
12007                )?;
12008                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12009                {
12010                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12011                }
12012                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12013                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12014                }
12015            }
12016
12017            next_offset += envelope_size;
12018
12019            // Decode the remaining unknown envelopes.
12020            while next_offset < end_offset {
12021                _next_ordinal_to_read += 1;
12022                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12023                next_offset += envelope_size;
12024            }
12025
12026            Ok(())
12027        }
12028    }
12029
12030    impl ScreenCaptureConfig {
12031        #[inline(always)]
12032        fn max_ordinal_present(&self) -> u64 {
12033            if let Some(_) = self.rotation {
12034                return 4;
12035            }
12036            if let Some(_) = self.buffer_count {
12037                return 3;
12038            }
12039            if let Some(_) = self.size {
12040                return 2;
12041            }
12042            if let Some(_) = self.import_token {
12043                return 1;
12044            }
12045            0
12046        }
12047    }
12048
12049    impl fidl::encoding::ResourceTypeMarker for ScreenCaptureConfig {
12050        type Borrowed<'a> = &'a mut Self;
12051        fn take_or_borrow<'a>(
12052            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12053        ) -> Self::Borrowed<'a> {
12054            value
12055        }
12056    }
12057
12058    unsafe impl fidl::encoding::TypeMarker for ScreenCaptureConfig {
12059        type Owned = Self;
12060
12061        #[inline(always)]
12062        fn inline_align(_context: fidl::encoding::Context) -> usize {
12063            8
12064        }
12065
12066        #[inline(always)]
12067        fn inline_size(_context: fidl::encoding::Context) -> usize {
12068            16
12069        }
12070    }
12071
12072    unsafe impl
12073        fidl::encoding::Encode<ScreenCaptureConfig, fidl::encoding::DefaultFuchsiaResourceDialect>
12074        for &mut ScreenCaptureConfig
12075    {
12076        unsafe fn encode(
12077            self,
12078            encoder: &mut fidl::encoding::Encoder<
12079                '_,
12080                fidl::encoding::DefaultFuchsiaResourceDialect,
12081            >,
12082            offset: usize,
12083            mut depth: fidl::encoding::Depth,
12084        ) -> fidl::Result<()> {
12085            encoder.debug_check_bounds::<ScreenCaptureConfig>(offset);
12086            // Vector header
12087            let max_ordinal: u64 = self.max_ordinal_present();
12088            encoder.write_num(max_ordinal, offset);
12089            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
12090            // Calling encoder.out_of_line_offset(0) is not allowed.
12091            if max_ordinal == 0 {
12092                return Ok(());
12093            }
12094            depth.increment()?;
12095            let envelope_size = 8;
12096            let bytes_len = max_ordinal as usize * envelope_size;
12097            #[allow(unused_variables)]
12098            let offset = encoder.out_of_line_offset(bytes_len);
12099            let mut _prev_end_offset: usize = 0;
12100            if 1 > max_ordinal {
12101                return Ok(());
12102            }
12103
12104            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12105            // are envelope_size bytes.
12106            let cur_offset: usize = (1 - 1) * envelope_size;
12107
12108            // Zero reserved fields.
12109            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12110
12111            // Safety:
12112            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12113            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12114            //   envelope_size bytes, there is always sufficient room.
12115            fidl::encoding::encode_in_envelope_optional::<BufferCollectionImportToken, fidl::encoding::DefaultFuchsiaResourceDialect>(
12116            self.import_token.as_mut().map(<BufferCollectionImportToken as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
12117            encoder, offset + cur_offset, depth
12118        )?;
12119
12120            _prev_end_offset = cur_offset + envelope_size;
12121            if 2 > max_ordinal {
12122                return Ok(());
12123            }
12124
12125            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12126            // are envelope_size bytes.
12127            let cur_offset: usize = (2 - 1) * envelope_size;
12128
12129            // Zero reserved fields.
12130            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12131
12132            // Safety:
12133            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12134            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12135            //   envelope_size bytes, there is always sufficient room.
12136            fidl::encoding::encode_in_envelope_optional::<
12137                fidl_fuchsia_math::SizeU,
12138                fidl::encoding::DefaultFuchsiaResourceDialect,
12139            >(
12140                self.size
12141                    .as_ref()
12142                    .map(<fidl_fuchsia_math::SizeU as fidl::encoding::ValueTypeMarker>::borrow),
12143                encoder,
12144                offset + cur_offset,
12145                depth,
12146            )?;
12147
12148            _prev_end_offset = cur_offset + envelope_size;
12149            if 3 > max_ordinal {
12150                return Ok(());
12151            }
12152
12153            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12154            // are envelope_size bytes.
12155            let cur_offset: usize = (3 - 1) * envelope_size;
12156
12157            // Zero reserved fields.
12158            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12159
12160            // Safety:
12161            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12162            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12163            //   envelope_size bytes, there is always sufficient room.
12164            fidl::encoding::encode_in_envelope_optional::<
12165                u32,
12166                fidl::encoding::DefaultFuchsiaResourceDialect,
12167            >(
12168                self.buffer_count.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
12169                encoder,
12170                offset + cur_offset,
12171                depth,
12172            )?;
12173
12174            _prev_end_offset = cur_offset + envelope_size;
12175            if 4 > max_ordinal {
12176                return Ok(());
12177            }
12178
12179            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12180            // are envelope_size bytes.
12181            let cur_offset: usize = (4 - 1) * envelope_size;
12182
12183            // Zero reserved fields.
12184            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12185
12186            // Safety:
12187            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12188            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12189            //   envelope_size bytes, there is always sufficient room.
12190            fidl::encoding::encode_in_envelope_optional::<
12191                Rotation,
12192                fidl::encoding::DefaultFuchsiaResourceDialect,
12193            >(
12194                self.rotation.as_ref().map(<Rotation as fidl::encoding::ValueTypeMarker>::borrow),
12195                encoder,
12196                offset + cur_offset,
12197                depth,
12198            )?;
12199
12200            _prev_end_offset = cur_offset + envelope_size;
12201
12202            Ok(())
12203        }
12204    }
12205
12206    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
12207        for ScreenCaptureConfig
12208    {
12209        #[inline(always)]
12210        fn new_empty() -> Self {
12211            Self::default()
12212        }
12213
12214        unsafe fn decode(
12215            &mut self,
12216            decoder: &mut fidl::encoding::Decoder<
12217                '_,
12218                fidl::encoding::DefaultFuchsiaResourceDialect,
12219            >,
12220            offset: usize,
12221            mut depth: fidl::encoding::Depth,
12222        ) -> fidl::Result<()> {
12223            decoder.debug_check_bounds::<Self>(offset);
12224            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
12225                None => return Err(fidl::Error::NotNullable),
12226                Some(len) => len,
12227            };
12228            // Calling decoder.out_of_line_offset(0) is not allowed.
12229            if len == 0 {
12230                return Ok(());
12231            };
12232            depth.increment()?;
12233            let envelope_size = 8;
12234            let bytes_len = len * envelope_size;
12235            let offset = decoder.out_of_line_offset(bytes_len)?;
12236            // Decode the envelope for each type.
12237            let mut _next_ordinal_to_read = 0;
12238            let mut next_offset = offset;
12239            let end_offset = offset + bytes_len;
12240            _next_ordinal_to_read += 1;
12241            if next_offset >= end_offset {
12242                return Ok(());
12243            }
12244
12245            // Decode unknown envelopes for gaps in ordinals.
12246            while _next_ordinal_to_read < 1 {
12247                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12248                _next_ordinal_to_read += 1;
12249                next_offset += envelope_size;
12250            }
12251
12252            let next_out_of_line = decoder.next_out_of_line();
12253            let handles_before = decoder.remaining_handles();
12254            if let Some((inlined, num_bytes, num_handles)) =
12255                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12256            {
12257                let member_inline_size =
12258                    <BufferCollectionImportToken as fidl::encoding::TypeMarker>::inline_size(
12259                        decoder.context,
12260                    );
12261                if inlined != (member_inline_size <= 4) {
12262                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12263                }
12264                let inner_offset;
12265                let mut inner_depth = depth.clone();
12266                if inlined {
12267                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12268                    inner_offset = next_offset;
12269                } else {
12270                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12271                    inner_depth.increment()?;
12272                }
12273                let val_ref = self.import_token.get_or_insert_with(|| {
12274                    fidl::new_empty!(
12275                        BufferCollectionImportToken,
12276                        fidl::encoding::DefaultFuchsiaResourceDialect
12277                    )
12278                });
12279                fidl::decode!(
12280                    BufferCollectionImportToken,
12281                    fidl::encoding::DefaultFuchsiaResourceDialect,
12282                    val_ref,
12283                    decoder,
12284                    inner_offset,
12285                    inner_depth
12286                )?;
12287                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12288                {
12289                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12290                }
12291                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12292                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12293                }
12294            }
12295
12296            next_offset += envelope_size;
12297            _next_ordinal_to_read += 1;
12298            if next_offset >= end_offset {
12299                return Ok(());
12300            }
12301
12302            // Decode unknown envelopes for gaps in ordinals.
12303            while _next_ordinal_to_read < 2 {
12304                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12305                _next_ordinal_to_read += 1;
12306                next_offset += envelope_size;
12307            }
12308
12309            let next_out_of_line = decoder.next_out_of_line();
12310            let handles_before = decoder.remaining_handles();
12311            if let Some((inlined, num_bytes, num_handles)) =
12312                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12313            {
12314                let member_inline_size =
12315                    <fidl_fuchsia_math::SizeU as fidl::encoding::TypeMarker>::inline_size(
12316                        decoder.context,
12317                    );
12318                if inlined != (member_inline_size <= 4) {
12319                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12320                }
12321                let inner_offset;
12322                let mut inner_depth = depth.clone();
12323                if inlined {
12324                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12325                    inner_offset = next_offset;
12326                } else {
12327                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12328                    inner_depth.increment()?;
12329                }
12330                let val_ref = self.size.get_or_insert_with(|| {
12331                    fidl::new_empty!(
12332                        fidl_fuchsia_math::SizeU,
12333                        fidl::encoding::DefaultFuchsiaResourceDialect
12334                    )
12335                });
12336                fidl::decode!(
12337                    fidl_fuchsia_math::SizeU,
12338                    fidl::encoding::DefaultFuchsiaResourceDialect,
12339                    val_ref,
12340                    decoder,
12341                    inner_offset,
12342                    inner_depth
12343                )?;
12344                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12345                {
12346                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12347                }
12348                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12349                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12350                }
12351            }
12352
12353            next_offset += envelope_size;
12354            _next_ordinal_to_read += 1;
12355            if next_offset >= end_offset {
12356                return Ok(());
12357            }
12358
12359            // Decode unknown envelopes for gaps in ordinals.
12360            while _next_ordinal_to_read < 3 {
12361                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12362                _next_ordinal_to_read += 1;
12363                next_offset += envelope_size;
12364            }
12365
12366            let next_out_of_line = decoder.next_out_of_line();
12367            let handles_before = decoder.remaining_handles();
12368            if let Some((inlined, num_bytes, num_handles)) =
12369                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12370            {
12371                let member_inline_size =
12372                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
12373                if inlined != (member_inline_size <= 4) {
12374                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12375                }
12376                let inner_offset;
12377                let mut inner_depth = depth.clone();
12378                if inlined {
12379                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12380                    inner_offset = next_offset;
12381                } else {
12382                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12383                    inner_depth.increment()?;
12384                }
12385                let val_ref = self.buffer_count.get_or_insert_with(|| {
12386                    fidl::new_empty!(u32, fidl::encoding::DefaultFuchsiaResourceDialect)
12387                });
12388                fidl::decode!(
12389                    u32,
12390                    fidl::encoding::DefaultFuchsiaResourceDialect,
12391                    val_ref,
12392                    decoder,
12393                    inner_offset,
12394                    inner_depth
12395                )?;
12396                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12397                {
12398                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12399                }
12400                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12401                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12402                }
12403            }
12404
12405            next_offset += envelope_size;
12406            _next_ordinal_to_read += 1;
12407            if next_offset >= end_offset {
12408                return Ok(());
12409            }
12410
12411            // Decode unknown envelopes for gaps in ordinals.
12412            while _next_ordinal_to_read < 4 {
12413                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12414                _next_ordinal_to_read += 1;
12415                next_offset += envelope_size;
12416            }
12417
12418            let next_out_of_line = decoder.next_out_of_line();
12419            let handles_before = decoder.remaining_handles();
12420            if let Some((inlined, num_bytes, num_handles)) =
12421                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12422            {
12423                let member_inline_size =
12424                    <Rotation as fidl::encoding::TypeMarker>::inline_size(decoder.context);
12425                if inlined != (member_inline_size <= 4) {
12426                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12427                }
12428                let inner_offset;
12429                let mut inner_depth = depth.clone();
12430                if inlined {
12431                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12432                    inner_offset = next_offset;
12433                } else {
12434                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12435                    inner_depth.increment()?;
12436                }
12437                let val_ref = self.rotation.get_or_insert_with(|| {
12438                    fidl::new_empty!(Rotation, fidl::encoding::DefaultFuchsiaResourceDialect)
12439                });
12440                fidl::decode!(
12441                    Rotation,
12442                    fidl::encoding::DefaultFuchsiaResourceDialect,
12443                    val_ref,
12444                    decoder,
12445                    inner_offset,
12446                    inner_depth
12447                )?;
12448                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12449                {
12450                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12451                }
12452                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12453                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12454                }
12455            }
12456
12457            next_offset += envelope_size;
12458
12459            // Decode the remaining unknown envelopes.
12460            while next_offset < end_offset {
12461                _next_ordinal_to_read += 1;
12462                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12463                next_offset += envelope_size;
12464            }
12465
12466            Ok(())
12467        }
12468    }
12469
12470    impl ScreenshotTakeFileRequest {
12471        #[inline(always)]
12472        fn max_ordinal_present(&self) -> u64 {
12473            if let Some(_) = self.format {
12474                return 1;
12475            }
12476            0
12477        }
12478    }
12479
12480    impl fidl::encoding::ResourceTypeMarker for ScreenshotTakeFileRequest {
12481        type Borrowed<'a> = &'a mut Self;
12482        fn take_or_borrow<'a>(
12483            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12484        ) -> Self::Borrowed<'a> {
12485            value
12486        }
12487    }
12488
12489    unsafe impl fidl::encoding::TypeMarker for ScreenshotTakeFileRequest {
12490        type Owned = Self;
12491
12492        #[inline(always)]
12493        fn inline_align(_context: fidl::encoding::Context) -> usize {
12494            8
12495        }
12496
12497        #[inline(always)]
12498        fn inline_size(_context: fidl::encoding::Context) -> usize {
12499            16
12500        }
12501    }
12502
12503    unsafe impl
12504        fidl::encoding::Encode<
12505            ScreenshotTakeFileRequest,
12506            fidl::encoding::DefaultFuchsiaResourceDialect,
12507        > for &mut ScreenshotTakeFileRequest
12508    {
12509        unsafe fn encode(
12510            self,
12511            encoder: &mut fidl::encoding::Encoder<
12512                '_,
12513                fidl::encoding::DefaultFuchsiaResourceDialect,
12514            >,
12515            offset: usize,
12516            mut depth: fidl::encoding::Depth,
12517        ) -> fidl::Result<()> {
12518            encoder.debug_check_bounds::<ScreenshotTakeFileRequest>(offset);
12519            // Vector header
12520            let max_ordinal: u64 = self.max_ordinal_present();
12521            encoder.write_num(max_ordinal, offset);
12522            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
12523            // Calling encoder.out_of_line_offset(0) is not allowed.
12524            if max_ordinal == 0 {
12525                return Ok(());
12526            }
12527            depth.increment()?;
12528            let envelope_size = 8;
12529            let bytes_len = max_ordinal as usize * envelope_size;
12530            #[allow(unused_variables)]
12531            let offset = encoder.out_of_line_offset(bytes_len);
12532            let mut _prev_end_offset: usize = 0;
12533            if 1 > max_ordinal {
12534                return Ok(());
12535            }
12536
12537            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12538            // are envelope_size bytes.
12539            let cur_offset: usize = (1 - 1) * envelope_size;
12540
12541            // Zero reserved fields.
12542            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12543
12544            // Safety:
12545            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12546            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12547            //   envelope_size bytes, there is always sufficient room.
12548            fidl::encoding::encode_in_envelope_optional::<
12549                ScreenshotFormat,
12550                fidl::encoding::DefaultFuchsiaResourceDialect,
12551            >(
12552                self.format
12553                    .as_ref()
12554                    .map(<ScreenshotFormat as fidl::encoding::ValueTypeMarker>::borrow),
12555                encoder,
12556                offset + cur_offset,
12557                depth,
12558            )?;
12559
12560            _prev_end_offset = cur_offset + envelope_size;
12561
12562            Ok(())
12563        }
12564    }
12565
12566    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
12567        for ScreenshotTakeFileRequest
12568    {
12569        #[inline(always)]
12570        fn new_empty() -> Self {
12571            Self::default()
12572        }
12573
12574        unsafe fn decode(
12575            &mut self,
12576            decoder: &mut fidl::encoding::Decoder<
12577                '_,
12578                fidl::encoding::DefaultFuchsiaResourceDialect,
12579            >,
12580            offset: usize,
12581            mut depth: fidl::encoding::Depth,
12582        ) -> fidl::Result<()> {
12583            decoder.debug_check_bounds::<Self>(offset);
12584            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
12585                None => return Err(fidl::Error::NotNullable),
12586                Some(len) => len,
12587            };
12588            // Calling decoder.out_of_line_offset(0) is not allowed.
12589            if len == 0 {
12590                return Ok(());
12591            };
12592            depth.increment()?;
12593            let envelope_size = 8;
12594            let bytes_len = len * envelope_size;
12595            let offset = decoder.out_of_line_offset(bytes_len)?;
12596            // Decode the envelope for each type.
12597            let mut _next_ordinal_to_read = 0;
12598            let mut next_offset = offset;
12599            let end_offset = offset + bytes_len;
12600            _next_ordinal_to_read += 1;
12601            if next_offset >= end_offset {
12602                return Ok(());
12603            }
12604
12605            // Decode unknown envelopes for gaps in ordinals.
12606            while _next_ordinal_to_read < 1 {
12607                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12608                _next_ordinal_to_read += 1;
12609                next_offset += envelope_size;
12610            }
12611
12612            let next_out_of_line = decoder.next_out_of_line();
12613            let handles_before = decoder.remaining_handles();
12614            if let Some((inlined, num_bytes, num_handles)) =
12615                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12616            {
12617                let member_inline_size =
12618                    <ScreenshotFormat as fidl::encoding::TypeMarker>::inline_size(decoder.context);
12619                if inlined != (member_inline_size <= 4) {
12620                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12621                }
12622                let inner_offset;
12623                let mut inner_depth = depth.clone();
12624                if inlined {
12625                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12626                    inner_offset = next_offset;
12627                } else {
12628                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12629                    inner_depth.increment()?;
12630                }
12631                let val_ref = self.format.get_or_insert_with(|| {
12632                    fidl::new_empty!(
12633                        ScreenshotFormat,
12634                        fidl::encoding::DefaultFuchsiaResourceDialect
12635                    )
12636                });
12637                fidl::decode!(
12638                    ScreenshotFormat,
12639                    fidl::encoding::DefaultFuchsiaResourceDialect,
12640                    val_ref,
12641                    decoder,
12642                    inner_offset,
12643                    inner_depth
12644                )?;
12645                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12646                {
12647                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12648                }
12649                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12650                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12651                }
12652            }
12653
12654            next_offset += envelope_size;
12655
12656            // Decode the remaining unknown envelopes.
12657            while next_offset < end_offset {
12658                _next_ordinal_to_read += 1;
12659                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12660                next_offset += envelope_size;
12661            }
12662
12663            Ok(())
12664        }
12665    }
12666
12667    impl ScreenshotTakeFileResponse {
12668        #[inline(always)]
12669        fn max_ordinal_present(&self) -> u64 {
12670            if let Some(_) = self.size {
12671                return 2;
12672            }
12673            if let Some(_) = self.file {
12674                return 1;
12675            }
12676            0
12677        }
12678    }
12679
12680    impl fidl::encoding::ResourceTypeMarker for ScreenshotTakeFileResponse {
12681        type Borrowed<'a> = &'a mut Self;
12682        fn take_or_borrow<'a>(
12683            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12684        ) -> Self::Borrowed<'a> {
12685            value
12686        }
12687    }
12688
12689    unsafe impl fidl::encoding::TypeMarker for ScreenshotTakeFileResponse {
12690        type Owned = Self;
12691
12692        #[inline(always)]
12693        fn inline_align(_context: fidl::encoding::Context) -> usize {
12694            8
12695        }
12696
12697        #[inline(always)]
12698        fn inline_size(_context: fidl::encoding::Context) -> usize {
12699            16
12700        }
12701    }
12702
12703    unsafe impl
12704        fidl::encoding::Encode<
12705            ScreenshotTakeFileResponse,
12706            fidl::encoding::DefaultFuchsiaResourceDialect,
12707        > for &mut ScreenshotTakeFileResponse
12708    {
12709        unsafe fn encode(
12710            self,
12711            encoder: &mut fidl::encoding::Encoder<
12712                '_,
12713                fidl::encoding::DefaultFuchsiaResourceDialect,
12714            >,
12715            offset: usize,
12716            mut depth: fidl::encoding::Depth,
12717        ) -> fidl::Result<()> {
12718            encoder.debug_check_bounds::<ScreenshotTakeFileResponse>(offset);
12719            // Vector header
12720            let max_ordinal: u64 = self.max_ordinal_present();
12721            encoder.write_num(max_ordinal, offset);
12722            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
12723            // Calling encoder.out_of_line_offset(0) is not allowed.
12724            if max_ordinal == 0 {
12725                return Ok(());
12726            }
12727            depth.increment()?;
12728            let envelope_size = 8;
12729            let bytes_len = max_ordinal as usize * envelope_size;
12730            #[allow(unused_variables)]
12731            let offset = encoder.out_of_line_offset(bytes_len);
12732            let mut _prev_end_offset: usize = 0;
12733            if 1 > max_ordinal {
12734                return Ok(());
12735            }
12736
12737            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12738            // are envelope_size bytes.
12739            let cur_offset: usize = (1 - 1) * envelope_size;
12740
12741            // Zero reserved fields.
12742            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12743
12744            // Safety:
12745            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12746            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12747            //   envelope_size bytes, there is always sufficient room.
12748            fidl::encoding::encode_in_envelope_optional::<
12749                fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>>,
12750                fidl::encoding::DefaultFuchsiaResourceDialect,
12751            >(
12752                self.file.as_mut().map(
12753                    <fidl::encoding::Endpoint<
12754                        fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
12755                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
12756                ),
12757                encoder,
12758                offset + cur_offset,
12759                depth,
12760            )?;
12761
12762            _prev_end_offset = cur_offset + envelope_size;
12763            if 2 > max_ordinal {
12764                return Ok(());
12765            }
12766
12767            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12768            // are envelope_size bytes.
12769            let cur_offset: usize = (2 - 1) * envelope_size;
12770
12771            // Zero reserved fields.
12772            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12773
12774            // Safety:
12775            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12776            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12777            //   envelope_size bytes, there is always sufficient room.
12778            fidl::encoding::encode_in_envelope_optional::<
12779                fidl_fuchsia_math::SizeU,
12780                fidl::encoding::DefaultFuchsiaResourceDialect,
12781            >(
12782                self.size
12783                    .as_ref()
12784                    .map(<fidl_fuchsia_math::SizeU as fidl::encoding::ValueTypeMarker>::borrow),
12785                encoder,
12786                offset + cur_offset,
12787                depth,
12788            )?;
12789
12790            _prev_end_offset = cur_offset + envelope_size;
12791
12792            Ok(())
12793        }
12794    }
12795
12796    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
12797        for ScreenshotTakeFileResponse
12798    {
12799        #[inline(always)]
12800        fn new_empty() -> Self {
12801            Self::default()
12802        }
12803
12804        unsafe fn decode(
12805            &mut self,
12806            decoder: &mut fidl::encoding::Decoder<
12807                '_,
12808                fidl::encoding::DefaultFuchsiaResourceDialect,
12809            >,
12810            offset: usize,
12811            mut depth: fidl::encoding::Depth,
12812        ) -> fidl::Result<()> {
12813            decoder.debug_check_bounds::<Self>(offset);
12814            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
12815                None => return Err(fidl::Error::NotNullable),
12816                Some(len) => len,
12817            };
12818            // Calling decoder.out_of_line_offset(0) is not allowed.
12819            if len == 0 {
12820                return Ok(());
12821            };
12822            depth.increment()?;
12823            let envelope_size = 8;
12824            let bytes_len = len * envelope_size;
12825            let offset = decoder.out_of_line_offset(bytes_len)?;
12826            // Decode the envelope for each type.
12827            let mut _next_ordinal_to_read = 0;
12828            let mut next_offset = offset;
12829            let end_offset = offset + bytes_len;
12830            _next_ordinal_to_read += 1;
12831            if next_offset >= end_offset {
12832                return Ok(());
12833            }
12834
12835            // Decode unknown envelopes for gaps in ordinals.
12836            while _next_ordinal_to_read < 1 {
12837                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12838                _next_ordinal_to_read += 1;
12839                next_offset += envelope_size;
12840            }
12841
12842            let next_out_of_line = decoder.next_out_of_line();
12843            let handles_before = decoder.remaining_handles();
12844            if let Some((inlined, num_bytes, num_handles)) =
12845                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12846            {
12847                let member_inline_size = <fidl::encoding::Endpoint<
12848                    fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
12849                > as fidl::encoding::TypeMarker>::inline_size(
12850                    decoder.context
12851                );
12852                if inlined != (member_inline_size <= 4) {
12853                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12854                }
12855                let inner_offset;
12856                let mut inner_depth = depth.clone();
12857                if inlined {
12858                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12859                    inner_offset = next_offset;
12860                } else {
12861                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12862                    inner_depth.increment()?;
12863                }
12864                let val_ref = self.file.get_or_insert_with(|| {
12865                    fidl::new_empty!(
12866                        fidl::encoding::Endpoint<
12867                            fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
12868                        >,
12869                        fidl::encoding::DefaultFuchsiaResourceDialect
12870                    )
12871                });
12872                fidl::decode!(
12873                    fidl::encoding::Endpoint<
12874                        fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
12875                    >,
12876                    fidl::encoding::DefaultFuchsiaResourceDialect,
12877                    val_ref,
12878                    decoder,
12879                    inner_offset,
12880                    inner_depth
12881                )?;
12882                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12883                {
12884                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12885                }
12886                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12887                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12888                }
12889            }
12890
12891            next_offset += envelope_size;
12892            _next_ordinal_to_read += 1;
12893            if next_offset >= end_offset {
12894                return Ok(());
12895            }
12896
12897            // Decode unknown envelopes for gaps in ordinals.
12898            while _next_ordinal_to_read < 2 {
12899                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12900                _next_ordinal_to_read += 1;
12901                next_offset += envelope_size;
12902            }
12903
12904            let next_out_of_line = decoder.next_out_of_line();
12905            let handles_before = decoder.remaining_handles();
12906            if let Some((inlined, num_bytes, num_handles)) =
12907                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12908            {
12909                let member_inline_size =
12910                    <fidl_fuchsia_math::SizeU as fidl::encoding::TypeMarker>::inline_size(
12911                        decoder.context,
12912                    );
12913                if inlined != (member_inline_size <= 4) {
12914                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12915                }
12916                let inner_offset;
12917                let mut inner_depth = depth.clone();
12918                if inlined {
12919                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12920                    inner_offset = next_offset;
12921                } else {
12922                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12923                    inner_depth.increment()?;
12924                }
12925                let val_ref = self.size.get_or_insert_with(|| {
12926                    fidl::new_empty!(
12927                        fidl_fuchsia_math::SizeU,
12928                        fidl::encoding::DefaultFuchsiaResourceDialect
12929                    )
12930                });
12931                fidl::decode!(
12932                    fidl_fuchsia_math::SizeU,
12933                    fidl::encoding::DefaultFuchsiaResourceDialect,
12934                    val_ref,
12935                    decoder,
12936                    inner_offset,
12937                    inner_depth
12938                )?;
12939                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12940                {
12941                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12942                }
12943                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12944                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12945                }
12946            }
12947
12948            next_offset += envelope_size;
12949
12950            // Decode the remaining unknown envelopes.
12951            while next_offset < end_offset {
12952                _next_ordinal_to_read += 1;
12953                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12954                next_offset += envelope_size;
12955            }
12956
12957            Ok(())
12958        }
12959    }
12960
12961    impl ScreenshotTakeRequest {
12962        #[inline(always)]
12963        fn max_ordinal_present(&self) -> u64 {
12964            if let Some(_) = self.format {
12965                return 1;
12966            }
12967            0
12968        }
12969    }
12970
12971    impl fidl::encoding::ResourceTypeMarker for ScreenshotTakeRequest {
12972        type Borrowed<'a> = &'a mut Self;
12973        fn take_or_borrow<'a>(
12974            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12975        ) -> Self::Borrowed<'a> {
12976            value
12977        }
12978    }
12979
12980    unsafe impl fidl::encoding::TypeMarker for ScreenshotTakeRequest {
12981        type Owned = Self;
12982
12983        #[inline(always)]
12984        fn inline_align(_context: fidl::encoding::Context) -> usize {
12985            8
12986        }
12987
12988        #[inline(always)]
12989        fn inline_size(_context: fidl::encoding::Context) -> usize {
12990            16
12991        }
12992    }
12993
12994    unsafe impl
12995        fidl::encoding::Encode<ScreenshotTakeRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
12996        for &mut ScreenshotTakeRequest
12997    {
12998        unsafe fn encode(
12999            self,
13000            encoder: &mut fidl::encoding::Encoder<
13001                '_,
13002                fidl::encoding::DefaultFuchsiaResourceDialect,
13003            >,
13004            offset: usize,
13005            mut depth: fidl::encoding::Depth,
13006        ) -> fidl::Result<()> {
13007            encoder.debug_check_bounds::<ScreenshotTakeRequest>(offset);
13008            // Vector header
13009            let max_ordinal: u64 = self.max_ordinal_present();
13010            encoder.write_num(max_ordinal, offset);
13011            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
13012            // Calling encoder.out_of_line_offset(0) is not allowed.
13013            if max_ordinal == 0 {
13014                return Ok(());
13015            }
13016            depth.increment()?;
13017            let envelope_size = 8;
13018            let bytes_len = max_ordinal as usize * envelope_size;
13019            #[allow(unused_variables)]
13020            let offset = encoder.out_of_line_offset(bytes_len);
13021            let mut _prev_end_offset: usize = 0;
13022            if 1 > max_ordinal {
13023                return Ok(());
13024            }
13025
13026            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
13027            // are envelope_size bytes.
13028            let cur_offset: usize = (1 - 1) * envelope_size;
13029
13030            // Zero reserved fields.
13031            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
13032
13033            // Safety:
13034            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
13035            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
13036            //   envelope_size bytes, there is always sufficient room.
13037            fidl::encoding::encode_in_envelope_optional::<
13038                ScreenshotFormat,
13039                fidl::encoding::DefaultFuchsiaResourceDialect,
13040            >(
13041                self.format
13042                    .as_ref()
13043                    .map(<ScreenshotFormat as fidl::encoding::ValueTypeMarker>::borrow),
13044                encoder,
13045                offset + cur_offset,
13046                depth,
13047            )?;
13048
13049            _prev_end_offset = cur_offset + envelope_size;
13050
13051            Ok(())
13052        }
13053    }
13054
13055    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
13056        for ScreenshotTakeRequest
13057    {
13058        #[inline(always)]
13059        fn new_empty() -> Self {
13060            Self::default()
13061        }
13062
13063        unsafe fn decode(
13064            &mut self,
13065            decoder: &mut fidl::encoding::Decoder<
13066                '_,
13067                fidl::encoding::DefaultFuchsiaResourceDialect,
13068            >,
13069            offset: usize,
13070            mut depth: fidl::encoding::Depth,
13071        ) -> fidl::Result<()> {
13072            decoder.debug_check_bounds::<Self>(offset);
13073            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
13074                None => return Err(fidl::Error::NotNullable),
13075                Some(len) => len,
13076            };
13077            // Calling decoder.out_of_line_offset(0) is not allowed.
13078            if len == 0 {
13079                return Ok(());
13080            };
13081            depth.increment()?;
13082            let envelope_size = 8;
13083            let bytes_len = len * envelope_size;
13084            let offset = decoder.out_of_line_offset(bytes_len)?;
13085            // Decode the envelope for each type.
13086            let mut _next_ordinal_to_read = 0;
13087            let mut next_offset = offset;
13088            let end_offset = offset + bytes_len;
13089            _next_ordinal_to_read += 1;
13090            if next_offset >= end_offset {
13091                return Ok(());
13092            }
13093
13094            // Decode unknown envelopes for gaps in ordinals.
13095            while _next_ordinal_to_read < 1 {
13096                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13097                _next_ordinal_to_read += 1;
13098                next_offset += envelope_size;
13099            }
13100
13101            let next_out_of_line = decoder.next_out_of_line();
13102            let handles_before = decoder.remaining_handles();
13103            if let Some((inlined, num_bytes, num_handles)) =
13104                fidl::encoding::decode_envelope_header(decoder, next_offset)?
13105            {
13106                let member_inline_size =
13107                    <ScreenshotFormat as fidl::encoding::TypeMarker>::inline_size(decoder.context);
13108                if inlined != (member_inline_size <= 4) {
13109                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
13110                }
13111                let inner_offset;
13112                let mut inner_depth = depth.clone();
13113                if inlined {
13114                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
13115                    inner_offset = next_offset;
13116                } else {
13117                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
13118                    inner_depth.increment()?;
13119                }
13120                let val_ref = self.format.get_or_insert_with(|| {
13121                    fidl::new_empty!(
13122                        ScreenshotFormat,
13123                        fidl::encoding::DefaultFuchsiaResourceDialect
13124                    )
13125                });
13126                fidl::decode!(
13127                    ScreenshotFormat,
13128                    fidl::encoding::DefaultFuchsiaResourceDialect,
13129                    val_ref,
13130                    decoder,
13131                    inner_offset,
13132                    inner_depth
13133                )?;
13134                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
13135                {
13136                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
13137                }
13138                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
13139                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
13140                }
13141            }
13142
13143            next_offset += envelope_size;
13144
13145            // Decode the remaining unknown envelopes.
13146            while next_offset < end_offset {
13147                _next_ordinal_to_read += 1;
13148                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13149                next_offset += envelope_size;
13150            }
13151
13152            Ok(())
13153        }
13154    }
13155
13156    impl ScreenshotTakeResponse {
13157        #[inline(always)]
13158        fn max_ordinal_present(&self) -> u64 {
13159            if let Some(_) = self.size {
13160                return 2;
13161            }
13162            if let Some(_) = self.vmo {
13163                return 1;
13164            }
13165            0
13166        }
13167    }
13168
13169    impl fidl::encoding::ResourceTypeMarker for ScreenshotTakeResponse {
13170        type Borrowed<'a> = &'a mut Self;
13171        fn take_or_borrow<'a>(
13172            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
13173        ) -> Self::Borrowed<'a> {
13174            value
13175        }
13176    }
13177
13178    unsafe impl fidl::encoding::TypeMarker for ScreenshotTakeResponse {
13179        type Owned = Self;
13180
13181        #[inline(always)]
13182        fn inline_align(_context: fidl::encoding::Context) -> usize {
13183            8
13184        }
13185
13186        #[inline(always)]
13187        fn inline_size(_context: fidl::encoding::Context) -> usize {
13188            16
13189        }
13190    }
13191
13192    unsafe impl
13193        fidl::encoding::Encode<
13194            ScreenshotTakeResponse,
13195            fidl::encoding::DefaultFuchsiaResourceDialect,
13196        > for &mut ScreenshotTakeResponse
13197    {
13198        unsafe fn encode(
13199            self,
13200            encoder: &mut fidl::encoding::Encoder<
13201                '_,
13202                fidl::encoding::DefaultFuchsiaResourceDialect,
13203            >,
13204            offset: usize,
13205            mut depth: fidl::encoding::Depth,
13206        ) -> fidl::Result<()> {
13207            encoder.debug_check_bounds::<ScreenshotTakeResponse>(offset);
13208            // Vector header
13209            let max_ordinal: u64 = self.max_ordinal_present();
13210            encoder.write_num(max_ordinal, offset);
13211            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
13212            // Calling encoder.out_of_line_offset(0) is not allowed.
13213            if max_ordinal == 0 {
13214                return Ok(());
13215            }
13216            depth.increment()?;
13217            let envelope_size = 8;
13218            let bytes_len = max_ordinal as usize * envelope_size;
13219            #[allow(unused_variables)]
13220            let offset = encoder.out_of_line_offset(bytes_len);
13221            let mut _prev_end_offset: usize = 0;
13222            if 1 > max_ordinal {
13223                return Ok(());
13224            }
13225
13226            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
13227            // are envelope_size bytes.
13228            let cur_offset: usize = (1 - 1) * envelope_size;
13229
13230            // Zero reserved fields.
13231            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
13232
13233            // Safety:
13234            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
13235            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
13236            //   envelope_size bytes, there is always sufficient room.
13237            fidl::encoding::encode_in_envelope_optional::<
13238                fidl::encoding::HandleType<
13239                    fidl::Vmo,
13240                    { fidl::ObjectType::VMO.into_raw() },
13241                    2147483648,
13242                >,
13243                fidl::encoding::DefaultFuchsiaResourceDialect,
13244            >(
13245                self.vmo.as_mut().map(
13246                    <fidl::encoding::HandleType<
13247                        fidl::Vmo,
13248                        { fidl::ObjectType::VMO.into_raw() },
13249                        2147483648,
13250                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
13251                ),
13252                encoder,
13253                offset + cur_offset,
13254                depth,
13255            )?;
13256
13257            _prev_end_offset = cur_offset + envelope_size;
13258            if 2 > max_ordinal {
13259                return Ok(());
13260            }
13261
13262            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
13263            // are envelope_size bytes.
13264            let cur_offset: usize = (2 - 1) * envelope_size;
13265
13266            // Zero reserved fields.
13267            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
13268
13269            // Safety:
13270            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
13271            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
13272            //   envelope_size bytes, there is always sufficient room.
13273            fidl::encoding::encode_in_envelope_optional::<
13274                fidl_fuchsia_math::SizeU,
13275                fidl::encoding::DefaultFuchsiaResourceDialect,
13276            >(
13277                self.size
13278                    .as_ref()
13279                    .map(<fidl_fuchsia_math::SizeU as fidl::encoding::ValueTypeMarker>::borrow),
13280                encoder,
13281                offset + cur_offset,
13282                depth,
13283            )?;
13284
13285            _prev_end_offset = cur_offset + envelope_size;
13286
13287            Ok(())
13288        }
13289    }
13290
13291    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
13292        for ScreenshotTakeResponse
13293    {
13294        #[inline(always)]
13295        fn new_empty() -> Self {
13296            Self::default()
13297        }
13298
13299        unsafe fn decode(
13300            &mut self,
13301            decoder: &mut fidl::encoding::Decoder<
13302                '_,
13303                fidl::encoding::DefaultFuchsiaResourceDialect,
13304            >,
13305            offset: usize,
13306            mut depth: fidl::encoding::Depth,
13307        ) -> fidl::Result<()> {
13308            decoder.debug_check_bounds::<Self>(offset);
13309            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
13310                None => return Err(fidl::Error::NotNullable),
13311                Some(len) => len,
13312            };
13313            // Calling decoder.out_of_line_offset(0) is not allowed.
13314            if len == 0 {
13315                return Ok(());
13316            };
13317            depth.increment()?;
13318            let envelope_size = 8;
13319            let bytes_len = len * envelope_size;
13320            let offset = decoder.out_of_line_offset(bytes_len)?;
13321            // Decode the envelope for each type.
13322            let mut _next_ordinal_to_read = 0;
13323            let mut next_offset = offset;
13324            let end_offset = offset + bytes_len;
13325            _next_ordinal_to_read += 1;
13326            if next_offset >= end_offset {
13327                return Ok(());
13328            }
13329
13330            // Decode unknown envelopes for gaps in ordinals.
13331            while _next_ordinal_to_read < 1 {
13332                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13333                _next_ordinal_to_read += 1;
13334                next_offset += envelope_size;
13335            }
13336
13337            let next_out_of_line = decoder.next_out_of_line();
13338            let handles_before = decoder.remaining_handles();
13339            if let Some((inlined, num_bytes, num_handles)) =
13340                fidl::encoding::decode_envelope_header(decoder, next_offset)?
13341            {
13342                let member_inline_size = <fidl::encoding::HandleType<
13343                    fidl::Vmo,
13344                    { fidl::ObjectType::VMO.into_raw() },
13345                    2147483648,
13346                > as fidl::encoding::TypeMarker>::inline_size(
13347                    decoder.context
13348                );
13349                if inlined != (member_inline_size <= 4) {
13350                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
13351                }
13352                let inner_offset;
13353                let mut inner_depth = depth.clone();
13354                if inlined {
13355                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
13356                    inner_offset = next_offset;
13357                } else {
13358                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
13359                    inner_depth.increment()?;
13360                }
13361                let val_ref =
13362                self.vmo.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
13363                fidl::decode!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
13364                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
13365                {
13366                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
13367                }
13368                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
13369                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
13370                }
13371            }
13372
13373            next_offset += envelope_size;
13374            _next_ordinal_to_read += 1;
13375            if next_offset >= end_offset {
13376                return Ok(());
13377            }
13378
13379            // Decode unknown envelopes for gaps in ordinals.
13380            while _next_ordinal_to_read < 2 {
13381                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13382                _next_ordinal_to_read += 1;
13383                next_offset += envelope_size;
13384            }
13385
13386            let next_out_of_line = decoder.next_out_of_line();
13387            let handles_before = decoder.remaining_handles();
13388            if let Some((inlined, num_bytes, num_handles)) =
13389                fidl::encoding::decode_envelope_header(decoder, next_offset)?
13390            {
13391                let member_inline_size =
13392                    <fidl_fuchsia_math::SizeU as fidl::encoding::TypeMarker>::inline_size(
13393                        decoder.context,
13394                    );
13395                if inlined != (member_inline_size <= 4) {
13396                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
13397                }
13398                let inner_offset;
13399                let mut inner_depth = depth.clone();
13400                if inlined {
13401                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
13402                    inner_offset = next_offset;
13403                } else {
13404                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
13405                    inner_depth.increment()?;
13406                }
13407                let val_ref = self.size.get_or_insert_with(|| {
13408                    fidl::new_empty!(
13409                        fidl_fuchsia_math::SizeU,
13410                        fidl::encoding::DefaultFuchsiaResourceDialect
13411                    )
13412                });
13413                fidl::decode!(
13414                    fidl_fuchsia_math::SizeU,
13415                    fidl::encoding::DefaultFuchsiaResourceDialect,
13416                    val_ref,
13417                    decoder,
13418                    inner_offset,
13419                    inner_depth
13420                )?;
13421                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
13422                {
13423                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
13424                }
13425                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
13426                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
13427                }
13428            }
13429
13430            next_offset += envelope_size;
13431
13432            // Decode the remaining unknown envelopes.
13433            while next_offset < end_offset {
13434                _next_ordinal_to_read += 1;
13435                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13436                next_offset += envelope_size;
13437            }
13438
13439            Ok(())
13440        }
13441    }
13442
13443    impl TrustedFlatlandConfig {
13444        #[inline(always)]
13445        fn max_ordinal_present(&self) -> u64 {
13446            if let Some(_) = self.skips_present_credits {
13447                return 3;
13448            }
13449            if let Some(_) = self.pass_acquire_fences {
13450                return 2;
13451            }
13452            if let Some(_) = self.schedule_asap {
13453                return 1;
13454            }
13455            0
13456        }
13457    }
13458
13459    impl fidl::encoding::ResourceTypeMarker for TrustedFlatlandConfig {
13460        type Borrowed<'a> = &'a mut Self;
13461        fn take_or_borrow<'a>(
13462            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
13463        ) -> Self::Borrowed<'a> {
13464            value
13465        }
13466    }
13467
13468    unsafe impl fidl::encoding::TypeMarker for TrustedFlatlandConfig {
13469        type Owned = Self;
13470
13471        #[inline(always)]
13472        fn inline_align(_context: fidl::encoding::Context) -> usize {
13473            8
13474        }
13475
13476        #[inline(always)]
13477        fn inline_size(_context: fidl::encoding::Context) -> usize {
13478            16
13479        }
13480    }
13481
13482    unsafe impl
13483        fidl::encoding::Encode<TrustedFlatlandConfig, fidl::encoding::DefaultFuchsiaResourceDialect>
13484        for &mut TrustedFlatlandConfig
13485    {
13486        unsafe fn encode(
13487            self,
13488            encoder: &mut fidl::encoding::Encoder<
13489                '_,
13490                fidl::encoding::DefaultFuchsiaResourceDialect,
13491            >,
13492            offset: usize,
13493            mut depth: fidl::encoding::Depth,
13494        ) -> fidl::Result<()> {
13495            encoder.debug_check_bounds::<TrustedFlatlandConfig>(offset);
13496            // Vector header
13497            let max_ordinal: u64 = self.max_ordinal_present();
13498            encoder.write_num(max_ordinal, offset);
13499            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
13500            // Calling encoder.out_of_line_offset(0) is not allowed.
13501            if max_ordinal == 0 {
13502                return Ok(());
13503            }
13504            depth.increment()?;
13505            let envelope_size = 8;
13506            let bytes_len = max_ordinal as usize * envelope_size;
13507            #[allow(unused_variables)]
13508            let offset = encoder.out_of_line_offset(bytes_len);
13509            let mut _prev_end_offset: usize = 0;
13510            if 1 > max_ordinal {
13511                return Ok(());
13512            }
13513
13514            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
13515            // are envelope_size bytes.
13516            let cur_offset: usize = (1 - 1) * envelope_size;
13517
13518            // Zero reserved fields.
13519            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
13520
13521            // Safety:
13522            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
13523            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
13524            //   envelope_size bytes, there is always sufficient room.
13525            fidl::encoding::encode_in_envelope_optional::<
13526                bool,
13527                fidl::encoding::DefaultFuchsiaResourceDialect,
13528            >(
13529                self.schedule_asap.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
13530                encoder,
13531                offset + cur_offset,
13532                depth,
13533            )?;
13534
13535            _prev_end_offset = cur_offset + envelope_size;
13536            if 2 > max_ordinal {
13537                return Ok(());
13538            }
13539
13540            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
13541            // are envelope_size bytes.
13542            let cur_offset: usize = (2 - 1) * envelope_size;
13543
13544            // Zero reserved fields.
13545            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
13546
13547            // Safety:
13548            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
13549            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
13550            //   envelope_size bytes, there is always sufficient room.
13551            fidl::encoding::encode_in_envelope_optional::<
13552                bool,
13553                fidl::encoding::DefaultFuchsiaResourceDialect,
13554            >(
13555                self.pass_acquire_fences
13556                    .as_ref()
13557                    .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
13558                encoder,
13559                offset + cur_offset,
13560                depth,
13561            )?;
13562
13563            _prev_end_offset = cur_offset + envelope_size;
13564            if 3 > max_ordinal {
13565                return Ok(());
13566            }
13567
13568            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
13569            // are envelope_size bytes.
13570            let cur_offset: usize = (3 - 1) * envelope_size;
13571
13572            // Zero reserved fields.
13573            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
13574
13575            // Safety:
13576            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
13577            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
13578            //   envelope_size bytes, there is always sufficient room.
13579            fidl::encoding::encode_in_envelope_optional::<
13580                bool,
13581                fidl::encoding::DefaultFuchsiaResourceDialect,
13582            >(
13583                self.skips_present_credits
13584                    .as_ref()
13585                    .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
13586                encoder,
13587                offset + cur_offset,
13588                depth,
13589            )?;
13590
13591            _prev_end_offset = cur_offset + envelope_size;
13592
13593            Ok(())
13594        }
13595    }
13596
13597    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
13598        for TrustedFlatlandConfig
13599    {
13600        #[inline(always)]
13601        fn new_empty() -> Self {
13602            Self::default()
13603        }
13604
13605        unsafe fn decode(
13606            &mut self,
13607            decoder: &mut fidl::encoding::Decoder<
13608                '_,
13609                fidl::encoding::DefaultFuchsiaResourceDialect,
13610            >,
13611            offset: usize,
13612            mut depth: fidl::encoding::Depth,
13613        ) -> fidl::Result<()> {
13614            decoder.debug_check_bounds::<Self>(offset);
13615            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
13616                None => return Err(fidl::Error::NotNullable),
13617                Some(len) => len,
13618            };
13619            // Calling decoder.out_of_line_offset(0) is not allowed.
13620            if len == 0 {
13621                return Ok(());
13622            };
13623            depth.increment()?;
13624            let envelope_size = 8;
13625            let bytes_len = len * envelope_size;
13626            let offset = decoder.out_of_line_offset(bytes_len)?;
13627            // Decode the envelope for each type.
13628            let mut _next_ordinal_to_read = 0;
13629            let mut next_offset = offset;
13630            let end_offset = offset + bytes_len;
13631            _next_ordinal_to_read += 1;
13632            if next_offset >= end_offset {
13633                return Ok(());
13634            }
13635
13636            // Decode unknown envelopes for gaps in ordinals.
13637            while _next_ordinal_to_read < 1 {
13638                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13639                _next_ordinal_to_read += 1;
13640                next_offset += envelope_size;
13641            }
13642
13643            let next_out_of_line = decoder.next_out_of_line();
13644            let handles_before = decoder.remaining_handles();
13645            if let Some((inlined, num_bytes, num_handles)) =
13646                fidl::encoding::decode_envelope_header(decoder, next_offset)?
13647            {
13648                let member_inline_size =
13649                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
13650                if inlined != (member_inline_size <= 4) {
13651                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
13652                }
13653                let inner_offset;
13654                let mut inner_depth = depth.clone();
13655                if inlined {
13656                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
13657                    inner_offset = next_offset;
13658                } else {
13659                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
13660                    inner_depth.increment()?;
13661                }
13662                let val_ref = self.schedule_asap.get_or_insert_with(|| {
13663                    fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
13664                });
13665                fidl::decode!(
13666                    bool,
13667                    fidl::encoding::DefaultFuchsiaResourceDialect,
13668                    val_ref,
13669                    decoder,
13670                    inner_offset,
13671                    inner_depth
13672                )?;
13673                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
13674                {
13675                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
13676                }
13677                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
13678                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
13679                }
13680            }
13681
13682            next_offset += envelope_size;
13683            _next_ordinal_to_read += 1;
13684            if next_offset >= end_offset {
13685                return Ok(());
13686            }
13687
13688            // Decode unknown envelopes for gaps in ordinals.
13689            while _next_ordinal_to_read < 2 {
13690                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13691                _next_ordinal_to_read += 1;
13692                next_offset += envelope_size;
13693            }
13694
13695            let next_out_of_line = decoder.next_out_of_line();
13696            let handles_before = decoder.remaining_handles();
13697            if let Some((inlined, num_bytes, num_handles)) =
13698                fidl::encoding::decode_envelope_header(decoder, next_offset)?
13699            {
13700                let member_inline_size =
13701                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
13702                if inlined != (member_inline_size <= 4) {
13703                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
13704                }
13705                let inner_offset;
13706                let mut inner_depth = depth.clone();
13707                if inlined {
13708                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
13709                    inner_offset = next_offset;
13710                } else {
13711                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
13712                    inner_depth.increment()?;
13713                }
13714                let val_ref = self.pass_acquire_fences.get_or_insert_with(|| {
13715                    fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
13716                });
13717                fidl::decode!(
13718                    bool,
13719                    fidl::encoding::DefaultFuchsiaResourceDialect,
13720                    val_ref,
13721                    decoder,
13722                    inner_offset,
13723                    inner_depth
13724                )?;
13725                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
13726                {
13727                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
13728                }
13729                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
13730                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
13731                }
13732            }
13733
13734            next_offset += envelope_size;
13735            _next_ordinal_to_read += 1;
13736            if next_offset >= end_offset {
13737                return Ok(());
13738            }
13739
13740            // Decode unknown envelopes for gaps in ordinals.
13741            while _next_ordinal_to_read < 3 {
13742                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13743                _next_ordinal_to_read += 1;
13744                next_offset += envelope_size;
13745            }
13746
13747            let next_out_of_line = decoder.next_out_of_line();
13748            let handles_before = decoder.remaining_handles();
13749            if let Some((inlined, num_bytes, num_handles)) =
13750                fidl::encoding::decode_envelope_header(decoder, next_offset)?
13751            {
13752                let member_inline_size =
13753                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
13754                if inlined != (member_inline_size <= 4) {
13755                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
13756                }
13757                let inner_offset;
13758                let mut inner_depth = depth.clone();
13759                if inlined {
13760                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
13761                    inner_offset = next_offset;
13762                } else {
13763                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
13764                    inner_depth.increment()?;
13765                }
13766                let val_ref = self.skips_present_credits.get_or_insert_with(|| {
13767                    fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
13768                });
13769                fidl::decode!(
13770                    bool,
13771                    fidl::encoding::DefaultFuchsiaResourceDialect,
13772                    val_ref,
13773                    decoder,
13774                    inner_offset,
13775                    inner_depth
13776                )?;
13777                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
13778                {
13779                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
13780                }
13781                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
13782                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
13783                }
13784            }
13785
13786            next_offset += envelope_size;
13787
13788            // Decode the remaining unknown envelopes.
13789            while next_offset < end_offset {
13790                _next_ordinal_to_read += 1;
13791                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13792                next_offset += envelope_size;
13793            }
13794
13795            Ok(())
13796        }
13797    }
13798
13799    impl ViewBoundProtocols {
13800        #[inline(always)]
13801        fn max_ordinal_present(&self) -> u64 {
13802            if let Some(_) = self.mouse_source {
13803                return 4;
13804            }
13805            if let Some(_) = self.touch_source {
13806                return 3;
13807            }
13808            if let Some(_) = self.view_focuser {
13809                return 2;
13810            }
13811            if let Some(_) = self.view_ref_focused {
13812                return 1;
13813            }
13814            0
13815        }
13816    }
13817
13818    impl fidl::encoding::ResourceTypeMarker for ViewBoundProtocols {
13819        type Borrowed<'a> = &'a mut Self;
13820        fn take_or_borrow<'a>(
13821            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
13822        ) -> Self::Borrowed<'a> {
13823            value
13824        }
13825    }
13826
13827    unsafe impl fidl::encoding::TypeMarker for ViewBoundProtocols {
13828        type Owned = Self;
13829
13830        #[inline(always)]
13831        fn inline_align(_context: fidl::encoding::Context) -> usize {
13832            8
13833        }
13834
13835        #[inline(always)]
13836        fn inline_size(_context: fidl::encoding::Context) -> usize {
13837            16
13838        }
13839    }
13840
13841    unsafe impl
13842        fidl::encoding::Encode<ViewBoundProtocols, fidl::encoding::DefaultFuchsiaResourceDialect>
13843        for &mut ViewBoundProtocols
13844    {
13845        unsafe fn encode(
13846            self,
13847            encoder: &mut fidl::encoding::Encoder<
13848                '_,
13849                fidl::encoding::DefaultFuchsiaResourceDialect,
13850            >,
13851            offset: usize,
13852            mut depth: fidl::encoding::Depth,
13853        ) -> fidl::Result<()> {
13854            encoder.debug_check_bounds::<ViewBoundProtocols>(offset);
13855            // Vector header
13856            let max_ordinal: u64 = self.max_ordinal_present();
13857            encoder.write_num(max_ordinal, offset);
13858            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
13859            // Calling encoder.out_of_line_offset(0) is not allowed.
13860            if max_ordinal == 0 {
13861                return Ok(());
13862            }
13863            depth.increment()?;
13864            let envelope_size = 8;
13865            let bytes_len = max_ordinal as usize * envelope_size;
13866            #[allow(unused_variables)]
13867            let offset = encoder.out_of_line_offset(bytes_len);
13868            let mut _prev_end_offset: usize = 0;
13869            if 1 > max_ordinal {
13870                return Ok(());
13871            }
13872
13873            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
13874            // are envelope_size bytes.
13875            let cur_offset: usize = (1 - 1) * envelope_size;
13876
13877            // Zero reserved fields.
13878            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
13879
13880            // Safety:
13881            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
13882            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
13883            //   envelope_size bytes, there is always sufficient room.
13884            fidl::encoding::encode_in_envelope_optional::<
13885                fidl::encoding::Endpoint<
13886                    fidl::endpoints::ServerEnd<fidl_fuchsia_ui_views::ViewRefFocusedMarker>,
13887                >,
13888                fidl::encoding::DefaultFuchsiaResourceDialect,
13889            >(
13890                self.view_ref_focused.as_mut().map(
13891                    <fidl::encoding::Endpoint<
13892                        fidl::endpoints::ServerEnd<fidl_fuchsia_ui_views::ViewRefFocusedMarker>,
13893                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
13894                ),
13895                encoder,
13896                offset + cur_offset,
13897                depth,
13898            )?;
13899
13900            _prev_end_offset = cur_offset + envelope_size;
13901            if 2 > max_ordinal {
13902                return Ok(());
13903            }
13904
13905            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
13906            // are envelope_size bytes.
13907            let cur_offset: usize = (2 - 1) * envelope_size;
13908
13909            // Zero reserved fields.
13910            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
13911
13912            // Safety:
13913            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
13914            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
13915            //   envelope_size bytes, there is always sufficient room.
13916            fidl::encoding::encode_in_envelope_optional::<
13917                fidl::encoding::Endpoint<
13918                    fidl::endpoints::ServerEnd<fidl_fuchsia_ui_views::FocuserMarker>,
13919                >,
13920                fidl::encoding::DefaultFuchsiaResourceDialect,
13921            >(
13922                self.view_focuser.as_mut().map(
13923                    <fidl::encoding::Endpoint<
13924                        fidl::endpoints::ServerEnd<fidl_fuchsia_ui_views::FocuserMarker>,
13925                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
13926                ),
13927                encoder,
13928                offset + cur_offset,
13929                depth,
13930            )?;
13931
13932            _prev_end_offset = cur_offset + envelope_size;
13933            if 3 > max_ordinal {
13934                return Ok(());
13935            }
13936
13937            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
13938            // are envelope_size bytes.
13939            let cur_offset: usize = (3 - 1) * envelope_size;
13940
13941            // Zero reserved fields.
13942            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
13943
13944            // Safety:
13945            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
13946            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
13947            //   envelope_size bytes, there is always sufficient room.
13948            fidl::encoding::encode_in_envelope_optional::<
13949                fidl::encoding::Endpoint<
13950                    fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::TouchSourceMarker>,
13951                >,
13952                fidl::encoding::DefaultFuchsiaResourceDialect,
13953            >(
13954                self.touch_source.as_mut().map(
13955                    <fidl::encoding::Endpoint<
13956                        fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::TouchSourceMarker>,
13957                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
13958                ),
13959                encoder,
13960                offset + cur_offset,
13961                depth,
13962            )?;
13963
13964            _prev_end_offset = cur_offset + envelope_size;
13965            if 4 > max_ordinal {
13966                return Ok(());
13967            }
13968
13969            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
13970            // are envelope_size bytes.
13971            let cur_offset: usize = (4 - 1) * envelope_size;
13972
13973            // Zero reserved fields.
13974            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
13975
13976            // Safety:
13977            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
13978            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
13979            //   envelope_size bytes, there is always sufficient room.
13980            fidl::encoding::encode_in_envelope_optional::<
13981                fidl::encoding::Endpoint<
13982                    fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::MouseSourceMarker>,
13983                >,
13984                fidl::encoding::DefaultFuchsiaResourceDialect,
13985            >(
13986                self.mouse_source.as_mut().map(
13987                    <fidl::encoding::Endpoint<
13988                        fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::MouseSourceMarker>,
13989                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
13990                ),
13991                encoder,
13992                offset + cur_offset,
13993                depth,
13994            )?;
13995
13996            _prev_end_offset = cur_offset + envelope_size;
13997
13998            Ok(())
13999        }
14000    }
14001
14002    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
14003        for ViewBoundProtocols
14004    {
14005        #[inline(always)]
14006        fn new_empty() -> Self {
14007            Self::default()
14008        }
14009
14010        unsafe fn decode(
14011            &mut self,
14012            decoder: &mut fidl::encoding::Decoder<
14013                '_,
14014                fidl::encoding::DefaultFuchsiaResourceDialect,
14015            >,
14016            offset: usize,
14017            mut depth: fidl::encoding::Depth,
14018        ) -> fidl::Result<()> {
14019            decoder.debug_check_bounds::<Self>(offset);
14020            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
14021                None => return Err(fidl::Error::NotNullable),
14022                Some(len) => len,
14023            };
14024            // Calling decoder.out_of_line_offset(0) is not allowed.
14025            if len == 0 {
14026                return Ok(());
14027            };
14028            depth.increment()?;
14029            let envelope_size = 8;
14030            let bytes_len = len * envelope_size;
14031            let offset = decoder.out_of_line_offset(bytes_len)?;
14032            // Decode the envelope for each type.
14033            let mut _next_ordinal_to_read = 0;
14034            let mut next_offset = offset;
14035            let end_offset = offset + bytes_len;
14036            _next_ordinal_to_read += 1;
14037            if next_offset >= end_offset {
14038                return Ok(());
14039            }
14040
14041            // Decode unknown envelopes for gaps in ordinals.
14042            while _next_ordinal_to_read < 1 {
14043                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
14044                _next_ordinal_to_read += 1;
14045                next_offset += envelope_size;
14046            }
14047
14048            let next_out_of_line = decoder.next_out_of_line();
14049            let handles_before = decoder.remaining_handles();
14050            if let Some((inlined, num_bytes, num_handles)) =
14051                fidl::encoding::decode_envelope_header(decoder, next_offset)?
14052            {
14053                let member_inline_size = <fidl::encoding::Endpoint<
14054                    fidl::endpoints::ServerEnd<fidl_fuchsia_ui_views::ViewRefFocusedMarker>,
14055                > as fidl::encoding::TypeMarker>::inline_size(
14056                    decoder.context
14057                );
14058                if inlined != (member_inline_size <= 4) {
14059                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
14060                }
14061                let inner_offset;
14062                let mut inner_depth = depth.clone();
14063                if inlined {
14064                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
14065                    inner_offset = next_offset;
14066                } else {
14067                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
14068                    inner_depth.increment()?;
14069                }
14070                let val_ref = self.view_ref_focused.get_or_insert_with(|| {
14071                    fidl::new_empty!(
14072                        fidl::encoding::Endpoint<
14073                            fidl::endpoints::ServerEnd<fidl_fuchsia_ui_views::ViewRefFocusedMarker>,
14074                        >,
14075                        fidl::encoding::DefaultFuchsiaResourceDialect
14076                    )
14077                });
14078                fidl::decode!(
14079                    fidl::encoding::Endpoint<
14080                        fidl::endpoints::ServerEnd<fidl_fuchsia_ui_views::ViewRefFocusedMarker>,
14081                    >,
14082                    fidl::encoding::DefaultFuchsiaResourceDialect,
14083                    val_ref,
14084                    decoder,
14085                    inner_offset,
14086                    inner_depth
14087                )?;
14088                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
14089                {
14090                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
14091                }
14092                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
14093                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
14094                }
14095            }
14096
14097            next_offset += envelope_size;
14098            _next_ordinal_to_read += 1;
14099            if next_offset >= end_offset {
14100                return Ok(());
14101            }
14102
14103            // Decode unknown envelopes for gaps in ordinals.
14104            while _next_ordinal_to_read < 2 {
14105                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
14106                _next_ordinal_to_read += 1;
14107                next_offset += envelope_size;
14108            }
14109
14110            let next_out_of_line = decoder.next_out_of_line();
14111            let handles_before = decoder.remaining_handles();
14112            if let Some((inlined, num_bytes, num_handles)) =
14113                fidl::encoding::decode_envelope_header(decoder, next_offset)?
14114            {
14115                let member_inline_size = <fidl::encoding::Endpoint<
14116                    fidl::endpoints::ServerEnd<fidl_fuchsia_ui_views::FocuserMarker>,
14117                > as fidl::encoding::TypeMarker>::inline_size(
14118                    decoder.context
14119                );
14120                if inlined != (member_inline_size <= 4) {
14121                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
14122                }
14123                let inner_offset;
14124                let mut inner_depth = depth.clone();
14125                if inlined {
14126                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
14127                    inner_offset = next_offset;
14128                } else {
14129                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
14130                    inner_depth.increment()?;
14131                }
14132                let val_ref = self.view_focuser.get_or_insert_with(|| {
14133                    fidl::new_empty!(
14134                        fidl::encoding::Endpoint<
14135                            fidl::endpoints::ServerEnd<fidl_fuchsia_ui_views::FocuserMarker>,
14136                        >,
14137                        fidl::encoding::DefaultFuchsiaResourceDialect
14138                    )
14139                });
14140                fidl::decode!(
14141                    fidl::encoding::Endpoint<
14142                        fidl::endpoints::ServerEnd<fidl_fuchsia_ui_views::FocuserMarker>,
14143                    >,
14144                    fidl::encoding::DefaultFuchsiaResourceDialect,
14145                    val_ref,
14146                    decoder,
14147                    inner_offset,
14148                    inner_depth
14149                )?;
14150                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
14151                {
14152                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
14153                }
14154                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
14155                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
14156                }
14157            }
14158
14159            next_offset += envelope_size;
14160            _next_ordinal_to_read += 1;
14161            if next_offset >= end_offset {
14162                return Ok(());
14163            }
14164
14165            // Decode unknown envelopes for gaps in ordinals.
14166            while _next_ordinal_to_read < 3 {
14167                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
14168                _next_ordinal_to_read += 1;
14169                next_offset += envelope_size;
14170            }
14171
14172            let next_out_of_line = decoder.next_out_of_line();
14173            let handles_before = decoder.remaining_handles();
14174            if let Some((inlined, num_bytes, num_handles)) =
14175                fidl::encoding::decode_envelope_header(decoder, next_offset)?
14176            {
14177                let member_inline_size = <fidl::encoding::Endpoint<
14178                    fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::TouchSourceMarker>,
14179                > as fidl::encoding::TypeMarker>::inline_size(
14180                    decoder.context
14181                );
14182                if inlined != (member_inline_size <= 4) {
14183                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
14184                }
14185                let inner_offset;
14186                let mut inner_depth = depth.clone();
14187                if inlined {
14188                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
14189                    inner_offset = next_offset;
14190                } else {
14191                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
14192                    inner_depth.increment()?;
14193                }
14194                let val_ref = self.touch_source.get_or_insert_with(|| {
14195                    fidl::new_empty!(
14196                        fidl::encoding::Endpoint<
14197                            fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::TouchSourceMarker>,
14198                        >,
14199                        fidl::encoding::DefaultFuchsiaResourceDialect
14200                    )
14201                });
14202                fidl::decode!(
14203                    fidl::encoding::Endpoint<
14204                        fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::TouchSourceMarker>,
14205                    >,
14206                    fidl::encoding::DefaultFuchsiaResourceDialect,
14207                    val_ref,
14208                    decoder,
14209                    inner_offset,
14210                    inner_depth
14211                )?;
14212                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
14213                {
14214                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
14215                }
14216                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
14217                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
14218                }
14219            }
14220
14221            next_offset += envelope_size;
14222            _next_ordinal_to_read += 1;
14223            if next_offset >= end_offset {
14224                return Ok(());
14225            }
14226
14227            // Decode unknown envelopes for gaps in ordinals.
14228            while _next_ordinal_to_read < 4 {
14229                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
14230                _next_ordinal_to_read += 1;
14231                next_offset += envelope_size;
14232            }
14233
14234            let next_out_of_line = decoder.next_out_of_line();
14235            let handles_before = decoder.remaining_handles();
14236            if let Some((inlined, num_bytes, num_handles)) =
14237                fidl::encoding::decode_envelope_header(decoder, next_offset)?
14238            {
14239                let member_inline_size = <fidl::encoding::Endpoint<
14240                    fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::MouseSourceMarker>,
14241                > as fidl::encoding::TypeMarker>::inline_size(
14242                    decoder.context
14243                );
14244                if inlined != (member_inline_size <= 4) {
14245                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
14246                }
14247                let inner_offset;
14248                let mut inner_depth = depth.clone();
14249                if inlined {
14250                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
14251                    inner_offset = next_offset;
14252                } else {
14253                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
14254                    inner_depth.increment()?;
14255                }
14256                let val_ref = self.mouse_source.get_or_insert_with(|| {
14257                    fidl::new_empty!(
14258                        fidl::encoding::Endpoint<
14259                            fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::MouseSourceMarker>,
14260                        >,
14261                        fidl::encoding::DefaultFuchsiaResourceDialect
14262                    )
14263                });
14264                fidl::decode!(
14265                    fidl::encoding::Endpoint<
14266                        fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::MouseSourceMarker>,
14267                    >,
14268                    fidl::encoding::DefaultFuchsiaResourceDialect,
14269                    val_ref,
14270                    decoder,
14271                    inner_offset,
14272                    inner_depth
14273                )?;
14274                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
14275                {
14276                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
14277                }
14278                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
14279                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
14280                }
14281            }
14282
14283            next_offset += envelope_size;
14284
14285            // Decode the remaining unknown envelopes.
14286            while next_offset < end_offset {
14287                _next_ordinal_to_read += 1;
14288                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
14289                next_offset += envelope_size;
14290            }
14291
14292            Ok(())
14293        }
14294    }
14295}