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:
Steve Klabnik 2016-01-12 14:35:10 -05:00
parent fd2dc5e2e0
commit 40c93504dd
2 changed files with 10 additions and 2 deletions

View File

@ -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]()

View File

@ -0,0 +1,6 @@
# Understanding Ownership
Now that weve got some basic syntax under our belt, its time to take a look
at Rusts most unique feature: ownership. Well also talk about several related
features: borrowing, slices, and lifetimes, as well as how Rust lays things out
in memory.