mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-09 06:30:54 +00:00
Mark endian_scalar as unsafe. (#6588)
* Mark endian_scalar as unsafe. Also - removed the deprecated flexbuffer slice from example - fixed some cargo warnings * Assertions and read_scalar made unsafe * Clippy lints * Add to Safety Co-authored-by: Casper Neo <cneo@google.com>
This commit is contained in:
@@ -71,7 +71,9 @@ impl<'a> flatbuffers::Follow<'a> for FromInclude {
|
||||
type Inner = Self;
|
||||
#[inline]
|
||||
fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
|
||||
let b = flatbuffers::read_scalar_at::<i64>(buf, loc);
|
||||
let b = unsafe {
|
||||
flatbuffers::read_scalar_at::<i64>(buf, loc)
|
||||
};
|
||||
Self(b)
|
||||
}
|
||||
}
|
||||
@@ -80,7 +82,7 @@ impl flatbuffers::Push for FromInclude {
|
||||
type Output = FromInclude;
|
||||
#[inline]
|
||||
fn push(&self, dst: &mut [u8], _rest: &[u8]) {
|
||||
flatbuffers::emplace_scalar::<i64>(dst, self.0);
|
||||
unsafe { flatbuffers::emplace_scalar::<i64>(dst, self.0); }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user