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