fidl_fuchsia_ui_composition_internal__common/
fidl_fuchsia_ui_composition_internal__common.rs1#![warn(clippy::all)]
4#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
5
6use bitflags::bitflags;
7use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
8use futures::future::{self, MaybeDone, TryFutureExt};
9use zx_status;
10
11pub const SIGNAL_DISPLAY_NOT_OWNED: u32 = 16777216;
12
13pub const SIGNAL_DISPLAY_OWNED: u32 = 33554432;
14
15#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
17pub enum ScreenCaptureError {
18 MissingArgs,
20 InvalidArgs,
22 BadHangingGet,
24 #[doc(hidden)]
25 __SourceBreaking { unknown_ordinal: u32 },
26}
27
28#[macro_export]
30macro_rules! ScreenCaptureErrorUnknown {
31 () => {
32 _
33 };
34}
35
36impl ScreenCaptureError {
37 #[inline]
38 pub fn from_primitive(prim: u32) -> Option<Self> {
39 match prim {
40 1 => Some(Self::MissingArgs),
41 2 => Some(Self::InvalidArgs),
42 3 => Some(Self::BadHangingGet),
43 _ => None,
44 }
45 }
46
47 #[inline]
48 pub fn from_primitive_allow_unknown(prim: u32) -> Self {
49 match prim {
50 1 => Self::MissingArgs,
51 2 => Self::InvalidArgs,
52 3 => Self::BadHangingGet,
53 unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
54 }
55 }
56
57 #[inline]
58 pub fn unknown() -> Self {
59 Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
60 }
61
62 #[inline]
63 pub const fn into_primitive(self) -> u32 {
64 match self {
65 Self::MissingArgs => 1,
66 Self::InvalidArgs => 2,
67 Self::BadHangingGet => 3,
68 Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
69 }
70 }
71
72 #[inline]
73 pub fn is_unknown(&self) -> bool {
74 match self {
75 Self::__SourceBreaking { unknown_ordinal: _ } => true,
76 _ => false,
77 }
78 }
79}
80
81#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
86#[repr(u32)]
87pub enum ScreenCaptureRotation {
88 Cw0Degrees = 0,
89 Cw90Degrees = 1,
90 Cw180Degrees = 2,
91 Cw270Degrees = 3,
92}
93
94impl ScreenCaptureRotation {
95 #[inline]
96 pub fn from_primitive(prim: u32) -> Option<Self> {
97 match prim {
98 0 => Some(Self::Cw0Degrees),
99 1 => Some(Self::Cw90Degrees),
100 2 => Some(Self::Cw180Degrees),
101 3 => Some(Self::Cw270Degrees),
102 _ => None,
103 }
104 }
105
106 #[inline]
107 pub const fn into_primitive(self) -> u32 {
108 self as u32
109 }
110}
111
112pub mod display_ownership_ordinals {
113 pub const GET_EVENT: u64 = 0x2dc713e7b367312f;
114}
115
116pub mod screen_capture_ordinals {
117 pub const CONFIGURE: u64 = 0x5d07582dc93862a2;
118 pub const GET_NEXT_FRAME: u64 = 0x48680722eab7103;
119}
120
121mod internal {
122 use super::*;
123 unsafe impl fidl::encoding::TypeMarker for ScreenCaptureError {
124 type Owned = Self;
125
126 #[inline(always)]
127 fn inline_align(_context: fidl::encoding::Context) -> usize {
128 std::mem::align_of::<u32>()
129 }
130
131 #[inline(always)]
132 fn inline_size(_context: fidl::encoding::Context) -> usize {
133 std::mem::size_of::<u32>()
134 }
135
136 #[inline(always)]
137 fn encode_is_copy() -> bool {
138 false
139 }
140
141 #[inline(always)]
142 fn decode_is_copy() -> bool {
143 false
144 }
145 }
146
147 impl fidl::encoding::ValueTypeMarker for ScreenCaptureError {
148 type Borrowed<'a> = Self;
149 #[inline(always)]
150 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
151 *value
152 }
153 }
154
155 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
156 for ScreenCaptureError
157 {
158 #[inline]
159 unsafe fn encode(
160 self,
161 encoder: &mut fidl::encoding::Encoder<'_, D>,
162 offset: usize,
163 _depth: fidl::encoding::Depth,
164 ) -> fidl::Result<()> {
165 encoder.debug_check_bounds::<Self>(offset);
166 encoder.write_num(self.into_primitive(), offset);
167 Ok(())
168 }
169 }
170
171 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ScreenCaptureError {
172 #[inline(always)]
173 fn new_empty() -> Self {
174 Self::unknown()
175 }
176
177 #[inline]
178 unsafe fn decode(
179 &mut self,
180 decoder: &mut fidl::encoding::Decoder<'_, D>,
181 offset: usize,
182 _depth: fidl::encoding::Depth,
183 ) -> fidl::Result<()> {
184 decoder.debug_check_bounds::<Self>(offset);
185 let prim = decoder.read_num::<u32>(offset);
186
187 *self = Self::from_primitive_allow_unknown(prim);
188 Ok(())
189 }
190 }
191 unsafe impl fidl::encoding::TypeMarker for ScreenCaptureRotation {
192 type Owned = Self;
193
194 #[inline(always)]
195 fn inline_align(_context: fidl::encoding::Context) -> usize {
196 std::mem::align_of::<u32>()
197 }
198
199 #[inline(always)]
200 fn inline_size(_context: fidl::encoding::Context) -> usize {
201 std::mem::size_of::<u32>()
202 }
203
204 #[inline(always)]
205 fn encode_is_copy() -> bool {
206 true
207 }
208
209 #[inline(always)]
210 fn decode_is_copy() -> bool {
211 false
212 }
213 }
214
215 impl fidl::encoding::ValueTypeMarker for ScreenCaptureRotation {
216 type Borrowed<'a> = Self;
217 #[inline(always)]
218 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
219 *value
220 }
221 }
222
223 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
224 for ScreenCaptureRotation
225 {
226 #[inline]
227 unsafe fn encode(
228 self,
229 encoder: &mut fidl::encoding::Encoder<'_, D>,
230 offset: usize,
231 _depth: fidl::encoding::Depth,
232 ) -> fidl::Result<()> {
233 encoder.debug_check_bounds::<Self>(offset);
234 encoder.write_num(self.into_primitive(), offset);
235 Ok(())
236 }
237 }
238
239 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ScreenCaptureRotation {
240 #[inline(always)]
241 fn new_empty() -> Self {
242 Self::Cw0Degrees
243 }
244
245 #[inline]
246 unsafe fn decode(
247 &mut self,
248 decoder: &mut fidl::encoding::Decoder<'_, D>,
249 offset: usize,
250 _depth: fidl::encoding::Depth,
251 ) -> fidl::Result<()> {
252 decoder.debug_check_bounds::<Self>(offset);
253 let prim = decoder.read_num::<u32>(offset);
254
255 *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
256 Ok(())
257 }
258 }
259}