Skip to content

Use Cow<str> in JSON parsers #545

@CryZe

Description

@CryZe

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 use Cow 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)]

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementAn improvement for livesplit-core.parsingThis is about one of the parsers.performanceAffects the performance of the code.suitable for contributionsThe issue is suitable those who are contributing to livesplit-core.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions