natkeo559 / can-types

A rust crate for encoding or decoding various Controller Area Network (CAN) data types, including the SAE J1939 standard.
https://crates.io/crates/can-types
Apache License 2.0
7 stars 0 forks source link

Add new optional feature "endian-num" #23

Open natkeo559 opened 2 months ago

natkeo559 commented 2 months ago

The endian-num crate offers some feature to effectively enforce endianness of certain types. This is something that may easily be integrated into can-types to provide endianness guarantees since some ECUs can be strictly Big-Endian or Little-Endian. Developers using this can, in theory, have some reassurance that their usage of can-types is behaving as expected.

For example, a type using endian-num has a Little-Endian byte order even on Big-Endian machines, or vice versa.

Implementing this might require adding additional conditional feature flags or macros. Some initial testing also indicates that a new branch build could be the simplest implementation.

Caveats: