arcnmx / serde-value

Serialization value trees
http://arcnmx.github.io/serde-value/serde_value/
MIT License
43 stars 30 forks source link

Value<'de> #15

Open dtolnay opened 7 years ago

dtolnay commented 7 years ago

It would be useful to have variants in Value to hold &'de str and &'de [u8]. This enables support for borrowed data in code like the following.

let v: Value = Deserialize::deserialize(deserializer)?;
{
    /* some logic, inspecting or mutating the Value */
}
return T::deserialize(v);

Currently in such a case T cannot borrow from the original Deserializer. This came up in https://github.com/serde-rs/serde/issues/1028.