Re:Learn Rust with entirely too many linked lists (2019)
by redrobein on Saturday February 22, 2020 @10:39AM
(#22391515)
> To explain what I think this comment means. When working on embedded systems, you can interact with hardware devices by writing directly to specially mapped memory areas.
And why can't you do this in rust?
Re:Learn Rust with entirely too many linked lists (2019)
by jasondclinton on Saturday February 22, 2020 @10:49AM
(#22391566)
You can. Rust allows full memory addressing.
Re:Learn Rust with entirely too many linked lists (2019)
by lawn on Saturday February 22, 2020 @10:56AM
(#22391602)
There's nothing to prevent you from doing this, although you may have to wrap it in an unsafe block.
Re:Learn Rust with entirely too many linked lists (2019)
by monocasa on Saturday February 22, 2020 @01:52PM
(#22392591)
They're saying more that intrusive data structures are really nice in situations that restrict heap allocation. The memory overhead outside of the structures linked together is O(1), because all of the per object metadata is stored in the objects themselves. That means consumers generally don't have to be hardcoded for certain number of objects like you would for an array/vector that doesn't have access to a heap.
E.g., if you want to write text to a small screen, the kernel driver gives you a memory region that you write bytes to, and they're shown on the screen immediately, without requiring the CPU.