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