DelSkayn / rquickjs

High level bindings to the quickjs javascript engine
MIT License
434 stars 59 forks source link

Persistent no longer implements Hash, Eq etc #187

Closed richarddd closed 11 months ago

richarddd commented 11 months ago

Seems like this got removed from the class refactoring PR. It's now no longer possible to store Values in a Hash map.

DelSkayn commented 11 months ago

I added a derive for Eq and Hash to persistant. Since all javascript values implement Eq and Hash this should allow the persistant object to be stored in hashmaps again.

richarddd commented 11 months ago

I see it's implemented for each JS value (Object,Function etc) but not for Value itself. I'm i missing something here? I'm trying to put a bunch of values in a HashSet and HashMap:

the trait bound `rquickjs::Object<'_>: std::hash::Hash` is not satisfied
the trait `std::hash::Hash` is not implemented for `rquickjs::Object<'_>

the trait bound `rquickjs::Object<'_>: std::cmp::Eq` is not satisfied
the trait `std::cmp::Eq` is not implemented for `rquickjs::Object<'_>`
DelSkayn commented 11 months ago

I reimplemented the Hash and Eq in 8b2079c are you on that commit or more recent? If you are still using the latest 0.4.0-beta version, I haven't pushed out a version with those changes yet.

richarddd commented 11 months ago

I reimplemented the Hash and Eq in 8b2079c are you on that commit or more recent? If you are still using the latest 0.4.0-beta version, I haven't pushed out a version with those changes yet.

Saw that now thanks. That solves it