Initial commit
commit 5031a8011ef08cf279103db05fa5465b714fee44
3 changed files with 57 additions and 0 deletions
.gitignore ADDED
| @@ -0,0 +1,2 @@ | ||
| 1 | +target/ | |
| 2 | +**/*.rs.bk | |
LICENSE ADDED
| @@ -0,0 +1,21 @@ | ||
| 1 | +MIT License | |
| 2 | + | |
| 3 | +Copyright (c) 2025 glibCode | |
| 4 | + | |
| 5 | +Permission is hereby granted, free of charge, to any person obtaining a copy | |
| 6 | +of this software and associated documentation files (the "Software"), to deal | |
| 7 | +in the Software without restriction, including without limitation the rights | |
| 8 | +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
| 9 | +copies of the Software, and to permit persons to whom the Software is | |
| 10 | +furnished to do so, subject to the following conditions: | |
| 11 | + | |
| 12 | +The above copyright notice and this permission notice shall be included in all | |
| 13 | +copies or substantial portions of the Software. | |
| 14 | + | |
| 15 | +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |
| 16 | +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |
| 17 | +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | |
| 18 | +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | |
| 19 | +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | |
| 20 | +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | |
| 21 | +SOFTWARE. | |
README.md ADDED
| @@ -0,0 +1,34 @@ | ||
| 1 | +# Rust: Ownership without Tears | |
| 2 | + | |
| 3 | +Example code and exercises for the glibCode course **[Rust: Ownership without Tears](https://glibcode.net/courses/rust-ownership/)** (Intermediate, about 11 hours). | |
| 4 | + | |
| 5 | +Ownership, borrowing and lifetimes, explained with pictures and fixed compiler errors, until the borrow checker feels like a friend. | |
| 6 | + | |
| 7 | +## Lessons | |
| 8 | + | |
| 9 | +| # | Lesson | Code | | |
| 10 | +| --- | --- | --- | | |
| 11 | +| 1 | Hello, Cargo | [`lessons/01-hello-cargo`](lessons/01-hello-cargo/) | | |
| 12 | +| 2 | Ownership: who frees the memory | [`lessons/02-ownership-who-frees-the-memory`](lessons/02-ownership-who-frees-the-memory/) | | |
| 13 | +| 3 | Borrowing and references | [`lessons/03-borrowing-and-references`](lessons/03-borrowing-and-references/) | | |
| 14 | +| 4 | Slices | [`lessons/04-slices`](lessons/04-slices/) | | |
| 15 | +| 5 | Structs and enums | [`lessons/05-structs-and-enums`](lessons/05-structs-and-enums/) | | |
| 16 | +| 6 | Pattern matching | [`lessons/06-pattern-matching`](lessons/06-pattern-matching/) | | |
| 17 | +| 7 | Error handling with Result | [`lessons/07-error-handling-with-result`](lessons/07-error-handling-with-result/) | | |
| 18 | +| 8 | Lifetimes demystified | [`lessons/08-lifetimes-demystified`](lessons/08-lifetimes-demystified/) | | |
| 19 | +| 9 | Traits and generics | [`lessons/09-traits-and-generics`](lessons/09-traits-and-generics/) | | |
| 20 | + | |
| 21 | +## Getting started | |
| 22 | + | |
| 23 | +```sh | |
| 24 | +git clone https://git.glibcode.net/glibcode/rust-ownership.git | |
| 25 | +cd rust-ownership | |
| 26 | +``` | |
| 27 | + | |
| 28 | +Rust from [rustup.rs](https://rustup.rs). Every lesson is its own Cargo project. | |
| 29 | + | |
| 30 | +Questions? Ask in the course forum or write to help@glibcode.net. | |
| 31 | + | |
| 32 | +## License | |
| 33 | + | |
| 34 | +The code is MIT licensed (see `LICENSE`). The lesson texts are © glibCode. | |