Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pre-allocate capacity for maps in json! macro. #876

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Commits on Oct 26, 2022

  1. Pre-allocate capacity for maps in json! macro.

    Attempt to address issue serde-rs#810.
    
    This implementation works by expanding the contents of the map twice,
    first to produce a capacity value, then actually inserting the elements.
    
    Because it expands the contents of the map twice, when encountering invalid syntax,
    it may print error messages twice, which may be unwanted.
    zachs18 committed Oct 26, 2022
    Configuration menu
    Copy the full SHA
    99629eb View commit details
    Browse the repository at this point in the history
  2. Change map-capacity-counting part of json_internal! macro to not repo…

    …rt errors.
    
    Since these errors are already reported by the part of the macro that actually parses the map,
    it is unnecessary to report them twice, so the capacity-counting part can just return 0 if
    it encounters an error.
    zachs18 committed Oct 26, 2022
    Configuration menu
    Copy the full SHA
    e976482 View commit details
    Browse the repository at this point in the history