fidl_fuchsia_session_scene__common/
fidl_fuchsia_session_scene__common.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::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
8use futures::future::{self, MaybeDone, TryFutureExt};
9use zx_status;
10
11/// The possible errors from the `PresentRootView` family of requests.
12#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
13pub enum PresentRootViewError {
14    /// An error occurred while processing the request.
15    InternalError,
16    #[doc(hidden)]
17    __SourceBreaking { unknown_ordinal: u32 },
18}
19
20/// Pattern that matches an unknown `PresentRootViewError` member.
21#[macro_export]
22macro_rules! PresentRootViewErrorUnknown {
23    () => {
24        _
25    };
26}
27
28impl PresentRootViewError {
29    #[inline]
30    pub fn from_primitive(prim: u32) -> Option<Self> {
31        match prim {
32            1 => Some(Self::InternalError),
33            _ => None,
34        }
35    }
36
37    #[inline]
38    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
39        match prim {
40            1 => Self::InternalError,
41            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
42        }
43    }
44
45    #[inline]
46    pub fn unknown() -> Self {
47        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
48    }
49
50    #[inline]
51    pub const fn into_primitive(self) -> u32 {
52        match self {
53            Self::InternalError => 1,
54            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
55        }
56    }
57
58    #[inline]
59    pub fn is_unknown(&self) -> bool {
60        match self {
61            Self::__SourceBreaking { unknown_ordinal: _ } => true,
62            _ => false,
63        }
64    }
65}
66
67pub mod manager_ordinals {
68    pub const SET_ROOT_VIEW: u64 = 0x3095976368270dc4;
69    pub const PRESENT_ROOT_VIEW_LEGACY: u64 = 0x17729b456a2eff7;
70    pub const PRESENT_ROOT_VIEW: u64 = 0x51e070bb675a18df;
71}
72
73mod internal {
74    use super::*;
75    unsafe impl fidl::encoding::TypeMarker for PresentRootViewError {
76        type Owned = Self;
77
78        #[inline(always)]
79        fn inline_align(_context: fidl::encoding::Context) -> usize {
80            std::mem::align_of::<u32>()
81        }
82
83        #[inline(always)]
84        fn inline_size(_context: fidl::encoding::Context) -> usize {
85            std::mem::size_of::<u32>()
86        }
87
88        #[inline(always)]
89        fn encode_is_copy() -> bool {
90            false
91        }
92
93        #[inline(always)]
94        fn decode_is_copy() -> bool {
95            false
96        }
97    }
98
99    impl fidl::encoding::ValueTypeMarker for PresentRootViewError {
100        type Borrowed<'a> = Self;
101        #[inline(always)]
102        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
103            *value
104        }
105    }
106
107    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
108        for PresentRootViewError
109    {
110        #[inline]
111        unsafe fn encode(
112            self,
113            encoder: &mut fidl::encoding::Encoder<'_, D>,
114            offset: usize,
115            _depth: fidl::encoding::Depth,
116        ) -> fidl::Result<()> {
117            encoder.debug_check_bounds::<Self>(offset);
118            encoder.write_num(self.into_primitive(), offset);
119            Ok(())
120        }
121    }
122
123    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for PresentRootViewError {
124        #[inline(always)]
125        fn new_empty() -> Self {
126            Self::unknown()
127        }
128
129        #[inline]
130        unsafe fn decode(
131            &mut self,
132            decoder: &mut fidl::encoding::Decoder<'_, D>,
133            offset: usize,
134            _depth: fidl::encoding::Depth,
135        ) -> fidl::Result<()> {
136            decoder.debug_check_bounds::<Self>(offset);
137            let prim = decoder.read_num::<u32>(offset);
138
139            *self = Self::from_primitive_allow_unknown(prim);
140            Ok(())
141        }
142    }
143}