1#![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 type ViewId = String;
12
13#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
15pub enum ScreensaverError {
16 NotSupported,
18 BadOperation,
20 #[doc(hidden)]
21 __SourceBreaking { unknown_ordinal: u32 },
22}
23
24#[macro_export]
26macro_rules! ScreensaverErrorUnknown {
27 () => {
28 _
29 };
30}
31
32impl ScreensaverError {
33 #[inline]
34 pub fn from_primitive(prim: u32) -> Option<Self> {
35 match prim {
36 1 => Some(Self::NotSupported),
37 2 => Some(Self::BadOperation),
38 _ => None,
39 }
40 }
41
42 #[inline]
43 pub fn from_primitive_allow_unknown(prim: u32) -> Self {
44 match prim {
45 1 => Self::NotSupported,
46 2 => Self::BadOperation,
47 unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
48 }
49 }
50
51 #[inline]
52 pub fn unknown() -> Self {
53 Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
54 }
55
56 #[inline]
57 pub const fn into_primitive(self) -> u32 {
58 match self {
59 Self::NotSupported => 1,
60 Self::BadOperation => 2,
61 Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
62 }
63 }
64
65 #[inline]
66 pub fn is_unknown(&self) -> bool {
67 match self {
68 Self::__SourceBreaking { unknown_ordinal: _ } => true,
69 _ => false,
70 }
71 }
72}
73
74#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
75pub struct ListedView {
76 pub position: u64,
77 pub id: String,
78}
79
80impl fidl::Persistable for ListedView {}
81
82#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
83#[repr(C)]
84pub struct ManagerFocusRequest {
85 pub position: u64,
86}
87
88impl fidl::Persistable for ManagerFocusRequest {}
89
90#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
91#[repr(C)]
92pub struct ManagerSetOrderRequest {
93 pub old_position: u64,
94 pub new_position: u64,
95}
96
97impl fidl::Persistable for ManagerSetOrderRequest {}
98
99#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
100pub struct ManagerListResponse {
101 pub views: Vec<ListedView>,
102}
103
104impl fidl::Persistable for ManagerListResponse {}
105
106#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
107pub struct ScreensaverSetRequest {
108 pub screensaver_on: bool,
110}
111
112impl fidl::Persistable for ScreensaverSetRequest {}
113
114pub mod manager_ordinals {
115 pub const LIST: u64 = 0x217177a089d8841b;
116 pub const SET_ORDER: u64 = 0x1a1478f581f1f3c2;
117 pub const CYCLE: u64 = 0x4211a94117087267;
118 pub const FOCUS: u64 = 0x789b0f092eb9551f;
119}
120
121pub mod screensaver_ordinals {
122 pub const SET: u64 = 0x312967391552d3eb;
123}
124
125mod internal {
126 use super::*;
127 unsafe impl fidl::encoding::TypeMarker for ScreensaverError {
128 type Owned = Self;
129
130 #[inline(always)]
131 fn inline_align(_context: fidl::encoding::Context) -> usize {
132 std::mem::align_of::<u32>()
133 }
134
135 #[inline(always)]
136 fn inline_size(_context: fidl::encoding::Context) -> usize {
137 std::mem::size_of::<u32>()
138 }
139
140 #[inline(always)]
141 fn encode_is_copy() -> bool {
142 false
143 }
144
145 #[inline(always)]
146 fn decode_is_copy() -> bool {
147 false
148 }
149 }
150
151 impl fidl::encoding::ValueTypeMarker for ScreensaverError {
152 type Borrowed<'a> = Self;
153 #[inline(always)]
154 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
155 *value
156 }
157 }
158
159 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
160 for ScreensaverError
161 {
162 #[inline]
163 unsafe fn encode(
164 self,
165 encoder: &mut fidl::encoding::Encoder<'_, D>,
166 offset: usize,
167 _depth: fidl::encoding::Depth,
168 ) -> fidl::Result<()> {
169 encoder.debug_check_bounds::<Self>(offset);
170 encoder.write_num(self.into_primitive(), offset);
171 Ok(())
172 }
173 }
174
175 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ScreensaverError {
176 #[inline(always)]
177 fn new_empty() -> Self {
178 Self::unknown()
179 }
180
181 #[inline]
182 unsafe fn decode(
183 &mut self,
184 decoder: &mut fidl::encoding::Decoder<'_, D>,
185 offset: usize,
186 _depth: fidl::encoding::Depth,
187 ) -> fidl::Result<()> {
188 decoder.debug_check_bounds::<Self>(offset);
189 let prim = decoder.read_num::<u32>(offset);
190
191 *self = Self::from_primitive_allow_unknown(prim);
192 Ok(())
193 }
194 }
195
196 impl fidl::encoding::ValueTypeMarker for ListedView {
197 type Borrowed<'a> = &'a Self;
198 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
199 value
200 }
201 }
202
203 unsafe impl fidl::encoding::TypeMarker for ListedView {
204 type Owned = Self;
205
206 #[inline(always)]
207 fn inline_align(_context: fidl::encoding::Context) -> usize {
208 8
209 }
210
211 #[inline(always)]
212 fn inline_size(_context: fidl::encoding::Context) -> usize {
213 24
214 }
215 }
216
217 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<ListedView, D>
218 for &ListedView
219 {
220 #[inline]
221 unsafe fn encode(
222 self,
223 encoder: &mut fidl::encoding::Encoder<'_, D>,
224 offset: usize,
225 _depth: fidl::encoding::Depth,
226 ) -> fidl::Result<()> {
227 encoder.debug_check_bounds::<ListedView>(offset);
228 fidl::encoding::Encode::<ListedView, D>::encode(
230 (
231 <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.position),
232 <fidl::encoding::BoundedString<128> as fidl::encoding::ValueTypeMarker>::borrow(
233 &self.id,
234 ),
235 ),
236 encoder,
237 offset,
238 _depth,
239 )
240 }
241 }
242 unsafe impl<
243 D: fidl::encoding::ResourceDialect,
244 T0: fidl::encoding::Encode<u64, D>,
245 T1: fidl::encoding::Encode<fidl::encoding::BoundedString<128>, D>,
246 > fidl::encoding::Encode<ListedView, D> for (T0, T1)
247 {
248 #[inline]
249 unsafe fn encode(
250 self,
251 encoder: &mut fidl::encoding::Encoder<'_, D>,
252 offset: usize,
253 depth: fidl::encoding::Depth,
254 ) -> fidl::Result<()> {
255 encoder.debug_check_bounds::<ListedView>(offset);
256 self.0.encode(encoder, offset + 0, depth)?;
260 self.1.encode(encoder, offset + 8, depth)?;
261 Ok(())
262 }
263 }
264
265 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ListedView {
266 #[inline(always)]
267 fn new_empty() -> Self {
268 Self {
269 position: fidl::new_empty!(u64, D),
270 id: fidl::new_empty!(fidl::encoding::BoundedString<128>, D),
271 }
272 }
273
274 #[inline]
275 unsafe fn decode(
276 &mut self,
277 decoder: &mut fidl::encoding::Decoder<'_, D>,
278 offset: usize,
279 _depth: fidl::encoding::Depth,
280 ) -> fidl::Result<()> {
281 decoder.debug_check_bounds::<Self>(offset);
282 fidl::decode!(u64, D, &mut self.position, decoder, offset + 0, _depth)?;
284 fidl::decode!(
285 fidl::encoding::BoundedString<128>,
286 D,
287 &mut self.id,
288 decoder,
289 offset + 8,
290 _depth
291 )?;
292 Ok(())
293 }
294 }
295
296 impl fidl::encoding::ValueTypeMarker for ManagerFocusRequest {
297 type Borrowed<'a> = &'a Self;
298 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
299 value
300 }
301 }
302
303 unsafe impl fidl::encoding::TypeMarker for ManagerFocusRequest {
304 type Owned = Self;
305
306 #[inline(always)]
307 fn inline_align(_context: fidl::encoding::Context) -> usize {
308 8
309 }
310
311 #[inline(always)]
312 fn inline_size(_context: fidl::encoding::Context) -> usize {
313 8
314 }
315 #[inline(always)]
316 fn encode_is_copy() -> bool {
317 true
318 }
319
320 #[inline(always)]
321 fn decode_is_copy() -> bool {
322 true
323 }
324 }
325
326 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<ManagerFocusRequest, D>
327 for &ManagerFocusRequest
328 {
329 #[inline]
330 unsafe fn encode(
331 self,
332 encoder: &mut fidl::encoding::Encoder<'_, D>,
333 offset: usize,
334 _depth: fidl::encoding::Depth,
335 ) -> fidl::Result<()> {
336 encoder.debug_check_bounds::<ManagerFocusRequest>(offset);
337 unsafe {
338 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
340 (buf_ptr as *mut ManagerFocusRequest)
341 .write_unaligned((self as *const ManagerFocusRequest).read());
342 }
345 Ok(())
346 }
347 }
348 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u64, D>>
349 fidl::encoding::Encode<ManagerFocusRequest, D> for (T0,)
350 {
351 #[inline]
352 unsafe fn encode(
353 self,
354 encoder: &mut fidl::encoding::Encoder<'_, D>,
355 offset: usize,
356 depth: fidl::encoding::Depth,
357 ) -> fidl::Result<()> {
358 encoder.debug_check_bounds::<ManagerFocusRequest>(offset);
359 self.0.encode(encoder, offset + 0, depth)?;
363 Ok(())
364 }
365 }
366
367 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ManagerFocusRequest {
368 #[inline(always)]
369 fn new_empty() -> Self {
370 Self { position: fidl::new_empty!(u64, D) }
371 }
372
373 #[inline]
374 unsafe fn decode(
375 &mut self,
376 decoder: &mut fidl::encoding::Decoder<'_, D>,
377 offset: usize,
378 _depth: fidl::encoding::Depth,
379 ) -> fidl::Result<()> {
380 decoder.debug_check_bounds::<Self>(offset);
381 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
382 unsafe {
385 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
386 }
387 Ok(())
388 }
389 }
390
391 impl fidl::encoding::ValueTypeMarker for ManagerSetOrderRequest {
392 type Borrowed<'a> = &'a Self;
393 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
394 value
395 }
396 }
397
398 unsafe impl fidl::encoding::TypeMarker for ManagerSetOrderRequest {
399 type Owned = Self;
400
401 #[inline(always)]
402 fn inline_align(_context: fidl::encoding::Context) -> usize {
403 8
404 }
405
406 #[inline(always)]
407 fn inline_size(_context: fidl::encoding::Context) -> usize {
408 16
409 }
410 #[inline(always)]
411 fn encode_is_copy() -> bool {
412 true
413 }
414
415 #[inline(always)]
416 fn decode_is_copy() -> bool {
417 true
418 }
419 }
420
421 unsafe impl<D: fidl::encoding::ResourceDialect>
422 fidl::encoding::Encode<ManagerSetOrderRequest, D> for &ManagerSetOrderRequest
423 {
424 #[inline]
425 unsafe fn encode(
426 self,
427 encoder: &mut fidl::encoding::Encoder<'_, D>,
428 offset: usize,
429 _depth: fidl::encoding::Depth,
430 ) -> fidl::Result<()> {
431 encoder.debug_check_bounds::<ManagerSetOrderRequest>(offset);
432 unsafe {
433 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
435 (buf_ptr as *mut ManagerSetOrderRequest)
436 .write_unaligned((self as *const ManagerSetOrderRequest).read());
437 }
440 Ok(())
441 }
442 }
443 unsafe impl<
444 D: fidl::encoding::ResourceDialect,
445 T0: fidl::encoding::Encode<u64, D>,
446 T1: fidl::encoding::Encode<u64, D>,
447 > fidl::encoding::Encode<ManagerSetOrderRequest, D> for (T0, T1)
448 {
449 #[inline]
450 unsafe fn encode(
451 self,
452 encoder: &mut fidl::encoding::Encoder<'_, D>,
453 offset: usize,
454 depth: fidl::encoding::Depth,
455 ) -> fidl::Result<()> {
456 encoder.debug_check_bounds::<ManagerSetOrderRequest>(offset);
457 self.0.encode(encoder, offset + 0, depth)?;
461 self.1.encode(encoder, offset + 8, depth)?;
462 Ok(())
463 }
464 }
465
466 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
467 for ManagerSetOrderRequest
468 {
469 #[inline(always)]
470 fn new_empty() -> Self {
471 Self { old_position: fidl::new_empty!(u64, D), new_position: fidl::new_empty!(u64, D) }
472 }
473
474 #[inline]
475 unsafe fn decode(
476 &mut self,
477 decoder: &mut fidl::encoding::Decoder<'_, D>,
478 offset: usize,
479 _depth: fidl::encoding::Depth,
480 ) -> fidl::Result<()> {
481 decoder.debug_check_bounds::<Self>(offset);
482 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
483 unsafe {
486 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 16);
487 }
488 Ok(())
489 }
490 }
491
492 impl fidl::encoding::ValueTypeMarker for ManagerListResponse {
493 type Borrowed<'a> = &'a Self;
494 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
495 value
496 }
497 }
498
499 unsafe impl fidl::encoding::TypeMarker for ManagerListResponse {
500 type Owned = Self;
501
502 #[inline(always)]
503 fn inline_align(_context: fidl::encoding::Context) -> usize {
504 8
505 }
506
507 #[inline(always)]
508 fn inline_size(_context: fidl::encoding::Context) -> usize {
509 16
510 }
511 }
512
513 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<ManagerListResponse, D>
514 for &ManagerListResponse
515 {
516 #[inline]
517 unsafe fn encode(
518 self,
519 encoder: &mut fidl::encoding::Encoder<'_, D>,
520 offset: usize,
521 _depth: fidl::encoding::Depth,
522 ) -> fidl::Result<()> {
523 encoder.debug_check_bounds::<ManagerListResponse>(offset);
524 fidl::encoding::Encode::<ManagerListResponse, D>::encode(
526 (
527 <fidl::encoding::UnboundedVector<ListedView> as fidl::encoding::ValueTypeMarker>::borrow(&self.views),
528 ),
529 encoder, offset, _depth
530 )
531 }
532 }
533 unsafe impl<
534 D: fidl::encoding::ResourceDialect,
535 T0: fidl::encoding::Encode<fidl::encoding::UnboundedVector<ListedView>, D>,
536 > fidl::encoding::Encode<ManagerListResponse, D> for (T0,)
537 {
538 #[inline]
539 unsafe fn encode(
540 self,
541 encoder: &mut fidl::encoding::Encoder<'_, D>,
542 offset: usize,
543 depth: fidl::encoding::Depth,
544 ) -> fidl::Result<()> {
545 encoder.debug_check_bounds::<ManagerListResponse>(offset);
546 self.0.encode(encoder, offset + 0, depth)?;
550 Ok(())
551 }
552 }
553
554 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ManagerListResponse {
555 #[inline(always)]
556 fn new_empty() -> Self {
557 Self { views: fidl::new_empty!(fidl::encoding::UnboundedVector<ListedView>, D) }
558 }
559
560 #[inline]
561 unsafe fn decode(
562 &mut self,
563 decoder: &mut fidl::encoding::Decoder<'_, D>,
564 offset: usize,
565 _depth: fidl::encoding::Depth,
566 ) -> fidl::Result<()> {
567 decoder.debug_check_bounds::<Self>(offset);
568 fidl::decode!(
570 fidl::encoding::UnboundedVector<ListedView>,
571 D,
572 &mut self.views,
573 decoder,
574 offset + 0,
575 _depth
576 )?;
577 Ok(())
578 }
579 }
580
581 impl fidl::encoding::ValueTypeMarker for ScreensaverSetRequest {
582 type Borrowed<'a> = &'a Self;
583 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
584 value
585 }
586 }
587
588 unsafe impl fidl::encoding::TypeMarker for ScreensaverSetRequest {
589 type Owned = Self;
590
591 #[inline(always)]
592 fn inline_align(_context: fidl::encoding::Context) -> usize {
593 1
594 }
595
596 #[inline(always)]
597 fn inline_size(_context: fidl::encoding::Context) -> usize {
598 1
599 }
600 }
601
602 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<ScreensaverSetRequest, D>
603 for &ScreensaverSetRequest
604 {
605 #[inline]
606 unsafe fn encode(
607 self,
608 encoder: &mut fidl::encoding::Encoder<'_, D>,
609 offset: usize,
610 _depth: fidl::encoding::Depth,
611 ) -> fidl::Result<()> {
612 encoder.debug_check_bounds::<ScreensaverSetRequest>(offset);
613 fidl::encoding::Encode::<ScreensaverSetRequest, D>::encode(
615 (<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.screensaver_on),),
616 encoder,
617 offset,
618 _depth,
619 )
620 }
621 }
622 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<bool, D>>
623 fidl::encoding::Encode<ScreensaverSetRequest, D> for (T0,)
624 {
625 #[inline]
626 unsafe fn encode(
627 self,
628 encoder: &mut fidl::encoding::Encoder<'_, D>,
629 offset: usize,
630 depth: fidl::encoding::Depth,
631 ) -> fidl::Result<()> {
632 encoder.debug_check_bounds::<ScreensaverSetRequest>(offset);
633 self.0.encode(encoder, offset + 0, depth)?;
637 Ok(())
638 }
639 }
640
641 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ScreensaverSetRequest {
642 #[inline(always)]
643 fn new_empty() -> Self {
644 Self { screensaver_on: fidl::new_empty!(bool, D) }
645 }
646
647 #[inline]
648 unsafe fn decode(
649 &mut self,
650 decoder: &mut fidl::encoding::Decoder<'_, D>,
651 offset: usize,
652 _depth: fidl::encoding::Depth,
653 ) -> fidl::Result<()> {
654 decoder.debug_check_bounds::<Self>(offset);
655 fidl::decode!(bool, D, &mut self.screensaver_on, decoder, offset + 0, _depth)?;
657 Ok(())
658 }
659 }
660}