Skip to content

Glossary: Data Structures and Algorithms in Rust

Slice

Also written: slices, &[u32], &[i32], &mut [i32], &str slice

A borrowed view of a run of items in a Vec or array, such as &[u32] or &items[1..]. Slicing copies nothing and is O(1), while to_vec() makes a copy.

Where the book teaches it

Related terms

VecIn placeBorrow