about summary refs log tree commit diff
path: root/src/libstd/num
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2014-04-23 05:51:30 -0700
committerbors <bors@rust-lang.org>2014-04-23 05:51:30 -0700
commitbb580f1a56138bd5a96ccc95c0f61caab72cf975 (patch)
tree4f3c924e3a5c4bbb8c1fcf24121295740f20d013 /src/libstd/num
parente049a7003b686002d5c091ec0465d07e5c5ff7a6 (diff)
parenta14c34d670fc76ccc025d5f7ae89ccbb811560c6 (diff)
downloadrust-bb580f1a56138bd5a96ccc95c0f61caab72cf975.tar.gz
rust-bb580f1a56138bd5a96ccc95c0f61caab72cf975.zip
auto merge of #13694 : jacob-hegna/rust/master, r=brson
... and uint_macros.rs
Diffstat (limited to 'src/libstd/num')
-rw-r--r--src/libstd/num/int_macros.rs10
-rw-r--r--src/libstd/num/uint_macros.rs10
2 files changed, 20 insertions, 0 deletions
diff --git a/src/libstd/num/int_macros.rs b/src/libstd/num/int_macros.rs
index a6b0ccf3a87..cacd8d0aef9 100644
--- a/src/libstd/num/int_macros.rs
+++ b/src/libstd/num/int_macros.rs
@@ -235,6 +235,16 @@ impl Primitive for $T {}
 // String conversion functions and impl str -> num
 
 /// Parse a byte slice as a number in the given base.
+///
+/// Yields an `Option` because `buf` may or may not actually be parseable.
+///
+/// # Examples
+///
+/// ```rust
+/// let digits = [49,50,51,52,53,54,55,56,57];
+/// let base   = 10;
+/// let num    = std::i64::parse_bytes(digits, base);
+/// ```
 #[inline]
 pub fn parse_bytes(buf: &[u8], radix: uint) -> Option<$T> {
     strconv::from_str_bytes_common(buf, radix, true, false, false,
diff --git a/src/libstd/num/uint_macros.rs b/src/libstd/num/uint_macros.rs
index 9b9aee672a0..697390a0069 100644
--- a/src/libstd/num/uint_macros.rs
+++ b/src/libstd/num/uint_macros.rs
@@ -149,6 +149,16 @@ impl Int for $T {}
 // String conversion functions and impl str -> num
 
 /// Parse a byte slice as a number in the given base.
+///
+/// Yields an `Option` because `buf` may or may not actually be parseable.
+///
+/// # Examples
+///
+/// ```rust
+/// let digits = [49,50,51,52,53,54,55,56,57];
+/// let base   = 10;
+/// let num    = std::i64::parse_bytes(digits, base);
+/// ```
 #[inline]
 pub fn parse_bytes(buf: &[u8], radix: uint) -> Option<$T> {
     strconv::from_str_bytes_common(buf, radix, false, false, false,