forked from BigfootDev/flatbuffers
Implement Serialize on generated rust types (#7022)
* 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
This commit is contained in:
@@ -103,6 +103,7 @@ CPP_17_OPTS = NO_INCL_OPTS + [
|
||||
"--gen-object-api",
|
||||
]
|
||||
RUST_OPTS = BASE_OPTS + ["--rust", "--gen-all", "--gen-name-strings"]
|
||||
RUST_SERIALIZE_OPTS = BASE_OPTS + ["--rust", "--gen-all", "--gen-name-strings", "--rust-serialize"]
|
||||
TS_OPTS = ["--ts", "--gen-name-strings"]
|
||||
LOBSTER_OPTS = ["--lobster"]
|
||||
SWIFT_OPTS = ["--swift", "--gen-json-emit", "--bfbs-filenames", str(tests_path)]
|
||||
@@ -155,6 +156,14 @@ flatc(
|
||||
data="monsterdata_test.json",
|
||||
)
|
||||
|
||||
flatc(
|
||||
RUST_SERIALIZE_OPTS,
|
||||
schema="monster_test.fbs",
|
||||
include="include_test",
|
||||
prefix="monster_test_serialize",
|
||||
data="monsterdata_test.json",
|
||||
)
|
||||
|
||||
flatc(
|
||||
options=BASE_OPTS + ["--python"],
|
||||
schema="monster_test.fbs",
|
||||
|
||||
Reference in New Issue
Block a user