orlp / foldhash

A fast, non-cryptographic, minimally DoS-resistant hashing algorithm for Rust.
zlib License
160 stars 4 forks source link

Querying time does not work on `zkvm` target #8

Closed Wollac closed 1 day ago

Wollac commented 1 week ago

Getting the time with std::time is not supported on all targets. With #4 and #7 there are already some conditions added, and the zkvm target is another instance that does not have a way to query the current time and panics instead.

This could be fixed by adding target_os = "zkvm" to the cfg before elapsed, but perhaps a more general fix like putting the querying behind a feature flag would be preferable, as there could be even more targets without full time support.

orlp commented 1 day ago

I'm not a fan of features that when enabled at the wrong time lead to compilation errors. The "std" feature is a known conventional hack around supporting no_std crates but besides that I'd rather have foldhash compile for all possible feature combinations. I'll just add another cfg flag.