{"id":13438459,"url":"https://github.com/marcelbuesing/can-dbc","last_synced_at":"2025-04-06T01:08:14.882Z","repository":{"id":37561724,"uuid":"150968971","full_name":"marcelbuesing/can-dbc","owner":"marcelbuesing","description":"Rust dbc parser","archived":false,"fork":false,"pushed_at":"2024-04-25T09:40:21.000Z","size":944,"stargazers_count":73,"open_issues_count":10,"forks_count":30,"subscribers_count":5,"default_branch":"dev","last_synced_at":"2025-04-01T20:00:12.341Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/marcelbuesing.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-09-30T13:18:54.000Z","updated_at":"2025-02-19T16:59:04.000Z","dependencies_parsed_at":"2024-10-25T18:41:16.398Z","dependency_job_id":"fb374b41-e48b-401d-a9b3-7ae76c4dcec1","html_url":"https://github.com/marcelbuesing/can-dbc","commit_stats":{"total_commits":158,"total_committers":6,"mean_commits":"26.333333333333332","dds":0.03797468354430378,"last_synced_commit":"7a3592008ea9accb531235937198fe8dd72a7428"},"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcelbuesing%2Fcan-dbc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcelbuesing%2Fcan-dbc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcelbuesing%2Fcan-dbc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcelbuesing%2Fcan-dbc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/marcelbuesing","download_url":"https://codeload.github.com/marcelbuesing/can-dbc/tar.gz/refs/heads/dev","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247419860,"owners_count":20936012,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-31T03:01:05.700Z","updated_at":"2025-04-06T01:08:14.866Z","avatar_url":"https://github.com/marcelbuesing.png","language":"Rust","readme":"# can-dbc\n[![LICENSE](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)\n[![VERSION](https://img.shields.io/crates/v/can-dbc.svg)](https://crates.io/crates/can-dbc)\n[![Actions Status](https://github.com/marcelbuesing/can-dbc/workflows/Continuous%20integration/badge.svg)](https://github.com/marcelbuesing/can-dbc/actions?query=workflow%3A\"Continuous+integration\")\n[![codecov](https://codecov.io/gh/marcelbuesing/can-dbc/branch/dev/graph/badge.svg)](https://codecov.io/gh/marcelbuesing/can-dbc)\n[![docs](https://docs.rs/can-dbc/badge.svg)](https://docs.rs/can-dbc)\n[![Cargo Deny Status](https://img.shields.io/badge/cargo--deny-license%20checked-green)](https://github.com/marcelbuesing/can-dbc/actions?query=workflow%3A\"Continuous+integration\")\n\nA CAN-dbc format parser written with Rust's [nom](https://github.com/Geal/nom) parser combinator library.\n\n# 1. Example\n\nRead dbc file and generate Rust structs based on the messages/signals defined in the dbc.\n\n```rust\nuse can_dbc::DBC;\nuse codegen::Scope;\n\nuse std::fs::File;\nuse std::io;\nuse std::io::prelude::*;\n\nfn main() -\u003e io::Result\u003c()\u003e {\n    let mut f = File::open(\"./examples/sample.dbc\")?;\n    let mut buffer = Vec::new();\n    f.read_to_end(\u0026mut buffer)?;\n\n    let dbc = can_dbc::DBC::from_slice(\u0026buffer).expect(\"Failed to parse dbc file\");\n\n    let mut scope = Scope::new();\n    for message in dbc.messages() {\n        for signal in message.signals() {\n\n            let mut scope = Scope::new();\n            let message_struct = scope.new_struct(message.message_name());\n            for signal in message.signals() {\n                message_struct.field(signal.name().to_lowercase().as_str(), \"f64\");\n            }\n        }\n    }\n\n    println!(\"{}\", scope.to_string());\n    Ok(())\n}\n```\n\nFor a proper implementation for reading or writing CAN frames according to the DBC, I recommend you take a look at [dbc-codegen](https://github.com/technocreatives/dbc-codegen).\n\n# 2. Example\n\nThe file parser simply parses a dbc input file and prints the parsed content.\n```\ncargo test \u0026\u0026 ./target/debug/examples/file_parser -i examples/sample.dbc\n```\n\n# Installation\ncan-dbc is available on crates.io and can be included in your Cargo enabled project like this:\n\n```yml\n[dependencies]\ncan-dbc = \"3.0\"\n```\n\n# Implemented DBC parts\n\n- [x] version\n- [x] new_symbols\n- [x] bit_timing *(deprecated but mandatory)*\n- [x] nodes\n- [x] value_tables\n- [x] messages\n- [x] message_transmitters\n- [x] environment_variables\n- [x] environment_variables_data\n- [x] signal_types\n- [x] comments\n- [x] attribute_definitions\n- [ ] sigtype_attr_list *(format missing documentation)*\n- [x] attribute_defaults\n- [x] attribute_values\n- [x] value_descriptions\n- [ ] category_definitions *(deprecated)*\n- [ ] categories *(deprecated)*\n- [ ] filter *(deprecated)*\n- [x] signal_type_refs\n- [x] signal_groups\n- [x] signal_extended_value_type_list\n\n# Deviating from standard\n- multispace between parsers instead of single space allowing e.g. (two spaces) `SIG_GROUP  13`.\n- `VAL_` suffix may be ` ;` or `;`\n\n# Alternatives\n- [canparse](https://github.com/jmagnuson/canparse)\n\n# Credits\nTest dbcs files were copied from the [cantools](https://github.com/eerimoq/cantools) project.\n\n# License Checks\n\nThis project uses [cargo-deny](https://github.com/EmbarkStudios/cargo-deny) for checking the licenses of dependencies. To run the check locally run the following:\n\n```\ncargo install cargo-deny\ncargo deny check\n```\n","funding_links":[],"categories":["Libraries","库 Libraries","库"],"sub_categories":["Automotive","汽车 Automotive","汽车"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarcelbuesing%2Fcan-dbc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmarcelbuesing%2Fcan-dbc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarcelbuesing%2Fcan-dbc/lists"}