diff options
author | StackDoubleFlow <ojaslandge@gmail.com> | 2019-10-19 22:24:13 -0500 |
---|---|---|
committer | Robert Winslow <rw@users.noreply.github.com> | 2019-10-19 23:24:13 -0400 |
commit | e93c8c46e65056381c1862d1be67a5e0dad57948 (patch) | |
tree | 46f3cd0c14d239b5a3dd71d3d45456485762e1fd /rust | |
parent | e21516b9d7797a66daaf4f3e4f3df1da1588faa2 (diff) | |
download | flatbuffers-e93c8c46e65056381c1862d1be67a5e0dad57948.tar.gz flatbuffers-e93c8c46e65056381c1862d1be67a5e0dad57948.tar.bz2 flatbuffers-e93c8c46e65056381c1862d1be67a5e0dad57948.zip |
Fix Follow implementation for bool (#5554)
Diffstat (limited to 'rust')
-rw-r--r-- | rust/flatbuffers/src/primitives.rs | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/rust/flatbuffers/src/primitives.rs b/rust/flatbuffers/src/primitives.rs index 2f3b7421..ccab9386 100644 --- a/rust/flatbuffers/src/primitives.rs +++ b/rust/flatbuffers/src/primitives.rs @@ -263,6 +263,14 @@ impl<'a, T: Follow<'a> + 'a> Follow<'a> for SkipFileIdentifier<T> { } } +impl<'a> Follow<'a> for bool { + type Inner = bool; + #[inline(always)] + fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { + read_scalar_at::<u8>(buf, loc) != 0 + } +} + /// Follow trait impls for primitive types. /// /// Ideally, these would be implemented as a single impl using trait bounds on @@ -280,7 +288,6 @@ macro_rules! impl_follow_for_endian_scalar { }; } -impl_follow_for_endian_scalar!(bool); impl_follow_for_endian_scalar!(u8); impl_follow_for_endian_scalar!(u16); impl_follow_for_endian_scalar!(u32); |