Skip to content

Commit

Permalink
add example for from_byte() documenation
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonthompson committed Jun 30, 2014
1 parent 04da31e commit 0bfcfcf
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/libcollections/str.rs
Expand Up @@ -106,6 +106,14 @@ pub fn from_utf8_owned(vv: Vec<u8>) -> Result<String, Vec<u8>> {
/// # Failure
///
/// Fails if invalid UTF-8
///
/// # Example
///
/// ```rust
/// use std::str;
/// let string = str::from_byte(66u8);
/// assert_eq!(string.as_slice(), "B");
/// ```
pub fn from_byte(b: u8) -> String {
assert!(b < 128u8);
String::from_char(1, b as char)
Expand Down

5 comments on commit 0bfcfcf

@bors
Copy link
Contributor

@bors bors commented on 0bfcfcf Jul 1, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

saw approval from huonw
at jasonthompson@0bfcfcf

@bors
Copy link
Contributor

@bors bors commented on 0bfcfcf Jul 1, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merging jasonthompson/rust/docs/str = 0bfcfcf into auto

@bors
Copy link
Contributor

@bors bors commented on 0bfcfcf Jul 1, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

jasonthompson/rust/docs/str = 0bfcfcf merged ok, testing candidate = 90ab2f8

@bors
Copy link
Contributor

@bors bors commented on 0bfcfcf Jul 1, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fast-forwarding master to auto = 90ab2f8

Please sign in to comment.