Skip to content

impl binop<Rhs=int> for Mint #74

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

Merged
merged 4 commits into from
Oct 11, 2020

Conversation

tamuhey
Copy link
Contributor

@tamuhey tamuhey commented Oct 11, 2020

It is pain to add two integers as Mint:

let a = 1usize;
let b = 2usize;
let c = Mint::new(a) + Mint::new(b);

Thus, I implemented Add<Rhs=int> for Mint and AddAssign<Rhs=int> for Mint:

let c = Mint::new(a) + b;

@qryxip
Copy link
Member

qryxip commented Oct 11, 2020

Yes, that's true. It is a pain.

According to these popular crates, It seems to be reasonable to implement Op<{integer}> and OpAssign<{integer}>.

@qryxip qryxip merged commit 006d353 into rust-lang-ja:master Oct 11, 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.

2 participants