EmbarkStudios / mirror-mirror

🪞 Powerful reflection library for Rust
Apache License 2.0
79 stars 2 forks source link

Make `NodeId` per type statically consistent (as long as TypeId is) #116

Closed fu5ha closed 1 year ago

fu5ha commented 1 year ago

Right now, NodeId is inconsistent across different processes and runs of the same process, which is potentially problematic in several situations. This uses a static, non-random ahash::RandomState as well as taking advantage of the apparently slightly faster RandomState::hash_one to calculate the NodeId hash from TypeId. cc @TimonPost

davidpdrsn commented 1 year ago

Is this the same as https://github.com/EmbarkStudios/mirror-mirror/pull/115?

TimonPost commented 1 year ago

yes but mine is first 😉 . No specific opinion who's could be closed. I also used the random state in the HashMap so we wont get random order there either. At least, if that is how it works.

davidpdrsn commented 1 year ago

Then lets just go with https://github.com/EmbarkStudios/mirror-mirror/pull/115