Slicing a Vector

This lesson teaches how to slice a vector in Rust!.

We'll cover the following

Get Slice

Imagine a situation where you need to get a portion of a vector. Rust allows you to borrow the slice of the vector instead of using the whole vector.

Syntax

Slice is a two-word object. The first word is a pointer to the data, and the second word is the length of the slice.

Create a free account to access the full course.

Continue your learning journey with a 14-day free trial.

By signing up, you agree to Educative's Terms of Service and Privacy Policy