Skip to main content

fidl_fuchsia_hardware_display/
fidl_fuchsia_hardware_display.rs

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