-
Notifications
You must be signed in to change notification settings - Fork 89
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
Support for custom default fuction with owned pattern #315
base: master
Are you sure you want to change the base?
Conversation
There are still a lot of tests failing, but my usecase works. Now I just have to fix all the corner cases. Also tests for the new feature are still missing.
this still leaves tests in all other packages including tests for internals in derive_builder_core
turns out having a todo in the test data generation is not good if you want the tests to pass :)
conversion is only used to disable the default value if the enum is not OptionOrDefault. It's cleaner to just use an enabled flag for that.
Woops. Turns out my simplified testcase isn't actually good enough, so I will have to do some more work on this. I'll leave this as a draft PR for now. |
Ok, I spent the last month making sure that I did not miss anything and properly testing, this. So it should be good to merge. |
I'm not sure when I'll have time to review this, but I have it on my to-do list. |
This is a fix for #298
I finally got back to my hobby project where I need this so I got around to implement this feature/bug fix.
I've implemented the solution I described in that issue so I won't repeat it here again. If there are any open questions I'm happy to answer them or adjust this PR.
No unwrap_or does not work because it expects a
T
and the default we have is an Option. Either we use or and than unwrap or we can useunwrap_or(default.unwrap())
. I personally think thator.unwrap
is a bit nicer.PS: I know that the rust 1.59 tests are failing right now. "Syn" just published a new version "2.0.55" that requires rust 1.60.
However on my fork the 1.59 tests succeeded with the old syn version.
PPS: I know that are a lot of commits. The best solution is to just squash them I think but I am open to rebasing them into a few usefull commits if you prefer that. This is a rather large change after all.