I think this might be a good exercise anyway. Since you’re just starting out with Rust, try to learn it by itself first - taking a project you’re familiar with written in another language and reimplementing in Rust is a good approach.
Graphics programming in Rust is going to throw you into the deep end of the pool - I’d save that for later.
They exist because (a) you do need to allocate things on the heap and (b) there’s no GC - you need to manage memory manually. Raw pointers require “full” management of the memory - you allocate and deallocate manually, there’s no compiler support for determining when the pointer is no longer in-use. If you deallocate prematurely, you’ll get use-after-free bugs (common gateway for security exploits to boot). So smart pointers integrate with the language to automate some of this and prevent a class of bugs (Rust, in particular, is very strong in this space).
The most canonical example of something using heap allocation in Rust is the
Vec struct (think
List in C#). The
Vec manages the backing heap memory internally, but I don’t think anyone would call it a “smart pointer”; that’s because its purpose is much more than just managing the heap allocation (i.e. allocating it and knowing when to deallocate it) - it’s a datastructure.
There are other reasons to use
Box (and thus heap allocation) in Rust, such as forming owned trait objects (aka type erasure), but I suggest you hold off on learning about trait objects for now; try to understand the more fundamental aspects of Rust first.
Finally, I would continue reading the book as it’ll introduce you to the concepts you’ll need to know. If you don’t understand something there, feel free to ask in this forum and people will happily help out.