-
Notifications
You must be signed in to change notification settings - Fork 379
Switch [f32; _] types in the public api to mint
equivalents
#536
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
Conversation
impl Into<[f32; 2]> also makes sense. |
It does, but for more complex types, mint support is nice. I'm not sure if that'll come up but it's a good crate to support I think |
Hello all -- this has now covered the API. Please let me know if you have any thoughts or opinions -- some of these bounds are a bit rough (especially the since the above would be a patch we'd be safe to go to 0.5.7. I'm failing some of the tests, but will fix over the weekend. that mostly is because this includes a breaking change where the |
This looks like a good improvement! With the caveat that I have almost no idea what I'm talking about: could this potentially have a noticeable impact on binary size due to monomorphization? I have even less idea of how it works in regards to
...mean that user-code like
..would end up with lots of copies of I had a quick search around and only related-ish thing I could find was rust-lang/rust#77767 so I suspect it probably isn't a big problem |
not like that -- it would work the other way around though. So there will only be one Morever, if you noticed, I actually put the trait bound on the impl block itself, so you can't ui.window("hello")
.size([10.0, 20.0])
.size(glam::Vec2::splat(100.0)) // error, expecting [f32; 2] However, if a user is using two different math libraries, or freely using arrays + a math library, their binary size will definitely increase. That doesn't overly concern me atm, but what are you thinking? I will say that the compile time increase that this would create somewhat worries me, but since we had At least on my end, I've been fairly extensively using the draw API for a node graph editor at work, and being able to use glam instead of arrays will wildly simplify that work |
I will say, for a normal math library like |
Ahh yeh that makes much more sense (for some reason I half-thought inlining a generic function would make the calling function generic, but on actually thinking about it, that.. wouldn't make much sense!) As long as there isn't much overhead if people exclusively use
I've been using euclid for similar purposes and although adding |
This is a larger effort that I'm only just starting. I'm not sure this is the right decision (using language primitives like arrays has a lovely simplicity), but especially for handling sizing in complex layouts, I'm always using a real math lib (basically always
glam
), and all the.into
calls are irksome.The plan here is that we take
mint
types as inputs but still return[f32; _]
as outputs (for example, in getters).If anyone has opinions on this, I'd love to hear them