{"repo":"oxibus/dbc-codegen","free":true,"listed":false,"github":"https://github.com/oxibus/dbc-codegen","clone":"git clone https://github.com/oxibus/dbc-codegen.git","description":"Generate Rust structs for messages from a dbc (CAN bus definition) file.","language":"Rust","stars":78,"topics":["rust","can","can-bus","codegen","dbc","library","cli","build-tool"],"license":"Apache-2.0","category":"dev-tools","readme_excerpt":"CAN DBC code generator for Rust Generates Rust messages from a dbc file. DBC files are descriptions of CAN frames. See this post for an introduction. Installation Install published version using cargo: Install latest version from the git repository: Using dbc-codegen Generate messages.rs from example.dbc using the CLI: Or put something like this into your build.rs file. Create a Config and pass it to codegen along with the contents of a DBC-file. See Config docs for a complete list of options. Using generated Rust code dbc-codegen generates a Rust file that is usually placed into the OUT DIR directory. Here is an example testing/can-messages/Cargo.toml which defines dependencies and features that are used in generated message file. Project setup To use the code, add this code to your lib.rs (or main.rs ): You will most likely want to interact with the generated Messages enum, and call Messages::from can message(id, &payload) . Note: The generated code contains a lot of documentation. Give it a try: Optional impls The generator config has the following flags that control what code gets generated: - impl debug : enables #[derive(Debug)] for messages. - impl arbitrary : enables implementation of Arbitrary trait. Also requires you to add arbitrary crate (version 1.x) as a dependency of the crate. - impl error : Implements core::error::Error for CanError . This makes it easy to use crates like anyhow for error handling. - check ranges : adds range checks in signal setters. (Enable","default_branch":null,"files":null,"tree":[],"storefront":"/r/oxibus","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/oxibus/dbc-codegen/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}