* Update release script to update Rust version (it still needs to be published after)
* Also update rust while I'm at it
Co-authored-by: Casper Neo <cneo@google.com>
* [Rust] Add length checks to arrays and vectors.
The previous behavior allowed for out of bounds access in
the public API (#7011).
* bump semver and test warning
Co-authored-by: Casper Neo <cneo@google.com>
* fix for rust build
* Rust: Implement Serialize on generated types
For debugging convenience it is really handy to be able to dump out
types as another format (ie: json). For example, if we are logging a
type to a structured logging system, or even printing it out in a
structured way to the console.
Right now we handle this by shelling out to `flatc` which is not ideal;
by implementing Serialize on the generated types we can use any of the
Serializer-implementing packages for our structured debug output.
* clang-format
* Make the flatbuffers Rust crate only have an optional dependency on the `serde` packages.
* fix warning
* fix rust test build
* Oh yeah this needs to be initialized
* fix toml syntax
* code review feedback
* rebuild test data
* benchmark many vtables
* Rust: Store written_table rev-positions sorted.
The previous implementation was slow if there were too many tables.
Asymototically when inserting the n^th vtable: The old implementation
took O(n) lookup steps and O(1) insertion. The new implementation is
O(log n) lookup and O(n) insertion. This might be improved further by
using a balanced btree.
Benchmarking, create_many_tables is 7.5x faster (on my laptop):
// Simple vector cache
test create_many_tables ... bench: 728,875 ns/iter (+/- 12,279) = 44 MB/s
// Sorted vector cache
test create_many_tables ... bench: 97,843 ns/iter (+/- 4,430) = 334 MB/s
* Fix lints
Co-authored-by: Casper Neo <cneo@google.com>
* Implement Serialize for flexbuffer::Reader
* bump version
* Remove use of experimantal or-patterns
* Remove more use of experimantal or-patterns
Co-authored-by: Casper Neo <cneo@google.com>
* Introduce new_from_vec in Rust (also fix formatting)
Also, rename `new_with_capacity` to `with_capacity` to match
how `Vec` does it.
* bump rust version
* mut_finished_buffer
Co-authored-by: Casper Neo <cneo@google.com>
* Fix Miri flag passing and bump Rust version.
* Fix Miri problems from Arrays PR.
SafeSliceAccess was removed for Arrays. It's kind of unsound.
It has two properties:
1. EndianSafe
2. Alignment 1
We only need 1. in create_vector_direct to memcpy data.
We both 1. and 2. for accessing things with slices as buffers are built on &[u8]
which is unaligned. Conditional compilation implements
SafeSliceAccess for >1byte scalars (like f32) on LittleEndian machines
which is wrong since they don't satisfy 2.
This UB is still accessible for Vectors (though not exercised our
tests) as it implements SafeSliceAccess. I'll fix this later by
splitting SafeSliceAccess into its 2 properties.
Co-authored-by: Casper Neo <cneo@google.com>
* 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>
* Add support for fixed size arrays
* clang-format
* Update rust image to 1.51 to support const generics
* Handle correctly big endian
* Add fuzz tests and clean code
* Add struct fuzz test and optimize struct arrays for api
* Bump flatbuffers crate version
* Remove debug code
This was added for testing in the recent genericize PR for flexbuffer Reader.
* Added alloc tests -> MapReader::{is_empty, index_key, len}
* Added , accessible through Deref to deprecation warning
* feature/rust-tokio-bytes added feature name for tokio-bytes
* Added flexbuffer implementation, TODO: typecast to avoid recurse
* Converted codebase to utilize FlexBuffer implementation, need to resolve deserialization issues
* Added todo for lifetime issue, may use &'de [u8] for deserializer instead of current method
* Added proper &[u8] implementation
* Removed unused struct
* Added experimental fix to get_slice
* Added experimental fix to get_slice
* Avoided lifetime issues via ref structs, need to check if this hurts peformance
* Updated deserializer implementation to allow for borrowed data from Reader struct
* Fixed bug with str
* Removed unnecessary generic parameter
* Added unsafe to avoid lifetime complaints, current tests pass, need to review alternatives to unsafe
* Opinionated: Removed bytes crate as this implementation could be done in a separate crate
* Cleaned up flatbuffer
* Fixed sample / example
* Resolved PR feedback, need to resolve issues with tests
* Cleaned up FlexBuffer trait to be an auto impl
* Removed TODO
* Reverted Deserializer to only support &'de [u8]
* Cleaned up / renamed function for clarification
* Renamed FlexBuffer -> InternalBuffer for clarification on it's purpose
* Fixed issue with key bytes
* resolved issues with broken tests, confirming this is a breaking change
* Removed FIXME that's solved by splitting String and Key variants
* Implemented associated types approach
* Fixed backward slice logic
* Fixed MapReader compile error
* Added from_buffer for deserialization, removed function since it's only needed for deserialization
* Removed dead code
* Cleaned up buffer, removed AsRef in favor of Deref
* Renamed Buffer::as_str -> Buffer::buffer_str
* Minor cleanup
* Updated documentation, need to fix tests
* Removed unnecessary &
* Removed unused lifetime
* removed unnecessary as_ref
* Minor optimization wrap-up
* resolved issue with Clone
* Added test to verify no deep-copy
* Added for optimization
* Updated to use empty fn instead of default
* Updated comments / test name - plus the 0.3.0 version bump
* comment
* Fix miri problems by assuming alignment is 1 in rust
* Removed is_aligned fn from rust verifier.
* Add back is_aligned, but make it w.r.t. buffer[0]
* touch unused variable
* touch unused variable
* +nightly
* Move Rust miri testing into its own docker
* fix bash
* missing one endian conversion
* fix endianness2
* format stuff
Co-authored-by: Casper Neo <cneo@google.com>
* Adds shared strings and tests for shared strings
* Adds resets on string_map
* Moved shared strings to use vector instead of hashmap
* Addresses all the issues
* Resolves some comments
* 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>