CAN DBC code generator for Rust
Generates Rust messages from a dbc
file.
⚠️ This is experimental - use with caution. Breaking changes will happen when you least expect it. ⚠️
Installation
With cargo:
Usage
Generate messages.rs
from example.dbc
:
Field/variant rename rules
If some field name starts with a non-alphabetic character or is a Rust keyword then it is prefixed with x
.
For example:
VAL_ 512 Five 0 "0Off" 1 "1On" 2 "2Oner" 3 "3Onest";
…is generated as:
Type
here:
SG_ Type : 30|1@0+ (1,0) [0|1] "boolean" Dolor
…conflicts with the Rust keyword type
. Therefore we prefix it with x
:
License
Licensed under either of
- Apache License, Version 2.0, (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
Contribution
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.