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