|
1 | 1 |
|
2 | 2 | # Triangle From Scratch |
3 | 3 |
|
4 | | -This is an educational series about drawing a triangle without using any outside crates. |
| 4 | +## This Is A Tutorial Repository |
5 | 5 |
|
6 | | -Specifically, the rules are: |
| 6 | +Feel free to look at the source code, |
| 7 | +but the crate is not on crates.io, |
| 8 | +and the majority of the project's "value" is in the mdbook articles that explain what's going on. |
7 | 9 |
|
8 | | -1) We can only put a crate into the `[dependencies]` section of `Cargo.toml` if it's a crate that we wrote ourselves, as part of this project. |
9 | | -2) We **can** still use Rust's standard library. Since all Rust programs can import from the standard library without a `[dependencies]` entry, it's fair game. |
| 10 | +[You Can Read The Book On The GitHub Pages Site](https://rust-tutorials.github.io/triangle-from-scratch/) |
10 | 11 |
|
11 | | -Without any external crates, we'll have to write our own operating system bindings. |
12 | | -It's not difficult code to write, there's just a lot of background details you need to understand first. |
13 | | -That's where most of our focus will go, on learning how that works. |
14 | | -There's a lot less focus spent on the literal "triangle drawing" part, which is usually fairly easy. |
| 12 | +## Project Organization |
15 | 13 |
|
16 | | -Expected subjects include: |
| 14 | +The `book_src/` contains the files to build the mdbook (`cargo install mdbook && mdbook build --open`). |
17 | 15 |
|
18 | | -* Reading OS documentation (which usually assumes you're programming in C). |
19 | | -* Understanding the C header files that describe the OS's public API. |
20 | | -* Writing appropriate "raw" Rust bindings to that public API. |
21 | | -* Creating ergonomic wrapper functions to make the API easily used with the rest of Rust. |
22 | | -* Having those wrapper functions be fully safe (in the Rust sense) when possible, or at least making them as error-proof as we can. |
| 16 | +The `examples/` folder is an "archive" of completed, runnable examples based on the mdbook chapters. |
23 | 17 |
|
24 | | -**Reminder:** The "absolutely no dependencies" thing is for demonstration purposes only. |
25 | | -If you actually want to draw a triangle within a reasonable amount of development time, please do feel free to use dependencies. |
26 | | -Depending on what you need to do, there's generally many good crates available. |
| 18 | +The crate's library portion (`src/lib.rs`, and sub-modules) contains the most easily reused code, |
| 19 | +based on work shown in the the mdbook chapters. |
| 20 | + |
| 21 | +The crate's binary portion (`src/main.rs`) is just scratch space. |
| 22 | +This is so that you can most easily use `cargo run` to test things out when doing work. |
| 23 | +The actual content of `main.rs` at any given moment is unimportant. |
| 24 | +All the valuable code is kept as an `example/` file when a tutorial chapter is completed. |
27 | 25 |
|
28 | 26 | ## Licensing and Contribution |
29 | 27 |
|
|
0 commit comments