Skip to content

Commit bb580f1

Browse files
committed
auto merge of #13694 : jacob-hegna/rust/master, r=brson
... and uint_macros.rs
2 parents e049a70 + a14c34d commit bb580f1

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

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

+10
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,16 @@ impl Primitive for $T {}
235235
// String conversion functions and impl str -> num
236236

237237
/// Parse a byte slice as a number in the given base.
238+
///
239+
/// Yields an `Option` because `buf` may or may not actually be parseable.
240+
///
241+
/// # Examples
242+
///
243+
/// ```rust
244+
/// let digits = [49,50,51,52,53,54,55,56,57];
245+
/// let base = 10;
246+
/// let num = std::i64::parse_bytes(digits, base);
247+
/// ```
238248
#[inline]
239249
pub fn parse_bytes(buf: &[u8], radix: uint) -> Option<$T> {
240250
strconv::from_str_bytes_common(buf, radix, true, false, false,

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

+10
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,16 @@ impl Int for $T {}
149149
// String conversion functions and impl str -> num
150150

151151
/// Parse a byte slice as a number in the given base.
152+
///
153+
/// Yields an `Option` because `buf` may or may not actually be parseable.
154+
///
155+
/// # Examples
156+
///
157+
/// ```rust
158+
/// let digits = [49,50,51,52,53,54,55,56,57];
159+
/// let base = 10;
160+
/// let num = std::i64::parse_bytes(digits, base);
161+
/// ```
152162
#[inline]
153163
pub fn parse_bytes(buf: &[u8], radix: uint) -> Option<$T> {
154164
strconv::from_str_bytes_common(buf, radix, false, false, false,

0 commit comments

Comments
 (0)