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