Skip to content

Conversation

JoNil
Copy link

@JoNil JoNil commented Apr 25, 2024

Hi!

I have a dbc with this line in it:

VAL_ 123456 Name 14 "Error" 0 "Normal" 1 "Low" 2 "Too low" 3 "High" 4 "Reserved" 5 "Reserved" 6 "Reserved" 15 "Not Available" ;

That generated this code with dbc-codegen:

#[derive(Clone, Copy, PartialEq)]
#[derive(Debug)]
pub enum Name {
    Error,
    Normal,
    Low,
    TooLow,
    High,
    Reserved,
    Reserved,
    Reserved,
    NotAvailable,
    _Other(u8),
}

Which is not valid rust. With this pr the generated code instead becomes:

#[derive(Clone, Copy, PartialEq)]
#[derive(Debug)]
pub enum Name {
    Error,
    Normal,
    Low,
    TooLow,
    High,
    Reserved,
    Reserved2,
    Reserved3,
    NotAvailable,
    _Other(u8),
}

@marcelbuesing
Copy link
Collaborator

Hi thanks for bearing with me. I think this better fits in the dbc-codegen crate as it's quite specific to the codegen use case, but very valid for that.

jannes922 added a commit to jannes922/can-dbc that referenced this pull request May 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants