odht icon indicating copy to clipboard operation
odht copied to clipboard

Unable to load an invalid hash table in debug mode

Open carlsverre opened this issue 1 year ago • 0 comments
trafficstars

Due to the debug_assert here: https://github.com/rust-lang/odht/blob/bc31b05fe859f4390f4cb76a90673e2e782c94a4/src/memory_layout.rs#L218 it's currently impossible (as far as I can tell) to load an invalid HashTable in debug mode and handle the error at runtime. Perhaps that debug assert should be moved into from_raw_bytes_unchecked?

In my use case I'm using ODHT to store an index within some serialized files. The code which loads these files uses from_raw_bytes to load the index and then checks it's Result to see if it failed.

carlsverre avatar Sep 19 '24 00:09 carlsverre