-
Notifications
You must be signed in to change notification settings - Fork 27
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
base: master
Are you sure you want to change the base?
Implement num_traits::Zero
, One
, and Pow
for Modint
#105
Conversation
Zero
, One
, and Pow
for Modintnum_traits::Zero
, One
, and Pow
for Modint
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. |
#[inline] | ||
fn is_one(&self) -> bool { | ||
self == &Self::one() | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#[inline] | |
fn is_one(&self) -> bool { | |
self == &Self::one() | |
} |
This part can be omitted (unlike Zero
, somehow).
There was a problem hiding this comment.
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?
There was a problem hiding this 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
git rm .cargo/config
(otherwise it fails to generate docs when Publish library to crates.io #119)- Instead, write
package.metadata.docs.rs
as follows:
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]
We need to do, I think. |
@qryxip I tried removing 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? |
I added
num-traits
as an optional dependency so that we may use libraries requiringZero
,One
, and so on, only when we know the library is available in that environment.