Rather than having Value always be a String, something like this could be better:
enum Value {
String(String),
Integer(i64),
Float(f64),
}
And then the From implementations would just set an Integer or Float. This would be nice because it means that numbers (which account for a lot of possible values) never have to allocate.
Doing deref to str wouldn't be the best thing with this change. Something like as_string() -> String might be better suited.
Thank you! I don't remember all the details off the top of my head, but that seems very much reasonable. If you want and have time, you could give it a try. I would be happy to review the PR.
Rather than having
Value
always be aString
, something like this could be better:And then the
From
implementations would just set anInteger
orFloat
. This would be nice because it means that numbers (which account for a lot of possible values) never have to allocate.Doing
deref
tostr
wouldn't be the best thing with this change. Something likeas_string() -> String
might be better suited.