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

Implement Pow by value #137

Merged
merged 2 commits into from
Mar 3, 2020
Merged

Implement Pow by value #137

merged 2 commits into from
Mar 3, 2020

Conversation

cuviper
Copy link
Member

@cuviper cuviper commented Mar 3, 2020

We already had Pow for references, so the default call doesn't consume
your allocation, but this wasn't sufficient for uses like BigRational.
Now we do implement it by value, and have also added a new inherent
method pow(&self, exp: u32) that takes precedence. That exponent type
matches the same method on primitive integers, and is likely sufficient
for most use cases.

Fixes #106

cuviper added 2 commits March 2, 2020 18:14
We already had `Pow` for references, so the default call doesn't consume
your allocation, but this wasn't sufficient for uses like `BigRational`.
Now we do implement it by value, and have also added a new inherent
method `pow(&self, exp: u32)` that takes precedence. That exponent type
matches the same method on primitive integers, and is likely sufficient
for most use cases.

Fixes rust-num#106
@cuviper
Copy link
Member Author

cuviper commented Mar 3, 2020

bors r+

@bors
Copy link
Contributor

bors bot commented Mar 3, 2020

Build succeeded

@bors bors bot merged commit 7f334ee into rust-num:master Mar 3, 2020
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

Successfully merging this pull request may close these issues.

implement Pow for BigInt
1 participant