Skip to content

docs: note that integer/bool/float map keys are stringified - #1344

Open
SatvikMishra08 wants to merge 1 commit into
serde-rs:masterfrom
SatvikMishra08:docs/1058-map-key-stringify
Open

SatvikMishra08 wants to merge 1 commit into
serde-rs:masterfrom
SatvikMishra08:docs/1058-map-key-stringify

Conversation

@SatvikMishra08

Copy link
Copy Markdown

Summary

Updates the Errors rustdoc for to_value and related serializers so they no longer claim that any non-string map key causes failure. Integer, boolean, and floating-point keys are converted to strings (since #231 and follow-ups); only keys that cannot be stringified fail.

Fixes #1058

Changes

Grep'd non-string keys and updated all matches in:

  • src/value/mod.rs (to_value)
  • src/ser.rs (to_writer, to_writer_pretty, to_vec, to_vec_pretty, to_string, to_string_pretty)
  • src/raw.rs
  • src/macros.rs (json!)

The existing doctest example with Vec keys (still an error) is unchanged.

Test plan

  • Docstring-only change
  • Confirm wording on docs.rs after merge

The Errors sections for to_value and related serializers still said
map serialization fails on any non-string key. Since serde-rs#231 (and later
bool/float support), those key types are converted to strings; only
keys that cannot be stringified fail.

Fixes serde-rs#1058
@SatvikMishra08

Copy link
Copy Markdown
Author

Small docs note on stringified map keys — still ready whenever you have a moment. Happy to reword.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Docs incorrectly state that only string keys for maps are supported

1 participant