Use Cow<str>
in JSON parsers
#545
Labels
enhancement
An improvement for livesplit-core.
parsing
This is about one of the parsers.
performance
Affects the performance of the code.
suitable for contributions
The issue is suitable those who are contributing to livesplit-core.
It was under the impression that you can't borrow with
serde_json
, but it's totally possible. The API directly supports it. The only thing you need to be careful about are escaped strings, but for those you can just useCow
to handle the owned unescaped case. Apparently there's an annotation you need to use though to specify that you prefer a borrowed str if possible on such a container. Each such field needs to be annotated with#[serde(borrow)]
The text was updated successfully, but these errors were encountered: