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

Add convience methods for bytemuck conversions #120

Open
ripytide opened this issue Jul 9, 2024 · 2 comments
Open

Add convience methods for bytemuck conversions #120

ripytide opened this issue Jul 9, 2024 · 2 comments

Comments

@ripytide
Copy link
Contributor

ripytide commented Jul 9, 2024

From #64

Convenience methods for bytemuck? slice.as_rgba() vs bytemuck::cast_slice::<Rgba<u8>>(slice)

Personally, I don't think using bytemuck is that bad as it is more explicit and ideally you would only be doing bit-casts when transferring data in or out of a strongly typed rust system so it shouldn't come up that often.

@kornelski
Copy link
Owner

It's not terrible, but looks odd when everything else is a trait/method:

kornelski/lodepng-rust@41b85c5

@ripytide
Copy link
Contributor Author

ripytide commented Aug 4, 2024

I'm not opposed to creating a helper trait for postfix bytemucking, but shouldn't that belong in the bytemuck crate rather than in this crate? You could just implement the helper trait locally in the crate you want to use it in, but I imagine that might become a maintenance burden if you have multiple crates where you'd like to use it. Perhaps a small helper crate?

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

No branches or pull requests

2 participants