Skip to main content

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