demo of arrays
()
| 1 | /// demo of arrays |
| 2 | |
| 3 | fn main() { |
| 4 | let xs = [1, 2, 3, 4, 5]; |
| 5 | |
| 6 | let ys: [i32; 500] = [0; 500]; |
| 7 | let _ys = [0_u64; 500]; |
| 8 | |
| 9 | println!("first element of the array: {}", xs[0]); |
| 10 | println!("second element of the array: {}", xs[1]); |
| 11 | |
| 12 | println!("small size: {}", xs.len()); |
| 13 | println!("big size: {}", ys.len()); |
| 14 | |
| 15 | println!("borrow a section of the array as a slice {:?}", &xs[1..3]); |
| 16 | |
| 17 | println!("{}", xs[5]); |
| 18 | } |
nothing calls this directly
no outgoing calls
no test coverage detected