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

Tracking: num-traits support #157

Open
virtualritz opened this issue Mar 20, 2023 · 6 comments
Open

Tracking: num-traits support #157

virtualritz opened this issue Mar 20, 2023 · 6 comments

Comments

@virtualritz
Copy link
Contributor

virtualritz commented Mar 20, 2023

A user of my uniform-cubic-splines crate wanted to use it with ultraviolet and ran into a traits issue.

My crate relies on Zero/One traits. Those were removed from std::num (unfortunately, I think), in 2014. My crate uses num-traits::Zero/One.

That means if some third party crate that implements a type that someone wants to use with my crate does not implement the num-traits version of these traits, it won't work. A user can't add support for it on their side (and neither can even my crate) because of orphan rules.

I guess the only solution would be to add support for this to ultraviolet. FYI, cgmath, glam & nalgebra all support these.

Would you consider this at all (or a PR)?

@fu5ha
Copy link
Owner

fu5ha commented Mar 20, 2023

Yeah absolutely. Can just make it an optional dependency and put the implementation under that feature flag :)

Only reason it hasn't been done already is I haven't needed it and nobody else has implemented it :P

@virtualritz
Copy link
Contributor Author

Okidoki. I'll look into it soon.

@virtualritz
Copy link
Contributor Author

Would you like the trait impls to live in their own file, e.g. src/vec/traits.rs or in each existing src/vec/vec?.rs file resp.?

@fu5ha
Copy link
Owner

fu5ha commented Mar 20, 2023

I think separate file is probably best

@virtualritz
Copy link
Contributor Author

Shall we keep this open to track further num-traits trait impls?

@fu5ha
Copy link
Owner

fu5ha commented Mar 20, 2023

Sure :)

@fu5ha fu5ha changed the title num-traits support? Tracking: num-traits support Mar 20, 2023
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