Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Remove the ComponentBytes and AsPixels traits #70

Closed
ripytide opened this issue May 23, 2024 · 2 comments
Closed

Remove the ComponentBytes and AsPixels traits #70

ripytide opened this issue May 23, 2024 · 2 comments

Comments

@ripytide
Copy link
Contributor

ripytide commented May 23, 2024

I don't see the utility of the ComponentBytes and AsPixels traits compared to a user simply using bytemuck's cast_slice() and cast_slice_mut() methods. This could easily be achieved by optionally implementing bytemuck::Pod for all the pixel structs. Then a user could enable that crate-feature and use bytemuck to do conversions as they need.

In addition, having an crate-local implementation has had soundness flaws in the past in #35 so removing it would reduce that risk.

@ripytide ripytide changed the title Remove the ComponentBytes trait Remove the ComponentBytes and AsPixels traits May 23, 2024
@ripytide
Copy link
Contributor Author

Also mentioned in #39 (comment)

@kornelski
Copy link
Owner

The only issue is that bytemuck's syntax is more verbose, since cast_slice() etc are not trait methods, but standalone functions in the bytemuck crate.

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

No branches or pull requests

2 participants