Hacker News new | ask | show | jobs
by hobbyist 4834 days ago
If Rust doesn't allow pointer arithmetic and conjuring up a pointer using '&' like in C, it doesn't make me feel there is anything special here.
2 comments

If you have a slice of a vector (`&[T]`), then you can also move it forward, like pointer arithmetic in C except checked to ensure that you don't overflow the bounds of the vector. Of course, if you have an unsafe pointer, then you can perform raw pointer arithmetic on it as well.

You can create references using `&`, although I didn't show it in this overview.

Pointer arithmetic should be confined to unsafe/system blocks as it only makes sense when writing low level code like device drivers.