From 12d8d8805c56a684778f6e2af76a3253750a95f2 Mon Sep 17 00:00:00 2001 From: TonalidadeHidrica <47710717+TonalidadeHidrica@users.noreply.github.com> Date: Mon, 13 Jun 2022 13:22:24 +0900 Subject: [PATCH 1/3] Implement Zero, One, and Pow --- Cargo.toml | 1 + src/modint.rs | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/Cargo.toml b/Cargo.toml index 463b124..4408768 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,6 +13,7 @@ publish = false # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] +num-traits = { version = "0.2.11", optional = true } [dev-dependencies] input = { path = "./crates/input" } diff --git a/src/modint.rs b/src/modint.rs index 8aa5220..21507d2 100644 --- a/src/modint.rs +++ b/src/modint.rs @@ -898,6 +898,39 @@ macro_rules! impl_basic_traits { } } + #[cfg(feature = "num-traits")] + impl<$generic_param: $generic_param_bound> num_traits::Zero for $self { + #[inline] + fn zero() -> Self { + Self::new(0) + } + #[inline] + fn is_zero(&self) -> bool { + self == &Self::zero() + } + } + + #[cfg(feature = "num-traits")] + impl<$generic_param: $generic_param_bound> num_traits::One for $self { + #[inline] + fn one() -> Self { + Self::new(1) + } + #[inline] + fn is_one(&self) -> bool { + self == &Self::one() + } + } + + #[cfg(feature = "num-traits")] + impl<$generic_param: $generic_param_bound> num_traits::Pow for $self { + type Output=$self; + #[inline] + fn pow(self, rhs: u64) -> Self::Output { + self.pow(rhs) + } + } + impl_basic_traits!($($rest)*); }; } From fd5ce0b676dcfd54b96654310bb9f866bf22025d Mon Sep 17 00:00:00 2001 From: TonalidadeHidrica <47710717+TonalidadeHidrica@users.noreply.github.com> Date: Wed, 29 Mar 2023 17:24:46 +0200 Subject: [PATCH 2/3] Bump num-traits version to 0.2.15 for [AtCoder 2023/1 Language Update](https://docs.google.com/spreadsheets/d/1HXyOXt5bKwhKWXruzUvfMFHQtBxfZQ0047W7VVObnXI/edit#gid=408033513&range=I2). --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 7b98f10..69d9103 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,7 +13,7 @@ publish = false # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -num-traits = { version = "0.2.11", optional = true } +num-traits = { version = "0.2.15", optional = true } [dev-dependencies] proconio = "=0.3.6" From 1c0c3fe15065739d5265d7785886dfc8374368a2 Mon Sep 17 00:00:00 2001 From: TonalidadeHidrica <47710717+TonalidadeHidrica@users.noreply.github.com> Date: Sat, 15 Apr 2023 23:02:01 +0200 Subject: [PATCH 3/3] Move KaTeX-in-doc configs to Cargo.toml --- .cargo/config.toml | 8 -------- Cargo.toml | 1 + 2 files changed, 1 insertion(+), 8 deletions(-) delete mode 100644 .cargo/config.toml diff --git a/.cargo/config.toml b/.cargo/config.toml deleted file mode 100644 index 3d99f63..0000000 --- a/.cargo/config.toml +++ /dev/null @@ -1,8 +0,0 @@ -[build] -# This works both on local `cargo doc` and on docs.rs because we don't have any `normal` dependency. -# In most cases, `package.metadata.docs.rs` is recommended. -# -# See also: -# - https://docs.rs/rustdoc-katex-demo -# - https://docs.rs/rust-latex-doc-minimal-example -rustdocflags = ["--html-in-header", "./doc/katex-header.html"] diff --git a/Cargo.toml b/Cargo.toml index b6dcbfa..70ff13a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,6 +10,7 @@ keywords = ["competitive"] categories = ["algorithms", "data-structures"] [package.metadata.docs.rs] +all-features = true rustdoc-args = ["--html-in-header", "./doc/katex-header.html"] [lib]