@@ -119,7 +119,7 @@ Or maybe you want an array of bytes that's mostly text? Byte strings to the resc
119
119
use std::str;
120
120
121
121
fn main() {
122
- // Note that this is not actually a &str
122
+ // Note that this is not actually a ` &str`
123
123
let bytestring: &[u8; 20] = b"this is a bytestring";
124
124
125
125
// Byte arrays don't have the `Display` trait, so printing them is a bit limited
@@ -136,7 +136,7 @@ fn main() {
136
136
let raw_bytestring = br"\u{211D} is not escaped here";
137
137
println!("{:?}", raw_bytestring);
138
138
139
- // Converting a byte array to str can fail
139
+ // Converting a byte array to ` str` can fail
140
140
if let Ok(my_str) = str::from_utf8(raw_bytestring) {
141
141
println!("And the same as text: '{}'", my_str);
142
142
}
@@ -147,7 +147,7 @@ fn main() {
147
147
// Bytestrings don't have to be UTF-8
148
148
let shift_jis = b"\x82\xe6\x82\xa8\x82\xb1\x82"; // "ようこそ" in SHIFT-JIS
149
149
150
- // But then they can't always be converted to str
150
+ // But then they can't always be converted to ` str`
151
151
match str::from_utf8(shift_jis) {
152
152
Ok(my_str) => println!("Conversion successful: '{}'", my_str),
153
153
Err(e) => println!("Conversion failed: {:?}", e),
0 commit comments