2
2
3
3
[ ![ crate] ( https://img.shields.io/crates/v/num.svg )] ( https://crates.io/crates/num )
4
4
[ ![ documentation] ( https://docs.rs/num/badge.svg )] ( https://docs.rs/num )
5
- ![ minimum rustc 1.8 ] ( https://img.shields.io/badge/rustc-1.8 +-red.svg )
5
+ ![ minimum rustc 1.15 ] ( https://img.shields.io/badge/rustc-1.15 +-red.svg )
6
6
[ ![ Travis status] ( https://travis-ci.org/rust-num/num.svg?branch=master )] ( https://travis-ci.org/rust-num/num )
7
7
8
8
A collection of numeric types and traits for Rust.
@@ -13,36 +13,26 @@ and generic range iterators.
13
13
14
14
` num ` is a meta-crate, re-exporting items from these sub-crates:
15
15
16
- - [ ` num-bigint ` ] ( https://github.com/rust-num/num-bigint )
17
- [ ![ crate] ( https://img.shields.io/crates/v/num-bigint.svg )] ( https://crates.io/crates/num-bigint )
16
+ | Repository | Crate | Documentation |
17
+ | ---------- | ----- | ------------- |
18
+ | [ ` num-bigint ` ] | [ ![ crate] [ bigint-cb ]] [ bigint-c ] | [ ![ documentation] [ bigint-db ]] [ bigint-d ]
19
+ | [ ` num-complex ` ] | [ ![ crate] [ complex-cb ]] [ complex-c ] | [ ![ documentation] [ complex-db ]] [ complex-d ]
20
+ | [ ` num-integer ` ] | [ ![ crate] [ integer-cb ]] [ integer-c ] | [ ![ documentation] [ integer-db ]] [ integer-d ]
21
+ | [ ` num-iter ` ] | [ ![ crate] [ iter-cb ]] [ iter-c ] | [ ![ documentation] [ iter-db ]] [ iter-d ]
22
+ | [ ` num-rational ` ] | [ ![ crate] [ rational-cb ]] [ rational-c ] | [ ![ documentation] [ rational-db ]] [ rational-d ]
23
+ | [ ` num-traits ` ] | [ ![ crate] [ traits-cb ]] [ traits-c ] | [ ![ documentation] [ traits-db ]] [ traits-d ]
24
+ | ([ ` num-derive ` ] ) | [ ![ crate] [ derive-cb ]] [ derive-c ] | [ ![ documentation] [ derive-db ]] [ derive-d ]
18
25
19
- - [ ` num-complex ` ] ( https://github.com/rust-num/num-complex )
20
- [ ![ crate] ( https://img.shields.io/crates/v/num-complex.svg )] ( https://crates.io/crates/num-complex )
21
-
22
- - [ ` num-integer ` ] ( https://github.com/rust-num/num-integer )
23
- [ ![ crate] ( https://img.shields.io/crates/v/num-integer.svg )] ( https://crates.io/crates/num-integer )
24
-
25
- - [ ` num-iter ` ] ( https://github.com/rust-num/num-iter )
26
- [ ![ crate] ( https://img.shields.io/crates/v/num-iter.svg )] ( https://crates.io/crates/num-iter )
27
-
28
- - [ ` num-rational ` ] ( https://github.com/rust-num/num-rational )
29
- [ ![ crate] ( https://img.shields.io/crates/v/num-rational.svg )] ( https://crates.io/crates/num-rational )
30
-
31
- - [ ` num-traits ` ] ( https://github.com/rust-num/num-traits )
32
- [ ![ crate] ( https://img.shields.io/crates/v/num-traits.svg )] ( https://crates.io/crates/num-traits )
33
-
34
- There is also a ` proc-macro ` crate for deriving some numeric traits:
35
-
36
- - [ ` num-derive ` ] ( https://github.com/rust-num/num-derive )
37
- [ ![ crate] ( https://img.shields.io/crates/v/num-derive.svg )] ( https://crates.io/crates/num-derive )
26
+ Note: ` num-derive ` is listed here for reference, but it's not directly included
27
+ in ` num ` . This is a ` proc-macro ` crate for deriving some of ` num ` 's traits.
38
28
39
29
## Usage
40
30
41
31
Add this to your ` Cargo.toml ` :
42
32
43
33
``` toml
44
34
[dependencies ]
45
- num = " 0.1 "
35
+ num = " 0.2 "
46
36
```
47
37
48
38
and this to your crate root:
@@ -51,11 +41,84 @@ and this to your crate root:
51
41
extern crate num;
52
42
```
53
43
44
+ ## Features
45
+
46
+ This crate can be used without the standard library (` #![no_std] ` ) by disabling
47
+ the default ` std ` feature. Use this in ` Cargo.toml ` :
48
+
49
+ ``` toml
50
+ [dependencies .num ]
51
+ version = " 0.2"
52
+ default-features = false
53
+ ```
54
+
55
+ The ` num-bigint ` crate is only available when ` std ` is enabled, and the other
56
+ sub-crates may have limited functionality when used without ` std ` .
57
+
58
+ Implementations for ` i128 ` and ` u128 ` are only available with Rust 1.26 and
59
+ later. The build script automatically detects this, but you can make it
60
+ mandatory by enabling the ` i128 ` crate feature.
61
+
62
+ The ` rand ` feature enables randomization traits in ` num-bigint ` and
63
+ ` num-complex ` .
64
+
65
+ The ` serde ` feature enables serialization for types in ` num-bigint ` ,
66
+ ` num-complex ` , and ` num-rational ` .
67
+
68
+ The ` num ` meta-crate no longer supports features to toggle the inclusion of
69
+ the individual sub-crates. If you need such control, you are recommended to
70
+ directly depend on your required crates instead.
71
+
54
72
## Releases
55
73
56
74
Release notes are available in [ RELEASES.md] ( RELEASES.md ) .
57
75
58
76
## Compatibility
59
77
60
- Most of the ` num ` crates are tested for rustc 1.8 and greater.
61
- The exception is ` num-derive ` which requires at least rustc 1.15.
78
+ The ` num ` crate as a whole is tested for rustc 1.15 and greater.
79
+
80
+ The ` num-traits ` , ` num-integer ` , and ` num-iter ` crates are individually tested
81
+ for rustc 1.8 and greater, if you require such older compatibility.
82
+
83
+
84
+ [ `num-bigint` ] : https://github.com/rust-num/num-bigint
85
+ [ bigint-c ] : https://crates.io/crates/num-bigint
86
+ [ bigint-cb ] : https://img.shields.io/crates/v/num-bigint.svg
87
+ [ bigint-d ] : https://docs.rs/num-bigint/
88
+ [ bigint-db ] : https://docs.rs/num-bigint/badge.svg
89
+
90
+ [ `num-complex` ] : https://github.com/rust-num/num-complex
91
+ [ complex-c ] : https://crates.io/crates/num-complex
92
+ [ complex-cb ] : https://img.shields.io/crates/v/num-complex.svg
93
+ [ complex-d ] : https://docs.rs/num-complex/
94
+ [ complex-db ] : https://docs.rs/num-complex/badge.svg
95
+
96
+ [ `num-derive` ] : https://github.com/rust-num/num-derive
97
+ [ derive-c ] : https://crates.io/crates/num-derive
98
+ [ derive-cb ] : https://img.shields.io/crates/v/num-derive.svg
99
+ [ derive-d ] : https://docs.rs/num-derive/
100
+ [ derive-db ] : https://docs.rs/num-derive/badge.svg
101
+
102
+ [ `num-integer` ] : https://github.com/rust-num/num-integer
103
+ [ integer-c ] : https://crates.io/crates/num-integer
104
+ [ integer-cb ] : https://img.shields.io/crates/v/num-integer.svg
105
+ [ integer-d ] : https://docs.rs/num-integer/
106
+ [ integer-db ] : https://docs.rs/num-integer/badge.svg
107
+
108
+ [ `num-iter` ] : https://github.com/rust-num/num-iter
109
+ [ iter-c ] : https://crates.io/crates/num-iter
110
+ [ iter-cb ] : https://img.shields.io/crates/v/num-iter.svg
111
+ [ iter-d ] : https://docs.rs/num-iter/
112
+ [ iter-db ] : https://docs.rs/num-iter/badge.svg
113
+
114
+ [ `num-rational` ] : https://github.com/rust-num/num-rational
115
+ [ rational-c ] : https://crates.io/crates/num-rational
116
+ [ rational-cb ] : https://img.shields.io/crates/v/num-rational.svg
117
+ [ rational-d ] : https://docs.rs/num-rational/
118
+ [ rational-db ] : https://docs.rs/num-rational/badge.svg
119
+
120
+ [ `num-traits` ] : https://github.com/rust-num/num-traits
121
+ [ traits-c ] : https://crates.io/crates/num-traits
122
+ [ traits-cb ] : https://img.shields.io/crates/v/num-traits.svg
123
+ [ traits-d ] : https://docs.rs/num-traits/
124
+ [ traits-db ] : https://docs.rs/num-traits/badge.svg
0 commit comments