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 AnnotationKeys = Vec<AnnotationKey>;
13
14pub const ANNOTATION_KEY_NAME: &str = "name";
17
18pub const ANNOTATION_KEY_PERSIST_ELEMENT: &str = "persist_element";
20
21pub const ANNOTATION_KEY_URL: &str = "url";
23
24pub const MANAGER_NAMESPACE: &str = "element_manager";
25
26pub const MAX_ANNOTATIONS_PER_ELEMENT: u32 = 1024;
28
29pub const MAX_ANNOTATION_KEY_NAMESPACE_SIZE: u32 = 128;
31
32pub const MAX_ANNOTATION_KEY_VALUE_SIZE: u32 = 128;
34
35#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
37#[repr(u32)]
38pub enum GetAnnotationsError {
39 BufferReadFailed = 1,
41}
42
43impl GetAnnotationsError {
44 #[inline]
45 pub fn from_primitive(prim: u32) -> Option<Self> {
46 match prim {
47 1 => Some(Self::BufferReadFailed),
48 _ => None,
49 }
50 }
51
52 #[inline]
53 pub const fn into_primitive(self) -> u32 {
54 self as u32
55 }
56}
57
58#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
59#[repr(u32)]
60pub enum ManagerError {
61 InvalidArgs = 1,
63 NotFound = 2,
65 UnableToPersist = 3,
68}
69
70impl ManagerError {
71 #[inline]
72 pub fn from_primitive(prim: u32) -> Option<Self> {
73 match prim {
74 1 => Some(Self::InvalidArgs),
75 2 => Some(Self::NotFound),
76 3 => Some(Self::UnableToPersist),
77 _ => None,
78 }
79 }
80
81 #[inline]
82 pub const fn into_primitive(self) -> u32 {
83 self as u32
84 }
85}
86
87#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
89#[repr(u32)]
90pub enum PresentViewError {
91 InvalidArgs = 1,
93}
94
95impl PresentViewError {
96 #[inline]
97 pub fn from_primitive(prim: u32) -> Option<Self> {
98 match prim {
99 1 => Some(Self::InvalidArgs),
100 _ => None,
101 }
102 }
103
104 #[inline]
105 pub const fn into_primitive(self) -> u32 {
106 self as u32
107 }
108}
109
110#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
112#[repr(u32)]
113pub enum UpdateAnnotationsError {
114 InvalidArgs = 1,
116 TooManyAnnotations = 2,
119}
120
121impl UpdateAnnotationsError {
122 #[inline]
123 pub fn from_primitive(prim: u32) -> Option<Self> {
124 match prim {
125 1 => Some(Self::InvalidArgs),
126 2 => Some(Self::TooManyAnnotations),
127 _ => None,
128 }
129 }
130
131 #[inline]
132 pub const fn into_primitive(self) -> u32 {
133 self as u32
134 }
135}
136
137#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
140pub enum WatchAnnotationsError {
141 BufferReadFailed,
143 #[doc(hidden)]
144 __SourceBreaking { unknown_ordinal: u32 },
145}
146
147#[macro_export]
149macro_rules! WatchAnnotationsErrorUnknown {
150 () => {
151 _
152 };
153}
154
155impl WatchAnnotationsError {
156 #[inline]
157 pub fn from_primitive(prim: u32) -> Option<Self> {
158 match prim {
159 1 => Some(Self::BufferReadFailed),
160 _ => None,
161 }
162 }
163
164 #[inline]
165 pub fn from_primitive_allow_unknown(prim: u32) -> Self {
166 match prim {
167 1 => Self::BufferReadFailed,
168 unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
169 }
170 }
171
172 #[inline]
173 pub fn unknown() -> Self {
174 Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
175 }
176
177 #[inline]
178 pub const fn into_primitive(self) -> u32 {
179 match self {
180 Self::BufferReadFailed => 1,
181 Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
182 }
183 }
184
185 #[inline]
186 pub fn is_unknown(&self) -> bool {
187 match self {
188 Self::__SourceBreaking { unknown_ordinal: _ } => true,
189 _ => false,
190 }
191 }
192}
193
194#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
196pub struct AnnotationKey {
197 pub namespace: String,
212 pub value: String,
215}
216
217impl fidl::Persistable for AnnotationKey {}
218
219#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
220pub struct ManagerRemoveElementRequest {
221 pub name: String,
222}
223
224impl fidl::Persistable for ManagerRemoveElementRequest {}
225
226pub mod annotation_controller_ordinals {
227 pub const UPDATE_ANNOTATIONS: u64 = 0x5718e51a2774c686;
228 pub const GET_ANNOTATIONS: u64 = 0xae78b17381824fa;
229 pub const WATCH_ANNOTATIONS: u64 = 0x253b196cae31356f;
230}
231
232pub mod controller_ordinals {
233 pub const UPDATE_ANNOTATIONS: u64 = 0x5718e51a2774c686;
234 pub const GET_ANNOTATIONS: u64 = 0xae78b17381824fa;
235 pub const WATCH_ANNOTATIONS: u64 = 0x253b196cae31356f;
236}
237
238pub mod graphical_presenter_ordinals {
239 pub const PRESENT_VIEW: u64 = 0x396042dd1422ac7a;
240}
241
242pub mod manager_ordinals {
243 pub const PROPOSE_ELEMENT: u64 = 0x2af76679cd73b902;
244 pub const REMOVE_ELEMENT: u64 = 0x1e65d66515e64b52;
245}
246
247pub mod view_controller_ordinals {
248 pub const DISMISS: u64 = 0x794061fcab05a3dc;
249 pub const ON_PRESENTED: u64 = 0x26977e68369330b5;
250}
251
252mod internal {
253 use super::*;
254 unsafe impl fidl::encoding::TypeMarker for GetAnnotationsError {
255 type Owned = Self;
256
257 #[inline(always)]
258 fn inline_align(_context: fidl::encoding::Context) -> usize {
259 std::mem::align_of::<u32>()
260 }
261
262 #[inline(always)]
263 fn inline_size(_context: fidl::encoding::Context) -> usize {
264 std::mem::size_of::<u32>()
265 }
266
267 #[inline(always)]
268 fn encode_is_copy() -> bool {
269 true
270 }
271
272 #[inline(always)]
273 fn decode_is_copy() -> bool {
274 false
275 }
276 }
277
278 impl fidl::encoding::ValueTypeMarker for GetAnnotationsError {
279 type Borrowed<'a> = Self;
280 #[inline(always)]
281 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
282 *value
283 }
284 }
285
286 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
287 for GetAnnotationsError
288 {
289 #[inline]
290 unsafe fn encode(
291 self,
292 encoder: &mut fidl::encoding::Encoder<'_, D>,
293 offset: usize,
294 _depth: fidl::encoding::Depth,
295 ) -> fidl::Result<()> {
296 encoder.debug_check_bounds::<Self>(offset);
297 encoder.write_num(self.into_primitive(), offset);
298 Ok(())
299 }
300 }
301
302 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for GetAnnotationsError {
303 #[inline(always)]
304 fn new_empty() -> Self {
305 Self::BufferReadFailed
306 }
307
308 #[inline]
309 unsafe fn decode(
310 &mut self,
311 decoder: &mut fidl::encoding::Decoder<'_, D>,
312 offset: usize,
313 _depth: fidl::encoding::Depth,
314 ) -> fidl::Result<()> {
315 decoder.debug_check_bounds::<Self>(offset);
316 let prim = decoder.read_num::<u32>(offset);
317
318 *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
319 Ok(())
320 }
321 }
322 unsafe impl fidl::encoding::TypeMarker for ManagerError {
323 type Owned = Self;
324
325 #[inline(always)]
326 fn inline_align(_context: fidl::encoding::Context) -> usize {
327 std::mem::align_of::<u32>()
328 }
329
330 #[inline(always)]
331 fn inline_size(_context: fidl::encoding::Context) -> usize {
332 std::mem::size_of::<u32>()
333 }
334
335 #[inline(always)]
336 fn encode_is_copy() -> bool {
337 true
338 }
339
340 #[inline(always)]
341 fn decode_is_copy() -> bool {
342 false
343 }
344 }
345
346 impl fidl::encoding::ValueTypeMarker for ManagerError {
347 type Borrowed<'a> = Self;
348 #[inline(always)]
349 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
350 *value
351 }
352 }
353
354 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for ManagerError {
355 #[inline]
356 unsafe fn encode(
357 self,
358 encoder: &mut fidl::encoding::Encoder<'_, D>,
359 offset: usize,
360 _depth: fidl::encoding::Depth,
361 ) -> fidl::Result<()> {
362 encoder.debug_check_bounds::<Self>(offset);
363 encoder.write_num(self.into_primitive(), offset);
364 Ok(())
365 }
366 }
367
368 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ManagerError {
369 #[inline(always)]
370 fn new_empty() -> Self {
371 Self::InvalidArgs
372 }
373
374 #[inline]
375 unsafe fn decode(
376 &mut self,
377 decoder: &mut fidl::encoding::Decoder<'_, D>,
378 offset: usize,
379 _depth: fidl::encoding::Depth,
380 ) -> fidl::Result<()> {
381 decoder.debug_check_bounds::<Self>(offset);
382 let prim = decoder.read_num::<u32>(offset);
383
384 *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
385 Ok(())
386 }
387 }
388 unsafe impl fidl::encoding::TypeMarker for PresentViewError {
389 type Owned = Self;
390
391 #[inline(always)]
392 fn inline_align(_context: fidl::encoding::Context) -> usize {
393 std::mem::align_of::<u32>()
394 }
395
396 #[inline(always)]
397 fn inline_size(_context: fidl::encoding::Context) -> usize {
398 std::mem::size_of::<u32>()
399 }
400
401 #[inline(always)]
402 fn encode_is_copy() -> bool {
403 true
404 }
405
406 #[inline(always)]
407 fn decode_is_copy() -> bool {
408 false
409 }
410 }
411
412 impl fidl::encoding::ValueTypeMarker for PresentViewError {
413 type Borrowed<'a> = Self;
414 #[inline(always)]
415 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
416 *value
417 }
418 }
419
420 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
421 for PresentViewError
422 {
423 #[inline]
424 unsafe fn encode(
425 self,
426 encoder: &mut fidl::encoding::Encoder<'_, D>,
427 offset: usize,
428 _depth: fidl::encoding::Depth,
429 ) -> fidl::Result<()> {
430 encoder.debug_check_bounds::<Self>(offset);
431 encoder.write_num(self.into_primitive(), offset);
432 Ok(())
433 }
434 }
435
436 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for PresentViewError {
437 #[inline(always)]
438 fn new_empty() -> Self {
439 Self::InvalidArgs
440 }
441
442 #[inline]
443 unsafe fn decode(
444 &mut self,
445 decoder: &mut fidl::encoding::Decoder<'_, D>,
446 offset: usize,
447 _depth: fidl::encoding::Depth,
448 ) -> fidl::Result<()> {
449 decoder.debug_check_bounds::<Self>(offset);
450 let prim = decoder.read_num::<u32>(offset);
451
452 *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
453 Ok(())
454 }
455 }
456 unsafe impl fidl::encoding::TypeMarker for UpdateAnnotationsError {
457 type Owned = Self;
458
459 #[inline(always)]
460 fn inline_align(_context: fidl::encoding::Context) -> usize {
461 std::mem::align_of::<u32>()
462 }
463
464 #[inline(always)]
465 fn inline_size(_context: fidl::encoding::Context) -> usize {
466 std::mem::size_of::<u32>()
467 }
468
469 #[inline(always)]
470 fn encode_is_copy() -> bool {
471 true
472 }
473
474 #[inline(always)]
475 fn decode_is_copy() -> bool {
476 false
477 }
478 }
479
480 impl fidl::encoding::ValueTypeMarker for UpdateAnnotationsError {
481 type Borrowed<'a> = Self;
482 #[inline(always)]
483 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
484 *value
485 }
486 }
487
488 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
489 for UpdateAnnotationsError
490 {
491 #[inline]
492 unsafe fn encode(
493 self,
494 encoder: &mut fidl::encoding::Encoder<'_, D>,
495 offset: usize,
496 _depth: fidl::encoding::Depth,
497 ) -> fidl::Result<()> {
498 encoder.debug_check_bounds::<Self>(offset);
499 encoder.write_num(self.into_primitive(), offset);
500 Ok(())
501 }
502 }
503
504 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
505 for UpdateAnnotationsError
506 {
507 #[inline(always)]
508 fn new_empty() -> Self {
509 Self::InvalidArgs
510 }
511
512 #[inline]
513 unsafe fn decode(
514 &mut self,
515 decoder: &mut fidl::encoding::Decoder<'_, D>,
516 offset: usize,
517 _depth: fidl::encoding::Depth,
518 ) -> fidl::Result<()> {
519 decoder.debug_check_bounds::<Self>(offset);
520 let prim = decoder.read_num::<u32>(offset);
521
522 *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
523 Ok(())
524 }
525 }
526 unsafe impl fidl::encoding::TypeMarker for WatchAnnotationsError {
527 type Owned = Self;
528
529 #[inline(always)]
530 fn inline_align(_context: fidl::encoding::Context) -> usize {
531 std::mem::align_of::<u32>()
532 }
533
534 #[inline(always)]
535 fn inline_size(_context: fidl::encoding::Context) -> usize {
536 std::mem::size_of::<u32>()
537 }
538
539 #[inline(always)]
540 fn encode_is_copy() -> bool {
541 false
542 }
543
544 #[inline(always)]
545 fn decode_is_copy() -> bool {
546 false
547 }
548 }
549
550 impl fidl::encoding::ValueTypeMarker for WatchAnnotationsError {
551 type Borrowed<'a> = Self;
552 #[inline(always)]
553 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
554 *value
555 }
556 }
557
558 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
559 for WatchAnnotationsError
560 {
561 #[inline]
562 unsafe fn encode(
563 self,
564 encoder: &mut fidl::encoding::Encoder<'_, D>,
565 offset: usize,
566 _depth: fidl::encoding::Depth,
567 ) -> fidl::Result<()> {
568 encoder.debug_check_bounds::<Self>(offset);
569 encoder.write_num(self.into_primitive(), offset);
570 Ok(())
571 }
572 }
573
574 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for WatchAnnotationsError {
575 #[inline(always)]
576 fn new_empty() -> Self {
577 Self::unknown()
578 }
579
580 #[inline]
581 unsafe fn decode(
582 &mut self,
583 decoder: &mut fidl::encoding::Decoder<'_, D>,
584 offset: usize,
585 _depth: fidl::encoding::Depth,
586 ) -> fidl::Result<()> {
587 decoder.debug_check_bounds::<Self>(offset);
588 let prim = decoder.read_num::<u32>(offset);
589
590 *self = Self::from_primitive_allow_unknown(prim);
591 Ok(())
592 }
593 }
594
595 impl fidl::encoding::ValueTypeMarker for AnnotationKey {
596 type Borrowed<'a> = &'a Self;
597 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
598 value
599 }
600 }
601
602 unsafe impl fidl::encoding::TypeMarker for AnnotationKey {
603 type Owned = Self;
604
605 #[inline(always)]
606 fn inline_align(_context: fidl::encoding::Context) -> usize {
607 8
608 }
609
610 #[inline(always)]
611 fn inline_size(_context: fidl::encoding::Context) -> usize {
612 32
613 }
614 }
615
616 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<AnnotationKey, D>
617 for &AnnotationKey
618 {
619 #[inline]
620 unsafe fn encode(
621 self,
622 encoder: &mut fidl::encoding::Encoder<'_, D>,
623 offset: usize,
624 _depth: fidl::encoding::Depth,
625 ) -> fidl::Result<()> {
626 encoder.debug_check_bounds::<AnnotationKey>(offset);
627 fidl::encoding::Encode::<AnnotationKey, D>::encode(
629 (
630 <fidl::encoding::BoundedString<128> as fidl::encoding::ValueTypeMarker>::borrow(
631 &self.namespace,
632 ),
633 <fidl::encoding::BoundedString<128> as fidl::encoding::ValueTypeMarker>::borrow(
634 &self.value,
635 ),
636 ),
637 encoder,
638 offset,
639 _depth,
640 )
641 }
642 }
643 unsafe impl<
644 D: fidl::encoding::ResourceDialect,
645 T0: fidl::encoding::Encode<fidl::encoding::BoundedString<128>, D>,
646 T1: fidl::encoding::Encode<fidl::encoding::BoundedString<128>, D>,
647 > fidl::encoding::Encode<AnnotationKey, D> for (T0, T1)
648 {
649 #[inline]
650 unsafe fn encode(
651 self,
652 encoder: &mut fidl::encoding::Encoder<'_, D>,
653 offset: usize,
654 depth: fidl::encoding::Depth,
655 ) -> fidl::Result<()> {
656 encoder.debug_check_bounds::<AnnotationKey>(offset);
657 self.0.encode(encoder, offset + 0, depth)?;
661 self.1.encode(encoder, offset + 16, depth)?;
662 Ok(())
663 }
664 }
665
666 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for AnnotationKey {
667 #[inline(always)]
668 fn new_empty() -> Self {
669 Self {
670 namespace: fidl::new_empty!(fidl::encoding::BoundedString<128>, D),
671 value: fidl::new_empty!(fidl::encoding::BoundedString<128>, D),
672 }
673 }
674
675 #[inline]
676 unsafe fn decode(
677 &mut self,
678 decoder: &mut fidl::encoding::Decoder<'_, D>,
679 offset: usize,
680 _depth: fidl::encoding::Depth,
681 ) -> fidl::Result<()> {
682 decoder.debug_check_bounds::<Self>(offset);
683 fidl::decode!(
685 fidl::encoding::BoundedString<128>,
686 D,
687 &mut self.namespace,
688 decoder,
689 offset + 0,
690 _depth
691 )?;
692 fidl::decode!(
693 fidl::encoding::BoundedString<128>,
694 D,
695 &mut self.value,
696 decoder,
697 offset + 16,
698 _depth
699 )?;
700 Ok(())
701 }
702 }
703
704 impl fidl::encoding::ValueTypeMarker for ManagerRemoveElementRequest {
705 type Borrowed<'a> = &'a Self;
706 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
707 value
708 }
709 }
710
711 unsafe impl fidl::encoding::TypeMarker for ManagerRemoveElementRequest {
712 type Owned = Self;
713
714 #[inline(always)]
715 fn inline_align(_context: fidl::encoding::Context) -> usize {
716 8
717 }
718
719 #[inline(always)]
720 fn inline_size(_context: fidl::encoding::Context) -> usize {
721 16
722 }
723 }
724
725 unsafe impl<D: fidl::encoding::ResourceDialect>
726 fidl::encoding::Encode<ManagerRemoveElementRequest, D> for &ManagerRemoveElementRequest
727 {
728 #[inline]
729 unsafe fn encode(
730 self,
731 encoder: &mut fidl::encoding::Encoder<'_, D>,
732 offset: usize,
733 _depth: fidl::encoding::Depth,
734 ) -> fidl::Result<()> {
735 encoder.debug_check_bounds::<ManagerRemoveElementRequest>(offset);
736 fidl::encoding::Encode::<ManagerRemoveElementRequest, D>::encode(
738 (<fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow(
739 &self.name,
740 ),),
741 encoder,
742 offset,
743 _depth,
744 )
745 }
746 }
747 unsafe impl<
748 D: fidl::encoding::ResourceDialect,
749 T0: fidl::encoding::Encode<fidl::encoding::UnboundedString, D>,
750 > fidl::encoding::Encode<ManagerRemoveElementRequest, D> for (T0,)
751 {
752 #[inline]
753 unsafe fn encode(
754 self,
755 encoder: &mut fidl::encoding::Encoder<'_, D>,
756 offset: usize,
757 depth: fidl::encoding::Depth,
758 ) -> fidl::Result<()> {
759 encoder.debug_check_bounds::<ManagerRemoveElementRequest>(offset);
760 self.0.encode(encoder, offset + 0, depth)?;
764 Ok(())
765 }
766 }
767
768 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
769 for ManagerRemoveElementRequest
770 {
771 #[inline(always)]
772 fn new_empty() -> Self {
773 Self { name: fidl::new_empty!(fidl::encoding::UnboundedString, D) }
774 }
775
776 #[inline]
777 unsafe fn decode(
778 &mut self,
779 decoder: &mut fidl::encoding::Decoder<'_, D>,
780 offset: usize,
781 _depth: fidl::encoding::Depth,
782 ) -> fidl::Result<()> {
783 decoder.debug_check_bounds::<Self>(offset);
784 fidl::decode!(
786 fidl::encoding::UnboundedString,
787 D,
788 &mut self.name,
789 decoder,
790 offset + 0,
791 _depth
792 )?;
793 Ok(())
794 }
795 }
796}