Last active
January 14, 2019 00:53
-
-
Save jean-airoldie/32204335e355115ae66c2e701ebeb51a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// automatically generated by the FlatBuffers compiler, do not modify | |
#![allow(dead_code)] | |
#![allow(unused_imports)] | |
extern crate flatbuffers; | |
// struct Message, aligned to 4 | |
#[repr(C, align(4))] | |
#[derive(Clone, Copy, Debug, PartialEq)] | |
pub struct Message { | |
value_: u32, | |
} // pub struct Message | |
impl flatbuffers::SafeSliceAccess for Message {} | |
impl<'a> flatbuffers::Follow<'a> for Message { | |
type Inner = &'a Message; | |
#[inline] | |
fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { | |
<&'a Message>::follow(buf, loc) | |
} | |
} | |
impl<'a> flatbuffers::Follow<'a> for &'a Message { | |
type Inner = &'a Message; | |
#[inline] | |
fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { | |
flatbuffers::follow_cast_ref::<Message>(buf, loc) | |
} | |
} | |
impl<'b> flatbuffers::Push for Message { | |
type Output = Message; | |
#[inline] | |
fn push(&self, dst: &mut [u8], _rest: &[u8]) { | |
let src = unsafe { | |
::std::slice::from_raw_parts(self as *const Message as *const u8, Self::size()) | |
}; | |
dst.copy_from_slice(src); | |
} | |
} | |
impl<'b> flatbuffers::Push for &'b Message { | |
type Output = Message; | |
#[inline] | |
fn push(&self, dst: &mut [u8], _rest: &[u8]) { | |
let src = unsafe { | |
::std::slice::from_raw_parts(*self as *const Message as *const u8, Self::size()) | |
}; | |
dst.copy_from_slice(src); | |
} | |
} | |
impl Message { | |
pub fn new<'a>(_value: u32) -> Self { | |
Message { | |
value_: _value.to_little_endian(), | |
} | |
} | |
pub fn value<'a>(&'a self) -> u32 { | |
self.value_.from_little_endian() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment