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

Allow f32 and f64 map keys #1027

Merged
merged 11 commits into from Jul 11, 2023
Merged

Commits on Jun 17, 2023

  1. Allow f32 and f64 keys

    Now we allow objects with `f32` or `f64` string-serialized keys. For example:
    
    ```json
    { "1.123": "foo", "2.0": "bar" }
    ```
    
    The `test_deny_float_key` test has been inverted, and the
    `deserialize_integer_key` macros have been renamed to
    `deserialize_numeric_key` in order to support `f32` and `f64`.
    overdrivenpotato committed Jun 17, 2023
    Configuration menu
    Copy the full SHA
    0503111 View commit details
    Browse the repository at this point in the history

Commits on Jul 9, 2023

  1. Return error on non-finite float keys

    This handles NaN and both positive and negative infinity.
    overdrivenpotato committed Jul 9, 2023
    Configuration menu
    Copy the full SHA
    f74b422 View commit details
    Browse the repository at this point in the history
  2. Print map float keys with CompactFormatter

    This ensures consistency with the default `Formatter::write_f32` output
    format used elsewhere.
    overdrivenpotato committed Jul 9, 2023
    Configuration menu
    Copy the full SHA
    9963405 View commit details
    Browse the repository at this point in the history
  3. Deserialize float keys using deserialize_number

    `deserialize_numeric_key!` has been renamed back to
    `deserialize_integer_key!`, and a new float-specific
    `deserialize_float_key!` macro has been introduced.
    
    This new macro attempts to deserialize float keys by delegating to the
    equivalent parent deserializer method.
    overdrivenpotato committed Jul 9, 2023
    Configuration menu
    Copy the full SHA
    22a5e9b View commit details
    Browse the repository at this point in the history
  4. Fix formatting

    overdrivenpotato committed Jul 9, 2023
    Configuration menu
    Copy the full SHA
    324c5b5 View commit details
    Browse the repository at this point in the history
  5. Fix builds without std feature

    An `unwrap` has been changed to simply discard the `Result`. We assume
    that writing to a `Vec` will never fail because the `std::io::Write`
    implementation never creates an I/O error.
    overdrivenpotato committed Jul 9, 2023
    Configuration menu
    Copy the full SHA
    18e1b59 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    5762701 View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    7760a1a View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    b0dbac7 View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    468a94a View commit details
    Browse the repository at this point in the history

Commits on Jul 10, 2023

  1. Configuration menu
    Copy the full SHA
    a4e2719 View commit details
    Browse the repository at this point in the history