Hi, I’m writing a small game to learn rust, and I’m having problems with getting a small struct out of an array slice.
The struct in question is templated and marked as
deriving(Copy,Clone), but when I try to move it, I get
error: cannot move out of type[physics::particle::Particle<'a, T>]
, a non-copy fixed-size array on this line. It contains another struct (with only
f32s and again
deriving(Copy,Clone)) and a borrowed non-mutable reference.
The whole function in which the error appears is a recursive building function for a bounding box hierarchy tree, taking a array slice that contains particles, and outputting the completed particle tree.
What am I doing wrong?
Another thing I tried was to replace the passing by value by calling
.clone(), but then i still get an error – this time
error: no method namedclone
found for typephysics::particle::Particle<'a, T>
in the current scope with a hint to implement or put in scope
core::clone::Clone … I also didn’t manage to make this work.
Sorry for putting up links to the whole repo, but I’ve tried several times to make a MWE for this and failed miserably