DEV Community

Cover image for Slices in Rust

Slices in Rust

Francesco Ciulla on March 05, 2024

The Slice type in Rust Rust has a built-in type called Slice that is used to reference a contiguous sequence of elements in a collection...
Collapse
 
lexlohr profile image
Alex Lohr

I'm missing the ability to define the end of the slice as inclusive in this otherwise very good description, e.g. like s[1..=3].

Collapse
 
francescoxx profile image
Francesco Ciulla

you are right, thanks for pointing it out!

Collapse
 
get_pieces profile image
Pieces 🌟

New Rust guide!🔥

Collapse
 
francescoxx profile image
Francesco Ciulla

you are welcome

Collapse
 
shedrick profile image
Shedrick Williams

Nice piece! Slices of collection types are something I’ve kind of had a hard time grasping, especially which part would be inclusive vs. which would be exclusive, so this helps for sure 👍

Collapse
 
francescoxx profile image
Francesco Ciulla

you are welcome