-
Notifications
You must be signed in to change notification settings - Fork 213
/
lib.rs
50 lines (41 loc) · 1.13 KB
/
lib.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
// Copyright 2020 Parity Technologies
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
//! num-traits support for uint.
#![no_std]
#[doc(hidden)]
pub use num_traits;
#[doc(hidden)]
pub use uint;
/// Add num-traits support to an integer created by `construct_uint!`.
#[macro_export]
macro_rules! impl_uint_num_traits {
($name: ident, $len: expr) => {
impl $crate::num_traits::identities::Zero for $name {
#[inline]
fn zero() -> Self {
Self::zero()
}
#[inline]
fn is_zero(&self) -> bool {
self.is_zero()
}
}
impl $crate::num_traits::identities::One for $name {
#[inline]
fn one() -> Self {
Self::one()
}
}
impl $crate::num_traits::Num for $name {
type FromStrRadixErr = $crate::uint::FromStrRadixErr;
fn from_str_radix(txt: &str, radix: u32) -> Result<Self, Self::FromStrRadixErr> {
Self::from_str_radix(txt, radix)
}
}
};
}