rust: Allow for usage in no_std environment (#6989)

This commit is contained in:
Marcin Witkowski
2022-01-20 17:49:02 +01:00
committed by GitHub
parent d7b75417fc
commit aff818cebf
14 changed files with 70 additions and 40 deletions

View File

@@ -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"

View File

@@ -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;