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
67mod internal {
68    use super::*;
69    unsafe impl fidl::encoding::TypeMarker for PresentRootViewError {
70        type Owned = Self;
71
72        #[inline(always)]
73        fn inline_align(_context: fidl::encoding::Context) -> usize {
74            std::mem::align_of::<u32>()
75        }
76
77        #[inline(always)]
78        fn inline_size(_context: fidl::encoding::Context) -> usize {
79            std::mem::size_of::<u32>()
80        }
81
82        #[inline(always)]
83        fn encode_is_copy() -> bool {
84            false
85        }
86
87        #[inline(always)]
88        fn decode_is_copy() -> bool {
89            false
90        }
91    }
92
93    impl fidl::encoding::ValueTypeMarker for PresentRootViewError {
94        type Borrowed<'a> = Self;
95        #[inline(always)]
96        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
97            *value
98        }
99    }
100
101    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
102        for PresentRootViewError
103    {
104        #[inline]
105        unsafe fn encode(
106            self,
107            encoder: &mut fidl::encoding::Encoder<'_, D>,
108            offset: usize,
109            _depth: fidl::encoding::Depth,
110        ) -> fidl::Result<()> {
111            encoder.debug_check_bounds::<Self>(offset);
112            encoder.write_num(self.into_primitive(), offset);
113            Ok(())
114        }
115    }
116
117    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for PresentRootViewError {
118        #[inline(always)]
119        fn new_empty() -> Self {
120            Self::unknown()
121        }
122
123        #[inline]
124        unsafe fn decode(
125            &mut self,
126            decoder: &mut fidl::encoding::Decoder<'_, D>,
127            offset: usize,
128            _depth: fidl::encoding::Depth,
129        ) -> fidl::Result<()> {
130            decoder.debug_check_bounds::<Self>(offset);
131            let prim = decoder.read_num::<u32>(offset);
132
133            *self = Self::from_primitive_allow_unknown(prim);
134            Ok(())
135        }
136    }
137}