/rust/registry/src/index.crates.io-1949cf8c6b5b557f/bnum-0.12.1/src/buint/strict.rs
Line | Count | Source |
1 | | macro_rules! strict { |
2 | | ($BUint: ident, $BInt: ident, $Digit: ident) => { |
3 | | #[doc = doc::strict::impl_desc!()] |
4 | | impl<const N: usize> $BUint<N> { |
5 | | crate::int::strict::impls!(U); |
6 | | |
7 | | #[doc = doc::strict::strict_add_signed!(U)] |
8 | | #[must_use = doc::must_use_op!()] |
9 | | #[inline] |
10 | 0 | pub const fn strict_add_signed(self, rhs: $BInt<N>) -> Self { |
11 | 0 | crate::errors::option_expect!( |
12 | 0 | self.checked_add_signed(rhs), |
13 | | crate::errors::err_msg!("attempt to add with overflow") |
14 | | ) |
15 | 0 | } Unexecuted instantiation: <bnum::buint::BUint<_>>::strict_add_signed Unexecuted instantiation: <bnum::buint::BUintD16<_>>::strict_add_signed Unexecuted instantiation: <bnum::buint::BUintD8<_>>::strict_add_signed Unexecuted instantiation: <bnum::buint::BUintD32<_>>::strict_add_signed |
16 | | } |
17 | | }; |
18 | | } |
19 | | |
20 | | #[cfg(test)] |
21 | | crate::test::all_digit_tests! { |
22 | | crate::int::strict::tests!(utest); |
23 | | |
24 | | test_bignum! { |
25 | | function: <utest>::strict_add_signed(a: utest, b: itest), |
26 | | skip: a.checked_add_signed(b).is_none() |
27 | | } |
28 | | } |
29 | | |
30 | | use crate::doc; |
31 | | |
32 | | crate::macro_impl!(strict); |