Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

SizeVec? #232

Closed
sarkahn opened this issue Sep 3, 2021 · 3 comments
Closed

SizeVec? #232

sarkahn opened this issue Sep 3, 2021 · 3 comments

Comments

@sarkahn
Copy link

sarkahn commented Sep 3, 2021

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.

@bitshifter
Copy link
Owner

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
Copy link
Author

sarkahn commented 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
Copy link
Owner

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 Dec 2, 2021

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants