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