String buffer and immutable ref to a string slice

This commit is contained in:
Vincent Batts 2023-01-14 15:21:59 -05:00
parent 4518c489dc
commit a3136725b5
46 changed files with 7 additions and 6 deletions

View File

@ -1,9 +1,10 @@
fn main() { fn main() {
let a: [i32; 6] = [10, 20, 30, 40, 50, 60]; let s1: &str = "Hello";
println!("a: {a:?}"); println!("s1: {s1}");
let s: &[i32] = &a[2..4]; let mut s2: String = String::from("Hello");
println!("s: {s:?}"); println!("s2: {s2}");
println!("a[2]: {}", a[2]);
println!("s[0]: {}", s[0]); s2.push_str(s1);
println!("s2: {s2}");
} }

Binary file not shown.