From dd0133d8362f0e1fca6f4346c620dd13c7e18dbc Mon Sep 17 00:00:00 2001 From: Steve Klabnik Date: Tue, 9 Feb 2016 14:06:24 -0500 Subject: Some docs for std::num This commit does two things: * Re-works the module-level documentation. * Cleaning up wording and adding links to where error types are used. Part of #29364 --- src/libcore/num/dec2flt/mod.rs | 7 +++++++ src/libcore/num/mod.rs | 13 ++++++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) (limited to 'src/libcore') diff --git a/src/libcore/num/dec2flt/mod.rs b/src/libcore/num/dec2flt/mod.rs index c0690c24bbb..9e946dc65c2 100644 --- a/src/libcore/num/dec2flt/mod.rs +++ b/src/libcore/num/dec2flt/mod.rs @@ -149,6 +149,13 @@ from_str_float_impl!(f32); from_str_float_impl!(f64); /// An error which can be returned when parsing a float. +/// +/// This error is used as the error type for the [`FromStr`] implementation +/// for [`f32`] and [`f64`]. +/// +/// [`FromStr`]: ../str/trait.FromStr.html +/// [`f32`]: ../primitive.f32.html +/// [`f64`]: ../primitive.f64.html #[derive(Debug, Clone, PartialEq)] #[stable(feature = "rust1", since = "1.0.0")] pub struct ParseFloatError { diff --git a/src/libcore/num/mod.rs b/src/libcore/num/mod.rs index 99a74cf09f5..9a9dfaa2679 100644 --- a/src/libcore/num/mod.rs +++ b/src/libcore/num/mod.rs @@ -2160,7 +2160,13 @@ impl usize { intrinsics::mul_with_overflow } } -/// Used for representing the classification of floating point numbers +/// A classification of floating point numbers. +/// +/// This `enum` is used as the return type for [`f32::classify()`] and [`f64::classify()`]. See +/// their documentation for more. +/// +/// [`f32::classify()`]: ../primitive.f32.html#method.classify +/// [`f64::classify()`]: ../primitive.f64.html#method.classify #[derive(Copy, Clone, PartialEq, Debug)] #[stable(feature = "rust1", since = "1.0.0")] pub enum FpCategory { @@ -2387,6 +2393,11 @@ fn from_str_radix(src: &str, radix: u32) } /// An error which can be returned when parsing an integer. +/// +/// This error is used as the error type for the `from_str_radix()` functions +/// on the primitive integer types, such as [`i8::from_str_radix()`]. +/// +/// [`i8::from_str_radix()`]: ../std/primitive.i8.html#method.from_str_radix #[derive(Debug, Clone, PartialEq)] #[stable(feature = "rust1", since = "1.0.0")] pub struct ParseIntError { kind: IntErrorKind } -- cgit 1.4.1-3-g733a5