Using HashMap on struct that doesn't derive Hash and Eq

So, basically I want to have an HashMap<String, opengl_graphics::Texture>.
Why? Because opengl_graphics::Texture doesn't have any function to get its String name and having an HashMap seems a good idea. Though there's a problem, opengl_graphics::Texture does not derive Hash nor Eq...
What's my best shot here?

Wouldn't it be a HashMap<String, opengl_graphics::Texture> in this case? I don't see how making your data the key can be useful...

Yeah you're right, I changed it, the String is the key.

The value type of a HashMap doesn't have to be Hash or Eq, only the key, so this should just work.

1 Like

I must have screwed up when using insert. Damn me.