Loading tutorials
Vec<T>. It defines the slice type, shows how a slice relates to the storage behind it, and covers the properties you need before the later chapters on ranges, 7 min read&[T], a borrowed view of contiguous elements) and how arrays and Vec<T> store their elements. It also assumes basic borrowing. The next chapter covers what happens when a range is 5 min read&v[1..4], and that you know Option and match. It covers what happens when an index or range doesn't fit the slice, and how to choose between the two ways of asking for an element.6 min read&[T] slice type and range syntax such as &a[1..4]. Here you will see how the same ideas apply to text, and why string slicing has a failure mode that array slicing7 min readVec<T> and arrays. You have already seen that &a[1..4] produces a &[i32]. Here you will use that type to design function signatures that accept many kinds of callers.5 min read&) and mutable (&mut) references, and how to build arrays and Vec<T> values. You should also know how to create a slice with &v[a..b]. The chapter covers what a slice borrows, how long the borrow lasts, and which c5 min read&mut [T], the exclusive borrow of a slice. It explains why the compiler won't give you two mutable slices into the same buffer by default, and how split_at_mut and related methods hand out several at once.7 min read&[T], range syntax such as &v[1..4], and the difference between indexing and get. It also assumes basic familiarity with 5 min readmatch, if let, let ... else, and function parameters take a slice apart by its length and by the elements at its ends. This chapter assumes you know the slice type &[T], range slicing, and the borrowing rules for slices from the earlier chapters. It also assumes you are co6 min read[T], str, and dyn Trait differently from ordinary types. It assumes you can create slices with ranges, know the difference between &[T] and Vec<T>, and understand basic borrowing. You don't need unsafe Rust6 min read&[T], &str) into owned values (Vec<T>, String, Box<[T]>, arrays) and how to go back. It assumes you know ownership and moves, shared and mutable borrowing, and the basic use of Vec<T>, String, and range slicing such as &v[1..3].6 min read