Open
Description
I understand that sometimes serde_json
can't guarantee it'll be able to give a &str
because the representation may contain escape characters, but we can typically get around this using Cow
.
The same way I can do this with a struct:
#[derive(Deserialize)]
struct MyStruct<'a> {
#[serde(borrow)]
some_str: Cow<'a, str>,
}
it would be nice to have the same thing for Value
.
// Owned
enum Value {
Null,
Bool(bool),
Number(Number),
String(String),
Array(Vec<Value>),
Object(Map<String, Value>),
}
// Borrowed
enum ValueRef<'a> {
Null,
Bool(bool),
Number(Number),
String(Cow<'a, str>),
Array(Vec<ValueRef<'a>>),
Object(Map<Cow<'a, str>, ValueRef<'a>>),
}
Metadata
Metadata
Assignees
Labels
No labels