PSeitz / serde_json_borrow

Fast JSON deserialization on borrowed data
MIT License
70 stars 11 forks source link

Implement `ToOwned<Owned = serde_json::Value>` for `serde_json_borrow::Value` #2

Closed tqwewe closed 1 year ago

tqwewe commented 1 year ago

This would allow me to use Cow<'a, serde_json_borrow::Value>, which is useful in my case for HashMap<'static str, Cow<'static, serde_json_borrow::Value>.

tqwewe commented 1 year ago

Nevermind, it seems like its not possible since we cannot implement Borrow for serde_json::Value.

PSeitz commented 1 year ago

You should be able to convert it via .into() into serde_json::Value

https://github.com/PSeitz/serde_json_borrow/blob/main/src/value.rs#L382