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

Arbitrary precision distances: could Copy be replaced with Clone? #7

Open
sleemans opened this issue Apr 24, 2024 · 1 comment
Open

Comments

@sleemans
Copy link

Thanks for the cool library!

For my use case, I need to work with distances of arbitrary precision. These distances can be so small, that the built-in types of Rust may not suffice. The fasterpam function, to my benefit, requires traits that are mostly compatible with unlimited-precision fraction libraries, such as fraction::BigFraction or num_rational. However, the only exception is the Copy trait, which, if I understand the documentation correctly, indicates that a bitwise copy is possible. I suspect it may not be possible to implement Copy for any arbitrary-precision fraction struct, as such a struct would need some kind of grow-shrink storage, and hence some bookkeeping that would be inherently incompatible with Copy.

Therefore my question: would it be possible to use the Clone trait instead of the Copy trait for the N and L type parameters in the function fasterpam? I'm fairly new to Rust programming, so please forgive me if this is not possible at all.

@kno10
Copy link
Owner

kno10 commented Apr 27, 2024

We are not Rust experts either, but I do not see why Clone should not be possible, except that it potentially is more expensive and needs to be made explicit. But only a few places should need it, you should give it a try.

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