66
Don't write Rust like it's Java
(jgayfer.com)
Welcome to the Rust community! This is a place to discuss about the Rust programming language.
Credits
Box
is (basically) just the way to have memory on the heap. Here's a direct comparison of how to do heap memory in C/++ and in rust:There can be a bit more to it with custom allocators etc. but that's the only way most people will use boxes. So
Box
basically just means "aT
is allocated somewhere and we need to free that memory when this value is dropped".