mirror of
https://github.com/rust-lang/book.git
synced 2026-11-30 19:24:32 -06:00
Update the TOC for ownership.
Here's a rough summary of notes from @aturon and I's discussion about
this:
Topics:
- heap vs stack
- pointers
- slices
- scope/drops
- Ownership
- confusion around allocating strings vs literals
- String::new and String.push
- or do we use String::from?
- scope/drops
- Move vs copy
- Borrowing
- Rust's take on pointers to entire objects
- Memory layout
- heap vs stack -- what does it mean to own a String -- what even is
a String??
- talk in terms of box and arrow diagrams, rather than address
spaces etc
- keep a high level of conceptual abstraction
- pointers
- Slices
- Rust's take on *interior* pointers
- Niko argues that slices and borrowing from fields of a struct are
conceptually related
- Sing the praises of slices wrt safety!
- We get to address string literals very early!
- Sidebar on literals and rodata
- Advanced: lifetimes
This commit is contained in:
+4
-2
@@ -16,10 +16,12 @@
|
||||
- [Control flow with `if`](if.md)
|
||||
- [Loops](loops.md)
|
||||
|
||||
- [Ownership & borrowing]()
|
||||
- [Understanding Ownership](understanding-ownership.md)
|
||||
- [Ownership]()
|
||||
- [References & Borrowing]()
|
||||
- [Lifetimes]()
|
||||
- [Memory Layout]()
|
||||
- [Slices]()
|
||||
- [Advanced: Lifetimes]()
|
||||
|
||||
- [Structs](structs.md)
|
||||
- [Method Syntax]()
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
# Understanding Ownership
|
||||
|
||||
Now that we’ve got some basic syntax under our belt, it’s time to take a look
|
||||
at Rust’s most unique feature: ownership. We’ll also talk about several related
|
||||
features: borrowing, slices, and lifetimes, as well as how Rust lays things out
|
||||
in memory.
|
||||
Reference in New Issue
Block a user