On the use of debug_assert!: https://github.com/chris-morgan/anymap/pull/32 resolved that a week before this discussion, removing all unsafe code there, though not the underlying assumptions; I just hadnât merged it.
For the rest: I stand by the principle of the TypeIdHasher. This is the dummy hasher, it just happens to be assuming that there are exactly eight bytes rather than merely taking the last eight bytes.
Performance is the name of the game here; I wrote it the way I did under the belief that no substantial change to TypeIdâs internals was likely. If it turns out to be likely to change, well then, weâll change it in anymap and any similar code.
But so far Iâm with Centril; until we get compelling rationale for change, Iâm happy leaving the assumption in.
(Incidentally, it could be more robust if it did transmute to u64: then if the size changed itâd fail to compile, instead of merely panicking the first time you use it. But as it is, changing the internal representation wonât cause problems if it still hashes to eight bytes, which seems most likely.)