Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generate Clone and Copy traits for Multiplexor structures #81

Open
utopalex opened this issue Aug 14, 2024 · 0 comments
Open

Generate Clone and Copy traits for Multiplexor structures #81

utopalex opened this issue Aug 14, 2024 · 0 comments

Comments

@utopalex
Copy link

Given a multiplexor structure such as

BO_ 850 ID352BMS_energyStatus: 8 VehicleBus
 SG_ BMS_multiplexor M : 0|2@1+ (1,0) [0|3] "" Vector__XXX
 SG_ BMS_energyBuffer m1 : 16|16@1+ (0.01,0) [0|655.35] "KWh"  Receiver
 SG_ BMS_energyToChargeComplete m1 : 48|16@1+ (0.02,0) [0|1310.7] "KWh"  Receiver
 SG_ BMS_expectedEnergyRemaining m1 : 32|16@1+ (0.02,0) [0|1310.7] "KWh"  Receiver
 SG_ BMS_fullChargeComplete : 7|1@1+ (1,0) [0|1] ""  Receiver
 SG_ BMS_idealEnergyRemaining m0 : 48|16@1+ (0.02,0) [0|1310.7] "KWh"  Receiver
 SG_ BMS_nominalEnergyRemaining m0 : 32|16@1+ (0.02,0) [0|1310.7] "KWh"  Receiver
 SG_ BMS_nominalFullPackEnergy m0 : 16|16@1+ (0.02,0) [0|1310.7] "KWh"  Receiver

dbc-codegen properly generates:

#[derive(Default)]
#[cfg_attr(feature = "debug", derive(Debug))]
pub struct Id352bmsEnergyStatusBmsMultiplexorM0 { raw: [u8; 8] }

However, since it doesn't generate #[derive(Default, Copy, Clone)], I can't use this enum type directly in my multi-threaded code without running into "Id352bmsEnergyStatusBmsMultiplexorM0: Clone" is not satisfied.
For other types, directly implementing a message, however these traits are generated.

I can manually add "Copy, Clone" traits and make the generated code works, but it breaks once I make a change to my DBC file.

Is there a good reason for this behaviour and some way to get around it, or could it be a new feature?

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

No branches or pull requests

1 participant