I have two vecs
vecA: Vec<Cell<f32>>, vecB: Vec<Cell<f32>>
I want to maintain the following invaraints:
vecB.len() = vecA.len() * 2; forall i: vecB[2*i] = vecA[i]; vecB[2*i+1] vecA[i]
I never modify vecB directly (though I do read from it).
Now, is there a way to intercept/overload the /push operators on vecA so taht whenever vecA does a set or push, certain functions gets called to modify vecB in the corresponding way?
[The issue here is not ref, mut ref, or ownership. The issue here is “reactivity”, where modifying one var results in triggers that modifies another var.)