I have a large struct and in an infinite loop, I need to pass it into a function.
I don’t want to copy the entire struct and it’s read-only so I wanted to pass a reference to it which worked fine until
serde::Deserialize started to complain.
Then I tried passing a box and cloning the box around but im not very sure what happens when you clone a box is it just cloning the pointer variable or the entire thing so I gave up using this until its clear to me.
Last thing I tried passing an Rc it also works fine until
So im back to cloning a read-only struct all over the place and I guess it’s doing memory allocation and free all the time this way so whats the performant way of passing a data around while still being able to use serde?
And what does clone do on the box exactly is it cloning the entire data or just the pointer variable?