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 num_traits::Zero, One, and Pow for Modint #105

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

TonalidadeHidrica
Copy link
Collaborator

I added num-traits as an optional dependency so that we may use libraries requiring Zero, One, and so on, only when we know the library is available in that environment.

@TonalidadeHidrica TonalidadeHidrica changed the title Implement Zero, One, and Pow for Modint Implement num_traits::Zero, One, and Pow for Modint Jun 21, 2022
@TonalidadeHidrica
Copy link
Collaborator Author

Do I need to add a feature flag to the CI script as well? I'm not sure what is the best practice to do so.

Comment on lines +919 to +922
#[inline]
fn is_one(&self) -> bool {
self == &Self::one()
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
#[inline]
fn is_one(&self) -> bool {
self == &Self::one()
}

This part can be omitted (unlike Zero, somehow).

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Huh, that's quite surprising :) However, I took a look at the doc to realize that it actually recommends to implement this. So shall we just leave this as it is?

Copy link
Member

@qryxip qryxip left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Before adding num-traits, we need to

index 4602b94..3a49247 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -10,6 +10,10 @@ keywords = ["competitive"]
 categories = ["algorithms", "data-structures"]
 publish = false

+[package.metadata.docs.rs]
+all-features = true
+rustdoc-args = ["--html-in-header", "katex-header.html"]
+
 # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

 [dependencies]

@qryxip
Copy link
Member

qryxip commented Apr 9, 2023

Do I need to add a feature flag to the CI script as well? I'm not sure what is the best practice to do so.

We need to do, I think.

@TonalidadeHidrica
Copy link
Collaborator Author

@qryxip I tried removing .cargo/config.toml and editing all-features = true. Am I doing correctly?

Also, I am not sure how to add a feature flag to the CI script, could you help me out? Do I need to add a new matrix for "all features", or maybe another way?

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