Loading tutorials
String and &str differ, and how moves work: assigning or passing a String transfers ownership and invalidates the old variable.2 min readString and &str, and have read the previous chapter on shared references (&T). A shared reference lets a function read a value. This chapter covers the mutable reference, which lets a function change the value2 min readString and Vec, and have seen &T and &mut T used in function parameters. Here you will learn the single rule that ties both kinds of reference together, and what the compiler does when you break it.2 min read&T) work and the rule that a value cannot be mutated while it is borrowed. Slices apply the same rules to a part of a collection instead of the whole thing.2 min readString and &str, how moves work, and how shared and mutable references behave. You should also be able to build and run a program with cargo.3 min read&T), mutable references (&mut T), and the rule that a value has either many shared borrows or one mutable borrow at a time. Here you learn how the compiler decides when a borrow stops counting against that rule.2 min read&T) and mutable (&mut T) references, the rule of many readers or one writer, and why a dangling reference is rejected. You should be able to build and run a program with cargo.3 min read&T and &mut T, and that you know why a returned reference must not outlive the data it points to. It also assumes you have seen the 'a syntax from the previous chapter.2 min read&T and &mut T. It also assumes you know the rule "many readers or one writer" and have seen 'a lifetime annotations on functions.2 min read&mut T works and the rule of many readers or one writer. Here you will see why you can pass the same &mut reference to several functions in a row, even though a &mut reference cannot be copied.2 min readString, Vec, and &str usage. Here you will decide which type a function parameter should have.2 min read&T) and mutable (&mut T) references, and the rule that a value has either many shared borrows or one mutable borrow at a time. You should be able to build and run a program with cargo.3 min read