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

Export as_opt_<type> helper functions #5

Merged
merged 22 commits into from
Jan 25, 2025
Merged

Conversation

rnag
Copy link
Owner

@rnag rnag commented Mar 17, 2023

Closes #4

Copy link
Contributor

@corneliusroemer corneliusroemer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There seems to be some differing assumptions on what should be None and what shouldn't.

I find the examples section hard to read. Rather than having many examples, it may be better to have unit tests - and examples (doc tests) in src/de_impl_opt.rs doc strings.

Somewhere there should be a dense table/section where the behaviour can be seen at a glance - possibly in the doc string itself. I like the # Returns section, explaining behaviour, but this could be complemented with more comprehensive cases for each of the input types str, i64, f64, u64.

examples/demo.rs Show resolved Hide resolved
examples/optionals/as_bool.rs Outdated Show resolved Hide resolved
examples/optionals/as_bool.rs Outdated Show resolved Hide resolved
examples/optionals/as_u64.rs Show resolved Hide resolved
src/de_impl_opt.rs Show resolved Hide resolved
src/de_impl_opt.rs Show resolved Hide resolved
@rnag
Copy link
Owner Author

rnag commented Mar 20, 2023

There seems to be some differing assumptions on what should be None and what shouldn't.

I find the examples section hard to read. Rather than having many examples, it may be better to have unit tests - and examples (doc tests) in src/de_impl_opt.rs doc strings.

Hi @corneliusroemer ! Thanks for bringing this up. I totally agree, that at some point it would be worth it to refactor it to move example cases into doc tests & unit tests more explicitly, that way it also runs automatically in the GitHub Actions workflow (CI) and also when deploying new versions.

I've created a new issue to track effort on this separately, as part of #7 .

For now, as and when when time allows, please take a look at recent changes and commits I have added as part of this PR, to confirm if it resolves or addresses all issues based on your notes. I will hold off on merging the changes until then.

Thanks, and have a great Monday 🎉 !

@rnag rnag requested a review from corneliusroemer April 5, 2023 02:46
@josephwynn-sc
Copy link

I just stumbled upon this crate and the first thing I wanted was as_opt_* - is there a chance this PR would be merged in the near future?

@rnag
Copy link
Owner Author

rnag commented Nov 7, 2024

@josephwynn-sc Yes, totally! Sorry for the long wait, just coming back after a hiatus.

I'll look into it this weekend, run some tests with rust -- now that I've got a new laptop and got Rust set up -- and if everything looks good, I'll go ahead and merge this PR. Thanks!

@rnag rnag merged commit 0bc6bc7 into main Jan 25, 2025
2 checks passed
@rnag rnag deleted the WIP-export-as-optional-functions branch January 25, 2025 05:12
@rnag
Copy link
Owner Author

rnag commented Jan 25, 2025

@corneliusroemer @josephwynn-sc Done -- PR has been merged, and exported opt_ functions are available as of v0.5.0 🎉

Feel free to check it out and let me know! 😃

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.

Provide extra functions to return Options when the input is null as Serde usually does
3 participants