fidl_fuchsia_hardware_display/
fidl_fuchsia_hardware_display.rs

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