rekka / meval-rs

Math expression parser and evaluation library for Rust
The Unlicense
153 stars 30 forks source link

`bindn` and `deserialize_any` #17

Closed sjeohp-zz closed 5 years ago

sjeohp-zz commented 5 years ago

Minor additions if you're interested

rekka commented 5 years ago

https://github.com/rekka/meval-rs/commit/d72830ac3f7b8404d6ef0322af8a1b6c5ecd08dc#commitcomment-30681918

Thanks for reporting! This is quite surprising. I have been testing the deserialization only on the TOML format (toml crate) and there it works as expected. According to https://serde.rs/impl-deserialize.html, deserialize_f64 should act only as a hint to the deserializer to know how to parse a value if it does not have sufficient information like in binary formats (non-self-describing formats). JSON of course should not have any trouble recognizing a string and calling visit_str on the visitor. I do not know why this fails in serde_json. Anyway, I do not need to support non-self-describing formats so deserialize_any is sufficient.

And thanks for implementing other bind functions. I did not have a use case for >3 variables myself. :)