naomijub / edn-rs

[DEPRECATED]: Crate to parse and emit EDN
https://crates.io/crates/edn-rs
MIT License
81 stars 14 forks source link

edn: use proper Rust Set type/collection internally for Edn::Set #17

Closed evaporei closed 4 years ago

evaporei commented 4 years ago

To actually use a Set Rust type internally for Edn::Set I had to do several changes, they are:

Considerations on API Design

There is one thing I would like a second opinion. Before to use the variant Edn::Double, you could just pass a f64 to it, like Edn::Double(1.2). Now since we will be using the OrderedFloat, I've created a public alias Double which just stands for OrderedFloat<f64>.

The problem with this is that the user has to either do Edn::Double(Double(1.2)) or it can do Edn::Double(1.2.into()) (more pleasant in my opinion). Do you think this is a problem/issue? If you are okay with the user having to do this conversion or use the new alias type then I think we can proceed normally.

By the way this is probably a breaking change, since Edn::Double(1.2) won't work anymore, and will have to be substituted by Edn::Double(1.2.into()). But still, is a very simple fix, and it doesn't affect macros at all, just the creation of Edn manually via enum šŸ™‚

Also, any suggestion is always welcome šŸ˜Š , the project is yours after all hahaha

Fixes https://github.com/naomijub/edn-rs/issues/3