I have a problem where I create an object containing a vector of objects:
pub struct ParticleSystem {
particles: Vec<Particle>
}
impl ParticleSystem {
pub fn new() -> ParticleSystem {
ParticleSystem {
particles: Vec::new()
}
}
}
I need to be able to access the vector within this object from within a function in the Particle class without passing ownership.
let mut system = ParticleSystem::new();
How would I go about passing a pointer to this through to the function? I'm quite new to rust. Thank you for your help, when i've tried it just passes ownership and interferes with other aspects of the program.