mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-22 10:08:52 +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:
@@ -27,13 +27,13 @@ macro_rules! make_test {
|
||||
);
|
||||
builder.finish(ss, None);
|
||||
|
||||
let s = flatbuffers::get_root::<ScalarStuff>(builder.finished_data());
|
||||
let s = flatbuffers::root::<ScalarStuff>(builder.finished_data()).unwrap();
|
||||
assert_eq!(s.$just(), $five);
|
||||
assert_eq!(s.$default(), $five);
|
||||
assert_eq!(s.$maybe(), Some($five));
|
||||
|
||||
// Test defaults are used when not specified.
|
||||
let s = flatbuffers::get_root::<ScalarStuff>(&[0; 8]);
|
||||
let s = flatbuffers::root::<ScalarStuff>(&[0; 8]).unwrap();
|
||||
assert_eq!(s.$just(), $zero);
|
||||
assert_eq!(s.$default(), $fortytwo);
|
||||
assert_eq!(s.$maybe(), None);
|
||||
|
||||
Reference in New Issue
Block a user