We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 04da31e commit 0bfcfcfCopy full SHA for 0bfcfcf
src/libcollections/str.rs
@@ -106,6 +106,14 @@ pub fn from_utf8_owned(vv: Vec<u8>) -> Result<String, Vec<u8>> {
106
/// # Failure
107
///
108
/// Fails if invalid UTF-8
109
+///
110
+/// # Example
111
112
+/// ```rust
113
+/// use std::str;
114
+/// let string = str::from_byte(66u8);
115
+/// assert_eq!(string.as_slice(), "B");
116
+/// ```
117
pub fn from_byte(b: u8) -> String {
118
assert!(b < 128u8);
119
String::from_char(1, b as char)
0 commit comments