Crate dbc_rs

Crate dbc_rs 

Source
Expand description

§dbc-rs

A no_std compatible Rust library for parsing and working with DBC (CAN database) files.

§Features

  • no_std compatible: Works in embedded environments without the standard library
  • Zero dependencies: Pure Rust implementation
  • Memory efficient: Uses fixed-size arrays for no_std builds
  • Type-safe: Strong typing for all DBC elements
  • Internationalized errors: Support for multiple languages

§Kernel Support (Experimental)

⚠️ EXPERIMENTAL: The kernel feature is experimental and subject to change. It provides compatibility with Linux kernel’s kernel::alloc API for use in kernel modules. This feature is still under development and may have breaking changes.

  • The kernel feature is mutually exclusive with alloc and std
  • Uses a mock kernel::alloc implementation for testing (not the real kernel alloc API)
  • Real kernel usage requires integration with rust-for-linux
  • API may change without notice

§Usage

use dbc_rs::Dbc;

let dbc_content = r#"VERSION "1.0"

BU_: ECM TCM

BO_ 256 EngineData : 8 ECM
 SG_ RPM : 0|16@0+ (0.25,0) [0|8000] "rpm" TCM
"#;

let dbc = Dbc::parse(dbc_content)?;

Structs§

Dbc
Represents a complete DBC (CAN database) file.
DbcBuilder
Builder for constructing Dbc instances programmatically.
Message
Represents a CAN message in a DBC file.
MessageBuilder
MessageList
Encapsulates the messages array and count for a DBC
Nodes
Represents a collection of node (ECU) names from a DBC file.
NodesBuilder
Builder for creating Nodes programmatically.
ParseOptions
Options for configuring DBC parsing behavior.
ReceiversBuilder
Builder for creating Receivers programmatically.
Signal
SignalBuilder
Signals
Encapsulates the signals array and count for a message
ValueDescriptions
Value descriptions for a signal.
ValueDescriptionsBuilder
Builder for creating ValueDescriptions programmatically.
ValueDescriptionsList
Encapsulates the value descriptions map for a DBC
Version
Represents a version string from a DBC file.
VersionBuilder
Builder for creating Version programmatically.

Enums§

ByteOrder
Byte order (endianness) for signal encoding in CAN messages.
Error
Error type for DBC parsing and validation operations.
Receivers
Represents the receiver nodes for a signal in a DBC file.

Constants§

PKG_VERSION
The version of this crate as specified in Cargo.toml.

Type Aliases§

Result
Result type alias for operations that can return an Error.