String buffer and immutable ref to a string slice
This commit is contained in:
parent
4518c489dc
commit
a3136725b5
13
src/main.rs
13
src/main.rs
|
@ -1,9 +1,10 @@
|
|||
fn main() {
|
||||
let a: [i32; 6] = [10, 20, 30, 40, 50, 60];
|
||||
println!("a: {a:?}");
|
||||
let s1: &str = "Hello";
|
||||
println!("s1: {s1}");
|
||||
|
||||
let s: &[i32] = &a[2..4];
|
||||
println!("s: {s:?}");
|
||||
println!("a[2]: {}", a[2]);
|
||||
println!("s[0]: {}", s[0]);
|
||||
let mut s2: String = String::from("Hello");
|
||||
println!("s2: {s2}");
|
||||
|
||||
s2.push_str(s1);
|
||||
println!("s2: {s2}");
|
||||
}
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue