Skip to content

Commit dd0133d

Browse files
committed
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
1 parent 6630a08 commit dd0133d

File tree

3 files changed

+22
-4
lines changed

3 files changed

+22
-4
lines changed

Diff for: src/libcore/num/dec2flt/mod.rs

+7
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,13 @@ from_str_float_impl!(f32);
149149
from_str_float_impl!(f64);
150150

151151
/// An error which can be returned when parsing a float.
152+
///
153+
/// This error is used as the error type for the [`FromStr`] implementation
154+
/// for [`f32`] and [`f64`].
155+
///
156+
/// [`FromStr`]: ../str/trait.FromStr.html
157+
/// [`f32`]: ../primitive.f32.html
158+
/// [`f64`]: ../primitive.f64.html
152159
#[derive(Debug, Clone, PartialEq)]
153160
#[stable(feature = "rust1", since = "1.0.0")]
154161
pub struct ParseFloatError {

Diff for: src/libcore/num/mod.rs

+12-1
Original file line numberDiff line numberDiff line change
@@ -2160,7 +2160,13 @@ impl usize {
21602160
intrinsics::mul_with_overflow }
21612161
}
21622162

2163-
/// Used for representing the classification of floating point numbers
2163+
/// A classification of floating point numbers.
2164+
///
2165+
/// This `enum` is used as the return type for [`f32::classify()`] and [`f64::classify()`]. See
2166+
/// their documentation for more.
2167+
///
2168+
/// [`f32::classify()`]: ../primitive.f32.html#method.classify
2169+
/// [`f64::classify()`]: ../primitive.f64.html#method.classify
21642170
#[derive(Copy, Clone, PartialEq, Debug)]
21652171
#[stable(feature = "rust1", since = "1.0.0")]
21662172
pub enum FpCategory {
@@ -2387,6 +2393,11 @@ fn from_str_radix<T: FromStrRadixHelper>(src: &str, radix: u32)
23872393
}
23882394

23892395
/// An error which can be returned when parsing an integer.
2396+
///
2397+
/// This error is used as the error type for the `from_str_radix()` functions
2398+
/// on the primitive integer types, such as [`i8::from_str_radix()`].
2399+
///
2400+
/// [`i8::from_str_radix()`]: ../std/primitive.i8.html#method.from_str_radix
23902401
#[derive(Debug, Clone, PartialEq)]
23912402
#[stable(feature = "rust1", since = "1.0.0")]
23922403
pub struct ParseIntError { kind: IntErrorKind }

Diff for: src/libstd/num/mod.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
//! Numeric traits and functions for generic mathematics
11+
//! Additional functionality for numerics.
1212
//!
13-
//! These are implemented for the primitive numeric types in `std::{u8, u16,
14-
//! u32, u64, usize, i8, i16, i32, i64, isize, f32, f64}`.
13+
//! This module provides some extra types that are useful when doing numerical
14+
//! work. See the individual documentation for each piece for more information.
1515
1616
#![stable(feature = "rust1", since = "1.0.0")]
1717
#![allow(missing_docs)]

0 commit comments

Comments
 (0)