4 releases
0.2.1 | Aug 9, 2019 |
---|---|
0.2.0 | May 5, 2019 |
0.1.9 | Apr 8, 2019 |
0.1.8 | Apr 8, 2019 |
#34 in #flat-buffers
30 downloads per month
Used in 4 crates
(3 directly)
6KB
138 lines
CFB Encoding
CFB (Canonical FlatBuffers) is a restricted variant of FlatBuffers for producing unequivocal transfer syntax.
CKB no longer uses CFB, see nervosnetwork/rfcs#136.
And CFB has not reached the defined scope since we decided to move on. However, the generated verifier is still useful since the current Rust Flatbuffer generator just panics on invalid input.
Usage
Install the code geneartor as commane line utility:
pip install -U cfbc
First generate bfbs file from fbs:
flatc -b --schema example.fbs
Then generate rust files from bfbs:
cfbc example.bfbs
Use Verifier with flatbuffers rust
- Add the generated
<name>_generated_verifier.rs
to the project in the same directory with the file<name>_generated.rs
generated byflatc -r
. - Add crate
flatbuffers-verifier
as a dependency in Cargo.toml. - Use the same version of
flatbuffers
as inflatbuffers-verifier
.
flatbuffers-verifier = "0.2.0"
flatbuffers = "0.6.0"
The crate flatbuffers-verifier
defines a function get_root
, which is intended to replace the
function with the same name in flatbuffers
. This function will verify the
buffer, and returns a Result
to indicate whether the buffer is valid.
Dependencies
~180KB