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::Handle {
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    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
3105        self.inner.shutdown_with_epitaph(status)
3106    }
3107
3108    fn is_closed(&self) -> bool {
3109        self.inner.channel().is_closed()
3110    }
3111    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3112        self.inner.channel().on_closed()
3113    }
3114
3115    #[cfg(target_os = "fuchsia")]
3116    fn signal_peer(
3117        &self,
3118        clear_mask: zx::Signals,
3119        set_mask: zx::Signals,
3120    ) -> Result<(), zx_status::Status> {
3121        use fidl::Peered;
3122        self.inner.channel().signal_peer(clear_mask, set_mask)
3123    }
3124}
3125
3126impl CoordinatorControlHandle {}
3127
3128#[must_use = "FIDL methods require a response to be sent"]
3129#[derive(Debug)]
3130pub struct CoordinatorImportImageResponder {
3131    control_handle: std::mem::ManuallyDrop<CoordinatorControlHandle>,
3132    tx_id: u32,
3133}
3134
3135/// Set the the channel to be shutdown (see [`CoordinatorControlHandle::shutdown`])
3136/// if the responder is dropped without sending a response, so that the client
3137/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3138impl std::ops::Drop for CoordinatorImportImageResponder {
3139    fn drop(&mut self) {
3140        self.control_handle.shutdown();
3141        // Safety: drops once, never accessed again
3142        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3143    }
3144}
3145
3146impl fidl::endpoints::Responder for CoordinatorImportImageResponder {
3147    type ControlHandle = CoordinatorControlHandle;
3148
3149    fn control_handle(&self) -> &CoordinatorControlHandle {
3150        &self.control_handle
3151    }
3152
3153    fn drop_without_shutdown(mut self) {
3154        // Safety: drops once, never accessed again due to mem::forget
3155        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3156        // Prevent Drop from running (which would shut down the channel)
3157        std::mem::forget(self);
3158    }
3159}
3160
3161impl CoordinatorImportImageResponder {
3162    /// Sends a response to the FIDL transaction.
3163    ///
3164    /// Sets the channel to shutdown if an error occurs.
3165    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3166        let _result = self.send_raw(result);
3167        if _result.is_err() {
3168            self.control_handle.shutdown();
3169        }
3170        self.drop_without_shutdown();
3171        _result
3172    }
3173
3174    /// Similar to "send" but does not shutdown the channel if an error occurs.
3175    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3176        let _result = self.send_raw(result);
3177        self.drop_without_shutdown();
3178        _result
3179    }
3180
3181    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3182        self.control_handle
3183            .inner
3184            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
3185                result,
3186                self.tx_id,
3187                0x3a8636eb9656b4f4,
3188                fidl::encoding::DynamicFlags::empty(),
3189            )
3190    }
3191}
3192
3193#[must_use = "FIDL methods require a response to be sent"]
3194#[derive(Debug)]
3195pub struct CoordinatorCreateLayerResponder {
3196    control_handle: std::mem::ManuallyDrop<CoordinatorControlHandle>,
3197    tx_id: u32,
3198}
3199
3200/// Set the the channel to be shutdown (see [`CoordinatorControlHandle::shutdown`])
3201/// if the responder is dropped without sending a response, so that the client
3202/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3203impl std::ops::Drop for CoordinatorCreateLayerResponder {
3204    fn drop(&mut self) {
3205        self.control_handle.shutdown();
3206        // Safety: drops once, never accessed again
3207        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3208    }
3209}
3210
3211impl fidl::endpoints::Responder for CoordinatorCreateLayerResponder {
3212    type ControlHandle = CoordinatorControlHandle;
3213
3214    fn control_handle(&self) -> &CoordinatorControlHandle {
3215        &self.control_handle
3216    }
3217
3218    fn drop_without_shutdown(mut self) {
3219        // Safety: drops once, never accessed again due to mem::forget
3220        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3221        // Prevent Drop from running (which would shut down the channel)
3222        std::mem::forget(self);
3223    }
3224}
3225
3226impl CoordinatorCreateLayerResponder {
3227    /// Sends a response to the FIDL transaction.
3228    ///
3229    /// Sets the channel to shutdown if an error occurs.
3230    pub fn send(self, mut result: Result<&LayerId, i32>) -> Result<(), fidl::Error> {
3231        let _result = self.send_raw(result);
3232        if _result.is_err() {
3233            self.control_handle.shutdown();
3234        }
3235        self.drop_without_shutdown();
3236        _result
3237    }
3238
3239    /// Similar to "send" but does not shutdown the channel if an error occurs.
3240    pub fn send_no_shutdown_on_err(
3241        self,
3242        mut result: Result<&LayerId, i32>,
3243    ) -> Result<(), fidl::Error> {
3244        let _result = self.send_raw(result);
3245        self.drop_without_shutdown();
3246        _result
3247    }
3248
3249    fn send_raw(&self, mut result: Result<&LayerId, i32>) -> Result<(), fidl::Error> {
3250        self.control_handle
3251            .inner
3252            .send::<fidl::encoding::ResultType<CoordinatorCreateLayerResponse, i32>>(
3253                result.map(|layer_id| (layer_id,)),
3254                self.tx_id,
3255                0x2137cfd788a3496b,
3256                fidl::encoding::DynamicFlags::empty(),
3257            )
3258    }
3259}
3260
3261#[must_use = "FIDL methods require a response to be sent"]
3262#[derive(Debug)]
3263pub struct CoordinatorCheckConfigResponder {
3264    control_handle: std::mem::ManuallyDrop<CoordinatorControlHandle>,
3265    tx_id: u32,
3266}
3267
3268/// Set the the channel to be shutdown (see [`CoordinatorControlHandle::shutdown`])
3269/// if the responder is dropped without sending a response, so that the client
3270/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3271impl std::ops::Drop for CoordinatorCheckConfigResponder {
3272    fn drop(&mut self) {
3273        self.control_handle.shutdown();
3274        // Safety: drops once, never accessed again
3275        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3276    }
3277}
3278
3279impl fidl::endpoints::Responder for CoordinatorCheckConfigResponder {
3280    type ControlHandle = CoordinatorControlHandle;
3281
3282    fn control_handle(&self) -> &CoordinatorControlHandle {
3283        &self.control_handle
3284    }
3285
3286    fn drop_without_shutdown(mut self) {
3287        // Safety: drops once, never accessed again due to mem::forget
3288        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3289        // Prevent Drop from running (which would shut down the channel)
3290        std::mem::forget(self);
3291    }
3292}
3293
3294impl CoordinatorCheckConfigResponder {
3295    /// Sends a response to the FIDL transaction.
3296    ///
3297    /// Sets the channel to shutdown if an error occurs.
3298    pub fn send(
3299        self,
3300        mut res: fidl_fuchsia_hardware_display_types::ConfigResult,
3301    ) -> Result<(), fidl::Error> {
3302        let _result = self.send_raw(res);
3303        if _result.is_err() {
3304            self.control_handle.shutdown();
3305        }
3306        self.drop_without_shutdown();
3307        _result
3308    }
3309
3310    /// Similar to "send" but does not shutdown the channel if an error occurs.
3311    pub fn send_no_shutdown_on_err(
3312        self,
3313        mut res: fidl_fuchsia_hardware_display_types::ConfigResult,
3314    ) -> Result<(), fidl::Error> {
3315        let _result = self.send_raw(res);
3316        self.drop_without_shutdown();
3317        _result
3318    }
3319
3320    fn send_raw(
3321        &self,
3322        mut res: fidl_fuchsia_hardware_display_types::ConfigResult,
3323    ) -> Result<(), fidl::Error> {
3324        self.control_handle.inner.send::<CoordinatorCheckConfigResponse>(
3325            (res,),
3326            self.tx_id,
3327            0x2bcfb4eb16878158,
3328            fidl::encoding::DynamicFlags::empty(),
3329        )
3330    }
3331}
3332
3333#[must_use = "FIDL methods require a response to be sent"]
3334#[derive(Debug)]
3335pub struct CoordinatorGetLatestAppliedConfigStampResponder {
3336    control_handle: std::mem::ManuallyDrop<CoordinatorControlHandle>,
3337    tx_id: u32,
3338}
3339
3340/// Set the the channel to be shutdown (see [`CoordinatorControlHandle::shutdown`])
3341/// if the responder is dropped without sending a response, so that the client
3342/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3343impl std::ops::Drop for CoordinatorGetLatestAppliedConfigStampResponder {
3344    fn drop(&mut self) {
3345        self.control_handle.shutdown();
3346        // Safety: drops once, never accessed again
3347        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3348    }
3349}
3350
3351impl fidl::endpoints::Responder for CoordinatorGetLatestAppliedConfigStampResponder {
3352    type ControlHandle = CoordinatorControlHandle;
3353
3354    fn control_handle(&self) -> &CoordinatorControlHandle {
3355        &self.control_handle
3356    }
3357
3358    fn drop_without_shutdown(mut self) {
3359        // Safety: drops once, never accessed again due to mem::forget
3360        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3361        // Prevent Drop from running (which would shut down the channel)
3362        std::mem::forget(self);
3363    }
3364}
3365
3366impl CoordinatorGetLatestAppliedConfigStampResponder {
3367    /// Sends a response to the FIDL transaction.
3368    ///
3369    /// Sets the channel to shutdown if an error occurs.
3370    pub fn send(self, mut stamp: &ConfigStamp) -> Result<(), fidl::Error> {
3371        let _result = self.send_raw(stamp);
3372        if _result.is_err() {
3373            self.control_handle.shutdown();
3374        }
3375        self.drop_without_shutdown();
3376        _result
3377    }
3378
3379    /// Similar to "send" but does not shutdown the channel if an error occurs.
3380    pub fn send_no_shutdown_on_err(self, mut stamp: &ConfigStamp) -> Result<(), fidl::Error> {
3381        let _result = self.send_raw(stamp);
3382        self.drop_without_shutdown();
3383        _result
3384    }
3385
3386    fn send_raw(&self, mut stamp: &ConfigStamp) -> Result<(), fidl::Error> {
3387        self.control_handle.inner.send::<CoordinatorGetLatestAppliedConfigStampResponse>(
3388            (stamp,),
3389            self.tx_id,
3390            0x76a50c0537265f65,
3391            fidl::encoding::DynamicFlags::empty(),
3392        )
3393    }
3394}
3395
3396#[must_use = "FIDL methods require a response to be sent"]
3397#[derive(Debug)]
3398pub struct CoordinatorImportBufferCollectionResponder {
3399    control_handle: std::mem::ManuallyDrop<CoordinatorControlHandle>,
3400    tx_id: u32,
3401}
3402
3403/// Set the the channel to be shutdown (see [`CoordinatorControlHandle::shutdown`])
3404/// if the responder is dropped without sending a response, so that the client
3405/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3406impl std::ops::Drop for CoordinatorImportBufferCollectionResponder {
3407    fn drop(&mut self) {
3408        self.control_handle.shutdown();
3409        // Safety: drops once, never accessed again
3410        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3411    }
3412}
3413
3414impl fidl::endpoints::Responder for CoordinatorImportBufferCollectionResponder {
3415    type ControlHandle = CoordinatorControlHandle;
3416
3417    fn control_handle(&self) -> &CoordinatorControlHandle {
3418        &self.control_handle
3419    }
3420
3421    fn drop_without_shutdown(mut self) {
3422        // Safety: drops once, never accessed again due to mem::forget
3423        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3424        // Prevent Drop from running (which would shut down the channel)
3425        std::mem::forget(self);
3426    }
3427}
3428
3429impl CoordinatorImportBufferCollectionResponder {
3430    /// Sends a response to the FIDL transaction.
3431    ///
3432    /// Sets the channel to shutdown if an error occurs.
3433    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3434        let _result = self.send_raw(result);
3435        if _result.is_err() {
3436            self.control_handle.shutdown();
3437        }
3438        self.drop_without_shutdown();
3439        _result
3440    }
3441
3442    /// Similar to "send" but does not shutdown the channel if an error occurs.
3443    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3444        let _result = self.send_raw(result);
3445        self.drop_without_shutdown();
3446        _result
3447    }
3448
3449    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3450        self.control_handle
3451            .inner
3452            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
3453                result,
3454                self.tx_id,
3455                0x30d06f510e7f4601,
3456                fidl::encoding::DynamicFlags::empty(),
3457            )
3458    }
3459}
3460
3461#[must_use = "FIDL methods require a response to be sent"]
3462#[derive(Debug)]
3463pub struct CoordinatorSetBufferCollectionConstraintsResponder {
3464    control_handle: std::mem::ManuallyDrop<CoordinatorControlHandle>,
3465    tx_id: u32,
3466}
3467
3468/// Set the the channel to be shutdown (see [`CoordinatorControlHandle::shutdown`])
3469/// if the responder is dropped without sending a response, so that the client
3470/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3471impl std::ops::Drop for CoordinatorSetBufferCollectionConstraintsResponder {
3472    fn drop(&mut self) {
3473        self.control_handle.shutdown();
3474        // Safety: drops once, never accessed again
3475        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3476    }
3477}
3478
3479impl fidl::endpoints::Responder for CoordinatorSetBufferCollectionConstraintsResponder {
3480    type ControlHandle = CoordinatorControlHandle;
3481
3482    fn control_handle(&self) -> &CoordinatorControlHandle {
3483        &self.control_handle
3484    }
3485
3486    fn drop_without_shutdown(mut self) {
3487        // Safety: drops once, never accessed again due to mem::forget
3488        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3489        // Prevent Drop from running (which would shut down the channel)
3490        std::mem::forget(self);
3491    }
3492}
3493
3494impl CoordinatorSetBufferCollectionConstraintsResponder {
3495    /// Sends a response to the FIDL transaction.
3496    ///
3497    /// Sets the channel to shutdown if an error occurs.
3498    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3499        let _result = self.send_raw(result);
3500        if _result.is_err() {
3501            self.control_handle.shutdown();
3502        }
3503        self.drop_without_shutdown();
3504        _result
3505    }
3506
3507    /// Similar to "send" but does not shutdown the channel if an error occurs.
3508    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3509        let _result = self.send_raw(result);
3510        self.drop_without_shutdown();
3511        _result
3512    }
3513
3514    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3515        self.control_handle
3516            .inner
3517            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
3518                result,
3519                self.tx_id,
3520                0x509a4ee9af6035df,
3521                fidl::encoding::DynamicFlags::empty(),
3522            )
3523    }
3524}
3525
3526#[must_use = "FIDL methods require a response to be sent"]
3527#[derive(Debug)]
3528pub struct CoordinatorIsCaptureSupportedResponder {
3529    control_handle: std::mem::ManuallyDrop<CoordinatorControlHandle>,
3530    tx_id: u32,
3531}
3532
3533/// Set the the channel to be shutdown (see [`CoordinatorControlHandle::shutdown`])
3534/// if the responder is dropped without sending a response, so that the client
3535/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3536impl std::ops::Drop for CoordinatorIsCaptureSupportedResponder {
3537    fn drop(&mut self) {
3538        self.control_handle.shutdown();
3539        // Safety: drops once, never accessed again
3540        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3541    }
3542}
3543
3544impl fidl::endpoints::Responder for CoordinatorIsCaptureSupportedResponder {
3545    type ControlHandle = CoordinatorControlHandle;
3546
3547    fn control_handle(&self) -> &CoordinatorControlHandle {
3548        &self.control_handle
3549    }
3550
3551    fn drop_without_shutdown(mut self) {
3552        // Safety: drops once, never accessed again due to mem::forget
3553        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3554        // Prevent Drop from running (which would shut down the channel)
3555        std::mem::forget(self);
3556    }
3557}
3558
3559impl CoordinatorIsCaptureSupportedResponder {
3560    /// Sends a response to the FIDL transaction.
3561    ///
3562    /// Sets the channel to shutdown if an error occurs.
3563    pub fn send(self, mut result: Result<bool, i32>) -> Result<(), fidl::Error> {
3564        let _result = self.send_raw(result);
3565        if _result.is_err() {
3566            self.control_handle.shutdown();
3567        }
3568        self.drop_without_shutdown();
3569        _result
3570    }
3571
3572    /// Similar to "send" but does not shutdown the channel if an error occurs.
3573    pub fn send_no_shutdown_on_err(self, mut result: Result<bool, i32>) -> Result<(), fidl::Error> {
3574        let _result = self.send_raw(result);
3575        self.drop_without_shutdown();
3576        _result
3577    }
3578
3579    fn send_raw(&self, mut result: Result<bool, i32>) -> Result<(), fidl::Error> {
3580        self.control_handle.inner.send::<fidl::encoding::ResultType<
3581            CoordinatorIsCaptureSupportedResponse,
3582            i32,
3583        >>(
3584            result.map(|supported| (supported,)),
3585            self.tx_id,
3586            0x4ca407277277971b,
3587            fidl::encoding::DynamicFlags::empty(),
3588        )
3589    }
3590}
3591
3592#[must_use = "FIDL methods require a response to be sent"]
3593#[derive(Debug)]
3594pub struct CoordinatorStartCaptureResponder {
3595    control_handle: std::mem::ManuallyDrop<CoordinatorControlHandle>,
3596    tx_id: u32,
3597}
3598
3599/// Set the the channel to be shutdown (see [`CoordinatorControlHandle::shutdown`])
3600/// if the responder is dropped without sending a response, so that the client
3601/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3602impl std::ops::Drop for CoordinatorStartCaptureResponder {
3603    fn drop(&mut self) {
3604        self.control_handle.shutdown();
3605        // Safety: drops once, never accessed again
3606        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3607    }
3608}
3609
3610impl fidl::endpoints::Responder for CoordinatorStartCaptureResponder {
3611    type ControlHandle = CoordinatorControlHandle;
3612
3613    fn control_handle(&self) -> &CoordinatorControlHandle {
3614        &self.control_handle
3615    }
3616
3617    fn drop_without_shutdown(mut self) {
3618        // Safety: drops once, never accessed again due to mem::forget
3619        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3620        // Prevent Drop from running (which would shut down the channel)
3621        std::mem::forget(self);
3622    }
3623}
3624
3625impl CoordinatorStartCaptureResponder {
3626    /// Sends a response to the FIDL transaction.
3627    ///
3628    /// Sets the channel to shutdown if an error occurs.
3629    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3630        let _result = self.send_raw(result);
3631        if _result.is_err() {
3632            self.control_handle.shutdown();
3633        }
3634        self.drop_without_shutdown();
3635        _result
3636    }
3637
3638    /// Similar to "send" but does not shutdown the channel if an error occurs.
3639    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3640        let _result = self.send_raw(result);
3641        self.drop_without_shutdown();
3642        _result
3643    }
3644
3645    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3646        self.control_handle
3647            .inner
3648            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
3649                result,
3650                self.tx_id,
3651                0x35cb38f19d96a8db,
3652                fidl::encoding::DynamicFlags::empty(),
3653            )
3654    }
3655}
3656
3657#[must_use = "FIDL methods require a response to be sent"]
3658#[derive(Debug)]
3659pub struct CoordinatorSetMinimumRgbResponder {
3660    control_handle: std::mem::ManuallyDrop<CoordinatorControlHandle>,
3661    tx_id: u32,
3662}
3663
3664/// Set the the channel to be shutdown (see [`CoordinatorControlHandle::shutdown`])
3665/// if the responder is dropped without sending a response, so that the client
3666/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3667impl std::ops::Drop for CoordinatorSetMinimumRgbResponder {
3668    fn drop(&mut self) {
3669        self.control_handle.shutdown();
3670        // Safety: drops once, never accessed again
3671        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3672    }
3673}
3674
3675impl fidl::endpoints::Responder for CoordinatorSetMinimumRgbResponder {
3676    type ControlHandle = CoordinatorControlHandle;
3677
3678    fn control_handle(&self) -> &CoordinatorControlHandle {
3679        &self.control_handle
3680    }
3681
3682    fn drop_without_shutdown(mut self) {
3683        // Safety: drops once, never accessed again due to mem::forget
3684        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3685        // Prevent Drop from running (which would shut down the channel)
3686        std::mem::forget(self);
3687    }
3688}
3689
3690impl CoordinatorSetMinimumRgbResponder {
3691    /// Sends a response to the FIDL transaction.
3692    ///
3693    /// Sets the channel to shutdown if an error occurs.
3694    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3695        let _result = self.send_raw(result);
3696        if _result.is_err() {
3697            self.control_handle.shutdown();
3698        }
3699        self.drop_without_shutdown();
3700        _result
3701    }
3702
3703    /// Similar to "send" but does not shutdown the channel if an error occurs.
3704    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3705        let _result = self.send_raw(result);
3706        self.drop_without_shutdown();
3707        _result
3708    }
3709
3710    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3711        self.control_handle
3712            .inner
3713            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
3714                result,
3715                self.tx_id,
3716                0x1b49251437038b0b,
3717                fidl::encoding::DynamicFlags::empty(),
3718            )
3719    }
3720}
3721
3722#[must_use = "FIDL methods require a response to be sent"]
3723#[derive(Debug)]
3724pub struct CoordinatorSetDisplayPowerModeResponder {
3725    control_handle: std::mem::ManuallyDrop<CoordinatorControlHandle>,
3726    tx_id: u32,
3727}
3728
3729/// Set the the channel to be shutdown (see [`CoordinatorControlHandle::shutdown`])
3730/// if the responder is dropped without sending a response, so that the client
3731/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3732impl std::ops::Drop for CoordinatorSetDisplayPowerModeResponder {
3733    fn drop(&mut self) {
3734        self.control_handle.shutdown();
3735        // Safety: drops once, never accessed again
3736        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3737    }
3738}
3739
3740impl fidl::endpoints::Responder for CoordinatorSetDisplayPowerModeResponder {
3741    type ControlHandle = CoordinatorControlHandle;
3742
3743    fn control_handle(&self) -> &CoordinatorControlHandle {
3744        &self.control_handle
3745    }
3746
3747    fn drop_without_shutdown(mut self) {
3748        // Safety: drops once, never accessed again due to mem::forget
3749        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3750        // Prevent Drop from running (which would shut down the channel)
3751        std::mem::forget(self);
3752    }
3753}
3754
3755impl CoordinatorSetDisplayPowerModeResponder {
3756    /// Sends a response to the FIDL transaction.
3757    ///
3758    /// Sets the channel to shutdown if an error occurs.
3759    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3760        let _result = self.send_raw(result);
3761        if _result.is_err() {
3762            self.control_handle.shutdown();
3763        }
3764        self.drop_without_shutdown();
3765        _result
3766    }
3767
3768    /// Similar to "send" but does not shutdown the channel if an error occurs.
3769    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3770        let _result = self.send_raw(result);
3771        self.drop_without_shutdown();
3772        _result
3773    }
3774
3775    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3776        self.control_handle
3777            .inner
3778            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
3779                result,
3780                self.tx_id,
3781                0xf4672f055072c92,
3782                fidl::encoding::DynamicFlags::empty(),
3783            )
3784    }
3785}
3786
3787#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
3788pub struct CoordinatorListenerMarker;
3789
3790impl fidl::endpoints::ProtocolMarker for CoordinatorListenerMarker {
3791    type Proxy = CoordinatorListenerProxy;
3792    type RequestStream = CoordinatorListenerRequestStream;
3793    #[cfg(target_os = "fuchsia")]
3794    type SynchronousProxy = CoordinatorListenerSynchronousProxy;
3795
3796    const DEBUG_NAME: &'static str = "(anonymous) CoordinatorListener";
3797}
3798
3799pub trait CoordinatorListenerProxyInterface: Send + Sync {
3800    fn r#on_displays_changed(
3801        &self,
3802        added: &[Info],
3803        removed: &[fidl_fuchsia_hardware_display_types::DisplayId],
3804    ) -> Result<(), fidl::Error>;
3805    fn r#on_vsync(
3806        &self,
3807        display_id: &fidl_fuchsia_hardware_display_types::DisplayId,
3808        timestamp: fidl::MonotonicInstant,
3809        applied_config_stamp: &ConfigStamp,
3810        cookie: &VsyncAckCookie,
3811    ) -> Result<(), fidl::Error>;
3812    fn r#on_client_ownership_change(&self, has_ownership: bool) -> Result<(), fidl::Error>;
3813}
3814#[derive(Debug)]
3815#[cfg(target_os = "fuchsia")]
3816pub struct CoordinatorListenerSynchronousProxy {
3817    client: fidl::client::sync::Client,
3818}
3819
3820#[cfg(target_os = "fuchsia")]
3821impl fidl::endpoints::SynchronousProxy for CoordinatorListenerSynchronousProxy {
3822    type Proxy = CoordinatorListenerProxy;
3823    type Protocol = CoordinatorListenerMarker;
3824
3825    fn from_channel(inner: fidl::Channel) -> Self {
3826        Self::new(inner)
3827    }
3828
3829    fn into_channel(self) -> fidl::Channel {
3830        self.client.into_channel()
3831    }
3832
3833    fn as_channel(&self) -> &fidl::Channel {
3834        self.client.as_channel()
3835    }
3836}
3837
3838#[cfg(target_os = "fuchsia")]
3839impl CoordinatorListenerSynchronousProxy {
3840    pub fn new(channel: fidl::Channel) -> Self {
3841        let protocol_name =
3842            <CoordinatorListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3843        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
3844    }
3845
3846    pub fn into_channel(self) -> fidl::Channel {
3847        self.client.into_channel()
3848    }
3849
3850    /// Waits until an event arrives and returns it. It is safe for other
3851    /// threads to make concurrent requests while waiting for an event.
3852    pub fn wait_for_event(
3853        &self,
3854        deadline: zx::MonotonicInstant,
3855    ) -> Result<CoordinatorListenerEvent, fidl::Error> {
3856        CoordinatorListenerEvent::decode(self.client.wait_for_event(deadline)?)
3857    }
3858
3859    /// Called when the set of connected displays changes.
3860    ///
3861    /// Also used to communicate the set of connected displays to a newly
3862    /// connected client.
3863    ///
3864    /// After this method is called, all applied and draft configurations may no
3865    /// longer be valid. The client must validate and apply a new configuration,
3866    /// by calling [`Coordinator.CheckConfig`] and [`Coordinator.ApplyConfig`].
3867    ///
3868    /// `added` and `removed` must not be both empty.
3869    pub fn r#on_displays_changed(
3870        &self,
3871        mut added: &[Info],
3872        mut removed: &[fidl_fuchsia_hardware_display_types::DisplayId],
3873    ) -> Result<(), fidl::Error> {
3874        self.client.send::<CoordinatorListenerOnDisplaysChangedRequest>(
3875            (added, removed),
3876            0x248fbe90c338a94f,
3877            fidl::encoding::DynamicFlags::empty(),
3878        )
3879    }
3880
3881    /// Called on every display Vertical Synchronization (Vsync).
3882    ///
3883    /// Clients must acknowledge VSync events via the method
3884    /// [`Coordinator.AcknowledgeVsync`].  The coordinator may throttle a client
3885    /// that accumulates a certain number of unacknowledged VSync cookies.
3886    /// Throttled clients do not receive VSync events.
3887    ///
3888    /// After a the client catches up on acknowledging cookies, the coordinator
3889    /// will unthrottle it (resume sending VSync events). Throttled clients may
3890    /// miss some VSync events, as the coordinator is allowed to drop VSync
3891    /// event information for throttled clients.
3892    ///
3893    /// When dropping VSync event information for throttled clients, the
3894    /// coordinator should prioritize retaining the information for newer
3895    /// events. In other words, the oldest unreported events should be dropped
3896    /// first.
3897    pub fn r#on_vsync(
3898        &self,
3899        mut display_id: &fidl_fuchsia_hardware_display_types::DisplayId,
3900        mut timestamp: fidl::MonotonicInstant,
3901        mut applied_config_stamp: &ConfigStamp,
3902        mut cookie: &VsyncAckCookie,
3903    ) -> Result<(), fidl::Error> {
3904        self.client.send::<CoordinatorListenerOnVsyncRequest>(
3905            (display_id, timestamp, applied_config_stamp, cookie),
3906            0x249e9b8da7a7ac47,
3907            fidl::encoding::DynamicFlags::empty(),
3908        )
3909    }
3910
3911    /// Called when the corresponding `Coordinator` client gains or loses
3912    /// ownership of the displays.
3913    ///
3914    /// A `Coordinator` client's active config is displayed iff it holds the
3915    /// ownership of the displays.
3916    ///
3917    /// A new `Coordinator` client should assume they do not have ownership
3918    /// of the displays until this method informs them otherwise.
3919    pub fn r#on_client_ownership_change(&self, mut has_ownership: bool) -> Result<(), fidl::Error> {
3920        self.client.send::<CoordinatorListenerOnClientOwnershipChangeRequest>(
3921            (has_ownership,),
3922            0x1acd2ae683153d5e,
3923            fidl::encoding::DynamicFlags::empty(),
3924        )
3925    }
3926}
3927
3928#[cfg(target_os = "fuchsia")]
3929impl From<CoordinatorListenerSynchronousProxy> for zx::Handle {
3930    fn from(value: CoordinatorListenerSynchronousProxy) -> Self {
3931        value.into_channel().into()
3932    }
3933}
3934
3935#[cfg(target_os = "fuchsia")]
3936impl From<fidl::Channel> for CoordinatorListenerSynchronousProxy {
3937    fn from(value: fidl::Channel) -> Self {
3938        Self::new(value)
3939    }
3940}
3941
3942#[cfg(target_os = "fuchsia")]
3943impl fidl::endpoints::FromClient for CoordinatorListenerSynchronousProxy {
3944    type Protocol = CoordinatorListenerMarker;
3945
3946    fn from_client(value: fidl::endpoints::ClientEnd<CoordinatorListenerMarker>) -> Self {
3947        Self::new(value.into_channel())
3948    }
3949}
3950
3951#[derive(Debug, Clone)]
3952pub struct CoordinatorListenerProxy {
3953    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
3954}
3955
3956impl fidl::endpoints::Proxy for CoordinatorListenerProxy {
3957    type Protocol = CoordinatorListenerMarker;
3958
3959    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
3960        Self::new(inner)
3961    }
3962
3963    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
3964        self.client.into_channel().map_err(|client| Self { client })
3965    }
3966
3967    fn as_channel(&self) -> &::fidl::AsyncChannel {
3968        self.client.as_channel()
3969    }
3970}
3971
3972impl CoordinatorListenerProxy {
3973    /// Create a new Proxy for fuchsia.hardware.display/CoordinatorListener.
3974    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
3975        let protocol_name =
3976            <CoordinatorListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3977        Self { client: fidl::client::Client::new(channel, protocol_name) }
3978    }
3979
3980    /// Get a Stream of events from the remote end of the protocol.
3981    ///
3982    /// # Panics
3983    ///
3984    /// Panics if the event stream was already taken.
3985    pub fn take_event_stream(&self) -> CoordinatorListenerEventStream {
3986        CoordinatorListenerEventStream { event_receiver: self.client.take_event_receiver() }
3987    }
3988
3989    /// Called when the set of connected displays changes.
3990    ///
3991    /// Also used to communicate the set of connected displays to a newly
3992    /// connected client.
3993    ///
3994    /// After this method is called, all applied and draft configurations may no
3995    /// longer be valid. The client must validate and apply a new configuration,
3996    /// by calling [`Coordinator.CheckConfig`] and [`Coordinator.ApplyConfig`].
3997    ///
3998    /// `added` and `removed` must not be both empty.
3999    pub fn r#on_displays_changed(
4000        &self,
4001        mut added: &[Info],
4002        mut removed: &[fidl_fuchsia_hardware_display_types::DisplayId],
4003    ) -> Result<(), fidl::Error> {
4004        CoordinatorListenerProxyInterface::r#on_displays_changed(self, added, removed)
4005    }
4006
4007    /// Called on every display Vertical Synchronization (Vsync).
4008    ///
4009    /// Clients must acknowledge VSync events via the method
4010    /// [`Coordinator.AcknowledgeVsync`].  The coordinator may throttle a client
4011    /// that accumulates a certain number of unacknowledged VSync cookies.
4012    /// Throttled clients do not receive VSync events.
4013    ///
4014    /// After a the client catches up on acknowledging cookies, the coordinator
4015    /// will unthrottle it (resume sending VSync events). Throttled clients may
4016    /// miss some VSync events, as the coordinator is allowed to drop VSync
4017    /// event information for throttled clients.
4018    ///
4019    /// When dropping VSync event information for throttled clients, the
4020    /// coordinator should prioritize retaining the information for newer
4021    /// events. In other words, the oldest unreported events should be dropped
4022    /// first.
4023    pub fn r#on_vsync(
4024        &self,
4025        mut display_id: &fidl_fuchsia_hardware_display_types::DisplayId,
4026        mut timestamp: fidl::MonotonicInstant,
4027        mut applied_config_stamp: &ConfigStamp,
4028        mut cookie: &VsyncAckCookie,
4029    ) -> Result<(), fidl::Error> {
4030        CoordinatorListenerProxyInterface::r#on_vsync(
4031            self,
4032            display_id,
4033            timestamp,
4034            applied_config_stamp,
4035            cookie,
4036        )
4037    }
4038
4039    /// Called when the corresponding `Coordinator` client gains or loses
4040    /// ownership of the displays.
4041    ///
4042    /// A `Coordinator` client's active config is displayed iff it holds the
4043    /// ownership of the displays.
4044    ///
4045    /// A new `Coordinator` client should assume they do not have ownership
4046    /// of the displays until this method informs them otherwise.
4047    pub fn r#on_client_ownership_change(&self, mut has_ownership: bool) -> Result<(), fidl::Error> {
4048        CoordinatorListenerProxyInterface::r#on_client_ownership_change(self, has_ownership)
4049    }
4050}
4051
4052impl CoordinatorListenerProxyInterface for CoordinatorListenerProxy {
4053    fn r#on_displays_changed(
4054        &self,
4055        mut added: &[Info],
4056        mut removed: &[fidl_fuchsia_hardware_display_types::DisplayId],
4057    ) -> Result<(), fidl::Error> {
4058        self.client.send::<CoordinatorListenerOnDisplaysChangedRequest>(
4059            (added, removed),
4060            0x248fbe90c338a94f,
4061            fidl::encoding::DynamicFlags::empty(),
4062        )
4063    }
4064
4065    fn r#on_vsync(
4066        &self,
4067        mut display_id: &fidl_fuchsia_hardware_display_types::DisplayId,
4068        mut timestamp: fidl::MonotonicInstant,
4069        mut applied_config_stamp: &ConfigStamp,
4070        mut cookie: &VsyncAckCookie,
4071    ) -> Result<(), fidl::Error> {
4072        self.client.send::<CoordinatorListenerOnVsyncRequest>(
4073            (display_id, timestamp, applied_config_stamp, cookie),
4074            0x249e9b8da7a7ac47,
4075            fidl::encoding::DynamicFlags::empty(),
4076        )
4077    }
4078
4079    fn r#on_client_ownership_change(&self, mut has_ownership: bool) -> Result<(), fidl::Error> {
4080        self.client.send::<CoordinatorListenerOnClientOwnershipChangeRequest>(
4081            (has_ownership,),
4082            0x1acd2ae683153d5e,
4083            fidl::encoding::DynamicFlags::empty(),
4084        )
4085    }
4086}
4087
4088pub struct CoordinatorListenerEventStream {
4089    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
4090}
4091
4092impl std::marker::Unpin for CoordinatorListenerEventStream {}
4093
4094impl futures::stream::FusedStream for CoordinatorListenerEventStream {
4095    fn is_terminated(&self) -> bool {
4096        self.event_receiver.is_terminated()
4097    }
4098}
4099
4100impl futures::Stream for CoordinatorListenerEventStream {
4101    type Item = Result<CoordinatorListenerEvent, fidl::Error>;
4102
4103    fn poll_next(
4104        mut self: std::pin::Pin<&mut Self>,
4105        cx: &mut std::task::Context<'_>,
4106    ) -> std::task::Poll<Option<Self::Item>> {
4107        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
4108            &mut self.event_receiver,
4109            cx
4110        )?) {
4111            Some(buf) => std::task::Poll::Ready(Some(CoordinatorListenerEvent::decode(buf))),
4112            None => std::task::Poll::Ready(None),
4113        }
4114    }
4115}
4116
4117#[derive(Debug)]
4118pub enum CoordinatorListenerEvent {
4119    #[non_exhaustive]
4120    _UnknownEvent {
4121        /// Ordinal of the event that was sent.
4122        ordinal: u64,
4123    },
4124}
4125
4126impl CoordinatorListenerEvent {
4127    /// Decodes a message buffer as a [`CoordinatorListenerEvent`].
4128    fn decode(
4129        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
4130    ) -> Result<CoordinatorListenerEvent, fidl::Error> {
4131        let (bytes, _handles) = buf.split_mut();
4132        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4133        debug_assert_eq!(tx_header.tx_id, 0);
4134        match tx_header.ordinal {
4135            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
4136                Ok(CoordinatorListenerEvent::_UnknownEvent { ordinal: tx_header.ordinal })
4137            }
4138            _ => Err(fidl::Error::UnknownOrdinal {
4139                ordinal: tx_header.ordinal,
4140                protocol_name:
4141                    <CoordinatorListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4142            }),
4143        }
4144    }
4145}
4146
4147/// A Stream of incoming requests for fuchsia.hardware.display/CoordinatorListener.
4148pub struct CoordinatorListenerRequestStream {
4149    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4150    is_terminated: bool,
4151}
4152
4153impl std::marker::Unpin for CoordinatorListenerRequestStream {}
4154
4155impl futures::stream::FusedStream for CoordinatorListenerRequestStream {
4156    fn is_terminated(&self) -> bool {
4157        self.is_terminated
4158    }
4159}
4160
4161impl fidl::endpoints::RequestStream for CoordinatorListenerRequestStream {
4162    type Protocol = CoordinatorListenerMarker;
4163    type ControlHandle = CoordinatorListenerControlHandle;
4164
4165    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
4166        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
4167    }
4168
4169    fn control_handle(&self) -> Self::ControlHandle {
4170        CoordinatorListenerControlHandle { inner: self.inner.clone() }
4171    }
4172
4173    fn into_inner(
4174        self,
4175    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
4176    {
4177        (self.inner, self.is_terminated)
4178    }
4179
4180    fn from_inner(
4181        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4182        is_terminated: bool,
4183    ) -> Self {
4184        Self { inner, is_terminated }
4185    }
4186}
4187
4188impl futures::Stream for CoordinatorListenerRequestStream {
4189    type Item = Result<CoordinatorListenerRequest, fidl::Error>;
4190
4191    fn poll_next(
4192        mut self: std::pin::Pin<&mut Self>,
4193        cx: &mut std::task::Context<'_>,
4194    ) -> std::task::Poll<Option<Self::Item>> {
4195        let this = &mut *self;
4196        if this.inner.check_shutdown(cx) {
4197            this.is_terminated = true;
4198            return std::task::Poll::Ready(None);
4199        }
4200        if this.is_terminated {
4201            panic!("polled CoordinatorListenerRequestStream after completion");
4202        }
4203        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
4204            |bytes, handles| {
4205                match this.inner.channel().read_etc(cx, bytes, handles) {
4206                    std::task::Poll::Ready(Ok(())) => {}
4207                    std::task::Poll::Pending => return std::task::Poll::Pending,
4208                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
4209                        this.is_terminated = true;
4210                        return std::task::Poll::Ready(None);
4211                    }
4212                    std::task::Poll::Ready(Err(e)) => {
4213                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
4214                            e.into(),
4215                        ))));
4216                    }
4217                }
4218
4219                // A message has been received from the channel
4220                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4221
4222                std::task::Poll::Ready(Some(match header.ordinal {
4223                0x248fbe90c338a94f => {
4224                    header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4225                    let mut req = fidl::new_empty!(CoordinatorListenerOnDisplaysChangedRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
4226                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CoordinatorListenerOnDisplaysChangedRequest>(&header, _body_bytes, handles, &mut req)?;
4227                    let control_handle = CoordinatorListenerControlHandle {
4228                        inner: this.inner.clone(),
4229                    };
4230                    Ok(CoordinatorListenerRequest::OnDisplaysChanged {added: req.added,
4231removed: req.removed,
4232
4233                        control_handle,
4234                    })
4235                }
4236                0x249e9b8da7a7ac47 => {
4237                    header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4238                    let mut req = fidl::new_empty!(CoordinatorListenerOnVsyncRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
4239                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CoordinatorListenerOnVsyncRequest>(&header, _body_bytes, handles, &mut req)?;
4240                    let control_handle = CoordinatorListenerControlHandle {
4241                        inner: this.inner.clone(),
4242                    };
4243                    Ok(CoordinatorListenerRequest::OnVsync {display_id: req.display_id,
4244timestamp: req.timestamp,
4245applied_config_stamp: req.applied_config_stamp,
4246cookie: req.cookie,
4247
4248                        control_handle,
4249                    })
4250                }
4251                0x1acd2ae683153d5e => {
4252                    header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4253                    let mut req = fidl::new_empty!(CoordinatorListenerOnClientOwnershipChangeRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
4254                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CoordinatorListenerOnClientOwnershipChangeRequest>(&header, _body_bytes, handles, &mut req)?;
4255                    let control_handle = CoordinatorListenerControlHandle {
4256                        inner: this.inner.clone(),
4257                    };
4258                    Ok(CoordinatorListenerRequest::OnClientOwnershipChange {has_ownership: req.has_ownership,
4259
4260                        control_handle,
4261                    })
4262                }
4263                _ if header.tx_id == 0 && header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
4264                    Ok(CoordinatorListenerRequest::_UnknownMethod {
4265                        ordinal: header.ordinal,
4266                        control_handle: CoordinatorListenerControlHandle { inner: this.inner.clone() },
4267                        method_type: fidl::MethodType::OneWay,
4268                    })
4269                }
4270                _ if header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
4271                    this.inner.send_framework_err(
4272                        fidl::encoding::FrameworkErr::UnknownMethod,
4273                        header.tx_id,
4274                        header.ordinal,
4275                        header.dynamic_flags(),
4276                        (bytes, handles),
4277                    )?;
4278                    Ok(CoordinatorListenerRequest::_UnknownMethod {
4279                        ordinal: header.ordinal,
4280                        control_handle: CoordinatorListenerControlHandle { inner: this.inner.clone() },
4281                        method_type: fidl::MethodType::TwoWay,
4282                    })
4283                }
4284                _ => Err(fidl::Error::UnknownOrdinal {
4285                    ordinal: header.ordinal,
4286                    protocol_name: <CoordinatorListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4287                }),
4288            }))
4289            },
4290        )
4291    }
4292}
4293
4294/// Provides updates from a `Coordinator` to one of its clients.
4295///
4296/// This protocol solely consists of one-way methods.
4297#[derive(Debug)]
4298pub enum CoordinatorListenerRequest {
4299    /// Called when the set of connected displays changes.
4300    ///
4301    /// Also used to communicate the set of connected displays to a newly
4302    /// connected client.
4303    ///
4304    /// After this method is called, all applied and draft configurations may no
4305    /// longer be valid. The client must validate and apply a new configuration,
4306    /// by calling [`Coordinator.CheckConfig`] and [`Coordinator.ApplyConfig`].
4307    ///
4308    /// `added` and `removed` must not be both empty.
4309    OnDisplaysChanged {
4310        added: Vec<Info>,
4311        removed: Vec<fidl_fuchsia_hardware_display_types::DisplayId>,
4312        control_handle: CoordinatorListenerControlHandle,
4313    },
4314    /// Called on every display Vertical Synchronization (Vsync).
4315    ///
4316    /// Clients must acknowledge VSync events via the method
4317    /// [`Coordinator.AcknowledgeVsync`].  The coordinator may throttle a client
4318    /// that accumulates a certain number of unacknowledged VSync cookies.
4319    /// Throttled clients do not receive VSync events.
4320    ///
4321    /// After a the client catches up on acknowledging cookies, the coordinator
4322    /// will unthrottle it (resume sending VSync events). Throttled clients may
4323    /// miss some VSync events, as the coordinator is allowed to drop VSync
4324    /// event information for throttled clients.
4325    ///
4326    /// When dropping VSync event information for throttled clients, the
4327    /// coordinator should prioritize retaining the information for newer
4328    /// events. In other words, the oldest unreported events should be dropped
4329    /// first.
4330    OnVsync {
4331        display_id: fidl_fuchsia_hardware_display_types::DisplayId,
4332        timestamp: fidl::MonotonicInstant,
4333        applied_config_stamp: ConfigStamp,
4334        cookie: VsyncAckCookie,
4335        control_handle: CoordinatorListenerControlHandle,
4336    },
4337    /// Called when the corresponding `Coordinator` client gains or loses
4338    /// ownership of the displays.
4339    ///
4340    /// A `Coordinator` client's active config is displayed iff it holds the
4341    /// ownership of the displays.
4342    ///
4343    /// A new `Coordinator` client should assume they do not have ownership
4344    /// of the displays until this method informs them otherwise.
4345    OnClientOwnershipChange {
4346        has_ownership: bool,
4347        control_handle: CoordinatorListenerControlHandle,
4348    },
4349    /// An interaction was received which does not match any known method.
4350    #[non_exhaustive]
4351    _UnknownMethod {
4352        /// Ordinal of the method that was called.
4353        ordinal: u64,
4354        control_handle: CoordinatorListenerControlHandle,
4355        method_type: fidl::MethodType,
4356    },
4357}
4358
4359impl CoordinatorListenerRequest {
4360    #[allow(irrefutable_let_patterns)]
4361    pub fn into_on_displays_changed(
4362        self,
4363    ) -> Option<(
4364        Vec<Info>,
4365        Vec<fidl_fuchsia_hardware_display_types::DisplayId>,
4366        CoordinatorListenerControlHandle,
4367    )> {
4368        if let CoordinatorListenerRequest::OnDisplaysChanged { added, removed, control_handle } =
4369            self
4370        {
4371            Some((added, removed, control_handle))
4372        } else {
4373            None
4374        }
4375    }
4376
4377    #[allow(irrefutable_let_patterns)]
4378    pub fn into_on_vsync(
4379        self,
4380    ) -> Option<(
4381        fidl_fuchsia_hardware_display_types::DisplayId,
4382        fidl::MonotonicInstant,
4383        ConfigStamp,
4384        VsyncAckCookie,
4385        CoordinatorListenerControlHandle,
4386    )> {
4387        if let CoordinatorListenerRequest::OnVsync {
4388            display_id,
4389            timestamp,
4390            applied_config_stamp,
4391            cookie,
4392            control_handle,
4393        } = self
4394        {
4395            Some((display_id, timestamp, applied_config_stamp, cookie, control_handle))
4396        } else {
4397            None
4398        }
4399    }
4400
4401    #[allow(irrefutable_let_patterns)]
4402    pub fn into_on_client_ownership_change(
4403        self,
4404    ) -> Option<(bool, CoordinatorListenerControlHandle)> {
4405        if let CoordinatorListenerRequest::OnClientOwnershipChange {
4406            has_ownership,
4407            control_handle,
4408        } = self
4409        {
4410            Some((has_ownership, control_handle))
4411        } else {
4412            None
4413        }
4414    }
4415
4416    /// Name of the method defined in FIDL
4417    pub fn method_name(&self) -> &'static str {
4418        match *self {
4419            CoordinatorListenerRequest::OnDisplaysChanged { .. } => "on_displays_changed",
4420            CoordinatorListenerRequest::OnVsync { .. } => "on_vsync",
4421            CoordinatorListenerRequest::OnClientOwnershipChange { .. } => {
4422                "on_client_ownership_change"
4423            }
4424            CoordinatorListenerRequest::_UnknownMethod {
4425                method_type: fidl::MethodType::OneWay,
4426                ..
4427            } => "unknown one-way method",
4428            CoordinatorListenerRequest::_UnknownMethod {
4429                method_type: fidl::MethodType::TwoWay,
4430                ..
4431            } => "unknown two-way method",
4432        }
4433    }
4434}
4435
4436#[derive(Debug, Clone)]
4437pub struct CoordinatorListenerControlHandle {
4438    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4439}
4440
4441impl fidl::endpoints::ControlHandle for CoordinatorListenerControlHandle {
4442    fn shutdown(&self) {
4443        self.inner.shutdown()
4444    }
4445    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
4446        self.inner.shutdown_with_epitaph(status)
4447    }
4448
4449    fn is_closed(&self) -> bool {
4450        self.inner.channel().is_closed()
4451    }
4452    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
4453        self.inner.channel().on_closed()
4454    }
4455
4456    #[cfg(target_os = "fuchsia")]
4457    fn signal_peer(
4458        &self,
4459        clear_mask: zx::Signals,
4460        set_mask: zx::Signals,
4461    ) -> Result<(), zx_status::Status> {
4462        use fidl::Peered;
4463        self.inner.channel().signal_peer(clear_mask, set_mask)
4464    }
4465}
4466
4467impl CoordinatorListenerControlHandle {}
4468
4469#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
4470pub struct ProviderMarker;
4471
4472impl fidl::endpoints::ProtocolMarker for ProviderMarker {
4473    type Proxy = ProviderProxy;
4474    type RequestStream = ProviderRequestStream;
4475    #[cfg(target_os = "fuchsia")]
4476    type SynchronousProxy = ProviderSynchronousProxy;
4477
4478    const DEBUG_NAME: &'static str = "fuchsia.hardware.display.Provider";
4479}
4480impl fidl::endpoints::DiscoverableProtocolMarker for ProviderMarker {}
4481pub type ProviderOpenCoordinatorWithListenerForVirtconResult = Result<(), i32>;
4482pub type ProviderOpenCoordinatorWithListenerForPrimaryResult = Result<(), i32>;
4483
4484pub trait ProviderProxyInterface: Send + Sync {
4485    type OpenCoordinatorWithListenerForVirtconResponseFut: std::future::Future<
4486            Output = Result<ProviderOpenCoordinatorWithListenerForVirtconResult, fidl::Error>,
4487        > + Send;
4488    fn r#open_coordinator_with_listener_for_virtcon(
4489        &self,
4490        payload: ProviderOpenCoordinatorWithListenerForVirtconRequest,
4491    ) -> Self::OpenCoordinatorWithListenerForVirtconResponseFut;
4492    type OpenCoordinatorWithListenerForPrimaryResponseFut: std::future::Future<
4493            Output = Result<ProviderOpenCoordinatorWithListenerForPrimaryResult, fidl::Error>,
4494        > + Send;
4495    fn r#open_coordinator_with_listener_for_primary(
4496        &self,
4497        payload: ProviderOpenCoordinatorWithListenerForPrimaryRequest,
4498    ) -> Self::OpenCoordinatorWithListenerForPrimaryResponseFut;
4499}
4500#[derive(Debug)]
4501#[cfg(target_os = "fuchsia")]
4502pub struct ProviderSynchronousProxy {
4503    client: fidl::client::sync::Client,
4504}
4505
4506#[cfg(target_os = "fuchsia")]
4507impl fidl::endpoints::SynchronousProxy for ProviderSynchronousProxy {
4508    type Proxy = ProviderProxy;
4509    type Protocol = ProviderMarker;
4510
4511    fn from_channel(inner: fidl::Channel) -> Self {
4512        Self::new(inner)
4513    }
4514
4515    fn into_channel(self) -> fidl::Channel {
4516        self.client.into_channel()
4517    }
4518
4519    fn as_channel(&self) -> &fidl::Channel {
4520        self.client.as_channel()
4521    }
4522}
4523
4524#[cfg(target_os = "fuchsia")]
4525impl ProviderSynchronousProxy {
4526    pub fn new(channel: fidl::Channel) -> Self {
4527        let protocol_name = <ProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4528        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
4529    }
4530
4531    pub fn into_channel(self) -> fidl::Channel {
4532        self.client.into_channel()
4533    }
4534
4535    /// Waits until an event arrives and returns it. It is safe for other
4536    /// threads to make concurrent requests while waiting for an event.
4537    pub fn wait_for_event(
4538        &self,
4539        deadline: zx::MonotonicInstant,
4540    ) -> Result<ProviderEvent, fidl::Error> {
4541        ProviderEvent::decode(self.client.wait_for_event(deadline)?)
4542    }
4543
4544    /// Opens a Virtcon client connection to the display coordinator.
4545    ///
4546    /// On success, `coordinator` and `coordinator_listener` will be bound to
4547    /// the display coordinator, as the Virtcon client.
4548    ///
4549    /// No event will be dispatched to the `Coordinator` protocol.
4550    ///
4551    /// Returns `ZX_ERR_ALREADY_BOUND` if the display coordinator already has a
4552    /// connected Virtcon client.
4553    pub fn r#open_coordinator_with_listener_for_virtcon(
4554        &self,
4555        mut payload: ProviderOpenCoordinatorWithListenerForVirtconRequest,
4556        ___deadline: zx::MonotonicInstant,
4557    ) -> Result<ProviderOpenCoordinatorWithListenerForVirtconResult, fidl::Error> {
4558        let _response = self.client.send_query::<
4559            ProviderOpenCoordinatorWithListenerForVirtconRequest,
4560            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
4561        >(
4562            &mut payload,
4563            0x154ac672633d9ec7,
4564            fidl::encoding::DynamicFlags::empty(),
4565            ___deadline,
4566        )?;
4567        Ok(_response.map(|x| x))
4568    }
4569
4570    /// Opens a primary client connection to the display coordinator.
4571    ///
4572    /// On success, `coordinator` and `coordinator_listener` will be bound to
4573    /// the display coordinator, as the primary client.
4574    ///
4575    /// No event will be dispatched to the `Coordinator` protocol.
4576    ///
4577    /// Returns `ZX_ERR_ALREADY_BOUND` if the display coordinator already has a
4578    /// connected primary client.
4579    pub fn r#open_coordinator_with_listener_for_primary(
4580        &self,
4581        mut payload: ProviderOpenCoordinatorWithListenerForPrimaryRequest,
4582        ___deadline: zx::MonotonicInstant,
4583    ) -> Result<ProviderOpenCoordinatorWithListenerForPrimaryResult, fidl::Error> {
4584        let _response = self.client.send_query::<
4585            ProviderOpenCoordinatorWithListenerForPrimaryRequest,
4586            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
4587        >(
4588            &mut payload,
4589            0x635b6087ce4f6bfa,
4590            fidl::encoding::DynamicFlags::empty(),
4591            ___deadline,
4592        )?;
4593        Ok(_response.map(|x| x))
4594    }
4595}
4596
4597#[cfg(target_os = "fuchsia")]
4598impl From<ProviderSynchronousProxy> for zx::Handle {
4599    fn from(value: ProviderSynchronousProxy) -> Self {
4600        value.into_channel().into()
4601    }
4602}
4603
4604#[cfg(target_os = "fuchsia")]
4605impl From<fidl::Channel> for ProviderSynchronousProxy {
4606    fn from(value: fidl::Channel) -> Self {
4607        Self::new(value)
4608    }
4609}
4610
4611#[cfg(target_os = "fuchsia")]
4612impl fidl::endpoints::FromClient for ProviderSynchronousProxy {
4613    type Protocol = ProviderMarker;
4614
4615    fn from_client(value: fidl::endpoints::ClientEnd<ProviderMarker>) -> Self {
4616        Self::new(value.into_channel())
4617    }
4618}
4619
4620#[derive(Debug, Clone)]
4621pub struct ProviderProxy {
4622    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
4623}
4624
4625impl fidl::endpoints::Proxy for ProviderProxy {
4626    type Protocol = ProviderMarker;
4627
4628    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
4629        Self::new(inner)
4630    }
4631
4632    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
4633        self.client.into_channel().map_err(|client| Self { client })
4634    }
4635
4636    fn as_channel(&self) -> &::fidl::AsyncChannel {
4637        self.client.as_channel()
4638    }
4639}
4640
4641impl ProviderProxy {
4642    /// Create a new Proxy for fuchsia.hardware.display/Provider.
4643    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
4644        let protocol_name = <ProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4645        Self { client: fidl::client::Client::new(channel, protocol_name) }
4646    }
4647
4648    /// Get a Stream of events from the remote end of the protocol.
4649    ///
4650    /// # Panics
4651    ///
4652    /// Panics if the event stream was already taken.
4653    pub fn take_event_stream(&self) -> ProviderEventStream {
4654        ProviderEventStream { event_receiver: self.client.take_event_receiver() }
4655    }
4656
4657    /// Opens a Virtcon client connection to the display coordinator.
4658    ///
4659    /// On success, `coordinator` and `coordinator_listener` will be bound to
4660    /// the display coordinator, as the Virtcon client.
4661    ///
4662    /// No event will be dispatched to the `Coordinator` protocol.
4663    ///
4664    /// Returns `ZX_ERR_ALREADY_BOUND` if the display coordinator already has a
4665    /// connected Virtcon client.
4666    pub fn r#open_coordinator_with_listener_for_virtcon(
4667        &self,
4668        mut payload: ProviderOpenCoordinatorWithListenerForVirtconRequest,
4669    ) -> fidl::client::QueryResponseFut<
4670        ProviderOpenCoordinatorWithListenerForVirtconResult,
4671        fidl::encoding::DefaultFuchsiaResourceDialect,
4672    > {
4673        ProviderProxyInterface::r#open_coordinator_with_listener_for_virtcon(self, payload)
4674    }
4675
4676    /// Opens a primary client connection to the display coordinator.
4677    ///
4678    /// On success, `coordinator` and `coordinator_listener` will be bound to
4679    /// the display coordinator, as the primary client.
4680    ///
4681    /// No event will be dispatched to the `Coordinator` protocol.
4682    ///
4683    /// Returns `ZX_ERR_ALREADY_BOUND` if the display coordinator already has a
4684    /// connected primary client.
4685    pub fn r#open_coordinator_with_listener_for_primary(
4686        &self,
4687        mut payload: ProviderOpenCoordinatorWithListenerForPrimaryRequest,
4688    ) -> fidl::client::QueryResponseFut<
4689        ProviderOpenCoordinatorWithListenerForPrimaryResult,
4690        fidl::encoding::DefaultFuchsiaResourceDialect,
4691    > {
4692        ProviderProxyInterface::r#open_coordinator_with_listener_for_primary(self, payload)
4693    }
4694}
4695
4696impl ProviderProxyInterface for ProviderProxy {
4697    type OpenCoordinatorWithListenerForVirtconResponseFut = fidl::client::QueryResponseFut<
4698        ProviderOpenCoordinatorWithListenerForVirtconResult,
4699        fidl::encoding::DefaultFuchsiaResourceDialect,
4700    >;
4701    fn r#open_coordinator_with_listener_for_virtcon(
4702        &self,
4703        mut payload: ProviderOpenCoordinatorWithListenerForVirtconRequest,
4704    ) -> Self::OpenCoordinatorWithListenerForVirtconResponseFut {
4705        fn _decode(
4706            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4707        ) -> Result<ProviderOpenCoordinatorWithListenerForVirtconResult, fidl::Error> {
4708            let _response = fidl::client::decode_transaction_body::<
4709                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
4710                fidl::encoding::DefaultFuchsiaResourceDialect,
4711                0x154ac672633d9ec7,
4712            >(_buf?)?;
4713            Ok(_response.map(|x| x))
4714        }
4715        self.client.send_query_and_decode::<
4716            ProviderOpenCoordinatorWithListenerForVirtconRequest,
4717            ProviderOpenCoordinatorWithListenerForVirtconResult,
4718        >(
4719            &mut payload,
4720            0x154ac672633d9ec7,
4721            fidl::encoding::DynamicFlags::empty(),
4722            _decode,
4723        )
4724    }
4725
4726    type OpenCoordinatorWithListenerForPrimaryResponseFut = fidl::client::QueryResponseFut<
4727        ProviderOpenCoordinatorWithListenerForPrimaryResult,
4728        fidl::encoding::DefaultFuchsiaResourceDialect,
4729    >;
4730    fn r#open_coordinator_with_listener_for_primary(
4731        &self,
4732        mut payload: ProviderOpenCoordinatorWithListenerForPrimaryRequest,
4733    ) -> Self::OpenCoordinatorWithListenerForPrimaryResponseFut {
4734        fn _decode(
4735            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4736        ) -> Result<ProviderOpenCoordinatorWithListenerForPrimaryResult, fidl::Error> {
4737            let _response = fidl::client::decode_transaction_body::<
4738                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
4739                fidl::encoding::DefaultFuchsiaResourceDialect,
4740                0x635b6087ce4f6bfa,
4741            >(_buf?)?;
4742            Ok(_response.map(|x| x))
4743        }
4744        self.client.send_query_and_decode::<
4745            ProviderOpenCoordinatorWithListenerForPrimaryRequest,
4746            ProviderOpenCoordinatorWithListenerForPrimaryResult,
4747        >(
4748            &mut payload,
4749            0x635b6087ce4f6bfa,
4750            fidl::encoding::DynamicFlags::empty(),
4751            _decode,
4752        )
4753    }
4754}
4755
4756pub struct ProviderEventStream {
4757    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
4758}
4759
4760impl std::marker::Unpin for ProviderEventStream {}
4761
4762impl futures::stream::FusedStream for ProviderEventStream {
4763    fn is_terminated(&self) -> bool {
4764        self.event_receiver.is_terminated()
4765    }
4766}
4767
4768impl futures::Stream for ProviderEventStream {
4769    type Item = Result<ProviderEvent, fidl::Error>;
4770
4771    fn poll_next(
4772        mut self: std::pin::Pin<&mut Self>,
4773        cx: &mut std::task::Context<'_>,
4774    ) -> std::task::Poll<Option<Self::Item>> {
4775        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
4776            &mut self.event_receiver,
4777            cx
4778        )?) {
4779            Some(buf) => std::task::Poll::Ready(Some(ProviderEvent::decode(buf))),
4780            None => std::task::Poll::Ready(None),
4781        }
4782    }
4783}
4784
4785#[derive(Debug)]
4786pub enum ProviderEvent {}
4787
4788impl ProviderEvent {
4789    /// Decodes a message buffer as a [`ProviderEvent`].
4790    fn decode(
4791        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
4792    ) -> Result<ProviderEvent, fidl::Error> {
4793        let (bytes, _handles) = buf.split_mut();
4794        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4795        debug_assert_eq!(tx_header.tx_id, 0);
4796        match tx_header.ordinal {
4797            _ => Err(fidl::Error::UnknownOrdinal {
4798                ordinal: tx_header.ordinal,
4799                protocol_name: <ProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4800            }),
4801        }
4802    }
4803}
4804
4805/// A Stream of incoming requests for fuchsia.hardware.display/Provider.
4806pub struct ProviderRequestStream {
4807    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4808    is_terminated: bool,
4809}
4810
4811impl std::marker::Unpin for ProviderRequestStream {}
4812
4813impl futures::stream::FusedStream for ProviderRequestStream {
4814    fn is_terminated(&self) -> bool {
4815        self.is_terminated
4816    }
4817}
4818
4819impl fidl::endpoints::RequestStream for ProviderRequestStream {
4820    type Protocol = ProviderMarker;
4821    type ControlHandle = ProviderControlHandle;
4822
4823    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
4824        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
4825    }
4826
4827    fn control_handle(&self) -> Self::ControlHandle {
4828        ProviderControlHandle { inner: self.inner.clone() }
4829    }
4830
4831    fn into_inner(
4832        self,
4833    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
4834    {
4835        (self.inner, self.is_terminated)
4836    }
4837
4838    fn from_inner(
4839        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4840        is_terminated: bool,
4841    ) -> Self {
4842        Self { inner, is_terminated }
4843    }
4844}
4845
4846impl futures::Stream for ProviderRequestStream {
4847    type Item = Result<ProviderRequest, fidl::Error>;
4848
4849    fn poll_next(
4850        mut self: std::pin::Pin<&mut Self>,
4851        cx: &mut std::task::Context<'_>,
4852    ) -> std::task::Poll<Option<Self::Item>> {
4853        let this = &mut *self;
4854        if this.inner.check_shutdown(cx) {
4855            this.is_terminated = true;
4856            return std::task::Poll::Ready(None);
4857        }
4858        if this.is_terminated {
4859            panic!("polled ProviderRequestStream after completion");
4860        }
4861        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
4862            |bytes, handles| {
4863                match this.inner.channel().read_etc(cx, bytes, handles) {
4864                    std::task::Poll::Ready(Ok(())) => {}
4865                    std::task::Poll::Pending => return std::task::Poll::Pending,
4866                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
4867                        this.is_terminated = true;
4868                        return std::task::Poll::Ready(None);
4869                    }
4870                    std::task::Poll::Ready(Err(e)) => {
4871                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
4872                            e.into(),
4873                        ))));
4874                    }
4875                }
4876
4877                // A message has been received from the channel
4878                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4879
4880                std::task::Poll::Ready(Some(match header.ordinal {
4881                    0x154ac672633d9ec7 => {
4882                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4883                        let mut req = fidl::new_empty!(
4884                            ProviderOpenCoordinatorWithListenerForVirtconRequest,
4885                            fidl::encoding::DefaultFuchsiaResourceDialect
4886                        );
4887                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ProviderOpenCoordinatorWithListenerForVirtconRequest>(&header, _body_bytes, handles, &mut req)?;
4888                        let control_handle = ProviderControlHandle { inner: this.inner.clone() };
4889                        Ok(ProviderRequest::OpenCoordinatorWithListenerForVirtcon {
4890                            payload: req,
4891                            responder: ProviderOpenCoordinatorWithListenerForVirtconResponder {
4892                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4893                                tx_id: header.tx_id,
4894                            },
4895                        })
4896                    }
4897                    0x635b6087ce4f6bfa => {
4898                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4899                        let mut req = fidl::new_empty!(
4900                            ProviderOpenCoordinatorWithListenerForPrimaryRequest,
4901                            fidl::encoding::DefaultFuchsiaResourceDialect
4902                        );
4903                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ProviderOpenCoordinatorWithListenerForPrimaryRequest>(&header, _body_bytes, handles, &mut req)?;
4904                        let control_handle = ProviderControlHandle { inner: this.inner.clone() };
4905                        Ok(ProviderRequest::OpenCoordinatorWithListenerForPrimary {
4906                            payload: req,
4907                            responder: ProviderOpenCoordinatorWithListenerForPrimaryResponder {
4908                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4909                                tx_id: header.tx_id,
4910                            },
4911                        })
4912                    }
4913                    _ => Err(fidl::Error::UnknownOrdinal {
4914                        ordinal: header.ordinal,
4915                        protocol_name:
4916                            <ProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4917                    }),
4918                }))
4919            },
4920        )
4921    }
4922}
4923
4924/// Provider for display coordinators.
4925///
4926/// The driver supports two simultaneous clients - a main client and a virtcon
4927/// client.  In some cases, the provider service may provide access to only one or
4928/// the other; if the client tries to open the other then `ZX_ERR_NOT_SUPPORTED` will
4929/// be returned.
4930#[derive(Debug)]
4931pub enum ProviderRequest {
4932    /// Opens a Virtcon client connection to the display coordinator.
4933    ///
4934    /// On success, `coordinator` and `coordinator_listener` will be bound to
4935    /// the display coordinator, as the Virtcon client.
4936    ///
4937    /// No event will be dispatched to the `Coordinator` protocol.
4938    ///
4939    /// Returns `ZX_ERR_ALREADY_BOUND` if the display coordinator already has a
4940    /// connected Virtcon client.
4941    OpenCoordinatorWithListenerForVirtcon {
4942        payload: ProviderOpenCoordinatorWithListenerForVirtconRequest,
4943        responder: ProviderOpenCoordinatorWithListenerForVirtconResponder,
4944    },
4945    /// Opens a primary client connection to the display coordinator.
4946    ///
4947    /// On success, `coordinator` and `coordinator_listener` will be bound to
4948    /// the display coordinator, as the primary client.
4949    ///
4950    /// No event will be dispatched to the `Coordinator` protocol.
4951    ///
4952    /// Returns `ZX_ERR_ALREADY_BOUND` if the display coordinator already has a
4953    /// connected primary client.
4954    OpenCoordinatorWithListenerForPrimary {
4955        payload: ProviderOpenCoordinatorWithListenerForPrimaryRequest,
4956        responder: ProviderOpenCoordinatorWithListenerForPrimaryResponder,
4957    },
4958}
4959
4960impl ProviderRequest {
4961    #[allow(irrefutable_let_patterns)]
4962    pub fn into_open_coordinator_with_listener_for_virtcon(
4963        self,
4964    ) -> Option<(
4965        ProviderOpenCoordinatorWithListenerForVirtconRequest,
4966        ProviderOpenCoordinatorWithListenerForVirtconResponder,
4967    )> {
4968        if let ProviderRequest::OpenCoordinatorWithListenerForVirtcon { payload, responder } = self
4969        {
4970            Some((payload, responder))
4971        } else {
4972            None
4973        }
4974    }
4975
4976    #[allow(irrefutable_let_patterns)]
4977    pub fn into_open_coordinator_with_listener_for_primary(
4978        self,
4979    ) -> Option<(
4980        ProviderOpenCoordinatorWithListenerForPrimaryRequest,
4981        ProviderOpenCoordinatorWithListenerForPrimaryResponder,
4982    )> {
4983        if let ProviderRequest::OpenCoordinatorWithListenerForPrimary { payload, responder } = self
4984        {
4985            Some((payload, responder))
4986        } else {
4987            None
4988        }
4989    }
4990
4991    /// Name of the method defined in FIDL
4992    pub fn method_name(&self) -> &'static str {
4993        match *self {
4994            ProviderRequest::OpenCoordinatorWithListenerForVirtcon { .. } => {
4995                "open_coordinator_with_listener_for_virtcon"
4996            }
4997            ProviderRequest::OpenCoordinatorWithListenerForPrimary { .. } => {
4998                "open_coordinator_with_listener_for_primary"
4999            }
5000        }
5001    }
5002}
5003
5004#[derive(Debug, Clone)]
5005pub struct ProviderControlHandle {
5006    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5007}
5008
5009impl fidl::endpoints::ControlHandle for ProviderControlHandle {
5010    fn shutdown(&self) {
5011        self.inner.shutdown()
5012    }
5013    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
5014        self.inner.shutdown_with_epitaph(status)
5015    }
5016
5017    fn is_closed(&self) -> bool {
5018        self.inner.channel().is_closed()
5019    }
5020    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
5021        self.inner.channel().on_closed()
5022    }
5023
5024    #[cfg(target_os = "fuchsia")]
5025    fn signal_peer(
5026        &self,
5027        clear_mask: zx::Signals,
5028        set_mask: zx::Signals,
5029    ) -> Result<(), zx_status::Status> {
5030        use fidl::Peered;
5031        self.inner.channel().signal_peer(clear_mask, set_mask)
5032    }
5033}
5034
5035impl ProviderControlHandle {}
5036
5037#[must_use = "FIDL methods require a response to be sent"]
5038#[derive(Debug)]
5039pub struct ProviderOpenCoordinatorWithListenerForVirtconResponder {
5040    control_handle: std::mem::ManuallyDrop<ProviderControlHandle>,
5041    tx_id: u32,
5042}
5043
5044/// Set the the channel to be shutdown (see [`ProviderControlHandle::shutdown`])
5045/// if the responder is dropped without sending a response, so that the client
5046/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5047impl std::ops::Drop for ProviderOpenCoordinatorWithListenerForVirtconResponder {
5048    fn drop(&mut self) {
5049        self.control_handle.shutdown();
5050        // Safety: drops once, never accessed again
5051        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5052    }
5053}
5054
5055impl fidl::endpoints::Responder for ProviderOpenCoordinatorWithListenerForVirtconResponder {
5056    type ControlHandle = ProviderControlHandle;
5057
5058    fn control_handle(&self) -> &ProviderControlHandle {
5059        &self.control_handle
5060    }
5061
5062    fn drop_without_shutdown(mut self) {
5063        // Safety: drops once, never accessed again due to mem::forget
5064        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5065        // Prevent Drop from running (which would shut down the channel)
5066        std::mem::forget(self);
5067    }
5068}
5069
5070impl ProviderOpenCoordinatorWithListenerForVirtconResponder {
5071    /// Sends a response to the FIDL transaction.
5072    ///
5073    /// Sets the channel to shutdown if an error occurs.
5074    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
5075        let _result = self.send_raw(result);
5076        if _result.is_err() {
5077            self.control_handle.shutdown();
5078        }
5079        self.drop_without_shutdown();
5080        _result
5081    }
5082
5083    /// Similar to "send" but does not shutdown the channel if an error occurs.
5084    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
5085        let _result = self.send_raw(result);
5086        self.drop_without_shutdown();
5087        _result
5088    }
5089
5090    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
5091        self.control_handle
5092            .inner
5093            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
5094                result,
5095                self.tx_id,
5096                0x154ac672633d9ec7,
5097                fidl::encoding::DynamicFlags::empty(),
5098            )
5099    }
5100}
5101
5102#[must_use = "FIDL methods require a response to be sent"]
5103#[derive(Debug)]
5104pub struct ProviderOpenCoordinatorWithListenerForPrimaryResponder {
5105    control_handle: std::mem::ManuallyDrop<ProviderControlHandle>,
5106    tx_id: u32,
5107}
5108
5109/// Set the the channel to be shutdown (see [`ProviderControlHandle::shutdown`])
5110/// if the responder is dropped without sending a response, so that the client
5111/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5112impl std::ops::Drop for ProviderOpenCoordinatorWithListenerForPrimaryResponder {
5113    fn drop(&mut self) {
5114        self.control_handle.shutdown();
5115        // Safety: drops once, never accessed again
5116        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5117    }
5118}
5119
5120impl fidl::endpoints::Responder for ProviderOpenCoordinatorWithListenerForPrimaryResponder {
5121    type ControlHandle = ProviderControlHandle;
5122
5123    fn control_handle(&self) -> &ProviderControlHandle {
5124        &self.control_handle
5125    }
5126
5127    fn drop_without_shutdown(mut self) {
5128        // Safety: drops once, never accessed again due to mem::forget
5129        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5130        // Prevent Drop from running (which would shut down the channel)
5131        std::mem::forget(self);
5132    }
5133}
5134
5135impl ProviderOpenCoordinatorWithListenerForPrimaryResponder {
5136    /// Sends a response to the FIDL transaction.
5137    ///
5138    /// Sets the channel to shutdown if an error occurs.
5139    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
5140        let _result = self.send_raw(result);
5141        if _result.is_err() {
5142            self.control_handle.shutdown();
5143        }
5144        self.drop_without_shutdown();
5145        _result
5146    }
5147
5148    /// Similar to "send" but does not shutdown the channel if an error occurs.
5149    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
5150        let _result = self.send_raw(result);
5151        self.drop_without_shutdown();
5152        _result
5153    }
5154
5155    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
5156        self.control_handle
5157            .inner
5158            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
5159                result,
5160                self.tx_id,
5161                0x635b6087ce4f6bfa,
5162                fidl::encoding::DynamicFlags::empty(),
5163            )
5164    }
5165}
5166
5167#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
5168pub struct ServiceMarker;
5169
5170#[cfg(target_os = "fuchsia")]
5171impl fidl::endpoints::ServiceMarker for ServiceMarker {
5172    type Proxy = ServiceProxy;
5173    type Request = ServiceRequest;
5174    const SERVICE_NAME: &'static str = "fuchsia.hardware.display.Service";
5175}
5176
5177/// A request for one of the member protocols of Service.
5178///
5179#[cfg(target_os = "fuchsia")]
5180pub enum ServiceRequest {
5181    Provider(ProviderRequestStream),
5182}
5183
5184#[cfg(target_os = "fuchsia")]
5185impl fidl::endpoints::ServiceRequest for ServiceRequest {
5186    type Service = ServiceMarker;
5187
5188    fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
5189        match name {
5190            "provider" => Self::Provider(
5191                <ProviderRequestStream as fidl::endpoints::RequestStream>::from_channel(_channel),
5192            ),
5193            _ => panic!("no such member protocol name for service Service"),
5194        }
5195    }
5196
5197    fn member_names() -> &'static [&'static str] {
5198        &["provider"]
5199    }
5200}
5201#[cfg(target_os = "fuchsia")]
5202pub struct ServiceProxy(#[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>);
5203
5204#[cfg(target_os = "fuchsia")]
5205impl fidl::endpoints::ServiceProxy for ServiceProxy {
5206    type Service = ServiceMarker;
5207
5208    fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
5209        Self(opener)
5210    }
5211}
5212
5213#[cfg(target_os = "fuchsia")]
5214impl ServiceProxy {
5215    pub fn connect_to_provider(&self) -> Result<ProviderProxy, fidl::Error> {
5216        let (proxy, server_end) = fidl::endpoints::create_proxy::<ProviderMarker>();
5217        self.connect_channel_to_provider(server_end)?;
5218        Ok(proxy)
5219    }
5220
5221    /// Like `connect_to_provider`, but returns a sync proxy.
5222    /// See [`Self::connect_to_provider`] for more details.
5223    pub fn connect_to_provider_sync(&self) -> Result<ProviderSynchronousProxy, fidl::Error> {
5224        let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<ProviderMarker>();
5225        self.connect_channel_to_provider(server_end)?;
5226        Ok(proxy)
5227    }
5228
5229    /// Like `connect_to_provider`, but accepts a server end.
5230    /// See [`Self::connect_to_provider`] for more details.
5231    pub fn connect_channel_to_provider(
5232        &self,
5233        server_end: fidl::endpoints::ServerEnd<ProviderMarker>,
5234    ) -> Result<(), fidl::Error> {
5235        self.0.open_member("provider", server_end.into_channel())
5236    }
5237
5238    pub fn instance_name(&self) -> &str {
5239        self.0.instance_name()
5240    }
5241}
5242
5243mod internal {
5244    use super::*;
5245
5246    impl fidl::encoding::ResourceTypeMarker for CoordinatorImportBufferCollectionRequest {
5247        type Borrowed<'a> = &'a mut Self;
5248        fn take_or_borrow<'a>(
5249            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
5250        ) -> Self::Borrowed<'a> {
5251            value
5252        }
5253    }
5254
5255    unsafe impl fidl::encoding::TypeMarker for CoordinatorImportBufferCollectionRequest {
5256        type Owned = Self;
5257
5258        #[inline(always)]
5259        fn inline_align(_context: fidl::encoding::Context) -> usize {
5260            8
5261        }
5262
5263        #[inline(always)]
5264        fn inline_size(_context: fidl::encoding::Context) -> usize {
5265            16
5266        }
5267    }
5268
5269    unsafe impl
5270        fidl::encoding::Encode<
5271            CoordinatorImportBufferCollectionRequest,
5272            fidl::encoding::DefaultFuchsiaResourceDialect,
5273        > for &mut CoordinatorImportBufferCollectionRequest
5274    {
5275        #[inline]
5276        unsafe fn encode(
5277            self,
5278            encoder: &mut fidl::encoding::Encoder<
5279                '_,
5280                fidl::encoding::DefaultFuchsiaResourceDialect,
5281            >,
5282            offset: usize,
5283            _depth: fidl::encoding::Depth,
5284        ) -> fidl::Result<()> {
5285            encoder.debug_check_bounds::<CoordinatorImportBufferCollectionRequest>(offset);
5286            // Delegate to tuple encoding.
5287            fidl::encoding::Encode::<
5288                CoordinatorImportBufferCollectionRequest,
5289                fidl::encoding::DefaultFuchsiaResourceDialect,
5290            >::encode(
5291                (
5292                    <BufferCollectionId as fidl::encoding::ValueTypeMarker>::borrow(
5293                        &self.buffer_collection_id,
5294                    ),
5295                    <fidl::encoding::Endpoint<
5296                        fidl::endpoints::ClientEnd<
5297                            fidl_fuchsia_sysmem2::BufferCollectionTokenMarker,
5298                        >,
5299                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
5300                        &mut self.buffer_collection_token,
5301                    ),
5302                ),
5303                encoder,
5304                offset,
5305                _depth,
5306            )
5307        }
5308    }
5309    unsafe impl<
5310        T0: fidl::encoding::Encode<BufferCollectionId, fidl::encoding::DefaultFuchsiaResourceDialect>,
5311        T1: fidl::encoding::Encode<
5312                fidl::encoding::Endpoint<
5313                    fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem2::BufferCollectionTokenMarker>,
5314                >,
5315                fidl::encoding::DefaultFuchsiaResourceDialect,
5316            >,
5317    >
5318        fidl::encoding::Encode<
5319            CoordinatorImportBufferCollectionRequest,
5320            fidl::encoding::DefaultFuchsiaResourceDialect,
5321        > for (T0, T1)
5322    {
5323        #[inline]
5324        unsafe fn encode(
5325            self,
5326            encoder: &mut fidl::encoding::Encoder<
5327                '_,
5328                fidl::encoding::DefaultFuchsiaResourceDialect,
5329            >,
5330            offset: usize,
5331            depth: fidl::encoding::Depth,
5332        ) -> fidl::Result<()> {
5333            encoder.debug_check_bounds::<CoordinatorImportBufferCollectionRequest>(offset);
5334            // Zero out padding regions. There's no need to apply masks
5335            // because the unmasked parts will be overwritten by fields.
5336            unsafe {
5337                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
5338                (ptr as *mut u64).write_unaligned(0);
5339            }
5340            // Write the fields.
5341            self.0.encode(encoder, offset + 0, depth)?;
5342            self.1.encode(encoder, offset + 8, depth)?;
5343            Ok(())
5344        }
5345    }
5346
5347    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
5348        for CoordinatorImportBufferCollectionRequest
5349    {
5350        #[inline(always)]
5351        fn new_empty() -> Self {
5352            Self {
5353                buffer_collection_id: fidl::new_empty!(
5354                    BufferCollectionId,
5355                    fidl::encoding::DefaultFuchsiaResourceDialect
5356                ),
5357                buffer_collection_token: fidl::new_empty!(
5358                    fidl::encoding::Endpoint<
5359                        fidl::endpoints::ClientEnd<
5360                            fidl_fuchsia_sysmem2::BufferCollectionTokenMarker,
5361                        >,
5362                    >,
5363                    fidl::encoding::DefaultFuchsiaResourceDialect
5364                ),
5365            }
5366        }
5367
5368        #[inline]
5369        unsafe fn decode(
5370            &mut self,
5371            decoder: &mut fidl::encoding::Decoder<
5372                '_,
5373                fidl::encoding::DefaultFuchsiaResourceDialect,
5374            >,
5375            offset: usize,
5376            _depth: fidl::encoding::Depth,
5377        ) -> fidl::Result<()> {
5378            decoder.debug_check_bounds::<Self>(offset);
5379            // Verify that padding bytes are zero.
5380            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(8) };
5381            let padval = unsafe { (ptr as *const u64).read_unaligned() };
5382            let mask = 0xffffffff00000000u64;
5383            let maskedval = padval & mask;
5384            if maskedval != 0 {
5385                return Err(fidl::Error::NonZeroPadding {
5386                    padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
5387                });
5388            }
5389            fidl::decode!(
5390                BufferCollectionId,
5391                fidl::encoding::DefaultFuchsiaResourceDialect,
5392                &mut self.buffer_collection_id,
5393                decoder,
5394                offset + 0,
5395                _depth
5396            )?;
5397            fidl::decode!(
5398                fidl::encoding::Endpoint<
5399                    fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem2::BufferCollectionTokenMarker>,
5400                >,
5401                fidl::encoding::DefaultFuchsiaResourceDialect,
5402                &mut self.buffer_collection_token,
5403                decoder,
5404                offset + 8,
5405                _depth
5406            )?;
5407            Ok(())
5408        }
5409    }
5410
5411    impl fidl::encoding::ResourceTypeMarker for CoordinatorImportEventRequest {
5412        type Borrowed<'a> = &'a mut Self;
5413        fn take_or_borrow<'a>(
5414            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
5415        ) -> Self::Borrowed<'a> {
5416            value
5417        }
5418    }
5419
5420    unsafe impl fidl::encoding::TypeMarker for CoordinatorImportEventRequest {
5421        type Owned = Self;
5422
5423        #[inline(always)]
5424        fn inline_align(_context: fidl::encoding::Context) -> usize {
5425            8
5426        }
5427
5428        #[inline(always)]
5429        fn inline_size(_context: fidl::encoding::Context) -> usize {
5430            16
5431        }
5432    }
5433
5434    unsafe impl
5435        fidl::encoding::Encode<
5436            CoordinatorImportEventRequest,
5437            fidl::encoding::DefaultFuchsiaResourceDialect,
5438        > for &mut CoordinatorImportEventRequest
5439    {
5440        #[inline]
5441        unsafe fn encode(
5442            self,
5443            encoder: &mut fidl::encoding::Encoder<
5444                '_,
5445                fidl::encoding::DefaultFuchsiaResourceDialect,
5446            >,
5447            offset: usize,
5448            _depth: fidl::encoding::Depth,
5449        ) -> fidl::Result<()> {
5450            encoder.debug_check_bounds::<CoordinatorImportEventRequest>(offset);
5451            // Delegate to tuple encoding.
5452            fidl::encoding::Encode::<
5453                CoordinatorImportEventRequest,
5454                fidl::encoding::DefaultFuchsiaResourceDialect,
5455            >::encode(
5456                (
5457                    <fidl::encoding::HandleType<
5458                        fidl::Event,
5459                        { fidl::ObjectType::EVENT.into_raw() },
5460                        2147483648,
5461                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
5462                        &mut self.event
5463                    ),
5464                    <EventId as fidl::encoding::ValueTypeMarker>::borrow(&self.id),
5465                ),
5466                encoder,
5467                offset,
5468                _depth,
5469            )
5470        }
5471    }
5472    unsafe impl<
5473        T0: fidl::encoding::Encode<
5474                fidl::encoding::HandleType<
5475                    fidl::Event,
5476                    { fidl::ObjectType::EVENT.into_raw() },
5477                    2147483648,
5478                >,
5479                fidl::encoding::DefaultFuchsiaResourceDialect,
5480            >,
5481        T1: fidl::encoding::Encode<EventId, fidl::encoding::DefaultFuchsiaResourceDialect>,
5482    >
5483        fidl::encoding::Encode<
5484            CoordinatorImportEventRequest,
5485            fidl::encoding::DefaultFuchsiaResourceDialect,
5486        > for (T0, T1)
5487    {
5488        #[inline]
5489        unsafe fn encode(
5490            self,
5491            encoder: &mut fidl::encoding::Encoder<
5492                '_,
5493                fidl::encoding::DefaultFuchsiaResourceDialect,
5494            >,
5495            offset: usize,
5496            depth: fidl::encoding::Depth,
5497        ) -> fidl::Result<()> {
5498            encoder.debug_check_bounds::<CoordinatorImportEventRequest>(offset);
5499            // Zero out padding regions. There's no need to apply masks
5500            // because the unmasked parts will be overwritten by fields.
5501            unsafe {
5502                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
5503                (ptr as *mut u64).write_unaligned(0);
5504            }
5505            // Write the fields.
5506            self.0.encode(encoder, offset + 0, depth)?;
5507            self.1.encode(encoder, offset + 8, depth)?;
5508            Ok(())
5509        }
5510    }
5511
5512    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
5513        for CoordinatorImportEventRequest
5514    {
5515        #[inline(always)]
5516        fn new_empty() -> Self {
5517            Self {
5518                event: fidl::new_empty!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
5519                id: fidl::new_empty!(EventId, fidl::encoding::DefaultFuchsiaResourceDialect),
5520            }
5521        }
5522
5523        #[inline]
5524        unsafe fn decode(
5525            &mut self,
5526            decoder: &mut fidl::encoding::Decoder<
5527                '_,
5528                fidl::encoding::DefaultFuchsiaResourceDialect,
5529            >,
5530            offset: usize,
5531            _depth: fidl::encoding::Depth,
5532        ) -> fidl::Result<()> {
5533            decoder.debug_check_bounds::<Self>(offset);
5534            // Verify that padding bytes are zero.
5535            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
5536            let padval = unsafe { (ptr as *const u64).read_unaligned() };
5537            let mask = 0xffffffff00000000u64;
5538            let maskedval = padval & mask;
5539            if maskedval != 0 {
5540                return Err(fidl::Error::NonZeroPadding {
5541                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
5542                });
5543            }
5544            fidl::decode!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.event, decoder, offset + 0, _depth)?;
5545            fidl::decode!(
5546                EventId,
5547                fidl::encoding::DefaultFuchsiaResourceDialect,
5548                &mut self.id,
5549                decoder,
5550                offset + 8,
5551                _depth
5552            )?;
5553            Ok(())
5554        }
5555    }
5556
5557    impl CoordinatorApplyConfig3Request {
5558        #[inline(always)]
5559        fn max_ordinal_present(&self) -> u64 {
5560            if let Some(_) = self.stamp {
5561                return 1;
5562            }
5563            0
5564        }
5565    }
5566
5567    impl fidl::encoding::ResourceTypeMarker for CoordinatorApplyConfig3Request {
5568        type Borrowed<'a> = &'a mut Self;
5569        fn take_or_borrow<'a>(
5570            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
5571        ) -> Self::Borrowed<'a> {
5572            value
5573        }
5574    }
5575
5576    unsafe impl fidl::encoding::TypeMarker for CoordinatorApplyConfig3Request {
5577        type Owned = Self;
5578
5579        #[inline(always)]
5580        fn inline_align(_context: fidl::encoding::Context) -> usize {
5581            8
5582        }
5583
5584        #[inline(always)]
5585        fn inline_size(_context: fidl::encoding::Context) -> usize {
5586            16
5587        }
5588    }
5589
5590    unsafe impl
5591        fidl::encoding::Encode<
5592            CoordinatorApplyConfig3Request,
5593            fidl::encoding::DefaultFuchsiaResourceDialect,
5594        > for &mut CoordinatorApplyConfig3Request
5595    {
5596        unsafe fn encode(
5597            self,
5598            encoder: &mut fidl::encoding::Encoder<
5599                '_,
5600                fidl::encoding::DefaultFuchsiaResourceDialect,
5601            >,
5602            offset: usize,
5603            mut depth: fidl::encoding::Depth,
5604        ) -> fidl::Result<()> {
5605            encoder.debug_check_bounds::<CoordinatorApplyConfig3Request>(offset);
5606            // Vector header
5607            let max_ordinal: u64 = self.max_ordinal_present();
5608            encoder.write_num(max_ordinal, offset);
5609            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
5610            // Calling encoder.out_of_line_offset(0) is not allowed.
5611            if max_ordinal == 0 {
5612                return Ok(());
5613            }
5614            depth.increment()?;
5615            let envelope_size = 8;
5616            let bytes_len = max_ordinal as usize * envelope_size;
5617            #[allow(unused_variables)]
5618            let offset = encoder.out_of_line_offset(bytes_len);
5619            let mut _prev_end_offset: usize = 0;
5620            if 1 > max_ordinal {
5621                return Ok(());
5622            }
5623
5624            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5625            // are envelope_size bytes.
5626            let cur_offset: usize = (1 - 1) * envelope_size;
5627
5628            // Zero reserved fields.
5629            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5630
5631            // Safety:
5632            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5633            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5634            //   envelope_size bytes, there is always sufficient room.
5635            fidl::encoding::encode_in_envelope_optional::<
5636                ConfigStamp,
5637                fidl::encoding::DefaultFuchsiaResourceDialect,
5638            >(
5639                self.stamp.as_ref().map(<ConfigStamp as fidl::encoding::ValueTypeMarker>::borrow),
5640                encoder,
5641                offset + cur_offset,
5642                depth,
5643            )?;
5644
5645            _prev_end_offset = cur_offset + envelope_size;
5646
5647            Ok(())
5648        }
5649    }
5650
5651    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
5652        for CoordinatorApplyConfig3Request
5653    {
5654        #[inline(always)]
5655        fn new_empty() -> Self {
5656            Self::default()
5657        }
5658
5659        unsafe fn decode(
5660            &mut self,
5661            decoder: &mut fidl::encoding::Decoder<
5662                '_,
5663                fidl::encoding::DefaultFuchsiaResourceDialect,
5664            >,
5665            offset: usize,
5666            mut depth: fidl::encoding::Depth,
5667        ) -> fidl::Result<()> {
5668            decoder.debug_check_bounds::<Self>(offset);
5669            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
5670                None => return Err(fidl::Error::NotNullable),
5671                Some(len) => len,
5672            };
5673            // Calling decoder.out_of_line_offset(0) is not allowed.
5674            if len == 0 {
5675                return Ok(());
5676            };
5677            depth.increment()?;
5678            let envelope_size = 8;
5679            let bytes_len = len * envelope_size;
5680            let offset = decoder.out_of_line_offset(bytes_len)?;
5681            // Decode the envelope for each type.
5682            let mut _next_ordinal_to_read = 0;
5683            let mut next_offset = offset;
5684            let end_offset = offset + bytes_len;
5685            _next_ordinal_to_read += 1;
5686            if next_offset >= end_offset {
5687                return Ok(());
5688            }
5689
5690            // Decode unknown envelopes for gaps in ordinals.
5691            while _next_ordinal_to_read < 1 {
5692                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5693                _next_ordinal_to_read += 1;
5694                next_offset += envelope_size;
5695            }
5696
5697            let next_out_of_line = decoder.next_out_of_line();
5698            let handles_before = decoder.remaining_handles();
5699            if let Some((inlined, num_bytes, num_handles)) =
5700                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5701            {
5702                let member_inline_size =
5703                    <ConfigStamp as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5704                if inlined != (member_inline_size <= 4) {
5705                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5706                }
5707                let inner_offset;
5708                let mut inner_depth = depth.clone();
5709                if inlined {
5710                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5711                    inner_offset = next_offset;
5712                } else {
5713                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5714                    inner_depth.increment()?;
5715                }
5716                let val_ref = self.stamp.get_or_insert_with(|| {
5717                    fidl::new_empty!(ConfigStamp, fidl::encoding::DefaultFuchsiaResourceDialect)
5718                });
5719                fidl::decode!(
5720                    ConfigStamp,
5721                    fidl::encoding::DefaultFuchsiaResourceDialect,
5722                    val_ref,
5723                    decoder,
5724                    inner_offset,
5725                    inner_depth
5726                )?;
5727                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5728                {
5729                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5730                }
5731                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5732                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5733                }
5734            }
5735
5736            next_offset += envelope_size;
5737
5738            // Decode the remaining unknown envelopes.
5739            while next_offset < end_offset {
5740                _next_ordinal_to_read += 1;
5741                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5742                next_offset += envelope_size;
5743            }
5744
5745            Ok(())
5746        }
5747    }
5748
5749    impl ProviderOpenCoordinatorWithListenerForPrimaryRequest {
5750        #[inline(always)]
5751        fn max_ordinal_present(&self) -> u64 {
5752            if let Some(_) = self.coordinator_listener {
5753                return 2;
5754            }
5755            if let Some(_) = self.coordinator {
5756                return 1;
5757            }
5758            0
5759        }
5760    }
5761
5762    impl fidl::encoding::ResourceTypeMarker for ProviderOpenCoordinatorWithListenerForPrimaryRequest {
5763        type Borrowed<'a> = &'a mut Self;
5764        fn take_or_borrow<'a>(
5765            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
5766        ) -> Self::Borrowed<'a> {
5767            value
5768        }
5769    }
5770
5771    unsafe impl fidl::encoding::TypeMarker for ProviderOpenCoordinatorWithListenerForPrimaryRequest {
5772        type Owned = Self;
5773
5774        #[inline(always)]
5775        fn inline_align(_context: fidl::encoding::Context) -> usize {
5776            8
5777        }
5778
5779        #[inline(always)]
5780        fn inline_size(_context: fidl::encoding::Context) -> usize {
5781            16
5782        }
5783    }
5784
5785    unsafe impl
5786        fidl::encoding::Encode<
5787            ProviderOpenCoordinatorWithListenerForPrimaryRequest,
5788            fidl::encoding::DefaultFuchsiaResourceDialect,
5789        > for &mut ProviderOpenCoordinatorWithListenerForPrimaryRequest
5790    {
5791        unsafe fn encode(
5792            self,
5793            encoder: &mut fidl::encoding::Encoder<
5794                '_,
5795                fidl::encoding::DefaultFuchsiaResourceDialect,
5796            >,
5797            offset: usize,
5798            mut depth: fidl::encoding::Depth,
5799        ) -> fidl::Result<()> {
5800            encoder
5801                .debug_check_bounds::<ProviderOpenCoordinatorWithListenerForPrimaryRequest>(offset);
5802            // Vector header
5803            let max_ordinal: u64 = self.max_ordinal_present();
5804            encoder.write_num(max_ordinal, offset);
5805            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
5806            // Calling encoder.out_of_line_offset(0) is not allowed.
5807            if max_ordinal == 0 {
5808                return Ok(());
5809            }
5810            depth.increment()?;
5811            let envelope_size = 8;
5812            let bytes_len = max_ordinal as usize * envelope_size;
5813            #[allow(unused_variables)]
5814            let offset = encoder.out_of_line_offset(bytes_len);
5815            let mut _prev_end_offset: usize = 0;
5816            if 1 > max_ordinal {
5817                return Ok(());
5818            }
5819
5820            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5821            // are envelope_size bytes.
5822            let cur_offset: usize = (1 - 1) * envelope_size;
5823
5824            // Zero reserved fields.
5825            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5826
5827            // Safety:
5828            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5829            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5830            //   envelope_size bytes, there is always sufficient room.
5831            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CoordinatorMarker>>, fidl::encoding::DefaultFuchsiaResourceDialect>(
5832            self.coordinator.as_mut().map(<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CoordinatorMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
5833            encoder, offset + cur_offset, depth
5834        )?;
5835
5836            _prev_end_offset = cur_offset + envelope_size;
5837            if 2 > max_ordinal {
5838                return Ok(());
5839            }
5840
5841            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5842            // are envelope_size bytes.
5843            let cur_offset: usize = (2 - 1) * envelope_size;
5844
5845            // Zero reserved fields.
5846            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5847
5848            // Safety:
5849            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5850            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5851            //   envelope_size bytes, there is always sufficient room.
5852            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<CoordinatorListenerMarker>>, fidl::encoding::DefaultFuchsiaResourceDialect>(
5853            self.coordinator_listener.as_mut().map(<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<CoordinatorListenerMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
5854            encoder, offset + cur_offset, depth
5855        )?;
5856
5857            _prev_end_offset = cur_offset + envelope_size;
5858
5859            Ok(())
5860        }
5861    }
5862
5863    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
5864        for ProviderOpenCoordinatorWithListenerForPrimaryRequest
5865    {
5866        #[inline(always)]
5867        fn new_empty() -> Self {
5868            Self::default()
5869        }
5870
5871        unsafe fn decode(
5872            &mut self,
5873            decoder: &mut fidl::encoding::Decoder<
5874                '_,
5875                fidl::encoding::DefaultFuchsiaResourceDialect,
5876            >,
5877            offset: usize,
5878            mut depth: fidl::encoding::Depth,
5879        ) -> fidl::Result<()> {
5880            decoder.debug_check_bounds::<Self>(offset);
5881            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
5882                None => return Err(fidl::Error::NotNullable),
5883                Some(len) => len,
5884            };
5885            // Calling decoder.out_of_line_offset(0) is not allowed.
5886            if len == 0 {
5887                return Ok(());
5888            };
5889            depth.increment()?;
5890            let envelope_size = 8;
5891            let bytes_len = len * envelope_size;
5892            let offset = decoder.out_of_line_offset(bytes_len)?;
5893            // Decode the envelope for each type.
5894            let mut _next_ordinal_to_read = 0;
5895            let mut next_offset = offset;
5896            let end_offset = offset + bytes_len;
5897            _next_ordinal_to_read += 1;
5898            if next_offset >= end_offset {
5899                return Ok(());
5900            }
5901
5902            // Decode unknown envelopes for gaps in ordinals.
5903            while _next_ordinal_to_read < 1 {
5904                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5905                _next_ordinal_to_read += 1;
5906                next_offset += envelope_size;
5907            }
5908
5909            let next_out_of_line = decoder.next_out_of_line();
5910            let handles_before = decoder.remaining_handles();
5911            if let Some((inlined, num_bytes, num_handles)) =
5912                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5913            {
5914                let member_inline_size = <fidl::encoding::Endpoint<
5915                    fidl::endpoints::ServerEnd<CoordinatorMarker>,
5916                > as fidl::encoding::TypeMarker>::inline_size(
5917                    decoder.context
5918                );
5919                if inlined != (member_inline_size <= 4) {
5920                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5921                }
5922                let inner_offset;
5923                let mut inner_depth = depth.clone();
5924                if inlined {
5925                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5926                    inner_offset = next_offset;
5927                } else {
5928                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5929                    inner_depth.increment()?;
5930                }
5931                let val_ref = self.coordinator.get_or_insert_with(|| {
5932                    fidl::new_empty!(
5933                        fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CoordinatorMarker>>,
5934                        fidl::encoding::DefaultFuchsiaResourceDialect
5935                    )
5936                });
5937                fidl::decode!(
5938                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CoordinatorMarker>>,
5939                    fidl::encoding::DefaultFuchsiaResourceDialect,
5940                    val_ref,
5941                    decoder,
5942                    inner_offset,
5943                    inner_depth
5944                )?;
5945                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5946                {
5947                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5948                }
5949                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5950                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5951                }
5952            }
5953
5954            next_offset += envelope_size;
5955            _next_ordinal_to_read += 1;
5956            if next_offset >= end_offset {
5957                return Ok(());
5958            }
5959
5960            // Decode unknown envelopes for gaps in ordinals.
5961            while _next_ordinal_to_read < 2 {
5962                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5963                _next_ordinal_to_read += 1;
5964                next_offset += envelope_size;
5965            }
5966
5967            let next_out_of_line = decoder.next_out_of_line();
5968            let handles_before = decoder.remaining_handles();
5969            if let Some((inlined, num_bytes, num_handles)) =
5970                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5971            {
5972                let member_inline_size = <fidl::encoding::Endpoint<
5973                    fidl::endpoints::ClientEnd<CoordinatorListenerMarker>,
5974                > as fidl::encoding::TypeMarker>::inline_size(
5975                    decoder.context
5976                );
5977                if inlined != (member_inline_size <= 4) {
5978                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5979                }
5980                let inner_offset;
5981                let mut inner_depth = depth.clone();
5982                if inlined {
5983                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5984                    inner_offset = next_offset;
5985                } else {
5986                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5987                    inner_depth.increment()?;
5988                }
5989                let val_ref = self.coordinator_listener.get_or_insert_with(|| {
5990                    fidl::new_empty!(
5991                        fidl::encoding::Endpoint<
5992                            fidl::endpoints::ClientEnd<CoordinatorListenerMarker>,
5993                        >,
5994                        fidl::encoding::DefaultFuchsiaResourceDialect
5995                    )
5996                });
5997                fidl::decode!(
5998                    fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<CoordinatorListenerMarker>>,
5999                    fidl::encoding::DefaultFuchsiaResourceDialect,
6000                    val_ref,
6001                    decoder,
6002                    inner_offset,
6003                    inner_depth
6004                )?;
6005                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6006                {
6007                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6008                }
6009                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6010                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6011                }
6012            }
6013
6014            next_offset += envelope_size;
6015
6016            // Decode the remaining unknown envelopes.
6017            while next_offset < end_offset {
6018                _next_ordinal_to_read += 1;
6019                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6020                next_offset += envelope_size;
6021            }
6022
6023            Ok(())
6024        }
6025    }
6026
6027    impl ProviderOpenCoordinatorWithListenerForVirtconRequest {
6028        #[inline(always)]
6029        fn max_ordinal_present(&self) -> u64 {
6030            if let Some(_) = self.coordinator_listener {
6031                return 2;
6032            }
6033            if let Some(_) = self.coordinator {
6034                return 1;
6035            }
6036            0
6037        }
6038    }
6039
6040    impl fidl::encoding::ResourceTypeMarker for ProviderOpenCoordinatorWithListenerForVirtconRequest {
6041        type Borrowed<'a> = &'a mut Self;
6042        fn take_or_borrow<'a>(
6043            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
6044        ) -> Self::Borrowed<'a> {
6045            value
6046        }
6047    }
6048
6049    unsafe impl fidl::encoding::TypeMarker for ProviderOpenCoordinatorWithListenerForVirtconRequest {
6050        type Owned = Self;
6051
6052        #[inline(always)]
6053        fn inline_align(_context: fidl::encoding::Context) -> usize {
6054            8
6055        }
6056
6057        #[inline(always)]
6058        fn inline_size(_context: fidl::encoding::Context) -> usize {
6059            16
6060        }
6061    }
6062
6063    unsafe impl
6064        fidl::encoding::Encode<
6065            ProviderOpenCoordinatorWithListenerForVirtconRequest,
6066            fidl::encoding::DefaultFuchsiaResourceDialect,
6067        > for &mut ProviderOpenCoordinatorWithListenerForVirtconRequest
6068    {
6069        unsafe fn encode(
6070            self,
6071            encoder: &mut fidl::encoding::Encoder<
6072                '_,
6073                fidl::encoding::DefaultFuchsiaResourceDialect,
6074            >,
6075            offset: usize,
6076            mut depth: fidl::encoding::Depth,
6077        ) -> fidl::Result<()> {
6078            encoder
6079                .debug_check_bounds::<ProviderOpenCoordinatorWithListenerForVirtconRequest>(offset);
6080            // Vector header
6081            let max_ordinal: u64 = self.max_ordinal_present();
6082            encoder.write_num(max_ordinal, offset);
6083            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
6084            // Calling encoder.out_of_line_offset(0) is not allowed.
6085            if max_ordinal == 0 {
6086                return Ok(());
6087            }
6088            depth.increment()?;
6089            let envelope_size = 8;
6090            let bytes_len = max_ordinal as usize * envelope_size;
6091            #[allow(unused_variables)]
6092            let offset = encoder.out_of_line_offset(bytes_len);
6093            let mut _prev_end_offset: usize = 0;
6094            if 1 > max_ordinal {
6095                return Ok(());
6096            }
6097
6098            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
6099            // are envelope_size bytes.
6100            let cur_offset: usize = (1 - 1) * envelope_size;
6101
6102            // Zero reserved fields.
6103            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6104
6105            // Safety:
6106            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
6107            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
6108            //   envelope_size bytes, there is always sufficient room.
6109            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CoordinatorMarker>>, fidl::encoding::DefaultFuchsiaResourceDialect>(
6110            self.coordinator.as_mut().map(<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CoordinatorMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
6111            encoder, offset + cur_offset, depth
6112        )?;
6113
6114            _prev_end_offset = cur_offset + envelope_size;
6115            if 2 > max_ordinal {
6116                return Ok(());
6117            }
6118
6119            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
6120            // are envelope_size bytes.
6121            let cur_offset: usize = (2 - 1) * envelope_size;
6122
6123            // Zero reserved fields.
6124            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6125
6126            // Safety:
6127            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
6128            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
6129            //   envelope_size bytes, there is always sufficient room.
6130            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<CoordinatorListenerMarker>>, fidl::encoding::DefaultFuchsiaResourceDialect>(
6131            self.coordinator_listener.as_mut().map(<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<CoordinatorListenerMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
6132            encoder, offset + cur_offset, depth
6133        )?;
6134
6135            _prev_end_offset = cur_offset + envelope_size;
6136
6137            Ok(())
6138        }
6139    }
6140
6141    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
6142        for ProviderOpenCoordinatorWithListenerForVirtconRequest
6143    {
6144        #[inline(always)]
6145        fn new_empty() -> Self {
6146            Self::default()
6147        }
6148
6149        unsafe fn decode(
6150            &mut self,
6151            decoder: &mut fidl::encoding::Decoder<
6152                '_,
6153                fidl::encoding::DefaultFuchsiaResourceDialect,
6154            >,
6155            offset: usize,
6156            mut depth: fidl::encoding::Depth,
6157        ) -> fidl::Result<()> {
6158            decoder.debug_check_bounds::<Self>(offset);
6159            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
6160                None => return Err(fidl::Error::NotNullable),
6161                Some(len) => len,
6162            };
6163            // Calling decoder.out_of_line_offset(0) is not allowed.
6164            if len == 0 {
6165                return Ok(());
6166            };
6167            depth.increment()?;
6168            let envelope_size = 8;
6169            let bytes_len = len * envelope_size;
6170            let offset = decoder.out_of_line_offset(bytes_len)?;
6171            // Decode the envelope for each type.
6172            let mut _next_ordinal_to_read = 0;
6173            let mut next_offset = offset;
6174            let end_offset = offset + bytes_len;
6175            _next_ordinal_to_read += 1;
6176            if next_offset >= end_offset {
6177                return Ok(());
6178            }
6179
6180            // Decode unknown envelopes for gaps in ordinals.
6181            while _next_ordinal_to_read < 1 {
6182                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6183                _next_ordinal_to_read += 1;
6184                next_offset += envelope_size;
6185            }
6186
6187            let next_out_of_line = decoder.next_out_of_line();
6188            let handles_before = decoder.remaining_handles();
6189            if let Some((inlined, num_bytes, num_handles)) =
6190                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6191            {
6192                let member_inline_size = <fidl::encoding::Endpoint<
6193                    fidl::endpoints::ServerEnd<CoordinatorMarker>,
6194                > as fidl::encoding::TypeMarker>::inline_size(
6195                    decoder.context
6196                );
6197                if inlined != (member_inline_size <= 4) {
6198                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6199                }
6200                let inner_offset;
6201                let mut inner_depth = depth.clone();
6202                if inlined {
6203                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6204                    inner_offset = next_offset;
6205                } else {
6206                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6207                    inner_depth.increment()?;
6208                }
6209                let val_ref = self.coordinator.get_or_insert_with(|| {
6210                    fidl::new_empty!(
6211                        fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CoordinatorMarker>>,
6212                        fidl::encoding::DefaultFuchsiaResourceDialect
6213                    )
6214                });
6215                fidl::decode!(
6216                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CoordinatorMarker>>,
6217                    fidl::encoding::DefaultFuchsiaResourceDialect,
6218                    val_ref,
6219                    decoder,
6220                    inner_offset,
6221                    inner_depth
6222                )?;
6223                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6224                {
6225                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6226                }
6227                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6228                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6229                }
6230            }
6231
6232            next_offset += envelope_size;
6233            _next_ordinal_to_read += 1;
6234            if next_offset >= end_offset {
6235                return Ok(());
6236            }
6237
6238            // Decode unknown envelopes for gaps in ordinals.
6239            while _next_ordinal_to_read < 2 {
6240                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6241                _next_ordinal_to_read += 1;
6242                next_offset += envelope_size;
6243            }
6244
6245            let next_out_of_line = decoder.next_out_of_line();
6246            let handles_before = decoder.remaining_handles();
6247            if let Some((inlined, num_bytes, num_handles)) =
6248                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6249            {
6250                let member_inline_size = <fidl::encoding::Endpoint<
6251                    fidl::endpoints::ClientEnd<CoordinatorListenerMarker>,
6252                > as fidl::encoding::TypeMarker>::inline_size(
6253                    decoder.context
6254                );
6255                if inlined != (member_inline_size <= 4) {
6256                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6257                }
6258                let inner_offset;
6259                let mut inner_depth = depth.clone();
6260                if inlined {
6261                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6262                    inner_offset = next_offset;
6263                } else {
6264                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6265                    inner_depth.increment()?;
6266                }
6267                let val_ref = self.coordinator_listener.get_or_insert_with(|| {
6268                    fidl::new_empty!(
6269                        fidl::encoding::Endpoint<
6270                            fidl::endpoints::ClientEnd<CoordinatorListenerMarker>,
6271                        >,
6272                        fidl::encoding::DefaultFuchsiaResourceDialect
6273                    )
6274                });
6275                fidl::decode!(
6276                    fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<CoordinatorListenerMarker>>,
6277                    fidl::encoding::DefaultFuchsiaResourceDialect,
6278                    val_ref,
6279                    decoder,
6280                    inner_offset,
6281                    inner_depth
6282                )?;
6283                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6284                {
6285                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6286                }
6287                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6288                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6289                }
6290            }
6291
6292            next_offset += envelope_size;
6293
6294            // Decode the remaining unknown envelopes.
6295            while next_offset < end_offset {
6296                _next_ordinal_to_read += 1;
6297                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6298                next_offset += envelope_size;
6299            }
6300
6301            Ok(())
6302        }
6303    }
6304}