You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Unlike C/C++ Rust enums are exhaustive: All possible values need to be explicitly mentioned.
That means that casting from the underlying type (e.g. 9 bit integer) to the enumeration can cause UB if the value stored in flatdata does not exist in the enumeration (e.g. corrupted file, etc).
Rust doesn't currently support C-like enums. This means that our options are a bit limited. Some ideas:
Create enum with an additional (hidden?) field Unknown, and check in reader (speed impact?)
Check enum values every time data is read and panic (speed impact)
Do not expose as enum, but newtype integer plus constants
If speed is impacted a raw reading function might be needed for fast access
The text was updated successfully, but these errors were encountered:
Unlike C/C++ Rust enums are exhaustive: All possible values need to be explicitly mentioned.
That means that casting from the underlying type (e.g. 9 bit integer) to the enumeration can cause UB if the value stored in flatdata does not exist in the enumeration (e.g. corrupted file, etc).
Rust doesn't currently support C-like enums. This means that our options are a bit limited. Some ideas:
Unknown
, and check in reader (speed impact?)raw
reading function might be needed for fast accessThe text was updated successfully, but these errors were encountered: