this post was submitted on 23 Jul 2026
7 points (100.0% liked)
Rust
8149 readers
14 users here now
Welcome to the Rust community! This is a place to discuss about the Rust programming language.
Wormhole
Credits
- The icon is a modified version of the official rust logo (changing the colors to a gradient and black background)
founded 3 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
Does your function need to accept
&mut self? If you can redesign that function just to take the slice of game objects (fn update(objs: &mut [T])) then you don't need to worry about the aliasing at all. You can pass an index as well if you want to operate on them one at a time.This is actually closer to the strategy you'd see with ECS. You'd operate not on individual objects, but on all relevant objects at once.