You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've been working on adopting merde into a project I've been working on, and this project makes extensive use of fnv, and it's type FnvHashMap, which is really just: pub type FnvHashMap<K, V> = HashMap<K, V, FnvBuildHasher>; because of it's performance characteristics with smaller keys. Unfortunately when trying to implement JsonSerialize with types like this, you get an error message like:
error[E0277]: the trait bound `HashMap<std::string::String, merde::Value<'args>, BuildHasherDefault<FnvHasher>>: JsonSerialize` is not satisfied
--> src/ser.rs:1235:22
|
1235 | guard.pair("args", &self.args_merde);
| ^^^^^^^^^^^^^^^^ the trait `JsonSerialize` is not implemented for `HashMap<std::string::String, merde::Value<'args>, BuildHasherDefault<FnvHasher>>`
|
= help: the trait `JsonSerialize` is implemented for `HashMap<K, V>`
= note: required for the cast from `&HashMap<std::string::String, merde::Value<'args>, BuildHasherDefault<FnvHasher>>` to `&dyn JsonSerialize`
Changing this type to a regular hashmap allows the code to compile. I know merde isn't super focused on performance, or every case, so I'm curious would there be any possibility to support custom hashers? or is this something better left to "just use a regular hashmap, and if you want something to support custom hashers use another crate".
The text was updated successfully, but these errors were encountered:
Hey,
I've been working on adopting merde into a project I've been working on, and this project makes extensive use of fnv, and it's type
FnvHashMap
, which is really just:pub type FnvHashMap<K, V> = HashMap<K, V, FnvBuildHasher>;
because of it's performance characteristics with smaller keys. Unfortunately when trying to implementJsonSerialize
with types like this, you get an error message like:Changing this type to a regular hashmap allows the code to compile. I know merde isn't super focused on performance, or every case, so I'm curious would there be any possibility to support custom hashers? or is this something better left to "just use a regular hashmap, and if you want something to support custom hashers use another crate".
The text was updated successfully, but these errors were encountered: