mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-10 23:17:27 +00:00
rust: Allow for usage in no_std environment (#6989)
This commit is contained in:
@@ -35,6 +35,8 @@ cd ./rust_usage_test
|
||||
cargo test $TARGET_FLAG -- --quiet
|
||||
check_test_result "Rust tests"
|
||||
|
||||
cargo test $TARGET_FLAG --no-default-features --features no_std -- --quiet
|
||||
check_test_result "Rust tests (no_std)"
|
||||
|
||||
cargo run $TARGET_FLAG --bin=flatbuffers_alloc_check
|
||||
check_test_result "Rust flatbuffers heap alloc test"
|
||||
|
||||
@@ -6,11 +6,16 @@ authors = ["Robert Winslow <hello@rwinslow.com>",
|
||||
"FlatBuffers Maintainers"]
|
||||
|
||||
[dependencies]
|
||||
flatbuffers = { path = "../../rust/flatbuffers" }
|
||||
flatbuffers = { path = "../../rust/flatbuffers", default-features = false }
|
||||
flexbuffers = { path = "../../rust/flexbuffers" }
|
||||
serde_derive = "1.0"
|
||||
serde = "1.0"
|
||||
serde_bytes = "0.11"
|
||||
libc_alloc = { version = "1.0.3", optional = true }
|
||||
|
||||
[features]
|
||||
default = ["flatbuffers/default"]
|
||||
no_std = ["flatbuffers/no_std", "libc_alloc"]
|
||||
|
||||
[[bin]]
|
||||
name = "monster_example"
|
||||
|
||||
@@ -15,6 +15,10 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#[cfg(feature = "no_std")]
|
||||
#[global_allocator]
|
||||
static ALLOCATOR: libc_alloc::LibcAlloc = libc_alloc::LibcAlloc;
|
||||
|
||||
#[macro_use]
|
||||
#[cfg(not(miri))] // slow.
|
||||
extern crate quickcheck;
|
||||
|
||||
Reference in New Issue
Block a user