about summary refs log tree commit diff
path: root/src/libstd/num
diff options
context:
space:
mode:
authorManish Goregaokar <manishsmail@gmail.com>2014-04-12 04:37:45 +0530
committerManish Goregaokar <manishsmail@gmail.com>2014-04-12 04:37:45 +0530
commit01d5d51dafae10aed1abf70d9e1eecadb8e4c19f (patch)
tree97bdb70d4b912f76061755ffe7d7d836ae423116 /src/libstd/num
parentb2b2bbb62893b9655f65cb2813eaaba4f2e742dd (diff)
downloadrust-01d5d51dafae10aed1abf70d9e1eecadb8e4c19f.tar.gz
rust-01d5d51dafae10aed1abf70d9e1eecadb8e4c19f.zip
Document traits in std::num (#7511)
Diffstat (limited to 'src/libstd/num')
-rw-r--r--src/libstd/num/mod.rs4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/libstd/num/mod.rs b/src/libstd/num/mod.rs
index 9d0b53f945f..d036e847120 100644
--- a/src/libstd/num/mod.rs
+++ b/src/libstd/num/mod.rs
@@ -159,6 +159,7 @@ pub fn abs_sub<T: Signed>(x: T, y: T) -> T {
 /// - `-1` if the number is negative
 #[inline(always)] pub fn signum<T: Signed>(value: T) -> T { value.signum() }
 
+/// A trait for values which cannot be negative
 pub trait Unsigned: Num {}
 
 /// A collection of rounding operations.
@@ -205,6 +206,7 @@ pub fn pow<T: One + Mul<T, T>>(mut base: T, mut exp: uint) -> T {
     }
 }
 
+/// Numbers which have upper and lower bounds
 pub trait Bounded {
     // FIXME (#5527): These should be associated constants
     fn min_value() -> Self;
@@ -1046,10 +1048,12 @@ impl_num_cast!(int,   to_int)
 impl_num_cast!(f32,   to_f32)
 impl_num_cast!(f64,   to_f64)
 
+/// A generic trait for converting a value to a string with a radix (base)
 pub trait ToStrRadix {
     fn to_str_radix(&self, radix: uint) -> ~str;
 }
 
+/// A generic trait for converting a string with a radix (base) to a value
 pub trait FromStrRadix {
     fn from_str_radix(str: &str, radix: uint) -> Option<Self>;
 }