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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// 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.

//! Numeric traits for generic mathematics
//!
//! This version of the crate only exists to re-export compatible
//! items from num-traits 0.2.  Please consider updating!

#![doc(html_root_url = "https://docs.rs/num-traits/0.1")]

extern crate num_traits;

pub use bounds::Bounded;
pub use float::{Float, FloatConst};
// pub use real::Real; // NOTE: Don't do this, it breaks `use num_traits::*;`.
pub use identities::{Zero, One, zero, one};
pub use ops::checked::{CheckedAdd, CheckedSub, CheckedMul, CheckedDiv, CheckedShl, CheckedShr};
pub use ops::wrapping::{WrappingAdd, WrappingMul, WrappingSub};
pub use ops::saturating::Saturating;
pub use sign::{Signed, Unsigned, abs, abs_sub, signum};
pub use cast::{AsPrimitive, FromPrimitive, ToPrimitive, NumCast, cast};
pub use int::PrimInt;
pub use pow::{pow, checked_pow};


// Re-exports from num-traits 0.2!

pub use num_traits::{Num, NumOps, NumRef, RefNum};
pub use num_traits::{NumAssignOps, NumAssign, NumAssignRef};
pub use num_traits::{FloatErrorKind, ParseFloatError};
pub use num_traits::clamp;

// Note: the module structure is explicitly re-created, rather than re-exporting en masse,
// so we won't expose any items that may be added later in the new version.

pub mod identities {
    pub use num_traits::identities::{Zero, One, zero, one};
}

pub mod sign {
    pub use num_traits::sign::{Signed, Unsigned, abs, abs_sub, signum};
}

pub mod ops {
    pub mod saturating {
        pub use num_traits::ops::saturating::Saturating;
    }

    pub mod checked {
        pub use num_traits::ops::checked::{CheckedAdd, CheckedSub, CheckedMul, CheckedDiv,
                                           CheckedShl, CheckedShr};
    }

    pub mod wrapping {
        pub use num_traits::ops::wrapping::{WrappingAdd, WrappingMul, WrappingSub};
    }
}

pub mod bounds {
    pub use num_traits::bounds::Bounded;
}

pub mod float {
    pub use num_traits::float::{Float, FloatConst};
}

pub mod real {
    pub use num_traits::real::Real;
}

pub mod cast {
    pub use num_traits::cast::{AsPrimitive, FromPrimitive, ToPrimitive, NumCast, cast};
}

pub mod int {
    pub use num_traits::int::PrimInt;
}

pub mod pow {
    pub use num_traits::pow::{pow, checked_pow};
}