...
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#[allow(non_upper_case_globals)]
13mod bitflags_long_enum {
14 flatbuffers::bitflags::bitflags! {
15 #[derive(Default)]
16 pub struct LongEnum: u64 {
17 const LongOne = 2;
18 const LongTwo = 4;
19 const LongBig = 1099511627776;
20 }
21 }
22}
23pub use self::bitflags_long_enum::LongEnum;
24
25impl<'a> flatbuffers::Follow<'a> for LongEnum {
26 type Inner = Self;
27 #[inline]
28 unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
29 let b = flatbuffers::read_scalar_at::<u64>(buf, loc);
30 // Safety:
31 // This is safe because we know bitflags is implemented with a repr transparent uint of the correct size.
32 // from_bits_unchecked will be replaced by an equivalent but safe from_bits_retain in bitflags 2.0
33 // https://github.com/bitflags/bitflags/issues/262
34 Self::from_bits_unchecked(b)
35 }
36}
37
38impl flatbuffers::Push for LongEnum {
39 type Output = LongEnum;
40 #[inline]
41 unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
42 flatbuffers::emplace_scalar::<u64>(dst, self.bits());
43 }
44}
45
46impl flatbuffers::EndianScalar for LongEnum {
47 type Scalar = u64;
48 #[inline]
49 fn to_little_endian(self) -> u64 {
50 self.bits().to_le()
51 }
52 #[inline]
53 #[allow(clippy::wrong_self_convention)]
54 fn from_little_endian(v: u64) -> Self {
55 let b = u64::from_le(v);
56 // Safety:
57 // This is safe because we know bitflags is implemented with a repr transparent uint of the correct size.
58 // from_bits_unchecked will be replaced by an equivalent but safe from_bits_retain in bitflags 2.0
59 // https://github.com/bitflags/bitflags/issues/262
60 unsafe { Self::from_bits_unchecked(b) }
61 }
62}
63
64impl<'a> flatbuffers::Verifiable for LongEnum {
65 #[inline]
66 fn run_verifier(
67 v: &mut flatbuffers::Verifier, pos: usize
68 ) -> Result<(), flatbuffers::InvalidFlatbuffer> {
69 use self::flatbuffers::Verifiable;
70 u64::run_verifier(v, pos)
71 }
72}
73
74impl flatbuffers::SimpleToVerifyInSlice for LongEnum {}
View as plain text