Skip to content

Commit d5a7a25

Browse files
committed
break into sections
1 parent a40c79d commit d5a7a25

5 files changed

+69
-67
lines changed

src/SUMMARY.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,9 @@
8989
- [Patterns](ch18-00-patterns.md) (perhaps an appendix?)
9090

9191
- [Advanced Features](ch19-00-advanced-features.md)
92+
- [Unsafe Rust](ch19-01-unsafe-rust.md)
93+
- [Advanced Lifetimes](ch19-02-advanced-lifetimes.md)
94+
- [Advanced Traits](ch19-03-advanced-traits.md)
9295

9396
- [Un-named project](ch20-00-unnamed-project.md)
9497

src/ch19-00-advanced-features.md

Lines changed: 0 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -13,70 +13,3 @@ Here's a quick summary:
1313
* Unsafe Rust: for when you need to tell Rust "just trust me, promise!"
1414
* Advanced Lifetimes: Additional lifetime syntax for complex situations.
1515
* Advanced Traits: Associated Types, coherence, and disambiguation.
16-
17-
## Unsafe Rust
18-
19-
Things you may do in an unsafe block that you may not in safe rust
20-
21-
- deref a raw pointer
22-
- call an unsafe fn
23-
- access or modify a static variable
24-
- impl an unsafe trait
25-
26-
Go see other stuff
27-
28-
Here's the syntax tho
29-
30-
You know unsafe blocks are the cause of any crashes
31-
32-
wrap all the unsafe, make it as small as possible, present a safe public API
33-
34-
### Raw Pointers
35-
36-
### Unsafe Functions
37-
38-
#### `transmute`
39-
40-
never ever. don't. stop.
41-
42-
#### `extern fn`
43-
44-
You have to write unsafe code to FFI
45-
46-
### `static`
47-
48-
### Unsafe Traits
49-
50-
## More Lifetimes
51-
52-
### Lifetimes that depend on other lifetimes
53-
54-
'a: 'b stuff: subtyping
55-
56-
### Higher ranked trait bounds
57-
58-
for<'a>
59-
60-
Needed for closures
61-
62-
## Associated Types
63-
64-
More common than the other things, less common than the rest of the book
65-
66-
why this is a thing instead of a generic
67-
68-
## The Thing Formerly Known as UFCS
69-
70-
Only needed when implementing super generic code
71-
72-
Lots of things are syntax sugar for this
73-
74-
Two traits that impl the same method - how to disambiguate
75-
76-
## Coherence
77-
78-
Show examples of when you control traits and types or not
79-
80-
Ex: Cannot impl Debug on someone else's type
81-
82-
Solution: newtype

src/ch19-01-unsafe-rust.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Unsafe Rust
2+
3+
Things you may do in an unsafe block that you may not in safe rust
4+
5+
- deref a raw pointer
6+
- call an unsafe fn
7+
- access or modify a static variable
8+
- impl an unsafe trait
9+
10+
Go see other stuff
11+
12+
Here's the syntax tho
13+
14+
You know unsafe blocks are the cause of any crashes
15+
16+
wrap all the unsafe, make it as small as possible, present a safe public API
17+
18+
## Raw Pointers
19+
20+
## Unsafe Functions
21+
22+
### `transmute`
23+
24+
never ever. don't. stop.
25+
26+
### `extern fn`
27+
28+
You have to write unsafe code to FFI
29+
30+
## `static`
31+
32+
## Unsafe Traits

src/ch19-02-advanced-lifetimes.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Advanced Lifetimes
2+
3+
### Lifetimes that depend on other lifetimes
4+
5+
'a: 'b stuff: subtyping
6+
7+
### Higher ranked trait bounds
8+
9+
for<'a>
10+
11+
Needed for closures

src/ch19-03-advanced-traits.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Advanced Traits
2+
3+
## Associated Types
4+
5+
More common than the other things, less common than the rest of the book
6+
7+
why this is a thing instead of a generic
8+
9+
## The Thing Formerly Known as UFCS
10+
11+
Only needed when implementing super generic code
12+
13+
Lots of things are syntax sugar for this
14+
15+
Two traits that impl the same method - how to disambiguate
16+
17+
## Coherence
18+
19+
Show examples of when you control traits and types or not
20+
21+
Ex: Cannot impl Debug on someone else's type
22+
23+
Solution: newtype

0 commit comments

Comments
 (0)