Post #645386
2025-05-21 21:21 UTC
Replies (13)
-
@slatian@pleroma.envs.net 2025-05-21 21:40
@rain This looks like what I was searching for my database cache (mapping forward and back between something stringy and a number)
-
@rain@hachyderm.io 2025-05-21 21:23
This is the repo -- quite happy with all the testing! https://github.com/oxidecomputer/iddqd
-
@crowbriarhexe@tech.lgbt 2025-05-21 21:23
@rain@hachyderm.io Help, I installed this crate and my eyes turned gold! 😅
-
@skinnylatte@hachyderm.io 2025-05-21 21:24
@rain@hachyderm.io relevant to your interests @wilson@hachyderm.io
-
@noratrieb@hachyderm.io 2025-05-21 21:29
@rain@hachyderm.io this is awesome, I've definitely done things like this before many times.. in my cases the usage was simple enough that a normal map worked fine, but this is nicer even then
-
@rukai@hachyderm.io 2025-05-21 21:33
@rain@hachyderm.io this looks so good. I have definitely needed this in the past.
-
@argv_minus_one@mastodon.sdf.org 2025-05-21 22:02
@rain@hachyderm.io Ooh neat. I was wanting something like this for years. I would have preferred if the map takes a function to extract the key from the value, though, rather than requiring the value to implement a trait. Then I could, for example, index `User`s by both `name` and `age` (as separate `IdHashMap`s), which unless I'm mistaken would be difficult with this trait-based design.
-
@brianm@hachyderm.io 2025-05-21 22:49
@rain@hachyderm.io oh. OH! This is cool. I didn’t know I wanted this until now!
-
@zkat@toot.cat 2025-05-21 22:59
@rain@hachyderm.io holy cow this is cool!!
-
@anselmschueler@ieji.de 2025-05-21 23:50
@rain@hachyderm.io Is the upcast method just a way to reify the fact that it's covariant?
-
@hermitcl@aus.social 2025-05-22 00:57
@rain@hachyderm.io I mean, I have no real idea what this does, but I love the name (am I showing my age?)
-
@weiznich@social.weiznich.de 2025-05-22 06:52
@rain@hachyderm.io Great Work. That seems like a really nice crate for creating maps from database types. Given that you might consider adding a wild card impl for IdHashItem based on diesels Identifiable trait so that you get these impls for free for all database structs. (Obviously that's something you want to put behind a feature flag)
-
@skade@hachyderm.io 2025-09-26 20:33
@rain@hachyderm.io needs a datastore implemented in it called idkva.