This is an educational series about drawing a triangle without using any outside crates.
Specifically, the rules are:
- We can only put a crate into the
Cargo.tomlif it's a crate that we wrote ourselves, as part of this project.
- 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.
Without any external crates, we'll have to write our own operating system bindings. It's not difficult code to write, there's just a lot of background details you need to understand first. That's where most of our focus will go, on learning how that works. There's a lot less focus spent on the literal "triangle drawing" part, which is usually fairly easy.
Expected subjects include:
- Reading OS documentation (which usually assumes you're programming in C).
- Understanding the C header files that describe the OS's public API.
- Writing appropriate "raw" Rust bindings to that public API.
- Creating ergonomic wrapper functions to make the API easily used with the rest of Rust.
- Having those wrapper functions be fully safe (in the Rust sense) when possible, or at least making them as error-proof as we can.
I will be frequently linking to the documentation pages many of the the important things we deal with. I expect you to actually go to those pages and read what they say. I will be covering much, but I can't cover every single detail every single time. You should always read the documentation for yourself as well as reading this tutorial.
Reminder: The "absolutely no dependencies" thing is for demonstration purposes only. If you actually want to draw a triangle within a reasonable amount of development time, please do feel free to use dependencies. Depending on what you need to do, there's generally many good crates available.