Skip to main content

fidl_fuchsia_hardware_display/
fidl_fuchsia_hardware_display.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_hardware_display__common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
15pub struct CoordinatorImportBufferCollectionRequest {
16    pub buffer_collection_id: BufferCollectionId,
17    pub buffer_collection_token:
18        fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem2::BufferCollectionTokenMarker>,
19}
20
21impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
22    for CoordinatorImportBufferCollectionRequest
23{
24}
25
26#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
27pub struct CoordinatorImportEventRequest {
28    pub event: fidl::Event,
29    pub id: EventId,
30}
31
32impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
33    for CoordinatorImportEventRequest
34{
35}
36
37#[derive(Debug, Default, PartialEq)]
38pub struct CoordinatorCommitConfigRequest {
39    /// Required. Must be valid and strictly monotonically-increasing.
40    pub stamp: Option<ConfigStamp>,
41    #[doc(hidden)]
42    pub __source_breaking: fidl::marker::SourceBreaking,
43}
44
45impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
46    for CoordinatorCommitConfigRequest
47{
48}
49
50#[derive(Debug, Default, PartialEq)]
51pub struct ProviderOpenCoordinatorRequest {
52    /// Required.
53    pub coordinator: Option<fidl::endpoints::ServerEnd<CoordinatorMarker>>,
54    /// Required.
55    pub coordinator_listener: Option<fidl::endpoints::ClientEnd<CoordinatorListenerMarker>>,
56    /// Required. Must be a valid priority.
57    pub priority: Option<ClientPriority>,
58    #[doc(hidden)]
59    pub __source_breaking: fidl::marker::SourceBreaking,
60}
61
62impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
63    for ProviderOpenCoordinatorRequest
64{
65}
66
67#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
68pub struct CoordinatorMarker;
69
70impl fidl::endpoints::ProtocolMarker for CoordinatorMarker {
71    type Proxy = CoordinatorProxy;
72    type RequestStream = CoordinatorRequestStream;
73    #[cfg(target_os = "fuchsia")]
74    type SynchronousProxy = CoordinatorSynchronousProxy;
75
76    const DEBUG_NAME: &'static str = "(anonymous) Coordinator";
77}
78pub type CoordinatorImportImageResult = Result<(), i32>;
79pub type CoordinatorCreateLayerResult = Result<(), i32>;
80pub type CoordinatorImportBufferCollectionResult = Result<(), i32>;
81pub type CoordinatorSetBufferCollectionConstraintsResult = Result<(), i32>;
82pub type CoordinatorIsCaptureSupportedResult = Result<bool, i32>;
83pub type CoordinatorStartCaptureResult = Result<(), i32>;
84pub type CoordinatorSetMinimumRgbResult = Result<(), i32>;
85pub type CoordinatorSetDisplayPowerModeResult = Result<(), i32>;
86
87pub trait CoordinatorProxyInterface: Send + Sync {
88    type ImportImageResponseFut: std::future::Future<Output = Result<CoordinatorImportImageResult, fidl::Error>>
89        + Send;
90    fn r#import_image(
91        &self,
92        image_metadata: &fidl_fuchsia_hardware_display_types::ImageMetadata,
93        buffer_collection_id: &BufferCollectionId,
94        buffer_index: u32,
95        image_id: &ImageId,
96    ) -> Self::ImportImageResponseFut;
97    fn r#release_image(&self, image_id: &ImageId) -> Result<(), fidl::Error>;
98    fn r#import_event(&self, event: fidl::Event, id: &EventId) -> Result<(), fidl::Error>;
99    fn r#release_event(&self, id: &EventId) -> Result<(), fidl::Error>;
100    type CreateLayerResponseFut: std::future::Future<Output = Result<CoordinatorCreateLayerResult, fidl::Error>>
101        + Send;
102    fn r#create_layer(&self, layer_id: &LayerId) -> Self::CreateLayerResponseFut;
103    fn r#destroy_layer(&self, layer_id: &LayerId) -> Result<(), fidl::Error>;
104    fn r#set_display_mode(
105        &self,
106        display_id: &fidl_fuchsia_hardware_display_types::DisplayId,
107        mode: &fidl_fuchsia_hardware_display_types::Mode,
108    ) -> Result<(), fidl::Error>;
109    fn r#set_display_color_conversion(
110        &self,
111        display_id: &fidl_fuchsia_hardware_display_types::DisplayId,
112        preoffsets: &[f32; 3],
113        coefficients: &[f32; 9],
114        postoffsets: &[f32; 3],
115    ) -> Result<(), fidl::Error>;
116    fn r#set_display_layers(
117        &self,
118        display_id: &fidl_fuchsia_hardware_display_types::DisplayId,
119        layer_ids: &[LayerId],
120    ) -> Result<(), fidl::Error>;
121    fn r#set_layer_primary_config(
122        &self,
123        layer_id: &LayerId,
124        image_metadata: &fidl_fuchsia_hardware_display_types::ImageMetadata,
125    ) -> Result<(), fidl::Error>;
126    fn r#set_layer_primary_position(
127        &self,
128        layer_id: &LayerId,
129        image_source_transformation: fidl_fuchsia_hardware_display_types::CoordinateTransformation,
130        image_source: &fidl_fuchsia_math::RectU,
131        display_destination: &fidl_fuchsia_math::RectU,
132    ) -> Result<(), fidl::Error>;
133    fn r#set_layer_primary_alpha(
134        &self,
135        layer_id: &LayerId,
136        mode: fidl_fuchsia_hardware_display_types::AlphaMode,
137        val: f32,
138    ) -> Result<(), fidl::Error>;
139    fn r#set_layer_color_config(
140        &self,
141        layer_id: &LayerId,
142        color: &fidl_fuchsia_hardware_display_types::Color,
143        display_destination: &fidl_fuchsia_math::RectU,
144    ) -> Result<(), fidl::Error>;
145    fn r#set_layer_image2(
146        &self,
147        layer_id: &LayerId,
148        image_id: &ImageId,
149        wait_event_id: &EventId,
150    ) -> Result<(), fidl::Error>;
151    type CheckConfigResponseFut: std::future::Future<
152            Output = Result<fidl_fuchsia_hardware_display_types::ConfigResult, fidl::Error>,
153        > + Send;
154    fn r#check_config(&self) -> Self::CheckConfigResponseFut;
155    fn r#discard_config(&self) -> Result<(), fidl::Error>;
156    type GetLatestCommittedConfigStampResponseFut: std::future::Future<Output = Result<ConfigStamp, fidl::Error>>
157        + Send;
158    fn r#get_latest_committed_config_stamp(&self)
159    -> Self::GetLatestCommittedConfigStampResponseFut;
160    fn r#commit_config(&self, payload: CoordinatorCommitConfigRequest) -> Result<(), fidl::Error>;
161    fn r#acknowledge_vsync(&self, cookie: u64) -> Result<(), fidl::Error>;
162    type ImportBufferCollectionResponseFut: std::future::Future<Output = Result<CoordinatorImportBufferCollectionResult, fidl::Error>>
163        + Send;
164    fn r#import_buffer_collection(
165        &self,
166        buffer_collection_id: &BufferCollectionId,
167        buffer_collection_token: fidl::endpoints::ClientEnd<
168            fidl_fuchsia_sysmem2::BufferCollectionTokenMarker,
169        >,
170    ) -> Self::ImportBufferCollectionResponseFut;
171    fn r#release_buffer_collection(
172        &self,
173        buffer_collection_id: &BufferCollectionId,
174    ) -> Result<(), fidl::Error>;
175    type SetBufferCollectionConstraintsResponseFut: std::future::Future<
176            Output = Result<CoordinatorSetBufferCollectionConstraintsResult, fidl::Error>,
177        > + Send;
178    fn r#set_buffer_collection_constraints(
179        &self,
180        buffer_collection_id: &BufferCollectionId,
181        buffer_usage: &fidl_fuchsia_hardware_display_types::ImageBufferUsage,
182    ) -> Self::SetBufferCollectionConstraintsResponseFut;
183    type IsCaptureSupportedResponseFut: std::future::Future<Output = Result<CoordinatorIsCaptureSupportedResult, fidl::Error>>
184        + Send;
185    fn r#is_capture_supported(&self) -> Self::IsCaptureSupportedResponseFut;
186    type StartCaptureResponseFut: std::future::Future<Output = Result<CoordinatorStartCaptureResult, fidl::Error>>
187        + Send;
188    fn r#start_capture(
189        &self,
190        signal_event_id: &EventId,
191        image_id: &ImageId,
192    ) -> Self::StartCaptureResponseFut;
193    type SetMinimumRgbResponseFut: std::future::Future<Output = Result<CoordinatorSetMinimumRgbResult, fidl::Error>>
194        + Send;
195    fn r#set_minimum_rgb(&self, minimum_rgb: u8) -> Self::SetMinimumRgbResponseFut;
196    type SetDisplayPowerModeResponseFut: std::future::Future<Output = Result<CoordinatorSetDisplayPowerModeResult, fidl::Error>>
197        + Send;
198    fn r#set_display_power_mode(
199        &self,
200        display_id: &fidl_fuchsia_hardware_display_types::DisplayId,
201        power_mode: fidl_fuchsia_hardware_display_types::PowerMode,
202    ) -> Self::SetDisplayPowerModeResponseFut;
203}
204#[derive(Debug)]
205#[cfg(target_os = "fuchsia")]
206pub struct CoordinatorSynchronousProxy {
207    client: fidl::client::sync::Client,
208}
209
210#[cfg(target_os = "fuchsia")]
211impl fidl::endpoints::SynchronousProxy for CoordinatorSynchronousProxy {
212    type Proxy = CoordinatorProxy;
213    type Protocol = CoordinatorMarker;
214
215    fn from_channel(inner: fidl::Channel) -> Self {
216        Self::new(inner)
217    }
218
219    fn into_channel(self) -> fidl::Channel {
220        self.client.into_channel()
221    }
222
223    fn as_channel(&self) -> &fidl::Channel {
224        self.client.as_channel()
225    }
226}
227
228#[cfg(target_os = "fuchsia")]
229impl CoordinatorSynchronousProxy {
230    pub fn new(channel: fidl::Channel) -> Self {
231        Self { client: fidl::client::sync::Client::new(channel) }
232    }
233
234    pub fn into_channel(self) -> fidl::Channel {
235        self.client.into_channel()
236    }
237
238    /// Waits until an event arrives and returns it. It is safe for other
239    /// threads to make concurrent requests while waiting for an event.
240    pub fn wait_for_event(
241        &self,
242        deadline: zx::MonotonicInstant,
243    ) -> Result<CoordinatorEvent, fidl::Error> {
244        CoordinatorEvent::decode(self.client.wait_for_event::<CoordinatorMarker>(deadline)?)
245    }
246
247    /// Imports a Buffer-Collection backed image.
248    ///
249    /// Returns `ZX_ERR_NOT_SUPPORTED` if the display hardware doesn't support
250    /// `image_metadata`.
251    /// Returns `ZX_ERR_ALREADY_EXISTS` if `image_id` was used in a successful
252    /// `ImportImage()` without a corresponding `ReleaseImage()`.
253    /// Returns `ZX_ERR_NO_MEMORY` if memory cannot be allocated for managing the image
254    /// Additionally, this method delegates internally to `fuchsia.hardware.display.engine/Engine`,
255    /// and will forward errors received from `ImportImage()` and `ImportImageForCapture()`.
256    ///
257    /// The implementation must ignore any Sysmem information around weak VMO
258    /// handles. Display stack consumers are responsible for ensuring that weak
259    /// VMOs are closed in a timely manner, which may involve calling
260    /// [`Coordinator.ReleaseImage`] and [`Coordinator.CommitConfig`].
261    pub fn r#import_image(
262        &self,
263        mut image_metadata: &fidl_fuchsia_hardware_display_types::ImageMetadata,
264        mut buffer_collection_id: &BufferCollectionId,
265        mut buffer_index: u32,
266        mut image_id: &ImageId,
267        ___deadline: zx::MonotonicInstant,
268    ) -> Result<CoordinatorImportImageResult, fidl::Error> {
269        let _response = self.client.send_query::<
270            CoordinatorImportImageRequest,
271            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
272            CoordinatorMarker,
273        >(
274            (image_metadata, buffer_collection_id, buffer_index, image_id,),
275            0x3a8636eb9656b4f4,
276            fidl::encoding::DynamicFlags::empty(),
277            ___deadline,
278        )?;
279        Ok(_response.map(|x| x))
280    }
281
282    /// Releases an imported image.
283    ///
284    /// `image_id` must be already imported by
285    /// [`fuchsia.hardware.display/Coordinator.ImportImage`].
286    ///
287    /// The image must not be the capture target of an ongoing capture specified
288    /// in [`fuchsia.hardware.display/Coordinator.StartCapture`].
289    ///
290    /// When an image is released, it is immediately removed from any draft
291    /// configurations, and any fences associated with the image are dropped.
292    /// The resources associated with the image will be released as soon as the
293    /// image is no longer in use.
294    pub fn r#release_image(&self, mut image_id: &ImageId) -> Result<(), fidl::Error> {
295        self.client.send::<CoordinatorReleaseImageRequest>(
296            (image_id,),
297            0x477192230517504,
298            fidl::encoding::DynamicFlags::empty(),
299        )
300    }
301
302    /// Imports an event into the driver and associates it with the given id.
303    ///
304    /// It is illegal for id to be equal to INVALID_DISP_ID, and it is undefined to
305    /// import one event with two different ids or to import two different events
306    /// with the same id (note that ids map well to koids).
307    ///
308    /// If a client is reusing events, they must clear the signal
309    /// before referencing the id again.
310    pub fn r#import_event(
311        &self,
312        mut event: fidl::Event,
313        mut id: &EventId,
314    ) -> Result<(), fidl::Error> {
315        self.client.send::<CoordinatorImportEventRequest>(
316            (event, id),
317            0x2864e5dc59390543,
318            fidl::encoding::DynamicFlags::empty(),
319        )
320    }
321
322    /// Releases the event imported with the given id.
323    ///
324    /// If any images are currently using the given event, the event
325    /// will still be waited up or signaled as appropriate before its
326    /// resources are released. It is an error to reuse an ID while the
327    /// submitted config has references to it.
328    pub fn r#release_event(&self, mut id: &EventId) -> Result<(), fidl::Error> {
329        self.client.send::<CoordinatorReleaseEventRequest>(
330            (id,),
331            0x32508c2101606b87,
332            fidl::encoding::DynamicFlags::empty(),
333        )
334    }
335
336    /// Creates a new layer.
337    ///
338    /// Layers are not associated with a particular display, but they can only be
339    /// shown on at most one display at any given time.  A layer is considered in
340    /// use from the time it is passed to SetDisplayLayers until a subsequent
341    /// configuration is committed which does not include the layer or until its
342    /// display is removed.
343    ///
344    /// * `layer_id` must be a valid ID (not equal to `INVALID_DISP_ID`).
345    /// * `layer_id` must not be in use (not equal to the ID of any currently
346    ///   existing layer in the same `Coordinator` session).
347    pub fn r#create_layer(
348        &self,
349        mut layer_id: &LayerId,
350        ___deadline: zx::MonotonicInstant,
351    ) -> Result<CoordinatorCreateLayerResult, fidl::Error> {
352        let _response = self.client.send_query::<
353            CoordinatorCreateLayerRequest,
354            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
355            CoordinatorMarker,
356        >(
357            (layer_id,),
358            0x2137cfd788a3496b,
359            fidl::encoding::DynamicFlags::empty(),
360            ___deadline,
361        )?;
362        Ok(_response.map(|x| x))
363    }
364
365    /// Destroys the given layer.
366    ///
367    /// It is illegal to destroy a layer which does not exist or which is in use.
368    pub fn r#destroy_layer(&self, mut layer_id: &LayerId) -> Result<(), fidl::Error> {
369        self.client.send::<CoordinatorDestroyLayerRequest>(
370            (layer_id,),
371            0x386e12d092bea2f8,
372            fidl::encoding::DynamicFlags::empty(),
373        )
374    }
375
376    /// Sets the mode for a display.
377    pub fn r#set_display_mode(
378        &self,
379        mut display_id: &fidl_fuchsia_hardware_display_types::DisplayId,
380        mut mode: &fidl_fuchsia_hardware_display_types::Mode,
381    ) -> Result<(), fidl::Error> {
382        self.client.send::<CoordinatorSetDisplayModeRequest>(
383            (display_id, mode),
384            0xbde3c59ee9c1777,
385            fidl::encoding::DynamicFlags::empty(),
386        )
387    }
388
389    /// Set the color conversion applied to the display. The conversion is applied to
390    /// to each pixel according to the formula:
391    ///
392    /// (coefficients * (pixel + preoffsets)) + postoffsets
393    ///
394    /// where pixel is a column vector consisting of the pixel's 3 components.
395    ///
396    /// `coefficients` is passed in row-major order. If the first entry of an array is NaN, the
397    /// array is treated as the identity element for the relevant operation.
398    /// Hardware that support color correction generally accept a limited range of coefficient
399    /// values. Coefficients in the range of [-2, 2] inclusive will be accepted by most
400    /// hardware. The hardware driver will clamp values that are outside its acceptable range.
401    ///
402    /// `preoffsets`, `postoffsets`: Clients are encourged to produce color correction values that
403    /// do not depend on pre and post offsets since some hardware do not have support for that.
404    /// For cases where pre and post offset values need to be used, the range should be limited to
405    /// (-1, 1) exclusive as confirmed by CheckConfig API. Values outside this range will be
406    /// rejected.
407    ///
408    /// Clients are encouraged to use the CheckConfig API to confirm support for correction and to
409    /// validate their color correction input values.
410    ///
411    /// This a stateful call. Once color conversion values have been succesfully applied via a call
412    /// to CommitConfig() they will remain in place until changed and another CommitConfig() call is
413    /// successful. If SetDisplayColorConversion() is called and then the config is discarded, then
414    /// the last successfully committed state is restored.
415    pub fn r#set_display_color_conversion(
416        &self,
417        mut display_id: &fidl_fuchsia_hardware_display_types::DisplayId,
418        mut preoffsets: &[f32; 3],
419        mut coefficients: &[f32; 9],
420        mut postoffsets: &[f32; 3],
421    ) -> Result<(), fidl::Error> {
422        self.client.send::<CoordinatorSetDisplayColorConversionRequest>(
423            (display_id, preoffsets, coefficients, postoffsets),
424            0x2f18186a987d51aa,
425            fidl::encoding::DynamicFlags::empty(),
426        )
427    }
428
429    /// Assigns a list of layers to be composited on a display.
430    pub fn r#set_display_layers(
431        &self,
432        mut display_id: &fidl_fuchsia_hardware_display_types::DisplayId,
433        mut layer_ids: &[LayerId],
434    ) -> Result<(), fidl::Error> {
435        self.client.send::<CoordinatorSetDisplayLayersRequest>(
436            (display_id, layer_ids),
437            0x190e0f6f93be1d89,
438            fidl::encoding::DynamicFlags::empty(),
439        )
440    }
441
442    /// Configures the layer as a primary layer with no image and the default
443    /// config (no src_frame cropping, the identity transform, positioned in the
444    /// top-left corner of the composed output, and no scaling).
445    ///
446    /// See the documentation on SetLayerImage for details on how this method
447    /// affects the layer's contents.
448    ///
449    /// It is illegal to pass an invalid layer id.
450    pub fn r#set_layer_primary_config(
451        &self,
452        mut layer_id: &LayerId,
453        mut image_metadata: &fidl_fuchsia_hardware_display_types::ImageMetadata,
454    ) -> Result<(), fidl::Error> {
455        self.client.send::<CoordinatorSetLayerPrimaryConfigRequest>(
456            (layer_id, image_metadata),
457            0x68d89ebd518b45b9,
458            fidl::encoding::DynamicFlags::empty(),
459        )
460    }
461
462    /// Sets the layer transform, scaling, and positioning.
463    ///
464    /// CheckConfig() will return INVALID_CONFIG if any of the configuration
465    /// validity conditions specified here is violated.
466    ///
467    /// Calling this on a non-primary layer or passing an invalid transform is
468    /// illegal.
469    pub fn r#set_layer_primary_position(
470        &self,
471        mut layer_id: &LayerId,
472        mut image_source_transformation: fidl_fuchsia_hardware_display_types::CoordinateTransformation,
473        mut image_source: &fidl_fuchsia_math::RectU,
474        mut display_destination: &fidl_fuchsia_math::RectU,
475    ) -> Result<(), fidl::Error> {
476        self.client.send::<CoordinatorSetLayerPrimaryPositionRequest>(
477            (layer_id, image_source_transformation, image_source, display_destination),
478            0x27b192b5a43851e2,
479            fidl::encoding::DynamicFlags::empty(),
480        )
481    }
482
483    /// Sets the alpha mode of the plane.
484    ///
485    /// If `mode` == DISABLED, the layer is opaque and `val` is ignored.
486    ///
487    /// If `mode` == PREMULTIPLIED or HW_MULTIPLY and `val` is NaN, the alpha
488    /// used when blending is determined by the per-pixel alpha channel.
489    ///
490    /// If `mode` == PREMULTIPLIED or HW_MULTIPLY and `val` is not NaN, the
491    /// alpha used when blending is the product of `val` and any per-pixel
492    /// alpha. Additionally, if `mode` == PREMULTIPLIED, then the hardware
493    /// premultiplies the color channel with `val` before blending.
494    ///
495    /// It is illegal to call this on a non-primary layer, to pass an
496    /// invalid mode, or to pass a value of `val` which is not NaN or
497    /// in the range [0, 1].
498    pub fn r#set_layer_primary_alpha(
499        &self,
500        mut layer_id: &LayerId,
501        mut mode: fidl_fuchsia_hardware_display_types::AlphaMode,
502        mut val: f32,
503    ) -> Result<(), fidl::Error> {
504        self.client.send::<CoordinatorSetLayerPrimaryAlphaRequest>(
505            (layer_id, mode, val),
506            0x104cf2b18b27296d,
507            fidl::encoding::DynamicFlags::empty(),
508        )
509    }
510
511    /// Configures the layer as a solid color fill layer.
512    ///
513    /// It is illegal to call this on an invalid layer.
514    pub fn r#set_layer_color_config(
515        &self,
516        mut layer_id: &LayerId,
517        mut color: &fidl_fuchsia_hardware_display_types::Color,
518        mut display_destination: &fidl_fuchsia_math::RectU,
519    ) -> Result<(), fidl::Error> {
520        self.client.send::<CoordinatorSetLayerColorConfigRequest>(
521            (layer_id, color, display_destination),
522            0x2fa91e9a2a01875f,
523            fidl::encoding::DynamicFlags::empty(),
524        )
525    }
526
527    /// Sets the image for the layer's draft configuration.
528    ///
529    /// If wait_event_id corresponds to an imported event, the driver will
530    /// wait for ZX_EVENT_SIGNALED on the object before presenting the image.
531    ///
532    /// A layer's submitted image is the most recently committed image which either has
533    /// no wait event or whose wait event has been signaled. Whenever a new image
534    /// is committed, any older images which never got committed are dropped, and
535    /// their signal events will be fired as soon as their wait events are
536    /// signaled. The driver also does not have any concept like 'target vsync',
537    /// meaning that if multiple images are committed within one vsync period, then
538    /// only the last image will actually be displayed.
539    ///
540    /// By default, the driver retains a submitted image until a new image is
541    /// submitted. However, setting a layer's ImageConfig with SetLayerPrimaryConfig
542    /// resets the layer's submitted and waiting images, even if the new ImageConfig
543    /// matches the old ImageConfig.
544    ///
545    /// An image cannot be used for multiple layers simultaneously, nor can an
546    /// image be given back to the display coordinator while it is still in use.
547    /// An image is considered in use when it is part of a draft configuration
548    /// or from when its configuration is committed until it is replaced by a
549    /// subsequent configuration that is *displayed* (not merely committed).
550    ///
551    /// It is illegal to call this with an invalid layer or image id, to
552    /// call it on a color layer, or to call it with an image and layer whose
553    /// ImageConfigs do not match. It is illegal to commit a configuration
554    /// with an image layer that has no image (note that is is not illegal to
555    /// validate such a configuration). It is illegal to reuse a wait event which
556    /// another layer that has not been presented is waiting on.
557    ///
558    /// Each layer can track a maximum of `MAX_WAITING_IMAGES_PER_LAYER` waiting images.
559    /// An image becomes "waiting" when it is the most recent image set to a layer that appears in
560    /// a config that is committed via `CommitConfig()` or similar.  To avoid exceeding the maximum,
561    /// the client can infer that the image is no longer waiting by:
562    ///   - noting the config stamp when the config containing the layer/image is committed
563    ///   - watching for that same (or later) config stamp to be returned by
564    ///     `CoordinatorListener.OnVsync()`.
565    pub fn r#set_layer_image2(
566        &self,
567        mut layer_id: &LayerId,
568        mut image_id: &ImageId,
569        mut wait_event_id: &EventId,
570    ) -> Result<(), fidl::Error> {
571        self.client.send::<CoordinatorSetLayerImage2Request>(
572            (layer_id, image_id, wait_event_id),
573            0x53c6376dfc13a971,
574            fidl::encoding::DynamicFlags::empty(),
575        )
576    }
577
578    /// Validates the draft configuration.
579    ///
580    /// Validation entails checking that the draft configuration can be used
581    /// by the system's display hardware.
582    ///
583    /// Most SetX operations require verifying the draft configuration. The
584    /// following operations do not require revalidation.
585    /// * SetLayerImage2()
586    pub fn r#check_config(
587        &self,
588        ___deadline: zx::MonotonicInstant,
589    ) -> Result<fidl_fuchsia_hardware_display_types::ConfigResult, fidl::Error> {
590        let _response = self.client.send_query::<
591            fidl::encoding::EmptyPayload,
592            CoordinatorCheckConfigResponse,
593            CoordinatorMarker,
594        >(
595            (),
596            0x2bcfb4eb16878158,
597            fidl::encoding::DynamicFlags::empty(),
598            ___deadline,
599        )?;
600        Ok(_response.res)
601    }
602
603    /// Discard all draft configuration changes.
604    pub fn r#discard_config(&self) -> Result<(), fidl::Error> {
605        self.client.send::<fidl::encoding::EmptyPayload>(
606            (),
607            0x1673399e9231dedf,
608            fidl::encoding::DynamicFlags::empty(),
609        )
610    }
611
612    /// Gets the stamp provided with the latest configuration the client
613    /// committed (by calling CommitConfig()) and the display core driver
614    /// accepted; the display configuration may not have been rendered yet
615    /// because of pending image availability or draft layer changes.
616    /// If no configuration was committed before, returns `INVALID_CONFIG_STAMP_VALUE`.
617    pub fn r#get_latest_committed_config_stamp(
618        &self,
619        ___deadline: zx::MonotonicInstant,
620    ) -> Result<ConfigStamp, fidl::Error> {
621        let _response = self.client.send_query::<
622            fidl::encoding::EmptyPayload,
623            CoordinatorGetLatestCommittedConfigStampResponse,
624            CoordinatorMarker,
625        >(
626            (),
627            0x2a441f2c81af5d66,
628            fidl::encoding::DynamicFlags::empty(),
629            ___deadline,
630        )?;
631        Ok(_response.stamp)
632    }
633
634    /// Commits any draft changes to the current configuration. This will
635    /// not apply draft changes to layers which are not on any display.
636    ///
637    /// If the draft configuration cannot be committed, this call will silently
638    /// fail, so the client should ensure its configuration is valid by
639    /// calling [`Coordinator.CheckConfig`].
640    pub fn r#commit_config(
641        &self,
642        mut payload: CoordinatorCommitConfigRequest,
643    ) -> Result<(), fidl::Error> {
644        self.client.send::<CoordinatorCommitConfigRequest>(
645            &mut payload,
646            0x4489cbd2fcfbaeaf,
647            fidl::encoding::DynamicFlags::empty(),
648        )
649    }
650
651    /// Acknowledges the receipt of one `OnVsync` message.
652    pub fn r#acknowledge_vsync(&self, mut cookie: u64) -> Result<(), fidl::Error> {
653        self.client.send::<CoordinatorAcknowledgeVsyncRequest>(
654            (cookie,),
655            0x25e921d26107d6ef,
656            fidl::encoding::DynamicFlags::empty(),
657        )
658    }
659
660    /// Import a sysmem buffer collection token. `buffer_collection_id` must not
661    /// already be in use.
662    pub fn r#import_buffer_collection(
663        &self,
664        mut buffer_collection_id: &BufferCollectionId,
665        mut buffer_collection_token: fidl::endpoints::ClientEnd<
666            fidl_fuchsia_sysmem2::BufferCollectionTokenMarker,
667        >,
668        ___deadline: zx::MonotonicInstant,
669    ) -> Result<CoordinatorImportBufferCollectionResult, fidl::Error> {
670        let _response = self.client.send_query::<
671            CoordinatorImportBufferCollectionRequest,
672            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
673            CoordinatorMarker,
674        >(
675            (buffer_collection_id, buffer_collection_token,),
676            0x30d06f510e7f4601,
677            fidl::encoding::DynamicFlags::empty(),
678            ___deadline,
679        )?;
680        Ok(_response.map(|x| x))
681    }
682
683    /// Release an imported buffer collection.
684    pub fn r#release_buffer_collection(
685        &self,
686        mut buffer_collection_id: &BufferCollectionId,
687    ) -> Result<(), fidl::Error> {
688        self.client.send::<CoordinatorReleaseBufferCollectionRequest>(
689            (buffer_collection_id,),
690            0x1c7dd5f8b0690be0,
691            fidl::encoding::DynamicFlags::empty(),
692        )
693    }
694
695    /// Takes an imported buffer collection and sets the constraints
696    /// on it so that it can be imported with a specific config.
697    pub fn r#set_buffer_collection_constraints(
698        &self,
699        mut buffer_collection_id: &BufferCollectionId,
700        mut buffer_usage: &fidl_fuchsia_hardware_display_types::ImageBufferUsage,
701        ___deadline: zx::MonotonicInstant,
702    ) -> Result<CoordinatorSetBufferCollectionConstraintsResult, fidl::Error> {
703        let _response = self.client.send_query::<
704            CoordinatorSetBufferCollectionConstraintsRequest,
705            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
706            CoordinatorMarker,
707        >(
708            (buffer_collection_id, buffer_usage,),
709            0x509a4ee9af6035df,
710            fidl::encoding::DynamicFlags::empty(),
711            ___deadline,
712        )?;
713        Ok(_response.map(|x| x))
714    }
715
716    /// Returns true if Capture is supported on the platform.
717    pub fn r#is_capture_supported(
718        &self,
719        ___deadline: zx::MonotonicInstant,
720    ) -> Result<CoordinatorIsCaptureSupportedResult, fidl::Error> {
721        let _response = self.client.send_query::<
722            fidl::encoding::EmptyPayload,
723            fidl::encoding::ResultType<CoordinatorIsCaptureSupportedResponse, i32>,
724            CoordinatorMarker,
725        >(
726            (),
727            0x4ca407277277971b,
728            fidl::encoding::DynamicFlags::empty(),
729            ___deadline,
730        )?;
731        Ok(_response.map(|x| x.supported))
732    }
733
734    /// Starts capture. Client must provide a valid signal_event_id and
735    /// image_id. signal_event_id must have been imported into the driver
736    /// using ImportEvent FIDL API. Image_id is the id from ImportImageForCapture.
737    /// The client will get notified once capture is complete via signal_event_id.
738    /// Returns ZX_ERR_NOT_SUPPORTED if coordinator does not support capture
739    pub fn r#start_capture(
740        &self,
741        mut signal_event_id: &EventId,
742        mut image_id: &ImageId,
743        ___deadline: zx::MonotonicInstant,
744    ) -> Result<CoordinatorStartCaptureResult, fidl::Error> {
745        let _response = self.client.send_query::<
746            CoordinatorStartCaptureRequest,
747            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
748            CoordinatorMarker,
749        >(
750            (signal_event_id, image_id,),
751            0x35cb38f19d96a8db,
752            fidl::encoding::DynamicFlags::empty(),
753            ___deadline,
754        )?;
755        Ok(_response.map(|x| x))
756    }
757
758    /// Set the minimum value of rgb channels. Valid range [0 255] inclusive. Returns
759    /// ZX_ERR_NOT_SUPPORTED when the display hardware does not support this feature.
760    /// This API is meant to address backlight bleeding that may occur on some hardware
761    /// that have a specific type of panel and hardware assembly. The evolution of this
762    /// API is highly hardware and product dependant and therefore as products evolve, this
763    /// API may change or support for this API may become non-existent. Therefore, this
764    /// API should be used with caution.
765    ///
766    /// Unlike other calls in this API, SetMiniumRgb is applied immediately, and does not
767    /// wait for CommitConfig(). It is, however, still stateful.
768    pub fn r#set_minimum_rgb(
769        &self,
770        mut minimum_rgb: u8,
771        ___deadline: zx::MonotonicInstant,
772    ) -> Result<CoordinatorSetMinimumRgbResult, fidl::Error> {
773        let _response = self.client.send_query::<
774            CoordinatorSetMinimumRgbRequest,
775            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
776            CoordinatorMarker,
777        >(
778            (minimum_rgb,),
779            0x1b49251437038b0b,
780            fidl::encoding::DynamicFlags::empty(),
781            ___deadline,
782        )?;
783        Ok(_response.map(|x| x))
784    }
785
786    /// Sets the display panel power mode.
787    ///
788    /// This call takes effect immediately. Clients don't need to call
789    /// [`Coordinator.CommitConfig`].
790    ///
791    /// Fails with ZX_ERR_NOT_FOUND if `display_id` does not belong to a display
792    /// known by the Coordinator. This can happen if a client issues a call to
793    /// [`Coordinator.SetDisplayPowerMode`] before it receives a notification
794    /// that the display was removed.
795    ///
796    /// This method is not idempotent. Each [`Coordinator.SetDisplayPowerMode`]
797    /// call explicitly sets the power mode on the display hardware, though the
798    /// display hardware driver may choose to behave idempotently.
799    ///
800    /// Fails with ZX_ERR_NOT_SUPPORTED if the display drivers or the hardware
801    /// don't support the given `power_mode`.
802    pub fn r#set_display_power_mode(
803        &self,
804        mut display_id: &fidl_fuchsia_hardware_display_types::DisplayId,
805        mut power_mode: fidl_fuchsia_hardware_display_types::PowerMode,
806        ___deadline: zx::MonotonicInstant,
807    ) -> Result<CoordinatorSetDisplayPowerModeResult, fidl::Error> {
808        let _response = self.client.send_query::<
809            CoordinatorSetDisplayPowerModeRequest,
810            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
811            CoordinatorMarker,
812        >(
813            (display_id, power_mode,),
814            0xf4672f055072c92,
815            fidl::encoding::DynamicFlags::empty(),
816            ___deadline,
817        )?;
818        Ok(_response.map(|x| x))
819    }
820}
821
822#[cfg(target_os = "fuchsia")]
823impl From<CoordinatorSynchronousProxy> for zx::NullableHandle {
824    fn from(value: CoordinatorSynchronousProxy) -> Self {
825        value.into_channel().into()
826    }
827}
828
829#[cfg(target_os = "fuchsia")]
830impl From<fidl::Channel> for CoordinatorSynchronousProxy {
831    fn from(value: fidl::Channel) -> Self {
832        Self::new(value)
833    }
834}
835
836#[cfg(target_os = "fuchsia")]
837impl fidl::endpoints::FromClient for CoordinatorSynchronousProxy {
838    type Protocol = CoordinatorMarker;
839
840    fn from_client(value: fidl::endpoints::ClientEnd<CoordinatorMarker>) -> Self {
841        Self::new(value.into_channel())
842    }
843}
844
845#[derive(Debug, Clone)]
846pub struct CoordinatorProxy {
847    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
848}
849
850impl fidl::endpoints::Proxy for CoordinatorProxy {
851    type Protocol = CoordinatorMarker;
852
853    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
854        Self::new(inner)
855    }
856
857    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
858        self.client.into_channel().map_err(|client| Self { client })
859    }
860
861    fn as_channel(&self) -> &::fidl::AsyncChannel {
862        self.client.as_channel()
863    }
864}
865
866impl CoordinatorProxy {
867    /// Create a new Proxy for fuchsia.hardware.display/Coordinator.
868    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
869        let protocol_name = <CoordinatorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
870        Self { client: fidl::client::Client::new(channel, protocol_name) }
871    }
872
873    /// Get a Stream of events from the remote end of the protocol.
874    ///
875    /// # Panics
876    ///
877    /// Panics if the event stream was already taken.
878    pub fn take_event_stream(&self) -> CoordinatorEventStream {
879        CoordinatorEventStream { event_receiver: self.client.take_event_receiver() }
880    }
881
882    /// Imports a Buffer-Collection backed image.
883    ///
884    /// Returns `ZX_ERR_NOT_SUPPORTED` if the display hardware doesn't support
885    /// `image_metadata`.
886    /// Returns `ZX_ERR_ALREADY_EXISTS` if `image_id` was used in a successful
887    /// `ImportImage()` without a corresponding `ReleaseImage()`.
888    /// Returns `ZX_ERR_NO_MEMORY` if memory cannot be allocated for managing the image
889    /// Additionally, this method delegates internally to `fuchsia.hardware.display.engine/Engine`,
890    /// and will forward errors received from `ImportImage()` and `ImportImageForCapture()`.
891    ///
892    /// The implementation must ignore any Sysmem information around weak VMO
893    /// handles. Display stack consumers are responsible for ensuring that weak
894    /// VMOs are closed in a timely manner, which may involve calling
895    /// [`Coordinator.ReleaseImage`] and [`Coordinator.CommitConfig`].
896    pub fn r#import_image(
897        &self,
898        mut image_metadata: &fidl_fuchsia_hardware_display_types::ImageMetadata,
899        mut buffer_collection_id: &BufferCollectionId,
900        mut buffer_index: u32,
901        mut image_id: &ImageId,
902    ) -> fidl::client::QueryResponseFut<
903        CoordinatorImportImageResult,
904        fidl::encoding::DefaultFuchsiaResourceDialect,
905    > {
906        CoordinatorProxyInterface::r#import_image(
907            self,
908            image_metadata,
909            buffer_collection_id,
910            buffer_index,
911            image_id,
912        )
913    }
914
915    /// Releases an imported image.
916    ///
917    /// `image_id` must be already imported by
918    /// [`fuchsia.hardware.display/Coordinator.ImportImage`].
919    ///
920    /// The image must not be the capture target of an ongoing capture specified
921    /// in [`fuchsia.hardware.display/Coordinator.StartCapture`].
922    ///
923    /// When an image is released, it is immediately removed from any draft
924    /// configurations, and any fences associated with the image are dropped.
925    /// The resources associated with the image will be released as soon as the
926    /// image is no longer in use.
927    pub fn r#release_image(&self, mut image_id: &ImageId) -> Result<(), fidl::Error> {
928        CoordinatorProxyInterface::r#release_image(self, image_id)
929    }
930
931    /// Imports an event into the driver and associates it with the given id.
932    ///
933    /// It is illegal for id to be equal to INVALID_DISP_ID, and it is undefined to
934    /// import one event with two different ids or to import two different events
935    /// with the same id (note that ids map well to koids).
936    ///
937    /// If a client is reusing events, they must clear the signal
938    /// before referencing the id again.
939    pub fn r#import_event(
940        &self,
941        mut event: fidl::Event,
942        mut id: &EventId,
943    ) -> Result<(), fidl::Error> {
944        CoordinatorProxyInterface::r#import_event(self, event, id)
945    }
946
947    /// Releases the event imported with the given id.
948    ///
949    /// If any images are currently using the given event, the event
950    /// will still be waited up or signaled as appropriate before its
951    /// resources are released. It is an error to reuse an ID while the
952    /// submitted config has references to it.
953    pub fn r#release_event(&self, mut id: &EventId) -> Result<(), fidl::Error> {
954        CoordinatorProxyInterface::r#release_event(self, id)
955    }
956
957    /// Creates a new layer.
958    ///
959    /// Layers are not associated with a particular display, but they can only be
960    /// shown on at most one display at any given time.  A layer is considered in
961    /// use from the time it is passed to SetDisplayLayers until a subsequent
962    /// configuration is committed which does not include the layer or until its
963    /// display is removed.
964    ///
965    /// * `layer_id` must be a valid ID (not equal to `INVALID_DISP_ID`).
966    /// * `layer_id` must not be in use (not equal to the ID of any currently
967    ///   existing layer in the same `Coordinator` session).
968    pub fn r#create_layer(
969        &self,
970        mut layer_id: &LayerId,
971    ) -> fidl::client::QueryResponseFut<
972        CoordinatorCreateLayerResult,
973        fidl::encoding::DefaultFuchsiaResourceDialect,
974    > {
975        CoordinatorProxyInterface::r#create_layer(self, layer_id)
976    }
977
978    /// Destroys the given layer.
979    ///
980    /// It is illegal to destroy a layer which does not exist or which is in use.
981    pub fn r#destroy_layer(&self, mut layer_id: &LayerId) -> Result<(), fidl::Error> {
982        CoordinatorProxyInterface::r#destroy_layer(self, layer_id)
983    }
984
985    /// Sets the mode for a display.
986    pub fn r#set_display_mode(
987        &self,
988        mut display_id: &fidl_fuchsia_hardware_display_types::DisplayId,
989        mut mode: &fidl_fuchsia_hardware_display_types::Mode,
990    ) -> Result<(), fidl::Error> {
991        CoordinatorProxyInterface::r#set_display_mode(self, display_id, mode)
992    }
993
994    /// Set the color conversion applied to the display. The conversion is applied to
995    /// to each pixel according to the formula:
996    ///
997    /// (coefficients * (pixel + preoffsets)) + postoffsets
998    ///
999    /// where pixel is a column vector consisting of the pixel's 3 components.
1000    ///
1001    /// `coefficients` is passed in row-major order. If the first entry of an array is NaN, the
1002    /// array is treated as the identity element for the relevant operation.
1003    /// Hardware that support color correction generally accept a limited range of coefficient
1004    /// values. Coefficients in the range of [-2, 2] inclusive will be accepted by most
1005    /// hardware. The hardware driver will clamp values that are outside its acceptable range.
1006    ///
1007    /// `preoffsets`, `postoffsets`: Clients are encourged to produce color correction values that
1008    /// do not depend on pre and post offsets since some hardware do not have support for that.
1009    /// For cases where pre and post offset values need to be used, the range should be limited to
1010    /// (-1, 1) exclusive as confirmed by CheckConfig API. Values outside this range will be
1011    /// rejected.
1012    ///
1013    /// Clients are encouraged to use the CheckConfig API to confirm support for correction and to
1014    /// validate their color correction input values.
1015    ///
1016    /// This a stateful call. Once color conversion values have been succesfully applied via a call
1017    /// to CommitConfig() they will remain in place until changed and another CommitConfig() call is
1018    /// successful. If SetDisplayColorConversion() is called and then the config is discarded, then
1019    /// the last successfully committed state is restored.
1020    pub fn r#set_display_color_conversion(
1021        &self,
1022        mut display_id: &fidl_fuchsia_hardware_display_types::DisplayId,
1023        mut preoffsets: &[f32; 3],
1024        mut coefficients: &[f32; 9],
1025        mut postoffsets: &[f32; 3],
1026    ) -> Result<(), fidl::Error> {
1027        CoordinatorProxyInterface::r#set_display_color_conversion(
1028            self,
1029            display_id,
1030            preoffsets,
1031            coefficients,
1032            postoffsets,
1033        )
1034    }
1035
1036    /// Assigns a list of layers to be composited on a display.
1037    pub fn r#set_display_layers(
1038        &self,
1039        mut display_id: &fidl_fuchsia_hardware_display_types::DisplayId,
1040        mut layer_ids: &[LayerId],
1041    ) -> Result<(), fidl::Error> {
1042        CoordinatorProxyInterface::r#set_display_layers(self, display_id, layer_ids)
1043    }
1044
1045    /// Configures the layer as a primary layer with no image and the default
1046    /// config (no src_frame cropping, the identity transform, positioned in the
1047    /// top-left corner of the composed output, and no scaling).
1048    ///
1049    /// See the documentation on SetLayerImage for details on how this method
1050    /// affects the layer's contents.
1051    ///
1052    /// It is illegal to pass an invalid layer id.
1053    pub fn r#set_layer_primary_config(
1054        &self,
1055        mut layer_id: &LayerId,
1056        mut image_metadata: &fidl_fuchsia_hardware_display_types::ImageMetadata,
1057    ) -> Result<(), fidl::Error> {
1058        CoordinatorProxyInterface::r#set_layer_primary_config(self, layer_id, image_metadata)
1059    }
1060
1061    /// Sets the layer transform, scaling, and positioning.
1062    ///
1063    /// CheckConfig() will return INVALID_CONFIG if any of the configuration
1064    /// validity conditions specified here is violated.
1065    ///
1066    /// Calling this on a non-primary layer or passing an invalid transform is
1067    /// illegal.
1068    pub fn r#set_layer_primary_position(
1069        &self,
1070        mut layer_id: &LayerId,
1071        mut image_source_transformation: fidl_fuchsia_hardware_display_types::CoordinateTransformation,
1072        mut image_source: &fidl_fuchsia_math::RectU,
1073        mut display_destination: &fidl_fuchsia_math::RectU,
1074    ) -> Result<(), fidl::Error> {
1075        CoordinatorProxyInterface::r#set_layer_primary_position(
1076            self,
1077            layer_id,
1078            image_source_transformation,
1079            image_source,
1080            display_destination,
1081        )
1082    }
1083
1084    /// Sets the alpha mode of the plane.
1085    ///
1086    /// If `mode` == DISABLED, the layer is opaque and `val` is ignored.
1087    ///
1088    /// If `mode` == PREMULTIPLIED or HW_MULTIPLY and `val` is NaN, the alpha
1089    /// used when blending is determined by the per-pixel alpha channel.
1090    ///
1091    /// If `mode` == PREMULTIPLIED or HW_MULTIPLY and `val` is not NaN, the
1092    /// alpha used when blending is the product of `val` and any per-pixel
1093    /// alpha. Additionally, if `mode` == PREMULTIPLIED, then the hardware
1094    /// premultiplies the color channel with `val` before blending.
1095    ///
1096    /// It is illegal to call this on a non-primary layer, to pass an
1097    /// invalid mode, or to pass a value of `val` which is not NaN or
1098    /// in the range [0, 1].
1099    pub fn r#set_layer_primary_alpha(
1100        &self,
1101        mut layer_id: &LayerId,
1102        mut mode: fidl_fuchsia_hardware_display_types::AlphaMode,
1103        mut val: f32,
1104    ) -> Result<(), fidl::Error> {
1105        CoordinatorProxyInterface::r#set_layer_primary_alpha(self, layer_id, mode, val)
1106    }
1107
1108    /// Configures the layer as a solid color fill layer.
1109    ///
1110    /// It is illegal to call this on an invalid layer.
1111    pub fn r#set_layer_color_config(
1112        &self,
1113        mut layer_id: &LayerId,
1114        mut color: &fidl_fuchsia_hardware_display_types::Color,
1115        mut display_destination: &fidl_fuchsia_math::RectU,
1116    ) -> Result<(), fidl::Error> {
1117        CoordinatorProxyInterface::r#set_layer_color_config(
1118            self,
1119            layer_id,
1120            color,
1121            display_destination,
1122        )
1123    }
1124
1125    /// Sets the image for the layer's draft configuration.
1126    ///
1127    /// If wait_event_id corresponds to an imported event, the driver will
1128    /// wait for ZX_EVENT_SIGNALED on the object before presenting the image.
1129    ///
1130    /// A layer's submitted image is the most recently committed image which either has
1131    /// no wait event or whose wait event has been signaled. Whenever a new image
1132    /// is committed, any older images which never got committed are dropped, and
1133    /// their signal events will be fired as soon as their wait events are
1134    /// signaled. The driver also does not have any concept like 'target vsync',
1135    /// meaning that if multiple images are committed within one vsync period, then
1136    /// only the last image will actually be displayed.
1137    ///
1138    /// By default, the driver retains a submitted image until a new image is
1139    /// submitted. However, setting a layer's ImageConfig with SetLayerPrimaryConfig
1140    /// resets the layer's submitted and waiting images, even if the new ImageConfig
1141    /// matches the old ImageConfig.
1142    ///
1143    /// An image cannot be used for multiple layers simultaneously, nor can an
1144    /// image be given back to the display coordinator while it is still in use.
1145    /// An image is considered in use when it is part of a draft configuration
1146    /// or from when its configuration is committed until it is replaced by a
1147    /// subsequent configuration that is *displayed* (not merely committed).
1148    ///
1149    /// It is illegal to call this with an invalid layer or image id, to
1150    /// call it on a color layer, or to call it with an image and layer whose
1151    /// ImageConfigs do not match. It is illegal to commit a configuration
1152    /// with an image layer that has no image (note that is is not illegal to
1153    /// validate such a configuration). It is illegal to reuse a wait event which
1154    /// another layer that has not been presented is waiting on.
1155    ///
1156    /// Each layer can track a maximum of `MAX_WAITING_IMAGES_PER_LAYER` waiting images.
1157    /// An image becomes "waiting" when it is the most recent image set to a layer that appears in
1158    /// a config that is committed via `CommitConfig()` or similar.  To avoid exceeding the maximum,
1159    /// the client can infer that the image is no longer waiting by:
1160    ///   - noting the config stamp when the config containing the layer/image is committed
1161    ///   - watching for that same (or later) config stamp to be returned by
1162    ///     `CoordinatorListener.OnVsync()`.
1163    pub fn r#set_layer_image2(
1164        &self,
1165        mut layer_id: &LayerId,
1166        mut image_id: &ImageId,
1167        mut wait_event_id: &EventId,
1168    ) -> Result<(), fidl::Error> {
1169        CoordinatorProxyInterface::r#set_layer_image2(self, layer_id, image_id, wait_event_id)
1170    }
1171
1172    /// Validates the draft configuration.
1173    ///
1174    /// Validation entails checking that the draft configuration can be used
1175    /// by the system's display hardware.
1176    ///
1177    /// Most SetX operations require verifying the draft configuration. The
1178    /// following operations do not require revalidation.
1179    /// * SetLayerImage2()
1180    pub fn r#check_config(
1181        &self,
1182    ) -> fidl::client::QueryResponseFut<
1183        fidl_fuchsia_hardware_display_types::ConfigResult,
1184        fidl::encoding::DefaultFuchsiaResourceDialect,
1185    > {
1186        CoordinatorProxyInterface::r#check_config(self)
1187    }
1188
1189    /// Discard all draft configuration changes.
1190    pub fn r#discard_config(&self) -> Result<(), fidl::Error> {
1191        CoordinatorProxyInterface::r#discard_config(self)
1192    }
1193
1194    /// Gets the stamp provided with the latest configuration the client
1195    /// committed (by calling CommitConfig()) and the display core driver
1196    /// accepted; the display configuration may not have been rendered yet
1197    /// because of pending image availability or draft layer changes.
1198    /// If no configuration was committed before, returns `INVALID_CONFIG_STAMP_VALUE`.
1199    pub fn r#get_latest_committed_config_stamp(
1200        &self,
1201    ) -> fidl::client::QueryResponseFut<ConfigStamp, fidl::encoding::DefaultFuchsiaResourceDialect>
1202    {
1203        CoordinatorProxyInterface::r#get_latest_committed_config_stamp(self)
1204    }
1205
1206    /// Commits any draft changes to the current configuration. This will
1207    /// not apply draft changes to layers which are not on any display.
1208    ///
1209    /// If the draft configuration cannot be committed, this call will silently
1210    /// fail, so the client should ensure its configuration is valid by
1211    /// calling [`Coordinator.CheckConfig`].
1212    pub fn r#commit_config(
1213        &self,
1214        mut payload: CoordinatorCommitConfigRequest,
1215    ) -> Result<(), fidl::Error> {
1216        CoordinatorProxyInterface::r#commit_config(self, payload)
1217    }
1218
1219    /// Acknowledges the receipt of one `OnVsync` message.
1220    pub fn r#acknowledge_vsync(&self, mut cookie: u64) -> Result<(), fidl::Error> {
1221        CoordinatorProxyInterface::r#acknowledge_vsync(self, cookie)
1222    }
1223
1224    /// Import a sysmem buffer collection token. `buffer_collection_id` must not
1225    /// already be in use.
1226    pub fn r#import_buffer_collection(
1227        &self,
1228        mut buffer_collection_id: &BufferCollectionId,
1229        mut buffer_collection_token: fidl::endpoints::ClientEnd<
1230            fidl_fuchsia_sysmem2::BufferCollectionTokenMarker,
1231        >,
1232    ) -> fidl::client::QueryResponseFut<
1233        CoordinatorImportBufferCollectionResult,
1234        fidl::encoding::DefaultFuchsiaResourceDialect,
1235    > {
1236        CoordinatorProxyInterface::r#import_buffer_collection(
1237            self,
1238            buffer_collection_id,
1239            buffer_collection_token,
1240        )
1241    }
1242
1243    /// Release an imported buffer collection.
1244    pub fn r#release_buffer_collection(
1245        &self,
1246        mut buffer_collection_id: &BufferCollectionId,
1247    ) -> Result<(), fidl::Error> {
1248        CoordinatorProxyInterface::r#release_buffer_collection(self, buffer_collection_id)
1249    }
1250
1251    /// Takes an imported buffer collection and sets the constraints
1252    /// on it so that it can be imported with a specific config.
1253    pub fn r#set_buffer_collection_constraints(
1254        &self,
1255        mut buffer_collection_id: &BufferCollectionId,
1256        mut buffer_usage: &fidl_fuchsia_hardware_display_types::ImageBufferUsage,
1257    ) -> fidl::client::QueryResponseFut<
1258        CoordinatorSetBufferCollectionConstraintsResult,
1259        fidl::encoding::DefaultFuchsiaResourceDialect,
1260    > {
1261        CoordinatorProxyInterface::r#set_buffer_collection_constraints(
1262            self,
1263            buffer_collection_id,
1264            buffer_usage,
1265        )
1266    }
1267
1268    /// Returns true if Capture is supported on the platform.
1269    pub fn r#is_capture_supported(
1270        &self,
1271    ) -> fidl::client::QueryResponseFut<
1272        CoordinatorIsCaptureSupportedResult,
1273        fidl::encoding::DefaultFuchsiaResourceDialect,
1274    > {
1275        CoordinatorProxyInterface::r#is_capture_supported(self)
1276    }
1277
1278    /// Starts capture. Client must provide a valid signal_event_id and
1279    /// image_id. signal_event_id must have been imported into the driver
1280    /// using ImportEvent FIDL API. Image_id is the id from ImportImageForCapture.
1281    /// The client will get notified once capture is complete via signal_event_id.
1282    /// Returns ZX_ERR_NOT_SUPPORTED if coordinator does not support capture
1283    pub fn r#start_capture(
1284        &self,
1285        mut signal_event_id: &EventId,
1286        mut image_id: &ImageId,
1287    ) -> fidl::client::QueryResponseFut<
1288        CoordinatorStartCaptureResult,
1289        fidl::encoding::DefaultFuchsiaResourceDialect,
1290    > {
1291        CoordinatorProxyInterface::r#start_capture(self, signal_event_id, image_id)
1292    }
1293
1294    /// Set the minimum value of rgb channels. Valid range [0 255] inclusive. Returns
1295    /// ZX_ERR_NOT_SUPPORTED when the display hardware does not support this feature.
1296    /// This API is meant to address backlight bleeding that may occur on some hardware
1297    /// that have a specific type of panel and hardware assembly. The evolution of this
1298    /// API is highly hardware and product dependant and therefore as products evolve, this
1299    /// API may change or support for this API may become non-existent. Therefore, this
1300    /// API should be used with caution.
1301    ///
1302    /// Unlike other calls in this API, SetMiniumRgb is applied immediately, and does not
1303    /// wait for CommitConfig(). It is, however, still stateful.
1304    pub fn r#set_minimum_rgb(
1305        &self,
1306        mut minimum_rgb: u8,
1307    ) -> fidl::client::QueryResponseFut<
1308        CoordinatorSetMinimumRgbResult,
1309        fidl::encoding::DefaultFuchsiaResourceDialect,
1310    > {
1311        CoordinatorProxyInterface::r#set_minimum_rgb(self, minimum_rgb)
1312    }
1313
1314    /// Sets the display panel power mode.
1315    ///
1316    /// This call takes effect immediately. Clients don't need to call
1317    /// [`Coordinator.CommitConfig`].
1318    ///
1319    /// Fails with ZX_ERR_NOT_FOUND if `display_id` does not belong to a display
1320    /// known by the Coordinator. This can happen if a client issues a call to
1321    /// [`Coordinator.SetDisplayPowerMode`] before it receives a notification
1322    /// that the display was removed.
1323    ///
1324    /// This method is not idempotent. Each [`Coordinator.SetDisplayPowerMode`]
1325    /// call explicitly sets the power mode on the display hardware, though the
1326    /// display hardware driver may choose to behave idempotently.
1327    ///
1328    /// Fails with ZX_ERR_NOT_SUPPORTED if the display drivers or the hardware
1329    /// don't support the given `power_mode`.
1330    pub fn r#set_display_power_mode(
1331        &self,
1332        mut display_id: &fidl_fuchsia_hardware_display_types::DisplayId,
1333        mut power_mode: fidl_fuchsia_hardware_display_types::PowerMode,
1334    ) -> fidl::client::QueryResponseFut<
1335        CoordinatorSetDisplayPowerModeResult,
1336        fidl::encoding::DefaultFuchsiaResourceDialect,
1337    > {
1338        CoordinatorProxyInterface::r#set_display_power_mode(self, display_id, power_mode)
1339    }
1340}
1341
1342impl CoordinatorProxyInterface for CoordinatorProxy {
1343    type ImportImageResponseFut = fidl::client::QueryResponseFut<
1344        CoordinatorImportImageResult,
1345        fidl::encoding::DefaultFuchsiaResourceDialect,
1346    >;
1347    fn r#import_image(
1348        &self,
1349        mut image_metadata: &fidl_fuchsia_hardware_display_types::ImageMetadata,
1350        mut buffer_collection_id: &BufferCollectionId,
1351        mut buffer_index: u32,
1352        mut image_id: &ImageId,
1353    ) -> Self::ImportImageResponseFut {
1354        fn _decode(
1355            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1356        ) -> Result<CoordinatorImportImageResult, fidl::Error> {
1357            let _response = fidl::client::decode_transaction_body::<
1358                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
1359                fidl::encoding::DefaultFuchsiaResourceDialect,
1360                0x3a8636eb9656b4f4,
1361            >(_buf?)?;
1362            Ok(_response.map(|x| x))
1363        }
1364        self.client
1365            .send_query_and_decode::<CoordinatorImportImageRequest, CoordinatorImportImageResult>(
1366                (image_metadata, buffer_collection_id, buffer_index, image_id),
1367                0x3a8636eb9656b4f4,
1368                fidl::encoding::DynamicFlags::empty(),
1369                _decode,
1370            )
1371    }
1372
1373    fn r#release_image(&self, mut image_id: &ImageId) -> Result<(), fidl::Error> {
1374        self.client.send::<CoordinatorReleaseImageRequest>(
1375            (image_id,),
1376            0x477192230517504,
1377            fidl::encoding::DynamicFlags::empty(),
1378        )
1379    }
1380
1381    fn r#import_event(&self, mut event: fidl::Event, mut id: &EventId) -> Result<(), fidl::Error> {
1382        self.client.send::<CoordinatorImportEventRequest>(
1383            (event, id),
1384            0x2864e5dc59390543,
1385            fidl::encoding::DynamicFlags::empty(),
1386        )
1387    }
1388
1389    fn r#release_event(&self, mut id: &EventId) -> Result<(), fidl::Error> {
1390        self.client.send::<CoordinatorReleaseEventRequest>(
1391            (id,),
1392            0x32508c2101606b87,
1393            fidl::encoding::DynamicFlags::empty(),
1394        )
1395    }
1396
1397    type CreateLayerResponseFut = fidl::client::QueryResponseFut<
1398        CoordinatorCreateLayerResult,
1399        fidl::encoding::DefaultFuchsiaResourceDialect,
1400    >;
1401    fn r#create_layer(&self, mut layer_id: &LayerId) -> Self::CreateLayerResponseFut {
1402        fn _decode(
1403            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1404        ) -> Result<CoordinatorCreateLayerResult, fidl::Error> {
1405            let _response = fidl::client::decode_transaction_body::<
1406                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
1407                fidl::encoding::DefaultFuchsiaResourceDialect,
1408                0x2137cfd788a3496b,
1409            >(_buf?)?;
1410            Ok(_response.map(|x| x))
1411        }
1412        self.client
1413            .send_query_and_decode::<CoordinatorCreateLayerRequest, CoordinatorCreateLayerResult>(
1414                (layer_id,),
1415                0x2137cfd788a3496b,
1416                fidl::encoding::DynamicFlags::empty(),
1417                _decode,
1418            )
1419    }
1420
1421    fn r#destroy_layer(&self, mut layer_id: &LayerId) -> Result<(), fidl::Error> {
1422        self.client.send::<CoordinatorDestroyLayerRequest>(
1423            (layer_id,),
1424            0x386e12d092bea2f8,
1425            fidl::encoding::DynamicFlags::empty(),
1426        )
1427    }
1428
1429    fn r#set_display_mode(
1430        &self,
1431        mut display_id: &fidl_fuchsia_hardware_display_types::DisplayId,
1432        mut mode: &fidl_fuchsia_hardware_display_types::Mode,
1433    ) -> Result<(), fidl::Error> {
1434        self.client.send::<CoordinatorSetDisplayModeRequest>(
1435            (display_id, mode),
1436            0xbde3c59ee9c1777,
1437            fidl::encoding::DynamicFlags::empty(),
1438        )
1439    }
1440
1441    fn r#set_display_color_conversion(
1442        &self,
1443        mut display_id: &fidl_fuchsia_hardware_display_types::DisplayId,
1444        mut preoffsets: &[f32; 3],
1445        mut coefficients: &[f32; 9],
1446        mut postoffsets: &[f32; 3],
1447    ) -> Result<(), fidl::Error> {
1448        self.client.send::<CoordinatorSetDisplayColorConversionRequest>(
1449            (display_id, preoffsets, coefficients, postoffsets),
1450            0x2f18186a987d51aa,
1451            fidl::encoding::DynamicFlags::empty(),
1452        )
1453    }
1454
1455    fn r#set_display_layers(
1456        &self,
1457        mut display_id: &fidl_fuchsia_hardware_display_types::DisplayId,
1458        mut layer_ids: &[LayerId],
1459    ) -> Result<(), fidl::Error> {
1460        self.client.send::<CoordinatorSetDisplayLayersRequest>(
1461            (display_id, layer_ids),
1462            0x190e0f6f93be1d89,
1463            fidl::encoding::DynamicFlags::empty(),
1464        )
1465    }
1466
1467    fn r#set_layer_primary_config(
1468        &self,
1469        mut layer_id: &LayerId,
1470        mut image_metadata: &fidl_fuchsia_hardware_display_types::ImageMetadata,
1471    ) -> Result<(), fidl::Error> {
1472        self.client.send::<CoordinatorSetLayerPrimaryConfigRequest>(
1473            (layer_id, image_metadata),
1474            0x68d89ebd518b45b9,
1475            fidl::encoding::DynamicFlags::empty(),
1476        )
1477    }
1478
1479    fn r#set_layer_primary_position(
1480        &self,
1481        mut layer_id: &LayerId,
1482        mut image_source_transformation: fidl_fuchsia_hardware_display_types::CoordinateTransformation,
1483        mut image_source: &fidl_fuchsia_math::RectU,
1484        mut display_destination: &fidl_fuchsia_math::RectU,
1485    ) -> Result<(), fidl::Error> {
1486        self.client.send::<CoordinatorSetLayerPrimaryPositionRequest>(
1487            (layer_id, image_source_transformation, image_source, display_destination),
1488            0x27b192b5a43851e2,
1489            fidl::encoding::DynamicFlags::empty(),
1490        )
1491    }
1492
1493    fn r#set_layer_primary_alpha(
1494        &self,
1495        mut layer_id: &LayerId,
1496        mut mode: fidl_fuchsia_hardware_display_types::AlphaMode,
1497        mut val: f32,
1498    ) -> Result<(), fidl::Error> {
1499        self.client.send::<CoordinatorSetLayerPrimaryAlphaRequest>(
1500            (layer_id, mode, val),
1501            0x104cf2b18b27296d,
1502            fidl::encoding::DynamicFlags::empty(),
1503        )
1504    }
1505
1506    fn r#set_layer_color_config(
1507        &self,
1508        mut layer_id: &LayerId,
1509        mut color: &fidl_fuchsia_hardware_display_types::Color,
1510        mut display_destination: &fidl_fuchsia_math::RectU,
1511    ) -> Result<(), fidl::Error> {
1512        self.client.send::<CoordinatorSetLayerColorConfigRequest>(
1513            (layer_id, color, display_destination),
1514            0x2fa91e9a2a01875f,
1515            fidl::encoding::DynamicFlags::empty(),
1516        )
1517    }
1518
1519    fn r#set_layer_image2(
1520        &self,
1521        mut layer_id: &LayerId,
1522        mut image_id: &ImageId,
1523        mut wait_event_id: &EventId,
1524    ) -> Result<(), fidl::Error> {
1525        self.client.send::<CoordinatorSetLayerImage2Request>(
1526            (layer_id, image_id, wait_event_id),
1527            0x53c6376dfc13a971,
1528            fidl::encoding::DynamicFlags::empty(),
1529        )
1530    }
1531
1532    type CheckConfigResponseFut = fidl::client::QueryResponseFut<
1533        fidl_fuchsia_hardware_display_types::ConfigResult,
1534        fidl::encoding::DefaultFuchsiaResourceDialect,
1535    >;
1536    fn r#check_config(&self) -> Self::CheckConfigResponseFut {
1537        fn _decode(
1538            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1539        ) -> Result<fidl_fuchsia_hardware_display_types::ConfigResult, fidl::Error> {
1540            let _response = fidl::client::decode_transaction_body::<
1541                CoordinatorCheckConfigResponse,
1542                fidl::encoding::DefaultFuchsiaResourceDialect,
1543                0x2bcfb4eb16878158,
1544            >(_buf?)?;
1545            Ok(_response.res)
1546        }
1547        self.client.send_query_and_decode::<
1548            fidl::encoding::EmptyPayload,
1549            fidl_fuchsia_hardware_display_types::ConfigResult,
1550        >(
1551            (),
1552            0x2bcfb4eb16878158,
1553            fidl::encoding::DynamicFlags::empty(),
1554            _decode,
1555        )
1556    }
1557
1558    fn r#discard_config(&self) -> Result<(), fidl::Error> {
1559        self.client.send::<fidl::encoding::EmptyPayload>(
1560            (),
1561            0x1673399e9231dedf,
1562            fidl::encoding::DynamicFlags::empty(),
1563        )
1564    }
1565
1566    type GetLatestCommittedConfigStampResponseFut =
1567        fidl::client::QueryResponseFut<ConfigStamp, fidl::encoding::DefaultFuchsiaResourceDialect>;
1568    fn r#get_latest_committed_config_stamp(
1569        &self,
1570    ) -> Self::GetLatestCommittedConfigStampResponseFut {
1571        fn _decode(
1572            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1573        ) -> Result<ConfigStamp, fidl::Error> {
1574            let _response = fidl::client::decode_transaction_body::<
1575                CoordinatorGetLatestCommittedConfigStampResponse,
1576                fidl::encoding::DefaultFuchsiaResourceDialect,
1577                0x2a441f2c81af5d66,
1578            >(_buf?)?;
1579            Ok(_response.stamp)
1580        }
1581        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ConfigStamp>(
1582            (),
1583            0x2a441f2c81af5d66,
1584            fidl::encoding::DynamicFlags::empty(),
1585            _decode,
1586        )
1587    }
1588
1589    fn r#commit_config(
1590        &self,
1591        mut payload: CoordinatorCommitConfigRequest,
1592    ) -> Result<(), fidl::Error> {
1593        self.client.send::<CoordinatorCommitConfigRequest>(
1594            &mut payload,
1595            0x4489cbd2fcfbaeaf,
1596            fidl::encoding::DynamicFlags::empty(),
1597        )
1598    }
1599
1600    fn r#acknowledge_vsync(&self, mut cookie: u64) -> Result<(), fidl::Error> {
1601        self.client.send::<CoordinatorAcknowledgeVsyncRequest>(
1602            (cookie,),
1603            0x25e921d26107d6ef,
1604            fidl::encoding::DynamicFlags::empty(),
1605        )
1606    }
1607
1608    type ImportBufferCollectionResponseFut = fidl::client::QueryResponseFut<
1609        CoordinatorImportBufferCollectionResult,
1610        fidl::encoding::DefaultFuchsiaResourceDialect,
1611    >;
1612    fn r#import_buffer_collection(
1613        &self,
1614        mut buffer_collection_id: &BufferCollectionId,
1615        mut buffer_collection_token: fidl::endpoints::ClientEnd<
1616            fidl_fuchsia_sysmem2::BufferCollectionTokenMarker,
1617        >,
1618    ) -> Self::ImportBufferCollectionResponseFut {
1619        fn _decode(
1620            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1621        ) -> Result<CoordinatorImportBufferCollectionResult, fidl::Error> {
1622            let _response = fidl::client::decode_transaction_body::<
1623                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
1624                fidl::encoding::DefaultFuchsiaResourceDialect,
1625                0x30d06f510e7f4601,
1626            >(_buf?)?;
1627            Ok(_response.map(|x| x))
1628        }
1629        self.client.send_query_and_decode::<
1630            CoordinatorImportBufferCollectionRequest,
1631            CoordinatorImportBufferCollectionResult,
1632        >(
1633            (buffer_collection_id, buffer_collection_token,),
1634            0x30d06f510e7f4601,
1635            fidl::encoding::DynamicFlags::empty(),
1636            _decode,
1637        )
1638    }
1639
1640    fn r#release_buffer_collection(
1641        &self,
1642        mut buffer_collection_id: &BufferCollectionId,
1643    ) -> Result<(), fidl::Error> {
1644        self.client.send::<CoordinatorReleaseBufferCollectionRequest>(
1645            (buffer_collection_id,),
1646            0x1c7dd5f8b0690be0,
1647            fidl::encoding::DynamicFlags::empty(),
1648        )
1649    }
1650
1651    type SetBufferCollectionConstraintsResponseFut = fidl::client::QueryResponseFut<
1652        CoordinatorSetBufferCollectionConstraintsResult,
1653        fidl::encoding::DefaultFuchsiaResourceDialect,
1654    >;
1655    fn r#set_buffer_collection_constraints(
1656        &self,
1657        mut buffer_collection_id: &BufferCollectionId,
1658        mut buffer_usage: &fidl_fuchsia_hardware_display_types::ImageBufferUsage,
1659    ) -> Self::SetBufferCollectionConstraintsResponseFut {
1660        fn _decode(
1661            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1662        ) -> Result<CoordinatorSetBufferCollectionConstraintsResult, fidl::Error> {
1663            let _response = fidl::client::decode_transaction_body::<
1664                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
1665                fidl::encoding::DefaultFuchsiaResourceDialect,
1666                0x509a4ee9af6035df,
1667            >(_buf?)?;
1668            Ok(_response.map(|x| x))
1669        }
1670        self.client.send_query_and_decode::<
1671            CoordinatorSetBufferCollectionConstraintsRequest,
1672            CoordinatorSetBufferCollectionConstraintsResult,
1673        >(
1674            (buffer_collection_id, buffer_usage,),
1675            0x509a4ee9af6035df,
1676            fidl::encoding::DynamicFlags::empty(),
1677            _decode,
1678        )
1679    }
1680
1681    type IsCaptureSupportedResponseFut = fidl::client::QueryResponseFut<
1682        CoordinatorIsCaptureSupportedResult,
1683        fidl::encoding::DefaultFuchsiaResourceDialect,
1684    >;
1685    fn r#is_capture_supported(&self) -> Self::IsCaptureSupportedResponseFut {
1686        fn _decode(
1687            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1688        ) -> Result<CoordinatorIsCaptureSupportedResult, fidl::Error> {
1689            let _response = fidl::client::decode_transaction_body::<
1690                fidl::encoding::ResultType<CoordinatorIsCaptureSupportedResponse, i32>,
1691                fidl::encoding::DefaultFuchsiaResourceDialect,
1692                0x4ca407277277971b,
1693            >(_buf?)?;
1694            Ok(_response.map(|x| x.supported))
1695        }
1696        self.client.send_query_and_decode::<
1697            fidl::encoding::EmptyPayload,
1698            CoordinatorIsCaptureSupportedResult,
1699        >(
1700            (),
1701            0x4ca407277277971b,
1702            fidl::encoding::DynamicFlags::empty(),
1703            _decode,
1704        )
1705    }
1706
1707    type StartCaptureResponseFut = fidl::client::QueryResponseFut<
1708        CoordinatorStartCaptureResult,
1709        fidl::encoding::DefaultFuchsiaResourceDialect,
1710    >;
1711    fn r#start_capture(
1712        &self,
1713        mut signal_event_id: &EventId,
1714        mut image_id: &ImageId,
1715    ) -> Self::StartCaptureResponseFut {
1716        fn _decode(
1717            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1718        ) -> Result<CoordinatorStartCaptureResult, fidl::Error> {
1719            let _response = fidl::client::decode_transaction_body::<
1720                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
1721                fidl::encoding::DefaultFuchsiaResourceDialect,
1722                0x35cb38f19d96a8db,
1723            >(_buf?)?;
1724            Ok(_response.map(|x| x))
1725        }
1726        self.client
1727            .send_query_and_decode::<CoordinatorStartCaptureRequest, CoordinatorStartCaptureResult>(
1728                (signal_event_id, image_id),
1729                0x35cb38f19d96a8db,
1730                fidl::encoding::DynamicFlags::empty(),
1731                _decode,
1732            )
1733    }
1734
1735    type SetMinimumRgbResponseFut = fidl::client::QueryResponseFut<
1736        CoordinatorSetMinimumRgbResult,
1737        fidl::encoding::DefaultFuchsiaResourceDialect,
1738    >;
1739    fn r#set_minimum_rgb(&self, mut minimum_rgb: u8) -> Self::SetMinimumRgbResponseFut {
1740        fn _decode(
1741            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1742        ) -> Result<CoordinatorSetMinimumRgbResult, fidl::Error> {
1743            let _response = fidl::client::decode_transaction_body::<
1744                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
1745                fidl::encoding::DefaultFuchsiaResourceDialect,
1746                0x1b49251437038b0b,
1747            >(_buf?)?;
1748            Ok(_response.map(|x| x))
1749        }
1750        self.client.send_query_and_decode::<
1751            CoordinatorSetMinimumRgbRequest,
1752            CoordinatorSetMinimumRgbResult,
1753        >(
1754            (minimum_rgb,),
1755            0x1b49251437038b0b,
1756            fidl::encoding::DynamicFlags::empty(),
1757            _decode,
1758        )
1759    }
1760
1761    type SetDisplayPowerModeResponseFut = fidl::client::QueryResponseFut<
1762        CoordinatorSetDisplayPowerModeResult,
1763        fidl::encoding::DefaultFuchsiaResourceDialect,
1764    >;
1765    fn r#set_display_power_mode(
1766        &self,
1767        mut display_id: &fidl_fuchsia_hardware_display_types::DisplayId,
1768        mut power_mode: fidl_fuchsia_hardware_display_types::PowerMode,
1769    ) -> Self::SetDisplayPowerModeResponseFut {
1770        fn _decode(
1771            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1772        ) -> Result<CoordinatorSetDisplayPowerModeResult, fidl::Error> {
1773            let _response = fidl::client::decode_transaction_body::<
1774                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
1775                fidl::encoding::DefaultFuchsiaResourceDialect,
1776                0xf4672f055072c92,
1777            >(_buf?)?;
1778            Ok(_response.map(|x| x))
1779        }
1780        self.client.send_query_and_decode::<
1781            CoordinatorSetDisplayPowerModeRequest,
1782            CoordinatorSetDisplayPowerModeResult,
1783        >(
1784            (display_id, power_mode,),
1785            0xf4672f055072c92,
1786            fidl::encoding::DynamicFlags::empty(),
1787            _decode,
1788        )
1789    }
1790}
1791
1792pub struct CoordinatorEventStream {
1793    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1794}
1795
1796impl std::marker::Unpin for CoordinatorEventStream {}
1797
1798impl futures::stream::FusedStream for CoordinatorEventStream {
1799    fn is_terminated(&self) -> bool {
1800        self.event_receiver.is_terminated()
1801    }
1802}
1803
1804impl futures::Stream for CoordinatorEventStream {
1805    type Item = Result<CoordinatorEvent, fidl::Error>;
1806
1807    fn poll_next(
1808        mut self: std::pin::Pin<&mut Self>,
1809        cx: &mut std::task::Context<'_>,
1810    ) -> std::task::Poll<Option<Self::Item>> {
1811        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1812            &mut self.event_receiver,
1813            cx
1814        )?) {
1815            Some(buf) => std::task::Poll::Ready(Some(CoordinatorEvent::decode(buf))),
1816            None => std::task::Poll::Ready(None),
1817        }
1818    }
1819}
1820
1821#[derive(Debug)]
1822pub enum CoordinatorEvent {}
1823
1824impl CoordinatorEvent {
1825    /// Decodes a message buffer as a [`CoordinatorEvent`].
1826    fn decode(
1827        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1828    ) -> Result<CoordinatorEvent, fidl::Error> {
1829        let (bytes, _handles) = buf.split_mut();
1830        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1831        debug_assert_eq!(tx_header.tx_id, 0);
1832        match tx_header.ordinal {
1833            _ => Err(fidl::Error::UnknownOrdinal {
1834                ordinal: tx_header.ordinal,
1835                protocol_name: <CoordinatorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1836            }),
1837        }
1838    }
1839}
1840
1841/// A Stream of incoming requests for fuchsia.hardware.display/Coordinator.
1842pub struct CoordinatorRequestStream {
1843    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1844    is_terminated: bool,
1845}
1846
1847impl std::marker::Unpin for CoordinatorRequestStream {}
1848
1849impl futures::stream::FusedStream for CoordinatorRequestStream {
1850    fn is_terminated(&self) -> bool {
1851        self.is_terminated
1852    }
1853}
1854
1855impl fidl::endpoints::RequestStream for CoordinatorRequestStream {
1856    type Protocol = CoordinatorMarker;
1857    type ControlHandle = CoordinatorControlHandle;
1858
1859    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1860        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1861    }
1862
1863    fn control_handle(&self) -> Self::ControlHandle {
1864        CoordinatorControlHandle { inner: self.inner.clone() }
1865    }
1866
1867    fn into_inner(
1868        self,
1869    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1870    {
1871        (self.inner, self.is_terminated)
1872    }
1873
1874    fn from_inner(
1875        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1876        is_terminated: bool,
1877    ) -> Self {
1878        Self { inner, is_terminated }
1879    }
1880}
1881
1882impl futures::Stream for CoordinatorRequestStream {
1883    type Item = Result<CoordinatorRequest, fidl::Error>;
1884
1885    fn poll_next(
1886        mut self: std::pin::Pin<&mut Self>,
1887        cx: &mut std::task::Context<'_>,
1888    ) -> std::task::Poll<Option<Self::Item>> {
1889        let this = &mut *self;
1890        if this.inner.check_shutdown(cx) {
1891            this.is_terminated = true;
1892            return std::task::Poll::Ready(None);
1893        }
1894        if this.is_terminated {
1895            panic!("polled CoordinatorRequestStream after completion");
1896        }
1897        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1898            |bytes, handles| {
1899                match this.inner.channel().read_etc(cx, bytes, handles) {
1900                    std::task::Poll::Ready(Ok(())) => {}
1901                    std::task::Poll::Pending => return std::task::Poll::Pending,
1902                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1903                        this.is_terminated = true;
1904                        return std::task::Poll::Ready(None);
1905                    }
1906                    std::task::Poll::Ready(Err(e)) => {
1907                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1908                            e.into(),
1909                        ))));
1910                    }
1911                }
1912
1913                // A message has been received from the channel
1914                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1915
1916                std::task::Poll::Ready(Some(match header.ordinal {
1917                    0x3a8636eb9656b4f4 => {
1918                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1919                        let mut req = fidl::new_empty!(
1920                            CoordinatorImportImageRequest,
1921                            fidl::encoding::DefaultFuchsiaResourceDialect
1922                        );
1923                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CoordinatorImportImageRequest>(&header, _body_bytes, handles, &mut req)?;
1924                        let control_handle = CoordinatorControlHandle { inner: this.inner.clone() };
1925                        Ok(CoordinatorRequest::ImportImage {
1926                            image_metadata: req.image_metadata,
1927                            buffer_collection_id: req.buffer_collection_id,
1928                            buffer_index: req.buffer_index,
1929                            image_id: req.image_id,
1930
1931                            responder: CoordinatorImportImageResponder {
1932                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1933                                tx_id: header.tx_id,
1934                            },
1935                        })
1936                    }
1937                    0x477192230517504 => {
1938                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1939                        let mut req = fidl::new_empty!(
1940                            CoordinatorReleaseImageRequest,
1941                            fidl::encoding::DefaultFuchsiaResourceDialect
1942                        );
1943                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CoordinatorReleaseImageRequest>(&header, _body_bytes, handles, &mut req)?;
1944                        let control_handle = CoordinatorControlHandle { inner: this.inner.clone() };
1945                        Ok(CoordinatorRequest::ReleaseImage {
1946                            image_id: req.image_id,
1947
1948                            control_handle,
1949                        })
1950                    }
1951                    0x2864e5dc59390543 => {
1952                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1953                        let mut req = fidl::new_empty!(
1954                            CoordinatorImportEventRequest,
1955                            fidl::encoding::DefaultFuchsiaResourceDialect
1956                        );
1957                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CoordinatorImportEventRequest>(&header, _body_bytes, handles, &mut req)?;
1958                        let control_handle = CoordinatorControlHandle { inner: this.inner.clone() };
1959                        Ok(CoordinatorRequest::ImportEvent {
1960                            event: req.event,
1961                            id: req.id,
1962
1963                            control_handle,
1964                        })
1965                    }
1966                    0x32508c2101606b87 => {
1967                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1968                        let mut req = fidl::new_empty!(
1969                            CoordinatorReleaseEventRequest,
1970                            fidl::encoding::DefaultFuchsiaResourceDialect
1971                        );
1972                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CoordinatorReleaseEventRequest>(&header, _body_bytes, handles, &mut req)?;
1973                        let control_handle = CoordinatorControlHandle { inner: this.inner.clone() };
1974                        Ok(CoordinatorRequest::ReleaseEvent { id: req.id, control_handle })
1975                    }
1976                    0x2137cfd788a3496b => {
1977                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1978                        let mut req = fidl::new_empty!(
1979                            CoordinatorCreateLayerRequest,
1980                            fidl::encoding::DefaultFuchsiaResourceDialect
1981                        );
1982                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CoordinatorCreateLayerRequest>(&header, _body_bytes, handles, &mut req)?;
1983                        let control_handle = CoordinatorControlHandle { inner: this.inner.clone() };
1984                        Ok(CoordinatorRequest::CreateLayer {
1985                            layer_id: req.layer_id,
1986
1987                            responder: CoordinatorCreateLayerResponder {
1988                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1989                                tx_id: header.tx_id,
1990                            },
1991                        })
1992                    }
1993                    0x386e12d092bea2f8 => {
1994                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1995                        let mut req = fidl::new_empty!(
1996                            CoordinatorDestroyLayerRequest,
1997                            fidl::encoding::DefaultFuchsiaResourceDialect
1998                        );
1999                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CoordinatorDestroyLayerRequest>(&header, _body_bytes, handles, &mut req)?;
2000                        let control_handle = CoordinatorControlHandle { inner: this.inner.clone() };
2001                        Ok(CoordinatorRequest::DestroyLayer {
2002                            layer_id: req.layer_id,
2003
2004                            control_handle,
2005                        })
2006                    }
2007                    0xbde3c59ee9c1777 => {
2008                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2009                        let mut req = fidl::new_empty!(
2010                            CoordinatorSetDisplayModeRequest,
2011                            fidl::encoding::DefaultFuchsiaResourceDialect
2012                        );
2013                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CoordinatorSetDisplayModeRequest>(&header, _body_bytes, handles, &mut req)?;
2014                        let control_handle = CoordinatorControlHandle { inner: this.inner.clone() };
2015                        Ok(CoordinatorRequest::SetDisplayMode {
2016                            display_id: req.display_id,
2017                            mode: req.mode,
2018
2019                            control_handle,
2020                        })
2021                    }
2022                    0x2f18186a987d51aa => {
2023                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2024                        let mut req = fidl::new_empty!(
2025                            CoordinatorSetDisplayColorConversionRequest,
2026                            fidl::encoding::DefaultFuchsiaResourceDialect
2027                        );
2028                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CoordinatorSetDisplayColorConversionRequest>(&header, _body_bytes, handles, &mut req)?;
2029                        let control_handle = CoordinatorControlHandle { inner: this.inner.clone() };
2030                        Ok(CoordinatorRequest::SetDisplayColorConversion {
2031                            display_id: req.display_id,
2032                            preoffsets: req.preoffsets,
2033                            coefficients: req.coefficients,
2034                            postoffsets: req.postoffsets,
2035
2036                            control_handle,
2037                        })
2038                    }
2039                    0x190e0f6f93be1d89 => {
2040                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2041                        let mut req = fidl::new_empty!(
2042                            CoordinatorSetDisplayLayersRequest,
2043                            fidl::encoding::DefaultFuchsiaResourceDialect
2044                        );
2045                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CoordinatorSetDisplayLayersRequest>(&header, _body_bytes, handles, &mut req)?;
2046                        let control_handle = CoordinatorControlHandle { inner: this.inner.clone() };
2047                        Ok(CoordinatorRequest::SetDisplayLayers {
2048                            display_id: req.display_id,
2049                            layer_ids: req.layer_ids,
2050
2051                            control_handle,
2052                        })
2053                    }
2054                    0x68d89ebd518b45b9 => {
2055                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2056                        let mut req = fidl::new_empty!(
2057                            CoordinatorSetLayerPrimaryConfigRequest,
2058                            fidl::encoding::DefaultFuchsiaResourceDialect
2059                        );
2060                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CoordinatorSetLayerPrimaryConfigRequest>(&header, _body_bytes, handles, &mut req)?;
2061                        let control_handle = CoordinatorControlHandle { inner: this.inner.clone() };
2062                        Ok(CoordinatorRequest::SetLayerPrimaryConfig {
2063                            layer_id: req.layer_id,
2064                            image_metadata: req.image_metadata,
2065
2066                            control_handle,
2067                        })
2068                    }
2069                    0x27b192b5a43851e2 => {
2070                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2071                        let mut req = fidl::new_empty!(
2072                            CoordinatorSetLayerPrimaryPositionRequest,
2073                            fidl::encoding::DefaultFuchsiaResourceDialect
2074                        );
2075                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CoordinatorSetLayerPrimaryPositionRequest>(&header, _body_bytes, handles, &mut req)?;
2076                        let control_handle = CoordinatorControlHandle { inner: this.inner.clone() };
2077                        Ok(CoordinatorRequest::SetLayerPrimaryPosition {
2078                            layer_id: req.layer_id,
2079                            image_source_transformation: req.image_source_transformation,
2080                            image_source: req.image_source,
2081                            display_destination: req.display_destination,
2082
2083                            control_handle,
2084                        })
2085                    }
2086                    0x104cf2b18b27296d => {
2087                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2088                        let mut req = fidl::new_empty!(
2089                            CoordinatorSetLayerPrimaryAlphaRequest,
2090                            fidl::encoding::DefaultFuchsiaResourceDialect
2091                        );
2092                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CoordinatorSetLayerPrimaryAlphaRequest>(&header, _body_bytes, handles, &mut req)?;
2093                        let control_handle = CoordinatorControlHandle { inner: this.inner.clone() };
2094                        Ok(CoordinatorRequest::SetLayerPrimaryAlpha {
2095                            layer_id: req.layer_id,
2096                            mode: req.mode,
2097                            val: req.val,
2098
2099                            control_handle,
2100                        })
2101                    }
2102                    0x2fa91e9a2a01875f => {
2103                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2104                        let mut req = fidl::new_empty!(
2105                            CoordinatorSetLayerColorConfigRequest,
2106                            fidl::encoding::DefaultFuchsiaResourceDialect
2107                        );
2108                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CoordinatorSetLayerColorConfigRequest>(&header, _body_bytes, handles, &mut req)?;
2109                        let control_handle = CoordinatorControlHandle { inner: this.inner.clone() };
2110                        Ok(CoordinatorRequest::SetLayerColorConfig {
2111                            layer_id: req.layer_id,
2112                            color: req.color,
2113                            display_destination: req.display_destination,
2114
2115                            control_handle,
2116                        })
2117                    }
2118                    0x53c6376dfc13a971 => {
2119                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2120                        let mut req = fidl::new_empty!(
2121                            CoordinatorSetLayerImage2Request,
2122                            fidl::encoding::DefaultFuchsiaResourceDialect
2123                        );
2124                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CoordinatorSetLayerImage2Request>(&header, _body_bytes, handles, &mut req)?;
2125                        let control_handle = CoordinatorControlHandle { inner: this.inner.clone() };
2126                        Ok(CoordinatorRequest::SetLayerImage2 {
2127                            layer_id: req.layer_id,
2128                            image_id: req.image_id,
2129                            wait_event_id: req.wait_event_id,
2130
2131                            control_handle,
2132                        })
2133                    }
2134                    0x2bcfb4eb16878158 => {
2135                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2136                        let mut req = fidl::new_empty!(
2137                            fidl::encoding::EmptyPayload,
2138                            fidl::encoding::DefaultFuchsiaResourceDialect
2139                        );
2140                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2141                        let control_handle = CoordinatorControlHandle { inner: this.inner.clone() };
2142                        Ok(CoordinatorRequest::CheckConfig {
2143                            responder: CoordinatorCheckConfigResponder {
2144                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2145                                tx_id: header.tx_id,
2146                            },
2147                        })
2148                    }
2149                    0x1673399e9231dedf => {
2150                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2151                        let mut req = fidl::new_empty!(
2152                            fidl::encoding::EmptyPayload,
2153                            fidl::encoding::DefaultFuchsiaResourceDialect
2154                        );
2155                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2156                        let control_handle = CoordinatorControlHandle { inner: this.inner.clone() };
2157                        Ok(CoordinatorRequest::DiscardConfig { control_handle })
2158                    }
2159                    0x2a441f2c81af5d66 => {
2160                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2161                        let mut req = fidl::new_empty!(
2162                            fidl::encoding::EmptyPayload,
2163                            fidl::encoding::DefaultFuchsiaResourceDialect
2164                        );
2165                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2166                        let control_handle = CoordinatorControlHandle { inner: this.inner.clone() };
2167                        Ok(CoordinatorRequest::GetLatestCommittedConfigStamp {
2168                            responder: CoordinatorGetLatestCommittedConfigStampResponder {
2169                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2170                                tx_id: header.tx_id,
2171                            },
2172                        })
2173                    }
2174                    0x4489cbd2fcfbaeaf => {
2175                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2176                        let mut req = fidl::new_empty!(
2177                            CoordinatorCommitConfigRequest,
2178                            fidl::encoding::DefaultFuchsiaResourceDialect
2179                        );
2180                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CoordinatorCommitConfigRequest>(&header, _body_bytes, handles, &mut req)?;
2181                        let control_handle = CoordinatorControlHandle { inner: this.inner.clone() };
2182                        Ok(CoordinatorRequest::CommitConfig { payload: req, control_handle })
2183                    }
2184                    0x25e921d26107d6ef => {
2185                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2186                        let mut req = fidl::new_empty!(
2187                            CoordinatorAcknowledgeVsyncRequest,
2188                            fidl::encoding::DefaultFuchsiaResourceDialect
2189                        );
2190                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CoordinatorAcknowledgeVsyncRequest>(&header, _body_bytes, handles, &mut req)?;
2191                        let control_handle = CoordinatorControlHandle { inner: this.inner.clone() };
2192                        Ok(CoordinatorRequest::AcknowledgeVsync {
2193                            cookie: req.cookie,
2194
2195                            control_handle,
2196                        })
2197                    }
2198                    0x30d06f510e7f4601 => {
2199                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2200                        let mut req = fidl::new_empty!(
2201                            CoordinatorImportBufferCollectionRequest,
2202                            fidl::encoding::DefaultFuchsiaResourceDialect
2203                        );
2204                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CoordinatorImportBufferCollectionRequest>(&header, _body_bytes, handles, &mut req)?;
2205                        let control_handle = CoordinatorControlHandle { inner: this.inner.clone() };
2206                        Ok(CoordinatorRequest::ImportBufferCollection {
2207                            buffer_collection_id: req.buffer_collection_id,
2208                            buffer_collection_token: req.buffer_collection_token,
2209
2210                            responder: CoordinatorImportBufferCollectionResponder {
2211                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2212                                tx_id: header.tx_id,
2213                            },
2214                        })
2215                    }
2216                    0x1c7dd5f8b0690be0 => {
2217                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2218                        let mut req = fidl::new_empty!(
2219                            CoordinatorReleaseBufferCollectionRequest,
2220                            fidl::encoding::DefaultFuchsiaResourceDialect
2221                        );
2222                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CoordinatorReleaseBufferCollectionRequest>(&header, _body_bytes, handles, &mut req)?;
2223                        let control_handle = CoordinatorControlHandle { inner: this.inner.clone() };
2224                        Ok(CoordinatorRequest::ReleaseBufferCollection {
2225                            buffer_collection_id: req.buffer_collection_id,
2226
2227                            control_handle,
2228                        })
2229                    }
2230                    0x509a4ee9af6035df => {
2231                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2232                        let mut req = fidl::new_empty!(
2233                            CoordinatorSetBufferCollectionConstraintsRequest,
2234                            fidl::encoding::DefaultFuchsiaResourceDialect
2235                        );
2236                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CoordinatorSetBufferCollectionConstraintsRequest>(&header, _body_bytes, handles, &mut req)?;
2237                        let control_handle = CoordinatorControlHandle { inner: this.inner.clone() };
2238                        Ok(CoordinatorRequest::SetBufferCollectionConstraints {
2239                            buffer_collection_id: req.buffer_collection_id,
2240                            buffer_usage: req.buffer_usage,
2241
2242                            responder: CoordinatorSetBufferCollectionConstraintsResponder {
2243                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2244                                tx_id: header.tx_id,
2245                            },
2246                        })
2247                    }
2248                    0x4ca407277277971b => {
2249                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2250                        let mut req = fidl::new_empty!(
2251                            fidl::encoding::EmptyPayload,
2252                            fidl::encoding::DefaultFuchsiaResourceDialect
2253                        );
2254                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2255                        let control_handle = CoordinatorControlHandle { inner: this.inner.clone() };
2256                        Ok(CoordinatorRequest::IsCaptureSupported {
2257                            responder: CoordinatorIsCaptureSupportedResponder {
2258                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2259                                tx_id: header.tx_id,
2260                            },
2261                        })
2262                    }
2263                    0x35cb38f19d96a8db => {
2264                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2265                        let mut req = fidl::new_empty!(
2266                            CoordinatorStartCaptureRequest,
2267                            fidl::encoding::DefaultFuchsiaResourceDialect
2268                        );
2269                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CoordinatorStartCaptureRequest>(&header, _body_bytes, handles, &mut req)?;
2270                        let control_handle = CoordinatorControlHandle { inner: this.inner.clone() };
2271                        Ok(CoordinatorRequest::StartCapture {
2272                            signal_event_id: req.signal_event_id,
2273                            image_id: req.image_id,
2274
2275                            responder: CoordinatorStartCaptureResponder {
2276                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2277                                tx_id: header.tx_id,
2278                            },
2279                        })
2280                    }
2281                    0x1b49251437038b0b => {
2282                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2283                        let mut req = fidl::new_empty!(
2284                            CoordinatorSetMinimumRgbRequest,
2285                            fidl::encoding::DefaultFuchsiaResourceDialect
2286                        );
2287                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CoordinatorSetMinimumRgbRequest>(&header, _body_bytes, handles, &mut req)?;
2288                        let control_handle = CoordinatorControlHandle { inner: this.inner.clone() };
2289                        Ok(CoordinatorRequest::SetMinimumRgb {
2290                            minimum_rgb: req.minimum_rgb,
2291
2292                            responder: CoordinatorSetMinimumRgbResponder {
2293                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2294                                tx_id: header.tx_id,
2295                            },
2296                        })
2297                    }
2298                    0xf4672f055072c92 => {
2299                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2300                        let mut req = fidl::new_empty!(
2301                            CoordinatorSetDisplayPowerModeRequest,
2302                            fidl::encoding::DefaultFuchsiaResourceDialect
2303                        );
2304                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CoordinatorSetDisplayPowerModeRequest>(&header, _body_bytes, handles, &mut req)?;
2305                        let control_handle = CoordinatorControlHandle { inner: this.inner.clone() };
2306                        Ok(CoordinatorRequest::SetDisplayPowerMode {
2307                            display_id: req.display_id,
2308                            power_mode: req.power_mode,
2309
2310                            responder: CoordinatorSetDisplayPowerModeResponder {
2311                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2312                                tx_id: header.tx_id,
2313                            },
2314                        })
2315                    }
2316                    _ => Err(fidl::Error::UnknownOrdinal {
2317                        ordinal: header.ordinal,
2318                        protocol_name:
2319                            <CoordinatorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2320                    }),
2321                }))
2322            },
2323        )
2324    }
2325}
2326
2327/// Interface for accessing the display hardware.
2328///
2329/// A display configuration can be separated into two parts: the layer layout and
2330/// the layer contents. The layout includes all parts of a configuration other
2331/// than the image handles. The submitted configuration is composed of the most
2332/// recently committed layout and a ready image from each layer - see
2333/// SetLayerImage2 for details on how the ready image is defined. Note the
2334/// requirement that each layer has a ready image. Whenever a new submitted
2335/// configuration is available, it is immediately given to the hardware. This
2336/// allows the layout and each layer's contents to advance independently when
2337/// possible.
2338///
2339/// Performing illegal actions on the interface will result in the interface
2340/// being closed.  The channel closure epitaph will return one of 4 values:
2341/// - ZX_ERR_INVALID_ARGS: for trivially-verifiable client errors, such as providing an ID for a
2342///       nonexistent image/layer/event, or a non-monotonically-increasing config stamp to
2343///       ApplyConfig, etc.
2344/// - ZX_ERR_BAD_STATE: indicates that the client has violated other API invariants, such as reusing
2345///       an event that hasn't been signaled yet.
2346/// - ZX_ERR_NO_MEMORY: memory could not be allocated to satisfy the requested operation.
2347/// - ZX_ERR_INTERNAL: catch-all used for any error that is not listed above.
2348#[derive(Debug)]
2349pub enum CoordinatorRequest {
2350    /// Imports a Buffer-Collection backed image.
2351    ///
2352    /// Returns `ZX_ERR_NOT_SUPPORTED` if the display hardware doesn't support
2353    /// `image_metadata`.
2354    /// Returns `ZX_ERR_ALREADY_EXISTS` if `image_id` was used in a successful
2355    /// `ImportImage()` without a corresponding `ReleaseImage()`.
2356    /// Returns `ZX_ERR_NO_MEMORY` if memory cannot be allocated for managing the image
2357    /// Additionally, this method delegates internally to `fuchsia.hardware.display.engine/Engine`,
2358    /// and will forward errors received from `ImportImage()` and `ImportImageForCapture()`.
2359    ///
2360    /// The implementation must ignore any Sysmem information around weak VMO
2361    /// handles. Display stack consumers are responsible for ensuring that weak
2362    /// VMOs are closed in a timely manner, which may involve calling
2363    /// [`Coordinator.ReleaseImage`] and [`Coordinator.CommitConfig`].
2364    ImportImage {
2365        image_metadata: fidl_fuchsia_hardware_display_types::ImageMetadata,
2366        buffer_collection_id: BufferCollectionId,
2367        buffer_index: u32,
2368        image_id: ImageId,
2369        responder: CoordinatorImportImageResponder,
2370    },
2371    /// Releases an imported image.
2372    ///
2373    /// `image_id` must be already imported by
2374    /// [`fuchsia.hardware.display/Coordinator.ImportImage`].
2375    ///
2376    /// The image must not be the capture target of an ongoing capture specified
2377    /// in [`fuchsia.hardware.display/Coordinator.StartCapture`].
2378    ///
2379    /// When an image is released, it is immediately removed from any draft
2380    /// configurations, and any fences associated with the image are dropped.
2381    /// The resources associated with the image will be released as soon as the
2382    /// image is no longer in use.
2383    ReleaseImage { image_id: ImageId, control_handle: CoordinatorControlHandle },
2384    /// Imports an event into the driver and associates it with the given id.
2385    ///
2386    /// It is illegal for id to be equal to INVALID_DISP_ID, and it is undefined to
2387    /// import one event with two different ids or to import two different events
2388    /// with the same id (note that ids map well to koids).
2389    ///
2390    /// If a client is reusing events, they must clear the signal
2391    /// before referencing the id again.
2392    ImportEvent { event: fidl::Event, id: EventId, control_handle: CoordinatorControlHandle },
2393    /// Releases the event imported with the given id.
2394    ///
2395    /// If any images are currently using the given event, the event
2396    /// will still be waited up or signaled as appropriate before its
2397    /// resources are released. It is an error to reuse an ID while the
2398    /// submitted config has references to it.
2399    ReleaseEvent { id: EventId, control_handle: CoordinatorControlHandle },
2400    /// Creates a new layer.
2401    ///
2402    /// Layers are not associated with a particular display, but they can only be
2403    /// shown on at most one display at any given time.  A layer is considered in
2404    /// use from the time it is passed to SetDisplayLayers until a subsequent
2405    /// configuration is committed which does not include the layer or until its
2406    /// display is removed.
2407    ///
2408    /// * `layer_id` must be a valid ID (not equal to `INVALID_DISP_ID`).
2409    /// * `layer_id` must not be in use (not equal to the ID of any currently
2410    ///   existing layer in the same `Coordinator` session).
2411    CreateLayer { layer_id: LayerId, responder: CoordinatorCreateLayerResponder },
2412    /// Destroys the given layer.
2413    ///
2414    /// It is illegal to destroy a layer which does not exist or which is in use.
2415    DestroyLayer { layer_id: LayerId, control_handle: CoordinatorControlHandle },
2416    /// Sets the mode for a display.
2417    SetDisplayMode {
2418        display_id: fidl_fuchsia_hardware_display_types::DisplayId,
2419        mode: fidl_fuchsia_hardware_display_types::Mode,
2420        control_handle: CoordinatorControlHandle,
2421    },
2422    /// Set the color conversion applied to the display. The conversion is applied to
2423    /// to each pixel according to the formula:
2424    ///
2425    /// (coefficients * (pixel + preoffsets)) + postoffsets
2426    ///
2427    /// where pixel is a column vector consisting of the pixel's 3 components.
2428    ///
2429    /// `coefficients` is passed in row-major order. If the first entry of an array is NaN, the
2430    /// array is treated as the identity element for the relevant operation.
2431    /// Hardware that support color correction generally accept a limited range of coefficient
2432    /// values. Coefficients in the range of [-2, 2] inclusive will be accepted by most
2433    /// hardware. The hardware driver will clamp values that are outside its acceptable range.
2434    ///
2435    /// `preoffsets`, `postoffsets`: Clients are encourged to produce color correction values that
2436    /// do not depend on pre and post offsets since some hardware do not have support for that.
2437    /// For cases where pre and post offset values need to be used, the range should be limited to
2438    /// (-1, 1) exclusive as confirmed by CheckConfig API. Values outside this range will be
2439    /// rejected.
2440    ///
2441    /// Clients are encouraged to use the CheckConfig API to confirm support for correction and to
2442    /// validate their color correction input values.
2443    ///
2444    /// This a stateful call. Once color conversion values have been succesfully applied via a call
2445    /// to CommitConfig() they will remain in place until changed and another CommitConfig() call is
2446    /// successful. If SetDisplayColorConversion() is called and then the config is discarded, then
2447    /// the last successfully committed state is restored.
2448    SetDisplayColorConversion {
2449        display_id: fidl_fuchsia_hardware_display_types::DisplayId,
2450        preoffsets: [f32; 3],
2451        coefficients: [f32; 9],
2452        postoffsets: [f32; 3],
2453        control_handle: CoordinatorControlHandle,
2454    },
2455    /// Assigns a list of layers to be composited on a display.
2456    SetDisplayLayers {
2457        display_id: fidl_fuchsia_hardware_display_types::DisplayId,
2458        layer_ids: Vec<LayerId>,
2459        control_handle: CoordinatorControlHandle,
2460    },
2461    /// Configures the layer as a primary layer with no image and the default
2462    /// config (no src_frame cropping, the identity transform, positioned in the
2463    /// top-left corner of the composed output, and no scaling).
2464    ///
2465    /// See the documentation on SetLayerImage for details on how this method
2466    /// affects the layer's contents.
2467    ///
2468    /// It is illegal to pass an invalid layer id.
2469    SetLayerPrimaryConfig {
2470        layer_id: LayerId,
2471        image_metadata: fidl_fuchsia_hardware_display_types::ImageMetadata,
2472        control_handle: CoordinatorControlHandle,
2473    },
2474    /// Sets the layer transform, scaling, and positioning.
2475    ///
2476    /// CheckConfig() will return INVALID_CONFIG if any of the configuration
2477    /// validity conditions specified here is violated.
2478    ///
2479    /// Calling this on a non-primary layer or passing an invalid transform is
2480    /// illegal.
2481    SetLayerPrimaryPosition {
2482        layer_id: LayerId,
2483        image_source_transformation: fidl_fuchsia_hardware_display_types::CoordinateTransformation,
2484        image_source: fidl_fuchsia_math::RectU,
2485        display_destination: fidl_fuchsia_math::RectU,
2486        control_handle: CoordinatorControlHandle,
2487    },
2488    /// Sets the alpha mode of the plane.
2489    ///
2490    /// If `mode` == DISABLED, the layer is opaque and `val` is ignored.
2491    ///
2492    /// If `mode` == PREMULTIPLIED or HW_MULTIPLY and `val` is NaN, the alpha
2493    /// used when blending is determined by the per-pixel alpha channel.
2494    ///
2495    /// If `mode` == PREMULTIPLIED or HW_MULTIPLY and `val` is not NaN, the
2496    /// alpha used when blending is the product of `val` and any per-pixel
2497    /// alpha. Additionally, if `mode` == PREMULTIPLIED, then the hardware
2498    /// premultiplies the color channel with `val` before blending.
2499    ///
2500    /// It is illegal to call this on a non-primary layer, to pass an
2501    /// invalid mode, or to pass a value of `val` which is not NaN or
2502    /// in the range [0, 1].
2503    SetLayerPrimaryAlpha {
2504        layer_id: LayerId,
2505        mode: fidl_fuchsia_hardware_display_types::AlphaMode,
2506        val: f32,
2507        control_handle: CoordinatorControlHandle,
2508    },
2509    /// Configures the layer as a solid color fill layer.
2510    ///
2511    /// It is illegal to call this on an invalid layer.
2512    SetLayerColorConfig {
2513        layer_id: LayerId,
2514        color: fidl_fuchsia_hardware_display_types::Color,
2515        display_destination: fidl_fuchsia_math::RectU,
2516        control_handle: CoordinatorControlHandle,
2517    },
2518    /// Sets the image for the layer's draft configuration.
2519    ///
2520    /// If wait_event_id corresponds to an imported event, the driver will
2521    /// wait for ZX_EVENT_SIGNALED on the object before presenting the image.
2522    ///
2523    /// A layer's submitted image is the most recently committed image which either has
2524    /// no wait event or whose wait event has been signaled. Whenever a new image
2525    /// is committed, any older images which never got committed are dropped, and
2526    /// their signal events will be fired as soon as their wait events are
2527    /// signaled. The driver also does not have any concept like 'target vsync',
2528    /// meaning that if multiple images are committed within one vsync period, then
2529    /// only the last image will actually be displayed.
2530    ///
2531    /// By default, the driver retains a submitted image until a new image is
2532    /// submitted. However, setting a layer's ImageConfig with SetLayerPrimaryConfig
2533    /// resets the layer's submitted and waiting images, even if the new ImageConfig
2534    /// matches the old ImageConfig.
2535    ///
2536    /// An image cannot be used for multiple layers simultaneously, nor can an
2537    /// image be given back to the display coordinator while it is still in use.
2538    /// An image is considered in use when it is part of a draft configuration
2539    /// or from when its configuration is committed until it is replaced by a
2540    /// subsequent configuration that is *displayed* (not merely committed).
2541    ///
2542    /// It is illegal to call this with an invalid layer or image id, to
2543    /// call it on a color layer, or to call it with an image and layer whose
2544    /// ImageConfigs do not match. It is illegal to commit a configuration
2545    /// with an image layer that has no image (note that is is not illegal to
2546    /// validate such a configuration). It is illegal to reuse a wait event which
2547    /// another layer that has not been presented is waiting on.
2548    ///
2549    /// Each layer can track a maximum of `MAX_WAITING_IMAGES_PER_LAYER` waiting images.
2550    /// An image becomes "waiting" when it is the most recent image set to a layer that appears in
2551    /// a config that is committed via `CommitConfig()` or similar.  To avoid exceeding the maximum,
2552    /// the client can infer that the image is no longer waiting by:
2553    ///   - noting the config stamp when the config containing the layer/image is committed
2554    ///   - watching for that same (or later) config stamp to be returned by
2555    ///     `CoordinatorListener.OnVsync()`.
2556    SetLayerImage2 {
2557        layer_id: LayerId,
2558        image_id: ImageId,
2559        wait_event_id: EventId,
2560        control_handle: CoordinatorControlHandle,
2561    },
2562    /// Validates the draft configuration.
2563    ///
2564    /// Validation entails checking that the draft configuration can be used
2565    /// by the system's display hardware.
2566    ///
2567    /// Most SetX operations require verifying the draft configuration. The
2568    /// following operations do not require revalidation.
2569    /// * SetLayerImage2()
2570    CheckConfig { responder: CoordinatorCheckConfigResponder },
2571    /// Discard all draft configuration changes.
2572    DiscardConfig { control_handle: CoordinatorControlHandle },
2573    /// Gets the stamp provided with the latest configuration the client
2574    /// committed (by calling CommitConfig()) and the display core driver
2575    /// accepted; the display configuration may not have been rendered yet
2576    /// because of pending image availability or draft layer changes.
2577    /// If no configuration was committed before, returns `INVALID_CONFIG_STAMP_VALUE`.
2578    GetLatestCommittedConfigStamp { responder: CoordinatorGetLatestCommittedConfigStampResponder },
2579    /// Commits any draft changes to the current configuration. This will
2580    /// not apply draft changes to layers which are not on any display.
2581    ///
2582    /// If the draft configuration cannot be committed, this call will silently
2583    /// fail, so the client should ensure its configuration is valid by
2584    /// calling [`Coordinator.CheckConfig`].
2585    CommitConfig {
2586        payload: CoordinatorCommitConfigRequest,
2587        control_handle: CoordinatorControlHandle,
2588    },
2589    /// Acknowledges the receipt of one `OnVsync` message.
2590    AcknowledgeVsync { cookie: u64, control_handle: CoordinatorControlHandle },
2591    /// Import a sysmem buffer collection token. `buffer_collection_id` must not
2592    /// already be in use.
2593    ImportBufferCollection {
2594        buffer_collection_id: BufferCollectionId,
2595        buffer_collection_token:
2596            fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem2::BufferCollectionTokenMarker>,
2597        responder: CoordinatorImportBufferCollectionResponder,
2598    },
2599    /// Release an imported buffer collection.
2600    ReleaseBufferCollection {
2601        buffer_collection_id: BufferCollectionId,
2602        control_handle: CoordinatorControlHandle,
2603    },
2604    /// Takes an imported buffer collection and sets the constraints
2605    /// on it so that it can be imported with a specific config.
2606    SetBufferCollectionConstraints {
2607        buffer_collection_id: BufferCollectionId,
2608        buffer_usage: fidl_fuchsia_hardware_display_types::ImageBufferUsage,
2609        responder: CoordinatorSetBufferCollectionConstraintsResponder,
2610    },
2611    /// Returns true if Capture is supported on the platform.
2612    IsCaptureSupported { responder: CoordinatorIsCaptureSupportedResponder },
2613    /// Starts capture. Client must provide a valid signal_event_id and
2614    /// image_id. signal_event_id must have been imported into the driver
2615    /// using ImportEvent FIDL API. Image_id is the id from ImportImageForCapture.
2616    /// The client will get notified once capture is complete via signal_event_id.
2617    /// Returns ZX_ERR_NOT_SUPPORTED if coordinator does not support capture
2618    StartCapture {
2619        signal_event_id: EventId,
2620        image_id: ImageId,
2621        responder: CoordinatorStartCaptureResponder,
2622    },
2623    /// Set the minimum value of rgb channels. Valid range [0 255] inclusive. Returns
2624    /// ZX_ERR_NOT_SUPPORTED when the display hardware does not support this feature.
2625    /// This API is meant to address backlight bleeding that may occur on some hardware
2626    /// that have a specific type of panel and hardware assembly. The evolution of this
2627    /// API is highly hardware and product dependant and therefore as products evolve, this
2628    /// API may change or support for this API may become non-existent. Therefore, this
2629    /// API should be used with caution.
2630    ///
2631    /// Unlike other calls in this API, SetMiniumRgb is applied immediately, and does not
2632    /// wait for CommitConfig(). It is, however, still stateful.
2633    SetMinimumRgb { minimum_rgb: u8, responder: CoordinatorSetMinimumRgbResponder },
2634    /// Sets the display panel power mode.
2635    ///
2636    /// This call takes effect immediately. Clients don't need to call
2637    /// [`Coordinator.CommitConfig`].
2638    ///
2639    /// Fails with ZX_ERR_NOT_FOUND if `display_id` does not belong to a display
2640    /// known by the Coordinator. This can happen if a client issues a call to
2641    /// [`Coordinator.SetDisplayPowerMode`] before it receives a notification
2642    /// that the display was removed.
2643    ///
2644    /// This method is not idempotent. Each [`Coordinator.SetDisplayPowerMode`]
2645    /// call explicitly sets the power mode on the display hardware, though the
2646    /// display hardware driver may choose to behave idempotently.
2647    ///
2648    /// Fails with ZX_ERR_NOT_SUPPORTED if the display drivers or the hardware
2649    /// don't support the given `power_mode`.
2650    SetDisplayPowerMode {
2651        display_id: fidl_fuchsia_hardware_display_types::DisplayId,
2652        power_mode: fidl_fuchsia_hardware_display_types::PowerMode,
2653        responder: CoordinatorSetDisplayPowerModeResponder,
2654    },
2655}
2656
2657impl CoordinatorRequest {
2658    #[allow(irrefutable_let_patterns)]
2659    pub fn into_import_image(
2660        self,
2661    ) -> Option<(
2662        fidl_fuchsia_hardware_display_types::ImageMetadata,
2663        BufferCollectionId,
2664        u32,
2665        ImageId,
2666        CoordinatorImportImageResponder,
2667    )> {
2668        if let CoordinatorRequest::ImportImage {
2669            image_metadata,
2670            buffer_collection_id,
2671            buffer_index,
2672            image_id,
2673            responder,
2674        } = self
2675        {
2676            Some((image_metadata, buffer_collection_id, buffer_index, image_id, responder))
2677        } else {
2678            None
2679        }
2680    }
2681
2682    #[allow(irrefutable_let_patterns)]
2683    pub fn into_release_image(self) -> Option<(ImageId, CoordinatorControlHandle)> {
2684        if let CoordinatorRequest::ReleaseImage { image_id, control_handle } = self {
2685            Some((image_id, control_handle))
2686        } else {
2687            None
2688        }
2689    }
2690
2691    #[allow(irrefutable_let_patterns)]
2692    pub fn into_import_event(self) -> Option<(fidl::Event, EventId, CoordinatorControlHandle)> {
2693        if let CoordinatorRequest::ImportEvent { event, id, control_handle } = self {
2694            Some((event, id, control_handle))
2695        } else {
2696            None
2697        }
2698    }
2699
2700    #[allow(irrefutable_let_patterns)]
2701    pub fn into_release_event(self) -> Option<(EventId, CoordinatorControlHandle)> {
2702        if let CoordinatorRequest::ReleaseEvent { id, control_handle } = self {
2703            Some((id, control_handle))
2704        } else {
2705            None
2706        }
2707    }
2708
2709    #[allow(irrefutable_let_patterns)]
2710    pub fn into_create_layer(self) -> Option<(LayerId, CoordinatorCreateLayerResponder)> {
2711        if let CoordinatorRequest::CreateLayer { layer_id, responder } = self {
2712            Some((layer_id, responder))
2713        } else {
2714            None
2715        }
2716    }
2717
2718    #[allow(irrefutable_let_patterns)]
2719    pub fn into_destroy_layer(self) -> Option<(LayerId, CoordinatorControlHandle)> {
2720        if let CoordinatorRequest::DestroyLayer { layer_id, control_handle } = self {
2721            Some((layer_id, control_handle))
2722        } else {
2723            None
2724        }
2725    }
2726
2727    #[allow(irrefutable_let_patterns)]
2728    pub fn into_set_display_mode(
2729        self,
2730    ) -> Option<(
2731        fidl_fuchsia_hardware_display_types::DisplayId,
2732        fidl_fuchsia_hardware_display_types::Mode,
2733        CoordinatorControlHandle,
2734    )> {
2735        if let CoordinatorRequest::SetDisplayMode { display_id, mode, control_handle } = self {
2736            Some((display_id, mode, control_handle))
2737        } else {
2738            None
2739        }
2740    }
2741
2742    #[allow(irrefutable_let_patterns)]
2743    pub fn into_set_display_color_conversion(
2744        self,
2745    ) -> Option<(
2746        fidl_fuchsia_hardware_display_types::DisplayId,
2747        [f32; 3],
2748        [f32; 9],
2749        [f32; 3],
2750        CoordinatorControlHandle,
2751    )> {
2752        if let CoordinatorRequest::SetDisplayColorConversion {
2753            display_id,
2754            preoffsets,
2755            coefficients,
2756            postoffsets,
2757            control_handle,
2758        } = self
2759        {
2760            Some((display_id, preoffsets, coefficients, postoffsets, control_handle))
2761        } else {
2762            None
2763        }
2764    }
2765
2766    #[allow(irrefutable_let_patterns)]
2767    pub fn into_set_display_layers(
2768        self,
2769    ) -> Option<(
2770        fidl_fuchsia_hardware_display_types::DisplayId,
2771        Vec<LayerId>,
2772        CoordinatorControlHandle,
2773    )> {
2774        if let CoordinatorRequest::SetDisplayLayers { display_id, layer_ids, control_handle } = self
2775        {
2776            Some((display_id, layer_ids, control_handle))
2777        } else {
2778            None
2779        }
2780    }
2781
2782    #[allow(irrefutable_let_patterns)]
2783    pub fn into_set_layer_primary_config(
2784        self,
2785    ) -> Option<(
2786        LayerId,
2787        fidl_fuchsia_hardware_display_types::ImageMetadata,
2788        CoordinatorControlHandle,
2789    )> {
2790        if let CoordinatorRequest::SetLayerPrimaryConfig {
2791            layer_id,
2792            image_metadata,
2793            control_handle,
2794        } = self
2795        {
2796            Some((layer_id, image_metadata, control_handle))
2797        } else {
2798            None
2799        }
2800    }
2801
2802    #[allow(irrefutable_let_patterns)]
2803    pub fn into_set_layer_primary_position(
2804        self,
2805    ) -> Option<(
2806        LayerId,
2807        fidl_fuchsia_hardware_display_types::CoordinateTransformation,
2808        fidl_fuchsia_math::RectU,
2809        fidl_fuchsia_math::RectU,
2810        CoordinatorControlHandle,
2811    )> {
2812        if let CoordinatorRequest::SetLayerPrimaryPosition {
2813            layer_id,
2814            image_source_transformation,
2815            image_source,
2816            display_destination,
2817            control_handle,
2818        } = self
2819        {
2820            Some((
2821                layer_id,
2822                image_source_transformation,
2823                image_source,
2824                display_destination,
2825                control_handle,
2826            ))
2827        } else {
2828            None
2829        }
2830    }
2831
2832    #[allow(irrefutable_let_patterns)]
2833    pub fn into_set_layer_primary_alpha(
2834        self,
2835    ) -> Option<(
2836        LayerId,
2837        fidl_fuchsia_hardware_display_types::AlphaMode,
2838        f32,
2839        CoordinatorControlHandle,
2840    )> {
2841        if let CoordinatorRequest::SetLayerPrimaryAlpha { layer_id, mode, val, control_handle } =
2842            self
2843        {
2844            Some((layer_id, mode, val, control_handle))
2845        } else {
2846            None
2847        }
2848    }
2849
2850    #[allow(irrefutable_let_patterns)]
2851    pub fn into_set_layer_color_config(
2852        self,
2853    ) -> Option<(
2854        LayerId,
2855        fidl_fuchsia_hardware_display_types::Color,
2856        fidl_fuchsia_math::RectU,
2857        CoordinatorControlHandle,
2858    )> {
2859        if let CoordinatorRequest::SetLayerColorConfig {
2860            layer_id,
2861            color,
2862            display_destination,
2863            control_handle,
2864        } = self
2865        {
2866            Some((layer_id, color, display_destination, control_handle))
2867        } else {
2868            None
2869        }
2870    }
2871
2872    #[allow(irrefutable_let_patterns)]
2873    pub fn into_set_layer_image2(
2874        self,
2875    ) -> Option<(LayerId, ImageId, EventId, CoordinatorControlHandle)> {
2876        if let CoordinatorRequest::SetLayerImage2 {
2877            layer_id,
2878            image_id,
2879            wait_event_id,
2880            control_handle,
2881        } = self
2882        {
2883            Some((layer_id, image_id, wait_event_id, control_handle))
2884        } else {
2885            None
2886        }
2887    }
2888
2889    #[allow(irrefutable_let_patterns)]
2890    pub fn into_check_config(self) -> Option<(CoordinatorCheckConfigResponder)> {
2891        if let CoordinatorRequest::CheckConfig { responder } = self {
2892            Some((responder))
2893        } else {
2894            None
2895        }
2896    }
2897
2898    #[allow(irrefutable_let_patterns)]
2899    pub fn into_discard_config(self) -> Option<(CoordinatorControlHandle)> {
2900        if let CoordinatorRequest::DiscardConfig { control_handle } = self {
2901            Some((control_handle))
2902        } else {
2903            None
2904        }
2905    }
2906
2907    #[allow(irrefutable_let_patterns)]
2908    pub fn into_get_latest_committed_config_stamp(
2909        self,
2910    ) -> Option<(CoordinatorGetLatestCommittedConfigStampResponder)> {
2911        if let CoordinatorRequest::GetLatestCommittedConfigStamp { responder } = self {
2912            Some((responder))
2913        } else {
2914            None
2915        }
2916    }
2917
2918    #[allow(irrefutable_let_patterns)]
2919    pub fn into_commit_config(
2920        self,
2921    ) -> Option<(CoordinatorCommitConfigRequest, CoordinatorControlHandle)> {
2922        if let CoordinatorRequest::CommitConfig { payload, control_handle } = self {
2923            Some((payload, control_handle))
2924        } else {
2925            None
2926        }
2927    }
2928
2929    #[allow(irrefutable_let_patterns)]
2930    pub fn into_acknowledge_vsync(self) -> Option<(u64, CoordinatorControlHandle)> {
2931        if let CoordinatorRequest::AcknowledgeVsync { cookie, control_handle } = self {
2932            Some((cookie, control_handle))
2933        } else {
2934            None
2935        }
2936    }
2937
2938    #[allow(irrefutable_let_patterns)]
2939    pub fn into_import_buffer_collection(
2940        self,
2941    ) -> Option<(
2942        BufferCollectionId,
2943        fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem2::BufferCollectionTokenMarker>,
2944        CoordinatorImportBufferCollectionResponder,
2945    )> {
2946        if let CoordinatorRequest::ImportBufferCollection {
2947            buffer_collection_id,
2948            buffer_collection_token,
2949            responder,
2950        } = self
2951        {
2952            Some((buffer_collection_id, buffer_collection_token, responder))
2953        } else {
2954            None
2955        }
2956    }
2957
2958    #[allow(irrefutable_let_patterns)]
2959    pub fn into_release_buffer_collection(
2960        self,
2961    ) -> Option<(BufferCollectionId, CoordinatorControlHandle)> {
2962        if let CoordinatorRequest::ReleaseBufferCollection {
2963            buffer_collection_id,
2964            control_handle,
2965        } = self
2966        {
2967            Some((buffer_collection_id, control_handle))
2968        } else {
2969            None
2970        }
2971    }
2972
2973    #[allow(irrefutable_let_patterns)]
2974    pub fn into_set_buffer_collection_constraints(
2975        self,
2976    ) -> Option<(
2977        BufferCollectionId,
2978        fidl_fuchsia_hardware_display_types::ImageBufferUsage,
2979        CoordinatorSetBufferCollectionConstraintsResponder,
2980    )> {
2981        if let CoordinatorRequest::SetBufferCollectionConstraints {
2982            buffer_collection_id,
2983            buffer_usage,
2984            responder,
2985        } = self
2986        {
2987            Some((buffer_collection_id, buffer_usage, responder))
2988        } else {
2989            None
2990        }
2991    }
2992
2993    #[allow(irrefutable_let_patterns)]
2994    pub fn into_is_capture_supported(self) -> Option<(CoordinatorIsCaptureSupportedResponder)> {
2995        if let CoordinatorRequest::IsCaptureSupported { responder } = self {
2996            Some((responder))
2997        } else {
2998            None
2999        }
3000    }
3001
3002    #[allow(irrefutable_let_patterns)]
3003    pub fn into_start_capture(
3004        self,
3005    ) -> Option<(EventId, ImageId, CoordinatorStartCaptureResponder)> {
3006        if let CoordinatorRequest::StartCapture { signal_event_id, image_id, responder } = self {
3007            Some((signal_event_id, image_id, responder))
3008        } else {
3009            None
3010        }
3011    }
3012
3013    #[allow(irrefutable_let_patterns)]
3014    pub fn into_set_minimum_rgb(self) -> Option<(u8, CoordinatorSetMinimumRgbResponder)> {
3015        if let CoordinatorRequest::SetMinimumRgb { minimum_rgb, responder } = self {
3016            Some((minimum_rgb, responder))
3017        } else {
3018            None
3019        }
3020    }
3021
3022    #[allow(irrefutable_let_patterns)]
3023    pub fn into_set_display_power_mode(
3024        self,
3025    ) -> Option<(
3026        fidl_fuchsia_hardware_display_types::DisplayId,
3027        fidl_fuchsia_hardware_display_types::PowerMode,
3028        CoordinatorSetDisplayPowerModeResponder,
3029    )> {
3030        if let CoordinatorRequest::SetDisplayPowerMode { display_id, power_mode, responder } = self
3031        {
3032            Some((display_id, power_mode, responder))
3033        } else {
3034            None
3035        }
3036    }
3037
3038    /// Name of the method defined in FIDL
3039    pub fn method_name(&self) -> &'static str {
3040        match *self {
3041            CoordinatorRequest::ImportImage { .. } => "import_image",
3042            CoordinatorRequest::ReleaseImage { .. } => "release_image",
3043            CoordinatorRequest::ImportEvent { .. } => "import_event",
3044            CoordinatorRequest::ReleaseEvent { .. } => "release_event",
3045            CoordinatorRequest::CreateLayer { .. } => "create_layer",
3046            CoordinatorRequest::DestroyLayer { .. } => "destroy_layer",
3047            CoordinatorRequest::SetDisplayMode { .. } => "set_display_mode",
3048            CoordinatorRequest::SetDisplayColorConversion { .. } => "set_display_color_conversion",
3049            CoordinatorRequest::SetDisplayLayers { .. } => "set_display_layers",
3050            CoordinatorRequest::SetLayerPrimaryConfig { .. } => "set_layer_primary_config",
3051            CoordinatorRequest::SetLayerPrimaryPosition { .. } => "set_layer_primary_position",
3052            CoordinatorRequest::SetLayerPrimaryAlpha { .. } => "set_layer_primary_alpha",
3053            CoordinatorRequest::SetLayerColorConfig { .. } => "set_layer_color_config",
3054            CoordinatorRequest::SetLayerImage2 { .. } => "set_layer_image2",
3055            CoordinatorRequest::CheckConfig { .. } => "check_config",
3056            CoordinatorRequest::DiscardConfig { .. } => "discard_config",
3057            CoordinatorRequest::GetLatestCommittedConfigStamp { .. } => {
3058                "get_latest_committed_config_stamp"
3059            }
3060            CoordinatorRequest::CommitConfig { .. } => "commit_config",
3061            CoordinatorRequest::AcknowledgeVsync { .. } => "acknowledge_vsync",
3062            CoordinatorRequest::ImportBufferCollection { .. } => "import_buffer_collection",
3063            CoordinatorRequest::ReleaseBufferCollection { .. } => "release_buffer_collection",
3064            CoordinatorRequest::SetBufferCollectionConstraints { .. } => {
3065                "set_buffer_collection_constraints"
3066            }
3067            CoordinatorRequest::IsCaptureSupported { .. } => "is_capture_supported",
3068            CoordinatorRequest::StartCapture { .. } => "start_capture",
3069            CoordinatorRequest::SetMinimumRgb { .. } => "set_minimum_rgb",
3070            CoordinatorRequest::SetDisplayPowerMode { .. } => "set_display_power_mode",
3071        }
3072    }
3073}
3074
3075#[derive(Debug, Clone)]
3076pub struct CoordinatorControlHandle {
3077    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3078}
3079
3080impl fidl::endpoints::ControlHandle for CoordinatorControlHandle {
3081    fn shutdown(&self) {
3082        self.inner.shutdown()
3083    }
3084
3085    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
3086        self.inner.shutdown_with_epitaph(status)
3087    }
3088
3089    fn is_closed(&self) -> bool {
3090        self.inner.channel().is_closed()
3091    }
3092    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3093        self.inner.channel().on_closed()
3094    }
3095
3096    #[cfg(target_os = "fuchsia")]
3097    fn signal_peer(
3098        &self,
3099        clear_mask: zx::Signals,
3100        set_mask: zx::Signals,
3101    ) -> Result<(), zx_status::Status> {
3102        use fidl::Peered;
3103        self.inner.channel().signal_peer(clear_mask, set_mask)
3104    }
3105}
3106
3107impl CoordinatorControlHandle {}
3108
3109#[must_use = "FIDL methods require a response to be sent"]
3110#[derive(Debug)]
3111pub struct CoordinatorImportImageResponder {
3112    control_handle: std::mem::ManuallyDrop<CoordinatorControlHandle>,
3113    tx_id: u32,
3114}
3115
3116/// Set the the channel to be shutdown (see [`CoordinatorControlHandle::shutdown`])
3117/// if the responder is dropped without sending a response, so that the client
3118/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3119impl std::ops::Drop for CoordinatorImportImageResponder {
3120    fn drop(&mut self) {
3121        self.control_handle.shutdown();
3122        // Safety: drops once, never accessed again
3123        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3124    }
3125}
3126
3127impl fidl::endpoints::Responder for CoordinatorImportImageResponder {
3128    type ControlHandle = CoordinatorControlHandle;
3129
3130    fn control_handle(&self) -> &CoordinatorControlHandle {
3131        &self.control_handle
3132    }
3133
3134    fn drop_without_shutdown(mut self) {
3135        // Safety: drops once, never accessed again due to mem::forget
3136        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3137        // Prevent Drop from running (which would shut down the channel)
3138        std::mem::forget(self);
3139    }
3140}
3141
3142impl CoordinatorImportImageResponder {
3143    /// Sends a response to the FIDL transaction.
3144    ///
3145    /// Sets the channel to shutdown if an error occurs.
3146    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3147        let _result = self.send_raw(result);
3148        if _result.is_err() {
3149            self.control_handle.shutdown();
3150        }
3151        self.drop_without_shutdown();
3152        _result
3153    }
3154
3155    /// Similar to "send" but does not shutdown the channel if an error occurs.
3156    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3157        let _result = self.send_raw(result);
3158        self.drop_without_shutdown();
3159        _result
3160    }
3161
3162    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3163        self.control_handle
3164            .inner
3165            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
3166                result,
3167                self.tx_id,
3168                0x3a8636eb9656b4f4,
3169                fidl::encoding::DynamicFlags::empty(),
3170            )
3171    }
3172}
3173
3174#[must_use = "FIDL methods require a response to be sent"]
3175#[derive(Debug)]
3176pub struct CoordinatorCreateLayerResponder {
3177    control_handle: std::mem::ManuallyDrop<CoordinatorControlHandle>,
3178    tx_id: u32,
3179}
3180
3181/// Set the the channel to be shutdown (see [`CoordinatorControlHandle::shutdown`])
3182/// if the responder is dropped without sending a response, so that the client
3183/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3184impl std::ops::Drop for CoordinatorCreateLayerResponder {
3185    fn drop(&mut self) {
3186        self.control_handle.shutdown();
3187        // Safety: drops once, never accessed again
3188        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3189    }
3190}
3191
3192impl fidl::endpoints::Responder for CoordinatorCreateLayerResponder {
3193    type ControlHandle = CoordinatorControlHandle;
3194
3195    fn control_handle(&self) -> &CoordinatorControlHandle {
3196        &self.control_handle
3197    }
3198
3199    fn drop_without_shutdown(mut self) {
3200        // Safety: drops once, never accessed again due to mem::forget
3201        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3202        // Prevent Drop from running (which would shut down the channel)
3203        std::mem::forget(self);
3204    }
3205}
3206
3207impl CoordinatorCreateLayerResponder {
3208    /// Sends a response to the FIDL transaction.
3209    ///
3210    /// Sets the channel to shutdown if an error occurs.
3211    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3212        let _result = self.send_raw(result);
3213        if _result.is_err() {
3214            self.control_handle.shutdown();
3215        }
3216        self.drop_without_shutdown();
3217        _result
3218    }
3219
3220    /// Similar to "send" but does not shutdown the channel if an error occurs.
3221    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3222        let _result = self.send_raw(result);
3223        self.drop_without_shutdown();
3224        _result
3225    }
3226
3227    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3228        self.control_handle
3229            .inner
3230            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
3231                result,
3232                self.tx_id,
3233                0x2137cfd788a3496b,
3234                fidl::encoding::DynamicFlags::empty(),
3235            )
3236    }
3237}
3238
3239#[must_use = "FIDL methods require a response to be sent"]
3240#[derive(Debug)]
3241pub struct CoordinatorCheckConfigResponder {
3242    control_handle: std::mem::ManuallyDrop<CoordinatorControlHandle>,
3243    tx_id: u32,
3244}
3245
3246/// Set the the channel to be shutdown (see [`CoordinatorControlHandle::shutdown`])
3247/// if the responder is dropped without sending a response, so that the client
3248/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3249impl std::ops::Drop for CoordinatorCheckConfigResponder {
3250    fn drop(&mut self) {
3251        self.control_handle.shutdown();
3252        // Safety: drops once, never accessed again
3253        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3254    }
3255}
3256
3257impl fidl::endpoints::Responder for CoordinatorCheckConfigResponder {
3258    type ControlHandle = CoordinatorControlHandle;
3259
3260    fn control_handle(&self) -> &CoordinatorControlHandle {
3261        &self.control_handle
3262    }
3263
3264    fn drop_without_shutdown(mut self) {
3265        // Safety: drops once, never accessed again due to mem::forget
3266        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3267        // Prevent Drop from running (which would shut down the channel)
3268        std::mem::forget(self);
3269    }
3270}
3271
3272impl CoordinatorCheckConfigResponder {
3273    /// Sends a response to the FIDL transaction.
3274    ///
3275    /// Sets the channel to shutdown if an error occurs.
3276    pub fn send(
3277        self,
3278        mut res: fidl_fuchsia_hardware_display_types::ConfigResult,
3279    ) -> Result<(), fidl::Error> {
3280        let _result = self.send_raw(res);
3281        if _result.is_err() {
3282            self.control_handle.shutdown();
3283        }
3284        self.drop_without_shutdown();
3285        _result
3286    }
3287
3288    /// Similar to "send" but does not shutdown the channel if an error occurs.
3289    pub fn send_no_shutdown_on_err(
3290        self,
3291        mut res: fidl_fuchsia_hardware_display_types::ConfigResult,
3292    ) -> Result<(), fidl::Error> {
3293        let _result = self.send_raw(res);
3294        self.drop_without_shutdown();
3295        _result
3296    }
3297
3298    fn send_raw(
3299        &self,
3300        mut res: fidl_fuchsia_hardware_display_types::ConfigResult,
3301    ) -> Result<(), fidl::Error> {
3302        self.control_handle.inner.send::<CoordinatorCheckConfigResponse>(
3303            (res,),
3304            self.tx_id,
3305            0x2bcfb4eb16878158,
3306            fidl::encoding::DynamicFlags::empty(),
3307        )
3308    }
3309}
3310
3311#[must_use = "FIDL methods require a response to be sent"]
3312#[derive(Debug)]
3313pub struct CoordinatorGetLatestCommittedConfigStampResponder {
3314    control_handle: std::mem::ManuallyDrop<CoordinatorControlHandle>,
3315    tx_id: u32,
3316}
3317
3318/// Set the the channel to be shutdown (see [`CoordinatorControlHandle::shutdown`])
3319/// if the responder is dropped without sending a response, so that the client
3320/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3321impl std::ops::Drop for CoordinatorGetLatestCommittedConfigStampResponder {
3322    fn drop(&mut self) {
3323        self.control_handle.shutdown();
3324        // Safety: drops once, never accessed again
3325        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3326    }
3327}
3328
3329impl fidl::endpoints::Responder for CoordinatorGetLatestCommittedConfigStampResponder {
3330    type ControlHandle = CoordinatorControlHandle;
3331
3332    fn control_handle(&self) -> &CoordinatorControlHandle {
3333        &self.control_handle
3334    }
3335
3336    fn drop_without_shutdown(mut self) {
3337        // Safety: drops once, never accessed again due to mem::forget
3338        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3339        // Prevent Drop from running (which would shut down the channel)
3340        std::mem::forget(self);
3341    }
3342}
3343
3344impl CoordinatorGetLatestCommittedConfigStampResponder {
3345    /// Sends a response to the FIDL transaction.
3346    ///
3347    /// Sets the channel to shutdown if an error occurs.
3348    pub fn send(self, mut stamp: &ConfigStamp) -> Result<(), fidl::Error> {
3349        let _result = self.send_raw(stamp);
3350        if _result.is_err() {
3351            self.control_handle.shutdown();
3352        }
3353        self.drop_without_shutdown();
3354        _result
3355    }
3356
3357    /// Similar to "send" but does not shutdown the channel if an error occurs.
3358    pub fn send_no_shutdown_on_err(self, mut stamp: &ConfigStamp) -> Result<(), fidl::Error> {
3359        let _result = self.send_raw(stamp);
3360        self.drop_without_shutdown();
3361        _result
3362    }
3363
3364    fn send_raw(&self, mut stamp: &ConfigStamp) -> Result<(), fidl::Error> {
3365        self.control_handle.inner.send::<CoordinatorGetLatestCommittedConfigStampResponse>(
3366            (stamp,),
3367            self.tx_id,
3368            0x2a441f2c81af5d66,
3369            fidl::encoding::DynamicFlags::empty(),
3370        )
3371    }
3372}
3373
3374#[must_use = "FIDL methods require a response to be sent"]
3375#[derive(Debug)]
3376pub struct CoordinatorImportBufferCollectionResponder {
3377    control_handle: std::mem::ManuallyDrop<CoordinatorControlHandle>,
3378    tx_id: u32,
3379}
3380
3381/// Set the the channel to be shutdown (see [`CoordinatorControlHandle::shutdown`])
3382/// if the responder is dropped without sending a response, so that the client
3383/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3384impl std::ops::Drop for CoordinatorImportBufferCollectionResponder {
3385    fn drop(&mut self) {
3386        self.control_handle.shutdown();
3387        // Safety: drops once, never accessed again
3388        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3389    }
3390}
3391
3392impl fidl::endpoints::Responder for CoordinatorImportBufferCollectionResponder {
3393    type ControlHandle = CoordinatorControlHandle;
3394
3395    fn control_handle(&self) -> &CoordinatorControlHandle {
3396        &self.control_handle
3397    }
3398
3399    fn drop_without_shutdown(mut self) {
3400        // Safety: drops once, never accessed again due to mem::forget
3401        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3402        // Prevent Drop from running (which would shut down the channel)
3403        std::mem::forget(self);
3404    }
3405}
3406
3407impl CoordinatorImportBufferCollectionResponder {
3408    /// Sends a response to the FIDL transaction.
3409    ///
3410    /// Sets the channel to shutdown if an error occurs.
3411    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3412        let _result = self.send_raw(result);
3413        if _result.is_err() {
3414            self.control_handle.shutdown();
3415        }
3416        self.drop_without_shutdown();
3417        _result
3418    }
3419
3420    /// Similar to "send" but does not shutdown the channel if an error occurs.
3421    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3422        let _result = self.send_raw(result);
3423        self.drop_without_shutdown();
3424        _result
3425    }
3426
3427    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3428        self.control_handle
3429            .inner
3430            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
3431                result,
3432                self.tx_id,
3433                0x30d06f510e7f4601,
3434                fidl::encoding::DynamicFlags::empty(),
3435            )
3436    }
3437}
3438
3439#[must_use = "FIDL methods require a response to be sent"]
3440#[derive(Debug)]
3441pub struct CoordinatorSetBufferCollectionConstraintsResponder {
3442    control_handle: std::mem::ManuallyDrop<CoordinatorControlHandle>,
3443    tx_id: u32,
3444}
3445
3446/// Set the the channel to be shutdown (see [`CoordinatorControlHandle::shutdown`])
3447/// if the responder is dropped without sending a response, so that the client
3448/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3449impl std::ops::Drop for CoordinatorSetBufferCollectionConstraintsResponder {
3450    fn drop(&mut self) {
3451        self.control_handle.shutdown();
3452        // Safety: drops once, never accessed again
3453        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3454    }
3455}
3456
3457impl fidl::endpoints::Responder for CoordinatorSetBufferCollectionConstraintsResponder {
3458    type ControlHandle = CoordinatorControlHandle;
3459
3460    fn control_handle(&self) -> &CoordinatorControlHandle {
3461        &self.control_handle
3462    }
3463
3464    fn drop_without_shutdown(mut self) {
3465        // Safety: drops once, never accessed again due to mem::forget
3466        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3467        // Prevent Drop from running (which would shut down the channel)
3468        std::mem::forget(self);
3469    }
3470}
3471
3472impl CoordinatorSetBufferCollectionConstraintsResponder {
3473    /// Sends a response to the FIDL transaction.
3474    ///
3475    /// Sets the channel to shutdown if an error occurs.
3476    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3477        let _result = self.send_raw(result);
3478        if _result.is_err() {
3479            self.control_handle.shutdown();
3480        }
3481        self.drop_without_shutdown();
3482        _result
3483    }
3484
3485    /// Similar to "send" but does not shutdown the channel if an error occurs.
3486    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3487        let _result = self.send_raw(result);
3488        self.drop_without_shutdown();
3489        _result
3490    }
3491
3492    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3493        self.control_handle
3494            .inner
3495            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
3496                result,
3497                self.tx_id,
3498                0x509a4ee9af6035df,
3499                fidl::encoding::DynamicFlags::empty(),
3500            )
3501    }
3502}
3503
3504#[must_use = "FIDL methods require a response to be sent"]
3505#[derive(Debug)]
3506pub struct CoordinatorIsCaptureSupportedResponder {
3507    control_handle: std::mem::ManuallyDrop<CoordinatorControlHandle>,
3508    tx_id: u32,
3509}
3510
3511/// Set the the channel to be shutdown (see [`CoordinatorControlHandle::shutdown`])
3512/// if the responder is dropped without sending a response, so that the client
3513/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3514impl std::ops::Drop for CoordinatorIsCaptureSupportedResponder {
3515    fn drop(&mut self) {
3516        self.control_handle.shutdown();
3517        // Safety: drops once, never accessed again
3518        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3519    }
3520}
3521
3522impl fidl::endpoints::Responder for CoordinatorIsCaptureSupportedResponder {
3523    type ControlHandle = CoordinatorControlHandle;
3524
3525    fn control_handle(&self) -> &CoordinatorControlHandle {
3526        &self.control_handle
3527    }
3528
3529    fn drop_without_shutdown(mut self) {
3530        // Safety: drops once, never accessed again due to mem::forget
3531        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3532        // Prevent Drop from running (which would shut down the channel)
3533        std::mem::forget(self);
3534    }
3535}
3536
3537impl CoordinatorIsCaptureSupportedResponder {
3538    /// Sends a response to the FIDL transaction.
3539    ///
3540    /// Sets the channel to shutdown if an error occurs.
3541    pub fn send(self, mut result: Result<bool, i32>) -> Result<(), fidl::Error> {
3542        let _result = self.send_raw(result);
3543        if _result.is_err() {
3544            self.control_handle.shutdown();
3545        }
3546        self.drop_without_shutdown();
3547        _result
3548    }
3549
3550    /// Similar to "send" but does not shutdown the channel if an error occurs.
3551    pub fn send_no_shutdown_on_err(self, mut result: Result<bool, i32>) -> Result<(), fidl::Error> {
3552        let _result = self.send_raw(result);
3553        self.drop_without_shutdown();
3554        _result
3555    }
3556
3557    fn send_raw(&self, mut result: Result<bool, i32>) -> Result<(), fidl::Error> {
3558        self.control_handle.inner.send::<fidl::encoding::ResultType<
3559            CoordinatorIsCaptureSupportedResponse,
3560            i32,
3561        >>(
3562            result.map(|supported| (supported,)),
3563            self.tx_id,
3564            0x4ca407277277971b,
3565            fidl::encoding::DynamicFlags::empty(),
3566        )
3567    }
3568}
3569
3570#[must_use = "FIDL methods require a response to be sent"]
3571#[derive(Debug)]
3572pub struct CoordinatorStartCaptureResponder {
3573    control_handle: std::mem::ManuallyDrop<CoordinatorControlHandle>,
3574    tx_id: u32,
3575}
3576
3577/// Set the the channel to be shutdown (see [`CoordinatorControlHandle::shutdown`])
3578/// if the responder is dropped without sending a response, so that the client
3579/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3580impl std::ops::Drop for CoordinatorStartCaptureResponder {
3581    fn drop(&mut self) {
3582        self.control_handle.shutdown();
3583        // Safety: drops once, never accessed again
3584        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3585    }
3586}
3587
3588impl fidl::endpoints::Responder for CoordinatorStartCaptureResponder {
3589    type ControlHandle = CoordinatorControlHandle;
3590
3591    fn control_handle(&self) -> &CoordinatorControlHandle {
3592        &self.control_handle
3593    }
3594
3595    fn drop_without_shutdown(mut self) {
3596        // Safety: drops once, never accessed again due to mem::forget
3597        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3598        // Prevent Drop from running (which would shut down the channel)
3599        std::mem::forget(self);
3600    }
3601}
3602
3603impl CoordinatorStartCaptureResponder {
3604    /// Sends a response to the FIDL transaction.
3605    ///
3606    /// Sets the channel to shutdown if an error occurs.
3607    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3608        let _result = self.send_raw(result);
3609        if _result.is_err() {
3610            self.control_handle.shutdown();
3611        }
3612        self.drop_without_shutdown();
3613        _result
3614    }
3615
3616    /// Similar to "send" but does not shutdown the channel if an error occurs.
3617    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3618        let _result = self.send_raw(result);
3619        self.drop_without_shutdown();
3620        _result
3621    }
3622
3623    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3624        self.control_handle
3625            .inner
3626            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
3627                result,
3628                self.tx_id,
3629                0x35cb38f19d96a8db,
3630                fidl::encoding::DynamicFlags::empty(),
3631            )
3632    }
3633}
3634
3635#[must_use = "FIDL methods require a response to be sent"]
3636#[derive(Debug)]
3637pub struct CoordinatorSetMinimumRgbResponder {
3638    control_handle: std::mem::ManuallyDrop<CoordinatorControlHandle>,
3639    tx_id: u32,
3640}
3641
3642/// Set the the channel to be shutdown (see [`CoordinatorControlHandle::shutdown`])
3643/// if the responder is dropped without sending a response, so that the client
3644/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3645impl std::ops::Drop for CoordinatorSetMinimumRgbResponder {
3646    fn drop(&mut self) {
3647        self.control_handle.shutdown();
3648        // Safety: drops once, never accessed again
3649        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3650    }
3651}
3652
3653impl fidl::endpoints::Responder for CoordinatorSetMinimumRgbResponder {
3654    type ControlHandle = CoordinatorControlHandle;
3655
3656    fn control_handle(&self) -> &CoordinatorControlHandle {
3657        &self.control_handle
3658    }
3659
3660    fn drop_without_shutdown(mut self) {
3661        // Safety: drops once, never accessed again due to mem::forget
3662        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3663        // Prevent Drop from running (which would shut down the channel)
3664        std::mem::forget(self);
3665    }
3666}
3667
3668impl CoordinatorSetMinimumRgbResponder {
3669    /// Sends a response to the FIDL transaction.
3670    ///
3671    /// Sets the channel to shutdown if an error occurs.
3672    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3673        let _result = self.send_raw(result);
3674        if _result.is_err() {
3675            self.control_handle.shutdown();
3676        }
3677        self.drop_without_shutdown();
3678        _result
3679    }
3680
3681    /// Similar to "send" but does not shutdown the channel if an error occurs.
3682    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3683        let _result = self.send_raw(result);
3684        self.drop_without_shutdown();
3685        _result
3686    }
3687
3688    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3689        self.control_handle
3690            .inner
3691            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
3692                result,
3693                self.tx_id,
3694                0x1b49251437038b0b,
3695                fidl::encoding::DynamicFlags::empty(),
3696            )
3697    }
3698}
3699
3700#[must_use = "FIDL methods require a response to be sent"]
3701#[derive(Debug)]
3702pub struct CoordinatorSetDisplayPowerModeResponder {
3703    control_handle: std::mem::ManuallyDrop<CoordinatorControlHandle>,
3704    tx_id: u32,
3705}
3706
3707/// Set the the channel to be shutdown (see [`CoordinatorControlHandle::shutdown`])
3708/// if the responder is dropped without sending a response, so that the client
3709/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3710impl std::ops::Drop for CoordinatorSetDisplayPowerModeResponder {
3711    fn drop(&mut self) {
3712        self.control_handle.shutdown();
3713        // Safety: drops once, never accessed again
3714        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3715    }
3716}
3717
3718impl fidl::endpoints::Responder for CoordinatorSetDisplayPowerModeResponder {
3719    type ControlHandle = CoordinatorControlHandle;
3720
3721    fn control_handle(&self) -> &CoordinatorControlHandle {
3722        &self.control_handle
3723    }
3724
3725    fn drop_without_shutdown(mut self) {
3726        // Safety: drops once, never accessed again due to mem::forget
3727        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3728        // Prevent Drop from running (which would shut down the channel)
3729        std::mem::forget(self);
3730    }
3731}
3732
3733impl CoordinatorSetDisplayPowerModeResponder {
3734    /// Sends a response to the FIDL transaction.
3735    ///
3736    /// Sets the channel to shutdown if an error occurs.
3737    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3738        let _result = self.send_raw(result);
3739        if _result.is_err() {
3740            self.control_handle.shutdown();
3741        }
3742        self.drop_without_shutdown();
3743        _result
3744    }
3745
3746    /// Similar to "send" but does not shutdown the channel if an error occurs.
3747    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3748        let _result = self.send_raw(result);
3749        self.drop_without_shutdown();
3750        _result
3751    }
3752
3753    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3754        self.control_handle
3755            .inner
3756            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
3757                result,
3758                self.tx_id,
3759                0xf4672f055072c92,
3760                fidl::encoding::DynamicFlags::empty(),
3761            )
3762    }
3763}
3764
3765#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
3766pub struct CoordinatorListenerMarker;
3767
3768impl fidl::endpoints::ProtocolMarker for CoordinatorListenerMarker {
3769    type Proxy = CoordinatorListenerProxy;
3770    type RequestStream = CoordinatorListenerRequestStream;
3771    #[cfg(target_os = "fuchsia")]
3772    type SynchronousProxy = CoordinatorListenerSynchronousProxy;
3773
3774    const DEBUG_NAME: &'static str = "(anonymous) CoordinatorListener";
3775}
3776
3777pub trait CoordinatorListenerProxyInterface: Send + Sync {
3778    fn r#on_displays_changed(
3779        &self,
3780        added: &[Info],
3781        removed: &[fidl_fuchsia_hardware_display_types::DisplayId],
3782    ) -> Result<(), fidl::Error>;
3783    fn r#on_vsync(
3784        &self,
3785        display_id: &fidl_fuchsia_hardware_display_types::DisplayId,
3786        timestamp: fidl::MonotonicInstant,
3787        displayed_config_stamp: &ConfigStamp,
3788        cookie: &VsyncAckCookie,
3789    ) -> Result<(), fidl::Error>;
3790    fn r#on_client_ownership_change(&self, has_ownership: bool) -> Result<(), fidl::Error>;
3791}
3792#[derive(Debug)]
3793#[cfg(target_os = "fuchsia")]
3794pub struct CoordinatorListenerSynchronousProxy {
3795    client: fidl::client::sync::Client,
3796}
3797
3798#[cfg(target_os = "fuchsia")]
3799impl fidl::endpoints::SynchronousProxy for CoordinatorListenerSynchronousProxy {
3800    type Proxy = CoordinatorListenerProxy;
3801    type Protocol = CoordinatorListenerMarker;
3802
3803    fn from_channel(inner: fidl::Channel) -> Self {
3804        Self::new(inner)
3805    }
3806
3807    fn into_channel(self) -> fidl::Channel {
3808        self.client.into_channel()
3809    }
3810
3811    fn as_channel(&self) -> &fidl::Channel {
3812        self.client.as_channel()
3813    }
3814}
3815
3816#[cfg(target_os = "fuchsia")]
3817impl CoordinatorListenerSynchronousProxy {
3818    pub fn new(channel: fidl::Channel) -> Self {
3819        Self { client: fidl::client::sync::Client::new(channel) }
3820    }
3821
3822    pub fn into_channel(self) -> fidl::Channel {
3823        self.client.into_channel()
3824    }
3825
3826    /// Waits until an event arrives and returns it. It is safe for other
3827    /// threads to make concurrent requests while waiting for an event.
3828    pub fn wait_for_event(
3829        &self,
3830        deadline: zx::MonotonicInstant,
3831    ) -> Result<CoordinatorListenerEvent, fidl::Error> {
3832        CoordinatorListenerEvent::decode(
3833            self.client.wait_for_event::<CoordinatorListenerMarker>(deadline)?,
3834        )
3835    }
3836
3837    /// Called when the set of connected displays changes.
3838    ///
3839    /// Also used to communicate the set of connected displays to a newly
3840    /// connected client.
3841    ///
3842    /// After this method is called, all applied and draft configurations may no
3843    /// longer be valid. The client must validate and apply a new configuration,
3844    /// by calling [`Coordinator.CheckConfig`] and [`Coordinator.CommitConfig`].
3845    ///
3846    /// `added` and `removed` must not be both empty.
3847    pub fn r#on_displays_changed(
3848        &self,
3849        mut added: &[Info],
3850        mut removed: &[fidl_fuchsia_hardware_display_types::DisplayId],
3851    ) -> Result<(), fidl::Error> {
3852        self.client.send::<CoordinatorListenerOnDisplaysChangedRequest>(
3853            (added, removed),
3854            0x248fbe90c338a94f,
3855            fidl::encoding::DynamicFlags::empty(),
3856        )
3857    }
3858
3859    /// Called on every display Vertical Synchronization (Vsync).
3860    ///
3861    /// Clients must acknowledge VSync events via the method
3862    /// [`Coordinator.AcknowledgeVsync`].  The coordinator may throttle a client
3863    /// that accumulates a certain number of unacknowledged VSync cookies.
3864    /// Throttled clients do not receive VSync events.
3865    ///
3866    /// After a the client catches up on acknowledging cookies, the coordinator
3867    /// will unthrottle it (resume sending VSync events). Throttled clients may
3868    /// miss some VSync events, as the coordinator is allowed to drop VSync
3869    /// event information for throttled clients.
3870    ///
3871    /// When dropping VSync event information for throttled clients, the
3872    /// coordinator should prioritize retaining the information for newer
3873    /// events. In other words, the oldest unreported events should be dropped
3874    /// first.
3875    pub fn r#on_vsync(
3876        &self,
3877        mut display_id: &fidl_fuchsia_hardware_display_types::DisplayId,
3878        mut timestamp: fidl::MonotonicInstant,
3879        mut displayed_config_stamp: &ConfigStamp,
3880        mut cookie: &VsyncAckCookie,
3881    ) -> Result<(), fidl::Error> {
3882        self.client.send::<CoordinatorListenerOnVsyncRequest>(
3883            (display_id, timestamp, displayed_config_stamp, cookie),
3884            0x249e9b8da7a7ac47,
3885            fidl::encoding::DynamicFlags::empty(),
3886        )
3887    }
3888
3889    /// Called when the corresponding `Coordinator` client gains or loses
3890    /// ownership of the displays.
3891    ///
3892    /// A `Coordinator` client's displayed config is visible iff it holds the
3893    /// ownership of the displays.
3894    ///
3895    /// A new `Coordinator` client should assume they do not have ownership
3896    /// of the displays until this method informs them otherwise.
3897    pub fn r#on_client_ownership_change(&self, mut has_ownership: bool) -> Result<(), fidl::Error> {
3898        self.client.send::<CoordinatorListenerOnClientOwnershipChangeRequest>(
3899            (has_ownership,),
3900            0x1acd2ae683153d5e,
3901            fidl::encoding::DynamicFlags::empty(),
3902        )
3903    }
3904}
3905
3906#[cfg(target_os = "fuchsia")]
3907impl From<CoordinatorListenerSynchronousProxy> for zx::NullableHandle {
3908    fn from(value: CoordinatorListenerSynchronousProxy) -> Self {
3909        value.into_channel().into()
3910    }
3911}
3912
3913#[cfg(target_os = "fuchsia")]
3914impl From<fidl::Channel> for CoordinatorListenerSynchronousProxy {
3915    fn from(value: fidl::Channel) -> Self {
3916        Self::new(value)
3917    }
3918}
3919
3920#[cfg(target_os = "fuchsia")]
3921impl fidl::endpoints::FromClient for CoordinatorListenerSynchronousProxy {
3922    type Protocol = CoordinatorListenerMarker;
3923
3924    fn from_client(value: fidl::endpoints::ClientEnd<CoordinatorListenerMarker>) -> Self {
3925        Self::new(value.into_channel())
3926    }
3927}
3928
3929#[derive(Debug, Clone)]
3930pub struct CoordinatorListenerProxy {
3931    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
3932}
3933
3934impl fidl::endpoints::Proxy for CoordinatorListenerProxy {
3935    type Protocol = CoordinatorListenerMarker;
3936
3937    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
3938        Self::new(inner)
3939    }
3940
3941    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
3942        self.client.into_channel().map_err(|client| Self { client })
3943    }
3944
3945    fn as_channel(&self) -> &::fidl::AsyncChannel {
3946        self.client.as_channel()
3947    }
3948}
3949
3950impl CoordinatorListenerProxy {
3951    /// Create a new Proxy for fuchsia.hardware.display/CoordinatorListener.
3952    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
3953        let protocol_name =
3954            <CoordinatorListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3955        Self { client: fidl::client::Client::new(channel, protocol_name) }
3956    }
3957
3958    /// Get a Stream of events from the remote end of the protocol.
3959    ///
3960    /// # Panics
3961    ///
3962    /// Panics if the event stream was already taken.
3963    pub fn take_event_stream(&self) -> CoordinatorListenerEventStream {
3964        CoordinatorListenerEventStream { event_receiver: self.client.take_event_receiver() }
3965    }
3966
3967    /// Called when the set of connected displays changes.
3968    ///
3969    /// Also used to communicate the set of connected displays to a newly
3970    /// connected client.
3971    ///
3972    /// After this method is called, all applied and draft configurations may no
3973    /// longer be valid. The client must validate and apply a new configuration,
3974    /// by calling [`Coordinator.CheckConfig`] and [`Coordinator.CommitConfig`].
3975    ///
3976    /// `added` and `removed` must not be both empty.
3977    pub fn r#on_displays_changed(
3978        &self,
3979        mut added: &[Info],
3980        mut removed: &[fidl_fuchsia_hardware_display_types::DisplayId],
3981    ) -> Result<(), fidl::Error> {
3982        CoordinatorListenerProxyInterface::r#on_displays_changed(self, added, removed)
3983    }
3984
3985    /// Called on every display Vertical Synchronization (Vsync).
3986    ///
3987    /// Clients must acknowledge VSync events via the method
3988    /// [`Coordinator.AcknowledgeVsync`].  The coordinator may throttle a client
3989    /// that accumulates a certain number of unacknowledged VSync cookies.
3990    /// Throttled clients do not receive VSync events.
3991    ///
3992    /// After a the client catches up on acknowledging cookies, the coordinator
3993    /// will unthrottle it (resume sending VSync events). Throttled clients may
3994    /// miss some VSync events, as the coordinator is allowed to drop VSync
3995    /// event information for throttled clients.
3996    ///
3997    /// When dropping VSync event information for throttled clients, the
3998    /// coordinator should prioritize retaining the information for newer
3999    /// events. In other words, the oldest unreported events should be dropped
4000    /// first.
4001    pub fn r#on_vsync(
4002        &self,
4003        mut display_id: &fidl_fuchsia_hardware_display_types::DisplayId,
4004        mut timestamp: fidl::MonotonicInstant,
4005        mut displayed_config_stamp: &ConfigStamp,
4006        mut cookie: &VsyncAckCookie,
4007    ) -> Result<(), fidl::Error> {
4008        CoordinatorListenerProxyInterface::r#on_vsync(
4009            self,
4010            display_id,
4011            timestamp,
4012            displayed_config_stamp,
4013            cookie,
4014        )
4015    }
4016
4017    /// Called when the corresponding `Coordinator` client gains or loses
4018    /// ownership of the displays.
4019    ///
4020    /// A `Coordinator` client's displayed config is visible iff it holds the
4021    /// ownership of the displays.
4022    ///
4023    /// A new `Coordinator` client should assume they do not have ownership
4024    /// of the displays until this method informs them otherwise.
4025    pub fn r#on_client_ownership_change(&self, mut has_ownership: bool) -> Result<(), fidl::Error> {
4026        CoordinatorListenerProxyInterface::r#on_client_ownership_change(self, has_ownership)
4027    }
4028}
4029
4030impl CoordinatorListenerProxyInterface for CoordinatorListenerProxy {
4031    fn r#on_displays_changed(
4032        &self,
4033        mut added: &[Info],
4034        mut removed: &[fidl_fuchsia_hardware_display_types::DisplayId],
4035    ) -> Result<(), fidl::Error> {
4036        self.client.send::<CoordinatorListenerOnDisplaysChangedRequest>(
4037            (added, removed),
4038            0x248fbe90c338a94f,
4039            fidl::encoding::DynamicFlags::empty(),
4040        )
4041    }
4042
4043    fn r#on_vsync(
4044        &self,
4045        mut display_id: &fidl_fuchsia_hardware_display_types::DisplayId,
4046        mut timestamp: fidl::MonotonicInstant,
4047        mut displayed_config_stamp: &ConfigStamp,
4048        mut cookie: &VsyncAckCookie,
4049    ) -> Result<(), fidl::Error> {
4050        self.client.send::<CoordinatorListenerOnVsyncRequest>(
4051            (display_id, timestamp, displayed_config_stamp, cookie),
4052            0x249e9b8da7a7ac47,
4053            fidl::encoding::DynamicFlags::empty(),
4054        )
4055    }
4056
4057    fn r#on_client_ownership_change(&self, mut has_ownership: bool) -> Result<(), fidl::Error> {
4058        self.client.send::<CoordinatorListenerOnClientOwnershipChangeRequest>(
4059            (has_ownership,),
4060            0x1acd2ae683153d5e,
4061            fidl::encoding::DynamicFlags::empty(),
4062        )
4063    }
4064}
4065
4066pub struct CoordinatorListenerEventStream {
4067    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
4068}
4069
4070impl std::marker::Unpin for CoordinatorListenerEventStream {}
4071
4072impl futures::stream::FusedStream for CoordinatorListenerEventStream {
4073    fn is_terminated(&self) -> bool {
4074        self.event_receiver.is_terminated()
4075    }
4076}
4077
4078impl futures::Stream for CoordinatorListenerEventStream {
4079    type Item = Result<CoordinatorListenerEvent, fidl::Error>;
4080
4081    fn poll_next(
4082        mut self: std::pin::Pin<&mut Self>,
4083        cx: &mut std::task::Context<'_>,
4084    ) -> std::task::Poll<Option<Self::Item>> {
4085        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
4086            &mut self.event_receiver,
4087            cx
4088        )?) {
4089            Some(buf) => std::task::Poll::Ready(Some(CoordinatorListenerEvent::decode(buf))),
4090            None => std::task::Poll::Ready(None),
4091        }
4092    }
4093}
4094
4095#[derive(Debug)]
4096pub enum CoordinatorListenerEvent {
4097    #[non_exhaustive]
4098    _UnknownEvent {
4099        /// Ordinal of the event that was sent.
4100        ordinal: u64,
4101    },
4102}
4103
4104impl CoordinatorListenerEvent {
4105    /// Decodes a message buffer as a [`CoordinatorListenerEvent`].
4106    fn decode(
4107        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
4108    ) -> Result<CoordinatorListenerEvent, fidl::Error> {
4109        let (bytes, _handles) = buf.split_mut();
4110        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4111        debug_assert_eq!(tx_header.tx_id, 0);
4112        match tx_header.ordinal {
4113            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
4114                Ok(CoordinatorListenerEvent::_UnknownEvent { ordinal: tx_header.ordinal })
4115            }
4116            _ => Err(fidl::Error::UnknownOrdinal {
4117                ordinal: tx_header.ordinal,
4118                protocol_name:
4119                    <CoordinatorListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4120            }),
4121        }
4122    }
4123}
4124
4125/// A Stream of incoming requests for fuchsia.hardware.display/CoordinatorListener.
4126pub struct CoordinatorListenerRequestStream {
4127    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4128    is_terminated: bool,
4129}
4130
4131impl std::marker::Unpin for CoordinatorListenerRequestStream {}
4132
4133impl futures::stream::FusedStream for CoordinatorListenerRequestStream {
4134    fn is_terminated(&self) -> bool {
4135        self.is_terminated
4136    }
4137}
4138
4139impl fidl::endpoints::RequestStream for CoordinatorListenerRequestStream {
4140    type Protocol = CoordinatorListenerMarker;
4141    type ControlHandle = CoordinatorListenerControlHandle;
4142
4143    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
4144        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
4145    }
4146
4147    fn control_handle(&self) -> Self::ControlHandle {
4148        CoordinatorListenerControlHandle { inner: self.inner.clone() }
4149    }
4150
4151    fn into_inner(
4152        self,
4153    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
4154    {
4155        (self.inner, self.is_terminated)
4156    }
4157
4158    fn from_inner(
4159        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4160        is_terminated: bool,
4161    ) -> Self {
4162        Self { inner, is_terminated }
4163    }
4164}
4165
4166impl futures::Stream for CoordinatorListenerRequestStream {
4167    type Item = Result<CoordinatorListenerRequest, fidl::Error>;
4168
4169    fn poll_next(
4170        mut self: std::pin::Pin<&mut Self>,
4171        cx: &mut std::task::Context<'_>,
4172    ) -> std::task::Poll<Option<Self::Item>> {
4173        let this = &mut *self;
4174        if this.inner.check_shutdown(cx) {
4175            this.is_terminated = true;
4176            return std::task::Poll::Ready(None);
4177        }
4178        if this.is_terminated {
4179            panic!("polled CoordinatorListenerRequestStream after completion");
4180        }
4181        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
4182            |bytes, handles| {
4183                match this.inner.channel().read_etc(cx, bytes, handles) {
4184                    std::task::Poll::Ready(Ok(())) => {}
4185                    std::task::Poll::Pending => return std::task::Poll::Pending,
4186                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
4187                        this.is_terminated = true;
4188                        return std::task::Poll::Ready(None);
4189                    }
4190                    std::task::Poll::Ready(Err(e)) => {
4191                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
4192                            e.into(),
4193                        ))));
4194                    }
4195                }
4196
4197                // A message has been received from the channel
4198                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4199
4200                std::task::Poll::Ready(Some(match header.ordinal {
4201                0x248fbe90c338a94f => {
4202                    header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4203                    let mut req = fidl::new_empty!(CoordinatorListenerOnDisplaysChangedRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
4204                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CoordinatorListenerOnDisplaysChangedRequest>(&header, _body_bytes, handles, &mut req)?;
4205                    let control_handle = CoordinatorListenerControlHandle {
4206                        inner: this.inner.clone(),
4207                    };
4208                    Ok(CoordinatorListenerRequest::OnDisplaysChanged {added: req.added,
4209removed: req.removed,
4210
4211                        control_handle,
4212                    })
4213                }
4214                0x249e9b8da7a7ac47 => {
4215                    header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4216                    let mut req = fidl::new_empty!(CoordinatorListenerOnVsyncRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
4217                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CoordinatorListenerOnVsyncRequest>(&header, _body_bytes, handles, &mut req)?;
4218                    let control_handle = CoordinatorListenerControlHandle {
4219                        inner: this.inner.clone(),
4220                    };
4221                    Ok(CoordinatorListenerRequest::OnVsync {display_id: req.display_id,
4222timestamp: req.timestamp,
4223displayed_config_stamp: req.displayed_config_stamp,
4224cookie: req.cookie,
4225
4226                        control_handle,
4227                    })
4228                }
4229                0x1acd2ae683153d5e => {
4230                    header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4231                    let mut req = fidl::new_empty!(CoordinatorListenerOnClientOwnershipChangeRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
4232                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CoordinatorListenerOnClientOwnershipChangeRequest>(&header, _body_bytes, handles, &mut req)?;
4233                    let control_handle = CoordinatorListenerControlHandle {
4234                        inner: this.inner.clone(),
4235                    };
4236                    Ok(CoordinatorListenerRequest::OnClientOwnershipChange {has_ownership: req.has_ownership,
4237
4238                        control_handle,
4239                    })
4240                }
4241                _ if header.tx_id == 0 && header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
4242                    Ok(CoordinatorListenerRequest::_UnknownMethod {
4243                        ordinal: header.ordinal,
4244                        control_handle: CoordinatorListenerControlHandle { inner: this.inner.clone() },
4245                        method_type: fidl::MethodType::OneWay,
4246                    })
4247                }
4248                _ if header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
4249                    this.inner.send_framework_err(
4250                        fidl::encoding::FrameworkErr::UnknownMethod,
4251                        header.tx_id,
4252                        header.ordinal,
4253                        header.dynamic_flags(),
4254                        (bytes, handles),
4255                    )?;
4256                    Ok(CoordinatorListenerRequest::_UnknownMethod {
4257                        ordinal: header.ordinal,
4258                        control_handle: CoordinatorListenerControlHandle { inner: this.inner.clone() },
4259                        method_type: fidl::MethodType::TwoWay,
4260                    })
4261                }
4262                _ => Err(fidl::Error::UnknownOrdinal {
4263                    ordinal: header.ordinal,
4264                    protocol_name: <CoordinatorListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4265                }),
4266            }))
4267            },
4268        )
4269    }
4270}
4271
4272/// Provides updates from a `Coordinator` to one of its clients.
4273///
4274/// This protocol solely consists of one-way methods.
4275#[derive(Debug)]
4276pub enum CoordinatorListenerRequest {
4277    /// Called when the set of connected displays changes.
4278    ///
4279    /// Also used to communicate the set of connected displays to a newly
4280    /// connected client.
4281    ///
4282    /// After this method is called, all applied and draft configurations may no
4283    /// longer be valid. The client must validate and apply a new configuration,
4284    /// by calling [`Coordinator.CheckConfig`] and [`Coordinator.CommitConfig`].
4285    ///
4286    /// `added` and `removed` must not be both empty.
4287    OnDisplaysChanged {
4288        added: Vec<Info>,
4289        removed: Vec<fidl_fuchsia_hardware_display_types::DisplayId>,
4290        control_handle: CoordinatorListenerControlHandle,
4291    },
4292    /// Called on every display Vertical Synchronization (Vsync).
4293    ///
4294    /// Clients must acknowledge VSync events via the method
4295    /// [`Coordinator.AcknowledgeVsync`].  The coordinator may throttle a client
4296    /// that accumulates a certain number of unacknowledged VSync cookies.
4297    /// Throttled clients do not receive VSync events.
4298    ///
4299    /// After a the client catches up on acknowledging cookies, the coordinator
4300    /// will unthrottle it (resume sending VSync events). Throttled clients may
4301    /// miss some VSync events, as the coordinator is allowed to drop VSync
4302    /// event information for throttled clients.
4303    ///
4304    /// When dropping VSync event information for throttled clients, the
4305    /// coordinator should prioritize retaining the information for newer
4306    /// events. In other words, the oldest unreported events should be dropped
4307    /// first.
4308    OnVsync {
4309        display_id: fidl_fuchsia_hardware_display_types::DisplayId,
4310        timestamp: fidl::MonotonicInstant,
4311        displayed_config_stamp: ConfigStamp,
4312        cookie: VsyncAckCookie,
4313        control_handle: CoordinatorListenerControlHandle,
4314    },
4315    /// Called when the corresponding `Coordinator` client gains or loses
4316    /// ownership of the displays.
4317    ///
4318    /// A `Coordinator` client's displayed config is visible iff it holds the
4319    /// ownership of the displays.
4320    ///
4321    /// A new `Coordinator` client should assume they do not have ownership
4322    /// of the displays until this method informs them otherwise.
4323    OnClientOwnershipChange {
4324        has_ownership: bool,
4325        control_handle: CoordinatorListenerControlHandle,
4326    },
4327    /// An interaction was received which does not match any known method.
4328    #[non_exhaustive]
4329    _UnknownMethod {
4330        /// Ordinal of the method that was called.
4331        ordinal: u64,
4332        control_handle: CoordinatorListenerControlHandle,
4333        method_type: fidl::MethodType,
4334    },
4335}
4336
4337impl CoordinatorListenerRequest {
4338    #[allow(irrefutable_let_patterns)]
4339    pub fn into_on_displays_changed(
4340        self,
4341    ) -> Option<(
4342        Vec<Info>,
4343        Vec<fidl_fuchsia_hardware_display_types::DisplayId>,
4344        CoordinatorListenerControlHandle,
4345    )> {
4346        if let CoordinatorListenerRequest::OnDisplaysChanged { added, removed, control_handle } =
4347            self
4348        {
4349            Some((added, removed, control_handle))
4350        } else {
4351            None
4352        }
4353    }
4354
4355    #[allow(irrefutable_let_patterns)]
4356    pub fn into_on_vsync(
4357        self,
4358    ) -> Option<(
4359        fidl_fuchsia_hardware_display_types::DisplayId,
4360        fidl::MonotonicInstant,
4361        ConfigStamp,
4362        VsyncAckCookie,
4363        CoordinatorListenerControlHandle,
4364    )> {
4365        if let CoordinatorListenerRequest::OnVsync {
4366            display_id,
4367            timestamp,
4368            displayed_config_stamp,
4369            cookie,
4370            control_handle,
4371        } = self
4372        {
4373            Some((display_id, timestamp, displayed_config_stamp, cookie, control_handle))
4374        } else {
4375            None
4376        }
4377    }
4378
4379    #[allow(irrefutable_let_patterns)]
4380    pub fn into_on_client_ownership_change(
4381        self,
4382    ) -> Option<(bool, CoordinatorListenerControlHandle)> {
4383        if let CoordinatorListenerRequest::OnClientOwnershipChange {
4384            has_ownership,
4385            control_handle,
4386        } = self
4387        {
4388            Some((has_ownership, control_handle))
4389        } else {
4390            None
4391        }
4392    }
4393
4394    /// Name of the method defined in FIDL
4395    pub fn method_name(&self) -> &'static str {
4396        match *self {
4397            CoordinatorListenerRequest::OnDisplaysChanged { .. } => "on_displays_changed",
4398            CoordinatorListenerRequest::OnVsync { .. } => "on_vsync",
4399            CoordinatorListenerRequest::OnClientOwnershipChange { .. } => {
4400                "on_client_ownership_change"
4401            }
4402            CoordinatorListenerRequest::_UnknownMethod {
4403                method_type: fidl::MethodType::OneWay,
4404                ..
4405            } => "unknown one-way method",
4406            CoordinatorListenerRequest::_UnknownMethod {
4407                method_type: fidl::MethodType::TwoWay,
4408                ..
4409            } => "unknown two-way method",
4410        }
4411    }
4412}
4413
4414#[derive(Debug, Clone)]
4415pub struct CoordinatorListenerControlHandle {
4416    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4417}
4418
4419impl fidl::endpoints::ControlHandle for CoordinatorListenerControlHandle {
4420    fn shutdown(&self) {
4421        self.inner.shutdown()
4422    }
4423
4424    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
4425        self.inner.shutdown_with_epitaph(status)
4426    }
4427
4428    fn is_closed(&self) -> bool {
4429        self.inner.channel().is_closed()
4430    }
4431    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
4432        self.inner.channel().on_closed()
4433    }
4434
4435    #[cfg(target_os = "fuchsia")]
4436    fn signal_peer(
4437        &self,
4438        clear_mask: zx::Signals,
4439        set_mask: zx::Signals,
4440    ) -> Result<(), zx_status::Status> {
4441        use fidl::Peered;
4442        self.inner.channel().signal_peer(clear_mask, set_mask)
4443    }
4444}
4445
4446impl CoordinatorListenerControlHandle {}
4447
4448#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
4449pub struct ProviderMarker;
4450
4451impl fidl::endpoints::ProtocolMarker for ProviderMarker {
4452    type Proxy = ProviderProxy;
4453    type RequestStream = ProviderRequestStream;
4454    #[cfg(target_os = "fuchsia")]
4455    type SynchronousProxy = ProviderSynchronousProxy;
4456
4457    const DEBUG_NAME: &'static str = "fuchsia.hardware.display.Provider";
4458}
4459impl fidl::endpoints::DiscoverableProtocolMarker for ProviderMarker {}
4460pub type ProviderOpenCoordinatorResult = Result<(), i32>;
4461
4462pub trait ProviderProxyInterface: Send + Sync {
4463    type OpenCoordinatorResponseFut: std::future::Future<Output = Result<ProviderOpenCoordinatorResult, fidl::Error>>
4464        + Send;
4465    fn r#open_coordinator(
4466        &self,
4467        payload: ProviderOpenCoordinatorRequest,
4468    ) -> Self::OpenCoordinatorResponseFut;
4469}
4470#[derive(Debug)]
4471#[cfg(target_os = "fuchsia")]
4472pub struct ProviderSynchronousProxy {
4473    client: fidl::client::sync::Client,
4474}
4475
4476#[cfg(target_os = "fuchsia")]
4477impl fidl::endpoints::SynchronousProxy for ProviderSynchronousProxy {
4478    type Proxy = ProviderProxy;
4479    type Protocol = ProviderMarker;
4480
4481    fn from_channel(inner: fidl::Channel) -> Self {
4482        Self::new(inner)
4483    }
4484
4485    fn into_channel(self) -> fidl::Channel {
4486        self.client.into_channel()
4487    }
4488
4489    fn as_channel(&self) -> &fidl::Channel {
4490        self.client.as_channel()
4491    }
4492}
4493
4494#[cfg(target_os = "fuchsia")]
4495impl ProviderSynchronousProxy {
4496    pub fn new(channel: fidl::Channel) -> Self {
4497        Self { client: fidl::client::sync::Client::new(channel) }
4498    }
4499
4500    pub fn into_channel(self) -> fidl::Channel {
4501        self.client.into_channel()
4502    }
4503
4504    /// Waits until an event arrives and returns it. It is safe for other
4505    /// threads to make concurrent requests while waiting for an event.
4506    pub fn wait_for_event(
4507        &self,
4508        deadline: zx::MonotonicInstant,
4509    ) -> Result<ProviderEvent, fidl::Error> {
4510        ProviderEvent::decode(self.client.wait_for_event::<ProviderMarker>(deadline)?)
4511    }
4512
4513    /// Opens a client connection to the Display Coordinator.
4514    ///
4515    /// On success, `coordinator` will be bound to the Display Coordinator
4516    /// at the requested priority level, and `coordinator_listener` will receive
4517    /// notifications for the newly bound client.
4518    ///
4519    /// Fails with `ZX_ERR_ALREADY_BOUND` if the Display Coordinator already has
4520    /// a connected client at the given priority level.
4521    ///
4522    /// Fails with `ZX_ERR_INVALID_ARGS` if one of the required fields is missing.
4523    pub fn r#open_coordinator(
4524        &self,
4525        mut payload: ProviderOpenCoordinatorRequest,
4526        ___deadline: zx::MonotonicInstant,
4527    ) -> Result<ProviderOpenCoordinatorResult, fidl::Error> {
4528        let _response = self.client.send_query::<
4529            ProviderOpenCoordinatorRequest,
4530            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
4531            ProviderMarker,
4532        >(
4533            &mut payload,
4534            0x1bd6070372d03df0,
4535            fidl::encoding::DynamicFlags::empty(),
4536            ___deadline,
4537        )?;
4538        Ok(_response.map(|x| x))
4539    }
4540}
4541
4542#[cfg(target_os = "fuchsia")]
4543impl From<ProviderSynchronousProxy> for zx::NullableHandle {
4544    fn from(value: ProviderSynchronousProxy) -> Self {
4545        value.into_channel().into()
4546    }
4547}
4548
4549#[cfg(target_os = "fuchsia")]
4550impl From<fidl::Channel> for ProviderSynchronousProxy {
4551    fn from(value: fidl::Channel) -> Self {
4552        Self::new(value)
4553    }
4554}
4555
4556#[cfg(target_os = "fuchsia")]
4557impl fidl::endpoints::FromClient for ProviderSynchronousProxy {
4558    type Protocol = ProviderMarker;
4559
4560    fn from_client(value: fidl::endpoints::ClientEnd<ProviderMarker>) -> Self {
4561        Self::new(value.into_channel())
4562    }
4563}
4564
4565#[derive(Debug, Clone)]
4566pub struct ProviderProxy {
4567    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
4568}
4569
4570impl fidl::endpoints::Proxy for ProviderProxy {
4571    type Protocol = ProviderMarker;
4572
4573    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
4574        Self::new(inner)
4575    }
4576
4577    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
4578        self.client.into_channel().map_err(|client| Self { client })
4579    }
4580
4581    fn as_channel(&self) -> &::fidl::AsyncChannel {
4582        self.client.as_channel()
4583    }
4584}
4585
4586impl ProviderProxy {
4587    /// Create a new Proxy for fuchsia.hardware.display/Provider.
4588    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
4589        let protocol_name = <ProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4590        Self { client: fidl::client::Client::new(channel, protocol_name) }
4591    }
4592
4593    /// Get a Stream of events from the remote end of the protocol.
4594    ///
4595    /// # Panics
4596    ///
4597    /// Panics if the event stream was already taken.
4598    pub fn take_event_stream(&self) -> ProviderEventStream {
4599        ProviderEventStream { event_receiver: self.client.take_event_receiver() }
4600    }
4601
4602    /// Opens a client connection to the Display Coordinator.
4603    ///
4604    /// On success, `coordinator` will be bound to the Display Coordinator
4605    /// at the requested priority level, and `coordinator_listener` will receive
4606    /// notifications for the newly bound client.
4607    ///
4608    /// Fails with `ZX_ERR_ALREADY_BOUND` if the Display Coordinator already has
4609    /// a connected client at the given priority level.
4610    ///
4611    /// Fails with `ZX_ERR_INVALID_ARGS` if one of the required fields is missing.
4612    pub fn r#open_coordinator(
4613        &self,
4614        mut payload: ProviderOpenCoordinatorRequest,
4615    ) -> fidl::client::QueryResponseFut<
4616        ProviderOpenCoordinatorResult,
4617        fidl::encoding::DefaultFuchsiaResourceDialect,
4618    > {
4619        ProviderProxyInterface::r#open_coordinator(self, payload)
4620    }
4621}
4622
4623impl ProviderProxyInterface for ProviderProxy {
4624    type OpenCoordinatorResponseFut = fidl::client::QueryResponseFut<
4625        ProviderOpenCoordinatorResult,
4626        fidl::encoding::DefaultFuchsiaResourceDialect,
4627    >;
4628    fn r#open_coordinator(
4629        &self,
4630        mut payload: ProviderOpenCoordinatorRequest,
4631    ) -> Self::OpenCoordinatorResponseFut {
4632        fn _decode(
4633            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4634        ) -> Result<ProviderOpenCoordinatorResult, fidl::Error> {
4635            let _response = fidl::client::decode_transaction_body::<
4636                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
4637                fidl::encoding::DefaultFuchsiaResourceDialect,
4638                0x1bd6070372d03df0,
4639            >(_buf?)?;
4640            Ok(_response.map(|x| x))
4641        }
4642        self.client
4643            .send_query_and_decode::<ProviderOpenCoordinatorRequest, ProviderOpenCoordinatorResult>(
4644                &mut payload,
4645                0x1bd6070372d03df0,
4646                fidl::encoding::DynamicFlags::empty(),
4647                _decode,
4648            )
4649    }
4650}
4651
4652pub struct ProviderEventStream {
4653    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
4654}
4655
4656impl std::marker::Unpin for ProviderEventStream {}
4657
4658impl futures::stream::FusedStream for ProviderEventStream {
4659    fn is_terminated(&self) -> bool {
4660        self.event_receiver.is_terminated()
4661    }
4662}
4663
4664impl futures::Stream for ProviderEventStream {
4665    type Item = Result<ProviderEvent, fidl::Error>;
4666
4667    fn poll_next(
4668        mut self: std::pin::Pin<&mut Self>,
4669        cx: &mut std::task::Context<'_>,
4670    ) -> std::task::Poll<Option<Self::Item>> {
4671        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
4672            &mut self.event_receiver,
4673            cx
4674        )?) {
4675            Some(buf) => std::task::Poll::Ready(Some(ProviderEvent::decode(buf))),
4676            None => std::task::Poll::Ready(None),
4677        }
4678    }
4679}
4680
4681#[derive(Debug)]
4682pub enum ProviderEvent {}
4683
4684impl ProviderEvent {
4685    /// Decodes a message buffer as a [`ProviderEvent`].
4686    fn decode(
4687        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
4688    ) -> Result<ProviderEvent, fidl::Error> {
4689        let (bytes, _handles) = buf.split_mut();
4690        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4691        debug_assert_eq!(tx_header.tx_id, 0);
4692        match tx_header.ordinal {
4693            _ => Err(fidl::Error::UnknownOrdinal {
4694                ordinal: tx_header.ordinal,
4695                protocol_name: <ProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4696            }),
4697        }
4698    }
4699}
4700
4701/// A Stream of incoming requests for fuchsia.hardware.display/Provider.
4702pub struct ProviderRequestStream {
4703    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4704    is_terminated: bool,
4705}
4706
4707impl std::marker::Unpin for ProviderRequestStream {}
4708
4709impl futures::stream::FusedStream for ProviderRequestStream {
4710    fn is_terminated(&self) -> bool {
4711        self.is_terminated
4712    }
4713}
4714
4715impl fidl::endpoints::RequestStream for ProviderRequestStream {
4716    type Protocol = ProviderMarker;
4717    type ControlHandle = ProviderControlHandle;
4718
4719    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
4720        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
4721    }
4722
4723    fn control_handle(&self) -> Self::ControlHandle {
4724        ProviderControlHandle { inner: self.inner.clone() }
4725    }
4726
4727    fn into_inner(
4728        self,
4729    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
4730    {
4731        (self.inner, self.is_terminated)
4732    }
4733
4734    fn from_inner(
4735        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4736        is_terminated: bool,
4737    ) -> Self {
4738        Self { inner, is_terminated }
4739    }
4740}
4741
4742impl futures::Stream for ProviderRequestStream {
4743    type Item = Result<ProviderRequest, fidl::Error>;
4744
4745    fn poll_next(
4746        mut self: std::pin::Pin<&mut Self>,
4747        cx: &mut std::task::Context<'_>,
4748    ) -> std::task::Poll<Option<Self::Item>> {
4749        let this = &mut *self;
4750        if this.inner.check_shutdown(cx) {
4751            this.is_terminated = true;
4752            return std::task::Poll::Ready(None);
4753        }
4754        if this.is_terminated {
4755            panic!("polled ProviderRequestStream after completion");
4756        }
4757        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
4758            |bytes, handles| {
4759                match this.inner.channel().read_etc(cx, bytes, handles) {
4760                    std::task::Poll::Ready(Ok(())) => {}
4761                    std::task::Poll::Pending => return std::task::Poll::Pending,
4762                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
4763                        this.is_terminated = true;
4764                        return std::task::Poll::Ready(None);
4765                    }
4766                    std::task::Poll::Ready(Err(e)) => {
4767                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
4768                            e.into(),
4769                        ))));
4770                    }
4771                }
4772
4773                // A message has been received from the channel
4774                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4775
4776                std::task::Poll::Ready(Some(match header.ordinal {
4777                    0x1bd6070372d03df0 => {
4778                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4779                        let mut req = fidl::new_empty!(
4780                            ProviderOpenCoordinatorRequest,
4781                            fidl::encoding::DefaultFuchsiaResourceDialect
4782                        );
4783                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ProviderOpenCoordinatorRequest>(&header, _body_bytes, handles, &mut req)?;
4784                        let control_handle = ProviderControlHandle { inner: this.inner.clone() };
4785                        Ok(ProviderRequest::OpenCoordinator {
4786                            payload: req,
4787                            responder: ProviderOpenCoordinatorResponder {
4788                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4789                                tx_id: header.tx_id,
4790                            },
4791                        })
4792                    }
4793                    _ => Err(fidl::Error::UnknownOrdinal {
4794                        ordinal: header.ordinal,
4795                        protocol_name:
4796                            <ProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4797                    }),
4798                }))
4799            },
4800        )
4801    }
4802}
4803
4804/// Provider for display coordinators.
4805///
4806/// The driver supports two simultaneous clients - a main client and a virtcon
4807/// client.  In some cases, the provider service may provide access to only one or
4808/// the other; if the client tries to open the other then `ZX_ERR_NOT_SUPPORTED` will
4809/// be returned.
4810#[derive(Debug)]
4811pub enum ProviderRequest {
4812    /// Opens a client connection to the Display Coordinator.
4813    ///
4814    /// On success, `coordinator` will be bound to the Display Coordinator
4815    /// at the requested priority level, and `coordinator_listener` will receive
4816    /// notifications for the newly bound client.
4817    ///
4818    /// Fails with `ZX_ERR_ALREADY_BOUND` if the Display Coordinator already has
4819    /// a connected client at the given priority level.
4820    ///
4821    /// Fails with `ZX_ERR_INVALID_ARGS` if one of the required fields is missing.
4822    OpenCoordinator {
4823        payload: ProviderOpenCoordinatorRequest,
4824        responder: ProviderOpenCoordinatorResponder,
4825    },
4826}
4827
4828impl ProviderRequest {
4829    #[allow(irrefutable_let_patterns)]
4830    pub fn into_open_coordinator(
4831        self,
4832    ) -> Option<(ProviderOpenCoordinatorRequest, ProviderOpenCoordinatorResponder)> {
4833        if let ProviderRequest::OpenCoordinator { payload, responder } = self {
4834            Some((payload, responder))
4835        } else {
4836            None
4837        }
4838    }
4839
4840    /// Name of the method defined in FIDL
4841    pub fn method_name(&self) -> &'static str {
4842        match *self {
4843            ProviderRequest::OpenCoordinator { .. } => "open_coordinator",
4844        }
4845    }
4846}
4847
4848#[derive(Debug, Clone)]
4849pub struct ProviderControlHandle {
4850    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4851}
4852
4853impl fidl::endpoints::ControlHandle for ProviderControlHandle {
4854    fn shutdown(&self) {
4855        self.inner.shutdown()
4856    }
4857
4858    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
4859        self.inner.shutdown_with_epitaph(status)
4860    }
4861
4862    fn is_closed(&self) -> bool {
4863        self.inner.channel().is_closed()
4864    }
4865    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
4866        self.inner.channel().on_closed()
4867    }
4868
4869    #[cfg(target_os = "fuchsia")]
4870    fn signal_peer(
4871        &self,
4872        clear_mask: zx::Signals,
4873        set_mask: zx::Signals,
4874    ) -> Result<(), zx_status::Status> {
4875        use fidl::Peered;
4876        self.inner.channel().signal_peer(clear_mask, set_mask)
4877    }
4878}
4879
4880impl ProviderControlHandle {}
4881
4882#[must_use = "FIDL methods require a response to be sent"]
4883#[derive(Debug)]
4884pub struct ProviderOpenCoordinatorResponder {
4885    control_handle: std::mem::ManuallyDrop<ProviderControlHandle>,
4886    tx_id: u32,
4887}
4888
4889/// Set the the channel to be shutdown (see [`ProviderControlHandle::shutdown`])
4890/// if the responder is dropped without sending a response, so that the client
4891/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4892impl std::ops::Drop for ProviderOpenCoordinatorResponder {
4893    fn drop(&mut self) {
4894        self.control_handle.shutdown();
4895        // Safety: drops once, never accessed again
4896        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4897    }
4898}
4899
4900impl fidl::endpoints::Responder for ProviderOpenCoordinatorResponder {
4901    type ControlHandle = ProviderControlHandle;
4902
4903    fn control_handle(&self) -> &ProviderControlHandle {
4904        &self.control_handle
4905    }
4906
4907    fn drop_without_shutdown(mut self) {
4908        // Safety: drops once, never accessed again due to mem::forget
4909        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4910        // Prevent Drop from running (which would shut down the channel)
4911        std::mem::forget(self);
4912    }
4913}
4914
4915impl ProviderOpenCoordinatorResponder {
4916    /// Sends a response to the FIDL transaction.
4917    ///
4918    /// Sets the channel to shutdown if an error occurs.
4919    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
4920        let _result = self.send_raw(result);
4921        if _result.is_err() {
4922            self.control_handle.shutdown();
4923        }
4924        self.drop_without_shutdown();
4925        _result
4926    }
4927
4928    /// Similar to "send" but does not shutdown the channel if an error occurs.
4929    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
4930        let _result = self.send_raw(result);
4931        self.drop_without_shutdown();
4932        _result
4933    }
4934
4935    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
4936        self.control_handle
4937            .inner
4938            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
4939                result,
4940                self.tx_id,
4941                0x1bd6070372d03df0,
4942                fidl::encoding::DynamicFlags::empty(),
4943            )
4944    }
4945}
4946
4947#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
4948pub struct ServiceMarker;
4949
4950#[cfg(target_os = "fuchsia")]
4951impl fidl::endpoints::ServiceMarker for ServiceMarker {
4952    type Proxy = ServiceProxy;
4953    type Request = ServiceRequest;
4954    const SERVICE_NAME: &'static str = "fuchsia.hardware.display.Service";
4955}
4956
4957/// A request for one of the member protocols of Service.
4958///
4959#[cfg(target_os = "fuchsia")]
4960pub enum ServiceRequest {
4961    Provider(ProviderRequestStream),
4962}
4963
4964#[cfg(target_os = "fuchsia")]
4965impl fidl::endpoints::ServiceRequest for ServiceRequest {
4966    type Service = ServiceMarker;
4967
4968    fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
4969        match name {
4970            "provider" => Self::Provider(
4971                <ProviderRequestStream as fidl::endpoints::RequestStream>::from_channel(_channel),
4972            ),
4973            _ => panic!("no such member protocol name for service Service"),
4974        }
4975    }
4976
4977    fn member_names() -> &'static [&'static str] {
4978        &["provider"]
4979    }
4980}
4981#[cfg(target_os = "fuchsia")]
4982pub struct ServiceProxy(#[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>);
4983
4984#[cfg(target_os = "fuchsia")]
4985impl fidl::endpoints::ServiceProxy for ServiceProxy {
4986    type Service = ServiceMarker;
4987
4988    fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
4989        Self(opener)
4990    }
4991}
4992
4993#[cfg(target_os = "fuchsia")]
4994impl ServiceProxy {
4995    pub fn connect_to_provider(&self) -> Result<ProviderProxy, fidl::Error> {
4996        let (proxy, server_end) = fidl::endpoints::create_proxy::<ProviderMarker>();
4997        self.connect_channel_to_provider(server_end)?;
4998        Ok(proxy)
4999    }
5000
5001    /// Like `connect_to_provider`, but returns a sync proxy.
5002    /// See [`Self::connect_to_provider`] for more details.
5003    pub fn connect_to_provider_sync(&self) -> Result<ProviderSynchronousProxy, fidl::Error> {
5004        let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<ProviderMarker>();
5005        self.connect_channel_to_provider(server_end)?;
5006        Ok(proxy)
5007    }
5008
5009    /// Like `connect_to_provider`, but accepts a server end.
5010    /// See [`Self::connect_to_provider`] for more details.
5011    pub fn connect_channel_to_provider(
5012        &self,
5013        server_end: fidl::endpoints::ServerEnd<ProviderMarker>,
5014    ) -> Result<(), fidl::Error> {
5015        self.0.open_member("provider", server_end.into_channel())
5016    }
5017
5018    pub fn instance_name(&self) -> &str {
5019        self.0.instance_name()
5020    }
5021}
5022
5023mod internal {
5024    use super::*;
5025
5026    impl fidl::encoding::ResourceTypeMarker for CoordinatorImportBufferCollectionRequest {
5027        type Borrowed<'a> = &'a mut Self;
5028        fn take_or_borrow<'a>(
5029            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
5030        ) -> Self::Borrowed<'a> {
5031            value
5032        }
5033    }
5034
5035    unsafe impl fidl::encoding::TypeMarker for CoordinatorImportBufferCollectionRequest {
5036        type Owned = Self;
5037
5038        #[inline(always)]
5039        fn inline_align(_context: fidl::encoding::Context) -> usize {
5040            8
5041        }
5042
5043        #[inline(always)]
5044        fn inline_size(_context: fidl::encoding::Context) -> usize {
5045            16
5046        }
5047    }
5048
5049    unsafe impl
5050        fidl::encoding::Encode<
5051            CoordinatorImportBufferCollectionRequest,
5052            fidl::encoding::DefaultFuchsiaResourceDialect,
5053        > for &mut CoordinatorImportBufferCollectionRequest
5054    {
5055        #[inline]
5056        unsafe fn encode(
5057            self,
5058            encoder: &mut fidl::encoding::Encoder<
5059                '_,
5060                fidl::encoding::DefaultFuchsiaResourceDialect,
5061            >,
5062            offset: usize,
5063            _depth: fidl::encoding::Depth,
5064        ) -> fidl::Result<()> {
5065            encoder.debug_check_bounds::<CoordinatorImportBufferCollectionRequest>(offset);
5066            // Delegate to tuple encoding.
5067            fidl::encoding::Encode::<
5068                CoordinatorImportBufferCollectionRequest,
5069                fidl::encoding::DefaultFuchsiaResourceDialect,
5070            >::encode(
5071                (
5072                    <BufferCollectionId as fidl::encoding::ValueTypeMarker>::borrow(
5073                        &self.buffer_collection_id,
5074                    ),
5075                    <fidl::encoding::Endpoint<
5076                        fidl::endpoints::ClientEnd<
5077                            fidl_fuchsia_sysmem2::BufferCollectionTokenMarker,
5078                        >,
5079                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
5080                        &mut self.buffer_collection_token,
5081                    ),
5082                ),
5083                encoder,
5084                offset,
5085                _depth,
5086            )
5087        }
5088    }
5089    unsafe impl<
5090        T0: fidl::encoding::Encode<BufferCollectionId, fidl::encoding::DefaultFuchsiaResourceDialect>,
5091        T1: fidl::encoding::Encode<
5092                fidl::encoding::Endpoint<
5093                    fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem2::BufferCollectionTokenMarker>,
5094                >,
5095                fidl::encoding::DefaultFuchsiaResourceDialect,
5096            >,
5097    >
5098        fidl::encoding::Encode<
5099            CoordinatorImportBufferCollectionRequest,
5100            fidl::encoding::DefaultFuchsiaResourceDialect,
5101        > for (T0, T1)
5102    {
5103        #[inline]
5104        unsafe fn encode(
5105            self,
5106            encoder: &mut fidl::encoding::Encoder<
5107                '_,
5108                fidl::encoding::DefaultFuchsiaResourceDialect,
5109            >,
5110            offset: usize,
5111            depth: fidl::encoding::Depth,
5112        ) -> fidl::Result<()> {
5113            encoder.debug_check_bounds::<CoordinatorImportBufferCollectionRequest>(offset);
5114            // Zero out padding regions. There's no need to apply masks
5115            // because the unmasked parts will be overwritten by fields.
5116            unsafe {
5117                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
5118                (ptr as *mut u64).write_unaligned(0);
5119            }
5120            // Write the fields.
5121            self.0.encode(encoder, offset + 0, depth)?;
5122            self.1.encode(encoder, offset + 8, depth)?;
5123            Ok(())
5124        }
5125    }
5126
5127    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
5128        for CoordinatorImportBufferCollectionRequest
5129    {
5130        #[inline(always)]
5131        fn new_empty() -> Self {
5132            Self {
5133                buffer_collection_id: fidl::new_empty!(
5134                    BufferCollectionId,
5135                    fidl::encoding::DefaultFuchsiaResourceDialect
5136                ),
5137                buffer_collection_token: fidl::new_empty!(
5138                    fidl::encoding::Endpoint<
5139                        fidl::endpoints::ClientEnd<
5140                            fidl_fuchsia_sysmem2::BufferCollectionTokenMarker,
5141                        >,
5142                    >,
5143                    fidl::encoding::DefaultFuchsiaResourceDialect
5144                ),
5145            }
5146        }
5147
5148        #[inline]
5149        unsafe fn decode(
5150            &mut self,
5151            decoder: &mut fidl::encoding::Decoder<
5152                '_,
5153                fidl::encoding::DefaultFuchsiaResourceDialect,
5154            >,
5155            offset: usize,
5156            _depth: fidl::encoding::Depth,
5157        ) -> fidl::Result<()> {
5158            decoder.debug_check_bounds::<Self>(offset);
5159            // Verify that padding bytes are zero.
5160            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(8) };
5161            let padval = unsafe { (ptr as *const u64).read_unaligned() };
5162            let mask = 0xffffffff00000000u64;
5163            let maskedval = padval & mask;
5164            if maskedval != 0 {
5165                return Err(fidl::Error::NonZeroPadding {
5166                    padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
5167                });
5168            }
5169            fidl::decode!(
5170                BufferCollectionId,
5171                fidl::encoding::DefaultFuchsiaResourceDialect,
5172                &mut self.buffer_collection_id,
5173                decoder,
5174                offset + 0,
5175                _depth
5176            )?;
5177            fidl::decode!(
5178                fidl::encoding::Endpoint<
5179                    fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem2::BufferCollectionTokenMarker>,
5180                >,
5181                fidl::encoding::DefaultFuchsiaResourceDialect,
5182                &mut self.buffer_collection_token,
5183                decoder,
5184                offset + 8,
5185                _depth
5186            )?;
5187            Ok(())
5188        }
5189    }
5190
5191    impl fidl::encoding::ResourceTypeMarker for CoordinatorImportEventRequest {
5192        type Borrowed<'a> = &'a mut Self;
5193        fn take_or_borrow<'a>(
5194            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
5195        ) -> Self::Borrowed<'a> {
5196            value
5197        }
5198    }
5199
5200    unsafe impl fidl::encoding::TypeMarker for CoordinatorImportEventRequest {
5201        type Owned = Self;
5202
5203        #[inline(always)]
5204        fn inline_align(_context: fidl::encoding::Context) -> usize {
5205            8
5206        }
5207
5208        #[inline(always)]
5209        fn inline_size(_context: fidl::encoding::Context) -> usize {
5210            16
5211        }
5212    }
5213
5214    unsafe impl
5215        fidl::encoding::Encode<
5216            CoordinatorImportEventRequest,
5217            fidl::encoding::DefaultFuchsiaResourceDialect,
5218        > for &mut CoordinatorImportEventRequest
5219    {
5220        #[inline]
5221        unsafe fn encode(
5222            self,
5223            encoder: &mut fidl::encoding::Encoder<
5224                '_,
5225                fidl::encoding::DefaultFuchsiaResourceDialect,
5226            >,
5227            offset: usize,
5228            _depth: fidl::encoding::Depth,
5229        ) -> fidl::Result<()> {
5230            encoder.debug_check_bounds::<CoordinatorImportEventRequest>(offset);
5231            // Delegate to tuple encoding.
5232            fidl::encoding::Encode::<
5233                CoordinatorImportEventRequest,
5234                fidl::encoding::DefaultFuchsiaResourceDialect,
5235            >::encode(
5236                (
5237                    <fidl::encoding::HandleType<
5238                        fidl::Event,
5239                        { fidl::ObjectType::EVENT.into_raw() },
5240                        2147483648,
5241                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
5242                        &mut self.event
5243                    ),
5244                    <EventId as fidl::encoding::ValueTypeMarker>::borrow(&self.id),
5245                ),
5246                encoder,
5247                offset,
5248                _depth,
5249            )
5250        }
5251    }
5252    unsafe impl<
5253        T0: fidl::encoding::Encode<
5254                fidl::encoding::HandleType<
5255                    fidl::Event,
5256                    { fidl::ObjectType::EVENT.into_raw() },
5257                    2147483648,
5258                >,
5259                fidl::encoding::DefaultFuchsiaResourceDialect,
5260            >,
5261        T1: fidl::encoding::Encode<EventId, fidl::encoding::DefaultFuchsiaResourceDialect>,
5262    >
5263        fidl::encoding::Encode<
5264            CoordinatorImportEventRequest,
5265            fidl::encoding::DefaultFuchsiaResourceDialect,
5266        > for (T0, T1)
5267    {
5268        #[inline]
5269        unsafe fn encode(
5270            self,
5271            encoder: &mut fidl::encoding::Encoder<
5272                '_,
5273                fidl::encoding::DefaultFuchsiaResourceDialect,
5274            >,
5275            offset: usize,
5276            depth: fidl::encoding::Depth,
5277        ) -> fidl::Result<()> {
5278            encoder.debug_check_bounds::<CoordinatorImportEventRequest>(offset);
5279            // Zero out padding regions. There's no need to apply masks
5280            // because the unmasked parts will be overwritten by fields.
5281            unsafe {
5282                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
5283                (ptr as *mut u64).write_unaligned(0);
5284            }
5285            // Write the fields.
5286            self.0.encode(encoder, offset + 0, depth)?;
5287            self.1.encode(encoder, offset + 8, depth)?;
5288            Ok(())
5289        }
5290    }
5291
5292    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
5293        for CoordinatorImportEventRequest
5294    {
5295        #[inline(always)]
5296        fn new_empty() -> Self {
5297            Self {
5298                event: fidl::new_empty!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
5299                id: fidl::new_empty!(EventId, fidl::encoding::DefaultFuchsiaResourceDialect),
5300            }
5301        }
5302
5303        #[inline]
5304        unsafe fn decode(
5305            &mut self,
5306            decoder: &mut fidl::encoding::Decoder<
5307                '_,
5308                fidl::encoding::DefaultFuchsiaResourceDialect,
5309            >,
5310            offset: usize,
5311            _depth: fidl::encoding::Depth,
5312        ) -> fidl::Result<()> {
5313            decoder.debug_check_bounds::<Self>(offset);
5314            // Verify that padding bytes are zero.
5315            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
5316            let padval = unsafe { (ptr as *const u64).read_unaligned() };
5317            let mask = 0xffffffff00000000u64;
5318            let maskedval = padval & mask;
5319            if maskedval != 0 {
5320                return Err(fidl::Error::NonZeroPadding {
5321                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
5322                });
5323            }
5324            fidl::decode!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.event, decoder, offset + 0, _depth)?;
5325            fidl::decode!(
5326                EventId,
5327                fidl::encoding::DefaultFuchsiaResourceDialect,
5328                &mut self.id,
5329                decoder,
5330                offset + 8,
5331                _depth
5332            )?;
5333            Ok(())
5334        }
5335    }
5336
5337    impl CoordinatorCommitConfigRequest {
5338        #[inline(always)]
5339        fn max_ordinal_present(&self) -> u64 {
5340            if let Some(_) = self.stamp {
5341                return 1;
5342            }
5343            0
5344        }
5345    }
5346
5347    impl fidl::encoding::ResourceTypeMarker for CoordinatorCommitConfigRequest {
5348        type Borrowed<'a> = &'a mut Self;
5349        fn take_or_borrow<'a>(
5350            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
5351        ) -> Self::Borrowed<'a> {
5352            value
5353        }
5354    }
5355
5356    unsafe impl fidl::encoding::TypeMarker for CoordinatorCommitConfigRequest {
5357        type Owned = Self;
5358
5359        #[inline(always)]
5360        fn inline_align(_context: fidl::encoding::Context) -> usize {
5361            8
5362        }
5363
5364        #[inline(always)]
5365        fn inline_size(_context: fidl::encoding::Context) -> usize {
5366            16
5367        }
5368    }
5369
5370    unsafe impl
5371        fidl::encoding::Encode<
5372            CoordinatorCommitConfigRequest,
5373            fidl::encoding::DefaultFuchsiaResourceDialect,
5374        > for &mut CoordinatorCommitConfigRequest
5375    {
5376        unsafe fn encode(
5377            self,
5378            encoder: &mut fidl::encoding::Encoder<
5379                '_,
5380                fidl::encoding::DefaultFuchsiaResourceDialect,
5381            >,
5382            offset: usize,
5383            mut depth: fidl::encoding::Depth,
5384        ) -> fidl::Result<()> {
5385            encoder.debug_check_bounds::<CoordinatorCommitConfigRequest>(offset);
5386            // Vector header
5387            let max_ordinal: u64 = self.max_ordinal_present();
5388            encoder.write_num(max_ordinal, offset);
5389            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
5390            // Calling encoder.out_of_line_offset(0) is not allowed.
5391            if max_ordinal == 0 {
5392                return Ok(());
5393            }
5394            depth.increment()?;
5395            let envelope_size = 8;
5396            let bytes_len = max_ordinal as usize * envelope_size;
5397            #[allow(unused_variables)]
5398            let offset = encoder.out_of_line_offset(bytes_len);
5399            let mut _prev_end_offset: usize = 0;
5400            if 1 > max_ordinal {
5401                return Ok(());
5402            }
5403
5404            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5405            // are envelope_size bytes.
5406            let cur_offset: usize = (1 - 1) * envelope_size;
5407
5408            // Zero reserved fields.
5409            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5410
5411            // Safety:
5412            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5413            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5414            //   envelope_size bytes, there is always sufficient room.
5415            fidl::encoding::encode_in_envelope_optional::<
5416                ConfigStamp,
5417                fidl::encoding::DefaultFuchsiaResourceDialect,
5418            >(
5419                self.stamp.as_ref().map(<ConfigStamp as fidl::encoding::ValueTypeMarker>::borrow),
5420                encoder,
5421                offset + cur_offset,
5422                depth,
5423            )?;
5424
5425            _prev_end_offset = cur_offset + envelope_size;
5426
5427            Ok(())
5428        }
5429    }
5430
5431    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
5432        for CoordinatorCommitConfigRequest
5433    {
5434        #[inline(always)]
5435        fn new_empty() -> Self {
5436            Self::default()
5437        }
5438
5439        unsafe fn decode(
5440            &mut self,
5441            decoder: &mut fidl::encoding::Decoder<
5442                '_,
5443                fidl::encoding::DefaultFuchsiaResourceDialect,
5444            >,
5445            offset: usize,
5446            mut depth: fidl::encoding::Depth,
5447        ) -> fidl::Result<()> {
5448            decoder.debug_check_bounds::<Self>(offset);
5449            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
5450                None => return Err(fidl::Error::NotNullable),
5451                Some(len) => len,
5452            };
5453            // Calling decoder.out_of_line_offset(0) is not allowed.
5454            if len == 0 {
5455                return Ok(());
5456            };
5457            depth.increment()?;
5458            let envelope_size = 8;
5459            let bytes_len = len * envelope_size;
5460            let offset = decoder.out_of_line_offset(bytes_len)?;
5461            // Decode the envelope for each type.
5462            let mut _next_ordinal_to_read = 0;
5463            let mut next_offset = offset;
5464            let end_offset = offset + bytes_len;
5465            _next_ordinal_to_read += 1;
5466            if next_offset >= end_offset {
5467                return Ok(());
5468            }
5469
5470            // Decode unknown envelopes for gaps in ordinals.
5471            while _next_ordinal_to_read < 1 {
5472                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5473                _next_ordinal_to_read += 1;
5474                next_offset += envelope_size;
5475            }
5476
5477            let next_out_of_line = decoder.next_out_of_line();
5478            let handles_before = decoder.remaining_handles();
5479            if let Some((inlined, num_bytes, num_handles)) =
5480                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5481            {
5482                let member_inline_size =
5483                    <ConfigStamp as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5484                if inlined != (member_inline_size <= 4) {
5485                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5486                }
5487                let inner_offset;
5488                let mut inner_depth = depth.clone();
5489                if inlined {
5490                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5491                    inner_offset = next_offset;
5492                } else {
5493                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5494                    inner_depth.increment()?;
5495                }
5496                let val_ref = self.stamp.get_or_insert_with(|| {
5497                    fidl::new_empty!(ConfigStamp, fidl::encoding::DefaultFuchsiaResourceDialect)
5498                });
5499                fidl::decode!(
5500                    ConfigStamp,
5501                    fidl::encoding::DefaultFuchsiaResourceDialect,
5502                    val_ref,
5503                    decoder,
5504                    inner_offset,
5505                    inner_depth
5506                )?;
5507                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5508                {
5509                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5510                }
5511                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5512                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5513                }
5514            }
5515
5516            next_offset += envelope_size;
5517
5518            // Decode the remaining unknown envelopes.
5519            while next_offset < end_offset {
5520                _next_ordinal_to_read += 1;
5521                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5522                next_offset += envelope_size;
5523            }
5524
5525            Ok(())
5526        }
5527    }
5528
5529    impl ProviderOpenCoordinatorRequest {
5530        #[inline(always)]
5531        fn max_ordinal_present(&self) -> u64 {
5532            if let Some(_) = self.priority {
5533                return 3;
5534            }
5535            if let Some(_) = self.coordinator_listener {
5536                return 2;
5537            }
5538            if let Some(_) = self.coordinator {
5539                return 1;
5540            }
5541            0
5542        }
5543    }
5544
5545    impl fidl::encoding::ResourceTypeMarker for ProviderOpenCoordinatorRequest {
5546        type Borrowed<'a> = &'a mut Self;
5547        fn take_or_borrow<'a>(
5548            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
5549        ) -> Self::Borrowed<'a> {
5550            value
5551        }
5552    }
5553
5554    unsafe impl fidl::encoding::TypeMarker for ProviderOpenCoordinatorRequest {
5555        type Owned = Self;
5556
5557        #[inline(always)]
5558        fn inline_align(_context: fidl::encoding::Context) -> usize {
5559            8
5560        }
5561
5562        #[inline(always)]
5563        fn inline_size(_context: fidl::encoding::Context) -> usize {
5564            16
5565        }
5566    }
5567
5568    unsafe impl
5569        fidl::encoding::Encode<
5570            ProviderOpenCoordinatorRequest,
5571            fidl::encoding::DefaultFuchsiaResourceDialect,
5572        > for &mut ProviderOpenCoordinatorRequest
5573    {
5574        unsafe fn encode(
5575            self,
5576            encoder: &mut fidl::encoding::Encoder<
5577                '_,
5578                fidl::encoding::DefaultFuchsiaResourceDialect,
5579            >,
5580            offset: usize,
5581            mut depth: fidl::encoding::Depth,
5582        ) -> fidl::Result<()> {
5583            encoder.debug_check_bounds::<ProviderOpenCoordinatorRequest>(offset);
5584            // Vector header
5585            let max_ordinal: u64 = self.max_ordinal_present();
5586            encoder.write_num(max_ordinal, offset);
5587            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
5588            // Calling encoder.out_of_line_offset(0) is not allowed.
5589            if max_ordinal == 0 {
5590                return Ok(());
5591            }
5592            depth.increment()?;
5593            let envelope_size = 8;
5594            let bytes_len = max_ordinal as usize * envelope_size;
5595            #[allow(unused_variables)]
5596            let offset = encoder.out_of_line_offset(bytes_len);
5597            let mut _prev_end_offset: usize = 0;
5598            if 1 > max_ordinal {
5599                return Ok(());
5600            }
5601
5602            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5603            // are envelope_size bytes.
5604            let cur_offset: usize = (1 - 1) * envelope_size;
5605
5606            // Zero reserved fields.
5607            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5608
5609            // Safety:
5610            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5611            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5612            //   envelope_size bytes, there is always sufficient room.
5613            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CoordinatorMarker>>, fidl::encoding::DefaultFuchsiaResourceDialect>(
5614            self.coordinator.as_mut().map(<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CoordinatorMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
5615            encoder, offset + cur_offset, depth
5616        )?;
5617
5618            _prev_end_offset = cur_offset + envelope_size;
5619            if 2 > max_ordinal {
5620                return Ok(());
5621            }
5622
5623            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5624            // are envelope_size bytes.
5625            let cur_offset: usize = (2 - 1) * envelope_size;
5626
5627            // Zero reserved fields.
5628            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5629
5630            // Safety:
5631            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5632            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5633            //   envelope_size bytes, there is always sufficient room.
5634            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<CoordinatorListenerMarker>>, fidl::encoding::DefaultFuchsiaResourceDialect>(
5635            self.coordinator_listener.as_mut().map(<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<CoordinatorListenerMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
5636            encoder, offset + cur_offset, depth
5637        )?;
5638
5639            _prev_end_offset = cur_offset + envelope_size;
5640            if 3 > max_ordinal {
5641                return Ok(());
5642            }
5643
5644            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5645            // are envelope_size bytes.
5646            let cur_offset: usize = (3 - 1) * envelope_size;
5647
5648            // Zero reserved fields.
5649            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5650
5651            // Safety:
5652            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5653            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5654            //   envelope_size bytes, there is always sufficient room.
5655            fidl::encoding::encode_in_envelope_optional::<
5656                ClientPriority,
5657                fidl::encoding::DefaultFuchsiaResourceDialect,
5658            >(
5659                self.priority
5660                    .as_ref()
5661                    .map(<ClientPriority as fidl::encoding::ValueTypeMarker>::borrow),
5662                encoder,
5663                offset + cur_offset,
5664                depth,
5665            )?;
5666
5667            _prev_end_offset = cur_offset + envelope_size;
5668
5669            Ok(())
5670        }
5671    }
5672
5673    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
5674        for ProviderOpenCoordinatorRequest
5675    {
5676        #[inline(always)]
5677        fn new_empty() -> Self {
5678            Self::default()
5679        }
5680
5681        unsafe fn decode(
5682            &mut self,
5683            decoder: &mut fidl::encoding::Decoder<
5684                '_,
5685                fidl::encoding::DefaultFuchsiaResourceDialect,
5686            >,
5687            offset: usize,
5688            mut depth: fidl::encoding::Depth,
5689        ) -> fidl::Result<()> {
5690            decoder.debug_check_bounds::<Self>(offset);
5691            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
5692                None => return Err(fidl::Error::NotNullable),
5693                Some(len) => len,
5694            };
5695            // Calling decoder.out_of_line_offset(0) is not allowed.
5696            if len == 0 {
5697                return Ok(());
5698            };
5699            depth.increment()?;
5700            let envelope_size = 8;
5701            let bytes_len = len * envelope_size;
5702            let offset = decoder.out_of_line_offset(bytes_len)?;
5703            // Decode the envelope for each type.
5704            let mut _next_ordinal_to_read = 0;
5705            let mut next_offset = offset;
5706            let end_offset = offset + bytes_len;
5707            _next_ordinal_to_read += 1;
5708            if next_offset >= end_offset {
5709                return Ok(());
5710            }
5711
5712            // Decode unknown envelopes for gaps in ordinals.
5713            while _next_ordinal_to_read < 1 {
5714                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5715                _next_ordinal_to_read += 1;
5716                next_offset += envelope_size;
5717            }
5718
5719            let next_out_of_line = decoder.next_out_of_line();
5720            let handles_before = decoder.remaining_handles();
5721            if let Some((inlined, num_bytes, num_handles)) =
5722                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5723            {
5724                let member_inline_size = <fidl::encoding::Endpoint<
5725                    fidl::endpoints::ServerEnd<CoordinatorMarker>,
5726                > as fidl::encoding::TypeMarker>::inline_size(
5727                    decoder.context
5728                );
5729                if inlined != (member_inline_size <= 4) {
5730                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5731                }
5732                let inner_offset;
5733                let mut inner_depth = depth.clone();
5734                if inlined {
5735                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5736                    inner_offset = next_offset;
5737                } else {
5738                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5739                    inner_depth.increment()?;
5740                }
5741                let val_ref = self.coordinator.get_or_insert_with(|| {
5742                    fidl::new_empty!(
5743                        fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CoordinatorMarker>>,
5744                        fidl::encoding::DefaultFuchsiaResourceDialect
5745                    )
5746                });
5747                fidl::decode!(
5748                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CoordinatorMarker>>,
5749                    fidl::encoding::DefaultFuchsiaResourceDialect,
5750                    val_ref,
5751                    decoder,
5752                    inner_offset,
5753                    inner_depth
5754                )?;
5755                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5756                {
5757                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5758                }
5759                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5760                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5761                }
5762            }
5763
5764            next_offset += envelope_size;
5765            _next_ordinal_to_read += 1;
5766            if next_offset >= end_offset {
5767                return Ok(());
5768            }
5769
5770            // Decode unknown envelopes for gaps in ordinals.
5771            while _next_ordinal_to_read < 2 {
5772                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5773                _next_ordinal_to_read += 1;
5774                next_offset += envelope_size;
5775            }
5776
5777            let next_out_of_line = decoder.next_out_of_line();
5778            let handles_before = decoder.remaining_handles();
5779            if let Some((inlined, num_bytes, num_handles)) =
5780                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5781            {
5782                let member_inline_size = <fidl::encoding::Endpoint<
5783                    fidl::endpoints::ClientEnd<CoordinatorListenerMarker>,
5784                > as fidl::encoding::TypeMarker>::inline_size(
5785                    decoder.context
5786                );
5787                if inlined != (member_inline_size <= 4) {
5788                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5789                }
5790                let inner_offset;
5791                let mut inner_depth = depth.clone();
5792                if inlined {
5793                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5794                    inner_offset = next_offset;
5795                } else {
5796                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5797                    inner_depth.increment()?;
5798                }
5799                let val_ref = self.coordinator_listener.get_or_insert_with(|| {
5800                    fidl::new_empty!(
5801                        fidl::encoding::Endpoint<
5802                            fidl::endpoints::ClientEnd<CoordinatorListenerMarker>,
5803                        >,
5804                        fidl::encoding::DefaultFuchsiaResourceDialect
5805                    )
5806                });
5807                fidl::decode!(
5808                    fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<CoordinatorListenerMarker>>,
5809                    fidl::encoding::DefaultFuchsiaResourceDialect,
5810                    val_ref,
5811                    decoder,
5812                    inner_offset,
5813                    inner_depth
5814                )?;
5815                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5816                {
5817                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5818                }
5819                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5820                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5821                }
5822            }
5823
5824            next_offset += envelope_size;
5825            _next_ordinal_to_read += 1;
5826            if next_offset >= end_offset {
5827                return Ok(());
5828            }
5829
5830            // Decode unknown envelopes for gaps in ordinals.
5831            while _next_ordinal_to_read < 3 {
5832                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5833                _next_ordinal_to_read += 1;
5834                next_offset += envelope_size;
5835            }
5836
5837            let next_out_of_line = decoder.next_out_of_line();
5838            let handles_before = decoder.remaining_handles();
5839            if let Some((inlined, num_bytes, num_handles)) =
5840                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5841            {
5842                let member_inline_size =
5843                    <ClientPriority as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5844                if inlined != (member_inline_size <= 4) {
5845                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5846                }
5847                let inner_offset;
5848                let mut inner_depth = depth.clone();
5849                if inlined {
5850                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5851                    inner_offset = next_offset;
5852                } else {
5853                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5854                    inner_depth.increment()?;
5855                }
5856                let val_ref = self.priority.get_or_insert_with(|| {
5857                    fidl::new_empty!(ClientPriority, fidl::encoding::DefaultFuchsiaResourceDialect)
5858                });
5859                fidl::decode!(
5860                    ClientPriority,
5861                    fidl::encoding::DefaultFuchsiaResourceDialect,
5862                    val_ref,
5863                    decoder,
5864                    inner_offset,
5865                    inner_depth
5866                )?;
5867                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5868                {
5869                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5870                }
5871                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5872                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5873                }
5874            }
5875
5876            next_offset += envelope_size;
5877
5878            // Decode the remaining unknown envelopes.
5879            while next_offset < end_offset {
5880                _next_ordinal_to_read += 1;
5881                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5882                next_offset += envelope_size;
5883            }
5884
5885            Ok(())
5886        }
5887    }
5888}