-
-
Notifications
You must be signed in to change notification settings - Fork 91
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
Implement many of the core traits for immutable and mutable refs #736
base: master
Are you sure you want to change the base?
Implement many of the core traits for immutable and mutable refs #736
Conversation
IMO the most important traits to have implemented for references, if you want to use it in higher level crates, would be The |
I strongly agree the most value comes from these 2 traits - one of which (
I agree with this to an extent. I think the changes in this PR still carry significant value in improving ergonomics and flexibility. As mentioned in #735 , wrapper types that wrap shared references is an immediate place where improvement would be noticed. I do also agree, however, that not supporting These changes are also highly related with the PR and associated discussion within #706 - wanted to just briefly mention this as the conversation there is highly relevant and includes valuable discussion. One observation of mine (which, admittedly may be entire inaccurate) is that there seems to be some conflation of relation between Of course, it would be a more significant change, but it seems that what e-g is attempting to accomplish with
I realize this is potentially getting a bit off track of what this PR is proposing, and this conversation appears pretty fragmented at the moment. It does seem that this is an issue that has been reoccurring and is blocking larger work efforts so I would suggest that we look into opening a PR specifically to explore what this would look like, and which can house all the conversation |
I didn't want to imply that the changes in this PR wouldn't be useful without the
Thanks for linking this, I did vaguely remember this discussion but couldn't remember where it was.
It's not entirely accurate.
While I kind of like the idea of this split into multiple traits I'm not sure it it would beneficial in practice. The only thing I can think of at the moment, which would have a size and not position, would be a |
I was also going to bring up the point of external utility of the traits such that from the perspective of an external developer how might I utilize these existing, or new trait methods. On the surface it seems convenient to be able to just retrieve the
My initial reaction to this is that it may unintentionally over-constrain future types that may also want to convey a size but not have position. An example of this may be a non-mono sized font that may want to convey information about the size of each glyph. Sprite sheets may be another instance where it would be beneficial to have graphical information with a size but not a position. I admit, I'm unsure if these are valid arguments but I do think it something to consider.
I would tend to agree with this. If it is determined to be desirable, however, I think other approaches could be taken to achieve this result without the constraints of the current design |
I've created a draft PR #737 that removes the |
I can't see a use case for having a common trait to get the size at the moment. What would the benefit of having a common trait to determine a glyph size and the size of a sprite sheet be, if there is no common API to draw them or do anything else with them? |
If the API extended to be able to convey the size of non-drawables, such as the display itself, it could be utilized for layout purposes. I admit I have been wavering over this after thinking about it, though. This is obviously a much larger fundamental change and I don't believe that the experimentation or discussion around such a change should impede the more immediate change outlined in these few PRs |
The display size is already defined by the |
The usage of the |
|
Not sure why I completely blanked on that - yeah, with this clarity I don't see much benefit in breaking up into pointed traits at this time. I think just eliminating |
Thank you for helping out with embedded-graphics development! Please:
CHANGELOG.md
entry in the Unreleased section under the appropriate heading (Added, Fixed, etc) if your changes affect the public APIrustfmt
on the projectjust build
(Linux/macOS only) and make sure it passes. If you use Windows, check that CI passes once you've opened the PR.PR description
This PR implements many of the core traits of e-g for both immutable and mutable refs. This change is done primarily to aid ergonomics.
These changes were split off from #735