diff --git a/src/libcollections/str.rs b/src/libcollections/str.rs index 10309adef20..7e47f02d21a 100644 --- a/src/libcollections/str.rs +++ b/src/libcollections/str.rs @@ -106,6 +106,14 @@ pub fn from_utf8_owned(vv: Vec) -> Result> { /// # 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)