fidl_fuchsia_location__common/
fidl_fuchsia_location__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/// Describes possible errors.
12#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
13#[repr(u32)]
14pub enum Error {
15    GeneralError = 1,
16}
17
18impl Error {
19    #[inline]
20    pub fn from_primitive(prim: u32) -> Option<Self> {
21        match prim {
22            1 => Some(Self::GeneralError),
23            _ => None,
24        }
25    }
26
27    #[inline]
28    pub const fn into_primitive(self) -> u32 {
29        self as u32
30    }
31}
32
33mod internal {
34    use super::*;
35    unsafe impl fidl::encoding::TypeMarker for Error {
36        type Owned = Self;
37
38        #[inline(always)]
39        fn inline_align(_context: fidl::encoding::Context) -> usize {
40            std::mem::align_of::<u32>()
41        }
42
43        #[inline(always)]
44        fn inline_size(_context: fidl::encoding::Context) -> usize {
45            std::mem::size_of::<u32>()
46        }
47
48        #[inline(always)]
49        fn encode_is_copy() -> bool {
50            true
51        }
52
53        #[inline(always)]
54        fn decode_is_copy() -> bool {
55            false
56        }
57    }
58
59    impl fidl::encoding::ValueTypeMarker for Error {
60        type Borrowed<'a> = Self;
61        #[inline(always)]
62        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
63            *value
64        }
65    }
66
67    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for Error {
68        #[inline]
69        unsafe fn encode(
70            self,
71            encoder: &mut fidl::encoding::Encoder<'_, D>,
72            offset: usize,
73            _depth: fidl::encoding::Depth,
74        ) -> fidl::Result<()> {
75            encoder.debug_check_bounds::<Self>(offset);
76            encoder.write_num(self.into_primitive(), offset);
77            Ok(())
78        }
79    }
80
81    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Error {
82        #[inline(always)]
83        fn new_empty() -> Self {
84            Self::GeneralError
85        }
86
87        #[inline]
88        unsafe fn decode(
89            &mut self,
90            decoder: &mut fidl::encoding::Decoder<'_, D>,
91            offset: usize,
92            _depth: fidl::encoding::Depth,
93        ) -> fidl::Result<()> {
94            decoder.debug_check_bounds::<Self>(offset);
95            let prim = decoder.read_num::<u32>(offset);
96
97            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
98            Ok(())
99        }
100    }
101}