Rust Object API (#6070)

* inital commit of rust object api

* Required fields support.

* clang fallthrough

* Fix unused variables

* just don't fall through

* remove comment

* s/panic/unreachable

* Tests for object API

* Added defaults

* deleted unintentionally added files and updated .bat file

* fix bat file

* clang format

* Cargo clippy checks

* remove commented out code

* clippy allows

* Remove matches! macro since we're not yet at Rust v1.42

* install clippy in RustTest.sh

* move line

Co-authored-by: Casper Neo <cneo@google.com>
This commit is contained in:
Casper
2021-01-22 13:07:32 -05:00
committed by GitHub
parent 796ed68faf
commit 1da0a2dfac
21 changed files with 2362 additions and 319 deletions

View File

@@ -21,33 +21,30 @@ if [[ "$1" == "mips-unknown-linux-gnu" ]]; then
export CARGO_TARGET_MIPS_UNKNOWN_LINUX_GNU_RUNNER="qemu-mips -L /usr/mips-linux-gnu"
fi
function check_test_result() {
if [[ $? == 0 ]]; then
echo OK: $1 passed.
else
echo KO: $1 failed.
exit 1
fi
}
cd ./rust_usage_test
cargo test $TARGET_FLAG -- --quiet
TEST_RESULT=$?
if [[ $TEST_RESULT == 0 ]]; then
echo "OK: Rust tests passed."
else
echo "KO: Rust tests failed."
exit 1
fi
check_test_result "Rust tests"
cargo run $TARGET_FLAG --bin=flatbuffers_alloc_check
TEST_RESULT=$?
if [[ $TEST_RESULT == 0 ]]; then
echo "OK: Rust heap alloc test passed."
else
echo "KO: Rust heap alloc test failed."
exit 1
fi
check_test_result "Rust flatbuffers heap alloc test"
cargo run $TARGET_FLAG --bin=flexbuffers_alloc_check
TEST_RESULT=$?
if [[ $TEST_RESULT == 0 ]]; then
echo "OK: Rust heap alloc test passed."
else
echo "KO: Rust heap alloc test failed."
exit 1
fi
check_test_result "Rust flexbuffers heap alloc test"
rustup component add clippy
cargo clippy $TARGET_FLAG
check_test_result "No Cargo clippy lints test"
cargo bench $TARGET_FLAG