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

feat: implement DeserializerOptions, and use it to add a new option integers_as_floats #132

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Gutawer
Copy link

@Gutawer Gutawer commented Jul 20, 2024

Closes #131 - decided I might as well PR this since it's not too much effort. Happy to make any requested changes and talk about the design but this is what I had in mind with my comment on the issue ticket :)

Adds an opt-in-per-call flag for accepting integers where floats are accepted, helping ergonomics when parsing data from languages like Python or typst where the distinction between ints and floats still exists, but is much weaker than Rust forcing you to convert explicitly always.

@Gutawer Gutawer requested a review from a team as a code owner July 20, 2024 17:51
@Gutawer Gutawer requested a review from npmccallum July 20, 2024 17:51
@Gutawer Gutawer changed the title feat: implement DeserializerOptions, and use it to add a new option integers_as_floats feat: implement DeserializerOptions, and use it to add a new option integers_as_floats Jul 20, 2024
@rjzak
Copy link
Member

rjzak commented Jul 22, 2024

Could you include a unit test to show this new functionality?

@Gutawer
Copy link
Author

Gutawer commented Jul 23, 2024

Yep happy to though it’ll be a couple of days until I can - there are tests in the form of doc examples but yeah I’m happy to contribute a more substantial test suite

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature]: Optionally accept integers where floats are expected
2 participants