Skip to content

Generate Clone and Copy traits for Multiplexor structures #81

@utopalex

Description

@utopalex

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions