-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Make asset handles !Default
#2647
Comments
#1395 is related, covering a |
I agree that the default impl for all handles reduces type safety. I am wondering though whether removing it would reduce the usibility of many build-in bundles (at least if that also means the bundles themself no longer are If there is no longer a default for the font handle in the text bundle, can there still be a default for the bundle? In the case of fonts this might be solved with ongoing discussions about bundling fonts/using system fonts (#1017, #1325), but the same problem arises with other bundles. E.g. is there a default for sprite bundle if there is no default for material handles? One idea: we could have convenience functions like |
It is only the requirement I care about. If a default font is added that can be used, and |
Only lifting the requirement would not improve your example of the Text bundle. We should then also rethink defaults for all bundles. But just lifting the requirement sounds reasonable as a first step 👍 |
Sorry, what I wrote was a bit misleading. I do care about removing the Default implementations, but only where they don't currently make sense, |
While I would like to remove the It could be useful to list all cases where a bundle has an handle component, and see what default could be used there
|
What problem does this solve or, what need does it fill?
Handle currently requires
Default
to be implemented, which reduces type safety because for manyAssets
no default makes sense. Removing this requirement would also partially solve #1201, because when creatingText
and filling out the values with..Default::default()
style.font
will be set to an invalid font Handle and fail to render.What solution would you like?
The removal of the requirement that all
Handles
have to implementDefault
. The reason this requirement exists is becauseHandle
derivesReflect
.What alternative(s) have you considered?
Runtime errors for default handle values where
Default
is invalid, but this delays the problem feedback and increases iteration time compared to getting the error at compile time.The text was updated successfully, but these errors were encountered: