You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was wondering if there's any chance we could get a "SizeVec" or "USizeVec" (Vec whose elements are usize). I use (usize,usize) a lot to represent 2D size, I find myself wanting to replace them with UVec2 to make the math easier to read, but then I have to convert to usize to interact with array indices and such.
Hey there. I am a bit reluctant to add this one. Since glam is not a generic library there's a bit more overhead to adding and maintaining new types. I will sit on this and see if there is further demand for it though.
If there is anything you can think of that would make it easier to work with usize with existing types let me know.
That makes sense, thanks for the consideration! I think even implementing From<(usize,usize)> and vice verse for UVec2 and UVec3 would make things a lot smoother for how I'm using them, if that would be possible.
I wouldn't add an impl From like this on the basis that Rust itself doesn't support impl From<usize> for u32 or any other conversion between types that loses information. I could look at adding explicit methods, such as from_tuple_usize or something. You could easily add something similar in your own project as an extension method for UVec* .
Repository owner locked and limited conversation to collaborators on Dec 2, 2021
Activity
bitshifter commentedon Sep 11, 2021
Hey there. I am a bit reluctant to add this one. Since glam is not a generic library there's a bit more overhead to adding and maintaining new types. I will sit on this and see if there is further demand for it though.
If there is anything you can think of that would make it easier to work with usize with existing types let me know.
sarkahn commentedon Sep 11, 2021
That makes sense, thanks for the consideration! I think even implementing
From<(usize,usize)>and vice verse for UVec2 and UVec3 would make things a lot smoother for how I'm using them, if that would be possible.bitshifter commentedon Oct 26, 2021
I wouldn't add an
impl Fromlike this on the basis that Rust itself doesn't supportimpl From<usize> for u32or any other conversion between types that loses information. I could look at adding explicit methods, such asfrom_tuple_usizeor something. You could easily add something similar in your own project as an extension method forUVec*.