glam-rs icon indicating copy to clipboard operation
glam-rs copied to clipboard

Make `Vec3A::from_vec4` const

Open herabit opened this issue 1 year ago • 2 comments

All of the implementations of Vec3A::from_vec4 do not seem to require non-const functionality, so marking them all as const fn will increase their versatility for API consumers.

I would make a pull request if I was more familiar with contributing to open source, as this seems like a minor change, though yeah I'd need to look into how to, do that.

herabit avatar Aug 05 '24 21:08 herabit

Wish I had read the contributing guide, I'll make this into a discussion. I'll leave this open for now just in case this is the preferred channel for communication. Close this if it you desire as, yeah I will create the discussion.

herabit avatar Aug 05 '24 21:08 herabit

If it's any consolation almost no one reads the contributing guide :) I really need to make an issue template directing people to discussions. I replied to your discussion thread but I'll leave this open until the PR is merged.

bitshifter avatar Aug 06 '24 02:08 bitshifter

It turns out this is not currently possible because Vec3::from_vec4 invokes deref to access the x,y & z values which can't be done in a const context.

At some point this might be possible https://github.com/rust-lang/rust/issues/67792.

bitshifter avatar Aug 29 '24 11:08 bitshifter