Crates.io | sbe-codegen |
lib.rs | sbe-codegen |
version | |
source | src |
created_at | 2024-10-19 10:44:56.90253 |
updated_at | 2024-10-19 10:44:56.90253 |
description | Performance-oriented multi-language SBE codec generator |
homepage | https://github.com/python-systems/sbe-codegen |
repository | https://github.com/python-systems/sbe-codegen |
max_upload_size | |
id | 1415252 |
Cargo.toml error: | TOML parse error at line 19, column 1 | 19 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include` |
size | 0 |
sbe-codegen is a tool to generate language-specific codecs for data structures encoded using Simple Binary Encoding.
sbe-codegen can be installed either by building from sources directly or by downloading from the JFrog crates repository.
The MSRV for sbe-codegen is 1.73.0
.
This means that sbe-codegen will compile with any version of Rust greater than or equal to 1.73.0
.
The code generation is currently broken on the stable channel due to certain features being unstable.
You can install the latest version of sbe-codegen by running:
$ cargo install sbe-codegen
Assuming you have this repository checked-out locally, you can build sbe-codegen by running:
$ cargo build --release
$ sbe-codegen --help
SBE multi-language codec generator
Usage: sbe-codegen [OPTIONS] --schema <SCHEMA_PATH> --language <LANGUAGE> --project-name <PROJECT_NAME> --project-path <PROJECT_PATH>
Options:
--schema <SCHEMA_PATH> Path to XML SBE schema
--language <LANGUAGE> Codec language [possible values: rust, python]
--project-name <PROJECT_NAME> Project name
--project-path <PROJECT_PATH> Project path
--project-version <VERSION> Project version (optional, taken from schema if not specified)
--with-test-deps Include test dependencies
--format Format project
-h, --help Print help
The following command generates Rust codecs for the example schema in the examples
directory:
$ sbe-codegen --schema ./examples/example-schema.xml --language rust --project-name example --project-path ./examples/rust --with-test-deps --format
The Python codecs similarly can be generated by running:
$ sbe-codegen --schema ./examples/example-schema.xml --language python --project-name example --project-path ./examples/python --format
The Rust codecs then can be compiled by running:
$ cd ./examples/rust
$ cargo build --release
Similarly, the Python codecs can be compiled by running (maturin is required):
$ cd ./examples/python
$ maturin build --release
Usage examples of the generated codecs can be found in the tests provided in the examples/rust/tests
(Rust) or examples/python/tests
(Python) directories.
If you want to test the generated codecs, generate them with the --with-test-deps
flag and run the tests with:
$ cd ./examples/rust
$ cargo test
$ cd ./examples/python
$ poetry install
$ maturin dev #--release (for benchmarks)
$ pytest