Loading tutorials
cargo, and have a rough picture of the stack and the heap. It covers the three rules, what they mean in practice, and the edge cases that surpris4 min readcargo run, and know the stack/heap distinction from the earlier chapters. You should also have seen the three ownership rules. The third rule says that when the owner goes out of scope, the value is dropped. Here you will see 4 min readcargo, and have seen the three ownership rules: every value has one owner, there is only one owner at a time, and the value is dropped when the owner goes out of scope. This chapter covers what happens when ownership changes hands. Rust calls that4 min readString, Vec, and &str.4 min readDrop, moves, and Copy versus Clone. Here we apply those ideas to function calls.5 min readString, Vec, and &str, and with running programs using cargo run. Here you learn how to let a function read a value without taking ownership of it.5 min read&T). It covers &mut T: how to create one, what it allows, and which compiler errors you will meet.4 min read&T) and mutable references (&mut T), and how a move transfers ownership. This chapter covers the rules that decide which combinations of references the compiler accepts. It also covers how to read the errors when it rejects your code.5 min readrustc error output.5 min readfn longest<'a>(...)). It covers what changes when a reference is stored in a struct field instead of passed through a function.4 min readString, Vec, and &str.5 min readBox<T>. It does not require RefCell, which the next chapter covers. We use it only once, in the last example.4 min read&T or one &mut T), how Box<T> and Rc<T> work, and how to read a borrow checker error. It covers Cell, RefCell, and the pattern they enable. It builds on the previous chapter on Rc.4 min readRc, and RefCell from the earlier chapters. It also assumes you can spawn a thread with std::thread::spawn. You will see why Rc<RefCell<T>> cannot cross threads, what Arc<Mutex<T>> changes, and which mistakes to expect.5 min read