This crate provides:
- Macros that implement modular arithmetic integer types
- Preset types
- [modtype::preset::u64::F
]
- [modtype::preset::u64::Z
]
- [modtype::preset::u64::thread_local::F
]
- [modtype::preset::u64::mod1000000007::F
]
- [modtype::preset::u64::mod1000000007::Z
]
```rust
type F = F_
Default,
Clone,
Copy,
PartialEq,
Eq,
PartialOrd,
Ord,
modtype::From,
modtype::Into,
modtype::FromStr,
modtype::Display,
modtype::Debug,
modtype::Deref,
modtype::Neg,
modtype::Add,
modtype::AddAssign,
modtype::Sub,
modtype::SubAssign,
modtype::Mul,
modtype::MulAssign,
modtype::Div,
modtype::DivAssign,
modtype::Rem,
modtype::RemAssign,
modtype::Zero,
modtype::One,
modtype::Num,
modtype::Bounded,
modtype::CheckedAdd,
modtype::CheckedSub,
modtype::CheckedMul,
modtype::CheckedDiv,
modtype::CheckedRem,
modtype::CheckedNeg,
modtype::Inv,
modtype::Unsigned,
modtype::FromPrimitive,
modtype::ToPrimitive,
modtype::Pow_u8,
modtype::Pow_u16,
modtype::Pow_u32,
modtype::Pow_usize,
modtype::Integer,
modtype::ToBigInt,
modtype::ToBigUint,
modtype::new,
modtype::get,
)]
modulus = "M::VALUE",
std = "std",
num_traits = "num::traits",
num_integer = "num::integer",
num_bigint = "num::bigint",
no_impl_for_ref
)]
struct F
enum Const17U32 {} ```
rust
use modtype::preset::u64::mod1000000007::{F, Z};
u8
], [u16
], [u32
], [u64
], [u128
], or [usize
].One
], The modulus is larger than 1
.Div
], the modulus is a prime.| Name | Format | Optional |
| :------------------- | :----------------------------------------------------------------------- | :------------------------------- |
| modulus
| modulus = #
[Lit
] where #
[Lit
] is converted/parsed to an [Expr
] | No |
| std
| std = #
[LitStr
] where #
[LitStr
] is parsed to a [Path
] | Yes (default = ::std
) |
| num_traits
| num_traits = #
[LitStr
] where #
[LitStr
] is parsed to a [Path
] | Yes (default = ::num::traits
) |
| num_integer
| num_integer = #
[LitStr
] where #
[LitStr
] is parsed to a [Path
] | Yes (default = ::num::integer
) |
| num_bigint
| num_bigint = #
[LitStr
] where #
[LitStr
] is parsed to a [Path
] | Yes (default = ::num::bigint
) |
| no_impl_for_ref
| no_impl_for_ref
| Yes |
| Name | Format | Optional |
| :------------------- | :------ | :------- |
| value
| value
| No |
ConstValue
]| Name | Format | Optional |
| :------------------- | :----------------------------------------------------------- | :-------- |
| const_value
| const_value = #
[LitInt
] where #
[LitInt
] has a suffix | No |