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