mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-02 04:04:19 +00:00
Rust Flatbuffers Verifier (#6269)
* Updated comments and fixed a fundemental type error. * bump rust flatbuffers semver * Initial commit with verifier, need to clean up * Verifier tested. Needs clean up and refactoring. * Display for InvalidFlatbuffer and better errors for strings * SimpleToVerify, some refactoring * Combined VerifierType TableAccessorFuncBody into FollowType * scrub todos * Update Rust get_root functions. There are 6 variants, with verifier options, default verifier options and no verification "fast". * Rename root fns * inline * Update to use thiserror * fix for bad compiler * improve error formatting * Replace multiply with saturating_multiply * saturating adds too * Add docs disclaiming experimental verification system Co-authored-by: Casper Neo <cneo@google.com>
This commit is contained in:
@@ -20,8 +20,7 @@ extern crate flatbuffers;
|
||||
// import the generated code
|
||||
#[path = "./monster_generated.rs"]
|
||||
mod monster_generated;
|
||||
pub use monster_generated::my_game::sample::{get_root_as_monster,
|
||||
Color, Equipment,
|
||||
pub use monster_generated::my_game::sample::{Color, Equipment,
|
||||
Monster, MonsterArgs,
|
||||
Vec3,
|
||||
Weapon, WeaponArgs};
|
||||
@@ -98,7 +97,7 @@ fn main() {
|
||||
let buf = builder.finished_data(); // Of type `&[u8]`
|
||||
|
||||
// Get access to the root:
|
||||
let monster = get_root_as_monster(buf);
|
||||
let monster = flatbuffers::root::<Monster>(buf).unwrap();
|
||||
|
||||
// Get and test some scalar types from the FlatBuffer.
|
||||
let hp = monster.hp();
|
||||
|
||||
Reference in New Issue
Block a user