I am simulating a n body problem. I am writing equations as general so that they could be called on any struct types which implements certain traits.
But there is a problem with mutable references to the struct fields. I am stuck with this problem for a about 15 days now. I tried different designs but couldn’t figure it out. I am close, I need your help to complete it.
I want to get a mutable and a immutable reference of different struct fields in a equation. Code is at
FYI I can’t clone the vector, it is huge size. I have many other functions which takes references of the struct,
so I can’t write functions which will give mutable reference to specific types. Please give your answers keeping this as note.