| 1 |
// automatically generated by the FlatBuffers compiler, do not modify |
| 2 |
// @generated |
| 3 |
extern crate alloc; |
| 4 |
extern crate flatbuffers; |
| 5 |
use alloc::boxed::Box; |
| 6 |
use alloc::string::{String, ToString}; |
| 7 |
use alloc::vec::Vec; |
| 8 |
use core::mem; |
| 9 |
use core::cmp::Ordering; |
| 10 |
use self::flatbuffers::{EndianScalar, Follow}; |
| 11 |
use super::*; |
| 12 |
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] |
| 13 |
pub const ENUM_MIN_ENUM_IN_NESTED_NS: i8 = 0; |
| 14 |
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] |
| 15 |
pub const ENUM_MAX_ENUM_IN_NESTED_NS: i8 = 2; |
| 16 |
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] |
| 17 |
#[allow(non_camel_case_types)] |
| 18 |
pub const ENUM_VALUES_ENUM_IN_NESTED_NS: [EnumInNestedNS; 3] = [ |
| 19 |
EnumInNestedNS::A, |
| 20 |
EnumInNestedNS::B, |
| 21 |
EnumInNestedNS::C, |
| 22 |
]; |
| 23 |
|
| 24 |
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)] |
| 25 |
#[repr(transparent)] |
| 26 |
pub struct EnumInNestedNS(pub i8); |
| 27 |
#[allow(non_upper_case_globals)] |
| 28 |
impl EnumInNestedNS { |
| 29 |
pub const A: Self = Self(0); |
| 30 |
pub const B: Self = Self(1); |
| 31 |
pub const C: Self = Self(2); |
| 32 |
|
| 33 |
pub const ENUM_MIN: i8 = 0; |
| 34 |
pub const ENUM_MAX: i8 = 2; |
| 35 |
pub const ENUM_VALUES: &'static [Self] = &[ |
| 36 |
Self::A, |
| 37 |
Self::B, |
| 38 |
Self::C, |
| 39 |
]; |
| 40 |
/// Returns the variant's name or "" if unknown. |
| 41 |
pub fn variant_name(self) -> Option<&'static str> { |
| 42 |
match self { |
| 43 |
Self::A => Some("A"), |
| 44 |
Self::B => Some("B"), |
| 45 |
Self::C => Some("C"), |
| 46 |
_ => None, |
| 47 |
} |
| 48 |
} |
| 49 |
} |
| 50 |
impl core::fmt::Debug for EnumInNestedNS { |
| 51 |
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { |
| 52 |
if let Some(name) = self.variant_name() { |
| 53 |
f.write_str(name) |
| 54 |
} else { |
| 55 |
f.write_fmt(format_args!("<UNKNOWN {:?}>", self.0)) |
| 56 |
} |
| 57 |
} |
| 58 |
} |
| 59 |
impl<'a> flatbuffers::Follow<'a> for EnumInNestedNS { |
| 60 |
type Inner = Self; |
| 61 |
#[inline] |
| 62 |
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { |
| 63 |
let b = flatbuffers::read_scalar_at::<i8>(buf, loc); |
| 64 |
Self(b) |
| 65 |
} |
| 66 |
} |
| 67 |
|
| 68 |
impl flatbuffers::Push for EnumInNestedNS { |
| 69 |
type Output = EnumInNestedNS; |
| 70 |
#[inline] |
| 71 |
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { |
| 72 |
flatbuffers::emplace_scalar::<i8>(dst, self.0); |
| 73 |
} |
| 74 |
} |
| 75 |
|
| 76 |
impl flatbuffers::EndianScalar for EnumInNestedNS { |
| 77 |
type Scalar = i8; |
| 78 |
#[inline] |
| 79 |
fn to_little_endian(self) -> i8 { |
| 80 |
self.0.to_le() |
| 81 |
} |
| 82 |
#[inline] |
| 83 |
#[allow(clippy::wrong_self_convention)] |
| 84 |
fn from_little_endian(v: i8) -> Self { |
| 85 |
let b = i8::from_le(v); |
| 86 |
Self(b) |
| 87 |
} |
| 88 |
} |
| 89 |
|
| 90 |
impl<'a> flatbuffers::Verifiable for EnumInNestedNS { |
| 91 |
#[inline] |
| 92 |
fn run_verifier( |
| 93 |
v: &mut flatbuffers::Verifier, pos: usize |
| 94 |
) -> Result<(), flatbuffers::InvalidFlatbuffer> { |
| 95 |
use self::flatbuffers::Verifiable; |
| 96 |
i8::run_verifier(v, pos) |
| 97 |
} |
| 98 |
} |
| 99 |
|
| 100 |
impl flatbuffers::SimpleToVerifyInSlice for EnumInNestedNS {} |