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 CoordinatorControlHandle {
3081    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
3082        self.inner.shutdown_with_epitaph(status.into())
3083    }
3084}
3085
3086impl fidl::endpoints::ControlHandle for CoordinatorControlHandle {
3087    fn shutdown(&self) {
3088        self.inner.shutdown()
3089    }
3090
3091    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
3092        self.inner.shutdown_with_epitaph(status)
3093    }
3094
3095    fn is_closed(&self) -> bool {
3096        self.inner.channel().is_closed()
3097    }
3098    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3099        self.inner.channel().on_closed()
3100    }
3101
3102    #[cfg(target_os = "fuchsia")]
3103    fn signal_peer(
3104        &self,
3105        clear_mask: zx::Signals,
3106        set_mask: zx::Signals,
3107    ) -> Result<(), zx_status::Status> {
3108        use fidl::Peered;
3109        self.inner.channel().signal_peer(clear_mask, set_mask)
3110    }
3111}
3112
3113impl CoordinatorControlHandle {}
3114
3115#[must_use = "FIDL methods require a response to be sent"]
3116#[derive(Debug)]
3117pub struct CoordinatorImportImageResponder {
3118    control_handle: std::mem::ManuallyDrop<CoordinatorControlHandle>,
3119    tx_id: u32,
3120}
3121
3122/// Set the the channel to be shutdown (see [`CoordinatorControlHandle::shutdown`])
3123/// if the responder is dropped without sending a response, so that the client
3124/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3125impl std::ops::Drop for CoordinatorImportImageResponder {
3126    fn drop(&mut self) {
3127        self.control_handle.shutdown();
3128        // Safety: drops once, never accessed again
3129        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3130    }
3131}
3132
3133impl fidl::endpoints::Responder for CoordinatorImportImageResponder {
3134    type ControlHandle = CoordinatorControlHandle;
3135
3136    fn control_handle(&self) -> &CoordinatorControlHandle {
3137        &self.control_handle
3138    }
3139
3140    fn drop_without_shutdown(mut self) {
3141        // Safety: drops once, never accessed again due to mem::forget
3142        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3143        // Prevent Drop from running (which would shut down the channel)
3144        std::mem::forget(self);
3145    }
3146}
3147
3148impl CoordinatorImportImageResponder {
3149    /// Sends a response to the FIDL transaction.
3150    ///
3151    /// Sets the channel to shutdown if an error occurs.
3152    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3153        let _result = self.send_raw(result);
3154        if _result.is_err() {
3155            self.control_handle.shutdown();
3156        }
3157        self.drop_without_shutdown();
3158        _result
3159    }
3160
3161    /// Similar to "send" but does not shutdown the channel if an error occurs.
3162    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3163        let _result = self.send_raw(result);
3164        self.drop_without_shutdown();
3165        _result
3166    }
3167
3168    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3169        self.control_handle
3170            .inner
3171            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
3172                result,
3173                self.tx_id,
3174                0x3a8636eb9656b4f4,
3175                fidl::encoding::DynamicFlags::empty(),
3176            )
3177    }
3178}
3179
3180#[must_use = "FIDL methods require a response to be sent"]
3181#[derive(Debug)]
3182pub struct CoordinatorCreateLayerResponder {
3183    control_handle: std::mem::ManuallyDrop<CoordinatorControlHandle>,
3184    tx_id: u32,
3185}
3186
3187/// Set the the channel to be shutdown (see [`CoordinatorControlHandle::shutdown`])
3188/// if the responder is dropped without sending a response, so that the client
3189/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3190impl std::ops::Drop for CoordinatorCreateLayerResponder {
3191    fn drop(&mut self) {
3192        self.control_handle.shutdown();
3193        // Safety: drops once, never accessed again
3194        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3195    }
3196}
3197
3198impl fidl::endpoints::Responder for CoordinatorCreateLayerResponder {
3199    type ControlHandle = CoordinatorControlHandle;
3200
3201    fn control_handle(&self) -> &CoordinatorControlHandle {
3202        &self.control_handle
3203    }
3204
3205    fn drop_without_shutdown(mut self) {
3206        // Safety: drops once, never accessed again due to mem::forget
3207        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3208        // Prevent Drop from running (which would shut down the channel)
3209        std::mem::forget(self);
3210    }
3211}
3212
3213impl CoordinatorCreateLayerResponder {
3214    /// Sends a response to the FIDL transaction.
3215    ///
3216    /// Sets the channel to shutdown if an error occurs.
3217    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3218        let _result = self.send_raw(result);
3219        if _result.is_err() {
3220            self.control_handle.shutdown();
3221        }
3222        self.drop_without_shutdown();
3223        _result
3224    }
3225
3226    /// Similar to "send" but does not shutdown the channel if an error occurs.
3227    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3228        let _result = self.send_raw(result);
3229        self.drop_without_shutdown();
3230        _result
3231    }
3232
3233    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3234        self.control_handle
3235            .inner
3236            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
3237                result,
3238                self.tx_id,
3239                0x2137cfd788a3496b,
3240                fidl::encoding::DynamicFlags::empty(),
3241            )
3242    }
3243}
3244
3245#[must_use = "FIDL methods require a response to be sent"]
3246#[derive(Debug)]
3247pub struct CoordinatorCheckConfigResponder {
3248    control_handle: std::mem::ManuallyDrop<CoordinatorControlHandle>,
3249    tx_id: u32,
3250}
3251
3252/// Set the the channel to be shutdown (see [`CoordinatorControlHandle::shutdown`])
3253/// if the responder is dropped without sending a response, so that the client
3254/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3255impl std::ops::Drop for CoordinatorCheckConfigResponder {
3256    fn drop(&mut self) {
3257        self.control_handle.shutdown();
3258        // Safety: drops once, never accessed again
3259        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3260    }
3261}
3262
3263impl fidl::endpoints::Responder for CoordinatorCheckConfigResponder {
3264    type ControlHandle = CoordinatorControlHandle;
3265
3266    fn control_handle(&self) -> &CoordinatorControlHandle {
3267        &self.control_handle
3268    }
3269
3270    fn drop_without_shutdown(mut self) {
3271        // Safety: drops once, never accessed again due to mem::forget
3272        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3273        // Prevent Drop from running (which would shut down the channel)
3274        std::mem::forget(self);
3275    }
3276}
3277
3278impl CoordinatorCheckConfigResponder {
3279    /// Sends a response to the FIDL transaction.
3280    ///
3281    /// Sets the channel to shutdown if an error occurs.
3282    pub fn send(
3283        self,
3284        mut res: fidl_fuchsia_hardware_display_types::ConfigResult,
3285    ) -> Result<(), fidl::Error> {
3286        let _result = self.send_raw(res);
3287        if _result.is_err() {
3288            self.control_handle.shutdown();
3289        }
3290        self.drop_without_shutdown();
3291        _result
3292    }
3293
3294    /// Similar to "send" but does not shutdown the channel if an error occurs.
3295    pub fn send_no_shutdown_on_err(
3296        self,
3297        mut res: fidl_fuchsia_hardware_display_types::ConfigResult,
3298    ) -> Result<(), fidl::Error> {
3299        let _result = self.send_raw(res);
3300        self.drop_without_shutdown();
3301        _result
3302    }
3303
3304    fn send_raw(
3305        &self,
3306        mut res: fidl_fuchsia_hardware_display_types::ConfigResult,
3307    ) -> Result<(), fidl::Error> {
3308        self.control_handle.inner.send::<CoordinatorCheckConfigResponse>(
3309            (res,),
3310            self.tx_id,
3311            0x2bcfb4eb16878158,
3312            fidl::encoding::DynamicFlags::empty(),
3313        )
3314    }
3315}
3316
3317#[must_use = "FIDL methods require a response to be sent"]
3318#[derive(Debug)]
3319pub struct CoordinatorGetLatestCommittedConfigStampResponder {
3320    control_handle: std::mem::ManuallyDrop<CoordinatorControlHandle>,
3321    tx_id: u32,
3322}
3323
3324/// Set the the channel to be shutdown (see [`CoordinatorControlHandle::shutdown`])
3325/// if the responder is dropped without sending a response, so that the client
3326/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3327impl std::ops::Drop for CoordinatorGetLatestCommittedConfigStampResponder {
3328    fn drop(&mut self) {
3329        self.control_handle.shutdown();
3330        // Safety: drops once, never accessed again
3331        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3332    }
3333}
3334
3335impl fidl::endpoints::Responder for CoordinatorGetLatestCommittedConfigStampResponder {
3336    type ControlHandle = CoordinatorControlHandle;
3337
3338    fn control_handle(&self) -> &CoordinatorControlHandle {
3339        &self.control_handle
3340    }
3341
3342    fn drop_without_shutdown(mut self) {
3343        // Safety: drops once, never accessed again due to mem::forget
3344        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3345        // Prevent Drop from running (which would shut down the channel)
3346        std::mem::forget(self);
3347    }
3348}
3349
3350impl CoordinatorGetLatestCommittedConfigStampResponder {
3351    /// Sends a response to the FIDL transaction.
3352    ///
3353    /// Sets the channel to shutdown if an error occurs.
3354    pub fn send(self, mut stamp: &ConfigStamp) -> Result<(), fidl::Error> {
3355        let _result = self.send_raw(stamp);
3356        if _result.is_err() {
3357            self.control_handle.shutdown();
3358        }
3359        self.drop_without_shutdown();
3360        _result
3361    }
3362
3363    /// Similar to "send" but does not shutdown the channel if an error occurs.
3364    pub fn send_no_shutdown_on_err(self, mut stamp: &ConfigStamp) -> Result<(), fidl::Error> {
3365        let _result = self.send_raw(stamp);
3366        self.drop_without_shutdown();
3367        _result
3368    }
3369
3370    fn send_raw(&self, mut stamp: &ConfigStamp) -> Result<(), fidl::Error> {
3371        self.control_handle.inner.send::<CoordinatorGetLatestCommittedConfigStampResponse>(
3372            (stamp,),
3373            self.tx_id,
3374            0x2a441f2c81af5d66,
3375            fidl::encoding::DynamicFlags::empty(),
3376        )
3377    }
3378}
3379
3380#[must_use = "FIDL methods require a response to be sent"]
3381#[derive(Debug)]
3382pub struct CoordinatorImportBufferCollectionResponder {
3383    control_handle: std::mem::ManuallyDrop<CoordinatorControlHandle>,
3384    tx_id: u32,
3385}
3386
3387/// Set the the channel to be shutdown (see [`CoordinatorControlHandle::shutdown`])
3388/// if the responder is dropped without sending a response, so that the client
3389/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3390impl std::ops::Drop for CoordinatorImportBufferCollectionResponder {
3391    fn drop(&mut self) {
3392        self.control_handle.shutdown();
3393        // Safety: drops once, never accessed again
3394        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3395    }
3396}
3397
3398impl fidl::endpoints::Responder for CoordinatorImportBufferCollectionResponder {
3399    type ControlHandle = CoordinatorControlHandle;
3400
3401    fn control_handle(&self) -> &CoordinatorControlHandle {
3402        &self.control_handle
3403    }
3404
3405    fn drop_without_shutdown(mut self) {
3406        // Safety: drops once, never accessed again due to mem::forget
3407        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3408        // Prevent Drop from running (which would shut down the channel)
3409        std::mem::forget(self);
3410    }
3411}
3412
3413impl CoordinatorImportBufferCollectionResponder {
3414    /// Sends a response to the FIDL transaction.
3415    ///
3416    /// Sets the channel to shutdown if an error occurs.
3417    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3418        let _result = self.send_raw(result);
3419        if _result.is_err() {
3420            self.control_handle.shutdown();
3421        }
3422        self.drop_without_shutdown();
3423        _result
3424    }
3425
3426    /// Similar to "send" but does not shutdown the channel if an error occurs.
3427    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3428        let _result = self.send_raw(result);
3429        self.drop_without_shutdown();
3430        _result
3431    }
3432
3433    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3434        self.control_handle
3435            .inner
3436            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
3437                result,
3438                self.tx_id,
3439                0x30d06f510e7f4601,
3440                fidl::encoding::DynamicFlags::empty(),
3441            )
3442    }
3443}
3444
3445#[must_use = "FIDL methods require a response to be sent"]
3446#[derive(Debug)]
3447pub struct CoordinatorSetBufferCollectionConstraintsResponder {
3448    control_handle: std::mem::ManuallyDrop<CoordinatorControlHandle>,
3449    tx_id: u32,
3450}
3451
3452/// Set the the channel to be shutdown (see [`CoordinatorControlHandle::shutdown`])
3453/// if the responder is dropped without sending a response, so that the client
3454/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3455impl std::ops::Drop for CoordinatorSetBufferCollectionConstraintsResponder {
3456    fn drop(&mut self) {
3457        self.control_handle.shutdown();
3458        // Safety: drops once, never accessed again
3459        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3460    }
3461}
3462
3463impl fidl::endpoints::Responder for CoordinatorSetBufferCollectionConstraintsResponder {
3464    type ControlHandle = CoordinatorControlHandle;
3465
3466    fn control_handle(&self) -> &CoordinatorControlHandle {
3467        &self.control_handle
3468    }
3469
3470    fn drop_without_shutdown(mut self) {
3471        // Safety: drops once, never accessed again due to mem::forget
3472        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3473        // Prevent Drop from running (which would shut down the channel)
3474        std::mem::forget(self);
3475    }
3476}
3477
3478impl CoordinatorSetBufferCollectionConstraintsResponder {
3479    /// Sends a response to the FIDL transaction.
3480    ///
3481    /// Sets the channel to shutdown if an error occurs.
3482    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3483        let _result = self.send_raw(result);
3484        if _result.is_err() {
3485            self.control_handle.shutdown();
3486        }
3487        self.drop_without_shutdown();
3488        _result
3489    }
3490
3491    /// Similar to "send" but does not shutdown the channel if an error occurs.
3492    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3493        let _result = self.send_raw(result);
3494        self.drop_without_shutdown();
3495        _result
3496    }
3497
3498    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3499        self.control_handle
3500            .inner
3501            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
3502                result,
3503                self.tx_id,
3504                0x509a4ee9af6035df,
3505                fidl::encoding::DynamicFlags::empty(),
3506            )
3507    }
3508}
3509
3510#[must_use = "FIDL methods require a response to be sent"]
3511#[derive(Debug)]
3512pub struct CoordinatorIsCaptureSupportedResponder {
3513    control_handle: std::mem::ManuallyDrop<CoordinatorControlHandle>,
3514    tx_id: u32,
3515}
3516
3517/// Set the the channel to be shutdown (see [`CoordinatorControlHandle::shutdown`])
3518/// if the responder is dropped without sending a response, so that the client
3519/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3520impl std::ops::Drop for CoordinatorIsCaptureSupportedResponder {
3521    fn drop(&mut self) {
3522        self.control_handle.shutdown();
3523        // Safety: drops once, never accessed again
3524        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3525    }
3526}
3527
3528impl fidl::endpoints::Responder for CoordinatorIsCaptureSupportedResponder {
3529    type ControlHandle = CoordinatorControlHandle;
3530
3531    fn control_handle(&self) -> &CoordinatorControlHandle {
3532        &self.control_handle
3533    }
3534
3535    fn drop_without_shutdown(mut self) {
3536        // Safety: drops once, never accessed again due to mem::forget
3537        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3538        // Prevent Drop from running (which would shut down the channel)
3539        std::mem::forget(self);
3540    }
3541}
3542
3543impl CoordinatorIsCaptureSupportedResponder {
3544    /// Sends a response to the FIDL transaction.
3545    ///
3546    /// Sets the channel to shutdown if an error occurs.
3547    pub fn send(self, mut result: Result<bool, i32>) -> Result<(), fidl::Error> {
3548        let _result = self.send_raw(result);
3549        if _result.is_err() {
3550            self.control_handle.shutdown();
3551        }
3552        self.drop_without_shutdown();
3553        _result
3554    }
3555
3556    /// Similar to "send" but does not shutdown the channel if an error occurs.
3557    pub fn send_no_shutdown_on_err(self, mut result: Result<bool, i32>) -> Result<(), fidl::Error> {
3558        let _result = self.send_raw(result);
3559        self.drop_without_shutdown();
3560        _result
3561    }
3562
3563    fn send_raw(&self, mut result: Result<bool, i32>) -> Result<(), fidl::Error> {
3564        self.control_handle.inner.send::<fidl::encoding::ResultType<
3565            CoordinatorIsCaptureSupportedResponse,
3566            i32,
3567        >>(
3568            result.map(|supported| (supported,)),
3569            self.tx_id,
3570            0x4ca407277277971b,
3571            fidl::encoding::DynamicFlags::empty(),
3572        )
3573    }
3574}
3575
3576#[must_use = "FIDL methods require a response to be sent"]
3577#[derive(Debug)]
3578pub struct CoordinatorStartCaptureResponder {
3579    control_handle: std::mem::ManuallyDrop<CoordinatorControlHandle>,
3580    tx_id: u32,
3581}
3582
3583/// Set the the channel to be shutdown (see [`CoordinatorControlHandle::shutdown`])
3584/// if the responder is dropped without sending a response, so that the client
3585/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3586impl std::ops::Drop for CoordinatorStartCaptureResponder {
3587    fn drop(&mut self) {
3588        self.control_handle.shutdown();
3589        // Safety: drops once, never accessed again
3590        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3591    }
3592}
3593
3594impl fidl::endpoints::Responder for CoordinatorStartCaptureResponder {
3595    type ControlHandle = CoordinatorControlHandle;
3596
3597    fn control_handle(&self) -> &CoordinatorControlHandle {
3598        &self.control_handle
3599    }
3600
3601    fn drop_without_shutdown(mut self) {
3602        // Safety: drops once, never accessed again due to mem::forget
3603        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3604        // Prevent Drop from running (which would shut down the channel)
3605        std::mem::forget(self);
3606    }
3607}
3608
3609impl CoordinatorStartCaptureResponder {
3610    /// Sends a response to the FIDL transaction.
3611    ///
3612    /// Sets the channel to shutdown if an error occurs.
3613    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3614        let _result = self.send_raw(result);
3615        if _result.is_err() {
3616            self.control_handle.shutdown();
3617        }
3618        self.drop_without_shutdown();
3619        _result
3620    }
3621
3622    /// Similar to "send" but does not shutdown the channel if an error occurs.
3623    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3624        let _result = self.send_raw(result);
3625        self.drop_without_shutdown();
3626        _result
3627    }
3628
3629    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3630        self.control_handle
3631            .inner
3632            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
3633                result,
3634                self.tx_id,
3635                0x35cb38f19d96a8db,
3636                fidl::encoding::DynamicFlags::empty(),
3637            )
3638    }
3639}
3640
3641#[must_use = "FIDL methods require a response to be sent"]
3642#[derive(Debug)]
3643pub struct CoordinatorSetMinimumRgbResponder {
3644    control_handle: std::mem::ManuallyDrop<CoordinatorControlHandle>,
3645    tx_id: u32,
3646}
3647
3648/// Set the the channel to be shutdown (see [`CoordinatorControlHandle::shutdown`])
3649/// if the responder is dropped without sending a response, so that the client
3650/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3651impl std::ops::Drop for CoordinatorSetMinimumRgbResponder {
3652    fn drop(&mut self) {
3653        self.control_handle.shutdown();
3654        // Safety: drops once, never accessed again
3655        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3656    }
3657}
3658
3659impl fidl::endpoints::Responder for CoordinatorSetMinimumRgbResponder {
3660    type ControlHandle = CoordinatorControlHandle;
3661
3662    fn control_handle(&self) -> &CoordinatorControlHandle {
3663        &self.control_handle
3664    }
3665
3666    fn drop_without_shutdown(mut self) {
3667        // Safety: drops once, never accessed again due to mem::forget
3668        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3669        // Prevent Drop from running (which would shut down the channel)
3670        std::mem::forget(self);
3671    }
3672}
3673
3674impl CoordinatorSetMinimumRgbResponder {
3675    /// Sends a response to the FIDL transaction.
3676    ///
3677    /// Sets the channel to shutdown if an error occurs.
3678    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3679        let _result = self.send_raw(result);
3680        if _result.is_err() {
3681            self.control_handle.shutdown();
3682        }
3683        self.drop_without_shutdown();
3684        _result
3685    }
3686
3687    /// Similar to "send" but does not shutdown the channel if an error occurs.
3688    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3689        let _result = self.send_raw(result);
3690        self.drop_without_shutdown();
3691        _result
3692    }
3693
3694    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3695        self.control_handle
3696            .inner
3697            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
3698                result,
3699                self.tx_id,
3700                0x1b49251437038b0b,
3701                fidl::encoding::DynamicFlags::empty(),
3702            )
3703    }
3704}
3705
3706#[must_use = "FIDL methods require a response to be sent"]
3707#[derive(Debug)]
3708pub struct CoordinatorSetDisplayPowerModeResponder {
3709    control_handle: std::mem::ManuallyDrop<CoordinatorControlHandle>,
3710    tx_id: u32,
3711}
3712
3713/// Set the the channel to be shutdown (see [`CoordinatorControlHandle::shutdown`])
3714/// if the responder is dropped without sending a response, so that the client
3715/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3716impl std::ops::Drop for CoordinatorSetDisplayPowerModeResponder {
3717    fn drop(&mut self) {
3718        self.control_handle.shutdown();
3719        // Safety: drops once, never accessed again
3720        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3721    }
3722}
3723
3724impl fidl::endpoints::Responder for CoordinatorSetDisplayPowerModeResponder {
3725    type ControlHandle = CoordinatorControlHandle;
3726
3727    fn control_handle(&self) -> &CoordinatorControlHandle {
3728        &self.control_handle
3729    }
3730
3731    fn drop_without_shutdown(mut self) {
3732        // Safety: drops once, never accessed again due to mem::forget
3733        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3734        // Prevent Drop from running (which would shut down the channel)
3735        std::mem::forget(self);
3736    }
3737}
3738
3739impl CoordinatorSetDisplayPowerModeResponder {
3740    /// Sends a response to the FIDL transaction.
3741    ///
3742    /// Sets the channel to shutdown if an error occurs.
3743    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3744        let _result = self.send_raw(result);
3745        if _result.is_err() {
3746            self.control_handle.shutdown();
3747        }
3748        self.drop_without_shutdown();
3749        _result
3750    }
3751
3752    /// Similar to "send" but does not shutdown the channel if an error occurs.
3753    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3754        let _result = self.send_raw(result);
3755        self.drop_without_shutdown();
3756        _result
3757    }
3758
3759    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3760        self.control_handle
3761            .inner
3762            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
3763                result,
3764                self.tx_id,
3765                0xf4672f055072c92,
3766                fidl::encoding::DynamicFlags::empty(),
3767            )
3768    }
3769}
3770
3771#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
3772pub struct CoordinatorListenerMarker;
3773
3774impl fidl::endpoints::ProtocolMarker for CoordinatorListenerMarker {
3775    type Proxy = CoordinatorListenerProxy;
3776    type RequestStream = CoordinatorListenerRequestStream;
3777    #[cfg(target_os = "fuchsia")]
3778    type SynchronousProxy = CoordinatorListenerSynchronousProxy;
3779
3780    const DEBUG_NAME: &'static str = "(anonymous) CoordinatorListener";
3781}
3782
3783pub trait CoordinatorListenerProxyInterface: Send + Sync {
3784    fn r#on_displays_changed(
3785        &self,
3786        added: &[Info],
3787        removed: &[fidl_fuchsia_hardware_display_types::DisplayId],
3788    ) -> Result<(), fidl::Error>;
3789    fn r#on_vsync(
3790        &self,
3791        display_id: &fidl_fuchsia_hardware_display_types::DisplayId,
3792        timestamp: fidl::MonotonicInstant,
3793        displayed_config_stamp: &ConfigStamp,
3794        cookie: &VsyncAckCookie,
3795    ) -> Result<(), fidl::Error>;
3796    fn r#on_client_ownership_change(&self, has_ownership: bool) -> Result<(), fidl::Error>;
3797}
3798#[derive(Debug)]
3799#[cfg(target_os = "fuchsia")]
3800pub struct CoordinatorListenerSynchronousProxy {
3801    client: fidl::client::sync::Client,
3802}
3803
3804#[cfg(target_os = "fuchsia")]
3805impl fidl::endpoints::SynchronousProxy for CoordinatorListenerSynchronousProxy {
3806    type Proxy = CoordinatorListenerProxy;
3807    type Protocol = CoordinatorListenerMarker;
3808
3809    fn from_channel(inner: fidl::Channel) -> Self {
3810        Self::new(inner)
3811    }
3812
3813    fn into_channel(self) -> fidl::Channel {
3814        self.client.into_channel()
3815    }
3816
3817    fn as_channel(&self) -> &fidl::Channel {
3818        self.client.as_channel()
3819    }
3820}
3821
3822#[cfg(target_os = "fuchsia")]
3823impl CoordinatorListenerSynchronousProxy {
3824    pub fn new(channel: fidl::Channel) -> Self {
3825        Self { client: fidl::client::sync::Client::new(channel) }
3826    }
3827
3828    pub fn into_channel(self) -> fidl::Channel {
3829        self.client.into_channel()
3830    }
3831
3832    /// Waits until an event arrives and returns it. It is safe for other
3833    /// threads to make concurrent requests while waiting for an event.
3834    pub fn wait_for_event(
3835        &self,
3836        deadline: zx::MonotonicInstant,
3837    ) -> Result<CoordinatorListenerEvent, fidl::Error> {
3838        CoordinatorListenerEvent::decode(
3839            self.client.wait_for_event::<CoordinatorListenerMarker>(deadline)?,
3840        )
3841    }
3842
3843    /// Called when the set of connected displays changes.
3844    ///
3845    /// Also used to communicate the set of connected displays to a newly
3846    /// connected client.
3847    ///
3848    /// After this method is called, all applied and draft configurations may no
3849    /// longer be valid. The client must validate and apply a new configuration,
3850    /// by calling [`Coordinator.CheckConfig`] and [`Coordinator.CommitConfig`].
3851    ///
3852    /// `added` and `removed` must not be both empty.
3853    pub fn r#on_displays_changed(
3854        &self,
3855        mut added: &[Info],
3856        mut removed: &[fidl_fuchsia_hardware_display_types::DisplayId],
3857    ) -> Result<(), fidl::Error> {
3858        self.client.send::<CoordinatorListenerOnDisplaysChangedRequest>(
3859            (added, removed),
3860            0x248fbe90c338a94f,
3861            fidl::encoding::DynamicFlags::empty(),
3862        )
3863    }
3864
3865    /// Called on every display Vertical Synchronization (Vsync).
3866    ///
3867    /// Clients must acknowledge VSync events via the method
3868    /// [`Coordinator.AcknowledgeVsync`].  The coordinator may throttle a client
3869    /// that accumulates a certain number of unacknowledged VSync cookies.
3870    /// Throttled clients do not receive VSync events.
3871    ///
3872    /// After a the client catches up on acknowledging cookies, the coordinator
3873    /// will unthrottle it (resume sending VSync events). Throttled clients may
3874    /// miss some VSync events, as the coordinator is allowed to drop VSync
3875    /// event information for throttled clients.
3876    ///
3877    /// When dropping VSync event information for throttled clients, the
3878    /// coordinator should prioritize retaining the information for newer
3879    /// events. In other words, the oldest unreported events should be dropped
3880    /// first.
3881    pub fn r#on_vsync(
3882        &self,
3883        mut display_id: &fidl_fuchsia_hardware_display_types::DisplayId,
3884        mut timestamp: fidl::MonotonicInstant,
3885        mut displayed_config_stamp: &ConfigStamp,
3886        mut cookie: &VsyncAckCookie,
3887    ) -> Result<(), fidl::Error> {
3888        self.client.send::<CoordinatorListenerOnVsyncRequest>(
3889            (display_id, timestamp, displayed_config_stamp, cookie),
3890            0x249e9b8da7a7ac47,
3891            fidl::encoding::DynamicFlags::empty(),
3892        )
3893    }
3894
3895    /// Called when the corresponding `Coordinator` client gains or loses
3896    /// ownership of the displays.
3897    ///
3898    /// A `Coordinator` client's displayed config is visible iff it holds the
3899    /// ownership of the displays.
3900    ///
3901    /// A new `Coordinator` client should assume they do not have ownership
3902    /// of the displays until this method informs them otherwise.
3903    pub fn r#on_client_ownership_change(&self, mut has_ownership: bool) -> Result<(), fidl::Error> {
3904        self.client.send::<CoordinatorListenerOnClientOwnershipChangeRequest>(
3905            (has_ownership,),
3906            0x1acd2ae683153d5e,
3907            fidl::encoding::DynamicFlags::empty(),
3908        )
3909    }
3910}
3911
3912#[cfg(target_os = "fuchsia")]
3913impl From<CoordinatorListenerSynchronousProxy> for zx::NullableHandle {
3914    fn from(value: CoordinatorListenerSynchronousProxy) -> Self {
3915        value.into_channel().into()
3916    }
3917}
3918
3919#[cfg(target_os = "fuchsia")]
3920impl From<fidl::Channel> for CoordinatorListenerSynchronousProxy {
3921    fn from(value: fidl::Channel) -> Self {
3922        Self::new(value)
3923    }
3924}
3925
3926#[cfg(target_os = "fuchsia")]
3927impl fidl::endpoints::FromClient for CoordinatorListenerSynchronousProxy {
3928    type Protocol = CoordinatorListenerMarker;
3929
3930    fn from_client(value: fidl::endpoints::ClientEnd<CoordinatorListenerMarker>) -> Self {
3931        Self::new(value.into_channel())
3932    }
3933}
3934
3935#[derive(Debug, Clone)]
3936pub struct CoordinatorListenerProxy {
3937    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
3938}
3939
3940impl fidl::endpoints::Proxy for CoordinatorListenerProxy {
3941    type Protocol = CoordinatorListenerMarker;
3942
3943    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
3944        Self::new(inner)
3945    }
3946
3947    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
3948        self.client.into_channel().map_err(|client| Self { client })
3949    }
3950
3951    fn as_channel(&self) -> &::fidl::AsyncChannel {
3952        self.client.as_channel()
3953    }
3954}
3955
3956impl CoordinatorListenerProxy {
3957    /// Create a new Proxy for fuchsia.hardware.display/CoordinatorListener.
3958    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
3959        let protocol_name =
3960            <CoordinatorListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3961        Self { client: fidl::client::Client::new(channel, protocol_name) }
3962    }
3963
3964    /// Get a Stream of events from the remote end of the protocol.
3965    ///
3966    /// # Panics
3967    ///
3968    /// Panics if the event stream was already taken.
3969    pub fn take_event_stream(&self) -> CoordinatorListenerEventStream {
3970        CoordinatorListenerEventStream { event_receiver: self.client.take_event_receiver() }
3971    }
3972
3973    /// Called when the set of connected displays changes.
3974    ///
3975    /// Also used to communicate the set of connected displays to a newly
3976    /// connected client.
3977    ///
3978    /// After this method is called, all applied and draft configurations may no
3979    /// longer be valid. The client must validate and apply a new configuration,
3980    /// by calling [`Coordinator.CheckConfig`] and [`Coordinator.CommitConfig`].
3981    ///
3982    /// `added` and `removed` must not be both empty.
3983    pub fn r#on_displays_changed(
3984        &self,
3985        mut added: &[Info],
3986        mut removed: &[fidl_fuchsia_hardware_display_types::DisplayId],
3987    ) -> Result<(), fidl::Error> {
3988        CoordinatorListenerProxyInterface::r#on_displays_changed(self, added, removed)
3989    }
3990
3991    /// Called on every display Vertical Synchronization (Vsync).
3992    ///
3993    /// Clients must acknowledge VSync events via the method
3994    /// [`Coordinator.AcknowledgeVsync`].  The coordinator may throttle a client
3995    /// that accumulates a certain number of unacknowledged VSync cookies.
3996    /// Throttled clients do not receive VSync events.
3997    ///
3998    /// After a the client catches up on acknowledging cookies, the coordinator
3999    /// will unthrottle it (resume sending VSync events). Throttled clients may
4000    /// miss some VSync events, as the coordinator is allowed to drop VSync
4001    /// event information for throttled clients.
4002    ///
4003    /// When dropping VSync event information for throttled clients, the
4004    /// coordinator should prioritize retaining the information for newer
4005    /// events. In other words, the oldest unreported events should be dropped
4006    /// first.
4007    pub fn r#on_vsync(
4008        &self,
4009        mut display_id: &fidl_fuchsia_hardware_display_types::DisplayId,
4010        mut timestamp: fidl::MonotonicInstant,
4011        mut displayed_config_stamp: &ConfigStamp,
4012        mut cookie: &VsyncAckCookie,
4013    ) -> Result<(), fidl::Error> {
4014        CoordinatorListenerProxyInterface::r#on_vsync(
4015            self,
4016            display_id,
4017            timestamp,
4018            displayed_config_stamp,
4019            cookie,
4020        )
4021    }
4022
4023    /// Called when the corresponding `Coordinator` client gains or loses
4024    /// ownership of the displays.
4025    ///
4026    /// A `Coordinator` client's displayed config is visible iff it holds the
4027    /// ownership of the displays.
4028    ///
4029    /// A new `Coordinator` client should assume they do not have ownership
4030    /// of the displays until this method informs them otherwise.
4031    pub fn r#on_client_ownership_change(&self, mut has_ownership: bool) -> Result<(), fidl::Error> {
4032        CoordinatorListenerProxyInterface::r#on_client_ownership_change(self, has_ownership)
4033    }
4034}
4035
4036impl CoordinatorListenerProxyInterface for CoordinatorListenerProxy {
4037    fn r#on_displays_changed(
4038        &self,
4039        mut added: &[Info],
4040        mut removed: &[fidl_fuchsia_hardware_display_types::DisplayId],
4041    ) -> Result<(), fidl::Error> {
4042        self.client.send::<CoordinatorListenerOnDisplaysChangedRequest>(
4043            (added, removed),
4044            0x248fbe90c338a94f,
4045            fidl::encoding::DynamicFlags::empty(),
4046        )
4047    }
4048
4049    fn r#on_vsync(
4050        &self,
4051        mut display_id: &fidl_fuchsia_hardware_display_types::DisplayId,
4052        mut timestamp: fidl::MonotonicInstant,
4053        mut displayed_config_stamp: &ConfigStamp,
4054        mut cookie: &VsyncAckCookie,
4055    ) -> Result<(), fidl::Error> {
4056        self.client.send::<CoordinatorListenerOnVsyncRequest>(
4057            (display_id, timestamp, displayed_config_stamp, cookie),
4058            0x249e9b8da7a7ac47,
4059            fidl::encoding::DynamicFlags::empty(),
4060        )
4061    }
4062
4063    fn r#on_client_ownership_change(&self, mut has_ownership: bool) -> Result<(), fidl::Error> {
4064        self.client.send::<CoordinatorListenerOnClientOwnershipChangeRequest>(
4065            (has_ownership,),
4066            0x1acd2ae683153d5e,
4067            fidl::encoding::DynamicFlags::empty(),
4068        )
4069    }
4070}
4071
4072pub struct CoordinatorListenerEventStream {
4073    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
4074}
4075
4076impl std::marker::Unpin for CoordinatorListenerEventStream {}
4077
4078impl futures::stream::FusedStream for CoordinatorListenerEventStream {
4079    fn is_terminated(&self) -> bool {
4080        self.event_receiver.is_terminated()
4081    }
4082}
4083
4084impl futures::Stream for CoordinatorListenerEventStream {
4085    type Item = Result<CoordinatorListenerEvent, fidl::Error>;
4086
4087    fn poll_next(
4088        mut self: std::pin::Pin<&mut Self>,
4089        cx: &mut std::task::Context<'_>,
4090    ) -> std::task::Poll<Option<Self::Item>> {
4091        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
4092            &mut self.event_receiver,
4093            cx
4094        )?) {
4095            Some(buf) => std::task::Poll::Ready(Some(CoordinatorListenerEvent::decode(buf))),
4096            None => std::task::Poll::Ready(None),
4097        }
4098    }
4099}
4100
4101#[derive(Debug)]
4102pub enum CoordinatorListenerEvent {
4103    #[non_exhaustive]
4104    _UnknownEvent {
4105        /// Ordinal of the event that was sent.
4106        ordinal: u64,
4107    },
4108}
4109
4110impl CoordinatorListenerEvent {
4111    /// Decodes a message buffer as a [`CoordinatorListenerEvent`].
4112    fn decode(
4113        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
4114    ) -> Result<CoordinatorListenerEvent, fidl::Error> {
4115        let (bytes, _handles) = buf.split_mut();
4116        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4117        debug_assert_eq!(tx_header.tx_id, 0);
4118        match tx_header.ordinal {
4119            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
4120                Ok(CoordinatorListenerEvent::_UnknownEvent { ordinal: tx_header.ordinal })
4121            }
4122            _ => Err(fidl::Error::UnknownOrdinal {
4123                ordinal: tx_header.ordinal,
4124                protocol_name:
4125                    <CoordinatorListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4126            }),
4127        }
4128    }
4129}
4130
4131/// A Stream of incoming requests for fuchsia.hardware.display/CoordinatorListener.
4132pub struct CoordinatorListenerRequestStream {
4133    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4134    is_terminated: bool,
4135}
4136
4137impl std::marker::Unpin for CoordinatorListenerRequestStream {}
4138
4139impl futures::stream::FusedStream for CoordinatorListenerRequestStream {
4140    fn is_terminated(&self) -> bool {
4141        self.is_terminated
4142    }
4143}
4144
4145impl fidl::endpoints::RequestStream for CoordinatorListenerRequestStream {
4146    type Protocol = CoordinatorListenerMarker;
4147    type ControlHandle = CoordinatorListenerControlHandle;
4148
4149    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
4150        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
4151    }
4152
4153    fn control_handle(&self) -> Self::ControlHandle {
4154        CoordinatorListenerControlHandle { inner: self.inner.clone() }
4155    }
4156
4157    fn into_inner(
4158        self,
4159    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
4160    {
4161        (self.inner, self.is_terminated)
4162    }
4163
4164    fn from_inner(
4165        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4166        is_terminated: bool,
4167    ) -> Self {
4168        Self { inner, is_terminated }
4169    }
4170}
4171
4172impl futures::Stream for CoordinatorListenerRequestStream {
4173    type Item = Result<CoordinatorListenerRequest, fidl::Error>;
4174
4175    fn poll_next(
4176        mut self: std::pin::Pin<&mut Self>,
4177        cx: &mut std::task::Context<'_>,
4178    ) -> std::task::Poll<Option<Self::Item>> {
4179        let this = &mut *self;
4180        if this.inner.check_shutdown(cx) {
4181            this.is_terminated = true;
4182            return std::task::Poll::Ready(None);
4183        }
4184        if this.is_terminated {
4185            panic!("polled CoordinatorListenerRequestStream after completion");
4186        }
4187        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
4188            |bytes, handles| {
4189                match this.inner.channel().read_etc(cx, bytes, handles) {
4190                    std::task::Poll::Ready(Ok(())) => {}
4191                    std::task::Poll::Pending => return std::task::Poll::Pending,
4192                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
4193                        this.is_terminated = true;
4194                        return std::task::Poll::Ready(None);
4195                    }
4196                    std::task::Poll::Ready(Err(e)) => {
4197                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
4198                            e.into(),
4199                        ))));
4200                    }
4201                }
4202
4203                // A message has been received from the channel
4204                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4205
4206                std::task::Poll::Ready(Some(match header.ordinal {
4207                0x248fbe90c338a94f => {
4208                    header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4209                    let mut req = fidl::new_empty!(CoordinatorListenerOnDisplaysChangedRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
4210                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CoordinatorListenerOnDisplaysChangedRequest>(&header, _body_bytes, handles, &mut req)?;
4211                    let control_handle = CoordinatorListenerControlHandle {
4212                        inner: this.inner.clone(),
4213                    };
4214                    Ok(CoordinatorListenerRequest::OnDisplaysChanged {added: req.added,
4215removed: req.removed,
4216
4217                        control_handle,
4218                    })
4219                }
4220                0x249e9b8da7a7ac47 => {
4221                    header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4222                    let mut req = fidl::new_empty!(CoordinatorListenerOnVsyncRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
4223                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CoordinatorListenerOnVsyncRequest>(&header, _body_bytes, handles, &mut req)?;
4224                    let control_handle = CoordinatorListenerControlHandle {
4225                        inner: this.inner.clone(),
4226                    };
4227                    Ok(CoordinatorListenerRequest::OnVsync {display_id: req.display_id,
4228timestamp: req.timestamp,
4229displayed_config_stamp: req.displayed_config_stamp,
4230cookie: req.cookie,
4231
4232                        control_handle,
4233                    })
4234                }
4235                0x1acd2ae683153d5e => {
4236                    header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4237                    let mut req = fidl::new_empty!(CoordinatorListenerOnClientOwnershipChangeRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
4238                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CoordinatorListenerOnClientOwnershipChangeRequest>(&header, _body_bytes, handles, &mut req)?;
4239                    let control_handle = CoordinatorListenerControlHandle {
4240                        inner: this.inner.clone(),
4241                    };
4242                    Ok(CoordinatorListenerRequest::OnClientOwnershipChange {has_ownership: req.has_ownership,
4243
4244                        control_handle,
4245                    })
4246                }
4247                _ if header.tx_id == 0 && header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
4248                    Ok(CoordinatorListenerRequest::_UnknownMethod {
4249                        ordinal: header.ordinal,
4250                        control_handle: CoordinatorListenerControlHandle { inner: this.inner.clone() },
4251                        method_type: fidl::MethodType::OneWay,
4252                    })
4253                }
4254                _ if header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
4255                    this.inner.send_framework_err(
4256                        fidl::encoding::FrameworkErr::UnknownMethod,
4257                        header.tx_id,
4258                        header.ordinal,
4259                        header.dynamic_flags(),
4260                        (bytes, handles),
4261                    )?;
4262                    Ok(CoordinatorListenerRequest::_UnknownMethod {
4263                        ordinal: header.ordinal,
4264                        control_handle: CoordinatorListenerControlHandle { inner: this.inner.clone() },
4265                        method_type: fidl::MethodType::TwoWay,
4266                    })
4267                }
4268                _ => Err(fidl::Error::UnknownOrdinal {
4269                    ordinal: header.ordinal,
4270                    protocol_name: <CoordinatorListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4271                }),
4272            }))
4273            },
4274        )
4275    }
4276}
4277
4278/// Provides updates from a `Coordinator` to one of its clients.
4279///
4280/// This protocol solely consists of one-way methods.
4281#[derive(Debug)]
4282pub enum CoordinatorListenerRequest {
4283    /// Called when the set of connected displays changes.
4284    ///
4285    /// Also used to communicate the set of connected displays to a newly
4286    /// connected client.
4287    ///
4288    /// After this method is called, all applied and draft configurations may no
4289    /// longer be valid. The client must validate and apply a new configuration,
4290    /// by calling [`Coordinator.CheckConfig`] and [`Coordinator.CommitConfig`].
4291    ///
4292    /// `added` and `removed` must not be both empty.
4293    OnDisplaysChanged {
4294        added: Vec<Info>,
4295        removed: Vec<fidl_fuchsia_hardware_display_types::DisplayId>,
4296        control_handle: CoordinatorListenerControlHandle,
4297    },
4298    /// Called on every display Vertical Synchronization (Vsync).
4299    ///
4300    /// Clients must acknowledge VSync events via the method
4301    /// [`Coordinator.AcknowledgeVsync`].  The coordinator may throttle a client
4302    /// that accumulates a certain number of unacknowledged VSync cookies.
4303    /// Throttled clients do not receive VSync events.
4304    ///
4305    /// After a the client catches up on acknowledging cookies, the coordinator
4306    /// will unthrottle it (resume sending VSync events). Throttled clients may
4307    /// miss some VSync events, as the coordinator is allowed to drop VSync
4308    /// event information for throttled clients.
4309    ///
4310    /// When dropping VSync event information for throttled clients, the
4311    /// coordinator should prioritize retaining the information for newer
4312    /// events. In other words, the oldest unreported events should be dropped
4313    /// first.
4314    OnVsync {
4315        display_id: fidl_fuchsia_hardware_display_types::DisplayId,
4316        timestamp: fidl::MonotonicInstant,
4317        displayed_config_stamp: ConfigStamp,
4318        cookie: VsyncAckCookie,
4319        control_handle: CoordinatorListenerControlHandle,
4320    },
4321    /// Called when the corresponding `Coordinator` client gains or loses
4322    /// ownership of the displays.
4323    ///
4324    /// A `Coordinator` client's displayed config is visible iff it holds the
4325    /// ownership of the displays.
4326    ///
4327    /// A new `Coordinator` client should assume they do not have ownership
4328    /// of the displays until this method informs them otherwise.
4329    OnClientOwnershipChange {
4330        has_ownership: bool,
4331        control_handle: CoordinatorListenerControlHandle,
4332    },
4333    /// An interaction was received which does not match any known method.
4334    #[non_exhaustive]
4335    _UnknownMethod {
4336        /// Ordinal of the method that was called.
4337        ordinal: u64,
4338        control_handle: CoordinatorListenerControlHandle,
4339        method_type: fidl::MethodType,
4340    },
4341}
4342
4343impl CoordinatorListenerRequest {
4344    #[allow(irrefutable_let_patterns)]
4345    pub fn into_on_displays_changed(
4346        self,
4347    ) -> Option<(
4348        Vec<Info>,
4349        Vec<fidl_fuchsia_hardware_display_types::DisplayId>,
4350        CoordinatorListenerControlHandle,
4351    )> {
4352        if let CoordinatorListenerRequest::OnDisplaysChanged { added, removed, control_handle } =
4353            self
4354        {
4355            Some((added, removed, control_handle))
4356        } else {
4357            None
4358        }
4359    }
4360
4361    #[allow(irrefutable_let_patterns)]
4362    pub fn into_on_vsync(
4363        self,
4364    ) -> Option<(
4365        fidl_fuchsia_hardware_display_types::DisplayId,
4366        fidl::MonotonicInstant,
4367        ConfigStamp,
4368        VsyncAckCookie,
4369        CoordinatorListenerControlHandle,
4370    )> {
4371        if let CoordinatorListenerRequest::OnVsync {
4372            display_id,
4373            timestamp,
4374            displayed_config_stamp,
4375            cookie,
4376            control_handle,
4377        } = self
4378        {
4379            Some((display_id, timestamp, displayed_config_stamp, cookie, control_handle))
4380        } else {
4381            None
4382        }
4383    }
4384
4385    #[allow(irrefutable_let_patterns)]
4386    pub fn into_on_client_ownership_change(
4387        self,
4388    ) -> Option<(bool, CoordinatorListenerControlHandle)> {
4389        if let CoordinatorListenerRequest::OnClientOwnershipChange {
4390            has_ownership,
4391            control_handle,
4392        } = self
4393        {
4394            Some((has_ownership, control_handle))
4395        } else {
4396            None
4397        }
4398    }
4399
4400    /// Name of the method defined in FIDL
4401    pub fn method_name(&self) -> &'static str {
4402        match *self {
4403            CoordinatorListenerRequest::OnDisplaysChanged { .. } => "on_displays_changed",
4404            CoordinatorListenerRequest::OnVsync { .. } => "on_vsync",
4405            CoordinatorListenerRequest::OnClientOwnershipChange { .. } => {
4406                "on_client_ownership_change"
4407            }
4408            CoordinatorListenerRequest::_UnknownMethod {
4409                method_type: fidl::MethodType::OneWay,
4410                ..
4411            } => "unknown one-way method",
4412            CoordinatorListenerRequest::_UnknownMethod {
4413                method_type: fidl::MethodType::TwoWay,
4414                ..
4415            } => "unknown two-way method",
4416        }
4417    }
4418}
4419
4420#[derive(Debug, Clone)]
4421pub struct CoordinatorListenerControlHandle {
4422    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4423}
4424
4425impl CoordinatorListenerControlHandle {
4426    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
4427        self.inner.shutdown_with_epitaph(status.into())
4428    }
4429}
4430
4431impl fidl::endpoints::ControlHandle for CoordinatorListenerControlHandle {
4432    fn shutdown(&self) {
4433        self.inner.shutdown()
4434    }
4435
4436    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
4437        self.inner.shutdown_with_epitaph(status)
4438    }
4439
4440    fn is_closed(&self) -> bool {
4441        self.inner.channel().is_closed()
4442    }
4443    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
4444        self.inner.channel().on_closed()
4445    }
4446
4447    #[cfg(target_os = "fuchsia")]
4448    fn signal_peer(
4449        &self,
4450        clear_mask: zx::Signals,
4451        set_mask: zx::Signals,
4452    ) -> Result<(), zx_status::Status> {
4453        use fidl::Peered;
4454        self.inner.channel().signal_peer(clear_mask, set_mask)
4455    }
4456}
4457
4458impl CoordinatorListenerControlHandle {}
4459
4460#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
4461pub struct ProviderMarker;
4462
4463impl fidl::endpoints::ProtocolMarker for ProviderMarker {
4464    type Proxy = ProviderProxy;
4465    type RequestStream = ProviderRequestStream;
4466    #[cfg(target_os = "fuchsia")]
4467    type SynchronousProxy = ProviderSynchronousProxy;
4468
4469    const DEBUG_NAME: &'static str = "fuchsia.hardware.display.Provider";
4470}
4471impl fidl::endpoints::DiscoverableProtocolMarker for ProviderMarker {}
4472pub type ProviderOpenCoordinatorResult = Result<(), i32>;
4473
4474pub trait ProviderProxyInterface: Send + Sync {
4475    type OpenCoordinatorResponseFut: std::future::Future<Output = Result<ProviderOpenCoordinatorResult, fidl::Error>>
4476        + Send;
4477    fn r#open_coordinator(
4478        &self,
4479        payload: ProviderOpenCoordinatorRequest,
4480    ) -> Self::OpenCoordinatorResponseFut;
4481}
4482#[derive(Debug)]
4483#[cfg(target_os = "fuchsia")]
4484pub struct ProviderSynchronousProxy {
4485    client: fidl::client::sync::Client,
4486}
4487
4488#[cfg(target_os = "fuchsia")]
4489impl fidl::endpoints::SynchronousProxy for ProviderSynchronousProxy {
4490    type Proxy = ProviderProxy;
4491    type Protocol = ProviderMarker;
4492
4493    fn from_channel(inner: fidl::Channel) -> Self {
4494        Self::new(inner)
4495    }
4496
4497    fn into_channel(self) -> fidl::Channel {
4498        self.client.into_channel()
4499    }
4500
4501    fn as_channel(&self) -> &fidl::Channel {
4502        self.client.as_channel()
4503    }
4504}
4505
4506#[cfg(target_os = "fuchsia")]
4507impl ProviderSynchronousProxy {
4508    pub fn new(channel: fidl::Channel) -> Self {
4509        Self { client: fidl::client::sync::Client::new(channel) }
4510    }
4511
4512    pub fn into_channel(self) -> fidl::Channel {
4513        self.client.into_channel()
4514    }
4515
4516    /// Waits until an event arrives and returns it. It is safe for other
4517    /// threads to make concurrent requests while waiting for an event.
4518    pub fn wait_for_event(
4519        &self,
4520        deadline: zx::MonotonicInstant,
4521    ) -> Result<ProviderEvent, fidl::Error> {
4522        ProviderEvent::decode(self.client.wait_for_event::<ProviderMarker>(deadline)?)
4523    }
4524
4525    /// Opens a client connection to the Display Coordinator.
4526    ///
4527    /// On success, `coordinator` will be bound to the Display Coordinator
4528    /// at the requested priority level, and `coordinator_listener` will receive
4529    /// notifications for the newly bound client.
4530    ///
4531    /// Fails with `ZX_ERR_ALREADY_BOUND` if the Display Coordinator already has
4532    /// a connected client at the given priority level.
4533    ///
4534    /// Fails with `ZX_ERR_INVALID_ARGS` if one of the required fields is missing.
4535    pub fn r#open_coordinator(
4536        &self,
4537        mut payload: ProviderOpenCoordinatorRequest,
4538        ___deadline: zx::MonotonicInstant,
4539    ) -> Result<ProviderOpenCoordinatorResult, fidl::Error> {
4540        let _response = self.client.send_query::<
4541            ProviderOpenCoordinatorRequest,
4542            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
4543            ProviderMarker,
4544        >(
4545            &mut payload,
4546            0x1bd6070372d03df0,
4547            fidl::encoding::DynamicFlags::empty(),
4548            ___deadline,
4549        )?;
4550        Ok(_response.map(|x| x))
4551    }
4552}
4553
4554#[cfg(target_os = "fuchsia")]
4555impl From<ProviderSynchronousProxy> for zx::NullableHandle {
4556    fn from(value: ProviderSynchronousProxy) -> Self {
4557        value.into_channel().into()
4558    }
4559}
4560
4561#[cfg(target_os = "fuchsia")]
4562impl From<fidl::Channel> for ProviderSynchronousProxy {
4563    fn from(value: fidl::Channel) -> Self {
4564        Self::new(value)
4565    }
4566}
4567
4568#[cfg(target_os = "fuchsia")]
4569impl fidl::endpoints::FromClient for ProviderSynchronousProxy {
4570    type Protocol = ProviderMarker;
4571
4572    fn from_client(value: fidl::endpoints::ClientEnd<ProviderMarker>) -> Self {
4573        Self::new(value.into_channel())
4574    }
4575}
4576
4577#[derive(Debug, Clone)]
4578pub struct ProviderProxy {
4579    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
4580}
4581
4582impl fidl::endpoints::Proxy for ProviderProxy {
4583    type Protocol = ProviderMarker;
4584
4585    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
4586        Self::new(inner)
4587    }
4588
4589    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
4590        self.client.into_channel().map_err(|client| Self { client })
4591    }
4592
4593    fn as_channel(&self) -> &::fidl::AsyncChannel {
4594        self.client.as_channel()
4595    }
4596}
4597
4598impl ProviderProxy {
4599    /// Create a new Proxy for fuchsia.hardware.display/Provider.
4600    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
4601        let protocol_name = <ProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4602        Self { client: fidl::client::Client::new(channel, protocol_name) }
4603    }
4604
4605    /// Get a Stream of events from the remote end of the protocol.
4606    ///
4607    /// # Panics
4608    ///
4609    /// Panics if the event stream was already taken.
4610    pub fn take_event_stream(&self) -> ProviderEventStream {
4611        ProviderEventStream { event_receiver: self.client.take_event_receiver() }
4612    }
4613
4614    /// Opens a client connection to the Display Coordinator.
4615    ///
4616    /// On success, `coordinator` will be bound to the Display Coordinator
4617    /// at the requested priority level, and `coordinator_listener` will receive
4618    /// notifications for the newly bound client.
4619    ///
4620    /// Fails with `ZX_ERR_ALREADY_BOUND` if the Display Coordinator already has
4621    /// a connected client at the given priority level.
4622    ///
4623    /// Fails with `ZX_ERR_INVALID_ARGS` if one of the required fields is missing.
4624    pub fn r#open_coordinator(
4625        &self,
4626        mut payload: ProviderOpenCoordinatorRequest,
4627    ) -> fidl::client::QueryResponseFut<
4628        ProviderOpenCoordinatorResult,
4629        fidl::encoding::DefaultFuchsiaResourceDialect,
4630    > {
4631        ProviderProxyInterface::r#open_coordinator(self, payload)
4632    }
4633}
4634
4635impl ProviderProxyInterface for ProviderProxy {
4636    type OpenCoordinatorResponseFut = fidl::client::QueryResponseFut<
4637        ProviderOpenCoordinatorResult,
4638        fidl::encoding::DefaultFuchsiaResourceDialect,
4639    >;
4640    fn r#open_coordinator(
4641        &self,
4642        mut payload: ProviderOpenCoordinatorRequest,
4643    ) -> Self::OpenCoordinatorResponseFut {
4644        fn _decode(
4645            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4646        ) -> Result<ProviderOpenCoordinatorResult, fidl::Error> {
4647            let _response = fidl::client::decode_transaction_body::<
4648                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
4649                fidl::encoding::DefaultFuchsiaResourceDialect,
4650                0x1bd6070372d03df0,
4651            >(_buf?)?;
4652            Ok(_response.map(|x| x))
4653        }
4654        self.client
4655            .send_query_and_decode::<ProviderOpenCoordinatorRequest, ProviderOpenCoordinatorResult>(
4656                &mut payload,
4657                0x1bd6070372d03df0,
4658                fidl::encoding::DynamicFlags::empty(),
4659                _decode,
4660            )
4661    }
4662}
4663
4664pub struct ProviderEventStream {
4665    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
4666}
4667
4668impl std::marker::Unpin for ProviderEventStream {}
4669
4670impl futures::stream::FusedStream for ProviderEventStream {
4671    fn is_terminated(&self) -> bool {
4672        self.event_receiver.is_terminated()
4673    }
4674}
4675
4676impl futures::Stream for ProviderEventStream {
4677    type Item = Result<ProviderEvent, fidl::Error>;
4678
4679    fn poll_next(
4680        mut self: std::pin::Pin<&mut Self>,
4681        cx: &mut std::task::Context<'_>,
4682    ) -> std::task::Poll<Option<Self::Item>> {
4683        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
4684            &mut self.event_receiver,
4685            cx
4686        )?) {
4687            Some(buf) => std::task::Poll::Ready(Some(ProviderEvent::decode(buf))),
4688            None => std::task::Poll::Ready(None),
4689        }
4690    }
4691}
4692
4693#[derive(Debug)]
4694pub enum ProviderEvent {}
4695
4696impl ProviderEvent {
4697    /// Decodes a message buffer as a [`ProviderEvent`].
4698    fn decode(
4699        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
4700    ) -> Result<ProviderEvent, fidl::Error> {
4701        let (bytes, _handles) = buf.split_mut();
4702        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4703        debug_assert_eq!(tx_header.tx_id, 0);
4704        match tx_header.ordinal {
4705            _ => Err(fidl::Error::UnknownOrdinal {
4706                ordinal: tx_header.ordinal,
4707                protocol_name: <ProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4708            }),
4709        }
4710    }
4711}
4712
4713/// A Stream of incoming requests for fuchsia.hardware.display/Provider.
4714pub struct ProviderRequestStream {
4715    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4716    is_terminated: bool,
4717}
4718
4719impl std::marker::Unpin for ProviderRequestStream {}
4720
4721impl futures::stream::FusedStream for ProviderRequestStream {
4722    fn is_terminated(&self) -> bool {
4723        self.is_terminated
4724    }
4725}
4726
4727impl fidl::endpoints::RequestStream for ProviderRequestStream {
4728    type Protocol = ProviderMarker;
4729    type ControlHandle = ProviderControlHandle;
4730
4731    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
4732        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
4733    }
4734
4735    fn control_handle(&self) -> Self::ControlHandle {
4736        ProviderControlHandle { inner: self.inner.clone() }
4737    }
4738
4739    fn into_inner(
4740        self,
4741    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
4742    {
4743        (self.inner, self.is_terminated)
4744    }
4745
4746    fn from_inner(
4747        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4748        is_terminated: bool,
4749    ) -> Self {
4750        Self { inner, is_terminated }
4751    }
4752}
4753
4754impl futures::Stream for ProviderRequestStream {
4755    type Item = Result<ProviderRequest, fidl::Error>;
4756
4757    fn poll_next(
4758        mut self: std::pin::Pin<&mut Self>,
4759        cx: &mut std::task::Context<'_>,
4760    ) -> std::task::Poll<Option<Self::Item>> {
4761        let this = &mut *self;
4762        if this.inner.check_shutdown(cx) {
4763            this.is_terminated = true;
4764            return std::task::Poll::Ready(None);
4765        }
4766        if this.is_terminated {
4767            panic!("polled ProviderRequestStream after completion");
4768        }
4769        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
4770            |bytes, handles| {
4771                match this.inner.channel().read_etc(cx, bytes, handles) {
4772                    std::task::Poll::Ready(Ok(())) => {}
4773                    std::task::Poll::Pending => return std::task::Poll::Pending,
4774                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
4775                        this.is_terminated = true;
4776                        return std::task::Poll::Ready(None);
4777                    }
4778                    std::task::Poll::Ready(Err(e)) => {
4779                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
4780                            e.into(),
4781                        ))));
4782                    }
4783                }
4784
4785                // A message has been received from the channel
4786                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4787
4788                std::task::Poll::Ready(Some(match header.ordinal {
4789                    0x1bd6070372d03df0 => {
4790                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4791                        let mut req = fidl::new_empty!(
4792                            ProviderOpenCoordinatorRequest,
4793                            fidl::encoding::DefaultFuchsiaResourceDialect
4794                        );
4795                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ProviderOpenCoordinatorRequest>(&header, _body_bytes, handles, &mut req)?;
4796                        let control_handle = ProviderControlHandle { inner: this.inner.clone() };
4797                        Ok(ProviderRequest::OpenCoordinator {
4798                            payload: req,
4799                            responder: ProviderOpenCoordinatorResponder {
4800                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4801                                tx_id: header.tx_id,
4802                            },
4803                        })
4804                    }
4805                    _ => Err(fidl::Error::UnknownOrdinal {
4806                        ordinal: header.ordinal,
4807                        protocol_name:
4808                            <ProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4809                    }),
4810                }))
4811            },
4812        )
4813    }
4814}
4815
4816/// Provider for display coordinators.
4817///
4818/// The driver supports two simultaneous clients - a main client and a virtcon
4819/// client.  In some cases, the provider service may provide access to only one or
4820/// the other; if the client tries to open the other then `ZX_ERR_NOT_SUPPORTED` will
4821/// be returned.
4822#[derive(Debug)]
4823pub enum ProviderRequest {
4824    /// Opens a client connection to the Display Coordinator.
4825    ///
4826    /// On success, `coordinator` will be bound to the Display Coordinator
4827    /// at the requested priority level, and `coordinator_listener` will receive
4828    /// notifications for the newly bound client.
4829    ///
4830    /// Fails with `ZX_ERR_ALREADY_BOUND` if the Display Coordinator already has
4831    /// a connected client at the given priority level.
4832    ///
4833    /// Fails with `ZX_ERR_INVALID_ARGS` if one of the required fields is missing.
4834    OpenCoordinator {
4835        payload: ProviderOpenCoordinatorRequest,
4836        responder: ProviderOpenCoordinatorResponder,
4837    },
4838}
4839
4840impl ProviderRequest {
4841    #[allow(irrefutable_let_patterns)]
4842    pub fn into_open_coordinator(
4843        self,
4844    ) -> Option<(ProviderOpenCoordinatorRequest, ProviderOpenCoordinatorResponder)> {
4845        if let ProviderRequest::OpenCoordinator { payload, responder } = self {
4846            Some((payload, responder))
4847        } else {
4848            None
4849        }
4850    }
4851
4852    /// Name of the method defined in FIDL
4853    pub fn method_name(&self) -> &'static str {
4854        match *self {
4855            ProviderRequest::OpenCoordinator { .. } => "open_coordinator",
4856        }
4857    }
4858}
4859
4860#[derive(Debug, Clone)]
4861pub struct ProviderControlHandle {
4862    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4863}
4864
4865impl ProviderControlHandle {
4866    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
4867        self.inner.shutdown_with_epitaph(status.into())
4868    }
4869}
4870
4871impl fidl::endpoints::ControlHandle for ProviderControlHandle {
4872    fn shutdown(&self) {
4873        self.inner.shutdown()
4874    }
4875
4876    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
4877        self.inner.shutdown_with_epitaph(status)
4878    }
4879
4880    fn is_closed(&self) -> bool {
4881        self.inner.channel().is_closed()
4882    }
4883    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
4884        self.inner.channel().on_closed()
4885    }
4886
4887    #[cfg(target_os = "fuchsia")]
4888    fn signal_peer(
4889        &self,
4890        clear_mask: zx::Signals,
4891        set_mask: zx::Signals,
4892    ) -> Result<(), zx_status::Status> {
4893        use fidl::Peered;
4894        self.inner.channel().signal_peer(clear_mask, set_mask)
4895    }
4896}
4897
4898impl ProviderControlHandle {}
4899
4900#[must_use = "FIDL methods require a response to be sent"]
4901#[derive(Debug)]
4902pub struct ProviderOpenCoordinatorResponder {
4903    control_handle: std::mem::ManuallyDrop<ProviderControlHandle>,
4904    tx_id: u32,
4905}
4906
4907/// Set the the channel to be shutdown (see [`ProviderControlHandle::shutdown`])
4908/// if the responder is dropped without sending a response, so that the client
4909/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4910impl std::ops::Drop for ProviderOpenCoordinatorResponder {
4911    fn drop(&mut self) {
4912        self.control_handle.shutdown();
4913        // Safety: drops once, never accessed again
4914        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4915    }
4916}
4917
4918impl fidl::endpoints::Responder for ProviderOpenCoordinatorResponder {
4919    type ControlHandle = ProviderControlHandle;
4920
4921    fn control_handle(&self) -> &ProviderControlHandle {
4922        &self.control_handle
4923    }
4924
4925    fn drop_without_shutdown(mut self) {
4926        // Safety: drops once, never accessed again due to mem::forget
4927        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4928        // Prevent Drop from running (which would shut down the channel)
4929        std::mem::forget(self);
4930    }
4931}
4932
4933impl ProviderOpenCoordinatorResponder {
4934    /// Sends a response to the FIDL transaction.
4935    ///
4936    /// Sets the channel to shutdown if an error occurs.
4937    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
4938        let _result = self.send_raw(result);
4939        if _result.is_err() {
4940            self.control_handle.shutdown();
4941        }
4942        self.drop_without_shutdown();
4943        _result
4944    }
4945
4946    /// Similar to "send" but does not shutdown the channel if an error occurs.
4947    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
4948        let _result = self.send_raw(result);
4949        self.drop_without_shutdown();
4950        _result
4951    }
4952
4953    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
4954        self.control_handle
4955            .inner
4956            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
4957                result,
4958                self.tx_id,
4959                0x1bd6070372d03df0,
4960                fidl::encoding::DynamicFlags::empty(),
4961            )
4962    }
4963}
4964
4965#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
4966pub struct ServiceMarker;
4967
4968#[cfg(target_os = "fuchsia")]
4969impl fidl::endpoints::ServiceMarker for ServiceMarker {
4970    type Proxy = ServiceProxy;
4971    type Request = ServiceRequest;
4972    const SERVICE_NAME: &'static str = "fuchsia.hardware.display.Service";
4973}
4974
4975/// A request for one of the member protocols of Service.
4976///
4977#[cfg(target_os = "fuchsia")]
4978pub enum ServiceRequest {
4979    Provider(ProviderRequestStream),
4980}
4981
4982#[cfg(target_os = "fuchsia")]
4983impl fidl::endpoints::ServiceRequest for ServiceRequest {
4984    type Service = ServiceMarker;
4985
4986    fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
4987        match name {
4988            "provider" => Self::Provider(
4989                <ProviderRequestStream as fidl::endpoints::RequestStream>::from_channel(_channel),
4990            ),
4991            _ => panic!("no such member protocol name for service Service"),
4992        }
4993    }
4994
4995    fn member_names() -> &'static [&'static str] {
4996        &["provider"]
4997    }
4998}
4999#[cfg(target_os = "fuchsia")]
5000pub struct ServiceProxy(#[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>);
5001
5002#[cfg(target_os = "fuchsia")]
5003impl fidl::endpoints::ServiceProxy for ServiceProxy {
5004    type Service = ServiceMarker;
5005
5006    fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
5007        Self(opener)
5008    }
5009}
5010
5011#[cfg(target_os = "fuchsia")]
5012impl ServiceProxy {
5013    pub fn connect_to_provider(&self) -> Result<ProviderProxy, fidl::Error> {
5014        let (proxy, server_end) = fidl::endpoints::create_proxy::<ProviderMarker>();
5015        self.connect_channel_to_provider(server_end)?;
5016        Ok(proxy)
5017    }
5018
5019    /// Like `connect_to_provider`, but returns a sync proxy.
5020    /// See [`Self::connect_to_provider`] for more details.
5021    pub fn connect_to_provider_sync(&self) -> Result<ProviderSynchronousProxy, fidl::Error> {
5022        let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<ProviderMarker>();
5023        self.connect_channel_to_provider(server_end)?;
5024        Ok(proxy)
5025    }
5026
5027    /// Like `connect_to_provider`, but accepts a server end.
5028    /// See [`Self::connect_to_provider`] for more details.
5029    pub fn connect_channel_to_provider(
5030        &self,
5031        server_end: fidl::endpoints::ServerEnd<ProviderMarker>,
5032    ) -> Result<(), fidl::Error> {
5033        self.0.open_member("provider", server_end.into_channel())
5034    }
5035
5036    pub fn instance_name(&self) -> &str {
5037        self.0.instance_name()
5038    }
5039}
5040
5041mod internal {
5042    use super::*;
5043
5044    impl fidl::encoding::ResourceTypeMarker for CoordinatorImportBufferCollectionRequest {
5045        type Borrowed<'a> = &'a mut Self;
5046        fn take_or_borrow<'a>(
5047            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
5048        ) -> Self::Borrowed<'a> {
5049            value
5050        }
5051    }
5052
5053    unsafe impl fidl::encoding::TypeMarker for CoordinatorImportBufferCollectionRequest {
5054        type Owned = Self;
5055
5056        #[inline(always)]
5057        fn inline_align(_context: fidl::encoding::Context) -> usize {
5058            8
5059        }
5060
5061        #[inline(always)]
5062        fn inline_size(_context: fidl::encoding::Context) -> usize {
5063            16
5064        }
5065    }
5066
5067    unsafe impl
5068        fidl::encoding::Encode<
5069            CoordinatorImportBufferCollectionRequest,
5070            fidl::encoding::DefaultFuchsiaResourceDialect,
5071        > for &mut CoordinatorImportBufferCollectionRequest
5072    {
5073        #[inline]
5074        unsafe fn encode(
5075            self,
5076            encoder: &mut fidl::encoding::Encoder<
5077                '_,
5078                fidl::encoding::DefaultFuchsiaResourceDialect,
5079            >,
5080            offset: usize,
5081            _depth: fidl::encoding::Depth,
5082        ) -> fidl::Result<()> {
5083            encoder.debug_check_bounds::<CoordinatorImportBufferCollectionRequest>(offset);
5084            // Delegate to tuple encoding.
5085            fidl::encoding::Encode::<
5086                CoordinatorImportBufferCollectionRequest,
5087                fidl::encoding::DefaultFuchsiaResourceDialect,
5088            >::encode(
5089                (
5090                    <BufferCollectionId as fidl::encoding::ValueTypeMarker>::borrow(
5091                        &self.buffer_collection_id,
5092                    ),
5093                    <fidl::encoding::Endpoint<
5094                        fidl::endpoints::ClientEnd<
5095                            fidl_fuchsia_sysmem2::BufferCollectionTokenMarker,
5096                        >,
5097                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
5098                        &mut self.buffer_collection_token,
5099                    ),
5100                ),
5101                encoder,
5102                offset,
5103                _depth,
5104            )
5105        }
5106    }
5107    unsafe impl<
5108        T0: fidl::encoding::Encode<BufferCollectionId, fidl::encoding::DefaultFuchsiaResourceDialect>,
5109        T1: fidl::encoding::Encode<
5110                fidl::encoding::Endpoint<
5111                    fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem2::BufferCollectionTokenMarker>,
5112                >,
5113                fidl::encoding::DefaultFuchsiaResourceDialect,
5114            >,
5115    >
5116        fidl::encoding::Encode<
5117            CoordinatorImportBufferCollectionRequest,
5118            fidl::encoding::DefaultFuchsiaResourceDialect,
5119        > for (T0, T1)
5120    {
5121        #[inline]
5122        unsafe fn encode(
5123            self,
5124            encoder: &mut fidl::encoding::Encoder<
5125                '_,
5126                fidl::encoding::DefaultFuchsiaResourceDialect,
5127            >,
5128            offset: usize,
5129            depth: fidl::encoding::Depth,
5130        ) -> fidl::Result<()> {
5131            encoder.debug_check_bounds::<CoordinatorImportBufferCollectionRequest>(offset);
5132            // Zero out padding regions. There's no need to apply masks
5133            // because the unmasked parts will be overwritten by fields.
5134            unsafe {
5135                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
5136                (ptr as *mut u64).write_unaligned(0);
5137            }
5138            // Write the fields.
5139            self.0.encode(encoder, offset + 0, depth)?;
5140            self.1.encode(encoder, offset + 8, depth)?;
5141            Ok(())
5142        }
5143    }
5144
5145    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
5146        for CoordinatorImportBufferCollectionRequest
5147    {
5148        #[inline(always)]
5149        fn new_empty() -> Self {
5150            Self {
5151                buffer_collection_id: fidl::new_empty!(
5152                    BufferCollectionId,
5153                    fidl::encoding::DefaultFuchsiaResourceDialect
5154                ),
5155                buffer_collection_token: fidl::new_empty!(
5156                    fidl::encoding::Endpoint<
5157                        fidl::endpoints::ClientEnd<
5158                            fidl_fuchsia_sysmem2::BufferCollectionTokenMarker,
5159                        >,
5160                    >,
5161                    fidl::encoding::DefaultFuchsiaResourceDialect
5162                ),
5163            }
5164        }
5165
5166        #[inline]
5167        unsafe fn decode(
5168            &mut self,
5169            decoder: &mut fidl::encoding::Decoder<
5170                '_,
5171                fidl::encoding::DefaultFuchsiaResourceDialect,
5172            >,
5173            offset: usize,
5174            _depth: fidl::encoding::Depth,
5175        ) -> fidl::Result<()> {
5176            decoder.debug_check_bounds::<Self>(offset);
5177            // Verify that padding bytes are zero.
5178            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(8) };
5179            let padval = unsafe { (ptr as *const u64).read_unaligned() };
5180            let mask = 0xffffffff00000000u64;
5181            let maskedval = padval & mask;
5182            if maskedval != 0 {
5183                return Err(fidl::Error::NonZeroPadding {
5184                    padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
5185                });
5186            }
5187            fidl::decode!(
5188                BufferCollectionId,
5189                fidl::encoding::DefaultFuchsiaResourceDialect,
5190                &mut self.buffer_collection_id,
5191                decoder,
5192                offset + 0,
5193                _depth
5194            )?;
5195            fidl::decode!(
5196                fidl::encoding::Endpoint<
5197                    fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem2::BufferCollectionTokenMarker>,
5198                >,
5199                fidl::encoding::DefaultFuchsiaResourceDialect,
5200                &mut self.buffer_collection_token,
5201                decoder,
5202                offset + 8,
5203                _depth
5204            )?;
5205            Ok(())
5206        }
5207    }
5208
5209    impl fidl::encoding::ResourceTypeMarker for CoordinatorImportEventRequest {
5210        type Borrowed<'a> = &'a mut Self;
5211        fn take_or_borrow<'a>(
5212            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
5213        ) -> Self::Borrowed<'a> {
5214            value
5215        }
5216    }
5217
5218    unsafe impl fidl::encoding::TypeMarker for CoordinatorImportEventRequest {
5219        type Owned = Self;
5220
5221        #[inline(always)]
5222        fn inline_align(_context: fidl::encoding::Context) -> usize {
5223            8
5224        }
5225
5226        #[inline(always)]
5227        fn inline_size(_context: fidl::encoding::Context) -> usize {
5228            16
5229        }
5230    }
5231
5232    unsafe impl
5233        fidl::encoding::Encode<
5234            CoordinatorImportEventRequest,
5235            fidl::encoding::DefaultFuchsiaResourceDialect,
5236        > for &mut CoordinatorImportEventRequest
5237    {
5238        #[inline]
5239        unsafe fn encode(
5240            self,
5241            encoder: &mut fidl::encoding::Encoder<
5242                '_,
5243                fidl::encoding::DefaultFuchsiaResourceDialect,
5244            >,
5245            offset: usize,
5246            _depth: fidl::encoding::Depth,
5247        ) -> fidl::Result<()> {
5248            encoder.debug_check_bounds::<CoordinatorImportEventRequest>(offset);
5249            // Delegate to tuple encoding.
5250            fidl::encoding::Encode::<
5251                CoordinatorImportEventRequest,
5252                fidl::encoding::DefaultFuchsiaResourceDialect,
5253            >::encode(
5254                (
5255                    <fidl::encoding::HandleType<
5256                        fidl::Event,
5257                        { fidl::ObjectType::EVENT.into_raw() },
5258                        2147483648,
5259                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
5260                        &mut self.event
5261                    ),
5262                    <EventId as fidl::encoding::ValueTypeMarker>::borrow(&self.id),
5263                ),
5264                encoder,
5265                offset,
5266                _depth,
5267            )
5268        }
5269    }
5270    unsafe impl<
5271        T0: fidl::encoding::Encode<
5272                fidl::encoding::HandleType<
5273                    fidl::Event,
5274                    { fidl::ObjectType::EVENT.into_raw() },
5275                    2147483648,
5276                >,
5277                fidl::encoding::DefaultFuchsiaResourceDialect,
5278            >,
5279        T1: fidl::encoding::Encode<EventId, fidl::encoding::DefaultFuchsiaResourceDialect>,
5280    >
5281        fidl::encoding::Encode<
5282            CoordinatorImportEventRequest,
5283            fidl::encoding::DefaultFuchsiaResourceDialect,
5284        > for (T0, T1)
5285    {
5286        #[inline]
5287        unsafe fn encode(
5288            self,
5289            encoder: &mut fidl::encoding::Encoder<
5290                '_,
5291                fidl::encoding::DefaultFuchsiaResourceDialect,
5292            >,
5293            offset: usize,
5294            depth: fidl::encoding::Depth,
5295        ) -> fidl::Result<()> {
5296            encoder.debug_check_bounds::<CoordinatorImportEventRequest>(offset);
5297            // Zero out padding regions. There's no need to apply masks
5298            // because the unmasked parts will be overwritten by fields.
5299            unsafe {
5300                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
5301                (ptr as *mut u64).write_unaligned(0);
5302            }
5303            // Write the fields.
5304            self.0.encode(encoder, offset + 0, depth)?;
5305            self.1.encode(encoder, offset + 8, depth)?;
5306            Ok(())
5307        }
5308    }
5309
5310    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
5311        for CoordinatorImportEventRequest
5312    {
5313        #[inline(always)]
5314        fn new_empty() -> Self {
5315            Self {
5316                event: fidl::new_empty!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
5317                id: fidl::new_empty!(EventId, fidl::encoding::DefaultFuchsiaResourceDialect),
5318            }
5319        }
5320
5321        #[inline]
5322        unsafe fn decode(
5323            &mut self,
5324            decoder: &mut fidl::encoding::Decoder<
5325                '_,
5326                fidl::encoding::DefaultFuchsiaResourceDialect,
5327            >,
5328            offset: usize,
5329            _depth: fidl::encoding::Depth,
5330        ) -> fidl::Result<()> {
5331            decoder.debug_check_bounds::<Self>(offset);
5332            // Verify that padding bytes are zero.
5333            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
5334            let padval = unsafe { (ptr as *const u64).read_unaligned() };
5335            let mask = 0xffffffff00000000u64;
5336            let maskedval = padval & mask;
5337            if maskedval != 0 {
5338                return Err(fidl::Error::NonZeroPadding {
5339                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
5340                });
5341            }
5342            fidl::decode!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.event, decoder, offset + 0, _depth)?;
5343            fidl::decode!(
5344                EventId,
5345                fidl::encoding::DefaultFuchsiaResourceDialect,
5346                &mut self.id,
5347                decoder,
5348                offset + 8,
5349                _depth
5350            )?;
5351            Ok(())
5352        }
5353    }
5354
5355    impl CoordinatorCommitConfigRequest {
5356        #[inline(always)]
5357        fn max_ordinal_present(&self) -> u64 {
5358            if let Some(_) = self.stamp {
5359                return 1;
5360            }
5361            0
5362        }
5363    }
5364
5365    impl fidl::encoding::ResourceTypeMarker for CoordinatorCommitConfigRequest {
5366        type Borrowed<'a> = &'a mut Self;
5367        fn take_or_borrow<'a>(
5368            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
5369        ) -> Self::Borrowed<'a> {
5370            value
5371        }
5372    }
5373
5374    unsafe impl fidl::encoding::TypeMarker for CoordinatorCommitConfigRequest {
5375        type Owned = Self;
5376
5377        #[inline(always)]
5378        fn inline_align(_context: fidl::encoding::Context) -> usize {
5379            8
5380        }
5381
5382        #[inline(always)]
5383        fn inline_size(_context: fidl::encoding::Context) -> usize {
5384            16
5385        }
5386    }
5387
5388    unsafe impl
5389        fidl::encoding::Encode<
5390            CoordinatorCommitConfigRequest,
5391            fidl::encoding::DefaultFuchsiaResourceDialect,
5392        > for &mut CoordinatorCommitConfigRequest
5393    {
5394        unsafe fn encode(
5395            self,
5396            encoder: &mut fidl::encoding::Encoder<
5397                '_,
5398                fidl::encoding::DefaultFuchsiaResourceDialect,
5399            >,
5400            offset: usize,
5401            mut depth: fidl::encoding::Depth,
5402        ) -> fidl::Result<()> {
5403            encoder.debug_check_bounds::<CoordinatorCommitConfigRequest>(offset);
5404            // Vector header
5405            let max_ordinal: u64 = self.max_ordinal_present();
5406            encoder.write_num(max_ordinal, offset);
5407            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
5408            // Calling encoder.out_of_line_offset(0) is not allowed.
5409            if max_ordinal == 0 {
5410                return Ok(());
5411            }
5412            depth.increment()?;
5413            let envelope_size = 8;
5414            let bytes_len = max_ordinal as usize * envelope_size;
5415            #[allow(unused_variables)]
5416            let offset = encoder.out_of_line_offset(bytes_len);
5417            let mut _prev_end_offset: usize = 0;
5418            if 1 > max_ordinal {
5419                return Ok(());
5420            }
5421
5422            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5423            // are envelope_size bytes.
5424            let cur_offset: usize = (1 - 1) * envelope_size;
5425
5426            // Zero reserved fields.
5427            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5428
5429            // Safety:
5430            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5431            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5432            //   envelope_size bytes, there is always sufficient room.
5433            fidl::encoding::encode_in_envelope_optional::<
5434                ConfigStamp,
5435                fidl::encoding::DefaultFuchsiaResourceDialect,
5436            >(
5437                self.stamp.as_ref().map(<ConfigStamp as fidl::encoding::ValueTypeMarker>::borrow),
5438                encoder,
5439                offset + cur_offset,
5440                depth,
5441            )?;
5442
5443            _prev_end_offset = cur_offset + envelope_size;
5444
5445            Ok(())
5446        }
5447    }
5448
5449    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
5450        for CoordinatorCommitConfigRequest
5451    {
5452        #[inline(always)]
5453        fn new_empty() -> Self {
5454            Self::default()
5455        }
5456
5457        unsafe fn decode(
5458            &mut self,
5459            decoder: &mut fidl::encoding::Decoder<
5460                '_,
5461                fidl::encoding::DefaultFuchsiaResourceDialect,
5462            >,
5463            offset: usize,
5464            mut depth: fidl::encoding::Depth,
5465        ) -> fidl::Result<()> {
5466            decoder.debug_check_bounds::<Self>(offset);
5467            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
5468                None => return Err(fidl::Error::NotNullable),
5469                Some(len) => len,
5470            };
5471            // Calling decoder.out_of_line_offset(0) is not allowed.
5472            if len == 0 {
5473                return Ok(());
5474            };
5475            depth.increment()?;
5476            let envelope_size = 8;
5477            let bytes_len = len * envelope_size;
5478            let offset = decoder.out_of_line_offset(bytes_len)?;
5479            // Decode the envelope for each type.
5480            let mut _next_ordinal_to_read = 0;
5481            let mut next_offset = offset;
5482            let end_offset = offset + bytes_len;
5483            _next_ordinal_to_read += 1;
5484            if next_offset >= end_offset {
5485                return Ok(());
5486            }
5487
5488            // Decode unknown envelopes for gaps in ordinals.
5489            while _next_ordinal_to_read < 1 {
5490                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5491                _next_ordinal_to_read += 1;
5492                next_offset += envelope_size;
5493            }
5494
5495            let next_out_of_line = decoder.next_out_of_line();
5496            let handles_before = decoder.remaining_handles();
5497            if let Some((inlined, num_bytes, num_handles)) =
5498                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5499            {
5500                let member_inline_size =
5501                    <ConfigStamp as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5502                if inlined != (member_inline_size <= 4) {
5503                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5504                }
5505                let inner_offset;
5506                let mut inner_depth = depth.clone();
5507                if inlined {
5508                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5509                    inner_offset = next_offset;
5510                } else {
5511                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5512                    inner_depth.increment()?;
5513                }
5514                let val_ref = self.stamp.get_or_insert_with(|| {
5515                    fidl::new_empty!(ConfigStamp, fidl::encoding::DefaultFuchsiaResourceDialect)
5516                });
5517                fidl::decode!(
5518                    ConfigStamp,
5519                    fidl::encoding::DefaultFuchsiaResourceDialect,
5520                    val_ref,
5521                    decoder,
5522                    inner_offset,
5523                    inner_depth
5524                )?;
5525                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5526                {
5527                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5528                }
5529                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5530                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5531                }
5532            }
5533
5534            next_offset += envelope_size;
5535
5536            // Decode the remaining unknown envelopes.
5537            while next_offset < end_offset {
5538                _next_ordinal_to_read += 1;
5539                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5540                next_offset += envelope_size;
5541            }
5542
5543            Ok(())
5544        }
5545    }
5546
5547    impl ProviderOpenCoordinatorRequest {
5548        #[inline(always)]
5549        fn max_ordinal_present(&self) -> u64 {
5550            if let Some(_) = self.priority {
5551                return 3;
5552            }
5553            if let Some(_) = self.coordinator_listener {
5554                return 2;
5555            }
5556            if let Some(_) = self.coordinator {
5557                return 1;
5558            }
5559            0
5560        }
5561    }
5562
5563    impl fidl::encoding::ResourceTypeMarker for ProviderOpenCoordinatorRequest {
5564        type Borrowed<'a> = &'a mut Self;
5565        fn take_or_borrow<'a>(
5566            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
5567        ) -> Self::Borrowed<'a> {
5568            value
5569        }
5570    }
5571
5572    unsafe impl fidl::encoding::TypeMarker for ProviderOpenCoordinatorRequest {
5573        type Owned = Self;
5574
5575        #[inline(always)]
5576        fn inline_align(_context: fidl::encoding::Context) -> usize {
5577            8
5578        }
5579
5580        #[inline(always)]
5581        fn inline_size(_context: fidl::encoding::Context) -> usize {
5582            16
5583        }
5584    }
5585
5586    unsafe impl
5587        fidl::encoding::Encode<
5588            ProviderOpenCoordinatorRequest,
5589            fidl::encoding::DefaultFuchsiaResourceDialect,
5590        > for &mut ProviderOpenCoordinatorRequest
5591    {
5592        unsafe fn encode(
5593            self,
5594            encoder: &mut fidl::encoding::Encoder<
5595                '_,
5596                fidl::encoding::DefaultFuchsiaResourceDialect,
5597            >,
5598            offset: usize,
5599            mut depth: fidl::encoding::Depth,
5600        ) -> fidl::Result<()> {
5601            encoder.debug_check_bounds::<ProviderOpenCoordinatorRequest>(offset);
5602            // Vector header
5603            let max_ordinal: u64 = self.max_ordinal_present();
5604            encoder.write_num(max_ordinal, offset);
5605            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
5606            // Calling encoder.out_of_line_offset(0) is not allowed.
5607            if max_ordinal == 0 {
5608                return Ok(());
5609            }
5610            depth.increment()?;
5611            let envelope_size = 8;
5612            let bytes_len = max_ordinal as usize * envelope_size;
5613            #[allow(unused_variables)]
5614            let offset = encoder.out_of_line_offset(bytes_len);
5615            let mut _prev_end_offset: usize = 0;
5616            if 1 > max_ordinal {
5617                return Ok(());
5618            }
5619
5620            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5621            // are envelope_size bytes.
5622            let cur_offset: usize = (1 - 1) * envelope_size;
5623
5624            // Zero reserved fields.
5625            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5626
5627            // Safety:
5628            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5629            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5630            //   envelope_size bytes, there is always sufficient room.
5631            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CoordinatorMarker>>, fidl::encoding::DefaultFuchsiaResourceDialect>(
5632            self.coordinator.as_mut().map(<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CoordinatorMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
5633            encoder, offset + cur_offset, depth
5634        )?;
5635
5636            _prev_end_offset = cur_offset + envelope_size;
5637            if 2 > max_ordinal {
5638                return Ok(());
5639            }
5640
5641            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5642            // are envelope_size bytes.
5643            let cur_offset: usize = (2 - 1) * envelope_size;
5644
5645            // Zero reserved fields.
5646            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5647
5648            // Safety:
5649            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5650            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5651            //   envelope_size bytes, there is always sufficient room.
5652            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<CoordinatorListenerMarker>>, fidl::encoding::DefaultFuchsiaResourceDialect>(
5653            self.coordinator_listener.as_mut().map(<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<CoordinatorListenerMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
5654            encoder, offset + cur_offset, depth
5655        )?;
5656
5657            _prev_end_offset = cur_offset + envelope_size;
5658            if 3 > max_ordinal {
5659                return Ok(());
5660            }
5661
5662            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5663            // are envelope_size bytes.
5664            let cur_offset: usize = (3 - 1) * envelope_size;
5665
5666            // Zero reserved fields.
5667            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5668
5669            // Safety:
5670            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5671            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5672            //   envelope_size bytes, there is always sufficient room.
5673            fidl::encoding::encode_in_envelope_optional::<
5674                ClientPriority,
5675                fidl::encoding::DefaultFuchsiaResourceDialect,
5676            >(
5677                self.priority
5678                    .as_ref()
5679                    .map(<ClientPriority as fidl::encoding::ValueTypeMarker>::borrow),
5680                encoder,
5681                offset + cur_offset,
5682                depth,
5683            )?;
5684
5685            _prev_end_offset = cur_offset + envelope_size;
5686
5687            Ok(())
5688        }
5689    }
5690
5691    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
5692        for ProviderOpenCoordinatorRequest
5693    {
5694        #[inline(always)]
5695        fn new_empty() -> Self {
5696            Self::default()
5697        }
5698
5699        unsafe fn decode(
5700            &mut self,
5701            decoder: &mut fidl::encoding::Decoder<
5702                '_,
5703                fidl::encoding::DefaultFuchsiaResourceDialect,
5704            >,
5705            offset: usize,
5706            mut depth: fidl::encoding::Depth,
5707        ) -> fidl::Result<()> {
5708            decoder.debug_check_bounds::<Self>(offset);
5709            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
5710                None => return Err(fidl::Error::NotNullable),
5711                Some(len) => len,
5712            };
5713            // Calling decoder.out_of_line_offset(0) is not allowed.
5714            if len == 0 {
5715                return Ok(());
5716            };
5717            depth.increment()?;
5718            let envelope_size = 8;
5719            let bytes_len = len * envelope_size;
5720            let offset = decoder.out_of_line_offset(bytes_len)?;
5721            // Decode the envelope for each type.
5722            let mut _next_ordinal_to_read = 0;
5723            let mut next_offset = offset;
5724            let end_offset = offset + bytes_len;
5725            _next_ordinal_to_read += 1;
5726            if next_offset >= end_offset {
5727                return Ok(());
5728            }
5729
5730            // Decode unknown envelopes for gaps in ordinals.
5731            while _next_ordinal_to_read < 1 {
5732                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5733                _next_ordinal_to_read += 1;
5734                next_offset += envelope_size;
5735            }
5736
5737            let next_out_of_line = decoder.next_out_of_line();
5738            let handles_before = decoder.remaining_handles();
5739            if let Some((inlined, num_bytes, num_handles)) =
5740                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5741            {
5742                let member_inline_size = <fidl::encoding::Endpoint<
5743                    fidl::endpoints::ServerEnd<CoordinatorMarker>,
5744                > as fidl::encoding::TypeMarker>::inline_size(
5745                    decoder.context
5746                );
5747                if inlined != (member_inline_size <= 4) {
5748                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5749                }
5750                let inner_offset;
5751                let mut inner_depth = depth.clone();
5752                if inlined {
5753                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5754                    inner_offset = next_offset;
5755                } else {
5756                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5757                    inner_depth.increment()?;
5758                }
5759                let val_ref = self.coordinator.get_or_insert_with(|| {
5760                    fidl::new_empty!(
5761                        fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CoordinatorMarker>>,
5762                        fidl::encoding::DefaultFuchsiaResourceDialect
5763                    )
5764                });
5765                fidl::decode!(
5766                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CoordinatorMarker>>,
5767                    fidl::encoding::DefaultFuchsiaResourceDialect,
5768                    val_ref,
5769                    decoder,
5770                    inner_offset,
5771                    inner_depth
5772                )?;
5773                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5774                {
5775                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5776                }
5777                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5778                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5779                }
5780            }
5781
5782            next_offset += envelope_size;
5783            _next_ordinal_to_read += 1;
5784            if next_offset >= end_offset {
5785                return Ok(());
5786            }
5787
5788            // Decode unknown envelopes for gaps in ordinals.
5789            while _next_ordinal_to_read < 2 {
5790                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5791                _next_ordinal_to_read += 1;
5792                next_offset += envelope_size;
5793            }
5794
5795            let next_out_of_line = decoder.next_out_of_line();
5796            let handles_before = decoder.remaining_handles();
5797            if let Some((inlined, num_bytes, num_handles)) =
5798                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5799            {
5800                let member_inline_size = <fidl::encoding::Endpoint<
5801                    fidl::endpoints::ClientEnd<CoordinatorListenerMarker>,
5802                > as fidl::encoding::TypeMarker>::inline_size(
5803                    decoder.context
5804                );
5805                if inlined != (member_inline_size <= 4) {
5806                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5807                }
5808                let inner_offset;
5809                let mut inner_depth = depth.clone();
5810                if inlined {
5811                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5812                    inner_offset = next_offset;
5813                } else {
5814                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5815                    inner_depth.increment()?;
5816                }
5817                let val_ref = self.coordinator_listener.get_or_insert_with(|| {
5818                    fidl::new_empty!(
5819                        fidl::encoding::Endpoint<
5820                            fidl::endpoints::ClientEnd<CoordinatorListenerMarker>,
5821                        >,
5822                        fidl::encoding::DefaultFuchsiaResourceDialect
5823                    )
5824                });
5825                fidl::decode!(
5826                    fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<CoordinatorListenerMarker>>,
5827                    fidl::encoding::DefaultFuchsiaResourceDialect,
5828                    val_ref,
5829                    decoder,
5830                    inner_offset,
5831                    inner_depth
5832                )?;
5833                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5834                {
5835                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5836                }
5837                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5838                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5839                }
5840            }
5841
5842            next_offset += envelope_size;
5843            _next_ordinal_to_read += 1;
5844            if next_offset >= end_offset {
5845                return Ok(());
5846            }
5847
5848            // Decode unknown envelopes for gaps in ordinals.
5849            while _next_ordinal_to_read < 3 {
5850                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5851                _next_ordinal_to_read += 1;
5852                next_offset += envelope_size;
5853            }
5854
5855            let next_out_of_line = decoder.next_out_of_line();
5856            let handles_before = decoder.remaining_handles();
5857            if let Some((inlined, num_bytes, num_handles)) =
5858                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5859            {
5860                let member_inline_size =
5861                    <ClientPriority as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5862                if inlined != (member_inline_size <= 4) {
5863                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5864                }
5865                let inner_offset;
5866                let mut inner_depth = depth.clone();
5867                if inlined {
5868                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5869                    inner_offset = next_offset;
5870                } else {
5871                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5872                    inner_depth.increment()?;
5873                }
5874                let val_ref = self.priority.get_or_insert_with(|| {
5875                    fidl::new_empty!(ClientPriority, fidl::encoding::DefaultFuchsiaResourceDialect)
5876                });
5877                fidl::decode!(
5878                    ClientPriority,
5879                    fidl::encoding::DefaultFuchsiaResourceDialect,
5880                    val_ref,
5881                    decoder,
5882                    inner_offset,
5883                    inner_depth
5884                )?;
5885                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5886                {
5887                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5888                }
5889                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5890                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5891                }
5892            }
5893
5894            next_offset += envelope_size;
5895
5896            // Decode the remaining unknown envelopes.
5897            while next_offset < end_offset {
5898                _next_ordinal_to_read += 1;
5899                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5900                next_offset += envelope_size;
5901            }
5902
5903            Ok(())
5904        }
5905    }
5906}